Explicitly set jQuery as a dependency of converse.js
Also in utils.js and otr.js (this will help reach to goal of having a private jquery which doesn't pollute the global $ var).
This commit is contained in:
parent
5bad6b02b6
commit
0c83ac4524
|
@ -15,9 +15,9 @@
|
|||
var otr = dependencies.otr,
|
||||
moment = dependencies.moment;
|
||||
if (typeof otr !== "undefined") {
|
||||
return factory(jQuery, _, otr.OTR, otr.DSA, templates, moment);
|
||||
return factory(dependencies.jQuery, _, otr.OTR, otr.DSA, templates, moment);
|
||||
} else {
|
||||
return factory(jQuery, _, undefined, undefined, templates, moment);
|
||||
return factory(dependencies.jQuery, _, undefined, undefined, templates, moment);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -4576,7 +4576,7 @@
|
|||
rid += 1;
|
||||
this.session.save({rid: rid}); // The RID needs to be increased with each request.
|
||||
this.connection.attach(jid, sid, rid, this.onConnect);
|
||||
} else if (prebind) {
|
||||
} else if (this.prebind) {
|
||||
delete this.connection;
|
||||
this.emit('noResumeableSession');
|
||||
}
|
||||
|
@ -4656,6 +4656,7 @@
|
|||
},
|
||||
'off': function(evt, handler) {
|
||||
converse.off(evt, handler);
|
||||
}
|
||||
},
|
||||
'jQuery': $
|
||||
};
|
||||
}));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"otr",
|
||||
"moment",
|
||||
"locales",
|
||||
|
@ -12,8 +13,9 @@ define("converse-dependencies", [
|
|||
"strophe.roster",
|
||||
"strophe.vcard",
|
||||
"strophe.disco"
|
||||
], function(otr, moment) {
|
||||
], function($, otr, moment) {
|
||||
return {
|
||||
'jQuery': $,
|
||||
'otr': otr,
|
||||
'moment': moment
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"moment",
|
||||
"locales",
|
||||
"backbone.browserStorage",
|
||||
|
@ -11,8 +12,9 @@ define("converse-dependencies", [
|
|||
"strophe.roster",
|
||||
"strophe.vcard",
|
||||
"strophe.disco"
|
||||
], function(moment) {
|
||||
], function($, moment) {
|
||||
return {
|
||||
'jQuery': $,
|
||||
'otr': undefined,
|
||||
'moment': moment
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"moment",
|
||||
"locales",
|
||||
"bootstrap", // XXX: Can be removed, only for https://conversejs.org
|
||||
|
@ -13,8 +14,9 @@ define("converse-dependencies", [
|
|||
"strophe.roster",
|
||||
"strophe.vcard",
|
||||
"strophe.disco"
|
||||
], function(moment) {
|
||||
], function($, moment) {
|
||||
return {
|
||||
'jQuery': $,
|
||||
'otr': undefined,
|
||||
'moment': moment
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"otr",
|
||||
"moment",
|
||||
"locales",
|
||||
|
@ -14,8 +15,9 @@ define("converse-dependencies", [
|
|||
"strophe.roster",
|
||||
"strophe.vcard",
|
||||
"strophe.disco"
|
||||
], function(otr, moment) {
|
||||
], function($, otr, moment) {
|
||||
return {
|
||||
'jQuery': $,
|
||||
'otr': otr,
|
||||
'moment': moment
|
||||
};
|
||||
|
|
3
src/jquery-private.js
vendored
Normal file
3
src/jquery-private.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
define(['jquery'], function (jq) {
|
||||
return jq.noConflict( true );
|
||||
});
|
|
@ -13,10 +13,11 @@
|
|||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define([
|
||||
"bigint"
|
||||
, "crypto"
|
||||
, "eventemitter"
|
||||
], function (BigInt, CryptoJS, EventEmitter) {
|
||||
"jquery",
|
||||
"bigint",
|
||||
"crypto",
|
||||
"eventemitter"
|
||||
], function ($, BigInt, CryptoJS, EventEmitter) {
|
||||
if ($.browser.msie) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
19
src/utils.js
19
src/utils.js
|
@ -1,10 +1,11 @@
|
|||
jQuery.fn.hasScrollBar = function() {
|
||||
if (!$.contains(document, this.get(0))) {
|
||||
define(["jquery"], function ($) {
|
||||
$.fn.hasScrollBar = function() {
|
||||
if (!$.contains(document, this.get(0))) {
|
||||
return false;
|
||||
}
|
||||
if(this.parent().height() < this.get(0).scrollHeight) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(this.parent().height() < this.get(0).scrollHeight) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user