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",
|
||||
["converse-dependencies", "converse-templates"],
|
||||
function (dependencies, templates) {
|
||||
var otr = dependencies.otr;
|
||||
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
|
||||
);
|
||||
}
|
||||
return factory(dependencies, templates);
|
||||
}
|
||||
);
|
||||
} 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";
|
||||
// Cannot use this due to Safari bug.
|
||||
// See https://github.com/jcbrand/converse.js/issues/196
|
||||
@ -5288,7 +5279,7 @@
|
||||
},
|
||||
'env': {
|
||||
'jQuery': $,
|
||||
'Strophe': Strophe,
|
||||
'Strophe': Strophe, // TODO: this must be wrapped
|
||||
'_': _
|
||||
},
|
||||
|
||||
|
3
dev.html
3
dev.html
@ -248,7 +248,8 @@
|
||||
play_sounds: true,
|
||||
roster_groups: true,
|
||||
show_controlbox_by_default: true,
|
||||
xhr_user_search: false
|
||||
xhr_user_search: false,
|
||||
debug: true
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
26
main.js
26
main.js
@ -1,9 +1,9 @@
|
||||
var config;
|
||||
if (typeof(require) === 'undefined') {
|
||||
/* 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
|
||||
* tests/main.js.
|
||||
*/
|
||||
* We want to save the configuration in a variable so that we can reuse it in
|
||||
* tests/main.js.
|
||||
*/
|
||||
require = {
|
||||
config: function (c) {
|
||||
config = c;
|
||||
@ -27,7 +27,14 @@ require.config({
|
||||
"jquery.browser": "components/jquery.browser/index",
|
||||
"jquery.easing": "components/jquery-easing-original/index", // XXX: Only required for https://conversejs.org website
|
||||
"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.muc": "components/strophe.muc/index",
|
||||
"strophe.roster": "src/strophe.roster",
|
||||
@ -161,12 +168,11 @@ require.config({
|
||||
'crypto.sha1': { deps: ['crypto.core'] },
|
||||
'crypto.sha256': { deps: ['crypto.core'] },
|
||||
'bigint': { deps: ['crypto'] },
|
||||
'strophe': { exports: 'Strophe' },
|
||||
'strophe.disco': { deps: ['strophe'] },
|
||||
'strophe.muc': { deps: ['strophe'] },
|
||||
'strophe.register': { deps: ['strophe'] },
|
||||
'strophe.roster': { deps: ['strophe'] },
|
||||
'strophe.vcard': { deps: ['strophe'] }
|
||||
'strophe.disco': { deps: ['strophe-full'] },
|
||||
'strophe.muc': { deps: ['strophe-full'] },
|
||||
'strophe.register': { deps: ['strophe-full'] },
|
||||
'strophe.roster': { deps: ['strophe-full'] },
|
||||
'strophe.vcard': { deps: ['strophe-full'] }
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,24 +1,26 @@
|
||||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"underscore",
|
||||
"utils",
|
||||
"otr",
|
||||
"moment",
|
||||
"strophe-full",
|
||||
"strophe.muc",
|
||||
"strophe.roster",
|
||||
"strophe.vcard",
|
||||
"strophe.disco",
|
||||
"bootstrapJS", // XXX: Only for https://conversejs.org
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
"jquery.browser",
|
||||
"jquery.easing", // XXX: Only for https://conversejs.org
|
||||
"typeahead",
|
||||
"strophe",
|
||||
"strophe.muc",
|
||||
"strophe.roster",
|
||||
"strophe.vcard",
|
||||
"strophe.disco"
|
||||
], function($, utils, otr, moment) {
|
||||
return {
|
||||
"typeahead"
|
||||
], function($, _, utils, otr, moment, Strophe) {
|
||||
return _.extend({
|
||||
'underscore': _,
|
||||
'jQuery': $,
|
||||
'otr': otr,
|
||||
'moment': moment,
|
||||
'utils': utils
|
||||
};
|
||||
}, Strophe);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user