From 9be07dffd70242b10fb6fec1098c5c0b60098532 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Tue, 30 Sep 2014 00:01:31 +0400 Subject: [PATCH] Small fixes Release commit --- dev/Common/Utils.js | 33 +++++++++++++++++++++------------ dev/Settings/App/General.js | 22 ++++++++++++---------- package.json | 2 +- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index bc8f5608d..b7a5a32d8 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -5,7 +5,7 @@ var oEncryptObject = null, - + Utils = {}, window = require('window'), @@ -204,12 +204,12 @@ { var sResultValue = false, - oEncrypt = Utils.rsaObject(sPublicKey); + oEncrypt = Utils.rsaObject(sPublicKey) ; if (oEncrypt) { - sResultValue = oEncrypt.encrypt(Utils.fakeMd5() + ':' + sValue + ':' + Utils.fakeMd5()) + sResultValue = oEncrypt.encrypt(Utils.fakeMd5() + ':' + sValue + ':' + Utils.fakeMd5()); if (false !== sResultValue && Utils.isNormal(sResultValue)) { return 'rsa:xxx:' + sResultValue; @@ -1186,6 +1186,14 @@ return (new Date()).getTime(); }; + /** + * @return {number} + */ + Utils.timestamp = function () + { + return window.Math.round(Utils.microtime() / 1000); + }; + /** * * @param {string} sLanguage @@ -1932,24 +1940,25 @@ * @param {string} sLanguage * @param {Function=} fDone * @param {Function=} fFail - * @param {Function=} fAllways */ - Utils.reloadLanguage = function (sLanguage, fDone, fFail, fAllways) + Utils.reloadLanguage = function (sLanguage, fDone, fFail) { + var iStart = Utils.microtime(); $.ajax({ 'url': require('Common/LinkBuilder').langLink(sLanguage), 'dataType': 'script', 'cache': true }) - .done(function () { - Utils.i18nReload(); - (fDone || Utils.emptyFunction)(); - }) .fail(fFail || Utils.emptyFunction) - .always(fAllways || Utils.emptyFunction) + .done(function () { + _.delay(function () { + Utils.i18nReload(); + (fDone || Utils.emptyFunction)(); + }, 500 < Utils.microtime() - iStart ? 1 : 500); + }) ; }; - + /** * @param {Object} oParams */ @@ -1959,7 +1968,7 @@ _.each(oParams, function (sKey, sValue) { aContent.push('' + sKey + '=' + sValue); }); - + $('#rl-head-viewport').attr('content', aContent.join(', ')); }; diff --git a/dev/Settings/App/General.js b/dev/Settings/App/General.js index 1a867f7aa..00db21280 100644 --- a/dev/Settings/App/General.js +++ b/dev/Settings/App/General.js @@ -67,22 +67,24 @@ _.delay(function () { var - f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self) + f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self), + fReloadLanguageHelper = function (iSaveSettingsStep) { + return function() { + self.languageTrigger(iSaveSettingsStep); + _.delay(function () { + self.languageTrigger(Enums.SaveSettingsStep.Idle); + }, 1000); + }; + } ; Data.language.subscribe(function (sValue) { self.languageTrigger(Enums.SaveSettingsStep.Animate); - Utils.reloadLanguage(sValue, function() { - self.languageTrigger(Enums.SaveSettingsStep.TrueResult); - }, function() { - self.languageTrigger(Enums.SaveSettingsStep.FalseResult); - }, function() { - _.delay(function () { - self.languageTrigger(Enums.SaveSettingsStep.Idle); - }, 1000); - }); + Utils.reloadLanguage(sValue, + fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult), + fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult)); Remote.saveSettings(null, { 'Language': sValue diff --git a/package.json b/package.json index 2245299c7..2baf4e043 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "RainLoop", "title": "RainLoop Webmail", "version": "1.6.9", - "release": "167", + "release": "169", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "gulpfile.js",