From 4bbfd5045e94b86eb2d73ad3efb39c144d291318 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 30 Jan 2017 20:29:04 +0100 Subject: [PATCH 1/2] ensure that JS is *really* only initialized after the DOM is fully loaded, resolves #166 --- js/privatebin.js | 13 ++++++------- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index fed80c3..6ed88f0 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -397,27 +397,26 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { }, /** - * load translations into cache, then execute callback function + * load translations into cache, then trigger controller initialization * * @name i18n.loadTranslations * @function - * @param {Function} callback */ - loadTranslations: function(callback) + loadTranslations: function() { var selectedLang = helper.getCookie('lang'); var language = selectedLang.length > 0 ? selectedLang : (navigator.language || navigator.userLanguage).substring(0, 2); // note that 'en' is built in, so no translation is necessary - if (this.supportedLanguages.indexOf(language) === -1) + if (i18n.supportedLanguages.indexOf(language) === -1) { - callback(); + controller.init(); } else { $.getJSON('i18n/' + language + '.json', function(data) { i18n.language = language; i18n.translations = data; - callback(); + controller.init(); }); } }, @@ -1713,7 +1712,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { * main application start, called when DOM is fully loaded and * runs controller initalization after translations are loaded */ - $(i18n.loadTranslations($.proxy(controller.init, controller))); + $(i18n.loadTranslations); return { helper: helper, diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 723b3e9..8938112 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index b8c343b..66a814e 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - + From 920f02e43d04968b45c5b08401c3857f4e396566 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 30 Jan 2017 20:36:38 +0100 Subject: [PATCH 2/2] fixing composer package versions, thanks @jelhan (#84) --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 1a80bc5..b92f462 100644 --- a/composer.json +++ b/composer.json @@ -18,9 +18,9 @@ } ], "require": { - "php": "^5.2.6 || ^7.0", - "paragonie/random_compat": "^2.0", - "yzalis/identicon": "^1.1" + "php": "^5.3.0 || ^7.0", + "paragonie/random_compat": "2.0.4", + "yzalis/identicon": "1.1.0" }, "require-dev": { "codacy/coverage": "dev-master",