diff --git a/src/converse-ping.js b/src/converse-ping.js index 9482f46e5..74038a182 100644 --- a/src/converse-ping.js +++ b/src/converse-ping.js @@ -56,7 +56,9 @@ }; _converse.registerPongHandler = function () { - _converse.connection.disco.addFeature(Strophe.NS.PING); + if (!_.isUndefined(_converse.connection.disco)) { + _converse.connection.disco.addFeature(Strophe.NS.PING); + } _converse.connection.ping.addPingHandler(_converse.pong); }; diff --git a/src/utils.js b/src/utils.js index 222d8db62..72d57eaaf 100755 --- a/src/utils.js +++ b/src/utils.js @@ -6,7 +6,7 @@ // Copyright (c) 2012-2017, Jan-Carel Brand // Licensed under the Mozilla Public License (MPLv2) // -/*global define, escape, locales, Jed */ +/*global define, escape, locales, window */ (function (root, factory) { define([ "sizzle", @@ -86,8 +86,11 @@ // Translation machinery // --------------------- u.__ = function (str) { + if (_.isUndefined(window.Jed)) { + return str; + } if (!u.isConverseLocale(this.locale) || this.locale === 'en') { - return Jed.sprintf.apply(Jed, arguments); + return Jed.sprintf.apply(window.Jed, arguments); } if (typeof this.jed === "undefined") { this.jed = new Jed(window.JSON.parse(locales[this.locale]));