Explicitly list dependencies for modules
Instead of using the deps-*.js files. Builds will currently break, they still need to be reworked. Also moved the refreshWebkit method to utils.
This commit is contained in:
parent
e79c204241
commit
e68c51d2fa
@ -61,9 +61,7 @@ module.exports = function(grunt) {
|
||||
rjs + ' -o src/build-no-jquery.js &&' +
|
||||
rjs + ' -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
|
||||
rjs + ' -o src/build-no-locales-no-otr.js && ' +
|
||||
rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' +
|
||||
rjs + ' -o src/build-no-otr.js &&' +
|
||||
rjs + ' -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js', callback);
|
||||
rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js', callback);
|
||||
// XXX: It might be possible to not have separate build config files. For example:
|
||||
// 'r.js -o src/build.js paths.converse-dependencies=src/deps-no-otr paths.locales=locale/nolocales out=builds/converse-no-locales-no-otr.min.js'
|
||||
});
|
||||
|
1
main.js
1
main.js
@ -50,7 +50,6 @@ require.config({
|
||||
"converse-otr": "src/converse-otr",
|
||||
"converse-ping": "src/converse-ping",
|
||||
"converse-register": "src/converse-register",
|
||||
"converse-dependencies": "src/deps-full",
|
||||
"converse-templates": "src/templates",
|
||||
|
||||
// Off-the-record-encryption
|
||||
|
@ -5,7 +5,6 @@
|
||||
include: ['main'],
|
||||
mainConfigFile: '../main.js',
|
||||
paths: {
|
||||
"converse-dependencies": "src/deps-full",
|
||||
"jquery": "src/jquery-external",
|
||||
"jquery-private": "src/jquery-private-external",
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
mainConfigFile: '../main.js',
|
||||
paths: {
|
||||
"moment_with_locales": "components/momentjs/moment",
|
||||
"converse-dependencies": "src/deps-no-otr",
|
||||
"locales": "locale/nolocales"
|
||||
}
|
||||
})
|
||||
|
@ -3,8 +3,5 @@
|
||||
name: "components/almond/almond.js",
|
||||
out: "../builds/converse.min.js",
|
||||
include: ['main'],
|
||||
mainConfigFile: '../main.js',
|
||||
paths: {
|
||||
"converse-dependencies": "src/deps-full"
|
||||
}
|
||||
mainConfigFile: '../main.js'
|
||||
})
|
||||
|
@ -15,28 +15,35 @@
|
||||
//
|
||||
// The dependencies are then split up and passed into the factory function,
|
||||
// which contains and instantiates converse.js.
|
||||
define("converse-core", ["converse-dependencies", "converse-templates"],
|
||||
function (dependencies, templates) {
|
||||
return factory(
|
||||
templates,
|
||||
dependencies.jQuery,
|
||||
dependencies.$iq,
|
||||
dependencies.$msg,
|
||||
dependencies.$pres,
|
||||
dependencies.$build,
|
||||
dependencies.Strophe,
|
||||
dependencies.underscore,
|
||||
dependencies.moment,
|
||||
dependencies.utils,
|
||||
dependencies.SHA1.b64_sha1
|
||||
);
|
||||
}
|
||||
);
|
||||
}(this, function (templates, $, $iq, $msg, $pres, $build, Strophe, _, moment, utils, b64_sha1) {
|
||||
/* "use strict";
|
||||
define("converse-core", [
|
||||
"jquery",
|
||||
"underscore",
|
||||
"polyfill",
|
||||
"utils",
|
||||
"moment_with_locales",
|
||||
"strophe",
|
||||
"converse-templates",
|
||||
"strophe.disco",
|
||||
"strophe.rsm",
|
||||
"strophe.vcard",
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
"typeahead",
|
||||
], factory);
|
||||
}(this, function ($, _, dummy, utils, moment, Strophe, templates) {
|
||||
/*
|
||||
* Cannot use this due to Safari bug.
|
||||
* See https://github.com/jcbrand/converse.js/issues/196
|
||||
*/
|
||||
// "use strict";
|
||||
|
||||
// Strophe globals
|
||||
var $build = Strophe.$build;
|
||||
var $iq = Strophe.$iq;
|
||||
var $msg = Strophe.$msg;
|
||||
var $pres = Strophe.$pres;
|
||||
var b64_sha1 = Strophe.SHA1.b64_sha1;
|
||||
Strophe = Strophe.Strophe;
|
||||
|
||||
// Use Mustache style syntax for variable interpolation
|
||||
/* Configuration of underscore templates (this config is distinct to the
|
||||
@ -61,17 +68,6 @@
|
||||
},
|
||||
off: function (evt, handler) {
|
||||
$(this).unbind(evt, handler);
|
||||
},
|
||||
refreshWebkit: function () {
|
||||
/* This works around a webkit bug. Refresh the browser's viewport,
|
||||
* otherwise chatboxes are not moved along when one is closed.
|
||||
*/
|
||||
if ($.browser.webkit) {
|
||||
var conversejs = document.getElementById('conversejs');
|
||||
conversejs.style.display = 'none';
|
||||
conversejs.offsetHeight = conversejs.offsetHeight;
|
||||
conversejs.style.display = 'block';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1058,7 +1054,7 @@
|
||||
this.renderToolbar().renderAvatar();
|
||||
this.$content.on('scroll', _.debounce(this.onScroll.bind(this), 100));
|
||||
converse.emit('chatBoxOpened', this);
|
||||
window.setTimeout(converse.refreshWebkit, 50);
|
||||
window.setTimeout(utils.refreshWebkit, 50);
|
||||
return this.showStatusMessage();
|
||||
},
|
||||
|
||||
@ -1718,7 +1714,7 @@
|
||||
* to make space available if need be.
|
||||
*/
|
||||
chatboxviews.trimChats(this);
|
||||
converse.refreshWebkit();
|
||||
utils.refreshWebkit();
|
||||
this.$content.scrollTop(this.model.get('scroll'));
|
||||
this.setChatState(ACTIVE).focus();
|
||||
converse.emit('chatBoxMaximized', this);
|
||||
@ -1731,7 +1727,7 @@
|
||||
this.model.save({'scroll': this.$content.scrollTop()});
|
||||
// Minimizes a chat box
|
||||
this.setChatState(INACTIVE).model.minimize();
|
||||
this.$el.hide('fast', converse.refreshwebkit);
|
||||
this.$el.hide('fast', utils.refreshwebkit);
|
||||
converse.emit('chatBoxMinimized', this);
|
||||
},
|
||||
|
||||
@ -1812,7 +1808,7 @@
|
||||
hide: function () {
|
||||
if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
|
||||
this.$el.hide();
|
||||
converse.refreshWebkit();
|
||||
utils.refreshWebkit();
|
||||
}
|
||||
return this;
|
||||
},
|
||||
@ -2086,7 +2082,7 @@
|
||||
|
||||
hide: function (callback) {
|
||||
this.$el.hide('fast', function () {
|
||||
converse.refreshWebkit();
|
||||
utils.refreshWebkit();
|
||||
converse.emit('chatBoxClosed', this);
|
||||
converse.controlboxtoggle.show(function () {
|
||||
if (typeof callback === "function") {
|
||||
@ -2103,7 +2099,7 @@
|
||||
if (converse.rosterview) {
|
||||
converse.rosterview.update();
|
||||
}
|
||||
converse.refreshWebkit();
|
||||
utils.refreshWebkit();
|
||||
}.bind(this));
|
||||
converse.emit('controlBoxOpened', this);
|
||||
}.bind(this));
|
||||
|
@ -10,7 +10,11 @@
|
||||
* as specified in XEP-0199 XMPP Ping.
|
||||
*/
|
||||
(function (root, factory) {
|
||||
define("converse-ping", ["converse-core", "converse-api"], factory);
|
||||
define("converse-ping", [
|
||||
"converse-core",
|
||||
"converse-api",
|
||||
"strophe.ping"
|
||||
], factory);
|
||||
}(this, function (converse, converse_api) {
|
||||
"use strict";
|
||||
// Strophe methods for building stanzas
|
||||
|
@ -1,23 +0,0 @@
|
||||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"underscore",
|
||||
"polyfill",
|
||||
"utils",
|
||||
"moment_with_locales",
|
||||
"strophe",
|
||||
"strophe.disco",
|
||||
"strophe.ping",
|
||||
"strophe.rsm",
|
||||
"strophe.vcard",
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
"jquery.browser",
|
||||
"typeahead"
|
||||
], function($, _, dummy, utils, moment, Strophe) {
|
||||
return _.extend({
|
||||
'underscore': _,
|
||||
'jQuery': $,
|
||||
'moment': moment,
|
||||
'utils': utils
|
||||
}, Strophe);
|
||||
});
|
@ -1,24 +0,0 @@
|
||||
define("converse-dependencies", [
|
||||
"jquery",
|
||||
"underscore",
|
||||
"polyfill",
|
||||
"utils",
|
||||
"moment_with_locales",
|
||||
"strophe",
|
||||
"strophe.disco",
|
||||
"strophe.ping",
|
||||
"strophe.rsm",
|
||||
"strophe.vcard",
|
||||
"backbone.browserStorage",
|
||||
"backbone.overview",
|
||||
"jquery.browser",
|
||||
"typeahead"
|
||||
], function($, _, dummy, utils, moment, Strophe) {
|
||||
return _.extend({
|
||||
'underscore': _,
|
||||
'jQuery': $,
|
||||
'otr': undefined,
|
||||
'moment': moment,
|
||||
'utils': utils
|
||||
}, Strophe);
|
||||
});
|
29
src/utils.js
29
src/utils.js
@ -1,11 +1,14 @@
|
||||
/*global jQuery, templates, escape, _, locales */
|
||||
/*global escape */
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(["jquery", "underscore", "jed", "converse-templates", "locales"], factory);
|
||||
} else {
|
||||
root.utils = factory(jQuery, _, templates, locales);
|
||||
}
|
||||
}(this, function ($, _, Jed, templates, locales) {
|
||||
define([
|
||||
"jquery",
|
||||
"jquery.browser",
|
||||
"underscore",
|
||||
"jed",
|
||||
"converse-templates",
|
||||
"locales"
|
||||
], factory);
|
||||
}(this, function ($, dummy, _, Jed, templates, locales) {
|
||||
"use strict";
|
||||
|
||||
var XFORM_TYPE_MAP = {
|
||||
@ -121,6 +124,18 @@
|
||||
return str;
|
||||
},
|
||||
|
||||
refreshWebkit: function () {
|
||||
/* This works around a webkit bug. Refreshes the browser's viewport,
|
||||
* otherwise chatboxes are not moved along when one is closed.
|
||||
*/
|
||||
if ($.browser.webkit) {
|
||||
var conversejs = document.getElementById('conversejs');
|
||||
conversejs.style.display = 'none';
|
||||
var tmp = conversejs.offsetHeight; // jshint ignore:line
|
||||
conversejs.style.display = 'block';
|
||||
}
|
||||
},
|
||||
|
||||
webForm2xForm: function (field) {
|
||||
/* Takes an HTML DOM and turns it into an XForm field.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user