Use `noConflict` to avoid polluting globale namespace
with lodash and Backbone.
This commit is contained in:
parent
39b3aa34d8
commit
3ea43c6a0f
4
Makefile
4
Makefile
|
@ -150,9 +150,9 @@ dist/converse.min.js: src locale node_modules *.js
|
|||
dist/converse.js: src locale node_modules *.js
|
||||
$(RJS) -o src/build.js include=converse out=dist/converse.js optimize=none
|
||||
dist/converse-no-jquery.min.js: src locale node_modules *.js
|
||||
$(RJS) -o src/build.js include=converse wrap.endFile=end-no-jquery.frag exclude=jquery exclude=jquery-private out=dist/converse-no-jquery.min.js
|
||||
$(RJS) -o src/build.js include=converse wrap.endFile=end-no-jquery.frag exclude=jquery exclude=jquery.noconflict out=dist/converse-no-jquery.min.js
|
||||
dist/converse-no-jquery.js: src locale node_modules *.js
|
||||
$(RJS) -o src/build.js include=converse wrap.endFile=end-no-jquery.frag exclude=jquery exclude=jquery-private out=dist/converse-no-jquery.js optimize=none
|
||||
$(RJS) -o src/build.js include=converse wrap.endFile=end-no-jquery.frag exclude=jquery exclude=jquery.noconflict out=dist/converse-no-jquery.js optimize=none
|
||||
dist/converse-no-dependencies.min.js: src locale node_modules *.js
|
||||
$(RJS) -o src/build-no-dependencies.js
|
||||
dist/converse-no-dependencies.js: src locale node_modules *.js
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
- sinon 2.1.0
|
||||
- eslint 3.19.0
|
||||
|
||||
- Use `noConflict` to avoid polluting globale namespace with lodash and Backbone. [jcbrand]
|
||||
- Bugfix: MUC user's nickname wasn't being shown in HTML5 notification messages. [jcbrand]
|
||||
- Bugfix: OTR meta-messages were being shown in HTML5 notifications. [jcbrand]
|
||||
- CSS fix: Icon lock wasn't showing. [jcbrand]
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/*global define */
|
||||
define(['backbone'], function (Backbone) {
|
||||
return Backbone.noConflict();
|
||||
});
|
|
@ -26,7 +26,7 @@
|
|||
exclude: [
|
||||
"awesomplete",
|
||||
"jquery",
|
||||
"jquery-private",
|
||||
"jquery.noconflict",
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
"moment_with_locales",
|
||||
|
|
|
@ -18,12 +18,13 @@ require.config({
|
|||
"almond": "node_modules/almond/almond",
|
||||
"awesomplete": "node_modules/awesomplete/awesomplete",
|
||||
"backbone": "node_modules/backbone/backbone",
|
||||
"backbone.noconflict": "src/backbone.noconflict",
|
||||
"backbone.browserStorage": "node_modules/backbone.browserStorage/backbone.browserStorage",
|
||||
"backbone.overview": "node_modules/backbone.overview/backbone.overview",
|
||||
"eventemitter": "node_modules/otr/build/dep/eventemitter",
|
||||
"es6-promise": "node_modules/es6-promise/dist/es6-promise",
|
||||
"jquery": "node_modules/jquery/dist/jquery",
|
||||
"jquery-private": "src/jquery-private",
|
||||
"jquery.noconflict": "src/jquery.noconflict",
|
||||
"jquery.browser": "node_modules/jquery.browser/dist/jquery.browser",
|
||||
"jquery.easing": "node_modules/jquery-easing/jquery.easing.1.3.umd", // XXX: Only required for https://conversejs.org website
|
||||
"pluggable": "node_modules/pluggable.js/dist/pluggable",
|
||||
|
@ -38,6 +39,7 @@ require.config({
|
|||
"tpl": "node_modules/lodash-template-loader/loader",
|
||||
"typeahead": "components/typeahead.js/index",
|
||||
"lodash": "node_modules/lodash/lodash",
|
||||
"lodash.noconflict": "src/lodash.noconflict",
|
||||
"underscore": "src/underscore-shim",
|
||||
"utils": "src/utils",
|
||||
|
||||
|
@ -166,18 +168,20 @@ require.config({
|
|||
}],
|
||||
|
||||
map: {
|
||||
// '*' means all modules will get 'jquery-private'
|
||||
// for their 'jquery' dependency.
|
||||
// '*' means all modules will get the '*.noconflict' version
|
||||
// as their dependency.
|
||||
'*': {
|
||||
'jquery': 'jquery-private',
|
||||
'jquery': 'jquery.noconflict',
|
||||
'backbone': 'backbone.noconflict',
|
||||
'lodash': 'lodash.noconflict',
|
||||
'underscore': 'lodash.noconflict'
|
||||
},
|
||||
'backbone': {
|
||||
"underscore": "lodash"
|
||||
},
|
||||
// 'jquery-private' wants the real jQuery module
|
||||
// though. If this line was not here, there would
|
||||
// '*.noconflict' wants the real module
|
||||
// If this line was not here, there would
|
||||
// be an unresolvable cyclic dependency.
|
||||
'jquery-private': { 'jquery': 'jquery' }
|
||||
'backbone.noconflict': { 'backbone': 'backbone' },
|
||||
'jquery.noconflict': { 'jquery': 'jquery' },
|
||||
'lodash.noconflict': { 'lodash': 'lodash' }
|
||||
},
|
||||
|
||||
lodashLoader: {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define */
|
||||
/*global define */
|
||||
|
||||
/* This is a Converse.js plugin which add support for bookmarks specified
|
||||
* in XEP-0048.
|
||||
|
@ -30,6 +30,7 @@
|
|||
) {
|
||||
|
||||
var $ = converse.env.jQuery,
|
||||
Backbone = converse.env.Backbone,
|
||||
Strophe = converse.env.Strophe,
|
||||
$iq = converse.env.$iq,
|
||||
b64_sha1 = converse.env.b64_sha1,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define */
|
||||
/*global define */
|
||||
|
||||
(function (root, factory) {
|
||||
define([
|
||||
|
@ -27,11 +27,12 @@
|
|||
) {
|
||||
"use strict";
|
||||
var $ = converse.env.jQuery,
|
||||
utils = converse.env.utils,
|
||||
Strophe = converse.env.Strophe,
|
||||
$msg = converse.env.$msg,
|
||||
Backbone = converse.env.Backbone,
|
||||
Strophe = converse.env.Strophe,
|
||||
_ = converse.env._,
|
||||
moment = converse.env.moment;
|
||||
moment = converse.env.moment,
|
||||
utils = converse.env.utils;
|
||||
|
||||
var KEY = {
|
||||
ENTER: 13,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global define, Backbone */
|
||||
/*global define */
|
||||
|
||||
(function (root, factory) {
|
||||
define(["converse-core",
|
||||
|
@ -45,6 +45,7 @@
|
|||
var USERS_PANEL_ID = 'users';
|
||||
// Strophe methods for building stanzas
|
||||
var Strophe = converse.env.Strophe,
|
||||
Backbone = converse.env.Backbone,
|
||||
utils = converse.env.utils;
|
||||
// Other necessary globals
|
||||
var $ = converse.env.jQuery,
|
||||
|
|
|
@ -7,18 +7,19 @@
|
|||
/*global Backbone, define, window, document, JSON */
|
||||
(function (root, factory) {
|
||||
define(["sizzle",
|
||||
"jquery-private",
|
||||
"lodash",
|
||||
"jquery.noconflict",
|
||||
"lodash.noconflict",
|
||||
"polyfill",
|
||||
"utils",
|
||||
"moment_with_locales",
|
||||
"strophe",
|
||||
"pluggable",
|
||||
"backbone.noconflict",
|
||||
"strophe.disco",
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
], factory);
|
||||
}(this, function (sizzle, $, _, polyfill, utils, moment, Strophe, pluggable) {
|
||||
}(this, function (sizzle, $, _, polyfill, utils, moment, Strophe, pluggable, Backbone) {
|
||||
/* Cannot use this due to Safari bug.
|
||||
* See https://github.com/jcbrand/converse.js/issues/196
|
||||
*/
|
||||
|
@ -2267,12 +2268,13 @@
|
|||
'$iq': $iq,
|
||||
'$msg': $msg,
|
||||
'$pres': $pres,
|
||||
'Backbone': Backbone,
|
||||
'Strophe': Strophe,
|
||||
'b64_sha1': b64_sha1,
|
||||
'_': _,
|
||||
'b64_sha1': b64_sha1,
|
||||
'jQuery': $,
|
||||
'sizzle': sizzle,
|
||||
'moment': moment,
|
||||
'sizzle': sizzle,
|
||||
'utils': utils
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define, window */
|
||||
/*global define, window */
|
||||
|
||||
(function (root, factory) {
|
||||
define(["converse-core",
|
||||
|
@ -26,6 +26,7 @@
|
|||
"use strict";
|
||||
var $ = converse.env.jQuery,
|
||||
_ = converse.env._,
|
||||
Backbone = converse.env.Backbone,
|
||||
b64_sha1 = converse.env.b64_sha1,
|
||||
moment = converse.env.moment;
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone */
|
||||
(function (root, factory) {
|
||||
define(["converse-core", "converse-muc"], factory);
|
||||
}(this, function (converse) {
|
||||
"use strict";
|
||||
var Backbone = converse.env.Backbone;
|
||||
|
||||
converse.plugins.add('converse-muc-embedded', {
|
||||
overrides: {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define */
|
||||
/*global define */
|
||||
|
||||
/* This is a Converse.js plugin which add support for multi-user chat rooms, as
|
||||
* specified in XEP-0045 Multi-user chat.
|
||||
|
@ -56,6 +56,7 @@
|
|||
|
||||
// Strophe methods for building stanzas
|
||||
var Strophe = converse.env.Strophe,
|
||||
Backbone = converse.env.Backbone,
|
||||
$iq = converse.env.$iq,
|
||||
$build = converse.env.$build,
|
||||
$msg = converse.env.$msg,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define, window, crypto, CryptoJS */
|
||||
/*global define, window, crypto, CryptoJS */
|
||||
|
||||
/* This is a Converse.js plugin which add support Off-the-record (OTR)
|
||||
* encryption of one-on-one chat messages.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define */
|
||||
/*global define */
|
||||
|
||||
/* This is a Converse.js plugin which add support for in-band registration
|
||||
* as specified in XEP-0077.
|
||||
|
@ -30,6 +30,7 @@
|
|||
|
||||
// Strophe methods for building stanzas
|
||||
var Strophe = converse.env.Strophe,
|
||||
Backbone = converse.env.Backbone,
|
||||
utils = converse.env.utils,
|
||||
$iq = converse.env.$iq;
|
||||
// Other necessary globals
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
|
||||
// Licensed under the Mozilla Public License (MPLv2)
|
||||
//
|
||||
/*global Backbone, define */
|
||||
/*global define */
|
||||
|
||||
(function (root, factory) {
|
||||
define(["converse-core",
|
||||
|
@ -25,6 +25,7 @@
|
|||
tpl_roster_item) {
|
||||
"use strict";
|
||||
var $ = converse.env.jQuery,
|
||||
Backbone = converse.env.Backbone,
|
||||
utils = converse.env.utils,
|
||||
Strophe = converse.env.Strophe,
|
||||
$iq = converse.env.$iq,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
define('jquery', [], function () { return jQuery; });
|
||||
define('jquery-private', [], function () { return jQuery; });
|
||||
define('jquery.noconflict', [], function () { return jQuery; });
|
||||
define('jquery.browser', [], function () { return jQuery; });
|
||||
define('awesomplete', [], function () { return jQuery; });
|
||||
define('lodash', [], function () { return _; });
|
||||
define('lodash.noconflict', [], function () { return _; });
|
||||
define('moment_with_locales', [], function () { return moment; });
|
||||
define('strophe', [], function () {
|
||||
return {
|
||||
|
@ -26,7 +27,8 @@
|
|||
define('strophe.ping', ['strophe'], strophePlugin);
|
||||
define('strophe.rsm', ['strophe'], strophePlugin);
|
||||
define('strophe.vcard', ['strophe'], strophePlugin);
|
||||
define('backbone', [], emptyFunction);
|
||||
define('backbone', [], function () { return Backbone; });
|
||||
define('backbone.noconflict', [], function () { return Backbone; });
|
||||
define('backbone.browserStorage', ['backbone'], emptyFunction);
|
||||
define('backbone.overview', ['backbone'], emptyFunction);
|
||||
define('otr', [], function () { return { 'DSA': DSA, 'OTR': OTR };});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define('jquery', [], function () { return jQuery; });
|
||||
define('jquery-private', [], function () { return jQuery; });
|
||||
define('jquery.noconflict', [], function () { return jQuery; });
|
||||
return require('converse');
|
||||
}));
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/*global define */
|
||||
define(['lodash'], function (_) {
|
||||
return _.noConflict();
|
||||
});
|
|
@ -1,9 +1,9 @@
|
|||
/*global define, escape, locales, Jed */
|
||||
(function (root, factory) {
|
||||
define([
|
||||
"jquery-private",
|
||||
"jquery.noconflict",
|
||||
"jquery.browser",
|
||||
"lodash",
|
||||
"lodash.noconflict",
|
||||
"locales",
|
||||
"moment_with_locales",
|
||||
"tpl!field",
|
||||
|
|
Loading…
Reference in New Issue