Initial work on letting converse.js use the AMD version of strophe.js
This commit is contained in:
parent
6aa38952ab
commit
b7643eaba0
41
converse.js
41
converse.js
@ -12,34 +12,25 @@
|
|||||||
define("converse",
|
define("converse",
|
||||||
["converse-dependencies", "converse-templates"],
|
["converse-dependencies", "converse-templates"],
|
||||||
function (dependencies, templates) {
|
function (dependencies, templates) {
|
||||||
var otr = dependencies.otr;
|
return factory(dependencies, templates);
|
||||||
if (typeof otr !== "undefined") {
|
|
||||||
return factory(
|
|
||||||
dependencies.jQuery,
|
|
||||||
_,
|
|
||||||
otr.OTR,
|
|
||||||
otr.DSA,
|
|
||||||
templates,
|
|
||||||
dependencies.moment,
|
|
||||||
dependencies.utils
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return factory(
|
|
||||||
dependencies.jQuery,
|
|
||||||
_,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
templates,
|
|
||||||
dependencies.moment,
|
|
||||||
dependencies.utils
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
root.converse = factory(jQuery, _, OTR, DSA, templates, moment, utils);
|
root.converse = factory(dependencies, templates);
|
||||||
}
|
}
|
||||||
}(this, function ($, _, OTR, DSA, templates, moment, utils) {
|
}(this, function (dependencies, templates) {
|
||||||
|
var $ = dependencies.jQuery;
|
||||||
|
var $iq = dependencies.$iq;
|
||||||
|
var $msg = dependencies.$msg;
|
||||||
|
var $pres = dependencies.$pres;
|
||||||
|
var DSA = dependencies.otr ? dependencies.otr.DSA : undefined;
|
||||||
|
var OTR = dependencies.otr ? dependencies.otr.OTR : undefined;
|
||||||
|
var Strophe = dependencies.Strophe;
|
||||||
|
var _ = dependencies.underscore;
|
||||||
|
var moment = dependencies.moment;
|
||||||
|
var utils = dependencies.utils;
|
||||||
|
var b64_sha1 = depencencies.SHA1.b64_sha1;
|
||||||
|
|
||||||
// "use strict";
|
// "use strict";
|
||||||
// Cannot use this due to Safari bug.
|
// Cannot use this due to Safari bug.
|
||||||
// See https://github.com/jcbrand/converse.js/issues/196
|
// See https://github.com/jcbrand/converse.js/issues/196
|
||||||
@ -5288,7 +5279,7 @@
|
|||||||
},
|
},
|
||||||
'env': {
|
'env': {
|
||||||
'jQuery': $,
|
'jQuery': $,
|
||||||
'Strophe': Strophe,
|
'Strophe': Strophe, // TODO: this must be wrapped
|
||||||
'_': _
|
'_': _
|
||||||
},
|
},
|
||||||
|
|
||||||
|
3
dev.html
3
dev.html
@ -248,7 +248,8 @@
|
|||||||
play_sounds: true,
|
play_sounds: true,
|
||||||
roster_groups: true,
|
roster_groups: true,
|
||||||
show_controlbox_by_default: true,
|
show_controlbox_by_default: true,
|
||||||
xhr_user_search: false
|
xhr_user_search: false,
|
||||||
|
debug: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
26
main.js
26
main.js
@ -1,9 +1,9 @@
|
|||||||
var config;
|
var config;
|
||||||
if (typeof(require) === 'undefined') {
|
if (typeof(require) === 'undefined') {
|
||||||
/* XXX: Hack to work around r.js's stupid parsing.
|
/* XXX: Hack to work around r.js's stupid parsing.
|
||||||
* We want to save the configuration in a variable so that we can reuse it in
|
* We want to save the configuration in a variable so that we can reuse it in
|
||||||
* tests/main.js.
|
* tests/main.js.
|
||||||
*/
|
*/
|
||||||
require = {
|
require = {
|
||||||
config: function (c) {
|
config: function (c) {
|
||||||
config = c;
|
config = c;
|
||||||
@ -27,7 +27,14 @@ require.config({
|
|||||||
"jquery.browser": "components/jquery.browser/index",
|
"jquery.browser": "components/jquery.browser/index",
|
||||||
"jquery.easing": "components/jquery-easing-original/index", // XXX: Only required for https://conversejs.org website
|
"jquery.easing": "components/jquery-easing-original/index", // XXX: Only required for https://conversejs.org website
|
||||||
"moment": "components/momentjs/moment",
|
"moment": "components/momentjs/moment",
|
||||||
"strophe": "components/strophe/strophe",
|
"strophe-base64": "components/strophe/src/base64",
|
||||||
|
"strophe-bosh": "components/strophe/src/bosh",
|
||||||
|
"strophe-core": "components/strophe/src/core",
|
||||||
|
"strophe-full": "components/strophe/src/wrapper",
|
||||||
|
"strophe-md5": "components/strophe/src/md5",
|
||||||
|
"strophe-sha1": "components/strophe/src/sha1",
|
||||||
|
"strophe-websocket": "components/strophe/src/websocket",
|
||||||
|
"strophe-polyfill": "components/strophe/src/polyfill",
|
||||||
"strophe.disco": "components/strophejs-plugins/disco/strophe.disco",
|
"strophe.disco": "components/strophejs-plugins/disco/strophe.disco",
|
||||||
"strophe.muc": "components/strophe.muc/index",
|
"strophe.muc": "components/strophe.muc/index",
|
||||||
"strophe.roster": "src/strophe.roster",
|
"strophe.roster": "src/strophe.roster",
|
||||||
@ -161,12 +168,11 @@ require.config({
|
|||||||
'crypto.sha1': { deps: ['crypto.core'] },
|
'crypto.sha1': { deps: ['crypto.core'] },
|
||||||
'crypto.sha256': { deps: ['crypto.core'] },
|
'crypto.sha256': { deps: ['crypto.core'] },
|
||||||
'bigint': { deps: ['crypto'] },
|
'bigint': { deps: ['crypto'] },
|
||||||
'strophe': { exports: 'Strophe' },
|
'strophe.disco': { deps: ['strophe-full'] },
|
||||||
'strophe.disco': { deps: ['strophe'] },
|
'strophe.muc': { deps: ['strophe-full'] },
|
||||||
'strophe.muc': { deps: ['strophe'] },
|
'strophe.register': { deps: ['strophe-full'] },
|
||||||
'strophe.register': { deps: ['strophe'] },
|
'strophe.roster': { deps: ['strophe-full'] },
|
||||||
'strophe.roster': { deps: ['strophe'] },
|
'strophe.vcard': { deps: ['strophe-full'] }
|
||||||
'strophe.vcard': { deps: ['strophe'] }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
define("converse-dependencies", [
|
define("converse-dependencies", [
|
||||||
"jquery",
|
"jquery",
|
||||||
|
"underscore",
|
||||||
"utils",
|
"utils",
|
||||||
"otr",
|
"otr",
|
||||||
"moment",
|
"moment",
|
||||||
|
"strophe-full",
|
||||||
|
"strophe.muc",
|
||||||
|
"strophe.roster",
|
||||||
|
"strophe.vcard",
|
||||||
|
"strophe.disco",
|
||||||
"bootstrapJS", // XXX: Only for https://conversejs.org
|
"bootstrapJS", // XXX: Only for https://conversejs.org
|
||||||
"backbone.browserStorage",
|
"backbone.browserStorage",
|
||||||
"backbone.overview",
|
"backbone.overview",
|
||||||
"jquery.browser",
|
"jquery.browser",
|
||||||
"jquery.easing", // XXX: Only for https://conversejs.org
|
"jquery.easing", // XXX: Only for https://conversejs.org
|
||||||
"typeahead",
|
"typeahead"
|
||||||
"strophe",
|
], function($, _, utils, otr, moment, Strophe) {
|
||||||
"strophe.muc",
|
return _.extend({
|
||||||
"strophe.roster",
|
'underscore': _,
|
||||||
"strophe.vcard",
|
|
||||||
"strophe.disco"
|
|
||||||
], function($, utils, otr, moment) {
|
|
||||||
return {
|
|
||||||
'jQuery': $,
|
'jQuery': $,
|
||||||
'otr': otr,
|
'otr': otr,
|
||||||
'moment': moment,
|
'moment': moment,
|
||||||
'utils': utils
|
'utils': utils
|
||||||
};
|
}, Strophe);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user