diff --git a/.jshintrc b/.jshintrc index d7ff8166c..25fd75f03 100644 --- a/.jshintrc +++ b/.jshintrc @@ -11,6 +11,7 @@ "regexp" : true, "undef" : true, "strict" : true, + "unused" : true, "asi" : false, "boss" : false, diff --git a/dev/Admin/AdminSettingsAbout.js b/dev/Admin/AdminSettingsAbout.js index 2cbd60f03..370763b7a 100644 --- a/dev/Admin/AdminSettingsAbout.js +++ b/dev/Admin/AdminSettingsAbout.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../External/ko.js') + ko = require('ko') ; /** @@ -85,4 +86,4 @@ module.exports = AdminSettingsAbout; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsBranding.js b/dev/Admin/AdminSettingsBranding.js index 8cef926a0..3c4e87b8d 100644 --- a/dev/Admin/AdminSettingsBranding.js +++ b/dev/Admin/AdminSettingsBranding.js @@ -1,13 +1,14 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Utils = require('../Common/Utils.js') + Utils = require('Utils') ; /** @@ -16,8 +17,8 @@ function AdminSettingsBranding() { var - Enums = require('../Common/Enums.js'), - AppSettings = require('..Storages/AppSettings.js') + Enums = require('Enums'), + AppSettings = require('../Storages/AppSettings.js') ; this.title = ko.observable(AppSettings.settingsGet('Title')); @@ -88,4 +89,4 @@ module.exports = AdminSettingsBranding; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsContacts.js b/dev/Admin/AdminSettingsContacts.js index 3ac75b6d3..d9810efc6 100644 --- a/dev/Admin/AdminSettingsContacts.js +++ b/dev/Admin/AdminSettingsContacts.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), AppSettings = require('../Storages/AppSettings.js') ; @@ -239,4 +240,4 @@ module.exports = AdminSettingsContacts; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsDomains.js b/dev/Admin/AdminSettingsDomains.js index fca41caae..aea2a2f6d 100644 --- a/dev/Admin/AdminSettingsDomains.js +++ b/dev/Admin/AdminSettingsDomains.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + window = require('window'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), + Enums = require('Enums'), PopupsDomainViewModel = require('../ViewModels/Popups/PopupsDomainViewModel.js'), @@ -57,7 +58,7 @@ AdminSettingsDomains.prototype.createDomain = function () { - require('../Knoin/Knoin.js').showScreenPopup(PopupsDomainViewModel); + require('kn').showScreenPopup(PopupsDomainViewModel); }; AdminSettingsDomains.prototype.deleteDomain = function (oDomain) @@ -92,7 +93,7 @@ { if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { - require('../Knoin/Knoin.js').showScreenPopup(PopupsDomainViewModel, [oData.Result]); + require('kn').showScreenPopup(PopupsDomainViewModel, [oData.Result]); } }; @@ -103,4 +104,4 @@ module.exports = AdminSettingsDomains; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsGeneral.js b/dev/Admin/AdminSettingsGeneral.js index 8cec855b1..6a6aa6f12 100644 --- a/dev/Admin/AdminSettingsGeneral.js +++ b/dev/Admin/AdminSettingsGeneral.js @@ -1,15 +1,16 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js'), @@ -131,7 +132,7 @@ AdminSettingsGeneral.prototype.selectLanguage = function () { - require('../Knoin/Knoin.js').showScreenPopup(PopupsLanguagesViewModel); + require('kn').showScreenPopup(PopupsLanguagesViewModel); }; /** @@ -144,4 +145,4 @@ module.exports = AdminSettingsGeneral; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsLicensing.js b/dev/Admin/AdminSettingsLicensing.js index 42d584b95..8656b9041 100644 --- a/dev/Admin/AdminSettingsLicensing.js +++ b/dev/Admin/AdminSettingsLicensing.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - moment = require('../External/moment.js'), + ko = require('ko'), + moment = require('moment'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js'), @@ -51,7 +52,7 @@ AdminSettingsLicensing.prototype.showActivationForm = function () { - require('../Knoin/Knoin.js').showScreenPopup(PopupsActivateViewModel); + require('kn').showScreenPopup(PopupsActivateViewModel); }; /** @@ -69,4 +70,4 @@ module.exports = AdminSettingsLicensing; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsLogin.js b/dev/Admin/AdminSettingsLogin.js index f50d246ab..5cc74fc53 100644 --- a/dev/Admin/AdminSettingsLogin.js +++ b/dev/Admin/AdminSettingsLogin.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js') @@ -68,4 +69,4 @@ module.exports = AdminSettingsLogin; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsPackages.js b/dev/Admin/AdminSettingsPackages.js index 14e8ded55..052c2d7ad 100644 --- a/dev/Admin/AdminSettingsPackages.js +++ b/dev/Admin/AdminSettingsPackages.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - ko = require('../External/ko.js'), + window = require('window'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Data = require('../Storages/AdminDataStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js') @@ -110,4 +111,4 @@ module.exports = AdminSettingsPackages; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsPlugins.js b/dev/Admin/AdminSettingsPlugins.js index 40059a88a..e6f120dc8 100644 --- a/dev/Admin/AdminSettingsPlugins.js +++ b/dev/Admin/AdminSettingsPlugins.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js'), @@ -86,7 +87,7 @@ { if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { - require('../Knoin/Knoin.js').showScreenPopup(PopupsPluginViewModel, [oData.Result]); + require('kn').showScreenPopup(PopupsPluginViewModel, [oData.Result]); } }; @@ -112,4 +113,4 @@ module.exports = AdminSettingsPlugins; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Admin/AdminSettingsSecurity.js b/dev/Admin/AdminSettingsSecurity.js index fd1af5fed..14e82e9b8 100644 --- a/dev/Admin/AdminSettingsSecurity.js +++ b/dev/Admin/AdminSettingsSecurity.js @@ -1,15 +1,16 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js'), @@ -133,4 +134,4 @@ module.exports = AdminSettingsSecurity; -}(module)); +}(module, require)); diff --git a/dev/Admin/AdminSettingsSocial.js b/dev/Admin/AdminSettingsSocial.js index 9fabc5848..f0084e739 100644 --- a/dev/Admin/AdminSettingsSocial.js +++ b/dev/Admin/AdminSettingsSocial.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js') + Enums = require('Enums'), + Utils = require('Utils') ; /** @@ -150,4 +151,4 @@ module.exports = AdminSettingsSocial; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Boots/AbstractApp.js b/dev/Boots/AbstractApp.js index 2a8f75ec6..a7babf9bc 100644 --- a/dev/Boots/AbstractApp.js +++ b/dev/Boots/AbstractApp.js @@ -1,24 +1,25 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - window = require('../External/window.js'), - $html = require('../External/$html.js'), - $window = require('../External/$window.js'), - $doc = require('../External/$doc.js'), + $ = require('$'), + _ = require('_'), + window = require('window'), + $html = require('$html'), + $window = require('$window'), + $doc = require('$doc'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), - Events = require('../Common/Events.js'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), + Events = require('Events'), AppSettings = require('../Storages/AppSettings.js'), - KnoinAbstractBoot = require('../Knoin/KnoinAbstractBoot.js') + KnoinAbstractBoot = require('KnoinAbstractBoot') ; /** @@ -141,7 +142,7 @@ AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose) { var - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), sCustomLogoutLink = Utils.pString(AppSettings.settingsGet('CustomLogoutLink')), bInIframe = !!AppSettings.settingsGet('InIframe') ; @@ -270,4 +271,4 @@ module.exports = AbstractApp; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Boots/AdminApp.js b/dev/Boots/AdminApp.js index 88378ee50..b94ee4613 100644 --- a/dev/Boots/AdminApp.js +++ b/dev/Boots/AdminApp.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - _ = require('../External/underscore.js'), - window = require('../External/window.js'), + ko = require('ko'), + _ = require('_'), + window = require('window'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js'), @@ -326,4 +327,4 @@ module.exports = new AdminApp(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Boots/Boot.js b/dev/Boots/Boot.js index 7fc5b57b4..08535fdea 100644 --- a/dev/Boots/Boot.js +++ b/dev/Boots/Boot.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - _ = require('../External/underscore.js'), - $ = require('../External/jquery.js'), - $window = require('../External/$window.js'), - $html = require('../External/$html.js'), + window = require('window'), + _ = require('_'), + $ = require('$'), + $window = require('$window'), + $html = require('$html'), - Globals = require('../Common/Globals.js'), - Plugins = require('../Common/Plugins.js'), - Utils = require('../Common/Utils.js') + Globals = require('Globals'), + Plugins = require('Plugins'), + Utils = require('Utils') ; module.exports = function (App) { @@ -45,7 +46,7 @@ window['rl']['createCommand'] = Utils.createCommand; window['rl']['EmailModel'] = require('../Models/EmailModel.js'); - window['rl']['Enums'] = require('../Common/Enums.js'); + window['rl']['Enums'] = require('Enums'); window['__RLBOOT'] = function (fCall) { @@ -74,4 +75,4 @@ }; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Boots/RainLoopApp.js b/dev/Boots/RainLoopApp.js index 1fbcfcb5e..eee63cd68 100644 --- a/dev/Boots/RainLoopApp.js +++ b/dev/Boots/RainLoopApp.js @@ -1,23 +1,24 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - moment = require('../External/moment.js'), + window = require('window'), + $ = require('$'), + _ = require('_'), + moment = require('moment'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Consts = require('../Common/Consts.js'), - Plugins = require('../Common/Plugins.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), - Events = require('../Common/Events.js'), + Enums = require('Enums'), + Globals = require('Globals'), + Consts = require('Consts'), + Plugins = require('Plugins'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), + Events = require('Events'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), LocalStorage = require('../Storages/LocalStorage.js'), AppSettings = require('../Storages/AppSettings.js'), @@ -1579,4 +1580,4 @@ module.exports = new RainLoopApp(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Base64.js b/dev/Common/Base64.js index b0bc13778..d8eee4e8b 100644 --- a/dev/Common/Base64.js +++ b/dev/Common/Base64.js @@ -1,8 +1,9 @@ // Base64 encode / decode // http://www.webtoolkit.info/ -'use strict'; (function (module) { + + 'use strict'; /*jslint bitwise: true*/ var Base64 = { @@ -167,4 +168,4 @@ module.exports = Base64; /*jslint bitwise: false*/ -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Consts.js b/dev/Common/Consts.js index 34f53537b..f7691cf77 100644 --- a/dev/Common/Consts.js +++ b/dev/Common/Consts.js @@ -1,8 +1,9 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; (function (module) { + 'use strict'; + var Consts = {}; Consts.Values = {}; @@ -125,4 +126,4 @@ module.exports = Consts; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Enums.js b/dev/Common/Enums.js index 31ae4415f..e9967a4ef 100644 --- a/dev/Common/Enums.js +++ b/dev/Common/Enums.js @@ -1,8 +1,9 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; (function (module) { + 'use strict'; + var Enums = {}; /** @@ -436,4 +437,4 @@ module.exports = Enums; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Events.js b/dev/Common/Events.js index 182b261d6..a5322dfbf 100644 --- a/dev/Common/Events.js +++ b/dev/Common/Events.js @@ -1,13 +1,14 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - _ = require('../External/underscore.js'), + _ = require('_'), - Utils = require('./Utils.js'), - Plugins = require('./Plugins.js') + Utils = require('Utils'), + Plugins = require('Plugins') ; /** @@ -62,4 +63,4 @@ module.exports = new Events(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index 0da028165..0748aa248 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -1,16 +1,17 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var Globals = {}, - window = require('../External/window.js'), - ko = require('../External/ko.js'), - key = require('../External/key.js'), - $html = require('../External/$html.js'), + window = require('window'), + ko = require('ko'), + key = require('key'), + $html = require('$html'), - Enums = require('../Common/Enums.js') + Enums = require('Enums') ; /** @@ -272,4 +273,4 @@ module.exports = Globals; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/LinkBuilder.js b/dev/Common/LinkBuilder.js index b118354ac..3ad50a695 100644 --- a/dev/Common/LinkBuilder.js +++ b/dev/Common/LinkBuilder.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - Utils = require('./Utils.js') + window = require('window'), + Utils = require('Utils') ; /** @@ -326,4 +327,4 @@ module.exports = new LinkBuilder(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/NewHtmlEditorWrapper.js b/dev/Common/NewHtmlEditorWrapper.js index be6216310..1e95cbd69 100644 --- a/dev/Common/NewHtmlEditorWrapper.js +++ b/dev/Common/NewHtmlEditorWrapper.js @@ -1,12 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - _ = require('../External/underscore.js'), - Globals = require('./Globals.js'), + window = require('window'), + _ = require('_'), + Globals = require('Globals'), AppSettings = require('../Storages/AppSettings.js') ; @@ -271,4 +272,4 @@ module.exports = NewHtmlEditorWrapper; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Plugins.js b/dev/Common/Plugins.js index dd8b97a37..793994fcc 100644 --- a/dev/Common/Plugins.js +++ b/dev/Common/Plugins.js @@ -1,7 +1,8 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var Plugins = { @@ -9,8 +10,8 @@ __remote: null, __data: null }, - _ = require('../External/underscore.js'), - Utils = require('./Utils.js') + _ = require('_'), + Utils = require('Utils') ; /** @@ -112,4 +113,4 @@ module.exports = Plugins; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Selector.js b/dev/Common/Selector.js index 7a1c20c8c..4bf4c9858 100644 --- a/dev/Common/Selector.js +++ b/dev/Common/Selector.js @@ -1,16 +1,17 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - key = require('../External/key.js'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + key = require('key'), - Enums = require('./Enums.js'), - Utils = require('./Utils.js') + Enums = require('Enums'), + Utils = require('Utils') ; /** @@ -726,4 +727,4 @@ module.exports = Selector; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index c67904a62..7f467be04 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -1,24 +1,25 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var Utils = {}, - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - window = require('../External/window.js'), - $window = require('../External/$window.js'), - $html = require('../External/$html.js'), - $div = require('../External/$div.js'), - $doc = require('../External/$doc.js'), - NotificationClass = require('../External/NotificationClass.js'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + window = require('window'), + $window = require('$window'), + $html = require('$html'), + $div = require('$div'), + $doc = require('$doc'), + NotificationClass = require('NotificationClass'), - Enums = require('./Enums.js'), - Consts = require('./Consts.js'), - Globals = require('./Globals.js') + Enums = require('Enums'), + Consts = require('Consts'), + Globals = require('Globals') ; Utils.trim = $.trim; @@ -2045,4 +2046,4 @@ module.exports = Utils; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/External/$div.js b/dev/External/$div.js index fee8b7c33..740a91a86 100644 --- a/dev/External/$div.js +++ b/dev/External/$div.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -module.exports = require('./jquery.js')('
'); \ No newline at end of file +module.exports = require('$')(''); \ No newline at end of file diff --git a/dev/External/$doc.js b/dev/External/$doc.js index 4509b03dd..49c957f6e 100644 --- a/dev/External/$doc.js +++ b/dev/External/$doc.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -module.exports = require('./jquery.js')(window.document); \ No newline at end of file +module.exports = require('$')(window.document); \ No newline at end of file diff --git a/dev/External/$html.js b/dev/External/$html.js index c761d5bb4..58436fc30 100644 --- a/dev/External/$html.js +++ b/dev/External/$html.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -module.exports = require('./jquery.js')('html'); \ No newline at end of file +module.exports = require('$')('html'); \ No newline at end of file diff --git a/dev/External/$window.js b/dev/External/$window.js index 8effe09c2..61942c6be 100644 --- a/dev/External/$window.js +++ b/dev/External/$window.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -module.exports = require('./jquery.js')(window); \ No newline at end of file +module.exports = require('$')(window); \ No newline at end of file diff --git a/dev/External/AppData.js b/dev/External/AppData.js index 8d947c9d2..c3ec93bd9 100644 --- a/dev/External/AppData.js +++ b/dev/External/AppData.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -module.exports = require('./window.js')['rainloopAppData'] || {}; \ No newline at end of file +module.exports = require('window')['rainloopAppData'] || {}; \ No newline at end of file diff --git a/dev/External/JSON.js b/dev/External/JSON.js index 7e5dfcebc..cc26e6852 100644 --- a/dev/External/JSON.js +++ b/dev/External/JSON.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = JSON; \ No newline at end of file diff --git a/dev/External/Jua.js b/dev/External/Jua.js index cbd0f1083..bed2238ec 100644 --- a/dev/External/Jua.js +++ b/dev/External/Jua.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = Jua; \ No newline at end of file diff --git a/dev/External/NotificationClass.js b/dev/External/NotificationClass.js index 18bdb0449..b339e8820 100644 --- a/dev/External/NotificationClass.js +++ b/dev/External/NotificationClass.js @@ -1,5 +1,4 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -var window = require('./window.js'); -module.exports = window.Notification && window.Notification.requestPermission ? window.Notification : null; \ No newline at end of file +var w = require('window'); +module.exports = w.Notification && w.Notification.requestPermission ? w.Notification : null; \ No newline at end of file diff --git a/dev/External/crossroads.js b/dev/External/crossroads.js index 257256e45..5c0e8dccc 100644 --- a/dev/External/crossroads.js +++ b/dev/External/crossroads.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = crossroads; \ No newline at end of file diff --git a/dev/External/hasher.js b/dev/External/hasher.js index c7c4ac5a1..e8f27cd7d 100644 --- a/dev/External/hasher.js +++ b/dev/External/hasher.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = hasher; \ No newline at end of file diff --git a/dev/External/ifvisible.js b/dev/External/ifvisible.js index db1ac0e75..e4b26adbe 100644 --- a/dev/External/ifvisible.js +++ b/dev/External/ifvisible.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = ifvisible; \ No newline at end of file diff --git a/dev/External/jquery.js b/dev/External/jquery.js index 849e3d81b..3c252e90d 100644 --- a/dev/External/jquery.js +++ b/dev/External/jquery.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = $; \ No newline at end of file diff --git a/dev/External/key.js b/dev/External/key.js index 957a8b2ef..a40d2cef0 100644 --- a/dev/External/key.js +++ b/dev/External/key.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = key; \ No newline at end of file diff --git a/dev/External/ko.js b/dev/External/ko.js index 444d4ac95..3205b2e12 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -1,22 +1,23 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; (function (module, ko) { + 'use strict'; + var - window = require('./window.js'), - _ = require('./underscore.js'), - $ = require('./jquery.js'), - $window = require('./$window.js'), - $doc = require('./$doc.js') + window = require('window'), + _ = require('_'), + $ = require('$'), + $window = require('$window'), + $doc = require('$doc') ; ko.bindingHandlers.tooltip = { 'init': function (oElement, fValueAccessor) { var - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js') + Globals = require('Globals'), + Utils = require('Utils') ; if (!Globals.bMobileDevice) @@ -54,7 +55,7 @@ ko.bindingHandlers.tooltip2 = { 'init': function (oElement, fValueAccessor) { var - Globals = require('../Common/Globals.js'), + Globals = require('Globals'), $oEl = $(oElement), sClass = $oEl.data('tooltip-class') || '', sPlacement = $oEl.data('tooltip-placement') || 'top' @@ -87,7 +88,7 @@ var $oEl = $(oElement), - Globals = require('../Common/Globals.js') + Globals = require('Globals') ; $oEl.tooltip({ @@ -121,7 +122,7 @@ ko.bindingHandlers.registrateBootstrapDropdown = { 'init': function (oElement) { - var Globals = require('../Common/Globals.js'); + var Globals = require('Globals'); Globals.aBootstrapDropdowns.push($(oElement)); } }; @@ -132,7 +133,7 @@ { var $el = $(oElement), - Utils = require('../Common/Utils.js') + Utils = require('Utils') ; if (!$el.hasClass('open')) @@ -162,7 +163,7 @@ ko.bindingHandlers.csstext = { 'init': function (oElement, fValueAccessor) { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText)) { oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor()); @@ -173,7 +174,7 @@ } }, 'update': function (oElement, fValueAccessor) { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText)) { oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor()); @@ -241,8 +242,8 @@ 'init': function (oElement, fValueAccessor) { var - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js') + Globals = require('Globals'), + Utils = require('Utils') ; $(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({ @@ -264,14 +265,14 @@ ko.bindingHandlers.i18nInit = { 'init': function (oElement) { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); Utils.i18nToNode(oElement); } }; ko.bindingHandlers.i18nUpdate = { 'update': function (oElement, fValueAccessor) { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); ko.utils.unwrapObservable(fValueAccessor()); Utils.i18nToNode(oElement); } @@ -312,7 +313,7 @@ 'update': function (oElement, fValueAccessor) { var - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), aValues = ko.utils.unwrapObservable(fValueAccessor()), iValue = Utils.pInt(aValues[1]), iSize = 0, @@ -346,8 +347,8 @@ ko.bindingHandlers.draggable = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) { var - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js') + Globals = require('Globals'), + Utils = require('Utils') ; if (!Globals.bMobileDevice) { @@ -429,7 +430,7 @@ ko.bindingHandlers.droppable = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) { - var Globals = require('../Common/Globals.js'); + var Globals = require('Globals'); if (!Globals.bMobileDevice) { var @@ -471,7 +472,7 @@ ko.bindingHandlers.nano = { 'init': function (oElement) { - var Globals = require('../Common/Globals.js'); + var Globals = require('Globals'); if (!Globals.bDisableNanoScroll) { $(oElement) @@ -568,7 +569,7 @@ 'init': function(oElement, fValueAccessor, fAllBindingsAccessor) { var - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), EmailModel = require('../Models/EmailModel.js'), $oEl = $(oElement), @@ -642,7 +643,7 @@ 'init': function(oElement, fValueAccessor, fAllBindingsAccessor) { var - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), ContactTagModel = require('../Models/ContactTagModel.js'), $oEl = $(oElement), @@ -757,7 +758,7 @@ ko.extenders.trimmer = function (oTarget) { var - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), oResult = ko.computed({ 'read': oTarget, 'write': function (sNewValue) { @@ -774,7 +775,7 @@ ko.extenders.posInterer = function (oTarget, iDefault) { var - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), oResult = ko.computed({ 'read': oTarget, 'write': function (sNewValue) { @@ -830,7 +831,7 @@ ko.extenders.falseTimeout = function (oTarget, iOption) { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); oTarget.iTimeout = 0; oTarget.subscribe(function (bValue) { @@ -855,7 +856,7 @@ ko.observable.fn.validateEmail = function () { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); this.hasError = ko.observable(false); @@ -870,7 +871,7 @@ ko.observable.fn.validateSimpleEmail = function () { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); this.hasError = ko.observable(false); @@ -885,7 +886,7 @@ ko.observable.fn.validateFunc = function (fFunc) { - var Utils = require('../Common/Utils.js'); + var Utils = require('Utils'); this.hasFuncError = ko.observable(false); diff --git a/dev/External/moment.js b/dev/External/moment.js index 2eee45592..8f47fad33 100644 --- a/dev/External/moment.js +++ b/dev/External/moment.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = moment; \ No newline at end of file diff --git a/dev/External/ssm.js b/dev/External/ssm.js index 57db98522..ddd0add1d 100644 --- a/dev/External/ssm.js +++ b/dev/External/ssm.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = ssm; \ No newline at end of file diff --git a/dev/External/underscore.js b/dev/External/underscore.js index fd33cd754..e069874fc 100644 --- a/dev/External/underscore.js +++ b/dev/External/underscore.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = _; \ No newline at end of file diff --git a/dev/External/window.js b/dev/External/window.js index 8a031a9ed..fd67c69bc 100644 --- a/dev/External/window.js +++ b/dev/External/window.js @@ -1,4 +1,3 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; module.exports = window; \ No newline at end of file diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js index e9460e651..17de22fc3 100644 --- a/dev/Knoin/Knoin.js +++ b/dev/Knoin/Knoin.js @@ -1,21 +1,22 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - hasher = require('../External/hasher.js'), - crossroads = require('../External/crossroads.js'), - $html = require('../External/$html.js'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + hasher = require('hasher'), + crossroads = require('crossroads'), + $html = require('$html'), - Globals = require('../Common/Globals.js'), - Plugins = require('../Common/Plugins.js'), - Utils = require('../Common/Utils.js'), + Globals = require('Globals'), + Plugins = require('Plugins'), + Utils = require('Utils'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -446,4 +447,4 @@ module.exports = new Knoin(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Knoin/KnoinAbstractBoot.js b/dev/Knoin/KnoinAbstractBoot.js index 013ee39a4..f2202e256 100644 --- a/dev/Knoin/KnoinAbstractBoot.js +++ b/dev/Knoin/KnoinAbstractBoot.js @@ -1,7 +1,8 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; (function (module) { + + 'use strict'; /** * @constructor @@ -18,4 +19,4 @@ module.exports = KnoinAbstractBoot; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Knoin/KnoinAbstractScreen.js b/dev/Knoin/KnoinAbstractScreen.js index ae72ad9d1..e93c70aa3 100644 --- a/dev/Knoin/KnoinAbstractScreen.js +++ b/dev/Knoin/KnoinAbstractScreen.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - crossroads = require('../External/crossroads.js'), - Utils = require('../Common/Utils.js') + crossroads = require('crossroads'), + Utils = require('Utils') ; /** @@ -86,4 +87,4 @@ module.exports = KnoinAbstractScreen; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Knoin/KnoinAbstractViewModel.js b/dev/Knoin/KnoinAbstractViewModel.js index a473a3322..bbef4b384 100644 --- a/dev/Knoin/KnoinAbstractViewModel.js +++ b/dev/Knoin/KnoinAbstractViewModel.js @@ -1,15 +1,16 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - $window = require('../External/$window.js'), + ko = require('ko'), + $window = require('$window'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js') + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils') ; /** @@ -107,4 +108,4 @@ module.exports = KnoinAbstractViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/AccountModel.js b/dev/Models/AccountModel.js index 4fc07108a..be5cdcf23 100644 --- a/dev/Models/AccountModel.js +++ b/dev/Models/AccountModel.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js') + ko = require('ko') ; /** @@ -26,9 +27,9 @@ */ AccountModel.prototype.changeAccountLink = function () { - return require('../Common/LinkBuilder.js').change(this.email); + return require('LinkBuilder').change(this.email); }; module.exports = AccountModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/AttachmentModel.js b/dev/Models/AttachmentModel.js index 9f090c2b6..ea83111ea 100644 --- a/dev/Models/AttachmentModel.js +++ b/dev/Models/AttachmentModel.js @@ -1,13 +1,14 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - window = require('../External/window.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js') + window = require('window'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder') ; /** @@ -248,4 +249,4 @@ module.exports = AttachmentModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/ComposeAttachmentModel.js b/dev/Models/ComposeAttachmentModel.js index d37446043..248455dc6 100644 --- a/dev/Models/ComposeAttachmentModel.js +++ b/dev/Models/ComposeAttachmentModel.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../External/ko.js'), - Utils = require('../Common/Utils.js') + ko = require('ko'), + Utils = require('Utils') ; /** @@ -72,4 +73,4 @@ module.exports = ComposeAttachmentModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/ContactModel.js b/dev/Models/ContactModel.js index 8d8646c24..0ad64d5e0 100644 --- a/dev/Models/ContactModel.js +++ b/dev/Models/ContactModel.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js') + _ = require('_'), + ko = require('ko'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder') ; /** @@ -137,4 +138,4 @@ module.exports = ContactModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/ContactPropertyModel.js b/dev/Models/ContactPropertyModel.js index 2043a36fb..462f1b866 100644 --- a/dev/Models/ContactPropertyModel.js +++ b/dev/Models/ContactPropertyModel.js @@ -1,12 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js') + ko = require('ko'), + Enums = require('Enums'), + Utils = require('Utils') ; /** @@ -39,4 +40,4 @@ module.exports = ContactPropertyModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/ContactTagModel.js b/dev/Models/ContactTagModel.js index eef67af4a..e5276b4e4 100644 --- a/dev/Models/ContactTagModel.js +++ b/dev/Models/ContactTagModel.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../External/ko.js'), - Utils = require('../Common/Utils.js') + ko = require('ko'), + Utils = require('Utils') ; /** @@ -54,4 +55,4 @@ module.exports = ContactTagModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/EmailModel.js b/dev/Models/EmailModel.js index 956278c3b..05d45a624 100644 --- a/dev/Models/EmailModel.js +++ b/dev/Models/EmailModel.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js') + Enums = require('Enums'), + Utils = require('Utils') ; /** @@ -374,4 +375,4 @@ module.exports = EmailModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/FilterConditionModel.js b/dev/Models/FilterConditionModel.js index 6477be478..94adaaae9 100644 --- a/dev/Models/FilterConditionModel.js +++ b/dev/Models/FilterConditionModel.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../External/ko.js'), - Enums = require('../Common/Enums.js') + ko = require('ko'), + Enums = require('Enums') ; /** @@ -58,4 +59,4 @@ module.exports = FilterConditionModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/FilterModel.js b/dev/Models/FilterModel.js index eb47948f6..5348a5806 100644 --- a/dev/Models/FilterModel.js +++ b/dev/Models/FilterModel.js @@ -1,12 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + ko = require('ko'), + Enums = require('Enums'), + Utils = require('Utils'), FilterConditionModel = require('./FilterConditionModel.js') ; @@ -90,4 +91,4 @@ module.exports = FilterModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/FolderModel.js b/dev/Models/FolderModel.js index e3bc36780..32110a6a8 100644 --- a/dev/Models/FolderModel.js +++ b/dev/Models/FolderModel.js @@ -1,17 +1,18 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - $window = require('../External/$window.js'), + _ = require('_'), + ko = require('ko'), + $window = require('$window'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - Events = require('../Common/Events.js') + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils'), + Events = require('Events') ; /** @@ -351,4 +352,4 @@ module.exports = FolderModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/IdentityModel.js b/dev/Models/IdentityModel.js index cd2fbf055..4887af09d 100644 --- a/dev/Models/IdentityModel.js +++ b/dev/Models/IdentityModel.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - Utils = require('../Common/Utils.js') + ko = require('ko'), + Utils = require('Utils') ; /** @@ -46,4 +47,4 @@ module.exports = IdentityModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/MessageModel.js b/dev/Models/MessageModel.js index 589270d65..2e2926bf6 100644 --- a/dev/Models/MessageModel.js +++ b/dev/Models/MessageModel.js @@ -1,20 +1,21 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - moment = require('../External/moment.js'), - $window = require('../External/$window.js'), - $div = require('../External/$div.js'), + window = require('window'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + moment = require('moment'), + $window = require('$window'), + $div = require('$div'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), EmailModel = require('./EmailModel.js'), AttachmentModel = require('./AttachmentModel.js') @@ -1283,4 +1284,4 @@ module.exports = MessageModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Models/OpenPgpKeyModel.js b/dev/Models/OpenPgpKeyModel.js index 9b97d8e7d..37b81f596 100644 --- a/dev/Models/OpenPgpKeyModel.js +++ b/dev/Models/OpenPgpKeyModel.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../External/ko.js') + ko = require('ko') ; /** @@ -40,4 +41,4 @@ module.exports = OpenPgpKeyModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Screens/AbstractSettings.js b/dev/Screens/AbstractSettings.js index ef25cff5c..50a6439c3 100644 --- a/dev/Screens/AbstractSettings.js +++ b/dev/Screens/AbstractSettings.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js') + kn = require('kn'), + KnoinAbstractScreen = require('KnoinAbstractScreen') ; /** @@ -197,4 +198,4 @@ module.exports = AbstractSettings; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Screens/AdminLoginScreen.js b/dev/Screens/AdminLoginScreen.js index 2dc87abe4..1697b26e2 100644 --- a/dev/Screens/AdminLoginScreen.js +++ b/dev/Screens/AdminLoginScreen.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - _ = require('../External/underscore.js'), - KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js') + _ = require('_'), + KnoinAbstractScreen = require('KnoinAbstractScreen') ; /** @@ -28,4 +29,4 @@ module.exports = AdminLoginScreen; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Screens/AdminSettingsScreen.js b/dev/Screens/AdminSettingsScreen.js index 16b24eef1..746cba520 100644 --- a/dev/Screens/AdminSettingsScreen.js +++ b/dev/Screens/AdminSettingsScreen.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), + _ = require('_'), AbstractSettings = require('./AbstractSettings.js') ; @@ -35,4 +36,4 @@ module.exports = AdminSettingsScreen; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Screens/LoginScreen.js b/dev/Screens/LoginScreen.js index 9e0436057..eff7ac788 100644 --- a/dev/Screens/LoginScreen.js +++ b/dev/Screens/LoginScreen.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js') + _ = require('_'), + KnoinAbstractScreen = require('KnoinAbstractScreen') ; /** @@ -28,4 +29,4 @@ module.exports = LoginScreen; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Screens/MailBoxScreen.js b/dev/Screens/MailBoxScreen.js index 4668dfbed..343135eb6 100644 --- a/dev/Screens/MailBoxScreen.js +++ b/dev/Screens/MailBoxScreen.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - $html = require('../External/$html.js'), + _ = require('_'), + $html = require('$html'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - Events = require('../Common/Events.js'), + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils'), + Events = require('Events'), - KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'), + KnoinAbstractScreen = require('KnoinAbstractScreen'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/WebMailDataStorage.js'), @@ -204,4 +205,4 @@ module.exports = MailBoxScreen; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Screens/SettingsScreen.js b/dev/Screens/SettingsScreen.js index cc77d9a57..90a9484ef 100644 --- a/dev/Screens/SettingsScreen.js +++ b/dev/Screens/SettingsScreen.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), + _ = require('_'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - Globals = require('../Common/Globals.js'), + Enums = require('Enums'), + Utils = require('Utils'), + Globals = require('Globals'), AbstractSettings = require('./AbstractSettings.js') ; @@ -52,4 +53,4 @@ module.exports = SettingsScreen; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsAccounts.js b/dev/Settings/SettingsAccounts.js index 157cca7a2..6b30d1441 100644 --- a/dev/Settings/SettingsAccounts.js +++ b/dev/Settings/SettingsAccounts.js @@ -1,21 +1,22 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + window = require('window'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), PopupsAddAccountViewModel = require('../ViewModels/Popups/PopupsAddAccountViewModel.js') ; @@ -99,4 +100,4 @@ module.exports = SettingsAccounts; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsChangePassword.js b/dev/Settings/SettingsChangePassword.js index 01e7d51d6..e3695a07c 100644 --- a/dev/Settings/SettingsChangePassword.js +++ b/dev/Settings/SettingsChangePassword.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js') ; @@ -118,4 +119,4 @@ module.exports = SettingsChangePassword; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsContacts.js b/dev/Settings/SettingsContacts.js index 85bf56c9c..d8613e749 100644 --- a/dev/Settings/SettingsContacts.js +++ b/dev/Settings/SettingsContacts.js @@ -1,12 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../External/ko.js'), + ko = require('ko'), - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Data = require('../Storages/WebMailDataStorage.js') @@ -55,4 +56,4 @@ module.exports = SettingsContacts; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsFilters.js b/dev/Settings/SettingsFilters.js index 6bd81cbd2..71a20b989 100644 --- a/dev/Settings/SettingsFilters.js +++ b/dev/Settings/SettingsFilters.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), - Utils = require('../Common/Utils.js') + ko = require('ko'), + Utils = require('Utils') ; /** @@ -29,7 +30,7 @@ SettingsFilters.prototype.addFilter = function () { var - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), FilterModel = require('../Models/FilterModel.js'), PopupsFilterViewModel = require('../ViewModels/Popups/PopupsFilterViewModel.js') ; @@ -39,4 +40,4 @@ module.exports = SettingsFilters; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsFolders.js b/dev/Settings/SettingsFolders.js index 62845c149..f95a1c34e 100644 --- a/dev/Settings/SettingsFolders.js +++ b/dev/Settings/SettingsFolders.js @@ -1,15 +1,16 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), AppSettings = require('../Storages/AppSettings.js'), LocalStorage = require('../Storages/LocalStorage.js'), @@ -218,4 +219,4 @@ module.exports = SettingsFolders; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsGeneral.js b/dev/Settings/SettingsGeneral.js index 67f576915..0b28359af 100644 --- a/dev/Settings/SettingsGeneral.js +++ b/dev/Settings/SettingsGeneral.js @@ -1,22 +1,23 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - $ = require('../External/jquery.js'), - ko = require('../External/ko.js'), + $ = require('$'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Consts = require('../Common/Consts.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js') ; @@ -177,4 +178,4 @@ module.exports = SettingsGeneral; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsIdentities.js b/dev/Settings/SettingsIdentities.js index 6c6be0f1d..9fef5aea7 100644 --- a/dev/Settings/SettingsIdentities.js +++ b/dev/Settings/SettingsIdentities.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'), + Enums = require('Enums'), + Utils = require('Utils'), + NewHtmlEditorWrapper = require('NewHtmlEditorWrapper'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), PopupsIdentityViewModel = require('../ViewModels/Popups/PopupsIdentityViewModel.js') ; @@ -233,4 +234,4 @@ module.exports = SettingsIdentities; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsIdentity.js b/dev/Settings/SettingsIdentity.js index 709a1a656..d982b7740 100644 --- a/dev/Settings/SettingsIdentity.js +++ b/dev/Settings/SettingsIdentity.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'), + Enums = require('Enums'), + Utils = require('Utils'), + NewHtmlEditorWrapper = require('NewHtmlEditorWrapper'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js') @@ -99,4 +100,4 @@ module.exports = SettingsIdentity; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsOpenPGP.js b/dev/Settings/SettingsOpenPGP.js index a3fdaaea1..df70315e6 100644 --- a/dev/Settings/SettingsOpenPGP.js +++ b/dev/Settings/SettingsOpenPGP.js @@ -1,12 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), + ko = require('ko'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), Data = require('../Storages/WebMailDataStorage.js'), @@ -85,4 +86,4 @@ module.exports = SettingsOpenPGP; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsSecurity.js b/dev/Settings/SettingsSecurity.js index 8a99aae3c..82adfdf53 100644 --- a/dev/Settings/SettingsSecurity.js +++ b/dev/Settings/SettingsSecurity.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), PopupsTwoFactorTestViewModel = require('../ViewModels/Popups/PopupsTwoFactorTestViewModel.js') ; @@ -166,4 +167,4 @@ module.exports = SettingsSecurity; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsSocial.js b/dev/Settings/SettingsSocial.js index 4d230b8bb..3ba14f4f2 100644 --- a/dev/Settings/SettingsSocial.js +++ b/dev/Settings/SettingsSocial.js @@ -1,7 +1,8 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; /** * @constructor @@ -9,7 +10,7 @@ function SettingsSocial() { var - Utils = require('../Common/Utils.js'), + Utils = require('Utils'), RL = require('../Boots/RainLoopApp.js'), Data = require('../Storages/WebMailDataStorage.js') ; @@ -74,4 +75,4 @@ module.exports = SettingsSocial; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Settings/SettingsThemes.js b/dev/Settings/SettingsThemes.js index c0688e17b..d55d5dd07 100644 --- a/dev/Settings/SettingsThemes.js +++ b/dev/Settings/SettingsThemes.js @@ -1,16 +1,17 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), - ko = require('../External/ko.js'), + window = require('window'), + $ = require('$'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js') @@ -128,4 +129,4 @@ module.exports = SettingsThemes; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/AbstractAjaxRemoteStorage.js b/dev/Storages/AbstractAjaxRemoteStorage.js index 2f6e4175a..a5ebe6d04 100644 --- a/dev/Storages/AbstractAjaxRemoteStorage.js +++ b/dev/Storages/AbstractAjaxRemoteStorage.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), + window = require('window'), + $ = require('$'), - Consts = require('../Common/Consts.js'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - Plugins = require('../Common/Plugins.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Consts = require('Consts'), + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils'), + Plugins = require('Plugins'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('./AppSettings.js') ; @@ -307,4 +308,4 @@ module.exports = AbstractAjaxRemoteStorage; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/AbstractData.js b/dev/Storages/AbstractData.js index 068c4fc63..2d94fb1a4 100644 --- a/dev/Storages/AbstractData.js +++ b/dev/Storages/AbstractData.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), AppSettings = require('./AppSettings.js') ; @@ -89,4 +90,4 @@ module.exports = AbstractData; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/AdminAjaxRemoteStorage.js b/dev/Storages/AdminAjaxRemoteStorage.js index 66604ed66..e5eac2909 100644 --- a/dev/Storages/AdminAjaxRemoteStorage.js +++ b/dev/Storages/AdminAjaxRemoteStorage.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), + _ = require('_'), AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js') ; @@ -272,4 +273,4 @@ module.exports = new AdminAjaxRemoteStorage(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/AdminDataStorage.js b/dev/Storages/AdminDataStorage.js index 097df307e..79d010610 100644 --- a/dev/Storages/AdminDataStorage.js +++ b/dev/Storages/AdminDataStorage.js @@ -1,11 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), AbstractData = require('./AbstractData.js') ; @@ -64,4 +65,4 @@ module.exports = new AdminDataStorage(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/AppSettings.js b/dev/Storages/AppSettings.js index b976bc612..314f1263e 100644 --- a/dev/Storages/AppSettings.js +++ b/dev/Storages/AppSettings.js @@ -1,12 +1,12 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - AppData = require('../External/AppData.js'), - - Utils = require('../Common/Utils.js') + AppData = require('AppData'), + Utils = require('Utils') ; /** @@ -60,4 +60,4 @@ module.exports = new AppSettings(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/LocalStorage.js b/dev/Storages/LocalStorage.js index 15ca7035f..03c5e960b 100644 --- a/dev/Storages/LocalStorage.js +++ b/dev/Storages/LocalStorage.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), + _ = require('_'), CookieDriver = require('./LocalStorages/CookieDriver.js'), LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js') @@ -21,6 +22,8 @@ }) ; + this.oDriver = null; + if (NextStorageDriver) { NextStorageDriver = /** @type {?Function} */ NextStorageDriver; @@ -51,4 +54,4 @@ module.exports = new LocalStorage(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/LocalStorages/CookieDriver.js b/dev/Storages/LocalStorages/CookieDriver.js index c1a02a8d9..6447e71f5 100644 --- a/dev/Storages/LocalStorages/CookieDriver.js +++ b/dev/Storages/LocalStorages/CookieDriver.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - $ = require('../../External/jquery.js'), - JSON = require('../../External/JSON.js'), + $ = require('$'), + JSON = require('JSON'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js') + Consts = require('Consts'), + Utils = require('Utils') ; /** @@ -87,4 +88,4 @@ module.exports = CookieDriver; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/LocalStorages/LocalStorageDriver.js b/dev/Storages/LocalStorages/LocalStorageDriver.js index f7ee66f0c..56f864758 100644 --- a/dev/Storages/LocalStorages/LocalStorageDriver.js +++ b/dev/Storages/LocalStorages/LocalStorageDriver.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../../External/window.js'), - JSON = require('../../External/JSON.js'), + window = require('window'), + JSON = require('JSON'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js') + Consts = require('Consts'), + Utils = require('Utils') ; /** @@ -84,4 +85,4 @@ module.exports = LocalStorageDriver; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/WebMailAjaxRemoteStorage.js b/dev/Storages/WebMailAjaxRemoteStorage.js index ee7097234..29b8e0cde 100644 --- a/dev/Storages/WebMailAjaxRemoteStorage.js +++ b/dev/Storages/WebMailAjaxRemoteStorage.js @@ -1,15 +1,16 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), + _ = require('_'), - Utils = require('../Common/Utils.js'), - Consts = require('../Common/Consts.js'), - Globals = require('../Common/Globals.js'), - Base64 = require('../Common/Base64.js'), + Utils = require('Utils'), + Consts = require('Consts'), + Globals = require('Globals'), + Base64 = require('Base64'), AppSettings = require('./AppSettings.js'), Cache = require('./WebMailCacheStorage.js'), @@ -810,4 +811,4 @@ module.exports = new WebMailAjaxRemoteStorage(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/WebMailCacheStorage.js b/dev/Storages/WebMailCacheStorage.js index de1282f0b..83441bb50 100644 --- a/dev/Storages/WebMailCacheStorage.js +++ b/dev/Storages/WebMailCacheStorage.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), + _ = require('_'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('./AppSettings.js') ; @@ -345,4 +346,4 @@ module.exports = new WebMailCacheStorage(); -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/Storages/WebMailDataStorage.js b/dev/Storages/WebMailDataStorage.js index 51efee8ff..b0caaf166 100644 --- a/dev/Storages/WebMailDataStorage.js +++ b/dev/Storages/WebMailDataStorage.js @@ -1,27 +1,28 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - moment = require('../External/moment.js'), - $div = require('../External/$div.js'), - NotificationClass = require('../External/NotificationClass.js'), + window = require('window'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + moment = require('moment'), + $div = require('$div'), + NotificationClass = require('NotificationClass'), - Consts = require('../Common/Consts.js'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Consts = require('Consts'), + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('./AppSettings.js'), Cache = require('./WebMailCacheStorage.js'), - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), MessageModel = require('../Models/MessageModel.js'), @@ -1024,4 +1025,4 @@ module.exports = new WebMailDataStorage(); -}(module)); +}(module, require)); diff --git a/dev/ViewModels/AbstractSystemDropDownViewModel.js b/dev/ViewModels/AbstractSystemDropDownViewModel.js index 799cb8a15..a10f55054 100644 --- a/dev/ViewModels/AbstractSystemDropDownViewModel.js +++ b/dev/ViewModels/AbstractSystemDropDownViewModel.js @@ -1,17 +1,18 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - window = require('../External/window.js'), - key = require('../External/key.js'), + _ = require('_'), + ko = require('ko'), + window = require('window'), + key = require('key'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/WebMailDataStorage.js'), @@ -20,8 +21,8 @@ PopupsKeyboardShortcutsHelpViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'), PopupsAddAccountViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -121,4 +122,4 @@ module.exports = AbstractSystemDropDownViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/AdminLoginViewModel.js b/dev/ViewModels/AdminLoginViewModel.js index ab95524af..72765011b 100644 --- a/dev/ViewModels/AdminLoginViewModel.js +++ b/dev/ViewModels/AdminLoginViewModel.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../Common/Enums.js'), - Utils = require('../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -118,4 +119,4 @@ module.exports = AdminLoginViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/AdminMenuViewModel.js b/dev/ViewModels/AdminMenuViewModel.js index 284552d8a..27cda0063 100644 --- a/dev/ViewModels/AdminMenuViewModel.js +++ b/dev/ViewModels/AdminMenuViewModel.js @@ -1,12 +1,13 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - kn = require('../Knoin/Knoin.js'), - Globals = require('../Common/Globals.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + Globals = require('Globals'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -35,4 +36,4 @@ module.exports = AdminMenuViewModel; -}(module)); +}(module, require)); diff --git a/dev/ViewModels/AdminPaneViewModel.js b/dev/ViewModels/AdminPaneViewModel.js index dfaf7bab6..46f796ebf 100644 --- a/dev/ViewModels/AdminPaneViewModel.js +++ b/dev/ViewModels/AdminPaneViewModel.js @@ -1,17 +1,18 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../External/ko.js'), + ko = require('ko'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/AdminDataStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -42,4 +43,4 @@ module.exports = AdminPaneViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/LoginViewModel.js b/dev/ViewModels/LoginViewModel.js index 21a1244ad..cb5a1f2cf 100644 --- a/dev/ViewModels/LoginViewModel.js +++ b/dev/ViewModels/LoginViewModel.js @@ -1,24 +1,25 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), + window = require('window'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), - Utils = require('../Common/Utils.js'), - Enums = require('../Common/Enums.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Utils = require('Utils'), + Enums = require('Enums'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('../Storages/AppSettings.js'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'), + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel'), PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js') ; @@ -371,4 +372,4 @@ module.exports = LoginViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/MailBoxFolderListViewModel.js b/dev/ViewModels/MailBoxFolderListViewModel.js index f71a7632d..e4b274cf8 100644 --- a/dev/ViewModels/MailBoxFolderListViewModel.js +++ b/dev/ViewModels/MailBoxFolderListViewModel.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../External/window.js'), - $ = require('../External/jquery.js'), - ko = require('../External/ko.js'), - key = require('../External/key.js'), - $html = require('../External/$html.js'), + window = require('window'), + $ = require('$'), + ko = require('ko'), + key = require('key'), + $html = require('$html'), - Utils = require('../Common/Utils.js'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Utils = require('Utils'), + Enums = require('Enums'), + Globals = require('Globals'), + LinkBuilder = require('LinkBuilder'), AppSettings = require('../Storages/AppSettings.js'), Cache = require('../Storages/WebMailCacheStorage.js'), @@ -23,8 +24,8 @@ PopupsFolderCreateViewModel = require('./Popups/PopupsFolderCreateViewModel.js'), PopupsContactsViewModel = require('./Popups/PopupsContactsViewModel.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -279,4 +280,4 @@ module.exports = MailBoxFolderListViewModel; -}(module)); +}(module, require)); diff --git a/dev/ViewModels/MailBoxMessageListViewModel.js b/dev/ViewModels/MailBoxMessageListViewModel.js index 1911bfe72..ee9f4833d 100644 --- a/dev/ViewModels/MailBoxMessageListViewModel.js +++ b/dev/ViewModels/MailBoxMessageListViewModel.js @@ -1,31 +1,32 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - $ = require('../External/jquery.js'), - _ = require('../External/underscore.js'), - ko = require('../External/ko.js'), - key = require('../External/key.js'), - ifvisible = require('../External/ifvisible.js'), - Jua = require('../External/Jua.js'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + key = require('key'), + ifvisible = require('ifvisible'), + Jua = require('Jua'), - Enums = require('../Common/Enums.js'), - Consts = require('../Common/Consts.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), - Events = require('../Common/Events.js'), - Selector = require('../Common/Selector.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), + Events = require('Events'), + Selector = require('Selector'), AppSettings = require('../Storages/AppSettings.js'), Cache = require('../Storages/WebMailCacheStorage.js'), Data = require('../Storages/WebMailDataStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'), + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel'), PopupsComposeViewModel = require('./Popups/PopupsComposeViewModel.js'), PopupsAdvancedSearchViewModel = require('./Popups/PopupsAdvancedSearchViewModel.js'), @@ -942,4 +943,4 @@ module.exports = MailBoxMessageListViewModel; -}(module)); +}(module, require)); diff --git a/dev/ViewModels/MailBoxMessageViewViewModel.js b/dev/ViewModels/MailBoxMessageViewViewModel.js index 6e6b985da..06d7ac372 100644 --- a/dev/ViewModels/MailBoxMessageViewViewModel.js +++ b/dev/ViewModels/MailBoxMessageViewViewModel.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - $ = require('../External/jquery.js'), - ko = require('../External/ko.js'), - key = require('../External/key.js'), - $html = require('../External/$html.js'), + $ = require('$'), + ko = require('ko'), + key = require('key'), + $html = require('$html'), - Consts = require('../Common/Consts.js'), - Enums = require('../Common/Enums.js'), - Globals = require('../Common/Globals.js'), - Utils = require('../Common/Utils.js'), - Events = require('../Common/Events.js'), + Consts = require('Consts'), + Enums = require('Enums'), + Globals = require('Globals'), + Utils = require('Utils'), + Events = require('Events'), Cache = require('../Storages/WebMailCacheStorage.js'), Data = require('../Storages/WebMailDataStorage.js'), @@ -21,8 +22,8 @@ PopupsComposeViewModel = require('./Popups/PopupsComposeViewModel.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -719,4 +720,4 @@ module.exports = MailBoxMessageViewViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/MailBoxSystemDropDownViewModel.js b/dev/ViewModels/MailBoxSystemDropDownViewModel.js index 8aee646b5..55d3f1a96 100644 --- a/dev/ViewModels/MailBoxSystemDropDownViewModel.js +++ b/dev/ViewModels/MailBoxSystemDropDownViewModel.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js') ; @@ -22,4 +23,4 @@ module.exports = MailBoxSystemDropDownViewModel; -}(module)); +}(module, require)); diff --git a/dev/ViewModels/Popups/PopupsActivateViewModel.js b/dev/ViewModels/Popups/PopupsActivateViewModel.js index d366fb44a..680c71ce0 100644 --- a/dev/ViewModels/Popups/PopupsActivateViewModel.js +++ b/dev/ViewModels/Popups/PopupsActivateViewModel.js @@ -1,20 +1,21 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), AppSettings = require('../../Storages/AppSettings.js'), Data = require('../../Storages/AdminDataStorage.js'), Remote = require('../../Storages/AdminAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -136,4 +137,4 @@ module.exports = PopupsActivateViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsAddAccountViewModel.js b/dev/ViewModels/Popups/PopupsAddAccountViewModel.js index c8c77dda3..7710b0a48 100644 --- a/dev/ViewModels/Popups/PopupsAddAccountViewModel.js +++ b/dev/ViewModels/Popups/PopupsAddAccountViewModel.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -114,4 +115,4 @@ module.exports = PopupsAddAccountViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js b/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js index 8f5b60b43..153f8a526 100644 --- a/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js +++ b/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js @@ -1,17 +1,18 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Utils = require('../../Common/Utils.js'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -107,4 +108,4 @@ module.exports = PopupsAddOpenPgpKeyViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js b/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js index 0f9fafcc4..46874e34e 100644 --- a/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js +++ b/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../../External/ko.js'), - moment = require('../../External/moment.js'), + ko = require('ko'), + moment = require('moment'), - Utils = require('../../Common/Utils.js'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -153,4 +154,4 @@ module.exports = PopupsAdvancedSearchViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsAskViewModel.js b/dev/ViewModels/Popups/PopupsAskViewModel.js index 7d26e7de9..78d212346 100644 --- a/dev/ViewModels/Popups/PopupsAskViewModel.js +++ b/dev/ViewModels/Popups/PopupsAskViewModel.js @@ -1,17 +1,18 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - ko = require('../../External/ko.js'), - key = require('../../External/key.js'), + ko = require('ko'), + key = require('key'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -126,4 +127,4 @@ module.exports = PopupsAskViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js b/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js index fd9003181..71446c8ed 100644 --- a/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js +++ b/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js @@ -1,23 +1,24 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + 'use strict'; + var - window = require('../../External/window.js'), - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), - key = require('../../External/key.js'), + window = require('window'), + _ = require('_'), + ko = require('ko'), + key = require('key'), - Utils = require('../../Common/Utils.js'), - Enums = require('../../Common/Enums.js'), + Utils = require('Utils'), + Enums = require('Enums'), Data = require('../../Storages/WebMailDataStorage.js'), EmailModel = require('../../Models/EmailModel.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -261,4 +262,4 @@ module.exports = PopupsComposeOpenPgpViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsComposeViewModel.js b/dev/ViewModels/Popups/PopupsComposeViewModel.js index 9d3be30af..8361c1bb4 100644 --- a/dev/ViewModels/Popups/PopupsComposeViewModel.js +++ b/dev/ViewModels/Popups/PopupsComposeViewModel.js @@ -1,24 +1,26 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../../External/window.js'), - $ = require('../../External/jquery.js'), - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), - moment = require('../../External/moment.js'), - $window = require('../../External/$window.js'), - JSON = require('../../External/JSON.js'), + window = require('window'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + moment = require('moment'), + $window = require('$window'), + JSON = require('JSON'), + Jua = require('Jua'), - Enums = require('../../Common/Enums.js'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js'), - Globals = require('../../Common/Globals.js'), - LinkBuilder = require('../../Common/LinkBuilder.js'), - Events = require('../../Common/Events.js'), - NewHtmlEditorWrapper = require('../../Common/NewHtmlEditorWrapper.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Utils = require('Utils'), + Globals = require('Globals'), + LinkBuilder = require('LinkBuilder'), + Events = require('Events'), + NewHtmlEditorWrapper = require('NewHtmlEditorWrapper'), AppSettings = require('../../Storages/AppSettings.js'), Data = require('../../Storages/WebMailDataStorage.js'), @@ -31,8 +33,8 @@ PopupsFolderSystemViewModel = require('./PopupsFolderSystemViewModel.js'), PopupsAskViewModel = require('./PopupsAskViewModel.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -1783,4 +1785,4 @@ module.exports = PopupsComposeViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsContactsViewModel.js b/dev/ViewModels/Popups/PopupsContactsViewModel.js index c2cff6a10..3c750b777 100644 --- a/dev/ViewModels/Popups/PopupsContactsViewModel.js +++ b/dev/ViewModels/Popups/PopupsContactsViewModel.js @@ -1,21 +1,22 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../../External/window.js'), - $ = require('../../External/jquery.js'), - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), - key = require('../../External/key.js'), + window = require('window'), + $ = require('$'), + _ = require('_'), + ko = require('ko'), + key = require('key'), - Enums = require('../../Common/Enums.js'), - Consts = require('../../Common/Consts.js'), - Globals = require('../../Common/Globals.js'), - Utils = require('../../Common/Utils.js'), - LinkBuilder = require('../../Common/LinkBuilder.js'), - Selector = require('../../Common/Selector.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Globals = require('Globals'), + Utils = require('Utils'), + LinkBuilder = require('LinkBuilder'), + Selector = require('Selector'), Data = require('../../Storages/WebMailDataStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), @@ -27,8 +28,8 @@ PopupsComposeViewModel = require('./PopupsComposeViewModel.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -786,4 +787,4 @@ module.exports = PopupsContactsViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsDomainViewModel.js b/dev/ViewModels/Popups/PopupsDomainViewModel.js index 119c2c128..af651a893 100644 --- a/dev/ViewModels/Popups/PopupsDomainViewModel.js +++ b/dev/ViewModels/Popups/PopupsDomainViewModel.js @@ -1,20 +1,21 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Utils = require('Utils'), Remote = require('../../Storages/AdminAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -316,4 +317,4 @@ module.exports = PopupsDomainViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsFilterViewModel.js b/dev/ViewModels/Popups/PopupsFilterViewModel.js index a23efb2f7..a904be722 100644 --- a/dev/ViewModels/Popups/PopupsFilterViewModel.js +++ b/dev/ViewModels/Popups/PopupsFilterViewModel.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js'), + Consts = require('Consts'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -48,4 +49,4 @@ module.exports = PopupsFilterViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsFolderClearViewModel.js b/dev/ViewModels/Popups/PopupsFolderClearViewModel.js index c05e312a3..d1ab901da 100644 --- a/dev/ViewModels/Popups/PopupsFolderClearViewModel.js +++ b/dev/ViewModels/Popups/PopupsFolderClearViewModel.js @@ -1,20 +1,21 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), Cache = require('../../Storages/WebMailCacheStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -117,4 +118,4 @@ module.exports = PopupsFolderClearViewModel; -}(module)); +}(module, require)); diff --git a/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js b/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js index 194981887..d817ee0fc 100644 --- a/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js +++ b/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js @@ -1,20 +1,21 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -128,4 +129,4 @@ module.exports = PopupsFolderCreateViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js b/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js index 4585afbcc..db21f5b7b 100644 --- a/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js +++ b/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js @@ -1,21 +1,22 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Consts = require('../../Common/Consts.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Consts = require('Consts'), + Utils = require('Utils'), AppSettings = require('../../Storages/AppSettings.js'), Data = require('../../Storages/WebMailDataStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -131,4 +132,4 @@ module.exports = PopupsFolderSystemViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js b/dev/ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js index 36ad9c617..1e3eaa960 100644 --- a/dev/ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js +++ b/dev/ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - window = require('../../External/window.js'), - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), + window = require('window'), + _ = require('_'), + ko = require('ko'), - Utils = require('../../Common/Utils.js'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -114,4 +115,4 @@ module.exports = PopupsGenerateNewOpenPgpKeyViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsIdentityViewModel.js b/dev/ViewModels/Popups/PopupsIdentityViewModel.js index e791ec934..4c3483f1a 100644 --- a/dev/ViewModels/Popups/PopupsIdentityViewModel.js +++ b/dev/ViewModels/Popups/PopupsIdentityViewModel.js @@ -1,19 +1,20 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), - kn = require('../../Knoin/Knoin.js'), + Enums = require('Enums'), + Utils = require('Utils'), + kn = require('kn'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -168,4 +169,4 @@ module.exports = PopupsIdentityViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js b/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js index cb13e9786..134dba740 100644 --- a/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js +++ b/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js @@ -1,16 +1,17 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../../External/underscore.js'), - key = require('../../External/key.js'), + _ = require('_'), + key = require('key'), - Enums = require('../../Common/Enums.js'), + Enums = require('Enums'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -60,4 +61,4 @@ module.exports = PopupsKeyboardShortcutsHelpViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsLanguagesViewModel.js b/dev/ViewModels/Popups/PopupsLanguagesViewModel.js index 1fce93198..af5b27724 100644 --- a/dev/ViewModels/Popups/PopupsLanguagesViewModel.js +++ b/dev/ViewModels/Popups/PopupsLanguagesViewModel.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), + _ = require('_'), + ko = require('ko'), - Utils = require('../../Common/Utils.js'), + Utils = require('Utils'), Data = require('../../Storages/WebMailDataStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -77,4 +78,4 @@ module.exports = PopupsLanguagesViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsPluginViewModel.js b/dev/ViewModels/Popups/PopupsPluginViewModel.js index 9c24d3cfa..3c1035261 100644 --- a/dev/ViewModels/Popups/PopupsPluginViewModel.js +++ b/dev/ViewModels/Popups/PopupsPluginViewModel.js @@ -1,22 +1,23 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - _ = require('../../External/underscore.js'), - ko = require('../../External/ko.js'), - key = require('../../External/key.js'), + _ = require('_'), + ko = require('ko'), + key = require('key'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Remote = require('../../Storages/AdminAjaxRemoteStorage.js'), PopupsAskViewModel = require('./PopupsAskViewModel.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -163,4 +164,4 @@ module.exports = PopupsPluginViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js b/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js index d4f3c8477..ba3e9afbe 100644 --- a/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js +++ b/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Enums = require('../../Common/Enums.js'), - Utils = require('../../Common/Utils.js'), + Enums = require('Enums'), + Utils = require('Utils'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -71,4 +72,4 @@ module.exports = PopupsTwoFactorTestViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js b/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js index 72a3ea774..35d05c78d 100644 --- a/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js +++ b/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js @@ -1,15 +1,16 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - ko = require('../../External/ko.js'), + ko = require('ko'), - Utils = require('../../Common/Utils.js'), + Utils = require('Utils'), - kn = require('../../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -54,4 +55,4 @@ module.exports = PopupsViewOpenPgpKeyViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/SettingsMenuViewModel.js b/dev/ViewModels/SettingsMenuViewModel.js index 6d003ab11..aa3bf3e99 100644 --- a/dev/ViewModels/SettingsMenuViewModel.js +++ b/dev/ViewModels/SettingsMenuViewModel.js @@ -1,14 +1,15 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - LinkBuilder = require('../Common/LinkBuilder.js'), - Globals = require('../Common/Globals.js'), + LinkBuilder = require('LinkBuilder'), + Globals = require('Globals'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -42,4 +43,4 @@ module.exports = SettingsMenuViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/SettingsPaneViewModel.js b/dev/ViewModels/SettingsPaneViewModel.js index c1f1432a6..9c6a803be 100644 --- a/dev/ViewModels/SettingsPaneViewModel.js +++ b/dev/ViewModels/SettingsPaneViewModel.js @@ -1,18 +1,19 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - key = require('../External/key.js'), + key = require('key'), - Enums = require('../Common/Enums.js'), - LinkBuilder = require('../Common/LinkBuilder.js'), + Enums = require('Enums'), + LinkBuilder = require('LinkBuilder'), Data = require('../Storages/WebMailDataStorage.js'), - kn = require('../Knoin/Knoin.js'), - KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') + kn = require('kn'), + KnoinAbstractViewModel = require('KnoinAbstractViewModel') ; /** @@ -48,4 +49,4 @@ module.exports = SettingsPaneViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/ViewModels/SettingsSystemDropDownViewModel.js b/dev/ViewModels/SettingsSystemDropDownViewModel.js index e9cf5f069..c4d328229 100644 --- a/dev/ViewModels/SettingsSystemDropDownViewModel.js +++ b/dev/ViewModels/SettingsSystemDropDownViewModel.js @@ -1,10 +1,11 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -'use strict'; -(function (module) { +(function (module, require) { + + 'use strict'; var - kn = require('../Knoin/Knoin.js'), + kn = require('kn'), AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js') ; @@ -22,4 +23,4 @@ module.exports = SettingsSystemDropDownViewModel; -}(module)); \ No newline at end of file +}(module, require)); \ No newline at end of file diff --git a/dev/_AdminBoot.js b/dev/_AdminBoot.js index 7740c2669..19524c3c7 100644 --- a/dev/_AdminBoot.js +++ b/dev/_AdminBoot.js @@ -1,10 +1,6 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -(function () { - +(function (require) { 'use strict'; - - var boot = require('./Boots/Boot.js'); - boot(require('./Boots/AdminApp.js')); - -}()); \ No newline at end of file + require('Boot')(require('./Boots/AdminApp.js')); +}(require)); \ No newline at end of file diff --git a/dev/_RainLoopBoot.js b/dev/_RainLoopBoot.js index eeda2785f..1d55ba08a 100644 --- a/dev/_RainLoopBoot.js +++ b/dev/_RainLoopBoot.js @@ -1,10 +1,6 @@ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -(function () { - +(function (require) { 'use strict'; - - var boot = require('./Boots/Boot.js'); - boot(require('./Boots/RainLoopApp.js')); - -}()); \ No newline at end of file + require('Boot')(require('./Boots/RainLoopApp.js')); +}(require)); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index be879646b..6f337ca4a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -25,6 +25,10 @@ var } }, + browserify = require('browserify'), + streamify = require('gulp-streamify'), + source = require('vinyl-source-stream'), + fs = require('node-fs'), path = require('path'), gulp = require('gulp'), @@ -60,7 +64,7 @@ function zipDir(sSrcDir, sDestDir, sFileName) function cleanDir(sDir) { return gulp.src(sDir, {read: false}) - .pipe(require('gulp-clean')()); + .pipe(require('gulp-rimraf')()); } function renameFileWothMd5Hash(sFile) @@ -70,6 +74,7 @@ function renameFileWothMd5Hash(sFile) return true; } +cfg.paths.globjs = 'dev/**/*.js'; cfg.paths.staticJS = 'rainloop/v/' + cfg.devVersion + '/static/js/'; cfg.paths.staticCSS = 'rainloop/v/' + cfg.devVersion + '/static/css/'; @@ -165,180 +170,11 @@ cfg.paths.js = { }, app: { name: 'app.js', - name_min: 'app.min.js', - src: [ - 'dev/Common/_Begin.js', - 'dev/Common/_BeginW.js', - - 'dev/Common/Globals.js', - 'dev/Common/Constants.js', - 'dev/Common/Enums.js', - 'dev/Common/Utils.js', - 'dev/Common/Base64.js', - 'dev/Common/Knockout.js', - 'dev/Common/LinkBuilder.js', - 'dev/Common/Plugins.js', - 'dev/Common/NewHtmlEditorWrapper.js', - 'dev/Common/Selector.js', - - 'dev/Storages/LocalStorages/CookieDriver.js', - 'dev/Storages/LocalStorages/LocalStorageDriver.js', - 'dev/Storages/LocalStorage.js', - - 'dev/Knoin/AbstractBoot.js', - 'dev/Knoin/AbstractViewModel.js', - 'dev/Knoin/AbstractScreen.js', - 'dev/Knoin/Knoin.js', - - 'dev/Models/EmailModel.js', - 'dev/Models/ContactModel.js', - 'dev/Models/ContactPropertyModel.js', - 'dev/Models/ContactTagModel.js', - 'dev/Models/AttachmentModel.js', - 'dev/Models/ComposeAttachmentModel.js', - 'dev/Models/MessageModel.js', - 'dev/Models/FolderModel.js', - 'dev/Models/AccountModel.js', - 'dev/Models/IdentityModel.js', - 'dev/Models/FilterConditionModel.js', - 'dev/Models/FilterModel.js', - 'dev/Models/OpenPgpKeyModel.js', - - 'dev/ViewModels/Popups/PopupsFolderClearViewModel.js', - 'dev/ViewModels/Popups/PopupsFolderCreateViewModel.js', - 'dev/ViewModels/Popups/PopupsFolderSystemViewModel.js', - 'dev/ViewModels/Popups/PopupsComposeViewModel.js', - 'dev/ViewModels/Popups/PopupsContactsViewModel.js', - 'dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js', - 'dev/ViewModels/Popups/PopupsAddAccountViewModel.js', - 'dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js', - 'dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js', - 'dev/ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js', - 'dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js', - 'dev/ViewModels/Popups/PopupsIdentityViewModel.js', - 'dev/ViewModels/Popups/PopupsLanguagesViewModel.js', - 'dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js', - 'dev/ViewModels/Popups/PopupsAskViewModel.js', - 'dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js', - 'dev/ViewModels/Popups/PopupsFiterViewModel.js', - - 'dev/ViewModels/LoginViewModel.js', - - 'dev/ViewModels/AbstractSystemDropDownViewModel.js', - 'dev/ViewModels/MailBoxSystemDropDownViewModel.js', - 'dev/ViewModels/SettingsSystemDropDownViewModel.js', - - 'dev/ViewModels/MailBoxFolderListViewModel.js', - 'dev/ViewModels/MailBoxMessageListViewModel.js', - 'dev/ViewModels/MailBoxMessageViewViewModel.js', - - 'dev/ViewModels/SettingsMenuViewModel.js', - 'dev/ViewModels/SettingsPaneViewModel.js', - - 'dev/Settings/General.js', - 'dev/Settings/Contacts.js', - 'dev/Settings/Accounts.js', - 'dev/Settings/Identity.js', - 'dev/Settings/Identities.js', - 'dev/Settings/Filters.js', - 'dev/Settings/Security.js', - 'dev/Settings/Social.js', - 'dev/Settings/ChangePassword.js', - 'dev/Settings/Folders.js', - 'dev/Settings/Themes.js', - 'dev/Settings/OpenPGP.js', - - 'dev/Storages/AbstractData.js', - 'dev/Storages/WebMailData.js', - - 'dev/Storages/AbstractAjaxRemote.js', - 'dev/Storages/WebMailAjaxRemote.js', - - 'dev/Storages/AbstractCache.js', - 'dev/Storages/WebMailCache.js', - - 'dev/Screens/AbstractSettings.js', - - 'dev/Screens/Login.js', - 'dev/Screens/MailBox.js', - 'dev/Screens/Settings.js', - - 'dev/Boots/AbstractApp.js', - 'dev/Boots/RainLoopApp.js', - - 'dev/Common/_End.js' - ] + name_min: 'app.min.js' }, admin: { name: 'admin.js', - name_min: 'admin.min.js', - src: [ - 'dev/Common/_Begin.js', - 'dev/Common/_BeginA.js', - - 'dev/Common/Globals.js', - 'dev/Common/Constants.js', - 'dev/Common/Enums.js', - 'dev/Common/Utils.js', - 'dev/Common/Base64.js', - 'dev/Common/Knockout.js', - 'dev/Common/LinkBuilder.js', - 'dev/Common/Plugins.js', - - 'dev/Storages/LocalStorages/CookieDriver.js', - 'dev/Storages/LocalStorages/LocalStorageDriver.js', - 'dev/Storages/LocalStorage.js', - - 'dev/Knoin/AbstractBoot.js', - 'dev/Knoin/AbstractViewModel.js', - 'dev/Knoin/AbstractScreen.js', - 'dev/Knoin/Knoin.js', - - 'dev/Models/EmailModel.js', - 'dev/Models/ContactTagModel.js', - - 'dev/ViewModels/Popups/PopupsDomainViewModel.js', - 'dev/ViewModels/Popups/PopupsPluginViewModel.js', - 'dev/ViewModels/Popups/PopupsActivateViewModel.js', - 'dev/ViewModels/Popups/PopupsLanguagesViewModel.js', - 'dev/ViewModels/Popups/PopupsAskViewModel.js', - - 'dev/ViewModels/AdminLoginViewModel.js', - - 'dev/ViewModels/AdminMenuViewModel.js', - 'dev/ViewModels/AdminPaneViewModel.js', - - 'dev/Admin/General.js', - 'dev/Admin/Login.js', - 'dev/Admin/Branding.js', - 'dev/Admin/Contacts.js', - 'dev/Admin/Domains.js', - 'dev/Admin/Security.js', - 'dev/Admin/Social.js', - 'dev/Admin/Plugins.js', - 'dev/Admin/Packages.js', - 'dev/Admin/Licensing.js', - 'dev/Admin/About.js', - - 'dev/Storages/AbstractData.js', - 'dev/Storages/AdminData.js', - - 'dev/Storages/AbstractAjaxRemote.js', - 'dev/Storages/AdminAjaxRemote.js', - - 'dev/Storages/AbstractCache.js', - 'dev/Storages/AdminCache.js', - - 'dev/Screens/AbstractSettings.js', - - 'dev/Screens/AdminLogin.js', - 'dev/Screens/AdminSettings.js', - - 'dev/Boots/AbstractApp.js', - 'dev/Boots/AdminApp.js', - - 'dev/Common/_End.js' - ] + name_min: 'admin.min.js' } }; @@ -396,40 +232,33 @@ gulp.task('js:libs', function() { }); gulp.task('js:app', function() { - return gulp.src(cfg.paths.js.app.src) - .pipe(concat(cfg.paths.js.app.name)) - .pipe(header('/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n' + - '(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible, key) {\n')) - .pipe(footer('\n\n}(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible, key));')) - .pipe(gulp.dest(cfg.paths.staticJS)); + return browserify({ + 'basedir': './dev/', + 'detectGlobals': false, + 'debug': false + }) + .add('./_RainLoopBoot.js') + .bundle() + .pipe(source(cfg.paths.js.app.name)) + .pipe(gulp.dest(cfg.paths.staticJS)) + .on('error', gutil.log); }); gulp.task('js:admin', function() { - return gulp.src(cfg.paths.js.admin.src) - .pipe(concat(cfg.paths.js.admin.name)) - .pipe(header('/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n' + - '(function (window, $, ko, crossroads, hasher, _) {\n')) - .pipe(footer('\n\n}(window, jQuery, ko, crossroads, hasher, _));')) - .pipe(gulp.dest(cfg.paths.staticJS)); -}); - -// - lint -gulp.task('js:app:lint', ['js:app'], function() { - return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name) - .pipe(jshint('.jshintrc')) - .pipe(jshint.reporter('jshint-summary', cfg.summary)) - .pipe(jshint.reporter('fail')); -}); - -gulp.task('js:admin:lint', ['js:admin'], function() { - return gulp.src(cfg.paths.staticJS + cfg.paths.js.admin.name) - .pipe(jshint('.jshintrc')) - .pipe(jshint.reporter('jshint-summary', cfg.summary)) - .pipe(jshint.reporter('fail')); + return browserify({ + 'basedir': './dev/', + 'detectGlobals': false, + 'debug': false + }) + .add('./_AdminBoot.js') + .bundle() + .pipe(source(cfg.paths.js.admin.name)) + .pipe(gulp.dest(cfg.paths.staticJS)) + .on('error', gutil.log); }); // - min -gulp.task('js:app:min', ['js:app:lint'], function() { +gulp.task('js:app:min', ['js:app'], function() { return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name) .pipe(rename(cfg.paths.js.app.name_min)) .pipe(uglify(cfg.uglify)) @@ -437,7 +266,7 @@ gulp.task('js:app:min', ['js:app:lint'], function() { .on('error', gutil.log); }); -gulp.task('js:admin:min', ['js:admin:lint'], function() { +gulp.task('js:admin:min', ['js:admin'], function() { return gulp.src(cfg.paths.staticJS + cfg.paths.js.admin.name) .pipe(rename(cfg.paths.js.admin.name_min)) .pipe(uglify(cfg.uglify)) @@ -445,6 +274,14 @@ gulp.task('js:admin:min', ['js:admin:lint'], function() { .on('error', gutil.log); }); +// lint +gulp.task('js:lint', function() { + return gulp.src(cfg.paths.globjs) + .pipe(jshint('.jshintrc')) + .pipe(jshint.reporter('jshint-summary', cfg.summary)) + .pipe(jshint.reporter('fail')); +}); + // OTHER regOtherMinTask('other:cookie', 'vendors/jquery-cookie/', 'jquery.cookie.js', 'jquery.cookie-1.4.0.min.js', '/*! jquery.cookie v1.4.0 (c) 2013 Klaus Hartl | MIT */\n'); @@ -581,7 +418,7 @@ gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:ownclo }); // MAIN -gulp.task('default', ['js:boot', 'js:libs', 'js:app:min', 'js:admin:min', 'css:main:min']); +gulp.task('default', ['js:boot', 'js:libs', 'js:lint', 'js:app:min', 'js:admin:min', 'css:main:min']); gulp.task('fast', ['js:app', 'js:admin', 'css:main']); gulp.task('rainloop', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip', 'rainloop:md5', 'rainloop:clean']); @@ -591,9 +428,8 @@ gulp.task('owncloud', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup', 'rai //WATCH gulp.task('watch', ['fast'], function() { - gulp.watch(cfg.paths.js.app.src, {interval: 1000}, ['js:app']); - gulp.watch(cfg.paths.js.admin.src, {interval: 1000}, ['js:admin']); - gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']); + gulp.watch(cfg.paths.globjs, {interval: 500}, ['js:app', 'js:admin']); + gulp.watch(cfg.paths.less.main.watch, {interval: 500}, ['css:main']); }); // aliases @@ -607,39 +443,4 @@ gulp.task('build+', ['rainloop+']); gulp.task('b', ['rainloop']); gulp.task('b+', ['rainloop+']); -gulp.task('own', ['owncloud']); - -var browserify = require('browserify'); -var streamify = require('gulp-streamify'); -var source = require('vinyl-source-stream'); - -gulp.task('bro', function() { - return browserify({ - 'basedir': './dev/', - 'detectGlobals': false, - 'debug': false - }) - .add('./_RainLoopBoot.js') - .bundle() - .pipe(source('app.js')) - - .pipe(streamify(jshint('.jshintrc'))) - .pipe(jshint.reporter('jshint-summary', cfg.summary)) - .pipe(jshint.reporter('fail')) - -// .pipe(rename('app.min.js')) -// .pipe(streamify(uglify(cfg.uglify))) - .pipe(gulp.dest(cfg.paths.staticJS)) - .on('error', gutil.log); -}); - -gulp.task('lint', function() { - return gulp.src('./dev/**/*.js') - .pipe(jshint('.jshintrc')) - .pipe(jshint.reporter('jshint-summary', cfg.summary)) - .pipe(jshint.reporter('fail')); -}); - -gulp.task('ww', ['bro'], function() { - gulp.watch('dev/**/*.js', {interval: 1000}, ['bro']); -}); \ No newline at end of file +gulp.task('own', ['owncloud']); \ No newline at end of file diff --git a/package.json b/package.json index 3adba3162..7c21c8dfd 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,46 @@ "engines": { "node": ">= 0.10.0" }, + "browser": { + "window": "./dev/External/window.js", + "JSON": "./dev/External/JSON.js", + "$": "./dev/External/jquery.js", + "jquery": "./dev/External/jquery.js", + "_": "./dev/External/underscore.js", + "underscore": "./dev/External/underscore.js", + "ko": "./dev/External/ko.js", + "key": "./dev/External/key.js", + "moment": "./dev/External/moment.js", + "crossroads": "./dev/External/crossroads.js", + "hasher": "./dev/External/hasher.js", + "ifvisible": "./dev/External/ifvisible.js", + "ssm": "./dev/External/ssm.js", + "Jua": "./dev/External/Jua.js", + "AppData": "./dev/External/AppData.js", + "NotificationClass": "./dev/External/NotificationClass.js", + "$window": "./dev/External/$window.js", + "$html": "./dev/External/$html.js", + "$doc": "./dev/External/$doc.js", + "$div": "./dev/External/$div.js", + + "Base64": "./dev/Common/Base64.js", + "Consts": "./dev/Common/Consts.js", + "Globals": "./dev/Common/Globals.js", + "Plugins": "./dev/Common/Plugins.js", + "Enums": "./dev/Common/Enums.js", + "Utils": "./dev/Common/Utils.js", + "Events": "./dev/Common/Events.js", + "Selector": "./dev/Common/Selector.js", + "LinkBuilder": "./dev/Common/LinkBuilder.js", + "NewHtmlEditorWrapper": "./dev/Common/NewHtmlEditorWrapper.js", + + "Knoin": "./dev/Knoin/Knoin.js", + "KnoinAbstractBoot": "./dev/Knoin/KnoinAbstractBoot.js", + "KnoinAbstractScreen": "./dev/Knoin/KnoinAbstractScreen.js", + "KnoinAbstractViewModel": "./dev/Knoin/KnoinAbstractViewModel.js", + "kn": "./dev/Knoin/Knoin.js", + "Boot": "./dev/Boots/Boot.js" + }, "devDependencies": { "crypto": "*", @@ -47,12 +87,12 @@ "jshint-summary": "*", "browserify": "*", - "vinyl-source-stream": "latest", + "vinyl-source-stream": "*", "gulp": "*", "gulp-util": "*", "gulp-uglify": "*", - "gulp-clean": "*", + "gulp-rimraf": "*", "gulp-jshint": "*", "gulp-less": "*", "gulp-zip": "*", diff --git a/rainloop/v/0.0.0/static/js/_app.js b/rainloop/v/0.0.0/static/js/_app.js deleted file mode 100644 index a47a2226a..000000000 --- a/rainloop/v/0.0.0/static/js/_app.js +++ /dev/null @@ -1,21415 +0,0 @@ -/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible, key) { - -'use strict'; - -var - /** - * @type {Object} - */ - Consts = {}, - - /** - * @type {Object} - */ - Enums = {}, - - /** - * @type {Object} - */ - NotificationI18N = {}, - - /** - * @type {Object.]*>([\s\S\r\n]*)<\/pre>/gmi, convertPre)
- .replace(/[\s]+/gm, ' ')
- .replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gmi, fixAttibuteValue)
- .replace(/
]*>/gmi, '\n')
- .replace(/<\/h[\d]>/gi, '\n')
- .replace(/<\/p>/gi, '\n\n')
- .replace(/<\/li>/gi, '\n')
- .replace(/<\/td>/gi, '\n')
- .replace(/<\/tr>/gi, '\n')
- .replace(/
]*>/gmi, '\n_______________________________\n\n')
- .replace(/]*>([\s\S\r\n]*)<\/div>/gmi, convertDivs)
- .replace(/]*>/gmi, '\n__bq__start__\n')
- .replace(/<\/blockquote>/gmi, '\n__bq__end__\n')
- .replace(/]*>([\s\S\r\n]*?)<\/a>/gmi, convertLinks)
- .replace(/<\/div>/gi, '\n')
- .replace(/ /gi, ' ')
- .replace(/"/gi, '"')
- .replace(/<[^>]*>/gm, '')
- ;
-
- sText = Utils.$div.html(sText).text();
-
- sText = sText
- .replace(/\n[ \t]+/gm, '\n')
- .replace(/[\n]{3,}/gm, '\n\n')
- .replace(/>/gi, '>')
- .replace(/</gi, '<')
- .replace(/&/gi, '&')
- ;
-
- iPos = 0;
- iLimit = 100;
-
- while (0 < iLimit)
- {
- iLimit--;
- iP1 = sText.indexOf('__bq__start__', iPos);
- if (-1 < iP1)
- {
- iP2 = sText.indexOf('__bq__start__', iP1 + 5);
- iP3 = sText.indexOf('__bq__end__', iP1 + 5);
-
- if ((-1 === iP2 || iP3 < iP2) && iP1 < iP3)
- {
- sText = sText.substring(0, iP1) +
- convertBlockquote(sText.substring(iP1 + 13, iP3)) +
- sText.substring(iP3 + 11);
-
- iPos = 0;
- }
- else if (-1 < iP2 && iP2 < iP3)
- {
- iPos = iP2 - 1;
- }
- else
- {
- iPos = 0;
- }
- }
- else
- {
- break;
- }
- }
-
- sText = sText
- .replace(/__bq__start__/gm, '')
- .replace(/__bq__end__/gm, '')
- ;
-
- return sText;
-};
-
-/**
- * @param {string} sPlain
- * @param {boolean} bLinkify = false
- * @return {string}
- */
-Utils.plainToHtml = function (sPlain, bLinkify)
-{
- sPlain = sPlain.toString().replace(/\r/g, '');
-
- var
- bIn = false,
- bDo = true,
- bStart = true,
- aNextText = [],
- sLine = '',
- iIndex = 0,
- aText = sPlain.split("\n")
- ;
-
- do
- {
- bDo = false;
- aNextText = [];
- for (iIndex = 0; iIndex < aText.length; iIndex++)
- {
- sLine = aText[iIndex];
- bStart = '>' === sLine.substr(0, 1);
- if (bStart && !bIn)
- {
- bDo = true;
- bIn = true;
- aNextText.push('~~~blockquote~~~');
- aNextText.push(sLine.substr(1));
- }
- else if (!bStart && bIn)
- {
- bIn = false;
- aNextText.push('~~~/blockquote~~~');
- aNextText.push(sLine);
- }
- else if (bStart && bIn)
- {
- aNextText.push(sLine.substr(1));
- }
- else
- {
- aNextText.push(sLine);
- }
- }
-
- if (bIn)
- {
- bIn = false;
- aNextText.push('~~~/blockquote~~~');
- }
-
- aText = aNextText;
- }
- while (bDo);
-
- sPlain = aText.join("\n");
-
- sPlain = sPlain
- .replace(/&/g, '&')
- .replace(/>/g, '>').replace(/')
- .replace(/[\s]*~~~\/blockquote~~~/g, '
')
- .replace(/[\-_~]{10,}/g, '
')
- .replace(/\n/g, '
');
-
- return bLinkify ? Utils.linkify(sPlain) : sPlain;
-};
-
-window.rainloop_Utils_htmlToPlain = Utils.htmlToPlain;
-window.rainloop_Utils_plainToHtml = Utils.plainToHtml;
-
-/**
- * @param {string} sHtml
- * @return {string}
- */
-Utils.linkify = function (sHtml)
-{
- if ($.fn && $.fn.linkify)
- {
- sHtml = Utils.$div.html(sHtml.replace(/&/ig, 'amp_amp_12345_amp_amp'))
- .linkify()
- .find('.linkified').removeClass('linkified').end()
- .html()
- .replace(/amp_amp_12345_amp_amp/g, '&')
- ;
- }
-
- return sHtml;
-};
-
-Utils.resizeAndCrop = function (sUrl, iValue, fCallback)
-{
- var oTempImg = new window.Image();
- oTempImg.onload = function() {
-
- var
- aDiff = [0, 0],
- oCanvas = document.createElement('canvas'),
- oCtx = oCanvas.getContext('2d')
- ;
-
- oCanvas.width = iValue;
- oCanvas.height = iValue;
-
- if (this.width > this.height)
- {
- aDiff = [this.width - this.height, 0];
- }
- else
- {
- aDiff = [0, this.height - this.width];
- }
-
- oCtx.fillStyle = '#fff';
- oCtx.fillRect(0, 0, iValue, iValue);
- oCtx.drawImage(this, aDiff[0] / 2, aDiff[1] / 2, this.width - aDiff[0], this.height - aDiff[1], 0, 0, iValue, iValue);
-
- fCallback(oCanvas.toDataURL('image/jpeg'));
- };
-
- oTempImg.src = sUrl;
-};
-
-Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
-{
- return function() {
- var
- iPrev = 0,
- iNext = 0,
- iLimit = 2,
- aResult = [],
- iCurrentPage = koCurrentPage(),
- iPageCount = koPageCount(),
-
- /**
- * @param {number} iIndex
- * @param {boolean=} bPush
- * @param {string=} sCustomName
- */
- fAdd = function (iIndex, bPush, sCustomName) {
-
- var oData = {
- 'current': iIndex === iCurrentPage,
- 'name': Utils.isUnd(sCustomName) ? iIndex.toString() : sCustomName.toString(),
- 'custom': Utils.isUnd(sCustomName) ? false : true,
- 'title': Utils.isUnd(sCustomName) ? '' : iIndex.toString(),
- 'value': iIndex.toString()
- };
-
- if (Utils.isUnd(bPush) ? true : !!bPush)
- {
- aResult.push(oData);
- }
- else
- {
- aResult.unshift(oData);
- }
- }
- ;
-
- if (1 < iPageCount || (0 < iPageCount && iPageCount < iCurrentPage))
-// if (0 < iPageCount && 0 < iCurrentPage)
- {
- if (iPageCount < iCurrentPage)
- {
- fAdd(iPageCount);
- iPrev = iPageCount;
- iNext = iPageCount;
- }
- else
- {
- if (3 >= iCurrentPage || iPageCount - 2 <= iCurrentPage)
- {
- iLimit += 2;
- }
-
- fAdd(iCurrentPage);
- iPrev = iCurrentPage;
- iNext = iCurrentPage;
- }
-
- while (0 < iLimit) {
-
- iPrev -= 1;
- iNext += 1;
-
- if (0 < iPrev)
- {
- fAdd(iPrev, false);
- iLimit--;
- }
-
- if (iPageCount >= iNext)
- {
- fAdd(iNext, true);
- iLimit--;
- }
- else if (0 >= iPrev)
- {
- break;
- }
- }
-
- if (3 === iPrev)
- {
- fAdd(2, false);
- }
- else if (3 < iPrev)
- {
- fAdd(Math.round((iPrev - 1) / 2), false, '...');
- }
-
- if (iPageCount - 2 === iNext)
- {
- fAdd(iPageCount - 1, true);
- }
- else if (iPageCount - 2 > iNext)
- {
- fAdd(Math.round((iPageCount + iNext) / 2), true, '...');
- }
-
- // first and last
- if (1 < iPrev)
- {
- fAdd(1, false);
- }
-
- if (iPageCount > iNext)
- {
- fAdd(iPageCount, true);
- }
- }
-
- return aResult;
- };
-};
-
-Utils.selectElement = function (element)
-{
- /* jshint onevar: false */
- if (window.getSelection)
- {
- var sel = window.getSelection();
- sel.removeAllRanges();
- var range = document.createRange();
- range.selectNodeContents(element);
- sel.addRange(range);
- }
- else if (document.selection)
- {
- var textRange = document.body.createTextRange();
- textRange.moveToElementText(element);
- textRange.select();
- }
- /* jshint onevar: true */
-};
-
-Utils.disableKeyFilter = function ()
-{
- if (window.key)
- {
- key.filter = function () {
- return RL.data().useKeyboardShortcuts();
- };
- }
-};
-
-Utils.restoreKeyFilter = function ()
-{
- if (window.key)
- {
- key.filter = function (event) {
-
- if (RL.data().useKeyboardShortcuts())
- {
- var
- element = event.target || event.srcElement,
- tagName = element ? element.tagName : ''
- ;
-
- tagName = tagName.toUpperCase();
- return !(tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA' ||
- (element && tagName === 'DIV' && 'editorHtmlArea' === element.className && element.contentEditable)
- );
- }
-
- return false;
- };
- }
-};
-
-Utils.detectDropdownVisibility = _.debounce(function () {
- Globals.dropdownVisibility(!!_.find(BootstrapDropdowns, function (oItem) {
- return oItem.hasClass('open');
- }));
-}, 50);
-
-Utils.triggerAutocompleteInputChange = function (bDelay) {
-
- var fFunc = function () {
- $('.checkAutocomplete').trigger('change');
- };
-
- if (bDelay)
- {
- _.delay(fFunc, 100);
- }
- else
- {
- fFunc();
- }
-};
-
-
-
-/*jslint bitwise: true*/
-// Base64 encode / decode
-// http://www.webtoolkit.info/
-
-Base64 = {
-
- // private property
- _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
-
- // public method for urlsafe encoding
- urlsafe_encode : function (input) {
- return Base64.encode(input).replace(/[+]/g, '-').replace(/[\/]/g, '_').replace(/[=]/g, '.');
- },
-
- // public method for encoding
- encode : function (input) {
- var
- output = '',
- chr1, chr2, chr3, enc1, enc2, enc3, enc4,
- i = 0
- ;
-
- input = Base64._utf8_encode(input);
-
- while (i < input.length)
- {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
-
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
-
- if (isNaN(chr2))
- {
- enc3 = enc4 = 64;
- }
- else if (isNaN(chr3))
- {
- enc4 = 64;
- }
-
- output = output +
- this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
- this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
- }
-
- return output;
- },
-
- // public method for decoding
- decode : function (input) {
- var
- output = '',
- chr1, chr2, chr3, enc1, enc2, enc3, enc4,
- i = 0
- ;
-
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
-
- while (i < input.length)
- {
- enc1 = this._keyStr.indexOf(input.charAt(i++));
- enc2 = this._keyStr.indexOf(input.charAt(i++));
- enc3 = this._keyStr.indexOf(input.charAt(i++));
- enc4 = this._keyStr.indexOf(input.charAt(i++));
-
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
-
- output = output + String.fromCharCode(chr1);
-
- if (enc3 !== 64)
- {
- output = output + String.fromCharCode(chr2);
- }
-
- if (enc4 !== 64)
- {
- output = output + String.fromCharCode(chr3);
- }
- }
-
- return Base64._utf8_decode(output);
- },
-
- // private method for UTF-8 encoding
- _utf8_encode : function (string) {
-
- string = string.replace(/\r\n/g, "\n");
-
- var
- utftext = '',
- n = 0,
- l = string.length,
- c = 0
- ;
-
- for (; n < l; n++) {
-
- c = string.charCodeAt(n);
-
- if (c < 128)
- {
- utftext += String.fromCharCode(c);
- }
- else if ((c > 127) && (c < 2048))
- {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- else
- {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- }
-
- return utftext;
- },
-
- // private method for UTF-8 decoding
- _utf8_decode : function (utftext) {
- var
- string = '',
- i = 0,
- c = 0,
- c2 = 0,
- c3 = 0
- ;
-
- while ( i < utftext.length )
- {
- c = utftext.charCodeAt(i);
-
- if (c < 128)
- {
- string += String.fromCharCode(c);
- i++;
- }
- else if((c > 191) && (c < 224))
- {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- }
- else
- {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
-
- return string;
- }
-};
-
-/*jslint bitwise: false*/
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-ko.bindingHandlers.tooltip = {
- 'init': function (oElement, fValueAccessor) {
- if (!Globals.bMobileDevice)
- {
- var
- $oEl = $(oElement),
- sClass = $oEl.data('tooltip-class') || '',
- sPlacement = $oEl.data('tooltip-placement') || 'top'
- ;
-
- $oEl.tooltip({
- 'delay': {
- 'show': 500,
- 'hide': 100
- },
- 'html': true,
- 'container': 'body',
- 'placement': sPlacement,
- 'trigger': 'hover',
- 'title': function () {
- return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : '' +
- Utils.i18n(ko.utils.unwrapObservable(fValueAccessor())) + '';
- }
- }).click(function () {
- $oEl.tooltip('hide');
- });
-
- Globals.tooltipTrigger.subscribe(function () {
- $oEl.tooltip('hide');
- });
- }
- }
-};
-
-ko.bindingHandlers.tooltip2 = {
- 'init': function (oElement, fValueAccessor) {
- var
- $oEl = $(oElement),
- sClass = $oEl.data('tooltip-class') || '',
- sPlacement = $oEl.data('tooltip-placement') || 'top'
- ;
-
- $oEl.tooltip({
- 'delay': {
- 'show': 500,
- 'hide': 100
- },
- 'html': true,
- 'container': 'body',
- 'placement': sPlacement,
- 'title': function () {
- return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
- '' + fValueAccessor()() + '';
- }
- }).click(function () {
- $oEl.tooltip('hide');
- });
-
- Globals.tooltipTrigger.subscribe(function () {
- $oEl.tooltip('hide');
- });
- }
-};
-
-ko.bindingHandlers.tooltip3 = {
- 'init': function (oElement) {
-
- var $oEl = $(oElement);
-
- $oEl.tooltip({
- 'container': 'body',
- 'trigger': 'hover manual',
- 'title': function () {
- return $oEl.data('tooltip3-data') || '';
- }
- });
-
- $document.click(function () {
- $oEl.tooltip('hide');
- });
-
- Globals.tooltipTrigger.subscribe(function () {
- $oEl.tooltip('hide');
- });
- },
- 'update': function (oElement, fValueAccessor) {
- var sValue = ko.utils.unwrapObservable(fValueAccessor());
- if ('' === sValue)
- {
- $(oElement).data('tooltip3-data', '').tooltip('hide');
- }
- else
- {
- $(oElement).data('tooltip3-data', sValue).tooltip('show');
- }
- }
-};
-
-ko.bindingHandlers.registrateBootstrapDropdown = {
- 'init': function (oElement) {
- BootstrapDropdowns.push($(oElement));
- }
-};
-
-ko.bindingHandlers.openDropdownTrigger = {
- 'update': function (oElement, fValueAccessor) {
- if (ko.utils.unwrapObservable(fValueAccessor()))
- {
- var $el = $(oElement);
- if (!$el.hasClass('open'))
- {
- $el.find('.dropdown-toggle').dropdown('toggle');
- Utils.detectDropdownVisibility();
- }
-
- fValueAccessor()(false);
- }
- }
-};
-
-ko.bindingHandlers.dropdownCloser = {
- 'init': function (oElement) {
- $(oElement).closest('.dropdown').on('click', '.e-item', function () {
- $(oElement).dropdown('toggle');
- });
- }
-};
-
-ko.bindingHandlers.popover = {
- 'init': function (oElement, fValueAccessor) {
- $(oElement).popover(ko.utils.unwrapObservable(fValueAccessor()));
- }
-};
-
-ko.bindingHandlers.csstext = {
- 'init': function (oElement, fValueAccessor) {
- if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
- {
- oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
- }
- else
- {
- $(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
- }
- },
- 'update': function (oElement, fValueAccessor) {
- if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
- {
- oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
- }
- else
- {
- $(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
- }
- }
-};
-
-ko.bindingHandlers.resizecrop = {
- 'init': function (oElement) {
- $(oElement).addClass('resizecrop').resizecrop({
- 'width': '100',
- 'height': '100',
- 'wrapperCSS': {
- 'border-radius': '10px'
- }
- });
- },
- 'update': function (oElement, fValueAccessor) {
- fValueAccessor()();
- $(oElement).resizecrop({
- 'width': '100',
- 'height': '100'
- });
- }
-};
-
-ko.bindingHandlers.onEnter = {
- 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
- $(oElement).on('keypress', function (oEvent) {
- if (oEvent && 13 === window.parseInt(oEvent.keyCode, 10))
- {
- $(oElement).trigger('change');
- fValueAccessor().call(oViewModel);
- }
- });
- }
-};
-
-ko.bindingHandlers.onEsc = {
- 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
- $(oElement).on('keypress', function (oEvent) {
- if (oEvent && 27 === window.parseInt(oEvent.keyCode, 10))
- {
- $(oElement).trigger('change');
- fValueAccessor().call(oViewModel);
- }
- });
- }
-};
-
-ko.bindingHandlers.clickOnTrue = {
- 'update': function (oElement, fValueAccessor) {
- if (ko.utils.unwrapObservable(fValueAccessor()))
- {
- $(oElement).click();
- }
- }
-};
-
-ko.bindingHandlers.modal = {
- 'init': function (oElement, fValueAccessor) {
-
- $(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
- 'keyboard': false,
- 'show': ko.utils.unwrapObservable(fValueAccessor())
- })
- .on('shown', function () {
- Utils.windowResize();
- })
- .find('.close').click(function () {
- fValueAccessor()(false);
- });
- },
- 'update': function (oElement, fValueAccessor) {
- $(oElement).modal(ko.utils.unwrapObservable(fValueAccessor()) ? 'show' : 'hide');
- }
-};
-
-ko.bindingHandlers.i18nInit = {
- 'init': function (oElement) {
- Utils.i18nToNode(oElement);
- }
-};
-
-ko.bindingHandlers.i18nUpdate = {
- 'update': function (oElement, fValueAccessor) {
- ko.utils.unwrapObservable(fValueAccessor());
- Utils.i18nToNode(oElement);
- }
-};
-
-ko.bindingHandlers.link = {
- 'update': function (oElement, fValueAccessor) {
- $(oElement).attr('href', ko.utils.unwrapObservable(fValueAccessor()));
- }
-};
-
-ko.bindingHandlers.title = {
- 'update': function (oElement, fValueAccessor) {
- $(oElement).attr('title', ko.utils.unwrapObservable(fValueAccessor()));
- }
-};
-
-ko.bindingHandlers.textF = {
- 'init': function (oElement, fValueAccessor) {
- $(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
- }
-};
-
-ko.bindingHandlers.initDom = {
- 'init': function (oElement, fValueAccessor) {
- fValueAccessor()(oElement);
- }
-};
-
-ko.bindingHandlers.initResizeTrigger = {
- 'init': function (oElement, fValueAccessor) {
- var aValues = ko.utils.unwrapObservable(fValueAccessor());
- $(oElement).css({
- 'height': aValues[1],
- 'min-height': aValues[1]
- });
- },
- 'update': function (oElement, fValueAccessor) {
- var
- aValues = ko.utils.unwrapObservable(fValueAccessor()),
- iValue = Utils.pInt(aValues[1]),
- iSize = 0,
- iOffset = $(oElement).offset().top
- ;
-
- if (0 < iOffset)
- {
- iOffset += Utils.pInt(aValues[2]);
- iSize = $window.height() - iOffset;
-
- if (iValue < iSize)
- {
- iValue = iSize;
- }
-
- $(oElement).css({
- 'height': iValue,
- 'min-height': iValue
- });
- }
- }
-};
-
-ko.bindingHandlers.appendDom = {
- 'update': function (oElement, fValueAccessor) {
- $(oElement).hide().empty().append(ko.utils.unwrapObservable(fValueAccessor())).show();
- }
-};
-
-ko.bindingHandlers.draggable = {
- 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
-
- if (!Globals.bMobileDevice)
- {
- var
- iTriggerZone = 100,
- iScrollSpeed = 3,
- fAllValueFunc = fAllBindingsAccessor(),
- sDroppableSelector = fAllValueFunc && fAllValueFunc['droppableSelector'] ? fAllValueFunc['droppableSelector'] : '',
- oConf = {
- 'distance': 20,
- 'handle': '.dragHandle',
- 'cursorAt': {'top': 22, 'left': 3},
- 'refreshPositions': true,
- 'scroll': true
- }
- ;
-
- if (sDroppableSelector)
- {
- oConf['drag'] = function (oEvent) {
-
- $(sDroppableSelector).each(function () {
- var
- moveUp = null,
- moveDown = null,
- $this = $(this),
- oOffset = $this.offset(),
- bottomPos = oOffset.top + $this.height()
- ;
-
- window.clearInterval($this.data('timerScroll'));
- $this.data('timerScroll', false);
-
- if (oEvent.pageX >= oOffset.left && oEvent.pageX <= oOffset.left + $this.width())
- {
- if (oEvent.pageY >= bottomPos - iTriggerZone && oEvent.pageY <= bottomPos)
- {
- moveUp = function() {
- $this.scrollTop($this.scrollTop() + iScrollSpeed);
- Utils.windowResize();
- };
-
- $this.data('timerScroll', window.setInterval(moveUp, 10));
- moveUp();
- }
-
- if (oEvent.pageY >= oOffset.top && oEvent.pageY <= oOffset.top + iTriggerZone)
- {
- moveDown = function() {
- $this.scrollTop($this.scrollTop() - iScrollSpeed);
- Utils.windowResize();
- };
-
- $this.data('timerScroll', window.setInterval(moveDown, 10));
- moveDown();
- }
- }
- });
- };
-
- oConf['stop'] = function() {
- $(sDroppableSelector).each(function () {
- window.clearInterval($(this).data('timerScroll'));
- $(this).data('timerScroll', false);
- });
- };
- }
-
- oConf['helper'] = function (oEvent) {
- return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null);
- };
-
- $(oElement).draggable(oConf).on('mousedown', function () {
- Utils.removeInFocus();
- });
- }
- }
-};
-
-ko.bindingHandlers.droppable = {
- 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
-
- if (!Globals.bMobileDevice)
- {
- var
- fValueFunc = fValueAccessor(),
- fAllValueFunc = fAllBindingsAccessor(),
- fOverCallback = fAllValueFunc && fAllValueFunc['droppableOver'] ? fAllValueFunc['droppableOver'] : null,
- fOutCallback = fAllValueFunc && fAllValueFunc['droppableOut'] ? fAllValueFunc['droppableOut'] : null,
- oConf = {
- 'tolerance': 'pointer',
- 'hoverClass': 'droppableHover'
- }
- ;
-
- if (fValueFunc)
- {
- oConf['drop'] = function (oEvent, oUi) {
- fValueFunc(oEvent, oUi);
- };
-
- if (fOverCallback)
- {
- oConf['over'] = function (oEvent, oUi) {
- fOverCallback(oEvent, oUi);
- };
- }
-
- if (fOutCallback)
- {
- oConf['out'] = function (oEvent, oUi) {
- fOutCallback(oEvent, oUi);
- };
- }
-
- $(oElement).droppable(oConf);
- }
- }
- }
-};
-
-ko.bindingHandlers.nano = {
- 'init': function (oElement) {
- if (!Globals.bDisableNanoScroll)
- {
- $(oElement)
- .addClass('nano')
- .nanoScroller({
- 'iOSNativeScrolling': false,
- 'preventPageScrolling': true
- })
- ;
- }
- }
-};
-
-ko.bindingHandlers.saveTrigger = {
- 'init': function (oElement) {
-
- var $oEl = $(oElement);
-
- $oEl.data('save-trigger-type', $oEl.is('input[type=text],input[type=email],input[type=password],select,textarea') ? 'input' : 'custom');
-
- if ('custom' === $oEl.data('save-trigger-type'))
- {
- $oEl.append(
- ' '
- ).addClass('settings-saved-trigger');
- }
- else
- {
- $oEl.addClass('settings-saved-trigger-input');
- }
- },
- 'update': function (oElement, fValueAccessor) {
- var
- mValue = ko.utils.unwrapObservable(fValueAccessor()),
- $oEl = $(oElement)
- ;
-
- if ('custom' === $oEl.data('save-trigger-type'))
- {
- switch (mValue.toString())
- {
- case '1':
- $oEl
- .find('.animated,.error').hide().removeClass('visible')
- .end()
- .find('.success').show().addClass('visible')
- ;
- break;
- case '0':
- $oEl
- .find('.animated,.success').hide().removeClass('visible')
- .end()
- .find('.error').show().addClass('visible')
- ;
- break;
- case '-2':
- $oEl
- .find('.error,.success').hide().removeClass('visible')
- .end()
- .find('.animated').show().addClass('visible')
- ;
- break;
- default:
- $oEl
- .find('.animated').hide()
- .end()
- .find('.error,.success').removeClass('visible')
- ;
- break;
- }
- }
- else
- {
- switch (mValue.toString())
- {
- case '1':
- $oEl.addClass('success').removeClass('error');
- break;
- case '0':
- $oEl.addClass('error').removeClass('success');
- break;
- case '-2':
-// $oEl;
- break;
- default:
- $oEl.removeClass('error success');
- break;
- }
- }
- }
-};
-
-ko.bindingHandlers.emailsTags = {
- 'init': function(oElement, fValueAccessor) {
- var
- $oEl = $(oElement),
- fValue = fValueAccessor(),
- fFocusCallback = function (bValue) {
- if (fValue && fValue.focusTrigger)
- {
- fValue.focusTrigger(bValue);
- }
- }
- ;
-
- $oEl.inputosaurus({
- 'parseOnBlur': true,
- 'allowDragAndDrop': true,
- 'focusCallback': fFocusCallback,
- 'inputDelimiters': [',', ';'],
- 'autoCompleteSource': function (oData, fResponse) {
- RL.getAutocomplete(oData.term, function (aData) {
- fResponse(_.map(aData, function (oEmailItem) {
- return oEmailItem.toLine(false);
- }));
- });
- },
- 'parseHook': function (aInput) {
- return _.map(aInput, function (sInputValue) {
-
- var
- sValue = Utils.trim(sInputValue),
- oEmail = null
- ;
-
- if ('' !== sValue)
- {
- oEmail = new EmailModel();
- oEmail.mailsoParse(sValue);
- oEmail.clearDuplicateName();
- return [oEmail.toLine(false), oEmail];
- }
-
- return [sValue, null];
-
- });
- },
- 'change': _.bind(function (oEvent) {
- $oEl.data('EmailsTagsValue', oEvent.target.value);
- fValue(oEvent.target.value);
- }, this)
- });
- },
- 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
-
- var
- $oEl = $(oElement),
- fAllValueFunc = fAllBindingsAccessor(),
- fEmailsTagsFilter = fAllValueFunc['emailsTagsFilter'] || null,
- sValue = ko.utils.unwrapObservable(fValueAccessor())
- ;
-
- if ($oEl.data('EmailsTagsValue') !== sValue)
- {
- $oEl.val(sValue);
- $oEl.data('EmailsTagsValue', sValue);
- $oEl.inputosaurus('refresh');
- }
-
- if (fEmailsTagsFilter && ko.utils.unwrapObservable(fEmailsTagsFilter))
- {
- $oEl.inputosaurus('focus');
- }
- }
-};
-
-ko.bindingHandlers.contactTags = {
- 'init': function(oElement, fValueAccessor) {
- var
- $oEl = $(oElement),
- fValue = fValueAccessor(),
- fFocusCallback = function (bValue) {
- if (fValue && fValue.focusTrigger)
- {
- fValue.focusTrigger(bValue);
- }
- }
- ;
-
- $oEl.inputosaurus({
- 'parseOnBlur': true,
- 'allowDragAndDrop': false,
- 'focusCallback': fFocusCallback,
- 'inputDelimiters': [',', ';'],
- 'outputDelimiter': ',',
- 'autoCompleteSource': function (oData, fResponse) {
- RL.getContactTagsAutocomplete(oData.term, function (aData) {
- fResponse(_.map(aData, function (oTagItem) {
- return oTagItem.toLine(false);
- }));
- });
- },
- 'parseHook': function (aInput) {
- return _.map(aInput, function (sInputValue) {
-
- var
- sValue = Utils.trim(sInputValue),
- oTag = null
- ;
-
- if ('' !== sValue)
- {
- oTag = new ContactTagModel();
- oTag.name(sValue);
- return [oTag.toLine(false), oTag];
- }
-
- return [sValue, null];
-
- });
- },
- 'change': _.bind(function (oEvent) {
- $oEl.data('ContactTagsValue', oEvent.target.value);
- fValue(oEvent.target.value);
- }, this)
- });
- },
- 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
-
- var
- $oEl = $(oElement),
- fAllValueFunc = fAllBindingsAccessor(),
- fContactTagsFilter = fAllValueFunc['contactTagsFilter'] || null,
- sValue = ko.utils.unwrapObservable(fValueAccessor())
- ;
-
- if ($oEl.data('ContactTagsValue') !== sValue)
- {
- $oEl.val(sValue);
- $oEl.data('ContactTagsValue', sValue);
- $oEl.inputosaurus('refresh');
- }
-
- if (fContactTagsFilter && ko.utils.unwrapObservable(fContactTagsFilter))
- {
- $oEl.inputosaurus('focus');
- }
- }
-};
-
-ko.bindingHandlers.command = {
- 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
- var
- jqElement = $(oElement),
- oCommand = fValueAccessor()
- ;
-
- if (!oCommand || !oCommand.enabled || !oCommand.canExecute)
- {
- throw new Error('You are not using command function');
- }
-
- jqElement.addClass('command');
- ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments);
- },
-
- 'update': function (oElement, fValueAccessor) {
-
- var
- bResult = true,
- jqElement = $(oElement),
- oCommand = fValueAccessor()
- ;
-
- bResult = oCommand.enabled();
- jqElement.toggleClass('command-not-enabled', !bResult);
-
- if (bResult)
- {
- bResult = oCommand.canExecute();
- jqElement.toggleClass('command-can-not-be-execute', !bResult);
- }
-
- jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
-
- if (jqElement.is('input') || jqElement.is('button'))
- {
- jqElement.prop('disabled', !bResult);
- }
- }
-};
-
-ko.extenders.trimmer = function (oTarget)
-{
- var oResult = ko.computed({
- 'read': oTarget,
- 'write': function (sNewValue) {
- oTarget(Utils.trim(sNewValue.toString()));
- },
- 'owner': this
- });
-
- oResult(oTarget());
- return oResult;
-};
-
-ko.extenders.posInterer = function (oTarget, iDefault)
-{
- var oResult = ko.computed({
- 'read': oTarget,
- 'write': function (sNewValue) {
- var iNew = Utils.pInt(sNewValue.toString(), iDefault);
- if (0 >= iNew)
- {
- iNew = iDefault;
- }
-
- if (iNew === oTarget() && '' + iNew !== '' + sNewValue)
- {
- oTarget(iNew + 1);
- }
-
- oTarget(iNew);
- }
- });
-
- oResult(oTarget());
- return oResult;
-};
-
-ko.extenders.reversible = function (oTarget)
-{
- var mValue = oTarget();
-
- oTarget.commit = function ()
- {
- mValue = oTarget();
- };
-
- oTarget.reverse = function ()
- {
- oTarget(mValue);
- };
-
- oTarget.commitedValue = function ()
- {
- return mValue;
- };
-
- return oTarget;
-};
-
-ko.extenders.toggleSubscribe = function (oTarget, oOptions)
-{
- oTarget.subscribe(oOptions[1], oOptions[0], 'beforeChange');
- oTarget.subscribe(oOptions[2], oOptions[0]);
-
- return oTarget;
-};
-
-ko.extenders.falseTimeout = function (oTarget, iOption)
-{
- oTarget.iTimeout = 0;
- oTarget.subscribe(function (bValue) {
- if (bValue)
- {
- window.clearTimeout(oTarget.iTimeout);
- oTarget.iTimeout = window.setTimeout(function () {
- oTarget(false);
- oTarget.iTimeout = 0;
- }, Utils.pInt(iOption));
- }
- });
-
- return oTarget;
-};
-
-ko.observable.fn.validateNone = function ()
-{
- this.hasError = ko.observable(false);
- return this;
-};
-
-ko.observable.fn.validateEmail = function ()
-{
- this.hasError = ko.observable(false);
-
- this.subscribe(function (sValue) {
- sValue = Utils.trim(sValue);
- this.hasError('' !== sValue && !(/^[^@\s]+@[^@\s]+$/.test(sValue)));
- }, this);
-
- this.valueHasMutated();
- return this;
-};
-
-ko.observable.fn.validateSimpleEmail = function ()
-{
- this.hasError = ko.observable(false);
-
- this.subscribe(function (sValue) {
- sValue = Utils.trim(sValue);
- this.hasError('' !== sValue && !(/^.+@.+$/.test(sValue)));
- }, this);
-
- this.valueHasMutated();
- return this;
-};
-
-ko.observable.fn.validateFunc = function (fFunc)
-{
- this.hasFuncError = ko.observable(false);
-
- if (Utils.isFunc(fFunc))
- {
- this.subscribe(function (sValue) {
- this.hasFuncError(!fFunc(sValue));
- }, this);
-
- this.valueHasMutated();
- }
-
- return this;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function LinkBuilder()
-{
- this.sBase = '#/';
- this.sServer = './?';
- this.sVersion = RL.settingsGet('Version');
- this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
- this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
-}
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.root = function ()
-{
- return this.sBase;
-};
-
-/**
- * @param {string} sDownload
- * @return {string}
- */
-LinkBuilder.prototype.attachmentDownload = function (sDownload)
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
-};
-
-/**
- * @param {string} sDownload
- * @return {string}
- */
-LinkBuilder.prototype.attachmentPreview = function (sDownload)
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
-};
-
-/**
- * @param {string} sDownload
- * @return {string}
- */
-LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.upload = function ()
-{
- return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.uploadContacts = function ()
-{
- return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.uploadBackground = function ()
-{
- return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.append = function ()
-{
- return this.sServer + '/Append/' + this.sSpecSuffix + '/';
-};
-
-/**
- * @param {string} sEmail
- * @return {string}
- */
-LinkBuilder.prototype.change = function (sEmail)
-{
- return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
-};
-
-/**
- * @param {string=} sAdd
- * @return {string}
- */
-LinkBuilder.prototype.ajax = function (sAdd)
-{
- return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
-};
-
-/**
- * @param {string} sRequestHash
- * @return {string}
- */
-LinkBuilder.prototype.messageViewLink = function (sRequestHash)
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
-};
-
-/**
- * @param {string} sRequestHash
- * @return {string}
- */
-LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
-};
-
-/**
- * @param {string} sEmail
- * @return {string}
- */
-LinkBuilder.prototype.avatarLink = function (sEmail)
-{
- return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
-// return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.inbox = function ()
-{
- return this.sBase + 'mailbox/Inbox';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.messagePreview = function ()
-{
- return this.sBase + 'mailbox/message-preview';
-};
-
-/**
- * @param {string=} sScreenName
- * @return {string}
- */
-LinkBuilder.prototype.settings = function (sScreenName)
-{
- var sResult = this.sBase + 'settings';
- if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
- {
- sResult += '/' + sScreenName;
- }
-
- return sResult;
-};
-
-/**
- * @param {string} sScreenName
- * @return {string}
- */
-LinkBuilder.prototype.admin = function (sScreenName)
-{
- var sResult = this.sBase;
- switch (sScreenName) {
- case 'AdminDomains':
- sResult += 'domains';
- break;
- case 'AdminSecurity':
- sResult += 'security';
- break;
- case 'AdminLicensing':
- sResult += 'licensing';
- break;
- }
-
- return sResult;
-};
-
-/**
- * @param {string} sFolder
- * @param {number=} iPage = 1
- * @param {string=} sSearch = ''
- * @return {string}
- */
-LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
-{
- iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
- sSearch = Utils.pString(sSearch);
-
- var sResult = this.sBase + 'mailbox/';
- if ('' !== sFolder)
- {
- sResult += encodeURI(sFolder);
- }
- if (1 < iPage)
- {
- sResult = sResult.replace(/[\/]+$/, '');
- sResult += '/p' + iPage;
- }
- if ('' !== sSearch)
- {
- sResult = sResult.replace(/[\/]+$/, '');
- sResult += '/' + encodeURI(sSearch);
- }
-
- return sResult;
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.phpInfo = function ()
-{
- return this.sServer + 'Info';
-};
-
-/**
- * @param {string} sLang
- * @return {string}
- */
-LinkBuilder.prototype.langLink = function (sLang)
-{
- return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.exportContactsVcf = function ()
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.exportContactsCsv = function ()
-{
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.emptyContactPic = function ()
-{
- return this.sStaticPrefix + 'css/images/empty-contact.png';
-};
-
-/**
- * @param {string} sFileName
- * @return {string}
- */
-LinkBuilder.prototype.sound = function (sFileName)
-{
- return this.sStaticPrefix + 'sounds/' + sFileName;
-};
-
-/**
- * @param {string} sTheme
- * @return {string}
- */
-LinkBuilder.prototype.themePreviewLink = function (sTheme)
-{
- var sPrefix = 'rainloop/v/' + this.sVersion + '/';
- if ('@custom' === sTheme.substr(-7))
- {
- sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
- sPrefix = '';
- }
-
- return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.notificationMailIcon = function ()
-{
- return this.sStaticPrefix + 'css/images/icom-message-notification.png';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.openPgpJs = function ()
-{
- return this.sStaticPrefix + 'js/openpgp.min.js';
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.socialGoogle = function ()
-{
- return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.socialTwitter = function ()
-{
- return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
-};
-
-/**
- * @return {string}
- */
-LinkBuilder.prototype.socialFacebook = function ()
-{
- return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @type {Object}
- */
-Plugins.oViewModelsHooks = {};
-
-/**
- * @type {Object}
- */
-Plugins.oSimpleHooks = {};
-
-/**
- * @param {string} sName
- * @param {Function} ViewModel
- */
-Plugins.regViewModelHook = function (sName, ViewModel)
-{
- if (ViewModel)
- {
- ViewModel.__hookName = sName;
- }
-};
-
-/**
- * @param {string} sName
- * @param {Function} fCallback
- */
-Plugins.addHook = function (sName, fCallback)
-{
- if (Utils.isFunc(fCallback))
- {
- if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
- {
- Plugins.oSimpleHooks[sName] = [];
- }
-
- Plugins.oSimpleHooks[sName].push(fCallback);
- }
-};
-
-/**
- * @param {string} sName
- * @param {Array=} aArguments
- */
-Plugins.runHook = function (sName, aArguments)
-{
- if (Utils.isArray(Plugins.oSimpleHooks[sName]))
- {
- aArguments = aArguments || [];
-
- _.each(Plugins.oSimpleHooks[sName], function (fCallback) {
- fCallback.apply(null, aArguments);
- });
- }
-};
-
-/**
- * @param {string} sName
- * @return {?}
- */
-Plugins.mainSettingsGet = function (sName)
-{
- return RL ? RL.settingsGet(sName) : null;
-};
-
-/**
- * @param {Function} fCallback
- * @param {string} sAction
- * @param {Object=} oParameters
- * @param {?number=} iTimeout
- * @param {string=} sGetAdd = ''
- * @param {Array=} aAbortActions = []
- */
-Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
-{
- if (RL)
- {
- RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
- }
-};
-
-/**
- * @param {string} sPluginSection
- * @param {string} sName
- * @return {?}
- */
-Plugins.settingsGet = function (sPluginSection, sName)
-{
- var oPlugin = Plugins.mainSettingsGet('Plugins');
- oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
- return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
-};
-
-
-
-
-/**
- * @constructor
- * @param {Object} oElement
- * @param {Function=} fOnBlur
- * @param {Function=} fOnReady
- * @param {Function=} fOnModeChange
- */
-function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
-{
- var self = this;
- self.editor = null;
- self.iBlurTimer = 0;
- self.fOnBlur = fOnBlur || null;
- self.fOnReady = fOnReady || null;
- self.fOnModeChange = fOnModeChange || null;
-
- self.$element = $(oElement);
-
- self.resize = _.throttle(_.bind(self.resize, self), 100);
-
- self.init();
-}
-
-NewHtmlEditorWrapper.prototype.blurTrigger = function ()
-{
- if (this.fOnBlur)
- {
- var self = this;
- window.clearTimeout(self.iBlurTimer);
- self.iBlurTimer = window.setTimeout(function () {
- self.fOnBlur();
- }, 200);
- }
-};
-
-NewHtmlEditorWrapper.prototype.focusTrigger = function ()
-{
- if (this.fOnBlur)
- {
- window.clearTimeout(this.iBlurTimer);
- }
-};
-
-/**
- * @return {boolean}
- */
-NewHtmlEditorWrapper.prototype.isHtml = function ()
-{
- return this.editor ? 'wysiwyg' === this.editor.mode : false;
-};
-
-/**
- * @return {boolean}
- */
-NewHtmlEditorWrapper.prototype.checkDirty = function ()
-{
- return this.editor ? this.editor.checkDirty() : false;
-};
-
-NewHtmlEditorWrapper.prototype.resetDirty = function ()
-{
- if (this.editor)
- {
- this.editor.resetDirty();
- }
-};
-
-/**
- * @return {string}
- */
-NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
-{
- if (this.editor)
- {
- if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
- {
- return this.editor.__plain.getRawData();
- }
-
- return bWrapIsHtml ?
- '' +
- this.editor.getData() + '' : this.editor.getData();
- }
-
- return '';
-};
-
-NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
-{
- if (this.editor)
- {
- if (bPlain)
- {
- if ('plain' === this.editor.mode)
- {
- this.editor.setMode('wysiwyg');
- }
- }
- else
- {
- if ('wysiwyg' === this.editor.mode)
- {
- this.editor.setMode('plain');
- }
- }
-
- this.resize();
- }
-};
-
-NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
-{
- if (this.editor)
- {
- this.modeToggle(true);
- this.editor.setData(sHtml);
-
- if (bFocus)
- {
- this.focus();
- }
- }
-};
-
-NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
-{
- if (this.editor)
- {
- this.modeToggle(false);
- if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
- {
- return this.editor.__plain.setRawData(sPlain);
- }
- else
- {
- this.editor.setData(sPlain);
- }
-
- if (bFocus)
- {
- this.focus();
- }
- }
-};
-
-NewHtmlEditorWrapper.prototype.init = function ()
-{
- if (this.$element && this.$element[0])
- {
- var
- self = this,
- fInit = function () {
-
- var
- oConfig = Globals.oHtmlEditorDefaultConfig,
- sLanguage = RL.settingsGet('Language'),
- bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
- ;
-
- if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)
- {
- oConfig.toolbarGroups.__SourceInited = true;
- oConfig.toolbarGroups.push({name: 'document', groups: ['mode', 'document', 'doctools']});
- }
-
- oConfig.enterMode = window.CKEDITOR.ENTER_BR;
- oConfig.shiftEnterMode = window.CKEDITOR.ENTER_BR;
-
- oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
- if (window.CKEDITOR.env)
- {
- window.CKEDITOR.env.isCompatible = true;
- }
-
- self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
-
- self.editor.on('key', function(oEvent) {
- if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
- {
- return false;
- }
- });
-
- self.editor.on('blur', function() {
- self.blurTrigger();
- });
-
- self.editor.on('mode', function() {
-
- self.blurTrigger();
-
- if (self.fOnModeChange)
- {
- self.fOnModeChange('plain' !== self.editor.mode);
- }
- });
-
- self.editor.on('focus', function() {
- self.focusTrigger();
- });
-
- if (self.fOnReady)
- {
- self.editor.on('instanceReady', function () {
-
- self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
-
- self.fOnReady();
- self.__resizable = true;
- self.resize();
- });
- }
- }
- ;
-
- if (window.CKEDITOR)
- {
- fInit();
- }
- else
- {
- window.__initEditor = fInit;
- }
- }
-};
-
-NewHtmlEditorWrapper.prototype.focus = function ()
-{
- if (this.editor)
- {
- this.editor.focus();
- }
-};
-
-NewHtmlEditorWrapper.prototype.blur = function ()
-{
- if (this.editor)
- {
- this.editor.focusManager.blur(true);
- }
-};
-
-NewHtmlEditorWrapper.prototype.resize = function ()
-{
- if (this.editor && this.__resizable)
- {
- try
- {
- this.editor.resize(this.$element.width(), this.$element.innerHeight());
- }
- catch (e) {}
- }
-};
-
-NewHtmlEditorWrapper.prototype.clear = function (bFocus)
-{
- this.setHtml('', bFocus);
-};
-
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @param {koProperty} oKoList
- * @param {koProperty} oKoSelectedItem
- * @param {string} sItemSelector
- * @param {string} sItemSelectedSelector
- * @param {string} sItemCheckedSelector
- * @param {string} sItemFocusedSelector
- */
-function Selector(oKoList, oKoSelectedItem,
- sItemSelector, sItemSelectedSelector, sItemCheckedSelector, sItemFocusedSelector)
-{
- this.list = oKoList;
-
- this.listChecked = ko.computed(function () {
- return _.filter(this.list(), function (oItem) {
- return oItem.checked();
- });
- }, this).extend({'rateLimit': 0});
-
- this.isListChecked = ko.computed(function () {
- return 0 < this.listChecked().length;
- }, this);
-
- this.focusedItem = ko.observable(null);
- this.selectedItem = oKoSelectedItem;
- this.selectedItemUseCallback = true;
-
- this.itemSelectedThrottle = _.debounce(_.bind(this.itemSelected, this), 300);
-
- this.listChecked.subscribe(function (aItems) {
- if (0 < aItems.length)
- {
- if (null === this.selectedItem())
- {
- this.selectedItem.valueHasMutated();
- }
- else
- {
- this.selectedItem(null);
- }
- }
- else if (this.bAutoSelect && this.focusedItem())
- {
- this.selectedItem(this.focusedItem());
- }
- }, this);
-
- this.selectedItem.subscribe(function (oItem) {
-
- if (oItem)
- {
- if (this.isListChecked())
- {
- _.each(this.listChecked(), function (oSubItem) {
- oSubItem.checked(false);
- });
- }
-
- if (this.selectedItemUseCallback)
- {
- this.itemSelectedThrottle(oItem);
- }
- }
- else if (this.selectedItemUseCallback)
- {
- this.itemSelected(null);
- }
-
- }, this);
-
- this.selectedItem.extend({'toggleSubscribe': [null,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.selected(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.selected(true);
- }
- }
- ]});
-
- this.focusedItem.extend({'toggleSubscribe': [null,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.focused(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.focused(true);
- }
- }
- ]});
-
- this.oContentVisible = null;
- this.oContentScrollable = null;
-
- this.sItemSelector = sItemSelector;
- this.sItemSelectedSelector = sItemSelectedSelector;
- this.sItemCheckedSelector = sItemCheckedSelector;
- this.sItemFocusedSelector = sItemFocusedSelector;
-
- this.sLastUid = '';
- this.bAutoSelect = true;
- this.oCallbacks = {};
-
- this.emptyFunction = function () {};
-
- this.focusedItem.subscribe(function (oItem) {
- if (oItem)
- {
- this.sLastUid = this.getItemUid(oItem);
- }
- }, this);
-
- var
- aCache = [],
- aCheckedCache = [],
- mFocused = null,
- mSelected = null
- ;
-
- this.list.subscribe(function (aItems) {
-
- var self = this;
- if (Utils.isArray(aItems))
- {
- _.each(aItems, function (oItem) {
- if (oItem)
- {
- var sUid = self.getItemUid(oItem);
-
- aCache.push(sUid);
- if (oItem.checked())
- {
- aCheckedCache.push(sUid);
- }
- if (null === mFocused && oItem.focused())
- {
- mFocused = sUid;
- }
- if (null === mSelected && oItem.selected())
- {
- mSelected = sUid;
- }
- }
- });
- }
- }, this, 'beforeChange');
-
- this.list.subscribe(function (aItems) {
-
- var
- self = this,
- oTemp = null,
- bGetNext = false,
- aUids = [],
- mNextFocused = mFocused,
- bChecked = false,
- bSelected = false,
- iLen = 0
- ;
-
- this.selectedItemUseCallback = false;
-
- this.focusedItem(null);
- this.selectedItem(null);
-
- if (Utils.isArray(aItems))
- {
- iLen = aCheckedCache.length;
-
- _.each(aItems, function (oItem) {
-
- var sUid = self.getItemUid(oItem);
- aUids.push(sUid);
-
- if (null !== mFocused && mFocused === sUid)
- {
- self.focusedItem(oItem);
- mFocused = null;
- }
-
- if (0 < iLen && -1 < Utils.inArray(sUid, aCheckedCache))
- {
- bChecked = true;
- oItem.checked(true);
- iLen--;
- }
-
- if (!bChecked && null !== mSelected && mSelected === sUid)
- {
- bSelected = true;
- self.selectedItem(oItem);
- mSelected = null;
- }
- });
-
- this.selectedItemUseCallback = true;
-
- if (!bChecked && !bSelected && this.bAutoSelect)
- {
- if (self.focusedItem())
- {
- self.selectedItem(self.focusedItem());
- }
- else if (0 < aItems.length)
- {
- if (null !== mNextFocused)
- {
- bGetNext = false;
- mNextFocused = _.find(aCache, function (sUid) {
- if (bGetNext && -1 < Utils.inArray(sUid, aUids))
- {
- return sUid;
- }
- else if (mNextFocused === sUid)
- {
- bGetNext = true;
- }
- return false;
- });
-
- if (mNextFocused)
- {
- oTemp = _.find(aItems, function (oItem) {
- return mNextFocused === self.getItemUid(oItem);
- });
- }
- }
-
- self.selectedItem(oTemp || null);
- self.focusedItem(self.selectedItem());
- }
- }
- }
-
- aCache = [];
- aCheckedCache = [];
- mFocused = null;
- mSelected = null;
-
- }, this);
-}
-
-Selector.prototype.itemSelected = function (oItem)
-{
- if (this.isListChecked())
- {
- if (!oItem)
- {
- (this.oCallbacks['onItemSelect'] || this.emptyFunction)(oItem || null);
- }
- }
- else
- {
- if (oItem)
- {
- (this.oCallbacks['onItemSelect'] || this.emptyFunction)(oItem);
- }
- }
-};
-
-Selector.prototype.goDown = function (bForceSelect)
-{
- this.newSelectPosition(Enums.EventKeyCode.Down, false, bForceSelect);
-};
-
-Selector.prototype.goUp = function (bForceSelect)
-{
- this.newSelectPosition(Enums.EventKeyCode.Up, false, bForceSelect);
-};
-
-Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeyScope)
-{
- this.oContentVisible = oContentVisible;
- this.oContentScrollable = oContentScrollable;
-
- sKeyScope = sKeyScope || 'all';
-
- if (this.oContentVisible && this.oContentScrollable)
- {
- var
- self = this
- ;
-
- $(this.oContentVisible)
- .on('selectstart', function (oEvent) {
- if (oEvent && oEvent.preventDefault)
- {
- oEvent.preventDefault();
- }
- })
- .on('click', this.sItemSelector, function (oEvent) {
- self.actionClick(ko.dataFor(this), oEvent);
- })
- .on('click', this.sItemCheckedSelector, function (oEvent) {
- var oItem = ko.dataFor(this);
- if (oItem)
- {
- if (oEvent && oEvent.shiftKey)
- {
- self.actionClick(oItem, oEvent);
- }
- else
- {
- self.focusedItem(oItem);
- oItem.checked(!oItem.checked());
- }
- }
- })
- ;
-
- key('enter', sKeyScope, function () {
- if (self.focusedItem() && !self.focusedItem().selected())
- {
- self.actionClick(self.focusedItem());
- return false;
- }
-
- return true;
- });
-
- key('ctrl+up, command+up, ctrl+down, command+down', sKeyScope, function () {
- return false;
- });
-
- key('up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space', sKeyScope, function (event, handler) {
- if (event && handler && handler.shortcut)
- {
- // TODO
- var iKey = 0;
- switch (handler.shortcut)
- {
- case 'up':
- case 'shift+up':
- iKey = Enums.EventKeyCode.Up;
- break;
- case 'down':
- case 'shift+down':
- iKey = Enums.EventKeyCode.Down;
- break;
- case 'insert':
- iKey = Enums.EventKeyCode.Insert;
- break;
- case 'space':
- iKey = Enums.EventKeyCode.Space;
- break;
- case 'home':
- iKey = Enums.EventKeyCode.Home;
- break;
- case 'end':
- iKey = Enums.EventKeyCode.End;
- break;
- case 'pageup':
- iKey = Enums.EventKeyCode.PageUp;
- break;
- case 'pagedown':
- iKey = Enums.EventKeyCode.PageDown;
- break;
- }
-
- if (0 < iKey)
- {
- self.newSelectPosition(iKey, key.shift);
- return false;
- }
- }
- });
- }
-};
-
-Selector.prototype.autoSelect = function (bValue)
-{
- this.bAutoSelect = !!bValue;
-};
-
-/**
- * @param {Object} oItem
- * @returns {string}
- */
-Selector.prototype.getItemUid = function (oItem)
-{
- var
- sUid = '',
- fGetItemUidCallback = this.oCallbacks['onItemGetUid'] || null
- ;
-
- if (fGetItemUidCallback && oItem)
- {
- sUid = fGetItemUidCallback(oItem);
- }
-
- return sUid.toString();
-};
-
-/**
- * @param {number} iEventKeyCode
- * @param {boolean} bShiftKey
- * @param {boolean=} bForceSelect = false
- */
-Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForceSelect)
-{
- var
- iIndex = 0,
- iPageStep = 10,
- bNext = false,
- bStop = false,
- oResult = null,
- aList = this.list(),
- iListLen = aList ? aList.length : 0,
- oFocused = this.focusedItem()
- ;
-
- if (0 < iListLen)
- {
- if (!oFocused)
- {
- if (Enums.EventKeyCode.Down === iEventKeyCode || Enums.EventKeyCode.Insert === iEventKeyCode || Enums.EventKeyCode.Space === iEventKeyCode || Enums.EventKeyCode.Home === iEventKeyCode || Enums.EventKeyCode.PageUp === iEventKeyCode)
- {
- oResult = aList[0];
- }
- else if (Enums.EventKeyCode.Up === iEventKeyCode || Enums.EventKeyCode.End === iEventKeyCode || Enums.EventKeyCode.PageDown === iEventKeyCode)
- {
- oResult = aList[aList.length - 1];
- }
- }
- else if (oFocused)
- {
- if (Enums.EventKeyCode.Down === iEventKeyCode || Enums.EventKeyCode.Up === iEventKeyCode || Enums.EventKeyCode.Insert === iEventKeyCode || Enums.EventKeyCode.Space === iEventKeyCode)
- {
- _.each(aList, function (oItem) {
- if (!bStop)
- {
- switch (iEventKeyCode) {
- case Enums.EventKeyCode.Up:
- if (oFocused === oItem)
- {
- bStop = true;
- }
- else
- {
- oResult = oItem;
- }
- break;
- case Enums.EventKeyCode.Down:
- case Enums.EventKeyCode.Insert:
- if (bNext)
- {
- oResult = oItem;
- bStop = true;
- }
- else if (oFocused === oItem)
- {
- bNext = true;
- }
- break;
- }
- }
- });
- }
- else if (Enums.EventKeyCode.Home === iEventKeyCode || Enums.EventKeyCode.End === iEventKeyCode)
- {
- if (Enums.EventKeyCode.Home === iEventKeyCode)
- {
- oResult = aList[0];
- }
- else if (Enums.EventKeyCode.End === iEventKeyCode)
- {
- oResult = aList[aList.length - 1];
- }
- }
- else if (Enums.EventKeyCode.PageDown === iEventKeyCode)
- {
- for (; iIndex < iListLen; iIndex++)
- {
- if (oFocused === aList[iIndex])
- {
- iIndex += iPageStep;
- iIndex = iListLen - 1 < iIndex ? iListLen - 1 : iIndex;
- oResult = aList[iIndex];
- break;
- }
- }
- }
- else if (Enums.EventKeyCode.PageUp === iEventKeyCode)
- {
- for (iIndex = iListLen; iIndex >= 0; iIndex--)
- {
- if (oFocused === aList[iIndex])
- {
- iIndex -= iPageStep;
- iIndex = 0 > iIndex ? 0 : iIndex;
- oResult = aList[iIndex];
- break;
- }
- }
- }
- }
- }
-
- if (oResult)
- {
- this.focusedItem(oResult);
-
- if (oFocused)
- {
- if (bShiftKey)
- {
- if (Enums.EventKeyCode.Up === iEventKeyCode || Enums.EventKeyCode.Down === iEventKeyCode)
- {
- oFocused.checked(!oFocused.checked());
- }
- }
- else if (Enums.EventKeyCode.Insert === iEventKeyCode || Enums.EventKeyCode.Space === iEventKeyCode)
- {
- oFocused.checked(!oFocused.checked());
- }
- }
-
- if ((this.bAutoSelect || !!bForceSelect) &&
- !this.isListChecked() && Enums.EventKeyCode.Space !== iEventKeyCode)
- {
- this.selectedItem(oResult);
- }
-
- this.scrollToFocused();
- }
- else if (oFocused)
- {
- if (bShiftKey && (Enums.EventKeyCode.Up === iEventKeyCode || Enums.EventKeyCode.Down === iEventKeyCode))
- {
- oFocused.checked(!oFocused.checked());
- }
- else if (Enums.EventKeyCode.Insert === iEventKeyCode || Enums.EventKeyCode.Space === iEventKeyCode)
- {
- oFocused.checked(!oFocused.checked());
- }
-
- this.focusedItem(oFocused);
- }
-};
-
-/**
- * @return {boolean}
- */
-Selector.prototype.scrollToFocused = function ()
-{
- if (!this.oContentVisible || !this.oContentScrollable)
- {
- return false;
- }
-
- var
- iOffset = 20,
- oFocused = $(this.sItemFocusedSelector, this.oContentScrollable),
- oPos = oFocused.position(),
- iVisibleHeight = this.oContentVisible.height(),
- iFocusedHeight = oFocused.outerHeight()
- ;
-
- if (oPos && (oPos.top < 0 || oPos.top + iFocusedHeight > iVisibleHeight))
- {
- if (oPos.top < 0)
- {
- this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iOffset);
- }
- else
- {
- this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iVisibleHeight + iFocusedHeight + iOffset);
- }
-
- return true;
- }
-
- return false;
-};
-
-/**
- * @param {boolean=} bFast = false
- * @return {boolean}
- */
-Selector.prototype.scrollToTop = function (bFast)
-{
- if (!this.oContentVisible || !this.oContentScrollable)
- {
- return false;
- }
-
- if (bFast)
- {
- this.oContentScrollable.scrollTop(0);
- }
- else
- {
- this.oContentScrollable.stop().animate({'scrollTop': 0}, 200);
- }
-
- return true;
-};
-
-Selector.prototype.eventClickFunction = function (oItem, oEvent)
-{
- var
- sUid = this.getItemUid(oItem),
- iIndex = 0,
- iLength = 0,
- oListItem = null,
- sLineUid = '',
- bChangeRange = false,
- bIsInRange = false,
- aList = [],
- bChecked = false
- ;
-
- if (oEvent && oEvent.shiftKey)
- {
- if ('' !== sUid && '' !== this.sLastUid && sUid !== this.sLastUid)
- {
- aList = this.list();
- bChecked = oItem.checked();
-
- for (iIndex = 0, iLength = aList.length; iIndex < iLength; iIndex++)
- {
- oListItem = aList[iIndex];
- sLineUid = this.getItemUid(oListItem);
-
- bChangeRange = false;
- if (sLineUid === this.sLastUid || sLineUid === sUid)
- {
- bChangeRange = true;
- }
-
- if (bChangeRange)
- {
- bIsInRange = !bIsInRange;
- }
-
- if (bIsInRange || bChangeRange)
- {
- oListItem.checked(bChecked);
- }
- }
- }
- }
-
- this.sLastUid = '' === sUid ? '' : sUid;
-};
-
-/**
- * @param {Object} oItem
- * @param {Object=} oEvent
- */
-Selector.prototype.actionClick = function (oItem, oEvent)
-{
- if (oItem)
- {
- var
- bClick = true,
- sUid = this.getItemUid(oItem)
- ;
-
- if (oEvent)
- {
- if (oEvent.shiftKey && !oEvent.ctrlKey && !oEvent.altKey)
- {
- bClick = false;
- if ('' === this.sLastUid)
- {
- this.sLastUid = sUid;
- }
-
- oItem.checked(!oItem.checked());
- this.eventClickFunction(oItem, oEvent);
-
- this.focusedItem(oItem);
- }
- else if (oEvent.ctrlKey && !oEvent.shiftKey && !oEvent.altKey)
- {
- bClick = false;
- this.focusedItem(oItem);
-
- if (this.selectedItem() && oItem !== this.selectedItem())
- {
- this.selectedItem().checked(true);
- }
-
- oItem.checked(!oItem.checked());
- }
- }
-
- if (bClick)
- {
- this.focusedItem(oItem);
- this.selectedItem(oItem);
-
- this.scrollToFocused();
- }
- }
-};
-
-Selector.prototype.on = function (sEventName, fCallback)
-{
- this.oCallbacks[sEventName] = fCallback;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function CookieDriver()
-{
-
-}
-
-CookieDriver.supported = function ()
-{
- return true;
-};
-
-/**
- * @param {string} sKey
- * @param {*} mData
- * @returns {boolean}
- */
-CookieDriver.prototype.set = function (sKey, mData)
-{
- var
- mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
- bResult = false,
- mResult = null
- ;
-
- try
- {
- mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
- if (!mResult)
- {
- mResult = {};
- }
-
- mResult[sKey] = mData;
- $.cookie(Consts.Values.ClientSideCookieIndexName, JSON.stringify(mResult), {
- 'expires': 30
- });
-
- bResult = true;
- }
- catch (oException) {}
-
- return bResult;
-};
-
-/**
- * @param {string} sKey
- * @returns {*}
- */
-CookieDriver.prototype.get = function (sKey)
-{
- var
- mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
- mResult = null
- ;
-
- try
- {
- mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
- if (mResult && !Utils.isUnd(mResult[sKey]))
- {
- mResult = mResult[sKey];
- }
- else
- {
- mResult = null;
- }
- }
- catch (oException) {}
-
- return mResult;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function LocalStorageDriver()
-{
-}
-
-LocalStorageDriver.supported = function ()
-{
- return !!window.localStorage;
-};
-
-/**
- * @param {string} sKey
- * @param {*} mData
- * @returns {boolean}
- */
-LocalStorageDriver.prototype.set = function (sKey, mData)
-{
- var
- mCookieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
- bResult = false,
- mResult = null
- ;
-
- try
- {
- mResult = null === mCookieValue ? null : JSON.parse(mCookieValue);
- if (!mResult)
- {
- mResult = {};
- }
-
- mResult[sKey] = mData;
- window.localStorage[Consts.Values.ClientSideCookieIndexName] = JSON.stringify(mResult);
-
- bResult = true;
- }
- catch (oException) {}
-
- return bResult;
-};
-
-/**
- * @param {string} sKey
- * @returns {*}
- */
-LocalStorageDriver.prototype.get = function (sKey)
-{
- var
- mCokieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
- mResult = null
- ;
-
- try
- {
- mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
- if (mResult && !Utils.isUnd(mResult[sKey]))
- {
- mResult = mResult[sKey];
- }
- else
- {
- mResult = null;
- }
- }
- catch (oException) {}
-
- return mResult;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function LocalStorage()
-{
- var
- sStorages = [
- LocalStorageDriver,
- CookieDriver
- ],
- NextStorageDriver = _.find(sStorages, function (NextStorageDriver) {
- return NextStorageDriver.supported();
- })
- ;
-
- if (NextStorageDriver)
- {
- NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
- this.oDriver = new NextStorageDriver();
- }
-}
-
-LocalStorage.prototype.oDriver = null;
-
-/**
- * @param {number} iKey
- * @param {*} mData
- * @return {boolean}
- */
-LocalStorage.prototype.set = function (iKey, mData)
-{
- return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
-};
-
-/**
- * @param {number} iKey
- * @return {*}
- */
-LocalStorage.prototype.get = function (iKey)
-{
- return this.oDriver ? this.oDriver.get('p' + iKey) : null;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function KnoinAbstractBoot()
-{
-
-}
-
-KnoinAbstractBoot.prototype.bootstart = function ()
-{
-
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {string=} sPosition = ''
- * @param {string=} sTemplate = ''
- * @constructor
- */
-function KnoinAbstractViewModel(sPosition, sTemplate)
-{
- this.bDisabeCloseOnEsc = false;
- this.sPosition = Utils.pString(sPosition);
- this.sTemplate = Utils.pString(sTemplate);
-
- this.sDefaultKeyScope = Enums.KeyState.None;
- this.sCurrentKeyScope = this.sDefaultKeyScope;
-
- this.viewModelName = '';
- this.viewModelVisibility = ko.observable(false);
- this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
-
- this.viewModelDom = null;
-}
-
-/**
- * @type {string}
- */
-KnoinAbstractViewModel.prototype.sPosition = '';
-
-/**
- * @type {string}
- */
-KnoinAbstractViewModel.prototype.sTemplate = '';
-
-/**
- * @type {string}
- */
-KnoinAbstractViewModel.prototype.viewModelName = '';
-
-/**
- * @type {?}
- */
-KnoinAbstractViewModel.prototype.viewModelDom = null;
-
-/**
- * @return {string}
- */
-KnoinAbstractViewModel.prototype.viewModelTemplate = function ()
-{
- return this.sTemplate;
-};
-
-/**
- * @return {string}
- */
-KnoinAbstractViewModel.prototype.viewModelPosition = function ()
-{
- return this.sPosition;
-};
-
-KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
-{
-};
-
-KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
-{
- this.sCurrentKeyScope = RL.data().keyScope();
- RL.data().keyScope(this.sDefaultKeyScope);
-};
-
-KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
-{
- RL.data().keyScope(this.sCurrentKeyScope);
-};
-
-KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
-{
- var self = this;
- $window.on('keydown', function (oEvent) {
- if (oEvent && self.modalVisibility && self.modalVisibility())
- {
- if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
- {
- Utils.delegateRun(self, 'cancelCommand');
- return false;
- }
- else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus())
- {
- return false;
- }
- }
-
- return true;
- });
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {string} sScreenName
- * @param {?=} aViewModels = []
- * @constructor
- */
-function KnoinAbstractScreen(sScreenName, aViewModels)
-{
- this.sScreenName = sScreenName;
- this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : [];
-}
-
-/**
- * @type {Array}
- */
-KnoinAbstractScreen.prototype.oCross = null;
-
-/**
- * @type {string}
- */
-KnoinAbstractScreen.prototype.sScreenName = '';
-
-/**
- * @type {Array}
- */
-KnoinAbstractScreen.prototype.aViewModels = [];
-
-/**
- * @return {Array}
- */
-KnoinAbstractScreen.prototype.viewModels = function ()
-{
- return this.aViewModels;
-};
-
-/**
- * @return {string}
- */
-KnoinAbstractScreen.prototype.screenName = function ()
-{
- return this.sScreenName;
-};
-
-KnoinAbstractScreen.prototype.routes = function ()
-{
- return null;
-};
-
-/**
- * @return {?Object}
- */
-KnoinAbstractScreen.prototype.__cross = function ()
-{
- return this.oCross;
-};
-
-KnoinAbstractScreen.prototype.__start = function ()
-{
- var
- aRoutes = this.routes(),
- oRoute = null,
- fMatcher = null
- ;
-
- if (Utils.isNonEmptyArray(aRoutes))
- {
- fMatcher = _.bind(this.onRoute || Utils.emptyFunction, this);
- oRoute = crossroads.create();
-
- _.each(aRoutes, function (aItem) {
- oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1];
- });
-
- this.oCross = oRoute;
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function Knoin()
-{
- this.sDefaultScreenName = '';
- this.oScreens = {};
- this.oBoot = null;
- this.oCurrentScreen = null;
-}
-
-/**
- * @param {Object} thisObject
- */
-Knoin.constructorEnd = function (thisObject)
-{
- if (Utils.isFunc(thisObject['__constructor_end']))
- {
- thisObject['__constructor_end'].call(thisObject);
- }
-};
-
-Knoin.prototype.sDefaultScreenName = '';
-Knoin.prototype.oScreens = {};
-Knoin.prototype.oBoot = null;
-Knoin.prototype.oCurrentScreen = null;
-
-Knoin.prototype.hideLoading = function ()
-{
- $('#rl-loading').hide();
-};
-
-Knoin.prototype.routeOff = function ()
-{
- hasher.changed.active = false;
-};
-
-Knoin.prototype.routeOn = function ()
-{
- hasher.changed.active = true;
-};
-
-/**
- * @param {Object} oBoot
- * @return {Knoin}
- */
-Knoin.prototype.setBoot = function (oBoot)
-{
- if (Utils.isNormal(oBoot))
- {
- this.oBoot = oBoot;
- }
-
- return this;
-};
-
-/**
- * @param {string} sScreenName
- * @return {?Object}
- */
-Knoin.prototype.screen = function (sScreenName)
-{
- return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null;
-};
-
-/**
- * @param {Function} ViewModelClass
- * @param {Object=} oScreen
- */
-Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
-{
- if (ViewModelClass && !ViewModelClass.__builded)
- {
- var
- oViewModel = new ViewModelClass(oScreen),
- sPosition = oViewModel.viewModelPosition(),
- oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
- oViewModelDom = null
- ;
-
- ViewModelClass.__builded = true;
- ViewModelClass.__vm = oViewModel;
- oViewModel.data = RL.data();
-
- oViewModel.viewModelName = ViewModelClass.__name;
-
- if (oViewModelPlace && 1 === oViewModelPlace.length)
- {
- oViewModelDom = $('').addClass('rl-view-model').addClass('RL-' + oViewModel.viewModelTemplate()).hide();
- oViewModelDom.appendTo(oViewModelPlace);
-
- oViewModel.viewModelDom = oViewModelDom;
- ViewModelClass.__dom = oViewModelDom;
-
- if ('Popups' === sPosition)
- {
- oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
- kn.hideScreenPopup(ViewModelClass);
- });
-
- oViewModel.modalVisibility.subscribe(function (bValue) {
-
- var self = this;
- if (bValue)
- {
- this.viewModelDom.show();
- this.storeAndSetKeyScope();
-
- RL.popupVisibilityNames.push(this.viewModelName);
- oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10);
-
- Utils.delegateRun(this, 'onFocus', [], 500);
- }
- else
- {
- Utils.delegateRun(this, 'onHide');
- this.restoreKeyScope();
-
- RL.popupVisibilityNames.remove(this.viewModelName);
- oViewModel.viewModelDom.css('z-index', 2000);
-
- Globals.tooltipTrigger(!Globals.tooltipTrigger());
-
- _.delay(function () {
- self.viewModelDom.hide();
- }, 300);
- }
-
- }, oViewModel);
- }
-
- Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
-
- ko.applyBindingAccessorsToNode(oViewModelDom[0], {
- 'i18nInit': true,
- 'template': function () { return {'name': oViewModel.viewModelTemplate()};}
- }, oViewModel);
-
- Utils.delegateRun(oViewModel, 'onBuild', [oViewModelDom]);
- if (oViewModel && 'Popups' === sPosition)
- {
- oViewModel.registerPopupKeyDown();
- }
-
- Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
- }
- else
- {
- Utils.log('Cannot find view model position: ' + sPosition);
- }
- }
-
- return ViewModelClass ? ViewModelClass.__vm : null;
-};
-
-/**
- * @param {Object} oViewModel
- * @param {Object} oViewModelDom
- */
-Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
-{
- if (oViewModel && oViewModelDom)
- {
- ko.applyBindings(oViewModel, oViewModelDom);
- }
-};
-
-/**
- * @param {Function} ViewModelClassToHide
- */
-Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
-{
- if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
- {
- ViewModelClassToHide.__vm.modalVisibility(false);
- Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]);
- }
-};
-
-/**
- * @param {Function} ViewModelClassToShow
- * @param {Array=} aParameters
- */
-Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
-{
- if (ViewModelClassToShow)
- {
- this.buildViewModel(ViewModelClassToShow);
-
- if (ViewModelClassToShow.__vm && ViewModelClassToShow.__dom)
- {
- ViewModelClassToShow.__vm.modalVisibility(true);
- Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
- Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
- }
- }
-};
-
-/**
- * @param {Function} ViewModelClassToShow
- * @return {boolean}
- */
-Knoin.prototype.isPopupVisible = function (ViewModelClassToShow)
-{
- return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false;
-};
-
-/**
- * @param {string} sScreenName
- * @param {string} sSubPart
- */
-Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
-{
- var
- self = this,
- oScreen = null,
- oCross = null
- ;
-
- if ('' === Utils.pString(sScreenName))
- {
- sScreenName = this.sDefaultScreenName;
- }
-
- if ('' !== sScreenName)
- {
- oScreen = this.screen(sScreenName);
- if (!oScreen)
- {
- oScreen = this.screen(this.sDefaultScreenName);
- if (oScreen)
- {
- sSubPart = sScreenName + '/' + sSubPart;
- sScreenName = this.sDefaultScreenName;
- }
- }
-
- if (oScreen && oScreen.__started)
- {
- if (!oScreen.__builded)
- {
- oScreen.__builded = true;
-
- if (Utils.isNonEmptyArray(oScreen.viewModels()))
- {
- _.each(oScreen.viewModels(), function (ViewModelClass) {
- this.buildViewModel(ViewModelClass, oScreen);
- }, this);
- }
-
- Utils.delegateRun(oScreen, 'onBuild');
- }
-
- _.defer(function () {
-
- // hide screen
- if (self.oCurrentScreen)
- {
- Utils.delegateRun(self.oCurrentScreen, 'onHide');
-
- if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
- {
- _.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) {
-
- if (ViewModelClass.__vm && ViewModelClass.__dom &&
- 'Popups' !== ViewModelClass.__vm.viewModelPosition())
- {
- ViewModelClass.__dom.hide();
- ViewModelClass.__vm.viewModelVisibility(false);
- Utils.delegateRun(ViewModelClass.__vm, 'onHide');
- }
-
- });
- }
- }
- // --
-
- self.oCurrentScreen = oScreen;
-
- // show screen
- if (self.oCurrentScreen)
- {
- Utils.delegateRun(self.oCurrentScreen, 'onShow');
-
- Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]);
-
- if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
- {
- _.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) {
-
- if (ViewModelClass.__vm && ViewModelClass.__dom &&
- 'Popups' !== ViewModelClass.__vm.viewModelPosition())
- {
- ViewModelClass.__dom.show();
- ViewModelClass.__vm.viewModelVisibility(true);
- Utils.delegateRun(ViewModelClass.__vm, 'onShow');
- Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
-
- Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]);
- }
-
- }, self);
- }
- }
- // --
-
- oCross = oScreen.__cross();
- if (oCross)
- {
- oCross.parse(sSubPart);
- }
- });
- }
- }
-};
-
-/**
- * @param {Array} aScreensClasses
- */
-Knoin.prototype.startScreens = function (aScreensClasses)
-{
- $('#rl-content').css({
- 'visibility': 'hidden'
- });
-
- _.each(aScreensClasses, function (CScreen) {
-
- var
- oScreen = new CScreen(),
- sScreenName = oScreen ? oScreen.screenName() : ''
- ;
-
- if (oScreen && '' !== sScreenName)
- {
- if ('' === this.sDefaultScreenName)
- {
- this.sDefaultScreenName = sScreenName;
- }
-
- this.oScreens[sScreenName] = oScreen;
- }
-
- }, this);
-
-
- _.each(this.oScreens, function (oScreen) {
- if (oScreen && !oScreen.__started && oScreen.__start)
- {
- oScreen.__started = true;
- oScreen.__start();
-
- Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]);
- Utils.delegateRun(oScreen, 'onStart');
- Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]);
- }
- }, this);
-
- var oCross = crossroads.create();
- oCross.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/, _.bind(this.screenOnRoute, this));
-
- hasher.initialized.add(oCross.parse, oCross);
- hasher.changed.add(oCross.parse, oCross);
- hasher.init();
-
- $('#rl-content').css({
- 'visibility': 'visible'
- });
-
- _.delay(function () {
- $html.removeClass('rl-started-trigger').addClass('rl-started');
- }, 50);
-};
-
-/**
- * @param {string} sHash
- * @param {boolean=} bSilence = false
- * @param {boolean=} bReplace = false
- */
-Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
-{
- sHash = '#' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
- sHash = '/' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
-
- bReplace = Utils.isUnd(bReplace) ? false : !!bReplace;
-
- if (Utils.isUnd(bSilence) ? false : !!bSilence)
- {
- hasher.changed.active = false;
- hasher[bReplace ? 'replaceHash' : 'setHash'](sHash);
- hasher.changed.active = true;
- }
- else
- {
- hasher.changed.active = true;
- hasher[bReplace ? 'replaceHash' : 'setHash'](sHash);
- hasher.setHash(sHash);
- }
-};
-
-/**
- * @return {Knoin}
- */
-Knoin.prototype.bootstart = function ()
-{
- if (this.oBoot && this.oBoot.bootstart)
- {
- this.oBoot.bootstart();
- }
-
- return this;
-};
-
-kn = new Knoin();
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {string=} sEmail
- * @param {string=} sName
- *
- * @constructor
- */
-function EmailModel(sEmail, sName)
-{
- this.email = sEmail || '';
- this.name = sName || '';
- this.privateType = null;
-
- this.clearDuplicateName();
-}
-
-/**
- * @static
- * @param {AjaxJsonEmail} oJsonEmail
- * @return {?EmailModel}
- */
-EmailModel.newInstanceFromJson = function (oJsonEmail)
-{
- var oEmailModel = new EmailModel();
- return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
-};
-
-/**
- * @type {string}
- */
-EmailModel.prototype.name = '';
-
-/**
- * @type {string}
- */
-EmailModel.prototype.email = '';
-
-/**
- * @type {(number|null)}
- */
-EmailModel.prototype.privateType = null;
-
-EmailModel.prototype.clear = function ()
-{
- this.email = '';
- this.name = '';
- this.privateType = null;
-};
-
-/**
- * @returns {boolean}
- */
-EmailModel.prototype.validate = function ()
-{
- return '' !== this.name || '' !== this.email;
-};
-
-/**
- * @param {boolean} bWithoutName = false
- * @return {string}
- */
-EmailModel.prototype.hash = function (bWithoutName)
-{
- return '#' + (bWithoutName ? '' : this.name) + '#' + this.email + '#';
-};
-
-EmailModel.prototype.clearDuplicateName = function ()
-{
- if (this.name === this.email)
- {
- this.name = '';
- }
-};
-
-/**
- * @return {number}
- */
-EmailModel.prototype.type = function ()
-{
- if (null === this.privateType)
- {
- if (this.email && '@facebook.com' === this.email.substr(-13))
- {
- this.privateType = Enums.EmailType.Facebook;
- }
-
- if (null === this.privateType)
- {
- this.privateType = Enums.EmailType.Default;
- }
- }
-
- return this.privateType;
-};
-
-/**
- * @param {string} sQuery
- * @return {boolean}
- */
-EmailModel.prototype.search = function (sQuery)
-{
- return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(sQuery.toLowerCase());
-};
-
-/**
- * @param {string} sString
- */
-EmailModel.prototype.parse = function (sString)
-{
- this.clear();
-
- sString = Utils.trim(sString);
-
- var
- mRegex = /(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,
- mMatch = mRegex.exec(sString)
- ;
-
- if (mMatch)
- {
- this.name = mMatch[1] || '';
- this.email = mMatch[2] || '';
-
- this.clearDuplicateName();
- }
- else if ((/^[^@]+@[^@]+$/).test(sString))
- {
- this.name = '';
- this.email = sString;
- }
-};
-
-/**
- * @param {AjaxJsonEmail} oJsonEmail
- * @return {boolean}
- */
-EmailModel.prototype.initByJson = function (oJsonEmail)
-{
- var bResult = false;
- if (oJsonEmail && 'Object/Email' === oJsonEmail['@Object'])
- {
- this.name = Utils.trim(oJsonEmail.Name);
- this.email = Utils.trim(oJsonEmail.Email);
-
- bResult = '' !== this.email;
- this.clearDuplicateName();
- }
-
- return bResult;
-};
-
-/**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @param {boolean=} bEncodeHtml = false
- * @return {string}
- */
-EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
-{
- var sResult = '';
- if ('' !== this.email)
- {
- bWrapWithLink = Utils.isUnd(bWrapWithLink) ? false : !!bWrapWithLink;
- bEncodeHtml = Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml;
-
- if (bFriendlyView && '' !== this.name)
- {
- sResult = bWrapWithLink ? '') +
- '" target="_blank" tabindex="-1">' + Utils.encodeHtml(this.name) + '' :
- (bEncodeHtml ? Utils.encodeHtml(this.name) : this.name);
- }
- else
- {
- sResult = this.email;
- if ('' !== this.name)
- {
- if (bWrapWithLink)
- {
- sResult = Utils.encodeHtml('"' + this.name + '" <') +
- '') + '" target="_blank" tabindex="-1">' + Utils.encodeHtml(sResult) + '' + Utils.encodeHtml('>');
- }
- else
- {
- sResult = '"' + this.name + '" <' + sResult + '>';
- if (bEncodeHtml)
- {
- sResult = Utils.encodeHtml(sResult);
- }
- }
- }
- else if (bWrapWithLink)
- {
- sResult = '' + Utils.encodeHtml(this.email) + '';
- }
- }
- }
-
- return sResult;
-};
-
-/**
- * @param {string} $sEmailAddress
- * @return {boolean}
- */
-EmailModel.prototype.mailsoParse = function ($sEmailAddress)
-{
- $sEmailAddress = Utils.trim($sEmailAddress);
- if ('' === $sEmailAddress)
- {
- return false;
- }
-
- var
- substr = function (str, start, len) {
- str += '';
- var end = str.length;
-
- if (start < 0) {
- start += end;
- }
-
- end = typeof len === 'undefined' ? end : (len < 0 ? len + end : len + start);
-
- return start >= str.length || start < 0 || start > end ? false : str.slice(start, end);
- },
-
- substr_replace = function (str, replace, start, length) {
- if (start < 0) {
- start = start + str.length;
- }
- length = length !== undefined ? length : str.length;
- if (length < 0) {
- length = length + str.length - start;
- }
- return str.slice(0, start) + replace.substr(0, length) + replace.slice(length) + str.slice(start + length);
- },
-
- $sName = '',
- $sEmail = '',
- $sComment = '',
-
- $bInName = false,
- $bInAddress = false,
- $bInComment = false,
-
- $aRegs = null,
-
- $iStartIndex = 0,
- $iEndIndex = 0,
- $iCurrentIndex = 0
- ;
-
- while ($iCurrentIndex < $sEmailAddress.length)
- {
- switch ($sEmailAddress.substr($iCurrentIndex, 1))
- {
- case '"':
- if ((!$bInName) && (!$bInAddress) && (!$bInComment))
- {
- $bInName = true;
- $iStartIndex = $iCurrentIndex;
- }
- else if ((!$bInAddress) && (!$bInComment))
- {
- $iEndIndex = $iCurrentIndex;
- $sName = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
- $sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
- $iEndIndex = 0;
- $iCurrentIndex = 0;
- $iStartIndex = 0;
- $bInName = false;
- }
- break;
- case '<':
- if ((!$bInName) && (!$bInAddress) && (!$bInComment))
- {
- if ($iCurrentIndex > 0 && $sName.length === 0)
- {
- $sName = substr($sEmailAddress, 0, $iCurrentIndex);
- }
-
- $bInAddress = true;
- $iStartIndex = $iCurrentIndex;
- }
- break;
- case '>':
- if ($bInAddress)
- {
- $iEndIndex = $iCurrentIndex;
- $sEmail = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
- $sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
- $iEndIndex = 0;
- $iCurrentIndex = 0;
- $iStartIndex = 0;
- $bInAddress = false;
- }
- break;
- case '(':
- if ((!$bInName) && (!$bInAddress) && (!$bInComment))
- {
- $bInComment = true;
- $iStartIndex = $iCurrentIndex;
- }
- break;
- case ')':
- if ($bInComment)
- {
- $iEndIndex = $iCurrentIndex;
- $sComment = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
- $sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
- $iEndIndex = 0;
- $iCurrentIndex = 0;
- $iStartIndex = 0;
- $bInComment = false;
- }
- break;
- case '\\':
- $iCurrentIndex++;
- break;
- }
-
- $iCurrentIndex++;
- }
-
- if ($sEmail.length === 0)
- {
- $aRegs = $sEmailAddress.match(/[^@\s]+@\S+/i);
- if ($aRegs && $aRegs[0])
- {
- $sEmail = $aRegs[0];
- }
- else
- {
- $sName = $sEmailAddress;
- }
- }
-
- if ($sEmail.length > 0 && $sName.length === 0 && $sComment.length === 0)
- {
- $sName = $sEmailAddress.replace($sEmail, '');
- }
-
- $sEmail = Utils.trim($sEmail).replace(/^[<]+/, '').replace(/[>]+$/, '');
- $sName = Utils.trim($sName).replace(/^["']+/, '').replace(/["']+$/, '');
- $sComment = Utils.trim($sComment).replace(/^[(]+/, '').replace(/[)]+$/, '');
-
- // Remove backslash
- $sName = $sName.replace(/\\\\(.)/, '$1');
- $sComment = $sComment.replace(/\\\\(.)/, '$1');
-
- this.name = $sName;
- this.email = $sEmail;
-
- this.clearDuplicateName();
- return true;
-};
-
-/**
- * @return {string}
- */
-EmailModel.prototype.inputoTagLine = function ()
-{
- return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function ContactModel()
-{
- this.idContact = 0;
- this.display = '';
- this.properties = [];
- this.tags = '';
- this.readOnly = false;
-
- this.focused = ko.observable(false);
- this.selected = ko.observable(false);
- this.checked = ko.observable(false);
- this.deleted = ko.observable(false);
-}
-
-/**
- * @return {Array|null}
- */
-ContactModel.prototype.getNameAndEmailHelper = function ()
-{
- var
- sName = '',
- sEmail = ''
- ;
-
- if (Utils.isNonEmptyArray(this.properties))
- {
- _.each(this.properties, function (aProperty) {
- if (aProperty)
- {
- if (Enums.ContactPropertyType.FirstName === aProperty[0])
- {
- sName = Utils.trim(aProperty[1] + ' ' + sName);
- }
- else if (Enums.ContactPropertyType.LastName === aProperty[0])
- {
- sName = Utils.trim(sName + ' ' + aProperty[1]);
- }
- else if ('' === sEmail && Enums.ContactPropertyType.Email === aProperty[0])
- {
- sEmail = aProperty[1];
- }
- }
- }, this);
- }
-
- return '' === sEmail ? null : [sEmail, sName];
-};
-
-ContactModel.prototype.parse = function (oItem)
-{
- var bResult = false;
- if (oItem && 'Object/Contact' === oItem['@Object'])
- {
- this.idContact = Utils.pInt(oItem['IdContact']);
- this.display = Utils.pString(oItem['Display']);
- this.readOnly = !!oItem['ReadOnly'];
- this.tags = '';
-
- if (Utils.isNonEmptyArray(oItem['Properties']))
- {
- _.each(oItem['Properties'], function (oProperty) {
- if (oProperty && oProperty['Type'] && Utils.isNormal(oProperty['Value']) && Utils.isNormal(oProperty['TypeStr']))
- {
- this.properties.push([Utils.pInt(oProperty['Type']), Utils.pString(oProperty['Value']), Utils.pString(oProperty['TypeStr'])]);
- }
- }, this);
- }
-
- if (Utils.isNonEmptyArray(oItem['Tags']))
- {
- this.tags = oItem['Tags'].join(',');
- }
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @return {string}
- */
-ContactModel.prototype.srcAttr = function ()
-{
- return RL.link().emptyContactPic();
-};
-
-/**
- * @return {string}
- */
-ContactModel.prototype.generateUid = function ()
-{
- return '' + this.idContact;
-};
-
-/**
- * @return string
- */
-ContactModel.prototype.lineAsCcc = function ()
-{
- var aResult = [];
- if (this.deleted())
- {
- aResult.push('deleted');
- }
- if (this.selected())
- {
- aResult.push('selected');
- }
- if (this.checked())
- {
- aResult.push('checked');
- }
- if (this.focused())
- {
- aResult.push('focused');
- }
-
- return aResult.join(' ');
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {number=} iType = Enums.ContactPropertyType.Unknown
- * @param {string=} sTypeStr = ''
- * @param {string=} sValue = ''
- * @param {boolean=} bFocused = false
- * @param {string=} sPlaceholder = ''
- *
- * @constructor
- */
-function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
-{
- this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
- this.typeStr = ko.observable(Utils.isUnd(sTypeStr) ? '' : sTypeStr);
- this.focused = ko.observable(Utils.isUnd(bFocused) ? false : !!bFocused);
- this.value = ko.observable(Utils.pString(sValue));
-
- this.placeholder = ko.observable(sPlaceholder || '');
-
- this.placeholderValue = ko.computed(function () {
- var sPlaceholder = this.placeholder();
- return sPlaceholder ? Utils.i18n(sPlaceholder) : '';
- }, this);
-
- this.largeValue = ko.computed(function () {
- return Enums.ContactPropertyType.Note === this.type();
- }, this);
-
-}
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function ContactTagModel()
-{
- this.idContactTag = 0;
- this.name = ko.observable('');
- this.readOnly = false;
-}
-
-ContactTagModel.prototype.parse = function (oItem)
-{
- var bResult = false;
- if (oItem && 'Object/Tag' === oItem['@Object'])
- {
- this.idContact = Utils.pInt(oItem['IdContactTag']);
- this.name(Utils.pString(oItem['Name']));
- this.readOnly = !!oItem['ReadOnly'];
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @param {string} sSearch
- * @return {boolean}
- */
-ContactTagModel.prototype.filterHelper = function (sSearch)
-{
- return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
-};
-
-/**
- * @param {boolean=} bEncodeHtml = false
- * @return {string}
- */
-ContactTagModel.prototype.toLine = function (bEncodeHtml)
-{
- return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
- Utils.encodeHtml(this.name()) : this.name();
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function AttachmentModel()
-{
- this.mimeType = '';
- this.fileName = '';
- this.estimatedSize = 0;
- this.friendlySize = '';
- this.isInline = false;
- this.isLinked = false;
- this.cid = '';
- this.cidWithOutTags = '';
- this.contentLocation = '';
- this.download = '';
- this.folder = '';
- this.uid = '';
- this.mimeIndex = '';
-}
-
-/**
- * @static
- * @param {AjaxJsonAttachment} oJsonAttachment
- * @return {?AttachmentModel}
- */
-AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
-{
- var oAttachmentModel = new AttachmentModel();
- return oAttachmentModel.initByJson(oJsonAttachment) ? oAttachmentModel : null;
-};
-
-AttachmentModel.prototype.mimeType = '';
-AttachmentModel.prototype.fileName = '';
-AttachmentModel.prototype.estimatedSize = 0;
-AttachmentModel.prototype.friendlySize = '';
-AttachmentModel.prototype.isInline = false;
-AttachmentModel.prototype.isLinked = false;
-AttachmentModel.prototype.cid = '';
-AttachmentModel.prototype.cidWithOutTags = '';
-AttachmentModel.prototype.contentLocation = '';
-AttachmentModel.prototype.download = '';
-AttachmentModel.prototype.folder = '';
-AttachmentModel.prototype.uid = '';
-AttachmentModel.prototype.mimeIndex = '';
-
-/**
- * @param {AjaxJsonAttachment} oJsonAttachment
- */
-AttachmentModel.prototype.initByJson = function (oJsonAttachment)
-{
- var bResult = false;
- if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
- {
- this.mimeType = (oJsonAttachment.MimeType || '').toLowerCase();
- this.fileName = oJsonAttachment.FileName;
- this.estimatedSize = Utils.pInt(oJsonAttachment.EstimatedSize);
- this.isInline = !!oJsonAttachment.IsInline;
- this.isLinked = !!oJsonAttachment.IsLinked;
- this.cid = oJsonAttachment.CID;
- this.contentLocation = oJsonAttachment.ContentLocation;
- this.download = oJsonAttachment.Download;
-
- this.folder = oJsonAttachment.Folder;
- this.uid = oJsonAttachment.Uid;
- this.mimeIndex = oJsonAttachment.MimeIndex;
-
- this.friendlySize = Utils.friendlySize(this.estimatedSize);
- this.cidWithOutTags = this.cid.replace(/^<+/, '').replace(/>+$/, '');
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @return {boolean}
- */
-AttachmentModel.prototype.isImage = function ()
-{
- return -1 < Utils.inArray(this.mimeType.toLowerCase(),
- ['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
- );
-};
-
-/**
- * @return {boolean}
- */
-AttachmentModel.prototype.isText = function ()
-{
- return 'text/' === this.mimeType.substr(0, 5) &&
- -1 === Utils.inArray(this.mimeType, ['text/html']);
-};
-
-/**
- * @return {boolean}
- */
-AttachmentModel.prototype.isPdf = function ()
-{
- return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
-};
-
-/**
- * @return {string}
- */
-AttachmentModel.prototype.linkDownload = function ()
-{
- return RL.link().attachmentDownload(this.download);
-};
-
-/**
- * @return {string}
- */
-AttachmentModel.prototype.linkPreview = function ()
-{
- return RL.link().attachmentPreview(this.download);
-};
-
-/**
- * @return {string}
- */
-AttachmentModel.prototype.linkPreviewAsPlain = function ()
-{
- return RL.link().attachmentPreviewAsPlain(this.download);
-};
-
-/**
- * @return {string}
- */
-AttachmentModel.prototype.generateTransferDownloadUrl = function ()
-{
- var sLink = this.linkDownload();
- if ('http' !== sLink.substr(0, 4))
- {
- sLink = window.location.protocol + '//' + window.location.host + window.location.pathname + sLink;
- }
-
- return this.mimeType + ':' + this.fileName + ':' + sLink;
-};
-
-/**
- * @param {AttachmentModel} oAttachment
- * @param {*} oEvent
- * @return {boolean}
- */
-AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
-{
- var oLocalEvent = oEvent.originalEvent || oEvent;
- if (oAttachment && oLocalEvent && oLocalEvent.dataTransfer && oLocalEvent.dataTransfer.setData)
- {
- oLocalEvent.dataTransfer.setData('DownloadURL', this.generateTransferDownloadUrl());
- }
-
- return true;
-};
-
-AttachmentModel.prototype.iconClass = function ()
-{
- var
- aParts = this.mimeType.toLocaleString().split('/'),
- sClass = 'icon-file'
- ;
-
- if (aParts && aParts[1])
- {
- if ('image' === aParts[0])
- {
- sClass = 'icon-file-image';
- }
- else if ('text' === aParts[0])
- {
- sClass = 'icon-file-text';
- }
- else if ('audio' === aParts[0])
- {
- sClass = 'icon-file-music';
- }
- else if ('video' === aParts[0])
- {
- sClass = 'icon-file-movie';
- }
- else if (-1 < Utils.inArray(aParts[1],
- ['zip', '7z', 'tar', 'rar', 'gzip', 'bzip', 'bzip2', 'x-zip', 'x-7z', 'x-rar', 'x-tar', 'x-gzip', 'x-bzip', 'x-bzip2', 'x-zip-compressed', 'x-7z-compressed', 'x-rar-compressed']))
- {
- sClass = 'icon-file-zip';
- }
-// else if (-1 < Utils.inArray(aParts[1],
-// ['pdf', 'x-pdf']))
-// {
-// sClass = 'icon-file-pdf';
-// }
-// else if (-1 < Utils.inArray(aParts[1], [
-// 'exe', 'x-exe', 'x-winexe', 'bat'
-// ]))
-// {
-// sClass = 'icon-console';
-// }
- else if (-1 < Utils.inArray(aParts[1], [
- 'rtf', 'msword', 'vnd.msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document',
- 'vnd.openxmlformats-officedocument.wordprocessingml.template',
- 'vnd.ms-word.document.macroEnabled.12',
- 'vnd.ms-word.template.macroEnabled.12'
- ]))
- {
- sClass = 'icon-file-text';
- }
- else if (-1 < Utils.inArray(aParts[1], [
- 'excel', 'ms-excel', 'vnd.ms-excel',
- 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- 'vnd.openxmlformats-officedocument.spreadsheetml.template',
- 'vnd.ms-excel.sheet.macroEnabled.12',
- 'vnd.ms-excel.template.macroEnabled.12',
- 'vnd.ms-excel.addin.macroEnabled.12',
- 'vnd.ms-excel.sheet.binary.macroEnabled.12'
- ]))
- {
- sClass = 'icon-file-excel';
- }
- else if (-1 < Utils.inArray(aParts[1], [
- 'powerpoint', 'ms-powerpoint', 'vnd.ms-powerpoint',
- 'vnd.openxmlformats-officedocument.presentationml.presentation',
- 'vnd.openxmlformats-officedocument.presentationml.template',
- 'vnd.openxmlformats-officedocument.presentationml.slideshow',
- 'vnd.ms-powerpoint.addin.macroEnabled.12',
- 'vnd.ms-powerpoint.presentation.macroEnabled.12',
- 'vnd.ms-powerpoint.template.macroEnabled.12',
- 'vnd.ms-powerpoint.slideshow.macroEnabled.12'
- ]))
- {
- sClass = 'icon-file-chart-graph';
- }
- }
-
- return sClass;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @param {string} sId
- * @param {string} sFileName
- * @param {?number=} nSize
- * @param {boolean=} bInline
- * @param {boolean=} bLinked
- * @param {string=} sCID
- * @param {string=} sContentLocation
- */
-function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, sContentLocation)
-{
- this.id = sId;
- this.isInline = Utils.isUnd(bInline) ? false : !!bInline;
- this.isLinked = Utils.isUnd(bLinked) ? false : !!bLinked;
- this.CID = Utils.isUnd(sCID) ? '' : sCID;
- this.contentLocation = Utils.isUnd(sContentLocation) ? '' : sContentLocation;
- this.fromMessage = false;
-
- this.fileName = ko.observable(sFileName);
- this.size = ko.observable(Utils.isUnd(nSize) ? null : nSize);
- this.tempName = ko.observable('');
-
- this.progress = ko.observable('');
- this.error = ko.observable('');
- this.waiting = ko.observable(true);
- this.uploading = ko.observable(false);
- this.enabled = ko.observable(true);
-
- this.friendlySize = ko.computed(function () {
- var mSize = this.size();
- return null === mSize ? '' : Utils.friendlySize(this.size());
- }, this);
-}
-
-ComposeAttachmentModel.prototype.id = '';
-ComposeAttachmentModel.prototype.isInline = false;
-ComposeAttachmentModel.prototype.isLinked = false;
-ComposeAttachmentModel.prototype.CID = '';
-ComposeAttachmentModel.prototype.contentLocation = '';
-ComposeAttachmentModel.prototype.fromMessage = false;
-ComposeAttachmentModel.prototype.cancel = Utils.emptyFunction;
-
-/**
- * @param {AjaxJsonComposeAttachment} oJsonAttachment
- */
-ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
-{
- var bResult = false;
- if (oJsonAttachment)
- {
- this.fileName(oJsonAttachment.Name);
- this.size(Utils.isUnd(oJsonAttachment.Size) ? 0 : Utils.pInt(oJsonAttachment.Size));
- this.tempName(Utils.isUnd(oJsonAttachment.TempName) ? '' : oJsonAttachment.TempName);
- this.isInline = false;
-
- bResult = true;
- }
-
- return bResult;
-};
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function MessageModel()
-{
- this.folderFullNameRaw = '';
- this.uid = '';
- this.hash = '';
- this.requestHash = '';
- this.subject = ko.observable('');
- this.subjectPrefix = ko.observable('');
- this.subjectSuffix = ko.observable('');
- this.size = ko.observable(0);
- this.dateTimeStampInUTC = ko.observable(0);
- this.priority = ko.observable(Enums.MessagePriority.Normal);
-
- this.proxy = false;
-
- this.fromEmailString = ko.observable('');
- this.fromClearEmailString = ko.observable('');
- this.toEmailsString = ko.observable('');
- this.toClearEmailsString = ko.observable('');
-
- this.senderEmailsString = ko.observable('');
- this.senderClearEmailsString = ko.observable('');
-
- this.emails = [];
-
- this.from = [];
- this.to = [];
- this.cc = [];
- this.bcc = [];
- this.replyTo = [];
- this.deliveredTo = [];
-
- this.newForAnimation = ko.observable(false);
-
- this.deleted = ko.observable(false);
- this.unseen = ko.observable(false);
- this.flagged = ko.observable(false);
- this.answered = ko.observable(false);
- this.forwarded = ko.observable(false);
- this.isReadReceipt = ko.observable(false);
-
- this.focused = ko.observable(false);
- this.selected = ko.observable(false);
- this.checked = ko.observable(false);
- this.hasAttachments = ko.observable(false);
- this.attachmentsMainType = ko.observable('');
-
- this.moment = ko.observable(moment(moment.unix(0)));
-
- this.attachmentIconClass = ko.computed(function () {
- var sClass = '';
- if (this.hasAttachments())
- {
- sClass = 'icon-attachment';
- switch (this.attachmentsMainType())
- {
- case 'image':
- sClass = 'icon-image';
- break;
- case 'archive':
- sClass = 'icon-file-zip';
- break;
- case 'doc':
- sClass = 'icon-file-text';
- break;
-// case 'pdf':
-// sClass = 'icon-file-pdf';
-// break;
- }
- }
- return sClass;
- }, this);
-
- this.fullFormatDateValue = ko.computed(function () {
- return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC());
- }, this);
-
- this.momentDate = Utils.createMomentDate(this);
- this.momentShortDate = Utils.createMomentShortDate(this);
-
- this.dateTimeStampInUTC.subscribe(function (iValue) {
- var iNow = moment().unix();
- this.moment(moment.unix(iNow < iValue ? iNow : iValue));
- }, this);
-
- this.body = null;
- this.plainRaw = '';
- this.isHtml = ko.observable(false);
- this.hasImages = ko.observable(false);
- this.attachments = ko.observableArray([]);
-
- this.isPgpSigned = ko.observable(false);
- this.isPgpEncrypted = ko.observable(false);
- this.pgpSignedVerifyStatus = ko.observable(Enums.SignedVerifyStatus.None);
- this.pgpSignedVerifyUser = ko.observable('');
-
- this.priority = ko.observable(Enums.MessagePriority.Normal);
- this.readReceipt = ko.observable('');
-
- this.aDraftInfo = [];
- this.sMessageId = '';
- this.sInReplyTo = '';
- this.sReferences = '';
-
- this.parentUid = ko.observable(0);
- this.threads = ko.observableArray([]);
- this.threadsLen = ko.observable(0);
- this.hasUnseenSubMessage = ko.observable(false);
- this.hasFlaggedSubMessage = ko.observable(false);
-
- this.lastInCollapsedThread = ko.observable(false);
- this.lastInCollapsedThreadLoading = ko.observable(false);
-
- this.threadsLenResult = ko.computed(function () {
- var iCount = this.threadsLen();
- return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
- }, this);
-}
-
-/**
- * @static
- * @param {AjaxJsonMessage} oJsonMessage
- * @return {?MessageModel}
- */
-MessageModel.newInstanceFromJson = function (oJsonMessage)
-{
- var oMessageModel = new MessageModel();
- return oMessageModel.initByJson(oJsonMessage) ? oMessageModel : null;
-};
-
-/**
- * @static
- * @param {number} iTimeStampInUTC
- * @return {string}
- */
-MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
-{
- return 0 < iTimeStampInUTC ? moment.unix(iTimeStampInUTC).format('LLL') : '';
-};
-
-/**
- * @static
- * @param {Array} aEmail
- * @param {boolean=} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
-MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
-{
- var
- aResult = [],
- iIndex = 0,
- iLen = 0
- ;
-
- if (Utils.isNonEmptyArray(aEmail))
- {
- for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
- {
- aResult.push(aEmail[iIndex].toLine(bFriendlyView, bWrapWithLink));
- }
- }
-
- return aResult.join(', ');
-};
-
-/**
- * @static
- * @param {Array} aEmail
- * @return {string}
- */
-MessageModel.emailsToLineClear = function (aEmail)
-{
- var
- aResult = [],
- iIndex = 0,
- iLen = 0
- ;
-
- if (Utils.isNonEmptyArray(aEmail))
- {
- for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
- {
- if (aEmail[iIndex] && aEmail[iIndex].email && '' !== aEmail[iIndex].name)
- {
- aResult.push(aEmail[iIndex].email);
- }
- }
- }
-
- return aResult.join(', ');
-};
-
-/**
- * @static
- * @param {?Array} aJsonEmails
- * @return {Array.}
- */
-MessageModel.initEmailsFromJson = function (aJsonEmails)
-{
- var
- iIndex = 0,
- iLen = 0,
- oEmailModel = null,
- aResult = []
- ;
-
- if (Utils.isNonEmptyArray(aJsonEmails))
- {
- for (iIndex = 0, iLen = aJsonEmails.length; iIndex < iLen; iIndex++)
- {
- oEmailModel = EmailModel.newInstanceFromJson(aJsonEmails[iIndex]);
- if (oEmailModel)
- {
- aResult.push(oEmailModel);
- }
- }
- }
-
- return aResult;
-};
-
-/**
- * @static
- * @param {Array.} aMessageEmails
- * @param {Object} oLocalUnic
- * @param {Array} aLocalEmails
- */
-MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
-{
- if (aMessageEmails && 0 < aMessageEmails.length)
- {
- var
- iIndex = 0,
- iLen = aMessageEmails.length
- ;
-
- for (; iIndex < iLen; iIndex++)
- {
- if (Utils.isUnd(oLocalUnic[aMessageEmails[iIndex].email]))
- {
- oLocalUnic[aMessageEmails[iIndex].email] = true;
- aLocalEmails.push(aMessageEmails[iIndex]);
- }
- }
- }
-};
-
-MessageModel.prototype.clear = function ()
-{
- this.folderFullNameRaw = '';
- this.uid = '';
- this.hash = '';
- this.requestHash = '';
- this.subject('');
- this.subjectPrefix('');
- this.subjectSuffix('');
- this.size(0);
- this.dateTimeStampInUTC(0);
- this.priority(Enums.MessagePriority.Normal);
-
- this.proxy = false;
-
- this.fromEmailString('');
- this.fromClearEmailString('');
- this.toEmailsString('');
- this.toClearEmailsString('');
- this.senderEmailsString('');
- this.senderClearEmailsString('');
-
- this.emails = [];
-
- this.from = [];
- this.to = [];
- this.cc = [];
- this.bcc = [];
- this.replyTo = [];
- this.deliveredTo = [];
-
- this.newForAnimation(false);
-
- this.deleted(false);
- this.unseen(false);
- this.flagged(false);
- this.answered(false);
- this.forwarded(false);
- this.isReadReceipt(false);
-
- this.selected(false);
- this.checked(false);
- this.hasAttachments(false);
- this.attachmentsMainType('');
-
- this.body = null;
- this.isHtml(false);
- this.hasImages(false);
- this.attachments([]);
-
- this.isPgpSigned(false);
- this.isPgpEncrypted(false);
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
- this.pgpSignedVerifyUser('');
-
- this.priority(Enums.MessagePriority.Normal);
- this.readReceipt('');
- this.aDraftInfo = [];
- this.sMessageId = '';
- this.sInReplyTo = '';
- this.sReferences = '';
-
- this.parentUid(0);
- this.threads([]);
- this.threadsLen(0);
- this.hasUnseenSubMessage(false);
- this.hasFlaggedSubMessage(false);
-
- this.lastInCollapsedThread(false);
- this.lastInCollapsedThreadLoading(false);
-};
-
-MessageModel.prototype.computeSenderEmail = function ()
-{
- var
- sSent = RL.data().sentFolder(),
- sDraft = RL.data().draftFolder()
- ;
-
- this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
- this.toEmailsString() : this.fromEmailString());
-
- this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
- this.toClearEmailsString() : this.fromClearEmailString());
-};
-
-/**
- * @param {AjaxJsonMessage} oJsonMessage
- * @return {boolean}
- */
-MessageModel.prototype.initByJson = function (oJsonMessage)
-{
- var bResult = false;
- if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
- {
- this.folderFullNameRaw = oJsonMessage.Folder;
- this.uid = oJsonMessage.Uid;
- this.hash = oJsonMessage.Hash;
- this.requestHash = oJsonMessage.RequestHash;
-
- this.proxy = !!oJsonMessage.ExternalProxy;
-
- this.size(Utils.pInt(oJsonMessage.Size));
-
- this.from = MessageModel.initEmailsFromJson(oJsonMessage.From);
- this.to = MessageModel.initEmailsFromJson(oJsonMessage.To);
- this.cc = MessageModel.initEmailsFromJson(oJsonMessage.Cc);
- this.bcc = MessageModel.initEmailsFromJson(oJsonMessage.Bcc);
- this.replyTo = MessageModel.initEmailsFromJson(oJsonMessage.ReplyTo);
- this.deliveredTo = MessageModel.initEmailsFromJson(oJsonMessage.DeliveredTo);
-
- this.subject(oJsonMessage.Subject);
- if (Utils.isArray(oJsonMessage.SubjectParts))
- {
- this.subjectPrefix(oJsonMessage.SubjectParts[0]);
- this.subjectSuffix(oJsonMessage.SubjectParts[1]);
- }
- else
- {
- this.subjectPrefix('');
- this.subjectSuffix(this.subject());
- }
-
- this.dateTimeStampInUTC(Utils.pInt(oJsonMessage.DateTimeStampInUTC));
- this.hasAttachments(!!oJsonMessage.HasAttachments);
- this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
-
- this.fromEmailString(MessageModel.emailsToLine(this.from, true));
- this.fromClearEmailString(MessageModel.emailsToLineClear(this.from));
- this.toEmailsString(MessageModel.emailsToLine(this.to, true));
- this.toClearEmailsString(MessageModel.emailsToLineClear(this.to));
-
- this.parentUid(Utils.pInt(oJsonMessage.ParentThread));
- this.threads(Utils.isArray(oJsonMessage.Threads) ? oJsonMessage.Threads : []);
- this.threadsLen(Utils.pInt(oJsonMessage.ThreadsLen));
-
- this.initFlagsByJson(oJsonMessage);
- this.computeSenderEmail();
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @param {AjaxJsonMessage} oJsonMessage
- * @return {boolean}
- */
-MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
-{
- var
- bResult = false,
- iPriority = Enums.MessagePriority.Normal
- ;
-
- if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
- {
- iPriority = Utils.pInt(oJsonMessage.Priority);
- this.priority(-1 < Utils.inArray(iPriority, [Enums.MessagePriority.High, Enums.MessagePriority.Low]) ?
- iPriority : Enums.MessagePriority.Normal);
-
- this.aDraftInfo = oJsonMessage.DraftInfo;
-
- this.sMessageId = oJsonMessage.MessageId;
- this.sInReplyTo = oJsonMessage.InReplyTo;
- this.sReferences = oJsonMessage.References;
-
- this.proxy = !!oJsonMessage.ExternalProxy;
-
- if (RL.data().capaOpenPGP())
- {
- this.isPgpSigned(!!oJsonMessage.PgpSigned);
- this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
- }
-
- this.hasAttachments(!!oJsonMessage.HasAttachments);
- this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
-
- this.foundedCIDs = Utils.isArray(oJsonMessage.FoundedCIDs) ? oJsonMessage.FoundedCIDs : [];
- this.attachments(this.initAttachmentsFromJson(oJsonMessage.Attachments));
-
- this.readReceipt(oJsonMessage.ReadReceipt || '');
-
- this.computeSenderEmail();
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @param {(AjaxJsonAttachment|null)} oJsonAttachments
- * @return {Array}
- */
-MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
-{
- var
- iIndex = 0,
- iLen = 0,
- oAttachmentModel = null,
- aResult = []
- ;
-
- if (oJsonAttachments && 'Collection/AttachmentCollection' === oJsonAttachments['@Object'] &&
- Utils.isNonEmptyArray(oJsonAttachments['@Collection']))
- {
- for (iIndex = 0, iLen = oJsonAttachments['@Collection'].length; iIndex < iLen; iIndex++)
- {
- oAttachmentModel = AttachmentModel.newInstanceFromJson(oJsonAttachments['@Collection'][iIndex]);
- if (oAttachmentModel)
- {
- if ('' !== oAttachmentModel.cidWithOutTags && 0 < this.foundedCIDs.length &&
- 0 <= Utils.inArray(oAttachmentModel.cidWithOutTags, this.foundedCIDs))
- {
- oAttachmentModel.isLinked = true;
- }
-
- aResult.push(oAttachmentModel);
- }
- }
- }
-
- return aResult;
-};
-
-/**
- * @param {AjaxJsonMessage} oJsonMessage
- * @return {boolean}
- */
-MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
-{
- var bResult = false;
-
- if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
- {
- this.unseen(!oJsonMessage.IsSeen);
- this.flagged(!!oJsonMessage.IsFlagged);
- this.answered(!!oJsonMessage.IsAnswered);
- this.forwarded(!!oJsonMessage.IsForwarded);
- this.isReadReceipt(!!oJsonMessage.IsReadReceipt);
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
-MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
-{
- return MessageModel.emailsToLine(this.from, bFriendlyView, bWrapWithLink);
-};
-
-/**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
-MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
-{
- return MessageModel.emailsToLine(this.to, bFriendlyView, bWrapWithLink);
-};
-
-/**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
-MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
-{
- return MessageModel.emailsToLine(this.cc, bFriendlyView, bWrapWithLink);
-};
-
-/**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
-MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
-{
- return MessageModel.emailsToLine(this.bcc, bFriendlyView, bWrapWithLink);
-};
-
-/**
- * @return string
- */
-MessageModel.prototype.lineAsCcc = function ()
-{
- var aResult = [];
- if (this.deleted())
- {
- aResult.push('deleted');
- }
- if (this.selected())
- {
- aResult.push('selected');
- }
- if (this.checked())
- {
- aResult.push('checked');
- }
- if (this.flagged())
- {
- aResult.push('flagged');
- }
- if (this.unseen())
- {
- aResult.push('unseen');
- }
- if (this.answered())
- {
- aResult.push('answered');
- }
- if (this.forwarded())
- {
- aResult.push('forwarded');
- }
- if (this.focused())
- {
- aResult.push('focused');
- }
- if (this.hasAttachments())
- {
- aResult.push('withAttachments');
- switch (this.attachmentsMainType())
- {
- case 'image':
- aResult.push('imageOnlyAttachments');
- break;
- case 'archive':
- aResult.push('archiveOnlyAttachments');
- break;
- }
- }
- if (this.newForAnimation())
- {
- aResult.push('new');
- }
- if ('' === this.subject())
- {
- aResult.push('emptySubject');
- }
- if (0 < this.parentUid())
- {
- aResult.push('hasParentMessage');
- }
- if (0 < this.threadsLen() && 0 === this.parentUid())
- {
- aResult.push('hasChildrenMessage');
- }
- if (this.hasUnseenSubMessage())
- {
- aResult.push('hasUnseenSubMessage');
- }
- if (this.hasFlaggedSubMessage())
- {
- aResult.push('hasFlaggedSubMessage');
- }
-
- return aResult.join(' ');
-};
-
-/**
- * @return {boolean}
- */
-MessageModel.prototype.hasVisibleAttachments = function ()
-{
- return !!_.find(this.attachments(), function (oAttachment) {
- return !oAttachment.isLinked;
- });
-// return 0 < this.attachments().length;
-};
-
-/**
- * @param {string} sCid
- * @return {*}
- */
-MessageModel.prototype.findAttachmentByCid = function (sCid)
-{
- var
- oResult = null,
- aAttachments = this.attachments()
- ;
-
- if (Utils.isNonEmptyArray(aAttachments))
- {
- sCid = sCid.replace(/^<+/, '').replace(/>+$/, '');
- oResult = _.find(aAttachments, function (oAttachment) {
- return sCid === oAttachment.cidWithOutTags;
- });
- }
-
- return oResult || null;
-};
-
-/**
- * @param {string} sContentLocation
- * @return {*}
- */
-MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
-{
- var
- oResult = null,
- aAttachments = this.attachments()
- ;
-
- if (Utils.isNonEmptyArray(aAttachments))
- {
- oResult = _.find(aAttachments, function (oAttachment) {
- return sContentLocation === oAttachment.contentLocation;
- });
- }
-
- return oResult || null;
-};
-
-
-/**
- * @return {string}
- */
-MessageModel.prototype.messageId = function ()
-{
- return this.sMessageId;
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.inReplyTo = function ()
-{
- return this.sInReplyTo;
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.references = function ()
-{
- return this.sReferences;
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.fromAsSingleEmail = function ()
-{
- return Utils.isArray(this.from) && this.from[0] ? this.from[0].email : '';
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.viewLink = function ()
-{
- return RL.link().messageViewLink(this.requestHash);
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.downloadLink = function ()
-{
- return RL.link().messageDownloadLink(this.requestHash);
-};
-
-/**
- * @param {Object} oExcludeEmails
- * @return {Array}
- */
-MessageModel.prototype.replyEmails = function (oExcludeEmails)
-{
- var
- aResult = [],
- oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
- ;
-
- MessageModel.replyHelper(this.replyTo, oUnic, aResult);
- if (0 === aResult.length)
- {
- MessageModel.replyHelper(this.from, oUnic, aResult);
- }
-
- return aResult;
-};
-
-/**
- * @param {Object} oExcludeEmails
- * @return {Array.}
- */
-MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
-{
- var
- aToResult = [],
- aCcResult = [],
- oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
- ;
-
- MessageModel.replyHelper(this.replyTo, oUnic, aToResult);
- if (0 === aToResult.length)
- {
- MessageModel.replyHelper(this.from, oUnic, aToResult);
- }
-
- MessageModel.replyHelper(this.to, oUnic, aToResult);
- MessageModel.replyHelper(this.cc, oUnic, aCcResult);
-
- return [aToResult, aCcResult];
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.textBodyToString = function ()
-{
- return this.body ? this.body.html() : '';
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.attachmentsToStringLine = function ()
-{
- var aAttachLines = _.map(this.attachments(), function (oItem) {
- return oItem.fileName + ' (' + oItem.friendlySize + ')';
- });
-
- return aAttachLines && 0 < aAttachLines.length ? aAttachLines.join(', ') : '';
-};
-
-/**
- * @return {Object}
- */
-MessageModel.prototype.getDataForWindowPopup = function ()
-{
- return {
- 'popupFrom': this.fromToLine(false),
- 'popupTo': this.toToLine(false),
- 'popupCc': this.ccToLine(false),
- 'popupBcc': this.bccToLine(false),
- 'popupSubject': this.subject(),
- 'popupDate': this.fullFormatDateValue(),
- 'popupAttachments': this.attachmentsToStringLine(),
- 'popupBody': this.textBodyToString()
- };
-};
-
-/**
- * @param {boolean=} bPrint = false
- */
-MessageModel.prototype.viewPopupMessage = function (bPrint)
-{
- Utils.windowPopupKnockout(this.getDataForWindowPopup(), 'PopupsWindowSimpleMessage', this.subject(), function (oPopupWin) {
- if (oPopupWin && oPopupWin.document && oPopupWin.document.body)
- {
- $('img.lazy', oPopupWin.document.body).each(function (iIndex, oImg) {
-
- var
- $oImg = $(oImg),
- sOrig = $oImg.data('original'),
- sSrc = $oImg.attr('src')
- ;
-
- if (0 <= iIndex && sOrig && !sSrc)
- {
- $oImg.attr('src', sOrig);
- }
- });
-
- if (bPrint)
- {
- window.setTimeout(function () {
- oPopupWin.print();
- }, 100);
- }
- }
- });
-};
-
-MessageModel.prototype.printMessage = function ()
-{
- this.viewPopupMessage(true);
-};
-
-/**
- * @returns {string}
- */
-MessageModel.prototype.generateUid = function ()
-{
- return this.folderFullNameRaw + '/' + this.uid;
-};
-
-/**
- * @param {MessageModel} oMessage
- * @return {MessageModel}
- */
-MessageModel.prototype.populateByMessageListItem = function (oMessage)
-{
- this.folderFullNameRaw = oMessage.folderFullNameRaw;
- this.uid = oMessage.uid;
- this.hash = oMessage.hash;
- this.requestHash = oMessage.requestHash;
- this.subject(oMessage.subject());
- this.subjectPrefix(this.subjectPrefix());
- this.subjectSuffix(this.subjectSuffix());
-
- this.size(oMessage.size());
- this.dateTimeStampInUTC(oMessage.dateTimeStampInUTC());
- this.priority(oMessage.priority());
-
- this.proxy = oMessage.proxy;
-
- this.fromEmailString(oMessage.fromEmailString());
- this.fromClearEmailString(oMessage.fromClearEmailString());
- this.toEmailsString(oMessage.toEmailsString());
- this.toClearEmailsString(oMessage.toClearEmailsString());
-
- this.emails = oMessage.emails;
-
- this.from = oMessage.from;
- this.to = oMessage.to;
- this.cc = oMessage.cc;
- this.bcc = oMessage.bcc;
- this.replyTo = oMessage.replyTo;
- this.deliveredTo = oMessage.deliveredTo;
-
- this.unseen(oMessage.unseen());
- this.flagged(oMessage.flagged());
- this.answered(oMessage.answered());
- this.forwarded(oMessage.forwarded());
- this.isReadReceipt(oMessage.isReadReceipt());
-
- this.selected(oMessage.selected());
- this.checked(oMessage.checked());
- this.hasAttachments(oMessage.hasAttachments());
- this.attachmentsMainType(oMessage.attachmentsMainType());
-
- this.moment(oMessage.moment());
-
- this.body = null;
-// this.isHtml(false);
-// this.hasImages(false);
-// this.attachments([]);
-
-// this.isPgpSigned(false);
-// this.isPgpEncrypted(false);
-
- this.priority(Enums.MessagePriority.Normal);
- this.aDraftInfo = [];
- this.sMessageId = '';
- this.sInReplyTo = '';
- this.sReferences = '';
-
- this.parentUid(oMessage.parentUid());
- this.threads(oMessage.threads());
- this.threadsLen(oMessage.threadsLen());
-
- this.computeSenderEmail();
-
- return this;
-};
-
-MessageModel.prototype.showExternalImages = function (bLazy)
-{
- if (this.body && this.body.data('rl-has-images'))
- {
- var sAttr = '';
- bLazy = Utils.isUnd(bLazy) ? false : bLazy;
-
- this.hasImages(false);
- this.body.data('rl-has-images', false);
-
- sAttr = this.proxy ? 'data-x-additional-src' : 'data-x-src';
- $('[' + sAttr + ']', this.body).each(function () {
- if (bLazy && $(this).is('img'))
- {
- $(this)
- .addClass('lazy')
- .attr('data-original', $(this).attr(sAttr))
- .removeAttr(sAttr)
- ;
- }
- else
- {
- $(this).attr('src', $(this).attr(sAttr)).removeAttr(sAttr);
- }
- });
-
- sAttr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url';
- $('[' + sAttr + ']', this.body).each(function () {
- var sStyle = Utils.trim($(this).attr('style'));
- sStyle = '' === sStyle ? '' : (';' === sStyle.substr(-1) ? sStyle + ' ' : sStyle + '; ');
- $(this).attr('style', sStyle + $(this).attr(sAttr)).removeAttr(sAttr);
- });
-
- if (bLazy)
- {
- $('img.lazy', this.body).addClass('lazy-inited').lazyload({
- 'threshold' : 400,
- 'effect' : 'fadeIn',
- 'skip_invisible' : false,
- 'container': $('.RL-MailMessageView .messageView .messageItem .content')[0]
- });
-
- $window.resize();
- }
-
- Utils.windowResize(500);
- }
-};
-
-MessageModel.prototype.showInternalImages = function (bLazy)
-{
- if (this.body && !this.body.data('rl-init-internal-images'))
- {
- this.body.data('rl-init-internal-images', true);
-
- bLazy = Utils.isUnd(bLazy) ? false : bLazy;
-
- var self = this;
-
- $('[data-x-src-cid]', this.body).each(function () {
-
- var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid'));
- if (oAttachment && oAttachment.download)
- {
- if (bLazy && $(this).is('img'))
- {
- $(this)
- .addClass('lazy')
- .attr('data-original', oAttachment.linkPreview());
- }
- else
- {
- $(this).attr('src', oAttachment.linkPreview());
- }
- }
- });
-
- $('[data-x-src-location]', this.body).each(function () {
-
- var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location'));
- if (!oAttachment)
- {
- oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-location'));
- }
-
- if (oAttachment && oAttachment.download)
- {
- if (bLazy && $(this).is('img'))
- {
- $(this)
- .addClass('lazy')
- .attr('data-original', oAttachment.linkPreview());
- }
- else
- {
- $(this).attr('src', oAttachment.linkPreview());
- }
- }
- });
-
- $('[data-x-style-cid]', this.body).each(function () {
-
- var
- sStyle = '',
- sName = '',
- oAttachment = self.findAttachmentByCid($(this).attr('data-x-style-cid'))
- ;
-
- if (oAttachment && oAttachment.linkPreview)
- {
- sName = $(this).attr('data-x-style-cid-name');
- if ('' !== sName)
- {
- sStyle = Utils.trim($(this).attr('style'));
- sStyle = '' === sStyle ? '' : (';' === sStyle.substr(-1) ? sStyle + ' ' : sStyle + '; ');
- $(this).attr('style', sStyle + sName + ': url(\'' + oAttachment.linkPreview() + '\')');
- }
- }
- });
-
- if (bLazy)
- {
- (function ($oImg, oContainer) {
- _.delay(function () {
- $oImg.addClass('lazy-inited').lazyload({
- 'threshold' : 400,
- 'effect' : 'fadeIn',
- 'skip_invisible' : false,
- 'container': oContainer
- });
- }, 300);
- }($('img.lazy', self.body), $('.RL-MailMessageView .messageView .messageItem .content')[0]));
- }
-
- Utils.windowResize(500);
- }
-};
-
-MessageModel.prototype.storeDataToDom = function ()
-{
- if (this.body)
- {
- this.body.data('rl-is-html', !!this.isHtml());
- this.body.data('rl-has-images', !!this.hasImages());
-
- this.body.data('rl-plain-raw', this.plainRaw);
-
- if (RL.data().capaOpenPGP())
- {
- this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
- this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
- this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
- this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
- }
- }
-};
-
-MessageModel.prototype.storePgpVerifyDataToDom = function ()
-{
- if (this.body && RL.data().capaOpenPGP())
- {
- this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
- this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
- }
-};
-
-MessageModel.prototype.fetchDataToDom = function ()
-{
- if (this.body)
- {
- this.isHtml(!!this.body.data('rl-is-html'));
- this.hasImages(!!this.body.data('rl-has-images'));
-
- this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
-
- if (RL.data().capaOpenPGP())
- {
- this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
- this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
- this.pgpSignedVerifyStatus(this.body.data('rl-pgp-verify-status'));
- this.pgpSignedVerifyUser(this.body.data('rl-pgp-verify-user'));
- }
- else
- {
- this.isPgpSigned(false);
- this.isPgpEncrypted(false);
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
- this.pgpSignedVerifyUser('');
- }
- }
-};
-
-MessageModel.prototype.verifyPgpSignedClearMessage = function ()
-{
- if (this.isPgpSigned())
- {
- var
- aRes = [],
- mPgpMessage = null,
- sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
- aPublicKeys = RL.data().findPublicKeysByEmail(sFrom),
- oValidKey = null,
- oValidSysKey = null,
- sPlain = ''
- ;
-
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
- this.pgpSignedVerifyUser('');
-
- try
- {
- mPgpMessage = window.openpgp.cleartext.readArmored(this.plainRaw);
- if (mPgpMessage && mPgpMessage.getText)
- {
- this.pgpSignedVerifyStatus(
- aPublicKeys.length ? Enums.SignedVerifyStatus.Unverified : Enums.SignedVerifyStatus.UnknownPublicKeys);
-
- aRes = mPgpMessage.verify(aPublicKeys);
- if (aRes && 0 < aRes.length)
- {
- oValidKey = _.find(aRes, function (oItem) {
- return oItem && oItem.keyid && oItem.valid;
- });
-
- if (oValidKey)
- {
- oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
- if (oValidSysKey)
- {
- sPlain = mPgpMessage.getText();
-
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
- this.pgpSignedVerifyUser(oValidSysKey.user);
-
- sPlain =
- $proxyDiv.empty().append(
- $('').text(sPlain)
- ).html()
- ;
-
- $proxyDiv.empty();
-
- this.replacePlaneTextBody(sPlain);
- }
- }
- }
- }
- }
- catch (oExc) {}
-
- this.storePgpVerifyDataToDom();
- }
-};
-
-MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
-{
- if (this.isPgpEncrypted())
- {
- var
- aRes = [],
- mPgpMessage = null,
- mPgpMessageDecrypted = null,
- sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
- aPublicKey = RL.data().findPublicKeysByEmail(sFrom),
- oPrivateKey = RL.data().findSelfPrivateKey(sPassword),
- oValidKey = null,
- oValidSysKey = null,
- sPlain = ''
- ;
-
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
- this.pgpSignedVerifyUser('');
-
- if (!oPrivateKey)
- {
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.UnknownPrivateKey);
- }
-
- try
- {
- mPgpMessage = window.openpgp.message.readArmored(this.plainRaw);
- if (mPgpMessage && oPrivateKey && mPgpMessage.decrypt)
- {
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Unverified);
-
- mPgpMessageDecrypted = mPgpMessage.decrypt(oPrivateKey);
- if (mPgpMessageDecrypted)
- {
- aRes = mPgpMessageDecrypted.verify(aPublicKey);
- if (aRes && 0 < aRes.length)
- {
- oValidKey = _.find(aRes, function (oItem) {
- return oItem && oItem.keyid && oItem.valid;
- });
-
- if (oValidKey)
- {
- oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
- if (oValidSysKey)
- {
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
- this.pgpSignedVerifyUser(oValidSysKey.user);
- }
- }
- }
-
- sPlain = mPgpMessageDecrypted.getText();
-
- sPlain =
- $proxyDiv.empty().append(
- $('').text(sPlain)
- ).html()
- ;
-
- $proxyDiv.empty();
-
- this.replacePlaneTextBody(sPlain);
- }
- }
- }
- catch (oExc) {}
-
- this.storePgpVerifyDataToDom();
- }
-};
-
-MessageModel.prototype.replacePlaneTextBody = function (sPlain)
-{
- if (this.body)
- {
- this.body.html(sPlain).addClass('b-text-part plain');
- }
-};
-
-/**
- * @return {string}
- */
-MessageModel.prototype.flagHash = function ()
-{
- return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
- this.isReadReceipt()].join('');
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function FolderModel()
-{
- this.name = ko.observable('');
- this.fullName = '';
- this.fullNameRaw = '';
- this.fullNameHash = '';
- this.delimiter = '';
- this.namespace = '';
- this.deep = 0;
- this.interval = 0;
-
- this.selectable = false;
- this.existen = true;
-
- this.type = ko.observable(Enums.FolderType.User);
-
- this.focused = ko.observable(false);
- this.selected = ko.observable(false);
- this.edited = ko.observable(false);
- this.collapsed = ko.observable(true);
- this.subScribed = ko.observable(true);
- this.subFolders = ko.observableArray([]);
- this.deleteAccess = ko.observable(false);
- this.actionBlink = ko.observable(false).extend({'falseTimeout': 1000});
-
- this.nameForEdit = ko.observable('');
-
- this.name.subscribe(function (sValue) {
- this.nameForEdit(sValue);
- }, this);
-
- this.edited.subscribe(function (bValue) {
- if (bValue)
- {
- this.nameForEdit(this.name());
- }
- }, this);
-
- this.privateMessageCountAll = ko.observable(0);
- this.privateMessageCountUnread = ko.observable(0);
-
- this.collapsedPrivate = ko.observable(true);
-}
-
-/**
- * @static
- * @param {AjaxJsonFolder} oJsonFolder
- * @return {?FolderModel}
- */
-FolderModel.newInstanceFromJson = function (oJsonFolder)
-{
- var oFolderModel = new FolderModel();
- return oFolderModel.initByJson(oJsonFolder) ? oFolderModel.initComputed() : null;
-};
-
-/**
- * @return {FolderModel}
- */
-FolderModel.prototype.initComputed = function ()
-{
- this.hasSubScribedSubfolders = ko.computed(function () {
- return !!_.find(this.subFolders(), function (oFolder) {
- return oFolder.subScribed() && !oFolder.isSystemFolder();
- });
- }, this);
-
- this.canBeEdited = ko.computed(function () {
- return Enums.FolderType.User === this.type() && this.existen && this.selectable;
- }, this);
-
- this.visible = ko.computed(function () {
- var
- bSubScribed = this.subScribed(),
- bSubFolders = this.hasSubScribedSubfolders()
- ;
-
- return (bSubScribed || (bSubFolders && (!this.existen || !this.selectable)));
- }, this);
-
- this.isSystemFolder = ko.computed(function () {
- return Enums.FolderType.User !== this.type();
- }, this);
-
- this.hidden = ko.computed(function () {
- var
- bSystem = this.isSystemFolder(),
- bSubFolders = this.hasSubScribedSubfolders()
- ;
-
- return (bSystem && !bSubFolders) || (!this.selectable && !bSubFolders);
-
- }, this);
-
- this.selectableForFolderList = ko.computed(function () {
- return !this.isSystemFolder() && this.selectable;
- }, this);
-
- this.messageCountAll = ko.computed({
- 'read': this.privateMessageCountAll,
- 'write': function (iValue) {
- if (Utils.isPosNumeric(iValue, true))
- {
- this.privateMessageCountAll(iValue);
- }
- else
- {
- this.privateMessageCountAll.valueHasMutated();
- }
- },
- 'owner': this
- });
-
- this.messageCountUnread = ko.computed({
- 'read': this.privateMessageCountUnread,
- 'write': function (iValue) {
- if (Utils.isPosNumeric(iValue, true))
- {
- this.privateMessageCountUnread(iValue);
- }
- else
- {
- this.privateMessageCountUnread.valueHasMutated();
- }
- },
- 'owner': this
- });
-
- this.printableUnreadCount = ko.computed(function () {
- var
- iCount = this.messageCountAll(),
- iUnread = this.messageCountUnread(),
- iType = this.type()
- ;
-
- if (Enums.FolderType.Inbox === iType)
- {
- RL.data().foldersInboxUnreadCount(iUnread);
- }
-
- if (0 < iCount)
- {
- if (Enums.FolderType.Draft === iType)
- {
- return '' + iCount;
- }
- else if (0 < iUnread && Enums.FolderType.Trash !== iType && Enums.FolderType.Archive !== iType && Enums.FolderType.SentItems !== iType)
- {
- return '' + iUnread;
- }
- }
-
- return '';
-
- }, this);
-
- this.canBeDeleted = ko.computed(function () {
- var
- bSystem = this.isSystemFolder()
- ;
- return !bSystem && 0 === this.subFolders().length && 'INBOX' !== this.fullNameRaw;
- }, this);
-
- this.canBeSubScribed = ko.computed(function () {
- return !this.isSystemFolder() && this.selectable && 'INBOX' !== this.fullNameRaw;
- }, this);
-
- this.visible.subscribe(function () {
- Utils.timeOutAction('folder-list-folder-visibility-change', function () {
- $window.trigger('folder-list-folder-visibility-change');
- }, 100);
- });
-
- this.localName = ko.computed(function () {
-
- Globals.langChangeTrigger();
-
- var
- iType = this.type(),
- sName = this.name()
- ;
-
- if (this.isSystemFolder())
- {
- switch (iType)
- {
- case Enums.FolderType.Inbox:
- sName = Utils.i18n('FOLDER_LIST/INBOX_NAME');
- break;
- case Enums.FolderType.SentItems:
- sName = Utils.i18n('FOLDER_LIST/SENT_NAME');
- break;
- case Enums.FolderType.Draft:
- sName = Utils.i18n('FOLDER_LIST/DRAFTS_NAME');
- break;
- case Enums.FolderType.Spam:
- sName = Utils.i18n('FOLDER_LIST/SPAM_NAME');
- break;
- case Enums.FolderType.Trash:
- sName = Utils.i18n('FOLDER_LIST/TRASH_NAME');
- break;
- case Enums.FolderType.Archive:
- sName = Utils.i18n('FOLDER_LIST/ARCHIVE_NAME');
- break;
- }
- }
-
- return sName;
-
- }, this);
-
- this.manageFolderSystemName = ko.computed(function () {
-
- Globals.langChangeTrigger();
-
- var
- sSuffix = '',
- iType = this.type(),
- sName = this.name()
- ;
-
- if (this.isSystemFolder())
- {
- switch (iType)
- {
- case Enums.FolderType.Inbox:
- sSuffix = '(' + Utils.i18n('FOLDER_LIST/INBOX_NAME') + ')';
- break;
- case Enums.FolderType.SentItems:
- sSuffix = '(' + Utils.i18n('FOLDER_LIST/SENT_NAME') + ')';
- break;
- case Enums.FolderType.Draft:
- sSuffix = '(' + Utils.i18n('FOLDER_LIST/DRAFTS_NAME') + ')';
- break;
- case Enums.FolderType.Spam:
- sSuffix = '(' + Utils.i18n('FOLDER_LIST/SPAM_NAME') + ')';
- break;
- case Enums.FolderType.Trash:
- sSuffix = '(' + Utils.i18n('FOLDER_LIST/TRASH_NAME') + ')';
- break;
- case Enums.FolderType.Archive:
- sSuffix = '(' + Utils.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')';
- break;
- }
- }
-
- if ('' !== sSuffix && '(' + sName + ')' === sSuffix || '(inbox)' === sSuffix.toLowerCase())
- {
- sSuffix = '';
- }
-
- return sSuffix;
-
- }, this);
-
- this.collapsed = ko.computed({
- 'read': function () {
- return !this.hidden() && this.collapsedPrivate();
- },
- 'write': function (mValue) {
- this.collapsedPrivate(mValue);
- },
- 'owner': this
- });
-
- this.hasUnreadMessages = ko.computed(function () {
- return 0 < this.messageCountUnread();
- }, this);
-
- this.hasSubScribedUnreadMessagesSubfolders = ko.computed(function () {
- return !!_.find(this.subFolders(), function (oFolder) {
- return oFolder.hasUnreadMessages() || oFolder.hasSubScribedUnreadMessagesSubfolders();
- });
- }, this);
-
- return this;
-};
-
-FolderModel.prototype.fullName = '';
-FolderModel.prototype.fullNameRaw = '';
-FolderModel.prototype.fullNameHash = '';
-FolderModel.prototype.delimiter = '';
-FolderModel.prototype.namespace = '';
-FolderModel.prototype.deep = 0;
-FolderModel.prototype.interval = 0;
-
-/**
- * @return {string}
- */
-FolderModel.prototype.collapsedCss = function ()
-{
- return this.hasSubScribedSubfolders() ?
- (this.collapsed() ? 'icon-right-mini e-collapsed-sign' : 'icon-down-mini e-collapsed-sign') : 'icon-none e-collapsed-sign';
-};
-
-/**
- * @param {AjaxJsonFolder} oJsonFolder
- * @return {boolean}
- */
-FolderModel.prototype.initByJson = function (oJsonFolder)
-{
- var bResult = false;
- if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object'])
- {
- this.name(oJsonFolder.Name);
- this.delimiter = oJsonFolder.Delimiter;
- this.fullName = oJsonFolder.FullName;
- this.fullNameRaw = oJsonFolder.FullNameRaw;
- this.fullNameHash = oJsonFolder.FullNameHash;
- this.deep = oJsonFolder.FullNameRaw.split(this.delimiter).length - 1;
- this.selectable = !!oJsonFolder.IsSelectable;
- this.existen = !!oJsonFolder.IsExists;
-
- this.subScribed(!!oJsonFolder.IsSubscribed);
- this.type('INBOX' === this.fullNameRaw ? Enums.FolderType.Inbox : Enums.FolderType.User);
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/**
- * @return {string}
- */
-FolderModel.prototype.printableFullName = function ()
-{
- return this.fullName.split(this.delimiter).join(' / ');
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {string} sEmail
- * @param {boolean=} bCanBeDelete = true
- * @constructor
- */
-function AccountModel(sEmail, bCanBeDelete)
-{
- this.email = sEmail;
- this.deleteAccess = ko.observable(false);
- this.canBeDalete = ko.observable(bCanBeDelete);
-}
-
-AccountModel.prototype.email = '';
-
-/**
- * @return {string}
- */
-AccountModel.prototype.changeAccountLink = function ()
-{
- return RL.link().change(this.email);
-};
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {string} sId
- * @param {string} sEmail
- * @param {boolean=} bCanBeDelete = true
- * @constructor
- */
-function IdentityModel(sId, sEmail, bCanBeDelete)
-{
- this.id = sId;
- this.email = ko.observable(sEmail);
- this.name = ko.observable('');
- this.replyTo = ko.observable('');
- this.bcc = ko.observable('');
-
- this.deleteAccess = ko.observable(false);
- this.canBeDalete = ko.observable(bCanBeDelete);
-}
-
-IdentityModel.prototype.formattedName = function ()
-{
- var sName = this.name();
- return '' === sName ? this.email() : sName + ' <' + this.email() + '>';
-};
-
-IdentityModel.prototype.formattedNameForCompose = function ()
-{
- var sName = this.name();
- return '' === sName ? this.email() : sName + ' (' + this.email() + ')';
-};
-
-IdentityModel.prototype.formattedNameForEmail = function ()
-{
- var sName = this.name();
- return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function FilterConditionModel(oKoList)
-{
- this.parentList = oKoList;
-
- this.field = ko.observable(Enums.FilterConditionField.From);
-
- this.fieldOptions = [ // TODO i18n
- {'id': Enums.FilterConditionField.From, 'name': 'From'},
- {'id': Enums.FilterConditionField.Recipient, 'name': 'Recipient (To or CC)'},
- {'id': Enums.FilterConditionField.To, 'name': 'To'},
- {'id': Enums.FilterConditionField.Subject, 'name': 'Subject'}
- ];
-
- this.type = ko.observable(Enums.FilterConditionType.EqualTo);
-
- this.typeOptions = [ // TODO i18n
- {'id': Enums.FilterConditionType.EqualTo, 'name': 'Equal To'},
- {'id': Enums.FilterConditionType.NotEqualTo, 'name': 'Not Equal To'},
- {'id': Enums.FilterConditionType.Contains, 'name': 'Contains'},
- {'id': Enums.FilterConditionType.NotContains, 'name': 'Not Contains'}
- ];
-
- this.value = ko.observable('');
-
- this.template = ko.computed(function () {
-
- var sTemplate = '';
- switch (this.type())
- {
- default:
- sTemplate = 'SettingsFiltersConditionDefault';
- break;
- }
-
- return sTemplate;
-
- }, this);
-}
-
-FilterConditionModel.prototype.removeSelf = function ()
-{
- this.parentList.remove(this);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function FilterModel()
-{
- this.new = ko.observable(true);
- this.enabled = ko.observable(true);
-
- this.name = ko.observable('');
-
- this.conditionsType = ko.observable(Enums.FilterRulesType.And);
-
- this.conditions = ko.observableArray([]);
-
- this.conditions.subscribe(function () {
- Utils.windowResize();
- });
-
- // Actions
- this.actionMarkAsRead = ko.observable(false);
- this.actionSkipOtherFilters = ko.observable(true);
- this.actionValue = ko.observable('');
-
- this.actionType = ko.observable(Enums.FiltersAction.Move);
- this.actionTypeOptions = [ // TODO i18n
- {'id': Enums.FiltersAction.None, 'name': 'Action - None'},
- {'id': Enums.FiltersAction.Move, 'name': 'Action - Move to'},
-// {'id': Enums.FiltersAction.Forward, 'name': 'Action - Forward to'},
- {'id': Enums.FiltersAction.Discard, 'name': 'Action - Discard'}
- ];
-
- this.actionMarkAsReadVisiblity = ko.computed(function () {
- return -1 < Utils.inArray(this.actionType(), [
- Enums.FiltersAction.None, Enums.FiltersAction.Forward, Enums.FiltersAction.Move
- ]);
- }, this);
-
- this.actionTemplate = ko.computed(function () {
-
- var sTemplate = '';
- switch (this.actionType())
- {
- default:
- case Enums.FiltersAction.Move:
- sTemplate = 'SettingsFiltersActionValueAsFolders';
- break;
- case Enums.FiltersAction.Forward:
- sTemplate = 'SettingsFiltersActionWithValue';
- break;
- case Enums.FiltersAction.None:
- case Enums.FiltersAction.Discard:
- sTemplate = 'SettingsFiltersActionNoValue';
- break;
- }
-
- return sTemplate;
-
- }, this);
-}
-
-FilterModel.prototype.addCondition = function ()
-{
- this.conditions.push(new FilterConditionModel(this.conditions));
-};
-
-FilterModel.prototype.parse = function (oItem)
-{
- var bResult = false;
- if (oItem && 'Object/Filter' === oItem['@Object'])
- {
- this.name(Utils.pString(oItem['Name']));
-
- bResult = true;
- }
-
- return bResult;
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {string} iIndex
- * @param {string} sGuID
- * @param {string} sID
- * @param {string} sUserID
- * @param {string} sEmail
- * @param {boolean} bIsPrivate
- * @param {string} sArmor
- * @constructor
- */
-function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
-{
- this.index = iIndex;
- this.id = sID;
- this.guid = sGuID;
- this.user = sUserID;
- this.email = sEmail;
- this.armor = sArmor;
- this.isPrivate = !!bIsPrivate;
-
- this.deleteAccess = ko.observable(false);
-}
-
-OpenPgpKeyModel.prototype.index = 0;
-OpenPgpKeyModel.prototype.id = '';
-OpenPgpKeyModel.prototype.guid = '';
-OpenPgpKeyModel.prototype.user = '';
-OpenPgpKeyModel.prototype.email = '';
-OpenPgpKeyModel.prototype.armor = '';
-OpenPgpKeyModel.prototype.isPrivate = false;
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsFolderClearViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsFolderClear');
-
- this.selectedFolder = ko.observable(null);
- this.clearingProcess = ko.observable(false);
- this.clearingError = ko.observable('');
-
- this.folderFullNameForClear = ko.computed(function () {
- var oFolder = this.selectedFolder();
- return oFolder ? oFolder.printableFullName() : '';
- }, this);
-
- this.folderNameForClear = ko.computed(function () {
- var oFolder = this.selectedFolder();
- return oFolder ? oFolder.localName() : '';
- }, this);
-
- this.dangerDescHtml = ko.computed(function () {
- return Utils.i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {
- 'FOLDER': this.folderNameForClear()
- });
- }, this);
-
- this.clearCommand = Utils.createCommand(this, function () {
-
- var
- self = this,
- oFolderToClear = this.selectedFolder()
- ;
-
- if (oFolderToClear)
- {
- RL.data().message(null);
- RL.data().messageList([]);
-
- this.clearingProcess(true);
-
- RL.cache().setFolderHash(oFolderToClear.fullNameRaw, '');
- RL.remote().folderClear(function (sResult, oData) {
-
- self.clearingProcess(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- RL.reloadMessageList(true);
- self.cancelCommand();
- }
- else
- {
- if (oData && oData.ErrorCode)
- {
- self.clearingError(Utils.getNotification(oData.ErrorCode));
- }
- else
- {
- self.clearingError(Utils.getNotification(Enums.Notification.MailServerError));
- }
- }
- }, oFolderToClear.fullNameRaw);
- }
-
- }, function () {
-
- var
- oFolder = this.selectedFolder(),
- bIsClearing = this.clearingProcess()
- ;
-
- return !bIsClearing && null !== oFolder;
-
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsFolderClearViewModel', PopupsFolderClearViewModel);
-
-PopupsFolderClearViewModel.prototype.clearPopup = function ()
-{
- this.clearingProcess(false);
- this.selectedFolder(null);
-};
-
-PopupsFolderClearViewModel.prototype.onShow = function (oFolder)
-{
- this.clearPopup();
- if (oFolder)
- {
- this.selectedFolder(oFolder);
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsFolderCreateViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsFolderCreate');
-
- Utils.initOnStartOrLangChange(function () {
- this.sNoParentText = Utils.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT');
- }, this);
-
- this.folderName = ko.observable('');
- this.folderName.focused = ko.observable(false);
-
- this.selectedParentValue = ko.observable(Consts.Values.UnuseOptionValue);
-
- this.parentFolderSelectList = ko.computed(function () {
-
- var
- oData = RL.data(),
- aTop = [],
- fDisableCallback = null,
- fVisibleCallback = null,
- aList = oData.folderList(),
- fRenameCallback = function (oItem) {
- return oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '';
- }
- ;
-
- aTop.push(['', this.sNoParentText]);
-
- if ('' !== oData.namespace)
- {
- fDisableCallback = function (oItem)
- {
- return oData.namespace !== oItem.fullNameRaw.substr(0, oData.namespace.length);
- };
- }
-
- return RL.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
-
- }, this);
-
- // commands
- this.createFolder = Utils.createCommand(this, function () {
-
- var
- oData = RL.data(),
- sParentFolderName = this.selectedParentValue()
- ;
-
- if ('' === sParentFolderName && 1 < oData.namespace.length)
- {
- sParentFolderName = oData.namespace.substr(0, oData.namespace.length - 1);
- }
-
- oData.foldersCreating(true);
- RL.remote().folderCreate(function (sResult, oData) {
-
- RL.data().foldersCreating(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- RL.folders();
- }
- else
- {
- RL.data().foldersListError(
- oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER'));
- }
-
- }, this.folderName(), sParentFolderName);
-
- this.cancelCommand();
-
- }, function () {
- return this.simpleFolderNameValidation(this.folderName());
- });
-
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsFolderCreateViewModel', PopupsFolderCreateViewModel);
-
-PopupsFolderCreateViewModel.prototype.sNoParentText = '';
-
-PopupsFolderCreateViewModel.prototype.simpleFolderNameValidation = function (sName)
-{
- return (/^[^\\\/]+$/g).test(Utils.trim(sName));
-};
-
-PopupsFolderCreateViewModel.prototype.clearPopup = function ()
-{
- this.folderName('');
- this.selectedParentValue('');
- this.folderName.focused(false);
-};
-
-PopupsFolderCreateViewModel.prototype.onShow = function ()
-{
- this.clearPopup();
-};
-
-PopupsFolderCreateViewModel.prototype.onFocus = function ()
-{
- this.folderName.focused(true);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsFolderSystemViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsFolderSystem');
-
- Utils.initOnStartOrLangChange(function () {
- this.sChooseOnText = Utils.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE');
- this.sUnuseText = Utils.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME');
- }, this);
-
- this.notification = ko.observable('');
-
- this.folderSelectList = ko.computed(function () {
- return RL.folderListOptionsBuilder([], RL.data().folderList(), RL.data().folderListSystemNames(), [
- ['', this.sChooseOnText],
- [Consts.Values.UnuseOptionValue, this.sUnuseText]
- ]);
- }, this);
-
- var
- oData = RL.data(),
- self = this,
- fSaveSystemFolders = null,
- fCallback = null
- ;
-
- this.sentFolder = oData.sentFolder;
- this.draftFolder = oData.draftFolder;
- this.spamFolder = oData.spamFolder;
- this.trashFolder = oData.trashFolder;
- this.archiveFolder = oData.archiveFolder;
-
- fSaveSystemFolders = _.debounce(function () {
-
- RL.settingsSet('SentFolder', self.sentFolder());
- RL.settingsSet('DraftFolder', self.draftFolder());
- RL.settingsSet('SpamFolder', self.spamFolder());
- RL.settingsSet('TrashFolder', self.trashFolder());
- RL.settingsSet('ArchiveFolder', self.archiveFolder());
-
- RL.remote().saveSystemFolders(Utils.emptyFunction, {
- 'SentFolder': self.sentFolder(),
- 'DraftFolder': self.draftFolder(),
- 'SpamFolder': self.spamFolder(),
- 'TrashFolder': self.trashFolder(),
- 'ArchiveFolder': self.archiveFolder(),
- 'NullFolder': 'NullFolder'
- });
-
- }, 1000);
-
- fCallback = function () {
-
- RL.settingsSet('SentFolder', self.sentFolder());
- RL.settingsSet('DraftFolder', self.draftFolder());
- RL.settingsSet('SpamFolder', self.spamFolder());
- RL.settingsSet('TrashFolder', self.trashFolder());
- RL.settingsSet('ArchiveFolder', self.archiveFolder());
-
- fSaveSystemFolders();
- };
-
- this.sentFolder.subscribe(fCallback);
- this.draftFolder.subscribe(fCallback);
- this.spamFolder.subscribe(fCallback);
- this.trashFolder.subscribe(fCallback);
- this.archiveFolder.subscribe(fCallback);
-
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsFolderSystemViewModel', PopupsFolderSystemViewModel);
-
-PopupsFolderSystemViewModel.prototype.sChooseOnText = '';
-PopupsFolderSystemViewModel.prototype.sUnuseText = '';
-
-/**
- * @param {number=} iNotificationType = Enums.SetSystemFoldersNotification.None
- */
-PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType)
-{
- var sNotification = '';
-
- iNotificationType = Utils.isUnd(iNotificationType) ? Enums.SetSystemFoldersNotification.None : iNotificationType;
-
- switch (iNotificationType)
- {
- case Enums.SetSystemFoldersNotification.Sent:
- sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
- break;
- case Enums.SetSystemFoldersNotification.Draft:
- sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS');
- break;
- case Enums.SetSystemFoldersNotification.Spam:
- sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM');
- break;
- case Enums.SetSystemFoldersNotification.Trash:
- sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
- break;
- case Enums.SetSystemFoldersNotification.Archive:
- sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
- break;
- }
-
- this.notification(sNotification);
-};
-
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsComposeViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsCompose');
-
- this.oEditor = null;
- this.aDraftInfo = null;
- this.sInReplyTo = '';
- this.bFromDraft = false;
- this.bSkipNext = false;
- this.sReferences = '';
-
- this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities);
-
- var
- self = this,
- oRainLoopData = RL.data(),
- fCcAndBccCheckHelper = function (aValue) {
- if (false === self.showCcAndBcc() && 0 < aValue.length)
- {
- self.showCcAndBcc(true);
- }
- }
- ;
-
- this.capaOpenPGP = oRainLoopData.capaOpenPGP;
-
- this.resizer = ko.observable(false).extend({'throttle': 50});
-
- this.identitiesDropdownTrigger = ko.observable(false);
-
- this.to = ko.observable('');
- this.to.focusTrigger = ko.observable(false);
- this.cc = ko.observable('');
- this.bcc = ko.observable('');
-
- this.replyTo = ko.observable('');
- this.subject = ko.observable('');
- this.isHtml = ko.observable(false);
-
- this.requestReadReceipt = ko.observable(false);
-
- this.sendError = ko.observable(false);
- this.sendSuccessButSaveError = ko.observable(false);
- this.savedError = ko.observable(false);
-
- this.savedTime = ko.observable(0);
- this.savedOrSendingText = ko.observable('');
-
- this.emptyToError = ko.observable(false);
- this.attachmentsInProcessError = ko.observable(false);
- this.showCcAndBcc = ko.observable(false);
-
- this.cc.subscribe(fCcAndBccCheckHelper, this);
- this.bcc.subscribe(fCcAndBccCheckHelper, this);
-
- this.draftFolder = ko.observable('');
- this.draftUid = ko.observable('');
- this.sending = ko.observable(false);
- this.saving = ko.observable(false);
- this.attachments = ko.observableArray([]);
-
- this.attachmentsInProcess = this.attachments.filter(function (oItem) {
- return oItem && '' === oItem.tempName();
- });
-
- this.attachmentsInReady = this.attachments.filter(function (oItem) {
- return oItem && '' !== oItem.tempName();
- });
-
- this.attachments.subscribe(function () {
- this.triggerForResize();
- }, this);
-
- this.isDraftFolderMessage = ko.computed(function () {
- return '' !== this.draftFolder() && '' !== this.draftUid();
- }, this);
-
- this.composeUploaderButton = ko.observable(null);
- this.composeUploaderDropPlace = ko.observable(null);
- this.dragAndDropEnabled = ko.observable(false);
- this.dragAndDropOver = ko.observable(false).extend({'throttle': 1});
- this.dragAndDropVisible = ko.observable(false).extend({'throttle': 1});
- this.attacheMultipleAllowed = ko.observable(false);
- this.addAttachmentEnabled = ko.observable(false);
-
- this.composeEditorArea = ko.observable(null);
-
- this.identities = RL.data().identities;
- this.defaultIdentityID = RL.data().defaultIdentityID;
- this.currentIdentityID = ko.observable('');
-
- this.currentIdentityString = ko.observable('');
- this.currentIdentityResultEmail = ko.observable('');
-
- this.identitiesOptions = ko.computed(function () {
-
- var aList = [{
- 'optValue': oRainLoopData.accountEmail(),
- 'optText': this.formattedFrom(false)
- }];
-
- _.each(oRainLoopData.identities(), function (oItem) {
- aList.push({
- 'optValue': oItem.id,
- 'optText': oItem.formattedNameForCompose()
- });
- });
-
- return aList;
-
- }, this);
-
- ko.computed(function () {
-
- var
- sResult = '',
- sResultEmail = '',
- oItem = null,
- aList = this.identities(),
- sID = this.currentIdentityID()
- ;
-
- if (this.bCapaAdditionalIdentities && sID && sID !== RL.data().accountEmail())
- {
- oItem = _.find(aList, function (oItem) {
- return oItem && sID === oItem['id'];
- });
-
- sResult = oItem ? oItem.formattedNameForCompose() : '';
- sResultEmail = oItem ? oItem.formattedNameForEmail() : '';
-
- if ('' === sResult && aList[0])
- {
- this.currentIdentityID(aList[0]['id']);
- return '';
- }
- }
-
- if ('' === sResult)
- {
- sResult = this.formattedFrom(false);
- sResultEmail = this.formattedFrom(true);
- }
-
- this.currentIdentityString(sResult);
- this.currentIdentityResultEmail(sResultEmail);
-
- return sResult;
-
- }, this);
-
- this.to.subscribe(function (sValue) {
- if (this.emptyToError() && 0 < sValue.length)
- {
- this.emptyToError(false);
- }
- }, this);
-
- this.attachmentsInProcess.subscribe(function (aValue) {
- if (this.attachmentsInProcessError() && Utils.isArray(aValue) && 0 === aValue.length)
- {
- this.attachmentsInProcessError(false);
- }
- }, this);
-
- this.editorResizeThrottle = _.throttle(_.bind(this.editorResize, this), 100);
-
- this.resizer.subscribe(function () {
- this.editorResizeThrottle();
- }, this);
-
- this.canBeSendedOrSaved = ko.computed(function () {
- return !this.sending() && !this.saving();
- }, this);
-
- this.deleteCommand = Utils.createCommand(this, function () {
-
- RL.deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
- kn.hideScreenPopup(PopupsComposeViewModel);
-
- }, function () {
- return this.isDraftFolderMessage();
- });
-
- this.sendMessageResponse = _.bind(this.sendMessageResponse, this);
- this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
-
- this.sendCommand = Utils.createCommand(this, function () {
- var
- sTo = Utils.trim(this.to()),
- sSentFolder = RL.data().sentFolder(),
- aFlagsCache = []
- ;
-
- if (0 < this.attachmentsInProcess().length)
- {
- this.attachmentsInProcessError(true);
- }
- else if (0 === sTo.length)
- {
- this.emptyToError(true);
- }
- else
- {
- if (RL.data().replySameFolder())
- {
- if (Utils.isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length && Utils.isNormal(this.aDraftInfo[2]) && 0 < this.aDraftInfo[2].length)
- {
- sSentFolder = this.aDraftInfo[2];
- }
- }
-
- if ('' === sSentFolder)
- {
- kn.showScreenPopup(PopupsFolderSystemViewModel, [Enums.SetSystemFoldersNotification.Sent]);
- }
- else
- {
- this.sendError(false);
- this.sending(true);
-
- if (Utils.isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length)
- {
- aFlagsCache = RL.cache().getMessageFlagsFromCache(this.aDraftInfo[2], this.aDraftInfo[1]);
- if (aFlagsCache)
- {
- if ('forward' === this.aDraftInfo[0])
- {
- aFlagsCache[3] = true;
- }
- else
- {
- aFlagsCache[2] = true;
- }
-
- RL.cache().setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], aFlagsCache);
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- RL.cache().setFolderHash(this.aDraftInfo[2], '');
- }
- }
-
- sSentFolder = Consts.Values.UnuseOptionValue === sSentFolder ? '' : sSentFolder;
-
- RL.cache().setFolderHash(this.draftFolder(), '');
- RL.cache().setFolderHash(sSentFolder, '');
-
- RL.remote().sendMessage(
- this.sendMessageResponse,
- this.draftFolder(),
- this.draftUid(),
- sSentFolder,
- this.currentIdentityResultEmail(),
- sTo,
- this.cc(),
- this.bcc(),
- this.subject(),
- this.oEditor ? this.oEditor.isHtml() : false,
- this.oEditor ? this.oEditor.getData(true) : '',
- this.prepearAttachmentsForSendOrSave(),
- this.aDraftInfo,
- this.sInReplyTo,
- this.sReferences,
- this.requestReadReceipt()
- );
- }
- }
- }, this.canBeSendedOrSaved);
-
- this.saveCommand = Utils.createCommand(this, function () {
-
- if (RL.data().draftFolderNotEnabled())
- {
- kn.showScreenPopup(PopupsFolderSystemViewModel, [Enums.SetSystemFoldersNotification.Draft]);
- }
- else
- {
- this.savedError(false);
- this.saving(true);
-
- this.bSkipNext = true;
-
- RL.cache().setFolderHash(RL.data().draftFolder(), '');
-
- RL.remote().saveMessage(
- this.saveMessageResponse,
- this.draftFolder(),
- this.draftUid(),
- RL.data().draftFolder(),
- this.currentIdentityResultEmail(),
- this.to(),
- this.cc(),
- this.bcc(),
- this.subject(),
- this.oEditor ? this.oEditor.isHtml() : false,
- this.oEditor ? this.oEditor.getData(true) : '',
- this.prepearAttachmentsForSendOrSave(),
- this.aDraftInfo,
- this.sInReplyTo,
- this.sReferences
- );
- }
-
- }, this.canBeSendedOrSaved);
-
- RL.sub('interval.1m', function () {
- if (this.modalVisibility() && !RL.data().draftFolderNotEnabled() && !this.isEmptyForm(false) &&
- !this.bSkipNext && !this.saving() && !this.sending() && !this.savedError())
- {
- this.bSkipNext = false;
- this.saveCommand();
- }
- }, this);
-
- this.showCcAndBcc.subscribe(function () {
- this.triggerForResize();
- }, this);
-
- this.dropboxEnabled = ko.observable(!!RL.settingsGet('DropboxApiKey'));
-
- this.dropboxCommand = Utils.createCommand(this, function () {
-
- if (window.Dropbox)
- {
- window.Dropbox.choose({
- //'iframe': true,
- 'success': function(aFiles) {
-
- if (aFiles && aFiles[0] && aFiles[0]['link'])
- {
- self.addDropboxAttachment(aFiles[0]);
- }
- },
- 'linkType': "direct",
- 'multiselect': false
- });
- }
-
- return true;
-
- }, function () {
- return this.dropboxEnabled();
- });
-
- this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported &&
- !!RL.settingsGet('GoogleClientID') && !!RL.settingsGet('GoogleApiKey'));
-
- this.driveVisible = ko.observable(false);
-
- this.driveCommand = Utils.createCommand(this, function () {
-
- this.driveOpenPopup();
- return true;
-
- }, function () {
- return this.driveEnabled();
- });
-
- this.driveCallback = _.bind(this.driveCallback, this);
-
- this.bDisabeCloseOnEsc = true;
- this.sDefaultKeyScope = Enums.KeyState.Compose;
-
- this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel);
-
-PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
-{
- if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
- {
- var self = this;
- kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [
- function (sResult) {
- self.editor(function (oEditor) {
- oEditor.setPlain(sResult);
- });
- },
- this.oEditor.getData(),
- this.currentIdentityResultEmail(),
- this.to(),
- this.cc(),
- this.bcc()
- ]);
- }
-};
-
-PopupsComposeViewModel.prototype.reloadDraftFolder = function ()
-{
- var sDraftFolder = RL.data().draftFolder();
- if ('' !== sDraftFolder)
- {
- RL.cache().setFolderHash(sDraftFolder, '');
- if (RL.data().currentFolderFullNameRaw() === sDraftFolder)
- {
- RL.reloadMessageList(true);
- }
- else
- {
- RL.folderInformation(sDraftFolder);
- }
- }
-};
-
-PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeType, oMessage)
-{
- var
- oIDs = {},
- sResult = '',
- fFindHelper = function (oItem) {
- if (oItem && oItem.email && oIDs[oItem.email])
- {
- sResult = oIDs[oItem.email];
- return true;
- }
-
- return false;
- }
- ;
-
- if (this.bCapaAdditionalIdentities)
- {
- _.each(this.identities(), function (oItem) {
- oIDs[oItem.email()] = oItem['id'];
- });
- }
-
- oIDs[RL.data().accountEmail()] = RL.data().accountEmail();
-
- if (oMessage)
- {
- switch (sComposeType)
- {
- case Enums.ComposeType.Empty:
- break;
- case Enums.ComposeType.Reply:
- case Enums.ComposeType.ReplyAll:
- case Enums.ComposeType.Forward:
- case Enums.ComposeType.ForwardAsAttachment:
- _.find(_.union(oMessage.to, oMessage.cc, oMessage.bcc, oMessage.deliveredTo), fFindHelper);
- break;
- case Enums.ComposeType.Draft:
- _.find(_.union(oMessage.from, oMessage.replyTo), fFindHelper);
- break;
- }
- }
-
- if ('' === sResult)
- {
- sResult = this.defaultIdentityID();
- }
-
- if ('' === sResult)
- {
- sResult = RL.data().accountEmail();
- }
-
- return sResult;
-};
-
-PopupsComposeViewModel.prototype.selectIdentity = function (oIdentity)
-{
- if (oIdentity)
- {
- this.currentIdentityID(oIdentity.optValue);
- }
-};
-
-/**
- *
- * @param {boolean=} bHeaderResult = false
- * @returns {string}
- */
-PopupsComposeViewModel.prototype.formattedFrom = function (bHeaderResult)
-{
- var
- sDisplayName = RL.data().displayName(),
- sEmail = RL.data().accountEmail()
- ;
-
- return '' === sDisplayName ? sEmail :
- ((Utils.isUnd(bHeaderResult) ? false : !!bHeaderResult) ?
- '"' + Utils.quoteName(sDisplayName) + '" <' + sEmail + '>' :
- sDisplayName + ' (' + sEmail + ')')
- ;
-};
-
-PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
-{
- var
- bResult = false,
- sMessage = ''
- ;
-
- this.sending(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- bResult = true;
- if (this.modalVisibility())
- {
- Utils.delegateRun(this, 'closeCommand');
- }
- }
-
- if (this.modalVisibility() && !bResult)
- {
- if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode)
- {
- this.sendSuccessButSaveError(true);
- window.alert(Utils.trim(Utils.i18n('COMPOSE/SAVED_ERROR_ON_SEND')));
- }
- else
- {
- sMessage = Utils.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage,
- oData && oData.ErrorMessage ? oData.ErrorMessage : '');
-
- this.sendError(true);
- window.alert(sMessage || Utils.getNotification(Enums.Notification.CantSendMessage));
- }
- }
-
- this.reloadDraftFolder();
-};
-
-PopupsComposeViewModel.prototype.saveMessageResponse = function (sResult, oData)
-{
- var
- bResult = false,
- oMessage = null
- ;
-
- this.saving(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- if (oData.Result.NewFolder && oData.Result.NewUid)
- {
- if (this.bFromDraft)
- {
- oMessage = RL.data().message();
- if (oMessage && this.draftFolder() === oMessage.folderFullNameRaw && this.draftUid() === oMessage.uid)
- {
- RL.data().message(null);
- }
- }
-
- this.draftFolder(oData.Result.NewFolder);
- this.draftUid(oData.Result.NewUid);
-
- if (this.modalVisibility())
- {
- this.savedTime(Math.round((new window.Date()).getTime() / 1000));
-
- this.savedOrSendingText(
- 0 < this.savedTime() ? Utils.i18n('COMPOSE/SAVED_TIME', {
- 'TIME': moment.unix(this.savedTime() - 1).format('LT')
- }) : ''
- );
-
- bResult = true;
-
- if (this.bFromDraft)
- {
- RL.cache().setFolderHash(this.draftFolder(), '');
- }
- }
- }
- }
-
- if (!this.modalVisibility() && !bResult)
- {
- this.savedError(true);
- this.savedOrSendingText(Utils.getNotification(Enums.Notification.CantSaveMessage));
- }
-
- this.reloadDraftFolder();
-};
-
-PopupsComposeViewModel.prototype.onHide = function ()
-{
- this.reset();
- kn.routeOn();
-};
-
-/**
- * @param {string} sSignature
- * @param {string=} sFrom
- * @param {string=} sData
- * @param {string=} sComposeType
- * @return {string}
- */
-PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom, sData, sComposeType)
-{
- var bHtml = false, bData = false;
- if ('' !== sSignature)
- {
- if (':HTML:' === sSignature.substr(0, 6))
- {
- bHtml = true;
- sSignature = sSignature.substr(6);
- }
-
- sSignature = sSignature.replace(/[\r]/, '');
-
- sFrom = Utils.pString(sFrom);
- if ('' !== sFrom)
- {
- sSignature = sSignature.replace(/{{FROM}}/, sFrom);
- }
-
- sSignature = sSignature.replace(/[\s]{1,2}{{FROM}}/, '{{FROM}}');
-
- sSignature = sSignature.replace(/{{FROM}}/, '');
- sSignature = sSignature.replace(/{{DATE}}/, moment().format('llll'));
-
- if (sData && Enums.ComposeType.Empty === sComposeType &&
- -1 < sSignature.indexOf('{{DATA}}'))
- {
- bData = true;
- sSignature = sSignature.replace('{{DATA}}', sData);
- }
-
- sSignature = sSignature.replace(/{{DATA}}/, '');
-
- if (!bHtml)
- {
- sSignature = Utils.convertPlainTextToHtml(sSignature);
- }
- }
-
- if (sData && !bData)
- {
- switch (sComposeType)
- {
- case Enums.ComposeType.Empty:
- sSignature = sData + '
' + sSignature;
- break;
- default:
- sSignature = sSignature + '
' + sData;
- break;
- }
- }
-
- return sSignature;
-};
-
-PopupsComposeViewModel.prototype.editor = function (fOnInit)
-{
- if (fOnInit)
- {
- var self = this;
- if (!this.oEditor && this.composeEditorArea())
- {
- _.delay(function () {
- self.oEditor = new NewHtmlEditorWrapper(self.composeEditorArea(), null, function () {
- fOnInit(self.oEditor);
- }, function (bHtml) {
- self.isHtml(!!bHtml);
- });
- }, 300);
- }
- else if (this.oEditor)
- {
- fOnInit(this.oEditor);
- }
- }
-};
-
-/**
- * @param {string=} sType = Enums.ComposeType.Empty
- * @param {?MessageModel|Array=} oMessageOrArray = null
- * @param {Array=} aToEmails = null
- * @param {string=} sCustomSubject = null
- * @param {string=} sCustomPlainText = null
- */
-PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToEmails, sCustomSubject, sCustomPlainText)
-{
- kn.routeOff();
-
- var
- self = this,
- sFrom = '',
- sTo = '',
- sCc = '',
- sDate = '',
- sSubject = '',
- oText = null,
- oSubText = null,
- sText = '',
- sReplyTitle = '',
- aResplyAllParts = [],
- oExcludeEmail = {},
- mEmail = RL.data().accountEmail(),
- sSignature = RL.data().signature(),
- bSignatureToAll = RL.data().signatureToAll(),
- aDownloads = [],
- aDraftInfo = null,
- oMessage = null,
- sComposeType = sType || Enums.ComposeType.Empty,
- fEmailArrayToStringLineHelper = function (aList, bFriendly) {
-
- var
- iIndex = 0,
- iLen = aList.length,
- aResult = []
- ;
-
- for (; iIndex < iLen; iIndex++)
- {
- aResult.push(aList[iIndex].toLine(!!bFriendly));
- }
-
- return aResult.join(', ');
- }
- ;
-
- oMessageOrArray = oMessageOrArray || null;
- if (oMessageOrArray && Utils.isNormal(oMessageOrArray))
- {
- oMessage = Utils.isArray(oMessageOrArray) && 1 === oMessageOrArray.length ? oMessageOrArray[0] :
- (!Utils.isArray(oMessageOrArray) ? oMessageOrArray : null);
- }
-
- if (null !== mEmail)
- {
- oExcludeEmail[mEmail] = true;
- }
-
- this.currentIdentityID(this.findIdentityIdByMessage(sComposeType, oMessage));
- this.reset();
-
- if (Utils.isNonEmptyArray(aToEmails))
- {
- this.to(fEmailArrayToStringLineHelper(aToEmails));
- }
-
- if ('' !== sComposeType && oMessage)
- {
- sDate = oMessage.fullFormatDateValue();
- sSubject = oMessage.subject();
- aDraftInfo = oMessage.aDraftInfo;
-
- oText = $(oMessage.body).clone();
- Utils.removeBlockquoteSwitcher(oText);
-
- oSubText = oText.find('[data-html-editor-font-wrapper=true]');
- sText = oSubText && oSubText[0] ? oSubText.html() : oText.html();
-
- switch (sComposeType)
- {
- case Enums.ComposeType.Empty:
- break;
-
- case Enums.ComposeType.Reply:
- this.to(fEmailArrayToStringLineHelper(oMessage.replyEmails(oExcludeEmail)));
- this.subject(Utils.replySubjectAdd('Re', sSubject));
- this.prepearMessageAttachments(oMessage, sComposeType);
- this.aDraftInfo = ['reply', oMessage.uid, oMessage.folderFullNameRaw];
- this.sInReplyTo = oMessage.sMessageId;
- this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences);
- break;
-
- case Enums.ComposeType.ReplyAll:
- aResplyAllParts = oMessage.replyAllEmails(oExcludeEmail);
- this.to(fEmailArrayToStringLineHelper(aResplyAllParts[0]));
- this.cc(fEmailArrayToStringLineHelper(aResplyAllParts[1]));
- this.subject(Utils.replySubjectAdd('Re', sSubject));
- this.prepearMessageAttachments(oMessage, sComposeType);
- this.aDraftInfo = ['reply', oMessage.uid, oMessage.folderFullNameRaw];
- this.sInReplyTo = oMessage.sMessageId;
- this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.references());
- break;
-
- case Enums.ComposeType.Forward:
- this.subject(Utils.replySubjectAdd('Fwd', sSubject));
- this.prepearMessageAttachments(oMessage, sComposeType);
- this.aDraftInfo = ['forward', oMessage.uid, oMessage.folderFullNameRaw];
- this.sInReplyTo = oMessage.sMessageId;
- this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences);
- break;
-
- case Enums.ComposeType.ForwardAsAttachment:
- this.subject(Utils.replySubjectAdd('Fwd', sSubject));
- this.prepearMessageAttachments(oMessage, sComposeType);
- this.aDraftInfo = ['forward', oMessage.uid, oMessage.folderFullNameRaw];
- this.sInReplyTo = oMessage.sMessageId;
- this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences);
- break;
-
- case Enums.ComposeType.Draft:
- this.to(fEmailArrayToStringLineHelper(oMessage.to));
- this.cc(fEmailArrayToStringLineHelper(oMessage.cc));
- this.bcc(fEmailArrayToStringLineHelper(oMessage.bcc));
-
- this.bFromDraft = true;
-
- this.draftFolder(oMessage.folderFullNameRaw);
- this.draftUid(oMessage.uid);
-
- this.subject(sSubject);
- this.prepearMessageAttachments(oMessage, sComposeType);
-
- this.aDraftInfo = Utils.isNonEmptyArray(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null;
- this.sInReplyTo = oMessage.sInReplyTo;
- this.sReferences = oMessage.sReferences;
- break;
-
- case Enums.ComposeType.EditAsNew:
- this.to(fEmailArrayToStringLineHelper(oMessage.to));
- this.cc(fEmailArrayToStringLineHelper(oMessage.cc));
- this.bcc(fEmailArrayToStringLineHelper(oMessage.bcc));
-
- this.subject(sSubject);
- this.prepearMessageAttachments(oMessage, sComposeType);
-
- this.aDraftInfo = Utils.isNonEmptyArray(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null;
- this.sInReplyTo = oMessage.sInReplyTo;
- this.sReferences = oMessage.sReferences;
- break;
- }
-
- switch (sComposeType)
- {
- case Enums.ComposeType.Reply:
- case Enums.ComposeType.ReplyAll:
- sFrom = oMessage.fromToLine(false, true);
- sReplyTitle = Utils.i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
- 'DATETIME': sDate,
- 'EMAIL': sFrom
- });
-
- sText = '
' + sReplyTitle + ':' +
- '' + sText + '
';
-
- break;
-
- case Enums.ComposeType.Forward:
- sFrom = oMessage.fromToLine(false, true);
- sTo = oMessage.toToLine(false, true);
- sCc = oMessage.ccToLine(false, true);
- sText = '
' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
- '
' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom +
- '
' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo +
- (0 < sCc.length ? '
' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
- '
' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) +
- '
' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) +
- '
' + sText;
- break;
- case Enums.ComposeType.ForwardAsAttachment:
- sText = '';
- break;
- }
-
- if (bSignatureToAll && '' !== sSignature &&
- Enums.ComposeType.EditAsNew !== sComposeType && Enums.ComposeType.Draft !== sComposeType)
- {
- sText = this.convertSignature(sSignature, fEmailArrayToStringLineHelper(oMessage.from, true), sText, sComposeType);
- }
-
- this.editor(function (oEditor) {
- oEditor.setHtml(sText, false);
- if (!oMessage.isHtml())
- {
- oEditor.modeToggle(false);
- }
- });
- }
- else if (Enums.ComposeType.Empty === sComposeType)
- {
- this.subject(Utils.isNormal(sCustomSubject) ? '' + sCustomSubject : '');
-
- sText = Utils.isNormal(sCustomPlainText) ? '' + sCustomPlainText : '';
- if (bSignatureToAll && '' !== sSignature)
- {
- sText = this.convertSignature(sSignature, '',
- Utils.convertPlainTextToHtml(sText), sComposeType);
- }
-
- this.editor(function (oEditor) {
- oEditor.setHtml(sText, false);
- if (Enums.EditorDefaultType.Html !== RL.data().editorDefaultType())
- {
- oEditor.modeToggle(false);
- }
- });
- }
- else if (Utils.isNonEmptyArray(oMessageOrArray))
- {
- _.each(oMessageOrArray, function (oMessage) {
- self.addMessageAsAttachment(oMessage);
- });
- }
-
- aDownloads = this.getAttachmentsDownloadsForUpload();
- if (Utils.isNonEmptyArray(aDownloads))
- {
- RL.remote().messageUploadAttachments(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- var
- oAttachment = null,
- sTempName = ''
- ;
-
- if (!self.viewModelVisibility())
- {
- for (sTempName in oData.Result)
- {
- if (oData.Result.hasOwnProperty(sTempName))
- {
- oAttachment = self.getAttachmentById(oData.Result[sTempName]);
- if (oAttachment)
- {
- oAttachment.tempName(sTempName);
- }
- }
- }
- }
- }
- else
- {
- self.setMessageAttachmentFailedDowbloadText();
- }
-
- }, aDownloads);
- }
-
- this.triggerForResize();
-};
-
-PopupsComposeViewModel.prototype.onFocus = function ()
-{
- if ('' === this.to())
- {
- this.to.focusTrigger(!this.to.focusTrigger());
- }
- else if (this.oEditor)
- {
- this.oEditor.focus();
- }
-
- this.triggerForResize();
-};
-
-PopupsComposeViewModel.prototype.editorResize = function ()
-{
- if (this.oEditor)
- {
- this.oEditor.resize();
- }
-};
-
-PopupsComposeViewModel.prototype.tryToClosePopup = function ()
-{
- var self = this;
- if (!kn.isPopupVisible(PopupsAskViewModel))
- {
- kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
- if (self.modalVisibility())
- {
- Utils.delegateRun(self, 'closeCommand');
- }
- }]);
- }
-};
-
-PopupsComposeViewModel.prototype.onBuild = function ()
-{
- this.initUploader();
-
- var
- self = this,
- oScript = null
- ;
-
- key('ctrl+q, command+q', Enums.KeyState.Compose, function () {
- self.identitiesDropdownTrigger(true);
- return false;
- });
-
- key('ctrl+s, command+s', Enums.KeyState.Compose, function () {
- self.saveCommand();
- return false;
- });
-
- key('ctrl+enter, command+enter', Enums.KeyState.Compose, function () {
- self.sendCommand();
- return false;
- });
-
- key('esc', Enums.KeyState.Compose, function () {
- if (self.modalVisibility())
- {
- self.tryToClosePopup();
- }
- return false;
- });
-
- $window.on('resize', function () {
- self.triggerForResize();
- });
-
- if (this.dropboxEnabled())
- {
- oScript = document.createElement('script');
- oScript.type = 'text/javascript';
- oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
- $(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey'));
-
- document.body.appendChild(oScript);
- }
-
- if (this.driveEnabled())
- {
- $.getScript('https://apis.google.com/js/api.js', function () {
- if (window.gapi)
- {
- self.driveVisible(true);
- }
- });
- }
-};
-
-PopupsComposeViewModel.prototype.driveCallback = function (sAccessToken, oData)
-{
- if (oData && window.XMLHttpRequest && window.google &&
- oData[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED &&
- oData[window.google.picker.Response.DOCUMENTS] && oData[window.google.picker.Response.DOCUMENTS][0] &&
- oData[window.google.picker.Response.DOCUMENTS][0]['id'])
- {
- var
- self = this,
- oRequest = new window.XMLHttpRequest()
- ;
-
- oRequest.open('GET', 'https://www.googleapis.com/drive/v2/files/' + oData[window.google.picker.Response.DOCUMENTS][0]['id']);
- oRequest.setRequestHeader('Authorization', 'Bearer ' + sAccessToken);
- oRequest.addEventListener('load', function() {
- if (oRequest && oRequest.responseText)
- {
- var oItem = JSON.parse(oRequest.responseText), fExport = function (oItem, sMimeType, sExt) {
- if (oItem && oItem['exportLinks'])
- {
- if (oItem['exportLinks'][sMimeType])
- {
- oItem['downloadUrl'] = oItem['exportLinks'][sMimeType];
- oItem['title'] = oItem['title'] + '.' + sExt;
- oItem['mimeType'] = sMimeType;
- }
- else if (oItem['exportLinks']['application/pdf'])
- {
- oItem['downloadUrl'] = oItem['exportLinks']['application/pdf'];
- oItem['title'] = oItem['title'] + '.pdf';
- oItem['mimeType'] = 'application/pdf';
- }
- }
- };
-
- if (oItem && !oItem['downloadUrl'] && oItem['mimeType'] && oItem['exportLinks'])
- {
- switch (oItem['mimeType'].toString().toLowerCase())
- {
- case 'application/vnd.google-apps.document':
- fExport(oItem, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx');
- break;
- case 'application/vnd.google-apps.spreadsheet':
- fExport(oItem, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlsx');
- break;
- case 'application/vnd.google-apps.drawing':
- fExport(oItem, 'image/png', 'png');
- break;
- case 'application/vnd.google-apps.presentation':
- fExport(oItem, 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'pptx');
- break;
- default:
- fExport(oItem, 'application/pdf', 'pdf');
- break;
- }
- }
-
- if (oItem && oItem['downloadUrl'])
- {
- self.addDriveAttachment(oItem, sAccessToken);
- }
- }
- });
-
- oRequest.send();
- }
-};
-
-PopupsComposeViewModel.prototype.driveCreatePiker = function (oOauthToken)
-{
- if (window.gapi && oOauthToken && oOauthToken.access_token)
- {
- var self = this;
-
- window.gapi.load('picker', {'callback': function () {
-
- if (window.google && window.google.picker)
- {
- var drivePicker = new window.google.picker.PickerBuilder()
- .addView(
- new window.google.picker.DocsView()
- .setIncludeFolders(true)
- )
- .setAppId(RL.settingsGet('GoogleClientID'))
- .setOAuthToken(oOauthToken.access_token)
- .setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
- .enableFeature(window.google.picker.Feature.NAV_HIDDEN)
- .build()
- ;
-
- drivePicker.setVisible(true);
- }
- }});
- }
-};
-
-PopupsComposeViewModel.prototype.driveOpenPopup = function ()
-{
- if (window.gapi)
- {
- var self = this;
-
- window.gapi.load('auth', {'callback': function () {
-
- var oAuthToken = window.gapi.auth.getToken();
- if (!oAuthToken)
- {
- window.gapi.auth.authorize({
- 'client_id': RL.settingsGet('GoogleClientID'),
- 'scope': 'https://www.googleapis.com/auth/drive.readonly',
- 'immediate': true
- }, function (oAuthResult) {
- if (oAuthResult && !oAuthResult.error)
- {
- var oAuthToken = window.gapi.auth.getToken();
- if (oAuthToken)
- {
- self.driveCreatePiker(oAuthToken);
- }
- }
- else
- {
- window.gapi.auth.authorize({
- 'client_id': RL.settingsGet('GoogleClientID'),
- 'scope': 'https://www.googleapis.com/auth/drive.readonly',
- 'immediate': false
- }, function (oAuthResult) {
- if (oAuthResult && !oAuthResult.error)
- {
- var oAuthToken = window.gapi.auth.getToken();
- if (oAuthToken)
- {
- self.driveCreatePiker(oAuthToken);
- }
- }
- });
- }
- });
- }
- else
- {
- self.driveCreatePiker(oAuthToken);
- }
- }});
- }
-};
-
-/**
- * @param {string} sId
- * @return {?Object}
- */
-PopupsComposeViewModel.prototype.getAttachmentById = function (sId)
-{
- var
- aAttachments = this.attachments(),
- iIndex = 0,
- iLen = aAttachments.length
- ;
-
- for (; iIndex < iLen; iIndex++)
- {
- if (aAttachments[iIndex] && sId === aAttachments[iIndex].id)
- {
- return aAttachments[iIndex];
- }
- }
-
- return null;
-};
-
-PopupsComposeViewModel.prototype.initUploader = function ()
-{
- if (this.composeUploaderButton())
- {
- var
- oUploadCache = {},
- iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
- oJua = new Jua({
- 'action': RL.link().upload(),
- 'name': 'uploader',
- 'queueSize': 2,
- 'multipleSizeLimit': 50,
- 'disableFolderDragAndDrop': false,
- 'clickElement': this.composeUploaderButton(),
- 'dragAndDropElement': this.composeUploaderDropPlace()
- })
- ;
-
- if (oJua)
- {
- oJua
-// .on('onLimitReached', function (iLimit) {
-// alert(iLimit);
-// })
- .on('onDragEnter', _.bind(function () {
- this.dragAndDropOver(true);
- }, this))
- .on('onDragLeave', _.bind(function () {
- this.dragAndDropOver(false);
- }, this))
- .on('onBodyDragEnter', _.bind(function () {
- this.dragAndDropVisible(true);
- }, this))
- .on('onBodyDragLeave', _.bind(function () {
- this.dragAndDropVisible(false);
- }, this))
- .on('onProgress', _.bind(function (sId, iLoaded, iTotal) {
- var oItem = null;
- if (Utils.isUnd(oUploadCache[sId]))
- {
- oItem = this.getAttachmentById(sId);
- if (oItem)
- {
- oUploadCache[sId] = oItem;
- }
- }
- else
- {
- oItem = oUploadCache[sId];
- }
-
- if (oItem)
- {
- oItem.progress(' - ' + Math.floor(iLoaded / iTotal * 100) + '%');
- }
-
- }, this))
- .on('onSelect', _.bind(function (sId, oData) {
-
- this.dragAndDropOver(false);
-
- var
- that = this,
- sFileName = Utils.isUnd(oData.FileName) ? '' : oData.FileName.toString(),
- mSize = Utils.isNormal(oData.Size) ? Utils.pInt(oData.Size) : null,
- oAttachment = new ComposeAttachmentModel(sId, sFileName, mSize)
- ;
-
- oAttachment.cancel = (function (sId) {
-
- return function () {
- that.attachments.remove(function (oItem) {
- return oItem && oItem.id === sId;
- });
-
- if (oJua)
- {
- oJua.cancel(sId);
- }
- };
-
- }(sId));
-
- this.attachments.push(oAttachment);
-
- if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
- {
- oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
- return false;
- }
-
- return true;
-
- }, this))
- .on('onStart', _.bind(function (sId) {
-
- var
- oItem = null
- ;
-
- if (Utils.isUnd(oUploadCache[sId]))
- {
- oItem = this.getAttachmentById(sId);
- if (oItem)
- {
- oUploadCache[sId] = oItem;
- }
- }
- else
- {
- oItem = oUploadCache[sId];
- }
-
- if (oItem)
- {
- oItem.waiting(false);
- oItem.uploading(true);
- }
-
- }, this))
- .on('onComplete', _.bind(function (sId, bResult, oData) {
-
- var
- sError = '',
- mErrorCode = null,
- oAttachmentJson = null,
- oAttachment = this.getAttachmentById(sId)
- ;
-
- oAttachmentJson = bResult && oData && oData.Result && oData.Result.Attachment ? oData.Result.Attachment : null;
- mErrorCode = oData && oData.Result && oData.Result.ErrorCode ? oData.Result.ErrorCode : null;
-
- if (null !== mErrorCode)
- {
- sError = Utils.getUploadErrorDescByCode(mErrorCode);
- }
- else if (!oAttachmentJson)
- {
- sError = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
- }
-
- if (oAttachment)
- {
- if ('' !== sError && 0 < sError.length)
- {
- oAttachment
- .waiting(false)
- .uploading(false)
- .error(sError)
- ;
- }
- else if (oAttachmentJson)
- {
- oAttachment
- .waiting(false)
- .uploading(false)
- ;
-
- oAttachment.initByUploadJson(oAttachmentJson);
- }
-
- if (Utils.isUnd(oUploadCache[sId]))
- {
- delete (oUploadCache[sId]);
- }
- }
-
- }, this))
- ;
-
- this
- .addAttachmentEnabled(true)
- .dragAndDropEnabled(oJua.isDragAndDropSupported())
- ;
- }
- else
- {
- this
- .addAttachmentEnabled(false)
- .dragAndDropEnabled(false)
- ;
- }
- }
-};
-
-/**
- * @return {Object}
- */
-PopupsComposeViewModel.prototype.prepearAttachmentsForSendOrSave = function ()
-{
- var oResult = {};
- _.each(this.attachmentsInReady(), function (oItem) {
- if (oItem && '' !== oItem.tempName() && oItem.enabled())
- {
- oResult[oItem.tempName()] = [
- oItem.fileName(),
- oItem.isInline ? '1' : '0',
- oItem.CID,
- oItem.contentLocation
- ];
- }
- });
-
- return oResult;
-};
-
-/**
- * @param {MessageModel} oMessage
- */
-PopupsComposeViewModel.prototype.addMessageAsAttachment = function (oMessage)
-{
- if (oMessage)
- {
- var
- self = this,
- oAttachment = null,
- sTemp = oMessage.subject(),
- fCancelFunc = function (sId) {
- return function () {
- self.attachments.remove(function (oItem) {
- return oItem && oItem.id === sId;
- });
- };
- }
- ;
-
- sTemp = '.eml' === sTemp.substr(-4).toLowerCase() ? sTemp : sTemp + '.eml';
- oAttachment = new ComposeAttachmentModel(
- oMessage.requestHash, sTemp, oMessage.size()
- );
-
- oAttachment.fromMessage = true;
- oAttachment.cancel = fCancelFunc(oMessage.requestHash);
- oAttachment.waiting(false).uploading(true);
-
- this.attachments.push(oAttachment);
- }
-};
-
-/**
- * @param {Object} oDropboxFile
- * @return {boolean}
- */
-PopupsComposeViewModel.prototype.addDropboxAttachment = function (oDropboxFile)
-{
- var
- self = this,
- oAttachment = null,
- fCancelFunc = function (sId) {
- return function () {
- self.attachments.remove(function (oItem) {
- return oItem && oItem.id === sId;
- });
- };
- },
- iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
- mSize = oDropboxFile['bytes']
- ;
-
- oAttachment = new ComposeAttachmentModel(
- oDropboxFile['link'], oDropboxFile['name'], mSize
- );
-
- oAttachment.fromMessage = false;
- oAttachment.cancel = fCancelFunc(oDropboxFile['link']);
- oAttachment.waiting(false).uploading(true);
-
- this.attachments.push(oAttachment);
-
- if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
- {
- oAttachment.uploading(false);
- oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
- return false;
- }
-
- RL.remote().composeUploadExternals(function (sResult, oData) {
-
- var bResult = false;
- oAttachment.uploading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- if (oData.Result[oAttachment.id])
- {
- bResult = true;
- oAttachment.tempName(oData.Result[oAttachment.id]);
- }
- }
-
- if (!bResult)
- {
- oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
- }
-
- }, [oDropboxFile['link']]);
-
- return true;
-};
-
-/**
- * @param {Object} oDriveFile
- * @param {string} sAccessToken
- * @return {boolean}
- */
-PopupsComposeViewModel.prototype.addDriveAttachment = function (oDriveFile, sAccessToken)
-{
- var
- self = this,
- fCancelFunc = function (sId) {
- return function () {
- self.attachments.remove(function (oItem) {
- return oItem && oItem.id === sId;
- });
- };
- },
- iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
- oAttachment = null,
- mSize = oDriveFile['fileSize'] ? Utils.pInt(oDriveFile['fileSize']) : 0
- ;
-
- oAttachment = new ComposeAttachmentModel(
- oDriveFile['downloadUrl'], oDriveFile['title'], mSize
- );
-
- oAttachment.fromMessage = false;
- oAttachment.cancel = fCancelFunc(oDriveFile['downloadUrl']);
- oAttachment.waiting(false).uploading(true);
-
- this.attachments.push(oAttachment);
-
- if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
- {
- oAttachment.uploading(false);
- oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
- return false;
- }
-
- RL.remote().composeUploadDrive(function (sResult, oData) {
-
- var bResult = false;
- oAttachment.uploading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- if (oData.Result[oAttachment.id])
- {
- bResult = true;
- oAttachment.tempName(oData.Result[oAttachment.id][0]);
- oAttachment.size(Utils.pInt(oData.Result[oAttachment.id][1]));
- }
- }
-
- if (!bResult)
- {
- oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
- }
-
- }, oDriveFile['downloadUrl'], sAccessToken);
-
- return true;
-};
-
-/**
- * @param {MessageModel} oMessage
- * @param {string} sType
- */
-PopupsComposeViewModel.prototype.prepearMessageAttachments = function (oMessage, sType)
-{
- if (oMessage)
- {
- var
- self = this,
- aAttachments = Utils.isNonEmptyArray(oMessage.attachments()) ? oMessage.attachments() : [],
- iIndex = 0,
- iLen = aAttachments.length,
- oAttachment = null,
- oItem = null,
- bAdd = false,
- fCancelFunc = function (sId) {
- return function () {
- self.attachments.remove(function (oItem) {
- return oItem && oItem.id === sId;
- });
- };
- }
- ;
-
- if (Enums.ComposeType.ForwardAsAttachment === sType)
- {
- this.addMessageAsAttachment(oMessage);
- }
- else
- {
- for (; iIndex < iLen; iIndex++)
- {
- oItem = aAttachments[iIndex];
-
- bAdd = false;
- switch (sType) {
- case Enums.ComposeType.Reply:
- case Enums.ComposeType.ReplyAll:
- bAdd = oItem.isLinked;
- break;
-
- case Enums.ComposeType.Forward:
- case Enums.ComposeType.Draft:
- case Enums.ComposeType.EditAsNew:
- bAdd = true;
- break;
- }
-
- if (bAdd)
- {
- oAttachment = new ComposeAttachmentModel(
- oItem.download, oItem.fileName, oItem.estimatedSize,
- oItem.isInline, oItem.isLinked, oItem.cid, oItem.contentLocation
- );
-
- oAttachment.fromMessage = true;
- oAttachment.cancel = fCancelFunc(oItem.download);
- oAttachment.waiting(false).uploading(true);
-
- this.attachments.push(oAttachment);
- }
- }
- }
- }
-};
-
-PopupsComposeViewModel.prototype.removeLinkedAttachments = function ()
-{
- this.attachments.remove(function (oItem) {
- return oItem && oItem.isLinked;
- });
-};
-
-PopupsComposeViewModel.prototype.setMessageAttachmentFailedDowbloadText = function ()
-{
- _.each(this.attachments(), function(oAttachment) {
- if (oAttachment && oAttachment.fromMessage)
- {
- oAttachment
- .waiting(false)
- .uploading(false)
- .error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded))
- ;
- }
- }, this);
-};
-
-/**
- * @param {boolean=} bIncludeAttachmentInProgress = true
- * @return {boolean}
- */
-PopupsComposeViewModel.prototype.isEmptyForm = function (bIncludeAttachmentInProgress)
-{
- bIncludeAttachmentInProgress = Utils.isUnd(bIncludeAttachmentInProgress) ? true : !!bIncludeAttachmentInProgress;
- var bAttach = bIncludeAttachmentInProgress ?
- 0 === this.attachments().length : 0 === this.attachmentsInReady().length;
-
- return 0 === this.to().length &&
- 0 === this.cc().length &&
- 0 === this.bcc().length &&
- 0 === this.subject().length &&
- bAttach &&
- (!this.oEditor || '' === this.oEditor.getData())
- ;
-};
-
-PopupsComposeViewModel.prototype.reset = function ()
-{
- this.to('');
- this.cc('');
- this.bcc('');
- this.replyTo('');
- this.subject('');
-
- this.requestReadReceipt(false);
-
- this.aDraftInfo = null;
- this.sInReplyTo = '';
- this.bFromDraft = false;
- this.sReferences = '';
-
- this.sendError(false);
- this.sendSuccessButSaveError(false);
- this.savedError(false);
- this.savedTime(0);
- this.savedOrSendingText('');
- this.emptyToError(false);
- this.attachmentsInProcessError(false);
- this.showCcAndBcc(false);
-
- this.attachments([]);
- this.dragAndDropOver(false);
- this.dragAndDropVisible(false);
-
- this.draftFolder('');
- this.draftUid('');
-
- this.sending(false);
- this.saving(false);
-
- if (this.oEditor)
- {
- this.oEditor.clear(false);
- }
-};
-
-/**
- * @return {Array}
- */
-PopupsComposeViewModel.prototype.getAttachmentsDownloadsForUpload = function ()
-{
- return _.map(_.filter(this.attachments(), function (oItem) {
- return oItem && '' === oItem.tempName();
- }), function (oItem) {
- return oItem.id;
- });
-};
-
-PopupsComposeViewModel.prototype.triggerForResize = function ()
-{
- this.resizer(!this.resizer());
- this.editorResizeThrottle();
-};
-
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsContactsViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsContacts');
-
- var
- self = this,
- fFastClearEmptyListHelper = function (aList) {
- if (aList && 0 < aList.length) {
- self.viewProperties.removeAll(aList);
- }
- }
- ;
-
- this.allowContactsSync = RL.data().allowContactsSync;
- this.enableContactsSync = RL.data().enableContactsSync;
- this.allowExport = !Globals.bMobileDevice;
-
- this.search = ko.observable('');
- this.contactsCount = ko.observable(0);
- this.contacts = RL.data().contacts;
- this.contactTags = RL.data().contactTags;
-
- this.currentContact = ko.observable(null);
-
- this.importUploaderButton = ko.observable(null);
-
- this.contactsPage = ko.observable(1);
- this.contactsPageCount = ko.computed(function () {
- var iPage = Math.ceil(this.contactsCount() / Consts.Defaults.ContactsPerPage);
- return 0 >= iPage ? 1 : iPage;
- }, this);
-
- this.contactsPagenator = ko.computed(Utils.computedPagenatorHelper(this.contactsPage, this.contactsPageCount));
-
- this.emptySelection = ko.observable(true);
- this.viewClearSearch = ko.observable(false);
-
- this.viewID = ko.observable('');
- this.viewReadOnly = ko.observable(false);
- this.viewProperties = ko.observableArray([]);
-
- this.viewTags = ko.observable('');
- this.viewTags.visibility = ko.observable(false);
- this.viewTags.focusTrigger = ko.observable(false);
-
- this.viewTags.focusTrigger.subscribe(function (bValue) {
- if (!bValue && '' === this.viewTags())
- {
- this.viewTags.visibility(false);
- }
- else if (bValue)
- {
- this.viewTags.visibility(true);
- }
- }, this);
-
- this.viewSaveTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.viewPropertiesNames = this.viewProperties.filter(function(oProperty) {
- return -1 < Utils.inArray(oProperty.type(), [
- Enums.ContactPropertyType.FirstName, Enums.ContactPropertyType.LastName
- ]);
- });
-
- this.viewPropertiesOther = this.viewProperties.filter(function(oProperty) {
- return -1 < Utils.inArray(oProperty.type(), [
- Enums.ContactPropertyType.Note
- ]);
- });
-
- this.viewPropertiesOther = ko.computed(function () {
-
- var aList = _.filter(this.viewProperties(), function (oProperty) {
- return -1 < Utils.inArray(oProperty.type(), [
- Enums.ContactPropertyType.Nick
- ]);
- });
-
- return _.sortBy(aList, function (oProperty) {
- return oProperty.type();
- });
-
- }, this);
-
- this.viewPropertiesEmails = this.viewProperties.filter(function(oProperty) {
- return Enums.ContactPropertyType.Email === oProperty.type();
- });
-
- this.viewPropertiesWeb = this.viewProperties.filter(function(oProperty) {
- return Enums.ContactPropertyType.Web === oProperty.type();
- });
-
- this.viewHasNonEmptyRequaredProperties = ko.computed(function() {
-
- var
- aNames = this.viewPropertiesNames(),
- aEmail = this.viewPropertiesEmails(),
- fHelper = function (oProperty) {
- return '' !== Utils.trim(oProperty.value());
- }
- ;
-
- return !!(_.find(aNames, fHelper) || _.find(aEmail, fHelper));
- }, this);
-
- this.viewPropertiesPhones = this.viewProperties.filter(function(oProperty) {
- return Enums.ContactPropertyType.Phone === oProperty.type();
- });
-
- this.viewPropertiesEmailsNonEmpty = this.viewPropertiesNames.filter(function(oProperty) {
- return '' !== Utils.trim(oProperty.value());
- });
-
- this.viewPropertiesEmailsEmptyAndOnFocused = this.viewPropertiesEmails.filter(function(oProperty) {
- var bF = oProperty.focused();
- return '' === Utils.trim(oProperty.value()) && !bF;
- });
-
- this.viewPropertiesPhonesEmptyAndOnFocused = this.viewPropertiesPhones.filter(function(oProperty) {
- var bF = oProperty.focused();
- return '' === Utils.trim(oProperty.value()) && !bF;
- });
-
- this.viewPropertiesWebEmptyAndOnFocused = this.viewPropertiesWeb.filter(function(oProperty) {
- var bF = oProperty.focused();
- return '' === Utils.trim(oProperty.value()) && !bF;
- });
-
- this.viewPropertiesOtherEmptyAndOnFocused = ko.computed(function () {
- return _.filter(this.viewPropertiesOther(), function (oProperty) {
- var bF = oProperty.focused();
- return '' === Utils.trim(oProperty.value()) && !bF;
- });
- }, this);
-
- this.viewPropertiesEmailsEmptyAndOnFocused.subscribe(function(aList) {
- fFastClearEmptyListHelper(aList);
- });
-
- this.viewPropertiesPhonesEmptyAndOnFocused.subscribe(function(aList) {
- fFastClearEmptyListHelper(aList);
- });
-
- this.viewPropertiesWebEmptyAndOnFocused.subscribe(function(aList) {
- fFastClearEmptyListHelper(aList);
- });
-
- this.viewPropertiesOtherEmptyAndOnFocused.subscribe(function(aList) {
- fFastClearEmptyListHelper(aList);
- });
-
- this.viewSaving = ko.observable(false);
-
- this.useCheckboxesInList = RL.data().useCheckboxesInList;
-
- this.search.subscribe(function () {
- this.reloadContactList();
- }, this);
-
- this.contacts.subscribe(function () {
- Utils.windowResize();
- }, this);
-
- this.viewProperties.subscribe(function () {
- Utils.windowResize();
- }, this);
-
- this.contactsChecked = ko.computed(function () {
- return _.filter(this.contacts(), function (oItem) {
- return oItem.checked();
- });
- }, this);
-
- this.contactsCheckedOrSelected = ko.computed(function () {
-
- var
- aChecked = this.contactsChecked(),
- oSelected = this.currentContact()
- ;
-
- return _.union(aChecked, oSelected ? [oSelected] : []);
-
- }, this);
-
- this.contactsCheckedOrSelectedUids = ko.computed(function () {
- return _.map(this.contactsCheckedOrSelected(), function (oContact) {
- return oContact.idContact;
- });
- }, this);
-
- this.selector = new Selector(this.contacts, this.currentContact,
- '.e-contact-item .actionHandle', '.e-contact-item.selected', '.e-contact-item .checkboxItem',
- '.e-contact-item.focused');
-
- this.selector.on('onItemSelect', _.bind(function (oContact) {
- this.populateViewContact(oContact ? oContact : null);
- if (!oContact)
- {
- this.emptySelection(true);
- }
- }, this));
-
- this.selector.on('onItemGetUid', function (oContact) {
- return oContact ? oContact.generateUid() : '';
- });
-
- this.newCommand = Utils.createCommand(this, function () {
- this.populateViewContact(null);
- this.currentContact(null);
- });
-
- this.deleteCommand = Utils.createCommand(this, function () {
- this.deleteSelectedContacts();
- this.emptySelection(true);
- }, function () {
- return 0 < this.contactsCheckedOrSelected().length;
- });
-
- this.newMessageCommand = Utils.createCommand(this, function () {
- var aC = this.contactsCheckedOrSelected(), aE = [];
- if (Utils.isNonEmptyArray(aC))
- {
- aE = _.map(aC, function (oItem) {
- if (oItem)
- {
- var
- aData = oItem.getNameAndEmailHelper(),
- oEmail = aData ? new EmailModel(aData[0], aData[1]) : null
- ;
-
- if (oEmail && oEmail.validate())
- {
- return oEmail;
- }
- }
-
- return null;
- });
-
- aE = _.compact(aE);
- }
-
- if (Utils.isNonEmptyArray(aE))
- {
- kn.hideScreenPopup(PopupsContactsViewModel);
- kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Empty, null, aE]);
- }
-
- }, function () {
- return 0 < this.contactsCheckedOrSelected().length;
- });
-
- this.clearCommand = Utils.createCommand(this, function () {
- this.search('');
- });
-
- this.saveCommand = Utils.createCommand(this, function () {
-
- this.viewSaving(true);
- this.viewSaveTrigger(Enums.SaveSettingsStep.Animate);
-
- var
- sRequestUid = Utils.fakeMd5(),
- aProperties = []
- ;
-
- _.each(this.viewProperties(), function (oItem) {
- if (oItem.type() && '' !== Utils.trim(oItem.value()))
- {
- aProperties.push([oItem.type(), oItem.value(), oItem.typeStr()]);
- }
- });
-
- RL.remote().contactSave(function (sResult, oData) {
-
- var bRes = false;
- self.viewSaving(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
- oData.Result.RequestUid === sRequestUid && 0 < Utils.pInt(oData.Result.ResultID))
- {
- if ('' === self.viewID())
- {
- self.viewID(Utils.pInt(oData.Result.ResultID));
- }
-
- self.reloadContactList();
- bRes = true;
- }
-
- _.delay(function () {
- self.viewSaveTrigger(bRes ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult);
- }, 300);
-
- if (bRes)
- {
- self.watchDirty(false);
-
- _.delay(function () {
- self.viewSaveTrigger(Enums.SaveSettingsStep.Idle);
- }, 1000);
- }
-
- }, sRequestUid, this.viewID(), this.viewTags(), aProperties);
-
- }, function () {
- var
- bV = this.viewHasNonEmptyRequaredProperties(),
- bReadOnly = this.viewReadOnly()
- ;
- return !this.viewSaving() && bV && !bReadOnly;
- });
-
- this.syncCommand = Utils.createCommand(this, function () {
-
- var self = this;
- RL.contactsSync(function (sResult, oData) {
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- window.alert(Utils.getNotification(
- oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.ContactsSyncError));
- }
-
- self.reloadContactList(true);
- });
-
- }, function () {
- return !this.contacts.syncing() && !this.contacts.importing();
- });
-
- this.bDropPageAfterDelete = false;
-
- this.watchDirty = ko.observable(false);
- this.watchHash = ko.observable(false);
-
- this.viewHash = ko.computed(function () {
- return '' + self.viewTags() + '|' + _.map(self.viewProperties(), function (oItem) {
- return oItem.value();
- }).join('');
- });
-
-// this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
-
- this.viewHash.subscribe(function () {
- if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty())
- {
- this.watchDirty(true);
- }
- }, this);
-
- this.sDefaultKeyScope = Enums.KeyState.ContactList;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
-
-PopupsContactsViewModel.prototype.getPropertyPlceholder = function (sType)
-{
- var sResult = '';
- switch (sType)
- {
- case Enums.ContactPropertyType.LastName:
- sResult = 'CONTACTS/PLACEHOLDER_ENTER_LAST_NAME';
- break;
- case Enums.ContactPropertyType.FirstName:
- sResult = 'CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME';
- break;
- case Enums.ContactPropertyType.Nick:
- sResult = 'CONTACTS/PLACEHOLDER_ENTER_NICK_NAME';
- break;
- }
-
- return sResult;
-};
-
-PopupsContactsViewModel.prototype.addNewProperty = function (sType, sTypeStr)
-{
- this.viewProperties.push(new ContactPropertyModel(sType, sTypeStr || '', '', true, this.getPropertyPlceholder(sType)));
-};
-
-PopupsContactsViewModel.prototype.addNewOrFocusProperty = function (sType, sTypeStr)
-{
- var oItem = _.find(this.viewProperties(), function (oItem) {
- return sType === oItem.type();
- });
-
- if (oItem)
- {
- oItem.focused(true);
- }
- else
- {
- this.addNewProperty(sType, sTypeStr);
- }
-};
-
-PopupsContactsViewModel.prototype.addNewTag = function ()
-{
- this.viewTags.visibility(true);
- this.viewTags.focusTrigger(true);
-};
-
-PopupsContactsViewModel.prototype.addNewEmail = function ()
-{
- this.addNewProperty(Enums.ContactPropertyType.Email, 'Home');
-};
-
-PopupsContactsViewModel.prototype.addNewPhone = function ()
-{
- this.addNewProperty(Enums.ContactPropertyType.Phone, 'Mobile');
-};
-
-PopupsContactsViewModel.prototype.addNewWeb = function ()
-{
- this.addNewProperty(Enums.ContactPropertyType.Web);
-};
-
-PopupsContactsViewModel.prototype.addNewNickname = function ()
-{
- this.addNewOrFocusProperty(Enums.ContactPropertyType.Nick);
-};
-
-PopupsContactsViewModel.prototype.addNewNotes = function ()
-{
- this.addNewOrFocusProperty(Enums.ContactPropertyType.Note);
-};
-
-PopupsContactsViewModel.prototype.addNewBirthday = function ()
-{
- this.addNewOrFocusProperty(Enums.ContactPropertyType.Birthday);
-};
-
-//PopupsContactsViewModel.prototype.addNewAddress = function ()
-//{
-//};
-
-PopupsContactsViewModel.prototype.exportVcf = function ()
-{
- RL.download(RL.link().exportContactsVcf());
-};
-
-PopupsContactsViewModel.prototype.exportCsv = function ()
-{
- RL.download(RL.link().exportContactsCsv());
-};
-
-PopupsContactsViewModel.prototype.initUploader = function ()
-{
- if (this.importUploaderButton())
- {
- var
- oJua = new Jua({
- 'action': RL.link().uploadContacts(),
- 'name': 'uploader',
- 'queueSize': 1,
- 'multipleSizeLimit': 1,
- 'disableFolderDragAndDrop': true,
- 'disableDragAndDrop': true,
- 'disableMultiple': true,
- 'disableDocumentDropPrevent': true,
- 'clickElement': this.importUploaderButton()
- })
- ;
-
- if (oJua)
- {
- oJua
- .on('onStart', _.bind(function () {
- this.contacts.importing(true);
- }, this))
- .on('onComplete', _.bind(function (sId, bResult, oData) {
-
- this.contacts.importing(false);
- this.reloadContactList();
-
- if (!sId || !bResult || !oData || !oData.Result)
- {
- window.alert(Utils.i18n('CONTACTS/ERROR_IMPORT_FILE'));
- }
-
- }, this))
- ;
- }
- }
-};
-
-PopupsContactsViewModel.prototype.removeCheckedOrSelectedContactsFromList = function ()
-{
- var
- self = this,
- oKoContacts = this.contacts,
- oCurrentContact = this.currentContact(),
- iCount = this.contacts().length,
- aContacts = this.contactsCheckedOrSelected()
- ;
-
- if (0 < aContacts.length)
- {
- _.each(aContacts, function (oContact) {
-
- if (oCurrentContact && oCurrentContact.idContact === oContact.idContact)
- {
- oCurrentContact = null;
- self.currentContact(null);
- }
-
- oContact.deleted(true);
- iCount--;
- });
-
- if (iCount <= 0)
- {
- this.bDropPageAfterDelete = true;
- }
-
- _.delay(function () {
-
- _.each(aContacts, function (oContact) {
- oKoContacts.remove(oContact);
- });
-
- }, 500);
- }
-};
-
-PopupsContactsViewModel.prototype.deleteSelectedContacts = function ()
-{
- if (0 < this.contactsCheckedOrSelected().length)
- {
- RL.remote().contactsDelete(
- _.bind(this.deleteResponse, this),
- this.contactsCheckedOrSelectedUids()
- );
-
- this.removeCheckedOrSelectedContactsFromList();
- }
-};
-
-/**
- * @param {string} sResult
- * @param {AjaxJsonDefaultResponse} oData
- */
-PopupsContactsViewModel.prototype.deleteResponse = function (sResult, oData)
-{
- if (500 < (Enums.StorageResultType.Success === sResult && oData && oData.Time ? Utils.pInt(oData.Time) : 0))
- {
- this.reloadContactList(this.bDropPageAfterDelete);
- }
- else
- {
- _.delay((function (self) {
- return function () {
- self.reloadContactList(self.bDropPageAfterDelete);
- };
- }(this)), 500);
- }
-};
-
-PopupsContactsViewModel.prototype.removeProperty = function (oProp)
-{
- this.viewProperties.remove(oProp);
-};
-
-/**
- * @param {?ContactModel} oContact
- */
-PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
-{
- var
- sId = '',
- sLastName = '',
- sFirstName = '',
- aList = []
- ;
-
- this.watchHash(false);
-
- this.emptySelection(false);
- this.viewReadOnly(false);
- this.viewTags('');
-
- if (oContact)
- {
- sId = oContact.idContact;
- if (Utils.isNonEmptyArray(oContact.properties))
- {
- _.each(oContact.properties, function (aProperty) {
- if (aProperty && aProperty[0])
- {
- if (Enums.ContactPropertyType.LastName === aProperty[0])
- {
- sLastName = aProperty[1];
- }
- else if (Enums.ContactPropertyType.FirstName === aProperty[0])
- {
- sFirstName = aProperty[1];
- }
- else
- {
- aList.push(new ContactPropertyModel(aProperty[0], aProperty[2] || '', aProperty[1]));
- }
- }
- });
- }
-
- this.viewTags(oContact.tags);
-
- this.viewReadOnly(!!oContact.readOnly);
- }
-
- this.viewTags.focusTrigger.valueHasMutated();
- this.viewTags.visibility('' !== this.viewTags());
-
- aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.LastName, '', sLastName, false,
- this.getPropertyPlceholder(Enums.ContactPropertyType.LastName)));
-
- aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.FirstName, '', sFirstName, !oContact,
- this.getPropertyPlceholder(Enums.ContactPropertyType.FirstName)));
-
- this.viewID(sId);
- this.viewProperties([]);
- this.viewProperties(aList);
-
- this.watchDirty(false);
- this.watchHash(true);
-};
-
-/**
- * @param {boolean=} bDropPagePosition = false
- */
-PopupsContactsViewModel.prototype.reloadContactList = function (bDropPagePosition)
-{
- var
- self = this,
- iOffset = (this.contactsPage() - 1) * Consts.Defaults.ContactsPerPage
- ;
-
- this.bDropPageAfterDelete = false;
-
- if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition)
- {
- this.contactsPage(1);
- iOffset = 0;
- }
-
- this.contacts.loading(true);
- RL.remote().contacts(function (sResult, oData) {
- var
- iCount = 0,
- aList = [],
- aTagsList = []
- ;
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.List)
- {
- if (Utils.isNonEmptyArray(oData.Result.List))
- {
- aList = _.map(oData.Result.List, function (oItem) {
- var oContact = new ContactModel();
- return oContact.parse(oItem) ? oContact : null;
- });
-
- aList = _.compact(aList);
-
- iCount = Utils.pInt(oData.Result.Count);
- iCount = 0 < iCount ? iCount : 0;
- }
-
- if (Utils.isNonEmptyArray(oData.Result.Tags))
- {
- aTagsList = _.map(oData.Result.Tags, function (oItem) {
- var oContactTag = new ContactTagModel();
- return oContactTag.parse(oItem) ? oContactTag : null;
- });
-
- aTagsList = _.compact(aTagsList);
- }
- }
-
- self.contactsCount(iCount);
-
- self.contacts(aList);
- self.contacts.loading(false);
- self.contactTags(aTagsList);
-
- self.viewClearSearch('' !== self.search());
-
- }, iOffset, Consts.Defaults.ContactsPerPage, this.search());
-};
-
-PopupsContactsViewModel.prototype.onBuild = function (oDom)
-{
- this.oContentVisible = $('.b-list-content', oDom);
- this.oContentScrollable = $('.content', this.oContentVisible);
-
- this.selector.init(this.oContentVisible, this.oContentScrollable, Enums.KeyState.ContactList);
-
- var self = this;
-
- key('delete', Enums.KeyState.ContactList, function () {
- self.deleteCommand();
- return false;
- });
-
- oDom
- .on('click', '.e-pagenator .e-page', function () {
- var oPage = ko.dataFor(this);
- if (oPage)
- {
- self.contactsPage(Utils.pInt(oPage.value));
- self.reloadContactList();
- }
- })
- ;
-
- this.initUploader();
-};
-
-PopupsContactsViewModel.prototype.onShow = function ()
-{
- kn.routeOff();
- this.reloadContactList(true);
-};
-
-PopupsContactsViewModel.prototype.onHide = function ()
-{
- kn.routeOn();
- this.currentContact(null);
- this.emptySelection(true);
- this.search('');
- this.contactsCount(0);
- this.contacts([]);
-// _.each(this.contacts(), function (oItem) {
-// oItem.checked(false);
-// });
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsAdvancedSearchViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAdvancedSearch');
-
- this.fromFocus = ko.observable(false);
-
- this.from = ko.observable('');
- this.to = ko.observable('');
- this.subject = ko.observable('');
- this.text = ko.observable('');
- this.selectedDateValue = ko.observable(-1);
-
- this.hasAttachment = ko.observable(false);
- this.starred = ko.observable(false);
- this.unseen = ko.observable(false);
-
- this.searchCommand = Utils.createCommand(this, function () {
-
- var sSearch = this.buildSearchString();
- if ('' !== sSearch)
- {
- RL.data().mainMessageListSearch(sSearch);
- }
-
- this.cancelCommand();
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsAdvancedSearchViewModel', PopupsAdvancedSearchViewModel);
-
-PopupsAdvancedSearchViewModel.prototype.buildSearchStringValue = function (sValue)
-{
- if (-1 < sValue.indexOf(' '))
- {
- sValue = '"' + sValue + '"';
- }
-
- return sValue;
-};
-
-PopupsAdvancedSearchViewModel.prototype.buildSearchString = function ()
-{
- var
- aResult = [],
- sFrom = Utils.trim(this.from()),
- sTo = Utils.trim(this.to()),
- sSubject = Utils.trim(this.subject()),
- sText = Utils.trim(this.text()),
- aIs = [],
- aHas = []
- ;
-
- if (sFrom && '' !== sFrom)
- {
- aResult.push('from:' + this.buildSearchStringValue(sFrom));
- }
-
- if (sTo && '' !== sTo)
- {
- aResult.push('to:' + this.buildSearchStringValue(sTo));
- }
-
- if (sSubject && '' !== sSubject)
- {
- aResult.push('subject:' + this.buildSearchStringValue(sSubject));
- }
-
- if (this.hasAttachment())
- {
- aHas.push('attachment');
- }
-
- if (this.unseen())
- {
- aIs.push('unseen');
- }
-
- if (this.starred())
- {
- aIs.push('flagged');
- }
-
- if (0 < aHas.length)
- {
- aResult.push('has:' + aHas.join(','));
- }
-
- if (0 < aIs.length)
- {
- aResult.push('is:' + aIs.join(','));
- }
-
- if (-1 < this.selectedDateValue())
- {
- aResult.push('date:' + moment().subtract('days', this.selectedDateValue()).format('YYYY.MM.DD') + '/');
- }
-
- if (sText && '' !== sText)
- {
- aResult.push('text:' + this.buildSearchStringValue(sText));
- }
-
- return Utils.trim(aResult.join(' '));
-};
-
-PopupsAdvancedSearchViewModel.prototype.clearPopup = function ()
-{
- this.from('');
- this.to('');
- this.subject('');
- this.text('');
-
- this.selectedDateValue(-1);
- this.hasAttachment(false);
- this.starred(false);
- this.unseen(false);
-
- this.fromFocus(true);
-};
-
-PopupsAdvancedSearchViewModel.prototype.onShow = function ()
-{
- this.clearPopup();
-};
-
-PopupsAdvancedSearchViewModel.prototype.onFocus = function ()
-{
- this.fromFocus(true);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsAddAccountViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAddAccount');
-
- this.email = ko.observable('');
- this.password = ko.observable('');
-
- this.emailError = ko.observable(false);
- this.passwordError = ko.observable(false);
-
- this.email.subscribe(function () {
- this.emailError(false);
- }, this);
-
- this.password.subscribe(function () {
- this.passwordError(false);
- }, this);
-
- this.submitRequest = ko.observable(false);
- this.submitError = ko.observable('');
-
- this.emailFocus = ko.observable(false);
-
- this.addAccountCommand = Utils.createCommand(this, function () {
-
- this.emailError('' === Utils.trim(this.email()));
- this.passwordError('' === Utils.trim(this.password()));
-
- if (this.emailError() || this.passwordError())
- {
- return false;
- }
-
- this.submitRequest(true);
-
- RL.remote().accountAdd(_.bind(function (sResult, oData) {
-
- this.submitRequest(false);
- if (Enums.StorageResultType.Success === sResult && oData && 'AccountAdd' === oData.Action)
- {
- if (oData.Result)
- {
- RL.accountsAndIdentities();
- this.cancelCommand();
- }
- else if (oData.ErrorCode)
- {
- this.submitError(Utils.getNotification(oData.ErrorCode));
- }
- }
- else
- {
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
- }
-
- }, this), this.email(), '', this.password());
-
- return true;
-
- }, function () {
- return !this.submitRequest();
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsAddAccountViewModel', PopupsAddAccountViewModel);
-
-PopupsAddAccountViewModel.prototype.clearPopup = function ()
-{
- this.email('');
- this.password('');
-
- this.emailError(false);
- this.passwordError(false);
-
- this.submitRequest(false);
- this.submitError('');
-};
-
-PopupsAddAccountViewModel.prototype.onShow = function ()
-{
- this.clearPopup();
-};
-
-PopupsAddAccountViewModel.prototype.onFocus = function ()
-{
- this.emailFocus(true);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsAddOpenPgpKeyViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAddOpenPgpKey');
-
- this.key = ko.observable('');
- this.key.error = ko.observable(false);
- this.key.focus = ko.observable(false);
-
- this.key.subscribe(function () {
- this.key.error(false);
- }, this);
-
- this.addOpenPgpKeyCommand = Utils.createCommand(this, function () {
-
- var
- iCount = 30,
- aMatch = null,
- sKey = Utils.trim(this.key()),
- oReg = /[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi,
- oOpenpgpKeyring = RL.data().openpgpKeyring
- ;
-
- sKey = sKey.replace(/[\r\n]([a-zA-Z0-9]{2,}:[^\r\n]+)[\r\n]+([a-zA-Z0-9\/\\+=]{10,})/g, '\n$1!-!N!-!$2')
- .replace(/[\n\r]+/g, '\n').replace(/!-!N!-!/g, '\n\n');
-
- this.key.error('' === sKey);
-
- if (!oOpenpgpKeyring || this.key.error())
- {
- return false;
- }
-
- do
- {
- aMatch = oReg.exec(sKey);
- if (!aMatch || 0 > iCount)
- {
- break;
- }
-
- if (aMatch[0] && aMatch[1] && aMatch[2] && aMatch[1] === aMatch[2])
- {
- if ('PRIVATE' === aMatch[1])
- {
- oOpenpgpKeyring.privateKeys.importKey(aMatch[0]);
- }
- else if ('PUBLIC' === aMatch[1])
- {
- oOpenpgpKeyring.publicKeys.importKey(aMatch[0]);
- }
- }
-
- iCount--;
- }
- while (true);
-
- oOpenpgpKeyring.store();
-
- RL.reloadOpenPgpKeys();
- Utils.delegateRun(this, 'cancelCommand');
-
- return true;
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsAddOpenPgpKeyViewModel', PopupsAddOpenPgpKeyViewModel);
-
-PopupsAddOpenPgpKeyViewModel.prototype.clearPopup = function ()
-{
- this.key('');
- this.key.error(false);
-};
-
-PopupsAddOpenPgpKeyViewModel.prototype.onShow = function ()
-{
- this.clearPopup();
-};
-
-PopupsAddOpenPgpKeyViewModel.prototype.onFocus = function ()
-{
- this.key.focus(true);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsViewOpenPgpKeyViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsViewOpenPgpKey');
-
- this.key = ko.observable('');
- this.keyDom = ko.observable(null);
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsViewOpenPgpKeyViewModel', PopupsViewOpenPgpKeyViewModel);
-
-PopupsViewOpenPgpKeyViewModel.prototype.clearPopup = function ()
-{
- this.key('');
-};
-
-PopupsViewOpenPgpKeyViewModel.prototype.selectKey = function ()
-{
- var oEl = this.keyDom();
- if (oEl)
- {
- Utils.selectElement(oEl);
- }
-};
-
-PopupsViewOpenPgpKeyViewModel.prototype.onShow = function (oOpenPgpKey)
-{
- this.clearPopup();
-
- if (oOpenPgpKey)
- {
- this.key(oOpenPgpKey.armor);
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsGenerateNewOpenPgpKeyViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsGenerateNewOpenPgpKey');
-
- this.email = ko.observable('');
- this.email.focus = ko.observable('');
- this.email.error = ko.observable(false);
-
- this.name = ko.observable('');
- this.password = ko.observable('');
- this.keyBitLength = ko.observable(2048);
-
- this.submitRequest = ko.observable(false);
-
- this.email.subscribe(function () {
- this.email.error(false);
- }, this);
-
- this.generateOpenPgpKeyCommand = Utils.createCommand(this, function () {
-
- var
- self = this,
- sUserID = '',
- mKeyPair = null,
- oOpenpgpKeyring = RL.data().openpgpKeyring
- ;
-
- this.email.error('' === Utils.trim(this.email()));
- if (!oOpenpgpKeyring || this.email.error())
- {
- return false;
- }
-
- sUserID = this.email();
- if ('' !== this.name())
- {
- sUserID = this.name() + ' <' + sUserID + '>';
- }
-
- this.submitRequest(true);
-
- _.delay(function () {
-// mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password()));
- mKeyPair = window.openpgp.generateKeyPair({
- 'userId': sUserID,
- 'numBits': Utils.pInt(self.keyBitLength()),
- 'passphrase': Utils.trim(self.password())
- });
-
- if (mKeyPair && mKeyPair.privateKeyArmored)
- {
- oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored);
- oOpenpgpKeyring.publicKeys.importKey(mKeyPair.publicKeyArmored);
- oOpenpgpKeyring.store();
-
- RL.reloadOpenPgpKeys();
- Utils.delegateRun(self, 'cancelCommand');
- }
-
- self.submitRequest(false);
- }, 100);
-
- return true;
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsGenerateNewOpenPgpKeyViewModel', PopupsGenerateNewOpenPgpKeyViewModel);
-
-PopupsGenerateNewOpenPgpKeyViewModel.prototype.clearPopup = function ()
-{
- this.name('');
- this.password('');
-
- this.email('');
- this.email.error(false);
- this.keyBitLength(2048);
-};
-
-PopupsGenerateNewOpenPgpKeyViewModel.prototype.onShow = function ()
-{
- this.clearPopup();
-};
-
-PopupsGenerateNewOpenPgpKeyViewModel.prototype.onFocus = function ()
-{
- this.email.focus(true);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsComposeOpenPgpViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsComposeOpenPgp');
-
- this.notification = ko.observable('');
-
- this.sign = ko.observable(true);
- this.encrypt = ko.observable(true);
-
- this.password = ko.observable('');
- this.password.focus = ko.observable(false);
- this.buttonFocus = ko.observable(false);
-
- this.from = ko.observable('');
- this.to = ko.observableArray([]);
- this.text = ko.observable('');
-
- this.resultCallback = null;
-
- this.submitRequest = ko.observable(false);
-
- // commands
- this.doCommand = Utils.createCommand(this, function () {
-
- var
- self = this,
- bResult = true,
- oData = RL.data(),
- oPrivateKey = null,
- aPublicKeys = []
- ;
-
- this.submitRequest(true);
-
- if (bResult && this.sign() && '' === this.from())
- {
- this.notification(Utils.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL'));
- bResult = false;
- }
-
- if (bResult && this.sign())
- {
- oPrivateKey = oData.findPrivateKeyByEmail(this.from(), this.password());
- if (!oPrivateKey)
- {
- this.notification(Utils.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
- 'EMAIL': this.from()
- }));
-
- bResult = false;
- }
- }
-
- if (bResult && this.encrypt() && 0 === this.to().length)
- {
- this.notification(Utils.i18n('PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT'));
- bResult = false;
- }
-
- if (bResult && this.encrypt())
- {
- aPublicKeys = [];
- _.each(this.to(), function (sEmail) {
- var aKeys = oData.findPublicKeysByEmail(sEmail);
- if (0 === aKeys.length && bResult)
- {
- self.notification(Utils.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
- 'EMAIL': sEmail
- }));
-
- bResult = false;
- }
-
- aPublicKeys = aPublicKeys.concat(aKeys);
- });
-
- if (bResult && (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length))
- {
- bResult = false;
- }
- }
-
- _.delay(function () {
-
- if (self.resultCallback && bResult)
- {
- try {
-
- if (oPrivateKey && 0 === aPublicKeys.length)
- {
- self.resultCallback(
- window.openpgp.signClearMessage([oPrivateKey], self.text())
- );
- }
- else if (oPrivateKey && 0 < aPublicKeys.length)
- {
- self.resultCallback(
- window.openpgp.signAndEncryptMessage(aPublicKeys, oPrivateKey, self.text())
- );
- }
- else if (!oPrivateKey && 0 < aPublicKeys.length)
- {
- self.resultCallback(
- window.openpgp.encryptMessage(aPublicKeys, self.text())
- );
- }
- }
- catch (e)
- {
- self.notification(Utils.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
- 'ERROR': '' + e
- }));
-
- bResult = false;
- }
- }
-
- if (bResult)
- {
- self.cancelCommand();
- }
-
- self.submitRequest(false);
-
- }, 10);
-
- }, function () {
- return !this.submitRequest() && (this.sign() || this.encrypt());
- });
-
- this.sDefaultKeyScope = Enums.KeyState.PopupComposeOpenPGP;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsComposeOpenPgpViewModel', PopupsComposeOpenPgpViewModel);
-
-PopupsComposeOpenPgpViewModel.prototype.clearPopup = function ()
-{
- this.notification('');
-
- this.password('');
- this.password.focus(false);
- this.buttonFocus(false);
-
- this.from('');
- this.to([]);
- this.text('');
-
- this.submitRequest(false);
-
- this.resultCallback = null;
-};
-
-PopupsComposeOpenPgpViewModel.prototype.onBuild = function ()
-{
- key('tab,shift+tab', Enums.KeyState.PopupComposeOpenPGP, _.bind(function () {
-
- switch (true)
- {
- case this.password.focus():
- this.buttonFocus(true);
- break;
- case this.buttonFocus():
- this.password.focus(true);
- break;
- }
-
- return false;
-
- }, this));
-};
-
-PopupsComposeOpenPgpViewModel.prototype.onHide = function ()
-{
- this.clearPopup();
-};
-
-PopupsComposeOpenPgpViewModel.prototype.onFocus = function ()
-{
- if (this.sign())
- {
- this.password.focus(true);
- }
- else
- {
- this.buttonFocus(true);
- }
-};
-
-PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFromEmail, sTo, sCc, sBcc)
-{
- this.clearPopup();
-
- var
- oEmail = new EmailModel(),
- sResultFromEmail = '',
- aRec = []
- ;
-
- this.resultCallback = fCallback;
-
- oEmail.clear();
- oEmail.mailsoParse(sFromEmail);
- if ('' !== oEmail.email)
- {
- sResultFromEmail = oEmail.email;
- }
-
- if ('' !== sTo)
- {
- aRec.push(sTo);
- }
-
- if ('' !== sCc)
- {
- aRec.push(sCc);
- }
-
- if ('' !== sBcc)
- {
- aRec.push(sBcc);
- }
-
- aRec = aRec.join(', ').split(',');
- aRec = _.compact(_.map(aRec, function (sValue) {
- oEmail.clear();
- oEmail.mailsoParse(Utils.trim(sValue));
- return '' === oEmail.email ? false : oEmail.email;
- }));
-
- this.from(sResultFromEmail);
- this.to(aRec);
- this.text(sText);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsIdentityViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsIdentity');
-
- this.id = '';
- this.edit = ko.observable(false);
- this.owner = ko.observable(false);
-
- this.email = ko.observable('').validateEmail();
- this.email.focused = ko.observable(false);
- this.name = ko.observable('');
- this.name.focused = ko.observable(false);
- this.replyTo = ko.observable('').validateSimpleEmail();
- this.replyTo.focused = ko.observable(false);
- this.bcc = ko.observable('').validateSimpleEmail();
- this.bcc.focused = ko.observable(false);
-
-// this.email.subscribe(function () {
-// this.email.hasError(false);
-// }, this);
-
- this.submitRequest = ko.observable(false);
- this.submitError = ko.observable('');
-
- this.addOrEditIdentityCommand = Utils.createCommand(this, function () {
-
- if (!this.email.hasError())
- {
- this.email.hasError('' === Utils.trim(this.email()));
- }
-
- if (this.email.hasError())
- {
- if (!this.owner())
- {
- this.email.focused(true);
- }
-
- return false;
- }
-
- if (this.replyTo.hasError())
- {
- this.replyTo.focused(true);
- return false;
- }
-
- if (this.bcc.hasError())
- {
- this.bcc.focused(true);
- return false;
- }
-
- this.submitRequest(true);
-
- RL.remote().identityUpdate(_.bind(function (sResult, oData) {
-
- this.submitRequest(false);
- if (Enums.StorageResultType.Success === sResult && oData)
- {
- if (oData.Result)
- {
- RL.accountsAndIdentities();
- this.cancelCommand();
- }
- else if (oData.ErrorCode)
- {
- this.submitError(Utils.getNotification(oData.ErrorCode));
- }
- }
- else
- {
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
- }
-
- }, this), this.id, this.email(), this.name(), this.replyTo(), this.bcc());
-
- return true;
-
- }, function () {
- return !this.submitRequest();
- });
-
- this.label = ko.computed(function () {
- return Utils.i18n('POPUPS_IDENTITIES/' + (this.edit() ? 'TITLE_UPDATE_IDENTITY': 'TITLE_ADD_IDENTITY'));
- }, this);
-
- this.button = ko.computed(function () {
- return Utils.i18n('POPUPS_IDENTITIES/' + (this.edit() ? 'BUTTON_UPDATE_IDENTITY': 'BUTTON_ADD_IDENTITY'));
- }, this);
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsIdentityViewModel', PopupsIdentityViewModel);
-
-PopupsIdentityViewModel.prototype.clearPopup = function ()
-{
- this.id = '';
- this.edit(false);
- this.owner(false);
-
- this.name('');
- this.email('');
- this.replyTo('');
- this.bcc('');
-
- this.email.hasError(false);
- this.replyTo.hasError(false);
- this.bcc.hasError(false);
-
- this.submitRequest(false);
- this.submitError('');
-};
-
-/**
- * @param {?IdentityModel} oIdentity
- */
-PopupsIdentityViewModel.prototype.onShow = function (oIdentity)
-{
- this.clearPopup();
-
- if (oIdentity)
- {
- this.edit(true);
-
- this.id = oIdentity.id;
- this.name(oIdentity.name());
- this.email(oIdentity.email());
- this.replyTo(oIdentity.replyTo());
- this.bcc(oIdentity.bcc());
-
- this.owner(this.id === RL.data().accountEmail());
- }
-};
-
-PopupsIdentityViewModel.prototype.onFocus = function ()
-{
- if (!this.owner())
- {
- this.email.focused(true);
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsLanguagesViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
-
- this.exp = ko.observable(false);
-
- this.languages = ko.computed(function () {
- return _.map(RL.data().languages(), function (sLanguage) {
- return {
- 'key': sLanguage,
- 'selected': ko.observable(false),
- 'fullName': Utils.convertLangName(sLanguage)
- };
- });
- });
-
- RL.data().mainLanguage.subscribe(function () {
- this.resetMainLanguage();
- }, this);
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsLanguagesViewModel', PopupsLanguagesViewModel);
-
-PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
-{
- return Utils.convertLangName(sLanguage, true);
-};
-
-PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
-{
- var sCurrent = RL.data().mainLanguage();
- _.each(this.languages(), function (oItem) {
- oItem['selected'](oItem['key'] === sCurrent);
- });
-};
-
-PopupsLanguagesViewModel.prototype.onShow = function ()
-{
- this.exp(true);
-
- this.resetMainLanguage();
-};
-
-PopupsLanguagesViewModel.prototype.onHide = function ()
-{
- this.exp(false);
-};
-
-PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
-{
- RL.data().mainLanguage(sLang);
- this.cancelCommand();
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsTwoFactorTestViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsTwoFactorTest');
-
- var self = this;
-
- this.code = ko.observable('');
- this.code.focused = ko.observable(false);
- this.code.status = ko.observable(null);
-
- this.testing = ko.observable(false);
-
- // commands
- this.testCode = Utils.createCommand(this, function () {
-
- this.testing(true);
- RL.remote().testTwoFactor(function (sResult, oData) {
-
- self.testing(false);
- self.code.status(Enums.StorageResultType.Success === sResult && oData && oData.Result ? true : false);
-
- }, this.code());
-
- }, function () {
- return '' !== this.code() && !this.testing();
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsTwoFactorTestViewModel', PopupsTwoFactorTestViewModel);
-
-PopupsTwoFactorTestViewModel.prototype.clearPopup = function ()
-{
- this.code('');
- this.code.focused(false);
- this.code.status(null);
- this.testing(false);
-};
-
-PopupsTwoFactorTestViewModel.prototype.onShow = function ()
-{
- this.clearPopup();
-};
-
-PopupsTwoFactorTestViewModel.prototype.onFocus = function ()
-{
- this.code.focused(true);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsAskViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAsk');
-
- this.askDesc = ko.observable('');
- this.yesButton = ko.observable('');
- this.noButton = ko.observable('');
-
- this.yesFocus = ko.observable(false);
- this.noFocus = ko.observable(false);
-
- this.fYesAction = null;
- this.fNoAction = null;
-
- this.bDisabeCloseOnEsc = true;
- this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsAskViewModel', PopupsAskViewModel);
-
-PopupsAskViewModel.prototype.clearPopup = function ()
-{
- this.askDesc('');
- this.yesButton(Utils.i18n('POPUPS_ASK/BUTTON_YES'));
- this.noButton(Utils.i18n('POPUPS_ASK/BUTTON_NO'));
-
- this.yesFocus(false);
- this.noFocus(false);
-
- this.fYesAction = null;
- this.fNoAction = null;
-};
-
-PopupsAskViewModel.prototype.yesClick = function ()
-{
- this.cancelCommand();
-
- if (Utils.isFunc(this.fYesAction))
- {
- this.fYesAction.call(null);
- }
-};
-
-PopupsAskViewModel.prototype.noClick = function ()
-{
- this.cancelCommand();
-
- if (Utils.isFunc(this.fNoAction))
- {
- this.fNoAction.call(null);
- }
-};
-
-/**
- * @param {string} sAskDesc
- * @param {Function=} fYesFunc
- * @param {Function=} fNoFunc
- * @param {string=} sYesButton
- * @param {string=} sNoButton
- */
-PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton)
-{
- this.clearPopup();
-
- this.fYesAction = fYesFunc || null;
- this.fNoAction = fNoFunc || null;
-
- this.askDesc(sAskDesc || '');
- if (sYesButton)
- {
- this.yesButton(sYesButton);
- }
-
- if (sYesButton)
- {
- this.yesButton(sNoButton);
- }
-};
-
-PopupsAskViewModel.prototype.onFocus = function ()
-{
- this.yesFocus(true);
-};
-
-PopupsAskViewModel.prototype.onBuild = function ()
-{
- key('tab, shift+tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
- if (this.yesFocus())
- {
- this.noFocus(true);
- }
- else
- {
- this.yesFocus(true);
- }
- return false;
- }, this));
-
- key('esc', Enums.KeyState.PopupAsk, _.bind(function () {
- this.noClick();
- return false;
- }, this));
-};
-
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsKeyboardShortcutsHelpViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
-
- this.sDefaultKeyScope = Enums.KeyState.PopupKeyboardShortcutsHelp;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsKeyboardShortcutsHelpViewModel', PopupsKeyboardShortcutsHelpViewModel);
-
-PopupsKeyboardShortcutsHelpViewModel.prototype.onBuild = function (oDom)
-{
- key('tab, shift+tab, left, right', Enums.KeyState.PopupKeyboardShortcutsHelp, _.bind(function (event, handler) {
- if (event && handler)
- {
- var
- $tabs = oDom.find('.nav.nav-tabs > li'),
- bNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut),
- iIndex = $tabs.index($tabs.filter('.active'))
- ;
-
- if (!bNext && iIndex > 0)
- {
- iIndex--;
- }
- else if (bNext && iIndex < $tabs.length - 1)
- {
- iIndex++;
- }
- else
- {
- iIndex = bNext ? 0 : $tabs.length - 1;
- }
-
- $tabs.eq(iIndex).find('a[data-toggle="tab"]').tab('show');
- return false;
- }
- }, this));
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function PopupsFilterViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsFilter');
-
- this.filter = ko.observable(null);
-
- this.selectedFolderValue = ko.observable(Consts.Values.UnuseOptionValue);
- this.folderSelectList = RL.data().folderMenuForMove;
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('PopupsFilterViewModel', PopupsFilterViewModel);
-
-PopupsFilterViewModel.prototype.clearPopup = function ()
-{
-
-};
-
-PopupsFilterViewModel.prototype.onShow = function (oFilter)
-{
- this.clearPopup();
-
- this.filter(oFilter);
-};
-
-PopupsFilterViewModel.prototype.onFocus = function ()
-{
-
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function LoginViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Center', 'Login');
-
- var oData = RL.data();
-
- this.email = ko.observable('');
- this.password = ko.observable('');
- this.signMe = ko.observable(false);
-
- this.additionalCode = ko.observable('');
- this.additionalCode.error = ko.observable(false);
- this.additionalCode.focused = ko.observable(false);
- this.additionalCode.visibility = ko.observable(false);
- this.additionalCodeSignMe = ko.observable(false);
-
- this.logoImg = Utils.trim(RL.settingsGet('LoginLogo'));
- this.loginDescription = Utils.trim(RL.settingsGet('LoginDescription'));
- this.logoCss = Utils.trim(RL.settingsGet('LoginCss'));
-
- this.emailError = ko.observable(false);
- this.passwordError = ko.observable(false);
-
- this.emailFocus = ko.observable(false);
- this.submitFocus = ko.observable(false);
-
- this.email.subscribe(function () {
- this.emailError(false);
- this.additionalCode('');
- this.additionalCode.visibility(false);
- }, this);
-
- this.password.subscribe(function () {
- this.passwordError(false);
- }, this);
-
- this.additionalCode.subscribe(function () {
- this.additionalCode.error(false);
- }, this);
-
- this.additionalCode.visibility.subscribe(function () {
- this.additionalCode.error(false);
- }, this);
-
- this.submitRequest = ko.observable(false);
- this.submitError = ko.observable('');
-
- this.allowLanguagesOnLogin = oData.allowLanguagesOnLogin;
-
- this.langRequest = ko.observable(false);
- this.mainLanguage = oData.mainLanguage;
- this.bSendLanguage = false;
-
- this.mainLanguageFullName = ko.computed(function () {
- return Utils.convertLangName(this.mainLanguage());
- }, this);
-
- this.signMeType = ko.observable(Enums.LoginSignMeType.Unused);
-
- this.signMeType.subscribe(function (iValue) {
- this.signMe(Enums.LoginSignMeType.DefaultOn === iValue);
- }, this);
-
- this.signMeVisibility = ko.computed(function () {
- return Enums.LoginSignMeType.Unused !== this.signMeType();
- }, this);
-
- this.submitCommand = Utils.createCommand(this, function () {
-
- Utils.triggerAutocompleteInputChange();
-
- this.emailError('' === Utils.trim(this.email()));
- this.passwordError('' === Utils.trim(this.password()));
-
- if (this.additionalCode.visibility())
- {
- this.additionalCode.error('' === Utils.trim(this.additionalCode()));
- }
-
- if (this.emailError() || this.passwordError() || this.additionalCode.error())
- {
- return false;
- }
-
- this.submitRequest(true);
-
- var
- sPassword = this.password(),
-
- fLoginRequest = _.bind(function (sPassword) {
-
- RL.remote().login(_.bind(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
- {
- if (oData.Result)
- {
- if (oData.TwoFactorAuth)
- {
- this.additionalCode('');
- this.additionalCode.visibility(true);
- this.additionalCode.focused(true);
-
- this.submitRequest(false);
- }
- else
- {
- RL.loginAndLogoutReload();
- }
- }
- else if (oData.ErrorCode)
- {
- this.submitRequest(false);
- this.submitError(Utils.getNotification(oData.ErrorCode));
-
- if ('' === this.submitError())
- {
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
- }
- }
- else
- {
- this.submitRequest(false);
- }
- }
- else
- {
- this.submitRequest(false);
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
- }
-
- }, this), this.email(), '', sPassword, !!this.signMe(),
- this.bSendLanguage ? this.mainLanguage() : '',
- this.additionalCode.visibility() ? this.additionalCode() : '',
- this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
- );
-
- }, this)
- ;
-
- if (!!RL.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported)
- {
- RL.remote().getPublicKey(_.bind(function (sResult, oData) {
-
- var bRequest = false;
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
- Utils.isArray(oData.Result) && oData.Result[0] && oData.Result[1] && oData.Result[2])
- {
- var sEncryptedPassword = Utils.rsaEncode(sPassword, oData.Result[0], oData.Result[1], oData.Result[2]);
- if (sEncryptedPassword)
- {
- fLoginRequest(sEncryptedPassword);
- bRequest = true;
- }
- }
-
- if (!bRequest)
- {
- this.submitRequest(false);
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
- }
-
- }, this));
- }
- else
- {
- fLoginRequest(sPassword);
- }
-
- return true;
-
- }, function () {
- return !this.submitRequest();
- });
-
- this.facebookLoginEnabled = ko.observable(false);
-
- this.facebookCommand = Utils.createCommand(this, function () {
-
- window.open(RL.link().socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
- return true;
-
- }, function () {
- return !this.submitRequest() && this.facebookLoginEnabled();
- });
-
- this.googleLoginEnabled = ko.observable(false);
-
- this.googleCommand = Utils.createCommand(this, function () {
-
- window.open(RL.link().socialGoogle(), 'Google', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
- return true;
-
- }, function () {
- return !this.submitRequest() && this.googleLoginEnabled();
- });
-
- this.twitterLoginEnabled = ko.observable(false);
-
- this.twitterCommand = Utils.createCommand(this, function () {
-
- window.open(RL.link().socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
- return true;
-
- }, function () {
- return !this.submitRequest() && this.twitterLoginEnabled();
- });
-
- this.socialLoginEnabled = ko.computed(function () {
-
- var
- bF = this.facebookLoginEnabled(),
- bG = this.googleLoginEnabled(),
- bT = this.twitterLoginEnabled()
- ;
-
- return bF || bG || bT;
- }, this);
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('LoginViewModel', LoginViewModel);
-
-LoginViewModel.prototype.onShow = function ()
-{
- kn.routeOff();
-
- _.delay(_.bind(function () {
- if ('' !== this.email() && '' !== this.password())
- {
- this.submitFocus(true);
- }
- else
- {
- this.emailFocus(true);
- }
-
- if (RL.settingsGet('UserLanguage'))
- {
- $.cookie('rllang', RL.data().language(), {'expires': 30});
- }
-
- }, this), 100);
-};
-
-LoginViewModel.prototype.onHide = function ()
-{
- this.submitFocus(false);
- this.emailFocus(false);
-};
-
-LoginViewModel.prototype.onBuild = function ()
-{
- var
- self = this,
- sJsHash = RL.settingsGet('JsHash'),
- fSocial = function (iErrorCode) {
- iErrorCode = Utils.pInt(iErrorCode);
- if (0 === iErrorCode)
- {
- self.submitRequest(true);
- RL.loginAndLogoutReload();
- }
- else
- {
- self.submitError(Utils.getNotification(iErrorCode));
- }
- }
- ;
-
- this.facebookLoginEnabled(!!RL.settingsGet('AllowFacebookSocial'));
- this.twitterLoginEnabled(!!RL.settingsGet('AllowTwitterSocial'));
- this.googleLoginEnabled(!!RL.settingsGet('AllowGoogleSocial'));
-
- switch ((RL.settingsGet('SignMe') || 'unused').toLowerCase())
- {
- case Enums.LoginSignMeTypeAsString.DefaultOff:
- this.signMeType(Enums.LoginSignMeType.DefaultOff);
- break;
- case Enums.LoginSignMeTypeAsString.DefaultOn:
- this.signMeType(Enums.LoginSignMeType.DefaultOn);
- break;
- default:
- case Enums.LoginSignMeTypeAsString.Unused:
- this.signMeType(Enums.LoginSignMeType.Unused);
- break;
- }
-
- this.email(RL.data().devEmail);
- this.password(RL.data().devPassword);
-
- if (this.googleLoginEnabled())
- {
- window['rl_' + sJsHash + '_google_login_service'] = fSocial;
- }
-
- if (this.facebookLoginEnabled())
- {
- window['rl_' + sJsHash + '_facebook_login_service'] = fSocial;
- }
-
- if (this.twitterLoginEnabled())
- {
- window['rl_' + sJsHash + '_twitter_login_service'] = fSocial;
- }
-
- _.delay(function () {
- RL.data().language.subscribe(function (sValue) {
- self.langRequest(true);
- $.ajax({
- 'url': RL.link().langLink(sValue),
- 'dataType': 'script',
- 'cache': true
- }).done(function() {
- self.bSendLanguage = true;
- Utils.i18nToDoc();
- $.cookie('rllang', RL.data().language(), {'expires': 30});
- }).always(function() {
- self.langRequest(false);
- });
- });
- }, 50);
-
- Utils.triggerAutocompleteInputChange(true);
-
-};
-
-LoginViewModel.prototype.submitForm = function ()
-{
- this.submitCommand();
-};
-
-LoginViewModel.prototype.selectLanguage = function ()
-{
- kn.showScreenPopup(PopupsLanguagesViewModel);
-};
-
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function AbstractSystemDropDownViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Right', 'SystemDropDown');
-
- var oData = RL.data();
-
- this.accounts = oData.accounts;
- this.accountEmail = oData.accountEmail;
- this.accountsLoading = oData.accountsLoading;
-
- this.accountMenuDropdownTrigger = ko.observable(false);
-
- this.capaAdditionalAccounts = RL.capa(Enums.Capa.AdditionalAccounts);
-
- this.loading = ko.computed(function () {
- return this.accountsLoading();
- }, this);
-
- this.accountClick = _.bind(this.accountClick, this);
-}
-
-_.extend(AbstractSystemDropDownViewModel.prototype, KnoinAbstractViewModel.prototype);
-
-AbstractSystemDropDownViewModel.prototype.accountClick = function (oAccount, oEvent)
-{
- if (oAccount && oEvent && !Utils.isUnd(oEvent.which) && 1 === oEvent.which)
- {
- var self = this;
- this.accountsLoading(true);
- _.delay(function () {
- self.accountsLoading(false);
- }, 1000);
- }
-
- return true;
-};
-
-AbstractSystemDropDownViewModel.prototype.emailTitle = function ()
-{
- return RL.data().accountEmail();
-};
-
-AbstractSystemDropDownViewModel.prototype.settingsClick = function ()
-{
- kn.setHash(RL.link().settings());
-};
-
-AbstractSystemDropDownViewModel.prototype.settingsHelp = function ()
-{
- kn.showScreenPopup(PopupsKeyboardShortcutsHelpViewModel);
-};
-
-AbstractSystemDropDownViewModel.prototype.addAccountClick = function ()
-{
- if (this.capaAdditionalAccounts)
- {
- kn.showScreenPopup(PopupsAddAccountViewModel);
- }
-};
-
-AbstractSystemDropDownViewModel.prototype.logoutClick = function ()
-{
- RL.remote().logout(function () {
- if (window.__rlah_clear)
- {
- window.__rlah_clear();
- }
-
- RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length);
- });
-};
-
-AbstractSystemDropDownViewModel.prototype.onBuild = function ()
-{
- var self = this;
- key('`', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function () {
- if (self.viewModelVisibility())
- {
- self.accountMenuDropdownTrigger(true);
- }
- });
-
- // shortcuts help
- key('shift+/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function () {
- if (self.viewModelVisibility())
- {
- kn.showScreenPopup(PopupsKeyboardShortcutsHelpViewModel);
- return false;
- }
- });
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractSystemDropDownViewModel
- */
-function MailBoxSystemDropDownViewModel()
-{
- AbstractSystemDropDownViewModel.call(this);
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractSystemDropDownViewModel
- */
-function SettingsSystemDropDownViewModel()
-{
- AbstractSystemDropDownViewModel.call(this);
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function MailBoxFolderListViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Left', 'MailFolderList');
-
- var oData = RL.data();
-
- this.oContentVisible = null;
- this.oContentScrollable = null;
-
- this.messageList = oData.messageList;
- this.folderList = oData.folderList;
- this.folderListSystem = oData.folderListSystem;
- this.foldersChanging = oData.foldersChanging;
-
- this.leftPanelDisabled = oData.leftPanelDisabled;
-
- this.iDropOverTimer = 0;
-
- this.allowContacts = !!RL.settingsGet('ContactsIsAllowed');
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('MailBoxFolderListViewModel', MailBoxFolderListViewModel);
-
-MailBoxFolderListViewModel.prototype.onBuild = function (oDom)
-{
- this.oContentVisible = $('.b-content', oDom);
- this.oContentScrollable = $('.content', this.oContentVisible);
-
- var self = this;
-
- oDom
- .on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function (oEvent) {
-
- var
- oFolder = ko.dataFor(this),
- bCollapsed = false
- ;
-
- if (oFolder && oEvent)
- {
- bCollapsed = oFolder.collapsed();
- Utils.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
-
- oFolder.collapsed(!bCollapsed);
- oEvent.preventDefault();
- oEvent.stopPropagation();
- }
- })
- .on('click', '.b-folders .e-item .e-link.selectable', function (oEvent) {
-
- oEvent.preventDefault();
-
- var
- oData = RL.data(),
- oFolder = ko.dataFor(this)
- ;
-
- if (oFolder)
- {
- if (Enums.Layout.NoPreview === oData.layout())
- {
- oData.message(null);
- }
-
- if (oFolder.fullNameRaw === oData.currentFolderFullNameRaw())
- {
- RL.cache().setFolderHash(oFolder.fullNameRaw, '');
- }
-
- kn.setHash(RL.link().mailBox(oFolder.fullNameHash));
- }
- })
- ;
-
- key('up, down', Enums.KeyState.FolderList, function (event, handler) {
-
- var
- iIndex = -1,
- iKeyCode = handler && 'up' === handler.shortcut ? 38 : 40,
- $items = $('.b-folders .e-item .e-link:not(.hidden):visible', oDom)
- ;
-
- if (event && $items.length)
- {
- iIndex = $items.index($items.filter('.focused'));
- if (-1 < iIndex)
- {
- $items.eq(iIndex).removeClass('focused');
- }
-
- if (iKeyCode === 38 && iIndex > 0)
- {
- iIndex--;
- }
- else if (iKeyCode === 40 && iIndex < $items.length - 1)
- {
- iIndex++;
- }
-
- $items.eq(iIndex).addClass('focused');
- self.scrollToFocused();
- }
-
- return false;
- });
-
- key('enter', Enums.KeyState.FolderList, function () {
- var $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
- if ($items.length && $items[0])
- {
- self.folderList.focused(false);
- $items.click();
- }
-
- return false;
- });
-
- key('space', Enums.KeyState.FolderList, function () {
- var bCollapsed = true, oFolder = null, $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
- if ($items.length && $items[0])
- {
- oFolder = ko.dataFor($items[0]);
- if (oFolder)
- {
- bCollapsed = oFolder.collapsed();
- Utils.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
- oFolder.collapsed(!bCollapsed);
- }
- }
-
- return false;
- });
-
- key('esc, tab, shift+tab, right', Enums.KeyState.FolderList, function () {
- self.folderList.focused(false);
- return false;
- });
-
- self.folderList.focused.subscribe(function (bValue) {
- $('.b-folders .e-item .e-link.focused', oDom).removeClass('focused');
- if (bValue)
- {
- $('.b-folders .e-item .e-link.selected', oDom).addClass('focused');
- }
- });
-};
-
-MailBoxFolderListViewModel.prototype.messagesDropOver = function (oFolder)
-{
- window.clearTimeout(this.iDropOverTimer);
- if (oFolder && oFolder.collapsed())
- {
- this.iDropOverTimer = window.setTimeout(function () {
- oFolder.collapsed(false);
- Utils.setExpandedFolder(oFolder.fullNameHash, true);
- Utils.windowResize();
- }, 500);
- }
-};
-
-MailBoxFolderListViewModel.prototype.messagesDropOut = function ()
-{
- window.clearTimeout(this.iDropOverTimer);
-};
-
-MailBoxFolderListViewModel.prototype.scrollToFocused = function ()
-{
- if (!this.oContentVisible || !this.oContentScrollable)
- {
- return false;
- }
-
- var
- iOffset = 20,
- oFocused = $('.e-item .e-link.focused', this.oContentScrollable),
- oPos = oFocused.position(),
- iVisibleHeight = this.oContentVisible.height(),
- iFocusedHeight = oFocused.outerHeight()
- ;
-
- if (oPos && (oPos.top < 0 || oPos.top + iFocusedHeight > iVisibleHeight))
- {
- if (oPos.top < 0)
- {
- this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iOffset);
- }
- else
- {
- this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iVisibleHeight + iFocusedHeight + iOffset);
- }
-
- return true;
- }
-
- return false;
-};
-
-/**
- *
- * @param {FolderModel} oToFolder
- * @param {{helper:jQuery}} oUi
- */
-MailBoxFolderListViewModel.prototype.messagesDrop = function (oToFolder, oUi)
-{
- if (oToFolder && oUi && oUi.helper)
- {
- var
- sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
- bCopy = $html.hasClass('rl-ctrl-key-pressed'),
- aUids = oUi.helper.data('rl-uids')
- ;
-
- if (Utils.isNormal(sFromFolderFullNameRaw) && '' !== sFromFolderFullNameRaw && Utils.isArray(aUids))
- {
- RL.moveMessagesToFolder(sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
- }
- }
-};
-
-MailBoxFolderListViewModel.prototype.composeClick = function ()
-{
- kn.showScreenPopup(PopupsComposeViewModel);
-};
-
-MailBoxFolderListViewModel.prototype.createFolder = function ()
-{
- kn.showScreenPopup(PopupsFolderCreateViewModel);
-};
-
-MailBoxFolderListViewModel.prototype.configureFolders = function ()
-{
- kn.setHash(RL.link().settings('folders'));
-};
-
-MailBoxFolderListViewModel.prototype.contactsClick = function ()
-{
- if (this.allowContacts)
- {
- kn.showScreenPopup(PopupsContactsViewModel);
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function MailBoxMessageListViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Right', 'MailMessageList');
-
- this.sLastUid = null;
- this.bPrefetch = false;
- this.emptySubjectValue = '';
-
- this.hideDangerousActions = !!RL.settingsGet('HideDangerousActions');
-
- var oData = RL.data();
-
- this.popupVisibility = RL.popupVisibility;
-
- this.message = oData.message;
- this.messageList = oData.messageList;
- this.folderList = oData.folderList;
- this.currentMessage = oData.currentMessage;
- this.isMessageSelected = oData.isMessageSelected;
- this.messageListSearch = oData.messageListSearch;
- this.messageListError = oData.messageListError;
- this.folderMenuForMove = oData.folderMenuForMove;
-
- this.useCheckboxesInList = oData.useCheckboxesInList;
-
- this.mainMessageListSearch = oData.mainMessageListSearch;
- this.messageListEndFolder = oData.messageListEndFolder;
-
- this.messageListChecked = oData.messageListChecked;
- this.messageListCheckedOrSelected = oData.messageListCheckedOrSelected;
- this.messageListCheckedOrSelectedUidsWithSubMails = oData.messageListCheckedOrSelectedUidsWithSubMails;
- this.messageListCompleteLoadingThrottle = oData.messageListCompleteLoadingThrottle;
-
- Utils.initOnStartOrLangChange(function () {
- this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
- }, this);
-
- this.userQuota = oData.userQuota;
- this.userUsageSize = oData.userUsageSize;
- this.userUsageProc = oData.userUsageProc;
-
- this.moveDropdownTrigger = ko.observable(false);
- this.moreDropdownTrigger = ko.observable(false);
-
- // append drag and drop
- this.dragOver = ko.observable(false).extend({'throttle': 1});
- this.dragOverEnter = ko.observable(false).extend({'throttle': 1});
- this.dragOverArea = ko.observable(null);
- this.dragOverBodyArea = ko.observable(null);
-
- this.messageListItemTemplate = ko.computed(function () {
- return Enums.Layout.NoPreview !== oData.layout() ?
- 'MailMessageListItem' : 'MailMessageListItemNoPreviewPane';
- });
-
- this.messageListSearchDesc = ko.computed(function () {
- var sValue = oData.messageListEndSearch();
- return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
- });
-
- this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(oData.messageListPage, oData.messageListPageCount));
-
- this.checkAll = ko.computed({
- 'read': function () {
- return 0 < RL.data().messageListChecked().length;
- },
-
- 'write': function (bValue) {
- bValue = !!bValue;
- _.each(RL.data().messageList(), function (oMessage) {
- oMessage.checked(bValue);
- });
- }
- });
-
- this.inputMessageListSearchFocus = ko.observable(false);
-
- this.sLastSearchValue = '';
- this.inputProxyMessageListSearch = ko.computed({
- 'read': this.mainMessageListSearch,
- 'write': function (sValue) {
- this.sLastSearchValue = sValue;
- },
- 'owner': this
- });
-
- this.isIncompleteChecked = ko.computed(function () {
- var
- iM = RL.data().messageList().length,
- iC = RL.data().messageListChecked().length
- ;
- return 0 < iM && 0 < iC && iM > iC;
- }, this);
-
- this.hasMessages = ko.computed(function () {
- return 0 < this.messageList().length;
- }, this);
-
- this.hasCheckedOrSelectedLines = ko.computed(function () {
- return 0 < this.messageListCheckedOrSelected().length;
- }, this);
-
- this.isSpamFolder = ko.computed(function () {
- return oData.spamFolder() === this.messageListEndFolder() &&
- '' !== oData.spamFolder();
- }, this);
-
- this.isSpamDisabled = ko.computed(function () {
- return Consts.Values.UnuseOptionValue === oData.spamFolder();
- }, this);
-
- this.isTrashFolder = ko.computed(function () {
- return oData.trashFolder() === this.messageListEndFolder() &&
- '' !== oData.trashFolder();
- }, this);
-
- this.isDraftFolder = ko.computed(function () {
- return oData.draftFolder() === this.messageListEndFolder() &&
- '' !== oData.draftFolder();
- }, this);
-
- this.isSentFolder = ko.computed(function () {
- return oData.sentFolder() === this.messageListEndFolder() &&
- '' !== oData.sentFolder();
- }, this);
-
- this.isArchiveFolder = ko.computed(function () {
- return oData.archiveFolder() === this.messageListEndFolder() &&
- '' !== oData.archiveFolder();
- }, this);
-
- this.isArchiveDisabled = ko.computed(function () {
- return Consts.Values.UnuseOptionValue === RL.data().archiveFolder();
- }, this);
-
- this.canBeMoved = this.hasCheckedOrSelectedLines;
-
- this.clearCommand = Utils.createCommand(this, function () {
- kn.showScreenPopup(PopupsFolderClearViewModel, [RL.data().currentFolder()]);
- });
-
- this.multyForwardCommand = Utils.createCommand(this, function () {
- kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.ForwardAsAttachment, RL.data().messageListCheckedOrSelected()]);
- }, this.canBeMoved);
-
- this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
- RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
- RL.data().currentFolderFullNameRaw(),
- RL.data().messageListCheckedOrSelectedUidsWithSubMails(), false);
- }, this.canBeMoved);
-
- this.deleteCommand = Utils.createCommand(this, function () {
- RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
- RL.data().currentFolderFullNameRaw(),
- RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.archiveCommand = Utils.createCommand(this, function () {
- RL.deleteMessagesFromFolder(Enums.FolderType.Archive,
- RL.data().currentFolderFullNameRaw(),
- RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.spamCommand = Utils.createCommand(this, function () {
- RL.deleteMessagesFromFolder(Enums.FolderType.Spam,
- RL.data().currentFolderFullNameRaw(),
- RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.notSpamCommand = Utils.createCommand(this, function () {
- RL.deleteMessagesFromFolder(Enums.FolderType.NotSpam,
- RL.data().currentFolderFullNameRaw(),
- RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.moveCommand = Utils.createCommand(this, Utils.emptyFunction, this.canBeMoved);
-
- this.reloadCommand = Utils.createCommand(this, function () {
- if (!RL.data().messageListCompleteLoadingThrottle())
- {
- RL.reloadMessageList(false, true);
- }
- });
-
- this.quotaTooltip = _.bind(this.quotaTooltip, this);
-
- this.selector = new Selector(this.messageList, this.currentMessage,
- '.messageListItem .actionHandle', '.messageListItem.selected', '.messageListItem .checkboxMessage',
- '.messageListItem.focused');
-
- this.selector.on('onItemSelect', _.bind(function (oMessage) {
- if (oMessage)
- {
- oData.message(oData.staticMessageList.populateByMessageListItem(oMessage));
- this.populateMessageBody(oData.message());
-
- if (Enums.Layout.NoPreview === oData.layout())
- {
- kn.setHash(RL.link().messagePreview(), true);
- oData.message.focused(true);
- }
- }
- else
- {
- oData.message(null);
- }
- }, this));
-
- this.selector.on('onItemGetUid', function (oMessage) {
- return oMessage ? oMessage.generateUid() : '';
- });
-
- oData.messageListEndHash.subscribe(function () {
- this.selector.scrollToTop();
- }, this);
-
- oData.layout.subscribe(function (mValue) {
- this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
- }, this);
-
- oData.layout.valueHasMutated();
-
- RL
- .sub('mailbox.message-list.selector.go-down', function () {
- this.selector.goDown(true);
- }, this)
- .sub('mailbox.message-list.selector.go-up', function () {
- this.selector.goUp(true);
- }, this)
- ;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('MailBoxMessageListViewModel', MailBoxMessageListViewModel);
-
-/**
- * @type {string}
- */
-MailBoxMessageListViewModel.prototype.emptySubjectValue = '';
-
-MailBoxMessageListViewModel.prototype.searchEnterAction = function ()
-{
- this.mainMessageListSearch(this.sLastSearchValue);
- this.inputMessageListSearchFocus(false);
-};
-
-/**
- * @returns {string}
- */
-MailBoxMessageListViewModel.prototype.printableMessageCountForDeletion = function ()
-{
- var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
- return 1 < iCnt ? ' (' + (100 > iCnt ? iCnt : '99+') + ')' : '';
-};
-
-MailBoxMessageListViewModel.prototype.cancelSearch = function ()
-{
- this.mainMessageListSearch('');
- this.inputMessageListSearchFocus(false);
-};
-
-/**
- * @param {string} sToFolderFullNameRaw
- * @return {boolean}
- */
-MailBoxMessageListViewModel.prototype.moveSelectedMessagesToFolder = function (sToFolderFullNameRaw, bCopy)
-{
- if (this.canBeMoved())
- {
- RL.moveMessagesToFolder(
- RL.data().currentFolderFullNameRaw(),
- RL.data().messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy);
- }
-
- return false;
-};
-
-MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem)
-{
- if (oMessageListItem)
- {
- oMessageListItem.checked(true);
- }
-
- var
- oEl = Utils.draggeblePlace(),
- aUids = RL.data().messageListCheckedOrSelectedUidsWithSubMails()
- ;
-
- oEl.data('rl-folder', RL.data().currentFolderFullNameRaw());
- oEl.data('rl-uids', aUids);
- oEl.find('.text').text('' + aUids.length);
-
- _.defer(function () {
- var aUids = RL.data().messageListCheckedOrSelectedUidsWithSubMails();
-
- oEl.data('rl-uids', aUids);
- oEl.find('.text').text('' + aUids.length);
- });
-
- return oEl;
-};
-
-/**
- * @param {string} sResult
- * @param {AjaxJsonDefaultResponse} oData
- * @param {boolean} bCached
- */
-MailBoxMessageListViewModel.prototype.onMessageResponse = function (sResult, oData, bCached)
-{
- var oRainLoopData = RL.data();
-
- oRainLoopData.hideMessageBodies();
- oRainLoopData.messageLoading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- oRainLoopData.setMessage(oData, bCached);
- }
- else if (Enums.StorageResultType.Unload === sResult)
- {
- oRainLoopData.message(null);
- oRainLoopData.messageError('');
- }
- else if (Enums.StorageResultType.Abort !== sResult)
- {
- oRainLoopData.message(null);
- oRainLoopData.messageError((oData && oData.ErrorCode ?
- Utils.getNotification(oData.ErrorCode) :
- Utils.getNotification(Enums.Notification.UnknownError)));
- }
-};
-
-MailBoxMessageListViewModel.prototype.populateMessageBody = function (oMessage)
-{
- if (oMessage)
- {
- if (RL.remote().message(this.onMessageResponse, oMessage.folderFullNameRaw, oMessage.uid))
- {
- RL.data().messageLoading(true);
- }
- else
- {
- Utils.log('Error: Unknown message request: ' + oMessage.folderFullNameRaw + ' ~ ' + oMessage.uid + ' [e-101]');
- }
- }
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {number} iSetAction
- * @param {Array=} aMessages = null
- */
-MailBoxMessageListViewModel.prototype.setAction = function (sFolderFullNameRaw, iSetAction, aMessages)
-{
- var
- aUids = [],
- oFolder = null,
- oCache = RL.cache(),
- iAlreadyUnread = 0
- ;
-
- if (Utils.isUnd(aMessages))
- {
- aMessages = RL.data().messageListChecked();
- }
-
- aUids = _.map(aMessages, function (oMessage) {
- return oMessage.uid;
- });
-
- if ('' !== sFolderFullNameRaw && 0 < aUids.length)
- {
- switch (iSetAction) {
- case Enums.MessageSetAction.SetSeen:
- _.each(aMessages, function (oMessage) {
- if (oMessage.unseen())
- {
- iAlreadyUnread++;
- }
-
- oMessage.unseen(false);
- oCache.storeMessageFlagsToCache(oMessage);
- });
-
- oFolder = oCache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
- }
-
- RL.remote().messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aUids, true);
- break;
- case Enums.MessageSetAction.UnsetSeen:
- _.each(aMessages, function (oMessage) {
- if (oMessage.unseen())
- {
- iAlreadyUnread++;
- }
-
- oMessage.unseen(true);
- oCache.storeMessageFlagsToCache(oMessage);
- });
-
- oFolder = oCache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread + aUids.length);
- }
- RL.remote().messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aUids, false);
- break;
- case Enums.MessageSetAction.SetFlag:
- _.each(aMessages, function (oMessage) {
- oMessage.flagged(true);
- oCache.storeMessageFlagsToCache(oMessage);
- });
- RL.remote().messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aUids, true);
- break;
- case Enums.MessageSetAction.UnsetFlag:
- _.each(aMessages, function (oMessage) {
- oMessage.flagged(false);
- oCache.storeMessageFlagsToCache(oMessage);
- });
- RL.remote().messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aUids, false);
- break;
- }
-
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {number} iSetAction
- */
-MailBoxMessageListViewModel.prototype.setActionForAll = function (sFolderFullNameRaw, iSetAction)
-{
- var
- oFolder = null,
- aMessages = RL.data().messageList(),
- oCache = RL.cache()
- ;
-
- if ('' !== sFolderFullNameRaw)
- {
- oFolder = oCache.getFolderFromCacheList(sFolderFullNameRaw);
-
- if (oFolder)
- {
- switch (iSetAction) {
- case Enums.MessageSetAction.SetSeen:
- oFolder = oCache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- _.each(aMessages, function (oMessage) {
- oMessage.unseen(false);
- });
-
- oFolder.messageCountUnread(0);
- oCache.clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
- }
-
- RL.remote().messageSetSeenToAll(Utils.emptyFunction, sFolderFullNameRaw, true);
- break;
- case Enums.MessageSetAction.UnsetSeen:
- oFolder = oCache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- _.each(aMessages, function (oMessage) {
- oMessage.unseen(true);
- });
-
- oFolder.messageCountUnread(oFolder.messageCountAll());
- oCache.clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
- }
- RL.remote().messageSetSeenToAll(Utils.emptyFunction, sFolderFullNameRaw, false);
- break;
- }
-
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- }
-};
-
-MailBoxMessageListViewModel.prototype.listSetSeen = function ()
-{
- this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen, RL.data().messageListCheckedOrSelected());
-};
-
-MailBoxMessageListViewModel.prototype.listSetAllSeen = function ()
-{
- this.setActionForAll(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen);
-};
-
-MailBoxMessageListViewModel.prototype.listUnsetSeen = function ()
-{
- this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetSeen, RL.data().messageListCheckedOrSelected());
-};
-
-MailBoxMessageListViewModel.prototype.listSetFlags = function ()
-{
- this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetFlag, RL.data().messageListCheckedOrSelected());
-};
-
-MailBoxMessageListViewModel.prototype.listUnsetFlags = function ()
-{
- this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, RL.data().messageListCheckedOrSelected());
-};
-
-MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage)
-{
- var
- aChecked = this.messageListCheckedOrSelected(),
- aCheckedUids = []
- ;
-
- if (oCurrentMessage)
- {
- if (0 < aChecked.length)
- {
- aCheckedUids = _.map(aChecked, function (oMessage) {
- return oMessage.uid;
- });
- }
-
- if (0 < aCheckedUids.length && -1 < Utils.inArray(oCurrentMessage.uid, aCheckedUids))
- {
- this.setAction(oCurrentMessage.folderFullNameRaw, oCurrentMessage.flagged() ?
- Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked);
- }
- else
- {
- this.setAction(oCurrentMessage.folderFullNameRaw, oCurrentMessage.flagged() ?
- Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, [oCurrentMessage]);
- }
- }
-};
-
-MailBoxMessageListViewModel.prototype.flagMessagesFast = function (bFlag)
-{
- var
- aChecked = this.messageListCheckedOrSelected(),
- aFlagged = []
- ;
-
- if (0 < aChecked.length)
- {
- aFlagged = _.filter(aChecked, function (oMessage) {
- return oMessage.flagged();
- });
-
- if (Utils.isUnd(bFlag))
- {
- this.setAction(aChecked[0].folderFullNameRaw,
- aChecked.length === aFlagged.length ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked);
- }
- else
- {
- this.setAction(aChecked[0].folderFullNameRaw,
- !bFlag ? Enums.MessageSetAction.UnsetFlag : Enums.MessageSetAction.SetFlag, aChecked);
- }
- }
-};
-
-MailBoxMessageListViewModel.prototype.seenMessagesFast = function (bSeen)
-{
- var
- aChecked = this.messageListCheckedOrSelected(),
- aUnseen = []
- ;
-
- if (0 < aChecked.length)
- {
- aUnseen = _.filter(aChecked, function (oMessage) {
- return oMessage.unseen();
- });
-
- if (Utils.isUnd(bSeen))
- {
- this.setAction(aChecked[0].folderFullNameRaw,
- 0 < aUnseen.length ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked);
- }
- else
- {
- this.setAction(aChecked[0].folderFullNameRaw,
- bSeen ? Enums.MessageSetAction.SetSeen : Enums.MessageSetAction.UnsetSeen, aChecked);
- }
- }
-};
-
-MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
-{
- var
- self = this,
- oData = RL.data()
- ;
-
- this.oContentVisible = $('.b-content', oDom);
- this.oContentScrollable = $('.content', this.oContentVisible);
-
- this.oContentVisible.on('click', '.fullThreadHandle', function () {
- var
- aList = [],
- oMessage = ko.dataFor(this)
- ;
-
- if (oMessage && !oMessage.lastInCollapsedThreadLoading())
- {
- RL.data().messageListThreadFolder(oMessage.folderFullNameRaw);
-
- aList = RL.data().messageListThreadUids();
-
- if (oMessage.lastInCollapsedThread())
- {
- aList.push(0 < oMessage.parentUid() ? oMessage.parentUid() : oMessage.uid);
- }
- else
- {
- aList = _.without(aList, 0 < oMessage.parentUid() ? oMessage.parentUid() : oMessage.uid);
- }
-
- RL.data().messageListThreadUids(_.uniq(aList));
-
- oMessage.lastInCollapsedThreadLoading(true);
- oMessage.lastInCollapsedThread(!oMessage.lastInCollapsedThread());
- RL.reloadMessageList();
- }
-
- return false;
- });
-
- this.selector.init(this.oContentVisible, this.oContentScrollable, Enums.KeyState.MessageList);
-
- oDom
- .on('click', '.messageList .b-message-list-wrapper', function () {
- if (self.message.focused())
- {
- self.message.focused(false);
- }
- })
- .on('click', '.e-pagenator .e-page', function () {
- var oPage = ko.dataFor(this);
- if (oPage)
- {
- kn.setHash(RL.link().mailBox(
- oData.currentFolderFullNameHash(),
- oPage.value,
- oData.messageListSearch()
- ));
- }
- })
- .on('click', '.messageList .checkboxCkeckAll', function () {
- self.checkAll(!self.checkAll());
- })
- .on('click', '.messageList .messageListItem .flagParent', function () {
- self.flagMessages(ko.dataFor(this));
- })
- ;
-
- this.initUploaderForAppend();
- this.initShortcuts();
-
- if (!Globals.bMobileDevice && RL.capa(Enums.Capa.Prefetch) && ifvisible)
- {
- ifvisible.setIdleDuration(10);
-
- ifvisible.idle(function () {
- self.prefetchNextTick();
- });
- }
-};
-
-MailBoxMessageListViewModel.prototype.initShortcuts = function ()
-{
- var self = this;
-
- // disable print
- key('ctrl+p, command+p', Enums.KeyState.MessageList, function () {
- return false;
- });
-
- // archive (zip)
- key('z', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.archiveCommand();
- return false;
- });
-
- // delete
- key('delete, shift+delete, shift+3', Enums.KeyState.MessageList, function (event, handler) {
- if (event)
- {
- if (0 < RL.data().messageListCheckedOrSelected().length)
- {
- if (handler && 'shift+delete' === handler.shortcut)
- {
- self.deleteWithoutMoveCommand();
- }
- else
- {
- self.deleteCommand();
- }
- }
-
- return false;
- }
- });
-
- // check mail
- key('ctrl+r, command+r', [Enums.KeyState.FolderList, Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.reloadCommand();
- return false;
- });
-
- // check all
- key('ctrl+a, command+a', Enums.KeyState.MessageList, function () {
- self.checkAll(!(self.checkAll() && !self.isIncompleteChecked()));
- return false;
- });
-
- // write/compose (open compose popup)
- key('w,c', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- kn.showScreenPopup(PopupsComposeViewModel);
- return false;
- });
-
- // important - star/flag messages
- key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.flagMessagesFast();
- return false;
- });
-
- // move
- key('m', Enums.KeyState.MessageList, function () {
- self.moveDropdownTrigger(true);
- return false;
- });
-
- // read
- key('q', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.seenMessagesFast(true);
- return false;
- });
-
- // unread
- key('u', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.seenMessagesFast(false);
- return false;
- });
-
- key('shift+f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.multyForwardCommand();
- return false;
- });
-
- // search input focus
- key('/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- self.inputMessageListSearchFocus(true);
- return false;
- });
-
- // cancel search
- key('esc', Enums.KeyState.MessageList, function () {
- if ('' !== self.messageListSearchDesc())
- {
- self.cancelSearch();
- return false;
- }
- });
-
- // change focused state
- key('tab, shift+tab, left, right', Enums.KeyState.MessageList, function (event, handler) {
- if (event && handler && 'shift+tab' === handler.shortcut || 'left' === handler.shortcut)
- {
- self.folderList.focused(true);
- }
- else if (self.message())
- {
- self.message.focused(true);
- }
-
- return false;
- });
-
- // TODO
- key('ctrl+left, command+left', Enums.KeyState.MessageView, function () {
- return false;
- });
-
- // TODO
- key('ctrl+right, command+right', Enums.KeyState.MessageView, function () {
- return false;
- });
-};
-
-MailBoxMessageListViewModel.prototype.prefetchNextTick = function ()
-{
- if (!this.bPrefetch && !ifvisible.now() && this.viewModelVisibility())
- {
- var
- self = this,
- oCache = RL.cache(),
- oMessage = _.find(this.messageList(), function (oMessage) {
- return oMessage &&
- !oCache.hasRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
- })
- ;
-
- if (oMessage)
- {
- this.bPrefetch = true;
-
- RL.cache().addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
-
- RL.remote().message(function (sResult, oData) {
-
- var bNext = !!(Enums.StorageResultType.Success === sResult && oData && oData.Result);
-
- _.delay(function () {
- self.bPrefetch = false;
- if (bNext)
- {
- self.prefetchNextTick();
- }
- }, 1000);
-
- }, oMessage.folderFullNameRaw, oMessage.uid);
- }
- }
-};
-
-MailBoxMessageListViewModel.prototype.composeClick = function ()
-{
- kn.showScreenPopup(PopupsComposeViewModel);
-};
-
-MailBoxMessageListViewModel.prototype.advancedSearchClick = function ()
-{
- kn.showScreenPopup(PopupsAdvancedSearchViewModel);
-};
-
-MailBoxMessageListViewModel.prototype.quotaTooltip = function ()
-{
- return Utils.i18n('MESSAGE_LIST/QUOTA_SIZE', {
- 'SIZE': Utils.friendlySize(this.userUsageSize()),
- 'PROC': this.userUsageProc(),
- 'LIMIT': Utils.friendlySize(this.userQuota())
- });
-};
-
-MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
-{
- if (!RL.settingsGet('AllowAppendMessage') || !this.dragOverArea())
- {
- return false;
- }
-
- var oJua = new Jua({
- 'action': RL.link().append(),
- 'name': 'AppendFile',
- 'queueSize': 1,
- 'multipleSizeLimit': 1,
- 'disableFolderDragAndDrop': true,
- 'hidden': {
- 'Folder': function () {
- return RL.data().currentFolderFullNameRaw();
- }
- },
- 'dragAndDropElement': this.dragOverArea(),
- 'dragAndDropBodyElement': this.dragOverBodyArea()
- });
-
- oJua
- .on('onDragEnter', _.bind(function () {
- this.dragOverEnter(true);
- }, this))
- .on('onDragLeave', _.bind(function () {
- this.dragOverEnter(false);
- }, this))
- .on('onBodyDragEnter', _.bind(function () {
- this.dragOver(true);
- }, this))
- .on('onBodyDragLeave', _.bind(function () {
- this.dragOver(false);
- }, this))
- .on('onSelect', _.bind(function (sUid, oData) {
- if (sUid && oData && 'message/rfc822' === oData['Type'])
- {
- RL.data().messageListLoading(true);
- return true;
- }
-
- return false;
- }, this))
- .on('onComplete', _.bind(function () {
- RL.reloadMessageList(true, true);
- }, this))
- ;
-
- return !!oJua;
-};
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function MailBoxMessageViewViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Right', 'MailMessageView');
-
- var
- self = this,
- sLastEmail = '',
- oData = RL.data(),
- createCommandHelper = function (sType) {
- return Utils.createCommand(self, function () {
- this.replyOrforward(sType);
- }, self.canBeRepliedOrForwarded);
- }
- ;
-
- this.oMessageScrollerDom = null;
-
- this.keyScope = oData.keyScope;
- this.message = oData.message;
- this.currentMessage = oData.currentMessage;
- this.messageListChecked = oData.messageListChecked;
- this.hasCheckedMessages = oData.hasCheckedMessages;
- this.messageListCheckedOrSelectedUidsWithSubMails = oData.messageListCheckedOrSelectedUidsWithSubMails;
- this.messageLoading = oData.messageLoading;
- this.messageLoadingThrottle = oData.messageLoadingThrottle;
- this.messagesBodiesDom = oData.messagesBodiesDom;
- this.useThreads = oData.useThreads;
- this.replySameFolder = oData.replySameFolder;
- this.layout = oData.layout;
- this.usePreviewPane = oData.usePreviewPane;
- this.isMessageSelected = oData.isMessageSelected;
- this.messageActiveDom = oData.messageActiveDom;
- this.messageError = oData.messageError;
-
- this.fullScreenMode = oData.messageFullScreenMode;
-
- this.showFullInfo = ko.observable(false);
- this.moreDropdownTrigger = ko.observable(false);
- this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});
-
- this.messageVisibility = ko.computed(function () {
- return !this.messageLoadingThrottle() && !!this.message();
- }, this);
-
- this.message.subscribe(function (oMessage) {
- if (!oMessage)
- {
- this.currentMessage(null);
- }
- }, this);
-
- this.canBeRepliedOrForwarded = this.messageVisibility;
-
- // commands
- this.closeMessage = Utils.createCommand(this, function () {
- oData.message(null);
- });
-
- this.replyCommand = createCommandHelper(Enums.ComposeType.Reply);
- this.replyAllCommand = createCommandHelper(Enums.ComposeType.ReplyAll);
- this.forwardCommand = createCommandHelper(Enums.ComposeType.Forward);
- this.forwardAsAttachmentCommand = createCommandHelper(Enums.ComposeType.ForwardAsAttachment);
- this.editAsNewCommand = createCommandHelper(Enums.ComposeType.EditAsNew);
-
- this.messageVisibilityCommand = Utils.createCommand(this, Utils.emptyFunction, this.messageVisibility);
-
- this.messageEditCommand = Utils.createCommand(this, function () {
- this.editMessage();
- }, this.messageVisibility);
-
- this.deleteCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
- RL.data().currentFolderFullNameRaw(),
- [this.message().uid], false);
- }
- }, this.messageVisibility);
-
- this.archiveCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- RL.deleteMessagesFromFolder(Enums.FolderType.Archive,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- this.spamCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- RL.deleteMessagesFromFolder(Enums.FolderType.Spam,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- this.notSpamCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- RL.deleteMessagesFromFolder(Enums.FolderType.NotSpam,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- // viewer
- this.viewHash = '';
- this.viewSubject = ko.observable('');
- this.viewFromShort = ko.observable('');
- this.viewToShort = ko.observable('');
- this.viewFrom = ko.observable('');
- this.viewTo = ko.observable('');
- this.viewCc = ko.observable('');
- this.viewBcc = ko.observable('');
- this.viewDate = ko.observable('');
- this.viewMoment = ko.observable('');
- this.viewLineAsCcc = ko.observable('');
- this.viewViewLink = ko.observable('');
- this.viewDownloadLink = ko.observable('');
- this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic);
- this.viewUserPicVisible = ko.observable(false);
-
- this.viewPgpPassword = ko.observable('');
- this.viewPgpSignedVerifyStatus = ko.computed(function () {
- return this.message() ? this.message().pgpSignedVerifyStatus() : Enums.SignedVerifyStatus.None;
- }, this);
-
- this.viewPgpSignedVerifyUser = ko.computed(function () {
- return this.message() ? this.message().pgpSignedVerifyUser() : '';
- }, this);
-
- this.message.subscribe(function (oMessage) {
-
- this.messageActiveDom(null);
-
- this.viewPgpPassword('');
-
- if (oMessage)
- {
- if (this.viewHash !== oMessage.hash)
- {
- this.scrollMessageToTop();
- }
-
- this.viewHash = oMessage.hash;
- this.viewSubject(oMessage.subject());
- this.viewFromShort(oMessage.fromToLine(true, true));
- this.viewToShort(oMessage.toToLine(true, true));
- this.viewFrom(oMessage.fromToLine(false));
- this.viewTo(oMessage.toToLine(false));
- this.viewCc(oMessage.ccToLine(false));
- this.viewBcc(oMessage.bccToLine(false));
- this.viewDate(oMessage.fullFormatDateValue());
- this.viewMoment(oMessage.momentDate());
- this.viewLineAsCcc(oMessage.lineAsCcc());
- this.viewViewLink(oMessage.viewLink());
- this.viewDownloadLink(oMessage.downloadLink());
-
- sLastEmail = oMessage.fromAsSingleEmail();
- RL.cache().getUserPic(sLastEmail, function (sPic, $sEmail) {
- if (sPic !== self.viewUserPic() && sLastEmail === $sEmail)
- {
- self.viewUserPicVisible(false);
- self.viewUserPic(Consts.DataImages.UserDotPic);
- if ('' !== sPic)
- {
- self.viewUserPicVisible(true);
- self.viewUserPic(sPic);
- }
- }
- });
- }
- else
- {
- this.viewHash = '';
- this.scrollMessageToTop();
- }
-
- }, this);
-
- this.fullScreenMode.subscribe(function (bValue) {
- if (bValue)
- {
- $html.addClass('rl-message-fullscreen');
- }
- else
- {
- $html.removeClass('rl-message-fullscreen');
- }
-
- Utils.windowResize();
- });
-
- this.messageLoadingThrottle.subscribe(function (bV) {
- if (bV)
- {
- Utils.windowResize();
- }
- });
-
- this.goUpCommand = Utils.createCommand(this, function () {
- RL.pub('mailbox.message-list.selector.go-up');
- });
-
- this.goDownCommand = Utils.createCommand(this, function () {
- RL.pub('mailbox.message-list.selector.go-down');
- });
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('MailBoxMessageViewViewModel', MailBoxMessageViewViewModel);
-
-MailBoxMessageViewViewModel.prototype.isPgpActionVisible = function ()
-{
- return Enums.SignedVerifyStatus.Success !== this.viewPgpSignedVerifyStatus();
-};
-
-MailBoxMessageViewViewModel.prototype.isPgpStatusVerifyVisible = function ()
-{
- return Enums.SignedVerifyStatus.None !== this.viewPgpSignedVerifyStatus();
-};
-
-MailBoxMessageViewViewModel.prototype.isPgpStatusVerifySuccess = function ()
-{
- return Enums.SignedVerifyStatus.Success === this.viewPgpSignedVerifyStatus();
-};
-
-MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
-{
- var sResult = '';
- switch (this.viewPgpSignedVerifyStatus())
- {
- case Enums.SignedVerifyStatus.UnknownPublicKeys:
- sResult = Utils.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND');
- break;
- case Enums.SignedVerifyStatus.UnknownPrivateKey:
- sResult = Utils.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND');
- break;
- case Enums.SignedVerifyStatus.Unverified:
- sResult = Utils.i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE');
- break;
- case Enums.SignedVerifyStatus.Error:
- sResult = Utils.i18n('PGP_NOTIFICATIONS/DECRYPTION_ERROR');
- break;
- case Enums.SignedVerifyStatus.Success:
- sResult = Utils.i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
- 'USER': this.viewPgpSignedVerifyUser()
- });
- break;
- }
-
- return sResult;
-};
-
-MailBoxMessageViewViewModel.prototype.scrollToTop = function ()
-{
- var oCont = $('.messageItem.nano .content', this.viewModelDom);
- if (oCont && oCont[0])
- {
-// oCont.animate({'scrollTop': 0}, 300);
- oCont.scrollTop(0);
- }
- else
- {
-// $('.messageItem', this.viewModelDom).animate({'scrollTop': 0}, 300);
- $('.messageItem', this.viewModelDom).scrollTop(0);
- }
-
- Utils.windowResize();
-};
-
-MailBoxMessageViewViewModel.prototype.fullScreen = function ()
-{
- this.fullScreenMode(true);
- Utils.windowResize();
-};
-
-MailBoxMessageViewViewModel.prototype.unFullScreen = function ()
-{
- this.fullScreenMode(false);
- Utils.windowResize();
-};
-
-MailBoxMessageViewViewModel.prototype.toggleFullScreen = function ()
-{
- Utils.removeSelection();
-
- this.fullScreenMode(!this.fullScreenMode());
- Utils.windowResize();
-};
-
-/**
- * @param {string} sType
- */
-MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
-{
- kn.showScreenPopup(PopupsComposeViewModel, [sType, RL.data().message()]);
-};
-
-MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
-{
- var
- self = this,
- oData = RL.data()
- ;
-
- this.fullScreenMode.subscribe(function (bValue) {
- if (bValue)
- {
- self.message.focused(true);
- }
- }, this);
-
- $('.attachmentsPlace', oDom).magnificPopup({
- 'delegate': '.magnificPopupImage:visible',
- 'type': 'image',
- 'gallery': {
- 'enabled': true,
- 'preload': [1, 1],
- 'navigateByImgClick': true
- },
- 'callbacks': {
- 'open': function() {
- oData.useKeyboardShortcuts(false);
- },
- 'close': function() {
- oData.useKeyboardShortcuts(true);
- }
- },
- 'mainClass': 'mfp-fade',
- 'removalDelay': 400
- });
-
- oDom
- .on('click', '.messageView .messageItem .messageItemHeader', function () {
- if (oData.useKeyboardShortcuts() && self.message())
- {
- self.message.focused(true);
- }
- })
- .on('click', 'a', function (oEvent) {
- // setup maito protocol
- return !(!!oEvent && 3 !== oEvent['which'] && RL.mailToHelper($(this).attr('href')));
- })
- .on('click', '.attachmentsPlace .attachmentPreview', function (oEvent) {
- if (oEvent && oEvent.stopPropagation)
- {
- oEvent.stopPropagation();
- }
- })
- .on('click', '.attachmentsPlace .attachmentItem', function () {
-
- var
- oAttachment = ko.dataFor(this)
- ;
-
- if (oAttachment && oAttachment.download)
- {
- RL.download(oAttachment.linkDownload());
- }
- })
- ;
-
- this.message.focused.subscribe(function (bValue) {
- if (bValue && !Utils.inFocus()) {
- this.messageDomFocused(true);
- } else {
- this.messageDomFocused(false);
- }
- }, this);
-
- this.messageDomFocused.subscribe(function (bValue) {
- if (!bValue && Enums.KeyState.MessageView === this.keyScope())
- {
- this.message.focused(false);
- }
- }, this);
-
- this.keyScope.subscribe(function (sValue) {
- if (Enums.KeyState.MessageView === sValue && this.message.focused())
- {
- this.messageDomFocused(true);
- }
- }, this);
-
- this.oMessageScrollerDom = oDom.find('.messageItem .content');
- this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null;
-
- this.initShortcuts();
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
-{
- if (this.viewModelVisibility() && this.message())
- {
- if (this.fullScreenMode())
- {
- this.fullScreenMode(false);
- }
- else if (Enums.Layout.NoPreview === RL.data().layout())
- {
- this.message(null);
- }
- else
- {
- this.message.focused(false);
- }
-
- return false;
- }
-};
-
-MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
-{
- var
- self = this,
- oData = RL.data()
- ;
-
- // exit fullscreen, back
- key('esc', Enums.KeyState.MessageView, _.bind(this.escShortcuts, this));
-
- // fullscreen
- key('enter', Enums.KeyState.MessageView, function () {
- self.toggleFullScreen();
- return false;
- });
-
- key('enter', Enums.KeyState.MessageList, function () {
- if (Enums.Layout.NoPreview !== oData.layout() && self.message())
- {
- self.toggleFullScreen();
- return false;
- }
- });
-
- // TODO // more toggle
-// key('', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
-// self.moreDropdownTrigger(true);
-// return false;
-// });
-
- // reply
- key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- if (oData.message())
- {
- self.replyCommand();
- return false;
- }
- });
-
- // replaAll
- key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- if (oData.message())
- {
- self.replyAllCommand();
- return false;
- }
- });
-
- // forward
- key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- if (oData.message())
- {
- self.forwardCommand();
- return false;
- }
- });
-
- // message information
-// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
-// if (oData.message())
-// {
-// self.showFullInfo(!self.showFullInfo());
-// return false;
-// }
-// });
-
- // toggle message blockquotes
- key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- if (oData.message() && oData.message().body)
- {
- Utils.toggleMessageBlockquote(oData.message().body);
- return false;
- }
- });
-
- key('ctrl+left, command+left, ctrl+up, command+up', Enums.KeyState.MessageView, function () {
- self.goUpCommand();
- return false;
- });
-
- key('ctrl+right, command+right, ctrl+down, command+down', Enums.KeyState.MessageView, function () {
- self.goDownCommand();
- return false;
- });
-
- // print
- key('ctrl+p, command+p', Enums.KeyState.MessageView, function () {
- if (self.message())
- {
- self.message().printMessage();
- }
-
- return false;
- });
-
- // delete
- key('delete, shift+delete', Enums.KeyState.MessageView, function (event, handler) {
- if (event)
- {
- if (handler && 'shift+delete' === handler.shortcut)
- {
- self.deleteWithoutMoveCommand();
- }
- else
- {
- self.deleteCommand();
- }
-
- return false;
- }
- });
-
- // change focused state
- key('tab, shift+tab, left', Enums.KeyState.MessageView, function () {
- if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== oData.layout())
- {
- self.message.focused(false);
- }
-
- return false;
- });
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
-{
- return RL.data().message() && RL.data().draftFolder() === RL.data().message().folderFullNameRaw;
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
-{
- return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw;
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
-{
- return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw;
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
-{
- return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue;
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
-{
- return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw;
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
-{
- return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue;
-};
-
-/**
- * @return {boolean}
- */
-MailBoxMessageViewViewModel.prototype.isDraftOrSentFolder = function ()
-{
- return this.isDraftFolder() || this.isSentFolder();
-};
-
-MailBoxMessageViewViewModel.prototype.composeClick = function ()
-{
- kn.showScreenPopup(PopupsComposeViewModel);
-};
-
-MailBoxMessageViewViewModel.prototype.editMessage = function ()
-{
- if (RL.data().message())
- {
- kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, RL.data().message()]);
- }
-};
-
-MailBoxMessageViewViewModel.prototype.scrollMessageToTop = function ()
-{
- if (this.oMessageScrollerDom)
- {
- this.oMessageScrollerDom.scrollTop(0);
- }
-};
-
-/**
- * @param {MessageModel} oMessage
- */
-MailBoxMessageViewViewModel.prototype.showImages = function (oMessage)
-{
- if (oMessage && oMessage.showExternalImages)
- {
- oMessage.showExternalImages(true);
- }
-};
-
-/**
- * @returns {string}
- */
-MailBoxMessageViewViewModel.prototype.printableCheckedMessageCount = function ()
-{
- var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
- return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : '';
-};
-
-
-/**
- * @param {MessageModel} oMessage
- */
-MailBoxMessageViewViewModel.prototype.verifyPgpSignedClearMessage = function (oMessage)
-{
- if (oMessage)
- {
- oMessage.verifyPgpSignedClearMessage();
- }
-};
-
-/**
- * @param {MessageModel} oMessage
- */
-MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMessage)
-{
- if (oMessage)
- {
- oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword());
- }
-};
-
-/**
- * @param {MessageModel} oMessage
- */
-MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
-{
- if (oMessage && '' !== oMessage.readReceipt())
- {
- RL.remote().sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
- oMessage.readReceipt(),
- Utils.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
- Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': RL.data().accountEmail()}));
-
- oMessage.isReadReceipt(true);
-
- RL.cache().storeMessageFlagsToCache(oMessage);
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {?} oScreen
- *
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function SettingsMenuViewModel(oScreen)
-{
- KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
-
- this.leftPanelDisabled = RL.data().leftPanelDisabled;
-
- this.menu = oScreen.menu;
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('SettingsMenuViewModel', SettingsMenuViewModel);
-
-SettingsMenuViewModel.prototype.link = function (sRoute)
-{
- return RL.link().settings(sRoute);
-};
-
-SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
-{
- kn.setHash(RL.link().inbox());
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
-function SettingsPaneViewModel()
-{
- KnoinAbstractViewModel.call(this, 'Right', 'SettingsPane');
-
- Knoin.constructorEnd(this);
-}
-
-Utils.extendAsViewModel('SettingsPaneViewModel', SettingsPaneViewModel);
-
-SettingsPaneViewModel.prototype.onBuild = function ()
-{
- var self = this;
- key('esc', Enums.KeyState.Settings, function () {
- self.backToMailBoxClick();
- });
-};
-
-SettingsPaneViewModel.prototype.onShow = function ()
-{
- RL.data().message(null);
-};
-
-SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
-{
- kn.setHash(RL.link().inbox());
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsGeneral()
-{
- var oData = RL.data();
-
- this.mainLanguage = oData.mainLanguage;
- this.mainMessagesPerPage = oData.mainMessagesPerPage;
- this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
- this.editorDefaultType = oData.editorDefaultType;
- this.showImages = oData.showImages;
- this.interfaceAnimation = oData.interfaceAnimation;
- this.useDesktopNotifications = oData.useDesktopNotifications;
- this.threading = oData.threading;
- this.useThreads = oData.useThreads;
- this.replySameFolder = oData.replySameFolder;
- this.layout = oData.layout;
- this.usePreviewPane = oData.usePreviewPane;
- this.useCheckboxesInList = oData.useCheckboxesInList;
- this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
-
- this.isDesktopNotificationsSupported = ko.computed(function () {
- return Enums.DesktopNotifications.NotSupported !== oData.desktopNotificationsPermisions();
- });
-
- this.isDesktopNotificationsDenied = ko.computed(function () {
- return Enums.DesktopNotifications.NotSupported === oData.desktopNotificationsPermisions() ||
- Enums.DesktopNotifications.Denied === oData.desktopNotificationsPermisions();
- });
-
- this.mainLanguageFullName = ko.computed(function () {
- return Utils.convertLangName(this.mainLanguage());
- }, this);
-
- this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
- this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.isAnimationSupported = Globals.bAnimationSupported;
-}
-
-Utils.addSettingsViewModel(SettingsGeneral, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
-
-SettingsGeneral.prototype.toggleLayout = function ()
-{
- this.layout(Enums.Layout.NoPreview === this.layout() ? Enums.Layout.SidePreview : Enums.Layout.NoPreview);
-};
-
-SettingsGeneral.prototype.onBuild = function ()
-{
- var self = this;
-
- _.delay(function () {
-
- var
- oData = RL.data(),
- f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self)
- ;
-
- oData.language.subscribe(function (sValue) {
-
- self.languageTrigger(Enums.SaveSettingsStep.Animate);
-
- $.ajax({
- 'url': RL.link().langLink(sValue),
- 'dataType': 'script',
- 'cache': true
- }).done(function() {
- Utils.i18nToDoc();
- self.languageTrigger(Enums.SaveSettingsStep.TrueResult);
- }).fail(function() {
- self.languageTrigger(Enums.SaveSettingsStep.FalseResult);
- }).always(function() {
- _.delay(function () {
- self.languageTrigger(Enums.SaveSettingsStep.Idle);
- }, 1000);
- });
-
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'Language': sValue
- });
- });
-
- oData.editorDefaultType.subscribe(function (sValue) {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'EditorDefaultType': sValue
- });
- });
-
- oData.messagesPerPage.subscribe(function (iValue) {
- RL.remote().saveSettings(f1, {
- 'MPP': iValue
- });
- });
-
- oData.showImages.subscribe(function (bValue) {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'ShowImages': bValue ? '1' : '0'
- });
- });
-
- oData.interfaceAnimation.subscribe(function (sValue) {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'InterfaceAnimation': sValue
- });
- });
-
- oData.useDesktopNotifications.subscribe(function (bValue) {
- Utils.timeOutAction('SaveDesktopNotifications', function () {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'DesktopNotifications': bValue ? '1' : '0'
- });
- }, 3000);
- });
-
- oData.replySameFolder.subscribe(function (bValue) {
- Utils.timeOutAction('SaveReplySameFolder', function () {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'ReplySameFolder': bValue ? '1' : '0'
- });
- }, 3000);
- });
-
- oData.useThreads.subscribe(function (bValue) {
-
- oData.messageList([]);
-
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'UseThreads': bValue ? '1' : '0'
- });
- });
-
- oData.layout.subscribe(function (nValue) {
-
- oData.messageList([]);
-
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'Layout': nValue
- });
- });
-
- oData.useCheckboxesInList.subscribe(function (bValue) {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'UseCheckboxesInList': bValue ? '1' : '0'
- });
- });
-
- }, 50);
-};
-
-SettingsGeneral.prototype.onShow = function ()
-{
- RL.data().desktopNotifications.valueHasMutated();
-};
-
-SettingsGeneral.prototype.selectLanguage = function ()
-{
- kn.showScreenPopup(PopupsLanguagesViewModel);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsContacts()
-{
- var oData = RL.data();
-
- this.contactsAutosave = oData.contactsAutosave;
-
- this.allowContactsSync = oData.allowContactsSync;
- this.enableContactsSync = oData.enableContactsSync;
- this.contactsSyncUrl = oData.contactsSyncUrl;
- this.contactsSyncUser = oData.contactsSyncUser;
- this.contactsSyncPass = oData.contactsSyncPass;
-
- this.saveTrigger = ko.computed(function () {
- return [
- this.enableContactsSync() ? '1' : '0',
- this.contactsSyncUrl(),
- this.contactsSyncUser(),
- this.contactsSyncPass()
- ].join('|');
- }, this).extend({'throttle': 500});
-
- this.saveTrigger.subscribe(function () {
- RL.remote().saveContactsSyncData(null,
- this.enableContactsSync(),
- this.contactsSyncUrl(),
- this.contactsSyncUser(),
- this.contactsSyncPass()
- );
- }, this);
-}
-
-Utils.addSettingsViewModel(SettingsContacts, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
-
-SettingsContacts.prototype.onBuild = function ()
-{
- RL.data().contactsAutosave.subscribe(function (bValue) {
- RL.remote().saveSettings(Utils.emptyFunction, {
- 'ContactsAutosave': bValue ? '1' : '0'
- });
- });
-};
-
-//SettingsContacts.prototype.onShow = function ()
-//{
-//
-//};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsAccounts()
-{
- var oData = RL.data();
-
- this.accounts = oData.accounts;
-
- this.processText = ko.computed(function () {
- return oData.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
- }, this);
-
- this.visibility = ko.computed(function () {
- return '' === this.processText() ? 'hidden' : 'visible';
- }, this);
-
- this.accountForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.deleteAccess(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.deleteAccess(true);
- }
- }
- ]});
-}
-
-Utils.addSettingsViewModel(SettingsAccounts, 'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
-
-SettingsAccounts.prototype.addNewAccount = function ()
-{
- kn.showScreenPopup(PopupsAddAccountViewModel);
-};
-
-/**
- * @param {AccountModel} oAccountToRemove
- */
-SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
-{
- if (oAccountToRemove && oAccountToRemove.deleteAccess())
- {
- this.accountForDeletion(null);
-
- var
- fRemoveAccount = function (oAccount) {
- return oAccountToRemove === oAccount;
- }
- ;
-
- if (oAccountToRemove)
- {
- this.accounts.remove(fRemoveAccount);
-
- RL.remote().accountDelete(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData &&
- oData.Result && oData.Reload)
- {
- kn.routeOff();
- kn.setHash(RL.link().root(), true);
- kn.routeOff();
-
- _.defer(function () {
- window.location.reload();
- });
- }
- else
- {
- RL.accountsAndIdentities();
- }
-
- }, oAccountToRemove.email);
- }
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsIdentity()
-{
- var oData = RL.data();
-
- this.editor = null;
-
- this.displayName = oData.displayName;
- this.signature = oData.signature;
- this.signatureToAll = oData.signatureToAll;
- this.replyTo = oData.replyTo;
-
- this.signatureDom = ko.observable(null);
-
- this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
-}
-
-Utils.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
-
-SettingsIdentity.prototype.onFocus = function ()
-{
- if (!this.editor && this.signatureDom())
- {
- var
- self = this,
- sSignature = RL.data().signature()
- ;
-
- this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () {
- RL.data().signature(
- (self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
- );
- }, function () {
- if (':HTML:' === sSignature.substr(0, 6))
- {
- self.editor.setHtml(sSignature.substr(6), false);
- }
- else
- {
- self.editor.setPlain(sSignature, false);
- }
- });
- }
-};
-
-SettingsIdentity.prototype.onBuild = function ()
-{
- var self = this;
- _.delay(function () {
-
- var
- oData = RL.data(),
- f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
- ;
-
- oData.displayName.subscribe(function (sValue) {
- RL.remote().saveSettings(f1, {
- 'DisplayName': sValue
- });
- });
-
- oData.replyTo.subscribe(function (sValue) {
- RL.remote().saveSettings(f2, {
- 'ReplyTo': sValue
- });
- });
-
- oData.signature.subscribe(function (sValue) {
- RL.remote().saveSettings(f3, {
- 'Signature': sValue
- });
- });
-
- oData.signatureToAll.subscribe(function (bValue) {
- RL.remote().saveSettings(null, {
- 'SignatureToAll': bValue ? '1' : '0'
- });
- });
-
- }, 50);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsIdentities()
-{
- var oData = RL.data();
-
- this.editor = null;
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- this.accountEmail = oData.accountEmail;
- this.displayName = oData.displayName;
- this.signature = oData.signature;
- this.signatureToAll = oData.signatureToAll;
- this.replyTo = oData.replyTo;
-
- this.signatureDom = ko.observable(null);
-
- this.defaultIdentityIDTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.identities = oData.identities;
- this.defaultIdentityID = oData.defaultIdentityID;
-
- this.identitiesOptions = ko.computed(function () {
-
- var
- aList = this.identities(),
- aResult = []
- ;
-
- if (0 < aList.length)
- {
- aResult.push({
- 'id': this.accountEmail.peek(),
- 'name': this.formattedAccountIdentity(),
- 'seporator': false
- });
-
- aResult.push({
- 'id': '---',
- 'name': '---',
- 'seporator': true,
- 'disabled': true
- });
-
- _.each(aList, function (oItem) {
- aResult.push({
- 'id': oItem.id,
- 'name': oItem.formattedNameForEmail(),
- 'seporator': false
- });
- });
- }
-
- return aResult;
- }, this);
-
- this.processText = ko.computed(function () {
- return oData.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
- }, this);
-
- this.visibility = ko.computed(function () {
- return '' === this.processText() ? 'hidden' : 'visible';
- }, this);
-
- this.identityForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.deleteAccess(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.deleteAccess(true);
- }
- }
- ]});
-}
-
-Utils.addSettingsViewModel(SettingsIdentities, 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
-
-/**
- *
- * @return {string}
- */
-SettingsIdentities.prototype.formattedAccountIdentity = function ()
-{
- var
- sDisplayName = this.displayName.peek(),
- sEmail = this.accountEmail.peek()
- ;
-
- return '' === sDisplayName ? sEmail : '"' + Utils.quoteName(sDisplayName) + '" <' + sEmail + '>';
-};
-
-SettingsIdentities.prototype.addNewIdentity = function ()
-{
- kn.showScreenPopup(PopupsIdentityViewModel);
-};
-
-SettingsIdentities.prototype.editIdentity = function (oIdentity)
-{
- kn.showScreenPopup(PopupsIdentityViewModel, [oIdentity]);
-};
-
-/**
- * @param {IdentityModel} oIdentityToRemove
- */
-SettingsIdentities.prototype.deleteIdentity = function (oIdentityToRemove)
-{
- if (oIdentityToRemove && oIdentityToRemove.deleteAccess())
- {
- this.identityForDeletion(null);
-
- var
- fRemoveFolder = function (oIdentity) {
- return oIdentityToRemove === oIdentity;
- }
- ;
-
- if (oIdentityToRemove)
- {
- this.identities.remove(fRemoveFolder);
-
- RL.remote().identityDelete(function () {
- RL.accountsAndIdentities();
- }, oIdentityToRemove.id);
- }
- }
-};
-
-SettingsIdentities.prototype.onFocus = function ()
-{
- if (!this.editor && this.signatureDom())
- {
- var
- self = this,
- sSignature = RL.data().signature()
- ;
-
- this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () {
- RL.data().signature(
- (self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
- );
- }, function () {
- if (':HTML:' === sSignature.substr(0, 6))
- {
- self.editor.setHtml(sSignature.substr(6), false);
- }
- else
- {
- self.editor.setPlain(sSignature, false);
- }
- });
- }
-};
-
-SettingsIdentities.prototype.onBuild = function (oDom)
-{
- var self = this;
-
- oDom
- .on('click', '.identity-item .e-action', function () {
- var oIdentityItem = ko.dataFor(this);
- if (oIdentityItem)
- {
- self.editIdentity(oIdentityItem);
- }
- })
- ;
-
- _.delay(function () {
-
- var
- oData = RL.data(),
- f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self),
- f4 = Utils.settingsSaveHelperSimpleFunction(self.defaultIdentityIDTrigger, self)
- ;
-
- oData.defaultIdentityID.subscribe(function (sValue) {
- RL.remote().saveSettings(f4, {
- 'DefaultIdentityID': sValue
- });
- });
-
- oData.displayName.subscribe(function (sValue) {
- RL.remote().saveSettings(f1, {
- 'DisplayName': sValue
- });
- });
-
- oData.replyTo.subscribe(function (sValue) {
- RL.remote().saveSettings(f2, {
- 'ReplyTo': sValue
- });
- });
-
- oData.signature.subscribe(function (sValue) {
- RL.remote().saveSettings(f3, {
- 'Signature': sValue
- });
- });
-
- oData.signatureToAll.subscribe(function (bValue) {
- RL.remote().saveSettings(null, {
- 'SignatureToAll': bValue ? '1' : '0'
- });
- });
-
- }, 50);
-};
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsFilters()
-{
-// var oData = RL.data();
-
- this.filters = ko.observableArray([]);
- this.filters.loading = ko.observable(false);
-
- this.filters.subscribe(function () {
- Utils.windowResize();
- });
-}
-
-Utils.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
-
-//SettingsFilters.prototype.onBuild = function ()
-//{
-//};
-
-SettingsFilters.prototype.deleteFilter = function (oFilter)
-{
- this.filters.remove(oFilter);
-};
-
-SettingsFilters.prototype.addFilter = function ()
-{
- kn.showScreenPopup(PopupsFilterViewModel, [new FilterModel()]);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsSecurity()
-{
- this.processing = ko.observable(false);
- this.clearing = ko.observable(false);
- this.secreting = ko.observable(false);
-
- this.viewUser = ko.observable('');
- this.viewEnable = ko.observable(false);
- this.viewEnable.subs = true;
- this.twoFactorStatus = ko.observable(false);
-
- this.viewSecret = ko.observable('');
- this.viewBackupCodes = ko.observable('');
- this.viewUrl = ko.observable('');
-
- this.bFirst = true;
-
- this.viewTwoFactorStatus = ko.computed(function () {
- Globals.langChangeTrigger();
- return Utils.i18n(
- this.twoFactorStatus() ?
- 'SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
- 'SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
- );
- }, this);
-
- this.onResult = _.bind(this.onResult, this);
- this.onSecretResult = _.bind(this.onSecretResult, this);
-}
-
-Utils.addSettingsViewModel(SettingsSecurity, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
-
-SettingsSecurity.prototype.showSecret = function ()
-{
- this.secreting(true);
- RL.remote().showTwoFactorSecret(this.onSecretResult);
-};
-
-SettingsSecurity.prototype.hideSecret = function ()
-{
- this.viewSecret('');
- this.viewBackupCodes('');
- this.viewUrl('');
-};
-
-SettingsSecurity.prototype.createTwoFactor = function ()
-{
- this.processing(true);
- RL.remote().createTwoFactor(this.onResult);
-};
-
-SettingsSecurity.prototype.enableTwoFactor = function ()
-{
- this.processing(true);
- RL.remote().enableTwoFactor(this.onResult, this.viewEnable());
-};
-
-SettingsSecurity.prototype.testTwoFactor = function ()
-{
- kn.showScreenPopup(PopupsTwoFactorTestViewModel);
-};
-
-SettingsSecurity.prototype.clearTwoFactor = function ()
-{
- this.viewSecret('');
- this.viewBackupCodes('');
- this.viewUrl('');
-
- this.clearing(true);
- RL.remote().clearTwoFactor(this.onResult);
-};
-
-SettingsSecurity.prototype.onShow = function ()
-{
- this.viewSecret('');
- this.viewBackupCodes('');
- this.viewUrl('');
-};
-
-SettingsSecurity.prototype.onResult = function (sResult, oData)
-{
- this.processing(false);
- this.clearing(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- this.viewUser(Utils.pString(oData.Result.User));
- this.viewEnable(!!oData.Result.Enable);
- this.twoFactorStatus(!!oData.Result.IsSet);
-
- this.viewSecret(Utils.pString(oData.Result.Secret));
- this.viewBackupCodes(Utils.pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
- this.viewUrl(Utils.pString(oData.Result.Url));
- }
- else
- {
- this.viewUser('');
- this.viewEnable(false);
- this.twoFactorStatus(false);
-
- this.viewSecret('');
- this.viewBackupCodes('');
- this.viewUrl('');
- }
-
- if (this.bFirst)
- {
- this.bFirst = false;
- var self = this;
- this.viewEnable.subscribe(function (bValue) {
- if (this.viewEnable.subs)
- {
- RL.remote().enableTwoFactor(function (sResult, oData) {
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- self.viewEnable.subs = false;
- self.viewEnable(false);
- self.viewEnable.subs = true;
- }
- }, bValue);
- }
- }, this);
- }
-};
-
-SettingsSecurity.prototype.onSecretResult = function (sResult, oData)
-{
- this.secreting(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- this.viewSecret(Utils.pString(oData.Result.Secret));
- this.viewUrl(Utils.pString(oData.Result.Url));
- }
- else
- {
- this.viewSecret('');
- this.viewUrl('');
- }
-};
-
-SettingsSecurity.prototype.onBuild = function ()
-{
- this.processing(true);
- RL.remote().getTwoFactor(this.onResult);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsSocialScreen()
-{
- var oData = RL.data();
-
- this.googleEnable = oData.googleEnable;
-
- this.googleActions = oData.googleActions;
- this.googleLoggined = oData.googleLoggined;
- this.googleUserName = oData.googleUserName;
-
- this.facebookEnable = oData.facebookEnable;
-
- this.facebookActions = oData.facebookActions;
- this.facebookLoggined = oData.facebookLoggined;
- this.facebookUserName = oData.facebookUserName;
-
- this.twitterEnable = oData.twitterEnable;
-
- this.twitterActions = oData.twitterActions;
- this.twitterLoggined = oData.twitterLoggined;
- this.twitterUserName = oData.twitterUserName;
-
- this.connectGoogle = Utils.createCommand(this, function () {
- if (!this.googleLoggined())
- {
- RL.googleConnect();
- }
- }, function () {
- return !this.googleLoggined() && !this.googleActions();
- });
-
- this.disconnectGoogle = Utils.createCommand(this, function () {
- RL.googleDisconnect();
- });
-
- this.connectFacebook = Utils.createCommand(this, function () {
- if (!this.facebookLoggined())
- {
- RL.facebookConnect();
- }
- }, function () {
- return !this.facebookLoggined() && !this.facebookActions();
- });
-
- this.disconnectFacebook = Utils.createCommand(this, function () {
- RL.facebookDisconnect();
- });
-
- this.connectTwitter = Utils.createCommand(this, function () {
- if (!this.twitterLoggined())
- {
- RL.twitterConnect();
- }
- }, function () {
- return !this.twitterLoggined() && !this.twitterActions();
- });
-
- this.disconnectTwitter = Utils.createCommand(this, function () {
- RL.twitterDisconnect();
- });
-}
-
-Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsChangePasswordScreen()
-{
- this.changeProcess = ko.observable(false);
-
- this.errorDescription = ko.observable('');
- this.passwordMismatch = ko.observable(false);
- this.passwordUpdateError = ko.observable(false);
- this.passwordUpdateSuccess = ko.observable(false);
-
- this.currentPassword = ko.observable('');
- this.currentPassword.error = ko.observable(false);
- this.newPassword = ko.observable('');
- this.newPassword2 = ko.observable('');
-
- this.currentPassword.subscribe(function () {
- this.passwordUpdateError(false);
- this.passwordUpdateSuccess(false);
- this.currentPassword.error(false);
- }, this);
-
- this.newPassword.subscribe(function () {
- this.passwordUpdateError(false);
- this.passwordUpdateSuccess(false);
- this.passwordMismatch(false);
- }, this);
-
- this.newPassword2.subscribe(function () {
- this.passwordUpdateError(false);
- this.passwordUpdateSuccess(false);
- this.passwordMismatch(false);
- }, this);
-
- this.saveNewPasswordCommand = Utils.createCommand(this, function () {
-
- if (this.newPassword() !== this.newPassword2())
- {
- this.passwordMismatch(true);
- this.errorDescription(Utils.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
- }
- else
- {
- this.changeProcess(true);
-
- this.passwordUpdateError(false);
- this.passwordUpdateSuccess(false);
- this.currentPassword.error(false);
- this.passwordMismatch(false);
- this.errorDescription('');
-
- RL.remote().changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
- }
-
- }, function () {
- return !this.changeProcess() && '' !== this.currentPassword() &&
- '' !== this.newPassword() && '' !== this.newPassword2();
- });
-
- this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
-}
-
-Utils.addSettingsViewModel(SettingsChangePasswordScreen, 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
-
-SettingsChangePasswordScreen.prototype.onHide = function ()
-{
- this.changeProcess(false);
- this.currentPassword('');
- this.newPassword('');
- this.newPassword2('');
- this.errorDescription('');
- this.passwordMismatch(false);
- this.currentPassword.error(false);
-};
-
-SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sResult, oData)
-{
- this.changeProcess(false);
- this.passwordMismatch(false);
- this.errorDescription('');
- this.currentPassword.error(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- this.currentPassword('');
- this.newPassword('');
- this.newPassword2('');
-
- this.passwordUpdateSuccess(true);
- this.currentPassword.error(false);
- }
- else
- {
- if (oData && Enums.Notification.CurrentPasswordIncorrect === oData.ErrorCode)
- {
- this.currentPassword.error(true);
- }
-
- this.passwordUpdateError(true);
- this.errorDescription(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
- Utils.getNotification(Enums.Notification.CouldNotSaveNewPassword));
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsFolders()
-{
- var oData = RL.data();
-
- this.foldersListError = oData.foldersListError;
- this.folderList = oData.folderList;
-
- this.processText = ko.computed(function () {
-
- var
- oData = RL.data(),
- bLoading = oData.foldersLoading(),
- bCreating = oData.foldersCreating(),
- bDeleting = oData.foldersDeleting(),
- bRenaming = oData.foldersRenaming()
- ;
-
- if (bCreating)
- {
- return Utils.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
- }
- else if (bDeleting)
- {
- return Utils.i18n('SETTINGS_FOLDERS/DELETING_PROCESS');
- }
- else if (bRenaming)
- {
- return Utils.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS');
- }
- else if (bLoading)
- {
- return Utils.i18n('SETTINGS_FOLDERS/LOADING_PROCESS');
- }
-
- return '';
-
- }, this);
-
- this.visibility = ko.computed(function () {
- return '' === this.processText() ? 'hidden' : 'visible';
- }, this);
-
- this.folderForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.deleteAccess(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.deleteAccess(true);
- }
- }
- ]});
-
- this.folderForEdit = ko.observable(null).extend({'toggleSubscribe': [this,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.edited(false);
- }
- }, function (oNext) {
- if (oNext && oNext.canBeEdited())
- {
- oNext.edited(true);
- }
- }
- ]});
-
- this.useImapSubscribe = !!RL.settingsGet('UseImapSubscribe');
-}
-
-Utils.addSettingsViewModel(SettingsFolders, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
-
-SettingsFolders.prototype.folderEditOnEnter = function (oFolder)
-{
- var sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '';
- if ('' !== sEditName && oFolder.name() !== sEditName)
- {
- RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, '');
-
- RL.data().foldersRenaming(true);
- RL.remote().folderRename(function (sResult, oData) {
-
- RL.data().foldersRenaming(false);
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- RL.data().foldersListError(
- oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
- }
-
- RL.folders();
-
- }, oFolder.fullNameRaw, sEditName);
-
- RL.cache().removeFolderFromCacheList(oFolder.fullNameRaw);
-
- oFolder.name(sEditName);
- }
-
- oFolder.edited(false);
-};
-
-SettingsFolders.prototype.folderEditOnEsc = function (oFolder)
-{
- if (oFolder)
- {
- oFolder.edited(false);
- }
-};
-
-SettingsFolders.prototype.onShow = function ()
-{
- RL.data().foldersListError('');
-};
-
-SettingsFolders.prototype.createFolder = function ()
-{
- kn.showScreenPopup(PopupsFolderCreateViewModel);
-};
-
-SettingsFolders.prototype.systemFolder = function ()
-{
- kn.showScreenPopup(PopupsFolderSystemViewModel);
-};
-
-SettingsFolders.prototype.deleteFolder = function (oFolderToRemove)
-{
- if (oFolderToRemove && oFolderToRemove.canBeDeleted() && oFolderToRemove.deleteAccess() &&
- 0 === oFolderToRemove.privateMessageCountAll())
- {
- this.folderForDeletion(null);
-
- var
- fRemoveFolder = function (oFolder) {
-
- if (oFolderToRemove === oFolder)
- {
- return true;
- }
-
- oFolder.subFolders.remove(fRemoveFolder);
- return false;
- }
- ;
-
- if (oFolderToRemove)
- {
- RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, '');
-
- RL.data().folderList.remove(fRemoveFolder);
-
- RL.data().foldersDeleting(true);
- RL.remote().folderDelete(function (sResult, oData) {
-
- RL.data().foldersDeleting(false);
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- RL.data().foldersListError(
- oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
- }
-
- RL.folders();
-
- }, oFolderToRemove.fullNameRaw);
-
- RL.cache().removeFolderFromCacheList(oFolderToRemove.fullNameRaw);
- }
- }
- else if (0 < oFolderToRemove.privateMessageCountAll())
- {
- RL.data().foldersListError(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
- }
-};
-
-SettingsFolders.prototype.subscribeFolder = function (oFolder)
-{
- RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, '');
- RL.remote().folderSetSubscribe(Utils.emptyFunction, oFolder.fullNameRaw, true);
-
- oFolder.subScribed(true);
-};
-
-SettingsFolders.prototype.unSubscribeFolder = function (oFolder)
-{
- RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, '');
- RL.remote().folderSetSubscribe(Utils.emptyFunction, oFolder.fullNameRaw, false);
-
- oFolder.subScribed(false);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsThemes()
-{
- var
- self = this,
- oData = RL.data()
- ;
-
- this.mainTheme = oData.mainTheme;
- this.themesObjects = ko.observableArray([]);
-
- this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
-
- this.oLastAjax = null;
- this.iTimer = 0;
-
- RL.data().theme.subscribe(function (sValue) {
-
- _.each(this.themesObjects(), function (oTheme) {
- oTheme.selected(sValue === oTheme.name);
- });
-
- var
- oThemeLink = $('#rlThemeLink'),
- oThemeStyle = $('#rlThemeStyle'),
- sUrl = oThemeLink.attr('href')
- ;
-
- if (!sUrl)
- {
- sUrl = oThemeStyle.attr('data-href');
- }
-
- if (sUrl)
- {
- sUrl = sUrl.toString().replace(/\/-\/[^\/]+\/\-\//, '/-/' + sValue + '/-/');
- sUrl = sUrl.toString().replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/');
-
- if ('Json/' !== sUrl.substring(sUrl.length - 5, sUrl.length))
- {
- sUrl += 'Json/';
- }
-
- window.clearTimeout(self.iTimer);
- self.themeTrigger(Enums.SaveSettingsStep.Animate);
-
- if (this.oLastAjax && this.oLastAjax.abort)
- {
- this.oLastAjax.abort();
- }
-
- this.oLastAjax = $.ajax({
- 'url': sUrl,
- 'dataType': 'json'
- }).done(function(aData) {
- if (aData && Utils.isArray(aData) && 2 === aData.length)
- {
- if (oThemeLink && oThemeLink[0] && (!oThemeStyle || !oThemeStyle[0]))
- {
- oThemeStyle = $('');
- oThemeLink.after(oThemeStyle);
- oThemeLink.remove();
- }
-
- if (oThemeStyle && oThemeStyle[0])
- {
- oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]);
- if (oThemeStyle && oThemeStyle[0] && oThemeStyle[0].styleSheet && !Utils.isUnd(oThemeStyle[0].styleSheet.cssText))
- {
- oThemeStyle[0].styleSheet.cssText = aData[1];
- }
- else
- {
- oThemeStyle.text(aData[1]);
- }
- }
-
- self.themeTrigger(Enums.SaveSettingsStep.TrueResult);
- }
-
- }).always(function() {
-
- self.iTimer = window.setTimeout(function () {
- self.themeTrigger(Enums.SaveSettingsStep.Idle);
- }, 1000);
-
- self.oLastAjax = null;
- });
- }
-
- RL.remote().saveSettings(null, {
- 'Theme': sValue
- });
-
- }, this);
-}
-
-Utils.addSettingsViewModel(SettingsThemes, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
-
-SettingsThemes.prototype.onBuild = function ()
-{
- var sCurrentTheme = RL.data().theme();
- this.themesObjects(_.map(RL.data().themes(), function (sTheme) {
- return {
- 'name': sTheme,
- 'nameDisplay': Utils.convertThemeName(sTheme),
- 'selected': ko.observable(sTheme === sCurrentTheme),
- 'themePreviewSrc': RL.link().themePreviewLink(sTheme)
- };
- }));
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function SettingsOpenPGP()
-{
- this.openpgpkeys = RL.data().openpgpkeys;
- this.openpgpkeysPublic = RL.data().openpgpkeysPublic;
- this.openpgpkeysPrivate = RL.data().openpgpkeysPrivate;
-
- this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.deleteAccess(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.deleteAccess(true);
- }
- }
- ]});
-}
-
-Utils.addSettingsViewModel(SettingsOpenPGP, 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
-
-SettingsOpenPGP.prototype.addOpenPgpKey = function ()
-{
- kn.showScreenPopup(PopupsAddOpenPgpKeyViewModel);
-};
-
-SettingsOpenPGP.prototype.generateOpenPgpKey = function ()
-{
- kn.showScreenPopup(PopupsGenerateNewOpenPgpKeyViewModel);
-};
-
-SettingsOpenPGP.prototype.viewOpenPgpKey = function (oOpenPgpKey)
-{
- if (oOpenPgpKey)
- {
- kn.showScreenPopup(PopupsViewOpenPgpKeyViewModel, [oOpenPgpKey]);
- }
-};
-
-/**
- * @param {OpenPgpKeyModel} oOpenPgpKeyToRemove
- */
-SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
-{
- if (oOpenPgpKeyToRemove && oOpenPgpKeyToRemove.deleteAccess())
- {
- this.openPgpKeyForDeletion(null);
-
- if (oOpenPgpKeyToRemove && RL.data().openpgpKeyring)
- {
- this.openpgpkeys.remove(function (oOpenPgpKey) {
- return oOpenPgpKeyToRemove === oOpenPgpKey;
- });
-
- RL.data().openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
- .removeForId(oOpenPgpKeyToRemove.guid);
-
- RL.data().openpgpKeyring.store();
-
- RL.reloadOpenPgpKeys();
- }
- }
-};
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function AbstractData()
-{
- this.leftPanelDisabled = ko.observable(false);
- this.useKeyboardShortcuts = ko.observable(true);
-
- this.keyScopeReal = ko.observable(Enums.KeyState.All);
- this.keyScopeFake = ko.observable(Enums.KeyState.All);
-
- this.keyScope = ko.computed({
- 'owner': this,
- 'read': function () {
- return this.keyScopeFake();
- },
- 'write': function (sValue) {
-
- if (Enums.KeyState.Menu !== sValue)
- {
- if (Enums.KeyState.Compose === sValue)
- {
- Utils.disableKeyFilter();
- }
- else
- {
- Utils.restoreKeyFilter();
- }
-
- this.keyScopeFake(sValue);
- if (Globals.dropdownVisibility())
- {
- sValue = Enums.KeyState.Menu;
- }
- }
-
- this.keyScopeReal(sValue);
- }
- });
-
- this.keyScopeReal.subscribe(function (sValue) {
-// window.console.log(sValue);
- key.setScope(sValue);
- });
-
- this.leftPanelDisabled.subscribe(function (bValue) {
- RL.pub('left-panel.' + (bValue ? 'off' : 'on'));
- });
-
- Globals.dropdownVisibility.subscribe(function (bValue) {
- if (bValue)
- {
- Globals.tooltipTrigger(!Globals.tooltipTrigger());
- this.keyScope(Enums.KeyState.Menu);
- }
- else if (Enums.KeyState.Menu === key.getScope())
- {
- this.keyScope(this.keyScopeFake());
- }
- }, this);
-
- Utils.initDataConstructorBySettings(this);
-}
-
-AbstractData.prototype.populateDataOnStart = function()
-{
- var
- mLayout = Utils.pInt(RL.settingsGet('Layout')),
- aLanguages = RL.settingsGet('Languages'),
- aThemes = RL.settingsGet('Themes')
- ;
-
- if (Utils.isArray(aLanguages))
- {
- this.languages(aLanguages);
- }
-
- if (Utils.isArray(aThemes))
- {
- this.themes(aThemes);
- }
-
- this.mainLanguage(RL.settingsGet('Language'));
- this.mainTheme(RL.settingsGet('Theme'));
-
- this.capaAdditionalAccounts(RL.capa(Enums.Capa.AdditionalAccounts));
- this.capaAdditionalIdentities(RL.capa(Enums.Capa.AdditionalIdentities));
- this.capaGravatar(RL.capa(Enums.Capa.Gravatar));
- this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage'));
- this.determineUserDomain(!!RL.settingsGet('DetermineUserDomain'));
-
- this.capaThemes(RL.capa(Enums.Capa.Themes));
- this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin'));
- this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings'));
- this.useLocalProxyForExternalImages(!!RL.settingsGet('UseLocalProxyForExternalImages'));
-
- this.editorDefaultType(RL.settingsGet('EditorDefaultType'));
- this.showImages(!!RL.settingsGet('ShowImages'));
- this.contactsAutosave(!!RL.settingsGet('ContactsAutosave'));
- this.interfaceAnimation(RL.settingsGet('InterfaceAnimation'));
-
- this.mainMessagesPerPage(RL.settingsGet('MPP'));
-
- this.desktopNotifications(!!RL.settingsGet('DesktopNotifications'));
- this.useThreads(!!RL.settingsGet('UseThreads'));
- this.replySameFolder(!!RL.settingsGet('ReplySameFolder'));
- this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList'));
-
- this.layout(Enums.Layout.SidePreview);
- if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
- {
- this.layout(mLayout);
- }
- this.facebookSupported(!!RL.settingsGet('SupportedFacebookSocial'));
- this.facebookEnable(!!RL.settingsGet('AllowFacebookSocial'));
- this.facebookAppID(RL.settingsGet('FacebookAppID'));
- this.facebookAppSecret(RL.settingsGet('FacebookAppSecret'));
-
- this.twitterEnable(!!RL.settingsGet('AllowTwitterSocial'));
- this.twitterConsumerKey(RL.settingsGet('TwitterConsumerKey'));
- this.twitterConsumerSecret(RL.settingsGet('TwitterConsumerSecret'));
-
- this.googleEnable(!!RL.settingsGet('AllowGoogleSocial'));
- this.googleClientID(RL.settingsGet('GoogleClientID'));
- this.googleClientSecret(RL.settingsGet('GoogleClientSecret'));
- this.googleApiKey(RL.settingsGet('GoogleApiKey'));
-
- this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial'));
- this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
-
- this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractData
- */
-function WebMailDataStorage()
-{
- AbstractData.call(this);
-
- var
- fRemoveSystemFolderType = function (observable) {
- return function () {
- var oFolder = RL.cache().getFolderFromCacheList(observable());
- if (oFolder)
- {
- oFolder.type(Enums.FolderType.User);
- }
- };
- },
- fSetSystemFolderType = function (iType) {
- return function (sValue) {
- var oFolder = RL.cache().getFolderFromCacheList(sValue);
- if (oFolder)
- {
- oFolder.type(iType);
- }
- };
- }
- ;
-
- this.devEmail = '';
- this.devPassword = '';
-
- this.accountEmail = ko.observable('');
- this.accountIncLogin = ko.observable('');
- this.accountOutLogin = ko.observable('');
- this.projectHash = ko.observable('');
- this.threading = ko.observable(false);
-
- this.lastFoldersHash = '';
- this.remoteSuggestions = false;
-
- // system folders
- this.sentFolder = ko.observable('');
- this.draftFolder = ko.observable('');
- this.spamFolder = ko.observable('');
- this.trashFolder = ko.observable('');
- this.archiveFolder = ko.observable('');
-
- this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange');
- this.draftFolder.subscribe(fRemoveSystemFolderType(this.draftFolder), this, 'beforeChange');
- this.spamFolder.subscribe(fRemoveSystemFolderType(this.spamFolder), this, 'beforeChange');
- this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange');
- this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange');
-
- this.sentFolder.subscribe(fSetSystemFolderType(Enums.FolderType.SentItems), this);
- this.draftFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Draft), this);
- this.spamFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Spam), this);
- this.trashFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Trash), this);
- this.archiveFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Archive), this);
-
- this.draftFolderNotEnabled = ko.computed(function () {
- return '' === this.draftFolder() || Consts.Values.UnuseOptionValue === this.draftFolder();
- }, this);
-
- // personal
- this.displayName = ko.observable('');
- this.signature = ko.observable('');
- this.signatureToAll = ko.observable(false);
- this.replyTo = ko.observable('');
-
- // security
- this.enableTwoFactor = ko.observable(false);
-
- // accounts
- this.accounts = ko.observableArray([]);
- this.accountsLoading = ko.observable(false).extend({'throttle': 100});
-
- // identities
- this.defaultIdentityID = ko.observable('');
- this.identities = ko.observableArray([]);
- this.identitiesLoading = ko.observable(false).extend({'throttle': 100});
-
- // contacts
- this.contactTags = ko.observableArray([]);
- this.contacts = ko.observableArray([]);
- this.contacts.loading = ko.observable(false).extend({'throttle': 200});
- this.contacts.importing = ko.observable(false).extend({'throttle': 200});
- this.contacts.syncing = ko.observable(false).extend({'throttle': 200});
- this.contacts.exportingVcf = ko.observable(false).extend({'throttle': 200});
- this.contacts.exportingCsv = ko.observable(false).extend({'throttle': 200});
-
- this.allowContactsSync = ko.observable(false);
- this.enableContactsSync = ko.observable(false);
- this.contactsSyncUrl = ko.observable('');
- this.contactsSyncUser = ko.observable('');
- this.contactsSyncPass = ko.observable('');
-
- this.allowContactsSync = ko.observable(!!RL.settingsGet('ContactsSyncIsAllowed'));
- this.enableContactsSync = ko.observable(!!RL.settingsGet('EnableContactsSync'));
- this.contactsSyncUrl = ko.observable(RL.settingsGet('ContactsSyncUrl'));
- this.contactsSyncUser = ko.observable(RL.settingsGet('ContactsSyncUser'));
- this.contactsSyncPass = ko.observable(RL.settingsGet('ContactsSyncPassword'));
-
- // folders
- this.namespace = '';
- this.folderList = ko.observableArray([]);
- this.folderList.focused = ko.observable(false);
-
- this.foldersListError = ko.observable('');
-
- this.foldersLoading = ko.observable(false);
- this.foldersCreating = ko.observable(false);
- this.foldersDeleting = ko.observable(false);
- this.foldersRenaming = ko.observable(false);
-
- this.foldersChanging = ko.computed(function () {
- var
- bLoading = this.foldersLoading(),
- bCreating = this.foldersCreating(),
- bDeleting = this.foldersDeleting(),
- bRenaming = this.foldersRenaming()
- ;
- return bLoading || bCreating || bDeleting || bRenaming;
- }, this);
-
- this.foldersInboxUnreadCount = ko.observable(0);
-
- this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.selected(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.selected(true);
- }
- }
- ]});
-
- this.currentFolderFullNameRaw = ko.computed(function () {
- return this.currentFolder() ? this.currentFolder().fullNameRaw : '';
- }, this);
-
- this.currentFolderFullName = ko.computed(function () {
- return this.currentFolder() ? this.currentFolder().fullName : '';
- }, this);
-
- this.currentFolderFullNameHash = ko.computed(function () {
- return this.currentFolder() ? this.currentFolder().fullNameHash : '';
- }, this);
-
- this.currentFolderName = ko.computed(function () {
- return this.currentFolder() ? this.currentFolder().name() : '';
- }, this);
-
- this.folderListSystemNames = ko.computed(function () {
-
- var
- aList = ['INBOX'],
- aFolders = this.folderList(),
- sSentFolder = this.sentFolder(),
- sDraftFolder = this.draftFolder(),
- sSpamFolder = this.spamFolder(),
- sTrashFolder = this.trashFolder(),
- sArchiveFolder = this.archiveFolder()
- ;
-
- if (Utils.isArray(aFolders) && 0 < aFolders.length)
- {
- if ('' !== sSentFolder && Consts.Values.UnuseOptionValue !== sSentFolder)
- {
- aList.push(sSentFolder);
- }
- if ('' !== sDraftFolder && Consts.Values.UnuseOptionValue !== sDraftFolder)
- {
- aList.push(sDraftFolder);
- }
- if ('' !== sSpamFolder && Consts.Values.UnuseOptionValue !== sSpamFolder)
- {
- aList.push(sSpamFolder);
- }
- if ('' !== sTrashFolder && Consts.Values.UnuseOptionValue !== sTrashFolder)
- {
- aList.push(sTrashFolder);
- }
- if ('' !== sArchiveFolder && Consts.Values.UnuseOptionValue !== sArchiveFolder)
- {
- aList.push(sArchiveFolder);
- }
- }
-
- return aList;
-
- }, this);
-
- this.folderListSystem = ko.computed(function () {
- return _.compact(_.map(this.folderListSystemNames(), function (sName) {
- return RL.cache().getFolderFromCacheList(sName);
- }));
- }, this);
-
- this.folderMenuForMove = ko.computed(function () {
- return RL.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), [
- this.currentFolderFullNameRaw()
- ], null, null, null, null, function (oItem) {
- return oItem ? oItem.localName() : '';
- });
- }, this);
-
- // message list
- this.staticMessageList = [];
-
- this.messageList = ko.observableArray([]).extend({'rateLimit': 0});
-
- this.messageListCount = ko.observable(0);
- this.messageListSearch = ko.observable('');
- this.messageListPage = ko.observable(1);
-
- this.messageListThreadFolder = ko.observable('');
- this.messageListThreadUids = ko.observableArray([]);
-
- this.messageListThreadFolder.subscribe(function () {
- this.messageListThreadUids([]);
- }, this);
-
- this.messageListEndFolder = ko.observable('');
- this.messageListEndSearch = ko.observable('');
- this.messageListEndPage = ko.observable(1);
-
- this.messageListEndHash = ko.computed(function () {
- return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage();
- }, this);
-
- this.messageListPageCount = ko.computed(function () {
- var iPage = Math.ceil(this.messageListCount() / this.messagesPerPage());
- return 0 >= iPage ? 1 : iPage;
- }, this);
-
- this.mainMessageListSearch = ko.computed({
- 'read': this.messageListSearch,
- 'write': function (sValue) {
- kn.setHash(RL.link().mailBox(
- this.currentFolderFullNameHash(), 1, Utils.trim(sValue.toString())
- ));
- },
- 'owner': this
- });
-
- this.messageListError = ko.observable('');
-
- this.messageListLoading = ko.observable(false);
- this.messageListIsNotCompleted = ko.observable(false);
- this.messageListCompleteLoadingThrottle = ko.observable(false).extend({'throttle': 200});
-
- this.messageListCompleteLoading = ko.computed(function () {
- var
- bOne = this.messageListLoading(),
- bTwo = this.messageListIsNotCompleted()
- ;
- return bOne || bTwo;
- }, this);
-
- this.messageListCompleteLoading.subscribe(function (bValue) {
- this.messageListCompleteLoadingThrottle(bValue);
- }, this);
-
- this.messageList.subscribe(_.debounce(function (aList) {
- _.each(aList, function (oItem) {
- if (oItem.newForAnimation())
- {
- oItem.newForAnimation(false);
- }
- });
- }, 500));
-
- // message preview
- this.staticMessageList = new MessageModel();
- this.message = ko.observable(null);
- this.messageLoading = ko.observable(false);
- this.messageLoadingThrottle = ko.observable(false).extend({'throttle': 50});
-
- this.message.focused = ko.observable(false);
-
- this.message.subscribe(function (oMessage) {
- if (!oMessage)
- {
- this.message.focused(false);
- this.messageFullScreenMode(false);
- this.hideMessageBodies();
-
- if (Enums.Layout.NoPreview === RL.data().layout() &&
- -1 < window.location.hash.indexOf('message-preview'))
- {
- RL.historyBack();
- }
- }
- else if (Enums.Layout.NoPreview === this.layout())
- {
- this.message.focused(true);
- }
- }, this);
-
- this.message.focused.subscribe(function (bValue) {
- if (bValue)
- {
- this.folderList.focused(false);
- this.keyScope(Enums.KeyState.MessageView);
- }
- else if (Enums.KeyState.MessageView === RL.data().keyScope())
- {
- if (Enums.Layout.NoPreview === RL.data().layout() && this.message())
- {
- this.keyScope(Enums.KeyState.MessageView);
- }
- else
- {
- this.keyScope(Enums.KeyState.MessageList);
- }
- }
- }, this);
-
- this.folderList.focused.subscribe(function (bValue) {
- if (bValue)
- {
- RL.data().keyScope(Enums.KeyState.FolderList);
- }
- else if (Enums.KeyState.FolderList === RL.data().keyScope())
- {
- RL.data().keyScope(Enums.KeyState.MessageList);
- }
- });
-
- this.messageLoading.subscribe(function (bValue) {
- this.messageLoadingThrottle(bValue);
- }, this);
-
- this.messageFullScreenMode = ko.observable(false);
-
- this.messageError = ko.observable('');
-
- this.messagesBodiesDom = ko.observable(null);
-
- this.messagesBodiesDom.subscribe(function (oDom) {
- if (oDom && !(oDom instanceof jQuery))
- {
- this.messagesBodiesDom($(oDom));
- }
- }, this);
-
- this.messageActiveDom = ko.observable(null);
-
- this.isMessageSelected = ko.computed(function () {
- return null !== this.message();
- }, this);
-
- this.currentMessage = ko.observable(null);
-
- this.messageListChecked = ko.computed(function () {
- return _.filter(this.messageList(), function (oItem) {
- return oItem.checked();
- });
- }, this).extend({'rateLimit': 0});
-
- this.hasCheckedMessages = ko.computed(function () {
- return 0 < this.messageListChecked().length;
- }, this).extend({'rateLimit': 0});
-
- this.messageListCheckedOrSelected = ko.computed(function () {
-
- var
- aChecked = this.messageListChecked(),
- oSelectedMessage = this.currentMessage()
- ;
-
- return _.union(aChecked, oSelectedMessage ? [oSelectedMessage] : []);
-
- }, this);
-
- this.messageListCheckedOrSelectedUidsWithSubMails = ko.computed(function () {
- var aList = [];
- _.each(this.messageListCheckedOrSelected(), function (oMessage) {
- if (oMessage)
- {
- aList.push(oMessage.uid);
- if (0 < oMessage.threadsLen() && 0 === oMessage.parentUid() && oMessage.lastInCollapsedThread())
- {
- aList = _.union(aList, oMessage.threads());
- }
- }
- });
- return aList;
- }, this);
-
- // quota
- this.userQuota = ko.observable(0);
- this.userUsageSize = ko.observable(0);
- this.userUsageProc = ko.computed(function () {
-
- var
- iQuota = this.userQuota(),
- iUsed = this.userUsageSize()
- ;
-
- return 0 < iQuota ? Math.ceil((iUsed / iQuota) * 100) : 0;
-
- }, this);
-
- // other
- this.capaOpenPGP = ko.observable(false);
- this.openpgpkeys = ko.observableArray([]);
- this.openpgpKeyring = null;
-
- this.openpgpkeysPublic = this.openpgpkeys.filter(function (oItem) {
- return !!(oItem && !oItem.isPrivate);
- });
-
- this.openpgpkeysPrivate = this.openpgpkeys.filter(function (oItem) {
- return !!(oItem && oItem.isPrivate);
- });
-
- // google
- this.googleActions = ko.observable(false);
- this.googleLoggined = ko.observable(false);
- this.googleUserName = ko.observable('');
-
- // facebook
- this.facebookActions = ko.observable(false);
- this.facebookLoggined = ko.observable(false);
- this.facebookUserName = ko.observable('');
-
- // twitter
- this.twitterActions = ko.observable(false);
- this.twitterLoggined = ko.observable(false);
- this.twitterUserName = ko.observable('');
-
- this.customThemeType = ko.observable(Enums.CustomThemeType.Light);
-
- this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
-}
-
-_.extend(WebMailDataStorage.prototype, AbstractData.prototype);
-
-WebMailDataStorage.prototype.purgeMessageBodyCache = function()
-{
- var
- iCount = 0,
- oMessagesBodiesDom = null,
- iEnd = Globals.iMessageBodyCacheCount - Consts.Values.MessageBodyCacheLimit
- ;
-
- if (0 < iEnd)
- {
- oMessagesBodiesDom = this.messagesBodiesDom();
- if (oMessagesBodiesDom)
- {
- oMessagesBodiesDom.find('.rl-cache-class').each(function () {
- var oItem = $(this);
- if (iEnd > oItem.data('rl-cache-count'))
- {
- oItem.addClass('rl-cache-purge');
- iCount++;
- }
- });
-
- if (0 < iCount)
- {
- _.delay(function () {
- oMessagesBodiesDom.find('.rl-cache-purge').remove();
- }, 300);
- }
- }
- }
-};
-
-WebMailDataStorage.prototype.populateDataOnStart = function()
-{
- AbstractData.prototype.populateDataOnStart.call(this);
-
- this.accountEmail(RL.settingsGet('Email'));
- this.accountIncLogin(RL.settingsGet('IncLogin'));
- this.accountOutLogin(RL.settingsGet('OutLogin'));
- this.projectHash(RL.settingsGet('ProjectHash'));
-
- this.defaultIdentityID(RL.settingsGet('DefaultIdentityID'));
-
- this.displayName(RL.settingsGet('DisplayName'));
- this.replyTo(RL.settingsGet('ReplyTo'));
- this.signature(RL.settingsGet('Signature'));
- this.signatureToAll(!!RL.settingsGet('SignatureToAll'));
- this.enableTwoFactor(!!RL.settingsGet('EnableTwoFactor'));
-
- this.lastFoldersHash = RL.local().get(Enums.ClientSideKeyName.FoldersLashHash) || '';
-
- this.remoteSuggestions = !!RL.settingsGet('RemoteSuggestions');
-
- this.devEmail = RL.settingsGet('DevEmail');
- this.devPassword = RL.settingsGet('DevPassword');
-};
-
-WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
-{
- if ('INBOX' === sFolder && Utils.isNormal(sUidNext) && sUidNext !== '')
- {
- if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length)
- {
- var
- oCache = RL.cache(),
- iIndex = 0,
- iLen = aNewMessages.length,
- fNotificationHelper = function (sImageSrc, sTitle, sText)
- {
- var oNotification = null;
- if (NotificationClass && RL.data().useDesktopNotifications())
- {
- oNotification = new NotificationClass(sTitle, {
- 'body': sText,
- 'icon': sImageSrc
- });
-
- if (oNotification)
- {
- if (oNotification.show)
- {
- oNotification.show();
- }
-
- window.setTimeout((function (oLocalNotifications) {
- return function () {
- if (oLocalNotifications.cancel)
- {
- oLocalNotifications.cancel();
- }
- else if (oLocalNotifications.close)
- {
- oLocalNotifications.close();
- }
- };
- }(oNotification)), 7000);
- }
- }
- }
- ;
-
- _.each(aNewMessages, function (oItem) {
- oCache.addNewMessageCache(sFolder, oItem.Uid);
- });
-
- if (3 < iLen)
- {
- fNotificationHelper(
- RL.link().notificationMailIcon(),
- RL.data().accountEmail(),
- Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
- 'COUNT': iLen
- })
- );
- }
- else
- {
- for (; iIndex < iLen; iIndex++)
- {
- fNotificationHelper(
- RL.link().notificationMailIcon(),
- MessageModel.emailsToLine(MessageModel.initEmailsFromJson(aNewMessages[iIndex].From), false),
- aNewMessages[iIndex].Subject
- );
- }
- }
- }
-
- RL.cache().setFolderUidNext(sFolder, sUidNext);
- }
-};
-
-/**
- * @param {string} sNamespace
- * @param {Array} aFolders
- * @return {Array}
- */
-WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFolders)
-{
- var
- iIndex = 0,
- iLen = 0,
- oFolder = null,
- oCacheFolder = null,
- sFolderFullNameRaw = '',
- aSubFolders = [],
- aList = []
- ;
-
- for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
- {
- oFolder = aFolders[iIndex];
- if (oFolder)
- {
- sFolderFullNameRaw = oFolder.FullNameRaw;
-
- oCacheFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw);
- if (!oCacheFolder)
- {
- oCacheFolder = FolderModel.newInstanceFromJson(oFolder);
- if (oCacheFolder)
- {
- RL.cache().setFolderToCacheList(sFolderFullNameRaw, oCacheFolder);
- RL.cache().setFolderFullNameRaw(oCacheFolder.fullNameHash, sFolderFullNameRaw);
- }
- }
-
- if (oCacheFolder)
- {
- oCacheFolder.collapsed(!Utils.isFolderExpanded(oCacheFolder.fullNameHash));
-
- if (oFolder.Extended)
- {
- if (oFolder.Extended.Hash)
- {
- RL.cache().setFolderHash(oCacheFolder.fullNameRaw, oFolder.Extended.Hash);
- }
-
- if (Utils.isNormal(oFolder.Extended.MessageCount))
- {
- oCacheFolder.messageCountAll(oFolder.Extended.MessageCount);
- }
-
- if (Utils.isNormal(oFolder.Extended.MessageUnseenCount))
- {
- oCacheFolder.messageCountUnread(oFolder.Extended.MessageUnseenCount);
- }
- }
-
- aSubFolders = oFolder['SubFolders'];
- if (aSubFolders && 'Collection/FolderCollection' === aSubFolders['@Object'] &&
- aSubFolders['@Collection'] && Utils.isArray(aSubFolders['@Collection']))
- {
- oCacheFolder.subFolders(
- this.folderResponseParseRec(sNamespace, aSubFolders['@Collection']));
- }
-
- aList.push(oCacheFolder);
- }
- }
- }
-
- return aList;
-};
-
-/**
- * @param {*} oData
- */
-WebMailDataStorage.prototype.setFolders = function (oData)
-{
- var
- aList = [],
- bUpdate = false,
- oRLData = RL.data(),
- fNormalizeFolder = function (sFolderFullNameRaw) {
- return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw ||
- null !== RL.cache().getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : '';
- }
- ;
-
- if (oData && oData.Result && 'Collection/FolderCollection' === oData.Result['@Object'] &&
- oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
- {
- if (!Utils.isUnd(oData.Result.Namespace))
- {
- oRLData.namespace = oData.Result.Namespace;
- }
-
- this.threading(!!RL.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true);
-
- aList = this.folderResponseParseRec(oRLData.namespace, oData.Result['@Collection']);
- oRLData.folderList(aList);
-
- if (oData.Result['SystemFolders'] &&
- '' === '' + RL.settingsGet('SentFolder') + RL.settingsGet('DraftFolder') +
- RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('ArchiveFolder') +
- RL.settingsGet('NullFolder'))
- {
- // TODO Magic Numbers
- RL.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null);
- RL.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null);
- RL.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null);
- RL.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null);
- RL.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null);
-
- bUpdate = true;
- }
-
- oRLData.sentFolder(fNormalizeFolder(RL.settingsGet('SentFolder')));
- oRLData.draftFolder(fNormalizeFolder(RL.settingsGet('DraftFolder')));
- oRLData.spamFolder(fNormalizeFolder(RL.settingsGet('SpamFolder')));
- oRLData.trashFolder(fNormalizeFolder(RL.settingsGet('TrashFolder')));
- oRLData.archiveFolder(fNormalizeFolder(RL.settingsGet('ArchiveFolder')));
-
- if (bUpdate)
- {
- RL.remote().saveSystemFolders(Utils.emptyFunction, {
- 'SentFolder': oRLData.sentFolder(),
- 'DraftFolder': oRLData.draftFolder(),
- 'SpamFolder': oRLData.spamFolder(),
- 'TrashFolder': oRLData.trashFolder(),
- 'ArchiveFolder': oRLData.archiveFolder(),
- 'NullFolder': 'NullFolder'
- });
- }
-
- RL.local().set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
- }
-};
-
-WebMailDataStorage.prototype.hideMessageBodies = function ()
-{
- var oMessagesBodiesDom = this.messagesBodiesDom();
- if (oMessagesBodiesDom)
- {
- oMessagesBodiesDom.find('.b-text-part').hide();
- }
-};
-
-/**
- * @param {boolean=} bBoot = false
- * @returns {Array}
- */
-WebMailDataStorage.prototype.getNextFolderNames = function (bBoot)
-{
- bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
-
- var
- aResult = [],
- iLimit = 10,
- iUtc = moment().unix(),
- iTimeout = iUtc - 60 * 5,
- aTimeouts = [],
- fSearchFunction = function (aList) {
- _.each(aList, function (oFolder) {
- if (oFolder && 'INBOX' !== oFolder.fullNameRaw &&
- oFolder.selectable && oFolder.existen &&
- iTimeout > oFolder.interval &&
- (!bBoot || oFolder.subScribed()))
- {
- aTimeouts.push([oFolder.interval, oFolder.fullNameRaw]);
- }
-
- if (oFolder && 0 < oFolder.subFolders().length)
- {
- fSearchFunction(oFolder.subFolders());
- }
- });
- }
- ;
-
- fSearchFunction(this.folderList());
-
- aTimeouts.sort(function(a, b) {
- if (a[0] < b[0])
- {
- return -1;
- }
- else if (a[0] > b[0])
- {
- return 1;
- }
-
- return 0;
- });
-
- _.find(aTimeouts, function (aItem) {
- var oFolder = RL.cache().getFolderFromCacheList(aItem[1]);
- if (oFolder)
- {
- oFolder.interval = iUtc;
- aResult.push(aItem[1]);
- }
-
- return iLimit <= aResult.length;
- });
-
- return _.uniq(aResult);
-};
-
-/**
- * @param {string} sFromFolderFullNameRaw
- * @param {Array} aUidForRemove
- * @param {string=} sToFolderFullNameRaw = ''
- * @param {bCopy=} bCopy = false
- */
-WebMailDataStorage.prototype.removeMessagesFromList = function (
- sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
-{
- sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : '';
- bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
-
- aUidForRemove = _.map(aUidForRemove, function (mValue) {
- return Utils.pInt(mValue);
- });
-
- var
- iUnseenCount = 0,
- oData = RL.data(),
- oCache = RL.cache(),
- aMessageList = oData.messageList(),
- oFromFolder = RL.cache().getFolderFromCacheList(sFromFolderFullNameRaw),
- oToFolder = '' === sToFolderFullNameRaw ? null : oCache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
- sCurrentFolderFullNameRaw = oData.currentFolderFullNameRaw(),
- oCurrentMessage = oData.message(),
- aMessages = sCurrentFolderFullNameRaw === sFromFolderFullNameRaw ? _.filter(aMessageList, function (oMessage) {
- return oMessage && -1 < Utils.inArray(Utils.pInt(oMessage.uid), aUidForRemove);
- }) : []
- ;
-
- _.each(aMessages, function (oMessage) {
- if (oMessage && oMessage.unseen())
- {
- iUnseenCount++;
- }
- });
-
- if (oFromFolder && !bCopy)
- {
- oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ?
- oFromFolder.messageCountAll() - aUidForRemove.length : 0);
-
- if (0 < iUnseenCount)
- {
- oFromFolder.messageCountUnread(0 <= oFromFolder.messageCountUnread() - iUnseenCount ?
- oFromFolder.messageCountUnread() - iUnseenCount : 0);
- }
- }
-
- if (oToFolder)
- {
- oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length);
- if (0 < iUnseenCount)
- {
- oToFolder.messageCountUnread(oToFolder.messageCountUnread() + iUnseenCount);
- }
-
- oToFolder.actionBlink(true);
- }
-
- if (0 < aMessages.length)
- {
- if (bCopy)
- {
- _.each(aMessages, function (oMessage) {
- oMessage.checked(false);
- });
- }
- else
- {
- oData.messageListIsNotCompleted(true);
-
- _.each(aMessages, function (oMessage) {
- if (oCurrentMessage && oCurrentMessage.hash === oMessage.hash)
- {
- oCurrentMessage = null;
- oData.message(null);
- }
-
- oMessage.deleted(true);
- });
-
- _.delay(function () {
- _.each(aMessages, function (oMessage) {
- oData.messageList.remove(oMessage);
- });
- }, 400);
- }
- }
-
- if ('' !== sFromFolderFullNameRaw)
- {
- oCache.setFolderHash(sFromFolderFullNameRaw, '');
- }
-
- if ('' !== sToFolderFullNameRaw)
- {
- oCache.setFolderHash(sToFolderFullNameRaw, '');
- }
-};
-
-WebMailDataStorage.prototype.setMessage = function (oData, bCached)
-{
- var
- bIsHtml = false,
- bHasExternals = false,
- bHasInternals = false,
- oBody = null,
- oTextBody = null,
- sId = '',
- sResultHtml = '',
- bPgpSigned = false,
- bPgpEncrypted = false,
- oMessagesBodiesDom = this.messagesBodiesDom(),
- oMessage = this.message()
- ;
-
- if (oData && oMessage && oData.Result && 'Object/Message' === oData.Result['@Object'] &&
- oMessage.folderFullNameRaw === oData.Result.Folder && oMessage.uid === oData.Result.Uid)
- {
- this.messageError('');
-
- oMessage.initUpdateByMessageJson(oData.Result);
- RL.cache().addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
-
- if (!bCached)
- {
- oMessage.initFlagsByJson(oData.Result);
- }
-
- oMessagesBodiesDom = oMessagesBodiesDom && oMessagesBodiesDom[0] ? oMessagesBodiesDom : null;
- if (oMessagesBodiesDom)
- {
- sId = 'rl-mgs-' + oMessage.hash.replace(/[^a-zA-Z0-9]/g, '');
- oTextBody = oMessagesBodiesDom.find('#' + sId);
- if (!oTextBody || !oTextBody[0])
- {
- bHasExternals = !!oData.Result.HasExternals;
- bHasInternals = !!oData.Result.HasInternals;
-
- oBody = $('').hide().addClass('rl-cache-class');
- oBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
-
- if (Utils.isNormal(oData.Result.Html) && '' !== oData.Result.Html)
- {
- bIsHtml = true;
- sResultHtml = oData.Result.Html.toString();
- }
- else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain)
- {
- bIsHtml = false;
- sResultHtml = Utils.plainToHtml(oData.Result.Plain.toString(), false);
-
- if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && RL.data().capaOpenPGP())
- {
- oMessage.plainRaw = Utils.pString(oData.Result.Plain);
-
- bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oMessage.plainRaw);
- if (!bPgpEncrypted)
- {
- bPgpSigned = /-----BEGIN PGP SIGNED MESSAGE-----/.test(oMessage.plainRaw) &&
- /-----BEGIN PGP SIGNATURE-----/.test(oMessage.plainRaw);
- }
-
- $proxyDiv.empty();
- if (bPgpSigned && oMessage.isPgpSigned())
- {
- sResultHtml =
- $proxyDiv.append(
- $('').text(oMessage.plainRaw)
- ).html()
- ;
- }
- else if (bPgpEncrypted && oMessage.isPgpEncrypted())
- {
- sResultHtml =
- $proxyDiv.append(
- $('').text(oMessage.plainRaw)
- ).html()
- ;
- }
-
- $proxyDiv.empty();
-
- oMessage.isPgpSigned(bPgpSigned);
- oMessage.isPgpEncrypted(bPgpEncrypted);
- }
- }
- else
- {
- bIsHtml = false;
- }
-
- oBody
- .html(Utils.linkify(sResultHtml))
- .addClass('b-text-part ' + (bIsHtml ? 'html' : 'plain'))
- ;
-
- oMessage.isHtml(!!bIsHtml);
- oMessage.hasImages(!!bHasExternals);
- oMessage.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
- oMessage.pgpSignedVerifyUser('');
-
- oMessage.body = oBody;
- if (oMessage.body)
- {
- oMessagesBodiesDom.append(oMessage.body);
- }
-
- oMessage.storeDataToDom();
-
- if (bHasInternals)
- {
- oMessage.showInternalImages(true);
- }
-
- if (oMessage.hasImages() && this.showImages())
- {
- oMessage.showExternalImages(true);
- }
-
- this.purgeMessageBodyCacheThrottle();
- }
- else
- {
- oMessage.body = oTextBody;
- if (oMessage.body)
- {
- oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
- oMessage.fetchDataToDom();
- }
- }
-
- this.messageActiveDom(oMessage.body);
-
- this.hideMessageBodies();
- oMessage.body.show();
-
- if (oBody)
- {
- Utils.initBlockquoteSwitcher(oBody);
- }
- }
-
- RL.cache().initMessageFlagsFromCache(oMessage);
- if (oMessage.unseen())
- {
- RL.setMessageSeen(oMessage);
- }
-
- Utils.windowResize();
- }
-};
-
-/**
- * @param {Array} aList
- * @returns {string}
- */
-WebMailDataStorage.prototype.calculateMessageListHash = function (aList)
-{
- return _.map(aList, function (oMessage) {
- return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
- }).join('|');
-};
-
-WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
-{
- if (oData && oData.Result && 'Collection/MessageCollection' === oData.Result['@Object'] &&
- oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
- {
- var
- oRainLoopData = RL.data(),
- oCache = RL.cache(),
- mLastCollapsedThreadUids = null,
- iIndex = 0,
- iLen = 0,
- iCount = 0,
- iOffset = 0,
- aList = [],
- iUtc = moment().unix(),
- aStaticList = oRainLoopData.staticMessageList,
- oJsonMessage = null,
- oMessage = null,
- oFolder = null,
- iNewCount = 0,
- bUnreadCountChange = false
- ;
-
- iCount = Utils.pInt(oData.Result.MessageResultCount);
- iOffset = Utils.pInt(oData.Result.Offset);
-
- if (Utils.isNonEmptyArray(oData.Result.LastCollapsedThreadUids))
- {
- mLastCollapsedThreadUids = oData.Result.LastCollapsedThreadUids;
- }
-
- oFolder = RL.cache().getFolderFromCacheList(
- Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
-
- if (oFolder && !bCached)
- {
- oFolder.interval = iUtc;
-
- RL.cache().setFolderHash(oData.Result.Folder, oData.Result.FolderHash);
-
- if (Utils.isNormal(oData.Result.MessageCount))
- {
- oFolder.messageCountAll(oData.Result.MessageCount);
- }
-
- if (Utils.isNormal(oData.Result.MessageUnseenCount))
- {
- if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
- {
- bUnreadCountChange = true;
- }
-
- oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
- }
-
- this.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
- }
-
- if (bUnreadCountChange && oFolder)
- {
- RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
- }
-
- for (iIndex = 0, iLen = oData.Result['@Collection'].length; iIndex < iLen; iIndex++)
- {
- oJsonMessage = oData.Result['@Collection'][iIndex];
- if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
- {
- oMessage = aStaticList[iIndex];
- if (!oMessage || !oMessage.initByJson(oJsonMessage))
- {
- oMessage = MessageModel.newInstanceFromJson(oJsonMessage);
- }
-
- if (oMessage)
- {
- if (oCache.hasNewMessageAndRemoveFromCache(oMessage.folderFullNameRaw, oMessage.uid) && 5 >= iNewCount)
- {
- iNewCount++;
- oMessage.newForAnimation(true);
- }
-
- oMessage.deleted(false);
-
- if (bCached)
- {
- RL.cache().initMessageFlagsFromCache(oMessage);
- }
- else
- {
- RL.cache().storeMessageFlagsToCache(oMessage);
- }
-
- oMessage.lastInCollapsedThread(mLastCollapsedThreadUids && -1 < Utils.inArray(Utils.pInt(oMessage.uid), mLastCollapsedThreadUids) ? true : false);
-
- aList.push(oMessage);
- }
- }
- }
-
- oRainLoopData.messageListCount(iCount);
- oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
- oRainLoopData.messageListPage(Math.ceil((iOffset / oRainLoopData.messagesPerPage()) + 1));
- oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
- oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
- oRainLoopData.messageListEndPage(oRainLoopData.messageListPage());
-
- oRainLoopData.messageList(aList);
- oRainLoopData.messageListIsNotCompleted(false);
-
- if (aStaticList.length < aList.length)
- {
- oRainLoopData.staticMessageList = aList;
- }
-
- oCache.clearNewMessageCache();
-
- if (oFolder && (bCached || bUnreadCountChange || RL.data().useThreads()))
- {
- RL.folderInformation(oFolder.fullNameRaw, aList);
- }
- }
- else
- {
- RL.data().messageListCount(0);
- RL.data().messageList([]);
- RL.data().messageListError(Utils.getNotification(
- oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList
- ));
- }
-};
-
-WebMailDataStorage.prototype.findPublicKeyByHex = function (sHash)
-{
- return _.find(this.openpgpkeysPublic(), function (oItem) {
- return oItem && sHash === oItem.id;
- });
-};
-
-WebMailDataStorage.prototype.findPublicKeysByEmail = function (sEmail)
-{
- return _.compact(_.map(this.openpgpkeysPublic(), function (oItem) {
-
- var oKey = null;
- if (oItem && sEmail === oItem.email)
- {
- try
- {
- oKey = window.openpgp.key.readArmored(oItem.armor);
- if (oKey && !oKey.err && oKey.keys && oKey.keys[0])
- {
- return oKey.keys[0];
- }
- }
- catch (e) {}
- }
-
- return null;
-
- }));
-};
-
-/**
- * @param {string} sEmail
- * @param {string=} sPassword
- * @returns {?}
- */
-WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
-{
- var
- oPrivateKey = null,
- oKey = _.find(this.openpgpkeysPrivate(), function (oItem) {
- return oItem && sEmail === oItem.email;
- })
- ;
-
- if (oKey)
- {
- try
- {
- oPrivateKey = window.openpgp.key.readArmored(oKey.armor);
- if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
- {
- oPrivateKey = oPrivateKey.keys[0];
- oPrivateKey.decrypt(Utils.pString(sPassword));
- }
- else
- {
- oPrivateKey = null;
- }
- }
- catch (e)
- {
- oPrivateKey = null;
- }
- }
-
- return oPrivateKey;
-};
-
-/**
- * @param {string=} sPassword
- * @returns {?}
- */
-WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword)
-{
- return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function AbstractAjaxRemoteStorage()
-{
- this.oRequests = {};
-}
-
-AbstractAjaxRemoteStorage.prototype.oRequests = {};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sRequestAction
- * @param {string} sType
- * @param {?AjaxJsonDefaultResponse} oData
- * @param {boolean} bCached
- * @param {*=} oRequestParameters
- */
-AbstractAjaxRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
-{
- var
- fCall = function () {
- if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
- {
- sType = Enums.StorageResultType.Unload;
- }
-
- if (Enums.StorageResultType.Success === sType && oData && !oData.Result)
- {
- if (oData && -1 < Utils.inArray(oData.ErrorCode, [
- Enums.Notification.AuthError, Enums.Notification.AccessError,
- Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
- Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
- ]))
- {
- Globals.iAjaxErrorCount++;
- }
-
- if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
- {
- Globals.iTokenErrorCount++;
- }
-
- if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
- {
- RL.loginAndLogoutReload(true);
- }
-
- if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
- {
- if (window.__rlah_clear)
- {
- window.__rlah_clear();
- }
-
- RL.loginAndLogoutReload(true);
- }
- }
- else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
- {
- Globals.iAjaxErrorCount = 0;
- Globals.iTokenErrorCount = 0;
- }
-
- if (fCallback)
- {
- Plugins.runHook('ajax-default-response', [sRequestAction, Enums.StorageResultType.Success === sType ? oData : null, sType, bCached, oRequestParameters]);
-
- fCallback(
- sType,
- Enums.StorageResultType.Success === sType ? oData : null,
- bCached,
- sRequestAction,
- oRequestParameters
- );
- }
- }
- ;
-
- switch (sType)
- {
- case 'success':
- sType = Enums.StorageResultType.Success;
- break;
- case 'abort':
- sType = Enums.StorageResultType.Abort;
- break;
- default:
- sType = Enums.StorageResultType.Error;
- break;
- }
-
- if (Enums.StorageResultType.Error === sType)
- {
- _.delay(fCall, 300);
- }
- else
- {
- fCall();
- }
-};
-
-/**
- * @param {?Function} fResultCallback
- * @param {Object} oParameters
- * @param {?number=} iTimeOut = 20000
- * @param {string=} sGetAdd = ''
- * @param {Array=} aAbortActions = []
- * @return {jQuery.jqXHR}
- */
-AbstractAjaxRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
-{
- var
- self = this,
- bPost = '' === sGetAdd,
- oHeaders = {},
- iStart = (new window.Date()).getTime(),
- oDefAjax = null,
- sAction = ''
- ;
-
- oParameters = oParameters || {};
- iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
- sGetAdd = Utils.isUnd(sGetAdd) ? '' : Utils.pString(sGetAdd);
- aAbortActions = Utils.isArray(aAbortActions) ? aAbortActions : [];
-
- sAction = oParameters.Action || '';
-
- if (sAction && 0 < aAbortActions.length)
- {
- _.each(aAbortActions, function (sActionToAbort) {
- if (self.oRequests[sActionToAbort])
- {
- self.oRequests[sActionToAbort].__aborted = true;
- if (self.oRequests[sActionToAbort].abort)
- {
- self.oRequests[sActionToAbort].abort();
- }
- self.oRequests[sActionToAbort] = null;
- }
- });
- }
-
- if (bPost)
- {
- oParameters['XToken'] = RL.settingsGet('Token');
- }
-
- oDefAjax = $.ajax({
- 'type': bPost ? 'POST' : 'GET',
- 'url': RL.link().ajax(sGetAdd),
- 'async': true,
- 'dataType': 'json',
- 'data': bPost ? oParameters : {},
- 'headers': oHeaders,
- 'timeout': iTimeOut,
- 'global': true
- });
-
- oDefAjax.always(function (oData, sType) {
-
- var bCached = false;
- if (oData && oData['Time'])
- {
- bCached = Utils.pInt(oData['Time']) > (new window.Date()).getTime() - iStart;
- }
-
- if (sAction && self.oRequests[sAction])
- {
- if (self.oRequests[sAction].__aborted)
- {
- sType = 'abort';
- }
-
- self.oRequests[sAction] = null;
- }
-
- self.defaultResponse(fResultCallback, sAction, sType, oData, bCached, oParameters);
- });
-
- if (sAction && 0 < aAbortActions.length && -1 < Utils.inArray(sAction, aAbortActions))
- {
- if (this.oRequests[sAction])
- {
- this.oRequests[sAction].__aborted = true;
- if (this.oRequests[sAction].abort)
- {
- this.oRequests[sAction].abort();
- }
- this.oRequests[sAction] = null;
- }
-
- this.oRequests[sAction] = oDefAjax;
- }
-
- return oDefAjax;
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sAction
- * @param {Object=} oParameters
- * @param {?number=} iTimeout
- * @param {string=} sGetAdd = ''
- * @param {Array=} aAbortActions = []
- */
-AbstractAjaxRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
-{
- oParameters = oParameters || {};
- oParameters.Action = sAction;
-
- sGetAdd = Utils.pString(sGetAdd);
-
- Plugins.runHook('ajax-default-request', [sAction, oParameters, sGetAdd]);
-
- this.ajaxRequest(fCallback, oParameters,
- Utils.isUnd(iTimeout) ? Consts.Defaults.DefaultAjaxTimeout : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
-};
-
-/**
- * @param {?Function} fCallback
- */
-AbstractAjaxRemoteStorage.prototype.noop = function (fCallback)
-{
- this.defaultRequest(fCallback, 'Noop');
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sMessage
- * @param {string} sFileName
- * @param {number} iLineNo
- * @param {string} sLocation
- * @param {string} sHtmlCapa
- * @param {number} iTime
- */
-AbstractAjaxRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
-{
- this.defaultRequest(fCallback, 'JsError', {
- 'Message': sMessage,
- 'FileName': sFileName,
- 'LineNo': iLineNo,
- 'Location': sLocation,
- 'HtmlCapa': sHtmlCapa,
- 'TimeOnPage': iTime
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sType
- * @param {Array=} mData = null
- * @param {boolean=} bIsError = false
- */
-AbstractAjaxRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
-{
- this.defaultRequest(fCallback, 'JsInfo', {
- 'Type': sType,
- 'Data': mData,
- 'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- */
-AbstractAjaxRemoteStorage.prototype.getPublicKey = function (fCallback)
-{
- this.defaultRequest(fCallback, 'GetPublicKey');
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sVersion
- */
-AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
-{
- this.defaultRequest(fCallback, 'Version', {
- 'Version': sVersion
- });
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractAjaxRemoteStorage
- */
-function WebMailAjaxRemoteStorage()
-{
- AbstractAjaxRemoteStorage.call(this);
-
- this.oRequests = {};
-}
-
-_.extend(WebMailAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype);
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.folders = function (fCallback)
-{
- this.defaultRequest(fCallback, 'Folders', {
- 'SentFolder': RL.settingsGet('SentFolder'),
- 'DraftFolder': RL.settingsGet('DraftFolder'),
- 'SpamFolder': RL.settingsGet('SpamFolder'),
- 'TrashFolder': RL.settingsGet('TrashFolder'),
- 'ArchiveFolder': RL.settingsGet('ArchiveFolder')
- }, null, '', ['Folders']);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sEmail
- * @param {string} sLogin
- * @param {string} sPassword
- * @param {boolean} bSignMe
- * @param {string=} sLanguage
- * @param {string=} sAdditionalCode
- * @param {boolean=} bAdditionalCodeSignMe
- */
-WebMailAjaxRemoteStorage.prototype.login = function (fCallback, sEmail, sLogin, sPassword, bSignMe, sLanguage, sAdditionalCode, bAdditionalCodeSignMe)
-{
- this.defaultRequest(fCallback, 'Login', {
- 'Email': sEmail,
- 'Login': sLogin,
- 'Password': sPassword,
- 'Language': sLanguage || '',
- 'AdditionalCode': sAdditionalCode || '',
- 'AdditionalCodeSignMe': bAdditionalCodeSignMe ? '1' : '0',
- 'SignMe': bSignMe ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.getTwoFactor = function (fCallback)
-{
- this.defaultRequest(fCallback, 'GetTwoFactorInfo');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.createTwoFactor = function (fCallback)
-{
- this.defaultRequest(fCallback, 'CreateTwoFactorSecret');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.clearTwoFactor = function (fCallback)
-{
- this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
-{
- this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sCode
- */
-WebMailAjaxRemoteStorage.prototype.testTwoFactor = function (fCallback, sCode)
-{
- this.defaultRequest(fCallback, 'TestTwoFactorInfo', {
- 'Code': sCode
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {boolean} bEnable
- */
-WebMailAjaxRemoteStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
-{
- this.defaultRequest(fCallback, 'EnableTwoFactor', {
- 'Enable': bEnable ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.clearTwoFactorInfo = function (fCallback)
-{
- this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.contactsSync = function (fCallback)
-{
- this.defaultRequest(fCallback, 'ContactsSync', null, Consts.Defaults.ContactsSyncAjaxTimeout);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {boolean} bEnable
- * @param {string} sUrl
- * @param {string} sUser
- * @param {string} sPassword
- */
-WebMailAjaxRemoteStorage.prototype.saveContactsSyncData = function (fCallback, bEnable, sUrl, sUser, sPassword)
-{
- this.defaultRequest(fCallback, 'SaveContactsSyncData', {
- 'Enable': bEnable ? '1' : '0',
- 'Url': sUrl,
- 'User': sUser,
- 'Password': sPassword
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sEmail
- * @param {string} sLogin
- * @param {string} sPassword
- */
-WebMailAjaxRemoteStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
-{
- this.defaultRequest(fCallback, 'AccountAdd', {
- 'Email': sEmail,
- 'Login': sLogin,
- 'Password': sPassword
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sEmailToDelete
- */
-WebMailAjaxRemoteStorage.prototype.accountDelete = function (fCallback, sEmailToDelete)
-{
- this.defaultRequest(fCallback, 'AccountDelete', {
- 'EmailToDelete': sEmailToDelete
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sId
- * @param {string} sEmail
- * @param {string} sName
- * @param {string} sReplyTo
- * @param {string} sBcc
- */
-WebMailAjaxRemoteStorage.prototype.identityUpdate = function (fCallback, sId, sEmail, sName, sReplyTo, sBcc)
-{
- this.defaultRequest(fCallback, 'IdentityUpdate', {
- 'Id': sId,
- 'Email': sEmail,
- 'Name': sName,
- 'ReplyTo': sReplyTo,
- 'Bcc': sBcc
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sIdToDelete
- */
-WebMailAjaxRemoteStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
-{
- this.defaultRequest(fCallback, 'IdentityDelete', {
- 'IdToDelete': sIdToDelete
- });
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.accountsAndIdentities = function (fCallback)
-{
- this.defaultRequest(fCallback, 'AccountsAndIdentities');
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {number=} iOffset = 0
- * @param {number=} iLimit = 20
- * @param {string=} sSearch = ''
- * @param {boolean=} bSilent = false
- */
-WebMailAjaxRemoteStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
-{
- sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
-
- var
- oData = RL.data(),
- sFolderHash = RL.cache().getFolderHash(sFolderFullNameRaw)
- ;
-
- bSilent = Utils.isUnd(bSilent) ? false : !!bSilent;
- iOffset = Utils.isUnd(iOffset) ? 0 : Utils.pInt(iOffset);
- iLimit = Utils.isUnd(iOffset) ? 20 : Utils.pInt(iLimit);
- sSearch = Utils.pString(sSearch);
-
- if ('' !== sFolderHash && ('' === sSearch || -1 === sSearch.indexOf('is:')))
- {
- this.defaultRequest(fCallback, 'MessageList', {},
- '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout,
- 'MessageList/' + Base64.urlsafe_encode([
- sFolderFullNameRaw,
- iOffset,
- iLimit,
- sSearch,
- oData.projectHash(),
- sFolderHash,
- 'INBOX' === sFolderFullNameRaw ? RL.cache().getFolderUidNext(sFolderFullNameRaw) : '',
- oData.threading() && oData.useThreads() ? '1' : '0',
- oData.threading() && sFolderFullNameRaw === oData.messageListThreadFolder() ? oData.messageListThreadUids().join(',') : ''
- ].join(String.fromCharCode(0))), bSilent ? [] : ['MessageList']);
- }
- else
- {
- this.defaultRequest(fCallback, 'MessageList', {
- 'Folder': sFolderFullNameRaw,
- 'Offset': iOffset,
- 'Limit': iLimit,
- 'Search': sSearch,
- 'UidNext': 'INBOX' === sFolderFullNameRaw ? RL.cache().getFolderUidNext(sFolderFullNameRaw) : '',
- 'UseThreads': RL.data().threading() && RL.data().useThreads() ? '1' : '0',
- 'ExpandedThreadUid': oData.threading() && sFolderFullNameRaw === oData.messageListThreadFolder() ? oData.messageListThreadUids().join(',') : ''
- }, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, '', bSilent ? [] : ['MessageList']);
- }
-};
-
-/**
- * @param {?Function} fCallback
- * @param {Array} aDownloads
- */
-WebMailAjaxRemoteStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
-{
- this.defaultRequest(fCallback, 'MessageUploadAttachments', {
- 'Attachments': aDownloads
- }, 999000);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {number} iUid
- * @return {boolean}
- */
-WebMailAjaxRemoteStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
-{
- sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
- iUid = Utils.pInt(iUid);
-
- if (RL.cache().getFolderFromCacheList(sFolderFullNameRaw) && 0 < iUid)
- {
- this.defaultRequest(fCallback, 'Message', {}, null,
- 'Message/' + Base64.urlsafe_encode([
- sFolderFullNameRaw,
- iUid,
- RL.data().projectHash(),
- RL.data().threading() && RL.data().useThreads() ? '1' : '0'
- ].join(String.fromCharCode(0))), ['Message']);
-
- return true;
- }
-
- return false;
-};
-
-/**
- * @param {?Function} fCallback
- * @param {Array} aExternals
- */
-WebMailAjaxRemoteStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
-{
- this.defaultRequest(fCallback, 'ComposeUploadExternals', {
- 'Externals': aExternals
- }, 999000);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sUrl
- * @param {string} sAccessToken
- */
-WebMailAjaxRemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
-{
- this.defaultRequest(fCallback, 'ComposeUploadDrive', {
- 'AccessToken': sAccessToken,
- 'Url': sUrl
- }, 999000);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolder
- * @param {Array=} aList = []
- */
-WebMailAjaxRemoteStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
-{
- var
- bRequest = true,
- oCache = RL.cache(),
- aUids = []
- ;
-
- if (Utils.isArray(aList) && 0 < aList.length)
- {
- bRequest = false;
- _.each(aList, function (oMessageListItem) {
- if (!oCache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, oMessageListItem.uid))
- {
- aUids.push(oMessageListItem.uid);
- }
-
- if (0 < oMessageListItem.threads().length)
- {
- _.each(oMessageListItem.threads(), function (sUid) {
- if (!oCache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, sUid))
- {
- aUids.push(sUid);
- }
- });
- }
- });
-
- if (0 < aUids.length)
- {
- bRequest = true;
- }
- }
-
- if (bRequest)
- {
- this.defaultRequest(fCallback, 'FolderInformation', {
- 'Folder': sFolder,
- 'FlagsUids': Utils.isArray(aUids) ? aUids.join(',') : '',
- 'UidNext': 'INBOX' === sFolder ? RL.cache().getFolderUidNext(sFolder) : ''
- });
- }
- else if (RL.data().useThreads())
- {
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
-};
-
-/**
- * @param {?Function} fCallback
- * @param {Array} aFolders
- */
-WebMailAjaxRemoteStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
-{
- this.defaultRequest(fCallback, 'FolderInformationMultiply', {
- 'Folders': aFolders
- });
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.logout = function (fCallback)
-{
- this.defaultRequest(fCallback, 'Logout');
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {Array} aUids
- * @param {boolean} bSetFlagged
- */
-WebMailAjaxRemoteStorage.prototype.messageSetFlagged = function (fCallback, sFolderFullNameRaw, aUids, bSetFlagged)
-{
- this.defaultRequest(fCallback, 'MessageSetFlagged', {
- 'Folder': sFolderFullNameRaw,
- 'Uids': aUids.join(','),
- 'SetAction': bSetFlagged ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {Array} aUids
- * @param {boolean} bSetSeen
- */
-WebMailAjaxRemoteStorage.prototype.messageSetSeen = function (fCallback, sFolderFullNameRaw, aUids, bSetSeen)
-{
- this.defaultRequest(fCallback, 'MessageSetSeen', {
- 'Folder': sFolderFullNameRaw,
- 'Uids': aUids.join(','),
- 'SetAction': bSetSeen ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {boolean} bSetSeen
- */
-WebMailAjaxRemoteStorage.prototype.messageSetSeenToAll = function (fCallback, sFolderFullNameRaw, bSetSeen)
-{
- this.defaultRequest(fCallback, 'MessageSetSeenToAll', {
- 'Folder': sFolderFullNameRaw,
- 'SetAction': bSetSeen ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sMessageFolder
- * @param {string} sMessageUid
- * @param {string} sDraftFolder
- * @param {string} sFrom
- * @param {string} sTo
- * @param {string} sCc
- * @param {string} sBcc
- * @param {string} sSubject
- * @param {boolean} bTextIsHtml
- * @param {string} sText
- * @param {Array} aAttachments
- * @param {(Array|null)} aDraftInfo
- * @param {string} sInReplyTo
- * @param {string} sReferences
- */
-WebMailAjaxRemoteStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder,
- sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences)
-{
- this.defaultRequest(fCallback, 'SaveMessage', {
- 'MessageFolder': sMessageFolder,
- 'MessageUid': sMessageUid,
- 'DraftFolder': sDraftFolder,
- 'From': sFrom,
- 'To': sTo,
- 'Cc': sCc,
- 'Bcc': sBcc,
- 'Subject': sSubject,
- 'TextIsHtml': bTextIsHtml ? '1' : '0',
- 'Text': sText,
- 'DraftInfo': aDraftInfo,
- 'InReplyTo': sInReplyTo,
- 'References': sReferences,
- 'Attachments': aAttachments
- }, Consts.Defaults.SaveMessageAjaxTimeout);
-};
-
-
-/**
- * @param {?Function} fCallback
- * @param {string} sMessageFolder
- * @param {string} sMessageUid
- * @param {string} sReadReceipt
- * @param {string} sSubject
- * @param {string} sText
- */
-WebMailAjaxRemoteStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText)
-{
- this.defaultRequest(fCallback, 'SendReadReceiptMessage', {
- 'MessageFolder': sMessageFolder,
- 'MessageUid': sMessageUid,
- 'ReadReceipt': sReadReceipt,
- 'Subject': sSubject,
- 'Text': sText
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sMessageFolder
- * @param {string} sMessageUid
- * @param {string} sSentFolder
- * @param {string} sFrom
- * @param {string} sTo
- * @param {string} sCc
- * @param {string} sBcc
- * @param {string} sSubject
- * @param {boolean} bTextIsHtml
- * @param {string} sText
- * @param {Array} aAttachments
- * @param {(Array|null)} aDraftInfo
- * @param {string} sInReplyTo
- * @param {string} sReferences
- * @param {boolean} bRequestReadReceipt
- */
-WebMailAjaxRemoteStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder,
- sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bRequestReadReceipt)
-{
- this.defaultRequest(fCallback, 'SendMessage', {
- 'MessageFolder': sMessageFolder,
- 'MessageUid': sMessageUid,
- 'SentFolder': sSentFolder,
- 'From': sFrom,
- 'To': sTo,
- 'Cc': sCc,
- 'Bcc': sBcc,
- 'Subject': sSubject,
- 'TextIsHtml': bTextIsHtml ? '1' : '0',
- 'Text': sText,
- 'DraftInfo': aDraftInfo,
- 'InReplyTo': sInReplyTo,
- 'References': sReferences,
- 'ReadReceiptRequest': bRequestReadReceipt ? '1' : '0',
- 'Attachments': aAttachments
- }, Consts.Defaults.SendMessageAjaxTimeout);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {Object} oData
- */
-WebMailAjaxRemoteStorage.prototype.saveSystemFolders = function (fCallback, oData)
-{
- this.defaultRequest(fCallback, 'SystemFoldersUpdate', oData);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {Object} oData
- */
-WebMailAjaxRemoteStorage.prototype.saveSettings = function (fCallback, oData)
-{
- this.defaultRequest(fCallback, 'SettingsUpdate', oData);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sPrevPassword
- * @param {string} sNewPassword
- */
-WebMailAjaxRemoteStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
-{
- this.defaultRequest(fCallback, 'ChangePassword', {
- 'PrevPassword': sPrevPassword,
- 'NewPassword': sNewPassword
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sNewFolderName
- * @param {string} sParentName
- */
-WebMailAjaxRemoteStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
-{
- this.defaultRequest(fCallback, 'FolderCreate', {
- 'Folder': sNewFolderName,
- 'Parent': sParentName
- }, null, '', ['Folders']);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- */
-WebMailAjaxRemoteStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
-{
- this.defaultRequest(fCallback, 'FolderDelete', {
- 'Folder': sFolderFullNameRaw
- }, null, '', ['Folders']);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sPrevFolderFullNameRaw
- * @param {string} sNewFolderName
- */
-WebMailAjaxRemoteStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
-{
- this.defaultRequest(fCallback, 'FolderRename', {
- 'Folder': sPrevFolderFullNameRaw,
- 'NewFolderName': sNewFolderName
- }, null, '', ['Folders']);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- */
-WebMailAjaxRemoteStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
-{
- this.defaultRequest(fCallback, 'FolderClear', {
- 'Folder': sFolderFullNameRaw
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {boolean} bSubscribe
- */
-WebMailAjaxRemoteStorage.prototype.folderSetSubscribe = function (fCallback, sFolderFullNameRaw, bSubscribe)
-{
- this.defaultRequest(fCallback, 'FolderSubscribe', {
- 'Folder': sFolderFullNameRaw,
- 'Subscribe': bSubscribe ? '1' : '0'
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolder
- * @param {string} sToFolder
- * @param {Array} aUids
- * @param {string=} sLearning
- */
-WebMailAjaxRemoteStorage.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning)
-{
- this.defaultRequest(fCallback, 'MessageMove', {
- 'FromFolder': sFolder,
- 'ToFolder': sToFolder,
- 'Uids': aUids.join(','),
- 'Learning': sLearning || ''
- }, null, '', ['MessageList']);
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolder
- * @param {string} sToFolder
- * @param {Array} aUids
- */
-WebMailAjaxRemoteStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids)
-{
- this.defaultRequest(fCallback, 'MessageCopy', {
- 'FromFolder': sFolder,
- 'ToFolder': sToFolder,
- 'Uids': aUids.join(',')
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sFolder
- * @param {Array} aUids
- */
-WebMailAjaxRemoteStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
-{
- this.defaultRequest(fCallback, 'MessageDelete', {
- 'Folder': sFolder,
- 'Uids': aUids.join(',')
- }, null, '', ['MessageList']);
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.appDelayStart = function (fCallback)
-{
- this.defaultRequest(fCallback, 'AppDelayStart');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.quota = function (fCallback)
-{
- this.defaultRequest(fCallback, 'Quota');
-};
-
-/**
- * @param {?Function} fCallback
- * @param {number} iOffset
- * @param {number} iLimit
- * @param {string} sSearch
- */
-WebMailAjaxRemoteStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
-{
- this.defaultRequest(fCallback, 'Contacts', {
- 'Offset': iOffset,
- 'Limit': iLimit,
- 'Search': sSearch
- }, null, '', ['Contacts']);
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, sTags, aProperties)
-{
- this.defaultRequest(fCallback, 'ContactSave', {
- 'RequestUid': sRequestUid,
- 'Uid': Utils.trim(sUid),
- 'Tags': Utils.trim(sTags),
- 'Properties': aProperties
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {Array} aUids
- */
-WebMailAjaxRemoteStorage.prototype.contactsDelete = function (fCallback, aUids)
-{
- this.defaultRequest(fCallback, 'ContactsDelete', {
- 'Uids': aUids.join(',')
- });
-};
-
-/**
- * @param {?Function} fCallback
- * @param {string} sQuery
- * @param {number} iPage
- */
-WebMailAjaxRemoteStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
-{
- this.defaultRequest(fCallback, 'Suggestions', {
- 'Query': sQuery,
- 'Page': iPage
- }, null, '', ['Suggestions']);
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.facebookUser = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialFacebookUserInformation');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.facebookDisconnect = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialFacebookDisconnect');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.twitterUser = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialTwitterUserInformation');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.twitterDisconnect = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialTwitterDisconnect');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.googleUser = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialGoogleUserInformation');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.googleDisconnect = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialGoogleDisconnect');
-};
-
-/**
- * @param {?Function} fCallback
- */
-WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback)
-{
- this.defaultRequest(fCallback, 'SocialUsers');
-};
-
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- */
-function AbstractCacheStorage()
-{
- this.bCapaGravatar = RL.capa(Enums.Capa.Gravatar);
-}
-
-/**
- * @type {Object}
- */
-AbstractCacheStorage.prototype.oServices = {};
-
-/**
- * @type {boolean}
- */
-AbstractCacheStorage.prototype.bCapaGravatar = false;
-
-AbstractCacheStorage.prototype.clear = function ()
-{
- this.bCapaGravatar = !!this.bCapaGravatar; // TODO
-};
-
-/**
- * @param {string} sEmail
- * @return {string}
- */
-AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
-{
- sEmail = Utils.trim(sEmail);
- fCallback(this.bCapaGravatar && '' !== sEmail ? RL.link().avatarLink(sEmail) : '', sEmail);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractCacheStorage
- */
-function WebMailCacheStorage()
-{
- AbstractCacheStorage.call(this);
-
- this.oFoldersCache = {};
- this.oFoldersNamesCache = {};
- this.oFolderHashCache = {};
- this.oFolderUidNextCache = {};
- this.oMessageListHashCache = {};
- this.oMessageFlagsCache = {};
- this.oNewMessage = {};
- this.oRequestedMessage = {};
-}
-
-_.extend(WebMailCacheStorage.prototype, AbstractCacheStorage.prototype);
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oFoldersCache = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oFoldersNamesCache = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oFolderHashCache = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oFolderUidNextCache = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oMessageListHashCache = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oMessageFlagsCache = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oBodies = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oNewMessage = {};
-
-/**
- * @type {Object}
- */
-WebMailCacheStorage.prototype.oRequestedMessage = {};
-
-WebMailCacheStorage.prototype.clear = function ()
-{
- AbstractCacheStorage.prototype.clear.call(this);
-
- this.oFoldersCache = {};
- this.oFoldersNamesCache = {};
- this.oFolderHashCache = {};
- this.oFolderUidNextCache = {};
- this.oMessageListHashCache = {};
- this.oMessageFlagsCache = {};
- this.oBodies = {};
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUid
- * @return {string}
- */
-WebMailCacheStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
-{
- return sFolderFullNameRaw + '#' + sUid;
-};
-
-/**
- * @param {string} sFolder
- * @param {string} sUid
- */
-WebMailCacheStorage.prototype.addRequestedMessage = function (sFolder, sUid)
-{
- this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
-};
-
-/**
- * @param {string} sFolder
- * @param {string} sUid
- * @return {boolean}
- */
-WebMailCacheStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
-{
- return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUid
- */
-WebMailCacheStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
-{
- this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUid
- */
-WebMailCacheStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
-{
- if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
- {
- this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = null;
- return true;
- }
-
- return false;
-};
-
-WebMailCacheStorage.prototype.clearNewMessageCache = function ()
-{
- this.oNewMessage = {};
-};
-
-/**
- * @param {string} sFolderHash
- * @return {string}
- */
-WebMailCacheStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
-{
- return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
-};
-
-/**
- * @param {string} sFolderHash
- * @param {string} sFolderFullNameRaw
- */
-WebMailCacheStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
-{
- this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @return {string}
- */
-WebMailCacheStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
-{
- return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {string} sFolderHash
- */
-WebMailCacheStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
-{
- this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @return {string}
- */
-WebMailCacheStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
-{
- return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUidNext
- */
-WebMailCacheStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
-{
- this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @return {?FolderModel}
- */
-WebMailCacheStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
-{
- return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- * @param {?FolderModel} oFolder
- */
-WebMailCacheStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
-{
- this.oFoldersCache[sFolderFullNameRaw] = oFolder;
-};
-
-/**
- * @param {string} sFolderFullNameRaw
- */
-WebMailCacheStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
-{
- this.setFolderToCacheList(sFolderFullNameRaw, null);
-};
-
-/**
- * @param {string} sFolderFullName
- * @param {string} sUid
- * @return {?Array}
- */
-WebMailCacheStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
-{
- return this.oMessageFlagsCache[sFolderFullName] && this.oMessageFlagsCache[sFolderFullName][sUid] ?
- this.oMessageFlagsCache[sFolderFullName][sUid] : null;
-};
-
-/**
- * @param {string} sFolderFullName
- * @param {string} sUid
- * @param {Array} aFlagsCache
- */
-WebMailCacheStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
-{
- if (!this.oMessageFlagsCache[sFolderFullName])
- {
- this.oMessageFlagsCache[sFolderFullName] = {};
- }
-
- this.oMessageFlagsCache[sFolderFullName][sUid] = aFlagsCache;
-};
-
-/**
- * @param {string} sFolderFullName
- */
-WebMailCacheStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
-{
- this.oMessageFlagsCache[sFolderFullName] = {};
-};
-
-/**
- * @param {(MessageModel|null)} oMessage
- */
-WebMailCacheStorage.prototype.initMessageFlagsFromCache = function (oMessage)
-{
- if (oMessage)
- {
- var
- self = this,
- aFlags = this.getMessageFlagsFromCache(oMessage.folderFullNameRaw, oMessage.uid),
- mUnseenSubUid = null,
- mFlaggedSubUid = null
- ;
-
- if (aFlags && 0 < aFlags.length)
- {
- oMessage.unseen(!!aFlags[0]);
- oMessage.flagged(!!aFlags[1]);
- oMessage.answered(!!aFlags[2]);
- oMessage.forwarded(!!aFlags[3]);
- oMessage.isReadReceipt(!!aFlags[4]);
- }
-
- if (0 < oMessage.threads().length)
- {
- mUnseenSubUid = _.find(oMessage.threads(), function (iSubUid) {
- var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
- return aFlags && 0 < aFlags.length && !!aFlags[0];
- });
-
- mFlaggedSubUid = _.find(oMessage.threads(), function (iSubUid) {
- var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
- return aFlags && 0 < aFlags.length && !!aFlags[1];
- });
-
- oMessage.hasUnseenSubMessage(mUnseenSubUid && 0 < Utils.pInt(mUnseenSubUid));
- oMessage.hasFlaggedSubMessage(mFlaggedSubUid && 0 < Utils.pInt(mFlaggedSubUid));
- }
- }
-};
-
-/**
- * @param {(MessageModel|null)} oMessage
- */
-WebMailCacheStorage.prototype.storeMessageFlagsToCache = function (oMessage)
-{
- if (oMessage)
- {
- this.setMessageFlagsToCache(
- oMessage.folderFullNameRaw,
- oMessage.uid,
- [oMessage.unseen(), oMessage.flagged(), oMessage.answered(), oMessage.forwarded(), oMessage.isReadReceipt()]
- );
- }
-};
-/**
- * @param {string} sFolder
- * @param {string} sUid
- * @param {Array} aFlags
- */
-WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
-{
- if (Utils.isArray(aFlags) && 0 < aFlags.length)
- {
- this.setMessageFlagsToCache(sFolder, sUid, aFlags);
- }
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @param {Array} aViewModels
- * @constructor
- * @extends KnoinAbstractScreen
- */
-function AbstractSettings(aViewModels)
-{
- KnoinAbstractScreen.call(this, 'settings', aViewModels);
-
- this.menu = ko.observableArray([]);
-
- this.oCurrentSubScreen = null;
- this.oViewModelPlace = null;
-}
-
-_.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
-
-AbstractSettings.prototype.onRoute = function (sSubName)
-{
- var
- self = this,
- oSettingsScreen = null,
- RoutedSettingsViewModel = null,
- oViewModelPlace = null,
- oViewModelDom = null
- ;
-
- RoutedSettingsViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
- return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
- sSubName === SettingsViewModel.__rlSettingsData.Route;
- });
-
- if (RoutedSettingsViewModel)
- {
- if (_.find(ViewModels['settings-removed'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
- }))
- {
- RoutedSettingsViewModel = null;
- }
-
- if (RoutedSettingsViewModel && _.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
- }))
- {
- RoutedSettingsViewModel = null;
- }
- }
-
- if (RoutedSettingsViewModel)
- {
- if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
- {
- oSettingsScreen = RoutedSettingsViewModel.__vm;
- }
- else
- {
- oViewModelPlace = this.oViewModelPlace;
- if (oViewModelPlace && 1 === oViewModelPlace.length)
- {
- RoutedSettingsViewModel = /** @type {?Function} */ RoutedSettingsViewModel;
- oSettingsScreen = new RoutedSettingsViewModel();
-
- oViewModelDom = $('').addClass('rl-settings-view-model').hide();
- oViewModelDom.appendTo(oViewModelPlace);
-
- oSettingsScreen.data = RL.data();
- oSettingsScreen.viewModelDom = oViewModelDom;
-
- oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
-
- RoutedSettingsViewModel.__dom = oViewModelDom;
- RoutedSettingsViewModel.__builded = true;
- RoutedSettingsViewModel.__vm = oSettingsScreen;
-
- ko.applyBindingAccessorsToNode(oViewModelDom[0], {
- 'i18nInit': true,
- 'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
- }, oSettingsScreen);
-
- Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
- }
- else
- {
- Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
- }
- }
-
- if (oSettingsScreen)
- {
- _.defer(function () {
- // hide
- if (self.oCurrentSubScreen)
- {
- Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
- self.oCurrentSubScreen.viewModelDom.hide();
- }
- // --
-
- self.oCurrentSubScreen = oSettingsScreen;
-
- // show
- if (self.oCurrentSubScreen)
- {
- self.oCurrentSubScreen.viewModelDom.show();
- Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
- Utils.delegateRun(self.oCurrentSubScreen, 'onFocus', [], 200);
-
- _.each(self.menu(), function (oItem) {
- oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
- });
-
- $('#rl-content .b-settings .b-content .content').scrollTop(0);
- }
- // --
-
- Utils.windowResize();
- });
- }
- }
- else
- {
- kn.setHash(RL.link().settings(), false, true);
- }
-};
-
-AbstractSettings.prototype.onHide = function ()
-{
- if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
- {
- Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
- this.oCurrentSubScreen.viewModelDom.hide();
- }
-};
-
-AbstractSettings.prototype.onBuild = function ()
-{
- _.each(ViewModels['settings'], function (SettingsViewModel) {
- if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
- !_.find(ViewModels['settings-removed'], function (RemoveSettingsViewModel) {
- return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
- }))
- {
- this.menu.push({
- 'route': SettingsViewModel.__rlSettingsData.Route,
- 'label': SettingsViewModel.__rlSettingsData.Label,
- 'selected': ko.observable(false),
- 'disabled': !!_.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
- })
- });
- }
- }, this);
-
- this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
-};
-
-AbstractSettings.prototype.routes = function ()
-{
- var
- DefaultViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
- return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
- }),
- sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
- oRules = {
- 'subname': /^(.*)$/,
- 'normalize_': function (oRequest, oVals) {
- oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
- return [oVals.subname];
- }
- }
- ;
-
- return [
- ['{subname}/', oRules],
- ['{subname}', oRules],
- ['', oRules]
- ];
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractScreen
- */
-function LoginScreen()
-{
- KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
-}
-
-_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
-
-LoginScreen.prototype.onShow = function ()
-{
- RL.setTitle('');
-};
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractScreen
- */
-function MailBoxScreen()
-{
- KnoinAbstractScreen.call(this, 'mailbox', [
- MailBoxSystemDropDownViewModel,
- MailBoxFolderListViewModel,
- MailBoxMessageListViewModel,
- MailBoxMessageViewViewModel
- ]);
-
- this.oLastRoute = {};
-}
-
-_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
-
-/**
- * @type {Object}
- */
-MailBoxScreen.prototype.oLastRoute = {};
-
-MailBoxScreen.prototype.setNewTitle = function ()
-{
- var
- sEmail = RL.data().accountEmail(),
- ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount()
- ;
-
- RL.setTitle(('' === sEmail ? '' :
- (0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
-};
-
-MailBoxScreen.prototype.onShow = function ()
-{
- this.setNewTitle();
- RL.data().keyScope(Enums.KeyState.MessageList);
-};
-
-/**
- * @param {string} sFolderHash
- * @param {number} iPage
- * @param {string} sSearch
- * @param {boolean=} bPreview = false
- */
-MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
-{
- if (Utils.isUnd(bPreview) ? false : !!bPreview)
- {
- if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())
- {
- RL.historyBack();
- }
- }
- else
- {
- var
- oData = RL.data(),
- sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),
- oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)
- ;
-
- if (oFolder)
- {
- oData
- .currentFolder(oFolder)
- .messageListPage(iPage)
- .messageListSearch(sSearch)
- ;
-
- if (Enums.Layout.NoPreview === oData.layout() && oData.message())
- {
- oData.message(null);
- }
-
- RL.reloadMessageList();
- }
- }
-};
-
-MailBoxScreen.prototype.onStart = function ()
-{
- var
- oData = RL.data(),
- fResizeFunction = function () {
- Utils.windowResize();
- }
- ;
-
- if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))
- {
- RL.accountsAndIdentities();
- }
-
- _.delay(function () {
- if ('INBOX' !== oData.currentFolderFullNameRaw())
- {
- RL.folderInformation('INBOX');
- }
- }, 1000);
-
- _.delay(function () {
- RL.quota();
- }, 5000);
-
- _.delay(function () {
- RL.remote().appDelayStart(Utils.emptyFunction);
- }, 35000);
-
- $html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
-
- oData.folderList.subscribe(fResizeFunction);
- oData.messageList.subscribe(fResizeFunction);
- oData.message.subscribe(fResizeFunction);
-
- oData.layout.subscribe(function (nValue) {
- $html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
- });
-
- oData.foldersInboxUnreadCount.subscribe(function () {
- this.setNewTitle();
- }, this);
-};
-
-/**
- * @return {Array}
- */
-MailBoxScreen.prototype.routes = function ()
-{
- var
- fNormP = function () {
- return ['Inbox', 1, '', true];
- },
- fNormS = function (oRequest, oVals) {
- oVals[0] = Utils.pString(oVals[0]);
- oVals[1] = Utils.pInt(oVals[1]);
- oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
- oVals[2] = Utils.pString(oVals[2]);
-
- if ('' === oRequest)
- {
- oVals[0] = 'Inbox';
- oVals[1] = 1;
- }
-
- return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2]), false];
- },
- fNormD = function (oRequest, oVals) {
- oVals[0] = Utils.pString(oVals[0]);
- oVals[1] = Utils.pString(oVals[1]);
-
- if ('' === oRequest)
- {
- oVals[0] = 'Inbox';
- }
-
- return [decodeURI(oVals[0]), 1, decodeURI(oVals[1]), false];
- }
- ;
-
- return [
- [/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
- [/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
- [/^([a-zA-Z0-9]+)\/(.+)\/?$/, {'normalize_': fNormD}],
- [/^message-preview$/, {'normalize_': fNormP}],
- [/^([^\/]*)$/, {'normalize_': fNormS}]
- ];
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractSettings
- */
-function SettingsScreen()
-{
- AbstractSettings.call(this, [
- SettingsSystemDropDownViewModel,
- SettingsMenuViewModel,
- SettingsPaneViewModel
- ]);
-
- Utils.initOnStartOrLangChange(function () {
- this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
- }, this, function () {
- RL.setTitle(this.sSettingsTitle);
- });
-}
-
-_.extend(SettingsScreen.prototype, AbstractSettings.prototype);
-
-SettingsScreen.prototype.onShow = function ()
-{
- RL.setTitle(this.sSettingsTitle);
- RL.data().keyScope(Enums.KeyState.Settings);
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends KnoinAbstractBoot
- */
-function AbstractApp()
-{
- KnoinAbstractBoot.call(this);
-
- this.oSettings = null;
- this.oPlugins = null;
- this.oLocal = null;
- this.oLink = null;
- this.oSubs = {};
-
- this.isLocalAutocomplete = true;
-
- this.popupVisibilityNames = ko.observableArray([]);
-
- this.popupVisibility = ko.computed(function () {
- return 0 < this.popupVisibilityNames().length;
- }, this);
-
- this.iframe = $('').appendTo('body');
-
- $window.on('error', function (oEvent) {
- if (RL && oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
- -1 === Utils.inArray(oEvent.originalEvent.message, [
- 'Script error.', 'Uncaught Error: Error calling method on NPObject.'
- ]))
- {
- RL.remote().jsError(
- Utils.emptyFunction,
- oEvent.originalEvent.message,
- oEvent.originalEvent.filename,
- oEvent.originalEvent.lineno,
- location && location.toString ? location.toString() : '',
- $html.attr('class'),
- Utils.microtime() - Globals.now
- );
- }
- });
-
- $document.on('keydown', function (oEvent) {
- if (oEvent && oEvent.ctrlKey)
- {
- $html.addClass('rl-ctrl-key-pressed');
- }
- }).on('keyup', function (oEvent) {
- if (oEvent && !oEvent.ctrlKey)
- {
- $html.removeClass('rl-ctrl-key-pressed');
- }
- });
-}
-
-_.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
-
-AbstractApp.prototype.oSettings = null;
-AbstractApp.prototype.oPlugins = null;
-AbstractApp.prototype.oLocal = null;
-AbstractApp.prototype.oLink = null;
-AbstractApp.prototype.oSubs = {};
-
-/**
- * @param {string} sLink
- * @return {boolean}
- */
-AbstractApp.prototype.download = function (sLink)
-{
- var
- oLink = null,
- oE = null,
- sUserAgent = navigator.userAgent.toLowerCase()
- ;
-
- if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
- {
- oLink = document.createElement('a');
- oLink['href'] = sLink;
-
- if (document['createEvent'])
- {
- oE = document['createEvent']('MouseEvents');
- if (oE && oE['initEvent'] && oLink['dispatchEvent'])
- {
- oE['initEvent']('click', true, true);
- oLink['dispatchEvent'](oE);
- return true;
- }
- }
- }
-
- if (Globals.bMobileDevice)
- {
- window.open(sLink, '_self');
- window.focus();
- }
- else
- {
- this.iframe.attr('src', sLink);
-// window.document.location.href = sLink;
- }
-
- return true;
-};
-
-/**
- * @return {LinkBuilder}
- */
-AbstractApp.prototype.link = function ()
-{
- if (null === this.oLink)
- {
- this.oLink = new LinkBuilder();
- }
-
- return this.oLink;
-};
-
-/**
- * @return {LocalStorage}
- */
-AbstractApp.prototype.local = function ()
-{
- if (null === this.oLocal)
- {
- this.oLocal = new LocalStorage();
- }
-
- return this.oLocal;
-};
-
-/**
- * @param {string} sName
- * @return {?}
- */
-AbstractApp.prototype.settingsGet = function (sName)
-{
- if (null === this.oSettings)
- {
- this.oSettings = Utils.isNormal(AppData) ? AppData : {};
- }
-
- return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
-};
-
-/**
- * @param {string} sName
- * @param {?} mValue
- */
-AbstractApp.prototype.settingsSet = function (sName, mValue)
-{
- if (null === this.oSettings)
- {
- this.oSettings = Utils.isNormal(AppData) ? AppData : {};
- }
-
- this.oSettings[sName] = mValue;
-};
-
-AbstractApp.prototype.setTitle = function (sTitle)
-{
- sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
- RL.settingsGet('Title') || '';
-
- window.document.title = '_';
- window.document.title = sTitle;
-};
-
-/**
- * @param {boolean=} bLogout = false
- * @param {boolean=} bClose = false
- */
-AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
-{
- var
- sCustomLogoutLink = Utils.pString(RL.settingsGet('CustomLogoutLink')),
- bInIframe = !!RL.settingsGet('InIframe')
- ;
-
- bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
- bClose = Utils.isUnd(bClose) ? false : !!bClose;
-
- if (bLogout && bClose && window.close)
- {
- window.close();
- }
-
- if (bLogout && '' !== sCustomLogoutLink && window.location.href !== sCustomLogoutLink)
- {
- _.delay(function () {
- if (bInIframe && window.parent)
- {
- window.parent.location.href = sCustomLogoutLink;
- }
- else
- {
- window.location.href = sCustomLogoutLink;
- }
- }, 100);
- }
- else
- {
- kn.routeOff();
- kn.setHash(RL.link().root(), true);
- kn.routeOff();
-
- _.delay(function () {
- if (bInIframe && window.parent)
- {
- window.parent.location.reload();
- }
- else
- {
- window.location.reload();
- }
- }, 100);
- }
-};
-
-AbstractApp.prototype.historyBack = function ()
-{
- window.history.back();
-};
-
-/**
- * @param {string} sQuery
- * @param {Function} fCallback
- */
-AbstractApp.prototype.getAutocomplete = function (sQuery, fCallback)
-{
- fCallback([], sQuery);
-};
-
-/**
- * @param {string} sName
- * @param {Function} fFunc
- * @param {Object=} oContext
- * @return {AbstractApp}
- */
-AbstractApp.prototype.sub = function (sName, fFunc, oContext)
-{
- if (Utils.isUnd(this.oSubs[sName]))
- {
- this.oSubs[sName] = [];
- }
-
- this.oSubs[sName].push([fFunc, oContext]);
-
- return this;
-};
-
-/**
- * @param {string} sName
- * @param {Array=} aArgs
- * @return {AbstractApp}
- */
-AbstractApp.prototype.pub = function (sName, aArgs)
-{
- Plugins.runHook('rl-pub', [sName, aArgs]);
- if (!Utils.isUnd(this.oSubs[sName]))
- {
- _.each(this.oSubs[sName], function (aItem) {
- if (aItem[0])
- {
- aItem[0].apply(aItem[1] || null, aArgs || []);
- }
- });
- }
-
- return this;
-};
-
-/**
- * @param {string} sName
- * @return {boolean}
- */
-AbstractApp.prototype.capa = function (sName)
-{
- var mCapa = this.settingsGet('Capa');
- return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
-};
-
-AbstractApp.prototype.bootstart = function ()
-{
- var self = this;
-
- Utils.initOnStartOrLangChange(function () {
- Utils.initNotificationLanguage();
- }, null);
-
- _.delay(function () {
- Utils.windowResize();
- }, 1000);
-
- ssm.addState({
- 'id': 'mobile',
- 'maxWidth': 767,
- 'onEnter': function() {
- $html.addClass('ssm-state-mobile');
- self.pub('ssm.mobile-enter');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-mobile');
- self.pub('ssm.mobile-leave');
- }
- });
-
- ssm.addState({
- 'id': 'tablet',
- 'minWidth': 768,
- 'maxWidth': 999,
- 'onEnter': function() {
- $html.addClass('ssm-state-tablet');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-tablet');
- }
- });
-
- ssm.addState({
- 'id': 'desktop',
- 'minWidth': 1000,
- 'maxWidth': 1400,
- 'onEnter': function() {
- $html.addClass('ssm-state-desktop');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-desktop');
- }
- });
-
- ssm.addState({
- 'id': 'desktop-large',
- 'minWidth': 1400,
- 'onEnter': function() {
- $html.addClass('ssm-state-desktop-large');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-desktop-large');
- }
- });
-
- RL.sub('ssm.mobile-enter', function () {
- RL.data().leftPanelDisabled(true);
- });
-
- RL.sub('ssm.mobile-leave', function () {
- RL.data().leftPanelDisabled(false);
- });
-
- RL.data().leftPanelDisabled.subscribe(function (bValue) {
- $html.toggleClass('rl-left-panel-disabled', bValue);
- });
-
- ssm.ready();
-};
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-/**
- * @constructor
- * @extends AbstractApp
- */
-function RainLoopApp()
-{
- AbstractApp.call(this);
-
- this.oData = null;
- this.oRemote = null;
- this.oCache = null;
- this.oMoveCache = {};
-
- this.quotaDebounce = _.debounce(this.quota, 1000 * 30);
- this.moveOrDeleteResponseHelper = _.bind(this.moveOrDeleteResponseHelper, this);
-
- this.messagesMoveTrigger = _.debounce(this.messagesMoveTrigger, 500);
-
- window.setInterval(function () {
- RL.pub('interval.30s');
- }, 30000);
-
- window.setInterval(function () {
- RL.pub('interval.1m');
- }, 60000);
-
- window.setInterval(function () {
- RL.pub('interval.2m');
- }, 60000 * 2);
-
- window.setInterval(function () {
- RL.pub('interval.3m');
- }, 60000 * 3);
-
- window.setInterval(function () {
- RL.pub('interval.5m');
- }, 60000 * 5);
-
- window.setInterval(function () {
- RL.pub('interval.10m');
- }, 60000 * 10);
-
- window.setTimeout(function () {
- window.setInterval(function () {
- RL.pub('interval.10m-after5m');
- }, 60000 * 10);
- }, 60000 * 5);
-
- $.wakeUp(function () {
- RL.remote().jsVersion(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
- {
- if (window.parent && !!RL.settingsGet('InIframe'))
- {
- window.parent.location.reload();
- }
- else
- {
- window.location.reload();
- }
- }
- }, RL.settingsGet('Version'));
- }, {}, 60 * 60 * 1000);
-}
-
-_.extend(RainLoopApp.prototype, AbstractApp.prototype);
-
-RainLoopApp.prototype.oData = null;
-RainLoopApp.prototype.oRemote = null;
-RainLoopApp.prototype.oCache = null;
-
-/**
- * @return {WebMailDataStorage}
- */
-RainLoopApp.prototype.data = function ()
-{
- if (null === this.oData)
- {
- this.oData = new WebMailDataStorage();
- }
-
- return this.oData;
-};
-
-/**
- * @return {WebMailAjaxRemoteStorage}
- */
-RainLoopApp.prototype.remote = function ()
-{
- if (null === this.oRemote)
- {
- this.oRemote = new WebMailAjaxRemoteStorage();
- }
-
- return this.oRemote;
-};
-
-/**
- * @return {WebMailCacheStorage}
- */
-RainLoopApp.prototype.cache = function ()
-{
- if (null === this.oCache)
- {
- this.oCache = new WebMailCacheStorage();
- }
-
- return this.oCache;
-};
-
-RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
-{
- var oCache = RL.cache();
- _.each(RL.data().messageList(), function (oMessage) {
- oCache.initMessageFlagsFromCache(oMessage);
- });
-
- oCache.initMessageFlagsFromCache(RL.data().message());
-};
-
-/**
- * @param {boolean=} bDropPagePosition = false
- * @param {boolean=} bDropCurrenFolderCache = false
- */
-RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
-{
- var
- oRLData = RL.data(),
- iOffset = (oRLData.messageListPage() - 1) * oRLData.messagesPerPage()
- ;
-
- if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache)
- {
- RL.cache().setFolderHash(oRLData.currentFolderFullNameRaw(), '');
- }
-
- if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition)
- {
- oRLData.messageListPage(1);
- iOffset = 0;
- }
-
- oRLData.messageListLoading(true);
- RL.remote().messageList(function (sResult, oData, bCached) {
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- oRLData.messageListError('');
- oRLData.messageListLoading(false);
- oRLData.setMessageList(oData, bCached);
- }
- else if (Enums.StorageResultType.Unload === sResult)
- {
- oRLData.messageListError('');
- oRLData.messageListLoading(false);
- }
- else if (Enums.StorageResultType.Abort !== sResult)
- {
- oRLData.messageList([]);
- oRLData.messageListLoading(false);
- oRLData.messageListError(oData && oData.ErrorCode ?
- Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST')
- );
- }
-
- }, oRLData.currentFolderFullNameRaw(), iOffset, oRLData.messagesPerPage(), oRLData.messageListSearch());
-};
-
-RainLoopApp.prototype.recacheInboxMessageList = function ()
-{
- RL.remote().messageList(Utils.emptyFunction, 'INBOX', 0, RL.data().messagesPerPage(), '', true);
-};
-
-RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
-{
- RL.reloadMessageList(bEmptyList);
-};
-
-/**
- * @param {Function} fResultFunc
- * @returns {boolean}
- */
-RainLoopApp.prototype.contactsSync = function (fResultFunc)
-{
- var oContacts = RL.data().contacts;
- if (oContacts.importing() || oContacts.syncing() || !RL.data().enableContactsSync() || !RL.data().allowContactsSync())
- {
- return false;
- }
-
- oContacts.syncing(true);
-
- RL.remote().contactsSync(function (sResult, oData) {
-
- oContacts.syncing(false);
-
- if (fResultFunc)
- {
- fResultFunc(sResult, oData);
- }
- });
-
- return true;
-};
-
-RainLoopApp.prototype.messagesMoveTrigger = function ()
-{
- var
- self = this,
- sSpamFolder = RL.data().spamFolder()
- ;
-
- _.each(this.oMoveCache, function (oItem) {
-
- var
- bSpam = sSpamFolder === oItem['To'],
- bHam = !bSpam && sSpamFolder === oItem['From'] && 'INBOX' === oItem['To']
- ;
-
- RL.remote().messagesMove(self.moveOrDeleteResponseHelper, oItem['From'], oItem['To'], oItem['Uid'],
- bSpam ? 'SPAM' : (bHam ? 'HAM' : ''));
- });
-
- this.oMoveCache = {};
-};
-
-RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove)
-{
- var sH = '$$' + sFromFolderFullNameRaw + '$$' + sToFolderFullNameRaw + '$$';
- if (!this.oMoveCache[sH])
- {
- this.oMoveCache[sH] = {
- 'From': sFromFolderFullNameRaw,
- 'To': sToFolderFullNameRaw,
- 'Uid': []
- };
- }
-
- this.oMoveCache[sH]['Uid'] = _.union(this.oMoveCache[sH]['Uid'], aUidForMove);
- this.messagesMoveTrigger();
-};
-
-RainLoopApp.prototype.messagesCopyHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy)
-{
- RL.remote().messagesCopy(
- this.moveOrDeleteResponseHelper,
- sFromFolderFullNameRaw,
- sToFolderFullNameRaw,
- aUidForCopy
- );
-};
-
-RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
-{
- RL.remote().messagesDelete(
- this.moveOrDeleteResponseHelper,
- sFromFolderFullNameRaw,
- aUidForRemove
- );
-};
-
-RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
-{
- if (Enums.StorageResultType.Success === sResult && RL.data().currentFolder())
- {
- if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length)
- {
- RL.cache().setFolderHash(oData.Result[0], oData.Result[1]);
- }
- else
- {
- RL.cache().setFolderHash(RL.data().currentFolderFullNameRaw(), '');
-
- if (oData && -1 < Utils.inArray(oData.ErrorCode,
- [Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
- {
- window.alert(Utils.getNotification(oData.ErrorCode));
- }
- }
-
- RL.reloadMessageListHelper(0 === RL.data().messageList().length);
- RL.quotaDebounce();
- }
-};
-
-/**
- * @param {string} sFromFolderFullNameRaw
- * @param {Array} aUidForRemove
- */
-RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
-{
- this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
- RL.data().removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
-};
-
-/**
- * @param {number} iDeleteType
- * @param {string} sFromFolderFullNameRaw
- * @param {Array} aUidForRemove
- * @param {boolean=} bUseFolder = true
- */
-RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFolderFullNameRaw, aUidForRemove, bUseFolder)
-{
- var
- self = this,
- oData = RL.data(),
- oCache = RL.cache(),
- oMoveFolder = null,
- nSetSystemFoldersNotification = null
- ;
-
- switch (iDeleteType)
- {
- case Enums.FolderType.Spam:
- oMoveFolder = oCache.getFolderFromCacheList(oData.spamFolder());
- nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam;
- break;
- case Enums.FolderType.NotSpam:
- oMoveFolder = oCache.getFolderFromCacheList('INBOX');
- break;
- case Enums.FolderType.Trash:
- oMoveFolder = oCache.getFolderFromCacheList(oData.trashFolder());
- nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash;
- break;
- case Enums.FolderType.Archive:
- oMoveFolder = oCache.getFolderFromCacheList(oData.archiveFolder());
- nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive;
- break;
- }
-
- bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder;
- if (bUseFolder)
- {
- if ((Enums.FolderType.Spam === iDeleteType && Consts.Values.UnuseOptionValue === oData.spamFolder()) ||
- (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === oData.trashFolder()) ||
- (Enums.FolderType.Archive === iDeleteType && Consts.Values.UnuseOptionValue === oData.archiveFolder()))
- {
- bUseFolder = false;
- }
- }
-
- if (!oMoveFolder && bUseFolder)
- {
- kn.showScreenPopup(PopupsFolderSystemViewModel, [nSetSystemFoldersNotification]);
- }
- else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType &&
- (sFromFolderFullNameRaw === oData.spamFolder() || sFromFolderFullNameRaw === oData.trashFolder())))
- {
- kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () {
-
- self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
- oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
-
- }]);
- }
- else if (oMoveFolder)
- {
- this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove);
- oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw);
- }
-};
-
-/**
- * @param {string} sFromFolderFullNameRaw
- * @param {Array} aUidForMove
- * @param {string} sToFolderFullNameRaw
- * @param {boolean=} bCopy = false
- */
-RainLoopApp.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy)
-{
- if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForMove) && 0 < aUidForMove.length)
- {
- var
- oFromFolder = RL.cache().getFolderFromCacheList(sFromFolderFullNameRaw),
- oToFolder = RL.cache().getFolderFromCacheList(sToFolderFullNameRaw)
- ;
-
- if (oFromFolder && oToFolder)
- {
- if (Utils.isUnd(bCopy) ? false : !!bCopy)
- {
- this.messagesCopyHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove);
- }
- else
- {
- this.messagesMoveHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove);
- }
-
- RL.data().removeMessagesFromList(oFromFolder.fullNameRaw, aUidForMove, oToFolder.fullNameRaw, bCopy);
- return true;
- }
- }
-
- return false;
-};
-
-/**
- * @param {Function=} fCallback
- */
-RainLoopApp.prototype.folders = function (fCallback)
-{
- this.data().foldersLoading(true);
- this.remote().folders(_.bind(function (sResult, oData) {
-
- RL.data().foldersLoading(false);
- if (Enums.StorageResultType.Success === sResult)
- {
- this.data().setFolders(oData);
- if (fCallback)
- {
- fCallback(true);
- }
- }
- else
- {
- if (fCallback)
- {
- fCallback(false);
- }
- }
- }, this));
-};
-
-RainLoopApp.prototype.reloadOpenPgpKeys = function ()
-{
- if (RL.data().capaOpenPGP())
- {
- var
- aKeys = [],
- oEmail = new EmailModel(),
- oOpenpgpKeyring = RL.data().openpgpKeyring,
- oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : []
- ;
-
- _.each(oOpenpgpKeys, function (oItem, iIndex) {
- if (oItem && oItem.primaryKey)
- {
- var
-
- oPrimaryUser = oItem.getPrimaryUser(),
- sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid
- : (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '')
- ;
-
- oEmail.clear();
- oEmail.mailsoParse(sUser);
-
- if (oEmail.validate())
- {
- aKeys.push(new OpenPgpKeyModel(
- iIndex,
- oItem.primaryKey.getFingerprint(),
- oItem.primaryKey.getKeyId().toHex().toLowerCase(),
- sUser,
- oEmail.email,
- oItem.isPrivate(),
- oItem.armor())
- );
- }
- }
- });
-
- RL.data().openpgpkeys(aKeys);
- }
-};
-
-RainLoopApp.prototype.accountsAndIdentities = function ()
-{
- var oRainLoopData = RL.data();
-
- oRainLoopData.accountsLoading(true);
- oRainLoopData.identitiesLoading(true);
-
- RL.remote().accountsAndIdentities(function (sResult, oData) {
-
- oRainLoopData.accountsLoading(false);
- oRainLoopData.identitiesLoading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData.Result)
- {
- var
- sParentEmail = RL.settingsGet('ParentEmail'),
- sAccountEmail = oRainLoopData.accountEmail()
- ;
-
- sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
-
- if (Utils.isArray(oData.Result['Accounts']))
- {
- oRainLoopData.accounts(_.map(oData.Result['Accounts'], function (sValue) {
- return new AccountModel(sValue, sValue !== sParentEmail);
- }));
- }
-
- if (Utils.isArray(oData.Result['Identities']))
- {
- oRainLoopData.identities(_.map(oData.Result['Identities'], function (oIdentityData) {
-
- var
- sId = Utils.pString(oIdentityData['Id']),
- sEmail = Utils.pString(oIdentityData['Email']),
- oIdentity = new IdentityModel(sId, sEmail, sId !== sAccountEmail)
- ;
-
- oIdentity.name(Utils.pString(oIdentityData['Name']));
- oIdentity.replyTo(Utils.pString(oIdentityData['ReplyTo']));
- oIdentity.bcc(Utils.pString(oIdentityData['Bcc']));
-
- return oIdentity;
- }));
- }
- }
- });
-};
-
-RainLoopApp.prototype.quota = function ()
-{
- this.remote().quota(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
- Utils.isArray(oData.Result) && 1 < oData.Result.length &&
- Utils.isPosNumeric(oData.Result[0], true) && Utils.isPosNumeric(oData.Result[1], true))
- {
- RL.data().userQuota(Utils.pInt(oData.Result[1]) * 1024);
- RL.data().userUsageSize(Utils.pInt(oData.Result[0]) * 1024);
- }
- });
-};
-
-/**
- * @param {string} sFolder
- * @param {Array=} aList = []
- */
-RainLoopApp.prototype.folderInformation = function (sFolder, aList)
-{
- if ('' !== Utils.trim(sFolder))
- {
- this.remote().folderInformation(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult)
- {
- if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder)
- {
- var
- iUtc = moment().unix(),
- sHash = RL.cache().getFolderHash(oData.Result.Folder),
- oFolder = RL.cache().getFolderFromCacheList(oData.Result.Folder),
- bCheck = false,
- sUid = '',
- aList = [],
- bUnreadCountChange = false,
- oFlags = null
- ;
-
- if (oFolder)
- {
- oFolder.interval = iUtc;
-
- if (oData.Result.Hash)
- {
- RL.cache().setFolderHash(oData.Result.Folder, oData.Result.Hash);
- }
-
- if (Utils.isNormal(oData.Result.MessageCount))
- {
- oFolder.messageCountAll(oData.Result.MessageCount);
- }
-
- if (Utils.isNormal(oData.Result.MessageUnseenCount))
- {
- if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
- {
- bUnreadCountChange = true;
- }
-
- oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
- }
-
- if (bUnreadCountChange)
- {
- RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
- }
-
- if (oData.Result.Flags)
- {
- for (sUid in oData.Result.Flags)
- {
- if (oData.Result.Flags.hasOwnProperty(sUid))
- {
- bCheck = true;
- oFlags = oData.Result.Flags[sUid];
- RL.cache().storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
- !oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded'], !!oFlags['IsReadReceipt']
- ]);
- }
- }
-
- if (bCheck)
- {
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- }
-
- RL.data().initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
-
- if (oData.Result.Hash !== sHash || '' === sHash)
- {
- if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
- {
- RL.reloadMessageList();
- }
- else if ('INBOX' === oFolder.fullNameRaw)
- {
- RL.recacheInboxMessageList();
- }
- }
- else if (bUnreadCountChange)
- {
- if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
- {
- aList = RL.data().messageList();
- if (Utils.isNonEmptyArray(aList))
- {
- RL.folderInformation(oFolder.fullNameRaw, aList);
- }
- }
- }
- }
- }
- }
- }, sFolder, aList);
- }
-};
-
-/**
- * @param {boolean=} bBoot = false
- */
-RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
-{
- bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
-
- var
- iUtc = moment().unix(),
- aFolders = RL.data().getNextFolderNames(bBoot)
- ;
-
- if (Utils.isNonEmptyArray(aFolders))
- {
- this.remote().folderInformationMultiply(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult)
- {
- if (oData && oData.Result && oData.Result.List && Utils.isNonEmptyArray(oData.Result.List))
- {
- _.each(oData.Result.List, function (oItem) {
-
- var
- aList = [],
- sHash = RL.cache().getFolderHash(oItem.Folder),
- oFolder = RL.cache().getFolderFromCacheList(oItem.Folder),
- bUnreadCountChange = false
- ;
-
- if (oFolder)
- {
- oFolder.interval = iUtc;
-
- if (oItem.Hash)
- {
- RL.cache().setFolderHash(oItem.Folder, oItem.Hash);
- }
-
- if (Utils.isNormal(oItem.MessageCount))
- {
- oFolder.messageCountAll(oItem.MessageCount);
- }
-
- if (Utils.isNormal(oItem.MessageUnseenCount))
- {
- if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oItem.MessageUnseenCount))
- {
- bUnreadCountChange = true;
- }
-
- oFolder.messageCountUnread(oItem.MessageUnseenCount);
- }
-
- if (bUnreadCountChange)
- {
- RL.cache().clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
- }
-
- if (oItem.Hash !== sHash || '' === sHash)
- {
- if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
- {
- RL.reloadMessageList();
- }
- }
- else if (bUnreadCountChange)
- {
- if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
- {
- aList = RL.data().messageList();
- if (Utils.isNonEmptyArray(aList))
- {
- RL.folderInformation(oFolder.fullNameRaw, aList);
- }
- }
- }
- }
- });
-
- if (bBoot)
- {
- RL.folderInformationMultiply(true);
- }
- }
- }
- }, aFolders);
- }
-};
-
-RainLoopApp.prototype.setMessageSeen = function (oMessage)
-{
- if (oMessage.unseen())
- {
- oMessage.unseen(false);
-
- var oFolder = RL.cache().getFolderFromCacheList(oMessage.folderFullNameRaw);
- if (oFolder)
- {
- oFolder.messageCountUnread(0 <= oFolder.messageCountUnread() - 1 ?
- oFolder.messageCountUnread() - 1 : 0);
- }
-
- RL.cache().storeMessageFlagsToCache(oMessage);
- RL.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
-
- RL.remote().messageSetSeen(Utils.emptyFunction, oMessage.folderFullNameRaw, [oMessage.uid], true);
-};
-
-RainLoopApp.prototype.googleConnect = function ()
-{
- window.open(RL.link().socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
-};
-
-RainLoopApp.prototype.twitterConnect = function ()
-{
- window.open(RL.link().socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
-};
-
-RainLoopApp.prototype.facebookConnect = function ()
-{
- window.open(RL.link().socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
-};
-
-/**
- * @param {boolean=} bFireAllActions
- */
-RainLoopApp.prototype.socialUsers = function (bFireAllActions)
-{
- var oRainLoopData = RL.data();
-
- if (bFireAllActions)
- {
- oRainLoopData.googleActions(true);
- oRainLoopData.facebookActions(true);
- oRainLoopData.twitterActions(true);
- }
-
- RL.remote().socialUsers(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- oRainLoopData.googleUserName(oData.Result['Google'] || '');
- oRainLoopData.facebookUserName(oData.Result['Facebook'] || '');
- oRainLoopData.twitterUserName(oData.Result['Twitter'] || '');
- }
- else
- {
- oRainLoopData.googleUserName('');
- oRainLoopData.facebookUserName('');
- oRainLoopData.twitterUserName('');
- }
-
- oRainLoopData.googleLoggined('' !== oRainLoopData.googleUserName());
- oRainLoopData.facebookLoggined('' !== oRainLoopData.facebookUserName());
- oRainLoopData.twitterLoggined('' !== oRainLoopData.twitterUserName());
-
- oRainLoopData.googleActions(false);
- oRainLoopData.facebookActions(false);
- oRainLoopData.twitterActions(false);
- });
-};
-
-RainLoopApp.prototype.googleDisconnect = function ()
-{
- RL.data().googleActions(true);
- RL.remote().googleDisconnect(function () {
- RL.socialUsers();
- });
-};
-
-RainLoopApp.prototype.facebookDisconnect = function ()
-{
- RL.data().facebookActions(true);
- RL.remote().facebookDisconnect(function () {
- RL.socialUsers();
- });
-};
-
-RainLoopApp.prototype.twitterDisconnect = function ()
-{
- RL.data().twitterActions(true);
- RL.remote().twitterDisconnect(function () {
- RL.socialUsers();
- });
-};
-
-/**
- * @param {Array} aSystem
- * @param {Array} aList
- * @param {Array=} aDisabled
- * @param {Array=} aHeaderLines
- * @param {?number=} iUnDeep
- * @param {Function=} fDisableCallback
- * @param {Function=} fVisibleCallback
- * @param {Function=} fRenameCallback
- * @param {boolean=} bSystem
- * @param {boolean=} bBuildUnvisible
- * @return {Array}
- */
-RainLoopApp.prototype.folderListOptionsBuilder = function (aSystem, aList, aDisabled, aHeaderLines, iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
-{
- var
- iIndex = 0,
- iLen = 0,
- /**
- * @type {?FolderModel}
- */
- oItem = null,
- bSep = false,
- sDeepPrefix = '\u00A0\u00A0\u00A0',
- aResult = []
- ;
-
- bSystem = !Utils.isNormal(bSystem) ? 0 < aSystem.length : bSystem;
- bBuildUnvisible = Utils.isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible;
- iUnDeep = !Utils.isNormal(iUnDeep) ? 0 : iUnDeep;
- fDisableCallback = Utils.isNormal(fDisableCallback) ? fDisableCallback : null;
- fVisibleCallback = Utils.isNormal(fVisibleCallback) ? fVisibleCallback : null;
- fRenameCallback = Utils.isNormal(fRenameCallback) ? fRenameCallback : null;
-
- if (!Utils.isArray(aDisabled))
- {
- aDisabled = [];
- }
-
- if (!Utils.isArray(aHeaderLines))
- {
- aHeaderLines = [];
- }
-
- for (iIndex = 0, iLen = aHeaderLines.length; iIndex < iLen; iIndex++)
- {
- aResult.push({
- 'id': aHeaderLines[iIndex][0],
- 'name': aHeaderLines[iIndex][1],
- 'system': false,
- 'seporator': false,
- 'disabled': false
- });
- }
-
- bSep = true;
- for (iIndex = 0, iLen = aSystem.length; iIndex < iLen; iIndex++)
- {
- oItem = aSystem[iIndex];
- if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
- {
- if (bSep && 0 < aResult.length)
- {
- aResult.push({
- 'id': '---',
- 'name': '---',
- 'system': false,
- 'seporator': true,
- 'disabled': true
- });
- }
-
- bSep = false;
- aResult.push({
- 'id': oItem.fullNameRaw,
- 'name': fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name(),
- 'system': true,
- 'seporator': false,
- 'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) ||
- (fDisableCallback ? fDisableCallback.call(null, oItem) : false)
- });
- }
- }
-
- bSep = true;
- for (iIndex = 0, iLen = aList.length; iIndex < iLen; iIndex++)
- {
- oItem = aList[iIndex];
- if (oItem.subScribed() || !oItem.existen)
- {
- if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
- {
- if (Enums.FolderType.User === oItem.type() || !bSystem || 0 < oItem.subFolders().length)
- {
- if (bSep && 0 < aResult.length)
- {
- aResult.push({
- 'id': '---',
- 'name': '---',
- 'system': false,
- 'seporator': true,
- 'disabled': true
- });
- }
-
- bSep = false;
- aResult.push({
- 'id': oItem.fullNameRaw,
- 'name': (new window.Array(oItem.deep + 1 - iUnDeep)).join(sDeepPrefix) +
- (fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name()),
- 'system': false,
- 'seporator': false,
- 'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) ||
- (fDisableCallback ? fDisableCallback.call(null, oItem) : false)
- });
- }
- }
- }
-
- if (oItem.subScribed() && 0 < oItem.subFolders().length)
- {
- aResult = aResult.concat(RL.folderListOptionsBuilder([], oItem.subFolders(), aDisabled, [],
- iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible));
- }
- }
-
- return aResult;
-};
-
-/**
- * @param {string} sQuery
- * @param {Function} fCallback
- */
-RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
-{
- var
- aData = []
- ;
-
- RL.remote().suggestions(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult && oData && Utils.isArray(oData.Result))
- {
- aData = _.map(oData.Result, function (aItem) {
- return aItem && aItem[0] ? new EmailModel(aItem[0], aItem[1]) : null;
- });
-
- fCallback(_.compact(aData));
- }
- else if (Enums.StorageResultType.Abort !== sResult)
- {
- fCallback([]);
- }
-
- }, sQuery);
-};
-
-/**
- * @param {string} sQuery
- * @param {Function} fCallback
- */
-RainLoopApp.prototype.getContactTagsAutocomplete = function (sQuery, fCallback)
-{
- fCallback(_.filter(RL.data().contactTags(), function (oContactTag) {
- return oContactTag && oContactTag.filterHelper(sQuery);
- }));
-};
-
-/**
- * @param {string} sMailToUrl
- * @returns {boolean}
- */
-RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
-{
- if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase())
- {
- sMailToUrl = sMailToUrl.toString().substr(7);
-
- var
- oParams = {},
- oEmailModel = null,
- sEmail = sMailToUrl.replace(/\?.+$/, ''),
- sQueryString = sMailToUrl.replace(/^[^\?]*\?/, '')
- ;
-
- oEmailModel = new EmailModel();
- oEmailModel.parse(window.decodeURIComponent(sEmail));
-
- if (oEmailModel && oEmailModel.email)
- {
- oParams = Utils.simpleQueryParser(sQueryString);
- kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Empty, null, [oEmailModel],
- Utils.isUnd(oParams.subject) ? null : Utils.pString(oParams.subject),
- Utils.isUnd(oParams.body) ? null : Utils.plainToHtml(Utils.pString(oParams.body))
- ]);
- }
-
- return true;
- }
-
- return false;
-};
-
-RainLoopApp.prototype.bootstart = function ()
-{
- RL.pub('rl.bootstart');
- AbstractApp.prototype.bootstart.call(this);
-
- RL.data().populateDataOnStart();
-
- var
- sCustomLoginLink = '',
- sJsHash = RL.settingsGet('JsHash'),
- iContactsSyncInterval = Utils.pInt(RL.settingsGet('ContactsSyncInterval')),
- bGoogle = RL.settingsGet('AllowGoogleSocial'),
- bFacebook = RL.settingsGet('AllowFacebookSocial'),
- bTwitter = RL.settingsGet('AllowTwitterSocial')
- ;
-
- if (!RL.settingsGet('ChangePasswordIsAllowed'))
- {
- Utils.removeSettingsViewModel(SettingsChangePasswordScreen);
- }
-
- if (!RL.settingsGet('ContactsIsAllowed'))
- {
- Utils.removeSettingsViewModel(SettingsContacts);
- }
-
- if (!RL.capa(Enums.Capa.AdditionalAccounts))
- {
- Utils.removeSettingsViewModel(SettingsAccounts);
- }
-
- if (RL.capa(Enums.Capa.AdditionalIdentities))
- {
- Utils.removeSettingsViewModel(SettingsIdentity);
- }
- else
- {
- Utils.removeSettingsViewModel(SettingsIdentities);
- }
-
- if (!RL.capa(Enums.Capa.OpenPGP))
- {
- Utils.removeSettingsViewModel(SettingsOpenPGP);
- }
-
- if (!RL.capa(Enums.Capa.TwoFactor))
- {
- Utils.removeSettingsViewModel(SettingsSecurity);
- }
-
- if (!RL.capa(Enums.Capa.Themes))
- {
- Utils.removeSettingsViewModel(SettingsThemes);
- }
-
- if (!RL.capa(Enums.Capa.Filters))
- {
- Utils.removeSettingsViewModel(SettingsFilters);
- }
-
- if (!bGoogle && !bFacebook && !bTwitter)
- {
- Utils.removeSettingsViewModel(SettingsSocialScreen);
- }
-
- Utils.initOnStartOrLangChange(function () {
-
- $.extend(true, $.magnificPopup.defaults, {
- 'tClose': Utils.i18n('MAGNIFIC_POPUP/CLOSE'),
- 'tLoading': Utils.i18n('MAGNIFIC_POPUP/LOADING'),
- 'gallery': {
- 'tPrev': Utils.i18n('MAGNIFIC_POPUP/GALLERY_PREV'),
- 'tNext': Utils.i18n('MAGNIFIC_POPUP/GALLERY_NEXT'),
- 'tCounter': Utils.i18n('MAGNIFIC_POPUP/GALLERY_COUNTER')
- },
- 'image': {
- 'tError': Utils.i18n('MAGNIFIC_POPUP/IMAGE_ERROR')
- },
- 'ajax': {
- 'tError': Utils.i18n('MAGNIFIC_POPUP/AJAX_ERROR')
- }
- });
-
- }, this);
-
- if (window.SimplePace)
- {
- window.SimplePace.set(70);
- window.SimplePace.sleep();
- }
-
- if (!!RL.settingsGet('Auth'))
- {
- this.setTitle(Utils.i18n('TITLES/LOADING'));
-
- this.folders(_.bind(function (bValue) {
-
- kn.hideLoading();
-
- if (bValue)
- {
- if (window.$LAB && window.crypto && window.crypto.getRandomValues && RL.capa(Enums.Capa.OpenPGP))
- {
- window.$LAB.script(window.openpgp ? '' : RL.link().openPgpJs()).wait(function () {
- if (window.openpgp)
- {
- RL.data().openpgpKeyring = new window.openpgp.Keyring();
- RL.data().capaOpenPGP(true);
-
- RL.pub('openpgp.init');
-
- RL.reloadOpenPgpKeys();
- }
- });
- }
- else
- {
- RL.data().capaOpenPGP(false);
- }
-
- kn.startScreens([MailBoxScreen, SettingsScreen]);
-
- if (bGoogle || bFacebook || bTwitter)
- {
- RL.socialUsers(true);
- }
-
- RL.sub('interval.2m', function () {
- RL.folderInformation('INBOX');
- });
-
- RL.sub('interval.2m', function () {
- var sF = RL.data().currentFolderFullNameRaw();
- if ('INBOX' !== sF)
- {
- RL.folderInformation(sF);
- }
- });
-
- RL.sub('interval.3m', function () {
- RL.folderInformationMultiply();
- });
-
- RL.sub('interval.5m', function () {
- RL.quota();
- });
-
- RL.sub('interval.10m', function () {
- RL.folders();
- });
-
- iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
- iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
-
- window.setInterval(function () {
- RL.contactsSync();
- }, iContactsSyncInterval * 60000 + 5000);
-
- _.delay(function () {
- RL.contactsSync();
- }, 5000);
-
- _.delay(function () {
- RL.folderInformationMultiply(true);
- }, 500);
-
- Plugins.runHook('rl-start-user-screens');
- RL.pub('rl.bootstart-user-screens');
-
- if (!!RL.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
- {
- _.delay(function () {
- try {
- window.navigator.registerProtocolHandler('mailto',
- window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
- '' + (RL.settingsGet('Title') || 'RainLoop'));
- } catch(e) {}
-
- if (RL.settingsGet('MailToEmail'))
- {
- RL.mailToHelper(RL.settingsGet('MailToEmail'));
- }
- }, 500);
- }
- }
- else
- {
- kn.startScreens([LoginScreen]);
-
- Plugins.runHook('rl-start-login-screens');
- RL.pub('rl.bootstart-login-screens');
- }
-
- if (window.SimplePace)
- {
- window.SimplePace.set(100);
- }
-
- if (!Globals.bMobileDevice)
- {
- _.defer(function () {
- Utils.initLayoutResizer('#rl-left', '#rl-right', Enums.ClientSideKeyName.FolderListSize);
- });
- }
-
- }, this));
- }
- else
- {
- sCustomLoginLink = Utils.pString(RL.settingsGet('CustomLoginLink'));
- if (!sCustomLoginLink)
- {
- kn.hideLoading();
- kn.startScreens([LoginScreen]);
-
- Plugins.runHook('rl-start-login-screens');
- RL.pub('rl.bootstart-login-screens');
-
- if (window.SimplePace)
- {
- window.SimplePace.set(100);
- }
- }
- else
- {
- kn.routeOff();
- kn.setHash(RL.link().root(), true);
- kn.routeOff();
-
- _.defer(function () {
- window.location.href = sCustomLoginLink;
- });
- }
- }
-
- if (bGoogle)
- {
- window['rl_' + sJsHash + '_google_service'] = function () {
- RL.data().googleActions(true);
- RL.socialUsers();
- };
- }
-
- if (bFacebook)
- {
- window['rl_' + sJsHash + '_facebook_service'] = function () {
- RL.data().facebookActions(true);
- RL.socialUsers();
- };
- }
-
- if (bTwitter)
- {
- window['rl_' + sJsHash + '_twitter_service'] = function () {
- RL.data().twitterActions(true);
- RL.socialUsers();
- };
- }
-
- RL.sub('interval.1m', function () {
- Globals.momentTrigger(!Globals.momentTrigger());
- });
-
- Plugins.runHook('rl-start-screens');
- RL.pub('rl.bootstart-end');
-};
-
-/**
- * @type {RainLoopApp}
- */
-RL = new RainLoopApp();
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
-
-$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
-$window.unload(function () {
- Globals.bUnload = true;
-});
-
-$html.on('click.dropdown.data-api', function () {
- Utils.detectDropdownVisibility();
-});
-
-// export
-window['rl'] = window['rl'] || {};
-window['rl']['addHook'] = Plugins.addHook;
-window['rl']['settingsGet'] = Plugins.mainSettingsGet;
-window['rl']['remoteRequest'] = Plugins.remoteRequest;
-window['rl']['pluginSettingsGet'] = Plugins.settingsGet;
-window['rl']['addSettingsViewModel'] = Utils.addSettingsViewModel;
-window['rl']['createCommand'] = Utils.createCommand;
-
-window['rl']['EmailModel'] = EmailModel;
-window['rl']['Enums'] = Enums;
-
-window['__RLBOOT'] = function (fCall) {
-
- // boot
- $(function () {
-
- if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
- {
- $('#rl-templates').html(window['rainloopTEMPLATES'][0]);
-
- _.delay(function () {
- window['rainloopAppData'] = {};
- window['rainloopI18N'] = {};
- window['rainloopTEMPLATES'] = {};
-
- kn.setBoot(RL).bootstart();
- $html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
-
- }, 50);
- }
- else
- {
- fCall(false);
- }
-
- window['__RLBOOT'] = null;
- });
-};
-
-
-}(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible, key));
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/_app.min.js b/rainloop/v/0.0.0/static/js/_app.min.js
deleted file mode 100644
index b580fa7e0..000000000
--- a/rainloop/v/0.0.0/static/js/_app.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-!function(e,t,s,i,o,n,a,r,l,c){"use strict";function u(){this.sBase="#/",this.sServer="./?",this.sVersion=jt.settingsGet("Version"),this.sSpecSuffix=jt.settingsGet("AuthAccountHash")||"0",this.sStaticPrefix=jt.settingsGet("StaticPrefix")||"rainloop/v/"+this.sVersion+"/static/"}function d(e,s,i,o){var n=this;n.editor=null,n.iBlurTimer=0,n.fOnBlur=s||null,n.fOnReady=i||null,n.fOnModeChange=o||null,n.$element=t(e),n.resize=r.throttle(r.bind(n.resize,n),100),n.init()}function h(e,t,i,o,n,a){this.list=e,this.listChecked=s.computed(function(){return r.filter(this.list(),function(e){return e.checked()})},this).extend({rateLimit:0}),this.isListChecked=s.computed(function(){return 00&&-1t?t:e))},this),this.body=null,this.plainRaw="",this.isHtml=s.observable(!1),this.hasImages=s.observable(!1),this.attachments=s.observableArray([]),this.isPgpSigned=s.observable(!1),this.isPgpEncrypted=s.observable(!1),this.pgpSignedVerifyStatus=s.observable(Lt.SignedVerifyStatus.None),this.pgpSignedVerifyUser=s.observable(""),this.priority=s.observable(Lt.MessagePriority.Normal),this.readReceipt=s.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=s.observable(0),this.threads=s.observableArray([]),this.threadsLen=s.observable(0),this.hasUnseenSubMessage=s.observable(!1),this.hasFlaggedSubMessage=s.observable(!1),this.lastInCollapsedThread=s.observable(!1),this.lastInCollapsedThreadLoading=s.observable(!1),this.threadsLenResult=s.computed(function(){var e=this.threadsLen();return 0===this.parentUid()&&e>0?e+1:""},this)}function N(){this.name=s.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.interval=0,this.selectable=!1,this.existen=!0,this.type=s.observable(Lt.FolderType.User),this.focused=s.observable(!1),this.selected=s.observable(!1),this.edited=s.observable(!1),this.collapsed=s.observable(!0),this.subScribed=s.observable(!0),this.subFolders=s.observableArray([]),this.deleteAccess=s.observable(!1),this.actionBlink=s.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=s.observable(""),this.name.subscribe(function(e){this.nameForEdit(e)},this),this.edited.subscribe(function(e){e&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=s.observable(0),this.privateMessageCountUnread=s.observable(0),this.collapsedPrivate=s.observable(!0)}function R(e,t){this.email=e,this.deleteAccess=s.observable(!1),this.canBeDalete=s.observable(t)}function I(e,t,i){this.id=e,this.email=s.observable(t),this.name=s.observable(""),this.replyTo=s.observable(""),this.bcc=s.observable(""),this.deleteAccess=s.observable(!1),this.canBeDalete=s.observable(i)}function L(e){this.parentList=e,this.field=s.observable(Lt.FilterConditionField.From),this.fieldOptions=[{id:Lt.FilterConditionField.From,name:"From"},{id:Lt.FilterConditionField.Recipient,name:"Recipient (To or CC)"},{id:Lt.FilterConditionField.To,name:"To"},{id:Lt.FilterConditionField.Subject,name:"Subject"}],this.type=s.observable(Lt.FilterConditionType.EqualTo),this.typeOptions=[{id:Lt.FilterConditionType.EqualTo,name:"Equal To"},{id:Lt.FilterConditionType.NotEqualTo,name:"Not Equal To"},{id:Lt.FilterConditionType.Contains,name:"Contains"},{id:Lt.FilterConditionType.NotContains,name:"Not Contains"}],this.value=s.observable(""),this.template=s.computed(function(){var e="";switch(this.type()){default:e="SettingsFiltersConditionDefault"}return e},this)}function P(){this.new=s.observable(!0),this.enabled=s.observable(!0),this.name=s.observable(""),this.conditionsType=s.observable(Lt.FilterRulesType.And),this.conditions=s.observableArray([]),this.conditions.subscribe(function(){Mt.windowResize()}),this.actionMarkAsRead=s.observable(!1),this.actionSkipOtherFilters=s.observable(!0),this.actionValue=s.observable(""),this.actionType=s.observable(Lt.FiltersAction.Move),this.actionTypeOptions=[{id:Lt.FiltersAction.None,name:"Action - None"},{id:Lt.FiltersAction.Move,name:"Action - Move to"},{id:Lt.FiltersAction.Discard,name:"Action - Discard"}],this.actionMarkAsReadVisiblity=s.computed(function(){return-1=e?1:e},this),this.contactsPagenator=s.computed(Mt.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=s.observable(!0),this.viewClearSearch=s.observable(!1),this.viewID=s.observable(""),this.viewReadOnly=s.observable(!1),this.viewProperties=s.observableArray([]),this.viewTags=s.observable(""),this.viewTags.visibility=s.observable(!1),this.viewTags.focusTrigger=s.observable(!1),this.viewTags.focusTrigger.subscribe(function(e){e||""!==this.viewTags()?e&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=s.observable(Lt.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(e){return-1e)break;t[0]&&t[1]&&t[2]&&t[1]===t[2]&&("PRIVATE"===t[1]?o.privateKeys.importKey(t[0]):"PUBLIC"===t[1]&&o.publicKeys.importKey(t[0])),e--}return o.store(),jt.reloadOpenPgpKeys(),Mt.delegateRun(this,"cancelCommand"),!0}),S.constructorEnd(this)}function B(){b.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=s.observable(""),this.keyDom=s.observable(null),S.constructorEnd(this)}function G(){b.call(this,"Popups","PopupsGenerateNewOpenPgpKey"),this.email=s.observable(""),this.email.focus=s.observable(""),this.email.error=s.observable(!1),this.name=s.observable(""),this.password=s.observable(""),this.keyBitLength=s.observable(2048),this.submitRequest=s.observable(!1),this.email.subscribe(function(){this.email.error(!1)},this),this.generateOpenPgpKeyCommand=Mt.createCommand(this,function(){var t=this,s="",i=null,o=jt.data().openpgpKeyring;return this.email.error(""===Mt.trim(this.email())),!o||this.email.error()?!1:(s=this.email(),""!==this.name()&&(s=this.name()+" <"+s+">"),this.submitRequest(!0),r.delay(function(){i=e.openpgp.generateKeyPair({userId:s,numBits:Mt.pInt(t.keyBitLength()),passphrase:Mt.trim(t.password())}),i&&i.privateKeyArmored&&(o.privateKeys.importKey(i.privateKeyArmored),o.publicKeys.importKey(i.publicKeyArmored),o.store(),jt.reloadOpenPgpKeys(),Mt.delegateRun(t,"cancelCommand")),t.submitRequest(!1)
-},100),!0)}),S.constructorEnd(this)}function K(){b.call(this,"Popups","PopupsComposeOpenPgp"),this.notification=s.observable(""),this.sign=s.observable(!0),this.encrypt=s.observable(!0),this.password=s.observable(""),this.password.focus=s.observable(!1),this.buttonFocus=s.observable(!1),this.from=s.observable(""),this.to=s.observableArray([]),this.text=s.observable(""),this.resultCallback=null,this.submitRequest=s.observable(!1),this.doCommand=Mt.createCommand(this,function(){var t=this,s=!0,i=jt.data(),o=null,n=[];this.submitRequest(!0),s&&this.sign()&&""===this.from()&&(this.notification(Mt.i18n("PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL")),s=!1),s&&this.sign()&&(o=i.findPrivateKeyByEmail(this.from(),this.password()),o||(this.notification(Mt.i18n("PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR",{EMAIL:this.from()})),s=!1)),s&&this.encrypt()&&0===this.to().length&&(this.notification(Mt.i18n("PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT")),s=!1),s&&this.encrypt()&&(n=[],r.each(this.to(),function(e){var o=i.findPublicKeysByEmail(e);0===o.length&&s&&(t.notification(Mt.i18n("PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR",{EMAIL:e})),s=!1),n=n.concat(o)}),!s||0!==n.length&&this.to().length===n.length||(s=!1)),r.delay(function(){if(t.resultCallback&&s)try{o&&0===n.length?t.resultCallback(e.openpgp.signClearMessage([o],t.text())):o&&00&&t>0&&e>t},this),this.hasMessages=s.computed(function(){return 0'),o.after(n),o.remove()),n&&n[0]&&(n.attr("data-href",a).attr("data-theme",e[0]),n&&n[0]&&n[0].styleSheet&&!Mt.isUnd(n[0].styleSheet.cssText)?n[0].styleSheet.cssText=e[1]:n.text(e[1])),i.themeTrigger(Lt.SaveSettingsStep.TrueResult))}).always(function(){i.iTimer=e.setTimeout(function(){i.themeTrigger(Lt.SaveSettingsStep.Idle)},1e3),i.oLastAjax=null})),jt.remote().saveSettings(null,{Theme:s})},this)}function ft(){this.openpgpkeys=jt.data().openpgpkeys,this.openpgpkeysPublic=jt.data().openpgpkeysPublic,this.openpgpkeysPrivate=jt.data().openpgpkeysPrivate,this.openPgpKeyForDeletion=s.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}function bt(){this.leftPanelDisabled=s.observable(!1),this.useKeyboardShortcuts=s.observable(!0),this.keyScopeReal=s.observable(Lt.KeyState.All),this.keyScopeFake=s.observable(Lt.KeyState.All),this.keyScope=s.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(e){Lt.KeyState.Menu!==e&&(Lt.KeyState.Compose===e?Mt.disableKeyFilter():Mt.restoreKeyFilter(),this.keyScopeFake(e),Ot.dropdownVisibility()&&(e=Lt.KeyState.Menu)),this.keyScopeReal(e)}}),this.keyScopeReal.subscribe(function(e){c.setScope(e)}),this.leftPanelDisabled.subscribe(function(e){jt.pub("left-panel."+(e?"off":"on"))}),Ot.dropdownVisibility.subscribe(function(e){e?(Ot.tooltipTrigger(!Ot.tooltipTrigger()),this.keyScope(Lt.KeyState.Menu)):Lt.KeyState.Menu===c.getScope()&&this.keyScope(this.keyScopeFake())
-},this),Mt.initDataConstructorBySettings(this)}function yt(){bt.call(this);var i=function(e){return function(){var t=jt.cache().getFolderFromCacheList(e());t&&t.type(Lt.FolderType.User)}},o=function(e){return function(t){var s=jt.cache().getFolderFromCacheList(t);s&&s.type(e)}};this.devEmail="",this.devPassword="",this.accountEmail=s.observable(""),this.accountIncLogin=s.observable(""),this.accountOutLogin=s.observable(""),this.projectHash=s.observable(""),this.threading=s.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=s.observable(""),this.draftFolder=s.observable(""),this.spamFolder=s.observable(""),this.trashFolder=s.observable(""),this.archiveFolder=s.observable(""),this.sentFolder.subscribe(i(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(i(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(i(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(i(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(i(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(o(Lt.FolderType.SentItems),this),this.draftFolder.subscribe(o(Lt.FolderType.Draft),this),this.spamFolder.subscribe(o(Lt.FolderType.Spam),this),this.trashFolder.subscribe(o(Lt.FolderType.Trash),this),this.archiveFolder.subscribe(o(Lt.FolderType.Archive),this),this.draftFolderNotEnabled=s.computed(function(){return""===this.draftFolder()||It.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=s.observable(""),this.signature=s.observable(""),this.signatureToAll=s.observable(!1),this.replyTo=s.observable(""),this.enableTwoFactor=s.observable(!1),this.accounts=s.observableArray([]),this.accountsLoading=s.observable(!1).extend({throttle:100}),this.defaultIdentityID=s.observable(""),this.identities=s.observableArray([]),this.identitiesLoading=s.observable(!1).extend({throttle:100}),this.contactTags=s.observableArray([]),this.contacts=s.observableArray([]),this.contacts.loading=s.observable(!1).extend({throttle:200}),this.contacts.importing=s.observable(!1).extend({throttle:200}),this.contacts.syncing=s.observable(!1).extend({throttle:200}),this.contacts.exportingVcf=s.observable(!1).extend({throttle:200}),this.contacts.exportingCsv=s.observable(!1).extend({throttle:200}),this.allowContactsSync=s.observable(!1),this.enableContactsSync=s.observable(!1),this.contactsSyncUrl=s.observable(""),this.contactsSyncUser=s.observable(""),this.contactsSyncPass=s.observable(""),this.allowContactsSync=s.observable(!!jt.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=s.observable(!!jt.settingsGet("EnableContactsSync")),this.contactsSyncUrl=s.observable(jt.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=s.observable(jt.settingsGet("ContactsSyncUser")),this.contactsSyncPass=s.observable(jt.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=s.observableArray([]),this.folderList.focused=s.observable(!1),this.foldersListError=s.observable(""),this.foldersLoading=s.observable(!1),this.foldersCreating=s.observable(!1),this.foldersDeleting=s.observable(!1),this.foldersRenaming=s.observable(!1),this.foldersChanging=s.computed(function(){var e=this.foldersLoading(),t=this.foldersCreating(),s=this.foldersDeleting(),i=this.foldersRenaming();return e||t||s||i},this),this.foldersInboxUnreadCount=s.observable(0),this.currentFolder=s.observable(null).extend({toggleSubscribe:[null,function(e){e&&e.selected(!1)},function(e){e&&e.selected(!0)}]}),this.currentFolderFullNameRaw=s.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=s.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=s.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=s.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=s.computed(function(){var e=["INBOX"],t=this.folderList(),s=this.sentFolder(),i=this.draftFolder(),o=this.spamFolder(),n=this.trashFolder(),a=this.archiveFolder();return Mt.isArray(t)&&0=e?1:e},this),this.mainMessageListSearch=s.computed({read:this.messageListSearch,write:function(e){xt.setHash(jt.link().mailBox(this.currentFolderFullNameHash(),1,Mt.trim(e.toString())))},owner:this}),this.messageListError=s.observable(""),this.messageListLoading=s.observable(!1),this.messageListIsNotCompleted=s.observable(!1),this.messageListCompleteLoadingThrottle=s.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=s.computed(function(){var e=this.messageListLoading(),t=this.messageListIsNotCompleted();return e||t},this),this.messageListCompleteLoading.subscribe(function(e){this.messageListCompleteLoadingThrottle(e)},this),this.messageList.subscribe(r.debounce(function(e){r.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new E,this.message=s.observable(null),this.messageLoading=s.observable(!1),this.messageLoadingThrottle=s.observable(!1).extend({throttle:50}),this.message.focused=s.observable(!1),this.message.subscribe(function(t){t?Lt.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),Lt.Layout.NoPreview===jt.data().layout()&&-10?Math.ceil(t/e*100):0},this),this.capaOpenPGP=s.observable(!1),this.openpgpkeys=s.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(e){return!(!e||e.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(e){return!(!e||!e.isPrivate)}),this.googleActions=s.observable(!1),this.googleLoggined=s.observable(!1),this.googleUserName=s.observable(""),this.facebookActions=s.observable(!1),this.facebookLoggined=s.observable(!1),this.facebookUserName=s.observable(""),this.twitterActions=s.observable(!1),this.twitterLoggined=s.observable(!1),this.twitterUserName=s.observable(""),this.customThemeType=s.observable(Lt.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=r.throttle(this.purgeMessageBodyCache,3e4)}function St(){this.oRequests={}}function vt(){St.call(this),this.oRequests={}}function Ct(){this.bCapaGravatar=jt.capa(Lt.Capa.Gravatar)}function wt(){Ct.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function Tt(e){y.call(this,"settings",e),this.menu=s.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function Ft(){y.call(this,"login",[$])}function At(){y.call(this,"mailbox",[Q,et,tt,st]),this.oLastRoute={}}function Et(){Tt.call(this,[Z,it,ot]),Mt.initOnStartOrLangChange(function(){this.sSettingsTitle=Mt.i18n("TITLES/SETTINGS")},this,function(){jt.setTitle(this.sSettingsTitle)})}function Nt(){f.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=s.observableArray([]),this.popupVisibility=s.computed(function(){return 0').appendTo("body"),Gt.on("error",function(e){jt&&e&&e.originalEvent&&e.originalEvent.message&&-1===Mt.inArray(e.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&jt.remote().jsError(Mt.emptyFunction,e.originalEvent.message,e.originalEvent.filename,e.originalEvent.lineno,location&&location.toString?location.toString():"",Bt.attr("class"),Mt.microtime()-Ot.now)}),Kt.on("keydown",function(e){e&&e.ctrlKey&&Bt.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&Bt.removeClass("rl-ctrl-key-pressed")})}function Rt(){Nt.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=r.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=r.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=r.debounce(this.messagesMoveTrigger,500),e.setInterval(function(){jt.pub("interval.30s")},3e4),e.setInterval(function(){jt.pub("interval.1m")},6e4),e.setInterval(function(){jt.pub("interval.2m")},12e4),e.setInterval(function(){jt.pub("interval.3m")},18e4),e.setInterval(function(){jt.pub("interval.5m")},3e5),e.setInterval(function(){jt.pub("interval.10m")},6e5),e.setTimeout(function(){e.setInterval(function(){jt.pub("interval.10m-after5m")},6e5)},3e5),t.wakeUp(function(){jt.remote().jsVersion(function(t,s){Lt.StorageResultType.Success===t&&s&&!s.Result&&(e.parent&&jt.settingsGet("InIframe")?e.parent.location.reload():e.location.reload())},jt.settingsGet("Version"))},{},36e5)}var It={},Lt={},Pt={},Mt={},Dt={},kt={},Ot={},_t={settings:[],"settings-removed":[],"settings-disabled":[]},Ut=[],xt=null,Vt=e.rainloopAppData||{},Ht=e.rainloopI18N||{},Bt=t("html"),Gt=t(e),Kt=t(e.document),qt=e.Notification&&e.Notification.requestPermission?e.Notification:null,jt=null,zt=t("");Ot.now=(new Date).getTime(),Ot.momentTrigger=s.observable(!0),Ot.dropdownVisibility=s.observable(!1).extend({rateLimit:0}),Ot.tooltipTrigger=s.observable(!1).extend({rateLimit:0}),Ot.langChangeTrigger=s.observable(!0),Ot.iAjaxErrorCount=0,Ot.iTokenErrorCount=0,Ot.iMessageBodyCacheCount=0,Ot.bUnload=!1,Ot.sUserAgent=(navigator.userAgent||"").toLowerCase(),Ot.bIsiOSDevice=-1n;n++)o=i[n].split("="),s[e.decodeURIComponent(o[0])]=e.decodeURIComponent(o[1]);return s},Mt.rsaEncode=function(t,s,i,o){if(e.crypto&&e.crypto.getRandomValues&&e.RSAKey&&s&&i&&o){var n=new e.RSAKey;if(n.setPublic(o,i),t=n.encrypt(Mt.fakeMd5()+":"+t+":"+Mt.fakeMd5()),!1!==t)return"rsa:"+s+":"+t}return!1},Mt.rsaEncode.supported=!!(e.crypto&&e.crypto.getRandomValues&&e.RSAKey),Mt.exportPath=function(t,s,i){for(var o=null,n=t.split("."),a=i||e;n.length&&(o=n.shift());)n.length||Mt.isUnd(s)?a=a[o]?a[o]:a[o]={}:a[o]=s},Mt.pImport=function(e,t,s){e[t]=s},Mt.pExport=function(e,t,s){return Mt.isUnd(e[t])?s:e[t]},Mt.encodeHtml=function(e){return Mt.isNormal(e)?e.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):""},Mt.splitPlainText=function(e,t){var s="",i="",o=e,n=0,a=0;for(t=Mt.isUnd(t)?100:t;o.length>t;)i=o.substring(0,t),n=i.lastIndexOf(" "),a=i.lastIndexOf("\n"),-1!==a&&(n=a),-1===n&&(n=t),s+=i.substring(0,n)+"\n",o=o.substring(n+1);return s+o},Mt.timeOutAction=function(){var t={};return function(s,i,o){Mt.isUnd(t[s])&&(t[s]=0),e.clearTimeout(t[s]),t[s]=e.setTimeout(i,o)}}(),Mt.timeOutActionSecond=function(){var t={};return function(s,i,o){t[s]||(t[s]=e.setTimeout(function(){i(),t[s]=0},o))}}(),Mt.audio=function(){var t=!1;return function(s,i){if(!1===t)if(Ot.bIsiOSDevice)t=null;else{var o=!1,n=!1,a=e.Audio?new e.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(n=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||n?(t=a,t.preload="none",t.loop=!1,t.autoplay=!1,t.muted=!1,t.src=o?s:i):t=null):t=null}return t}}(),Mt.hos=function(e,t){return e&&Object.hasOwnProperty?Object.hasOwnProperty.call(e,t):!1},Mt.i18n=function(e,t,s){var i="",o=Mt.isUnd(Ht[e])?Mt.isUnd(s)?e:s:Ht[e];if(!Mt.isUnd(t)&&!Mt.isNull(t))for(i in t)Mt.hos(t,i)&&(o=o.replace("%"+i+"%",t[i]));return o},Mt.i18nToNode=function(e){r.defer(function(){t(".i18n",e).each(function(){var e=t(this),s="";s=e.data("i18n-text"),s?e.text(Mt.i18n(s)):(s=e.data("i18n-html"),s&&e.html(Mt.i18n(s)),s=e.data("i18n-placeholder"),s&&e.attr("placeholder",Mt.i18n(s)),s=e.data("i18n-title"),s&&e.attr("title",Mt.i18n(s)))})})},Mt.i18nToDoc=function(){e.rainloopI18N&&(Ht=e.rainloopI18N||{},Mt.i18nToNode(Kt),Ot.langChangeTrigger(!Ot.langChangeTrigger())),e.rainloopI18N={}},Mt.initOnStartOrLangChange=function(e,t,s){e&&e.call(t),s?Ot.langChangeTrigger.subscribe(function(){e&&e.call(t),s.call(t)}):e&&Ot.langChangeTrigger.subscribe(e,t)},Mt.inFocus=function(){return document.activeElement?(Mt.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=t(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},Mt.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var e=t(document.activeElement);e.is("input,textarea")&&document.activeElement.blur()}},Mt.removeSelection=function(){if(e&&e.getSelection){var t=e.getSelection();t&&t.removeAllRanges&&t.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},Mt.replySubjectAdd=function(e,t){e=Mt.trim(e.toUpperCase()),t=Mt.trim(t.replace(/[\s]+/," "));var s=0,i="",o=!1,n="",a=[],r=[],l="RE"===e,c="FWD"===e,u=!c;if(""!==t){for(o=!1,r=t.split(":"),s=0;s0);return e.replace(/[\s]+/," ")},Mt._replySubjectAdd_=function(t,s,i){var o=null,n=Mt.trim(s);return n=null===(o=new e.RegExp("^"+t+"[\\s]?\\:(.*)$","gi").exec(s))||Mt.isUnd(o[1])?null===(o=new e.RegExp("^("+t+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(s))||Mt.isUnd(o[1])||Mt.isUnd(o[2])||Mt.isUnd(o[3])?t+": "+s:o[1]+(Mt.pInt(o[2])+1)+o[3]:t+"[2]: "+o[1],n=n.replace(/[\s]+/g," "),n=(Mt.isUnd(i)?!0:i)?Mt.fixLongSubject(n):n},Mt._fixLongSubject_=function(e){var t=0,s=null;e=Mt.trim(e.replace(/[\s]+/," "));do s=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!s||Mt.isUnd(s[0]))&&(s=null),s&&(t=0,t+=Mt.isUnd(s[2])?1:0+Mt.pInt(s[2]),t+=Mt.isUnd(s[4])?1:0+Mt.pInt(s[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(s);return e=e.replace(/[\s]+/," ")},Mt.roundNumber=function(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},Mt.friendlySize=function(e){return e=Mt.pInt(e),e>=1073741824?Mt.roundNumber(e/1073741824,1)+"GB":e>=1048576?Mt.roundNumber(e/1048576,1)+"MB":e>=1024?Mt.roundNumber(e/1024,0)+"KB":e+"B"},Mt.log=function(t){e.console&&e.console.log&&e.console.log(t)},Mt.getNotification=function(e,t){return e=Mt.pInt(e),Lt.Notification.ClientViewError===e&&t?t:Mt.isUnd(Pt[e])?"":Pt[e]},Mt.initNotificationLanguage=function(){Pt[Lt.Notification.InvalidToken]=Mt.i18n("NOTIFICATIONS/INVALID_TOKEN"),Pt[Lt.Notification.AuthError]=Mt.i18n("NOTIFICATIONS/AUTH_ERROR"),Pt[Lt.Notification.AccessError]=Mt.i18n("NOTIFICATIONS/ACCESS_ERROR"),Pt[Lt.Notification.ConnectionError]=Mt.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Pt[Lt.Notification.CaptchaError]=Mt.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Pt[Lt.Notification.SocialFacebookLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Pt[Lt.Notification.SocialTwitterLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Pt[Lt.Notification.SocialGoogleLoginAccessDisable]=Mt.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Pt[Lt.Notification.DomainNotAllowed]=Mt.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Pt[Lt.Notification.AccountNotAllowed]=Mt.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Pt[Lt.Notification.AccountTwoFactorAuthRequired]=Mt.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Pt[Lt.Notification.AccountTwoFactorAuthError]=Mt.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Pt[Lt.Notification.CouldNotSaveNewPassword]=Mt.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Pt[Lt.Notification.CurrentPasswordIncorrect]=Mt.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Pt[Lt.Notification.NewPasswordShort]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Pt[Lt.Notification.NewPasswordWeak]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Pt[Lt.Notification.NewPasswordForbidden]=Mt.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Pt[Lt.Notification.ContactsSyncError]=Mt.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Pt[Lt.Notification.CantGetMessageList]=Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Pt[Lt.Notification.CantGetMessage]=Mt.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Pt[Lt.Notification.CantDeleteMessage]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Pt[Lt.Notification.CantMoveMessage]=Mt.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Pt[Lt.Notification.CantCopyMessage]=Mt.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Pt[Lt.Notification.CantSaveMessage]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Pt[Lt.Notification.CantSendMessage]=Mt.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Pt[Lt.Notification.InvalidRecipients]=Mt.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Pt[Lt.Notification.CantCreateFolder]=Mt.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Pt[Lt.Notification.CantRenameFolder]=Mt.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Pt[Lt.Notification.CantDeleteFolder]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Pt[Lt.Notification.CantDeleteNonEmptyFolder]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Pt[Lt.Notification.CantSubscribeFolder]=Mt.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Pt[Lt.Notification.CantUnsubscribeFolder]=Mt.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Pt[Lt.Notification.CantSaveSettings]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Pt[Lt.Notification.CantSavePluginSettings]=Mt.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Pt[Lt.Notification.DomainAlreadyExists]=Mt.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Pt[Lt.Notification.CantInstallPackage]=Mt.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Pt[Lt.Notification.CantDeletePackage]=Mt.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Pt[Lt.Notification.InvalidPluginPackage]=Mt.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Pt[Lt.Notification.UnsupportedPluginPackage]=Mt.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Pt[Lt.Notification.LicensingServerIsUnavailable]=Mt.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Pt[Lt.Notification.LicensingExpired]=Mt.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Pt[Lt.Notification.LicensingBanned]=Mt.i18n("NOTIFICATIONS/LICENSING_BANNED"),Pt[Lt.Notification.DemoSendMessageError]=Mt.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Pt[Lt.Notification.AccountAlreadyExists]=Mt.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Pt[Lt.Notification.MailServerError]=Mt.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Pt[Lt.Notification.InvalidInputArgument]=Mt.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),Pt[Lt.Notification.UnknownNotification]=Mt.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Pt[Lt.Notification.UnknownError]=Mt.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Mt.getUploadErrorDescByCode=function(e){var t="";switch(Mt.pInt(e)){case Lt.UploadErrorCode.FileIsTooBig:t=Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Lt.UploadErrorCode.FilePartiallyUploaded:t=Mt.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Lt.UploadErrorCode.FileNoUploaded:t=Mt.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Lt.UploadErrorCode.MissingTempFolder:t=Mt.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Lt.UploadErrorCode.FileOnSaveingError:t=Mt.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Lt.UploadErrorCode.FileType:t=Mt.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=Mt.i18n("UPLOAD/ERROR_UNKNOWN")}return t},Mt.delegateRun=function(e,t,s,i){e&&e[t]&&(i=Mt.pInt(i),0>=i?e[t].apply(e,Mt.isArray(s)?s:[]):r.delay(function(){e[t].apply(e,Mt.isArray(s)?s:[])},i))},Mt.killCtrlAandS=function(t){if(t=t||e.event,t&&t.ctrlKey&&!t.shiftKey&&!t.altKey){var s=t.target||t.srcElement,i=t.keyCode||t.which;if(i===Lt.EventKeyCode.S)return void t.preventDefault();if(s&&s.tagName&&s.tagName.match(/INPUT|TEXTAREA/i))return;i===Lt.EventKeyCode.A&&(e.getSelection?e.getSelection().removeAllRanges():e.document.selection&&e.document.selection.clear&&e.document.selection.clear(),t.preventDefault())}},Mt.createCommand=function(e,t,i){var o=t?function(){return o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=s.observable(!0),i=Mt.isUnd(i)?!0:i,o.canExecute=s.computed(Mt.isFunc(i)?function(){return o.enabled()&&i.call(e)}:function(){return o.enabled()&&!!i}),o},Mt.initDataConstructorBySettings=function(t){t.editorDefaultType=s.observable(Lt.EditorDefaultType.Html),t.showImages=s.observable(!1),t.interfaceAnimation=s.observable(Lt.InterfaceAnimation.Full),t.contactsAutosave=s.observable(!1),Ot.sAnimationType=Lt.InterfaceAnimation.Full,t.capaThemes=s.observable(!1),t.allowLanguagesOnSettings=s.observable(!0),t.allowLanguagesOnLogin=s.observable(!0),t.useLocalProxyForExternalImages=s.observable(!1),t.desktopNotifications=s.observable(!1),t.useThreads=s.observable(!0),t.replySameFolder=s.observable(!0),t.useCheckboxesInList=s.observable(!0),t.layout=s.observable(Lt.Layout.SidePreview),t.usePreviewPane=s.computed(function(){return Lt.Layout.NoPreview!==t.layout()}),t.interfaceAnimation.subscribe(function(e){if(Ot.bMobileDevice||e===Lt.InterfaceAnimation.None)Bt.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Ot.sAnimationType=Lt.InterfaceAnimation.None;else switch(e){case Lt.InterfaceAnimation.Full:Bt.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Ot.sAnimationType=e;break;case Lt.InterfaceAnimation.Normal:Bt.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Ot.sAnimationType=e
-}}),t.interfaceAnimation.valueHasMutated(),t.desktopNotificationsPermisions=s.computed(function(){t.desktopNotifications();var s=Lt.DesktopNotifications.NotSupported;if(qt&&qt.permission)switch(qt.permission.toLowerCase()){case"granted":s=Lt.DesktopNotifications.Allowed;break;case"denied":s=Lt.DesktopNotifications.Denied;break;case"default":s=Lt.DesktopNotifications.NotAllowed}else e.webkitNotifications&&e.webkitNotifications.checkPermission&&(s=e.webkitNotifications.checkPermission());return s}),t.useDesktopNotifications=s.computed({read:function(){return t.desktopNotifications()&&Lt.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()},write:function(e){if(e){var s=t.desktopNotificationsPermisions();Lt.DesktopNotifications.Allowed===s?t.desktopNotifications(!0):Lt.DesktopNotifications.NotAllowed===s?qt.requestPermission(function(){t.desktopNotifications.valueHasMutated(),Lt.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()?t.desktopNotifications()?t.desktopNotifications.valueHasMutated():t.desktopNotifications(!0):t.desktopNotifications()?t.desktopNotifications(!1):t.desktopNotifications.valueHasMutated()}):t.desktopNotifications(!1)}else t.desktopNotifications(!1)}}),t.language=s.observable(""),t.languages=s.observableArray([]),t.mainLanguage=s.computed({read:t.language,write:function(e){e!==t.language()?-1=t.diff(s,"hours")?i:t.format("L")===s.format("L")?Mt.i18n("MESSAGE_LIST/TODAY_AT",{TIME:s.format("LT")}):t.clone().subtract("days",1).format("L")===s.format("L")?Mt.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:s.format("LT")}):s.format(t.year()===s.year()?"D MMM.":"LL")},e)},Mt.isFolderExpanded=function(e){var t=jt.local().get(Lt.ClientSideKeyName.ExpandedFolders);return r.isArray(t)&&-1!==r.indexOf(t,e)},Mt.setExpandedFolder=function(e,t){var s=jt.local().get(Lt.ClientSideKeyName.ExpandedFolders);r.isArray(s)||(s=[]),t?(s.push(e),s=r.uniq(s)):s=r.without(s,e),jt.local().set(Lt.ClientSideKeyName.ExpandedFolders,s)},Mt.initLayoutResizer=function(e,s,i){var o=60,n=155,a=t(e),r=t(s),l=jt.local().get(i)||null,c=function(e){e&&(a.css({width:""+e+"px"}),r.css({left:""+e+"px"}))},u=function(e){if(e)a.resizable("disable"),c(o);else{a.resizable("enable");var t=Mt.pInt(jt.local().get(i))||n;c(t>n?t:n)}},d=function(e,t){t&&t.size&&t.size.width&&(jt.local().set(i,t.size.width),r.css({left:""+t.size.width+"px"}))};null!==l&&c(l>n?l:n),a.resizable({helper:"ui-resizable-helper",minWidth:n,maxWidth:350,handles:"e",stop:d}),jt.sub("left-panel.off",function(){u(!0)}),jt.sub("left-panel.on",function(){u(!1)})},Mt.initBlockquoteSwitcher=function(e){if(e){var s=t("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===t(this).parent().closest("blockquote",e).length});s&&0100)&&(e.addClass("rl-bq-switcher hidden-bq"),t('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),Mt.windowResize()}).after("
").before("
"))})}},Mt.removeBlockquoteSwitcher=function(e){e&&(t(e).find("blockquote.rl-bq-switcher").each(function(){t(this).removeClass("rl-bq-switcher hidden-bq")}),t(e).find(".rlBlockquoteSwitcher").each(function(){t(this).remove()}))},Mt.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},Mt.extendAsViewModel=function(e,t,s){t&&(s||(s=b),t.__name=e,Dt.regViewModelHook(e,t),r.extend(t.prototype,s.prototype))},Mt.addSettingsViewModel=function(e,t,s,i,o){e.__rlSettingsData={Label:s,Template:t,Route:i,IsDefault:!!o},_t.settings.push(e)},Mt.removeSettingsViewModel=function(e){_t["settings-removed"].push(e)},Mt.disableSettingsViewModel=function(e){_t["settings-disabled"].push(e)},Mt.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7))),Mt.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Mt.quoteName=function(e){return e.replace(/["]/g,'\\"')},Mt.microtime=function(){return(new Date).getTime()},Mt.convertLangName=function(e,t){return Mt.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},Mt.fakeMd5=function(e){var t="",s="0123456789abcdefghijklmnopqrstuvwxyz";for(e=Mt.isUnd(e)?32:Mt.pInt(e);t.length>>32-t}function s(e,t){var s,i,o,n,a;return o=2147483648&e,n=2147483648&t,s=1073741824&e,i=1073741824&t,a=(1073741823&e)+(1073741823&t),s&i?2147483648^a^o^n:s|i?1073741824&a?3221225472^a^o^n:1073741824^a^o^n:a^o^n}function i(e,t,s){return e&t|~e&s}function o(e,t,s){return e&s|t&~s}function n(e,t,s){return e^t^s}function a(e,t,s){return t^(e|~s)}function r(e,o,n,a,r,l,c){return e=s(e,s(s(i(o,n,a),r),c)),s(t(e,l),o)}function l(e,i,n,a,r,l,c){return e=s(e,s(s(o(i,n,a),r),c)),s(t(e,l),i)}function c(e,i,o,a,r,l,c){return e=s(e,s(s(n(i,o,a),r),c)),s(t(e,l),i)}function u(e,i,o,n,r,l,c){return e=s(e,s(s(a(i,o,n),r),c)),s(t(e,l),i)}function d(e){for(var t,s=e.length,i=s+8,o=(i-i%64)/64,n=16*(o+1),a=Array(n-1),r=0,l=0;s>l;)t=(l-l%4)/4,r=l%4*8,a[t]=a[t]|e.charCodeAt(l)<>>29,a}function h(e){var t,s,i="",o="";for(s=0;3>=s;s++)t=e>>>8*s&255,o="0"+t.toString(16),i+=o.substr(o.length-2,2);return i}function p(e){e=e.replace(/rn/g,"n");for(var t="",s=0;si?t+=String.fromCharCode(i):i>127&&2048>i?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t}var m,g,f,b,y,S,v,C,w,T=Array(),F=7,A=12,E=17,N=22,R=5,I=9,L=14,P=20,M=4,D=11,k=16,O=23,_=6,U=10,x=15,V=21;for(e=p(e),T=d(e),S=1732584193,v=4023233417,C=2562383102,w=271733878,m=0;m /g,">").replace(/")},Mt.draggeblePlace=function(){return t(' ').appendTo("#rl-hidden")},Mt.defautOptionsAfterRender=function(e,s){s&&!Mt.isUnd(s.disabled)&&e&&t(e).toggleClass("disabled",s.disabled).prop("disabled",s.disabled)},Mt.windowPopupKnockout=function(s,i,o,n){var a=null,r=e.open(""),l="__OpenerApplyBindingsUid"+Mt.fakeMd5()+"__",c=t("#"+i);e[l]=function(){if(r&&r.document.body&&c&&c[0]){var i=t(r.document.body);t("#rl-content",i).html(c.html()),t("html",r.document).addClass("external "+t("html").attr("class")),Mt.i18nToNode(i),S.prototype.applyExternal(s,t("#rl-content",i)[0]),e[l]=null,n(r)}},r.document.open(),r.document.write(''+Mt.encodeHtml(o)+' '),r.document.close(),a=r.document.createElement("script"),a.type="text/javascript",a.innerHTML="if(window&&window.opener&&window.opener['"+l+"']){window.opener['"+l+"']();window.opener['"+l+"']=null}",r.document.getElementsByTagName("head")[0].appendChild(a)},Mt.settingsSaveHelperFunction=function(e,t,s,i){return s=s||null,i=Mt.isUnd(i)?1e3:Mt.pInt(i),function(o,n,a,l,c){t.call(s,n&&n.Result?Lt.SaveSettingsStep.TrueResult:Lt.SaveSettingsStep.FalseResult),e&&e.call(s,o,n,a,l,c),r.delay(function(){t.call(s,Lt.SaveSettingsStep.Idle)},i)}},Mt.settingsSaveHelperSimpleFunction=function(e,t){return Mt.settingsSaveHelperFunction(null,e,t,1e3)},Mt.$div=t(""),Mt.htmlToPlain=function(e){var s=0,i=0,o=0,n=0,a=0,r="",l=function(e){for(var t=100,s="",i="",o=e,n=0,a=0;o.length>t;)i=o.substring(0,t),n=i.lastIndexOf(" "),a=i.lastIndexOf("\n"),-1!==a&&(n=a),-1===n&&(n=t),s+=i.substring(0,n)+"\n",o=o.substring(n+1);return s+o},c=function(e){return e=l(t.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2]*>([\s\S\r\n]*)<\/div>/gim,u),e="\n"+t.trim(e)+"\n"),e}return""},d=function(){return arguments&&1 "):""},h=function(){return arguments&&1 /g,">"):""},p=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,d).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,h).replace(/
]*>/gim,"\n").replace(/<\/h[\d]>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>([\s\S\r\n]*)<\/div>/gim,u).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S\r\n]*?)<\/a>/gim,p).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),r=Mt.$div.html(r).text(),r=r.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),s=0,a=100;a>0&&(a--,i=r.indexOf("__bq__start__",s),i>-1);)o=r.indexOf("__bq__start__",i+5),n=r.indexOf("__bq__end__",i+5),(-1===o||o>n)&&n>i?(r=r.substring(0,i)+c(r.substring(i+13,n))+r.substring(n+11),s=0):s=o>-1&&n>o?o-1:0;return r=r.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},Mt.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var s=!1,i=!0,o=!0,n=[],a="",r=0,l=e.split("\n");do{for(i=!1,n=[],r=0;r"===a.substr(0,1),o&&!s?(i=!0,s=!0,n.push("~~~blockquote~~~"),n.push(a.substr(1))):!o&&s?(s=!1,n.push("~~~/blockquote~~~"),n.push(a)):n.push(o&&s?a.substr(1):a);s&&(s=!1,n.push("~~~/blockquote~~~")),l=n}while(i);return e=l.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/[\s]*~~~\/blockquote~~~/g,"
").replace(/[\-_~]{10,}/g,"
").replace(/\n/g,"
"),t?Mt.linkify(e):e},e.rainloop_Utils_htmlToPlain=Mt.htmlToPlain,e.rainloop_Utils_plainToHtml=Mt.plainToHtml,Mt.linkify=function(e){return t.fn&&t.fn.linkify&&(e=Mt.$div.html(e.replace(/&/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&")),e},Mt.resizeAndCrop=function(t,s,i){var o=new e.Image;o.onload=function(){var e=[0,0],t=document.createElement("canvas"),o=t.getContext("2d");t.width=s,t.height=s,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,s,s),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,s,s),i(t.toDataURL("image/jpeg"))},o.src=t},Mt.computedPagenatorHelper=function(e,t){return function(){var s=0,i=0,o=2,n=[],a=e(),r=t(),l=function(e,t,s){var i={current:e===a,name:Mt.isUnd(s)?e.toString():s.toString(),custom:Mt.isUnd(s)?!1:!0,title:Mt.isUnd(s)?"":e.toString(),value:e.toString()};(Mt.isUnd(t)?0:!t)?n.unshift(i):n.push(i)};if(r>1||r>0&&a>r){for(a>r?(l(r),s=r,i=r):((3>=a||a>=r-2)&&(o+=2),l(a),s=a,i=a);o>0;)if(s-=1,i+=1,s>0&&(l(s,!1),o--),r>=i)l(i,!0),o--;else if(0>=s)break;3===s?l(2,!1):s>3&&l(Math.round((s-1)/2),!1,"..."),r-2===i?l(r-1,!0):r-2>i&&l(Math.round((r+i)/2),!0,"..."),s>1&&l(1,!1),r>i&&l(r,!0)}return n}},Mt.selectElement=function(t){if(e.getSelection){var s=e.getSelection();s.removeAllRanges();var i=document.createRange();i.selectNodeContents(t),s.addRange(i)}else if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t),o.select()}},Mt.disableKeyFilter=function(){e.key&&(c.filter=function(){return jt.data().useKeyboardShortcuts()})},Mt.restoreKeyFilter=function(){e.key&&(c.filter=function(e){if(jt.data().useKeyboardShortcuts()){var t=e.target||e.srcElement,s=t?t.tagName:"";return s=s.toUpperCase(),!("INPUT"===s||"SELECT"===s||"TEXTAREA"===s||t&&"DIV"===s&&"editorHtmlArea"===t.className&&t.contentEditable)}return!1})},Mt.detectDropdownVisibility=r.debounce(function(){Ot.dropdownVisibility(!!r.find(Ut,function(e){return e.hasClass("open")}))},50),Mt.triggerAutocompleteInputChange=function(e){var s=function(){t(".checkAutocomplete").trigger("change")};e?r.delay(s,100):s()},kt={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return kt.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=kt._utf8_encode(e);c>2,n=(3&t)<<4|s>>4,a=(15&s)<<2|i>>6,r=63&i,isNaN(s)?a=r=64:isNaN(i)&&(r=64),l=l+this._keyStr.charAt(o)+this._keyStr.charAt(n)+this._keyStr.charAt(a)+this._keyStr.charAt(r);return l},decode:function(e){var t,s,i,o,n,a,r,l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c>4,s=(15&n)<<4|a>>2,i=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(s)),64!==r&&(l+=String.fromCharCode(i));return kt._utf8_decode(l)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",s=0,i=e.length,o=0;i>s;s++)o=e.charCodeAt(s),128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128));return t},_utf8_decode:function(e){for(var t="",s=0,i=0,o=0,n=0;si?(t+=String.fromCharCode(i),s++):i>191&&224>i?(o=e.charCodeAt(s+1),t+=String.fromCharCode((31&i)<<6|63&o),s+=2):(o=e.charCodeAt(s+1),n=e.charCodeAt(s+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&n),s+=3);return t}},s.bindingHandlers.tooltip={init:function(e,i){if(!Ot.bMobileDevice){var o=t(e),n=o.data("tooltip-class")||"",a=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,trigger:"hover",title:function(){return o.is(".disabled")||Ot.dropdownVisibility()?"":''+Mt.i18n(s.utils.unwrapObservable(i()))+""}}).click(function(){o.tooltip("hide")}),Ot.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(e,s){var i=t(e),o=i.data("tooltip-class")||"",n=i.data("tooltip-placement")||"top";i.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:n,title:function(){return i.is(".disabled")||Ot.dropdownVisibility()?"":''+s()()+""}}).click(function(){i.tooltip("hide")}),Ot.tooltipTrigger.subscribe(function(){i.tooltip("hide")})}},s.bindingHandlers.tooltip3={init:function(e){var s=t(e);s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),Kt.click(function(){s.tooltip("hide")}),Ot.tooltipTrigger.subscribe(function(){s.tooltip("hide")})},update:function(e,i){var o=s.utils.unwrapObservable(i());""===o?t(e).data("tooltip3-data","").tooltip("hide"):t(e).data("tooltip3-data",o).tooltip("show")}},s.bindingHandlers.registrateBootstrapDropdown={init:function(e){Ut.push(t(e))}},s.bindingHandlers.openDropdownTrigger={update:function(e,i){if(s.utils.unwrapObservable(i())){var o=t(e);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),Mt.detectDropdownVisibility()),i()(!1)}}},s.bindingHandlers.dropdownCloser={init:function(e){t(e).closest(".dropdown").on("click",".e-item",function(){t(e).dropdown("toggle")})}},s.bindingHandlers.popover={init:function(e,i){t(e).popover(s.utils.unwrapObservable(i()))}},s.bindingHandlers.csstext={init:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))},update:function(e,i){e&&e.styleSheet&&!Mt.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=s.utils.unwrapObservable(i()):t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.resizecrop={init:function(e){t(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,s){s()(),t(e).resizecrop({width:"100",height:"100"})}},s.bindingHandlers.onEnter={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&13===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.onEsc={init:function(s,i,o,n){t(s).on("keypress",function(o){o&&27===e.parseInt(o.keyCode,10)&&(t(s).trigger("change"),i().call(n))})}},s.bindingHandlers.clickOnTrue={update:function(e,i){s.utils.unwrapObservable(i())&&t(e).click()}},s.bindingHandlers.modal={init:function(e,i){t(e).toggleClass("fade",!Ot.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(i())}).on("shown",function(){Mt.windowResize()}).find(".close").click(function(){i()(!1)})},update:function(e,i){t(e).modal(s.utils.unwrapObservable(i())?"show":"hide")}},s.bindingHandlers.i18nInit={init:function(e){Mt.i18nToNode(e)}},s.bindingHandlers.i18nUpdate={update:function(e,t){s.utils.unwrapObservable(t()),Mt.i18nToNode(e)}},s.bindingHandlers.link={update:function(e,i){t(e).attr("href",s.utils.unwrapObservable(i()))}},s.bindingHandlers.title={update:function(e,i){t(e).attr("title",s.utils.unwrapObservable(i()))}},s.bindingHandlers.textF={init:function(e,i){t(e).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.initDom={init:function(e,t){t()(e)}},s.bindingHandlers.initResizeTrigger={init:function(e,i){var o=s.utils.unwrapObservable(i());t(e).css({height:o[1],"min-height":o[1]})},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=Mt.pInt(o[1]),a=0,r=t(e).offset().top;r>0&&(r+=Mt.pInt(o[2]),a=Gt.height()-r,a>n&&(n=a),t(e).css({height:n,"min-height":n}))}},s.bindingHandlers.appendDom={update:function(e,i){t(e).hide().empty().append(s.utils.unwrapObservable(i())).show()}},s.bindingHandlers.draggable={init:function(i,o,n){if(!Ot.bMobileDevice){var a=100,r=3,l=n(),c=l&&l.droppableSelector?l.droppableSelector:"",u={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};c&&(u.drag=function(s){t(c).each(function(){var i=null,o=null,n=t(this),l=n.offset(),c=l.top+n.height();e.clearInterval(n.data("timerScroll")),n.data("timerScroll",!1),s.pageX>=l.left&&s.pageX<=l.left+n.width()&&(s.pageY>=c-a&&s.pageY<=c&&(i=function(){n.scrollTop(n.scrollTop()+r),Mt.windowResize()},n.data("timerScroll",e.setInterval(i,10)),i()),s.pageY>=l.top&&s.pageY<=l.top+a&&(o=function(){n.scrollTop(n.scrollTop()-r),Mt.windowResize()},n.data("timerScroll",e.setInterval(o,10)),o()))})},u.stop=function(){t(c).each(function(){e.clearInterval(t(this).data("timerScroll")),t(this).data("timerScroll",!1)})}),u.helper=function(e){return o()(e&&e.target?s.dataFor(e.target):null)},t(i).draggable(u).on("mousedown",function(){Mt.removeInFocus()})}}},s.bindingHandlers.droppable={init:function(e,s,i){if(!Ot.bMobileDevice){var o=s(),n=i(),a=n&&n.droppableOver?n.droppableOver:null,r=n&&n.droppableOut?n.droppableOut:null,l={tolerance:"pointer",hoverClass:"droppableHover"};o&&(l.drop=function(e,t){o(e,t)},a&&(l.over=function(e,t){a(e,t)}),r&&(l.out=function(e,t){r(e,t)}),t(e).droppable(l))}}},s.bindingHandlers.nano={init:function(e){Ot.bDisableNanoScroll||t(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},s.bindingHandlers.saveTrigger={init:function(e){var s=t(e);s.data("save-trigger-type",s.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===s.data("save-trigger-type")?s.append(' ').addClass("settings-saved-trigger"):s.addClass("settings-saved-trigger-input")},update:function(e,i){var o=s.utils.unwrapObservable(i()),n=t(e);if("custom"===n.data("save-trigger-type"))switch(o.toString()){case"1":n.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":n.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":n.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:n.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":n.addClass("success").removeClass("error");break;case"0":n.addClass("error").removeClass("success");break;case"-2":break;default:n.removeClass("error success")}}},s.bindingHandlers.emailsTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:n,inputDelimiters:[",",";"],autoCompleteSource:function(e,t){jt.getAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new v,s.mailsoParse(t),s.clearDuplicateName(),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("EmailsTagsValue",e.target.value),o(e.target.value)},this)})},update:function(e,i,o){var n=t(e),a=o(),r=a.emailsTagsFilter||null,l=s.utils.unwrapObservable(i());n.data("EmailsTagsValue")!==l&&(n.val(l),n.data("EmailsTagsValue",l),n.inputosaurus("refresh")),r&&s.utils.unwrapObservable(r)&&n.inputosaurus("focus")}},s.bindingHandlers.contactTags={init:function(e,s){var i=t(e),o=s(),n=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};i.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:n,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(e,t){jt.getContactTagsAutocomplete(e.term,function(e){t(r.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return r.map(e,function(e){var t=Mt.trim(e),s=null;return""!==t?(s=new T,s.name(t),[s.toLine(!1),s]):[t,null]})},change:r.bind(function(e){i.data("ContactTagsValue",e.target.value),o(e.target.value)},this)})},update:function(e,i,o){var n=t(e),a=o(),r=a.contactTagsFilter||null,l=s.utils.unwrapObservable(i());n.data("ContactTagsValue")!==l&&(n.val(l),n.data("ContactTagsValue",l),n.inputosaurus("refresh")),r&&s.utils.unwrapObservable(r)&&n.inputosaurus("focus")}},s.bindingHandlers.command={init:function(e,i,o,n){var a=t(e),r=i();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),s.bindingHandlers[a.is("form")?"submit":"click"].init.apply(n,arguments)},update:function(e,s){var i=!0,o=t(e),n=s();i=n.enabled(),o.toggleClass("command-not-enabled",!i),i&&(i=n.canExecute(),o.toggleClass("command-can-not-be-execute",!i)),o.toggleClass("command-disabled disable disabled",!i).toggleClass("no-disabled",!!i),(o.is("input")||o.is("button"))&&o.prop("disabled",!i)}},s.extenders.trimmer=function(e){var t=s.computed({read:e,write:function(t){e(Mt.trim(t.toString()))},owner:this});return t(e()),t},s.extenders.posInterer=function(e,t){var i=s.computed({read:e,write:function(s){var i=Mt.pInt(s.toString(),t);0>=i&&(i=t),i===e()&&""+i!=""+s&&e(i+1),e(i)}});return i(e()),i},s.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},s.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},s.extenders.falseTimeout=function(t,s){return t.iTimeout=0,t.subscribe(function(i){i&&(e.clearTimeout(t.iTimeout),t.iTimeout=e.setTimeout(function(){t(!1),t.iTimeout=0},Mt.pInt(s)))}),t},s.observable.fn.validateNone=function(){return this.hasError=s.observable(!1),this},s.observable.fn.validateEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateSimpleEmail=function(){return this.hasError=s.observable(!1),this.subscribe(function(e){e=Mt.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateFunc=function(e){return this.hasFuncError=s.observable(!1),Mt.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},u.prototype.root=function(){return this.sBase},u.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},u.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},u.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},u.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},u.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},u.prototype.change=function(t){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+e.encodeURIComponent(t)+"/"},u.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},u.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},u.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},u.prototype.avatarLink=function(t){return this.sServer+"/Raw/0/Avatar/"+e.encodeURIComponent(t)+"/"},u.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},u.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},u.prototype.settings=function(e){var t=this.sBase+"settings";return Mt.isUnd(e)||""===e||(t+="/"+e),t},u.prototype.admin=function(e){var t=this.sBase;switch(e){case"AdminDomains":t+="domains";break;case"AdminSecurity":t+="security";break;case"AdminLicensing":t+="licensing"}return t},u.prototype.mailBox=function(e,t,s){t=Mt.isNormal(t)?Mt.pInt(t):1,s=Mt.pString(s);var i=this.sBase+"mailbox/";return""!==e&&(i+=encodeURI(e)),t>1&&(i=i.replace(/[\/]+$/,""),i+="/p"+t),""!==s&&(i=i.replace(/[\/]+$/,""),i+="/"+encodeURI(s)),i},u.prototype.phpInfo=function(){return this.sServer+"Info"},u.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},u.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},u.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},u.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},u.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},u.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=Mt.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},u.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},u.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},u.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},u.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Dt.oViewModelsHooks={},Dt.oSimpleHooks={},Dt.regViewModelHook=function(e,t){t&&(t.__hookName=e)
-},Dt.addHook=function(e,t){Mt.isFunc(t)&&(Mt.isArray(Dt.oSimpleHooks[e])||(Dt.oSimpleHooks[e]=[]),Dt.oSimpleHooks[e].push(t))},Dt.runHook=function(e,t){Mt.isArray(Dt.oSimpleHooks[e])&&(t=t||[],r.each(Dt.oSimpleHooks[e],function(e){e.apply(null,t)}))},Dt.mainSettingsGet=function(e){return jt?jt.settingsGet(e):null},Dt.remoteRequest=function(e,t,s,i,o,n){jt&&jt.remote().defaultRequest(e,t,s,i,o,n)},Dt.settingsGet=function(e,t){var s=Dt.mainSettingsGet("Plugins");return s=s&&Mt.isUnd(s[e])?null:s[e],s?Mt.isUnd(s[t])?null:s[t]:null},d.prototype.blurTrigger=function(){if(this.fOnBlur){var t=this;e.clearTimeout(t.iBlurTimer),t.iBlurTimer=e.setTimeout(function(){t.fOnBlur()},200)}},d.prototype.focusTrigger=function(){this.fOnBlur&&e.clearTimeout(this.iBlurTimer)},d.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},d.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},d.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},d.prototype.getData=function(e){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():e?''+this.editor.getData()+"":this.editor.getData():""},d.prototype.modeToggle=function(e){this.editor&&(e?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"),this.resize())},d.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},d.prototype.setPlain=function(e,t){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(e);this.editor.setData(e),t&&this.focus()}},d.prototype.init=function(){if(this.$element&&this.$element[0]){var t=this,s=function(){var s=Ot.oHtmlEditorDefaultConfig,i=jt.settingsGet("Language"),o=!!jt.settingsGet("AllowHtmlEditorSourceButton");o&&s.toolbarGroups&&!s.toolbarGroups.__SourceInited&&(s.toolbarGroups.__SourceInited=!0,s.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),s.enterMode=e.CKEDITOR.ENTER_BR,s.shiftEnterMode=e.CKEDITOR.ENTER_BR,s.language=Ot.oHtmlEditorLangsMap[i]||"en",e.CKEDITOR.env&&(e.CKEDITOR.env.isCompatible=!0),t.editor=e.CKEDITOR.appendTo(t.$element[0],s),t.editor.on("key",function(e){return e&&e.data&&9===e.data.keyCode?!1:void 0}),t.editor.on("blur",function(){t.blurTrigger()}),t.editor.on("mode",function(){t.blurTrigger(),t.fOnModeChange&&t.fOnModeChange("plain"!==t.editor.mode)}),t.editor.on("focus",function(){t.focusTrigger()}),t.fOnReady&&t.editor.on("instanceReady",function(){t.editor.setKeystroke(e.CKEDITOR.CTRL+65,"selectAll"),t.fOnReady(),t.__resizable=!0,t.resize()})};e.CKEDITOR?s():e.__initEditor=s}},d.prototype.focus=function(){this.editor&&this.editor.focus()},d.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},d.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},d.prototype.clear=function(e){this.setHtml("",e)},h.prototype.itemSelected=function(e){this.isListChecked()?e||(this.oCallbacks.onItemSelect||this.emptyFunction)(e||null):e&&(this.oCallbacks.onItemSelect||this.emptyFunction)(e)},h.prototype.goDown=function(e){this.newSelectPosition(Lt.EventKeyCode.Down,!1,e)},h.prototype.goUp=function(e){this.newSelectPosition(Lt.EventKeyCode.Up,!1,e)},h.prototype.init=function(e,i,o){if(this.oContentVisible=e,this.oContentScrollable=i,o=o||"all",this.oContentVisible&&this.oContentScrollable){var n=this;t(this.oContentVisible).on("selectstart",function(e){e&&e.preventDefault&&e.preventDefault()}).on("click",this.sItemSelector,function(e){n.actionClick(s.dataFor(this),e)}).on("click",this.sItemCheckedSelector,function(e){var t=s.dataFor(this);t&&(e&&e.shiftKey?n.actionClick(t,e):(n.focusedItem(t),t.checked(!t.checked())))}),c("enter",o,function(){return n.focusedItem()&&!n.focusedItem().selected()?(n.actionClick(n.focusedItem()),!1):!0}),c("ctrl+up, command+up, ctrl+down, command+down",o,function(){return!1}),c("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",o,function(e,t){if(e&&t&&t.shortcut){var s=0;switch(t.shortcut){case"up":case"shift+up":s=Lt.EventKeyCode.Up;break;case"down":case"shift+down":s=Lt.EventKeyCode.Down;break;case"insert":s=Lt.EventKeyCode.Insert;break;case"space":s=Lt.EventKeyCode.Space;break;case"home":s=Lt.EventKeyCode.Home;break;case"end":s=Lt.EventKeyCode.End;break;case"pageup":s=Lt.EventKeyCode.PageUp;break;case"pagedown":s=Lt.EventKeyCode.PageDown}if(s>0)return n.newSelectPosition(s,c.shift),!1}})}},h.prototype.autoSelect=function(e){this.bAutoSelect=!!e},h.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},h.prototype.newSelectPosition=function(e,t,s){var i=0,o=10,n=!1,a=!1,l=null,c=this.list(),u=c?c.length:0,d=this.focusedItem();if(u>0)if(d){if(d)if(Lt.EventKeyCode.Down===e||Lt.EventKeyCode.Up===e||Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e)r.each(c,function(t){if(!a)switch(e){case Lt.EventKeyCode.Up:d===t?a=!0:l=t;break;case Lt.EventKeyCode.Down:case Lt.EventKeyCode.Insert:n?(l=t,a=!0):d===t&&(n=!0)}});else if(Lt.EventKeyCode.Home===e||Lt.EventKeyCode.End===e)Lt.EventKeyCode.Home===e?l=c[0]:Lt.EventKeyCode.End===e&&(l=c[c.length-1]);else if(Lt.EventKeyCode.PageDown===e){for(;u>i;i++)if(d===c[i]){i+=o,i=i>u-1?u-1:i,l=c[i];break}}else if(Lt.EventKeyCode.PageUp===e)for(i=u;i>=0;i--)if(d===c[i]){i-=o,i=0>i?0:i,l=c[i];break}}else Lt.EventKeyCode.Down===e||Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e||Lt.EventKeyCode.Home===e||Lt.EventKeyCode.PageUp===e?l=c[0]:(Lt.EventKeyCode.Up===e||Lt.EventKeyCode.End===e||Lt.EventKeyCode.PageDown===e)&&(l=c[c.length-1]);l?(this.focusedItem(l),d&&(t?(Lt.EventKeyCode.Up===e||Lt.EventKeyCode.Down===e)&&d.checked(!d.checked()):(Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e)&&d.checked(!d.checked())),!this.bAutoSelect&&!s||this.isListChecked()||Lt.EventKeyCode.Space===e||this.selectedItem(l),this.scrollToFocused()):d&&(!t||Lt.EventKeyCode.Up!==e&&Lt.EventKeyCode.Down!==e?(Lt.EventKeyCode.Insert===e||Lt.EventKeyCode.Space===e)&&d.checked(!d.checked()):d.checked(!d.checked()),this.focusedItem(d))},h.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,s=t(this.sItemFocusedSelector,this.oContentScrollable),i=s.position(),o=this.oContentVisible.height(),n=s.outerHeight();return i&&(i.top<0||i.top+n>o)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},h.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},h.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),i=0,o=0,n=null,a="",r=!1,l=!1,c=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(c=this.list(),u=e.checked(),i=0,o=c.length;o>i;i++)n=c[i],a=this.getItemUid(n),r=!1,(a===this.sLastUid||a===s)&&(r=!0),r&&(l=!l),(l||r)&&n.checked(u);this.sLastUid=""===s?"":s},h.prototype.actionClick=function(e,t){if(e){var s=!0,i=this.getItemUid(e);t&&(!t.shiftKey||t.ctrlKey||t.altKey?!t.ctrlKey||t.shiftKey||t.altKey||(s=!1,this.focusedItem(e),this.selectedItem()&&e!==this.selectedItem()&&this.selectedItem().checked(!0),e.checked(!e.checked())):(s=!1,""===this.sLastUid&&(this.sLastUid=i),e.checked(!e.checked()),this.eventClickFunction(e,t),this.focusedItem(e))),s&&(this.focusedItem(e),this.selectedItem(e),this.scrollToFocused())}},h.prototype.on=function(e,t){this.oCallbacks[e]=t},p.supported=function(){return!0},p.prototype.set=function(e,s){var i=t.cookie(It.Values.ClientSideCookieIndexName),o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[e]=s,t.cookie(It.Values.ClientSideCookieIndexName,JSON.stringify(n),{expires:30}),o=!0}catch(a){}return o},p.prototype.get=function(e){var s=t.cookie(It.Values.ClientSideCookieIndexName),i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[e])?i[e]:null}catch(o){}return i},m.supported=function(){return!!e.localStorage},m.prototype.set=function(t,s){var i=e.localStorage[It.Values.ClientSideCookieIndexName]||null,o=!1,n=null;try{n=null===i?null:JSON.parse(i),n||(n={}),n[t]=s,e.localStorage[It.Values.ClientSideCookieIndexName]=JSON.stringify(n),o=!0}catch(a){}return o},m.prototype.get=function(t){var s=e.localStorage[It.Values.ClientSideCookieIndexName]||null,i=null;try{i=null===s?null:JSON.parse(s),i=i&&!Mt.isUnd(i[t])?i[t]:null}catch(o){}return i},g.prototype.oDriver=null,g.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},g.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},f.prototype.bootstart=function(){},b.prototype.sPosition="",b.prototype.sTemplate="",b.prototype.viewModelName="",b.prototype.viewModelDom=null,b.prototype.viewModelTemplate=function(){return this.sTemplate},b.prototype.viewModelPosition=function(){return this.sPosition},b.prototype.cancelCommand=b.prototype.closeCommand=function(){},b.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=jt.data().keyScope(),jt.data().keyScope(this.sDefaultKeyScope)},b.prototype.restoreKeyScope=function(){jt.data().keyScope(this.sCurrentKeyScope)},b.prototype.registerPopupKeyDown=function(){var e=this;Gt.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&Lt.EventKeyCode.Esc===t.keyCode)return Mt.delegateRun(e,"cancelCommand"),!1;if(Lt.EventKeyCode.Backspace===t.keyCode&&!Mt.inFocus())return!1}return!0})},y.prototype.oCross=null,y.prototype.sScreenName="",y.prototype.aViewModels=[],y.prototype.viewModels=function(){return this.aViewModels},y.prototype.screenName=function(){return this.sScreenName},y.prototype.routes=function(){return null},y.prototype.__cross=function(){return this.oCross},y.prototype.__start=function(){var e=this.routes(),t=null,s=null;Mt.isNonEmptyArray(e)&&(s=r.bind(this.onRoute||Mt.emptyFunction,this),t=i.create(),r.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},S.constructorEnd=function(e){Mt.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},S.prototype.sDefaultScreenName="",S.prototype.oScreens={},S.prototype.oBoot=null,S.prototype.oCurrentScreen=null,S.prototype.hideLoading=function(){t("#rl-loading").hide()},S.prototype.routeOff=function(){o.changed.active=!1},S.prototype.routeOn=function(){o.changed.active=!0},S.prototype.setBoot=function(e){return Mt.isNormal(e)&&(this.oBoot=e),this},S.prototype.screen=function(e){return""===e||Mt.isUnd(this.oScreens[e])?null:this.oScreens[e]},S.prototype.buildViewModel=function(e,i){if(e&&!e.__builded){var o=new e(i),n=o.viewModelPosition(),a=t("#rl-content #rl-"+n.toLowerCase()),l=null;e.__builded=!0,e.__vm=o,o.data=jt.data(),o.viewModelName=e.__name,a&&1===a.length?(l=t("").addClass("rl-view-model").addClass("RL-"+o.viewModelTemplate()).hide(),l.appendTo(a),o.viewModelDom=l,e.__dom=l,"Popups"===n&&(o.cancelCommand=o.closeCommand=Mt.createCommand(o,function(){xt.hideScreenPopup(e)}),o.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),jt.popupVisibilityNames.push(this.viewModelName),o.viewModelDom.css("z-index",3e3+jt.popupVisibilityNames().length+10),Mt.delegateRun(this,"onFocus",[],500)):(Mt.delegateRun(this,"onHide"),this.restoreKeyScope(),jt.popupVisibilityNames.remove(this.viewModelName),o.viewModelDom.css("z-index",2e3),Ot.tooltipTrigger(!Ot.tooltipTrigger()),r.delay(function(){t.viewModelDom.hide()},300))},o)),Dt.runHook("view-model-pre-build",[e.__name,o,l]),s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:o.viewModelTemplate()}}},o),Mt.delegateRun(o,"onBuild",[l]),o&&"Popups"===n&&o.registerPopupKeyDown(),Dt.runHook("view-model-post-build",[e.__name,o,l])):Mt.log("Cannot find view model position: "+n)}return e?e.__vm:null},S.prototype.applyExternal=function(e,t){e&&t&&s.applyBindings(e,t)},S.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),Dt.runHook("view-model-on-hide",[e.__name,e.__vm]))},S.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),Mt.delegateRun(e.__vm,"onShow",t||[]),Dt.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},S.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},S.prototype.screenOnRoute=function(e,t){var s=this,i=null,o=null;""===Mt.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(i=this.screen(e),i||(i=this.screen(this.sDefaultScreenName),i&&(t=e+"/"+t,e=this.sDefaultScreenName)),i&&i.__started&&(i.__builded||(i.__builded=!0,Mt.isNonEmptyArray(i.viewModels())&&r.each(i.viewModels(),function(e){this.buildViewModel(e,i)},this),Mt.delegateRun(i,"onBuild")),r.defer(function(){s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onHide"),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),Mt.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=i,s.oCurrentScreen&&(Mt.delegateRun(s.oCurrentScreen,"onShow"),Dt.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),Mt.isNonEmptyArray(s.oCurrentScreen.viewModels())&&r.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),Mt.delegateRun(e.__vm,"onShow"),Mt.delegateRun(e.__vm,"onFocus",[],200),Dt.runHook("view-model-on-show",[e.__name,e.__vm]))},s)),o=i.__cross(),o&&o.parse(t)})))},S.prototype.startScreens=function(e){t("#rl-content").css({visibility:"hidden"}),r.each(e,function(e){var t=new e,s=t?t.screenName():"";t&&""!==s&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=s),this.oScreens[s]=t)},this),r.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),Dt.runHook("screen-pre-start",[e.screenName(),e]),Mt.delegateRun(e,"onStart"),Dt.runHook("screen-post-start",[e.screenName(),e]))},this);var s=i.create();s.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,r.bind(this.screenOnRoute,this)),o.initialized.add(s.parse,s),o.changed.add(s.parse,s),o.init(),t("#rl-content").css({visibility:"visible"}),r.delay(function(){Bt.removeClass("rl-started-trigger").addClass("rl-started")},50)},S.prototype.setHash=function(e,t,s){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,s=Mt.isUnd(s)?!1:!!s,(Mt.isUnd(t)?1:!t)?(o.changed.active=!0,o[s?"replaceHash":"setHash"](e),o.setHash(e)):(o.changed.active=!1,o[s?"replaceHash":"setHash"](e),o.changed.active=!0)},S.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},xt=new S,v.newInstanceFromJson=function(e){var t=new v;return t.initByJson(e)?t:null},v.prototype.name="",v.prototype.email="",v.prototype.privateType=null,v.prototype.clear=function(){this.email="",this.name="",this.privateType=null},v.prototype.validate=function(){return""!==this.name||""!==this.email},v.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},v.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},v.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=Lt.EmailType.Facebook),null===this.privateType&&(this.privateType=Lt.EmailType.Default)),this.privateType},v.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},v.prototype.parse=function(e){this.clear(),e=Mt.trim(e);var t=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,s=t.exec(e);s?(this.name=s[1]||"",this.email=s[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},v.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=Mt.trim(e.Name),this.email=Mt.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},v.prototype.toLine=function(e,t,s){var i="";return""!==this.email&&(t=Mt.isUnd(t)?!1:!!t,s=Mt.isUnd(s)?!1:!!s,e&&""!==this.name?i=t?'")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(this.name)+"":s?Mt.encodeHtml(this.name):this.name:(i=this.email,""!==this.name?t?i=Mt.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Mt.encodeHtml(i)+""+Mt.encodeHtml(">"):(i='"'+this.name+'" <'+i+">",s&&(i=Mt.encodeHtml(i))):t&&(i=''+Mt.encodeHtml(this.email)+""))),i},v.prototype.mailsoParse=function(e){if(e=Mt.trim(e),""===e)return!1;for(var t=function(e,t,s){e+="";var i=e.length;return 0>t&&(t+=i),i="undefined"==typeof s?i:0>s?s+i:s+t,t>=e.length||0>t||t>i?!1:e.slice(t,i)},s=function(e,t,s,i){return 0>s&&(s+=e.length),i=void 0!==i?i:e.length,0>i&&(i=i+e.length-s),e.slice(0,s)+t.substr(0,i)+t.slice(i)+e.slice(s+i)},i="",o="",n="",a=!1,r=!1,l=!1,c=null,u=0,d=0,h=0;h0&&0===i.length&&(i=t(e,0,h)),r=!0,u=h);break;case">":r&&(d=h,o=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,r=!1);break;case"(":a||r||l||(l=!0,u=h);break;case")":l&&(d=h,n=t(e,u+1,d-u-1),e=s(e,"",u,d-u+1),d=0,h=0,u=0,l=!1);break;case"\\":h++}h++}return 0===o.length&&(c=e.match(/[^@\s]+@\S+/i),c&&c[0]?o=c[0]:i=e),o.length>0&&0===i.length&&0===n.length&&(i=e.replace(o,"")),o=Mt.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),i=Mt.trim(i).replace(/^["']+/,"").replace(/["']+$/,""),n=Mt.trim(n).replace(/^[(]+/,"").replace(/[)]+$/,""),i=i.replace(/\\\\(.)/,"$1"),n=n.replace(/\\\\(.)/,"$1"),this.name=i,this.email=o,this.clearDuplicateName(),!0},v.prototype.inputoTagLine=function(){return 0 +$/,""),t=!0),t},F.prototype.isImage=function(){return-10?n.unix(e).format("LLL"):""},E.emailsToLine=function(e,t,s){var i=[],o=0,n=0;if(Mt.isNonEmptyArray(e))for(o=0,n=e.length;n>o;o++)i.push(e[o].toLine(t,s));return i.join(", ")},E.emailsToLineClear=function(e){var t=[],s=0,i=0;if(Mt.isNonEmptyArray(e))for(s=0,i=e.length;i>s;s++)e[s]&&e[s].email&&""!==e[s].name&&t.push(e[s].email);return t.join(", ")},E.initEmailsFromJson=function(e){var t=0,s=0,i=null,o=[];if(Mt.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=v.newInstanceFromJson(e[t]),i&&o.push(i);return o},E.replyHelper=function(e,t,s){if(e&&0i;i++)Mt.isUnd(t[e[i].email])&&(t[e[i].email]=!0,s.push(e[i]))},E.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.subjectPrefix(""),this.subjectSuffix(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Lt.MessagePriority.Normal),this.proxy=!1,this.fromEmailString(""),this.fromClearEmailString(""),this.toEmailsString(""),this.toClearEmailsString(""),this.senderEmailsString(""),this.senderClearEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Lt.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},E.prototype.computeSenderEmail=function(){var e=jt.data().sentFolder(),t=jt.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===e||this.folderFullNameRaw===t?this.toEmailsString():this.fromEmailString()),this.senderClearEmailsString(this.folderFullNameRaw===e||this.folderFullNameRaw===t?this.toClearEmailsString():this.fromClearEmailString())},E.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.proxy=!!e.ExternalProxy,this.size(Mt.pInt(e.Size)),this.from=E.initEmailsFromJson(e.From),this.to=E.initEmailsFromJson(e.To),this.cc=E.initEmailsFromJson(e.Cc),this.bcc=E.initEmailsFromJson(e.Bcc),this.replyTo=E.initEmailsFromJson(e.ReplyTo),this.deliveredTo=E.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),Mt.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(Mt.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(E.emailsToLine(this.from,!0)),this.fromClearEmailString(E.emailsToLineClear(this.from)),this.toEmailsString(E.emailsToLine(this.to,!0)),this.toClearEmailsString(E.emailsToLineClear(this.to)),this.parentUid(Mt.pInt(e.ParentThread)),this.threads(Mt.isArray(e.Threads)?e.Threads:[]),this.threadsLen(Mt.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},E.prototype.initUpdateByMessageJson=function(e){var t=!1,s=Lt.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(s=Mt.pInt(e.Priority),this.priority(-1t;t++)i=F.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0 +$/,""),t=r.find(s,function(t){return e===t.cidWithOutTags})),t||null},E.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return Mt.isNonEmptyArray(s)&&(t=r.find(s,function(t){return e===t.contentLocation})),t||null},E.prototype.messageId=function(){return this.sMessageId},E.prototype.inReplyTo=function(){return this.sInReplyTo},E.prototype.references=function(){return this.sReferences},E.prototype.fromAsSingleEmail=function(){return Mt.isArray(this.from)&&this.from[0]?this.from[0].email:""},E.prototype.viewLink=function(){return jt.link().messageViewLink(this.requestHash)},E.prototype.downloadLink=function(){return jt.link().messageDownloadLink(this.requestHash)},E.prototype.replyEmails=function(e){var t=[],s=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,s,t),0===t.length&&E.replyHelper(this.from,s,t),t},E.prototype.replyAllEmails=function(e){var t=[],s=[],i=Mt.isUnd(e)?{}:e;return E.replyHelper(this.replyTo,i,t),0===t.length&&E.replyHelper(this.from,i,t),E.replyHelper(this.to,i,t),E.replyHelper(this.cc,i,s),[t,s]},E.prototype.textBodyToString=function(){return this.body?this.body.html():""},E.prototype.attachmentsToStringLine=function(){var e=r.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0=0&&o&&!n&&i.attr("src",o)}),s&&e.setTimeout(function(){i.print()},100))})},E.prototype.printMessage=function(){this.viewPopupMessage(!0)},E.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},E.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.subjectPrefix(this.subjectPrefix()),this.subjectSuffix(this.subjectSuffix()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.proxy=e.proxy,this.fromEmailString(e.fromEmailString()),this.fromClearEmailString(e.fromClearEmailString()),this.toEmailsString(e.toEmailsString()),this.toClearEmailsString(e.toClearEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(Lt.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},E.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var s="";e=Mt.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),s=this.proxy?"data-x-additional-src":"data-x-src",t("["+s+"]",this.body).each(function(){e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",t(this).attr(s)).removeAttr(s):t(this).attr("src",t(this).attr(s)).removeAttr(s)}),s=this.proxy?"data-x-additional-style-url":"data-x-style-url",t("["+s+"]",this.body).each(function(){var e=Mt.trim(t(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+t(this).attr(s)).removeAttr(s)}),e&&(t("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t(".RL-MailMessageView .messageView .messageItem .content")[0]}),Gt.resize()),Mt.windowResize(500)}},E.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=Mt.isUnd(e)?!1:e;var s=this;t("[data-x-src-cid]",this.body).each(function(){var i=s.findAttachmentByCid(t(this).attr("data-x-src-cid"));i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-src-location]",this.body).each(function(){var i=s.findAttachmentByContentLocation(t(this).attr("data-x-src-location"));i||(i=s.findAttachmentByCid(t(this).attr("data-x-src-location"))),i&&i.download&&(e&&t(this).is("img")?t(this).addClass("lazy").attr("data-original",i.linkPreview()):t(this).attr("src",i.linkPreview()))}),t("[data-x-style-cid]",this.body).each(function(){var e="",i="",o=s.findAttachmentByCid(t(this).attr("data-x-style-cid"));o&&o.linkPreview&&(i=t(this).attr("data-x-style-cid-name"),""!==i&&(e=Mt.trim(t(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",t(this).attr("style",e+i+": url('"+o.linkPreview()+"')")))}),e&&!function(e,t){r.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(t("img.lazy",s.body),t(".RL-MailMessageView .messageView .messageItem .content")[0]),Mt.windowResize(500)}},E.prototype.storeDataToDom=function(){this.body&&(this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw),jt.data().capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser())))},E.prototype.storePgpVerifyDataToDom=function(){this.body&&jt.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},E.prototype.fetchDataToDom=function(){this.body&&(this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=Mt.pString(this.body.data("rl-plain-raw")),jt.data().capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},E.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var s=[],i=null,o=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",n=jt.data().findPublicKeysByEmail(o),a=null,l=null,c="";this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{i=e.openpgp.cleartext.readArmored(this.plainRaw),i&&i.getText&&(this.pgpSignedVerifyStatus(n.length?Lt.SignedVerifyStatus.Unverified:Lt.SignedVerifyStatus.UnknownPublicKeys),s=i.verify(n),s&&0').text(c)).html(),zt.empty(),this.replacePlaneTextBody(c)))))}catch(u){}this.storePgpVerifyDataToDom()}},E.prototype.decryptPgpEncryptedMessage=function(s){if(this.isPgpEncrypted()){var i=[],o=null,n=null,a=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=jt.data().findPublicKeysByEmail(a),c=jt.data().findSelfPrivateKey(s),u=null,d=null,h="";this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),c||this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.UnknownPrivateKey);try{o=e.openpgp.message.readArmored(this.plainRaw),o&&c&&o.decrypt&&(this.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.Unverified),n=o.decrypt(c),n&&(i=n.verify(l),i&&0').text(h)).html(),zt.empty(),this.replacePlaneTextBody(h)))}catch(p){}this.storePgpVerifyDataToDom()}},E.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},E.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},N.newInstanceFromJson=function(e){var t=new N;return t.initByJson(e)?t.initComputed():null},N.prototype.initComputed=function(){return this.hasSubScribedSubfolders=s.computed(function(){return!!r.find(this.subFolders(),function(e){return e.subScribed()&&!e.isSystemFolder()})},this),this.canBeEdited=s.computed(function(){return Lt.FolderType.User===this.type()&&this.existen&&this.selectable},this),this.visible=s.computed(function(){var e=this.subScribed(),t=this.hasSubScribedSubfolders();return e||t&&(!this.existen||!this.selectable)},this),this.isSystemFolder=s.computed(function(){return Lt.FolderType.User!==this.type()},this),this.hidden=s.computed(function(){var e=this.isSystemFolder(),t=this.hasSubScribedSubfolders();return e&&!t||!this.selectable&&!t},this),this.selectableForFolderList=s.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=s.computed({read:this.privateMessageCountAll,write:function(e){Mt.isPosNumeric(e,!0)?this.privateMessageCountAll(e):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=s.computed({read:this.privateMessageCountUnread,write:function(e){Mt.isPosNumeric(e,!0)?this.privateMessageCountUnread(e):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=s.computed(function(){var e=this.messageCountAll(),t=this.messageCountUnread(),s=this.type();if(Lt.FolderType.Inbox===s&&jt.data().foldersInboxUnreadCount(t),e>0){if(Lt.FolderType.Draft===s)return""+e;if(t>0&&Lt.FolderType.Trash!==s&&Lt.FolderType.Archive!==s&&Lt.FolderType.SentItems!==s)return""+t}return""},this),this.canBeDeleted=s.computed(function(){var e=this.isSystemFolder();return!e&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=s.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){Mt.timeOutAction("folder-list-folder-visibility-change",function(){Gt.trigger("folder-list-folder-visibility-change")},100)}),this.localName=s.computed(function(){Ot.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case Lt.FolderType.Inbox:t=Mt.i18n("FOLDER_LIST/INBOX_NAME");break;case Lt.FolderType.SentItems:t=Mt.i18n("FOLDER_LIST/SENT_NAME");break;case Lt.FolderType.Draft:t=Mt.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Lt.FolderType.Spam:t=Mt.i18n("FOLDER_LIST/SPAM_NAME");break;case Lt.FolderType.Trash:t=Mt.i18n("FOLDER_LIST/TRASH_NAME");break;case Lt.FolderType.Archive:t=Mt.i18n("FOLDER_LIST/ARCHIVE_NAME")}return t},this),this.manageFolderSystemName=s.computed(function(){Ot.langChangeTrigger();var e="",t=this.type(),s=this.name();if(this.isSystemFolder())switch(t){case Lt.FolderType.Inbox:e="("+Mt.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Lt.FolderType.SentItems:e="("+Mt.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Lt.FolderType.Draft:e="("+Mt.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Lt.FolderType.Spam:e="("+Mt.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Lt.FolderType.Trash:e="("+Mt.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Lt.FolderType.Archive:e="("+Mt.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==e&&"("+s+")"===e||"(inbox)"===e.toLowerCase())&&(e=""),e},this),this.collapsed=s.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(e){this.collapsedPrivate(e)},owner:this}),this.hasUnreadMessages=s.computed(function(){return 0"},I.prototype.formattedNameForCompose=function(){var e=this.name();return""===e?this.email():e+" ("+this.email()+")"},I.prototype.formattedNameForEmail=function(){var e=this.name();return""===e?this.email():'"'+Mt.quoteName(e)+'" <'+this.email()+">"},L.prototype.removeSelf=function(){this.parentList.remove(this)},P.prototype.addCondition=function(){this.conditions.push(new L(this.conditions))},P.prototype.parse=function(e){var t=!1;return e&&"Object/Filter"===e["@Object"]&&(this.name(Mt.pString(e.Name)),t=!0),t},M.prototype.index=0,M.prototype.id="",M.prototype.guid="",M.prototype.user="",M.prototype.email="",M.prototype.armor="",M.prototype.isPrivate=!1,Mt.extendAsViewModel("PopupsFolderClearViewModel",D),D.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},D.prototype.onShow=function(e){this.clearPopup(),e&&this.selectedFolder(e)},Mt.extendAsViewModel("PopupsFolderCreateViewModel",k),k.prototype.sNoParentText="",k.prototype.simpleFolderNameValidation=function(e){return/^[^\\\/]+$/g.test(Mt.trim(e))},k.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},k.prototype.onShow=function(){this.clearPopup()},k.prototype.onFocus=function(){this.folderName.focused(!0)},Mt.extendAsViewModel("PopupsFolderSystemViewModel",O),O.prototype.sChooseOnText="",O.prototype.sUnuseText="",O.prototype.onShow=function(e){var t="";switch(e=Mt.isUnd(e)?Lt.SetSystemFoldersNotification.None:e){case Lt.SetSystemFoldersNotification.Sent:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Lt.SetSystemFoldersNotification.Draft:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Lt.SetSystemFoldersNotification.Spam:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Lt.SetSystemFoldersNotification.Trash:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Lt.SetSystemFoldersNotification.Archive:t=Mt.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(t)},Mt.extendAsViewModel("PopupsComposeViewModel",_),_.prototype.openOpenPgpPopup=function(){if(this.capaOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var e=this;xt.showScreenPopup(K,[function(t){e.editor(function(e){e.setPlain(t)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},_.prototype.reloadDraftFolder=function(){var e=jt.data().draftFolder();""!==e&&(jt.cache().setFolderHash(e,""),jt.data().currentFolderFullNameRaw()===e?jt.reloadMessageList(!0):jt.folderInformation(e))},_.prototype.findIdentityIdByMessage=function(e,t){var s={},i="",o=function(e){return e&&e.email&&s[e.email]?(i=s[e.email],!0):!1};if(this.bCapaAdditionalIdentities&&r.each(this.identities(),function(e){s[e.email()]=e.id}),s[jt.data().accountEmail()]=jt.data().accountEmail(),t)switch(e){case Lt.ComposeType.Empty:break;case Lt.ComposeType.Reply:case Lt.ComposeType.ReplyAll:case Lt.ComposeType.Forward:case Lt.ComposeType.ForwardAsAttachment:r.find(r.union(t.to,t.cc,t.bcc,t.deliveredTo),o);break;case Lt.ComposeType.Draft:r.find(r.union(t.from,t.replyTo),o)}return""===i&&(i=this.defaultIdentityID()),""===i&&(i=jt.data().accountEmail()),i},_.prototype.selectIdentity=function(e){e&&this.currentIdentityID(e.optValue)},_.prototype.formattedFrom=function(e){var t=jt.data().displayName(),s=jt.data().accountEmail();return""===t?s:(Mt.isUnd(e)?1:!e)?t+" ("+s+")":'"'+Mt.quoteName(t)+'" <'+s+">"},_.prototype.sendMessageResponse=function(t,s){var i=!1,o="";this.sending(!1),Lt.StorageResultType.Success===t&&s&&s.Result&&(i=!0,this.modalVisibility()&&Mt.delegateRun(this,"closeCommand")),this.modalVisibility()&&!i&&(s&&Lt.Notification.CantSaveMessage===s.ErrorCode?(this.sendSuccessButSaveError(!0),e.alert(Mt.trim(Mt.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(o=Mt.getNotification(s&&s.ErrorCode?s.ErrorCode:Lt.Notification.CantSendMessage,s&&s.ErrorMessage?s.ErrorMessage:""),this.sendError(!0),e.alert(o||Mt.getNotification(Lt.Notification.CantSendMessage)))),this.reloadDraftFolder()},_.prototype.saveMessageResponse=function(t,s){var i=!1,o=null;this.saving(!1),Lt.StorageResultType.Success===t&&s&&s.Result&&s.Result.NewFolder&&s.Result.NewUid&&(this.bFromDraft&&(o=jt.data().message(),o&&this.draftFolder()===o.folderFullNameRaw&&this.draftUid()===o.uid&&jt.data().message(null)),this.draftFolder(s.Result.NewFolder),this.draftUid(s.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new e.Date).getTime()/1e3)),this.savedOrSendingText(0 "+e;break;default:e=e+"
"+s}return e},_.prototype.editor=function(e){if(e){var t=this;!this.oEditor&&this.composeEditorArea()?r.delay(function(){t.oEditor=new d(t.composeEditorArea(),null,function(){e(t.oEditor)},function(e){t.isHtml(!!e)})},300):this.oEditor&&e(this.oEditor)}},_.prototype.onShow=function(e,s,i,o,n){xt.routeOff();var a=this,l="",c="",u="",d="",h="",p=null,m=null,g="",f="",b=[],y={},S=jt.data().accountEmail(),v=jt.data().signature(),C=jt.data().signatureToAll(),w=[],T=null,F=null,A=e||Lt.ComposeType.Empty,E=function(e,t){for(var s=0,i=e.length,o=[];i>s;s++)o.push(e[s].toLine(!!t));return o.join(", ")};if(s=s||null,s&&Mt.isNormal(s)&&(F=Mt.isArray(s)&&1===s.length?s[0]:Mt.isArray(s)?null:s),null!==S&&(y[S]=!0),this.currentIdentityID(this.findIdentityIdByMessage(A,F)),this.reset(),Mt.isNonEmptyArray(i)&&this.to(E(i)),""!==A&&F){switch(d=F.fullFormatDateValue(),h=F.subject(),T=F.aDraftInfo,p=t(F.body).clone(),Mt.removeBlockquoteSwitcher(p),m=p.find("[data-html-editor-font-wrapper=true]"),g=m&&m[0]?m.html():p.html(),A){case Lt.ComposeType.Empty:break;case Lt.ComposeType.Reply:this.to(E(F.replyEmails(y))),this.subject(Mt.replySubjectAdd("Re",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["reply",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.sReferences);break;case Lt.ComposeType.ReplyAll:b=F.replyAllEmails(y),this.to(E(b[0])),this.cc(E(b[1])),this.subject(Mt.replySubjectAdd("Re",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["reply",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.references());break;case Lt.ComposeType.Forward:this.subject(Mt.replySubjectAdd("Fwd",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["forward",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.sReferences);break;case Lt.ComposeType.ForwardAsAttachment:this.subject(Mt.replySubjectAdd("Fwd",h)),this.prepearMessageAttachments(F,A),this.aDraftInfo=["forward",F.uid,F.folderFullNameRaw],this.sInReplyTo=F.sMessageId,this.sReferences=Mt.trim(this.sInReplyTo+" "+F.sReferences);break;case Lt.ComposeType.Draft:this.to(E(F.to)),this.cc(E(F.cc)),this.bcc(E(F.bcc)),this.bFromDraft=!0,this.draftFolder(F.folderFullNameRaw),this.draftUid(F.uid),this.subject(h),this.prepearMessageAttachments(F,A),this.aDraftInfo=Mt.isNonEmptyArray(T)&&3===T.length?T:null,this.sInReplyTo=F.sInReplyTo,this.sReferences=F.sReferences;break;case Lt.ComposeType.EditAsNew:this.to(E(F.to)),this.cc(E(F.cc)),this.bcc(E(F.bcc)),this.subject(h),this.prepearMessageAttachments(F,A),this.aDraftInfo=Mt.isNonEmptyArray(T)&&3===T.length?T:null,this.sInReplyTo=F.sInReplyTo,this.sReferences=F.sReferences}switch(A){case Lt.ComposeType.Reply:case Lt.ComposeType.ReplyAll:l=F.fromToLine(!1,!0),f=Mt.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:d,EMAIL:l}),g="
"+f+":"+g+"
";break;case Lt.ComposeType.Forward:l=F.fromToLine(!1,!0),c=F.toToLine(!1,!0),u=F.ccToLine(!1,!0),g="
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+l+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+c+(0 "+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+u:"")+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Mt.encodeHtml(d)+"
"+Mt.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Mt.encodeHtml(h)+"
"+g;break;case Lt.ComposeType.ForwardAsAttachment:g=""}C&&""!==v&&Lt.ComposeType.EditAsNew!==A&&Lt.ComposeType.Draft!==A&&(g=this.convertSignature(v,E(F.from,!0),g,A)),this.editor(function(e){e.setHtml(g,!1),F.isHtml()||e.modeToggle(!1)})}else Lt.ComposeType.Empty===A?(this.subject(Mt.isNormal(o)?""+o:""),g=Mt.isNormal(n)?""+n:"",C&&""!==v&&(g=this.convertSignature(v,"",Mt.convertPlainTextToHtml(g),A)),this.editor(function(e){e.setHtml(g,!1),Lt.EditorDefaultType.Html!==jt.data().editorDefaultType()&&e.modeToggle(!1)})):Mt.isNonEmptyArray(s)&&r.each(s,function(e){a.addMessageAsAttachment(e)});w=this.getAttachmentsDownloadsForUpload(),Mt.isNonEmptyArray(w)&&jt.remote().messageUploadAttachments(function(e,t){if(Lt.StorageResultType.Success===e&&t&&t.Result){var s=null,i="";if(!a.viewModelVisibility())for(i in t.Result)t.Result.hasOwnProperty(i)&&(s=a.getAttachmentById(t.Result[i]),s&&s.tempName(i))}else a.setMessageAttachmentFailedDowbloadText()},w),this.triggerForResize()},_.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},_.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},_.prototype.tryToClosePopup=function(){var e=this;xt.isPopupVisible(W)||xt.showScreenPopup(W,[Mt.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&Mt.delegateRun(e,"closeCommand")}])},_.prototype.onBuild=function(){this.initUploader();var s=this,i=null;c("ctrl+q, command+q",Lt.KeyState.Compose,function(){return s.identitiesDropdownTrigger(!0),!1}),c("ctrl+s, command+s",Lt.KeyState.Compose,function(){return s.saveCommand(),!1}),c("ctrl+enter, command+enter",Lt.KeyState.Compose,function(){return s.sendCommand(),!1}),c("esc",Lt.KeyState.Compose,function(){return s.modalVisibility()&&s.tryToClosePopup(),!1}),Gt.on("resize",function(){s.triggerForResize()}),this.dropboxEnabled()&&(i=document.createElement("script"),i.type="text/javascript",i.src="https://www.dropbox.com/static/api/1/dropins.js",t(i).attr("id","dropboxjs").attr("data-app-key",jt.settingsGet("DropboxApiKey")),document.body.appendChild(i)),this.driveEnabled()&&t.getScript("https://apis.google.com/js/api.js",function(){e.gapi&&s.driveVisible(!0)})},_.prototype.driveCallback=function(t,s){if(s&&e.XMLHttpRequest&&e.google&&s[e.google.picker.Response.ACTION]===e.google.picker.Action.PICKED&&s[e.google.picker.Response.DOCUMENTS]&&s[e.google.picker.Response.DOCUMENTS][0]&&s[e.google.picker.Response.DOCUMENTS][0].id){var i=this,o=new e.XMLHttpRequest;o.open("GET","https://www.googleapis.com/drive/v2/files/"+s[e.google.picker.Response.DOCUMENTS][0].id),o.setRequestHeader("Authorization","Bearer "+t),o.addEventListener("load",function(){if(o&&o.responseText){var e=JSON.parse(o.responseText),s=function(e,t,s){e&&e.exportLinks&&(e.exportLinks[t]?(e.downloadUrl=e.exportLinks[t],e.title=e.title+"."+s,e.mimeType=t):e.exportLinks["application/pdf"]&&(e.downloadUrl=e.exportLinks["application/pdf"],e.title=e.title+".pdf",e.mimeType="application/pdf"))};if(e&&!e.downloadUrl&&e.mimeType&&e.exportLinks)switch(e.mimeType.toString().toLowerCase()){case"application/vnd.google-apps.document":s(e,"application/vnd.openxmlformats-officedocument.wordprocessingml.document","docx");break;case"application/vnd.google-apps.spreadsheet":s(e,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsx");break;case"application/vnd.google-apps.drawing":s(e,"image/png","png");break;case"application/vnd.google-apps.presentation":s(e,"application/vnd.openxmlformats-officedocument.presentationml.presentation","pptx");break;default:s(e,"application/pdf","pdf")}e&&e.downloadUrl&&i.addDriveAttachment(e,t)}}),o.send()}},_.prototype.driveCreatePiker=function(t){if(e.gapi&&t&&t.access_token){var s=this;e.gapi.load("picker",{callback:function(){if(e.google&&e.google.picker){var i=(new e.google.picker.PickerBuilder).addView((new e.google.picker.DocsView).setIncludeFolders(!0)).setAppId(jt.settingsGet("GoogleClientID")).setOAuthToken(t.access_token).setCallback(r.bind(s.driveCallback,s,t.access_token)).enableFeature(e.google.picker.Feature.NAV_HIDDEN).build();i.setVisible(!0)}}})}},_.prototype.driveOpenPopup=function(){if(e.gapi){var t=this;e.gapi.load("auth",{callback:function(){var s=e.gapi.auth.getToken();s?t.driveCreatePiker(s):e.gapi.auth.authorize({client_id:jt.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!0},function(s){if(s&&!s.error){var i=e.gapi.auth.getToken();i&&t.driveCreatePiker(i)}else e.gapi.auth.authorize({client_id:jt.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!1},function(s){if(s&&!s.error){var i=e.gapi.auth.getToken();i&&t.driveCreatePiker(i)}})})}})}},_.prototype.getAttachmentById=function(e){for(var t=this.attachments(),s=0,i=t.length;i>s;s++)if(t[s]&&e===t[s].id)return t[s];return null},_.prototype.initUploader=function(){if(this.composeUploaderButton()){var e={},t=Mt.pInt(jt.settingsGet("AttachmentLimit")),s=new a({action:jt.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",r.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",r.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",r.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",r.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",r.bind(function(t,s,i){var o=null;Mt.isUnd(e[t])?(o=this.getAttachmentById(t),o&&(e[t]=o)):o=e[t],o&&o.progress(" - "+Math.floor(s/i*100)+"%")},this)).on("onSelect",r.bind(function(e,i){this.dragAndDropOver(!1);var o=this,n=Mt.isUnd(i.FileName)?"":i.FileName.toString(),a=Mt.isNormal(i.Size)?Mt.pInt(i.Size):null,r=new A(e,n,a);return r.cancel=function(e){return function(){o.attachments.remove(function(t){return t&&t.id===e}),s&&s.cancel(e)}}(e),this.attachments.push(r),a>0&&t>0&&a>t?(r.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",r.bind(function(t){var s=null;Mt.isUnd(e[t])?(s=this.getAttachmentById(t),s&&(e[t]=s)):s=e[t],s&&(s.waiting(!1),s.uploading(!0))},this)).on("onComplete",r.bind(function(t,s,i){var o="",n=null,a=null,r=this.getAttachmentById(t);a=s&&i&&i.Result&&i.Result.Attachment?i.Result.Attachment:null,n=i&&i.Result&&i.Result.ErrorCode?i.Result.ErrorCode:null,null!==n?o=Mt.getUploadErrorDescByCode(n):a||(o=Mt.i18n("UPLOAD/ERROR_UNKNOWN")),r&&(""!==o&&00&&o>0&&n>o?(s.uploading(!1),s.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(jt.remote().composeUploadExternals(function(e,t){var i=!1;s.uploading(!1),Lt.StorageResultType.Success===e&&t&&t.Result&&t.Result[s.id]&&(i=!0,s.tempName(t.Result[s.id])),i||s.error(Mt.getUploadErrorDescByCode(Lt.UploadErrorCode.FileNoUploaded))},[e.link]),!0)},_.prototype.addDriveAttachment=function(e,t){var s=this,i=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}},o=Mt.pInt(jt.settingsGet("AttachmentLimit")),n=null,a=e.fileSize?Mt.pInt(e.fileSize):0;return n=new A(e.downloadUrl,e.title,a),n.fromMessage=!1,n.cancel=i(e.downloadUrl),n.waiting(!1).uploading(!0),this.attachments.push(n),a>0&&o>0&&a>o?(n.uploading(!1),n.error(Mt.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(jt.remote().composeUploadDrive(function(e,t){var s=!1;n.uploading(!1),Lt.StorageResultType.Success===e&&t&&t.Result&&t.Result[n.id]&&(s=!0,n.tempName(t.Result[n.id][0]),n.size(Mt.pInt(t.Result[n.id][1]))),s||n.error(Mt.getUploadErrorDescByCode(Lt.UploadErrorCode.FileNoUploaded))},e.downloadUrl,t),!0)},_.prototype.prepearMessageAttachments=function(e,t){if(e){var s=this,i=Mt.isNonEmptyArray(e.attachments())?e.attachments():[],o=0,n=i.length,a=null,r=null,l=!1,c=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}};if(Lt.ComposeType.ForwardAsAttachment===t)this.addMessageAsAttachment(e);else for(;n>o;o++){switch(r=i[o],l=!1,t){case Lt.ComposeType.Reply:case Lt.ComposeType.ReplyAll:l=r.isLinked;break;case Lt.ComposeType.Forward:case Lt.ComposeType.Draft:case Lt.ComposeType.EditAsNew:l=!0}l&&(a=new A(r.download,r.fileName,r.estimatedSize,r.isInline,r.isLinked,r.cid,r.contentLocation),a.fromMessage=!0,a.cancel=c(r.download),a.waiting(!1).uploading(!0),this.attachments.push(a))}}},_.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},_.prototype.setMessageAttachmentFailedDowbloadText=function(){r.each(this.attachments(),function(e){e&&e.fromMessage&&e.waiting(!1).uploading(!1).error(Mt.getUploadErrorDescByCode(Lt.UploadErrorCode.FileNoUploaded))},this)},_.prototype.isEmptyForm=function(e){e=Mt.isUnd(e)?!0:!!e;var t=e?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&t&&(!this.oEditor||""===this.oEditor.getData())},_.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.attachmentsInProcessError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},_.prototype.getAttachmentsDownloadsForUpload=function(){return r.map(r.filter(this.attachments(),function(e){return e&&""===e.tempName()}),function(e){return e.id})},_.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Mt.extendAsViewModel("PopupsContactsViewModel",U),U.prototype.getPropertyPlceholder=function(e){var t="";
-switch(e){case Lt.ContactPropertyType.LastName:t="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case Lt.ContactPropertyType.FirstName:t="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case Lt.ContactPropertyType.Nick:t="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return t},U.prototype.addNewProperty=function(e,t){this.viewProperties.push(new w(e,t||"","",!0,this.getPropertyPlceholder(e)))},U.prototype.addNewOrFocusProperty=function(e,t){var s=r.find(this.viewProperties(),function(t){return e===t.type()});s?s.focused(!0):this.addNewProperty(e,t)},U.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},U.prototype.addNewEmail=function(){this.addNewProperty(Lt.ContactPropertyType.Email,"Home")},U.prototype.addNewPhone=function(){this.addNewProperty(Lt.ContactPropertyType.Phone,"Mobile")},U.prototype.addNewWeb=function(){this.addNewProperty(Lt.ContactPropertyType.Web)},U.prototype.addNewNickname=function(){this.addNewOrFocusProperty(Lt.ContactPropertyType.Nick)},U.prototype.addNewNotes=function(){this.addNewOrFocusProperty(Lt.ContactPropertyType.Note)},U.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(Lt.ContactPropertyType.Birthday)},U.prototype.exportVcf=function(){jt.download(jt.link().exportContactsVcf())},U.prototype.exportCsv=function(){jt.download(jt.link().exportContactsCsv())},U.prototype.initUploader=function(){if(this.importUploaderButton()){var t=new a({action:jt.link().uploadContacts(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,disableDragAndDrop:!0,disableMultiple:!0,disableDocumentDropPrevent:!0,clickElement:this.importUploaderButton()});t&&t.on("onStart",r.bind(function(){this.contacts.importing(!0)},this)).on("onComplete",r.bind(function(t,s,i){this.contacts.importing(!1),this.reloadContactList(),t&&s&&i&&i.Result||e.alert(Mt.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},U.prototype.removeCheckedOrSelectedContactsFromList=function(){var e=this,t=this.contacts,s=this.currentContact(),i=this.contacts().length,o=this.contactsCheckedOrSelected();0=i&&(this.bDropPageAfterDelete=!0),r.delay(function(){r.each(o,function(e){t.remove(e)})},500))},U.prototype.deleteSelectedContacts=function(){00?i:0),Mt.isNonEmptyArray(s.Result.Tags)&&(n=r.map(s.Result.Tags,function(e){var t=new T;return t.parse(e)?t:null}),n=r.compact(n))),t.contactsCount(i),t.contacts(o),t.contacts.loading(!1),t.contactTags(n),t.viewClearSearch(""!==t.search())},s,It.Defaults.ContactsPerPage,this.search())},U.prototype.onBuild=function(e){this.oContentVisible=t(".b-list-content",e),this.oContentScrollable=t(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Lt.KeyState.ContactList);var i=this;c("delete",Lt.KeyState.ContactList,function(){return i.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=s.dataFor(this);e&&(i.contactsPage(Mt.pInt(e.value)),i.reloadContactList())}),this.initUploader()},U.prototype.onShow=function(){xt.routeOff(),this.reloadContactList(!0)},U.prototype.onHide=function(){xt.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Mt.extendAsViewModel("PopupsAdvancedSearchViewModel",x),x.prototype.buildSearchStringValue=function(e){return-1 li"),o=s&&("tab"===s.shortcut||"right"===s.shortcut),n=i.index(i.filter(".active"));return!o&&n>0?n--:o&&n-1&&r.eq(n).removeClass("focused"),38===a&&n>0?n--:40===a&&no)?(this.oContentScrollable.scrollTop(i.top<0?this.oContentScrollable.scrollTop()+i.top-e:this.oContentScrollable.scrollTop()+i.top-o+n+e),!0):!1},et.prototype.messagesDrop=function(e,t){if(e&&t&&t.helper){var s=t.helper.data("rl-folder"),i=Bt.hasClass("rl-ctrl-key-pressed"),o=t.helper.data("rl-uids");Mt.isNormal(s)&&""!==s&&Mt.isArray(o)&&jt.moveMessagesToFolder(s,o,e.fullNameRaw,i)}},et.prototype.composeClick=function(){xt.showScreenPopup(_)},et.prototype.createFolder=function(){xt.showScreenPopup(k)},et.prototype.configureFolders=function(){xt.setHash(jt.link().settings("folders"))},et.prototype.contactsClick=function(){this.allowContacts&&xt.showScreenPopup(U)},Mt.extendAsViewModel("MailBoxMessageListViewModel",tt),tt.prototype.emptySubjectValue="",tt.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue),this.inputMessageListSearchFocus(!1)},tt.prototype.printableMessageCountForDeletion=function(){var e=this.messageListCheckedOrSelectedUidsWithSubMails().length;return e>1?" ("+(100>e?e:"99+")+")":""},tt.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},tt.prototype.moveSelectedMessagesToFolder=function(e,t){return this.canBeMoved()&&jt.moveMessagesToFolder(jt.data().currentFolderFullNameRaw(),jt.data().messageListCheckedOrSelectedUidsWithSubMails(),e,t),!1},tt.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=Mt.draggeblePlace(),s=jt.data().messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",jt.data().currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),r.defer(function(){var e=jt.data().messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},tt.prototype.onMessageResponse=function(e,t,s){var i=jt.data();i.hideMessageBodies(),i.messageLoading(!1),Lt.StorageResultType.Success===e&&t&&t.Result?i.setMessage(t,s):Lt.StorageResultType.Unload===e?(i.message(null),i.messageError("")):Lt.StorageResultType.Abort!==e&&(i.message(null),i.messageError(Mt.getNotification(t&&t.ErrorCode?t.ErrorCode:Lt.Notification.UnknownError)))},tt.prototype.populateMessageBody=function(e){e&&(jt.remote().message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?jt.data().messageLoading(!0):Mt.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},tt.prototype.setAction=function(e,t,s){var i=[],o=null,n=jt.cache(),a=0;if(Mt.isUnd(s)&&(s=jt.data().messageListChecked()),i=r.map(s,function(e){return e.uid}),""!==e&&00?100>e?e:"99+":""},st.prototype.verifyPgpSignedClearMessage=function(e){e&&e.verifyPgpSignedClearMessage()},st.prototype.decryptPgpEncryptedMessage=function(e){e&&e.decryptPgpEncryptedMessage(this.viewPgpPassword())},st.prototype.readReceipt=function(e){e&&""!==e.readReceipt()&&(jt.remote().sendReadReceiptMessage(Mt.emptyFunction,e.folderFullNameRaw,e.uid,e.readReceipt(),Mt.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:e.subject()}),Mt.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":jt.data().accountEmail()})),e.isReadReceipt(!0),jt.cache().storeMessageFlagsToCache(e),jt.reloadFlagsCurrentMessageListAndMessageFromCache())},Mt.extendAsViewModel("SettingsMenuViewModel",it),it.prototype.link=function(e){return jt.link().settings(e)},it.prototype.backToMailBoxClick=function(){xt.setHash(jt.link().inbox())},Mt.extendAsViewModel("SettingsPaneViewModel",ot),ot.prototype.onBuild=function(){var e=this;c("esc",Lt.KeyState.Settings,function(){e.backToMailBoxClick()})},ot.prototype.onShow=function(){jt.data().message(null)},ot.prototype.backToMailBoxClick=function(){xt.setHash(jt.link().inbox())},Mt.addSettingsViewModel(nt,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),nt.prototype.toggleLayout=function(){this.layout(Lt.Layout.NoPreview===this.layout()?Lt.Layout.SidePreview:Lt.Layout.NoPreview)},nt.prototype.onBuild=function(){var e=this;r.delay(function(){var s=jt.data(),i=Mt.settingsSaveHelperSimpleFunction(e.mppTrigger,e);s.language.subscribe(function(s){e.languageTrigger(Lt.SaveSettingsStep.Animate),t.ajax({url:jt.link().langLink(s),dataType:"script",cache:!0}).done(function(){Mt.i18nToDoc(),e.languageTrigger(Lt.SaveSettingsStep.TrueResult)}).fail(function(){e.languageTrigger(Lt.SaveSettingsStep.FalseResult)}).always(function(){r.delay(function(){e.languageTrigger(Lt.SaveSettingsStep.Idle)},1e3)}),jt.remote().saveSettings(Mt.emptyFunction,{Language:s})}),s.editorDefaultType.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{EditorDefaultType:e})}),s.messagesPerPage.subscribe(function(e){jt.remote().saveSettings(i,{MPP:e})}),s.showImages.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{ShowImages:e?"1":"0"})}),s.interfaceAnimation.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{InterfaceAnimation:e})}),s.useDesktopNotifications.subscribe(function(e){Mt.timeOutAction("SaveDesktopNotifications",function(){jt.remote().saveSettings(Mt.emptyFunction,{DesktopNotifications:e?"1":"0"})},3e3)}),s.replySameFolder.subscribe(function(e){Mt.timeOutAction("SaveReplySameFolder",function(){jt.remote().saveSettings(Mt.emptyFunction,{ReplySameFolder:e?"1":"0"})},3e3)}),s.useThreads.subscribe(function(e){s.messageList([]),jt.remote().saveSettings(Mt.emptyFunction,{UseThreads:e?"1":"0"})}),s.layout.subscribe(function(e){s.messageList([]),jt.remote().saveSettings(Mt.emptyFunction,{Layout:e})}),s.useCheckboxesInList.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{UseCheckboxesInList:e?"1":"0"})})},50)},nt.prototype.onShow=function(){jt.data().desktopNotifications.valueHasMutated()},nt.prototype.selectLanguage=function(){xt.showScreenPopup(j)},Mt.addSettingsViewModel(at,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),at.prototype.onBuild=function(){jt.data().contactsAutosave.subscribe(function(e){jt.remote().saveSettings(Mt.emptyFunction,{ContactsAutosave:e?"1":"0"})})},Mt.addSettingsViewModel(rt,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),rt.prototype.addNewAccount=function(){xt.showScreenPopup(V)},rt.prototype.deleteAccount=function(t){if(t&&t.deleteAccess()){this.accountForDeletion(null);var s=function(e){return t===e};t&&(this.accounts.remove(s),jt.remote().accountDelete(function(t,s){Lt.StorageResultType.Success===t&&s&&s.Result&&s.Reload?(xt.routeOff(),xt.setHash(jt.link().root(),!0),xt.routeOff(),r.defer(function(){e.location.reload()})):jt.accountsAndIdentities()},t.email))}},Mt.addSettingsViewModel(lt,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),lt.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=jt.data().signature();this.editor=new d(e.signatureDom(),function(){jt.data().signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},lt.prototype.onBuild=function(){var e=this;r.delay(function(){var t=jt.data(),s=Mt.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),i=Mt.settingsSaveHelperSimpleFunction(e.replyTrigger,e),o=Mt.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);t.displayName.subscribe(function(e){jt.remote().saveSettings(s,{DisplayName:e})}),t.replyTo.subscribe(function(e){jt.remote().saveSettings(i,{ReplyTo:e})}),t.signature.subscribe(function(e){jt.remote().saveSettings(o,{Signature:e})}),t.signatureToAll.subscribe(function(e){jt.remote().saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},Mt.addSettingsViewModel(ct,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),ct.prototype.formattedAccountIdentity=function(){var e=this.displayName.peek(),t=this.accountEmail.peek();return""===e?t:'"'+Mt.quoteName(e)+'" <'+t+">"},ct.prototype.addNewIdentity=function(){xt.showScreenPopup(q)},ct.prototype.editIdentity=function(e){xt.showScreenPopup(q,[e])},ct.prototype.deleteIdentity=function(e){if(e&&e.deleteAccess()){this.identityForDeletion(null);var t=function(t){return e===t};e&&(this.identities.remove(t),jt.remote().identityDelete(function(){jt.accountsAndIdentities()},e.id))}},ct.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=jt.data().signature();this.editor=new d(e.signatureDom(),function(){jt.data().signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},ct.prototype.onBuild=function(e){var t=this;e.on("click",".identity-item .e-action",function(){var e=s.dataFor(this);e&&t.editIdentity(e)}),r.delay(function(){var e=jt.data(),s=Mt.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),i=Mt.settingsSaveHelperSimpleFunction(t.replyTrigger,t),o=Mt.settingsSaveHelperSimpleFunction(t.signatureTrigger,t),n=Mt.settingsSaveHelperSimpleFunction(t.defaultIdentityIDTrigger,t);e.defaultIdentityID.subscribe(function(e){jt.remote().saveSettings(n,{DefaultIdentityID:e})}),e.displayName.subscribe(function(e){jt.remote().saveSettings(s,{DisplayName:e})}),e.replyTo.subscribe(function(e){jt.remote().saveSettings(i,{ReplyTo:e})}),e.signature.subscribe(function(e){jt.remote().saveSettings(o,{Signature:e})}),e.signatureToAll.subscribe(function(e){jt.remote().saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},Mt.addSettingsViewModel(ut,"SettingsFilters","SETTINGS_LABELS/LABEL_FILTERS_NAME","filters"),ut.prototype.deleteFilter=function(e){this.filters.remove(e)},ut.prototype.addFilter=function(){xt.showScreenPopup(Y,[new P])},Mt.addSettingsViewModel(dt,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),dt.prototype.showSecret=function(){this.secreting(!0),jt.remote().showTwoFactorSecret(this.onSecretResult)},dt.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},dt.prototype.createTwoFactor=function(){this.processing(!0),jt.remote().createTwoFactor(this.onResult)},dt.prototype.enableTwoFactor=function(){this.processing(!0),jt.remote().enableTwoFactor(this.onResult,this.viewEnable())},dt.prototype.testTwoFactor=function(){xt.showScreenPopup(z)},dt.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),jt.remote().clearTwoFactor(this.onResult)},dt.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},dt.prototype.onResult=function(e,t){if(this.processing(!1),this.clearing(!1),Lt.StorageResultType.Success===e&&t&&t.Result?(this.viewUser(Mt.pString(t.Result.User)),this.viewEnable(!!t.Result.Enable),this.twoFactorStatus(!!t.Result.IsSet),this.viewSecret(Mt.pString(t.Result.Secret)),this.viewBackupCodes(Mt.pString(t.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Mt.pString(t.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var s=this;this.viewEnable.subscribe(function(e){this.viewEnable.subs&&jt.remote().enableTwoFactor(function(e,t){Lt.StorageResultType.Success===e&&t&&t.Result||(s.viewEnable.subs=!1,s.viewEnable(!1),s.viewEnable.subs=!0)},e)},this)}},dt.prototype.onSecretResult=function(e,t){this.secreting(!1),Lt.StorageResultType.Success===e&&t&&t.Result?(this.viewSecret(Mt.pString(t.Result.Secret)),this.viewUrl(Mt.pString(t.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},dt.prototype.onBuild=function(){this.processing(!0),jt.remote().getTwoFactor(this.onResult)},Mt.addSettingsViewModel(ht,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Mt.addSettingsViewModel(pt,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),pt.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},pt.prototype.onChangePasswordResponse=function(e,t){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),Lt.StorageResultType.Success===e&&t&&t.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(t&&Lt.Notification.CurrentPasswordIncorrect===t.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(Mt.getNotification(t&&t.ErrorCode?t.ErrorCode:Lt.Notification.CouldNotSaveNewPassword)))},Mt.addSettingsViewModel(mt,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),mt.prototype.folderEditOnEnter=function(e){var t=e?Mt.trim(e.nameForEdit()):"";""!==t&&e.name()!==t&&(jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,""),jt.data().foldersRenaming(!0),jt.remote().folderRename(function(e,t){jt.data().foldersRenaming(!1),Lt.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),jt.folders()},e.fullNameRaw,t),jt.cache().removeFolderFromCacheList(e.fullNameRaw),e.name(t)),e.edited(!1)},mt.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},mt.prototype.onShow=function(){jt.data().foldersListError("")},mt.prototype.createFolder=function(){xt.showScreenPopup(k)},mt.prototype.systemFolder=function(){xt.showScreenPopup(O)},mt.prototype.deleteFolder=function(e){if(e&&e.canBeDeleted()&&e.deleteAccess()&&0===e.privateMessageCountAll()){this.folderForDeletion(null);var t=function(s){return e===s?!0:(s.subFolders.remove(t),!1)};e&&(jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,""),jt.data().folderList.remove(t),jt.data().foldersDeleting(!0),jt.remote().folderDelete(function(e,t){jt.data().foldersDeleting(!1),Lt.StorageResultType.Success===e&&t&&t.Result||jt.data().foldersListError(t&&t.ErrorCode?Mt.getNotification(t.ErrorCode):Mt.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),jt.folders()},e.fullNameRaw),jt.cache().removeFolderFromCacheList(e.fullNameRaw))}else 00&&(s=this.messagesBodiesDom(),s&&(s.find(".rl-cache-class").each(function(){var s=t(this);i>s.data("rl-cache-count")&&(s.addClass("rl-cache-purge"),e++)}),e>0&&r.delay(function(){s.find(".rl-cache-purge").remove()},300)))},yt.prototype.populateDataOnStart=function(){bt.prototype.populateDataOnStart.call(this),this.accountEmail(jt.settingsGet("Email")),this.accountIncLogin(jt.settingsGet("IncLogin")),this.accountOutLogin(jt.settingsGet("OutLogin")),this.projectHash(jt.settingsGet("ProjectHash")),this.defaultIdentityID(jt.settingsGet("DefaultIdentityID")),this.displayName(jt.settingsGet("DisplayName")),this.replyTo(jt.settingsGet("ReplyTo")),this.signature(jt.settingsGet("Signature")),this.signatureToAll(!!jt.settingsGet("SignatureToAll")),this.enableTwoFactor(!!jt.settingsGet("EnableTwoFactor")),this.lastFoldersHash=jt.local().get(Lt.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!jt.settingsGet("RemoteSuggestions"),this.devEmail=jt.settingsGet("DevEmail"),this.devPassword=jt.settingsGet("DevPassword")},yt.prototype.initUidNextAndNewMessages=function(t,s,i){if("INBOX"===t&&Mt.isNormal(s)&&""!==s){if(Mt.isArray(i)&&03)l(jt.link().notificationMailIcon(),jt.data().accountEmail(),Mt.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:a}));else for(;a>n;n++)l(jt.link().notificationMailIcon(),E.emailsToLine(E.initEmailsFromJson(i[n].From),!1),i[n].Subject)}jt.cache().setFolderUidNext(t,s)}},yt.prototype.folderResponseParseRec=function(e,t){var s=0,i=0,o=null,n=null,a="",r=[],l=[];for(s=0,i=t.length;i>s;s++)o=t[s],o&&(a=o.FullNameRaw,n=jt.cache().getFolderFromCacheList(a),n||(n=N.newInstanceFromJson(o),n&&(jt.cache().setFolderToCacheList(a,n),jt.cache().setFolderFullNameRaw(n.fullNameHash,a))),n&&(n.collapsed(!Mt.isFolderExpanded(n.fullNameHash)),o.Extended&&(o.Extended.Hash&&jt.cache().setFolderHash(n.fullNameRaw,o.Extended.Hash),Mt.isNormal(o.Extended.MessageCount)&&n.messageCountAll(o.Extended.MessageCount),Mt.isNormal(o.Extended.MessageUnseenCount)&&n.messageCountUnread(o.Extended.MessageUnseenCount)),r=o.SubFolders,r&&"Collection/FolderCollection"===r["@Object"]&&r["@Collection"]&&Mt.isArray(r["@Collection"])&&n.subFolders(this.folderResponseParseRec(e,r["@Collection"])),l.push(n)));return l},yt.prototype.setFolders=function(e){var t=[],s=!1,i=jt.data(),o=function(e){return""===e||It.Values.UnuseOptionValue===e||null!==jt.cache().getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])&&(Mt.isUnd(e.Result.Namespace)||(i.namespace=e.Result.Namespace),this.threading(!!jt.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(i.namespace,e.Result["@Collection"]),i.folderList(t),e.Result.SystemFolders&&""==""+jt.settingsGet("SentFolder")+jt.settingsGet("DraftFolder")+jt.settingsGet("SpamFolder")+jt.settingsGet("TrashFolder")+jt.settingsGet("ArchiveFolder")+jt.settingsGet("NullFolder")&&(jt.settingsSet("SentFolder",e.Result.SystemFolders[2]||null),jt.settingsSet("DraftFolder",e.Result.SystemFolders[3]||null),jt.settingsSet("SpamFolder",e.Result.SystemFolders[4]||null),jt.settingsSet("TrashFolder",e.Result.SystemFolders[5]||null),jt.settingsSet("ArchiveFolder",e.Result.SystemFolders[12]||null),s=!0),i.sentFolder(o(jt.settingsGet("SentFolder"))),i.draftFolder(o(jt.settingsGet("DraftFolder"))),i.spamFolder(o(jt.settingsGet("SpamFolder"))),i.trashFolder(o(jt.settingsGet("TrashFolder"))),i.archiveFolder(o(jt.settingsGet("ArchiveFolder"))),s&&jt.remote().saveSystemFolders(Mt.emptyFunction,{SentFolder:i.sentFolder(),DraftFolder:i.draftFolder(),SpamFolder:i.spamFolder(),TrashFolder:i.trashFolder(),ArchiveFolder:i.archiveFolder(),NullFolder:"NullFolder"}),jt.local().set(Lt.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},yt.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},yt.prototype.getNextFolderNames=function(e){e=Mt.isUnd(e)?!1:!!e;var t=[],s=10,i=n().unix(),o=i-300,a=[],l=function(t){r.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&o>t.interval&&(!e||t.subScribed())&&a.push([t.interval,t.fullNameRaw]),t&&0t[0]?1:0}),r.find(a,function(e){var o=jt.cache().getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),r.uniq(t)},yt.prototype.removeMessagesFromList=function(e,t,s,i){s=Mt.isNormal(s)?s:"",i=Mt.isUnd(i)?!1:!!i,t=r.map(t,function(e){return Mt.pInt(e)});var o=0,n=jt.data(),a=jt.cache(),l=n.messageList(),c=jt.cache().getFolderFromCacheList(e),u=""===s?null:a.getFolderFromCacheList(s||""),d=n.currentFolderFullNameRaw(),h=n.message(),p=d===e?r.filter(l,function(e){return e&&-10&&c.messageCountUnread(0<=c.messageCountUnread()-o?c.messageCountUnread()-o:0)),u&&(u.messageCountAll(u.messageCountAll()+t.length),o>0&&u.messageCountUnread(u.messageCountUnread()+o),u.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),a.data("rl-cache-count",++Ot.iMessageBodyCacheCount),Mt.isNormal(e.Result.Html)&&""!==e.Result.Html?(i=!0,c=e.Result.Html.toString()):Mt.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(i=!1,c=Mt.plainToHtml(e.Result.Plain.toString(),!1),(p.isPgpSigned()||p.isPgpEncrypted())&&jt.data().capaOpenPGP()&&(p.plainRaw=Mt.pString(e.Result.Plain),d=/---BEGIN PGP MESSAGE---/.test(p.plainRaw),d||(u=/-----BEGIN PGP SIGNED MESSAGE-----/.test(p.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(p.plainRaw)),zt.empty(),u&&p.isPgpSigned()?c=zt.append(t('').text(p.plainRaw)).html():d&&p.isPgpEncrypted()&&(c=zt.append(t('').text(p.plainRaw)).html()),zt.empty(),p.isPgpSigned(u),p.isPgpEncrypted(d))):i=!1,a.html(Mt.linkify(c)).addClass("b-text-part "+(i?"html":"plain")),p.isHtml(!!i),p.hasImages(!!o),p.pgpSignedVerifyStatus(Lt.SignedVerifyStatus.None),p.pgpSignedVerifyUser(""),p.body=a,p.body&&h.append(p.body),p.storeDataToDom(),n&&p.showInternalImages(!0),p.hasImages()&&this.showImages()&&p.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(p.body),this.hideMessageBodies(),p.body.show(),a&&Mt.initBlockquoteSwitcher(a)),jt.cache().initMessageFlagsFromCache(p),p.unseen()&&jt.setMessageSeen(p),Mt.windowResize())},yt.prototype.calculateMessageListHash=function(e){return r.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},yt.prototype.setMessageList=function(e,t){if(e&&e.Result&&"Collection/MessageCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&Mt.isArray(e.Result["@Collection"])){var s=jt.data(),i=jt.cache(),o=null,a=0,r=0,l=0,c=0,u=[],d=n().unix(),h=s.staticMessageList,p=null,m=null,g=null,f=0,b=!1;for(l=Mt.pInt(e.Result.MessageResultCount),c=Mt.pInt(e.Result.Offset),Mt.isNonEmptyArray(e.Result.LastCollapsedThreadUids)&&(o=e.Result.LastCollapsedThreadUids),g=jt.cache().getFolderFromCacheList(Mt.isNormal(e.Result.Folder)?e.Result.Folder:""),g&&!t&&(g.interval=d,jt.cache().setFolderHash(e.Result.Folder,e.Result.FolderHash),Mt.isNormal(e.Result.MessageCount)&&g.messageCountAll(e.Result.MessageCount),Mt.isNormal(e.Result.MessageUnseenCount)&&(Mt.pInt(g.messageCountUnread())!==Mt.pInt(e.Result.MessageUnseenCount)&&(b=!0),g.messageCountUnread(e.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(g.fullNameRaw,e.Result.UidNext,e.Result.NewMessages)),b&&g&&jt.cache().clearMessageFlagsFromCacheByFolder(g.fullNameRaw),a=0,r=e.Result["@Collection"].length;r>a;a++)p=e.Result["@Collection"][a],p&&"Object/Message"===p["@Object"]&&(m=h[a],m&&m.initByJson(p)||(m=E.newInstanceFromJson(p)),m&&(i.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=f&&(f++,m.newForAnimation(!0)),m.deleted(!1),t?jt.cache().initMessageFlagsFromCache(m):jt.cache().storeMessageFlagsToCache(m),m.lastInCollapsedThread(o&&-1(new e.Date).getTime()-d),p&&l.oRequests[p]&&(l.oRequests[p].__aborted&&(o="abort"),l.oRequests[p]=null),l.defaultResponse(s,p,o,t,n,i)}),p&&00?(this.defaultRequest(e,"Message",{},null,"Message/"+kt.urlsafe_encode([t,s,jt.data().projectHash(),jt.data().threading()&&jt.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},vt.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},vt.prototype.composeUploadDrive=function(e,t,s){this.defaultRequest(e,"ComposeUploadDrive",{AccessToken:s,Url:t},999e3)},vt.prototype.folderInformation=function(e,t,s){var i=!0,o=jt.cache(),n=[];Mt.isArray(s)&&0 ").addClass("rl-settings-view-model").hide(),l.appendTo(a),o.data=jt.data(),o.viewModelDom=l,o.__rlSettingsData=n.__rlSettingsData,n.__dom=l,n.__builded=!0,n.__vm=o,s.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:n.__rlSettingsData.Template}}},o),Mt.delegateRun(o,"onBuild",[l])):Mt.log("Cannot find sub settings view model position: SettingsSubScreen")),o&&r.defer(function(){i.oCurrentSubScreen&&(Mt.delegateRun(i.oCurrentSubScreen,"onHide"),i.oCurrentSubScreen.viewModelDom.hide()),i.oCurrentSubScreen=o,i.oCurrentSubScreen&&(i.oCurrentSubScreen.viewModelDom.show(),Mt.delegateRun(i.oCurrentSubScreen,"onShow"),Mt.delegateRun(i.oCurrentSubScreen,"onFocus",[],200),r.each(i.menu(),function(e){e.selected(o&&o.__rlSettingsData&&e.route===o.__rlSettingsData.Route)}),t("#rl-content .b-settings .b-content .content").scrollTop(0)),Mt.windowResize()})):xt.setHash(jt.link().settings(),!1,!0)},Tt.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Mt.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},Tt.prototype.onBuild=function(){r.each(_t.settings,function(e){e&&e.__rlSettingsData&&!r.find(_t["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:s.observable(!1),disabled:!!r.find(_t["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=t("#rl-content #rl-settings-subscreen")},Tt.prototype.routes=function(){var e=r.find(_t.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",s={subname:/^(.*)$/,normalize_:function(e,s){return s.subname=Mt.isUnd(s.subname)?t:Mt.pString(s.subname),[s.subname]}};return[["{subname}/",s],["{subname}",s],["",s]]},r.extend(Ft.prototype,y.prototype),Ft.prototype.onShow=function(){jt.setTitle("")},r.extend(At.prototype,y.prototype),At.prototype.oLastRoute={},At.prototype.setNewTitle=function(){var e=jt.data().accountEmail(),t=jt.data().foldersInboxUnreadCount();jt.setTitle((""===e?"":(t>0?"("+t+") ":" ")+e+" - ")+Mt.i18n("TITLES/MAILBOX"))},At.prototype.onShow=function(){this.setNewTitle(),jt.data().keyScope(Lt.KeyState.MessageList)},At.prototype.onRoute=function(e,t,s,i){if(Mt.isUnd(i)?1:!i){var o=jt.data(),n=jt.cache().getFolderFullNameRaw(e),a=jt.cache().getFolderFromCacheList(n);a&&(o.currentFolder(a).messageListPage(t).messageListSearch(s),Lt.Layout.NoPreview===o.layout()&&o.message()&&o.message(null),jt.reloadMessageList())}else Lt.Layout.NoPreview!==jt.data().layout()||jt.data().message()||jt.historyBack()},At.prototype.onStart=function(){var e=jt.data(),t=function(){Mt.windowResize()};(jt.capa(Lt.Capa.AdditionalAccounts)||jt.capa(Lt.Capa.AdditionalIdentities))&&jt.accountsAndIdentities(),r.delay(function(){"INBOX"!==e.currentFolderFullNameRaw()&&jt.folderInformation("INBOX")},1e3),r.delay(function(){jt.quota()},5e3),r.delay(function(){jt.remote().appDelayStart(Mt.emptyFunction)},35e3),Bt.toggleClass("rl-no-preview-pane",Lt.Layout.NoPreview===e.layout()),e.folderList.subscribe(t),e.messageList.subscribe(t),e.message.subscribe(t),e.layout.subscribe(function(e){Bt.toggleClass("rl-no-preview-pane",Lt.Layout.NoPreview===e)}),e.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},At.prototype.routes=function(){var e=function(){return["Inbox",1,"",!0]},t=function(e,t){return t[0]=Mt.pString(t[0]),t[1]=Mt.pInt(t[1]),t[1]=0>=t[1]?1:t[1],t[2]=Mt.pString(t[2]),""===e&&(t[0]="Inbox",t[1]=1),[decodeURI(t[0]),t[1],decodeURI(t[2]),!1]},s=function(e,t){return t[0]=Mt.pString(t[0]),t[1]=Mt.pString(t[1]),""===e&&(t[0]="Inbox"),[decodeURI(t[0]),1,decodeURI(t[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:s}],[/^message-preview$/,{normalize_:e}],[/^([^\/]*)$/,{normalize_:t}]]},r.extend(Et.prototype,Tt.prototype),Et.prototype.onShow=function(){jt.setTitle(this.sSettingsTitle),jt.data().keyScope(Lt.KeyState.Settings)},r.extend(Nt.prototype,f.prototype),Nt.prototype.oSettings=null,Nt.prototype.oPlugins=null,Nt.prototype.oLocal=null,Nt.prototype.oLink=null,Nt.prototype.oSubs={},Nt.prototype.download=function(t){var s=null,i=null,o=navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(s=document.createElement("a"),s.href=t,document.createEvent&&(i=document.createEvent("MouseEvents"),i&&i.initEvent&&s.dispatchEvent))?(i.initEvent("click",!0,!0),s.dispatchEvent(i),!0):(Ot.bMobileDevice?(e.open(t,"_self"),e.focus()):this.iframe.attr("src",t),!0)},Nt.prototype.link=function(){return null===this.oLink&&(this.oLink=new u),this.oLink},Nt.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new g),this.oLocal},Nt.prototype.settingsGet=function(e){return null===this.oSettings&&(this.oSettings=Mt.isNormal(Vt)?Vt:{}),Mt.isUnd(this.oSettings[e])?null:this.oSettings[e]},Nt.prototype.settingsSet=function(e,t){null===this.oSettings&&(this.oSettings=Mt.isNormal(Vt)?Vt:{}),this.oSettings[e]=t},Nt.prototype.setTitle=function(t){t=(Mt.isNormal(t)&&0d;d++)f.push({id:o[d][0],name:o[d][1],system:!1,seporator:!1,disabled:!1});for(m=!0,d=0,h=t.length;h>d;d++)p=t[d],(r?r.call(null,p):!0)&&(m&&0d;d++)p=s[d],(p.subScribed()||!p.existen)&&(r?r.call(null,p):!0)&&(Lt.FolderType.User===p.type()||!c||0=5?o:20,o=320>=o?o:320,e.setInterval(function(){jt.contactsSync()},6e4*o+5e3),r.delay(function(){jt.contactsSync()},5e3),r.delay(function(){jt.folderInformationMultiply(!0)},500),Dt.runHook("rl-start-user-screens"),jt.pub("rl.bootstart-user-screens"),jt.settingsGet("AccountSignMe")&&e.navigator.registerProtocolHandler&&r.delay(function(){try{e.navigator.registerProtocolHandler("mailto",e.location.protocol+"//"+e.location.host+e.location.pathname+"?mailto&to=%s",""+(jt.settingsGet("Title")||"RainLoop"))}catch(t){}jt.settingsGet("MailToEmail")&&jt.mailToHelper(jt.settingsGet("MailToEmail"))},500)):(xt.startScreens([Ft]),Dt.runHook("rl-start-login-screens"),jt.pub("rl.bootstart-login-screens")),e.SimplePace&&e.SimplePace.set(100),Ot.bMobileDevice||r.defer(function(){Mt.initLayoutResizer("#rl-left","#rl-right",Lt.ClientSideKeyName.FolderListSize)})},this))):(s=Mt.pString(jt.settingsGet("CustomLoginLink")),s?(xt.routeOff(),xt.setHash(jt.link().root(),!0),xt.routeOff(),r.defer(function(){e.location.href=s})):(xt.hideLoading(),xt.startScreens([Ft]),Dt.runHook("rl-start-login-screens"),jt.pub("rl.bootstart-login-screens"),e.SimplePace&&e.SimplePace.set(100))),n&&(e["rl_"+i+"_google_service"]=function(){jt.data().googleActions(!0),jt.socialUsers()}),a&&(e["rl_"+i+"_facebook_service"]=function(){jt.data().facebookActions(!0),jt.socialUsers()}),l&&(e["rl_"+i+"_twitter_service"]=function(){jt.data().twitterActions(!0),jt.socialUsers()}),jt.sub("interval.1m",function(){Ot.momentTrigger(!Ot.momentTrigger())}),Dt.runHook("rl-start-screens"),jt.pub("rl.bootstart-end")},jt=new Rt,Bt.addClass(Ot.bMobileDevice?"mobile":"no-mobile"),Gt.keydown(Mt.killCtrlAandS).keyup(Mt.killCtrlAandS),Gt.unload(function(){Ot.bUnload=!0}),Bt.on("click.dropdown.data-api",function(){Mt.detectDropdownVisibility()}),e.rl=e.rl||{},e.rl.addHook=Dt.addHook,e.rl.settingsGet=Dt.mainSettingsGet,e.rl.remoteRequest=Dt.remoteRequest,e.rl.pluginSettingsGet=Dt.settingsGet,e.rl.addSettingsViewModel=Mt.addSettingsViewModel,e.rl.createCommand=Mt.createCommand,e.rl.EmailModel=v,e.rl.Enums=Lt,e.__RLBOOT=function(s){t(function(){e.rainloopTEMPLATES&&e.rainloopTEMPLATES[0]?(t("#rl-templates").html(e.rainloopTEMPLATES[0]),r.delay(function(){e.rainloopAppData={},e.rainloopI18N={},e.rainloopTEMPLATES={},xt.setBoot(jt).bootstart(),Bt.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):s(!1),e.__RLBOOT=null})}}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible,key);
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/admin.js b/rainloop/v/0.0.0/static/js/admin.js
index 0a3363557..04cf7aa88 100644
--- a/rainloop/v/0.0.0/static/js/admin.js
+++ b/rainloop/v/0.0.0/static/js/admin.js
@@ -1,189 +1,2183 @@
-/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (window, $, ko, crossroads, hasher, _) {
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o').appendTo('body');
+
+ $window.on('error', function (oEvent) {
+ if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
+ -1 === Utils.inArray(oEvent.originalEvent.message, [
+ 'Script error.', 'Uncaught Error: Error calling method on NPObject.'
+ ]))
+ {
+ Remote.jsError(
+ Utils.emptyFunction,
+ oEvent.originalEvent.message,
+ oEvent.originalEvent.filename,
+ oEvent.originalEvent.lineno,
+ window.location && window.location.toString ? window.location.toString() : '',
+ $html.attr('class'),
+ Utils.microtime() - Globals.now
+ );
+ }
+ });
+
+ $doc.on('keydown', function (oEvent) {
+ if (oEvent && oEvent.ctrlKey)
+ {
+ $html.addClass('rl-ctrl-key-pressed');
+ }
+ }).on('keyup', function (oEvent) {
+ if (oEvent && !oEvent.ctrlKey)
+ {
+ $html.removeClass('rl-ctrl-key-pressed');
+ }
+ });
+ }
+
+ _.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
+
+ AbstractApp.prototype.remote = function ()
+ {
+ return null;
+ };
+
+ AbstractApp.prototype.data = function ()
+ {
+ return null;
+ };
+
+ AbstractApp.prototype.setupSettings = function ()
+ {
+ return true;
+ };
+
+ /**
+ * @param {string} sLink
+ * @return {boolean}
+ */
+ AbstractApp.prototype.download = function (sLink)
+ {
+ var
+ oE = null,
+ oLink = null,
+ sUserAgent = window.navigator.userAgent.toLowerCase()
+ ;
+
+ if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
+ {
+ oLink = window.document.createElement('a');
+ oLink['href'] = sLink;
+
+ if (window.document['createEvent'])
+ {
+ oE = window.document['createEvent']('MouseEvents');
+ if (oE && oE['initEvent'] && oLink['dispatchEvent'])
+ {
+ oE['initEvent']('click', true, true);
+ oLink['dispatchEvent'](oE);
+ return true;
+ }
+ }
+ }
+
+ if (Globals.bMobileDevice)
+ {
+ window.open(sLink, '_self');
+ window.focus();
+ }
+ else
+ {
+ this.iframe.attr('src', sLink);
+ // window.document.location.href = sLink;
+ }
+
+ return true;
+ };
+
+ AbstractApp.prototype.setTitle = function (sTitle)
+ {
+ sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
+ AppSettings.settingsGet('Title') || '';
+
+ window.document.title = '_';
+ window.document.title = sTitle;
+ };
+
+ /**
+ * @param {boolean=} bLogout = false
+ * @param {boolean=} bClose = false
+ */
+ AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
+ {
+ var
+ kn = require('kn'),
+ sCustomLogoutLink = Utils.pString(AppSettings.settingsGet('CustomLogoutLink')),
+ bInIframe = !!AppSettings.settingsGet('InIframe')
+ ;
+
+ bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
+ bClose = Utils.isUnd(bClose) ? false : !!bClose;
+
+ if (bLogout && bClose && window.close)
+ {
+ window.close();
+ }
+
+ if (bLogout && '' !== sCustomLogoutLink && window.location.href !== sCustomLogoutLink)
+ {
+ _.delay(function () {
+ if (bInIframe && window.parent)
+ {
+ window.parent.location.href = sCustomLogoutLink;
+ }
+ else
+ {
+ window.location.href = sCustomLogoutLink;
+ }
+ }, 100);
+ }
+ else
+ {
+ kn.routeOff();
+ kn.setHash(LinkBuilder.root(), true);
+ kn.routeOff();
+
+ _.delay(function () {
+ if (bInIframe && window.parent)
+ {
+ window.parent.location.reload();
+ }
+ else
+ {
+ window.location.reload();
+ }
+ }, 100);
+ }
+ };
+
+ AbstractApp.prototype.historyBack = function ()
+ {
+ window.history.back();
+ };
+
+ AbstractApp.prototype.bootstart = function ()
+ {
+ Events.pub('rl.bootstart');
+
+ var ssm = require('../External/ssm.js');
+
+ Utils.initOnStartOrLangChange(function () {
+ Utils.initNotificationLanguage();
+ }, null);
+
+ _.delay(function () {
+ Utils.windowResize();
+ }, 1000);
+
+ ssm.addState({
+ 'id': 'mobile',
+ 'maxWidth': 767,
+ 'onEnter': function() {
+ $html.addClass('ssm-state-mobile');
+ Events.pub('ssm.mobile-enter');
+ },
+ 'onLeave': function() {
+ $html.removeClass('ssm-state-mobile');
+ Events.pub('ssm.mobile-leave');
+ }
+ });
+
+ ssm.addState({
+ 'id': 'tablet',
+ 'minWidth': 768,
+ 'maxWidth': 999,
+ 'onEnter': function() {
+ $html.addClass('ssm-state-tablet');
+ },
+ 'onLeave': function() {
+ $html.removeClass('ssm-state-tablet');
+ }
+ });
+
+ ssm.addState({
+ 'id': 'desktop',
+ 'minWidth': 1000,
+ 'maxWidth': 1400,
+ 'onEnter': function() {
+ $html.addClass('ssm-state-desktop');
+ },
+ 'onLeave': function() {
+ $html.removeClass('ssm-state-desktop');
+ }
+ });
+
+ ssm.addState({
+ 'id': 'desktop-large',
+ 'minWidth': 1400,
+ 'onEnter': function() {
+ $html.addClass('ssm-state-desktop-large');
+ },
+ 'onLeave': function() {
+ $html.removeClass('ssm-state-desktop-large');
+ }
+ });
+
+ Events.sub('ssm.mobile-enter', function () {
+ Globals.leftPanelDisabled(true);
+ });
+
+ Events.sub('ssm.mobile-leave', function () {
+ Globals.leftPanelDisabled(false);
+ });
+
+ Globals.leftPanelDisabled.subscribe(function (bValue) {
+ $html.toggleClass('rl-left-panel-disabled', bValue);
+ });
+
+ ssm.ready();
+ };
+
+ module.exports = AbstractApp;
+
+}(module, require));
+},{"$":32,"$doc":24,"$html":25,"$window":26,"../External/ssm.js":36,"../Storages/AppSettings.js":54,"Events":18,"Globals":19,"KnoinAbstractBoot":40,"LinkBuilder":20,"Utils":22,"_":37,"kn":39,"window":38}],14:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ ko = require('ko'),
+ _ = require('_'),
+ window = require('window'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+
+ kn = require('kn'),
+
+ AppSettings = require('../Storages/AppSettings.js'),
+ Data = require('../Storages/AdminDataStorage.js'),
+ Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
+
+ AdminSettingsScreen = require('../Screens/AdminSettingsScreen.js'),
+ AdminLoginScreen = require('../Screens/AdminLoginScreen.js'),
+
+ AbstractApp = require('./AbstractApp.js')
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractApp
+ */
+ function AdminApp()
+ {
+ AbstractApp.call(this, Remote);
+ }
+
+ _.extend(AdminApp.prototype, AbstractApp.prototype);
+
+ AdminApp.prototype.remote = function ()
+ {
+ return Remote;
+ };
+
+ AdminApp.prototype.data = function ()
+ {
+ return Data;
+ };
+
+ AdminApp.prototype.setupSettings = function ()
+ {
+ var
+ AdminSettingsGeneral = require('../Admin/AdminSettingsGeneral.js'),
+ AdminSettingsLogin = require('../Admin/AdminSettingsLogin.js'),
+ AdminSettingsBranding = require('../Admin/AdminSettingsBranding.js'),
+ AdminSettingsContacts = require('../Admin/AdminSettingsContacts.js'),
+ AdminSettingsDomains = require('../Admin/AdminSettingsDomains.js'),
+ AdminSettingsSecurity = require('../Admin/AdminSettingsSecurity.js'),
+ AdminSettingsSocial = require('../Admin/AdminSettingsSocial.js'),
+ AdminSettingsPlugins = require('../Admin/AdminSettingsPlugins.js'),
+ AdminSettingsPackages = require('../Admin/AdminSettingsPackages.js'),
+ AdminSettingsLicensing = require('../Admin/AdminSettingsLicensing.js'),
+ AdminSettingsAbout = require('../Admin/AdminSettingsAbout.js')
+ ;
+
+ kn.addSettingsViewModel(AdminSettingsGeneral,
+ 'AdminSettingsGeneral', 'General', 'general', true);
+
+ kn.addSettingsViewModel(AdminSettingsLogin,
+ 'AdminSettingsLogin', 'Login', 'login');
+
+ if (AppSettings.capa(Enums.Capa.Prem))
+ {
+ kn.addSettingsViewModel(AdminSettingsBranding,
+ 'AdminSettingsBranding', 'Branding', 'branding');
+ }
+
+ kn.addSettingsViewModel(AdminSettingsContacts,
+ 'AdminSettingsContacts', 'Contacts', 'contacts');
+
+ kn.addSettingsViewModel(AdminSettingsDomains,
+ 'AdminSettingsDomains', 'Domains', 'domains');
+
+ kn.addSettingsViewModel(AdminSettingsSecurity,
+ 'AdminSettingsSecurity', 'Security', 'security');
+
+ kn.addSettingsViewModel(AdminSettingsSocial,
+ 'AdminSettingsSocial', 'Social', 'social');
+
+ kn.addSettingsViewModel(AdminSettingsPlugins,
+ 'AdminSettingsPlugins', 'Plugins', 'plugins');
+
+ kn.addSettingsViewModel(AdminSettingsPackages,
+ 'AdminSettingsPackages', 'Packages', 'packages');
+
+ kn.addSettingsViewModel(AdminSettingsLicensing,
+ 'AdminSettingsLicensing', 'Licensing', 'licensing');
+
+ kn.addSettingsViewModel(AdminSettingsAbout,
+ 'AdminSettingsAbout', 'About', 'about');
+
+ return true;
+ };
+
+ AdminApp.prototype.reloadDomainList = function ()
+ {
+ Data.domainsLoading(true);
+
+ Remote.domainList(function (sResult, oData) {
+ Data.domainsLoading(false);
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ var aList = _.map(oData.Result, function (bEnabled, sName) {
+ return {
+ 'name': sName,
+ 'disabled': ko.observable(!bEnabled),
+ 'deleteAccess': ko.observable(false)
+ };
+ }, this);
+
+ Data.domains(aList);
+ }
+ });
+ };
+
+ AdminApp.prototype.reloadPluginList = function ()
+ {
+ Data.pluginsLoading(true);
+ Remote.pluginList(function (sResult, oData) {
+
+ Data.pluginsLoading(false);
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ var aList = _.map(oData.Result, function (oItem) {
+ return {
+ 'name': oItem['Name'],
+ 'disabled': ko.observable(!oItem['Enabled']),
+ 'configured': ko.observable(!!oItem['Configured'])
+ };
+ }, this);
+
+ Data.plugins(aList);
+ }
+ });
+ };
+
+ AdminApp.prototype.reloadPackagesList = function ()
+ {
+ Data.packagesLoading(true);
+ Data.packagesReal(true);
+
+ Remote.packagesList(function (sResult, oData) {
+
+ Data.packagesLoading(false);
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ Data.packagesReal(!!oData.Result.Real);
+ Data.packagesMainUpdatable(!!oData.Result.MainUpdatable);
+
+ var
+ aList = [],
+ aLoading = {}
+ ;
+
+ _.each(Data.packages(), function (oItem) {
+ if (oItem && oItem['loading']())
+ {
+ aLoading[oItem['file']] = oItem;
+ }
+ });
+
+ if (Utils.isArray(oData.Result.List))
+ {
+ aList = _.compact(_.map(oData.Result.List, function (oItem) {
+ if (oItem)
+ {
+ oItem['loading'] = ko.observable(!Utils.isUnd(aLoading[oItem['file']]));
+ return 'core' === oItem['type'] && !oItem['canBeInstalled'] ? null : oItem;
+ }
+ return null;
+ }));
+ }
+
+ Data.packages(aList);
+ }
+ else
+ {
+ Data.packagesReal(false);
+ }
+ });
+ };
+
+ AdminApp.prototype.updateCoreData = function ()
+ {
+ Data.coreUpdating(true);
+ Remote.updateCoreData(function (sResult, oData) {
+
+ Data.coreUpdating(false);
+ Data.coreRemoteVersion('');
+ Data.coreRemoteRelease('');
+ Data.coreVersionCompare(-2);
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ Data.coreReal(true);
+ window.location.reload();
+ }
+ else
+ {
+ Data.coreReal(false);
+ }
+ });
+
+ };
+
+ AdminApp.prototype.reloadCoreData = function ()
+ {
+ Data.coreChecking(true);
+ Data.coreReal(true);
+
+ Remote.coreData(function (sResult, oData) {
+
+ Data.coreChecking(false);
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ Data.coreReal(!!oData.Result.Real);
+ Data.coreUpdatable(!!oData.Result.Updatable);
+ Data.coreAccess(!!oData.Result.Access);
+ Data.coreRemoteVersion(oData.Result.RemoteVersion || '');
+ Data.coreRemoteRelease(oData.Result.RemoteRelease || '');
+ Data.coreVersionCompare(Utils.pInt(oData.Result.VersionCompare));
+ }
+ else
+ {
+ Data.coreReal(false);
+ Data.coreRemoteVersion('');
+ Data.coreRemoteRelease('');
+ Data.coreVersionCompare(-2);
+ }
+ });
+ };
+
+ /**
+ *
+ * @param {boolean=} bForce = false
+ */
+ AdminApp.prototype.reloadLicensing = function (bForce)
+ {
+ bForce = Utils.isUnd(bForce) ? false : !!bForce;
+
+ Data.licensingProcess(true);
+ Data.licenseError('');
+
+ Remote.licensing(function (sResult, oData) {
+ Data.licensingProcess(false);
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result && Utils.isNormal(oData.Result['Expired']))
+ {
+ Data.licenseValid(true);
+ Data.licenseExpired(Utils.pInt(oData.Result['Expired']));
+ Data.licenseError('');
+
+ Data.licensing(true);
+ }
+ else
+ {
+ if (oData && oData.ErrorCode && -1 < Utils.inArray(Utils.pInt(oData.ErrorCode), [
+ Enums.Notification.LicensingServerIsUnavailable,
+ Enums.Notification.LicensingExpired
+ ]))
+ {
+ Data.licenseError(Utils.getNotification(Utils.pInt(oData.ErrorCode)));
+ Data.licensing(true);
+ }
+ else
+ {
+ if (Enums.StorageResultType.Abort === sResult)
+ {
+ Data.licenseError(Utils.getNotification(Enums.Notification.LicensingServerIsUnavailable));
+ Data.licensing(true);
+ }
+ else
+ {
+ Data.licensing(false);
+ }
+ }
+ }
+ }, bForce);
+ };
+
+ AdminApp.prototype.bootstart = function ()
+ {
+ AbstractApp.prototype.bootstart.call(this);
+
+ Data.populateDataOnStart();
+
+ kn.hideLoading();
+
+ if (!AppSettings.settingsGet('AllowAdminPanel'))
+ {
+ kn.routeOff();
+ kn.setHash(LinkBuilder.root(), true);
+ kn.routeOff();
+
+ _.defer(function () {
+ window.location.href = '/';
+ });
+ }
+ else
+ {
+ if (!!AppSettings.settingsGet('Auth'))
+ {
+ kn.startScreens([AdminSettingsScreen]);
+ }
+ else
+ {
+ kn.startScreens([AdminLoginScreen]);
+ }
+ }
+
+ if (window.SimplePace)
+ {
+ window.SimplePace.set(100);
+ }
+ };
+
+ module.exports = new AdminApp();
+
+}(module, require));
+},{"../Admin/AdminSettingsAbout.js":2,"../Admin/AdminSettingsBranding.js":3,"../Admin/AdminSettingsContacts.js":4,"../Admin/AdminSettingsDomains.js":5,"../Admin/AdminSettingsGeneral.js":6,"../Admin/AdminSettingsLicensing.js":7,"../Admin/AdminSettingsLogin.js":8,"../Admin/AdminSettingsPackages.js":9,"../Admin/AdminSettingsPlugins.js":10,"../Admin/AdminSettingsSecurity.js":11,"../Admin/AdminSettingsSocial.js":12,"../Screens/AdminLoginScreen.js":48,"../Screens/AdminSettingsScreen.js":49,"../Storages/AdminAjaxRemoteStorage.js":52,"../Storages/AdminDataStorage.js":53,"../Storages/AppSettings.js":54,"./AbstractApp.js":13,"Enums":17,"LinkBuilder":20,"Utils":22,"_":37,"kn":39,"ko":34,"window":38}],15:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ window = require('window'),
+ _ = require('_'),
+ $ = require('$'),
+ $window = require('$window'),
+ $html = require('$html'),
+
+ Globals = require('Globals'),
+ Plugins = require('Plugins'),
+ Utils = require('Utils')
+ ;
+
+ module.exports = function (App) {
+
+ Globals.__RL = App;
+
+ App.setupSettings();
+
+ Plugins.__boot = App;
+ Plugins.__remote = App.remote();
+ Plugins.__data = App.data();
+
+ $html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
+
+ $window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
+ $window.unload(function () {
+ Globals.bUnload = true;
+ });
+
+ $html.on('click.dropdown.data-api', function () {
+ Utils.detectDropdownVisibility();
+ });
+
+ // export
+ window['rl'] = window['rl'] || {};
+ window['rl']['addHook'] = Plugins.addHook;
+ window['rl']['settingsGet'] = Plugins.mainSettingsGet;
+ window['rl']['remoteRequest'] = Plugins.remoteRequest;
+ window['rl']['pluginSettingsGet'] = Plugins.settingsGet;
+ window['rl']['createCommand'] = Utils.createCommand;
+
+ window['rl']['EmailModel'] = require('../Models/EmailModel.js');
+ window['rl']['Enums'] = require('Enums');
+
+ window['__RLBOOT'] = function (fCall) {
+
+ // boot
+ $(function () {
+
+ if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
+ {
+ $('#rl-templates').html(window['rainloopTEMPLATES'][0]);
+
+ _.delay(function () {
+
+ App.bootstart();
+ $html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
+
+ }, 50);
+ }
+ else
+ {
+ fCall(false);
+ }
+
+ window['__RLBOOT'] = null;
+ });
+ };
+
+ };
+
+}(module, require));
+},{"$":32,"$html":25,"$window":26,"../Models/EmailModel.js":45,"Enums":17,"Globals":19,"Plugins":21,"Utils":22,"_":37,"window":38}],16:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
'use strict';
- var
- Globals = {},
- window = require('../External/window.js'),
- ko = require('../External/ko.js'),
- $html = require('../External/$html.js')
- ;
-
- /**
- * @type {?}
- */
- Globals.now = (new window.Date()).getTime();
-
- /**
- * @type {?}
- */
- Globals.momentTrigger = ko.observable(true);
-
- /**
- * @type {?}
- */
- Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
-
- /**
- * @type {?}
- */
- Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
-
- /**
- * @type {?}
- */
- Globals.langChangeTrigger = ko.observable(true);
+ var Consts = {};
+
+ Consts.Values = {};
+ Consts.DataImages = {};
+ Consts.Defaults = {};
/**
+ * @const
* @type {number}
*/
- Globals.iAjaxErrorCount = 0;
+ Consts.Defaults.MessagesPerPage = 20;
/**
+ * @const
* @type {number}
*/
- Globals.iTokenErrorCount = 0;
+ Consts.Defaults.ContactsPerPage = 50;
/**
+ * @const
+ * @type {Array}
+ */
+ Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
+
+ /**
+ * @const
* @type {number}
*/
- Globals.iMessageBodyCacheCount = 0;
+ Consts.Defaults.DefaultAjaxTimeout = 30000;
/**
- * @type {boolean}
+ * @const
+ * @type {number}
*/
- Globals.bUnload = false;
+ Consts.Defaults.SearchAjaxTimeout = 300000;
/**
+ * @const
+ * @type {number}
+ */
+ Consts.Defaults.SendMessageAjaxTimeout = 300000;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Defaults.SaveMessageAjaxTimeout = 200000;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Defaults.ContactsSyncAjaxTimeout = 200000;
+
+ /**
+ * @const
* @type {string}
*/
- Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
-
- /**
- * @type {boolean}
- */
- Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
-
- /**
- * @type {boolean}
- */
- Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
-
- /**
- * @type {boolean}
- */
- Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
-
- /**
- * @type {boolean}
- */
- Globals.bDisableNanoScroll = Globals.bMobileDevice;
-
- /**
- * @type {boolean}
- */
- Globals.bAllowPdfPreview = !Globals.bMobileDevice;
-
- /**
- * @type {boolean}
- */
- Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
-
- /**
- * @type {boolean}
- */
- Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
+ Consts.Values.UnuseOptionValue = '__UNUSE__';
/**
+ * @const
* @type {string}
*/
- Globals.sAnimationType = '';
+ Consts.Values.ClientSideCookieIndexName = 'rlcsc';
/**
- * @type {Object}
+ * @const
+ * @type {number}
*/
- Globals.oHtmlEditorDefaultConfig = {
- 'title': false,
- 'stylesSet': false,
- 'customConfig': '',
- 'contentsCss': '',
- 'toolbarGroups': [
- {name: 'spec'},
- {name: 'styles'},
- {name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
- {name: 'colors'},
- {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']},
- {name: 'links'},
- {name: 'insert'},
- {name: 'others'}
- // {name: 'document', groups: ['mode', 'document', 'doctools']}
- ],
-
- 'removePlugins': 'contextmenu', //blockquote
- 'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll',
- 'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
-
- 'extraPlugins': 'plain',
-
- 'allowedContent': true,
- 'autoParagraph': false,
-
- 'font_defaultLabel': 'Arial',
- 'fontSize_defaultLabel': '13',
- 'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
- };
+ Consts.Values.ImapDefaulPort = 143;
/**
- * @type {Object}
+ * @const
+ * @type {number}
*/
- Globals.oHtmlEditorLangsMap = {
- 'de': 'de',
- 'es': 'es',
- 'fr': 'fr',
- 'hu': 'hu',
- 'is': 'is',
- 'it': 'it',
- 'ko': 'ko',
- 'ko-kr': 'ko',
- 'lv': 'lv',
- 'nl': 'nl',
- 'no': 'no',
- 'pl': 'pl',
- 'pt': 'pt',
- 'pt-pt': 'pt',
- 'pt-br': 'pt-br',
- 'ru': 'ru',
- 'ro': 'ro',
- 'zh': 'zh',
- 'zh-cn': 'zh-cn'
- };
+ Consts.Values.ImapDefaulSecurePort = 993;
- if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
- {
- Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
- return oType && 'application/pdf' === oType.type;
- });
- }
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.SmtpDefaulPort = 25;
- Globals.oI18N = {},
-
- Globals.oNotificationI18N = {},
-
- Globals.aBootstrapDropdowns = [],
-
- Globals.aViewModels = {
- 'settings': [],
- 'settings-removed': [],
- 'settings-disabled': []
- };
-
- module.exports = Globals;
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.SmtpDefaulSecurePort = 465;
-}(module));
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.MessageBodyCacheLimit = 15;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.AjaxErrorLimit = 7;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.TokenErrorLimit = 10;
+
+ /**
+ * @const
+ * @type {string}
+ */
+ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=';
+
+ /**
+ * @const
+ * @type {string}
+ */
+ Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
+
+ module.exports = Consts;
+
+}(module, require));
+},{}],17:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
@@ -623,35 +2617,823 @@
module.exports = Enums;
-}(module));
+}(module, require));
+},{}],18:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+
+ Utils = require('Utils'),
+ Plugins = require('Plugins')
+ ;
+
+ /**
+ * @constructor
+ */
+ function Events()
+ {
+ this.oSubs = {};
+ }
+
+ Events.prototype.oSubs = {};
+
+ /**
+ * @param {string} sName
+ * @param {Function} fFunc
+ * @param {Object=} oContext
+ * @return {Events}
+ */
+ Events.prototype.sub = function (sName, fFunc, oContext)
+ {
+ if (Utils.isUnd(this.oSubs[sName]))
+ {
+ this.oSubs[sName] = [];
+ }
+
+ this.oSubs[sName].push([fFunc, oContext]);
+
+ return this;
+ };
+
+ /**
+ * @param {string} sName
+ * @param {Array=} aArgs
+ * @return {Events}
+ */
+ Events.prototype.pub = function (sName, aArgs)
+ {
+ Plugins.runHook('rl-pub', [sName, aArgs]);
+
+ if (!Utils.isUnd(this.oSubs[sName]))
+ {
+ _.each(this.oSubs[sName], function (aItem) {
+ if (aItem[0])
+ {
+ aItem[0].apply(aItem[1] || null, aArgs || []);
+ }
+ });
+ }
+
+ return this;
+ };
+
+ module.exports = new Events();
+
+}(module, require));
+},{"Plugins":21,"Utils":22,"_":37}],19:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ Globals = {},
+ window = require('window'),
+ ko = require('ko'),
+ key = require('key'),
+ $html = require('$html'),
+
+ Enums = require('Enums')
+ ;
+
+ /**
+ * @type {?}
+ */
+ Globals.now = (new window.Date()).getTime();
+
+ /**
+ * @type {?}
+ */
+ Globals.momentTrigger = ko.observable(true);
+
+ /**
+ * @type {?}
+ */
+ Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
+
+ /**
+ * @type {?}
+ */
+ Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
+
+ /**
+ * @type {?}
+ */
+ Globals.langChangeTrigger = ko.observable(true);
+
+ /**
+ * @type {boolean}
+ */
+ Globals.useKeyboardShortcuts = ko.observable(true);
+
+ /**
+ * @type {number}
+ */
+ Globals.iAjaxErrorCount = 0;
+
+ /**
+ * @type {number}
+ */
+ Globals.iTokenErrorCount = 0;
+
+ /**
+ * @type {number}
+ */
+ Globals.iMessageBodyCacheCount = 0;
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bUnload = false;
+
+ /**
+ * @type {string}
+ */
+ Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bDisableNanoScroll = Globals.bMobileDevice;
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bAllowPdfPreview = !Globals.bMobileDevice;
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
+
+ /**
+ * @type {string}
+ */
+ Globals.sAnimationType = '';
+
+ /**
+ * @type {*}
+ */
+ Globals.__RL = null;
+
+ /**
+ * @type {Object}
+ */
+ Globals.oHtmlEditorDefaultConfig = {
+ 'title': false,
+ 'stylesSet': false,
+ 'customConfig': '',
+ 'contentsCss': '',
+ 'toolbarGroups': [
+ {name: 'spec'},
+ {name: 'styles'},
+ {name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
+ {name: 'colors'},
+ {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']},
+ {name: 'links'},
+ {name: 'insert'},
+ {name: 'others'}
+ // {name: 'document', groups: ['mode', 'document', 'doctools']}
+ ],
+
+ 'removePlugins': 'contextmenu', //blockquote
+ 'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll',
+ 'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
+
+ 'extraPlugins': 'plain',
+
+ 'allowedContent': true,
+ 'autoParagraph': false,
+
+ 'font_defaultLabel': 'Arial',
+ 'fontSize_defaultLabel': '13',
+ 'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
+ };
+
+ /**
+ * @type {Object}
+ */
+ Globals.oHtmlEditorLangsMap = {
+ 'de': 'de',
+ 'es': 'es',
+ 'fr': 'fr',
+ 'hu': 'hu',
+ 'is': 'is',
+ 'it': 'it',
+ 'ko': 'ko',
+ 'ko-kr': 'ko',
+ 'lv': 'lv',
+ 'nl': 'nl',
+ 'no': 'no',
+ 'pl': 'pl',
+ 'pt': 'pt',
+ 'pt-pt': 'pt',
+ 'pt-br': 'pt-br',
+ 'ru': 'ru',
+ 'ro': 'ro',
+ 'zh': 'zh',
+ 'zh-cn': 'zh-cn'
+ };
+
+ if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
+ {
+ Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
+ return oType && 'application/pdf' === oType.type;
+ });
+ }
+
+ Globals.oI18N = window['rainloopI18N'] || {};
+
+ Globals.oNotificationI18N = {};
+
+ Globals.aBootstrapDropdowns = [];
+
+ Globals.aViewModels = {
+ 'settings': [],
+ 'settings-removed': [],
+ 'settings-disabled': []
+ };
+
+ Globals.leftPanelDisabled = ko.observable(false);
+
+ // popups
+ Globals.popupVisibilityNames = ko.observableArray([]);
+
+ Globals.popupVisibility = ko.computed(function () {
+ return 0 < Globals.popupVisibilityNames().length;
+ }, this);
+
+ // keys
+ Globals.keyScopeReal = ko.observable(Enums.KeyState.All);
+ Globals.keyScopeFake = ko.observable(Enums.KeyState.All);
+
+ Globals.keyScope = ko.computed({
+ 'owner': this,
+ 'read': function () {
+ return Globals.keyScopeFake();
+ },
+ 'write': function (sValue) {
+
+ if (Enums.KeyState.Menu !== sValue)
+ {
+ if (Enums.KeyState.Compose === sValue)
+ {
+ // disableKeyFilter
+ key.filter = function () {
+ return Globals.useKeyboardShortcuts();
+ };
+ }
+ else
+ {
+ // restoreKeyFilter
+ key.filter = function (event) {
+
+ if (Globals.useKeyboardShortcuts())
+ {
+ var
+ oElement = event.target || event.srcElement,
+ sTagName = oElement ? oElement.tagName : ''
+ ;
+
+ sTagName = sTagName.toUpperCase();
+ return !(sTagName === 'INPUT' || sTagName === 'SELECT' || sTagName === 'TEXTAREA' ||
+ (oElement && sTagName === 'DIV' && 'editorHtmlArea' === oElement.className && oElement.contentEditable)
+ );
+ }
+
+ return false;
+ };
+ }
+
+ Globals.keyScopeFake(sValue);
+ if (Globals.dropdownVisibility())
+ {
+ sValue = Enums.KeyState.Menu;
+ }
+ }
+
+ Globals.keyScopeReal(sValue);
+ }
+ });
+
+ Globals.keyScopeReal.subscribe(function (sValue) {
+// window.console.log(sValue);
+ key.setScope(sValue);
+ });
+
+ Globals.dropdownVisibility.subscribe(function (bValue) {
+ if (bValue)
+ {
+ Globals.tooltipTrigger(!Globals.tooltipTrigger());
+ Globals.keyScope(Enums.KeyState.Menu);
+ }
+ else if (Enums.KeyState.Menu === key.getScope())
+ {
+ Globals.keyScope(Globals.keyScopeFake());
+ }
+ });
+
+ module.exports = Globals;
+
+}(module, require));
+},{"$html":25,"Enums":17,"key":33,"ko":34,"window":38}],20:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
'use strict';
var
- Utils = {},
-
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- key = require('../External/key.js'),
- window = require('../External/window.js'),
- $window = require('../External/$window.js'),
- $doc = require('../External/$doc.js'),
- NotificationClass = require('../External/NotificationClass.js'),
-
- LocalStorage = require('../Storages/LocalStorage.js'),
-
- kn = require('../Knoin/Knoin.js'),
-
- Enums = require('./Enums.js'),
- Globals = require('./Globals.js')
+ window = require('window'),
+ Utils = require('Utils')
;
- window.console.log('---');
- window.console.log(_);
+ /**
+ * @constructor
+ */
+ function LinkBuilder()
+ {
+ var AppSettings = require('../Storages/AppSettings.js');
+
+ this.sBase = '#/';
+ this.sServer = './?';
+ this.sVersion = AppSettings.settingsGet('Version');
+ this.sSpecSuffix = AppSettings.settingsGet('AuthAccountHash') || '0';
+ this.sStaticPrefix = AppSettings.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
+ }
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.root = function ()
+ {
+ return this.sBase;
+ };
+
+ /**
+ * @param {string} sDownload
+ * @return {string}
+ */
+ LinkBuilder.prototype.attachmentDownload = function (sDownload)
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
+ };
+
+ /**
+ * @param {string} sDownload
+ * @return {string}
+ */
+ LinkBuilder.prototype.attachmentPreview = function (sDownload)
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
+ };
+
+ /**
+ * @param {string} sDownload
+ * @return {string}
+ */
+ LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.upload = function ()
+ {
+ return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.uploadContacts = function ()
+ {
+ return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.uploadBackground = function ()
+ {
+ return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.append = function ()
+ {
+ return this.sServer + '/Append/' + this.sSpecSuffix + '/';
+ };
+
+ /**
+ * @param {string} sEmail
+ * @return {string}
+ */
+ LinkBuilder.prototype.change = function (sEmail)
+ {
+ return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
+ };
+
+ /**
+ * @param {string=} sAdd
+ * @return {string}
+ */
+ LinkBuilder.prototype.ajax = function (sAdd)
+ {
+ return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
+ };
+
+ /**
+ * @param {string} sRequestHash
+ * @return {string}
+ */
+ LinkBuilder.prototype.messageViewLink = function (sRequestHash)
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
+ };
+
+ /**
+ * @param {string} sRequestHash
+ * @return {string}
+ */
+ LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
+ };
+
+ /**
+ * @param {string} sEmail
+ * @return {string}
+ */
+ LinkBuilder.prototype.avatarLink = function (sEmail)
+ {
+ return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
+ // return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.inbox = function ()
+ {
+ return this.sBase + 'mailbox/Inbox';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.messagePreview = function ()
+ {
+ return this.sBase + 'mailbox/message-preview';
+ };
+
+ /**
+ * @param {string=} sScreenName
+ * @return {string}
+ */
+ LinkBuilder.prototype.settings = function (sScreenName)
+ {
+ var sResult = this.sBase + 'settings';
+ if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
+ {
+ sResult += '/' + sScreenName;
+ }
+
+ return sResult;
+ };
+
+ /**
+ * @param {string} sScreenName
+ * @return {string}
+ */
+ LinkBuilder.prototype.admin = function (sScreenName)
+ {
+ var sResult = this.sBase;
+ switch (sScreenName) {
+ case 'AdminDomains':
+ sResult += 'domains';
+ break;
+ case 'AdminSecurity':
+ sResult += 'security';
+ break;
+ case 'AdminLicensing':
+ sResult += 'licensing';
+ break;
+ }
+
+ return sResult;
+ };
+
+ /**
+ * @param {string} sFolder
+ * @param {number=} iPage = 1
+ * @param {string=} sSearch = ''
+ * @return {string}
+ */
+ LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
+ {
+ iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
+ sSearch = Utils.pString(sSearch);
+
+ var sResult = this.sBase + 'mailbox/';
+ if ('' !== sFolder)
+ {
+ sResult += encodeURI(sFolder);
+ }
+ if (1 < iPage)
+ {
+ sResult = sResult.replace(/[\/]+$/, '');
+ sResult += '/p' + iPage;
+ }
+ if ('' !== sSearch)
+ {
+ sResult = sResult.replace(/[\/]+$/, '');
+ sResult += '/' + encodeURI(sSearch);
+ }
+
+ return sResult;
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.phpInfo = function ()
+ {
+ return this.sServer + 'Info';
+ };
+
+ /**
+ * @param {string} sLang
+ * @return {string}
+ */
+ LinkBuilder.prototype.langLink = function (sLang)
+ {
+ return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.exportContactsVcf = function ()
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.exportContactsCsv = function ()
+ {
+ return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.emptyContactPic = function ()
+ {
+ return this.sStaticPrefix + 'css/images/empty-contact.png';
+ };
+
+ /**
+ * @param {string} sFileName
+ * @return {string}
+ */
+ LinkBuilder.prototype.sound = function (sFileName)
+ {
+ return this.sStaticPrefix + 'sounds/' + sFileName;
+ };
+
+ /**
+ * @param {string} sTheme
+ * @return {string}
+ */
+ LinkBuilder.prototype.themePreviewLink = function (sTheme)
+ {
+ var sPrefix = 'rainloop/v/' + this.sVersion + '/';
+ if ('@custom' === sTheme.substr(-7))
+ {
+ sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
+ sPrefix = '';
+ }
+
+ return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.notificationMailIcon = function ()
+ {
+ return this.sStaticPrefix + 'css/images/icom-message-notification.png';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.openPgpJs = function ()
+ {
+ return this.sStaticPrefix + 'js/openpgp.min.js';
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.socialGoogle = function ()
+ {
+ return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.socialTwitter = function ()
+ {
+ return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.socialFacebook = function ()
+ {
+ return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
+ };
+
+ module.exports = new LinkBuilder();
+
+}(module, require));
+},{"../Storages/AppSettings.js":54,"Utils":22,"window":38}],21:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ Plugins = {
+ __boot: null,
+ __remote: null,
+ __data: null
+ },
+ _ = require('_'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @type {Object}
+ */
+ Plugins.oViewModelsHooks = {};
+
+ /**
+ * @type {Object}
+ */
+ Plugins.oSimpleHooks = {};
+
+ /**
+ * @param {string} sName
+ * @param {Function} ViewModel
+ */
+ Plugins.regViewModelHook = function (sName, ViewModel)
+ {
+ if (ViewModel)
+ {
+ ViewModel.__hookName = sName;
+ }
+ };
+
+ /**
+ * @param {string} sName
+ * @param {Function} fCallback
+ */
+ Plugins.addHook = function (sName, fCallback)
+ {
+ if (Utils.isFunc(fCallback))
+ {
+ if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
+ {
+ Plugins.oSimpleHooks[sName] = [];
+ }
+
+ Plugins.oSimpleHooks[sName].push(fCallback);
+ }
+ };
+
+ /**
+ * @param {string} sName
+ * @param {Array=} aArguments
+ */
+ Plugins.runHook = function (sName, aArguments)
+ {
+ if (Utils.isArray(Plugins.oSimpleHooks[sName]))
+ {
+ aArguments = aArguments || [];
+
+ _.each(Plugins.oSimpleHooks[sName], function (fCallback) {
+ fCallback.apply(null, aArguments);
+ });
+ }
+ };
+
+ /**
+ * @param {string} sName
+ * @return {?}
+ */
+ Plugins.mainSettingsGet = function (sName)
+ {
+ if (Plugins.__boot)
+ {
+ return Plugins.__boot.settingsGet(sName);
+ }
+
+ return null;
+ };
+
+ /**
+ * @param {Function} fCallback
+ * @param {string} sAction
+ * @param {Object=} oParameters
+ * @param {?number=} iTimeout
+ * @param {string=} sGetAdd = ''
+ * @param {Array=} aAbortActions = []
+ */
+ Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
+ {
+ if (Plugins.__remote)
+ {
+ Plugins.__remote.defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
+ }
+ };
+
+ /**
+ * @param {string} sPluginSection
+ * @param {string} sName
+ * @return {?}
+ */
+ Plugins.settingsGet = function (sPluginSection, sName)
+ {
+ var oPlugin = Plugins.mainSettingsGet('Plugins');
+ oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
+ return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
+ };
+
+ module.exports = Plugins;
+
+}(module, require));
+},{"Utils":22,"_":37}],22:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ Utils = {},
+
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ window = require('window'),
+ $window = require('$window'),
+ $html = require('$html'),
+ $div = require('$div'),
+ $doc = require('$doc'),
+ NotificationClass = require('NotificationClass'),
+
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Globals = require('Globals')
+ ;
Utils.trim = $.trim;
Utils.inArray = $.inArray;
@@ -783,24 +3565,24 @@
Utils.exportPath = function (sPath, oObject, oObjectToExportTo)
{
var
- part = null,
- parts = sPath.split('.'),
- cur = oObjectToExportTo || window
+ sPart = null,
+ aParts = sPath.split('.'),
+ oCur = oObjectToExportTo || window
;
- for (; parts.length && (part = parts.shift());)
+ for (; aParts.length && (sPart = aParts.shift());)
{
- if (!parts.length && !Utils.isUnd(oObject))
+ if (!aParts.length && !Utils.isUnd(oObject))
{
- cur[part] = oObject;
+ oCur[sPart] = oObject;
}
- else if (cur[part])
+ else if (oCur[sPart])
{
- cur = cur[part];
+ oCur = oCur[sPart];
}
else
{
- cur = cur[part] = {};
+ oCur = oCur[sPart] = {};
}
}
};
@@ -1051,15 +3833,15 @@
if (window['rainloopI18N'])
{
Globals.oI18N = window['rainloopI18N'] || {};
-
+
Utils.i18nToNode($doc);
-
+
Globals.langChangeTrigger(!Globals.langChangeTrigger());
}
window['rainloopI18N'] = null;
};
-
+
/**
* @param {Function} fCallback
* @param {Object} oScope
@@ -1094,14 +3876,14 @@
*/
Utils.inFocus = function ()
{
- if (document.activeElement)
+ if (window.document.activeElement)
{
- if (Utils.isUnd(document.activeElement.__inFocusCache))
+ if (Utils.isUnd(window.document.activeElement.__inFocusCache))
{
- document.activeElement.__inFocusCache = $(document.activeElement).is('input,textarea,iframe,.cke_editable');
+ window.document.activeElement.__inFocusCache = $(window.document.activeElement).is('input,textarea,iframe,.cke_editable');
}
- return !!document.activeElement.__inFocusCache;
+ return !!window.document.activeElement.__inFocusCache;
}
return false;
@@ -1109,12 +3891,12 @@
Utils.removeInFocus = function ()
{
- if (document && document.activeElement && document.activeElement.blur)
+ if (window.document && window.document.activeElement && window.document.activeElement.blur)
{
- var oA = $(document.activeElement);
+ var oA = $(window.document.activeElement);
if (oA.is('input,textarea'))
{
- document.activeElement.blur();
+ window.document.activeElement.blur();
}
}
};
@@ -1129,9 +3911,9 @@
oSel.removeAllRanges();
}
}
- else if (document && document.selection && document.selection.empty)
+ else if (window.document && window.document.selection && window.document.selection.empty)
{
- document.selection.empty();
+ window.document.selection.empty();
}
};
@@ -1551,11 +4333,14 @@
{
var
fResult = fExecute ? function () {
- if (fResult.canExecute && fResult.canExecute())
+
+ if (fResult && fResult.canExecute && fResult.canExecute())
{
fExecute.apply(oContext, Array.prototype.slice.call(arguments));
}
+
return false;
+
} : function () {}
;
@@ -1870,112 +4655,6 @@
}, oObject);
};
- /**
- * @param {string} sFullNameHash
- * @return {boolean}
- */
- Utils.isFolderExpanded = function (sFullNameHash)
- {
- var aExpandedList = /** @type {Array|null} */ LocalStorage.get(Enums.ClientSideKeyName.ExpandedFolders);
- return _.isArray(aExpandedList) && -1 !== _.indexOf(aExpandedList, sFullNameHash);
- };
-
- /**
- * @param {string} sFullNameHash
- * @param {boolean} bExpanded
- */
- Utils.setExpandedFolder = function (sFullNameHash, bExpanded)
- {
- var aExpandedList = /** @type {Array|null} */ LocalStorage.get(Enums.ClientSideKeyName.ExpandedFolders);
- if (!_.isArray(aExpandedList))
- {
- aExpandedList = [];
- }
-
- if (bExpanded)
- {
- aExpandedList.push(sFullNameHash);
- aExpandedList = _.uniq(aExpandedList);
- }
- else
- {
- aExpandedList = _.without(aExpandedList, sFullNameHash);
- }
-
- LocalStorage.set(Enums.ClientSideKeyName.ExpandedFolders, aExpandedList);
- };
-
- Utils.initLayoutResizer = function (sLeft, sRight, sClientSideKeyName)
- {
- var
- iDisabledWidth = 60,
- iMinWidth = 155,
- oLeft = $(sLeft),
- oRight = $(sRight),
-
- mLeftWidth = LocalStorage.get(sClientSideKeyName) || null,
-
- fSetWidth = function (iWidth) {
- if (iWidth)
- {
- oLeft.css({
- 'width': '' + iWidth + 'px'
- });
-
- oRight.css({
- 'left': '' + iWidth + 'px'
- });
- }
- },
-
- fDisable = function (bDisable) {
- if (bDisable)
- {
- oLeft.resizable('disable');
- fSetWidth(iDisabledWidth);
- }
- else
- {
- oLeft.resizable('enable');
- var iWidth = Utils.pInt(LocalStorage.get(sClientSideKeyName)) || iMinWidth;
- fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth);
- }
- },
-
- fResizeFunction = function (oEvent, oObject) {
- if (oObject && oObject.size && oObject.size.width)
- {
- LocalStorage.set(sClientSideKeyName, oObject.size.width);
-
- oRight.css({
- 'left': '' + oObject.size.width + 'px'
- });
- }
- }
- ;
-
- if (null !== mLeftWidth)
- {
- fSetWidth(mLeftWidth > iMinWidth ? mLeftWidth : iMinWidth);
- }
-
- oLeft.resizable({
- 'helper': 'ui-resizable-helper',
- 'minWidth': iMinWidth,
- 'maxWidth': 350,
- 'handles': 'e',
- 'stop': fResizeFunction
- });
-
- RL.sub('left-panel.off', function () {
- fDisable(true);
- });
-
- RL.sub('left-panel.on', function () {
- fDisable(false);
- });
- };
-
/**
* @param {Object} oMessageTextBody
*/
@@ -2155,7 +4834,10 @@
Utils.i18nToNode(oBody);
- kn.applyExternal(oViewModel, $('#rl-content', oBody)[0]);
+ if (oViewModel && $('#rl-content', oBody)[0])
+ {
+ ko.applyBindings(oViewModel, $('#rl-content', oBody)[0]);
+ }
window[sFunc] = null;
@@ -2201,8 +4883,6 @@
return Utils.settingsSaveHelperFunction(null, koTrigger, oContext, 1000);
};
- Utils.$div = $('');
-
/**
* @param {string} sHtml
* @return {string}
@@ -2311,7 +4991,7 @@
.replace(/<[^>]*>/gm, '')
;
- sText = Utils.$div.html(sText).text();
+ sText = $div.html(sText).text();
sText = sText
.replace(/\n[ \t]+/gm, '\n')
@@ -2448,7 +5128,7 @@
{
if ($.fn && $.fn.linkify)
{
- sHtml = Utils.$div.html(sHtml.replace(/&/ig, 'amp_amp_12345_amp_amp'))
+ sHtml = $div.html(sHtml.replace(/&/ig, 'amp_amp_12345_amp_amp'))
.linkify()
.find('.linkified').removeClass('linkified').end()
.html()
@@ -2466,7 +5146,7 @@
var
aDiff = [0, 0],
- oCanvas = document.createElement('canvas'),
+ oCanvas = window.document.createElement('canvas'),
oCtx = oCanvas.getContext('2d')
;
@@ -2492,6 +5172,135 @@
oTempImg.src = sUrl;
};
+ /**
+ * @param {Array} aSystem
+ * @param {Array} aList
+ * @param {Array=} aDisabled
+ * @param {Array=} aHeaderLines
+ * @param {?number=} iUnDeep
+ * @param {Function=} fDisableCallback
+ * @param {Function=} fVisibleCallback
+ * @param {Function=} fRenameCallback
+ * @param {boolean=} bSystem
+ * @param {boolean=} bBuildUnvisible
+ * @return {Array}
+ */
+ Utils.folderListOptionsBuilder = function (aSystem, aList, aDisabled, aHeaderLines, iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
+ {
+ var
+ /**
+ * @type {?FolderModel}
+ */
+ oItem = null,
+ bSep = false,
+ iIndex = 0,
+ iLen = 0,
+ sDeepPrefix = '\u00A0\u00A0\u00A0',
+ aResult = []
+ ;
+
+ bSystem = !Utils.isNormal(bSystem) ? 0 < aSystem.length : bSystem;
+ bBuildUnvisible = Utils.isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible;
+ iUnDeep = !Utils.isNormal(iUnDeep) ? 0 : iUnDeep;
+ fDisableCallback = Utils.isNormal(fDisableCallback) ? fDisableCallback : null;
+ fVisibleCallback = Utils.isNormal(fVisibleCallback) ? fVisibleCallback : null;
+ fRenameCallback = Utils.isNormal(fRenameCallback) ? fRenameCallback : null;
+
+ if (!Utils.isArray(aDisabled))
+ {
+ aDisabled = [];
+ }
+
+ if (!Utils.isArray(aHeaderLines))
+ {
+ aHeaderLines = [];
+ }
+
+ for (iIndex = 0, iLen = aHeaderLines.length; iIndex < iLen; iIndex++)
+ {
+ aResult.push({
+ 'id': aHeaderLines[iIndex][0],
+ 'name': aHeaderLines[iIndex][1],
+ 'system': false,
+ 'seporator': false,
+ 'disabled': false
+ });
+ }
+
+ bSep = true;
+ for (iIndex = 0, iLen = aSystem.length; iIndex < iLen; iIndex++)
+ {
+ oItem = aSystem[iIndex];
+ if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
+ {
+ if (bSep && 0 < aResult.length)
+ {
+ aResult.push({
+ 'id': '---',
+ 'name': '---',
+ 'system': false,
+ 'seporator': true,
+ 'disabled': true
+ });
+ }
+
+ bSep = false;
+ aResult.push({
+ 'id': oItem.fullNameRaw,
+ 'name': fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name(),
+ 'system': true,
+ 'seporator': false,
+ 'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) ||
+ (fDisableCallback ? fDisableCallback.call(null, oItem) : false)
+ });
+ }
+ }
+
+ bSep = true;
+ for (iIndex = 0, iLen = aList.length; iIndex < iLen; iIndex++)
+ {
+ oItem = aList[iIndex];
+ if (oItem.subScribed() || !oItem.existen)
+ {
+ if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
+ {
+ if (Enums.FolderType.User === oItem.type() || !bSystem || 0 < oItem.subFolders().length)
+ {
+ if (bSep && 0 < aResult.length)
+ {
+ aResult.push({
+ 'id': '---',
+ 'name': '---',
+ 'system': false,
+ 'seporator': true,
+ 'disabled': true
+ });
+ }
+
+ bSep = false;
+ aResult.push({
+ 'id': oItem.fullNameRaw,
+ 'name': (new window.Array(oItem.deep + 1 - iUnDeep)).join(sDeepPrefix) +
+ (fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name()),
+ 'system': false,
+ 'seporator': false,
+ 'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) ||
+ (fDisableCallback ? fDisableCallback.call(null, oItem) : false)
+ });
+ }
+ }
+ }
+
+ if (oItem.subScribed() && 0 < oItem.subFolders().length)
+ {
+ aResult = aResult.concat(Utils.folderListOptionsBuilder([], oItem.subFolders(), aDisabled, [],
+ iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible));
+ }
+ }
+
+ return aResult;
+ };
+
Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
{
return function() {
@@ -2626,40 +5435,6 @@
/* jshint onevar: true */
};
- Utils.disableKeyFilter = function (Data)
- {
- if (window.key)
- {
- key.filter = function () {
- return Data.useKeyboardShortcuts();
- };
- }
- };
-
- Utils.restoreKeyFilter = function (Data)
- {
- if (window.key)
- {
- key.filter = function (event) {
-
- if (Data.useKeyboardShortcuts())
- {
- var
- oElement = event.target || event.srcElement,
- sTagName = oElement ? oElement.tagName : ''
- ;
-
- sTagName = sTagName.toUpperCase();
- return !(sTagName === 'INPUT' || sTagName === 'SELECT' || sTagName === 'TEXTAREA' ||
- (oElement && sTagName === 'DIV' && 'editorHtmlArea' === oElement.className && oElement.contentEditable)
- );
- }
-
- return false;
- };
- }
- };
-
Utils.detectDropdownVisibility = _.debounce(function () {
Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) {
return oItem.hasClass('open');
@@ -2684,876 +5459,997 @@
module.exports = Utils;
-}(module));
-// Base64 encode / decode
-// http://www.webtoolkit.info/
-
-(function (module) {
-
- 'use strict';
-
- /*jslint bitwise: true*/
- var Base64 = {
-
- // private property
- _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
-
- // public method for urlsafe encoding
- urlsafe_encode : function (input) {
- return Base64.encode(input).replace(/[+]/g, '-').replace(/[\/]/g, '_').replace(/[=]/g, '.');
- },
-
- // public method for encoding
- encode : function (input) {
- var
- output = '',
- chr1, chr2, chr3, enc1, enc2, enc3, enc4,
- i = 0
- ;
-
- input = Base64._utf8_encode(input);
-
- while (i < input.length)
- {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
-
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
-
- if (isNaN(chr2))
- {
- enc3 = enc4 = 64;
- }
- else if (isNaN(chr3))
- {
- enc4 = 64;
- }
-
- output = output +
- this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
- this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
- }
-
- return output;
- },
-
- // public method for decoding
- decode : function (input) {
- var
- output = '',
- chr1, chr2, chr3, enc1, enc2, enc3, enc4,
- i = 0
- ;
-
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
-
- while (i < input.length)
- {
- enc1 = this._keyStr.indexOf(input.charAt(i++));
- enc2 = this._keyStr.indexOf(input.charAt(i++));
- enc3 = this._keyStr.indexOf(input.charAt(i++));
- enc4 = this._keyStr.indexOf(input.charAt(i++));
-
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
-
- output = output + String.fromCharCode(chr1);
-
- if (enc3 !== 64)
- {
- output = output + String.fromCharCode(chr2);
- }
-
- if (enc4 !== 64)
- {
- output = output + String.fromCharCode(chr3);
- }
- }
-
- return Base64._utf8_decode(output);
- },
-
- // private method for UTF-8 encoding
- _utf8_encode : function (string) {
-
- string = string.replace(/\r\n/g, "\n");
-
- var
- utftext = '',
- n = 0,
- l = string.length,
- c = 0
- ;
-
- for (; n < l; n++) {
-
- c = string.charCodeAt(n);
-
- if (c < 128)
- {
- utftext += String.fromCharCode(c);
- }
- else if ((c > 127) && (c < 2048))
- {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- else
- {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
- }
-
- return utftext;
- },
-
- // private method for UTF-8 decoding
- _utf8_decode : function (utftext) {
- var
- string = '',
- i = 0,
- c = 0,
- c2 = 0,
- c3 = 0
- ;
-
- while ( i < utftext.length )
- {
- c = utftext.charCodeAt(i);
-
- if (c < 128)
- {
- string += String.fromCharCode(c);
- i++;
- }
- else if((c > 191) && (c < 224))
- {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- }
- else
- {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
-
- return string;
- }
- };
-
- module.exports = Base64;
- /*jslint bitwise: false*/
-
-}(module));
+}(module, require));
+},{"$":32,"$div":23,"$doc":24,"$html":25,"$window":26,"Consts":16,"Enums":17,"Globals":19,"NotificationClass":29,"_":37,"ko":34,"window":38}],23:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+module.exports = require('$')('');
+},{"$":32}],24:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = require('$')(window.document);
+},{"$":32}],25:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = require('$')('html');
+},{"$":32}],26:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = require('$')(window);
+},{"$":32}],27:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = require('window')['rainloopAppData'] || {};
+},{"window":38}],28:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = JSON;
+},{}],29:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+var w = require('window');
+module.exports = w.Notification && w.Notification.requestPermission ? w.Notification : null;
+},{"window":38}],30:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = crossroads;
+},{}],31:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = hasher;
+},{}],32:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = $;
+},{}],33:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = key;
+},{}],34:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, ko) {
'use strict';
-
- var
- window = require('../External/window.js'),
- Utils = require('./Utils.js')
- ;
- /**
- * @constructor
- */
- function LinkBuilder()
- {
- this.sBase = '#/';
- this.sServer = './?';
- this.sVersion = RL.settingsGet('Version');
- this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
- this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
- }
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.root = function ()
- {
- return this.sBase;
- };
-
- /**
- * @param {string} sDownload
- * @return {string}
- */
- LinkBuilder.prototype.attachmentDownload = function (sDownload)
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
- };
-
- /**
- * @param {string} sDownload
- * @return {string}
- */
- LinkBuilder.prototype.attachmentPreview = function (sDownload)
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
- };
-
- /**
- * @param {string} sDownload
- * @return {string}
- */
- LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.upload = function ()
- {
- return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.uploadContacts = function ()
- {
- return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.uploadBackground = function ()
- {
- return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.append = function ()
- {
- return this.sServer + '/Append/' + this.sSpecSuffix + '/';
- };
-
- /**
- * @param {string} sEmail
- * @return {string}
- */
- LinkBuilder.prototype.change = function (sEmail)
- {
- return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
- };
-
- /**
- * @param {string=} sAdd
- * @return {string}
- */
- LinkBuilder.prototype.ajax = function (sAdd)
- {
- return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
- };
-
- /**
- * @param {string} sRequestHash
- * @return {string}
- */
- LinkBuilder.prototype.messageViewLink = function (sRequestHash)
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
- };
-
- /**
- * @param {string} sRequestHash
- * @return {string}
- */
- LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
- };
-
- /**
- * @param {string} sEmail
- * @return {string}
- */
- LinkBuilder.prototype.avatarLink = function (sEmail)
- {
- return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
- // return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.inbox = function ()
- {
- return this.sBase + 'mailbox/Inbox';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.messagePreview = function ()
- {
- return this.sBase + 'mailbox/message-preview';
- };
-
- /**
- * @param {string=} sScreenName
- * @return {string}
- */
- LinkBuilder.prototype.settings = function (sScreenName)
- {
- var sResult = this.sBase + 'settings';
- if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
- {
- sResult += '/' + sScreenName;
- }
-
- return sResult;
- };
-
- /**
- * @param {string} sScreenName
- * @return {string}
- */
- LinkBuilder.prototype.admin = function (sScreenName)
- {
- var sResult = this.sBase;
- switch (sScreenName) {
- case 'AdminDomains':
- sResult += 'domains';
- break;
- case 'AdminSecurity':
- sResult += 'security';
- break;
- case 'AdminLicensing':
- sResult += 'licensing';
- break;
- }
-
- return sResult;
- };
-
- /**
- * @param {string} sFolder
- * @param {number=} iPage = 1
- * @param {string=} sSearch = ''
- * @return {string}
- */
- LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
- {
- iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
- sSearch = Utils.pString(sSearch);
-
- var sResult = this.sBase + 'mailbox/';
- if ('' !== sFolder)
- {
- sResult += encodeURI(sFolder);
- }
- if (1 < iPage)
- {
- sResult = sResult.replace(/[\/]+$/, '');
- sResult += '/p' + iPage;
- }
- if ('' !== sSearch)
- {
- sResult = sResult.replace(/[\/]+$/, '');
- sResult += '/' + encodeURI(sSearch);
- }
-
- return sResult;
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.phpInfo = function ()
- {
- return this.sServer + 'Info';
- };
-
- /**
- * @param {string} sLang
- * @return {string}
- */
- LinkBuilder.prototype.langLink = function (sLang)
- {
- return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.exportContactsVcf = function ()
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.exportContactsCsv = function ()
- {
- return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.emptyContactPic = function ()
- {
- return this.sStaticPrefix + 'css/images/empty-contact.png';
- };
-
- /**
- * @param {string} sFileName
- * @return {string}
- */
- LinkBuilder.prototype.sound = function (sFileName)
- {
- return this.sStaticPrefix + 'sounds/' + sFileName;
- };
-
- /**
- * @param {string} sTheme
- * @return {string}
- */
- LinkBuilder.prototype.themePreviewLink = function (sTheme)
- {
- var sPrefix = 'rainloop/v/' + this.sVersion + '/';
- if ('@custom' === sTheme.substr(-7))
- {
- sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
- sPrefix = '';
- }
-
- return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.notificationMailIcon = function ()
- {
- return this.sStaticPrefix + 'css/images/icom-message-notification.png';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.openPgpJs = function ()
- {
- return this.sStaticPrefix + 'js/openpgp.min.js';
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.socialGoogle = function ()
- {
- return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.socialTwitter = function ()
- {
- return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.socialFacebook = function ()
- {
- return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
- };
-
- module.exports = new LinkBuilder();
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
var
- Plugins = {
- __boot: null,
- __remote: null,
- __data: null
- },
- _ = require('../External/underscore.js'),
- Utils = require('./Utils.js')
+ window = require('window'),
+ _ = require('_'),
+ $ = require('$'),
+ $window = require('$window'),
+ $doc = require('$doc')
;
- /**
- * @type {Object}
- */
- Plugins.oViewModelsHooks = {};
+ ko.bindingHandlers.tooltip = {
+ 'init': function (oElement, fValueAccessor) {
- /**
- * @type {Object}
- */
- Plugins.oSimpleHooks = {};
+ var
+ Globals = require('Globals'),
+ Utils = require('Utils')
+ ;
- /**
- * @param {string} sName
- * @param {Function} ViewModel
- */
- Plugins.regViewModelHook = function (sName, ViewModel)
- {
- if (ViewModel)
- {
- ViewModel.__hookName = sName;
- }
- };
-
- /**
- * @param {string} sName
- * @param {Function} fCallback
- */
- Plugins.addHook = function (sName, fCallback)
- {
- if (Utils.isFunc(fCallback))
- {
- if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
+ if (!Globals.bMobileDevice)
{
- Plugins.oSimpleHooks[sName] = [];
- }
+ var
+ $oEl = $(oElement),
+ sClass = $oEl.data('tooltip-class') || '',
+ sPlacement = $oEl.data('tooltip-placement') || 'top'
+ ;
- Plugins.oSimpleHooks[sName].push(fCallback);
+ $oEl.tooltip({
+ 'delay': {
+ 'show': 500,
+ 'hide': 100
+ },
+ 'html': true,
+ 'container': 'body',
+ 'placement': sPlacement,
+ 'trigger': 'hover',
+ 'title': function () {
+ return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : '' +
+ Utils.i18n(ko.utils.unwrapObservable(fValueAccessor())) + '';
+ }
+ }).click(function () {
+ $oEl.tooltip('hide');
+ });
+
+ Globals.tooltipTrigger.subscribe(function () {
+ $oEl.tooltip('hide');
+ });
+ }
}
};
- /**
- * @param {string} sName
- * @param {Array=} aArguments
- */
- Plugins.runHook = function (sName, aArguments)
- {
- if (Utils.isArray(Plugins.oSimpleHooks[sName]))
- {
- aArguments = aArguments || [];
+ ko.bindingHandlers.tooltip2 = {
+ 'init': function (oElement, fValueAccessor) {
+ var
+ Globals = require('Globals'),
+ $oEl = $(oElement),
+ sClass = $oEl.data('tooltip-class') || '',
+ sPlacement = $oEl.data('tooltip-placement') || 'top'
+ ;
- _.each(Plugins.oSimpleHooks[sName], function (fCallback) {
- fCallback.apply(null, aArguments);
+ $oEl.tooltip({
+ 'delay': {
+ 'show': 500,
+ 'hide': 100
+ },
+ 'html': true,
+ 'container': 'body',
+ 'placement': sPlacement,
+ 'title': function () {
+ return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
+ '' + fValueAccessor()() + '';
+ }
+ }).click(function () {
+ $oEl.tooltip('hide');
+ });
+
+ Globals.tooltipTrigger.subscribe(function () {
+ $oEl.tooltip('hide');
});
}
};
- /**
- * @param {string} sName
- * @return {?}
- */
- Plugins.mainSettingsGet = function (sName)
- {
- if (Plugins.__boot)
- {
- return Plugins.__boot.settingsGet(sName);
- }
+ ko.bindingHandlers.tooltip3 = {
+ 'init': function (oElement) {
- return null;
- };
+ var
+ $oEl = $(oElement),
+ Globals = require('Globals')
+ ;
- /**
- * @param {Function} fCallback
- * @param {string} sAction
- * @param {Object=} oParameters
- * @param {?number=} iTimeout
- * @param {string=} sGetAdd = ''
- * @param {Array=} aAbortActions = []
- */
- Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
- {
- if (Plugins.__remote)
- {
- Plugins.__remote.defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
- }
- };
-
- /**
- * @param {string} sPluginSection
- * @param {string} sName
- * @return {?}
- */
- Plugins.settingsGet = function (sPluginSection, sName)
- {
- var oPlugin = Plugins.mainSettingsGet('Plugins');
- oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
- return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
- };
-
- module.exports = Plugins;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- $ = require('../../External/jquery.js'),
- JSON = require('../../External/JSON.js'),
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js')
- ;
-
- /**
- * @constructor
- */
- function CookieDriver()
- {
-
- }
-
- CookieDriver.supported = function ()
- {
- return true;
- };
-
- /**
- * @param {string} sKey
- * @param {*} mData
- * @returns {boolean}
- */
- CookieDriver.prototype.set = function (sKey, mData)
- {
- var
- mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
- bResult = false,
- mResult = null
- ;
-
- try
- {
- mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
- if (!mResult)
- {
- mResult = {};
- }
-
- mResult[sKey] = mData;
- $.cookie(Consts.Values.ClientSideCookieIndexName, JSON.stringify(mResult), {
- 'expires': 30
+ $oEl.tooltip({
+ 'container': 'body',
+ 'trigger': 'hover manual',
+ 'title': function () {
+ return $oEl.data('tooltip3-data') || '';
+ }
});
- bResult = true;
- }
- catch (oException) {}
+ $doc.click(function () {
+ $oEl.tooltip('hide');
+ });
- return bResult;
- };
-
- /**
- * @param {string} sKey
- * @returns {*}
- */
- CookieDriver.prototype.get = function (sKey)
- {
- var
- mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
- mResult = null
- ;
-
- try
- {
- mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
- if (mResult && !Utils.isUnd(mResult[sKey]))
+ Globals.tooltipTrigger.subscribe(function () {
+ $oEl.tooltip('hide');
+ });
+ },
+ 'update': function (oElement, fValueAccessor) {
+ var sValue = ko.utils.unwrapObservable(fValueAccessor());
+ if ('' === sValue)
{
- mResult = mResult[sKey];
+ $(oElement).data('tooltip3-data', '').tooltip('hide');
}
else
{
- mResult = null;
+ $(oElement).data('tooltip3-data', sValue).tooltip('show');
}
}
- catch (oException) {}
-
- return mResult;
};
- module.exports = CookieDriver;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- window = require('../../External/window.js'),
- JSON = require('../../External/JSON.js'),
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js')
- ;
-
- /**
- * @constructor
- */
- function LocalStorageDriver()
- {
- }
-
- LocalStorageDriver.supported = function ()
- {
- return !!window.localStorage;
- };
-
- /**
- * @param {string} sKey
- * @param {*} mData
- * @returns {boolean}
- */
- LocalStorageDriver.prototype.set = function (sKey, mData)
- {
- var
- mCookieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
- bResult = false,
- mResult = null
- ;
-
- try
- {
- mResult = null === mCookieValue ? null : JSON.parse(mCookieValue);
- if (!mResult)
- {
- mResult = {};
- }
-
- mResult[sKey] = mData;
- window.localStorage[Consts.Values.ClientSideCookieIndexName] = JSON.stringify(mResult);
-
- bResult = true;
+ ko.bindingHandlers.registrateBootstrapDropdown = {
+ 'init': function (oElement) {
+ var Globals = require('Globals');
+ Globals.aBootstrapDropdowns.push($(oElement));
}
- catch (oException) {}
-
- return bResult;
};
- /**
- * @param {string} sKey
- * @returns {*}
- */
- LocalStorageDriver.prototype.get = function (sKey)
- {
- var
- mCokieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
- mResult = null
- ;
-
- try
- {
- mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
- if (mResult && !Utils.isUnd(mResult[sKey]))
+ ko.bindingHandlers.openDropdownTrigger = {
+ 'update': function (oElement, fValueAccessor) {
+ if (ko.utils.unwrapObservable(fValueAccessor()))
{
- mResult = mResult[sKey];
+ var
+ $el = $(oElement),
+ Utils = require('Utils')
+ ;
+
+ if (!$el.hasClass('open'))
+ {
+ $el.find('.dropdown-toggle').dropdown('toggle');
+ Utils.detectDropdownVisibility();
+ }
+
+ fValueAccessor()(false);
+ }
+ }
+ };
+
+ ko.bindingHandlers.dropdownCloser = {
+ 'init': function (oElement) {
+ $(oElement).closest('.dropdown').on('click', '.e-item', function () {
+ $(oElement).dropdown('toggle');
+ });
+ }
+ };
+
+ ko.bindingHandlers.popover = {
+ 'init': function (oElement, fValueAccessor) {
+ $(oElement).popover(ko.utils.unwrapObservable(fValueAccessor()));
+ }
+ };
+
+ ko.bindingHandlers.csstext = {
+ 'init': function (oElement, fValueAccessor) {
+ var Utils = require('Utils');
+ if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
+ {
+ oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
}
else
{
- mResult = null;
+ $(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
+ }
+ },
+ 'update': function (oElement, fValueAccessor) {
+ var Utils = require('Utils');
+ if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
+ {
+ oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
+ }
+ else
+ {
+ $(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
}
}
- catch (oException) {}
-
- return mResult;
};
-
- module.exports = LocalStorageDriver;
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+ ko.bindingHandlers.resizecrop = {
+ 'init': function (oElement) {
+ $(oElement).addClass('resizecrop').resizecrop({
+ 'width': '100',
+ 'height': '100',
+ 'wrapperCSS': {
+ 'border-radius': '10px'
+ }
+ });
+ },
+ 'update': function (oElement, fValueAccessor) {
+ fValueAccessor()();
+ $(oElement).resizecrop({
+ 'width': '100',
+ 'height': '100'
+ });
+ }
+ };
-(function (module) {
+ ko.bindingHandlers.onEnter = {
+ 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
+ $(oElement).on('keypress', function (oEvent) {
+ if (oEvent && 13 === window.parseInt(oEvent.keyCode, 10))
+ {
+ $(oElement).trigger('change');
+ fValueAccessor().call(oViewModel);
+ }
+ });
+ }
+ };
- 'use strict';
+ ko.bindingHandlers.onEsc = {
+ 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
+ $(oElement).on('keypress', function (oEvent) {
+ if (oEvent && 27 === window.parseInt(oEvent.keyCode, 10))
+ {
+ $(oElement).trigger('change');
+ fValueAccessor().call(oViewModel);
+ }
+ });
+ }
+ };
- var
- _ = require('../External/underscore.js'),
- CookieDriver = require('./LocalStorages/CookieDriver.js'),
- LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js')
- ;
+ ko.bindingHandlers.clickOnTrue = {
+ 'update': function (oElement, fValueAccessor) {
+ if (ko.utils.unwrapObservable(fValueAccessor()))
+ {
+ $(oElement).click();
+ }
+ }
+ };
- /**
- * @constructor
- */
- function LocalStorage()
+ ko.bindingHandlers.modal = {
+ 'init': function (oElement, fValueAccessor) {
+
+ var
+ Globals = require('Globals'),
+ Utils = require('Utils')
+ ;
+
+ $(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
+ 'keyboard': false,
+ 'show': ko.utils.unwrapObservable(fValueAccessor())
+ })
+ .on('shown', function () {
+ Utils.windowResize();
+ })
+ .find('.close').click(function () {
+ fValueAccessor()(false);
+ });
+
+ },
+ 'update': function (oElement, fValueAccessor) {
+ $(oElement).modal(ko.utils.unwrapObservable(fValueAccessor()) ? 'show' : 'hide');
+ }
+ };
+
+ ko.bindingHandlers.i18nInit = {
+ 'init': function (oElement) {
+ var Utils = require('Utils');
+ Utils.i18nToNode(oElement);
+ }
+ };
+
+ ko.bindingHandlers.i18nUpdate = {
+ 'update': function (oElement, fValueAccessor) {
+ var Utils = require('Utils');
+ ko.utils.unwrapObservable(fValueAccessor());
+ Utils.i18nToNode(oElement);
+ }
+ };
+
+ ko.bindingHandlers.link = {
+ 'update': function (oElement, fValueAccessor) {
+ $(oElement).attr('href', ko.utils.unwrapObservable(fValueAccessor()));
+ }
+ };
+
+ ko.bindingHandlers.title = {
+ 'update': function (oElement, fValueAccessor) {
+ $(oElement).attr('title', ko.utils.unwrapObservable(fValueAccessor()));
+ }
+ };
+
+ ko.bindingHandlers.textF = {
+ 'init': function (oElement, fValueAccessor) {
+ $(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
+ }
+ };
+
+ ko.bindingHandlers.initDom = {
+ 'init': function (oElement, fValueAccessor) {
+ fValueAccessor()(oElement);
+ }
+ };
+
+ ko.bindingHandlers.initResizeTrigger = {
+ 'init': function (oElement, fValueAccessor) {
+ var aValues = ko.utils.unwrapObservable(fValueAccessor());
+ $(oElement).css({
+ 'height': aValues[1],
+ 'min-height': aValues[1]
+ });
+ },
+ 'update': function (oElement, fValueAccessor) {
+
+ var
+ Utils = require('Utils'),
+ aValues = ko.utils.unwrapObservable(fValueAccessor()),
+ iValue = Utils.pInt(aValues[1]),
+ iSize = 0,
+ iOffset = $(oElement).offset().top
+ ;
+
+ if (0 < iOffset)
+ {
+ iOffset += Utils.pInt(aValues[2]);
+ iSize = $window.height() - iOffset;
+
+ if (iValue < iSize)
+ {
+ iValue = iSize;
+ }
+
+ $(oElement).css({
+ 'height': iValue,
+ 'min-height': iValue
+ });
+ }
+ }
+ };
+
+ ko.bindingHandlers.appendDom = {
+ 'update': function (oElement, fValueAccessor) {
+ $(oElement).hide().empty().append(ko.utils.unwrapObservable(fValueAccessor())).show();
+ }
+ };
+
+ ko.bindingHandlers.draggable = {
+ 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
+ var
+ Globals = require('Globals'),
+ Utils = require('Utils')
+ ;
+ if (!Globals.bMobileDevice)
+ {
+ var
+ iTriggerZone = 100,
+ iScrollSpeed = 3,
+ fAllValueFunc = fAllBindingsAccessor(),
+ sDroppableSelector = fAllValueFunc && fAllValueFunc['droppableSelector'] ? fAllValueFunc['droppableSelector'] : '',
+ oConf = {
+ 'distance': 20,
+ 'handle': '.dragHandle',
+ 'cursorAt': {'top': 22, 'left': 3},
+ 'refreshPositions': true,
+ 'scroll': true
+ }
+ ;
+
+ if (sDroppableSelector)
+ {
+ oConf['drag'] = function (oEvent) {
+
+ $(sDroppableSelector).each(function () {
+ var
+ moveUp = null,
+ moveDown = null,
+ $this = $(this),
+ oOffset = $this.offset(),
+ bottomPos = oOffset.top + $this.height()
+ ;
+
+ window.clearInterval($this.data('timerScroll'));
+ $this.data('timerScroll', false);
+
+ if (oEvent.pageX >= oOffset.left && oEvent.pageX <= oOffset.left + $this.width())
+ {
+ if (oEvent.pageY >= bottomPos - iTriggerZone && oEvent.pageY <= bottomPos)
+ {
+ moveUp = function() {
+ $this.scrollTop($this.scrollTop() + iScrollSpeed);
+ Utils.windowResize();
+ };
+
+ $this.data('timerScroll', window.setInterval(moveUp, 10));
+ moveUp();
+ }
+
+ if (oEvent.pageY >= oOffset.top && oEvent.pageY <= oOffset.top + iTriggerZone)
+ {
+ moveDown = function() {
+ $this.scrollTop($this.scrollTop() - iScrollSpeed);
+ Utils.windowResize();
+ };
+
+ $this.data('timerScroll', window.setInterval(moveDown, 10));
+ moveDown();
+ }
+ }
+ });
+ };
+
+ oConf['stop'] = function() {
+ $(sDroppableSelector).each(function () {
+ window.clearInterval($(this).data('timerScroll'));
+ $(this).data('timerScroll', false);
+ });
+ };
+ }
+
+ oConf['helper'] = function (oEvent) {
+ return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null);
+ };
+
+ $(oElement).draggable(oConf).on('mousedown', function () {
+ Utils.removeInFocus();
+ });
+ }
+ }
+ };
+
+ ko.bindingHandlers.droppable = {
+ 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
+ var Globals = require('Globals');
+ if (!Globals.bMobileDevice)
+ {
+ var
+ fValueFunc = fValueAccessor(),
+ fAllValueFunc = fAllBindingsAccessor(),
+ fOverCallback = fAllValueFunc && fAllValueFunc['droppableOver'] ? fAllValueFunc['droppableOver'] : null,
+ fOutCallback = fAllValueFunc && fAllValueFunc['droppableOut'] ? fAllValueFunc['droppableOut'] : null,
+ oConf = {
+ 'tolerance': 'pointer',
+ 'hoverClass': 'droppableHover'
+ }
+ ;
+
+ if (fValueFunc)
+ {
+ oConf['drop'] = function (oEvent, oUi) {
+ fValueFunc(oEvent, oUi);
+ };
+
+ if (fOverCallback)
+ {
+ oConf['over'] = function (oEvent, oUi) {
+ fOverCallback(oEvent, oUi);
+ };
+ }
+
+ if (fOutCallback)
+ {
+ oConf['out'] = function (oEvent, oUi) {
+ fOutCallback(oEvent, oUi);
+ };
+ }
+
+ $(oElement).droppable(oConf);
+ }
+ }
+ }
+ };
+
+ ko.bindingHandlers.nano = {
+ 'init': function (oElement) {
+ var Globals = require('Globals');
+ if (!Globals.bDisableNanoScroll)
+ {
+ $(oElement)
+ .addClass('nano')
+ .nanoScroller({
+ 'iOSNativeScrolling': false,
+ 'preventPageScrolling': true
+ })
+ ;
+ }
+ }
+ };
+
+ ko.bindingHandlers.saveTrigger = {
+ 'init': function (oElement) {
+
+ var $oEl = $(oElement);
+
+ $oEl.data('save-trigger-type', $oEl.is('input[type=text],input[type=email],input[type=password],select,textarea') ? 'input' : 'custom');
+
+ if ('custom' === $oEl.data('save-trigger-type'))
+ {
+ $oEl.append(
+ ' '
+ ).addClass('settings-saved-trigger');
+ }
+ else
+ {
+ $oEl.addClass('settings-saved-trigger-input');
+ }
+ },
+ 'update': function (oElement, fValueAccessor) {
+ var
+ mValue = ko.utils.unwrapObservable(fValueAccessor()),
+ $oEl = $(oElement)
+ ;
+
+ if ('custom' === $oEl.data('save-trigger-type'))
+ {
+ switch (mValue.toString())
+ {
+ case '1':
+ $oEl
+ .find('.animated,.error').hide().removeClass('visible')
+ .end()
+ .find('.success').show().addClass('visible')
+ ;
+ break;
+ case '0':
+ $oEl
+ .find('.animated,.success').hide().removeClass('visible')
+ .end()
+ .find('.error').show().addClass('visible')
+ ;
+ break;
+ case '-2':
+ $oEl
+ .find('.error,.success').hide().removeClass('visible')
+ .end()
+ .find('.animated').show().addClass('visible')
+ ;
+ break;
+ default:
+ $oEl
+ .find('.animated').hide()
+ .end()
+ .find('.error,.success').removeClass('visible')
+ ;
+ break;
+ }
+ }
+ else
+ {
+ switch (mValue.toString())
+ {
+ case '1':
+ $oEl.addClass('success').removeClass('error');
+ break;
+ case '0':
+ $oEl.addClass('error').removeClass('success');
+ break;
+ case '-2':
+ // $oEl;
+ break;
+ default:
+ $oEl.removeClass('error success');
+ break;
+ }
+ }
+ }
+ };
+
+ ko.bindingHandlers.emailsTags = {
+ 'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
+
+ var
+ Utils = require('Utils'),
+ EmailModel = require('../Models/EmailModel.js'),
+
+ $oEl = $(oElement),
+ fValue = fValueAccessor(),
+ fAllBindings = fAllBindingsAccessor(),
+ fAutoCompleteSource = fAllBindings['autoCompleteSource'] || null,
+ fFocusCallback = function (bValue) {
+ if (fValue && fValue.focusTrigger)
+ {
+ fValue.focusTrigger(bValue);
+ }
+ }
+ ;
+
+ $oEl.inputosaurus({
+ 'parseOnBlur': true,
+ 'allowDragAndDrop': true,
+ 'focusCallback': fFocusCallback,
+ 'inputDelimiters': [',', ';'],
+ 'autoCompleteSource': fAutoCompleteSource,
+ 'parseHook': function (aInput) {
+ return _.map(aInput, function (sInputValue) {
+
+ var
+ sValue = Utils.trim(sInputValue),
+ oEmail = null
+ ;
+
+ if ('' !== sValue)
+ {
+ oEmail = new EmailModel();
+ oEmail.mailsoParse(sValue);
+ oEmail.clearDuplicateName();
+ return [oEmail.toLine(false), oEmail];
+ }
+
+ return [sValue, null];
+
+ });
+ },
+ 'change': _.bind(function (oEvent) {
+ $oEl.data('EmailsTagsValue', oEvent.target.value);
+ fValue(oEvent.target.value);
+ }, this)
+ });
+ },
+ 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
+
+ var
+ $oEl = $(oElement),
+ fAllValueFunc = fAllBindingsAccessor(),
+ fEmailsTagsFilter = fAllValueFunc['emailsTagsFilter'] || null,
+ sValue = ko.utils.unwrapObservable(fValueAccessor())
+ ;
+
+ if ($oEl.data('EmailsTagsValue') !== sValue)
+ {
+ $oEl.val(sValue);
+ $oEl.data('EmailsTagsValue', sValue);
+ $oEl.inputosaurus('refresh');
+ }
+
+ if (fEmailsTagsFilter && ko.utils.unwrapObservable(fEmailsTagsFilter))
+ {
+ $oEl.inputosaurus('focus');
+ }
+ }
+ };
+
+ ko.bindingHandlers.contactTags = {
+ 'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
+
+ var
+ Utils = require('Utils'),
+ ContactTagModel = require('../Models/ContactTagModel.js'),
+
+ $oEl = $(oElement),
+ fValue = fValueAccessor(),
+ fAllBindings = fAllBindingsAccessor(),
+ fAutoCompleteSource = fAllBindings['autoCompleteSource'] || null,
+ fFocusCallback = function (bValue) {
+ if (fValue && fValue.focusTrigger)
+ {
+ fValue.focusTrigger(bValue);
+ }
+ }
+ ;
+
+ $oEl.inputosaurus({
+ 'parseOnBlur': true,
+ 'allowDragAndDrop': false,
+ 'focusCallback': fFocusCallback,
+ 'inputDelimiters': [',', ';'],
+ 'outputDelimiter': ',',
+ 'autoCompleteSource': fAutoCompleteSource,
+ 'parseHook': function (aInput) {
+ return _.map(aInput, function (sInputValue) {
+
+ var
+ sValue = Utils.trim(sInputValue),
+ oTag = null
+ ;
+
+ if ('' !== sValue)
+ {
+ oTag = new ContactTagModel();
+ oTag.name(sValue);
+ return [oTag.toLine(false), oTag];
+ }
+
+ return [sValue, null];
+
+ });
+ },
+ 'change': _.bind(function (oEvent) {
+ $oEl.data('ContactTagsValue', oEvent.target.value);
+ fValue(oEvent.target.value);
+ }, this)
+ });
+ },
+ 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
+
+ var
+ $oEl = $(oElement),
+ fAllValueFunc = fAllBindingsAccessor(),
+ fContactTagsFilter = fAllValueFunc['contactTagsFilter'] || null,
+ sValue = ko.utils.unwrapObservable(fValueAccessor())
+ ;
+
+ if ($oEl.data('ContactTagsValue') !== sValue)
+ {
+ $oEl.val(sValue);
+ $oEl.data('ContactTagsValue', sValue);
+ $oEl.inputosaurus('refresh');
+ }
+
+ if (fContactTagsFilter && ko.utils.unwrapObservable(fContactTagsFilter))
+ {
+ $oEl.inputosaurus('focus');
+ }
+ }
+ };
+
+ ko.bindingHandlers.command = {
+ 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
+ var
+ jqElement = $(oElement),
+ oCommand = fValueAccessor()
+ ;
+
+ if (!oCommand || !oCommand.enabled || !oCommand.canExecute)
+ {
+ throw new Error('You are not using command function');
+ }
+
+ jqElement.addClass('command');
+ ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments);
+ },
+
+ 'update': function (oElement, fValueAccessor) {
+
+ var
+ bResult = true,
+ jqElement = $(oElement),
+ oCommand = fValueAccessor()
+ ;
+
+ bResult = oCommand.enabled();
+ jqElement.toggleClass('command-not-enabled', !bResult);
+
+ if (bResult)
+ {
+ bResult = oCommand.canExecute();
+ jqElement.toggleClass('command-can-not-be-execute', !bResult);
+ }
+
+ jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
+
+ if (jqElement.is('input') || jqElement.is('button'))
+ {
+ jqElement.prop('disabled', !bResult);
+ }
+ }
+ };
+
+ ko.extenders.trimmer = function (oTarget)
{
var
- NextStorageDriver = _.find([LocalStorageDriver, CookieDriver], function (NextStorageDriver) {
- return NextStorageDriver.supported();
+ Utils = require('Utils'),
+ oResult = ko.computed({
+ 'read': oTarget,
+ 'write': function (sNewValue) {
+ oTarget(Utils.trim(sNewValue.toString()));
+ },
+ 'owner': this
})
;
- if (NextStorageDriver)
+ oResult(oTarget());
+ return oResult;
+ };
+
+ ko.extenders.posInterer = function (oTarget, iDefault)
+ {
+ var
+ Utils = require('Utils'),
+ oResult = ko.computed({
+ 'read': oTarget,
+ 'write': function (sNewValue) {
+ var iNew = Utils.pInt(sNewValue.toString(), iDefault);
+ if (0 >= iNew)
+ {
+ iNew = iDefault;
+ }
+
+ if (iNew === oTarget() && '' + iNew !== '' + sNewValue)
+ {
+ oTarget(iNew + 1);
+ }
+
+ oTarget(iNew);
+ }
+ })
+ ;
+
+ oResult(oTarget());
+ return oResult;
+ };
+
+ ko.extenders.reversible = function (oTarget)
+ {
+ var mValue = oTarget();
+
+ oTarget.commit = function ()
{
- NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
- this.oDriver = new NextStorageDriver();
+ mValue = oTarget();
+ };
+
+ oTarget.reverse = function ()
+ {
+ oTarget(mValue);
+ };
+
+ oTarget.commitedValue = function ()
+ {
+ return mValue;
+ };
+
+ return oTarget;
+ };
+
+ ko.extenders.toggleSubscribe = function (oTarget, oOptions)
+ {
+ oTarget.subscribe(oOptions[1], oOptions[0], 'beforeChange');
+ oTarget.subscribe(oOptions[2], oOptions[0]);
+
+ return oTarget;
+ };
+
+ ko.extenders.falseTimeout = function (oTarget, iOption)
+ {
+ var Utils = require('Utils');
+
+ oTarget.iTimeout = 0;
+ oTarget.subscribe(function (bValue) {
+ if (bValue)
+ {
+ window.clearTimeout(oTarget.iTimeout);
+ oTarget.iTimeout = window.setTimeout(function () {
+ oTarget(false);
+ oTarget.iTimeout = 0;
+ }, Utils.pInt(iOption));
+ }
+ });
+
+ return oTarget;
+ };
+
+ ko.observable.fn.validateNone = function ()
+ {
+ this.hasError = ko.observable(false);
+ return this;
+ };
+
+ ko.observable.fn.validateEmail = function ()
+ {
+ var Utils = require('Utils');
+
+ this.hasError = ko.observable(false);
+
+ this.subscribe(function (sValue) {
+ sValue = Utils.trim(sValue);
+ this.hasError('' !== sValue && !(/^[^@\s]+@[^@\s]+$/.test(sValue)));
+ }, this);
+
+ this.valueHasMutated();
+ return this;
+ };
+
+ ko.observable.fn.validateSimpleEmail = function ()
+ {
+ var Utils = require('Utils');
+
+ this.hasError = ko.observable(false);
+
+ this.subscribe(function (sValue) {
+ sValue = Utils.trim(sValue);
+ this.hasError('' !== sValue && !(/^.+@.+$/.test(sValue)));
+ }, this);
+
+ this.valueHasMutated();
+ return this;
+ };
+
+ ko.observable.fn.validateFunc = function (fFunc)
+ {
+ var Utils = require('Utils');
+
+ this.hasFuncError = ko.observable(false);
+
+ if (Utils.isFunc(fFunc))
+ {
+ this.subscribe(function (sValue) {
+ this.hasFuncError(!fFunc(sValue));
+ }, this);
+
+ this.valueHasMutated();
}
- }
- LocalStorage.prototype.oDriver = null;
-
- /**
- * @param {number} iKey
- * @param {*} mData
- * @return {boolean}
- */
- LocalStorage.prototype.set = function (iKey, mData)
- {
- return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
+ return this;
};
- /**
- * @param {number} iKey
- * @return {*}
- */
- LocalStorage.prototype.get = function (iKey)
- {
- return this.oDriver ? this.oDriver.get('p' + iKey) : null;
- };
+ module.exports = ko;
- module.exports = new LocalStorage();
+}(module, ko));
-}(module));
+},{"$":32,"$doc":24,"$window":26,"../Models/ContactTagModel.js":44,"../Models/EmailModel.js":45,"Globals":19,"Utils":22,"_":37,"window":38}],35:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+module.exports = moment;
+},{}],36:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+module.exports = ssm;
+},{}],37:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = _;
+},{}],38:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+module.exports = window;
+},{}],39:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
'use strict';
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- hasher = require('../External/hasher.js'),
- crossroads = require('../External/crossroads.js'),
- $window = require('../External/$window.js'),
- $html = require('../External/$html.js'),
-
- Globals = require('../Common/Globals.js'),
- Plugins = require('../Common/Plugins.js'),
- Utils = require('../Common/Utils.js'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ hasher = require('hasher'),
+ crossroads = require('crossroads'),
+ $html = require('$html'),
- RL = require('../RL.js'),
+ Globals = require('Globals'),
+ Plugins = require('Plugins'),
+ Utils = require('Utils'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -3563,28 +6459,11 @@
{
this.sDefaultScreenName = '';
this.oScreens = {};
- this.oBoot = null;
- this.oRemote = null;
- this.oData = null;
this.oCurrentScreen = null;
}
- /**
- * @param {Object} thisObject
- */
- Knoin.constructorEnd = function (thisObject)
- {
- if (Utils.isFunc(thisObject['__constructor_end']))
- {
- thisObject['__constructor_end'].call(thisObject);
- }
- };
-
Knoin.prototype.sDefaultScreenName = '';
Knoin.prototype.oScreens = {};
- Knoin.prototype.oBoot = null;
- Knoin.prototype.oRemote = null;
- Knoin.prototype.oData = null;
Knoin.prototype.oCurrentScreen = null;
Knoin.prototype.hideLoading = function ()
@@ -3592,21 +6471,6 @@
$('#rl-loading').hide();
};
- Knoin.prototype.rl = function ()
- {
- return this.oBoot;
- };
-
- Knoin.prototype.remote = function ()
- {
- return this.oRemote;
- };
-
- Knoin.prototype.data = function ()
- {
- return this.oData;
- };
-
/**
* @param {Object} thisObject
*/
@@ -3733,19 +6597,19 @@
if (bValue)
{
this.viewModelDom.show();
- this.storeAndSetKeyScope(kn.data());
+ this.storeAndSetKeyScope();
- RL.popupVisibilityNames.push(this.viewModelName); // TODO cjs
- oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10); // TODO cjs
+ Globals.popupVisibilityNames.push(this.viewModelName);
+ oViewModel.viewModelDom.css('z-index', 3000 + Globals.popupVisibilityNames().length + 10);
Utils.delegateRun(this, 'onFocus', [], 500);
}
else
{
Utils.delegateRun(this, 'onHide');
- this.restoreKeyScope(kn.data());
+ this.restoreKeyScope();
- RL.popupVisibilityNames.remove(this.viewModelName); // TODO cjs
+ Globals.popupVisibilityNames.remove(this.viewModelName);
oViewModel.viewModelDom.css('z-index', 2000);
Globals.tooltipTrigger(!Globals.tooltipTrigger());
@@ -3758,7 +6622,7 @@
}, oViewModel);
}
- Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs
+ Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
'i18nInit': true,
@@ -3771,7 +6635,7 @@
oViewModel.registerPopupKeyDown();
}
- Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs
+ Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
}
else
{
@@ -3782,18 +6646,6 @@
return ViewModelClass ? ViewModelClass.__vm : null;
};
- /**
- * @param {Object} oViewModel
- * @param {Object} oViewModelDom
- */
- Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
- {
- if (oViewModel && oViewModelDom)
- {
- ko.applyBindings(oViewModel, oViewModelDom);
- }
- };
-
/**
* @param {Function} ViewModelClassToHide
*/
@@ -3802,7 +6654,7 @@
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
{
ViewModelClassToHide.__vm.modalVisibility(false);
- Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]); // TODO cjs
+ Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]);
}
};
@@ -3820,7 +6672,7 @@
{
ViewModelClassToShow.__vm.modalVisibility(true);
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
- Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]); // TODO cjs
+ Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
}
}
};
@@ -3911,7 +6763,7 @@
{
Utils.delegateRun(self.oCurrentScreen, 'onShow');
- Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]); // TODO cjs
+ Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]);
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
{
@@ -3925,7 +6777,7 @@
Utils.delegateRun(ViewModelClass.__vm, 'onShow');
Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
- Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]); // TODO cjs
+ Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]);
}
}, self);
@@ -3978,9 +6830,9 @@
oScreen.__started = true;
oScreen.__start();
- Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]); // TODO cjs
+ Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]);
Utils.delegateRun(oScreen, 'onStart');
- Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]); // TODO cjs
+ Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]);
}
}, this);
@@ -4026,80 +6878,557 @@
}
};
- /**
- * @return {Knoin}
- */
- Knoin.prototype.bootstart = function (RL, Remote, Data)
- {
- this.oBoot = RL;
- this.oData = Data;
- this.oRemote = Remote;
-
- Plugins.__boot = this.oBoot;
- Plugins.__data = this.oData;
- Plugins.__remote = this.oRemote;
-
- $html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
-
- $window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
- $window.unload(function () {
- Globals.bUnload = true;
- });
-
- $html.on('click.dropdown.data-api', function () {
- Utils.detectDropdownVisibility();
- });
-
- // export
- window['rl'] = window['rl'] || {};
- window['rl']['addHook'] = Plugins.addHook;
- window['rl']['settingsGet'] = Plugins.mainSettingsGet;
- window['rl']['remoteRequest'] = Plugins.remoteRequest;
- window['rl']['pluginSettingsGet'] = Plugins.settingsGet;
- window['rl']['addSettingsViewModel'] = _.bind(this.addSettingsViewModel, this);
- window['rl']['createCommand'] = Utils.createCommand;
-
- window['rl']['EmailModel'] = require('../Models/EmailModel.js');
- window['rl']['Enums'] = require('../Common/Enums.js');
-
- window['__RLBOOT'] = function (fCall) {
-
- // boot
- $(function () {
-
- if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
- {
- $('#rl-templates').html(window['rainloopTEMPLATES'][0]);
-
- _.delay(function () {
-
- RL.bootstart();
- $html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
-
- }, 50);
- }
- else
- {
- fCall(false);
- }
-
- window['__RLBOOT'] = null;
- });
- };
- };
-
module.exports = new Knoin();
-}(module));
+}(module, require));
+},{"$":32,"$html":25,"Globals":19,"KnoinAbstractViewModel":42,"Plugins":21,"Utils":22,"_":37,"crossroads":30,"hasher":31,"ko":34}],40:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
+
+ 'use strict';
+
+ /**
+ * @constructor
+ */
+ function KnoinAbstractBoot()
+ {
+
+ }
+
+ KnoinAbstractBoot.prototype.bootstart = function ()
+ {
+
+ };
+
+ module.exports = KnoinAbstractBoot;
+
+}(module, require));
+},{}],41:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
'use strict';
var
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js')
+ crossroads = require('crossroads'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @param {string} sScreenName
+ * @param {?=} aViewModels = []
+ * @constructor
+ */
+ function KnoinAbstractScreen(sScreenName, aViewModels)
+ {
+ this.sScreenName = sScreenName;
+ this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : [];
+ }
+
+ /**
+ * @type {Array}
+ */
+ KnoinAbstractScreen.prototype.oCross = null;
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractScreen.prototype.sScreenName = '';
+
+ /**
+ * @type {Array}
+ */
+ KnoinAbstractScreen.prototype.aViewModels = [];
+
+ /**
+ * @return {Array}
+ */
+ KnoinAbstractScreen.prototype.viewModels = function ()
+ {
+ return this.aViewModels;
+ };
+
+ /**
+ * @return {string}
+ */
+ KnoinAbstractScreen.prototype.screenName = function ()
+ {
+ return this.sScreenName;
+ };
+
+ KnoinAbstractScreen.prototype.routes = function ()
+ {
+ return null;
+ };
+
+ /**
+ * @return {?Object}
+ */
+ KnoinAbstractScreen.prototype.__cross = function ()
+ {
+ return this.oCross;
+ };
+
+ KnoinAbstractScreen.prototype.__start = function ()
+ {
+ var
+ aRoutes = this.routes(),
+ oRoute = null,
+ fMatcher = null
+ ;
+
+ if (Utils.isNonEmptyArray(aRoutes))
+ {
+ fMatcher = _.bind(this.onRoute || Utils.emptyFunction, this);
+ oRoute = crossroads.create();
+
+ _.each(aRoutes, function (aItem) {
+ oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1];
+ });
+
+ this.oCross = oRoute;
+ }
+ };
+
+ module.exports = KnoinAbstractScreen;
+
+}(module, require));
+},{"Utils":22,"crossroads":30}],42:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ ko = require('ko'),
+ $window = require('$window'),
+
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @param {string=} sPosition = ''
+ * @param {string=} sTemplate = ''
+ * @constructor
+ */
+ function KnoinAbstractViewModel(sPosition, sTemplate)
+ {
+ this.bDisabeCloseOnEsc = false;
+ this.sPosition = Utils.pString(sPosition);
+ this.sTemplate = Utils.pString(sTemplate);
+
+ this.sDefaultKeyScope = Enums.KeyState.None;
+ this.sCurrentKeyScope = this.sDefaultKeyScope;
+
+ this.viewModelName = '';
+ this.viewModelVisibility = ko.observable(false);
+ this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
+
+ this.viewModelDom = null;
+ }
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.sPosition = '';
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.sTemplate = '';
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.viewModelName = '';
+
+ /**
+ * @type {?}
+ */
+ KnoinAbstractViewModel.prototype.viewModelDom = null;
+
+ /**
+ * @return {string}
+ */
+ KnoinAbstractViewModel.prototype.viewModelTemplate = function ()
+ {
+ return this.sTemplate;
+ };
+
+ /**
+ * @return {string}
+ */
+ KnoinAbstractViewModel.prototype.viewModelPosition = function ()
+ {
+ return this.sPosition;
+ };
+
+ KnoinAbstractViewModel.prototype.cancelCommand = function () {};
+ KnoinAbstractViewModel.prototype.closeCommand = function () {};
+
+ KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
+ {
+ this.sCurrentKeyScope = Globals.keyScope();
+ Globals.keyScope(this.sDefaultKeyScope);
+ };
+
+ KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
+ {
+ Globals.keyScope(this.sCurrentKeyScope);
+ };
+
+ KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
+ {
+ var self = this;
+
+ $window.on('keydown', function (oEvent) {
+ if (oEvent && self.modalVisibility && self.modalVisibility())
+ {
+ if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
+ {
+ Utils.delegateRun(self, 'cancelCommand');
+ return false;
+ }
+ else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus())
+ {
+ return false;
+ }
+ }
+
+ return true;
+ });
+ };
+
+ module.exports = KnoinAbstractViewModel;
+
+}(module, require));
+},{"$window":26,"Enums":17,"Globals":19,"Utils":22,"ko":34}],43:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ window = require('window'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder')
+ ;
+
+ /**
+ * @constructor
+ */
+ function AttachmentModel()
+ {
+ this.mimeType = '';
+ this.fileName = '';
+ this.estimatedSize = 0;
+ this.friendlySize = '';
+ this.isInline = false;
+ this.isLinked = false;
+ this.cid = '';
+ this.cidWithOutTags = '';
+ this.contentLocation = '';
+ this.download = '';
+ this.folder = '';
+ this.uid = '';
+ this.mimeIndex = '';
+ }
+
+ /**
+ * @static
+ * @param {AjaxJsonAttachment} oJsonAttachment
+ * @return {?AttachmentModel}
+ */
+ AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
+ {
+ var oAttachmentModel = new AttachmentModel();
+ return oAttachmentModel.initByJson(oJsonAttachment) ? oAttachmentModel : null;
+ };
+
+ AttachmentModel.prototype.mimeType = '';
+ AttachmentModel.prototype.fileName = '';
+ AttachmentModel.prototype.estimatedSize = 0;
+ AttachmentModel.prototype.friendlySize = '';
+ AttachmentModel.prototype.isInline = false;
+ AttachmentModel.prototype.isLinked = false;
+ AttachmentModel.prototype.cid = '';
+ AttachmentModel.prototype.cidWithOutTags = '';
+ AttachmentModel.prototype.contentLocation = '';
+ AttachmentModel.prototype.download = '';
+ AttachmentModel.prototype.folder = '';
+ AttachmentModel.prototype.uid = '';
+ AttachmentModel.prototype.mimeIndex = '';
+
+ /**
+ * @param {AjaxJsonAttachment} oJsonAttachment
+ */
+ AttachmentModel.prototype.initByJson = function (oJsonAttachment)
+ {
+ var bResult = false;
+ if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
+ {
+ this.mimeType = (oJsonAttachment.MimeType || '').toLowerCase();
+ this.fileName = oJsonAttachment.FileName;
+ this.estimatedSize = Utils.pInt(oJsonAttachment.EstimatedSize);
+ this.isInline = !!oJsonAttachment.IsInline;
+ this.isLinked = !!oJsonAttachment.IsLinked;
+ this.cid = oJsonAttachment.CID;
+ this.contentLocation = oJsonAttachment.ContentLocation;
+ this.download = oJsonAttachment.Download;
+
+ this.folder = oJsonAttachment.Folder;
+ this.uid = oJsonAttachment.Uid;
+ this.mimeIndex = oJsonAttachment.MimeIndex;
+
+ this.friendlySize = Utils.friendlySize(this.estimatedSize);
+ this.cidWithOutTags = this.cid.replace(/^<+/, '').replace(/>+$/, '');
+
+ bResult = true;
+ }
+
+ return bResult;
+ };
+
+ /**
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.isImage = function ()
+ {
+ return -1 < Utils.inArray(this.mimeType.toLowerCase(),
+ ['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
+ );
+ };
+
+ /**
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.isText = function ()
+ {
+ return 'text/' === this.mimeType.substr(0, 5) &&
+ -1 === Utils.inArray(this.mimeType, ['text/html']);
+ };
+
+ /**
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.isPdf = function ()
+ {
+ return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
+ };
+
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.linkDownload = function ()
+ {
+ return LinkBuilder.attachmentDownload(this.download);
+ };
+
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.linkPreview = function ()
+ {
+ return LinkBuilder.attachmentPreview(this.download);
+ };
+
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.linkPreviewAsPlain = function ()
+ {
+ return LinkBuilder.attachmentPreviewAsPlain(this.download);
+ };
+
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.generateTransferDownloadUrl = function ()
+ {
+ var sLink = this.linkDownload();
+ if ('http' !== sLink.substr(0, 4))
+ {
+ sLink = window.location.protocol + '//' + window.location.host + window.location.pathname + sLink;
+ }
+
+ return this.mimeType + ':' + this.fileName + ':' + sLink;
+ };
+
+ /**
+ * @param {AttachmentModel} oAttachment
+ * @param {*} oEvent
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
+ {
+ var oLocalEvent = oEvent.originalEvent || oEvent;
+ if (oAttachment && oLocalEvent && oLocalEvent.dataTransfer && oLocalEvent.dataTransfer.setData)
+ {
+ oLocalEvent.dataTransfer.setData('DownloadURL', this.generateTransferDownloadUrl());
+ }
+
+ return true;
+ };
+
+ AttachmentModel.prototype.iconClass = function ()
+ {
+ var
+ aParts = this.mimeType.toLocaleString().split('/'),
+ sClass = 'icon-file'
+ ;
+
+ if (aParts && aParts[1])
+ {
+ if ('image' === aParts[0])
+ {
+ sClass = 'icon-file-image';
+ }
+ else if ('text' === aParts[0])
+ {
+ sClass = 'icon-file-text';
+ }
+ else if ('audio' === aParts[0])
+ {
+ sClass = 'icon-file-music';
+ }
+ else if ('video' === aParts[0])
+ {
+ sClass = 'icon-file-movie';
+ }
+ else if (-1 < Utils.inArray(aParts[1],
+ ['zip', '7z', 'tar', 'rar', 'gzip', 'bzip', 'bzip2', 'x-zip', 'x-7z', 'x-rar', 'x-tar', 'x-gzip', 'x-bzip', 'x-bzip2', 'x-zip-compressed', 'x-7z-compressed', 'x-rar-compressed']))
+ {
+ sClass = 'icon-file-zip';
+ }
+ // else if (-1 < Utils.inArray(aParts[1],
+ // ['pdf', 'x-pdf']))
+ // {
+ // sClass = 'icon-file-pdf';
+ // }
+ // else if (-1 < Utils.inArray(aParts[1], [
+ // 'exe', 'x-exe', 'x-winexe', 'bat'
+ // ]))
+ // {
+ // sClass = 'icon-console';
+ // }
+ else if (-1 < Utils.inArray(aParts[1], [
+ 'rtf', 'msword', 'vnd.msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'vnd.openxmlformats-officedocument.wordprocessingml.template',
+ 'vnd.ms-word.document.macroEnabled.12',
+ 'vnd.ms-word.template.macroEnabled.12'
+ ]))
+ {
+ sClass = 'icon-file-text';
+ }
+ else if (-1 < Utils.inArray(aParts[1], [
+ 'excel', 'ms-excel', 'vnd.ms-excel',
+ 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'vnd.openxmlformats-officedocument.spreadsheetml.template',
+ 'vnd.ms-excel.sheet.macroEnabled.12',
+ 'vnd.ms-excel.template.macroEnabled.12',
+ 'vnd.ms-excel.addin.macroEnabled.12',
+ 'vnd.ms-excel.sheet.binary.macroEnabled.12'
+ ]))
+ {
+ sClass = 'icon-file-excel';
+ }
+ else if (-1 < Utils.inArray(aParts[1], [
+ 'powerpoint', 'ms-powerpoint', 'vnd.ms-powerpoint',
+ 'vnd.openxmlformats-officedocument.presentationml.presentation',
+ 'vnd.openxmlformats-officedocument.presentationml.template',
+ 'vnd.openxmlformats-officedocument.presentationml.slideshow',
+ 'vnd.ms-powerpoint.addin.macroEnabled.12',
+ 'vnd.ms-powerpoint.presentation.macroEnabled.12',
+ 'vnd.ms-powerpoint.template.macroEnabled.12',
+ 'vnd.ms-powerpoint.slideshow.macroEnabled.12'
+ ]))
+ {
+ sClass = 'icon-file-chart-graph';
+ }
+ }
+
+ return sClass;
+ };
+
+ module.exports = AttachmentModel;
+
+}(module, require));
+},{"Globals":19,"LinkBuilder":20,"Utils":22,"window":38}],44:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ ko = require('ko'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @constructor
+ */
+ function ContactTagModel()
+ {
+ this.idContactTag = 0;
+ this.name = ko.observable('');
+ this.readOnly = false;
+ }
+
+ ContactTagModel.prototype.parse = function (oItem)
+ {
+ var bResult = false;
+ if (oItem && 'Object/Tag' === oItem['@Object'])
+ {
+ this.idContact = Utils.pInt(oItem['IdContactTag']);
+ this.name(Utils.pString(oItem['Name']));
+ this.readOnly = !!oItem['ReadOnly'];
+
+ bResult = true;
+ }
+
+ return bResult;
+ };
+
+ /**
+ * @param {string} sSearch
+ * @return {boolean}
+ */
+ ContactTagModel.prototype.filterHelper = function (sSearch)
+ {
+ return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
+ };
+
+ /**
+ * @param {boolean=} bEncodeHtml = false
+ * @return {string}
+ */
+ ContactTagModel.prototype.toLine = function (bEncodeHtml)
+ {
+ return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
+ Utils.encodeHtml(this.name()) : this.name();
+ };
+
+ module.exports = ContactTagModel;
+
+}(module, require));
+},{"Utils":22,"ko":34}],45:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ Enums = require('Enums'),
+ Utils = require('Utils')
;
/**
@@ -4468,83 +7797,4507 @@
module.exports = EmailModel;
-}(module));
+}(module, require));
+},{"Enums":17,"Utils":22}],46:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
- Utils = require('../Common/Utils.js')
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ moment = require('moment'),
+ $window = require('$window'),
+ $div = require('$div'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+
+ EmailModel = require('./EmailModel.js'),
+ AttachmentModel = require('./AttachmentModel.js')
+ ;
+
+ /**
+ * @constructor
+ */
+ function MessageModel()
+ {
+ this.folderFullNameRaw = '';
+ this.uid = '';
+ this.hash = '';
+ this.requestHash = '';
+ this.subject = ko.observable('');
+ this.subjectPrefix = ko.observable('');
+ this.subjectSuffix = ko.observable('');
+ this.size = ko.observable(0);
+ this.dateTimeStampInUTC = ko.observable(0);
+ this.priority = ko.observable(Enums.MessagePriority.Normal);
+
+ this.proxy = false;
+
+ this.fromEmailString = ko.observable('');
+ this.fromClearEmailString = ko.observable('');
+ this.toEmailsString = ko.observable('');
+ this.toClearEmailsString = ko.observable('');
+
+ this.senderEmailsString = ko.observable('');
+ this.senderClearEmailsString = ko.observable('');
+
+ this.emails = [];
+
+ this.from = [];
+ this.to = [];
+ this.cc = [];
+ this.bcc = [];
+ this.replyTo = [];
+ this.deliveredTo = [];
+
+ this.newForAnimation = ko.observable(false);
+
+ this.deleted = ko.observable(false);
+ this.unseen = ko.observable(false);
+ this.flagged = ko.observable(false);
+ this.answered = ko.observable(false);
+ this.forwarded = ko.observable(false);
+ this.isReadReceipt = ko.observable(false);
+
+ this.focused = ko.observable(false);
+ this.selected = ko.observable(false);
+ this.checked = ko.observable(false);
+ this.hasAttachments = ko.observable(false);
+ this.attachmentsMainType = ko.observable('');
+
+ this.moment = ko.observable(moment(moment.unix(0)));
+
+ this.attachmentIconClass = ko.computed(function () {
+ var sClass = '';
+ if (this.hasAttachments())
+ {
+ sClass = 'icon-attachment';
+ switch (this.attachmentsMainType())
+ {
+ case 'image':
+ sClass = 'icon-image';
+ break;
+ case 'archive':
+ sClass = 'icon-file-zip';
+ break;
+ case 'doc':
+ sClass = 'icon-file-text';
+ break;
+ // case 'pdf':
+ // sClass = 'icon-file-pdf';
+ // break;
+ }
+ }
+ return sClass;
+ }, this);
+
+ this.fullFormatDateValue = ko.computed(function () {
+ return MessageModel.calculateFullFromatDateValue(this.dateTimeStampInUTC());
+ }, this);
+
+ this.momentDate = Utils.createMomentDate(this);
+ this.momentShortDate = Utils.createMomentShortDate(this);
+
+ this.dateTimeStampInUTC.subscribe(function (iValue) {
+ var iNow = moment().unix();
+ this.moment(moment.unix(iNow < iValue ? iNow : iValue));
+ }, this);
+
+ this.body = null;
+ this.plainRaw = '';
+ this.isHtml = ko.observable(false);
+ this.hasImages = ko.observable(false);
+ this.attachments = ko.observableArray([]);
+
+ this.isPgpSigned = ko.observable(false);
+ this.isPgpEncrypted = ko.observable(false);
+ this.pgpSignedVerifyStatus = ko.observable(Enums.SignedVerifyStatus.None);
+ this.pgpSignedVerifyUser = ko.observable('');
+
+ this.priority = ko.observable(Enums.MessagePriority.Normal);
+ this.readReceipt = ko.observable('');
+
+ this.aDraftInfo = [];
+ this.sMessageId = '';
+ this.sInReplyTo = '';
+ this.sReferences = '';
+
+ this.parentUid = ko.observable(0);
+ this.threads = ko.observableArray([]);
+ this.threadsLen = ko.observable(0);
+ this.hasUnseenSubMessage = ko.observable(false);
+ this.hasFlaggedSubMessage = ko.observable(false);
+
+ this.lastInCollapsedThread = ko.observable(false);
+ this.lastInCollapsedThreadLoading = ko.observable(false);
+
+ this.threadsLenResult = ko.computed(function () {
+ var iCount = this.threadsLen();
+ return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
+ }, this);
+ }
+
+ /**
+ * @static
+ * @param {AjaxJsonMessage} oJsonMessage
+ * @return {?MessageModel}
+ */
+ MessageModel.newInstanceFromJson = function (oJsonMessage)
+ {
+ var oMessageModel = new MessageModel();
+ return oMessageModel.initByJson(oJsonMessage) ? oMessageModel : null;
+ };
+
+ /**
+ * @static
+ * @param {number} iTimeStampInUTC
+ * @return {string}
+ */
+ MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
+ {
+ return 0 < iTimeStampInUTC ? moment.unix(iTimeStampInUTC).format('LLL') : '';
+ };
+
+ /**
+ * @static
+ * @param {Array} aEmail
+ * @param {boolean=} bFriendlyView
+ * @param {boolean=} bWrapWithLink = false
+ * @return {string}
+ */
+ MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
+ {
+ var
+ aResult = [],
+ iIndex = 0,
+ iLen = 0
+ ;
+
+ if (Utils.isNonEmptyArray(aEmail))
+ {
+ for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
+ {
+ aResult.push(aEmail[iIndex].toLine(bFriendlyView, bWrapWithLink));
+ }
+ }
+
+ return aResult.join(', ');
+ };
+
+ /**
+ * @static
+ * @param {Array} aEmail
+ * @return {string}
+ */
+ MessageModel.emailsToLineClear = function (aEmail)
+ {
+ var
+ aResult = [],
+ iIndex = 0,
+ iLen = 0
+ ;
+
+ if (Utils.isNonEmptyArray(aEmail))
+ {
+ for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
+ {
+ if (aEmail[iIndex] && aEmail[iIndex].email && '' !== aEmail[iIndex].name)
+ {
+ aResult.push(aEmail[iIndex].email);
+ }
+ }
+ }
+
+ return aResult.join(', ');
+ };
+
+ /**
+ * @static
+ * @param {?Array} aJsonEmails
+ * @return {Array.}
+ */
+ MessageModel.initEmailsFromJson = function (aJsonEmails)
+ {
+ var
+ iIndex = 0,
+ iLen = 0,
+ oEmailModel = null,
+ aResult = []
+ ;
+
+ if (Utils.isNonEmptyArray(aJsonEmails))
+ {
+ for (iIndex = 0, iLen = aJsonEmails.length; iIndex < iLen; iIndex++)
+ {
+ oEmailModel = EmailModel.newInstanceFromJson(aJsonEmails[iIndex]);
+ if (oEmailModel)
+ {
+ aResult.push(oEmailModel);
+ }
+ }
+ }
+
+ return aResult;
+ };
+
+ /**
+ * @static
+ * @param {Array.} aMessageEmails
+ * @param {Object} oLocalUnic
+ * @param {Array} aLocalEmails
+ */
+ MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
+ {
+ if (aMessageEmails && 0 < aMessageEmails.length)
+ {
+ var
+ iIndex = 0,
+ iLen = aMessageEmails.length
+ ;
+
+ for (; iIndex < iLen; iIndex++)
+ {
+ if (Utils.isUnd(oLocalUnic[aMessageEmails[iIndex].email]))
+ {
+ oLocalUnic[aMessageEmails[iIndex].email] = true;
+ aLocalEmails.push(aMessageEmails[iIndex]);
+ }
+ }
+ }
+ };
+
+ MessageModel.prototype.clear = function ()
+ {
+ this.folderFullNameRaw = '';
+ this.uid = '';
+ this.hash = '';
+ this.requestHash = '';
+ this.subject('');
+ this.subjectPrefix('');
+ this.subjectSuffix('');
+ this.size(0);
+ this.dateTimeStampInUTC(0);
+ this.priority(Enums.MessagePriority.Normal);
+
+ this.proxy = false;
+
+ this.fromEmailString('');
+ this.fromClearEmailString('');
+ this.toEmailsString('');
+ this.toClearEmailsString('');
+ this.senderEmailsString('');
+ this.senderClearEmailsString('');
+
+ this.emails = [];
+
+ this.from = [];
+ this.to = [];
+ this.cc = [];
+ this.bcc = [];
+ this.replyTo = [];
+ this.deliveredTo = [];
+
+ this.newForAnimation(false);
+
+ this.deleted(false);
+ this.unseen(false);
+ this.flagged(false);
+ this.answered(false);
+ this.forwarded(false);
+ this.isReadReceipt(false);
+
+ this.selected(false);
+ this.checked(false);
+ this.hasAttachments(false);
+ this.attachmentsMainType('');
+
+ this.body = null;
+ this.isHtml(false);
+ this.hasImages(false);
+ this.attachments([]);
+
+ this.isPgpSigned(false);
+ this.isPgpEncrypted(false);
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
+ this.pgpSignedVerifyUser('');
+
+ this.priority(Enums.MessagePriority.Normal);
+ this.readReceipt('');
+ this.aDraftInfo = [];
+ this.sMessageId = '';
+ this.sInReplyTo = '';
+ this.sReferences = '';
+
+ this.parentUid(0);
+ this.threads([]);
+ this.threadsLen(0);
+ this.hasUnseenSubMessage(false);
+ this.hasFlaggedSubMessage(false);
+
+ this.lastInCollapsedThread(false);
+ this.lastInCollapsedThreadLoading(false);
+ };
+
+ MessageModel.prototype.computeSenderEmail = function ()
+ {
+ var
+ Data = require('../Storages/WebMailDataStorage.js'),
+ sSent = Data.sentFolder(),
+ sDraft = Data.draftFolder()
+ ;
+
+ this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
+ this.toEmailsString() : this.fromEmailString());
+
+ this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
+ this.toClearEmailsString() : this.fromClearEmailString());
+ };
+
+ /**
+ * @param {AjaxJsonMessage} oJsonMessage
+ * @return {boolean}
+ */
+ MessageModel.prototype.initByJson = function (oJsonMessage)
+ {
+ var bResult = false;
+ if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
+ {
+ this.folderFullNameRaw = oJsonMessage.Folder;
+ this.uid = oJsonMessage.Uid;
+ this.hash = oJsonMessage.Hash;
+ this.requestHash = oJsonMessage.RequestHash;
+
+ this.proxy = !!oJsonMessage.ExternalProxy;
+
+ this.size(Utils.pInt(oJsonMessage.Size));
+
+ this.from = MessageModel.initEmailsFromJson(oJsonMessage.From);
+ this.to = MessageModel.initEmailsFromJson(oJsonMessage.To);
+ this.cc = MessageModel.initEmailsFromJson(oJsonMessage.Cc);
+ this.bcc = MessageModel.initEmailsFromJson(oJsonMessage.Bcc);
+ this.replyTo = MessageModel.initEmailsFromJson(oJsonMessage.ReplyTo);
+ this.deliveredTo = MessageModel.initEmailsFromJson(oJsonMessage.DeliveredTo);
+
+ this.subject(oJsonMessage.Subject);
+ if (Utils.isArray(oJsonMessage.SubjectParts))
+ {
+ this.subjectPrefix(oJsonMessage.SubjectParts[0]);
+ this.subjectSuffix(oJsonMessage.SubjectParts[1]);
+ }
+ else
+ {
+ this.subjectPrefix('');
+ this.subjectSuffix(this.subject());
+ }
+
+ this.dateTimeStampInUTC(Utils.pInt(oJsonMessage.DateTimeStampInUTC));
+ this.hasAttachments(!!oJsonMessage.HasAttachments);
+ this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
+
+ this.fromEmailString(MessageModel.emailsToLine(this.from, true));
+ this.fromClearEmailString(MessageModel.emailsToLineClear(this.from));
+ this.toEmailsString(MessageModel.emailsToLine(this.to, true));
+ this.toClearEmailsString(MessageModel.emailsToLineClear(this.to));
+
+ this.parentUid(Utils.pInt(oJsonMessage.ParentThread));
+ this.threads(Utils.isArray(oJsonMessage.Threads) ? oJsonMessage.Threads : []);
+ this.threadsLen(Utils.pInt(oJsonMessage.ThreadsLen));
+
+ this.initFlagsByJson(oJsonMessage);
+ this.computeSenderEmail();
+
+ bResult = true;
+ }
+
+ return bResult;
+ };
+
+ /**
+ * @param {AjaxJsonMessage} oJsonMessage
+ * @return {boolean}
+ */
+ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
+ {
+ var
+ Data = require('../Storages/WebMailDataStorage.js'),
+ bResult = false,
+ iPriority = Enums.MessagePriority.Normal
+ ;
+
+ if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
+ {
+ iPriority = Utils.pInt(oJsonMessage.Priority);
+ this.priority(-1 < Utils.inArray(iPriority, [Enums.MessagePriority.High, Enums.MessagePriority.Low]) ?
+ iPriority : Enums.MessagePriority.Normal);
+
+ this.aDraftInfo = oJsonMessage.DraftInfo;
+
+ this.sMessageId = oJsonMessage.MessageId;
+ this.sInReplyTo = oJsonMessage.InReplyTo;
+ this.sReferences = oJsonMessage.References;
+
+ this.proxy = !!oJsonMessage.ExternalProxy;
+
+ if (Data.capaOpenPGP())
+ {
+ this.isPgpSigned(!!oJsonMessage.PgpSigned);
+ this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
+ }
+
+ this.hasAttachments(!!oJsonMessage.HasAttachments);
+ this.attachmentsMainType(oJsonMessage.AttachmentsMainType);
+
+ this.foundedCIDs = Utils.isArray(oJsonMessage.FoundedCIDs) ? oJsonMessage.FoundedCIDs : [];
+ this.attachments(this.initAttachmentsFromJson(oJsonMessage.Attachments));
+
+ this.readReceipt(oJsonMessage.ReadReceipt || '');
+
+ this.computeSenderEmail();
+
+ bResult = true;
+ }
+
+ return bResult;
+ };
+
+ /**
+ * @param {(AjaxJsonAttachment|null)} oJsonAttachments
+ * @return {Array}
+ */
+ MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
+ {
+ var
+ iIndex = 0,
+ iLen = 0,
+ oAttachmentModel = null,
+ aResult = []
+ ;
+
+ if (oJsonAttachments && 'Collection/AttachmentCollection' === oJsonAttachments['@Object'] &&
+ Utils.isNonEmptyArray(oJsonAttachments['@Collection']))
+ {
+ for (iIndex = 0, iLen = oJsonAttachments['@Collection'].length; iIndex < iLen; iIndex++)
+ {
+ oAttachmentModel = AttachmentModel.newInstanceFromJson(oJsonAttachments['@Collection'][iIndex]);
+ if (oAttachmentModel)
+ {
+ if ('' !== oAttachmentModel.cidWithOutTags && 0 < this.foundedCIDs.length &&
+ 0 <= Utils.inArray(oAttachmentModel.cidWithOutTags, this.foundedCIDs))
+ {
+ oAttachmentModel.isLinked = true;
+ }
+
+ aResult.push(oAttachmentModel);
+ }
+ }
+ }
+
+ return aResult;
+ };
+
+ /**
+ * @param {AjaxJsonMessage} oJsonMessage
+ * @return {boolean}
+ */
+ MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
+ {
+ var bResult = false;
+
+ if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
+ {
+ this.unseen(!oJsonMessage.IsSeen);
+ this.flagged(!!oJsonMessage.IsFlagged);
+ this.answered(!!oJsonMessage.IsAnswered);
+ this.forwarded(!!oJsonMessage.IsForwarded);
+ this.isReadReceipt(!!oJsonMessage.IsReadReceipt);
+
+ bResult = true;
+ }
+
+ return bResult;
+ };
+
+ /**
+ * @param {boolean} bFriendlyView
+ * @param {boolean=} bWrapWithLink = false
+ * @return {string}
+ */
+ MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
+ {
+ return MessageModel.emailsToLine(this.from, bFriendlyView, bWrapWithLink);
+ };
+
+ /**
+ * @param {boolean} bFriendlyView
+ * @param {boolean=} bWrapWithLink = false
+ * @return {string}
+ */
+ MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
+ {
+ return MessageModel.emailsToLine(this.to, bFriendlyView, bWrapWithLink);
+ };
+
+ /**
+ * @param {boolean} bFriendlyView
+ * @param {boolean=} bWrapWithLink = false
+ * @return {string}
+ */
+ MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
+ {
+ return MessageModel.emailsToLine(this.cc, bFriendlyView, bWrapWithLink);
+ };
+
+ /**
+ * @param {boolean} bFriendlyView
+ * @param {boolean=} bWrapWithLink = false
+ * @return {string}
+ */
+ MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
+ {
+ return MessageModel.emailsToLine(this.bcc, bFriendlyView, bWrapWithLink);
+ };
+
+ /**
+ * @return string
+ */
+ MessageModel.prototype.lineAsCcc = function ()
+ {
+ var aResult = [];
+ if (this.deleted())
+ {
+ aResult.push('deleted');
+ }
+ if (this.selected())
+ {
+ aResult.push('selected');
+ }
+ if (this.checked())
+ {
+ aResult.push('checked');
+ }
+ if (this.flagged())
+ {
+ aResult.push('flagged');
+ }
+ if (this.unseen())
+ {
+ aResult.push('unseen');
+ }
+ if (this.answered())
+ {
+ aResult.push('answered');
+ }
+ if (this.forwarded())
+ {
+ aResult.push('forwarded');
+ }
+ if (this.focused())
+ {
+ aResult.push('focused');
+ }
+ if (this.hasAttachments())
+ {
+ aResult.push('withAttachments');
+ switch (this.attachmentsMainType())
+ {
+ case 'image':
+ aResult.push('imageOnlyAttachments');
+ break;
+ case 'archive':
+ aResult.push('archiveOnlyAttachments');
+ break;
+ }
+ }
+ if (this.newForAnimation())
+ {
+ aResult.push('new');
+ }
+ if ('' === this.subject())
+ {
+ aResult.push('emptySubject');
+ }
+ if (0 < this.parentUid())
+ {
+ aResult.push('hasParentMessage');
+ }
+ if (0 < this.threadsLen() && 0 === this.parentUid())
+ {
+ aResult.push('hasChildrenMessage');
+ }
+ if (this.hasUnseenSubMessage())
+ {
+ aResult.push('hasUnseenSubMessage');
+ }
+ if (this.hasFlaggedSubMessage())
+ {
+ aResult.push('hasFlaggedSubMessage');
+ }
+
+ return aResult.join(' ');
+ };
+
+ /**
+ * @return {boolean}
+ */
+ MessageModel.prototype.hasVisibleAttachments = function ()
+ {
+ return !!_.find(this.attachments(), function (oAttachment) {
+ return !oAttachment.isLinked;
+ });
+ };
+
+ /**
+ * @param {string} sCid
+ * @return {*}
+ */
+ MessageModel.prototype.findAttachmentByCid = function (sCid)
+ {
+ var
+ oResult = null,
+ aAttachments = this.attachments()
+ ;
+
+ if (Utils.isNonEmptyArray(aAttachments))
+ {
+ sCid = sCid.replace(/^<+/, '').replace(/>+$/, '');
+ oResult = _.find(aAttachments, function (oAttachment) {
+ return sCid === oAttachment.cidWithOutTags;
+ });
+ }
+
+ return oResult || null;
+ };
+
+ /**
+ * @param {string} sContentLocation
+ * @return {*}
+ */
+ MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
+ {
+ var
+ oResult = null,
+ aAttachments = this.attachments()
+ ;
+
+ if (Utils.isNonEmptyArray(aAttachments))
+ {
+ oResult = _.find(aAttachments, function (oAttachment) {
+ return sContentLocation === oAttachment.contentLocation;
+ });
+ }
+
+ return oResult || null;
+ };
+
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.messageId = function ()
+ {
+ return this.sMessageId;
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.inReplyTo = function ()
+ {
+ return this.sInReplyTo;
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.references = function ()
+ {
+ return this.sReferences;
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.fromAsSingleEmail = function ()
+ {
+ return Utils.isArray(this.from) && this.from[0] ? this.from[0].email : '';
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.viewLink = function ()
+ {
+ return LinkBuilder.messageViewLink(this.requestHash);
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.downloadLink = function ()
+ {
+ return LinkBuilder.messageDownloadLink(this.requestHash);
+ };
+
+ /**
+ * @param {Object} oExcludeEmails
+ * @return {Array}
+ */
+ MessageModel.prototype.replyEmails = function (oExcludeEmails)
+ {
+ var
+ aResult = [],
+ oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
+ ;
+
+ MessageModel.replyHelper(this.replyTo, oUnic, aResult);
+ if (0 === aResult.length)
+ {
+ MessageModel.replyHelper(this.from, oUnic, aResult);
+ }
+
+ return aResult;
+ };
+
+ /**
+ * @param {Object} oExcludeEmails
+ * @return {Array.}
+ */
+ MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
+ {
+ var
+ aToResult = [],
+ aCcResult = [],
+ oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
+ ;
+
+ MessageModel.replyHelper(this.replyTo, oUnic, aToResult);
+ if (0 === aToResult.length)
+ {
+ MessageModel.replyHelper(this.from, oUnic, aToResult);
+ }
+
+ MessageModel.replyHelper(this.to, oUnic, aToResult);
+ MessageModel.replyHelper(this.cc, oUnic, aCcResult);
+
+ return [aToResult, aCcResult];
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.textBodyToString = function ()
+ {
+ return this.body ? this.body.html() : '';
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.attachmentsToStringLine = function ()
+ {
+ var aAttachLines = _.map(this.attachments(), function (oItem) {
+ return oItem.fileName + ' (' + oItem.friendlySize + ')';
+ });
+
+ return aAttachLines && 0 < aAttachLines.length ? aAttachLines.join(', ') : '';
+ };
+
+ /**
+ * @return {Object}
+ */
+ MessageModel.prototype.getDataForWindowPopup = function ()
+ {
+ return {
+ 'popupFrom': this.fromToLine(false),
+ 'popupTo': this.toToLine(false),
+ 'popupCc': this.ccToLine(false),
+ 'popupBcc': this.bccToLine(false),
+ 'popupSubject': this.subject(),
+ 'popupDate': this.fullFormatDateValue(),
+ 'popupAttachments': this.attachmentsToStringLine(),
+ 'popupBody': this.textBodyToString()
+ };
+ };
+
+ /**
+ * @param {boolean=} bPrint = false
+ */
+ MessageModel.prototype.viewPopupMessage = function (bPrint)
+ {
+ Utils.windowPopupKnockout(this.getDataForWindowPopup(), 'PopupsWindowSimpleMessage', this.subject(), function (oPopupWin) {
+ if (oPopupWin && oPopupWin.document && oPopupWin.document.body)
+ {
+ $('img.lazy', oPopupWin.document.body).each(function (iIndex, oImg) {
+
+ var
+ $oImg = $(oImg),
+ sOrig = $oImg.data('original'),
+ sSrc = $oImg.attr('src')
+ ;
+
+ if (0 <= iIndex && sOrig && !sSrc)
+ {
+ $oImg.attr('src', sOrig);
+ }
+ });
+
+ if (bPrint)
+ {
+ window.setTimeout(function () {
+ oPopupWin.print();
+ }, 100);
+ }
+ }
+ });
+ };
+
+ MessageModel.prototype.printMessage = function ()
+ {
+ this.viewPopupMessage(true);
+ };
+
+ /**
+ * @returns {string}
+ */
+ MessageModel.prototype.generateUid = function ()
+ {
+ return this.folderFullNameRaw + '/' + this.uid;
+ };
+
+ /**
+ * @param {MessageModel} oMessage
+ * @return {MessageModel}
+ */
+ MessageModel.prototype.populateByMessageListItem = function (oMessage)
+ {
+ this.folderFullNameRaw = oMessage.folderFullNameRaw;
+ this.uid = oMessage.uid;
+ this.hash = oMessage.hash;
+ this.requestHash = oMessage.requestHash;
+ this.subject(oMessage.subject());
+ this.subjectPrefix(this.subjectPrefix());
+ this.subjectSuffix(this.subjectSuffix());
+
+ this.size(oMessage.size());
+ this.dateTimeStampInUTC(oMessage.dateTimeStampInUTC());
+ this.priority(oMessage.priority());
+
+ this.proxy = oMessage.proxy;
+
+ this.fromEmailString(oMessage.fromEmailString());
+ this.fromClearEmailString(oMessage.fromClearEmailString());
+ this.toEmailsString(oMessage.toEmailsString());
+ this.toClearEmailsString(oMessage.toClearEmailsString());
+
+ this.emails = oMessage.emails;
+
+ this.from = oMessage.from;
+ this.to = oMessage.to;
+ this.cc = oMessage.cc;
+ this.bcc = oMessage.bcc;
+ this.replyTo = oMessage.replyTo;
+ this.deliveredTo = oMessage.deliveredTo;
+
+ this.unseen(oMessage.unseen());
+ this.flagged(oMessage.flagged());
+ this.answered(oMessage.answered());
+ this.forwarded(oMessage.forwarded());
+ this.isReadReceipt(oMessage.isReadReceipt());
+
+ this.selected(oMessage.selected());
+ this.checked(oMessage.checked());
+ this.hasAttachments(oMessage.hasAttachments());
+ this.attachmentsMainType(oMessage.attachmentsMainType());
+
+ this.moment(oMessage.moment());
+
+ this.body = null;
+
+ this.priority(Enums.MessagePriority.Normal);
+ this.aDraftInfo = [];
+ this.sMessageId = '';
+ this.sInReplyTo = '';
+ this.sReferences = '';
+
+ this.parentUid(oMessage.parentUid());
+ this.threads(oMessage.threads());
+ this.threadsLen(oMessage.threadsLen());
+
+ this.computeSenderEmail();
+
+ return this;
+ };
+
+ MessageModel.prototype.showExternalImages = function (bLazy)
+ {
+ if (this.body && this.body.data('rl-has-images'))
+ {
+ var sAttr = '';
+ bLazy = Utils.isUnd(bLazy) ? false : bLazy;
+
+ this.hasImages(false);
+ this.body.data('rl-has-images', false);
+
+ sAttr = this.proxy ? 'data-x-additional-src' : 'data-x-src';
+ $('[' + sAttr + ']', this.body).each(function () {
+ if (bLazy && $(this).is('img'))
+ {
+ $(this)
+ .addClass('lazy')
+ .attr('data-original', $(this).attr(sAttr))
+ .removeAttr(sAttr)
+ ;
+ }
+ else
+ {
+ $(this).attr('src', $(this).attr(sAttr)).removeAttr(sAttr);
+ }
+ });
+
+ sAttr = this.proxy ? 'data-x-additional-style-url' : 'data-x-style-url';
+ $('[' + sAttr + ']', this.body).each(function () {
+ var sStyle = Utils.trim($(this).attr('style'));
+ sStyle = '' === sStyle ? '' : (';' === sStyle.substr(-1) ? sStyle + ' ' : sStyle + '; ');
+ $(this).attr('style', sStyle + $(this).attr(sAttr)).removeAttr(sAttr);
+ });
+
+ if (bLazy)
+ {
+ $('img.lazy', this.body).addClass('lazy-inited').lazyload({
+ 'threshold' : 400,
+ 'effect' : 'fadeIn',
+ 'skip_invisible' : false,
+ 'container': $('.RL-MailMessageView .messageView .messageItem .content')[0]
+ });
+
+ $window.resize();
+ }
+
+ Utils.windowResize(500);
+ }
+ };
+
+ MessageModel.prototype.showInternalImages = function (bLazy)
+ {
+ if (this.body && !this.body.data('rl-init-internal-images'))
+ {
+ this.body.data('rl-init-internal-images', true);
+
+ bLazy = Utils.isUnd(bLazy) ? false : bLazy;
+
+ var self = this;
+
+ $('[data-x-src-cid]', this.body).each(function () {
+
+ var oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-cid'));
+ if (oAttachment && oAttachment.download)
+ {
+ if (bLazy && $(this).is('img'))
+ {
+ $(this)
+ .addClass('lazy')
+ .attr('data-original', oAttachment.linkPreview());
+ }
+ else
+ {
+ $(this).attr('src', oAttachment.linkPreview());
+ }
+ }
+ });
+
+ $('[data-x-src-location]', this.body).each(function () {
+
+ var oAttachment = self.findAttachmentByContentLocation($(this).attr('data-x-src-location'));
+ if (!oAttachment)
+ {
+ oAttachment = self.findAttachmentByCid($(this).attr('data-x-src-location'));
+ }
+
+ if (oAttachment && oAttachment.download)
+ {
+ if (bLazy && $(this).is('img'))
+ {
+ $(this)
+ .addClass('lazy')
+ .attr('data-original', oAttachment.linkPreview());
+ }
+ else
+ {
+ $(this).attr('src', oAttachment.linkPreview());
+ }
+ }
+ });
+
+ $('[data-x-style-cid]', this.body).each(function () {
+
+ var
+ sStyle = '',
+ sName = '',
+ oAttachment = self.findAttachmentByCid($(this).attr('data-x-style-cid'))
+ ;
+
+ if (oAttachment && oAttachment.linkPreview)
+ {
+ sName = $(this).attr('data-x-style-cid-name');
+ if ('' !== sName)
+ {
+ sStyle = Utils.trim($(this).attr('style'));
+ sStyle = '' === sStyle ? '' : (';' === sStyle.substr(-1) ? sStyle + ' ' : sStyle + '; ');
+ $(this).attr('style', sStyle + sName + ': url(\'' + oAttachment.linkPreview() + '\')');
+ }
+ }
+ });
+
+ if (bLazy)
+ {
+ (function ($oImg, oContainer) {
+ _.delay(function () {
+ $oImg.addClass('lazy-inited').lazyload({
+ 'threshold' : 400,
+ 'effect' : 'fadeIn',
+ 'skip_invisible' : false,
+ 'container': oContainer
+ });
+ }, 300);
+ }($('img.lazy', self.body), $('.RL-MailMessageView .messageView .messageItem .content')[0]));
+ }
+
+ Utils.windowResize(500);
+ }
+ };
+
+ MessageModel.prototype.storeDataToDom = function ()
+ {
+ if (this.body)
+ {
+ this.body.data('rl-is-html', !!this.isHtml());
+ this.body.data('rl-has-images', !!this.hasImages());
+
+ this.body.data('rl-plain-raw', this.plainRaw);
+
+ var Data = require('../Storages/WebMailDataStorage.js');
+ if (Data.capaOpenPGP())
+ {
+ this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
+ this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
+ this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
+ this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
+ }
+ }
+ };
+
+ MessageModel.prototype.storePgpVerifyDataToDom = function ()
+ {
+ var Data = require('../Storages/WebMailDataStorage.js');
+ if (this.body && Data.capaOpenPGP())
+ {
+ this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
+ this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
+ }
+ };
+
+ MessageModel.prototype.fetchDataToDom = function ()
+ {
+ if (this.body)
+ {
+ this.isHtml(!!this.body.data('rl-is-html'));
+ this.hasImages(!!this.body.data('rl-has-images'));
+
+ this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
+
+ var Data = require('../Storages/WebMailDataStorage.js');
+ if (Data.capaOpenPGP())
+ {
+ this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
+ this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
+ this.pgpSignedVerifyStatus(this.body.data('rl-pgp-verify-status'));
+ this.pgpSignedVerifyUser(this.body.data('rl-pgp-verify-user'));
+ }
+ else
+ {
+ this.isPgpSigned(false);
+ this.isPgpEncrypted(false);
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
+ this.pgpSignedVerifyUser('');
+ }
+ }
+ };
+
+ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
+ {
+ if (this.isPgpSigned())
+ {
+ var
+ aRes = [],
+ mPgpMessage = null,
+ Data = require('../Storages/WebMailDataStorage.js'),
+ sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
+ aPublicKeys = Data.findPublicKeysByEmail(sFrom),
+ oValidKey = null,
+ oValidSysKey = null,
+ sPlain = ''
+ ;
+
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
+ this.pgpSignedVerifyUser('');
+
+ try
+ {
+ mPgpMessage = window.openpgp.cleartext.readArmored(this.plainRaw);
+ if (mPgpMessage && mPgpMessage.getText)
+ {
+ this.pgpSignedVerifyStatus(
+ aPublicKeys.length ? Enums.SignedVerifyStatus.Unverified : Enums.SignedVerifyStatus.UnknownPublicKeys);
+
+ aRes = mPgpMessage.verify(aPublicKeys);
+ if (aRes && 0 < aRes.length)
+ {
+ oValidKey = _.find(aRes, function (oItem) {
+ return oItem && oItem.keyid && oItem.valid;
+ });
+
+ if (oValidKey)
+ {
+ oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
+ if (oValidSysKey)
+ {
+ sPlain = mPgpMessage.getText();
+
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
+ this.pgpSignedVerifyUser(oValidSysKey.user);
+
+ sPlain =
+ $div.empty().append(
+ $('').text(sPlain)
+ ).html()
+ ;
+
+ $div.empty();
+
+ this.replacePlaneTextBody(sPlain);
+ }
+ }
+ }
+ }
+ }
+ catch (oExc) {}
+
+ this.storePgpVerifyDataToDom();
+ }
+ };
+
+ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
+ {
+ if (this.isPgpEncrypted())
+ {
+ var
+ aRes = [],
+ mPgpMessage = null,
+ mPgpMessageDecrypted = null,
+ Data = require('../Storages/WebMailDataStorage.js'),
+ sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
+ aPublicKey = Data.findPublicKeysByEmail(sFrom),
+ oPrivateKey = Data.findSelfPrivateKey(sPassword),
+ oValidKey = null,
+ oValidSysKey = null,
+ sPlain = ''
+ ;
+
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
+ this.pgpSignedVerifyUser('');
+
+ if (!oPrivateKey)
+ {
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.UnknownPrivateKey);
+ }
+
+ try
+ {
+ mPgpMessage = window.openpgp.message.readArmored(this.plainRaw);
+ if (mPgpMessage && oPrivateKey && mPgpMessage.decrypt)
+ {
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Unverified);
+
+ mPgpMessageDecrypted = mPgpMessage.decrypt(oPrivateKey);
+ if (mPgpMessageDecrypted)
+ {
+ aRes = mPgpMessageDecrypted.verify(aPublicKey);
+ if (aRes && 0 < aRes.length)
+ {
+ oValidKey = _.find(aRes, function (oItem) {
+ return oItem && oItem.keyid && oItem.valid;
+ });
+
+ if (oValidKey)
+ {
+ oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
+ if (oValidSysKey)
+ {
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
+ this.pgpSignedVerifyUser(oValidSysKey.user);
+ }
+ }
+ }
+
+ sPlain = mPgpMessageDecrypted.getText();
+
+ sPlain =
+ $div.empty().append(
+ $('').text(sPlain)
+ ).html()
+ ;
+
+ $div.empty();
+
+ this.replacePlaneTextBody(sPlain);
+ }
+ }
+ }
+ catch (oExc) {}
+
+ this.storePgpVerifyDataToDom();
+ }
+ };
+
+ MessageModel.prototype.replacePlaneTextBody = function (sPlain)
+ {
+ if (this.body)
+ {
+ this.body.html(sPlain).addClass('b-text-part plain');
+ }
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.flagHash = function ()
+ {
+ return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
+ this.isReadReceipt()].join('');
+ };
+
+ module.exports = MessageModel;
+
+}(module, require));
+},{"$":32,"$div":23,"$window":26,"../Storages/WebMailDataStorage.js":59,"./AttachmentModel.js":43,"./EmailModel.js":45,"Enums":17,"LinkBuilder":20,"Utils":22,"_":37,"ko":34,"moment":35,"window":38}],47:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+
+ kn = require('kn'),
+ KnoinAbstractScreen = require('KnoinAbstractScreen')
+ ;
+
+ /**
+ * @param {Array} aViewModels
+ * @constructor
+ * @extends KnoinAbstractScreen
+ */
+ function AbstractSettings(aViewModels)
+ {
+ KnoinAbstractScreen.call(this, 'settings', aViewModels);
+
+ this.menu = ko.observableArray([]);
+
+ this.oCurrentSubScreen = null;
+ this.oViewModelPlace = null;
+ }
+
+ _.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
+
+ AbstractSettings.prototype.onRoute = function (sSubName)
+ {
+ var
+ self = this,
+ oSettingsScreen = null,
+ RoutedSettingsViewModel = null,
+ oViewModelPlace = null,
+ oViewModelDom = null
+ ;
+
+ RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
+ return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
+ sSubName === SettingsViewModel.__rlSettingsData.Route;
+ });
+
+ if (RoutedSettingsViewModel)
+ {
+ if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
+ return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
+ }))
+ {
+ RoutedSettingsViewModel = null;
+ }
+
+ if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
+ return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
+ }))
+ {
+ RoutedSettingsViewModel = null;
+ }
+ }
+
+ if (RoutedSettingsViewModel)
+ {
+ if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
+ {
+ oSettingsScreen = RoutedSettingsViewModel.__vm;
+ }
+ else
+ {
+ oViewModelPlace = this.oViewModelPlace;
+ if (oViewModelPlace && 1 === oViewModelPlace.length)
+ {
+ RoutedSettingsViewModel = /** @type {?Function} */ RoutedSettingsViewModel;
+ oSettingsScreen = new RoutedSettingsViewModel();
+
+ oViewModelDom = $('').addClass('rl-settings-view-model').hide();
+ oViewModelDom.appendTo(oViewModelPlace);
+
+ oSettingsScreen.viewModelDom = oViewModelDom;
+
+ oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
+
+ RoutedSettingsViewModel.__dom = oViewModelDom;
+ RoutedSettingsViewModel.__builded = true;
+ RoutedSettingsViewModel.__vm = oSettingsScreen;
+
+ ko.applyBindingAccessorsToNode(oViewModelDom[0], {
+ 'i18nInit': true,
+ 'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
+ }, oSettingsScreen);
+
+ Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
+ }
+ else
+ {
+ Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
+ }
+ }
+
+ if (oSettingsScreen)
+ {
+ _.defer(function () {
+ // hide
+ if (self.oCurrentSubScreen)
+ {
+ Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
+ self.oCurrentSubScreen.viewModelDom.hide();
+ }
+ // --
+
+ self.oCurrentSubScreen = oSettingsScreen;
+
+ // show
+ if (self.oCurrentSubScreen)
+ {
+ self.oCurrentSubScreen.viewModelDom.show();
+ Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
+ Utils.delegateRun(self.oCurrentSubScreen, 'onFocus', [], 200);
+
+ _.each(self.menu(), function (oItem) {
+ oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
+ });
+
+ $('#rl-content .b-settings .b-content .content').scrollTop(0);
+ }
+ // --
+
+ Utils.windowResize();
+ });
+ }
+ }
+ else
+ {
+ kn.setHash(LinkBuilder.settings(), false, true);
+ }
+ };
+
+ AbstractSettings.prototype.onHide = function ()
+ {
+ if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
+ {
+ Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
+ this.oCurrentSubScreen.viewModelDom.hide();
+ }
+ };
+
+ AbstractSettings.prototype.onBuild = function ()
+ {
+ _.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
+ if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
+ !_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
+ return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
+ }))
+ {
+ this.menu.push({
+ 'route': SettingsViewModel.__rlSettingsData.Route,
+ 'label': SettingsViewModel.__rlSettingsData.Label,
+ 'selected': ko.observable(false),
+ 'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
+ return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
+ })
+ });
+ }
+ }, this);
+
+ this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
+ };
+
+ AbstractSettings.prototype.routes = function ()
+ {
+ var
+ DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
+ return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
+ }),
+ sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
+ oRules = {
+ 'subname': /^(.*)$/,
+ 'normalize_': function (oRequest, oVals) {
+ oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
+ return [oVals.subname];
+ }
+ }
+ ;
+
+ return [
+ ['{subname}/', oRules],
+ ['{subname}', oRules],
+ ['', oRules]
+ ];
+ };
+
+ module.exports = AbstractSettings;
+
+}(module, require));
+},{"$":32,"Globals":19,"KnoinAbstractScreen":41,"LinkBuilder":20,"Utils":22,"_":37,"kn":39,"ko":34}],48:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+ KnoinAbstractScreen = require('KnoinAbstractScreen')
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractScreen
+ */
+ function AdminLoginScreen()
+ {
+ var AdminLoginViewModel = require('../ViewModels/AdminLoginViewModel.js');
+ KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
+ }
+
+ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
+
+ AdminLoginScreen.prototype.onShow = function ()
+ {
+ var RL = require('../Boots/AdminApp.js');
+ RL.setTitle('');
+ };
+
+ module.exports = AdminLoginScreen;
+
+}(module, require));
+},{"../Boots/AdminApp.js":14,"../ViewModels/AdminLoginViewModel.js":60,"KnoinAbstractScreen":41,"_":37}],49:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+ AbstractSettings = require('./AbstractSettings.js')
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractSettings
+ */
+ function AdminSettingsScreen()
+ {
+ var
+ AdminMenuViewModel = require('../ViewModels/AdminMenuViewModel.js'),
+ AdminPaneViewModel = require('../ViewModels/AdminPaneViewModel.js')
+ ;
+
+ AbstractSettings.call(this, [
+ AdminMenuViewModel,
+ AdminPaneViewModel
+ ]);
+ }
+
+ _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
+
+ AdminSettingsScreen.prototype.onShow = function ()
+ {
+ var RL = require('../Boots/AdminApp.js');
+ RL.setTitle('');
+ };
+
+ module.exports = AdminSettingsScreen;
+
+}(module, require));
+},{"../Boots/AdminApp.js":14,"../ViewModels/AdminMenuViewModel.js":61,"../ViewModels/AdminPaneViewModel.js":62,"./AbstractSettings.js":47,"_":37}],50:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ window = require('window'),
+ $ = require('$'),
+
+ Consts = require('Consts'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ Plugins = require('Plugins'),
+ LinkBuilder = require('LinkBuilder'),
+
+ AppSettings = require('./AppSettings.js')
+ ;
+
+ /**
+ * @constructor
+ */
+ function AbstractAjaxRemoteStorage()
+ {
+ this.oRequests = {};
+ }
+
+ AbstractAjaxRemoteStorage.prototype.oRequests = {};
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sRequestAction
+ * @param {string} sType
+ * @param {?AjaxJsonDefaultResponse} oData
+ * @param {boolean} bCached
+ * @param {*=} oRequestParameters
+ */
+ AbstractAjaxRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
+ {
+ var
+ fCall = function () {
+ if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
+ {
+ sType = Enums.StorageResultType.Unload;
+ }
+
+ if (Enums.StorageResultType.Success === sType && oData && !oData.Result)
+ {
+ if (oData && -1 < Utils.inArray(oData.ErrorCode, [
+ Enums.Notification.AuthError, Enums.Notification.AccessError,
+ Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
+ Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
+ ]))
+ {
+ Globals.iAjaxErrorCount++;
+ }
+
+ if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
+ {
+ Globals.iTokenErrorCount++;
+ }
+
+ if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
+ {
+ if (Globals.__RL)
+ {
+ Globals.__RL.loginAndLogoutReload(true);
+ }
+ }
+
+ if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
+ {
+ if (window.__rlah_clear)
+ {
+ window.__rlah_clear();
+ }
+
+ if (Globals.__RL)
+ {
+ Globals.__RL.loginAndLogoutReload(true);
+ }
+ }
+ }
+ else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
+ {
+ Globals.iAjaxErrorCount = 0;
+ Globals.iTokenErrorCount = 0;
+ }
+
+ if (fCallback)
+ {
+ Plugins.runHook('ajax-default-response', [sRequestAction, Enums.StorageResultType.Success === sType ? oData : null, sType, bCached, oRequestParameters]);
+
+ fCallback(
+ sType,
+ Enums.StorageResultType.Success === sType ? oData : null,
+ bCached,
+ sRequestAction,
+ oRequestParameters
+ );
+ }
+ }
+ ;
+
+ switch (sType)
+ {
+ case 'success':
+ sType = Enums.StorageResultType.Success;
+ break;
+ case 'abort':
+ sType = Enums.StorageResultType.Abort;
+ break;
+ default:
+ sType = Enums.StorageResultType.Error;
+ break;
+ }
+
+ if (Enums.StorageResultType.Error === sType)
+ {
+ _.delay(fCall, 300);
+ }
+ else
+ {
+ fCall();
+ }
+ };
+
+ /**
+ * @param {?Function} fResultCallback
+ * @param {Object} oParameters
+ * @param {?number=} iTimeOut = 20000
+ * @param {string=} sGetAdd = ''
+ * @param {Array=} aAbortActions = []
+ * @return {jQuery.jqXHR}
+ */
+ AbstractAjaxRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
+ {
+ var
+ self = this,
+ bPost = '' === sGetAdd,
+ oHeaders = {},
+ iStart = (new window.Date()).getTime(),
+ oDefAjax = null,
+ sAction = ''
+ ;
+
+ oParameters = oParameters || {};
+ iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
+ sGetAdd = Utils.isUnd(sGetAdd) ? '' : Utils.pString(sGetAdd);
+ aAbortActions = Utils.isArray(aAbortActions) ? aAbortActions : [];
+
+ sAction = oParameters.Action || '';
+
+ if (sAction && 0 < aAbortActions.length)
+ {
+ _.each(aAbortActions, function (sActionToAbort) {
+ if (self.oRequests[sActionToAbort])
+ {
+ self.oRequests[sActionToAbort].__aborted = true;
+ if (self.oRequests[sActionToAbort].abort)
+ {
+ self.oRequests[sActionToAbort].abort();
+ }
+ self.oRequests[sActionToAbort] = null;
+ }
+ });
+ }
+
+ if (bPost)
+ {
+ oParameters['XToken'] = AppSettings.settingsGet('Token');
+ }
+
+ oDefAjax = $.ajax({
+ 'type': bPost ? 'POST' : 'GET',
+ 'url': LinkBuilder.ajax(sGetAdd),
+ 'async': true,
+ 'dataType': 'json',
+ 'data': bPost ? oParameters : {},
+ 'headers': oHeaders,
+ 'timeout': iTimeOut,
+ 'global': true
+ });
+
+ oDefAjax.always(function (oData, sType) {
+
+ var bCached = false;
+ if (oData && oData['Time'])
+ {
+ bCached = Utils.pInt(oData['Time']) > (new window.Date()).getTime() - iStart;
+ }
+
+ if (sAction && self.oRequests[sAction])
+ {
+ if (self.oRequests[sAction].__aborted)
+ {
+ sType = 'abort';
+ }
+
+ self.oRequests[sAction] = null;
+ }
+
+ self.defaultResponse(fResultCallback, sAction, sType, oData, bCached, oParameters);
+ });
+
+ if (sAction && 0 < aAbortActions.length && -1 < Utils.inArray(sAction, aAbortActions))
+ {
+ if (this.oRequests[sAction])
+ {
+ this.oRequests[sAction].__aborted = true;
+ if (this.oRequests[sAction].abort)
+ {
+ this.oRequests[sAction].abort();
+ }
+ this.oRequests[sAction] = null;
+ }
+
+ this.oRequests[sAction] = oDefAjax;
+ }
+
+ return oDefAjax;
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sAction
+ * @param {Object=} oParameters
+ * @param {?number=} iTimeout
+ * @param {string=} sGetAdd = ''
+ * @param {Array=} aAbortActions = []
+ */
+ AbstractAjaxRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
+ {
+ oParameters = oParameters || {};
+ oParameters.Action = sAction;
+
+ sGetAdd = Utils.pString(sGetAdd);
+
+ Plugins.runHook('ajax-default-request', [sAction, oParameters, sGetAdd]);
+
+ this.ajaxRequest(fCallback, oParameters,
+ Utils.isUnd(iTimeout) ? Consts.Defaults.DefaultAjaxTimeout : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AbstractAjaxRemoteStorage.prototype.noop = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'Noop');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sMessage
+ * @param {string} sFileName
+ * @param {number} iLineNo
+ * @param {string} sLocation
+ * @param {string} sHtmlCapa
+ * @param {number} iTime
+ */
+ AbstractAjaxRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
+ {
+ this.defaultRequest(fCallback, 'JsError', {
+ 'Message': sMessage,
+ 'FileName': sFileName,
+ 'LineNo': iLineNo,
+ 'Location': sLocation,
+ 'HtmlCapa': sHtmlCapa,
+ 'TimeOnPage': iTime
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sType
+ * @param {Array=} mData = null
+ * @param {boolean=} bIsError = false
+ */
+ AbstractAjaxRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
+ {
+ this.defaultRequest(fCallback, 'JsInfo', {
+ 'Type': sType,
+ 'Data': mData,
+ 'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AbstractAjaxRemoteStorage.prototype.getPublicKey = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'GetPublicKey');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sVersion
+ */
+ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
+ {
+ this.defaultRequest(fCallback, 'Version', {
+ 'Version': sVersion
+ });
+ };
+
+ module.exports = AbstractAjaxRemoteStorage;
+
+}(module, require));
+},{"$":32,"./AppSettings.js":54,"Consts":16,"Enums":17,"Globals":19,"LinkBuilder":20,"Plugins":21,"Utils":22,"window":38}],51:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+
+ AppSettings = require('./AppSettings.js')
;
/**
* @constructor
*/
- function ContactTagModel()
+ function AbstractData()
{
- this.idContactTag = 0;
- this.name = ko.observable('');
- this.readOnly = false;
+ Utils.initDataConstructorBySettings(this);
}
- ContactTagModel.prototype.parse = function (oItem)
+ AbstractData.prototype.populateDataOnStart = function()
{
- var bResult = false;
- if (oItem && 'Object/Tag' === oItem['@Object'])
+ var
+ mLayout = Utils.pInt(AppSettings.settingsGet('Layout')),
+ aLanguages = AppSettings.settingsGet('Languages'),
+ aThemes = AppSettings.settingsGet('Themes')
+ ;
+
+ if (Utils.isArray(aLanguages))
{
- this.idContact = Utils.pInt(oItem['IdContactTag']);
- this.name(Utils.pString(oItem['Name']));
- this.readOnly = !!oItem['ReadOnly'];
+ this.languages(aLanguages);
+ }
+
+ if (Utils.isArray(aThemes))
+ {
+ this.themes(aThemes);
+ }
+
+ this.mainLanguage(AppSettings.settingsGet('Language'));
+ this.mainTheme(AppSettings.settingsGet('Theme'));
+
+ this.capaAdditionalAccounts(AppSettings.capa(Enums.Capa.AdditionalAccounts));
+ this.capaAdditionalIdentities(AppSettings.capa(Enums.Capa.AdditionalIdentities));
+ this.capaGravatar(AppSettings.capa(Enums.Capa.Gravatar));
+ this.determineUserLanguage(!!AppSettings.settingsGet('DetermineUserLanguage'));
+ this.determineUserDomain(!!AppSettings.settingsGet('DetermineUserDomain'));
+
+ this.capaThemes(AppSettings.capa(Enums.Capa.Themes));
+ this.allowLanguagesOnLogin(!!AppSettings.settingsGet('AllowLanguagesOnLogin'));
+ this.allowLanguagesOnSettings(!!AppSettings.settingsGet('AllowLanguagesOnSettings'));
+ this.useLocalProxyForExternalImages(!!AppSettings.settingsGet('UseLocalProxyForExternalImages'));
+
+ this.editorDefaultType(AppSettings.settingsGet('EditorDefaultType'));
+ this.showImages(!!AppSettings.settingsGet('ShowImages'));
+ this.contactsAutosave(!!AppSettings.settingsGet('ContactsAutosave'));
+ this.interfaceAnimation(AppSettings.settingsGet('InterfaceAnimation'));
+
+ this.mainMessagesPerPage(AppSettings.settingsGet('MPP'));
+
+ this.desktopNotifications(!!AppSettings.settingsGet('DesktopNotifications'));
+ this.useThreads(!!AppSettings.settingsGet('UseThreads'));
+ this.replySameFolder(!!AppSettings.settingsGet('ReplySameFolder'));
+ this.useCheckboxesInList(!!AppSettings.settingsGet('UseCheckboxesInList'));
+
+ this.layout(Enums.Layout.SidePreview);
+ if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
+ {
+ this.layout(mLayout);
+ }
+ this.facebookSupported(!!AppSettings.settingsGet('SupportedFacebookSocial'));
+ this.facebookEnable(!!AppSettings.settingsGet('AllowFacebookSocial'));
+ this.facebookAppID(AppSettings.settingsGet('FacebookAppID'));
+ this.facebookAppSecret(AppSettings.settingsGet('FacebookAppSecret'));
+
+ this.twitterEnable(!!AppSettings.settingsGet('AllowTwitterSocial'));
+ this.twitterConsumerKey(AppSettings.settingsGet('TwitterConsumerKey'));
+ this.twitterConsumerSecret(AppSettings.settingsGet('TwitterConsumerSecret'));
+
+ this.googleEnable(!!AppSettings.settingsGet('AllowGoogleSocial'));
+ this.googleClientID(AppSettings.settingsGet('GoogleClientID'));
+ this.googleClientSecret(AppSettings.settingsGet('GoogleClientSecret'));
+ this.googleApiKey(AppSettings.settingsGet('GoogleApiKey'));
+
+ this.dropboxEnable(!!AppSettings.settingsGet('AllowDropboxSocial'));
+ this.dropboxApiKey(AppSettings.settingsGet('DropboxApiKey'));
+
+ this.contactsIsAllowed(!!AppSettings.settingsGet('ContactsIsAllowed'));
+ };
+
+ module.exports = AbstractData;
+
+}(module, require));
+},{"./AppSettings.js":54,"Enums":17,"Utils":22}],52:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+
+ AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js')
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractAjaxRemoteStorage
+ */
+ function AdminAjaxRemoteStorage()
+ {
+ AbstractAjaxRemoteStorage.call(this);
+
+ this.oRequests = {};
+ }
+
+ _.extend(AdminAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype);
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sLogin
+ * @param {string} sPassword
+ */
+ AdminAjaxRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
+ {
+ this.defaultRequest(fCallback, 'AdminLogin', {
+ 'Login': sLogin,
+ 'Password': sPassword
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.adminLogout = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminLogout');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {?} oData
+ */
+ AdminAjaxRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
+ {
+ this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.domainList = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminDomainList');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.pluginList = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminPluginList');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.packagesList = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminPackagesList');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.coreData = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminCoreData');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.updateCoreData = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Object} oPackage
+ */
+ AdminAjaxRemoteStorage.prototype.packageInstall = function (fCallback, oPackage)
+ {
+ this.defaultRequest(fCallback, 'AdminPackageInstall', {
+ 'Id': oPackage.id,
+ 'Type': oPackage.type,
+ 'File': oPackage.file
+ }, 60000);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Object} oPackage
+ */
+ AdminAjaxRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
+ {
+ this.defaultRequest(fCallback, 'AdminPackageDelete', {
+ 'Id': oPackage.id
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sName
+ */
+ AdminAjaxRemoteStorage.prototype.domain = function (fCallback, sName)
+ {
+ this.defaultRequest(fCallback, 'AdminDomainLoad', {
+ 'Name': sName
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sName
+ */
+ AdminAjaxRemoteStorage.prototype.plugin = function (fCallback, sName)
+ {
+ this.defaultRequest(fCallback, 'AdminPluginLoad', {
+ 'Name': sName
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sName
+ */
+ AdminAjaxRemoteStorage.prototype.domainDelete = function (fCallback, sName)
+ {
+ this.defaultRequest(fCallback, 'AdminDomainDelete', {
+ 'Name': sName
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sName
+ * @param {boolean} bDisabled
+ */
+ AdminAjaxRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
+ {
+ return this.defaultRequest(fCallback, 'AdminDomainDisable', {
+ 'Name': sName,
+ 'Disabled': !!bDisabled ? '1' : '0'
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Object} oConfig
+ */
+ AdminAjaxRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
+ {
+ return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {boolean} bForce
+ */
+ AdminAjaxRemoteStorage.prototype.licensing = function (fCallback, bForce)
+ {
+ return this.defaultRequest(fCallback, 'AdminLicensing', {
+ 'Force' : bForce ? '1' : '0'
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sDomain
+ * @param {string} sKey
+ */
+ AdminAjaxRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
+ {
+ return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
+ 'Domain' : sDomain,
+ 'Key' : sKey
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sName
+ * @param {boolean} bDisabled
+ */
+ AdminAjaxRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
+ {
+ return this.defaultRequest(fCallback, 'AdminPluginDisable', {
+ 'Name': sName,
+ 'Disabled': !!bDisabled ? '1' : '0'
+ });
+ };
+
+ AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
+ bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin,
+ sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList)
+ {
+ this.defaultRequest(fCallback, 'AdminDomainSave', {
+ 'Create': bCreate ? '1' : '0',
+ 'Name': sName,
+ 'IncHost': sIncHost,
+ 'IncPort': iIncPort,
+ 'IncSecure': sIncSecure,
+ 'IncShortLogin': bIncShortLogin ? '1' : '0',
+ 'OutHost': sOutHost,
+ 'OutPort': iOutPort,
+ 'OutSecure': sOutSecure,
+ 'OutShortLogin': bOutShortLogin ? '1' : '0',
+ 'OutAuth': bOutAuth ? '1' : '0',
+ 'WhiteList': sWhiteList
+ });
+ };
+
+ AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
+ sIncHost, iIncPort, sIncSecure,
+ sOutHost, iOutPort, sOutSecure, bOutAuth)
+ {
+ this.defaultRequest(fCallback, 'AdminDomainTest', {
+ 'Name': sName,
+ 'IncHost': sIncHost,
+ 'IncPort': iIncPort,
+ 'IncSecure': sIncSecure,
+ 'OutHost': sOutHost,
+ 'OutPort': iOutPort,
+ 'OutSecure': sOutSecure,
+ 'OutAuth': bOutAuth ? '1' : '0'
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {?} oData
+ */
+ AdminAjaxRemoteStorage.prototype.testContacts = function (fCallback, oData)
+ {
+ this.defaultRequest(fCallback, 'AdminContactsTest', oData);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {?} oData
+ */
+ AdminAjaxRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
+ {
+ this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AdminPing');
+ };
+
+ module.exports = new AdminAjaxRemoteStorage();
+
+}(module, require));
+},{"./AbstractAjaxRemoteStorage.js":50,"_":37}],53:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+ ko = require('ko'),
+
+ AbstractData = require('./AbstractData.js')
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractData
+ */
+ function AdminDataStorage()
+ {
+ AbstractData.call(this);
+
+ this.domainsLoading = ko.observable(false).extend({'throttle': 100});
+ this.domains = ko.observableArray([]);
+
+ this.pluginsLoading = ko.observable(false).extend({'throttle': 100});
+ this.plugins = ko.observableArray([]);
+
+ this.packagesReal = ko.observable(true);
+ this.packagesMainUpdatable = ko.observable(true);
+ this.packagesLoading = ko.observable(false).extend({'throttle': 100});
+ this.packages = ko.observableArray([]);
+
+ this.coreReal = ko.observable(true);
+ this.coreUpdatable = ko.observable(true);
+ this.coreAccess = ko.observable(true);
+ this.coreChecking = ko.observable(false).extend({'throttle': 100});
+ this.coreUpdating = ko.observable(false).extend({'throttle': 100});
+ this.coreRemoteVersion = ko.observable('');
+ this.coreRemoteRelease = ko.observable('');
+ this.coreVersionCompare = ko.observable(-2);
+
+ this.licensing = ko.observable(false);
+ this.licensingProcess = ko.observable(false);
+ this.licenseValid = ko.observable(false);
+ this.licenseExpired = ko.observable(0);
+ this.licenseError = ko.observable('');
+
+ this.licenseTrigger = ko.observable(false);
+
+ this.adminManLoading = ko.computed(function () {
+ return '000' !== [this.domainsLoading() ? '1' : '0', this.pluginsLoading() ? '1' : '0', this.packagesLoading() ? '1' : '0'].join('');
+ }, this);
+
+ this.adminManLoadingVisibility = ko.computed(function () {
+ return this.adminManLoading() ? 'visible' : 'hidden';
+ }, this).extend({'rateLimit': 300});
+ }
+
+ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
+
+ AdminDataStorage.prototype.populateDataOnStart = function()
+ {
+ AbstractData.prototype.populateDataOnStart.call(this);
+ };
+
+ module.exports = new AdminDataStorage();
+
+}(module, require));
+},{"./AbstractData.js":51,"_":37,"ko":34}],54:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ AppData = require('AppData'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @constructor
+ */
+ function AppSettings()
+ {
+ this.oSettings = null;
+ }
+
+ AppSettings.prototype.oSettings = null;
+
+ /**
+ * @param {string} sName
+ * @return {?}
+ */
+ AppSettings.prototype.settingsGet = function (sName)
+ {
+ if (null === this.oSettings)
+ {
+ this.oSettings = Utils.isNormal(AppData) ? AppData : {};
+ }
+
+ return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
+ };
+
+ /**
+ * @param {string} sName
+ * @param {?} mValue
+ */
+ AppSettings.prototype.settingsSet = function (sName, mValue)
+ {
+ if (null === this.oSettings)
+ {
+ this.oSettings = Utils.isNormal(AppData) ? AppData : {};
+ }
+
+ this.oSettings[sName] = mValue;
+ };
+
+ /**
+ * @param {string} sName
+ * @return {boolean}
+ */
+ AppSettings.prototype.capa = function (sName)
+ {
+ var mCapa = this.settingsGet('Capa');
+ return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
+ };
+
+
+ module.exports = new AppSettings();
+
+}(module, require));
+},{"AppData":27,"Utils":22}],55:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+
+ CookieDriver = require('./LocalStorages/CookieDriver.js'),
+ LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js')
+ ;
+
+ /**
+ * @constructor
+ */
+ function LocalStorage()
+ {
+ var
+ NextStorageDriver = _.find([LocalStorageDriver, CookieDriver], function (NextStorageDriver) {
+ return NextStorageDriver.supported();
+ })
+ ;
+
+ this.oDriver = null;
+
+ if (NextStorageDriver)
+ {
+ NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
+ this.oDriver = new NextStorageDriver();
+ }
+ }
+
+ LocalStorage.prototype.oDriver = null;
+
+ /**
+ * @param {number} iKey
+ * @param {*} mData
+ * @return {boolean}
+ */
+ LocalStorage.prototype.set = function (iKey, mData)
+ {
+ return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
+ };
+
+ /**
+ * @param {number} iKey
+ * @return {*}
+ */
+ LocalStorage.prototype.get = function (iKey)
+ {
+ return this.oDriver ? this.oDriver.get('p' + iKey) : null;
+ };
+
+ module.exports = new LocalStorage();
+
+}(module, require));
+},{"./LocalStorages/CookieDriver.js":56,"./LocalStorages/LocalStorageDriver.js":57,"_":37}],56:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ $ = require('$'),
+ JSON = require('JSON'),
+
+ Consts = require('Consts'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @constructor
+ */
+ function CookieDriver()
+ {
+
+ }
+
+ CookieDriver.supported = function ()
+ {
+ return true;
+ };
+
+ /**
+ * @param {string} sKey
+ * @param {*} mData
+ * @returns {boolean}
+ */
+ CookieDriver.prototype.set = function (sKey, mData)
+ {
+ var
+ mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
+ bResult = false,
+ mResult = null
+ ;
+
+ try
+ {
+ mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
+ if (!mResult)
+ {
+ mResult = {};
+ }
+
+ mResult[sKey] = mData;
+ $.cookie(Consts.Values.ClientSideCookieIndexName, JSON.stringify(mResult), {
+ 'expires': 30
+ });
bResult = true;
}
+ catch (oException) {}
return bResult;
};
/**
- * @param {string} sSearch
- * @return {boolean}
+ * @param {string} sKey
+ * @returns {*}
*/
- ContactTagModel.prototype.filterHelper = function (sSearch)
+ CookieDriver.prototype.get = function (sKey)
{
- return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
+ var
+ mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
+ mResult = null
+ ;
+
+ try
+ {
+ mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
+ if (mResult && !Utils.isUnd(mResult[sKey]))
+ {
+ mResult = mResult[sKey];
+ }
+ else
+ {
+ mResult = null;
+ }
+ }
+ catch (oException) {}
+
+ return mResult;
};
- /**
- * @param {boolean=} bEncodeHtml = false
- * @return {string}
- */
- ContactTagModel.prototype.toLine = function (bEncodeHtml)
- {
- return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
- Utils.encodeHtml(this.name()) : this.name();
- };
+ module.exports = CookieDriver;
- module.exports = ContactTagModel;
-
-}(module));
+}(module, require));
+},{"$":32,"Consts":16,"JSON":28,"Utils":22}],57:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
-
- Enums = require('../../Common/Enums.js'),
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js'),
+ window = require('window'),
+ JSON = require('JSON'),
+
+ Consts = require('Consts'),
+ Utils = require('Utils')
+ ;
+
+ /**
+ * @constructor
+ */
+ function LocalStorageDriver()
+ {
+ }
+
+ LocalStorageDriver.supported = function ()
+ {
+ return !!window.localStorage;
+ };
+
+ /**
+ * @param {string} sKey
+ * @param {*} mData
+ * @returns {boolean}
+ */
+ LocalStorageDriver.prototype.set = function (sKey, mData)
+ {
+ var
+ mCookieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
+ bResult = false,
+ mResult = null
+ ;
+
+ try
+ {
+ mResult = null === mCookieValue ? null : JSON.parse(mCookieValue);
+ if (!mResult)
+ {
+ mResult = {};
+ }
+
+ mResult[sKey] = mData;
+ window.localStorage[Consts.Values.ClientSideCookieIndexName] = JSON.stringify(mResult);
+
+ bResult = true;
+ }
+ catch (oException) {}
+
+ return bResult;
+ };
+
+ /**
+ * @param {string} sKey
+ * @returns {*}
+ */
+ LocalStorageDriver.prototype.get = function (sKey)
+ {
+ var
+ mCokieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
+ mResult = null
+ ;
+
+ try
+ {
+ mResult = null === mCokieValue ? null : JSON.parse(mCokieValue);
+ if (mResult && !Utils.isUnd(mResult[sKey]))
+ {
+ mResult = mResult[sKey];
+ }
+ else
+ {
+ mResult = null;
+ }
+ }
+ catch (oException) {}
+
+ return mResult;
+ };
+
+ module.exports = LocalStorageDriver;
+
+}(module, require));
+},{"Consts":16,"JSON":28,"Utils":22,"window":38}],58:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+
+ AppSettings = require('./AppSettings.js')
+ ;
+
+ /**
+ * @constructor
+ */
+ function WebMailCacheStorage()
+ {
+ this.oFoldersCache = {};
+ this.oFoldersNamesCache = {};
+ this.oFolderHashCache = {};
+ this.oFolderUidNextCache = {};
+ this.oMessageListHashCache = {};
+ this.oMessageFlagsCache = {};
+ this.oNewMessage = {};
+ this.oRequestedMessage = {};
+
+ this.bCapaGravatar = AppSettings.capa(Enums.Capa.Gravatar);
+ }
+
+ /**
+ * @type {boolean}
+ */
+ WebMailCacheStorage.prototype.bCapaGravatar = false;
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oFoldersCache = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oFoldersNamesCache = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oFolderHashCache = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oFolderUidNextCache = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oMessageListHashCache = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oMessageFlagsCache = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oBodies = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oNewMessage = {};
+
+ /**
+ * @type {Object}
+ */
+ WebMailCacheStorage.prototype.oRequestedMessage = {};
+
+ WebMailCacheStorage.prototype.clear = function ()
+ {
+ this.oFoldersCache = {};
+ this.oFoldersNamesCache = {};
+ this.oFolderHashCache = {};
+ this.oFolderUidNextCache = {};
+ this.oMessageListHashCache = {};
+ this.oMessageFlagsCache = {};
+ this.oBodies = {};
+ };
+
+
+ /**
+ * @param {string} sEmail
+ * @param {Function} fCallback
+ * @return {string}
+ */
+ WebMailCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
+ {
+ sEmail = Utils.trim(sEmail);
+ fCallback(this.bCapaGravatar && '' !== sEmail ? LinkBuilder.avatarLink(sEmail) : '', sEmail);
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUid
+ * @return {string}
+ */
+ WebMailCacheStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
+ {
+ return sFolderFullNameRaw + '#' + sUid;
+ };
+
+ /**
+ * @param {string} sFolder
+ * @param {string} sUid
+ */
+ WebMailCacheStorage.prototype.addRequestedMessage = function (sFolder, sUid)
+ {
+ this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
+ };
+
+ /**
+ * @param {string} sFolder
+ * @param {string} sUid
+ * @return {boolean}
+ */
+ WebMailCacheStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
+ {
+ return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUid
+ */
+ WebMailCacheStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
+ {
+ this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUid
+ */
+ WebMailCacheStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
+ {
+ if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
+ {
+ this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = null;
+ return true;
+ }
+
+ return false;
+ };
+
+ WebMailCacheStorage.prototype.clearNewMessageCache = function ()
+ {
+ this.oNewMessage = {};
+ };
+
+ /**
+ * @param {string} sFolderHash
+ * @return {string}
+ */
+ WebMailCacheStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
+ {
+ return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
+ };
+
+ /**
+ * @param {string} sFolderHash
+ * @param {string} sFolderFullNameRaw
+ */
+ WebMailCacheStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
+ {
+ this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @return {string}
+ */
+ WebMailCacheStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
+ {
+ return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sFolderHash
+ */
+ WebMailCacheStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
+ {
+ this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @return {string}
+ */
+ WebMailCacheStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
+ {
+ return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUidNext
+ */
+ WebMailCacheStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
+ {
+ this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @return {?FolderModel}
+ */
+ WebMailCacheStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
+ {
+ return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {?FolderModel} oFolder
+ */
+ WebMailCacheStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
+ {
+ this.oFoldersCache[sFolderFullNameRaw] = oFolder;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ */
+ WebMailCacheStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
+ {
+ this.setFolderToCacheList(sFolderFullNameRaw, null);
+ };
+
+ /**
+ * @param {string} sFolderFullName
+ * @param {string} sUid
+ * @return {?Array}
+ */
+ WebMailCacheStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
+ {
+ return this.oMessageFlagsCache[sFolderFullName] && this.oMessageFlagsCache[sFolderFullName][sUid] ?
+ this.oMessageFlagsCache[sFolderFullName][sUid] : null;
+ };
+
+ /**
+ * @param {string} sFolderFullName
+ * @param {string} sUid
+ * @param {Array} aFlagsCache
+ */
+ WebMailCacheStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
+ {
+ if (!this.oMessageFlagsCache[sFolderFullName])
+ {
+ this.oMessageFlagsCache[sFolderFullName] = {};
+ }
+
+ this.oMessageFlagsCache[sFolderFullName][sUid] = aFlagsCache;
+ };
+
+ /**
+ * @param {string} sFolderFullName
+ */
+ WebMailCacheStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
+ {
+ this.oMessageFlagsCache[sFolderFullName] = {};
+ };
+
+ /**
+ * @param {(MessageModel|null)} oMessage
+ */
+ WebMailCacheStorage.prototype.initMessageFlagsFromCache = function (oMessage)
+ {
+ if (oMessage)
+ {
+ var
+ self = this,
+ aFlags = this.getMessageFlagsFromCache(oMessage.folderFullNameRaw, oMessage.uid),
+ mUnseenSubUid = null,
+ mFlaggedSubUid = null
+ ;
+
+ if (aFlags && 0 < aFlags.length)
+ {
+ oMessage.unseen(!!aFlags[0]);
+ oMessage.flagged(!!aFlags[1]);
+ oMessage.answered(!!aFlags[2]);
+ oMessage.forwarded(!!aFlags[3]);
+ oMessage.isReadReceipt(!!aFlags[4]);
+ }
+
+ if (0 < oMessage.threads().length)
+ {
+ mUnseenSubUid = _.find(oMessage.threads(), function (iSubUid) {
+ var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
+ return aFlags && 0 < aFlags.length && !!aFlags[0];
+ });
+
+ mFlaggedSubUid = _.find(oMessage.threads(), function (iSubUid) {
+ var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
+ return aFlags && 0 < aFlags.length && !!aFlags[1];
+ });
+
+ oMessage.hasUnseenSubMessage(mUnseenSubUid && 0 < Utils.pInt(mUnseenSubUid));
+ oMessage.hasFlaggedSubMessage(mFlaggedSubUid && 0 < Utils.pInt(mFlaggedSubUid));
+ }
+ }
+ };
+
+ /**
+ * @param {(MessageModel|null)} oMessage
+ */
+ WebMailCacheStorage.prototype.storeMessageFlagsToCache = function (oMessage)
+ {
+ if (oMessage)
+ {
+ this.setMessageFlagsToCache(
+ oMessage.folderFullNameRaw,
+ oMessage.uid,
+ [oMessage.unseen(), oMessage.flagged(), oMessage.answered(), oMessage.forwarded(), oMessage.isReadReceipt()]
+ );
+ }
+ };
+ /**
+ * @param {string} sFolder
+ * @param {string} sUid
+ * @param {Array} aFlags
+ */
+ WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
+ {
+ if (Utils.isArray(aFlags) && 0 < aFlags.length)
+ {
+ this.setMessageFlagsToCache(sFolder, sUid, aFlags);
+ }
+ };
+
+ module.exports = new WebMailCacheStorage();
+
+}(module, require));
+},{"./AppSettings.js":54,"Enums":17,"LinkBuilder":20,"Utils":22,"_":37}],59:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ moment = require('moment'),
+ $div = require('$div'),
+ NotificationClass = require('NotificationClass'),
+
+ Consts = require('Consts'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+
+ AppSettings = require('./AppSettings.js'),
+ Cache = require('./WebMailCacheStorage.js'),
+
+ kn = require('kn'),
+
+ MessageModel = require('../Models/MessageModel.js'),
+
+ LocalStorage = require('./LocalStorage.js'),
+ AbstractData = require('./AbstractData.js')
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractData
+ */
+ function WebMailDataStorage()
+ {
+ AbstractData.call(this);
+
+ var
+ fRemoveSystemFolderType = function (observable) {
+ return function () {
+ var oFolder = Cache.getFolderFromCacheList(observable());
+ if (oFolder)
+ {
+ oFolder.type(Enums.FolderType.User);
+ }
+ };
+ },
+ fSetSystemFolderType = function (iType) {
+ return function (sValue) {
+ var oFolder = Cache.getFolderFromCacheList(sValue);
+ if (oFolder)
+ {
+ oFolder.type(iType);
+ }
+ };
+ }
+ ;
+
+ this.devEmail = '';
+ this.devPassword = '';
+
+ this.accountEmail = ko.observable('');
+ this.accountIncLogin = ko.observable('');
+ this.accountOutLogin = ko.observable('');
+ this.projectHash = ko.observable('');
+ this.threading = ko.observable(false);
+
+ this.lastFoldersHash = '';
+ this.remoteSuggestions = false;
+
+ // system folders
+ this.sentFolder = ko.observable('');
+ this.draftFolder = ko.observable('');
+ this.spamFolder = ko.observable('');
+ this.trashFolder = ko.observable('');
+ this.archiveFolder = ko.observable('');
+
+ this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange');
+ this.draftFolder.subscribe(fRemoveSystemFolderType(this.draftFolder), this, 'beforeChange');
+ this.spamFolder.subscribe(fRemoveSystemFolderType(this.spamFolder), this, 'beforeChange');
+ this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange');
+ this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange');
+
+ this.sentFolder.subscribe(fSetSystemFolderType(Enums.FolderType.SentItems), this);
+ this.draftFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Draft), this);
+ this.spamFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Spam), this);
+ this.trashFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Trash), this);
+ this.archiveFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Archive), this);
+
+ this.draftFolderNotEnabled = ko.computed(function () {
+ return '' === this.draftFolder() || Consts.Values.UnuseOptionValue === this.draftFolder();
+ }, this);
+
+ // personal
+ this.displayName = ko.observable('');
+ this.signature = ko.observable('');
+ this.signatureToAll = ko.observable(false);
+ this.replyTo = ko.observable('');
+
+ // security
+ this.enableTwoFactor = ko.observable(false);
+
+ // accounts
+ this.accounts = ko.observableArray([]);
+ this.accountsLoading = ko.observable(false).extend({'throttle': 100});
+
+ // identities
+ this.defaultIdentityID = ko.observable('');
+ this.identities = ko.observableArray([]);
+ this.identitiesLoading = ko.observable(false).extend({'throttle': 100});
+
+ // contacts
+ this.contactTags = ko.observableArray([]);
+ this.contacts = ko.observableArray([]);
+ this.contacts.loading = ko.observable(false).extend({'throttle': 200});
+ this.contacts.importing = ko.observable(false).extend({'throttle': 200});
+ this.contacts.syncing = ko.observable(false).extend({'throttle': 200});
+ this.contacts.exportingVcf = ko.observable(false).extend({'throttle': 200});
+ this.contacts.exportingCsv = ko.observable(false).extend({'throttle': 200});
+
+ this.allowContactsSync = ko.observable(false);
+ this.enableContactsSync = ko.observable(false);
+ this.contactsSyncUrl = ko.observable('');
+ this.contactsSyncUser = ko.observable('');
+ this.contactsSyncPass = ko.observable('');
+
+ this.allowContactsSync = ko.observable(!!AppSettings.settingsGet('ContactsSyncIsAllowed'));
+ this.enableContactsSync = ko.observable(!!AppSettings.settingsGet('EnableContactsSync'));
+ this.contactsSyncUrl = ko.observable(AppSettings.settingsGet('ContactsSyncUrl'));
+ this.contactsSyncUser = ko.observable(AppSettings.settingsGet('ContactsSyncUser'));
+ this.contactsSyncPass = ko.observable(AppSettings.settingsGet('ContactsSyncPassword'));
+
+ // folders
+ this.namespace = '';
+ this.folderList = ko.observableArray([]);
+ this.folderList.focused = ko.observable(false);
+
+ this.foldersListError = ko.observable('');
+
+ this.foldersLoading = ko.observable(false);
+ this.foldersCreating = ko.observable(false);
+ this.foldersDeleting = ko.observable(false);
+ this.foldersRenaming = ko.observable(false);
+
+ this.foldersChanging = ko.computed(function () {
+ var
+ bLoading = this.foldersLoading(),
+ bCreating = this.foldersCreating(),
+ bDeleting = this.foldersDeleting(),
+ bRenaming = this.foldersRenaming()
+ ;
+ return bLoading || bCreating || bDeleting || bRenaming;
+ }, this);
+
+ this.foldersInboxUnreadCount = ko.observable(0);
+
+ this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null,
+ function (oPrev) {
+ if (oPrev)
+ {
+ oPrev.selected(false);
+ }
+ }, function (oNext) {
+ if (oNext)
+ {
+ oNext.selected(true);
+ }
+ }
+ ]});
+
+ this.currentFolderFullNameRaw = ko.computed(function () {
+ return this.currentFolder() ? this.currentFolder().fullNameRaw : '';
+ }, this);
+
+ this.currentFolderFullName = ko.computed(function () {
+ return this.currentFolder() ? this.currentFolder().fullName : '';
+ }, this);
+
+ this.currentFolderFullNameHash = ko.computed(function () {
+ return this.currentFolder() ? this.currentFolder().fullNameHash : '';
+ }, this);
+
+ this.currentFolderName = ko.computed(function () {
+ return this.currentFolder() ? this.currentFolder().name() : '';
+ }, this);
+
+ this.folderListSystemNames = ko.computed(function () {
+
+ var
+ aList = ['INBOX'],
+ aFolders = this.folderList(),
+ sSentFolder = this.sentFolder(),
+ sDraftFolder = this.draftFolder(),
+ sSpamFolder = this.spamFolder(),
+ sTrashFolder = this.trashFolder(),
+ sArchiveFolder = this.archiveFolder()
+ ;
+
+ if (Utils.isArray(aFolders) && 0 < aFolders.length)
+ {
+ if ('' !== sSentFolder && Consts.Values.UnuseOptionValue !== sSentFolder)
+ {
+ aList.push(sSentFolder);
+ }
+ if ('' !== sDraftFolder && Consts.Values.UnuseOptionValue !== sDraftFolder)
+ {
+ aList.push(sDraftFolder);
+ }
+ if ('' !== sSpamFolder && Consts.Values.UnuseOptionValue !== sSpamFolder)
+ {
+ aList.push(sSpamFolder);
+ }
+ if ('' !== sTrashFolder && Consts.Values.UnuseOptionValue !== sTrashFolder)
+ {
+ aList.push(sTrashFolder);
+ }
+ if ('' !== sArchiveFolder && Consts.Values.UnuseOptionValue !== sArchiveFolder)
+ {
+ aList.push(sArchiveFolder);
+ }
+ }
+
+ return aList;
+
+ }, this);
+
+ this.folderListSystem = ko.computed(function () {
+ return _.compact(_.map(this.folderListSystemNames(), function (sName) {
+ return Cache.getFolderFromCacheList(sName);
+ }));
+ }, this);
+
+ this.folderMenuForMove = ko.computed(function () {
+ return Utils.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), [
+ this.currentFolderFullNameRaw()
+ ], null, null, null, null, function (oItem) {
+ return oItem ? oItem.localName() : '';
+ });
+ }, this);
+
+ // message list
+ this.staticMessageList = [];
+
+ this.messageList = ko.observableArray([]).extend({'rateLimit': 0});
+
+ this.messageListCount = ko.observable(0);
+ this.messageListSearch = ko.observable('');
+ this.messageListPage = ko.observable(1);
+
+ this.messageListThreadFolder = ko.observable('');
+ this.messageListThreadUids = ko.observableArray([]);
+
+ this.messageListThreadFolder.subscribe(function () {
+ this.messageListThreadUids([]);
+ }, this);
+
+ this.messageListEndFolder = ko.observable('');
+ this.messageListEndSearch = ko.observable('');
+ this.messageListEndPage = ko.observable(1);
+
+ this.messageListEndHash = ko.computed(function () {
+ return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage();
+ }, this);
+
+ this.messageListPageCount = ko.computed(function () {
+ var iPage = window.Math.ceil(this.messageListCount() / this.messagesPerPage());
+ return 0 >= iPage ? 1 : iPage;
+ }, this);
+
+ this.mainMessageListSearch = ko.computed({
+ 'read': this.messageListSearch,
+ 'write': function (sValue) {
+ kn.setHash(LinkBuilder.mailBox(
+ this.currentFolderFullNameHash(), 1, Utils.trim(sValue.toString())
+ ));
+ },
+ 'owner': this
+ });
+
+ this.messageListError = ko.observable('');
+
+ this.messageListLoading = ko.observable(false);
+ this.messageListIsNotCompleted = ko.observable(false);
+ this.messageListCompleteLoadingThrottle = ko.observable(false).extend({'throttle': 200});
+
+ this.messageListCompleteLoading = ko.computed(function () {
+ var
+ bOne = this.messageListLoading(),
+ bTwo = this.messageListIsNotCompleted()
+ ;
+ return bOne || bTwo;
+ }, this);
+
+ this.messageListCompleteLoading.subscribe(function (bValue) {
+ this.messageListCompleteLoadingThrottle(bValue);
+ }, this);
+
+ this.messageList.subscribe(_.debounce(function (aList) {
+ _.each(aList, function (oItem) {
+ if (oItem.newForAnimation())
+ {
+ oItem.newForAnimation(false);
+ }
+ });
+ }, 500));
+
+ // message preview
+ this.staticMessageList = new MessageModel();
+ this.message = ko.observable(null);
+ this.messageLoading = ko.observable(false);
+ this.messageLoadingThrottle = ko.observable(false).extend({'throttle': 50});
+
+ this.message.focused = ko.observable(false);
+
+ this.message.subscribe(function (oMessage) {
+ if (!oMessage)
+ {
+ this.message.focused(false);
+ this.messageFullScreenMode(false);
+ this.hideMessageBodies();
+
+ if (Enums.Layout.NoPreview === this.layout() &&
+ -1 < window.location.hash.indexOf('message-preview'))
+ {
+ if (Globals.__RL)
+ {
+ Globals.__RL.historyBack();
+ }
+ }
+ }
+ else if (Enums.Layout.NoPreview === this.layout())
+ {
+ this.message.focused(true);
+ }
+ }, this);
+
+ this.message.focused.subscribe(function (bValue) {
+ if (bValue)
+ {
+ this.folderList.focused(false);
+ Globals.keyScope(Enums.KeyState.MessageView);
+ }
+ else if (Enums.KeyState.MessageView === Globals.keyScope())
+ {
+ if (Enums.Layout.NoPreview === this.layout() && this.message())
+ {
+ Globals.keyScope(Enums.KeyState.MessageView);
+ }
+ else
+ {
+ Globals.keyScope(Enums.KeyState.MessageList);
+ }
+ }
+ }, this);
+
+ this.folderList.focused.subscribe(function (bValue) {
+ if (bValue)
+ {
+ Globals.keyScope(Enums.KeyState.FolderList);
+ }
+ else if (Enums.KeyState.FolderList === Globals.keyScope())
+ {
+ Globals.keyScope(Enums.KeyState.MessageList);
+ }
+ });
+
+ this.messageLoading.subscribe(function (bValue) {
+ this.messageLoadingThrottle(bValue);
+ }, this);
+
+ this.messageFullScreenMode = ko.observable(false);
+
+ this.messageError = ko.observable('');
+
+ this.messagesBodiesDom = ko.observable(null);
+
+ this.messagesBodiesDom.subscribe(function (oDom) {
+ if (oDom && !(oDom instanceof $))
+ {
+ this.messagesBodiesDom($(oDom));
+ }
+ }, this);
+
+ this.messageActiveDom = ko.observable(null);
+
+ this.isMessageSelected = ko.computed(function () {
+ return null !== this.message();
+ }, this);
+
+ this.currentMessage = ko.observable(null);
+
+ this.messageListChecked = ko.computed(function () {
+ return _.filter(this.messageList(), function (oItem) {
+ return oItem.checked();
+ });
+ }, this).extend({'rateLimit': 0});
+
+ this.hasCheckedMessages = ko.computed(function () {
+ return 0 < this.messageListChecked().length;
+ }, this).extend({'rateLimit': 0});
+
+ this.messageListCheckedOrSelected = ko.computed(function () {
+
+ var
+ aChecked = this.messageListChecked(),
+ oSelectedMessage = this.currentMessage()
+ ;
+
+ return _.union(aChecked, oSelectedMessage ? [oSelectedMessage] : []);
+
+ }, this);
+
+ this.messageListCheckedOrSelectedUidsWithSubMails = ko.computed(function () {
+ var aList = [];
+ _.each(this.messageListCheckedOrSelected(), function (oMessage) {
+ if (oMessage)
+ {
+ aList.push(oMessage.uid);
+ if (0 < oMessage.threadsLen() && 0 === oMessage.parentUid() && oMessage.lastInCollapsedThread())
+ {
+ aList = _.union(aList, oMessage.threads());
+ }
+ }
+ });
+ return aList;
+ }, this);
+
+ // quota
+ this.userQuota = ko.observable(0);
+ this.userUsageSize = ko.observable(0);
+ this.userUsageProc = ko.computed(function () {
+
+ var
+ iQuota = this.userQuota(),
+ iUsed = this.userUsageSize()
+ ;
+
+ return 0 < iQuota ? window.Math.ceil((iUsed / iQuota) * 100) : 0;
+
+ }, this);
+
+ // other
+ this.capaOpenPGP = ko.observable(false);
+ this.openpgpkeys = ko.observableArray([]);
+ this.openpgpKeyring = null;
+
+ this.openpgpkeysPublic = this.openpgpkeys.filter(function (oItem) {
+ return !!(oItem && !oItem.isPrivate);
+ });
+
+ this.openpgpkeysPrivate = this.openpgpkeys.filter(function (oItem) {
+ return !!(oItem && oItem.isPrivate);
+ });
+
+ // google
+ this.googleActions = ko.observable(false);
+ this.googleLoggined = ko.observable(false);
+ this.googleUserName = ko.observable('');
+
+ // facebook
+ this.facebookActions = ko.observable(false);
+ this.facebookLoggined = ko.observable(false);
+ this.facebookUserName = ko.observable('');
+
+ // twitter
+ this.twitterActions = ko.observable(false);
+ this.twitterLoggined = ko.observable(false);
+ this.twitterUserName = ko.observable('');
+
+ this.customThemeType = ko.observable(Enums.CustomThemeType.Light);
+
+ this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
+ }
+
+ _.extend(WebMailDataStorage.prototype, AbstractData.prototype);
+
+ WebMailDataStorage.prototype.purgeMessageBodyCache = function()
+ {
+ var
+ iCount = 0,
+ oMessagesBodiesDom = null,
+ iEnd = Globals.iMessageBodyCacheCount - Consts.Values.MessageBodyCacheLimit
+ ;
+
+ if (0 < iEnd)
+ {
+ oMessagesBodiesDom = this.messagesBodiesDom();
+ if (oMessagesBodiesDom)
+ {
+ oMessagesBodiesDom.find('.rl-cache-class').each(function () {
+ var oItem = $(this);
+ if (iEnd > oItem.data('rl-cache-count'))
+ {
+ oItem.addClass('rl-cache-purge');
+ iCount++;
+ }
+ });
+
+ if (0 < iCount)
+ {
+ _.delay(function () {
+ oMessagesBodiesDom.find('.rl-cache-purge').remove();
+ }, 300);
+ }
+ }
+ }
+ };
+
+ WebMailDataStorage.prototype.populateDataOnStart = function()
+ {
+ AbstractData.prototype.populateDataOnStart.call(this);
+
+ this.accountEmail(AppSettings.settingsGet('Email'));
+ this.accountIncLogin(AppSettings.settingsGet('IncLogin'));
+ this.accountOutLogin(AppSettings.settingsGet('OutLogin'));
+ this.projectHash(AppSettings.settingsGet('ProjectHash'));
+
+ this.defaultIdentityID(AppSettings.settingsGet('DefaultIdentityID'));
+
+ this.displayName(AppSettings.settingsGet('DisplayName'));
+ this.replyTo(AppSettings.settingsGet('ReplyTo'));
+ this.signature(AppSettings.settingsGet('Signature'));
+ this.signatureToAll(!!AppSettings.settingsGet('SignatureToAll'));
+ this.enableTwoFactor(!!AppSettings.settingsGet('EnableTwoFactor'));
+
+ this.lastFoldersHash = LocalStorage.get(Enums.ClientSideKeyName.FoldersLashHash) || '';
+
+ this.remoteSuggestions = !!AppSettings.settingsGet('RemoteSuggestions');
+
+ this.devEmail = AppSettings.settingsGet('DevEmail');
+ this.devPassword = AppSettings.settingsGet('DevPassword');
+ };
+
+ WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
+ {
+ if ('INBOX' === sFolder && Utils.isNormal(sUidNext) && sUidNext !== '')
+ {
+ if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length)
+ {
+ var
+ self = this,
+ iIndex = 0,
+ iLen = aNewMessages.length,
+ fNotificationHelper = function (sImageSrc, sTitle, sText)
+ {
+ var oNotification = null;
+ if (NotificationClass && self.useDesktopNotifications())
+ {
+ oNotification = new NotificationClass(sTitle, {
+ 'body': sText,
+ 'icon': sImageSrc
+ });
+
+ if (oNotification)
+ {
+ if (oNotification.show)
+ {
+ oNotification.show();
+ }
+
+ window.setTimeout((function (oLocalNotifications) {
+ return function () {
+ if (oLocalNotifications.cancel)
+ {
+ oLocalNotifications.cancel();
+ }
+ else if (oLocalNotifications.close)
+ {
+ oLocalNotifications.close();
+ }
+ };
+ }(oNotification)), 7000);
+ }
+ }
+ }
+ ;
+
+ _.each(aNewMessages, function (oItem) {
+ Cache.addNewMessageCache(sFolder, oItem.Uid);
+ });
+
+ if (3 < iLen)
+ {
+ fNotificationHelper(
+ LinkBuilder.notificationMailIcon(),
+ this.accountEmail(),
+ Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
+ 'COUNT': iLen
+ })
+ );
+ }
+ else
+ {
+ for (; iIndex < iLen; iIndex++)
+ {
+ fNotificationHelper(
+ LinkBuilder.notificationMailIcon(),
+ MessageModel.emailsToLine(MessageModel.initEmailsFromJson(aNewMessages[iIndex].From), false),
+ aNewMessages[iIndex].Subject
+ );
+ }
+ }
+ }
+
+ Cache.setFolderUidNext(sFolder, sUidNext);
+ }
+ };
+
+ WebMailDataStorage.prototype.hideMessageBodies = function ()
+ {
+ var oMessagesBodiesDom = this.messagesBodiesDom();
+ if (oMessagesBodiesDom)
+ {
+ oMessagesBodiesDom.find('.b-text-part').hide();
+ }
+ };
+
+ /**
+ * @param {boolean=} bBoot = false
+ * @returns {Array}
+ */
+ WebMailDataStorage.prototype.getNextFolderNames = function (bBoot)
+ {
+ bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
+
+ var
+ aResult = [],
+ iLimit = 10,
+ iUtc = moment().unix(),
+ iTimeout = iUtc - 60 * 5,
+ aTimeouts = [],
+ fSearchFunction = function (aList) {
+ _.each(aList, function (oFolder) {
+ if (oFolder && 'INBOX' !== oFolder.fullNameRaw &&
+ oFolder.selectable && oFolder.existen &&
+ iTimeout > oFolder.interval &&
+ (!bBoot || oFolder.subScribed()))
+ {
+ aTimeouts.push([oFolder.interval, oFolder.fullNameRaw]);
+ }
+
+ if (oFolder && 0 < oFolder.subFolders().length)
+ {
+ fSearchFunction(oFolder.subFolders());
+ }
+ });
+ }
+ ;
+
+ fSearchFunction(this.folderList());
+
+ aTimeouts.sort(function(a, b) {
+ if (a[0] < b[0])
+ {
+ return -1;
+ }
+ else if (a[0] > b[0])
+ {
+ return 1;
+ }
+
+ return 0;
+ });
+
+ _.find(aTimeouts, function (aItem) {
+ var oFolder = Cache.getFolderFromCacheList(aItem[1]);
+ if (oFolder)
+ {
+ oFolder.interval = iUtc;
+ aResult.push(aItem[1]);
+ }
+
+ return iLimit <= aResult.length;
+ });
+
+ return _.uniq(aResult);
+ };
+
+ /**
+ * @param {string} sFromFolderFullNameRaw
+ * @param {Array} aUidForRemove
+ * @param {string=} sToFolderFullNameRaw = ''
+ * @param {bCopy=} bCopy = false
+ */
+ WebMailDataStorage.prototype.removeMessagesFromList = function (
+ sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy)
+ {
+ sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : '';
+ bCopy = Utils.isUnd(bCopy) ? false : !!bCopy;
+
+ aUidForRemove = _.map(aUidForRemove, function (mValue) {
+ return Utils.pInt(mValue);
+ });
+
+ var
+ self = this,
+ iUnseenCount = 0,
+ aMessageList = this.messageList(),
+ oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
+ oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
+ sCurrentFolderFullNameRaw = this.currentFolderFullNameRaw(),
+ oCurrentMessage = this.message(),
+ aMessages = sCurrentFolderFullNameRaw === sFromFolderFullNameRaw ? _.filter(aMessageList, function (oMessage) {
+ return oMessage && -1 < Utils.inArray(Utils.pInt(oMessage.uid), aUidForRemove);
+ }) : []
+ ;
+
+ _.each(aMessages, function (oMessage) {
+ if (oMessage && oMessage.unseen())
+ {
+ iUnseenCount++;
+ }
+ });
+
+ if (oFromFolder && !bCopy)
+ {
+ oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ?
+ oFromFolder.messageCountAll() - aUidForRemove.length : 0);
+
+ if (0 < iUnseenCount)
+ {
+ oFromFolder.messageCountUnread(0 <= oFromFolder.messageCountUnread() - iUnseenCount ?
+ oFromFolder.messageCountUnread() - iUnseenCount : 0);
+ }
+ }
+
+ if (oToFolder)
+ {
+ oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length);
+ if (0 < iUnseenCount)
+ {
+ oToFolder.messageCountUnread(oToFolder.messageCountUnread() + iUnseenCount);
+ }
+
+ oToFolder.actionBlink(true);
+ }
+
+ if (0 < aMessages.length)
+ {
+ if (bCopy)
+ {
+ _.each(aMessages, function (oMessage) {
+ oMessage.checked(false);
+ });
+ }
+ else
+ {
+ this.messageListIsNotCompleted(true);
+
+ _.each(aMessages, function (oMessage) {
+ if (oCurrentMessage && oCurrentMessage.hash === oMessage.hash)
+ {
+ oCurrentMessage = null;
+ self.message(null);
+ }
+
+ oMessage.deleted(true);
+ });
+
+ _.delay(function () {
+ _.each(aMessages, function (oMessage) {
+ self.messageList.remove(oMessage);
+ });
+ }, 400);
+ }
+ }
+
+ if ('' !== sFromFolderFullNameRaw)
+ {
+ Cache.setFolderHash(sFromFolderFullNameRaw, '');
+ }
+
+ if ('' !== sToFolderFullNameRaw)
+ {
+ Cache.setFolderHash(sToFolderFullNameRaw, '');
+ }
+ };
+
+ WebMailDataStorage.prototype.setMessage = function (oData, bCached)
+ {
+ var
+ bIsHtml = false,
+ bHasExternals = false,
+ bHasInternals = false,
+ oBody = null,
+ oTextBody = null,
+ sId = '',
+ sResultHtml = '',
+ bPgpSigned = false,
+ bPgpEncrypted = false,
+ oMessagesBodiesDom = this.messagesBodiesDom(),
+ oMessage = this.message()
+ ;
+
+ if (oData && oMessage && oData.Result && 'Object/Message' === oData.Result['@Object'] &&
+ oMessage.folderFullNameRaw === oData.Result.Folder && oMessage.uid === oData.Result.Uid)
+ {
+ this.messageError('');
+
+ oMessage.initUpdateByMessageJson(oData.Result);
+ Cache.addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
+
+ if (!bCached)
+ {
+ oMessage.initFlagsByJson(oData.Result);
+ }
+
+ oMessagesBodiesDom = oMessagesBodiesDom && oMessagesBodiesDom[0] ? oMessagesBodiesDom : null;
+ if (oMessagesBodiesDom)
+ {
+ sId = 'rl-mgs-' + oMessage.hash.replace(/[^a-zA-Z0-9]/g, '');
+ oTextBody = oMessagesBodiesDom.find('#' + sId);
+ if (!oTextBody || !oTextBody[0])
+ {
+ bHasExternals = !!oData.Result.HasExternals;
+ bHasInternals = !!oData.Result.HasInternals;
+
+ oBody = $('').hide().addClass('rl-cache-class');
+ oBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
+
+ if (Utils.isNormal(oData.Result.Html) && '' !== oData.Result.Html)
+ {
+ bIsHtml = true;
+ sResultHtml = oData.Result.Html.toString();
+ }
+ else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain)
+ {
+ bIsHtml = false;
+ sResultHtml = Utils.plainToHtml(oData.Result.Plain.toString(), false);
+
+ if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && this.capaOpenPGP())
+ {
+ oMessage.plainRaw = Utils.pString(oData.Result.Plain);
+
+ bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oMessage.plainRaw);
+ if (!bPgpEncrypted)
+ {
+ bPgpSigned = /-----BEGIN PGP SIGNED MESSAGE-----/.test(oMessage.plainRaw) &&
+ /-----BEGIN PGP SIGNATURE-----/.test(oMessage.plainRaw);
+ }
+
+ $div.empty();
+ if (bPgpSigned && oMessage.isPgpSigned())
+ {
+ sResultHtml =
+ $div.append(
+ $('').text(oMessage.plainRaw)
+ ).html()
+ ;
+ }
+ else if (bPgpEncrypted && oMessage.isPgpEncrypted())
+ {
+ sResultHtml =
+ $div.append(
+ $('').text(oMessage.plainRaw)
+ ).html()
+ ;
+ }
+
+ $div.empty();
+
+ oMessage.isPgpSigned(bPgpSigned);
+ oMessage.isPgpEncrypted(bPgpEncrypted);
+ }
+ }
+ else
+ {
+ bIsHtml = false;
+ }
+
+ oBody
+ .html(Utils.linkify(sResultHtml))
+ .addClass('b-text-part ' + (bIsHtml ? 'html' : 'plain'))
+ ;
+
+ oMessage.isHtml(!!bIsHtml);
+ oMessage.hasImages(!!bHasExternals);
+ oMessage.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
+ oMessage.pgpSignedVerifyUser('');
+
+ oMessage.body = oBody;
+ if (oMessage.body)
+ {
+ oMessagesBodiesDom.append(oMessage.body);
+ }
+
+ oMessage.storeDataToDom();
+
+ if (bHasInternals)
+ {
+ oMessage.showInternalImages(true);
+ }
+
+ if (oMessage.hasImages() && this.showImages())
+ {
+ oMessage.showExternalImages(true);
+ }
+
+ this.purgeMessageBodyCacheThrottle();
+ }
+ else
+ {
+ oMessage.body = oTextBody;
+ if (oMessage.body)
+ {
+ oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
+ oMessage.fetchDataToDom();
+ }
+ }
+
+ this.messageActiveDom(oMessage.body);
+
+ this.hideMessageBodies();
+ oMessage.body.show();
+
+ if (oBody)
+ {
+ Utils.initBlockquoteSwitcher(oBody);
+ }
+ }
+
+ Cache.initMessageFlagsFromCache(oMessage);
+ if (oMessage.unseen())
+ {
+ if (Globals.__RL)
+ {
+ Globals.__RL.setMessageSeen(oMessage);
+ }
+ }
+
+ Utils.windowResize();
+ }
+ };
+
+ /**
+ * @param {Array} aList
+ * @returns {string}
+ */
+ WebMailDataStorage.prototype.calculateMessageListHash = function (aList)
+ {
+ return _.map(aList, function (oMessage) {
+ return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
+ }).join('|');
+ };
+
+ WebMailDataStorage.prototype.findPublicKeyByHex = function (sHash)
+ {
+ return _.find(this.openpgpkeysPublic(), function (oItem) {
+ return oItem && sHash === oItem.id;
+ });
+ };
+
+ WebMailDataStorage.prototype.findPublicKeysByEmail = function (sEmail)
+ {
+ return _.compact(_.map(this.openpgpkeysPublic(), function (oItem) {
+
+ var oKey = null;
+ if (oItem && sEmail === oItem.email)
+ {
+ try
+ {
+ oKey = window.openpgp.key.readArmored(oItem.armor);
+ if (oKey && !oKey.err && oKey.keys && oKey.keys[0])
+ {
+ return oKey.keys[0];
+ }
+ }
+ catch (e) {}
+ }
+
+ return null;
+
+ }));
+ };
+
+ /**
+ * @param {string} sEmail
+ * @param {string=} sPassword
+ * @returns {?}
+ */
+ WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
+ {
+ var
+ oPrivateKey = null,
+ oKey = _.find(this.openpgpkeysPrivate(), function (oItem) {
+ return oItem && sEmail === oItem.email;
+ })
+ ;
+
+ if (oKey)
+ {
+ try
+ {
+ oPrivateKey = window.openpgp.key.readArmored(oKey.armor);
+ if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
+ {
+ oPrivateKey = oPrivateKey.keys[0];
+ oPrivateKey.decrypt(Utils.pString(sPassword));
+ }
+ else
+ {
+ oPrivateKey = null;
+ }
+ }
+ catch (e)
+ {
+ oPrivateKey = null;
+ }
+ }
+
+ return oPrivateKey;
+ };
+
+ /**
+ * @param {string=} sPassword
+ * @returns {?}
+ */
+ WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword)
+ {
+ return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
+ };
+
+ module.exports = new WebMailDataStorage();
+
+}(module, require));
+
+},{"$":32,"$div":23,"../Models/MessageModel.js":46,"./AbstractData.js":51,"./AppSettings.js":54,"./LocalStorage.js":55,"./WebMailCacheStorage.js":58,"Consts":16,"Enums":17,"Globals":19,"LinkBuilder":20,"NotificationClass":29,"Utils":22,"_":37,"kn":39,"ko":34,"moment":35,"window":38}],60:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+
+ Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function AdminLoginViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Center', 'AdminLogin');
+
+ this.login = ko.observable('');
+ this.password = ko.observable('');
+
+ this.loginError = ko.observable(false);
+ this.passwordError = ko.observable(false);
+
+ this.loginFocus = ko.observable(false);
+
+ this.login.subscribe(function () {
+ this.loginError(false);
+ }, this);
+
+ this.password.subscribe(function () {
+ this.passwordError(false);
+ }, this);
+
+ this.submitRequest = ko.observable(false);
+ this.submitError = ko.observable('');
+
+ this.submitCommand = Utils.createCommand(this, function () {
+
+ Utils.triggerAutocompleteInputChange();
+
+ this.loginError('' === Utils.trim(this.login()));
+ this.passwordError('' === Utils.trim(this.password()));
+
+ if (this.loginError() || this.passwordError())
+ {
+ return false;
+ }
+
+ this.submitRequest(true);
+
+ Remote.adminLogin(_.bind(function (sResult, oData) {
+
+ if (Enums.StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action)
+ {
+ if (oData.Result)
+ {
+ var RL = require('../Boots/AdminApp.js');
+ RL.loginAndLogoutReload();
+ }
+ else if (oData.ErrorCode)
+ {
+ this.submitRequest(false);
+ this.submitError(Utils.getNotification(oData.ErrorCode));
+ }
+ }
+ else
+ {
+ this.submitRequest(false);
+ this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
+ }
+
+ }, this), this.login(), this.password());
+
+ return true;
+
+ }, function () {
+ return !this.submitRequest();
+ });
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel('AdminLoginViewModel', AdminLoginViewModel);
+
+ AdminLoginViewModel.prototype.onShow = function ()
+ {
+ kn.routeOff();
+
+ _.delay(_.bind(function () {
+ this.loginFocus(true);
+ }, this), 100);
+
+ };
+
+ AdminLoginViewModel.prototype.onHide = function ()
+ {
+ this.loginFocus(false);
+ };
+
+ AdminLoginViewModel.prototype.onBuild = function ()
+ {
+ Utils.triggerAutocompleteInputChange(true);
+ };
+
+ AdminLoginViewModel.prototype.submitForm = function ()
+ {
+ this.submitCommand();
+ };
+
+ module.exports = AdminLoginViewModel;
+
+}(module, require));
+},{"../Boots/AdminApp.js":14,"../Storages/AdminAjaxRemoteStorage.js":52,"Enums":17,"KnoinAbstractViewModel":42,"Utils":22,"_":37,"kn":39,"ko":34}],61:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ kn = require('kn'),
+ Globals = require('Globals'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
+ ;
+
+ /**
+ * @param {?} oScreen
+ *
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function AdminMenuViewModel(oScreen)
+ {
+ KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu');
+
+ this.leftPanelDisabled = Globals.leftPanelDisabled;
+
+ this.menu = oScreen.menu;
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel('AdminMenuViewModel', AdminMenuViewModel);
+
+ AdminMenuViewModel.prototype.link = function (sRoute)
+ {
+ return '#/' + sRoute;
+ };
+
+ module.exports = AdminMenuViewModel;
+
+}(module, require));
+
+},{"Globals":19,"KnoinAbstractViewModel":42,"kn":39}],62:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ ko = require('ko'),
+
+ AppSettings = require('../Storages/AppSettings.js'),
+ Data = require('../Storages/AdminDataStorage.js'),
+ Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function AdminPaneViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Right', 'AdminPane');
+
+ this.adminDomain = ko.observable(AppSettings.settingsGet('AdminDomain'));
+ this.version = ko.observable(AppSettings.settingsGet('Version'));
+
+ this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel('AdminPaneViewModel', AdminPaneViewModel);
+
+ AdminPaneViewModel.prototype.logoutClick = function ()
+ {
+ Remote.adminLogout(function () {
+ var RL = require('../Boots/AdminApp.js');
+ RL.loginAndLogoutReload();
+ });
+ };
+
+ module.exports = AdminPaneViewModel;
+
+}(module, require));
+},{"../Boots/AdminApp.js":14,"../Storages/AdminAjaxRemoteStorage.js":52,"../Storages/AdminDataStorage.js":53,"../Storages/AppSettings.js":54,"KnoinAbstractViewModel":42,"kn":39,"ko":34}],63:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+
+ AppSettings = require('../../Storages/AppSettings.js'),
+ Data = require('../../Storages/AdminDataStorage.js'),
+ Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function PopupsActivateViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Popups', 'PopupsActivate');
+
+ var self = this;
+
+ this.domain = ko.observable('');
+ this.key = ko.observable('');
+ this.key.focus = ko.observable(false);
+ this.activationSuccessed = ko.observable(false);
+
+ this.licenseTrigger = Data.licenseTrigger;
+
+ this.activateProcess = ko.observable(false);
+ this.activateText = ko.observable('');
+ this.activateText.isError = ko.observable(false);
+
+ this.key.subscribe(function () {
+ this.activateText('');
+ this.activateText.isError(false);
+ }, this);
+
+ this.activationSuccessed.subscribe(function (bValue) {
+ if (bValue)
+ {
+ this.licenseTrigger(!this.licenseTrigger());
+ }
+ }, this);
+
+ this.activateCommand = Utils.createCommand(this, function () {
+
+ this.activateProcess(true);
+ if (this.validateSubscriptionKey())
+ {
+ Remote.licensingActivate(function (sResult, oData) {
+
+ self.activateProcess(false);
+ if (Enums.StorageResultType.Success === sResult && oData.Result)
+ {
+ if (true === oData.Result)
+ {
+ self.activationSuccessed(true);
+ self.activateText('Subscription Key Activated Successfully');
+ self.activateText.isError(false);
+ }
+ else
+ {
+ self.activateText(oData.Result);
+ self.activateText.isError(true);
+ self.key.focus(true);
+ }
+ }
+ else if (oData.ErrorCode)
+ {
+ self.activateText(Utils.getNotification(oData.ErrorCode));
+ self.activateText.isError(true);
+ self.key.focus(true);
+ }
+ else
+ {
+ self.activateText(Utils.getNotification(Enums.Notification.UnknownError));
+ self.activateText.isError(true);
+ self.key.focus(true);
+ }
+
+ }, this.domain(), this.key());
+ }
+ else
+ {
+ this.activateProcess(false);
+ this.activateText('Invalid Subscription Key');
+ this.activateText.isError(true);
+ this.key.focus(true);
+ }
+
+ }, function () {
+ return !this.activateProcess() && '' !== this.domain() && '' !== this.key() && !this.activationSuccessed();
+ });
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel('PopupsActivateViewModel', PopupsActivateViewModel);
+
+ PopupsActivateViewModel.prototype.onShow = function ()
+ {
+ this.domain(AppSettings.settingsGet('AdminDomain'));
+ if (!this.activateProcess())
+ {
+ this.key('');
+ this.activateText('');
+ this.activateText.isError(false);
+ this.activationSuccessed(false);
+ }
+ };
+
+ PopupsActivateViewModel.prototype.onFocus = function ()
+ {
+ if (!this.activateProcess())
+ {
+ this.key.focus(true);
+ }
+ };
+
+ /**
+ * @returns {boolean}
+ */
+ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
+ {
+ var sValue = this.key();
+ return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
+ };
+
+ module.exports = PopupsActivateViewModel;
+
+}(module, require));
+},{"../../Storages/AdminAjaxRemoteStorage.js":52,"../../Storages/AdminDataStorage.js":53,"../../Storages/AppSettings.js":54,"Enums":17,"KnoinAbstractViewModel":42,"Utils":22,"kn":39,"ko":34}],64:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ ko = require('ko'),
+ key = require('key'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function PopupsAskViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAsk');
+
+ this.askDesc = ko.observable('');
+ this.yesButton = ko.observable('');
+ this.noButton = ko.observable('');
+
+ this.yesFocus = ko.observable(false);
+ this.noFocus = ko.observable(false);
+
+ this.fYesAction = null;
+ this.fNoAction = null;
+
+ this.bDisabeCloseOnEsc = true;
+ this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel('PopupsAskViewModel', PopupsAskViewModel);
+
+ PopupsAskViewModel.prototype.clearPopup = function ()
+ {
+ this.askDesc('');
+ this.yesButton(Utils.i18n('POPUPS_ASK/BUTTON_YES'));
+ this.noButton(Utils.i18n('POPUPS_ASK/BUTTON_NO'));
+
+ this.yesFocus(false);
+ this.noFocus(false);
+
+ this.fYesAction = null;
+ this.fNoAction = null;
+ };
+
+ PopupsAskViewModel.prototype.yesClick = function ()
+ {
+ this.cancelCommand();
+
+ if (Utils.isFunc(this.fYesAction))
+ {
+ this.fYesAction.call(null);
+ }
+ };
+
+ PopupsAskViewModel.prototype.noClick = function ()
+ {
+ this.cancelCommand();
+
+ if (Utils.isFunc(this.fNoAction))
+ {
+ this.fNoAction.call(null);
+ }
+ };
+
+ /**
+ * @param {string} sAskDesc
+ * @param {Function=} fYesFunc
+ * @param {Function=} fNoFunc
+ * @param {string=} sYesButton
+ * @param {string=} sNoButton
+ */
+ PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton)
+ {
+ this.clearPopup();
+
+ this.fYesAction = fYesFunc || null;
+ this.fNoAction = fNoFunc || null;
+
+ this.askDesc(sAskDesc || '');
+ if (sYesButton)
+ {
+ this.yesButton(sYesButton);
+ }
+
+ if (sYesButton)
+ {
+ this.yesButton(sNoButton);
+ }
+ };
+
+ PopupsAskViewModel.prototype.onFocus = function ()
+ {
+ this.yesFocus(true);
+ };
+
+ PopupsAskViewModel.prototype.onBuild = function ()
+ {
+ key('tab, shift+tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
+ if (this.yesFocus())
+ {
+ this.noFocus(true);
+ }
+ else
+ {
+ this.yesFocus(true);
+ }
+ return false;
+ }, this));
+
+ key('esc', Enums.KeyState.PopupAsk, _.bind(function () {
+ this.noClick();
+ return false;
+ }, this));
+ };
+
+ module.exports = PopupsAskViewModel;
+
+}(module, require));
+},{"Enums":17,"KnoinAbstractViewModel":42,"Utils":22,"key":33,"kn":39,"ko":34}],65:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Utils = require('Utils'),
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -4764,7 +12517,9 @@
{
if (oData.Result)
{
+ var RL = require('../../Boots/AdminApp.js');
RL.reloadDomainList();
+
this.closeCommand();
}
else if (Enums.Notification.DomainAlreadyExists === oData.ErrorCode)
@@ -4842,27 +12597,112 @@
this.whiteList('');
};
- module.exports = new PopupsDomainViewModel();
+ module.exports = PopupsDomainViewModel;
-}(module));
+}(module, require));
+},{"../../Boots/AdminApp.js":14,"../../Storages/AdminAjaxRemoteStorage.js":52,"Consts":16,"Enums":17,"KnoinAbstractViewModel":42,"Utils":22,"_":37,"kn":39,"ko":34}],66:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
- key = require('../../External/key.js'),
-
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
+ _ = require('_'),
+ ko = require('ko'),
+
+ Utils = require('Utils'),
+
+ Data = require('../../Storages/WebMailDataStorage.js'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function PopupsLanguagesViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
+
+ this.exp = ko.observable(false);
+
+ this.languages = ko.computed(function () {
+ return _.map(Data.languages(), function (sLanguage) {
+ return {
+ 'key': sLanguage,
+ 'selected': ko.observable(false),
+ 'fullName': Utils.convertLangName(sLanguage)
+ };
+ });
+ });
+
+ Data.mainLanguage.subscribe(function () {
+ this.resetMainLanguage();
+ }, this);
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel('PopupsLanguagesViewModel', PopupsLanguagesViewModel);
+
+ PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
+ {
+ return Utils.convertLangName(sLanguage, true);
+ };
+
+ PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
+ {
+ var sCurrent = Data.mainLanguage();
+ _.each(this.languages(), function (oItem) {
+ oItem['selected'](oItem['key'] === sCurrent);
+ });
+ };
+
+ PopupsLanguagesViewModel.prototype.onShow = function ()
+ {
+ this.exp(true);
+
+ this.resetMainLanguage();
+ };
+
+ PopupsLanguagesViewModel.prototype.onHide = function ()
+ {
+ this.exp(false);
+ };
+
+ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
+ {
+ Data.mainLanguage(sLang);
+ this.cancelCommand();
+ };
+
+ module.exports = PopupsLanguagesViewModel;
+
+}(module, require));
+},{"../../Storages/WebMailDataStorage.js":59,"KnoinAbstractViewModel":42,"Utils":22,"_":37,"kn":39,"ko":34}],67:[function(require,module,exports){
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+(function (module, require) {
+
+ 'use strict';
+
+ var
+ _ = require('_'),
+ ko = require('ko'),
+ key = require('key'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ PopupsAskViewModel = require('./PopupsAskViewModel.js'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -5007,1657 +12847,7 @@
}, this));
};
- module.exports = new PopupsPluginViewModel();
+ module.exports = PopupsPluginViewModel;
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- ko = require('../../External/ko.js'),
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
-
- Data = require('../../Storages/AdminDataStorage.js'),
- Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
-
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsActivateViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsActivate');
-
- var self = this;
-
- this.domain = ko.observable('');
- this.key = ko.observable('');
- this.key.focus = ko.observable(false);
- this.activationSuccessed = ko.observable(false);
-
- this.licenseTrigger = Data.licenseTrigger;
-
- this.activateProcess = ko.observable(false);
- this.activateText = ko.observable('');
- this.activateText.isError = ko.observable(false);
-
- this.key.subscribe(function () {
- this.activateText('');
- this.activateText.isError(false);
- }, this);
-
- this.activationSuccessed.subscribe(function (bValue) {
- if (bValue)
- {
- this.licenseTrigger(!this.licenseTrigger());
- }
- }, this);
-
- this.activateCommand = Utils.createCommand(this, function () {
-
- this.activateProcess(true);
- if (this.validateSubscriptionKey())
- {
- Remote.licensingActivate(function (sResult, oData) {
-
- self.activateProcess(false);
- if (Enums.StorageResultType.Success === sResult && oData.Result)
- {
- if (true === oData.Result)
- {
- self.activationSuccessed(true);
- self.activateText('Subscription Key Activated Successfully');
- self.activateText.isError(false);
- }
- else
- {
- self.activateText(oData.Result);
- self.activateText.isError(true);
- self.key.focus(true);
- }
- }
- else if (oData.ErrorCode)
- {
- self.activateText(Utils.getNotification(oData.ErrorCode));
- self.activateText.isError(true);
- self.key.focus(true);
- }
- else
- {
- self.activateText(Utils.getNotification(Enums.Notification.UnknownError));
- self.activateText.isError(true);
- self.key.focus(true);
- }
-
- }, this.domain(), this.key());
- }
- else
- {
- this.activateProcess(false);
- this.activateText('Invalid Subscription Key');
- this.activateText.isError(true);
- this.key.focus(true);
- }
-
- }, function () {
- return !this.activateProcess() && '' !== this.domain() && '' !== this.key() && !this.activationSuccessed();
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel('PopupsActivateViewModel', PopupsActivateViewModel);
-
- PopupsActivateViewModel.prototype.onShow = function ()
- {
- this.domain(RL.settingsGet('AdminDomain'));
- if (!this.activateProcess())
- {
- this.key('');
- this.activateText('');
- this.activateText.isError(false);
- this.activationSuccessed(false);
- }
- };
-
- PopupsActivateViewModel.prototype.onFocus = function ()
- {
- if (!this.activateProcess())
- {
- this.key.focus(true);
- }
- };
-
- /**
- * @returns {boolean}
- */
- PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
- {
- var sValue = this.key();
- return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
- };
-
- module.exports = new PopupsActivateViewModel();
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
-
- Utils = require('../../Common/Utils.js'),
-
- Data = require('../../Storages/WebMailDataStorage.js'),
-
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsLanguagesViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
-
- this.exp = ko.observable(false);
-
- this.languages = ko.computed(function () {
- return _.map(Data.languages(), function (sLanguage) {
- return {
- 'key': sLanguage,
- 'selected': ko.observable(false),
- 'fullName': Utils.convertLangName(sLanguage)
- };
- });
- });
-
- Data.mainLanguage.subscribe(function () {
- this.resetMainLanguage();
- }, this);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel('PopupsLanguagesViewModel', PopupsLanguagesViewModel);
-
- PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
- {
- return Utils.convertLangName(sLanguage, true);
- };
-
- PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
- {
- var sCurrent = Data.mainLanguage();
- _.each(this.languages(), function (oItem) {
- oItem['selected'](oItem['key'] === sCurrent);
- });
- };
-
- PopupsLanguagesViewModel.prototype.onShow = function ()
- {
- this.exp(true);
-
- this.resetMainLanguage();
- };
-
- PopupsLanguagesViewModel.prototype.onHide = function ()
- {
- this.exp(false);
- };
-
- PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
- {
- Data.mainLanguage(sLang);
- this.cancelCommand();
- };
-
- module.exports = new PopupsLanguagesViewModel();
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- ko = require('../../External/ko.js'),
- key = require('../../External/key.js'),
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsAskViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsAsk');
-
- this.askDesc = ko.observable('');
- this.yesButton = ko.observable('');
- this.noButton = ko.observable('');
-
- this.yesFocus = ko.observable(false);
- this.noFocus = ko.observable(false);
-
- this.fYesAction = null;
- this.fNoAction = null;
-
- this.bDisabeCloseOnEsc = true;
- this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel('PopupsAskViewModel', PopupsAskViewModel);
-
- PopupsAskViewModel.prototype.clearPopup = function ()
- {
- this.askDesc('');
- this.yesButton(Utils.i18n('POPUPS_ASK/BUTTON_YES'));
- this.noButton(Utils.i18n('POPUPS_ASK/BUTTON_NO'));
-
- this.yesFocus(false);
- this.noFocus(false);
-
- this.fYesAction = null;
- this.fNoAction = null;
- };
-
- PopupsAskViewModel.prototype.yesClick = function ()
- {
- this.cancelCommand();
-
- if (Utils.isFunc(this.fYesAction))
- {
- this.fYesAction.call(null);
- }
- };
-
- PopupsAskViewModel.prototype.noClick = function ()
- {
- this.cancelCommand();
-
- if (Utils.isFunc(this.fNoAction))
- {
- this.fNoAction.call(null);
- }
- };
-
- /**
- * @param {string} sAskDesc
- * @param {Function=} fYesFunc
- * @param {Function=} fNoFunc
- * @param {string=} sYesButton
- * @param {string=} sNoButton
- */
- PopupsAskViewModel.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton)
- {
- this.clearPopup();
-
- this.fYesAction = fYesFunc || null;
- this.fNoAction = fNoFunc || null;
-
- this.askDesc(sAskDesc || '');
- if (sYesButton)
- {
- this.yesButton(sYesButton);
- }
-
- if (sYesButton)
- {
- this.yesButton(sNoButton);
- }
- };
-
- PopupsAskViewModel.prototype.onFocus = function ()
- {
- this.yesFocus(true);
- };
-
- PopupsAskViewModel.prototype.onBuild = function ()
- {
- key('tab, shift+tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
- if (this.yesFocus())
- {
- this.noFocus(true);
- }
- else
- {
- this.yesFocus(true);
- }
- return false;
- }, this));
-
- key('esc', Enums.KeyState.PopupAsk, _.bind(function () {
- this.noClick();
- return false;
- }, this));
- };
-
- module.exports = new PopupsAskViewModel();
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
-
- Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
-
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AdminLoginViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Center', 'AdminLogin');
-
- this.login = ko.observable('');
- this.password = ko.observable('');
-
- this.loginError = ko.observable(false);
- this.passwordError = ko.observable(false);
-
- this.loginFocus = ko.observable(false);
-
- this.login.subscribe(function () {
- this.loginError(false);
- }, this);
-
- this.password.subscribe(function () {
- this.passwordError(false);
- }, this);
-
- this.submitRequest = ko.observable(false);
- this.submitError = ko.observable('');
-
- this.submitCommand = Utils.createCommand(this, function () {
-
- Utils.triggerAutocompleteInputChange();
-
- this.loginError('' === Utils.trim(this.login()));
- this.passwordError('' === Utils.trim(this.password()));
-
- if (this.loginError() || this.passwordError())
- {
- return false;
- }
-
- this.submitRequest(true);
-
- Remote.adminLogin(_.bind(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action)
- {
- if (oData.Result)
- {
- RL.loginAndLogoutReload();
- }
- else if (oData.ErrorCode)
- {
- this.submitRequest(false);
- this.submitError(Utils.getNotification(oData.ErrorCode));
- }
- }
- else
- {
- this.submitRequest(false);
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
- }
-
- }, this), this.login(), this.password());
-
- return true;
-
- }, function () {
- return !this.submitRequest();
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel('AdminLoginViewModel', AdminLoginViewModel);
-
- AdminLoginViewModel.prototype.onShow = function ()
- {
- kn.routeOff();
-
- _.delay(_.bind(function () {
- this.loginFocus(true);
- }, this), 100);
-
- };
-
- AdminLoginViewModel.prototype.onHide = function ()
- {
- this.loginFocus(false);
- };
-
- AdminLoginViewModel.prototype.onBuild = function ()
- {
- Utils.triggerAutocompleteInputChange(true);
- };
-
- AdminLoginViewModel.prototype.submitForm = function ()
- {
- this.submitCommand();
- };
-
- module.exports = new AdminLoginViewModel();
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- kn = require('../Knoin/Knoin.js'),
- Data = require('../Storages/AdminDataStorage.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
- ;
-
- /**
- * @param {?} oScreen
- *
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AdminMenuViewModel(oScreen)
- {
- KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu');
-
- this.leftPanelDisabled = Data.leftPanelDisabled;
-
- this.menu = oScreen.menu;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel('AdminMenuViewModel', AdminMenuViewModel);
-
- AdminMenuViewModel.prototype.link = function (sRoute)
- {
- return '#/' + sRoute;
- };
-
- module.exports = new AdminMenuViewModel();
-
-}(module));
-
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- ko = require('../External/ko.js'),
-
- Data = require('../Storages/AdminDataStorage.js'),
- Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
-
- RL = require('../RL.js'),
-
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AdminPaneViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Right', 'AdminPane');
-
- this.adminDomain = ko.observable(RL().settingsGet('AdminDomain'));
- this.version = ko.observable(RL().settingsGet('Version'));
-
- this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel('AdminPaneViewModel', AdminPaneViewModel);
-
- AdminPaneViewModel.prototype.logoutClick = function ()
- {
- Remote.adminLogout(function () {
- RL().loginAndLogoutReload();
- });
- };
-
- module.exports = new AdminPaneViewModel();
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- ko = require('../External/ko.js'),
- key = require('../External/key.js'),
-
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
-
- RL = require('../RL.js')
- ;
-
- /**
- * @constructor
- */
- function AbstractData()
- {
- var self = this;
-
- this.leftPanelDisabled = ko.observable(false);
- this.useKeyboardShortcuts = ko.observable(true);
-
- this.keyScopeReal = ko.observable(Enums.KeyState.All);
- this.keyScopeFake = ko.observable(Enums.KeyState.All);
-
- this.keyScope = ko.computed({
- 'owner': this,
- 'read': function () {
- return this.keyScopeFake();
- },
- 'write': function (sValue) {
-
- if (Enums.KeyState.Menu !== sValue)
- {
- if (Enums.KeyState.Compose === sValue)
- {
- Utils.disableKeyFilter(self);
- }
- else
- {
- Utils.restoreKeyFilter(self);
- }
-
- this.keyScopeFake(sValue);
- if (Globals.dropdownVisibility())
- {
- sValue = Enums.KeyState.Menu;
- }
- }
-
- this.keyScopeReal(sValue);
- }
- });
-
- this.keyScopeReal.subscribe(function (sValue) {
- // window.console.log(sValue);
- key.setScope(sValue);
- });
-
- this.leftPanelDisabled.subscribe(function (bValue) {
- RL().pub('left-panel.' + (bValue ? 'off' : 'on'));
- });
-
- Globals.dropdownVisibility.subscribe(function (bValue) {
- if (bValue)
- {
- Globals.tooltipTrigger(!Globals.tooltipTrigger());
- this.keyScope(Enums.KeyState.Menu);
- }
- else if (Enums.KeyState.Menu === key.getScope())
- {
- this.keyScope(this.keyScopeFake());
- }
- }, this);
-
- Utils.initDataConstructorBySettings(this);
- }
-
- AbstractData.prototype.populateDataOnStart = function()
- {
- var
- mLayout = Utils.pInt(RL().settingsGet('Layout')), // TODO cjs
- aLanguages = RL().settingsGet('Languages'),
- aThemes = RL().settingsGet('Themes')
- ;
-
- if (Utils.isArray(aLanguages))
- {
- this.languages(aLanguages);
- }
-
- if (Utils.isArray(aThemes))
- {
- this.themes(aThemes);
- }
-
- this.mainLanguage(RL().settingsGet('Language'));
- this.mainTheme(RL().settingsGet('Theme'));
-
- this.capaAdditionalAccounts(RL().capa(Enums.Capa.AdditionalAccounts));
- this.capaAdditionalIdentities(RL().capa(Enums.Capa.AdditionalIdentities));
- this.capaGravatar(RL().capa(Enums.Capa.Gravatar));
- this.determineUserLanguage(!!RL().settingsGet('DetermineUserLanguage'));
- this.determineUserDomain(!!RL().settingsGet('DetermineUserDomain'));
-
- this.capaThemes(RL().capa(Enums.Capa.Themes));
- this.allowLanguagesOnLogin(!!RL().settingsGet('AllowLanguagesOnLogin'));
- this.allowLanguagesOnSettings(!!RL().settingsGet('AllowLanguagesOnSettings'));
- this.useLocalProxyForExternalImages(!!RL().settingsGet('UseLocalProxyForExternalImages'));
-
- this.editorDefaultType(RL().settingsGet('EditorDefaultType'));
- this.showImages(!!RL().settingsGet('ShowImages'));
- this.contactsAutosave(!!RL().settingsGet('ContactsAutosave'));
- this.interfaceAnimation(RL().settingsGet('InterfaceAnimation'));
-
- this.mainMessagesPerPage(RL().settingsGet('MPP'));
-
- this.desktopNotifications(!!RL().settingsGet('DesktopNotifications'));
- this.useThreads(!!RL().settingsGet('UseThreads'));
- this.replySameFolder(!!RL().settingsGet('ReplySameFolder'));
- this.useCheckboxesInList(!!RL().settingsGet('UseCheckboxesInList'));
-
- this.layout(Enums.Layout.SidePreview);
- if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
- {
- this.layout(mLayout);
- }
- this.facebookSupported(!!RL().settingsGet('SupportedFacebookSocial'));
- this.facebookEnable(!!RL().settingsGet('AllowFacebookSocial'));
- this.facebookAppID(RL().settingsGet('FacebookAppID'));
- this.facebookAppSecret(RL().settingsGet('FacebookAppSecret'));
-
- this.twitterEnable(!!RL().settingsGet('AllowTwitterSocial'));
- this.twitterConsumerKey(RL().settingsGet('TwitterConsumerKey'));
- this.twitterConsumerSecret(RL().settingsGet('TwitterConsumerSecret'));
-
- this.googleEnable(!!RL().settingsGet('AllowGoogleSocial'));
- this.googleClientID(RL().settingsGet('GoogleClientID'));
- this.googleClientSecret(RL().settingsGet('GoogleClientSecret'));
- this.googleApiKey(RL().settingsGet('GoogleApiKey'));
-
- this.dropboxEnable(!!RL().settingsGet('AllowDropboxSocial'));
- this.dropboxApiKey(RL().settingsGet('DropboxApiKey'));
-
- this.contactsIsAllowed(!!RL().settingsGet('ContactsIsAllowed'));
- };
-
- module.exports = AbstractData;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
-
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
-
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js')
- ;
-
- /**
- * @param {Array} aViewModels
- * @constructor
- * @extends KnoinAbstractScreen
- */
- function AbstractSettings(aViewModels)
- {
- KnoinAbstractScreen.call(this, 'settings', aViewModels);
-
- this.menu = ko.observableArray([]);
-
- this.oCurrentSubScreen = null;
- this.oViewModelPlace = null;
- }
-
- _.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
-
- AbstractSettings.prototype.onRoute = function (sSubName)
- {
- var
- self = this,
- oSettingsScreen = null,
- RoutedSettingsViewModel = null,
- oViewModelPlace = null,
- oViewModelDom = null
- ;
-
- RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
- return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
- sSubName === SettingsViewModel.__rlSettingsData.Route;
- });
-
- if (RoutedSettingsViewModel)
- {
- if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
- }))
- {
- RoutedSettingsViewModel = null;
- }
-
- if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
- }))
- {
- RoutedSettingsViewModel = null;
- }
- }
-
- if (RoutedSettingsViewModel)
- {
- if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
- {
- oSettingsScreen = RoutedSettingsViewModel.__vm;
- }
- else
- {
- oViewModelPlace = this.oViewModelPlace;
- if (oViewModelPlace && 1 === oViewModelPlace.length)
- {
- RoutedSettingsViewModel = /** @type {?Function} */ RoutedSettingsViewModel;
- oSettingsScreen = new RoutedSettingsViewModel();
-
- oViewModelDom = $('').addClass('rl-settings-view-model').hide();
- oViewModelDom.appendTo(oViewModelPlace);
-
- oSettingsScreen.viewModelDom = oViewModelDom;
-
- oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
-
- RoutedSettingsViewModel.__dom = oViewModelDom;
- RoutedSettingsViewModel.__builded = true;
- RoutedSettingsViewModel.__vm = oSettingsScreen;
-
- ko.applyBindingAccessorsToNode(oViewModelDom[0], {
- 'i18nInit': true,
- 'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
- }, oSettingsScreen);
-
- Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
- }
- else
- {
- Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
- }
- }
-
- if (oSettingsScreen)
- {
- _.defer(function () {
- // hide
- if (self.oCurrentSubScreen)
- {
- Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
- self.oCurrentSubScreen.viewModelDom.hide();
- }
- // --
-
- self.oCurrentSubScreen = oSettingsScreen;
-
- // show
- if (self.oCurrentSubScreen)
- {
- self.oCurrentSubScreen.viewModelDom.show();
- Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
- Utils.delegateRun(self.oCurrentSubScreen, 'onFocus', [], 200);
-
- _.each(self.menu(), function (oItem) {
- oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
- });
-
- $('#rl-content .b-settings .b-content .content').scrollTop(0);
- }
- // --
-
- Utils.windowResize();
- });
- }
- }
- else
- {
- kn.setHash(LinkBuilder.settings(), false, true); // TODO cjs
- }
- };
-
- AbstractSettings.prototype.onHide = function ()
- {
- if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
- {
- Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
- this.oCurrentSubScreen.viewModelDom.hide();
- }
- };
-
- AbstractSettings.prototype.onBuild = function ()
- {
- _.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
- if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
- !_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
- return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
- }))
- {
- this.menu.push({
- 'route': SettingsViewModel.__rlSettingsData.Route,
- 'label': SettingsViewModel.__rlSettingsData.Label,
- 'selected': ko.observable(false),
- 'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
- })
- });
- }
- }, this);
-
- this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
- };
-
- AbstractSettings.prototype.routes = function ()
- {
- var
- DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
- return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
- }),
- sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
- oRules = {
- 'subname': /^(.*)$/,
- 'normalize_': function (oRequest, oVals) {
- oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
- return [oVals.subname];
- }
- }
- ;
-
- return [
- ['{subname}/', oRules],
- ['{subname}', oRules],
- ['', oRules]
- ];
- };
-
- module.exports = AbstractSettings;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- _ = require('../External/underscore.js'),
- KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'),
- AdminLoginViewModel = require('../ViewModels/AdminLoginViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractScreen
- */
- function AdminLoginScreen()
- {
- KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
- }
-
- _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
-
- AdminLoginScreen.prototype.onShow = function ()
- {
- RL.setTitle(''); // TODO cjs
- };
-
- module.exports = AdminLoginScreen;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- _ = require('../External/underscore.js'),
- AbstractSettings = require('./AbstractSettings.js'),
- AdminMenuViewModel = require('../ViewModels/AdminMenuViewModel.js'),
- AdminPaneViewModel = require('../ViewModels/AdminPaneViewModel.js')
- ;
-
- /**
- * @constructor
- * @extends AbstractSettings
- */
- function AdminSettingsScreen()
- {
- AbstractSettings.call(this, [
- AdminMenuViewModel,
- AdminPaneViewModel
- ]);
- }
-
- _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
-
- AdminSettingsScreen.prototype.onShow = function ()
- {
- RL.setTitle(''); // TODO cjs
- };
-
- module.exports = AdminSettingsScreen;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- window = require('../External/window.js'),
- $html = require('../External/$html.js'),
- $window = require('../External/$window.js'),
- $doc = require('../External/$doc.js'),
- AppData = require('../External/AppData.js'),
-
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- Plugins = require('../Common/Plugins.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
-
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractBoot = require('../Knoin/KnoinAbstractBoot.js')
- ;
-
- /**
- * @param {*} Remote
- * @constructor
- * @extends KnoinAbstractBoot
- */
- function AbstractApp(Remote)
- {
- KnoinAbstractBoot.call(this);
-
- this.oSettings = null;
- this.oPlugins = null;
- this.oLocal = null;
- this.oLink = null;
- this.oSubs = {};
-
- this.isLocalAutocomplete = true;
-
- this.popupVisibilityNames = ko.observableArray([]);
-
- this.popupVisibility = ko.computed(function () {
- return 0 < this.popupVisibilityNames().length;
- }, this);
-
- this.iframe = $('').appendTo('body');
-
- $window.on('error', function (oEvent) {
- if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
- -1 === Utils.inArray(oEvent.originalEvent.message, [
- 'Script error.', 'Uncaught Error: Error calling method on NPObject.'
- ]))
- {
- Remote.jsError(
- Utils.emptyFunction,
- oEvent.originalEvent.message,
- oEvent.originalEvent.filename,
- oEvent.originalEvent.lineno,
- window.location && window.location.toString ? window.location.toString() : '',
- $html.attr('class'),
- Utils.microtime() - Globals.now
- );
- }
- });
-
- $doc.on('keydown', function (oEvent) {
- if (oEvent && oEvent.ctrlKey)
- {
- $html.addClass('rl-ctrl-key-pressed');
- }
- }).on('keyup', function (oEvent) {
- if (oEvent && !oEvent.ctrlKey)
- {
- $html.removeClass('rl-ctrl-key-pressed');
- }
- });
- }
-
- _.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
-
- AbstractApp.prototype.oSettings = null;
- AbstractApp.prototype.oPlugins = null;
- AbstractApp.prototype.oLocal = null;
- AbstractApp.prototype.oLink = null;
- AbstractApp.prototype.oSubs = {};
-
- /**
- * @param {string} sLink
- * @return {boolean}
- */
- AbstractApp.prototype.download = function (sLink)
- {
- var
- oE = null,
- oLink = null,
- sUserAgent = window.navigator.userAgent.toLowerCase()
- ;
-
- if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
- {
- oLink = window.document.createElement('a');
- oLink['href'] = sLink;
-
- if (window.document['createEvent'])
- {
- oE = window.document['createEvent']('MouseEvents');
- if (oE && oE['initEvent'] && oLink['dispatchEvent'])
- {
- oE['initEvent']('click', true, true);
- oLink['dispatchEvent'](oE);
- return true;
- }
- }
- }
-
- if (Globals.bMobileDevice)
- {
- window.open(sLink, '_self');
- window.focus();
- }
- else
- {
- this.iframe.attr('src', sLink);
- // window.document.location.href = sLink;
- }
-
- return true;
- };
-
- /**
- * @param {string} sName
- * @return {?}
- */
- AbstractApp.prototype.settingsGet = function (sName)
- {
- if (null === this.oSettings)
- {
- this.oSettings = Utils.isNormal(AppData) ? AppData : {};
- }
-
- return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
- };
-
- /**
- * @param {string} sName
- * @param {?} mValue
- */
- AbstractApp.prototype.settingsSet = function (sName, mValue)
- {
- if (null === this.oSettings)
- {
- this.oSettings = Utils.isNormal(AppData) ? AppData : {};
- }
-
- this.oSettings[sName] = mValue;
- };
-
- AbstractApp.prototype.setTitle = function (sTitle)
- {
- sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
- this.settingsGet('Title') || '';
-
- window.document.title = '_';
- window.document.title = sTitle;
- };
-
- /**
- * @param {boolean=} bLogout = false
- * @param {boolean=} bClose = false
- */
- AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
- {
- var
- sCustomLogoutLink = Utils.pString(this.settingsGet('CustomLogoutLink')),
- bInIframe = !!this.settingsGet('InIframe')
- ;
-
- bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
- bClose = Utils.isUnd(bClose) ? false : !!bClose;
-
- if (bLogout && bClose && window.close)
- {
- window.close();
- }
-
- if (bLogout && '' !== sCustomLogoutLink && window.location.href !== sCustomLogoutLink)
- {
- _.delay(function () {
- if (bInIframe && window.parent)
- {
- window.parent.location.href = sCustomLogoutLink;
- }
- else
- {
- window.location.href = sCustomLogoutLink;
- }
- }, 100);
- }
- else
- {
- kn.routeOff();
- kn.setHash(LinkBuilder.root(), true);
- kn.routeOff();
-
- _.delay(function () {
- if (bInIframe && window.parent)
- {
- window.parent.location.reload();
- }
- else
- {
- window.location.reload();
- }
- }, 100);
- }
- };
-
- AbstractApp.prototype.historyBack = function ()
- {
- window.history.back();
- };
-
- /**
- * @param {string} sQuery
- * @param {Function} fCallback
- */
- AbstractApp.prototype.getAutocomplete = function (sQuery, fCallback)
- {
- fCallback([], sQuery);
- };
-
- /**
- * @param {string} sName
- * @param {Function} fFunc
- * @param {Object=} oContext
- * @return {AbstractApp}
- */
- AbstractApp.prototype.sub = function (sName, fFunc, oContext)
- {
- if (Utils.isUnd(this.oSubs[sName]))
- {
- this.oSubs[sName] = [];
- }
-
- this.oSubs[sName].push([fFunc, oContext]);
-
- return this;
- };
-
- /**
- * @param {string} sName
- * @param {Array=} aArgs
- * @return {AbstractApp}
- */
- AbstractApp.prototype.pub = function (sName, aArgs)
- {
- Plugins.runHook('rl-pub', [sName, aArgs]);
- if (!Utils.isUnd(this.oSubs[sName]))
- {
- _.each(this.oSubs[sName], function (aItem) {
- if (aItem[0])
- {
- aItem[0].apply(aItem[1] || null, aArgs || []);
- }
- });
- }
-
- return this;
- };
-
- /**
- * @param {string} sName
- * @return {boolean}
- */
- AbstractApp.prototype.capa = function (sName)
- {
- var mCapa = this.settingsGet('Capa');
- return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
- };
-
- AbstractApp.prototype.bootstart = function (Data)
- {
- var
- self = this,
- ssm = require('../External/ssm.js')
- ;
-
- Utils.initOnStartOrLangChange(function () {
- Utils.initNotificationLanguage();
- }, null);
-
- _.delay(function () {
- Utils.windowResize();
- }, 1000);
-
- ssm.addState({
- 'id': 'mobile',
- 'maxWidth': 767,
- 'onEnter': function() {
- $html.addClass('ssm-state-mobile');
- self.pub('ssm.mobile-enter');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-mobile');
- self.pub('ssm.mobile-leave');
- }
- });
-
- ssm.addState({
- 'id': 'tablet',
- 'minWidth': 768,
- 'maxWidth': 999,
- 'onEnter': function() {
- $html.addClass('ssm-state-tablet');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-tablet');
- }
- });
-
- ssm.addState({
- 'id': 'desktop',
- 'minWidth': 1000,
- 'maxWidth': 1400,
- 'onEnter': function() {
- $html.addClass('ssm-state-desktop');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-desktop');
- }
- });
-
- ssm.addState({
- 'id': 'desktop-large',
- 'minWidth': 1400,
- 'onEnter': function() {
- $html.addClass('ssm-state-desktop-large');
- },
- 'onLeave': function() {
- $html.removeClass('ssm-state-desktop-large');
- }
- });
-
- this.sub('ssm.mobile-enter', function () {
- Data.leftPanelDisabled(true);
- });
-
- this.sub('ssm.mobile-leave', function () {
- Data.leftPanelDisabled(false);
- });
-
- Data.leftPanelDisabled.subscribe(function (bValue) {
- $html.toggleClass('rl-left-panel-disabled', bValue);
- });
-
- ssm.ready();
- };
-
- module.exports = AbstractApp;
-
-}(module));
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module) {
-
- 'use strict';
-
- var
- ko = require('../External/ko.js'),
- _ = require('../External/underscore.js'),
- window = require('../External/window.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
-
- kn = require('../Knoin/Knoin.js'),
-
- Data = require('../Storages/AdminDataStorage.js'),
- Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
-
- AbstractApp = require('./AbstractApp.js')
- ;
-
- /**
- * @constructor
- * @extends AbstractApp
- */
- function AdminApp()
- {
- AbstractApp.call(this, Remote);
-
- this.oData = null;
- this.oRemote = null;
- this.oCache = null;
- }
-
- _.extend(AdminApp.prototype, AbstractApp.prototype);
-
- AdminApp.prototype.oData = null;
- AdminApp.prototype.oRemote = null;
- AdminApp.prototype.oCache = null;
-
- /**
- * @return {AdminDataStorage}
- */
- AdminApp.prototype.data = function ()
- {
- if (null === this.oData)
- {
- this.oData = new AdminDataStorage(); // TODO cjs
- }
-
- return this.oData;
- };
-
- /**
- * @return {AdminAjaxRemoteStorage}
- */
- AdminApp.prototype.remote = function ()
- {
- if (null === this.oRemote)
- {
- this.oRemote = new AdminAjaxRemoteStorage(); // TODO cjs
- }
-
- return this.oRemote;
- };
-
- AdminApp.prototype.reloadDomainList = function ()
- {
- // TODO cjs
- Data.domainsLoading(true);
- Remote.domainList(function (sResult, oData) {
- Data.domainsLoading(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- var aList = _.map(oData.Result, function (bEnabled, sName) {
- return {
- 'name': sName,
- 'disabled': ko.observable(!bEnabled),
- 'deleteAccess': ko.observable(false)
- };
- }, this);
-
- Data.domains(aList);
- }
- });
- };
-
- AdminApp.prototype.reloadPluginList = function ()
- {
- // TODO cjs
- Data.pluginsLoading(true);
- Remote.pluginList(function (sResult, oData) {
- Data.pluginsLoading(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- var aList = _.map(oData.Result, function (oItem) {
- return {
- 'name': oItem['Name'],
- 'disabled': ko.observable(!oItem['Enabled']),
- 'configured': ko.observable(!!oItem['Configured'])
- };
- }, this);
-
- Data.plugins(aList);
- }
- });
- };
-
- AdminApp.prototype.reloadPackagesList = function ()
- {
- // TODO cjs
- Data.packagesLoading(true);
- Data.packagesReal(true);
-
- Remote.packagesList(function (sResult, oData) {
-
- Data.packagesLoading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- Data.packagesReal(!!oData.Result.Real);
- Data.packagesMainUpdatable(!!oData.Result.MainUpdatable);
-
- var
- aList = [],
- aLoading = {}
- ;
-
- _.each(Data.packages(), function (oItem) {
- if (oItem && oItem['loading']())
- {
- aLoading[oItem['file']] = oItem;
- }
- });
-
- if (Utils.isArray(oData.Result.List))
- {
- aList = _.compact(_.map(oData.Result.List, function (oItem) {
- if (oItem)
- {
- oItem['loading'] = ko.observable(!Utils.isUnd(aLoading[oItem['file']]));
- return 'core' === oItem['type'] && !oItem['canBeInstalled'] ? null : oItem;
- }
- return null;
- }));
- }
-
- Data.packages(aList);
- }
- else
- {
- Data.packagesReal(false);
- }
- });
- };
-
- AdminApp.prototype.updateCoreData = function ()
- {
- Data.coreUpdating(true);
- Remote.updateCoreData(function (sResult, oData) {
-
- Data.coreUpdating(false);
- Data.coreRemoteVersion('');
- Data.coreRemoteRelease('');
- Data.coreVersionCompare(-2);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- Data.coreReal(true);
- window.location.reload();
- }
- else
- {
- Data.coreReal(false);
- }
- });
-
- };
-
- AdminApp.prototype.reloadCoreData = function ()
- {
- Data.coreChecking(true);
- Data.coreReal(true);
-
- Remote.coreData(function (sResult, oData) {
-
- Data.coreChecking(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- Data.coreReal(!!oData.Result.Real);
- Data.coreUpdatable(!!oData.Result.Updatable);
- Data.coreAccess(!!oData.Result.Access);
- Data.coreRemoteVersion(oData.Result.RemoteVersion || '');
- Data.coreRemoteRelease(oData.Result.RemoteRelease || '');
- Data.coreVersionCompare(Utils.pInt(oData.Result.VersionCompare));
- }
- else
- {
- Data.coreReal(false);
- Data.coreRemoteVersion('');
- Data.coreRemoteRelease('');
- Data.coreVersionCompare(-2);
- }
- });
- };
-
- /**
- *
- * @param {boolean=} bForce = false
- */
- AdminApp.prototype.reloadLicensing = function (bForce)
- {
- bForce = Utils.isUnd(bForce) ? false : !!bForce;
-
- // TODO cjs
- Data.licensingProcess(true);
- Data.licenseError('');
-
- Remote.licensing(function (sResult, oData) {
- Data.licensingProcess(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result && Utils.isNormal(oData.Result['Expired']))
- {
- Data.licenseValid(true);
- Data.licenseExpired(Utils.pInt(oData.Result['Expired']));
- Data.licenseError('');
-
- Data.licensing(true);
- }
- else
- {
- if (oData && oData.ErrorCode && -1 < Utils.inArray(Utils.pInt(oData.ErrorCode), [
- Enums.Notification.LicensingServerIsUnavailable,
- Enums.Notification.LicensingExpired
- ]))
- {
- Data.licenseError(Utils.getNotification(Utils.pInt(oData.ErrorCode)));
- Data.licensing(true);
- }
- else
- {
- if (Enums.StorageResultType.Abort === sResult)
- {
- Data.licenseError(Utils.getNotification(Enums.Notification.LicensingServerIsUnavailable));
- Data.licensing(true);
- }
- else
- {
- Data.licensing(false);
- }
- }
- }
- }, bForce);
- };
-
- AdminApp.prototype.bootstart = function ()
- {
- AbstractApp.prototype.bootstart.call(this, Data);
-
- Data.populateDataOnStart();
-
- kn.hideLoading();
-
- if (!RL.settingsGet('AllowAdminPanel'))
- {
- kn.routeOff();
- kn.setHash(LinkBuilder.root(), true);
- kn.routeOff();
-
- _.defer(function () {
- window.location.href = '/';
- });
- }
- else
- {
- // kn.removeSettingsViewModel(AdminAbout);
-
- if (!RL.capa(Enums.Capa.Prem))
- {
- kn.removeSettingsViewModel(AdminBranding);
- }
-
- if (!!RL.settingsGet('Auth'))
- {
- // TODO
- // if (!RL.settingsGet('AllowPackages') && AdminPackages)
- // {
- // kn.disableSettingsViewModel(AdminPackages);
- // }
-
- kn.startScreens([AdminSettingsScreen]);
- }
- else
- {
- kn.startScreens([AdminLoginScreen]);
- }
- }
-
- if (window.SimplePace)
- {
- window.SimplePace.set(100);
- }
- };
-
- module.exports = new AdminApp();
-
-}(module));
-
-}(window, jQuery, ko, crossroads, hasher, _));
\ No newline at end of file
+}(module, require));
+},{"../../Storages/AdminAjaxRemoteStorage.js":52,"./PopupsAskViewModel.js":64,"Enums":17,"KnoinAbstractViewModel":42,"Utils":22,"_":37,"key":33,"kn":39,"ko":34}]},{},[1]);
diff --git a/rainloop/v/0.0.0/static/js/admin.min.js b/rainloop/v/0.0.0/static/js/admin.min.js
index 520f10352..2c171998a 100644
--- a/rainloop/v/0.0.0/static/js/admin.min.js
+++ b/rainloop/v/0.0.0/static/js/admin.min.js
@@ -1,5 +1,6 @@
-/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-!function(e,t,i,n,o,s){"use strict";function a(){this.sBase="#/",this.sServer="./?",this.sVersion=lt.settingsGet("Version"),this.sSpecSuffix=lt.settingsGet("AuthAccountHash")||"0",this.sStaticPrefix=lt.settingsGet("StaticPrefix")||"rainloop/v/"+this.sVersion+"/static/"}function r(){}function l(){}function c(){var e=[l,r],t=s.find(e,function(e){return e.supported()});t&&(t=t,this.oDriver=new t)}function u(){}function p(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=$.pString(e),this.sTemplate=$.pString(t),this.sDefaultKeyScope=W.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=i.observable(!1),this.modalVisibility=i.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}function d(e,t){this.sScreenName=e,this.aViewModels=$.isArray(t)?t:[]}function g(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null}function h(e,t){this.email=e||"",this.name=t||"",this.privateType=null,this.clearDuplicateName()}function m(){this.idContactTag=0,this.name=i.observable(""),this.readOnly=!1}function f(){p.call(this,"Popups","PopupsDomain"),this.edit=i.observable(!1),this.saving=i.observable(!1),this.savingError=i.observable(""),this.whiteListPage=i.observable(!1),this.testing=i.observable(!1),this.testingDone=i.observable(!1),this.testingImapError=i.observable(!1),this.testingSmtpError=i.observable(!1),this.testingImapErrorDesc=i.observable(""),this.testingSmtpErrorDesc=i.observable(""),this.testingImapError.subscribe(function(e){e||this.testingImapErrorDesc("")},this),this.testingSmtpError.subscribe(function(e){e||this.testingSmtpErrorDesc("")},this),this.testingImapErrorDesc=i.observable(""),this.testingSmtpErrorDesc=i.observable(""),this.imapServerFocus=i.observable(!1),this.smtpServerFocus=i.observable(!1),this.name=i.observable(""),this.name.focused=i.observable(!1),this.imapServer=i.observable(""),this.imapPort=i.observable(""+j.Values.ImapDefaulPort),this.imapSecure=i.observable(W.ServerSecure.None),this.imapShortLogin=i.observable(!1),this.smtpServer=i.observable(""),this.smtpPort=i.observable(""+j.Values.SmtpDefaulPort),this.smtpSecure=i.observable(W.ServerSecure.None),this.smtpShortLogin=i.observable(!1),this.smtpAuth=i.observable(!0),this.whiteList=i.observable(""),this.headerText=i.computed(function(){var e=this.name();return this.edit()?'Edit Domain "'+e+'"':"Add Domain"+(""===e?"":' "'+e+'"')},this),this.domainIsComputed=i.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=i.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=i.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=$.createCommand(this,function(){this.saving(!0),lt.remote().createOrUpdateDomain(s.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),$.pInt(this.imapPort()),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),$.pInt(this.smtpPort()),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=$.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),lt.remote().testConnectionForDomain(s.bind(this.onTestConnectionResponse,this),this.name(),this.imapServer(),$.pInt(this.imapPort()),this.imapSecure(),this.smtpServer(),$.pInt(this.smtpPort()),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=$.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),this.imapServerFocus.subscribe(function(e){e&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(e){e&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer().replace(/imap/gi,"smtp"))},this),this.imapSecure.subscribe(function(e){var t=$.pInt(this.imapPort());switch(e=$.pString(e)){case"0":993===t&&this.imapPort("143");break;case"1":143===t&&this.imapPort("993")}},this),this.smtpSecure.subscribe(function(e){var t=$.pInt(this.smtpPort());switch(e=$.pString(e)){case"0":(465===t||587===t)&&this.smtpPort("25");break;case"1":(25===t||587===t)&&this.smtpPort("465");break;case"2":(25===t||465===t)&&this.smtpPort("587")}},this),g.constructorEnd(this)}function b(){p.call(this,"Popups","PopupsPlugin");var e=this;this.onPluginSettingsUpdateResponse=s.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=i.observable(""),this.name=i.observable(""),this.readme=i.observable(""),this.configures=i.observableArray([]),this.hasReadme=i.computed(function(){return""!==this.readme()},this),this.hasConfiguration=i.computed(function(){return 0').appendTo("body"),st.on("error",function(e){lt&&e&&e.originalEvent&&e.originalEvent.message&&-1===$.inArray(e.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&<.remote().jsError($.emptyFunction,e.originalEvent.message,e.originalEvent.filename,e.originalEvent.lineno,location&&location.toString?location.toString():"",ot.attr("class"),$.microtime()-X.now)}),at.on("keydown",function(e){e&&e.ctrlKey&&ot.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&ot.removeClass("rl-ctrl-key-pressed")})}function z(){K.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var j={},W={},Y={},$={},J={},Q={},X={},Z={settings:[],"settings-removed":[],"settings-disabled":[]},et=[],tt=null,it=e.rainloopAppData||{},nt=e.rainloopI18N||{},ot=t("html"),st=t(e),at=t(e.document),rt=e.Notification&&e.Notification.requestPermission?e.Notification:null,lt=null;X.now=(new Date).getTime(),X.momentTrigger=i.observable(!0),X.dropdownVisibility=i.observable(!1).extend({rateLimit:0}),X.tooltipTrigger=i.observable(!1).extend({rateLimit:0}),X.langChangeTrigger=i.observable(!0),X.iAjaxErrorCount=0,X.iTokenErrorCount=0,X.iMessageBodyCacheCount=0,X.bUnload=!1,X.sUserAgent=(navigator.userAgent||"").toLowerCase(),X.bIsiOSDevice=-1s;s++)o=n[s].split("="),i[e.decodeURIComponent(o[0])]=e.decodeURIComponent(o[1]);return i},$.rsaEncode=function(t,i,n,o){if(e.crypto&&e.crypto.getRandomValues&&e.RSAKey&&i&&n&&o){var s=new e.RSAKey;if(s.setPublic(o,n),t=s.encrypt($.fakeMd5()+":"+t+":"+$.fakeMd5()),!1!==t)return"rsa:"+i+":"+t}return!1},$.rsaEncode.supported=!!(e.crypto&&e.crypto.getRandomValues&&e.RSAKey),$.exportPath=function(t,i,n){for(var o=null,s=t.split("."),a=n||e;s.length&&(o=s.shift());)s.length||$.isUnd(i)?a=a[o]?a[o]:a[o]={}:a[o]=i},$.pImport=function(e,t,i){e[t]=i},$.pExport=function(e,t,i){return $.isUnd(e[t])?i:e[t]},$.encodeHtml=function(e){return $.isNormal(e)?e.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):""},$.splitPlainText=function(e,t){var i="",n="",o=e,s=0,a=0;for(t=$.isUnd(t)?100:t;o.length>t;)n=o.substring(0,t),s=n.lastIndexOf(" "),a=n.lastIndexOf("\n"),-1!==a&&(s=a),-1===s&&(s=t),i+=n.substring(0,s)+"\n",o=o.substring(s+1);return i+o},$.timeOutAction=function(){var t={};return function(i,n,o){$.isUnd(t[i])&&(t[i]=0),e.clearTimeout(t[i]),t[i]=e.setTimeout(n,o)}}(),$.timeOutActionSecond=function(){var t={};return function(i,n,o){t[i]||(t[i]=e.setTimeout(function(){n(),t[i]=0},o))}}(),$.audio=function(){var t=!1;return function(i,n){if(!1===t)if(X.bIsiOSDevice)t=null;else{var o=!1,s=!1,a=e.Audio?new e.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(s=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||s?(t=a,t.preload="none",t.loop=!1,t.autoplay=!1,t.muted=!1,t.src=o?i:n):t=null):t=null}return t}}(),$.hos=function(e,t){return e&&Object.hasOwnProperty?Object.hasOwnProperty.call(e,t):!1},$.i18n=function(e,t,i){var n="",o=$.isUnd(nt[e])?$.isUnd(i)?e:i:nt[e];if(!$.isUnd(t)&&!$.isNull(t))for(n in t)$.hos(t,n)&&(o=o.replace("%"+n+"%",t[n]));return o},$.i18nToNode=function(e){s.defer(function(){t(".i18n",e).each(function(){var e=t(this),i="";
-i=e.data("i18n-text"),i?e.text($.i18n(i)):(i=e.data("i18n-html"),i&&e.html($.i18n(i)),i=e.data("i18n-placeholder"),i&&e.attr("placeholder",$.i18n(i)),i=e.data("i18n-title"),i&&e.attr("title",$.i18n(i)))})})},$.i18nToDoc=function(){e.rainloopI18N&&(nt=e.rainloopI18N||{},$.i18nToNode(at),X.langChangeTrigger(!X.langChangeTrigger())),e.rainloopI18N={}},$.initOnStartOrLangChange=function(e,t,i){e&&e.call(t),i?X.langChangeTrigger.subscribe(function(){e&&e.call(t),i.call(t)}):e&&X.langChangeTrigger.subscribe(e,t)},$.inFocus=function(){return document.activeElement?($.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=t(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},$.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var e=t(document.activeElement);e.is("input,textarea")&&document.activeElement.blur()}},$.removeSelection=function(){if(e&&e.getSelection){var t=e.getSelection();t&&t.removeAllRanges&&t.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},$.replySubjectAdd=function(e,t){e=$.trim(e.toUpperCase()),t=$.trim(t.replace(/[\s]+/," "));var i=0,n="",o=!1,s="",a=[],r=[],l="RE"===e,c="FWD"===e,u=!c;if(""!==t){for(o=!1,r=t.split(":"),i=0;i0);return e.replace(/[\s]+/," ")},$._replySubjectAdd_=function(t,i,n){var o=null,s=$.trim(i);return s=null===(o=new e.RegExp("^"+t+"[\\s]?\\:(.*)$","gi").exec(i))||$.isUnd(o[1])?null===(o=new e.RegExp("^("+t+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(i))||$.isUnd(o[1])||$.isUnd(o[2])||$.isUnd(o[3])?t+": "+i:o[1]+($.pInt(o[2])+1)+o[3]:t+"[2]: "+o[1],s=s.replace(/[\s]+/g," "),s=($.isUnd(n)?!0:n)?$.fixLongSubject(s):s},$._fixLongSubject_=function(e){var t=0,i=null;e=$.trim(e.replace(/[\s]+/," "));do i=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!i||$.isUnd(i[0]))&&(i=null),i&&(t=0,t+=$.isUnd(i[2])?1:0+$.pInt(i[2]),t+=$.isUnd(i[4])?1:0+$.pInt(i[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(i);return e=e.replace(/[\s]+/," ")},$.roundNumber=function(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},$.friendlySize=function(e){return e=$.pInt(e),e>=1073741824?$.roundNumber(e/1073741824,1)+"GB":e>=1048576?$.roundNumber(e/1048576,1)+"MB":e>=1024?$.roundNumber(e/1024,0)+"KB":e+"B"},$.log=function(t){e.console&&e.console.log&&e.console.log(t)},$.getNotification=function(e,t){return e=$.pInt(e),W.Notification.ClientViewError===e&&t?t:$.isUnd(Y[e])?"":Y[e]},$.initNotificationLanguage=function(){Y[W.Notification.InvalidToken]=$.i18n("NOTIFICATIONS/INVALID_TOKEN"),Y[W.Notification.AuthError]=$.i18n("NOTIFICATIONS/AUTH_ERROR"),Y[W.Notification.AccessError]=$.i18n("NOTIFICATIONS/ACCESS_ERROR"),Y[W.Notification.ConnectionError]=$.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Y[W.Notification.CaptchaError]=$.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Y[W.Notification.SocialFacebookLoginAccessDisable]=$.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Y[W.Notification.SocialTwitterLoginAccessDisable]=$.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Y[W.Notification.SocialGoogleLoginAccessDisable]=$.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Y[W.Notification.DomainNotAllowed]=$.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Y[W.Notification.AccountNotAllowed]=$.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Y[W.Notification.AccountTwoFactorAuthRequired]=$.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Y[W.Notification.AccountTwoFactorAuthError]=$.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Y[W.Notification.CouldNotSaveNewPassword]=$.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Y[W.Notification.CurrentPasswordIncorrect]=$.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Y[W.Notification.NewPasswordShort]=$.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Y[W.Notification.NewPasswordWeak]=$.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Y[W.Notification.NewPasswordForbidden]=$.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Y[W.Notification.ContactsSyncError]=$.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Y[W.Notification.CantGetMessageList]=$.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Y[W.Notification.CantGetMessage]=$.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Y[W.Notification.CantDeleteMessage]=$.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Y[W.Notification.CantMoveMessage]=$.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Y[W.Notification.CantCopyMessage]=$.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Y[W.Notification.CantSaveMessage]=$.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Y[W.Notification.CantSendMessage]=$.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Y[W.Notification.InvalidRecipients]=$.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Y[W.Notification.CantCreateFolder]=$.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Y[W.Notification.CantRenameFolder]=$.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Y[W.Notification.CantDeleteFolder]=$.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Y[W.Notification.CantDeleteNonEmptyFolder]=$.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Y[W.Notification.CantSubscribeFolder]=$.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Y[W.Notification.CantUnsubscribeFolder]=$.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Y[W.Notification.CantSaveSettings]=$.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Y[W.Notification.CantSavePluginSettings]=$.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Y[W.Notification.DomainAlreadyExists]=$.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Y[W.Notification.CantInstallPackage]=$.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Y[W.Notification.CantDeletePackage]=$.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Y[W.Notification.InvalidPluginPackage]=$.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Y[W.Notification.UnsupportedPluginPackage]=$.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Y[W.Notification.LicensingServerIsUnavailable]=$.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Y[W.Notification.LicensingExpired]=$.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Y[W.Notification.LicensingBanned]=$.i18n("NOTIFICATIONS/LICENSING_BANNED"),Y[W.Notification.DemoSendMessageError]=$.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Y[W.Notification.AccountAlreadyExists]=$.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Y[W.Notification.MailServerError]=$.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Y[W.Notification.InvalidInputArgument]=$.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),Y[W.Notification.UnknownNotification]=$.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Y[W.Notification.UnknownError]=$.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},$.getUploadErrorDescByCode=function(e){var t="";switch($.pInt(e)){case W.UploadErrorCode.FileIsTooBig:t=$.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case W.UploadErrorCode.FilePartiallyUploaded:t=$.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case W.UploadErrorCode.FileNoUploaded:t=$.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case W.UploadErrorCode.MissingTempFolder:t=$.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case W.UploadErrorCode.FileOnSaveingError:t=$.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case W.UploadErrorCode.FileType:t=$.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=$.i18n("UPLOAD/ERROR_UNKNOWN")}return t},$.delegateRun=function(e,t,i,n){e&&e[t]&&(n=$.pInt(n),0>=n?e[t].apply(e,$.isArray(i)?i:[]):s.delay(function(){e[t].apply(e,$.isArray(i)?i:[])},n))},$.killCtrlAandS=function(t){if(t=t||e.event,t&&t.ctrlKey&&!t.shiftKey&&!t.altKey){var i=t.target||t.srcElement,n=t.keyCode||t.which;if(n===W.EventKeyCode.S)return void t.preventDefault();if(i&&i.tagName&&i.tagName.match(/INPUT|TEXTAREA/i))return;n===W.EventKeyCode.A&&(e.getSelection?e.getSelection().removeAllRanges():e.document.selection&&e.document.selection.clear&&e.document.selection.clear(),t.preventDefault())}},$.createCommand=function(e,t,n){var o=t?function(){return o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=i.observable(!0),n=$.isUnd(n)?!0:n,o.canExecute=i.computed($.isFunc(n)?function(){return o.enabled()&&n.call(e)}:function(){return o.enabled()&&!!n}),o},$.initDataConstructorBySettings=function(t){t.editorDefaultType=i.observable(W.EditorDefaultType.Html),t.showImages=i.observable(!1),t.interfaceAnimation=i.observable(W.InterfaceAnimation.Full),t.contactsAutosave=i.observable(!1),X.sAnimationType=W.InterfaceAnimation.Full,t.capaThemes=i.observable(!1),t.allowLanguagesOnSettings=i.observable(!0),t.allowLanguagesOnLogin=i.observable(!0),t.useLocalProxyForExternalImages=i.observable(!1),t.desktopNotifications=i.observable(!1),t.useThreads=i.observable(!0),t.replySameFolder=i.observable(!0),t.useCheckboxesInList=i.observable(!0),t.layout=i.observable(W.Layout.SidePreview),t.usePreviewPane=i.computed(function(){return W.Layout.NoPreview!==t.layout()}),t.interfaceAnimation.subscribe(function(e){if(X.bMobileDevice||e===W.InterfaceAnimation.None)ot.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),X.sAnimationType=W.InterfaceAnimation.None;else switch(e){case W.InterfaceAnimation.Full:ot.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),X.sAnimationType=e;break;case W.InterfaceAnimation.Normal:ot.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),X.sAnimationType=e}}),t.interfaceAnimation.valueHasMutated(),t.desktopNotificationsPermisions=i.computed(function(){t.desktopNotifications();var i=W.DesktopNotifications.NotSupported;if(rt&&rt.permission)switch(rt.permission.toLowerCase()){case"granted":i=W.DesktopNotifications.Allowed;break;case"denied":i=W.DesktopNotifications.Denied;break;case"default":i=W.DesktopNotifications.NotAllowed}else e.webkitNotifications&&e.webkitNotifications.checkPermission&&(i=e.webkitNotifications.checkPermission());return i}),t.useDesktopNotifications=i.computed({read:function(){return t.desktopNotifications()&&W.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()},write:function(e){if(e){var i=t.desktopNotificationsPermisions();W.DesktopNotifications.Allowed===i?t.desktopNotifications(!0):W.DesktopNotifications.NotAllowed===i?rt.requestPermission(function(){t.desktopNotifications.valueHasMutated(),W.DesktopNotifications.Allowed===t.desktopNotificationsPermisions()?t.desktopNotifications()?t.desktopNotifications.valueHasMutated():t.desktopNotifications(!0):t.desktopNotifications()?t.desktopNotifications(!1):t.desktopNotifications.valueHasMutated()}):t.desktopNotifications(!1)}else t.desktopNotifications(!1)}}),t.language=i.observable(""),t.languages=i.observableArray([]),t.mainLanguage=i.computed({read:t.language,write:function(e){e!==t.language()?-1<$.inArray(e,t.languages())?t.language(e):0=t.diff(i,"hours")?n:t.format("L")===i.format("L")?$.i18n("MESSAGE_LIST/TODAY_AT",{TIME:i.format("LT")}):t.clone().subtract("days",1).format("L")===i.format("L")?$.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:i.format("LT")}):i.format(t.year()===i.year()?"D MMM.":"LL")},e)},$.isFolderExpanded=function(e){var t=lt.local().get(W.ClientSideKeyName.ExpandedFolders);return s.isArray(t)&&-1!==s.indexOf(t,e)},$.setExpandedFolder=function(e,t){var i=lt.local().get(W.ClientSideKeyName.ExpandedFolders);s.isArray(i)||(i=[]),t?(i.push(e),i=s.uniq(i)):i=s.without(i,e),lt.local().set(W.ClientSideKeyName.ExpandedFolders,i)},$.initLayoutResizer=function(e,i,n){var o=60,s=155,a=t(e),r=t(i),l=lt.local().get(n)||null,c=function(e){e&&(a.css({width:""+e+"px"}),r.css({left:""+e+"px"}))},u=function(e){if(e)a.resizable("disable"),c(o);else{a.resizable("enable");var t=$.pInt(lt.local().get(n))||s;c(t>s?t:s)}},p=function(e,t){t&&t.size&&t.size.width&&(lt.local().set(n,t.size.width),r.css({left:""+t.size.width+"px"}))};null!==l&&c(l>s?l:s),a.resizable({helper:"ui-resizable-helper",minWidth:s,maxWidth:350,handles:"e",stop:p}),lt.sub("left-panel.off",function(){u(!0)}),lt.sub("left-panel.on",function(){u(!1)})},$.initBlockquoteSwitcher=function(e){if(e){var i=t("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===t(this).parent().closest("blockquote",e).length});i&&0100)&&(e.addClass("rl-bq-switcher hidden-bq"),t('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),$.windowResize()}).after("
").before("
"))})}},$.removeBlockquoteSwitcher=function(e){e&&(t(e).find("blockquote.rl-bq-switcher").each(function(){t(this).removeClass("rl-bq-switcher hidden-bq")}),t(e).find(".rlBlockquoteSwitcher").each(function(){t(this).remove()}))},$.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},$.extendAsViewModel=function(e,t,i){t&&(i||(i=p),t.__name=e,J.regViewModelHook(e,t),s.extend(t.prototype,i.prototype))},$.addSettingsViewModel=function(e,t,i,n,o){e.__rlSettingsData={Label:i,Template:t,Route:n,IsDefault:!!o},Z.settings.push(e)},$.removeSettingsViewModel=function(e){Z["settings-removed"].push(e)},$.disableSettingsViewModel=function(e){Z["settings-disabled"].push(e)},$.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=$.trim(e.substring(0,e.length-7))),$.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},$.quoteName=function(e){return e.replace(/["]/g,'\\"')},$.microtime=function(){return(new Date).getTime()},$.convertLangName=function(e,t){return $.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},$.fakeMd5=function(e){var t="",i="0123456789abcdefghijklmnopqrstuvwxyz";for(e=$.isUnd(e)?32:$.pInt(e);t.length>>32-t}function i(e,t){var i,n,o,s,a;return o=2147483648&e,s=2147483648&t,i=1073741824&e,n=1073741824&t,a=(1073741823&e)+(1073741823&t),i&n?2147483648^a^o^s:i|n?1073741824&a?3221225472^a^o^s:1073741824^a^o^s:a^o^s}function n(e,t,i){return e&t|~e&i}function o(e,t,i){return e&i|t&~i}function s(e,t,i){return e^t^i}function a(e,t,i){return t^(e|~i)}function r(e,o,s,a,r,l,c){return e=i(e,i(i(n(o,s,a),r),c)),i(t(e,l),o)}function l(e,n,s,a,r,l,c){return e=i(e,i(i(o(n,s,a),r),c)),i(t(e,l),n)}function c(e,n,o,a,r,l,c){return e=i(e,i(i(s(n,o,a),r),c)),i(t(e,l),n)}function u(e,n,o,s,r,l,c){return e=i(e,i(i(a(n,o,s),r),c)),i(t(e,l),n)}function p(e){for(var t,i=e.length,n=i+8,o=(n-n%64)/64,s=16*(o+1),a=Array(s-1),r=0,l=0;i>l;)t=(l-l%4)/4,r=l%4*8,a[t]=a[t]|e.charCodeAt(l)<>>29,a}function d(e){var t,i,n="",o="";for(i=0;3>=i;i++)t=e>>>8*i&255,o="0"+t.toString(16),n+=o.substr(o.length-2,2);return n}function g(e){e=e.replace(/rn/g,"n");for(var t="",i=0;in?t+=String.fromCharCode(n):n>127&&2048>n?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}var h,m,f,b,S,v,y,A,C,w=Array(),T=7,N=12,E=17,I=22,P=5,_=9,D=14,R=20,k=4,L=11,O=16,x=23,F=6,U=10,M=15,V=21;for(e=g(e),w=p(e),v=1732584193,y=4023233417,A=2562383102,C=271733878,h=0;h /g,">").replace(/")},$.draggeblePlace=function(){return t(' ').appendTo("#rl-hidden")},$.defautOptionsAfterRender=function(e,i){i&&!$.isUnd(i.disabled)&&e&&t(e).toggleClass("disabled",i.disabled).prop("disabled",i.disabled)},$.windowPopupKnockout=function(i,n,o,s){var a=null,r=e.open(""),l="__OpenerApplyBindingsUid"+$.fakeMd5()+"__",c=t("#"+n);e[l]=function(){if(r&&r.document.body&&c&&c[0]){var n=t(r.document.body);t("#rl-content",n).html(c.html()),t("html",r.document).addClass("external "+t("html").attr("class")),$.i18nToNode(n),g.prototype.applyExternal(i,t("#rl-content",n)[0]),e[l]=null,s(r)}},r.document.open(),r.document.write(''+$.encodeHtml(o)+' '),r.document.close(),a=r.document.createElement("script"),a.type="text/javascript",a.innerHTML="if(window&&window.opener&&window.opener['"+l+"']){window.opener['"+l+"']();window.opener['"+l+"']=null}",r.document.getElementsByTagName("head")[0].appendChild(a)},$.settingsSaveHelperFunction=function(e,t,i,n){return i=i||null,n=$.isUnd(n)?1e3:$.pInt(n),function(o,a,r,l,c){t.call(i,a&&a.Result?W.SaveSettingsStep.TrueResult:W.SaveSettingsStep.FalseResult),e&&e.call(i,o,a,r,l,c),s.delay(function(){t.call(i,W.SaveSettingsStep.Idle)},n)}},$.settingsSaveHelperSimpleFunction=function(e,t){return $.settingsSaveHelperFunction(null,e,t,1e3)},$.$div=t(""),$.htmlToPlain=function(e){var i=0,n=0,o=0,s=0,a=0,r="",l=function(e){for(var t=100,i="",n="",o=e,s=0,a=0;o.length>t;)n=o.substring(0,t),s=n.lastIndexOf(" "),a=n.lastIndexOf("\n"),-1!==a&&(s=a),-1===s&&(s=t),i+=n.substring(0,s)+"\n",o=o.substring(s+1);return i+o},c=function(e){return e=l(t.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2]*>([\s\S\r\n]*)<\/div>/gim,u),e="\n"+t.trim(e)+"\n"),e}return""},p=function(){return arguments&&1 "):""},d=function(){return arguments&&1 /g,">"):""},g=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,p).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,d).replace(/
]*>/gim,"\n").replace(/<\/h[\d]>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>([\s\S\r\n]*)<\/div>/gim,u).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S\r\n]*?)<\/a>/gim,g).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),r=$.$div.html(r).text(),r=r.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),i=0,a=100;a>0&&(a--,n=r.indexOf("__bq__start__",i),n>-1);)o=r.indexOf("__bq__start__",n+5),s=r.indexOf("__bq__end__",n+5),(-1===o||o>s)&&s>n?(r=r.substring(0,n)+c(r.substring(n+13,s))+r.substring(s+11),i=0):i=o>-1&&s>o?o-1:0;return r=r.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},$.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var i=!1,n=!0,o=!0,s=[],a="",r=0,l=e.split("\n");do{for(n=!1,s=[],r=0;r"===a.substr(0,1),o&&!i?(n=!0,i=!0,s.push("~~~blockquote~~~"),s.push(a.substr(1))):!o&&i?(i=!1,s.push("~~~/blockquote~~~"),s.push(a)):s.push(o&&i?a.substr(1):a);i&&(i=!1,s.push("~~~/blockquote~~~")),l=s}while(n);return e=l.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/[\s]*~~~\/blockquote~~~/g,"
").replace(/[\-_~]{10,}/g,"
").replace(/\n/g,"
"),t?$.linkify(e):e},e.rainloop_Utils_htmlToPlain=$.htmlToPlain,e.rainloop_Utils_plainToHtml=$.plainToHtml,$.linkify=function(e){return t.fn&&t.fn.linkify&&(e=$.$div.html(e.replace(/&/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&")),e},$.resizeAndCrop=function(t,i,n){var o=new e.Image;o.onload=function(){var e=[0,0],t=document.createElement("canvas"),o=t.getContext("2d");t.width=i,t.height=i,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,i,i),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,i,i),n(t.toDataURL("image/jpeg"))},o.src=t},$.computedPagenatorHelper=function(e,t){return function(){var i=0,n=0,o=2,s=[],a=e(),r=t(),l=function(e,t,i){var n={current:e===a,name:$.isUnd(i)?e.toString():i.toString(),custom:$.isUnd(i)?!1:!0,title:$.isUnd(i)?"":e.toString(),value:e.toString()};($.isUnd(t)?0:!t)?s.unshift(n):s.push(n)};if(r>1||r>0&&a>r){for(a>r?(l(r),i=r,n=r):((3>=a||a>=r-2)&&(o+=2),l(a),i=a,n=a);o>0;)if(i-=1,n+=1,i>0&&(l(i,!1),o--),r>=n)l(n,!0),o--;else if(0>=i)break;3===i?l(2,!1):i>3&&l(Math.round((i-1)/2),!1,"..."),r-2===n?l(r-1,!0):r-2>n&&l(Math.round((r+n)/2),!0,"..."),i>1&&l(1,!1),r>n&&l(r,!0)}return s}},$.selectElement=function(t){if(e.getSelection){var i=e.getSelection();i.removeAllRanges();var n=document.createRange();n.selectNodeContents(t),i.addRange(n)}else if(document.selection){var o=document.body.createTextRange();o.moveToElementText(t),o.select()}},$.disableKeyFilter=function(){e.key&&(key.filter=function(){return lt.data().useKeyboardShortcuts()})},$.restoreKeyFilter=function(){e.key&&(key.filter=function(e){if(lt.data().useKeyboardShortcuts()){var t=e.target||e.srcElement,i=t?t.tagName:"";return i=i.toUpperCase(),!("INPUT"===i||"SELECT"===i||"TEXTAREA"===i||t&&"DIV"===i&&"editorHtmlArea"===t.className&&t.contentEditable)}return!1})},$.detectDropdownVisibility=s.debounce(function(){X.dropdownVisibility(!!s.find(et,function(e){return e.hasClass("open")}))},50),$.triggerAutocompleteInputChange=function(e){var i=function(){t(".checkAutocomplete").trigger("change")};e?s.delay(i,100):i()},Q={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return Q.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var t,i,n,o,s,a,r,l="",c=0;for(e=Q._utf8_encode(e);c>2,s=(3&t)<<4|i>>4,a=(15&i)<<2|n>>6,r=63&n,isNaN(i)?a=r=64:isNaN(n)&&(r=64),l=l+this._keyStr.charAt(o)+this._keyStr.charAt(s)+this._keyStr.charAt(a)+this._keyStr.charAt(r);return l},decode:function(e){var t,i,n,o,s,a,r,l="",c=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");c>4,i=(15&s)<<4|a>>2,n=(3&a)<<6|r,l+=String.fromCharCode(t),64!==a&&(l+=String.fromCharCode(i)),64!==r&&(l+=String.fromCharCode(n));return Q._utf8_decode(l)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",i=0,n=e.length,o=0;n>i;i++)o=e.charCodeAt(i),128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128));return t},_utf8_decode:function(e){for(var t="",i=0,n=0,o=0,s=0;in?(t+=String.fromCharCode(n),i++):n>191&&224>n?(o=e.charCodeAt(i+1),t+=String.fromCharCode((31&n)<<6|63&o),i+=2):(o=e.charCodeAt(i+1),s=e.charCodeAt(i+2),t+=String.fromCharCode((15&n)<<12|(63&o)<<6|63&s),i+=3);return t}},i.bindingHandlers.tooltip={init:function(e,n){if(!X.bMobileDevice){var o=t(e),s=o.data("tooltip-class")||"",a=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,trigger:"hover",title:function(){return o.is(".disabled")||X.dropdownVisibility()?"":''+$.i18n(i.utils.unwrapObservable(n()))+""}}).click(function(){o.tooltip("hide")}),X.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}}},i.bindingHandlers.tooltip2={init:function(e,i){var n=t(e),o=n.data("tooltip-class")||"",s=n.data("tooltip-placement")||"top";n.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:s,title:function(){return n.is(".disabled")||X.dropdownVisibility()?"":''+i()()+""}}).click(function(){n.tooltip("hide")}),X.tooltipTrigger.subscribe(function(){n.tooltip("hide")})}},i.bindingHandlers.tooltip3={init:function(e){var i=t(e);i.tooltip({container:"body",trigger:"hover manual",title:function(){return i.data("tooltip3-data")||""}}),at.click(function(){i.tooltip("hide")}),X.tooltipTrigger.subscribe(function(){i.tooltip("hide")})},update:function(e,n){var o=i.utils.unwrapObservable(n());""===o?t(e).data("tooltip3-data","").tooltip("hide"):t(e).data("tooltip3-data",o).tooltip("show")}},i.bindingHandlers.registrateBootstrapDropdown={init:function(e){et.push(t(e))}},i.bindingHandlers.openDropdownTrigger={update:function(e,n){if(i.utils.unwrapObservable(n())){var o=t(e);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),$.detectDropdownVisibility()),n()(!1)}}},i.bindingHandlers.dropdownCloser={init:function(e){t(e).closest(".dropdown").on("click",".e-item",function(){t(e).dropdown("toggle")})}},i.bindingHandlers.popover={init:function(e,n){t(e).popover(i.utils.unwrapObservable(n()))}},i.bindingHandlers.csstext={init:function(e,n){e&&e.styleSheet&&!$.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=i.utils.unwrapObservable(n()):t(e).text(i.utils.unwrapObservable(n()))},update:function(e,n){e&&e.styleSheet&&!$.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=i.utils.unwrapObservable(n()):t(e).text(i.utils.unwrapObservable(n()))}},i.bindingHandlers.resizecrop={init:function(e){t(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,i){i()(),t(e).resizecrop({width:"100",height:"100"})}},i.bindingHandlers.onEnter={init:function(i,n,o,s){t(i).on("keypress",function(o){o&&13===e.parseInt(o.keyCode,10)&&(t(i).trigger("change"),n().call(s))})}},i.bindingHandlers.onEsc={init:function(i,n,o,s){t(i).on("keypress",function(o){o&&27===e.parseInt(o.keyCode,10)&&(t(i).trigger("change"),n().call(s))})}},i.bindingHandlers.clickOnTrue={update:function(e,n){i.utils.unwrapObservable(n())&&t(e).click()}},i.bindingHandlers.modal={init:function(e,n){t(e).toggleClass("fade",!X.bMobileDevice).modal({keyboard:!1,show:i.utils.unwrapObservable(n())}).on("shown",function(){$.windowResize()}).find(".close").click(function(){n()(!1)})},update:function(e,n){t(e).modal(i.utils.unwrapObservable(n())?"show":"hide")}},i.bindingHandlers.i18nInit={init:function(e){$.i18nToNode(e)}},i.bindingHandlers.i18nUpdate={update:function(e,t){i.utils.unwrapObservable(t()),$.i18nToNode(e)}},i.bindingHandlers.link={update:function(e,n){t(e).attr("href",i.utils.unwrapObservable(n()))}},i.bindingHandlers.title={update:function(e,n){t(e).attr("title",i.utils.unwrapObservable(n()))}},i.bindingHandlers.textF={init:function(e,n){t(e).text(i.utils.unwrapObservable(n()))}},i.bindingHandlers.initDom={init:function(e,t){t()(e)}},i.bindingHandlers.initResizeTrigger={init:function(e,n){var o=i.utils.unwrapObservable(n());t(e).css({height:o[1],"min-height":o[1]})},update:function(e,n){var o=i.utils.unwrapObservable(n()),s=$.pInt(o[1]),a=0,r=t(e).offset().top;r>0&&(r+=$.pInt(o[2]),a=st.height()-r,a>s&&(s=a),t(e).css({height:s,"min-height":s}))}},i.bindingHandlers.appendDom={update:function(e,n){t(e).hide().empty().append(i.utils.unwrapObservable(n())).show()
-}},i.bindingHandlers.draggable={init:function(n,o,s){if(!X.bMobileDevice){var a=100,r=3,l=s(),c=l&&l.droppableSelector?l.droppableSelector:"",u={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};c&&(u.drag=function(i){t(c).each(function(){var n=null,o=null,s=t(this),l=s.offset(),c=l.top+s.height();e.clearInterval(s.data("timerScroll")),s.data("timerScroll",!1),i.pageX>=l.left&&i.pageX<=l.left+s.width()&&(i.pageY>=c-a&&i.pageY<=c&&(n=function(){s.scrollTop(s.scrollTop()+r),$.windowResize()},s.data("timerScroll",e.setInterval(n,10)),n()),i.pageY>=l.top&&i.pageY<=l.top+a&&(o=function(){s.scrollTop(s.scrollTop()-r),$.windowResize()},s.data("timerScroll",e.setInterval(o,10)),o()))})},u.stop=function(){t(c).each(function(){e.clearInterval(t(this).data("timerScroll")),t(this).data("timerScroll",!1)})}),u.helper=function(e){return o()(e&&e.target?i.dataFor(e.target):null)},t(n).draggable(u).on("mousedown",function(){$.removeInFocus()})}}},i.bindingHandlers.droppable={init:function(e,i,n){if(!X.bMobileDevice){var o=i(),s=n(),a=s&&s.droppableOver?s.droppableOver:null,r=s&&s.droppableOut?s.droppableOut:null,l={tolerance:"pointer",hoverClass:"droppableHover"};o&&(l.drop=function(e,t){o(e,t)},a&&(l.over=function(e,t){a(e,t)}),r&&(l.out=function(e,t){r(e,t)}),t(e).droppable(l))}}},i.bindingHandlers.nano={init:function(e){X.bDisableNanoScroll||t(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},i.bindingHandlers.saveTrigger={init:function(e){var i=t(e);i.data("save-trigger-type",i.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===i.data("save-trigger-type")?i.append(' ').addClass("settings-saved-trigger"):i.addClass("settings-saved-trigger-input")},update:function(e,n){var o=i.utils.unwrapObservable(n()),s=t(e);if("custom"===s.data("save-trigger-type"))switch(o.toString()){case"1":s.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":s.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":s.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:s.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":s.addClass("success").removeClass("error");break;case"0":s.addClass("error").removeClass("success");break;case"-2":break;default:s.removeClass("error success")}}},i.bindingHandlers.emailsTags={init:function(e,i){var n=t(e),o=i(),a=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};n.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:a,inputDelimiters:[",",";"],autoCompleteSource:function(e,t){lt.getAutocomplete(e.term,function(e){t(s.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return s.map(e,function(e){var t=$.trim(e),i=null;return""!==t?(i=new h,i.mailsoParse(t),i.clearDuplicateName(),[i.toLine(!1),i]):[t,null]})},change:s.bind(function(e){n.data("EmailsTagsValue",e.target.value),o(e.target.value)},this)})},update:function(e,n,o){var s=t(e),a=o(),r=a.emailsTagsFilter||null,l=i.utils.unwrapObservable(n());s.data("EmailsTagsValue")!==l&&(s.val(l),s.data("EmailsTagsValue",l),s.inputosaurus("refresh")),r&&i.utils.unwrapObservable(r)&&s.inputosaurus("focus")}},i.bindingHandlers.contactTags={init:function(e,i){var n=t(e),o=i(),a=function(e){o&&o.focusTrigger&&o.focusTrigger(e)};n.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:a,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(e,t){lt.getContactTagsAutocomplete(e.term,function(e){t(s.map(e,function(e){return e.toLine(!1)}))})},parseHook:function(e){return s.map(e,function(e){var t=$.trim(e),i=null;return""!==t?(i=new m,i.name(t),[i.toLine(!1),i]):[t,null]})},change:s.bind(function(e){n.data("ContactTagsValue",e.target.value),o(e.target.value)},this)})},update:function(e,n,o){var s=t(e),a=o(),r=a.contactTagsFilter||null,l=i.utils.unwrapObservable(n());s.data("ContactTagsValue")!==l&&(s.val(l),s.data("ContactTagsValue",l),s.inputosaurus("refresh")),r&&i.utils.unwrapObservable(r)&&s.inputosaurus("focus")}},i.bindingHandlers.command={init:function(e,n,o,s){var a=t(e),r=n();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),i.bindingHandlers[a.is("form")?"submit":"click"].init.apply(s,arguments)},update:function(e,i){var n=!0,o=t(e),s=i();n=s.enabled(),o.toggleClass("command-not-enabled",!n),n&&(n=s.canExecute(),o.toggleClass("command-can-not-be-execute",!n)),o.toggleClass("command-disabled disable disabled",!n).toggleClass("no-disabled",!!n),(o.is("input")||o.is("button"))&&o.prop("disabled",!n)}},i.extenders.trimmer=function(e){var t=i.computed({read:e,write:function(t){e($.trim(t.toString()))},owner:this});return t(e()),t},i.extenders.posInterer=function(e,t){var n=i.computed({read:e,write:function(i){var n=$.pInt(i.toString(),t);0>=n&&(n=t),n===e()&&""+n!=""+i&&e(n+1),e(n)}});return n(e()),n},i.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},i.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},i.extenders.falseTimeout=function(t,i){return t.iTimeout=0,t.subscribe(function(n){n&&(e.clearTimeout(t.iTimeout),t.iTimeout=e.setTimeout(function(){t(!1),t.iTimeout=0},$.pInt(i)))}),t},i.observable.fn.validateNone=function(){return this.hasError=i.observable(!1),this},i.observable.fn.validateEmail=function(){return this.hasError=i.observable(!1),this.subscribe(function(e){e=$.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},i.observable.fn.validateSimpleEmail=function(){return this.hasError=i.observable(!1),this.subscribe(function(e){e=$.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},i.observable.fn.validateFunc=function(e){return this.hasFuncError=i.observable(!1),$.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},a.prototype.root=function(){return this.sBase},a.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},a.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},a.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},a.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},a.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},a.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},a.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},a.prototype.change=function(t){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+e.encodeURIComponent(t)+"/"},a.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},a.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},a.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},a.prototype.avatarLink=function(t){return this.sServer+"/Raw/0/Avatar/"+e.encodeURIComponent(t)+"/"},a.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},a.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},a.prototype.settings=function(e){var t=this.sBase+"settings";return $.isUnd(e)||""===e||(t+="/"+e),t},a.prototype.admin=function(e){var t=this.sBase;switch(e){case"AdminDomains":t+="domains";break;case"AdminSecurity":t+="security";break;case"AdminLicensing":t+="licensing"}return t},a.prototype.mailBox=function(e,t,i){t=$.isNormal(t)?$.pInt(t):1,i=$.pString(i);var n=this.sBase+"mailbox/";return""!==e&&(n+=encodeURI(e)),t>1&&(n=n.replace(/[\/]+$/,""),n+="/p"+t),""!==i&&(n=n.replace(/[\/]+$/,""),n+="/"+encodeURI(i)),n},a.prototype.phpInfo=function(){return this.sServer+"Info"},a.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},a.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},a.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},a.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},a.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},a.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=$.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},a.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},a.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},a.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},a.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},a.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},J.oViewModelsHooks={},J.oSimpleHooks={},J.regViewModelHook=function(e,t){t&&(t.__hookName=e)},J.addHook=function(e,t){$.isFunc(t)&&($.isArray(J.oSimpleHooks[e])||(J.oSimpleHooks[e]=[]),J.oSimpleHooks[e].push(t))},J.runHook=function(e,t){$.isArray(J.oSimpleHooks[e])&&(t=t||[],s.each(J.oSimpleHooks[e],function(e){e.apply(null,t)}))},J.mainSettingsGet=function(e){return lt?lt.settingsGet(e):null},J.remoteRequest=function(e,t,i,n,o,s){lt&<.remote().defaultRequest(e,t,i,n,o,s)},J.settingsGet=function(e,t){var i=J.mainSettingsGet("Plugins");return i=i&&$.isUnd(i[e])?null:i[e],i?$.isUnd(i[t])?null:i[t]:null},r.supported=function(){return!0},r.prototype.set=function(e,i){var n=t.cookie(j.Values.ClientSideCookieIndexName),o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[e]=i,t.cookie(j.Values.ClientSideCookieIndexName,JSON.stringify(s),{expires:30}),o=!0}catch(a){}return o},r.prototype.get=function(e){var i=t.cookie(j.Values.ClientSideCookieIndexName),n=null;try{n=null===i?null:JSON.parse(i),n=n&&!$.isUnd(n[e])?n[e]:null}catch(o){}return n},l.supported=function(){return!!e.localStorage},l.prototype.set=function(t,i){var n=e.localStorage[j.Values.ClientSideCookieIndexName]||null,o=!1,s=null;try{s=null===n?null:JSON.parse(n),s||(s={}),s[t]=i,e.localStorage[j.Values.ClientSideCookieIndexName]=JSON.stringify(s),o=!0}catch(a){}return o},l.prototype.get=function(t){var i=e.localStorage[j.Values.ClientSideCookieIndexName]||null,n=null;try{n=null===i?null:JSON.parse(i),n=n&&!$.isUnd(n[t])?n[t]:null}catch(o){}return n},c.prototype.oDriver=null,c.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},c.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},u.prototype.bootstart=function(){},p.prototype.sPosition="",p.prototype.sTemplate="",p.prototype.viewModelName="",p.prototype.viewModelDom=null,p.prototype.viewModelTemplate=function(){return this.sTemplate},p.prototype.viewModelPosition=function(){return this.sPosition},p.prototype.cancelCommand=p.prototype.closeCommand=function(){},p.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=lt.data().keyScope(),lt.data().keyScope(this.sDefaultKeyScope)},p.prototype.restoreKeyScope=function(){lt.data().keyScope(this.sCurrentKeyScope)},p.prototype.registerPopupKeyDown=function(){var e=this;st.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&W.EventKeyCode.Esc===t.keyCode)return $.delegateRun(e,"cancelCommand"),!1;if(W.EventKeyCode.Backspace===t.keyCode&&!$.inFocus())return!1}return!0})},d.prototype.oCross=null,d.prototype.sScreenName="",d.prototype.aViewModels=[],d.prototype.viewModels=function(){return this.aViewModels},d.prototype.screenName=function(){return this.sScreenName},d.prototype.routes=function(){return null},d.prototype.__cross=function(){return this.oCross},d.prototype.__start=function(){var e=this.routes(),t=null,i=null;$.isNonEmptyArray(e)&&(i=s.bind(this.onRoute||$.emptyFunction,this),t=n.create(),s.each(e,function(e){t.addRoute(e[0],i).rules=e[1]}),this.oCross=t)},g.constructorEnd=function(e){$.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},g.prototype.sDefaultScreenName="",g.prototype.oScreens={},g.prototype.oBoot=null,g.prototype.oCurrentScreen=null,g.prototype.hideLoading=function(){t("#rl-loading").hide()},g.prototype.routeOff=function(){o.changed.active=!1},g.prototype.routeOn=function(){o.changed.active=!0},g.prototype.setBoot=function(e){return $.isNormal(e)&&(this.oBoot=e),this},g.prototype.screen=function(e){return""===e||$.isUnd(this.oScreens[e])?null:this.oScreens[e]},g.prototype.buildViewModel=function(e,n){if(e&&!e.__builded){var o=new e(n),a=o.viewModelPosition(),r=t("#rl-content #rl-"+a.toLowerCase()),l=null;e.__builded=!0,e.__vm=o,o.data=lt.data(),o.viewModelName=e.__name,r&&1===r.length?(l=t("").addClass("rl-view-model").addClass("RL-"+o.viewModelTemplate()).hide(),l.appendTo(r),o.viewModelDom=l,e.__dom=l,"Popups"===a&&(o.cancelCommand=o.closeCommand=$.createCommand(o,function(){tt.hideScreenPopup(e)}),o.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),lt.popupVisibilityNames.push(this.viewModelName),o.viewModelDom.css("z-index",3e3+lt.popupVisibilityNames().length+10),$.delegateRun(this,"onFocus",[],500)):($.delegateRun(this,"onHide"),this.restoreKeyScope(),lt.popupVisibilityNames.remove(this.viewModelName),o.viewModelDom.css("z-index",2e3),X.tooltipTrigger(!X.tooltipTrigger()),s.delay(function(){t.viewModelDom.hide()},300))},o)),J.runHook("view-model-pre-build",[e.__name,o,l]),i.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:o.viewModelTemplate()}}},o),$.delegateRun(o,"onBuild",[l]),o&&"Popups"===a&&o.registerPopupKeyDown(),J.runHook("view-model-post-build",[e.__name,o,l])):$.log("Cannot find view model position: "+a)}return e?e.__vm:null},g.prototype.applyExternal=function(e,t){e&&t&&i.applyBindings(e,t)},g.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),J.runHook("view-model-on-hide",[e.__name,e.__vm]))},g.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),$.delegateRun(e.__vm,"onShow",t||[]),J.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},g.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},g.prototype.screenOnRoute=function(e,t){var i=this,n=null,o=null;""===$.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(n=this.screen(e),n||(n=this.screen(this.sDefaultScreenName),n&&(t=e+"/"+t,e=this.sDefaultScreenName)),n&&n.__started&&(n.__builded||(n.__builded=!0,$.isNonEmptyArray(n.viewModels())&&s.each(n.viewModels(),function(e){this.buildViewModel(e,n)},this),$.delegateRun(n,"onBuild")),s.defer(function(){i.oCurrentScreen&&($.delegateRun(i.oCurrentScreen,"onHide"),$.isNonEmptyArray(i.oCurrentScreen.viewModels())&&s.each(i.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),$.delegateRun(e.__vm,"onHide"))})),i.oCurrentScreen=n,i.oCurrentScreen&&($.delegateRun(i.oCurrentScreen,"onShow"),J.runHook("screen-on-show",[i.oCurrentScreen.screenName(),i.oCurrentScreen]),$.isNonEmptyArray(i.oCurrentScreen.viewModels())&&s.each(i.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),$.delegateRun(e.__vm,"onShow"),$.delegateRun(e.__vm,"onFocus",[],200),J.runHook("view-model-on-show",[e.__name,e.__vm]))},i)),o=n.__cross(),o&&o.parse(t)})))},g.prototype.startScreens=function(e){t("#rl-content").css({visibility:"hidden"}),s.each(e,function(e){var t=new e,i=t?t.screenName():"";t&&""!==i&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=i),this.oScreens[i]=t)},this),s.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),J.runHook("screen-pre-start",[e.screenName(),e]),$.delegateRun(e,"onStart"),J.runHook("screen-post-start",[e.screenName(),e]))},this);var i=n.create();i.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,s.bind(this.screenOnRoute,this)),o.initialized.add(i.parse,i),o.changed.add(i.parse,i),o.init(),t("#rl-content").css({visibility:"visible"}),s.delay(function(){ot.removeClass("rl-started-trigger").addClass("rl-started")},50)},g.prototype.setHash=function(e,t,i){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,i=$.isUnd(i)?!1:!!i,($.isUnd(t)?1:!t)?(o.changed.active=!0,o[i?"replaceHash":"setHash"](e),o.setHash(e)):(o.changed.active=!1,o[i?"replaceHash":"setHash"](e),o.changed.active=!0)},g.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},tt=new g,h.newInstanceFromJson=function(e){var t=new h;return t.initByJson(e)?t:null},h.prototype.name="",h.prototype.email="",h.prototype.privateType=null,h.prototype.clear=function(){this.email="",this.name="",this.privateType=null},h.prototype.validate=function(){return""!==this.name||""!==this.email},h.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},h.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},h.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=W.EmailType.Facebook),null===this.privateType&&(this.privateType=W.EmailType.Default)),this.privateType},h.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},h.prototype.parse=function(e){this.clear(),e=$.trim(e);var t=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,i=t.exec(e);i?(this.name=i[1]||"",this.email=i[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},h.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=$.trim(e.Name),this.email=$.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},h.prototype.toLine=function(e,t,i){var n="";return""!==this.email&&(t=$.isUnd(t)?!1:!!t,i=$.isUnd(i)?!1:!!i,e&&""!==this.name?n=t?'")+'" target="_blank" tabindex="-1">'+$.encodeHtml(this.name)+"":i?$.encodeHtml(this.name):this.name:(n=this.email,""!==this.name?t?n=$.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+$.encodeHtml(n)+""+$.encodeHtml(">"):(n='"'+this.name+'" <'+n+">",i&&(n=$.encodeHtml(n))):t&&(n=''+$.encodeHtml(this.email)+""))),n},h.prototype.mailsoParse=function(e){if(e=$.trim(e),""===e)return!1;for(var t=function(e,t,i){e+="";var n=e.length;return 0>t&&(t+=n),n="undefined"==typeof i?n:0>i?i+n:i+t,t>=e.length||0>t||t>n?!1:e.slice(t,n)},i=function(e,t,i,n){return 0>i&&(i+=e.length),n=void 0!==n?n:e.length,0>n&&(n=n+e.length-i),e.slice(0,i)+t.substr(0,n)+t.slice(n)+e.slice(i+n)},n="",o="",s="",a=!1,r=!1,l=!1,c=null,u=0,p=0,d=0;d0&&0===n.length&&(n=t(e,0,d)),r=!0,u=d);break;case">":r&&(p=d,o=t(e,u+1,p-u-1),e=i(e,"",u,p-u+1),p=0,d=0,u=0,r=!1);break;case"(":a||r||l||(l=!0,u=d);break;case")":l&&(p=d,s=t(e,u+1,p-u-1),e=i(e,"",u,p-u+1),p=0,d=0,u=0,l=!1);break;case"\\":d++}d++}return 0===o.length&&(c=e.match(/[^@\s]+@\S+/i),c&&c[0]?o=c[0]:n=e),o.length>0&&0===n.length&&0===s.length&&(n=e.replace(o,"")),o=$.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),n=$.trim(n).replace(/^["']+/,"").replace(/["']+$/,""),s=$.trim(s).replace(/^[(]+/,"").replace(/[)]+$/,""),n=n.replace(/\\\\(.)/,"$1"),s=s.replace(/\\\\(.)/,"$1"),this.name=n,this.email=o,this.clearDuplicateName(),!0},h.prototype.inputoTagLine=function(){return 0(new e.Date).getTime()-p),g&&l.oRequests[g]&&(l.oRequests[g].__aborted&&(o="abort"),l.oRequests[g]=null),l.defaultResponse(i,g,o,t,s,n)}),g&&0 ").addClass("rl-settings-view-model").hide(),l.appendTo(r),o.data=lt.data(),o.viewModelDom=l,o.__rlSettingsData=a.__rlSettingsData,a.__dom=l,a.__builded=!0,a.__vm=o,i.applyBindingAccessorsToNode(l[0],{i18nInit:!0,template:function(){return{name:a.__rlSettingsData.Template}}},o),$.delegateRun(o,"onBuild",[l])):$.log("Cannot find sub settings view model position: SettingsSubScreen")),o&&s.defer(function(){n.oCurrentSubScreen&&($.delegateRun(n.oCurrentSubScreen,"onHide"),n.oCurrentSubScreen.viewModelDom.hide()),n.oCurrentSubScreen=o,n.oCurrentSubScreen&&(n.oCurrentSubScreen.viewModelDom.show(),$.delegateRun(n.oCurrentSubScreen,"onShow"),$.delegateRun(n.oCurrentSubScreen,"onFocus",[],200),s.each(n.menu(),function(e){e.selected(o&&o.__rlSettingsData&&e.route===o.__rlSettingsData.Route)}),t("#rl-content .b-settings .b-content .content").scrollTop(0)),$.windowResize()})):tt.setHash(lt.link().settings(),!1,!0)},H.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&($.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},H.prototype.onBuild=function(){s.each(Z.settings,function(e){e&&e.__rlSettingsData&&!s.find(Z["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:i.observable(!1),disabled:!!s.find(Z["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=t("#rl-content #rl-settings-subscreen")},H.prototype.routes=function(){var e=s.find(Z.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",i={subname:/^(.*)$/,normalize_:function(e,i){return i.subname=$.isUnd(i.subname)?t:$.pString(i.subname),[i.subname]}};return[["{subname}/",i],["{subname}",i],["",i]]},s.extend(q.prototype,d.prototype),q.prototype.onShow=function(){lt.setTitle("")},s.extend(B.prototype,H.prototype),B.prototype.onShow=function(){lt.setTitle("")},s.extend(K.prototype,u.prototype),K.prototype.oSettings=null,K.prototype.oPlugins=null,K.prototype.oLocal=null,K.prototype.oLink=null,K.prototype.oSubs={},K.prototype.download=function(t){var i=null,n=null,o=navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(i=document.createElement("a"),i.href=t,document.createEvent&&(n=document.createEvent("MouseEvents"),n&&n.initEvent&&i.dispatchEvent))?(n.initEvent("click",!0,!0),i.dispatchEvent(n),!0):(X.bMobileDevice?(e.open(t,"_self"),e.focus()):this.iframe.attr("src",t),!0)},K.prototype.link=function(){return null===this.oLink&&(this.oLink=new a),this.oLink},K.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new c),this.oLocal},K.prototype.settingsGet=function(e){return null===this.oSettings&&(this.oSettings=$.isNormal(it)?it:{}),$.isUnd(this.oSettings[e])?null:this.oSettings[e]},K.prototype.settingsSet=function(e,t){null===this.oSettings&&(this.oSettings=$.isNormal(it)?it:{}),this.oSettings[e]=t},K.prototype.setTitle=function(t){t=($.isNormal(t)&&0').appendTo("body"),r.on("error",function(t){t&&t.originalEvent&&t.originalEvent.message&&-1===u.inArray(t.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&e.jsError(u.emptyFunction,t.originalEvent.message,t.originalEvent.filename,t.originalEvent.lineno,o.location&&o.location.toString?o.location.toString():"",a.attr("class"),u.microtime()-c.now)}),l.on("keydown",function(e){e&&e.ctrlKey&&a.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&a.removeClass("rl-ctrl-key-pressed")})}var s=t("$"),n=t("_"),o=t("window"),a=t("$html"),r=t("$window"),l=t("$doc"),c=t("Globals"),u=t("Utils"),d=t("LinkBuilder"),p=t("Events"),h=t("../Storages/AppSettings.js"),g=t("KnoinAbstractBoot");n.extend(i.prototype,g.prototype),i.prototype.remote=function(){return null},i.prototype.data=function(){return null},i.prototype.setupSettings=function(){return!0},i.prototype.download=function(e){var t=null,i=null,s=o.navigator.userAgent.toLowerCase();return s&&(s.indexOf("chrome")>-1||s.indexOf("chrome")>-1)&&(i=o.document.createElement("a"),i.href=e,o.document.createEvent&&(t=o.document.createEvent("MouseEvents"),t&&t.initEvent&&i.dispatchEvent))?(t.initEvent("click",!0,!0),i.dispatchEvent(t),!0):(c.bMobileDevice?(o.open(e,"_self"),o.focus()):this.iframe.attr("src",e),!0)},i.prototype.setTitle=function(e){e=(u.isNormal(e)&&01&&(s=s.replace(/[\/]+$/,""),s+="/p"+t),""!==i&&(s=s.replace(/[\/]+$/,""),s+="/"+encodeURI(i)),s},i.prototype.phpInfo=function(){return this.sServer+"Info"},i.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},i.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},i.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},i.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},i.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},i.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=n.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},i.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},i.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},i.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},e.exports=new i}(t,e)},{"../Storages/AppSettings.js":54,Utils:22,window:38}],21:[function(e,t){!function(e,t){"use strict";var i={__boot:null,__remote:null,__data:null},s=t("_"),n=t("Utils");i.oViewModelsHooks={},i.oSimpleHooks={},i.regViewModelHook=function(e,t){t&&(t.__hookName=e)},i.addHook=function(e,t){n.isFunc(t)&&(n.isArray(i.oSimpleHooks[e])||(i.oSimpleHooks[e]=[]),i.oSimpleHooks[e].push(t))},i.runHook=function(e,t){n.isArray(i.oSimpleHooks[e])&&(t=t||[],s.each(i.oSimpleHooks[e],function(e){e.apply(null,t)}))},i.mainSettingsGet=function(e){return i.__boot?i.__boot.settingsGet(e):null},i.remoteRequest=function(e,t,s,n,o,a){i.__remote&&i.__remote.defaultRequest(e,t,s,n,o,a)},i.settingsGet=function(e,t){var s=i.mainSettingsGet("Plugins");return s=s&&n.isUnd(s[e])?null:s[e],s?n.isUnd(s[t])?null:s[t]:null},e.exports=i}(t,e)},{Utils:22,_:37}],22:[function(e,t){!function(e,t){"use strict";var i={},s=t("$"),n=t("_"),o=t("ko"),a=t("window"),r=t("$window"),l=t("$html"),c=t("$div"),u=t("$doc"),d=t("NotificationClass"),p=t("Enums"),h=t("Consts"),g=t("Globals");i.trim=s.trim,i.inArray=s.inArray,i.isArray=n.isArray,i.isFunc=n.isFunction,i.isUnd=n.isUndefined,i.isNull=n.isNull,i.emptyFunction=function(){},i.isNormal=function(e){return!i.isUnd(e)&&!i.isNull(e)},i.windowResize=n.debounce(function(e){i.isUnd(e)?r.resize():a.setTimeout(function(){r.resize()},e)},50),i.isPosNumeric=function(e,t){return i.isNormal(e)?(i.isUnd(t)?0:!t)?/^[1-9]+[0-9]*$/.test(e.toString()):/^[0-9]*$/.test(e.toString()):!1},i.pInt=function(e,t){var s=i.isNormal(e)&&""!==e?a.parseInt(e,10):t||0;return a.isNaN(s)?t||0:s},i.pString=function(e){return i.isNormal(e)?""+e:""},i.isNonEmptyArray=function(e){return i.isArray(e)&&0n;n++)s=i[n].split("="),t[a.decodeURIComponent(s[0])]=a.decodeURIComponent(s[1]);return t},i.rsaEncode=function(e,t,s,n){if(a.crypto&&a.crypto.getRandomValues&&a.RSAKey&&t&&s&&n){var o=new a.RSAKey;if(o.setPublic(n,s),e=o.encrypt(i.fakeMd5()+":"+e+":"+i.fakeMd5()),!1!==e)return"rsa:"+t+":"+e}return!1},i.rsaEncode.supported=!!(a.crypto&&a.crypto.getRandomValues&&a.RSAKey),i.exportPath=function(e,t,s){for(var n=null,o=e.split("."),r=s||a;o.length&&(n=o.shift());)o.length||i.isUnd(t)?r=r[n]?r[n]:r[n]={}:r[n]=t},i.pImport=function(e,t,i){e[t]=i},i.pExport=function(e,t,s){return i.isUnd(e[t])?s:e[t]},i.encodeHtml=function(e){return i.isNormal(e)?e.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):""},i.splitPlainText=function(e,t){var s="",n="",o=e,a=0,r=0;for(t=i.isUnd(t)?100:t;o.length>t;)n=o.substring(0,t),a=n.lastIndexOf(" "),r=n.lastIndexOf("\n"),-1!==r&&(a=r),-1===a&&(a=t),s+=n.substring(0,a)+"\n",o=o.substring(a+1);return s+o},i.timeOutAction=function(){var e={};return function(t,s,n){i.isUnd(e[t])&&(e[t]=0),a.clearTimeout(e[t]),e[t]=a.setTimeout(s,n)}}(),i.timeOutActionSecond=function(){var e={};return function(t,i,s){e[t]||(e[t]=a.setTimeout(function(){i(),e[t]=0},s))}}(),i.audio=function(){var e=!1;return function(t,i){if(!1===e)if(g.bIsiOSDevice)e=null;else{var s=!1,n=!1,o=a.Audio?new a.Audio:null;o&&o.canPlayType&&o.play?(s=""!==o.canPlayType('audio/mpeg; codecs="mp3"'),s||(n=""!==o.canPlayType('audio/ogg; codecs="vorbis"')),s||n?(e=o,e.preload="none",e.loop=!1,e.autoplay=!1,e.muted=!1,e.src=s?t:i):e=null):e=null}return e}}(),i.hos=function(e,t){return e&&a.Object&&a.Object.hasOwnProperty?a.Object.hasOwnProperty.call(e,t):!1},i.i18n=function(e,t,s){var n="",o=i.isUnd(g.oI18N[e])?i.isUnd(s)?e:s:g.oI18N[e];if(!i.isUnd(t)&&!i.isNull(t))for(n in t)i.hos(t,n)&&(o=o.replace("%"+n+"%",t[n]));return o},i.i18nToNode=function(e){n.defer(function(){s(".i18n",e).each(function(){var e=s(this),t="";t=e.data("i18n-text"),t?e.text(i.i18n(t)):(t=e.data("i18n-html"),t&&e.html(i.i18n(t)),t=e.data("i18n-placeholder"),t&&e.attr("placeholder",i.i18n(t)),t=e.data("i18n-title"),t&&e.attr("title",i.i18n(t)))})})},i.i18nReload=function(){a.rainloopI18N&&(g.oI18N=a.rainloopI18N||{},i.i18nToNode(u),g.langChangeTrigger(!g.langChangeTrigger())),a.rainloopI18N=null},i.initOnStartOrLangChange=function(e,t,i){e&&e.call(t),i?g.langChangeTrigger.subscribe(function(){e&&e.call(t),i.call(t)}):e&&g.langChangeTrigger.subscribe(e,t)},i.inFocus=function(){return a.document.activeElement?(i.isUnd(a.document.activeElement.__inFocusCache)&&(a.document.activeElement.__inFocusCache=s(a.document.activeElement).is("input,textarea,iframe,.cke_editable")),!!a.document.activeElement.__inFocusCache):!1},i.removeInFocus=function(){if(a.document&&a.document.activeElement&&a.document.activeElement.blur){var e=s(a.document.activeElement);e.is("input,textarea")&&a.document.activeElement.blur()}},i.removeSelection=function(){if(a&&a.getSelection){var e=a.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}else a.document&&a.document.selection&&a.document.selection.empty&&a.document.selection.empty()},i.replySubjectAdd=function(e,t){e=i.trim(e.toUpperCase()),t=i.trim(t.replace(/[\s]+/," "));var s=0,n="",o=!1,a="",r=[],l=[],c="RE"===e,u="FWD"===e,d=!u;if(""!==t){for(o=!1,l=t.split(":"),s=0;s0);return e.replace(/[\s]+/," ")},i._replySubjectAdd_=function(e,t,s){var n=null,o=i.trim(t);return o=null===(n=new a.RegExp("^"+e+"[\\s]?\\:(.*)$","gi").exec(t))||i.isUnd(n[1])?null===(n=new a.RegExp("^("+e+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(t))||i.isUnd(n[1])||i.isUnd(n[2])||i.isUnd(n[3])?e+": "+t:n[1]+(i.pInt(n[2])+1)+n[3]:e+"[2]: "+n[1],o=o.replace(/[\s]+/g," "),o=(i.isUnd(s)?!0:s)?i.fixLongSubject(o):o},i._fixLongSubject_=function(e){var t=0,s=null;e=i.trim(e.replace(/[\s]+/," "));do s=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!s||i.isUnd(s[0]))&&(s=null),s&&(t=0,t+=i.isUnd(s[2])?1:0+i.pInt(s[2]),t+=i.isUnd(s[4])?1:0+i.pInt(s[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(s);return e=e.replace(/[\s]+/," ")},i.roundNumber=function(e,t){return a.Math.round(e*a.Math.pow(10,t))/a.Math.pow(10,t)},i.friendlySize=function(e){return e=i.pInt(e),e>=1073741824?i.roundNumber(e/1073741824,1)+"GB":e>=1048576?i.roundNumber(e/1048576,1)+"MB":e>=1024?i.roundNumber(e/1024,0)+"KB":e+"B"},i.log=function(e){a.console&&a.console.log&&a.console.log(e)},i.getNotification=function(e,t){return e=i.pInt(e),p.Notification.ClientViewError===e&&t?t:i.isUnd(g.oNotificationI18N[e])?"":g.oNotificationI18N[e]},i.initNotificationLanguage=function(){var e=g.oNotificationI18N||{};e[p.Notification.InvalidToken]=i.i18n("NOTIFICATIONS/INVALID_TOKEN"),e[p.Notification.AuthError]=i.i18n("NOTIFICATIONS/AUTH_ERROR"),e[p.Notification.AccessError]=i.i18n("NOTIFICATIONS/ACCESS_ERROR"),e[p.Notification.ConnectionError]=i.i18n("NOTIFICATIONS/CONNECTION_ERROR"),e[p.Notification.CaptchaError]=i.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),e[p.Notification.SocialFacebookLoginAccessDisable]=i.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),e[p.Notification.SocialTwitterLoginAccessDisable]=i.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),e[p.Notification.SocialGoogleLoginAccessDisable]=i.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),e[p.Notification.DomainNotAllowed]=i.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),e[p.Notification.AccountNotAllowed]=i.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),e[p.Notification.AccountTwoFactorAuthRequired]=i.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),e[p.Notification.AccountTwoFactorAuthError]=i.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),e[p.Notification.CouldNotSaveNewPassword]=i.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),e[p.Notification.CurrentPasswordIncorrect]=i.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),e[p.Notification.NewPasswordShort]=i.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),e[p.Notification.NewPasswordWeak]=i.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),e[p.Notification.NewPasswordForbidden]=i.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),e[p.Notification.ContactsSyncError]=i.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),e[p.Notification.CantGetMessageList]=i.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),e[p.Notification.CantGetMessage]=i.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),e[p.Notification.CantDeleteMessage]=i.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),e[p.Notification.CantMoveMessage]=i.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[p.Notification.CantCopyMessage]=i.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[p.Notification.CantSaveMessage]=i.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),e[p.Notification.CantSendMessage]=i.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),e[p.Notification.InvalidRecipients]=i.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),e[p.Notification.CantCreateFolder]=i.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),e[p.Notification.CantRenameFolder]=i.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),e[p.Notification.CantDeleteFolder]=i.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),e[p.Notification.CantDeleteNonEmptyFolder]=i.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),e[p.Notification.CantSubscribeFolder]=i.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),e[p.Notification.CantUnsubscribeFolder]=i.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),e[p.Notification.CantSaveSettings]=i.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),e[p.Notification.CantSavePluginSettings]=i.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),e[p.Notification.DomainAlreadyExists]=i.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),e[p.Notification.CantInstallPackage]=i.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),e[p.Notification.CantDeletePackage]=i.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),e[p.Notification.InvalidPluginPackage]=i.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),e[p.Notification.UnsupportedPluginPackage]=i.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),e[p.Notification.LicensingServerIsUnavailable]=i.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),e[p.Notification.LicensingExpired]=i.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),e[p.Notification.LicensingBanned]=i.i18n("NOTIFICATIONS/LICENSING_BANNED"),e[p.Notification.DemoSendMessageError]=i.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),e[p.Notification.AccountAlreadyExists]=i.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),e[p.Notification.MailServerError]=i.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),e[p.Notification.InvalidInputArgument]=i.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),e[p.Notification.UnknownNotification]=i.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),e[p.Notification.UnknownError]=i.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},i.getUploadErrorDescByCode=function(e){var t="";switch(i.pInt(e)){case p.UploadErrorCode.FileIsTooBig:t=i.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case p.UploadErrorCode.FilePartiallyUploaded:t=i.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case p.UploadErrorCode.FileNoUploaded:t=i.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case p.UploadErrorCode.MissingTempFolder:t=i.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case p.UploadErrorCode.FileOnSaveingError:t=i.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case p.UploadErrorCode.FileType:t=i.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=i.i18n("UPLOAD/ERROR_UNKNOWN")}return t},i.delegateRun=function(e,t,s,o){e&&e[t]&&(o=i.pInt(o),0>=o?e[t].apply(e,i.isArray(s)?s:[]):n.delay(function(){e[t].apply(e,i.isArray(s)?s:[])},o))},i.killCtrlAandS=function(e){if(e=e||a.event,e&&e.ctrlKey&&!e.shiftKey&&!e.altKey){var t=e.target||e.srcElement,i=e.keyCode||e.which;if(i===p.EventKeyCode.S)return void e.preventDefault();if(t&&t.tagName&&t.tagName.match(/INPUT|TEXTAREA/i))return;i===p.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),e.preventDefault())}},i.createCommand=function(e,t,s){var n=t?function(){return n&&n.canExecute&&n.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return n.enabled=o.observable(!0),s=i.isUnd(s)?!0:s,n.canExecute=o.computed(i.isFunc(s)?function(){return n.enabled()&&s.call(e)}:function(){return n.enabled()&&!!s}),n},i.initDataConstructorBySettings=function(e){e.editorDefaultType=o.observable(p.EditorDefaultType.Html),e.showImages=o.observable(!1),e.interfaceAnimation=o.observable(p.InterfaceAnimation.Full),e.contactsAutosave=o.observable(!1),g.sAnimationType=p.InterfaceAnimation.Full,e.capaThemes=o.observable(!1),e.allowLanguagesOnSettings=o.observable(!0),e.allowLanguagesOnLogin=o.observable(!0),e.useLocalProxyForExternalImages=o.observable(!1),e.desktopNotifications=o.observable(!1),e.useThreads=o.observable(!0),e.replySameFolder=o.observable(!0),e.useCheckboxesInList=o.observable(!0),e.layout=o.observable(p.Layout.SidePreview),e.usePreviewPane=o.computed(function(){return p.Layout.NoPreview!==e.layout()}),e.interfaceAnimation.subscribe(function(e){if(g.bMobileDevice||e===p.InterfaceAnimation.None)l.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),g.sAnimationType=p.InterfaceAnimation.None;else switch(e){case p.InterfaceAnimation.Full:l.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),g.sAnimationType=e;break;case p.InterfaceAnimation.Normal:l.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),g.sAnimationType=e}}),e.interfaceAnimation.valueHasMutated(),e.desktopNotificationsPermisions=o.computed(function(){e.desktopNotifications();var t=p.DesktopNotifications.NotSupported;if(d&&d.permission)switch(d.permission.toLowerCase()){case"granted":t=p.DesktopNotifications.Allowed;break;case"denied":t=p.DesktopNotifications.Denied;break;case"default":t=p.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(t=a.webkitNotifications.checkPermission());return t}),e.useDesktopNotifications=o.computed({read:function(){return e.desktopNotifications()&&p.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()},write:function(t){if(t){var i=e.desktopNotificationsPermisions();p.DesktopNotifications.Allowed===i?e.desktopNotifications(!0):p.DesktopNotifications.NotAllowed===i?d.requestPermission(function(){e.desktopNotifications.valueHasMutated(),p.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()?e.desktopNotifications()?e.desktopNotifications.valueHasMutated():e.desktopNotifications(!0):e.desktopNotifications()?e.desktopNotifications(!1):e.desktopNotifications.valueHasMutated()}):e.desktopNotifications(!1)}else e.desktopNotifications(!1)}}),e.language=o.observable(""),e.languages=o.observableArray([]),e.mainLanguage=o.computed({read:e.language,write:function(t){t!==e.language()?-1=t.diff(s,"hours")?n:t.format("L")===s.format("L")?i.i18n("MESSAGE_LIST/TODAY_AT",{TIME:s.format("LT")}):t.clone().subtract("days",1).format("L")===s.format("L")?i.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:s.format("LT")}):s.format(t.year()===s.year()?"D MMM.":"LL")},e)},i.initBlockquoteSwitcher=function(e){if(e){var t=s("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===s(this).parent().closest("blockquote",e).length});t&&0100)&&(e.addClass("rl-bq-switcher hidden-bq"),s('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),i.windowResize()}).after("
").before("
"))
+})}},i.removeBlockquoteSwitcher=function(e){e&&(s(e).find("blockquote.rl-bq-switcher").each(function(){s(this).removeClass("rl-bq-switcher hidden-bq")}),s(e).find(".rlBlockquoteSwitcher").each(function(){s(this).remove()}))},i.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},i.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=i.trim(e.substring(0,e.length-7))),i.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},i.quoteName=function(e){return e.replace(/["]/g,'\\"')},i.microtime=function(){return(new Date).getTime()},i.convertLangName=function(e,t){return i.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},i.fakeMd5=function(e){var t="",s="0123456789abcdefghijklmnopqrstuvwxyz";for(e=i.isUnd(e)?32:i.pInt(e);t.length>>32-t}function i(e,t){var i,s,n,o,a;return n=2147483648&e,o=2147483648&t,i=1073741824&e,s=1073741824&t,a=(1073741823&e)+(1073741823&t),i&s?2147483648^a^n^o:i|s?1073741824&a?3221225472^a^n^o:1073741824^a^n^o:a^n^o}function s(e,t,i){return e&t|~e&i}function n(e,t,i){return e&i|t&~i}function o(e,t,i){return e^t^i}function a(e,t,i){return t^(e|~i)}function r(e,n,o,a,r,l,c){return e=i(e,i(i(s(n,o,a),r),c)),i(t(e,l),n)}function l(e,s,o,a,r,l,c){return e=i(e,i(i(n(s,o,a),r),c)),i(t(e,l),s)}function c(e,s,n,a,r,l,c){return e=i(e,i(i(o(s,n,a),r),c)),i(t(e,l),s)}function u(e,s,n,o,r,l,c){return e=i(e,i(i(a(s,n,o),r),c)),i(t(e,l),s)}function d(e){for(var t,i=e.length,s=i+8,n=(s-s%64)/64,o=16*(n+1),a=Array(o-1),r=0,l=0;i>l;)t=(l-l%4)/4,r=l%4*8,a[t]=a[t]|e.charCodeAt(l)<>>29,a}function p(e){var t,i,s="",n="";for(i=0;3>=i;i++)t=e>>>8*i&255,n="0"+t.toString(16),s+=n.substr(n.length-2,2);return s}function h(e){e=e.replace(/rn/g,"n");for(var t="",i=0;is?t+=String.fromCharCode(s):s>127&&2048>s?(t+=String.fromCharCode(s>>6|192),t+=String.fromCharCode(63&s|128)):(t+=String.fromCharCode(s>>12|224),t+=String.fromCharCode(s>>6&63|128),t+=String.fromCharCode(63&s|128))}return t}var g,m,f,b,S,v,y,A,w,C=Array(),T=7,E=12,N=17,P=22,L=5,k=9,I=14,R=20,D=4,_=11,x=16,F=23,M=6,U=10,O=15,j=21;for(e=h(e),C=d(e),v=1732584193,y=4023233417,A=2562383102,w=271733878,g=0;g /g,">").replace(/")},i.draggeblePlace=function(){return s(' ').appendTo("#rl-hidden")},i.defautOptionsAfterRender=function(e,t){t&&!i.isUnd(t.disabled)&&e&&s(e).toggleClass("disabled",t.disabled).prop("disabled",t.disabled)},i.windowPopupKnockout=function(e,t,n,r){var l=null,c=a.open(""),u="__OpenerApplyBindingsUid"+i.fakeMd5()+"__",d=s("#"+t);a[u]=function(){if(c&&c.document.body&&d&&d[0]){var t=s(c.document.body);s("#rl-content",t).html(d.html()),s("html",c.document).addClass("external "+s("html").attr("class")),i.i18nToNode(t),e&&s("#rl-content",t)[0]&&o.applyBindings(e,s("#rl-content",t)[0]),a[u]=null,r(c)}},c.document.open(),c.document.write(''+i.encodeHtml(n)+' '),c.document.close(),l=c.document.createElement("script"),l.type="text/javascript",l.innerHTML="if(window&&window.opener&&window.opener['"+u+"']){window.opener['"+u+"']();window.opener['"+u+"']=null}",c.document.getElementsByTagName("head")[0].appendChild(l)},i.settingsSaveHelperFunction=function(e,t,s,o){return s=s||null,o=i.isUnd(o)?1e3:i.pInt(o),function(i,a,r,l,c){t.call(s,a&&a.Result?p.SaveSettingsStep.TrueResult:p.SaveSettingsStep.FalseResult),e&&e.call(s,i,a,r,l,c),n.delay(function(){t.call(s,p.SaveSettingsStep.Idle)},o)}},i.settingsSaveHelperSimpleFunction=function(e,t){return i.settingsSaveHelperFunction(null,e,t,1e3)},i.htmlToPlain=function(e){var t=0,i=0,n=0,o=0,a=0,r="",l=function(e){for(var t=100,i="",s="",n=e,o=0,a=0;n.length>t;)s=n.substring(0,t),o=s.lastIndexOf(" "),a=s.lastIndexOf("\n"),-1!==a&&(o=a),-1===o&&(o=t),i+=s.substring(0,o)+"\n",n=n.substring(o+1);return i+n},u=function(e){return e=l(s.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2]*>([\s\S\r\n]*)<\/div>/gim,d),e="\n"+s.trim(e)+"\n"),e}return""},p=function(){return arguments&&1 "):""},h=function(){return arguments&&1 /g,">"):""},g=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,p).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,h).replace(/
]*>/gim,"\n").replace(/<\/h[\d]>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>([\s\S\r\n]*)<\/div>/gim,d).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S\r\n]*?)<\/a>/gim,g).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),r=c.html(r).text(),r=r.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),t=0,a=100;a>0&&(a--,i=r.indexOf("__bq__start__",t),i>-1);)n=r.indexOf("__bq__start__",i+5),o=r.indexOf("__bq__end__",i+5),(-1===n||n>o)&&o>i?(r=r.substring(0,i)+u(r.substring(i+13,o))+r.substring(o+11),t=0):t=n>-1&&o>n?n-1:0;return r=r.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},i.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var s=!1,n=!0,o=!0,a=[],r="",l=0,c=e.split("\n");do{for(n=!1,a=[],l=0;l"===r.substr(0,1),o&&!s?(n=!0,s=!0,a.push("~~~blockquote~~~"),a.push(r.substr(1))):!o&&s?(s=!1,a.push("~~~/blockquote~~~"),a.push(r)):a.push(o&&s?r.substr(1):r);s&&(s=!1,a.push("~~~/blockquote~~~")),c=a}while(n);return e=c.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/[\s]*~~~\/blockquote~~~/g,"
").replace(/[\-_~]{10,}/g,"
").replace(/\n/g,"
"),t?i.linkify(e):e},a.rainloop_Utils_htmlToPlain=i.htmlToPlain,a.rainloop_Utils_plainToHtml=i.plainToHtml,i.linkify=function(e){return s.fn&&s.fn.linkify&&(e=c.html(e.replace(/&/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&")),e},i.resizeAndCrop=function(e,t,i){var s=new a.Image;s.onload=function(){var e=[0,0],s=a.document.createElement("canvas"),n=s.getContext("2d");s.width=t,s.height=t,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],n.fillStyle="#fff",n.fillRect(0,0,t,t),n.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,t,t),i(s.toDataURL("image/jpeg"))},s.src=e},i.folderListOptionsBuilder=function(e,t,s,n,o,r,l,c,u,d){var h=null,g=!1,m=0,f=0,b="Â Â Â ",S=[];for(u=i.isNormal(u)?u:0m;m++)S.push({id:n[m][0],name:n[m][1],system:!1,seporator:!1,disabled:!1});for(g=!0,m=0,f=e.length;f>m;m++)h=e[m],(l?l.call(null,h):!0)&&(g&&0m;m++)h=t[m],(h.subScribed()||!h.existen)&&(l?l.call(null,h):!0)&&(p.FolderType.User===h.type()||!u||01||c>0&&l>c){for(l>c?(u(c),s=c,n=c):((3>=l||l>=c-2)&&(o+=2),u(l),s=l,n=l);o>0;)if(s-=1,n+=1,s>0&&(u(s,!1),o--),c>=n)u(n,!0),o--;else if(0>=s)break;3===s?u(2,!1):s>3&&u(a.Math.round((s-1)/2),!1,"..."),c-2===n?u(c-1,!0):c-2>n&&u(a.Math.round((c+n)/2),!0,"..."),s>1&&u(1,!1),c>n&&u(c,!0)}return r}},i.selectElement=function(e){if(a.getSelection){var t=a.getSelection();t.removeAllRanges();var i=a.document.createRange();i.selectNodeContents(e),t.addRange(i)}else if(a.document.selection){var s=a.document.body.createTextRange();s.moveToElementText(e),s.select()}},i.detectDropdownVisibility=n.debounce(function(){g.dropdownVisibility(!!n.find(g.aBootstrapDropdowns,function(e){return e.hasClass("open")}))},50),i.triggerAutocompleteInputChange=function(e){var t=function(){s(".checkAutocomplete").trigger("change")};e?n.delay(t,100):t()},e.exports=i}(t,e)},{$:32,$div:23,$doc:24,$html:25,$window:26,Consts:16,Enums:17,Globals:19,NotificationClass:29,_:37,ko:34,window:38}],23:[function(e,t){t.exports=e("$")("")},{$:32}],24:[function(e,t){t.exports=e("$")(window.document)},{$:32}],25:[function(e,t){t.exports=e("$")("html")},{$:32}],26:[function(e,t){t.exports=e("$")(window)},{$:32}],27:[function(e,t){t.exports=e("window").rainloopAppData||{}},{window:38}],28:[function(e,t){t.exports=JSON},{}],29:[function(e,t){var i=e("window");t.exports=i.Notification&&i.Notification.requestPermission?i.Notification:null},{window:38}],30:[function(e,t){t.exports=crossroads},{}],31:[function(e,t){t.exports=hasher},{}],32:[function(e,t){t.exports=$},{}],33:[function(e,t){t.exports=key},{}],34:[function(e,t){!function(t,i){"use strict";var s=e("window"),n=e("_"),o=e("$"),a=e("$window"),r=e("$doc");i.bindingHandlers.tooltip={init:function(t,s){var n=e("Globals"),a=e("Utils");if(!n.bMobileDevice){var r=o(t),l=r.data("tooltip-class")||"",c=r.data("tooltip-placement")||"top";r.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:c,trigger:"hover",title:function(){return r.is(".disabled")||n.dropdownVisibility()?"":''+a.i18n(i.utils.unwrapObservable(s()))+""}}).click(function(){r.tooltip("hide")}),n.tooltipTrigger.subscribe(function(){r.tooltip("hide")})}}},i.bindingHandlers.tooltip2={init:function(t,i){var s=e("Globals"),n=o(t),a=n.data("tooltip-class")||"",r=n.data("tooltip-placement")||"top";n.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:r,title:function(){return n.is(".disabled")||s.dropdownVisibility()?"":''+i()()+""}}).click(function(){n.tooltip("hide")}),s.tooltipTrigger.subscribe(function(){n.tooltip("hide")})}},i.bindingHandlers.tooltip3={init:function(t){var i=o(t),s=e("Globals");i.tooltip({container:"body",trigger:"hover manual",title:function(){return i.data("tooltip3-data")||""}}),r.click(function(){i.tooltip("hide")}),s.tooltipTrigger.subscribe(function(){i.tooltip("hide")})},update:function(e,t){var s=i.utils.unwrapObservable(t());""===s?o(e).data("tooltip3-data","").tooltip("hide"):o(e).data("tooltip3-data",s).tooltip("show")}},i.bindingHandlers.registrateBootstrapDropdown={init:function(t){var i=e("Globals");i.aBootstrapDropdowns.push(o(t))}},i.bindingHandlers.openDropdownTrigger={update:function(t,s){if(i.utils.unwrapObservable(s())){var n=o(t),a=e("Utils");n.hasClass("open")||(n.find(".dropdown-toggle").dropdown("toggle"),a.detectDropdownVisibility()),s()(!1)}}},i.bindingHandlers.dropdownCloser={init:function(e){o(e).closest(".dropdown").on("click",".e-item",function(){o(e).dropdown("toggle")})}},i.bindingHandlers.popover={init:function(e,t){o(e).popover(i.utils.unwrapObservable(t()))}},i.bindingHandlers.csstext={init:function(t,s){var n=e("Utils");t&&t.styleSheet&&!n.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=i.utils.unwrapObservable(s()):o(t).text(i.utils.unwrapObservable(s()))},update:function(t,s){var n=e("Utils");t&&t.styleSheet&&!n.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=i.utils.unwrapObservable(s()):o(t).text(i.utils.unwrapObservable(s()))}},i.bindingHandlers.resizecrop={init:function(e){o(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,t){t()(),o(e).resizecrop({width:"100",height:"100"})}},i.bindingHandlers.onEnter={init:function(e,t,i,n){o(e).on("keypress",function(i){i&&13===s.parseInt(i.keyCode,10)&&(o(e).trigger("change"),t().call(n))})}},i.bindingHandlers.onEsc={init:function(e,t,i,n){o(e).on("keypress",function(i){i&&27===s.parseInt(i.keyCode,10)&&(o(e).trigger("change"),t().call(n))})}},i.bindingHandlers.clickOnTrue={update:function(e,t){i.utils.unwrapObservable(t())&&o(e).click()}},i.bindingHandlers.modal={init:function(t,s){var n=e("Globals"),a=e("Utils");o(t).toggleClass("fade",!n.bMobileDevice).modal({keyboard:!1,show:i.utils.unwrapObservable(s())}).on("shown",function(){a.windowResize()}).find(".close").click(function(){s()(!1)})},update:function(e,t){o(e).modal(i.utils.unwrapObservable(t())?"show":"hide")}},i.bindingHandlers.i18nInit={init:function(t){var i=e("Utils");i.i18nToNode(t)}},i.bindingHandlers.i18nUpdate={update:function(t,s){var n=e("Utils");i.utils.unwrapObservable(s()),n.i18nToNode(t)}},i.bindingHandlers.link={update:function(e,t){o(e).attr("href",i.utils.unwrapObservable(t()))}},i.bindingHandlers.title={update:function(e,t){o(e).attr("title",i.utils.unwrapObservable(t()))}},i.bindingHandlers.textF={init:function(e,t){o(e).text(i.utils.unwrapObservable(t()))}},i.bindingHandlers.initDom={init:function(e,t){t()(e)}},i.bindingHandlers.initResizeTrigger={init:function(e,t){var s=i.utils.unwrapObservable(t());o(e).css({height:s[1],"min-height":s[1]})},update:function(t,s){var n=e("Utils"),r=i.utils.unwrapObservable(s()),l=n.pInt(r[1]),c=0,u=o(t).offset().top;u>0&&(u+=n.pInt(r[2]),c=a.height()-u,c>l&&(l=c),o(t).css({height:l,"min-height":l}))}},i.bindingHandlers.appendDom={update:function(e,t){o(e).hide().empty().append(i.utils.unwrapObservable(t())).show()}},i.bindingHandlers.draggable={init:function(t,n,a){var r=e("Globals"),l=e("Utils");if(!r.bMobileDevice){var c=100,u=3,d=a(),p=d&&d.droppableSelector?d.droppableSelector:"",h={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};p&&(h.drag=function(e){o(p).each(function(){var t=null,i=null,n=o(this),a=n.offset(),r=a.top+n.height();s.clearInterval(n.data("timerScroll")),n.data("timerScroll",!1),e.pageX>=a.left&&e.pageX<=a.left+n.width()&&(e.pageY>=r-c&&e.pageY<=r&&(t=function(){n.scrollTop(n.scrollTop()+u),l.windowResize()},n.data("timerScroll",s.setInterval(t,10)),t()),e.pageY>=a.top&&e.pageY<=a.top+c&&(i=function(){n.scrollTop(n.scrollTop()-u),l.windowResize()},n.data("timerScroll",s.setInterval(i,10)),i()))})},h.stop=function(){o(p).each(function(){s.clearInterval(o(this).data("timerScroll")),o(this).data("timerScroll",!1)})}),h.helper=function(e){return n()(e&&e.target?i.dataFor(e.target):null)},o(t).draggable(h).on("mousedown",function(){l.removeInFocus()})}}},i.bindingHandlers.droppable={init:function(t,i,s){var n=e("Globals");if(!n.bMobileDevice){var a=i(),r=s(),l=r&&r.droppableOver?r.droppableOver:null,c=r&&r.droppableOut?r.droppableOut:null,u={tolerance:"pointer",hoverClass:"droppableHover"};a&&(u.drop=function(e,t){a(e,t)},l&&(u.over=function(e,t){l(e,t)}),c&&(u.out=function(e,t){c(e,t)}),o(t).droppable(u))}}},i.bindingHandlers.nano={init:function(t){var i=e("Globals");i.bDisableNanoScroll||o(t).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},i.bindingHandlers.saveTrigger={init:function(e){var t=o(e);t.data("save-trigger-type",t.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===t.data("save-trigger-type")?t.append(' ').addClass("settings-saved-trigger"):t.addClass("settings-saved-trigger-input")},update:function(e,t){var s=i.utils.unwrapObservable(t()),n=o(e);if("custom"===n.data("save-trigger-type"))switch(s.toString()){case"1":n.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":n.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":n.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:n.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(s.toString()){case"1":n.addClass("success").removeClass("error");break;case"0":n.addClass("error").removeClass("success");break;case"-2":break;default:n.removeClass("error success")}}},i.bindingHandlers.emailsTags={init:function(t,i,s){var a=e("Utils"),r=e("../Models/EmailModel.js"),l=o(t),c=i(),u=s(),d=u.autoCompleteSource||null,p=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:p,inputDelimiters:[",",";"],autoCompleteSource:d,parseHook:function(e){return n.map(e,function(e){var t=a.trim(e),i=null;return""!==t?(i=new r,i.mailsoParse(t),i.clearDuplicateName(),[i.toLine(!1),i]):[t,null]})},change:n.bind(function(e){l.data("EmailsTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,s){var n=o(e),a=s(),r=a.emailsTagsFilter||null,l=i.utils.unwrapObservable(t());n.data("EmailsTagsValue")!==l&&(n.val(l),n.data("EmailsTagsValue",l),n.inputosaurus("refresh")),r&&i.utils.unwrapObservable(r)&&n.inputosaurus("focus")}},i.bindingHandlers.contactTags={init:function(t,i,s){var a=e("Utils"),r=e("../Models/ContactTagModel.js"),l=o(t),c=i(),u=s(),d=u.autoCompleteSource||null,p=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:p,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:d,parseHook:function(e){return n.map(e,function(e){var t=a.trim(e),i=null;return""!==t?(i=new r,i.name(t),[i.toLine(!1),i]):[t,null]})},change:n.bind(function(e){l.data("ContactTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,s){var n=o(e),a=s(),r=a.contactTagsFilter||null,l=i.utils.unwrapObservable(t());n.data("ContactTagsValue")!==l&&(n.val(l),n.data("ContactTagsValue",l),n.inputosaurus("refresh")),r&&i.utils.unwrapObservable(r)&&n.inputosaurus("focus")}},i.bindingHandlers.command={init:function(e,t,s,n){var a=o(e),r=t();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");a.addClass("command"),i.bindingHandlers[a.is("form")?"submit":"click"].init.apply(n,arguments)},update:function(e,t){var i=!0,s=o(e),n=t();i=n.enabled(),s.toggleClass("command-not-enabled",!i),i&&(i=n.canExecute(),s.toggleClass("command-can-not-be-execute",!i)),s.toggleClass("command-disabled disable disabled",!i).toggleClass("no-disabled",!!i),(s.is("input")||s.is("button"))&&s.prop("disabled",!i)}},i.extenders.trimmer=function(t){var s=e("Utils"),n=i.computed({read:t,write:function(e){t(s.trim(e.toString()))},owner:this});return n(t()),n},i.extenders.posInterer=function(t,s){var n=e("Utils"),o=i.computed({read:t,write:function(e){var i=n.pInt(e.toString(),s);0>=i&&(i=s),i===t()&&""+i!=""+e&&t(i+1),t(i)}});return o(t()),o},i.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},i.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},i.extenders.falseTimeout=function(t,i){var n=e("Utils");return t.iTimeout=0,t.subscribe(function(e){e&&(s.clearTimeout(t.iTimeout),t.iTimeout=s.setTimeout(function(){t(!1),t.iTimeout=0},n.pInt(i)))}),t},i.observable.fn.validateNone=function(){return this.hasError=i.observable(!1),this},i.observable.fn.validateEmail=function(){var t=e("Utils");return this.hasError=i.observable(!1),this.subscribe(function(e){e=t.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},i.observable.fn.validateSimpleEmail=function(){var t=e("Utils");return this.hasError=i.observable(!1),this.subscribe(function(e){e=t.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},i.observable.fn.validateFunc=function(t){var s=e("Utils");return this.hasFuncError=i.observable(!1),s.isFunc(t)&&(this.subscribe(function(e){this.hasFuncError(!t(e))},this),this.valueHasMutated()),this},t.exports=i}(t,ko)},{$:32,$doc:24,$window:26,"../Models/ContactTagModel.js":44,"../Models/EmailModel.js":45,Globals:19,Utils:22,_:37,window:38}],35:[function(e,t){t.exports=moment},{}],36:[function(e,t){t.exports=ssm},{}],37:[function(e,t){t.exports=_},{}],38:[function(e,t){t.exports=window},{}],39:[function(e,t){!function(e,t){"use strict";function i(){this.sDefaultScreenName="",this.oScreens={},this.oCurrentScreen=null}var s=t("$"),n=t("_"),o=t("ko"),a=t("hasher"),r=t("crossroads"),l=t("$html"),c=t("Globals"),u=t("Plugins"),d=t("Utils"),p=t("KnoinAbstractViewModel");i.prototype.sDefaultScreenName="",i.prototype.oScreens={},i.prototype.oCurrentScreen=null,i.prototype.hideLoading=function(){s("#rl-loading").hide()},i.prototype.constructorEnd=function(e){d.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},i.prototype.extendAsViewModel=function(e,t,i){t&&(i||(i=p),t.__name=e,u.regViewModelHook(e,t),n.extend(t.prototype,i.prototype))},i.prototype.addSettingsViewModel=function(e,t,i,s,n){e.__rlSettingsData={Label:i,Template:t,Route:s,IsDefault:!!n},c.aViewModels.settings.push(e)},i.prototype.removeSettingsViewModel=function(e){c.aViewModels["settings-removed"].push(e)},i.prototype.disableSettingsViewModel=function(e){c.aViewModels["settings-disabled"].push(e)},i.prototype.routeOff=function(){a.changed.active=!1},i.prototype.routeOn=function(){a.changed.active=!0},i.prototype.screen=function(e){return""===e||d.isUnd(this.oScreens[e])?null:this.oScreens[e]},i.prototype.buildViewModel=function(e,t){if(e&&!e.__builded){var i=this,a=new e(t),r=a.viewModelPosition(),l=s("#rl-content #rl-"+r.toLowerCase()),p=null;e.__builded=!0,e.__vm=a,a.viewModelName=e.__name,l&&1===l.length?(p=s("").addClass("rl-view-model").addClass("RL-"+a.viewModelTemplate()).hide(),p.appendTo(l),a.viewModelDom=p,e.__dom=p,"Popups"===r&&(a.cancelCommand=a.closeCommand=d.createCommand(a,function(){i.hideScreenPopup(e)}),a.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),c.popupVisibilityNames.push(this.viewModelName),a.viewModelDom.css("z-index",3e3+c.popupVisibilityNames().length+10),d.delegateRun(this,"onFocus",[],500)):(d.delegateRun(this,"onHide"),this.restoreKeyScope(),c.popupVisibilityNames.remove(this.viewModelName),a.viewModelDom.css("z-index",2e3),c.tooltipTrigger(!c.tooltipTrigger()),n.delay(function(){t.viewModelDom.hide()},300))},a)),u.runHook("view-model-pre-build",[e.__name,a,p]),o.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:a.viewModelTemplate()}}},a),d.delegateRun(a,"onBuild",[p]),a&&"Popups"===r&&a.registerPopupKeyDown(),u.runHook("view-model-post-build",[e.__name,a,p])):d.log("Cannot find view model position: "+r)}return e?e.__vm:null},i.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),u.runHook("view-model-on-hide",[e.__name,e.__vm]))},i.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),d.delegateRun(e.__vm,"onShow",t||[]),u.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},i.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},i.prototype.screenOnRoute=function(e,t){var i=this,s=null,o=null;""===d.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(s=this.screen(e),s||(s=this.screen(this.sDefaultScreenName),s&&(t=e+"/"+t,e=this.sDefaultScreenName)),s&&s.__started&&(s.__builded||(s.__builded=!0,d.isNonEmptyArray(s.viewModels())&&n.each(s.viewModels(),function(e){this.buildViewModel(e,s)},this),d.delegateRun(s,"onBuild")),n.defer(function(){i.oCurrentScreen&&(d.delegateRun(i.oCurrentScreen,"onHide"),d.isNonEmptyArray(i.oCurrentScreen.viewModels())&&n.each(i.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),d.delegateRun(e.__vm,"onHide"))})),i.oCurrentScreen=s,i.oCurrentScreen&&(d.delegateRun(i.oCurrentScreen,"onShow"),u.runHook("screen-on-show",[i.oCurrentScreen.screenName(),i.oCurrentScreen]),d.isNonEmptyArray(i.oCurrentScreen.viewModels())&&n.each(i.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),d.delegateRun(e.__vm,"onShow"),d.delegateRun(e.__vm,"onFocus",[],200),u.runHook("view-model-on-show",[e.__name,e.__vm]))},i)),o=s.__cross(),o&&o.parse(t)})))},i.prototype.startScreens=function(e){s("#rl-content").css({visibility:"hidden"}),n.each(e,function(e){var t=new e,i=t?t.screenName():"";t&&""!==i&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=i),this.oScreens[i]=t)},this),n.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),u.runHook("screen-pre-start",[e.screenName(),e]),d.delegateRun(e,"onStart"),u.runHook("screen-post-start",[e.screenName(),e]))},this);var t=r.create();t.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,n.bind(this.screenOnRoute,this)),a.initialized.add(t.parse,t),a.changed.add(t.parse,t),a.init(),s("#rl-content").css({visibility:"visible"}),n.delay(function(){l.removeClass("rl-started-trigger").addClass("rl-started")},50)},i.prototype.setHash=function(e,t,i){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,i=d.isUnd(i)?!1:!!i,(d.isUnd(t)?1:!t)?(a.changed.active=!0,a[i?"replaceHash":"setHash"](e),a.setHash(e)):(a.changed.active=!1,a[i?"replaceHash":"setHash"](e),a.changed.active=!0)},e.exports=new i}(t,e)},{$:32,$html:25,Globals:19,KnoinAbstractViewModel:42,Plugins:21,Utils:22,_:37,crossroads:30,hasher:31,ko:34}],40:[function(e,t){!function(e){"use strict";function t(){}t.prototype.bootstart=function(){},e.exports=t}(t,e)},{}],41:[function(e,t){!function(e,t){"use strict";function i(e,t){this.sScreenName=e,this.aViewModels=n.isArray(t)?t:[]}var s=t("crossroads"),n=t("Utils");i.prototype.oCross=null,i.prototype.sScreenName="",i.prototype.aViewModels=[],i.prototype.viewModels=function(){return this.aViewModels},i.prototype.screenName=function(){return this.sScreenName},i.prototype.routes=function(){return null},i.prototype.__cross=function(){return this.oCross},i.prototype.__start=function(){var e=this.routes(),t=null,i=null;n.isNonEmptyArray(e)&&(i=_.bind(this.onRoute||n.emptyFunction,this),t=s.create(),_.each(e,function(e){t.addRoute(e[0],i).rules=e[1]}),this.oCross=t)},e.exports=i}(t,e)},{Utils:22,crossroads:30}],42:[function(e,t){!function(e,t){"use strict";function i(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=r.pString(e),this.sTemplate=r.pString(t),this.sDefaultKeyScope=o.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=s.observable(!1),this.modalVisibility=s.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}var s=t("ko"),n=t("$window"),o=t("Enums"),a=t("Globals"),r=t("Utils");i.prototype.sPosition="",i.prototype.sTemplate="",i.prototype.viewModelName="",i.prototype.viewModelDom=null,i.prototype.viewModelTemplate=function(){return this.sTemplate},i.prototype.viewModelPosition=function(){return this.sPosition},i.prototype.cancelCommand=function(){},i.prototype.closeCommand=function(){},i.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=a.keyScope(),a.keyScope(this.sDefaultKeyScope)},i.prototype.restoreKeyScope=function(){a.keyScope(this.sCurrentKeyScope)},i.prototype.registerPopupKeyDown=function(){var e=this;n.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&o.EventKeyCode.Esc===t.keyCode)return r.delegateRun(e,"cancelCommand"),!1;if(o.EventKeyCode.Backspace===t.keyCode&&!r.inFocus())return!1}return!0})},e.exports=i}(t,e)},{$window:26,Enums:17,Globals:19,Utils:22,ko:34}],43:[function(e,t){!function(e,t){"use strict";function i(){this.mimeType="",this.fileName="",this.estimatedSize=0,this.friendlySize="",this.isInline=!1,this.isLinked=!1,this.cid="",this.cidWithOutTags="",this.contentLocation="",this.download="",this.folder="",this.uid="",this.mimeIndex=""
+}var s=t("window"),n=t("Globals"),o=t("Utils"),a=t("LinkBuilder");i.newInstanceFromJson=function(e){var t=new i;return t.initByJson(e)?t:null},i.prototype.mimeType="",i.prototype.fileName="",i.prototype.estimatedSize=0,i.prototype.friendlySize="",i.prototype.isInline=!1,i.prototype.isLinked=!1,i.prototype.cid="",i.prototype.cidWithOutTags="",i.prototype.contentLocation="",i.prototype.download="",i.prototype.folder="",i.prototype.uid="",i.prototype.mimeIndex="",i.prototype.initByJson=function(e){var t=!1;return e&&"Object/Attachment"===e["@Object"]&&(this.mimeType=(e.MimeType||"").toLowerCase(),this.fileName=e.FileName,this.estimatedSize=o.pInt(e.EstimatedSize),this.isInline=!!e.IsInline,this.isLinked=!!e.IsLinked,this.cid=e.CID,this.contentLocation=e.ContentLocation,this.download=e.Download,this.folder=e.Folder,this.uid=e.Uid,this.mimeIndex=e.MimeIndex,this.friendlySize=o.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),t=!0),t},i.prototype.isImage=function(){return-1,]+)>?,? ?/g,i=t.exec(e);i?(this.name=i[1]||"",this.email=i[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},i.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=n.trim(e.Name),this.email=n.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},i.prototype.toLine=function(e,t,i){var s="";return""!==this.email&&(t=n.isUnd(t)?!1:!!t,i=n.isUnd(i)?!1:!!i,e&&""!==this.name?s=t?'")+'" target="_blank" tabindex="-1">'+n.encodeHtml(this.name)+"":i?n.encodeHtml(this.name):this.name:(s=this.email,""!==this.name?t?s=n.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+n.encodeHtml(s)+""+n.encodeHtml(">"):(s='"'+this.name+'" <'+s+">",i&&(s=n.encodeHtml(s))):t&&(s=''+n.encodeHtml(this.email)+""))),s},i.prototype.mailsoParse=function(e){if(e=n.trim(e),""===e)return!1;for(var t=function(e,t,i){e+="";var s=e.length;return 0>t&&(t+=s),s="undefined"==typeof i?s:0>i?i+s:i+t,t>=e.length||0>t||t>s?!1:e.slice(t,s)},i=function(e,t,i,s){return 0>i&&(i+=e.length),s=void 0!==s?s:e.length,0>s&&(s=s+e.length-i),e.slice(0,i)+t.substr(0,s)+t.slice(s)+e.slice(i+s)},s="",o="",a="",r=!1,l=!1,c=!1,u=null,d=0,p=0,h=0;h0&&0===s.length&&(s=t(e,0,h)),l=!0,d=h);break;case">":l&&(p=h,o=t(e,d+1,p-d-1),e=i(e,"",d,p-d+1),p=0,h=0,d=0,l=!1);break;case"(":r||l||c||(c=!0,d=h);break;case")":c&&(p=h,a=t(e,d+1,p-d-1),e=i(e,"",d,p-d+1),p=0,h=0,d=0,c=!1);break;case"\\":h++}h++}return 0===o.length&&(u=e.match(/[^@\s]+@\S+/i),u&&u[0]?o=u[0]:s=e),o.length>0&&0===s.length&&0===a.length&&(s=e.replace(o,"")),o=n.trim(o).replace(/^[<]+/,"").replace(/[>]+$/,""),s=n.trim(s).replace(/^["']+/,"").replace(/["']+$/,""),a=n.trim(a).replace(/^[(]+/,"").replace(/[)]+$/,""),s=s.replace(/\\\\(.)/,"$1"),a=a.replace(/\\\\(.)/,"$1"),this.name=s,this.email=o,this.clearDuplicateName(),!0},i.prototype.inputoTagLine=function(){return 0t?t:e))},this),this.body=null,this.plainRaw="",this.isHtml=a.observable(!1),this.hasImages=a.observable(!1),this.attachments=a.observableArray([]),this.isPgpSigned=a.observable(!1),this.isPgpEncrypted=a.observable(!1),this.pgpSignedVerifyStatus=a.observable(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser=a.observable(""),this.priority=a.observable(u.MessagePriority.Normal),this.readReceipt=a.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=a.observable(0),this.threads=a.observableArray([]),this.threadsLen=a.observable(0),this.hasUnseenSubMessage=a.observable(!1),this.hasFlaggedSubMessage=a.observable(!1),this.lastInCollapsedThread=a.observable(!1),this.lastInCollapsedThreadLoading=a.observable(!1),this.threadsLenResult=a.computed(function(){var e=this.threadsLen();return 0===this.parentUid()&&e>0?e+1:""},this)}var s=t("window"),n=t("$"),o=t("_"),a=t("ko"),r=t("moment"),l=t("$window"),c=t("$div"),u=t("Enums"),d=t("Utils"),p=t("LinkBuilder"),h=t("./EmailModel.js"),g=t("./AttachmentModel.js");i.newInstanceFromJson=function(e){var t=new i;return t.initByJson(e)?t:null},i.calculateFullFromatDateValue=function(e){return e>0?r.unix(e).format("LLL"):""},i.emailsToLine=function(e,t,i){var s=[],n=0,o=0;if(d.isNonEmptyArray(e))for(n=0,o=e.length;o>n;n++)s.push(e[n].toLine(t,i));return s.join(", ")},i.emailsToLineClear=function(e){var t=[],i=0,s=0;if(d.isNonEmptyArray(e))for(i=0,s=e.length;s>i;i++)e[i]&&e[i].email&&""!==e[i].name&&t.push(e[i].email);return t.join(", ")},i.initEmailsFromJson=function(e){var t=0,i=0,s=null,n=[];if(d.isNonEmptyArray(e))for(t=0,i=e.length;i>t;t++)s=h.newInstanceFromJson(e[t]),s&&n.push(s);return n},i.replyHelper=function(e,t,i){if(e&&0s;s++)d.isUnd(t[e[s].email])&&(t[e[s].email]=!0,i.push(e[s]))},i.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.subjectPrefix(""),this.subjectSuffix(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(u.MessagePriority.Normal),this.proxy=!1,this.fromEmailString(""),this.fromClearEmailString(""),this.toEmailsString(""),this.toClearEmailsString(""),this.senderEmailsString(""),this.senderClearEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(u.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},i.prototype.computeSenderEmail=function(){var e=t("../Storages/WebMailDataStorage.js"),i=e.sentFolder(),s=e.draftFolder();this.senderEmailsString(this.folderFullNameRaw===i||this.folderFullNameRaw===s?this.toEmailsString():this.fromEmailString()),this.senderClearEmailsString(this.folderFullNameRaw===i||this.folderFullNameRaw===s?this.toClearEmailsString():this.fromClearEmailString())},i.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.proxy=!!e.ExternalProxy,this.size(d.pInt(e.Size)),this.from=i.initEmailsFromJson(e.From),this.to=i.initEmailsFromJson(e.To),this.cc=i.initEmailsFromJson(e.Cc),this.bcc=i.initEmailsFromJson(e.Bcc),this.replyTo=i.initEmailsFromJson(e.ReplyTo),this.deliveredTo=i.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),d.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(d.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(i.emailsToLine(this.from,!0)),this.fromClearEmailString(i.emailsToLineClear(this.from)),this.toEmailsString(i.emailsToLine(this.to,!0)),this.toClearEmailsString(i.emailsToLineClear(this.to)),this.parentUid(d.pInt(e.ParentThread)),this.threads(d.isArray(e.Threads)?e.Threads:[]),this.threadsLen(d.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},i.prototype.initUpdateByMessageJson=function(e){var i=t("../Storages/WebMailDataStorage.js"),s=!1,n=u.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(n=d.pInt(e.Priority),this.priority(-1t;t++)s=g.newInstanceFromJson(e["@Collection"][t]),s&&(""!==s.cidWithOutTags&&0 +$/,""),t=o.find(i,function(t){return e===t.cidWithOutTags})),t||null},i.prototype.findAttachmentByContentLocation=function(e){var t=null,i=this.attachments();return d.isNonEmptyArray(i)&&(t=o.find(i,function(t){return e===t.contentLocation})),t||null},i.prototype.messageId=function(){return this.sMessageId},i.prototype.inReplyTo=function(){return this.sInReplyTo},i.prototype.references=function(){return this.sReferences},i.prototype.fromAsSingleEmail=function(){return d.isArray(this.from)&&this.from[0]?this.from[0].email:""},i.prototype.viewLink=function(){return p.messageViewLink(this.requestHash)},i.prototype.downloadLink=function(){return p.messageDownloadLink(this.requestHash)},i.prototype.replyEmails=function(e){var t=[],s=d.isUnd(e)?{}:e;return i.replyHelper(this.replyTo,s,t),0===t.length&&i.replyHelper(this.from,s,t),t},i.prototype.replyAllEmails=function(e){var t=[],s=[],n=d.isUnd(e)?{}:e;return i.replyHelper(this.replyTo,n,t),0===t.length&&i.replyHelper(this.from,n,t),i.replyHelper(this.to,n,t),i.replyHelper(this.cc,n,s),[t,s]},i.prototype.textBodyToString=function(){return this.body?this.body.html():""},i.prototype.attachmentsToStringLine=function(){var e=o.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0=0&&s&&!o&&i.attr("src",s)}),e&&s.setTimeout(function(){t.print()},100))})},i.prototype.printMessage=function(){this.viewPopupMessage(!0)},i.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},i.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.subjectPrefix(this.subjectPrefix()),this.subjectSuffix(this.subjectSuffix()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.proxy=e.proxy,this.fromEmailString(e.fromEmailString()),this.fromClearEmailString(e.fromClearEmailString()),this.toEmailsString(e.toEmailsString()),this.toClearEmailsString(e.toClearEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(u.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},i.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var t="";e=d.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),t=this.proxy?"data-x-additional-src":"data-x-src",n("["+t+"]",this.body).each(function(){e&&n(this).is("img")?n(this).addClass("lazy").attr("data-original",n(this).attr(t)).removeAttr(t):n(this).attr("src",n(this).attr(t)).removeAttr(t)}),t=this.proxy?"data-x-additional-style-url":"data-x-style-url",n("["+t+"]",this.body).each(function(){var e=d.trim(n(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",n(this).attr("style",e+n(this).attr(t)).removeAttr(t)}),e&&(n("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:n(".RL-MailMessageView .messageView .messageItem .content")[0]}),l.resize()),d.windowResize(500)}},i.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=d.isUnd(e)?!1:e;var t=this;n("[data-x-src-cid]",this.body).each(function(){var i=t.findAttachmentByCid(n(this).attr("data-x-src-cid"));i&&i.download&&(e&&n(this).is("img")?n(this).addClass("lazy").attr("data-original",i.linkPreview()):n(this).attr("src",i.linkPreview()))}),n("[data-x-src-location]",this.body).each(function(){var i=t.findAttachmentByContentLocation(n(this).attr("data-x-src-location"));i||(i=t.findAttachmentByCid(n(this).attr("data-x-src-location"))),i&&i.download&&(e&&n(this).is("img")?n(this).addClass("lazy").attr("data-original",i.linkPreview()):n(this).attr("src",i.linkPreview()))}),n("[data-x-style-cid]",this.body).each(function(){var e="",i="",s=t.findAttachmentByCid(n(this).attr("data-x-style-cid"));s&&s.linkPreview&&(i=n(this).attr("data-x-style-cid-name"),""!==i&&(e=d.trim(n(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",n(this).attr("style",e+i+": url('"+s.linkPreview()+"')")))}),e&&!function(e,t){o.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(n("img.lazy",t.body),n(".RL-MailMessageView .messageView .messageItem .content")[0]),d.windowResize(500)}},i.prototype.storeDataToDom=function(){if(this.body){this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw);var e=t("../Storages/WebMailDataStorage.js");e.capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))}},i.prototype.storePgpVerifyDataToDom=function(){var e=t("../Storages/WebMailDataStorage.js");this.body&&e.capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},i.prototype.fetchDataToDom=function(){if(this.body){this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=d.pString(this.body.data("rl-plain-raw"));var e=t("../Storages/WebMailDataStorage.js");e.capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""))}},i.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var e=[],i=null,a=t("../Storages/WebMailDataStorage.js"),r=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=a.findPublicKeysByEmail(r),d=null,p=null,h="";this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{i=s.openpgp.cleartext.readArmored(this.plainRaw),i&&i.getText&&(this.pgpSignedVerifyStatus(l.length?u.SignedVerifyStatus.Unverified:u.SignedVerifyStatus.UnknownPublicKeys),e=i.verify(l),e&&0').text(h)).html(),c.empty(),this.replacePlaneTextBody(h)))))}catch(g){}this.storePgpVerifyDataToDom()}},i.prototype.decryptPgpEncryptedMessage=function(e){if(this.isPgpEncrypted()){var i=[],a=null,r=null,l=t("../Storages/WebMailDataStorage.js"),d=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",p=l.findPublicKeysByEmail(d),h=l.findSelfPrivateKey(e),g=null,m=null,f="";this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),h||this.pgpSignedVerifyStatus(u.SignedVerifyStatus.UnknownPrivateKey);try{a=s.openpgp.message.readArmored(this.plainRaw),a&&h&&a.decrypt&&(this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Unverified),r=a.decrypt(h),r&&(i=r.verify(p),i&&0').text(f)).html(),c.empty(),this.replacePlaneTextBody(f)))}catch(b){}this.storePgpVerifyDataToDom()}},i.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},i.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},e.exports=i}(t,e)},{$:32,$div:23,$window:26,"../Storages/WebMailDataStorage.js":59,"./AttachmentModel.js":43,"./EmailModel.js":45,Enums:17,LinkBuilder:20,Utils:22,_:37,ko:34,moment:35,window:38}],47:[function(e,t){!function(e,t){"use strict";function i(e){u.call(this,"settings",e),this.menu=o.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}var s=t("$"),n=t("_"),o=t("ko"),a=t("Globals"),r=t("Utils"),l=t("LinkBuilder"),c=t("kn"),u=t("KnoinAbstractScreen");n.extend(i.prototype,u.prototype),i.prototype.onRoute=function(e){var t=this,i=null,u=null,d=null,p=null;u=n.find(a.aViewModels.settings,function(t){return t&&t.__rlSettingsData&&e===t.__rlSettingsData.Route}),u&&(n.find(a.aViewModels["settings-removed"],function(e){return e&&e===u})&&(u=null),u&&n.find(a.aViewModels["settings-disabled"],function(e){return e&&e===u})&&(u=null)),u?(u.__builded&&u.__vm?i=u.__vm:(d=this.oViewModelPlace,d&&1===d.length?(u=u,i=new u,p=s("").addClass("rl-settings-view-model").hide(),p.appendTo(d),i.viewModelDom=p,i.__rlSettingsData=u.__rlSettingsData,u.__dom=p,u.__builded=!0,u.__vm=i,o.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:u.__rlSettingsData.Template}}},i),r.delegateRun(i,"onBuild",[p])):r.log("Cannot find sub settings view model position: SettingsSubScreen")),i&&n.defer(function(){t.oCurrentSubScreen&&(r.delegateRun(t.oCurrentSubScreen,"onHide"),t.oCurrentSubScreen.viewModelDom.hide()),t.oCurrentSubScreen=i,t.oCurrentSubScreen&&(t.oCurrentSubScreen.viewModelDom.show(),r.delegateRun(t.oCurrentSubScreen,"onShow"),r.delegateRun(t.oCurrentSubScreen,"onFocus",[],200),n.each(t.menu(),function(e){e.selected(i&&i.__rlSettingsData&&e.route===i.__rlSettingsData.Route)}),s("#rl-content .b-settings .b-content .content").scrollTop(0)),r.windowResize()})):c.setHash(l.settings(),!1,!0)},i.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(r.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},i.prototype.onBuild=function(){n.each(a.aViewModels.settings,function(e){e&&e.__rlSettingsData&&!n.find(a.aViewModels["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:o.observable(!1),disabled:!!n.find(a.aViewModels["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=s("#rl-content #rl-settings-subscreen")},i.prototype.routes=function(){var e=n.find(a.aViewModels.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",i={subname:/^(.*)$/,normalize_:function(e,i){return i.subname=r.isUnd(i.subname)?t:r.pString(i.subname),[i.subname]}};return[["{subname}/",i],["{subname}",i],["",i]]},e.exports=i}(t,e)},{$:32,Globals:19,KnoinAbstractScreen:41,LinkBuilder:20,Utils:22,_:37,kn:39,ko:34}],48:[function(e,t){!function(e,t){"use strict";function i(){var e=t("../ViewModels/AdminLoginViewModel.js");n.call(this,"login",[e])}var s=t("_"),n=t("KnoinAbstractScreen");s.extend(i.prototype,n.prototype),i.prototype.onShow=function(){var e=t("../Boots/AdminApp.js");e.setTitle("")},e.exports=i}(t,e)},{"../Boots/AdminApp.js":14,"../ViewModels/AdminLoginViewModel.js":60,KnoinAbstractScreen:41,_:37}],49:[function(e,t){!function(e,t){"use strict";function i(){var e=t("../ViewModels/AdminMenuViewModel.js"),i=t("../ViewModels/AdminPaneViewModel.js");n.call(this,[e,i])}var s=t("_"),n=t("./AbstractSettings.js");s.extend(i.prototype,n.prototype),i.prototype.onShow=function(){var e=t("../Boots/AdminApp.js");e.setTitle("")},e.exports=i}(t,e)},{"../Boots/AdminApp.js":14,"../ViewModels/AdminMenuViewModel.js":61,"../ViewModels/AdminPaneViewModel.js":62,"./AbstractSettings.js":47,_:37}],50:[function(e,t){!function(e,t){"use strict";function i(){this.oRequests={}}var s=t("window"),n=t("$"),o=t("Consts"),a=t("Enums"),r=t("Globals"),l=t("Utils"),c=t("Plugins"),u=t("LinkBuilder"),d=t("./AppSettings.js");i.prototype.oRequests={},i.prototype.defaultResponse=function(e,t,i,n,u,d){var p=function(){a.StorageResultType.Success!==i&&r.bUnload&&(i=a.StorageResultType.Unload),a.StorageResultType.Success===i&&n&&!n.Result?(n&&-1(new s.Date).getTime()-h),m&&r.oRequests[m]&&(r.oRequests[m].__aborted&&(n="abort"),r.oRequests[m]=null),r.defaultResponse(e,m,n,i,o,t)}),m&&0=e?1:e},this),this.mainMessageListSearch=a.computed({read:this.messageListSearch,write:function(e){b.setHash(g.mailBox(this.currentFolderFullNameHash(),1,h.trim(e.toString())))},owner:this}),this.messageListError=a.observable(""),this.messageListLoading=a.observable(!1),this.messageListIsNotCompleted=a.observable(!1),this.messageListCompleteLoadingThrottle=a.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=a.computed(function(){var e=this.messageListLoading(),t=this.messageListIsNotCompleted();return e||t},this),this.messageListCompleteLoading.subscribe(function(e){this.messageListCompleteLoadingThrottle(e)},this),this.messageList.subscribe(o.debounce(function(e){o.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new S,this.message=a.observable(null),this.messageLoading=a.observable(!1),this.messageLoadingThrottle=a.observable(!1).extend({throttle:50}),this.message.focused=a.observable(!1),this.message.subscribe(function(e){e?d.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),d.Layout.NoPreview===this.layout()&&-10?s.Math.ceil(t/e*100):0},this),this.capaOpenPGP=a.observable(!1),this.openpgpkeys=a.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(e){return!(!e||e.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(e){return!(!e||!e.isPrivate)}),this.googleActions=a.observable(!1),this.googleLoggined=a.observable(!1),this.googleUserName=a.observable(""),this.facebookActions=a.observable(!1),this.facebookLoggined=a.observable(!1),this.facebookUserName=a.observable(""),this.twitterActions=a.observable(!1),this.twitterLoggined=a.observable(!1),this.twitterUserName=a.observable(""),this.customThemeType=a.observable(d.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=o.throttle(this.purgeMessageBodyCache,3e4)}var s=t("window"),n=t("$"),o=t("_"),a=t("ko"),r=t("moment"),l=t("$div"),c=t("NotificationClass"),u=t("Consts"),d=t("Enums"),p=t("Globals"),h=t("Utils"),g=t("LinkBuilder"),m=t("./AppSettings.js"),f=t("./WebMailCacheStorage.js"),b=t("kn"),S=t("../Models/MessageModel.js"),v=t("./LocalStorage.js"),y=t("./AbstractData.js");o.extend(i.prototype,y.prototype),i.prototype.purgeMessageBodyCache=function(){var e=0,t=null,i=p.iMessageBodyCacheCount-u.Values.MessageBodyCacheLimit;i>0&&(t=this.messagesBodiesDom(),t&&(t.find(".rl-cache-class").each(function(){var t=n(this);i>t.data("rl-cache-count")&&(t.addClass("rl-cache-purge"),e++)}),e>0&&o.delay(function(){t.find(".rl-cache-purge").remove()},300)))},i.prototype.populateDataOnStart=function(){y.prototype.populateDataOnStart.call(this),this.accountEmail(m.settingsGet("Email")),this.accountIncLogin(m.settingsGet("IncLogin")),this.accountOutLogin(m.settingsGet("OutLogin")),this.projectHash(m.settingsGet("ProjectHash")),this.defaultIdentityID(m.settingsGet("DefaultIdentityID")),this.displayName(m.settingsGet("DisplayName")),this.replyTo(m.settingsGet("ReplyTo")),this.signature(m.settingsGet("Signature")),this.signatureToAll(!!m.settingsGet("SignatureToAll")),this.enableTwoFactor(!!m.settingsGet("EnableTwoFactor")),this.lastFoldersHash=v.get(d.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!m.settingsGet("RemoteSuggestions"),this.devEmail=m.settingsGet("DevEmail"),this.devPassword=m.settingsGet("DevPassword")},i.prototype.initUidNextAndNewMessages=function(e,t,i){if("INBOX"===e&&h.isNormal(t)&&""!==t){if(h.isArray(i)&&03)l(g.notificationMailIcon(),this.accountEmail(),h.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:r}));else for(;r>a;a++)l(g.notificationMailIcon(),S.emailsToLine(S.initEmailsFromJson(i[a].From),!1),i[a].Subject)}f.setFolderUidNext(e,t)}},i.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},i.prototype.getNextFolderNames=function(e){e=h.isUnd(e)?!1:!!e;var t=[],i=10,s=r().unix(),n=s-300,a=[],l=function(t){o.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&n>t.interval&&(!e||t.subScribed())&&a.push([t.interval,t.fullNameRaw]),t&&0t[0]?1:0}),o.find(a,function(e){var n=f.getFolderFromCacheList(e[1]);return n&&(n.interval=s,t.push(e[1])),i<=t.length}),o.uniq(t)},i.prototype.removeMessagesFromList=function(e,t,i,s){i=h.isNormal(i)?i:"",s=h.isUnd(s)?!1:!!s,t=o.map(t,function(e){return h.pInt(e)});var n=this,a=0,r=this.messageList(),l=f.getFolderFromCacheList(e),c=""===i?null:f.getFolderFromCacheList(i||""),u=this.currentFolderFullNameRaw(),d=this.message(),p=u===e?o.filter(r,function(e){return e&&-10&&l.messageCountUnread(0<=l.messageCountUnread()-a?l.messageCountUnread()-a:0)),c&&(c.messageCountAll(c.messageCountAll()+t.length),a>0&&c.messageCountUnread(c.messageCountUnread()+a),c.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),a.data("rl-cache-count",++p.iMessageBodyCacheCount),h.isNormal(e.Result.Html)&&""!==e.Result.Html?(i=!0,u=e.Result.Html.toString()):h.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(i=!1,u=h.plainToHtml(e.Result.Plain.toString(),!1),(S.isPgpSigned()||S.isPgpEncrypted())&&this.capaOpenPGP()&&(S.plainRaw=h.pString(e.Result.Plain),m=/---BEGIN PGP MESSAGE---/.test(S.plainRaw),m||(g=/-----BEGIN PGP SIGNED MESSAGE-----/.test(S.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(S.plainRaw)),l.empty(),g&&S.isPgpSigned()?u=l.append(n('').text(S.plainRaw)).html():m&&S.isPgpEncrypted()&&(u=l.append(n('').text(S.plainRaw)).html()),l.empty(),S.isPgpSigned(g),S.isPgpEncrypted(m))):i=!1,a.html(h.linkify(u)).addClass("b-text-part "+(i?"html":"plain")),S.isHtml(!!i),S.hasImages(!!s),S.pgpSignedVerifyStatus(d.SignedVerifyStatus.None),S.pgpSignedVerifyUser(""),S.body=a,S.body&&b.append(S.body),S.storeDataToDom(),o&&S.showInternalImages(!0),S.hasImages()&&this.showImages()&&S.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(S.body),this.hideMessageBodies(),S.body.show(),a&&h.initBlockquoteSwitcher(a)),f.initMessageFlagsFromCache(S),S.unseen()&&p.__RL&&p.__RL.setMessageSeen(S),h.windowResize())},i.prototype.calculateMessageListHash=function(e){return o.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},i.prototype.findPublicKeyByHex=function(e){return o.find(this.openpgpkeysPublic(),function(t){return t&&e===t.id})},i.prototype.findPublicKeysByEmail=function(e){return o.compact(o.map(this.openpgpkeysPublic(),function(t){var i=null;if(t&&e===t.email)try{if(i=s.openpgp.key.readArmored(t.armor),i&&!i.err&&i.keys&&i.keys[0])return i.keys[0]}catch(n){}return null}))},i.prototype.findPrivateKeyByEmail=function(e,t){var i=null,n=o.find(this.openpgpkeysPrivate(),function(t){return t&&e===t.email});if(n)try{i=s.openpgp.key.readArmored(n.armor),i&&!i.err&&i.keys&&i.keys[0]?(i=i.keys[0],i.decrypt(h.pString(t))):i=null}catch(a){i=null}return i},i.prototype.findSelfPrivateKey=function(e){return this.findPrivateKeyByEmail(this.accountEmail(),e)},e.exports=new i}(t,e)},{$:32,$div:23,"../Models/MessageModel.js":46,"./AbstractData.js":51,"./AppSettings.js":54,"./LocalStorage.js":55,"./WebMailCacheStorage.js":58,Consts:16,Enums:17,Globals:19,LinkBuilder:20,NotificationClass:29,Utils:22,_:37,kn:39,ko:34,moment:35,window:38}],60:[function(e,t){!function(e,t){"use strict";function i(){c.call(this,"Center","AdminLogin"),this.login=n.observable(""),this.password=n.observable(""),this.loginError=n.observable(!1),this.passwordError=n.observable(!1),this.loginFocus=n.observable(!1),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=n.observable(!1),this.submitError=n.observable(""),this.submitCommand=a.createCommand(this,function(){return a.triggerAutocompleteInputChange(),this.loginError(""===a.trim(this.login())),this.passwordError(""===a.trim(this.password())),this.loginError()||this.passwordError()?!1:(this.submitRequest(!0),r.adminLogin(s.bind(function(e,i){if(o.StorageResultType.Success===e&&i&&"AdminLogin"===i.Action)if(i.Result){var s=t("../Boots/AdminApp.js");s.loginAndLogoutReload()}else i.ErrorCode&&(this.submitRequest(!1),this.submitError(a.getNotification(i.ErrorCode)));else this.submitRequest(!1),this.submitError(a.getNotification(o.Notification.UnknownError))},this),this.login(),this.password()),!0)},function(){return!this.submitRequest()}),l.constructorEnd(this)}var s=t("_"),n=t("ko"),o=t("Enums"),a=t("Utils"),r=t("../Storages/AdminAjaxRemoteStorage.js"),l=t("kn"),c=t("KnoinAbstractViewModel");l.extendAsViewModel("AdminLoginViewModel",i),i.prototype.onShow=function(){l.routeOff(),s.delay(s.bind(function(){this.loginFocus(!0)},this),100)},i.prototype.onHide=function(){this.loginFocus(!1)},i.prototype.onBuild=function(){a.triggerAutocompleteInputChange(!0)},i.prototype.submitForm=function(){this.submitCommand()},e.exports=i}(t,e)},{"../Boots/AdminApp.js":14,"../Storages/AdminAjaxRemoteStorage.js":52,Enums:17,KnoinAbstractViewModel:42,Utils:22,_:37,kn:39,ko:34}],61:[function(e,t){!function(e,t){"use strict";function i(e){o.call(this,"Left","AdminMenu"),this.leftPanelDisabled=n.leftPanelDisabled,this.menu=e.menu,s.constructorEnd(this)}var s=t("kn"),n=t("Globals"),o=t("KnoinAbstractViewModel");s.extendAsViewModel("AdminMenuViewModel",i),i.prototype.link=function(e){return"#/"+e
+},e.exports=i}(t,e)},{Globals:19,KnoinAbstractViewModel:42,kn:39}],62:[function(e,t){!function(e,t){"use strict";function i(){l.call(this,"Right","AdminPane"),this.adminDomain=s.observable(n.settingsGet("AdminDomain")),this.version=s.observable(n.settingsGet("Version")),this.adminManLoadingVisibility=o.adminManLoadingVisibility,r.constructorEnd(this)}var s=t("ko"),n=t("../Storages/AppSettings.js"),o=t("../Storages/AdminDataStorage.js"),a=t("../Storages/AdminAjaxRemoteStorage.js"),r=t("kn"),l=t("KnoinAbstractViewModel");r.extendAsViewModel("AdminPaneViewModel",i),i.prototype.logoutClick=function(){a.adminLogout(function(){var e=t("../Boots/AdminApp.js");e.loginAndLogoutReload()})},e.exports=i}(t,e)},{"../Boots/AdminApp.js":14,"../Storages/AdminAjaxRemoteStorage.js":52,"../Storages/AdminDataStorage.js":53,"../Storages/AppSettings.js":54,KnoinAbstractViewModel:42,kn:39,ko:34}],63:[function(e,t){!function(e,t){"use strict";function i(){u.call(this,"Popups","PopupsActivate");var e=this;this.domain=s.observable(""),this.key=s.observable(""),this.key.focus=s.observable(!1),this.activationSuccessed=s.observable(!1),this.licenseTrigger=r.licenseTrigger,this.activateProcess=s.observable(!1),this.activateText=s.observable(""),this.activateText.isError=s.observable(!1),this.key.subscribe(function(){this.activateText(""),this.activateText.isError(!1)},this),this.activationSuccessed.subscribe(function(e){e&&this.licenseTrigger(!this.licenseTrigger())},this),this.activateCommand=o.createCommand(this,function(){this.activateProcess(!0),this.validateSubscriptionKey()?l.licensingActivate(function(t,i){e.activateProcess(!1),n.StorageResultType.Success===t&&i.Result?!0===i.Result?(e.activationSuccessed(!0),e.activateText("Subscription Key Activated Successfully"),e.activateText.isError(!1)):(e.activateText(i.Result),e.activateText.isError(!0),e.key.focus(!0)):i.ErrorCode?(e.activateText(o.getNotification(i.ErrorCode)),e.activateText.isError(!0),e.key.focus(!0)):(e.activateText(o.getNotification(n.Notification.UnknownError)),e.activateText.isError(!0),e.key.focus(!0))},this.domain(),this.key()):(this.activateProcess(!1),this.activateText("Invalid Subscription Key"),this.activateText.isError(!0),this.key.focus(!0))},function(){return!this.activateProcess()&&""!==this.domain()&&""!==this.key()&&!this.activationSuccessed()}),c.constructorEnd(this)}var s=t("ko"),n=t("Enums"),o=t("Utils"),a=t("../../Storages/AppSettings.js"),r=t("../../Storages/AdminDataStorage.js"),l=t("../../Storages/AdminAjaxRemoteStorage.js"),c=t("kn"),u=t("KnoinAbstractViewModel");c.extendAsViewModel("PopupsActivateViewModel",i),i.prototype.onShow=function(){this.domain(a.settingsGet("AdminDomain")),this.activateProcess()||(this.key(""),this.activateText(""),this.activateText.isError(!1),this.activationSuccessed(!1))},i.prototype.onFocus=function(){this.activateProcess()||this.key.focus(!0)},i.prototype.validateSubscriptionKey=function(){var e=this.key();return""===e||!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(o.trim(e))},e.exports=i}(t,e)},{"../../Storages/AdminAjaxRemoteStorage.js":52,"../../Storages/AdminDataStorage.js":53,"../../Storages/AppSettings.js":54,Enums:17,KnoinAbstractViewModel:42,Utils:22,kn:39,ko:34}],64:[function(e,t){!function(e,t){"use strict";function i(){l.call(this,"Popups","PopupsAsk"),this.askDesc=s.observable(""),this.yesButton=s.observable(""),this.noButton=s.observable(""),this.yesFocus=s.observable(!1),this.noFocus=s.observable(!1),this.fYesAction=null,this.fNoAction=null,this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=o.KeyState.PopupAsk,r.constructorEnd(this)}var s=t("ko"),n=t("key"),o=t("Enums"),a=t("Utils"),r=t("kn"),l=t("KnoinAbstractViewModel");r.extendAsViewModel("PopupsAskViewModel",i),i.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(a.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(a.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},i.prototype.yesClick=function(){this.cancelCommand(),a.isFunc(this.fYesAction)&&this.fYesAction.call(null)},i.prototype.noClick=function(){this.cancelCommand(),a.isFunc(this.fNoAction)&&this.fNoAction.call(null)},i.prototype.onShow=function(e,t,i,s,n){this.clearPopup(),this.fYesAction=t||null,this.fNoAction=i||null,this.askDesc(e||""),s&&this.yesButton(s),s&&this.yesButton(n)},i.prototype.onFocus=function(){this.yesFocus(!0)},i.prototype.onBuild=function(){n("tab, shift+tab, right, left",o.KeyState.PopupAsk,_.bind(function(){return this.yesFocus()?this.noFocus(!0):this.yesFocus(!0),!1},this)),n("esc",o.KeyState.PopupAsk,_.bind(function(){return this.noClick(),!1},this))},e.exports=i}(t,e)},{Enums:17,KnoinAbstractViewModel:42,Utils:22,key:33,kn:39,ko:34}],65:[function(e,t){!function(e,t){"use strict";function i(){u.call(this,"Popups","PopupsDomain"),this.edit=n.observable(!1),this.saving=n.observable(!1),this.savingError=n.observable(""),this.whiteListPage=n.observable(!1),this.testing=n.observable(!1),this.testingDone=n.observable(!1),this.testingImapError=n.observable(!1),this.testingSmtpError=n.observable(!1),this.testingImapErrorDesc=n.observable(""),this.testingSmtpErrorDesc=n.observable(""),this.testingImapError.subscribe(function(e){e||this.testingImapErrorDesc("")},this),this.testingSmtpError.subscribe(function(e){e||this.testingSmtpErrorDesc("")},this),this.testingImapErrorDesc=n.observable(""),this.testingSmtpErrorDesc=n.observable(""),this.imapServerFocus=n.observable(!1),this.smtpServerFocus=n.observable(!1),this.name=n.observable(""),this.name.focused=n.observable(!1),this.imapServer=n.observable(""),this.imapPort=n.observable(""+a.Values.ImapDefaulPort),this.imapSecure=n.observable(o.ServerSecure.None),this.imapShortLogin=n.observable(!1),this.smtpServer=n.observable(""),this.smtpPort=n.observable(""+a.Values.SmtpDefaulPort),this.smtpSecure=n.observable(o.ServerSecure.None),this.smtpShortLogin=n.observable(!1),this.smtpAuth=n.observable(!0),this.whiteList=n.observable(""),this.headerText=n.computed(function(){var e=this.name();return this.edit()?'Edit Domain "'+e+'"':"Add Domain"+(""===e?"":' "'+e+'"')},this),this.domainIsComputed=n.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=n.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=n.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=r.createCommand(this,function(){this.saving(!0),l.createOrUpdateDomain(s.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),r.pInt(this.imapPort()),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),r.pInt(this.smtpPort()),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=r.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),l.testConnectionForDomain(s.bind(this.onTestConnectionResponse,this),this.name(),this.imapServer(),r.pInt(this.imapPort()),this.imapSecure(),this.smtpServer(),r.pInt(this.smtpPort()),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=r.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),this.imapServerFocus.subscribe(function(e){e&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(e){e&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer().replace(/imap/gi,"smtp"))},this),this.imapSecure.subscribe(function(e){var t=r.pInt(this.imapPort());switch(e=r.pString(e)){case"0":993===t&&this.imapPort("143");break;case"1":143===t&&this.imapPort("993")}},this),this.smtpSecure.subscribe(function(e){var t=r.pInt(this.smtpPort());switch(e=r.pString(e)){case"0":(465===t||587===t)&&this.smtpPort("25");break;case"1":(25===t||587===t)&&this.smtpPort("465");break;case"2":(25===t||465===t)&&this.smtpPort("587")}},this),c.constructorEnd(this)}var s=t("_"),n=t("ko"),o=t("Enums"),a=t("Consts"),r=t("Utils"),l=t("../../Storages/AdminAjaxRemoteStorage.js"),c=t("kn"),u=t("KnoinAbstractViewModel");c.extendAsViewModel("PopupsDomainViewModel",i),i.prototype.onTestConnectionResponse=function(e,t){this.testing(!1),o.StorageResultType.Success===e&&t.Result?(this.testingDone(!0),this.testingImapError(!0!==t.Result.Imap),this.testingSmtpError(!0!==t.Result.Smtp),this.testingImapError()&&t.Result.Imap&&this.testingImapErrorDesc(t.Result.Imap),this.testingSmtpError()&&t.Result.Smtp&&this.testingSmtpErrorDesc(t.Result.Smtp)):(this.testingImapError(!0),this.testingSmtpError(!0))},i.prototype.onDomainCreateOrSaveResponse=function(e,i){if(this.saving(!1),o.StorageResultType.Success===e&&i)if(i.Result){var s=t("../../Boots/AdminApp.js");s.reloadDomainList(),this.closeCommand()}else o.Notification.DomainAlreadyExists===i.ErrorCode&&this.savingError("Domain already exists");else this.savingError("Unknown error")},i.prototype.onHide=function(){this.whiteListPage(!1)},i.prototype.onShow=function(e){this.saving(!1),this.whiteListPage(!1),this.testing(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.clearForm(),e&&(this.edit(!0),this.name(r.trim(e.Name)),this.imapServer(r.trim(e.IncHost)),this.imapPort(""+r.pInt(e.IncPort)),this.imapSecure(r.trim(e.IncSecure)),this.imapShortLogin(!!e.IncShortLogin),this.smtpServer(r.trim(e.OutHost)),this.smtpPort(""+r.pInt(e.OutPort)),this.smtpSecure(r.trim(e.OutSecure)),this.smtpShortLogin(!!e.OutShortLogin),this.smtpAuth(!!e.OutAuth),this.whiteList(r.trim(e.WhiteList)))},i.prototype.onFocus=function(){""===this.name()&&this.name.focused(!0)},i.prototype.clearForm=function(){this.edit(!1),this.whiteListPage(!1),this.savingError(""),this.name(""),this.name.focused(!1),this.imapServer(""),this.imapPort(""+a.Values.ImapDefaulPort),this.imapSecure(o.ServerSecure.None),this.imapShortLogin(!1),this.smtpServer(""),this.smtpPort(""+a.Values.SmtpDefaulPort),this.smtpSecure(o.ServerSecure.None),this.smtpShortLogin(!1),this.smtpAuth(!0),this.whiteList("")},e.exports=i}(t,e)},{"../../Boots/AdminApp.js":14,"../../Storages/AdminAjaxRemoteStorage.js":52,Consts:16,Enums:17,KnoinAbstractViewModel:42,Utils:22,_:37,kn:39,ko:34}],66:[function(e,t){!function(e,t){"use strict";function i(){l.call(this,"Popups","PopupsLanguages"),this.exp=n.observable(!1),this.languages=n.computed(function(){return s.map(a.languages(),function(e){return{key:e,selected:n.observable(!1),fullName:o.convertLangName(e)}})}),a.mainLanguage.subscribe(function(){this.resetMainLanguage()},this),r.constructorEnd(this)}var s=t("_"),n=t("ko"),o=t("Utils"),a=t("../../Storages/WebMailDataStorage.js"),r=t("kn"),l=t("KnoinAbstractViewModel");r.extendAsViewModel("PopupsLanguagesViewModel",i),i.prototype.languageEnName=function(e){return o.convertLangName(e,!0)},i.prototype.resetMainLanguage=function(){var e=a.mainLanguage();s.each(this.languages(),function(t){t.selected(t.key===e)})},i.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},i.prototype.onHide=function(){this.exp(!1)},i.prototype.changeLanguage=function(e){a.mainLanguage(e),this.cancelCommand()},e.exports=i}(t,e)},{"../../Storages/WebMailDataStorage.js":59,KnoinAbstractViewModel:42,Utils:22,_:37,kn:39,ko:34}],67:[function(e,t){!function(e,t){"use strict";function i(){d.call(this,"Popups","PopupsPlugin");var e=this;this.onPluginSettingsUpdateResponse=s.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=n.observable(""),this.name=n.observable(""),this.readme=n.observable(""),this.configures=n.observableArray([]),this.hasReadme=n.computed(function(){return""!==this.readme()},this),this.hasConfiguration=n.computed(function(){return 0 ');
-
-},{"./jquery.js":26}],16:[function(require,module,exports){
+module.exports = require('$')('');
+},{"$":26}],16:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
-module.exports = require('./jquery.js')(window.document);
-
-},{"./jquery.js":26}],17:[function(require,module,exports){
+module.exports = require('$')(window.document);
+},{"$":26}],17:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
-module.exports = require('./jquery.js')('html');
-
-},{"./jquery.js":26}],18:[function(require,module,exports){
+module.exports = require('$')('html');
+},{"$":26}],18:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
-module.exports = require('./jquery.js')(window);
-
-},{"./jquery.js":26}],19:[function(require,module,exports){
+module.exports = require('$')(window);
+},{"$":26}],19:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
-module.exports = require('./window.js')['rainloopAppData'] || {};
-},{"./window.js":32}],20:[function(require,module,exports){
+module.exports = require('window')['rainloopAppData'] || {};
+},{"window":32}],20:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = JSON;
},{}],21:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = Jua;
},{}],22:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
-var window = require('./window.js');
-module.exports = window.Notification && window.Notification.requestPermission ? window.Notification : null;
-},{"./window.js":32}],23:[function(require,module,exports){
+var w = require('window');
+module.exports = w.Notification && w.Notification.requestPermission ? w.Notification : null;
+},{"window":32}],23:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = crossroads;
},{}],24:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = hasher;
},{}],25:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = ifvisible;
},{}],26:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = $;
},{}],27:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = key;
},{}],28:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
@@ -6629,21 +6594,21 @@ module.exports = key;
(function (module, ko) {
'use strict';
-
+
var
- window = require('./window.js'),
- _ = require('./underscore.js'),
- $ = require('./jquery.js'),
- $window = require('./$window.js'),
- $doc = require('./$doc.js')
+ window = require('window'),
+ _ = require('_'),
+ $ = require('$'),
+ $window = require('$window'),
+ $doc = require('$doc')
;
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
var
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js')
+ Globals = require('Globals'),
+ Utils = require('Utils')
;
if (!Globals.bMobileDevice)
@@ -6681,7 +6646,7 @@ module.exports = key;
ko.bindingHandlers.tooltip2 = {
'init': function (oElement, fValueAccessor) {
var
- Globals = require('../Common/Globals.js'),
+ Globals = require('Globals'),
$oEl = $(oElement),
sClass = $oEl.data('tooltip-class') || '',
sPlacement = $oEl.data('tooltip-placement') || 'top'
@@ -6714,7 +6679,7 @@ module.exports = key;
var
$oEl = $(oElement),
- Globals = require('../Common/Globals.js')
+ Globals = require('Globals')
;
$oEl.tooltip({
@@ -6748,7 +6713,7 @@ module.exports = key;
ko.bindingHandlers.registrateBootstrapDropdown = {
'init': function (oElement) {
- var Globals = require('../Common/Globals.js');
+ var Globals = require('Globals');
Globals.aBootstrapDropdowns.push($(oElement));
}
};
@@ -6759,7 +6724,7 @@ module.exports = key;
{
var
$el = $(oElement),
- Utils = require('../Common/Utils.js')
+ Utils = require('Utils')
;
if (!$el.hasClass('open'))
@@ -6789,7 +6754,7 @@ module.exports = key;
ko.bindingHandlers.csstext = {
'init': function (oElement, fValueAccessor) {
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
{
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
@@ -6800,7 +6765,7 @@ module.exports = key;
}
},
'update': function (oElement, fValueAccessor) {
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
{
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
@@ -6868,8 +6833,8 @@ module.exports = key;
'init': function (oElement, fValueAccessor) {
var
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js')
+ Globals = require('Globals'),
+ Utils = require('Utils')
;
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
@@ -6891,14 +6856,14 @@ module.exports = key;
ko.bindingHandlers.i18nInit = {
'init': function (oElement) {
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
Utils.i18nToNode(oElement);
}
};
ko.bindingHandlers.i18nUpdate = {
'update': function (oElement, fValueAccessor) {
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
ko.utils.unwrapObservable(fValueAccessor());
Utils.i18nToNode(oElement);
}
@@ -6939,7 +6904,7 @@ module.exports = key;
'update': function (oElement, fValueAccessor) {
var
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
aValues = ko.utils.unwrapObservable(fValueAccessor()),
iValue = Utils.pInt(aValues[1]),
iSize = 0,
@@ -6973,8 +6938,8 @@ module.exports = key;
ko.bindingHandlers.draggable = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
var
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js')
+ Globals = require('Globals'),
+ Utils = require('Utils')
;
if (!Globals.bMobileDevice)
{
@@ -7056,7 +7021,7 @@ module.exports = key;
ko.bindingHandlers.droppable = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
- var Globals = require('../Common/Globals.js');
+ var Globals = require('Globals');
if (!Globals.bMobileDevice)
{
var
@@ -7098,7 +7063,7 @@ module.exports = key;
ko.bindingHandlers.nano = {
'init': function (oElement) {
- var Globals = require('../Common/Globals.js');
+ var Globals = require('Globals');
if (!Globals.bDisableNanoScroll)
{
$(oElement)
@@ -7195,7 +7160,7 @@ module.exports = key;
'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
var
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
EmailModel = require('../Models/EmailModel.js'),
$oEl = $(oElement),
@@ -7269,7 +7234,7 @@ module.exports = key;
'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
var
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
ContactTagModel = require('../Models/ContactTagModel.js'),
$oEl = $(oElement),
@@ -7384,7 +7349,7 @@ module.exports = key;
ko.extenders.trimmer = function (oTarget)
{
var
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
oResult = ko.computed({
'read': oTarget,
'write': function (sNewValue) {
@@ -7401,7 +7366,7 @@ module.exports = key;
ko.extenders.posInterer = function (oTarget, iDefault)
{
var
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
oResult = ko.computed({
'read': oTarget,
'write': function (sNewValue) {
@@ -7457,7 +7422,7 @@ module.exports = key;
ko.extenders.falseTimeout = function (oTarget, iOption)
{
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
oTarget.iTimeout = 0;
oTarget.subscribe(function (bValue) {
@@ -7482,7 +7447,7 @@ module.exports = key;
ko.observable.fn.validateEmail = function ()
{
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
this.hasError = ko.observable(false);
@@ -7497,7 +7462,7 @@ module.exports = key;
ko.observable.fn.validateSimpleEmail = function ()
{
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
this.hasError = ko.observable(false);
@@ -7512,7 +7477,7 @@ module.exports = key;
ko.observable.fn.validateFunc = function (fFunc)
{
- var Utils = require('../Common/Utils.js');
+ var Utils = require('Utils');
this.hasFuncError = ko.observable(false);
@@ -7532,51 +7497,42 @@ module.exports = key;
}(module, ko));
-},{"../Common/Globals.js":9,"../Common/Utils.js":14,"../Models/ContactTagModel.js":42,"../Models/EmailModel.js":43,"./$doc.js":16,"./$window.js":18,"./jquery.js":26,"./underscore.js":31,"./window.js":32}],29:[function(require,module,exports){
+},{"$":26,"$doc":16,"$window":18,"../Models/ContactTagModel.js":42,"../Models/EmailModel.js":43,"Globals":9,"Utils":14,"_":31,"window":32}],29:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = moment;
},{}],30:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = ssm;
},{}],31:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = _;
},{}],32:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-'use strict';
-
module.exports = window;
-
},{}],33:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- hasher = require('../External/hasher.js'),
- crossroads = require('../External/crossroads.js'),
- $html = require('../External/$html.js'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ hasher = require('hasher'),
+ crossroads = require('crossroads'),
+ $html = require('$html'),
- Globals = require('../Common/Globals.js'),
- Plugins = require('../Common/Plugins.js'),
- Utils = require('../Common/Utils.js'),
+ Globals = require('Globals'),
+ Plugins = require('Plugins'),
+ Utils = require('Utils'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -8007,12 +7963,12 @@ module.exports = window;
module.exports = new Knoin();
-}(module));
-},{"../Common/Globals.js":9,"../Common/Plugins.js":12,"../Common/Utils.js":14,"../External/$html.js":17,"../External/crossroads.js":23,"../External/hasher.js":24,"../External/jquery.js":26,"../External/ko.js":28,"../External/underscore.js":31,"../Knoin/KnoinAbstractViewModel.js":36}],34:[function(require,module,exports){
+}(module, require));
+},{"$":26,"$html":17,"Globals":9,"KnoinAbstractViewModel":36,"Plugins":12,"Utils":14,"_":31,"crossroads":23,"hasher":24,"ko":28}],34:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
-
+
'use strict';
/**
@@ -8030,17 +7986,17 @@ module.exports = window;
module.exports = KnoinAbstractBoot;
-}(module));
+}(module, require));
},{}],35:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- crossroads = require('../External/crossroads.js'),
- Utils = require('../Common/Utils.js')
+ crossroads = require('crossroads'),
+ Utils = require('Utils')
;
/**
@@ -8121,21 +8077,21 @@ module.exports = window;
module.exports = KnoinAbstractScreen;
-}(module));
-},{"../Common/Utils.js":14,"../External/crossroads.js":23}],36:[function(require,module,exports){
+}(module, require));
+},{"Utils":14,"crossroads":23}],36:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
- $window = require('../External/$window.js'),
+ ko = require('ko'),
+ $window = require('$window'),
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js')
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils')
;
/**
@@ -8233,16 +8189,16 @@ module.exports = window;
module.exports = KnoinAbstractViewModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$window.js":18,"../External/ko.js":28}],37:[function(require,module,exports){
+}(module, require));
+},{"$window":18,"Enums":7,"Globals":9,"Utils":14,"ko":28}],37:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js')
+ ko = require('ko')
;
/**
@@ -8264,26 +8220,26 @@ module.exports = window;
*/
AccountModel.prototype.changeAccountLink = function ()
{
- return require('../Common/LinkBuilder.js').change(this.email);
+ return require('LinkBuilder').change(this.email);
};
module.exports = AccountModel;
-}(module));
-},{"../Common/LinkBuilder.js":10,"../External/ko.js":28}],38:[function(require,module,exports){
+}(module, require));
+},{"LinkBuilder":10,"ko":28}],38:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
- var
- window = require('../External/window.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js')
- ;
+ var
+ window = require('window'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder')
+ ;
+
/**
* @constructor
*/
@@ -8522,17 +8478,17 @@ module.exports = window;
module.exports = AttachmentModel;
-}(module));
-},{"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/window.js":32}],39:[function(require,module,exports){
+}(module, require));
+},{"Globals":9,"LinkBuilder":10,"Utils":14,"window":32}],39:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../External/ko.js'),
- Utils = require('../Common/Utils.js')
+ ko = require('ko'),
+ Utils = require('Utils')
;
/**
@@ -8599,22 +8555,22 @@ module.exports = window;
module.exports = ComposeAttachmentModel;
-}(module));
-},{"../Common/Utils.js":14,"../External/ko.js":28}],40:[function(require,module,exports){
+}(module, require));
+},{"Utils":14,"ko":28}],40:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js')
+ _ = require('_'),
+ ko = require('ko'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder')
;
-
+
/**
* @constructor
*/
@@ -8741,18 +8697,18 @@ module.exports = window;
module.exports = ContactModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/ko.js":28,"../External/underscore.js":31}],41:[function(require,module,exports){
+}(module, require));
+},{"Enums":7,"LinkBuilder":10,"Utils":14,"_":31,"ko":28}],41:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js')
+ ko = require('ko'),
+ Enums = require('Enums'),
+ Utils = require('Utils')
;
/**
@@ -8785,17 +8741,17 @@ module.exports = window;
module.exports = ContactPropertyModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Utils.js":14,"../External/ko.js":28}],42:[function(require,module,exports){
+}(module, require));
+},{"Enums":7,"Utils":14,"ko":28}],42:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../External/ko.js'),
- Utils = require('../Common/Utils.js')
+ ko = require('ko'),
+ Utils = require('Utils')
;
/**
@@ -8844,17 +8800,17 @@ module.exports = window;
module.exports = ContactTagModel;
-}(module));
-},{"../Common/Utils.js":14,"../External/ko.js":28}],43:[function(require,module,exports){
+}(module, require));
+},{"Utils":14,"ko":28}],43:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js')
+ Enums = require('Enums'),
+ Utils = require('Utils')
;
/**
@@ -9223,17 +9179,17 @@ module.exports = window;
module.exports = EmailModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Utils.js":14}],44:[function(require,module,exports){
+}(module, require));
+},{"Enums":7,"Utils":14}],44:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../External/ko.js'),
- Enums = require('../Common/Enums.js')
+ ko = require('ko'),
+ Enums = require('Enums')
;
/**
@@ -9286,18 +9242,18 @@ module.exports = window;
module.exports = FilterConditionModel;
-}(module));
-},{"../Common/Enums.js":7,"../External/ko.js":28}],45:[function(require,module,exports){
+}(module, require));
+},{"Enums":7,"ko":28}],45:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
+ ko = require('ko'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
FilterConditionModel = require('./FilterConditionModel.js')
;
@@ -9381,23 +9337,23 @@ module.exports = window;
module.exports = FilterModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Utils.js":14,"../External/ko.js":28,"./FilterConditionModel.js":44}],46:[function(require,module,exports){
+}(module, require));
+},{"./FilterConditionModel.js":44,"Enums":7,"Utils":14,"ko":28}],46:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- $window = require('../External/$window.js'),
+ _ = require('_'),
+ ko = require('ko'),
+ $window = require('$window'),
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- Events = require('../Common/Events.js')
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ Events = require('Events')
;
/**
@@ -9429,7 +9385,7 @@ module.exports = window;
this.actionBlink = ko.observable(false).extend({'falseTimeout': 1000});
this.nameForEdit = ko.observable('');
-
+
this.privateMessageCountAll = ko.observable(0);
this.privateMessageCountUnread = ko.observable(0);
@@ -9737,17 +9693,17 @@ module.exports = window;
module.exports = FolderModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$window.js":18,"../External/ko.js":28,"../External/underscore.js":31}],47:[function(require,module,exports){
+}(module, require));
+},{"$window":18,"Enums":7,"Events":8,"Globals":9,"Utils":14,"_":31,"ko":28}],47:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
- Utils = require('../Common/Utils.js')
+ ko = require('ko'),
+ Utils = require('Utils')
;
/**
@@ -9788,26 +9744,26 @@ module.exports = window;
module.exports = IdentityModel;
-}(module));
-},{"../Common/Utils.js":14,"../External/ko.js":28}],48:[function(require,module,exports){
+}(module, require));
+},{"Utils":14,"ko":28}],48:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- moment = require('../External/moment.js'),
- $window = require('../External/$window.js'),
- $div = require('../External/$div.js'),
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ moment = require('moment'),
+ $window = require('$window'),
+ $div = require('$div'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
EmailModel = require('./EmailModel.js'),
AttachmentModel = require('./AttachmentModel.js')
@@ -11076,16 +11032,16 @@ module.exports = window;
module.exports = MessageModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/$div.js":15,"../External/$window.js":18,"../External/jquery.js":26,"../External/ko.js":28,"../External/moment.js":29,"../External/underscore.js":31,"../External/window.js":32,"../Storages/WebMailDataStorage.js":74,"./AttachmentModel.js":38,"./EmailModel.js":43}],49:[function(require,module,exports){
+}(module, require));
+},{"$":26,"$div":15,"$window":18,"../Storages/WebMailDataStorage.js":74,"./AttachmentModel.js":38,"./EmailModel.js":43,"Enums":7,"LinkBuilder":10,"Utils":14,"_":31,"ko":28,"moment":29,"window":32}],49:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../External/ko.js')
+ ko = require('ko')
;
/**
@@ -11121,25 +11077,25 @@ module.exports = window;
module.exports = OpenPgpKeyModel;
-}(module));
-},{"../External/ko.js":28}],50:[function(require,module,exports){
+}(module, require));
+},{"ko":28}],50:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
-
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js')
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+
+ kn = require('kn'),
+ KnoinAbstractScreen = require('KnoinAbstractScreen')
;
/**
@@ -11323,17 +11279,17 @@ module.exports = window;
module.exports = AbstractSettings;
-}(module));
-},{"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/ko.js":28,"../External/underscore.js":31,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractScreen.js":35}],51:[function(require,module,exports){
+}(module, require));
+},{"$":26,"Globals":9,"KnoinAbstractScreen":35,"LinkBuilder":10,"Utils":14,"_":31,"kn":33,"ko":28}],51:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- _ = require('../External/underscore.js'),
- KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js')
+ _ = require('_'),
+ KnoinAbstractScreen = require('KnoinAbstractScreen')
;
/**
@@ -11356,24 +11312,24 @@ module.exports = window;
module.exports = LoginScreen;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../External/underscore.js":31,"../Knoin/KnoinAbstractScreen.js":35,"../ViewModels/LoginViewModel.js":76}],52:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../ViewModels/LoginViewModel.js":76,"KnoinAbstractScreen":35,"_":31}],52:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
- $html = require('../External/$html.js'),
-
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- Events = require('../Common/Events.js'),
+ _ = require('_'),
+ $html = require('$html'),
- KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ Events = require('Events'),
+
+ KnoinAbstractScreen = require('KnoinAbstractScreen'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
@@ -11418,7 +11374,7 @@ module.exports = window;
sEmail = Data.accountEmail(),
nFoldersInboxUnreadCount = Data.foldersInboxUnreadCount()
;
-
+
RL.setTitle(('' === sEmail ? '' :
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
};
@@ -11510,7 +11466,7 @@ module.exports = window;
});
Events.sub('mailbox.inbox-unread-count', function (nCount) {
- Data.foldersInboxUnreadCount(nCount)
+ Data.foldersInboxUnreadCount(nCount);
});
Data.foldersInboxUnreadCount.subscribe(function () {
@@ -11565,20 +11521,20 @@ module.exports = window;
module.exports = MailBoxScreen;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$html.js":17,"../External/underscore.js":31,"../Knoin/KnoinAbstractScreen.js":35,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/MailBoxFolderListViewModel.js":77,"../ViewModels/MailBoxMessageListViewModel.js":78,"../ViewModels/MailBoxMessageViewViewModel.js":79,"../ViewModels/MailBoxSystemDropDownViewModel.js":80}],53:[function(require,module,exports){
+}(module, require));
+},{"$html":17,"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/MailBoxFolderListViewModel.js":77,"../ViewModels/MailBoxMessageListViewModel.js":78,"../ViewModels/MailBoxMessageViewViewModel.js":79,"../ViewModels/MailBoxSystemDropDownViewModel.js":80,"Enums":7,"Events":8,"Globals":9,"KnoinAbstractScreen":35,"Utils":14,"_":31}],53:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- Globals = require('../Common/Globals.js'),
+ _ = require('_'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ Globals = require('Globals'),
AbstractSettings = require('./AbstractSettings.js')
;
@@ -11591,7 +11547,7 @@ module.exports = window;
{
var
RL = require('../Boots/RainLoopApp.js'),
-
+
SettingsSystemDropDownViewModel = require('../ViewModels/SettingsSystemDropDownViewModel.js'),
SettingsMenuViewModel = require('../ViewModels/SettingsMenuViewModel.js'),
SettingsPaneViewModel = require('../ViewModels/SettingsPaneViewModel.js')
@@ -11615,34 +11571,34 @@ module.exports = window;
SettingsScreen.prototype.onShow = function ()
{
var RL = require('../Boots/RainLoopApp.js');
-
+
RL.setTitle(this.sSettingsTitle);
Globals.keyScope(Enums.KeyState.Settings);
};
module.exports = SettingsScreen;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/underscore.js":31,"../ViewModels/SettingsMenuViewModel.js":98,"../ViewModels/SettingsPaneViewModel.js":99,"../ViewModels/SettingsSystemDropDownViewModel.js":100,"./AbstractSettings.js":50}],54:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../ViewModels/SettingsMenuViewModel.js":98,"../ViewModels/SettingsPaneViewModel.js":99,"../ViewModels/SettingsSystemDropDownViewModel.js":100,"./AbstractSettings.js":50,"Enums":7,"Globals":9,"Utils":14,"_":31}],54:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- window = require('../External/window.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ window = require('window'),
+ _ = require('_'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
PopupsAddAccountViewModel = require('../ViewModels/Popups/PopupsAddAccountViewModel.js')
;
@@ -11726,20 +11682,20 @@ module.exports = window;
module.exports = SettingsAccounts;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/ko.js":28,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddAccountViewModel.js":81}],55:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddAccountViewModel.js":81,"Enums":7,"LinkBuilder":10,"Utils":14,"_":31,"kn":33,"ko":28,"window":32}],55:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
+ _ = require('_'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
;
@@ -11849,18 +11805,18 @@ module.exports = window;
module.exports = SettingsChangePassword;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Utils.js":14,"../External/ko.js":28,"../External/underscore.js":31,"../Storages/WebMailAjaxRemoteStorage.js":72}],56:[function(require,module,exports){
+}(module, require));
+},{"../Storages/WebMailAjaxRemoteStorage.js":72,"Enums":7,"Utils":14,"_":31,"ko":28}],56:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../External/ko.js'),
+ ko = require('ko'),
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
Data = require('../Storages/WebMailDataStorage.js')
@@ -11909,17 +11865,17 @@ module.exports = window;
module.exports = SettingsContacts;
-}(module));
-},{"../Common/Utils.js":14,"../External/ko.js":28,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74}],57:[function(require,module,exports){
+}(module, require));
+},{"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"Utils":14,"ko":28}],57:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- ko = require('../External/ko.js'),
- Utils = require('../Common/Utils.js')
+ ko = require('ko'),
+ Utils = require('Utils')
;
/**
@@ -11943,7 +11899,7 @@ module.exports = window;
SettingsFilters.prototype.addFilter = function ()
{
var
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
FilterModel = require('../Models/FilterModel.js'),
PopupsFilterViewModel = require('../ViewModels/Popups/PopupsFilterViewModel.js')
;
@@ -11953,21 +11909,21 @@ module.exports = window;
module.exports = SettingsFilters;
-}(module));
-},{"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Models/FilterModel.js":45,"../ViewModels/Popups/PopupsFilterViewModel.js":88}],58:[function(require,module,exports){
+}(module, require));
+},{"../Models/FilterModel.js":45,"../ViewModels/Popups/PopupsFilterViewModel.js":88,"Utils":14,"kn":33,"ko":28}],58:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
+ ko = require('ko'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
AppSettings = require('../Storages/AppSettings.js'),
LocalStorage = require('../Storages/LocalStorage.js'),
@@ -12176,28 +12132,28 @@ module.exports = window;
module.exports = SettingsFolders;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/AppSettings.js":68,"../Storages/LocalStorage.js":69,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsFolderCreateViewModel.js":90,"../ViewModels/Popups/PopupsFolderSystemViewModel.js":91}],59:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/LocalStorage.js":69,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsFolderCreateViewModel.js":90,"../ViewModels/Popups/PopupsFolderSystemViewModel.js":91,"Enums":7,"Utils":14,"kn":33,"ko":28}],59:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- $ = require('../External/jquery.js'),
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Consts = require('../Common/Consts.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ $ = require('$'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js')
;
@@ -12355,28 +12311,28 @@ module.exports = window;
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
-
+
module.exports = SettingsGeneral;
-}(module));
-},{"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsLanguagesViewModel.js":95}],60:[function(require,module,exports){
+}(module, require));
+},{"$":26,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsLanguagesViewModel.js":95,"Consts":6,"Enums":7,"Globals":9,"LinkBuilder":10,"Utils":14,"kn":33,"ko":28}],60:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
+ ko = require('ko'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ NewHtmlEditorWrapper = require('NewHtmlEditorWrapper'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
PopupsIdentityViewModel = require('../ViewModels/Popups/PopupsIdentityViewModel.js')
;
@@ -12596,20 +12552,20 @@ module.exports = window;
module.exports = SettingsIdentities;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/NewHtmlEditorWrapper.js":11,"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsIdentityViewModel.js":93}],61:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsIdentityViewModel.js":93,"Enums":7,"NewHtmlEditorWrapper":11,"Utils":14,"kn":33,"ko":28}],61:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ NewHtmlEditorWrapper = require('NewHtmlEditorWrapper'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
@@ -12700,18 +12656,18 @@ module.exports = window;
module.exports = SettingsIdentity;
-}(module));
-},{"../Common/Enums.js":7,"../Common/NewHtmlEditorWrapper.js":11,"../Common/Utils.js":14,"../External/ko.js":28,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74}],62:[function(require,module,exports){
+}(module, require));
+},{"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"Enums":7,"NewHtmlEditorWrapper":11,"Utils":14,"ko":28}],62:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- ko = require('../External/ko.js'),
+ ko = require('ko'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
Data = require('../Storages/WebMailDataStorage.js'),
@@ -12790,24 +12746,24 @@ module.exports = window;
module.exports = SettingsOpenPGP;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js":82,"../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js":92,"../ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js":97}],63:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js":82,"../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js":92,"../ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js":97,"kn":33,"ko":28}],63:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
-
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
PopupsTwoFactorTestViewModel = require('../ViewModels/Popups/PopupsTwoFactorTestViewModel.js')
;
@@ -12961,11 +12917,11 @@ module.exports = window;
module.exports = SettingsSecurity;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../ViewModels/Popups/PopupsTwoFactorTestViewModel.js":96}],64:[function(require,module,exports){
+}(module, require));
+},{"../Storages/WebMailAjaxRemoteStorage.js":72,"../ViewModels/Popups/PopupsTwoFactorTestViewModel.js":96,"Enums":7,"Globals":9,"Utils":14,"kn":33,"ko":28}],64:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
@@ -12975,7 +12931,7 @@ module.exports = window;
function SettingsSocial()
{
var
- Utils = require('../Common/Utils.js'),
+ Utils = require('Utils'),
RL = require('../Boots/RainLoopApp.js'),
Data = require('../Storages/WebMailDataStorage.js')
;
@@ -13040,22 +12996,22 @@ module.exports = window;
module.exports = SettingsSocial;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Utils.js":14,"../Storages/WebMailDataStorage.js":74}],65:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailDataStorage.js":74,"Utils":14}],65:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
- ko = require('../External/ko.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ window = require('window'),
+ $ = require('$'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
@@ -13115,7 +13071,7 @@ module.exports = window;
'url': sUrl,
'dataType': 'json'
}).done(function(aData) {
-
+
if (aData && Utils.isArray(aData) && 2 === aData.length)
{
if (oThemeLink && oThemeLink[0] && (!oThemeStyle || !oThemeStyle[0]))
@@ -13173,24 +13129,24 @@ module.exports = window;
module.exports = SettingsThemes;
-}(module));
-},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/ko.js":28,"../External/window.js":32,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74}],66:[function(require,module,exports){
+}(module, require));
+},{"$":26,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"Enums":7,"LinkBuilder":10,"Utils":14,"ko":28,"window":32}],66:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
+ window = require('window'),
+ $ = require('$'),
- Consts = require('../Common/Consts.js'),
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- Plugins = require('../Common/Plugins.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Consts = require('Consts'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ Plugins = require('Plugins'),
+ LinkBuilder = require('LinkBuilder'),
AppSettings = require('./AppSettings.js')
;
@@ -13485,21 +13441,21 @@ module.exports = window;
module.exports = AbstractAjaxRemoteStorage;
-}(module));
-},{"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Plugins.js":12,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/window.js":32,"./AppSettings.js":68}],67:[function(require,module,exports){
+}(module, require));
+},{"$":26,"./AppSettings.js":68,"Consts":6,"Enums":7,"Globals":9,"LinkBuilder":10,"Plugins":12,"Utils":14,"window":32}],67:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
-
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+
AppSettings = require('./AppSettings.js')
;
-
+
/**
* @constructor
*/
@@ -13579,18 +13535,17 @@ module.exports = window;
module.exports = AbstractData;
-}(module));
-},{"../Common/Enums.js":7,"../Common/Utils.js":14,"./AppSettings.js":68}],68:[function(require,module,exports){
+}(module, require));
+},{"./AppSettings.js":68,"Enums":7,"Utils":14}],68:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- AppData = require('../External/AppData.js'),
-
- Utils = require('../Common/Utils.js')
+ AppData = require('AppData'),
+ Utils = require('Utils')
;
/**
@@ -13644,17 +13599,17 @@ module.exports = window;
module.exports = new AppSettings();
-}(module));
-},{"../Common/Utils.js":14,"../External/AppData.js":19}],69:[function(require,module,exports){
+}(module, require));
+},{"AppData":19,"Utils":14}],69:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
-
+ _ = require('_'),
+
CookieDriver = require('./LocalStorages/CookieDriver.js'),
LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js')
;
@@ -13670,6 +13625,8 @@ module.exports = window;
})
;
+ this.oDriver = null;
+
if (NextStorageDriver)
{
NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
@@ -13700,20 +13657,20 @@ module.exports = window;
module.exports = new LocalStorage();
-}(module));
-},{"../External/underscore.js":31,"./LocalStorages/CookieDriver.js":70,"./LocalStorages/LocalStorageDriver.js":71}],70:[function(require,module,exports){
+}(module, require));
+},{"./LocalStorages/CookieDriver.js":70,"./LocalStorages/LocalStorageDriver.js":71,"_":31}],70:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- $ = require('../../External/jquery.js'),
- JSON = require('../../External/JSON.js'),
-
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js')
+ $ = require('$'),
+ JSON = require('JSON'),
+
+ Consts = require('Consts'),
+ Utils = require('Utils')
;
/**
@@ -13792,20 +13749,20 @@ module.exports = window;
module.exports = CookieDriver;
-}(module));
-},{"../../Common/Consts.js":6,"../../Common/Utils.js":14,"../../External/JSON.js":20,"../../External/jquery.js":26}],71:[function(require,module,exports){
+}(module, require));
+},{"$":26,"Consts":6,"JSON":20,"Utils":14}],71:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../../External/window.js'),
- JSON = require('../../External/JSON.js'),
-
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js')
+ window = require('window'),
+ JSON = require('JSON'),
+
+ Consts = require('Consts'),
+ Utils = require('Utils')
;
/**
@@ -13881,26 +13838,26 @@ module.exports = window;
module.exports = LocalStorageDriver;
-}(module));
-},{"../../Common/Consts.js":6,"../../Common/Utils.js":14,"../../External/JSON.js":20,"../../External/window.js":32}],72:[function(require,module,exports){
+}(module, require));
+},{"Consts":6,"JSON":20,"Utils":14,"window":32}],72:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- _ = require('../External/underscore.js'),
+ _ = require('_'),
- Utils = require('../Common/Utils.js'),
- Consts = require('../Common/Consts.js'),
- Globals = require('../Common/Globals.js'),
- Base64 = require('../Common/Base64.js'),
+ Utils = require('Utils'),
+ Consts = require('Consts'),
+ Globals = require('Globals'),
+ Base64 = require('Base64'),
AppSettings = require('./AppSettings.js'),
Cache = require('./WebMailCacheStorage.js'),
Data = require('./WebMailDataStorage.js'),
-
+
AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js')
;
@@ -14696,20 +14653,20 @@ module.exports = window;
module.exports = new WebMailAjaxRemoteStorage();
-}(module));
-},{"../Common/Base64.js":5,"../Common/Consts.js":6,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/underscore.js":31,"./AbstractAjaxRemoteStorage.js":66,"./AppSettings.js":68,"./WebMailCacheStorage.js":73,"./WebMailDataStorage.js":74}],73:[function(require,module,exports){
+}(module, require));
+},{"./AbstractAjaxRemoteStorage.js":66,"./AppSettings.js":68,"./WebMailCacheStorage.js":73,"./WebMailDataStorage.js":74,"Base64":5,"Consts":6,"Globals":9,"Utils":14,"_":31}],73:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../External/underscore.js'),
-
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ _ = require('_'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
AppSettings = require('./AppSettings.js')
;
@@ -15046,33 +15003,33 @@ module.exports = window;
module.exports = new WebMailCacheStorage();
-}(module));
-},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/underscore.js":31,"./AppSettings.js":68}],74:[function(require,module,exports){
+}(module, require));
+},{"./AppSettings.js":68,"Enums":7,"LinkBuilder":10,"Utils":14,"_":31}],74:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- moment = require('../External/moment.js'),
- $div = require('../External/$div.js'),
- NotificationClass = require('../External/NotificationClass.js'),
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ moment = require('moment'),
+ $div = require('$div'),
+ NotificationClass = require('NotificationClass'),
- Consts = require('../Common/Consts.js'),
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Consts = require('Consts'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
AppSettings = require('./AppSettings.js'),
Cache = require('./WebMailCacheStorage.js'),
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
MessageModel = require('../Models/MessageModel.js'),
@@ -16075,24 +16032,24 @@ module.exports = window;
module.exports = new WebMailDataStorage();
-}(module));
+}(module, require));
-},{"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/$div.js":15,"../External/NotificationClass.js":22,"../External/jquery.js":26,"../External/ko.js":28,"../External/moment.js":29,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Models/MessageModel.js":48,"./AbstractData.js":67,"./AppSettings.js":68,"./LocalStorage.js":69,"./WebMailCacheStorage.js":73}],75:[function(require,module,exports){
+},{"$":26,"$div":15,"../Models/MessageModel.js":48,"./AbstractData.js":67,"./AppSettings.js":68,"./LocalStorage.js":69,"./WebMailCacheStorage.js":73,"Consts":6,"Enums":7,"Globals":9,"LinkBuilder":10,"NotificationClass":22,"Utils":14,"_":31,"kn":33,"ko":28,"moment":29,"window":32}],75:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- window = require('../External/window.js'),
- key = require('../External/key.js'),
+ _ = require('_'),
+ ko = require('ko'),
+ window = require('window'),
+ key = require('key'),
- Enums = require('../Common/Enums.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
@@ -16101,8 +16058,8 @@ module.exports = window;
PopupsKeyboardShortcutsHelpViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'),
PopupsAddAccountViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -16202,30 +16159,30 @@ module.exports = window;
module.exports = AbstractSystemDropDownViewModel;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/key.js":27,"../External/ko.js":28,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js":94}],76:[function(require,module,exports){
+}(module, require));
+},{"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js":94,"Enums":7,"KnoinAbstractViewModel":36,"LinkBuilder":10,"Utils":14,"_":31,"key":27,"kn":33,"ko":28,"window":32}],76:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
- Utils = require('../Common/Utils.js'),
- Enums = require('../Common/Enums.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Utils = require('Utils'),
+ Enums = require('Enums'),
+ LinkBuilder = require('LinkBuilder'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'),
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel'),
PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js')
;
@@ -16499,7 +16456,7 @@ module.exports = window;
if (0 === iErrorCode)
{
self.submitRequest(true);
-
+
var RL = require('../Boots/RainLoopApp.js');
RL.loginAndLogoutReload();
}
@@ -16578,25 +16535,25 @@ module.exports = window;
module.exports = LoginViewModel;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/ko.js":28,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsLanguagesViewModel.js":95}],77:[function(require,module,exports){
+}(module, require));
+},{"$":26,"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsLanguagesViewModel.js":95,"Enums":7,"KnoinAbstractViewModel":36,"LinkBuilder":10,"Utils":14,"_":31,"kn":33,"ko":28,"window":32}],77:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../External/window.js'),
- $ = require('../External/jquery.js'),
- ko = require('../External/ko.js'),
- key = require('../External/key.js'),
- $html = require('../External/$html.js'),
+ window = require('window'),
+ $ = require('$'),
+ ko = require('ko'),
+ key = require('key'),
+ $html = require('$html'),
- Utils = require('../Common/Utils.js'),
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Utils = require('Utils'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ LinkBuilder = require('LinkBuilder'),
AppSettings = require('../Storages/AppSettings.js'),
Cache = require('../Storages/WebMailCacheStorage.js'),
@@ -16606,8 +16563,8 @@ module.exports = window;
PopupsFolderCreateViewModel = require('./Popups/PopupsFolderCreateViewModel.js'),
PopupsContactsViewModel = require('./Popups/PopupsContactsViewModel.js'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -16862,38 +16819,38 @@ module.exports = window;
module.exports = MailBoxFolderListViewModel;
-}(module));
+}(module, require));
-},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/$html.js":17,"../External/jquery.js":26,"../External/key.js":27,"../External/ko.js":28,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/AppSettings.js":68,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86,"./Popups/PopupsContactsViewModel.js":87,"./Popups/PopupsFolderCreateViewModel.js":90}],78:[function(require,module,exports){
+},{"$":26,"$html":17,"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86,"./Popups/PopupsContactsViewModel.js":87,"./Popups/PopupsFolderCreateViewModel.js":90,"Enums":7,"Globals":9,"KnoinAbstractViewModel":36,"LinkBuilder":10,"Utils":14,"key":27,"kn":33,"ko":28,"window":32}],78:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- $ = require('../External/jquery.js'),
- _ = require('../External/underscore.js'),
- ko = require('../External/ko.js'),
- key = require('../External/key.js'),
- ifvisible = require('../External/ifvisible.js'),
- Jua = require('../External/Jua.js'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ key = require('key'),
+ ifvisible = require('ifvisible'),
+ Jua = require('Jua'),
- Enums = require('../Common/Enums.js'),
- Consts = require('../Common/Consts.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
- Events = require('../Common/Events.js'),
- Selector = require('../Common/Selector.js'),
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+ Events = require('Events'),
+ Selector = require('Selector'),
AppSettings = require('../Storages/AppSettings.js'),
Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'),
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel'),
PopupsComposeViewModel = require('./Popups/PopupsComposeViewModel.js'),
PopupsAdvancedSearchViewModel = require('./Popups/PopupsAdvancedSearchViewModel.js'),
@@ -17174,6 +17131,7 @@ module.exports = window;
{
if (this.canBeMoved())
{
+ var RL = require('../Boots/RainLoopApp.js');
RL.moveMessagesToFolder(
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy);
@@ -17261,7 +17219,8 @@ module.exports = window;
var
aUids = [],
oFolder = null,
- iAlreadyUnread = 0
+ iAlreadyUnread = 0,
+ RL = require('../Boots/RainLoopApp.js')
;
if (Utils.isUnd(aMessages))
@@ -17341,7 +17300,8 @@ module.exports = window;
{
var
oFolder = null,
- aMessages = Data.messageList()
+ aMessages = Data.messageList(),
+ RL = require('../Boots/RainLoopApp.js')
;
if ('' !== sFolderFullNameRaw)
@@ -17494,7 +17454,8 @@ module.exports = window;
MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
{
var
- self = this
+ self = this,
+ RL = require('../Boots/RainLoopApp.js')
;
this.oContentVisible = $('.b-content', oDom);
@@ -17525,6 +17486,7 @@ module.exports = window;
oMessage.lastInCollapsedThreadLoading(true);
oMessage.lastInCollapsedThread(!oMessage.lastInCollapsedThread());
+
RL.reloadMessageList();
}
@@ -17755,20 +17717,23 @@ module.exports = window;
return false;
}
- var oJua = new Jua({
- 'action': LinkBuilder.append(),
- 'name': 'AppendFile',
- 'queueSize': 1,
- 'multipleSizeLimit': 1,
- 'disableFolderDragAndDrop': true,
- 'hidden': {
- 'Folder': function () {
- return Data.currentFolderFullNameRaw();
- }
- },
- 'dragAndDropElement': this.dragOverArea(),
- 'dragAndDropBodyElement': this.dragOverBodyArea()
- });
+ var
+ RL = require('../Boots/RainLoopApp.js'),
+ oJua = new Jua({
+ 'action': LinkBuilder.append(),
+ 'name': 'AppendFile',
+ 'queueSize': 1,
+ 'multipleSizeLimit': 1,
+ 'disableFolderDragAndDrop': true,
+ 'hidden': {
+ 'Folder': function () {
+ return Data.currentFolderFullNameRaw();
+ }
+ },
+ 'dragAndDropElement': this.dragOverArea(),
+ 'dragAndDropBodyElement': this.dragOverBodyArea()
+ })
+ ;
oJua
.on('onDragEnter', _.bind(function () {
@@ -17802,26 +17767,26 @@ module.exports = window;
module.exports = MailBoxMessageListViewModel;
-}(module));
+}(module, require));
-},{"../Boots/RainLoopApp.js":4,"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Selector.js":13,"../Common/Utils.js":14,"../External/Jua.js":21,"../External/ifvisible.js":25,"../External/jquery.js":26,"../External/key.js":27,"../External/ko.js":28,"../External/underscore.js":31,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsAdvancedSearchViewModel.js":83,"./Popups/PopupsComposeViewModel.js":86,"./Popups/PopupsFolderClearViewModel.js":89}],79:[function(require,module,exports){
+},{"$":26,"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsAdvancedSearchViewModel.js":83,"./Popups/PopupsComposeViewModel.js":86,"./Popups/PopupsFolderClearViewModel.js":89,"Consts":6,"Enums":7,"Events":8,"Globals":9,"Jua":21,"KnoinAbstractViewModel":36,"LinkBuilder":10,"Selector":13,"Utils":14,"_":31,"ifvisible":25,"key":27,"kn":33,"ko":28}],79:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- $ = require('../External/jquery.js'),
- ko = require('../External/ko.js'),
- key = require('../External/key.js'),
- $html = require('../External/$html.js'),
+ $ = require('$'),
+ ko = require('ko'),
+ key = require('key'),
+ $html = require('$html'),
- Consts = require('../Common/Consts.js'),
- Enums = require('../Common/Enums.js'),
- Globals = require('../Common/Globals.js'),
- Utils = require('../Common/Utils.js'),
- Events = require('../Common/Events.js'),
+ Consts = require('Consts'),
+ Enums = require('Enums'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ Events = require('Events'),
Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
@@ -17829,8 +17794,8 @@ module.exports = window;
PopupsComposeViewModel = require('./Popups/PopupsComposeViewModel.js'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -18527,16 +18492,16 @@ module.exports = window;
module.exports = MailBoxMessageViewViewModel;
-}(module));
-},{"../Boots/RainLoopApp.js":4,"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$html.js":17,"../External/jquery.js":26,"../External/key.js":27,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86}],80:[function(require,module,exports){
+}(module, require));
+},{"$":26,"$html":17,"../Boots/RainLoopApp.js":4,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86,"Consts":6,"Enums":7,"Events":8,"Globals":9,"KnoinAbstractViewModel":36,"Utils":14,"key":27,"kn":33,"ko":28}],80:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
;
@@ -18554,26 +18519,26 @@ module.exports = window;
module.exports = MailBoxSystemDropDownViewModel;
-}(module));
+}(module, require));
-},{"../Knoin/Knoin.js":33,"./AbstractSystemDropDownViewModel.js":75}],81:[function(require,module,exports){
+},{"./AbstractSystemDropDownViewModel.js":75,"kn":33}],81:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
+ _ = require('_'),
+ ko = require('ko'),
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -18674,23 +18639,23 @@ module.exports = window;
module.exports = PopupsAddAccountViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../External/underscore.js":31,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72}],82:[function(require,module,exports){
+}(module, require));
+},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"_":31,"kn":33,"ko":28}],82:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../../External/ko.js'),
+ ko = require('ko'),
- Utils = require('../../Common/Utils.js'),
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -18786,24 +18751,24 @@ module.exports = window;
module.exports = PopupsAddOpenPgpKeyViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],83:[function(require,module,exports){
+}(module, require));
+},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailDataStorage.js":74,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],83:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../../External/ko.js'),
- moment = require('../../External/moment.js'),
-
- Utils = require('../../Common/Utils.js'),
+ ko = require('ko'),
+ moment = require('moment'),
+
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -18944,23 +18909,23 @@ module.exports = window;
module.exports = PopupsAdvancedSearchViewModel;
-}(module));
-},{"../../Common/Utils.js":14,"../../External/ko.js":28,"../../External/moment.js":29,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],84:[function(require,module,exports){
+}(module, require));
+},{"../../Storages/WebMailDataStorage.js":74,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28,"moment":29}],84:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- ko = require('../../External/ko.js'),
- key = require('../../External/key.js'),
+ ko = require('ko'),
+ key = require('key'),
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
-
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -19075,29 +19040,29 @@ module.exports = window;
module.exports = PopupsAskViewModel;
-}(module));
-},{"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/key.js":27,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36}],85:[function(require,module,exports){
+}(module, require));
+},{"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"key":27,"kn":33,"ko":28}],85:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
-
+
var
- window = require('../../External/window.js'),
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
- key = require('../../External/key.js'),
+ window = require('window'),
+ _ = require('_'),
+ ko = require('ko'),
+ key = require('key'),
- Utils = require('../../Common/Utils.js'),
- Enums = require('../../Common/Enums.js'),
+ Utils = require('Utils'),
+ Enums = require('Enums'),
Data = require('../../Storages/WebMailDataStorage.js'),
EmailModel = require('../../Models/EmailModel.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -19341,30 +19306,31 @@ module.exports = window;
module.exports = PopupsComposeOpenPgpViewModel;
-}(module));
-},{"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/key.js":27,"../../External/ko.js":28,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Models/EmailModel.js":43,"../../Storages/WebMailDataStorage.js":74}],86:[function(require,module,exports){
+}(module, require));
+},{"../../Models/EmailModel.js":43,"../../Storages/WebMailDataStorage.js":74,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"_":31,"key":27,"kn":33,"ko":28,"window":32}],86:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- window = require('../../External/window.js'),
- $ = require('../../External/jquery.js'),
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
- moment = require('../../External/moment.js'),
- $window = require('../../External/$window.js'),
- JSON = require('../../External/JSON.js'),
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ moment = require('moment'),
+ $window = require('$window'),
+ JSON = require('JSON'),
+ Jua = require('Jua'),
- Enums = require('../../Common/Enums.js'),
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js'),
- Globals = require('../../Common/Globals.js'),
- LinkBuilder = require('../../Common/LinkBuilder.js'),
- Events = require('../../Common/Events.js'),
- NewHtmlEditorWrapper = require('../../Common/NewHtmlEditorWrapper.js'),
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Utils = require('Utils'),
+ Globals = require('Globals'),
+ LinkBuilder = require('LinkBuilder'),
+ Events = require('Events'),
+ NewHtmlEditorWrapper = require('NewHtmlEditorWrapper'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
@@ -19377,8 +19343,8 @@ module.exports = window;
PopupsFolderSystemViewModel = require('./PopupsFolderSystemViewModel.js'),
PopupsAskViewModel = require('./PopupsAskViewModel.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -21129,27 +21095,27 @@ module.exports = window;
module.exports = PopupsComposeViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Consts.js":6,"../../Common/Enums.js":7,"../../Common/Events.js":8,"../../Common/Globals.js":9,"../../Common/LinkBuilder.js":10,"../../Common/NewHtmlEditorWrapper.js":11,"../../Common/Utils.js":14,"../../External/$window.js":18,"../../External/JSON.js":20,"../../External/jquery.js":26,"../../External/ko.js":28,"../../External/moment.js":29,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Models/ComposeAttachmentModel.js":39,"../../Storages/AppSettings.js":68,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74,"./PopupsAskViewModel.js":84,"./PopupsComposeOpenPgpViewModel.js":85,"./PopupsFolderSystemViewModel.js":91}],87:[function(require,module,exports){
+}(module, require));
+},{"$":26,"$window":18,"../../Boots/RainLoopApp.js":4,"../../Models/ComposeAttachmentModel.js":39,"../../Storages/AppSettings.js":68,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74,"./PopupsAskViewModel.js":84,"./PopupsComposeOpenPgpViewModel.js":85,"./PopupsFolderSystemViewModel.js":91,"Consts":6,"Enums":7,"Events":8,"Globals":9,"JSON":20,"Jua":21,"KnoinAbstractViewModel":36,"LinkBuilder":10,"NewHtmlEditorWrapper":11,"Utils":14,"_":31,"kn":33,"ko":28,"moment":29,"window":32}],87:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../../External/window.js'),
- $ = require('../../External/jquery.js'),
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
- key = require('../../External/key.js'),
+ window = require('window'),
+ $ = require('$'),
+ _ = require('_'),
+ ko = require('ko'),
+ key = require('key'),
- Enums = require('../../Common/Enums.js'),
- Consts = require('../../Common/Consts.js'),
- Globals = require('../../Common/Globals.js'),
- Utils = require('../../Common/Utils.js'),
- LinkBuilder = require('../../Common/LinkBuilder.js'),
- Selector = require('../../Common/Selector.js'),
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Globals = require('Globals'),
+ Utils = require('Utils'),
+ LinkBuilder = require('LinkBuilder'),
+ Selector = require('Selector'),
Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
@@ -21161,8 +21127,8 @@ module.exports = window;
PopupsComposeViewModel = require('./PopupsComposeViewModel.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -21488,7 +21454,7 @@ module.exports = window;
self = this,
RL = require('../../Boots/RainLoopApp.js')
;
-
+
RL.contactsSync(function (sResult, oData) {
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
@@ -21920,24 +21886,24 @@ module.exports = window;
module.exports = PopupsContactsViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Consts.js":6,"../../Common/Enums.js":7,"../../Common/Globals.js":9,"../../Common/LinkBuilder.js":10,"../../Common/Selector.js":13,"../../Common/Utils.js":14,"../../External/jquery.js":26,"../../External/key.js":27,"../../External/ko.js":28,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Models/ContactModel.js":40,"../../Models/ContactPropertyModel.js":41,"../../Models/ContactTagModel.js":42,"../../Models/EmailModel.js":43,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"./PopupsComposeViewModel.js":86}],88:[function(require,module,exports){
+}(module, require));
+},{"$":26,"../../Boots/RainLoopApp.js":4,"../../Models/ContactModel.js":40,"../../Models/ContactPropertyModel.js":41,"../../Models/ContactTagModel.js":42,"../../Models/EmailModel.js":43,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"./PopupsComposeViewModel.js":86,"Consts":6,"Enums":7,"Globals":9,"KnoinAbstractViewModel":36,"LinkBuilder":10,"Selector":13,"Utils":14,"_":31,"key":27,"kn":33,"ko":28,"window":32}],88:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../../External/ko.js'),
-
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js'),
+ ko = require('ko'),
+
+ Consts = require('Consts'),
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -21967,32 +21933,32 @@ module.exports = window;
PopupsFilterViewModel.prototype.onShow = function (oFilter)
{
this.clearPopup();
-
+
this.filter(oFilter);
};
module.exports = PopupsFilterViewModel;
-}(module));
-},{"../../Common/Consts.js":6,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],89:[function(require,module,exports){
+}(module, require));
+},{"../../Storages/WebMailDataStorage.js":74,"Consts":6,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],89:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../../External/ko.js'),
+ ko = require('ko'),
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
Cache = require('../../Storages/WebMailCacheStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22095,27 +22061,27 @@ module.exports = window;
module.exports = PopupsFolderClearViewModel;
-}(module));
+}(module, require));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74}],90:[function(require,module,exports){
+},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],90:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- ko = require('../../External/ko.js'),
+ ko = require('ko'),
- Enums = require('../../Common/Enums.js'),
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js'),
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22229,27 +22195,27 @@ module.exports = window;
module.exports = PopupsFolderCreateViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Consts.js":6,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74}],91:[function(require,module,exports){
+}(module, require));
+},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"Consts":6,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],91:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
-
+(function (module, require) {
+
'use strict';
var
- ko = require('../../External/ko.js'),
+ ko = require('ko'),
- Enums = require('../../Common/Enums.js'),
- Consts = require('../../Common/Consts.js'),
- Utils = require('../../Common/Utils.js'),
+ Enums = require('Enums'),
+ Consts = require('Consts'),
+ Utils = require('Utils'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22365,25 +22331,25 @@ module.exports = window;
module.exports = PopupsFolderSystemViewModel;
-}(module));
-},{"../../Common/Consts.js":6,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/AppSettings.js":68,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74}],92:[function(require,module,exports){
+}(module, require));
+},{"../../Storages/AppSettings.js":68,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"Consts":6,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],92:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- window = require('../../External/window.js'),
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
+ window = require('window'),
+ _ = require('_'),
+ ko = require('ko'),
- Utils = require('../../Common/Utils.js'),
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22484,25 +22450,25 @@ module.exports = window;
module.exports = PopupsGenerateNewOpenPgpKeyViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],93:[function(require,module,exports){
+}(module, require));
+},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailDataStorage.js":74,"KnoinAbstractViewModel":36,"Utils":14,"_":31,"kn":33,"ko":28,"window":32}],93:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../../External/ko.js'),
+ ko = require('ko'),
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
- kn = require('../../Knoin/Knoin.js'),
+ Enums = require('Enums'),
+ Utils = require('Utils'),
+ kn = require('kn'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22657,22 +22623,22 @@ module.exports = window;
module.exports = PopupsIdentityViewModel;
-}(module));
-},{"../../Boots/RainLoopApp.js":4,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74}],94:[function(require,module,exports){
+}(module, require));
+},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],94:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../../External/underscore.js'),
- key = require('../../External/key.js'),
+ _ = require('_'),
+ key = require('key'),
- Enums = require('../../Common/Enums.js'),
+ Enums = require('Enums'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22722,24 +22688,24 @@ module.exports = window;
module.exports = PopupsKeyboardShortcutsHelpViewModel;
-}(module));
-},{"../../Common/Enums.js":7,"../../External/key.js":27,"../../External/underscore.js":31,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36}],95:[function(require,module,exports){
+}(module, require));
+},{"Enums":7,"KnoinAbstractViewModel":36,"_":31,"key":27,"kn":33}],95:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- _ = require('../../External/underscore.js'),
- ko = require('../../External/ko.js'),
-
- Utils = require('../../Common/Utils.js'),
+ _ = require('_'),
+ ko = require('ko'),
+
+ Utils = require('Utils'),
Data = require('../../Storages/WebMailDataStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22804,26 +22770,26 @@ module.exports = window;
module.exports = PopupsLanguagesViewModel;
-}(module));
-},{"../../Common/Utils.js":14,"../../External/ko.js":28,"../../External/underscore.js":31,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],96:[function(require,module,exports){
+}(module, require));
+},{"../../Storages/WebMailDataStorage.js":74,"KnoinAbstractViewModel":36,"Utils":14,"_":31,"kn":33,"ko":28}],96:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../../External/ko.js'),
-
- Enums = require('../../Common/Enums.js'),
- Utils = require('../../Common/Utils.js'),
+ ko = require('ko'),
+
+ Enums = require('Enums'),
+ Utils = require('Utils'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
-
+
/**
* @constructor
* @extends KnoinAbstractViewModel
@@ -22880,21 +22846,21 @@ module.exports = window;
module.exports = PopupsTwoFactorTestViewModel;
-}(module));
-},{"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72}],97:[function(require,module,exports){
+}(module, require));
+},{"../../Storages/WebMailAjaxRemoteStorage.js":72,"Enums":7,"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],97:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- ko = require('../../External/ko.js'),
-
- Utils = require('../../Common/Utils.js'),
+ ko = require('ko'),
- kn = require('../../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
+ Utils = require('Utils'),
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22939,20 +22905,20 @@ module.exports = window;
module.exports = PopupsViewOpenPgpKeyViewModel;
-}(module));
-},{"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36}],98:[function(require,module,exports){
+}(module, require));
+},{"KnoinAbstractViewModel":36,"Utils":14,"kn":33,"ko":28}],98:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- LinkBuilder = require('../Common/LinkBuilder.js'),
- Globals = require('../Common/Globals.js'),
+ LinkBuilder = require('LinkBuilder'),
+ Globals = require('Globals'),
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -22986,24 +22952,24 @@ module.exports = window;
module.exports = SettingsMenuViewModel;
-}(module));
-},{"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36}],99:[function(require,module,exports){
+}(module, require));
+},{"Globals":9,"KnoinAbstractViewModel":36,"LinkBuilder":10,"kn":33}],99:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- key = require('../External/key.js'),
+ key = require('key'),
- Enums = require('../Common/Enums.js'),
- LinkBuilder = require('../Common/LinkBuilder.js'),
+ Enums = require('Enums'),
+ LinkBuilder = require('LinkBuilder'),
Data = require('../Storages/WebMailDataStorage.js'),
-
- kn = require('../Knoin/Knoin.js'),
- KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
+
+ kn = require('kn'),
+ KnoinAbstractViewModel = require('KnoinAbstractViewModel')
;
/**
@@ -23039,16 +23005,16 @@ module.exports = window;
module.exports = SettingsPaneViewModel;
-}(module));
-},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../External/key.js":27,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/WebMailDataStorage.js":74}],100:[function(require,module,exports){
+}(module, require));
+},{"../Storages/WebMailDataStorage.js":74,"Enums":7,"KnoinAbstractViewModel":36,"LinkBuilder":10,"key":27,"kn":33}],100:[function(require,module,exports){
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module) {
+(function (module, require) {
'use strict';
var
- kn = require('../Knoin/Knoin.js'),
+ kn = require('kn'),
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
;
@@ -23066,5 +23032,5 @@ module.exports = window;
module.exports = SettingsSystemDropDownViewModel;
-}(module));
-},{"../Knoin/Knoin.js":33,"./AbstractSystemDropDownViewModel.js":75}]},{},[1]);
+}(module, require));
+},{"./AbstractSystemDropDownViewModel.js":75,"kn":33}]},{},[1]);
diff --git a/rainloop/v/0.0.0/static/js/app.min.js b/rainloop/v/0.0.0/static/js/app.min.js
index 1685f3504..fb08d77fd 100644
--- a/rainloop/v/0.0.0/static/js/app.min.js
+++ b/rainloop/v/0.0.0/static/js/app.min.js
@@ -1,11 +1,10 @@
-!function e(t,s,o){function i(r,a){if(!s[r]){if(!t[r]){var l="function"==typeof require&&require;if(!a&&l)return l(r,!0);if(n)return n(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var u=s[r]={exports:{}};t[r][0].call(u.exports,function(e){var s=t[r][1][e];return i(s?s:e)},u,u.exports,e,t,s,o)}return s[r].exports}for(var n="function"==typeof require&&require,r=0;r').appendTo("body"),a.on("error",function(t){t&&t.originalEvent&&t.originalEvent.message&&-1===u.inArray(t.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&e.jsError(u.emptyFunction,t.originalEvent.message,t.originalEvent.filename,t.originalEvent.lineno,n.location&&n.location.toString?n.location.toString():"",r.attr("class"),u.microtime()-c.now)}),l.on("keydown",function(e){e&&e.ctrlKey&&r.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&r.removeClass("rl-ctrl-key-pressed")})}var o=e("../External/jquery.js"),i=e("../External/underscore.js"),n=e("../External/window.js"),r=e("../External/$html.js"),a=e("../External/$window.js"),l=e("../External/$doc.js"),c=e("../Common/Globals.js"),u=e("../Common/Utils.js"),d=e("../Common/LinkBuilder.js"),p=e("../Common/Events.js"),h=e("../Storages/AppSettings.js"),m=e("../Knoin/KnoinAbstractBoot.js");i.extend(s.prototype,m.prototype),s.prototype.remote=function(){return null},s.prototype.data=function(){return null},s.prototype.setupSettings=function(){return!0},s.prototype.download=function(e){var t=null,s=null,o=n.navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(s=n.document.createElement("a"),s.href=e,n.document.createEvent&&(t=n.document.createEvent("MouseEvents"),t&&t.initEvent&&s.dispatchEvent))?(t.initEvent("click",!0,!0),s.dispatchEvent(t),!0):(c.bMobileDevice?(n.open(e,"_self"),n.focus()):this.iframe.attr("src",e),!0)},s.prototype.setTitle=function(e){e=(u.isNormal(e)&&0i;i++)m=e.Result["@Collection"][i],m&&"Object/Message"===m["@Object"]&&(g=h[i],g&&g.initByJson(m)||(g=w.newInstanceFromJson(m)),g&&(S.hasNewMessageAndRemoveFromCache(g.folderFullNameRaw,g.uid)&&5>=y&&(y++,g.newForAnimation(!0)),g.deleted(!1),t?S.initMessageFlagsFromCache(g):S.storeMessageFlagsToCache(g),g.lastInCollapsedThread(s&&-1o;o++)n=t[o],n&&(a=n.FullNameRaw,r=S.getFolderFromCacheList(a),r||(r=C.newInstanceFromJson(n),r&&(S.setFolderToCacheList(a,r),S.setFolderFullNameRaw(r.fullNameHash,a))),r&&(r.collapsed(!s.isFolderExpanded(r.fullNameHash)),n.Extended&&(n.Extended.Hash&&S.setFolderHash(r.fullNameRaw,n.Extended.Hash),d.isNormal(n.Extended.MessageCount)&&r.messageCountAll(n.Extended.MessageCount),d.isNormal(n.Extended.MessageUnseenCount)&&r.messageCountUnread(n.Extended.MessageUnseenCount)),l=n.SubFolders,l&&"Collection/FolderCollection"===l["@Object"]&&l["@Collection"]&&d.isArray(l["@Collection"])&&r.subFolders(this.folderResponseParseRec(e,l["@Collection"])),c.push(r)));return c},s.prototype.setFolders=function(e){var t=[],s=!1,o=function(e){return""===e||c.Values.UnuseOptionValue===e||null!==S.getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&d.isArray(e.Result["@Collection"])&&(d.isUnd(e.Result.Namespace)||(b.namespace=e.Result.Namespace),b.threading(!!f.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(b.namespace,e.Result["@Collection"]),b.folderList(t),e.Result.SystemFolders&&""==""+f.settingsGet("SentFolder")+f.settingsGet("DraftFolder")+f.settingsGet("SpamFolder")+f.settingsGet("TrashFolder")+f.settingsGet("ArchiveFolder")+f.settingsGet("NullFolder")&&(f.settingsSet("SentFolder",e.Result.SystemFolders[2]||null),f.settingsSet("DraftFolder",e.Result.SystemFolders[3]||null),f.settingsSet("SpamFolder",e.Result.SystemFolders[4]||null),f.settingsSet("TrashFolder",e.Result.SystemFolders[5]||null),f.settingsSet("ArchiveFolder",e.Result.SystemFolders[12]||null),s=!0),b.sentFolder(o(f.settingsGet("SentFolder"))),b.draftFolder(o(f.settingsGet("DraftFolder"))),b.spamFolder(o(f.settingsGet("SpamFolder"))),b.trashFolder(o(f.settingsGet("TrashFolder"))),b.archiveFolder(o(f.settingsGet("ArchiveFolder"))),s&&y.saveSystemFolders(d.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder(),ArchiveFolder:b.archiveFolder(),NullFolder:"NullFolder"}),g.set(a.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},s.prototype.isFolderExpanded=function(e){var t=g.get(a.ClientSideKeyName.ExpandedFolders);return n.isArray(t)&&-1!==n.indexOf(t,e)},s.prototype.setExpandedFolder=function(e,t){var s=g.get(a.ClientSideKeyName.ExpandedFolders);n.isArray(s)||(s=[]),t?(s.push(e),s=n.uniq(s)):s=n.without(s,e),g.set(a.ClientSideKeyName.ExpandedFolders,s)},s.prototype.initLayoutResizer=function(e,t,s){var o=60,n=155,r=i(e),a=i(t),l=g.get(s)||null,c=function(e){e&&(r.css({width:""+e+"px"}),a.css({left:""+e+"px"}))},u=function(e){if(e)r.resizable("disable"),c(o);else{r.resizable("enable");var t=d.pInt(g.get(s))||n;c(t>n?t:n)}},p=function(e,t){t&&t.size&&t.size.width&&(g.set(s,t.size.width),a.css({left:""+t.size.width+"px"}))};null!==l&&c(l>n?l:n),r.resizable({helper:"ui-resizable-helper",minWidth:n,maxWidth:350,handles:"e",stop:p}),h.sub("left-panel.off",function(){u(!0)}),h.sub("left-panel.on",function(){u(!1)})},s.prototype.mailToHelper=function(e){if(e&&"mailto:"===e.toString().substr(0,7).toLowerCase()){e=e.toString().substr(7);var t={},s=null,i=e.replace(/\?.+$/,""),n=e.replace(/^[^\?]*\?/,"");return s=new v,s.parse(o.decodeURIComponent(i)),s&&s.email&&(t=d.simpleQueryParser(n),m.showScreenPopup(M,[a.ComposeType.Empty,null,[s],d.isUnd(t.subject)?null:d.pString(t.subject),d.isUnd(t.body)?null:d.plainToHtml(d.pString(t.body))])),!0}return!1},s.prototype.bootstart=function(){P.prototype.bootstart.call(this),b.populateDataOnStart();var e=this,t="",s=f.settingsGet("JsHash"),r=d.pInt(f.settingsGet("ContactsSyncInterval")),c=f.settingsGet("AllowGoogleSocial"),g=f.settingsGet("AllowFacebookSocial"),S=f.settingsGet("AllowTwitterSocial");d.initOnStartOrLangChange(function(){i.extend(!0,i.magnificPopup.defaults,{tClose:d.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:d.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:d.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:d.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:d.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:d.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:d.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this),o.SimplePace&&(o.SimplePace.set(70),o.SimplePace.sleep()),l.leftPanelDisabled.subscribe(function(e){h.pub("left-panel."+(e?"off":"on"))}),f.settingsGet("Auth")?(this.setTitle(d.i18n("TITLES/LOADING")),this.folders(n.bind(function(t){m.hideLoading(),t?(o.$LAB&&o.crypto&&o.crypto.getRandomValues&&f.capa(a.Capa.OpenPGP)?o.$LAB.script(o.openpgp?"":p.openPgpJs()).wait(function(){o.openpgp&&(b.openpgpKeyring=new o.openpgp.Keyring,b.capaOpenPGP(!0),h.pub("openpgp.init"),e.reloadOpenPgpKeys())}):b.capaOpenPGP(!1),m.startScreens([N,R]),(c||g||S)&&e.socialUsers(!0),h.sub("interval.2m",function(){e.folderInformation("INBOX")}),h.sub("interval.2m",function(){var t=b.currentFolderFullNameRaw();"INBOX"!==t&&e.folderInformation(t)}),h.sub("interval.3m",function(){e.folderInformationMultiply()}),h.sub("interval.5m",function(){e.quota()}),h.sub("interval.10m",function(){e.folders()}),r=r>=5?r:20,r=320>=r?r:320,o.setInterval(function(){e.contactsSync()},6e4*r+5e3),n.delay(function(){e.contactsSync()},5e3),n.delay(function(){e.folderInformationMultiply(!0)},500),u.runHook("rl-start-user-screens"),h.pub("rl.bootstart-user-screens"),f.settingsGet("AccountSignMe")&&o.navigator.registerProtocolHandler&&n.delay(function(){try{o.navigator.registerProtocolHandler("mailto",o.location.protocol+"//"+o.location.host+o.location.pathname+"?mailto&to=%s",""+(f.settingsGet("Title")||"RainLoop"))}catch(t){}f.settingsGet("MailToEmail")&&e.mailToHelper(f.settingsGet("MailToEmail"))},500)):(m.startScreens([L]),u.runHook("rl-start-login-screens"),h.pub("rl.bootstart-login-screens")),o.SimplePace&&o.SimplePace.set(100),l.bMobileDevice||n.defer(function(){e.initLayoutResizer("#rl-left","#rl-right",a.ClientSideKeyName.FolderListSize)})},this))):(t=d.pString(f.settingsGet("CustomLoginLink")),t?(m.routeOff(),m.setHash(p.root(),!0),m.routeOff(),n.defer(function(){o.location.href=t})):(m.hideLoading(),m.startScreens([L]),u.runHook("rl-start-login-screens"),h.pub("rl.bootstart-login-screens"),o.SimplePace&&o.SimplePace.set(100))),c&&(o["rl_"+s+"_google_service"]=function(){b.googleActions(!0),e.socialUsers()}),g&&(o["rl_"+s+"_facebook_service"]=function(){b.facebookActions(!0),e.socialUsers()}),S&&(o["rl_"+s+"_twitter_service"]=function(){b.twitterActions(!0),e.socialUsers()}),h.sub("interval.1m",function(){l.momentTrigger(!l.momentTrigger())}),u.runHook("rl-start-screens"),h.pub("rl.bootstart-end")},t.exports=new s}(t)},{"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Plugins.js":12,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/moment.js":29,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Models/AccountModel.js":37,"../Models/EmailModel.js":43,"../Models/FolderModel.js":46,"../Models/IdentityModel.js":47,"../Models/MessageModel.js":48,"../Models/OpenPgpKeyModel.js":49,"../Screens/LoginScreen.js":51,"../Screens/MailBoxScreen.js":52,"../Screens/SettingsScreen.js":53,"../Settings/SettingsAccounts.js":54,"../Settings/SettingsChangePassword.js":55,"../Settings/SettingsContacts.js":56,"../Settings/SettingsFilters.js":57,"../Settings/SettingsFolders.js":58,"../Settings/SettingsGeneral.js":59,"../Settings/SettingsIdentities.js":60,"../Settings/SettingsIdentity.js":61,"../Settings/SettingsOpenPGP.js":62,"../Settings/SettingsSecurity.js":63,"../Settings/SettingsSocial.js":64,"../Settings/SettingsThemes.js":65,"../Storages/AppSettings.js":68,"../Storages/LocalStorage.js":69,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAskViewModel.js":84,"../ViewModels/Popups/PopupsComposeViewModel.js":86,"./AbstractApp.js":2}],5:[function(e,t){!function(e){"use strict";var t={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return t.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var s,o,i,n,r,a,l,c="",u=0;for(e=t._utf8_encode(e);u>2,r=(3&s)<<4|o>>4,a=(15&o)<<2|i>>6,l=63&i,isNaN(o)?a=l=64:isNaN(i)&&(l=64),c=c+this._keyStr.charAt(n)+this._keyStr.charAt(r)+this._keyStr.charAt(a)+this._keyStr.charAt(l);return c},decode:function(e){var s,o,i,n,r,a,l,c="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u>4,o=(15&r)<<4|a>>2,i=(3&a)<<6|l,c+=String.fromCharCode(s),64!==a&&(c+=String.fromCharCode(o)),64!==l&&(c+=String.fromCharCode(i));return t._utf8_decode(c)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",s=0,o=e.length,i=0;o>s;s++)i=e.charCodeAt(s),128>i?t+=String.fromCharCode(i):i>127&&2048>i?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128));return t},_utf8_decode:function(e){for(var t="",s=0,o=0,i=0,n=0;so?(t+=String.fromCharCode(o),s++):o>191&&224>o?(i=e.charCodeAt(s+1),t+=String.fromCharCode((31&o)<<6|63&i),s+=2):(i=e.charCodeAt(s+1),n=e.charCodeAt(s+2),t+=String.fromCharCode((15&o)<<12|(63&i)<<6|63&n),s+=3);return t}};e.exports=t}(t)},{}],6:[function(e,t){!function(e){"use strict";var t={};t.Values={},t.DataImages={},t.Defaults={},t.Defaults.MessagesPerPage=20,t.Defaults.ContactsPerPage=50,t.Defaults.MessagesPerPageArray=[10,20,30,50,100],t.Defaults.DefaultAjaxTimeout=3e4,t.Defaults.SearchAjaxTimeout=3e5,t.Defaults.SendMessageAjaxTimeout=3e5,t.Defaults.SaveMessageAjaxTimeout=2e5,t.Defaults.ContactsSyncAjaxTimeout=2e5,t.Values.UnuseOptionValue="__UNUSE__",t.Values.ClientSideCookieIndexName="rlcsc",t.Values.ImapDefaulPort=143,t.Values.ImapDefaulSecurePort=993,t.Values.SmtpDefaulPort=25,t.Values.SmtpDefaulSecurePort=465,t.Values.MessageBodyCacheLimit=15,t.Values.AjaxErrorLimit=7,t.Values.TokenErrorLimit=10,t.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",t.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",e.exports=t
-}(t)},{}],7:[function(e,t){!function(e){"use strict";var t={};t.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},t.State={Empty:10,Login:20,Auth:30},t.StateType={Webmail:0,Admin:1},t.Capa={Prem:"PREM",TwoFactor:"TWO_FACTOR",OpenPGP:"OPEN_PGP",Prefetch:"PREFETCH",Gravatar:"GRAVATAR",Themes:"THEMES",Filters:"FILTERS",AdditionalAccounts:"ADDITIONAL_ACCOUNTS",AdditionalIdentities:"ADDITIONAL_IDENTITIES"},t.KeyState={All:"all",None:"none",ContactList:"contact-list",MessageList:"message-list",FolderList:"folder-list",MessageView:"message-view",Compose:"compose",Settings:"settings",Menu:"menu",PopupComposeOpenPGP:"compose-open-pgp",PopupKeyboardShortcutsHelp:"popup-keyboard-shortcuts-help",PopupAsk:"popup-ask"},t.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,NotSpam:80,User:99},t.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},t.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},t.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},t.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},t.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},t.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},t.EventKeyCode={Backspace:8,Tab:9,Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Space:32,Insert:45,Delete:46,A:65,S:83},t.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},t.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},t.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},t.MessagePriority={Low:5,Normal:3,High:1},t.EditorDefaultType={Html:"Html",Plain:"Plain"},t.CustomThemeType={Light:"Light",Dark:"Dark"},t.ServerSecure={None:0,SSL:1,TLS:2},t.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},t.EmailType={Defailt:0,Facebook:1,Google:2},t.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},t.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},t.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},t.FilterConditionField={From:"From",To:"To",Recipient:"Recipient",Subject:"Subject"},t.FilterConditionType={Contains:"Contains",NotContains:"NotContains",EqualTo:"EqualTo",NotEqualTo:"NotEqualTo"},t.FiltersAction={None:"None",Move:"Move",Discard:"Discard",Forward:"Forward"},t.FilterRulesType={And:"And",Or:"Or"},t.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},t.ContactPropertyType={Unknown:0,FullName:10,FirstName:15,LastName:16,MiddleName:16,Nick:18,NamePrefix:20,NameSuffix:21,Email:30,Phone:31,Web:32,Birthday:40,Facebook:90,Skype:91,GitHub:92,Note:110,Custom:250},t.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,AccountTwoFactorAuthRequired:120,AccountTwoFactorAuthError:121,CouldNotSaveNewPassword:130,CurrentPasswordIncorrect:131,NewPasswordShort:132,NewPasswordWeak:133,NewPasswordForbidden:134,ContactsSyncError:140,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantCopyMessage:205,CantSaveMessage:301,CantSendMessage:302,InvalidRecipients:303,CantCreateFolder:400,CantRenameFolder:401,CantDeleteFolder:402,CantSubscribeFolder:403,CantUnsubscribeFolder:404,CantDeleteNonEmptyFolder:405,CantSaveSettings:501,CantSavePluginSettings:502,DomainAlreadyExists:601,CantInstallPackage:701,CantDeletePackage:702,InvalidPluginPackage:703,UnsupportedPluginPackage:704,LicensingServerIsUnavailable:710,LicensingExpired:711,LicensingBanned:712,DemoSendMessageError:750,AccountAlreadyExists:801,MailServerError:901,ClientViewError:902,InvalidInputArgument:903,UnknownNotification:999,UnknownError:999},e.exports=t}(t)},{}],8:[function(e,t){!function(t){"use strict";function s(){this.oSubs={}}var o=e("../External/underscore.js"),i=e("./Utils.js"),n=e("./Plugins.js");s.prototype.oSubs={},s.prototype.sub=function(e,t,s){return i.isUnd(this.oSubs[e])&&(this.oSubs[e]=[]),this.oSubs[e].push([t,s]),this},s.prototype.pub=function(e,t){return n.runHook("rl-pub",[e,t]),i.isUnd(this.oSubs[e])||o.each(this.oSubs[e],function(e){e[0]&&e[0].apply(e[1]||null,t||[])}),this},t.exports=new s}(t)},{"../External/underscore.js":31,"./Plugins.js":12,"./Utils.js":14}],9:[function(e,t){!function(t){"use strict";var s={},o=e("../External/window.js"),i=e("../External/ko.js"),n=e("../External/key.js"),r=e("../External/$html.js"),a=e("../Common/Enums.js");s.now=(new o.Date).getTime(),s.momentTrigger=i.observable(!0),s.dropdownVisibility=i.observable(!1).extend({rateLimit:0}),s.tooltipTrigger=i.observable(!1).extend({rateLimit:0}),s.langChangeTrigger=i.observable(!0),s.useKeyboardShortcuts=i.observable(!0),s.iAjaxErrorCount=0,s.iTokenErrorCount=0,s.iMessageBodyCacheCount=0,s.bUnload=!1,s.sUserAgent=(o.navigator.userAgent||"").toLowerCase(),s.bIsiOSDevice=-11&&(o=o.replace(/[\/]+$/,""),o+="/p"+t),""!==s&&(o=o.replace(/[\/]+$/,""),o+="/"+encodeURI(s)),o},s.prototype.phpInfo=function(){return this.sServer+"Info"},s.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},s.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},s.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},s.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},s.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},s.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=i.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},s.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},s.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},s.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},s.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},s.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},t.exports=new s}(t)},{"../External/window.js":32,"../Storages/AppSettings.js":68,"./Utils.js":14}],11:[function(e,t){!function(t){"use strict";function s(e,t,s,o){this.editor=null,this.iBlurTimer=0,this.fOnBlur=t||null,this.fOnReady=s||null,this.fOnModeChange=o||null,this.$element=$(e),this.resize=i.throttle(i.bind(this.resize,this),100),this.init()}var o=e("../External/window.js"),i=e("../External/underscore.js"),n=e("./Globals.js"),r=e("../Storages/AppSettings.js");s.prototype.blurTrigger=function(){if(this.fOnBlur){var e=this;o.clearTimeout(this.iBlurTimer),this.iBlurTimer=o.setTimeout(function(){e.fOnBlur()},200)}},s.prototype.focusTrigger=function(){this.fOnBlur&&o.clearTimeout(this.iBlurTimer)},s.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},s.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},s.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},s.prototype.getData=function(e){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():e?''+this.editor.getData()+"":this.editor.getData():""},s.prototype.modeToggle=function(e){this.editor&&(e?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"),this.resize())},s.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},s.prototype.setPlain=function(e,t){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(e);this.editor.setData(e),t&&this.focus()}},s.prototype.init=function(){if(this.$element&&this.$element[0]){var e=this,t=function(){var t=n.oHtmlEditorDefaultConfig,s=r.settingsGet("Language"),i=!!r.settingsGet("AllowHtmlEditorSourceButton");i&&t.toolbarGroups&&!t.toolbarGroups.__SourceInited&&(t.toolbarGroups.__SourceInited=!0,t.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),t.enterMode=o.CKEDITOR.ENTER_BR,t.shiftEnterMode=o.CKEDITOR.ENTER_BR,t.language=n.oHtmlEditorLangsMap[s]||"en",o.CKEDITOR.env&&(o.CKEDITOR.env.isCompatible=!0),e.editor=o.CKEDITOR.appendTo(e.$element[0],t),e.editor.on("key",function(e){return e&&e.data&&9===e.data.keyCode?!1:void 0}),e.editor.on("blur",function(){e.blurTrigger()}),e.editor.on("mode",function(){e.blurTrigger(),e.fOnModeChange&&e.fOnModeChange("plain"!==e.editor.mode)}),e.editor.on("focus",function(){e.focusTrigger()}),e.fOnReady&&e.editor.on("instanceReady",function(){e.editor.setKeystroke(o.CKEDITOR.CTRL+65,"selectAll"),e.fOnReady(),e.__resizable=!0,e.resize()})};o.CKEDITOR?t():o.__initEditor=t}},s.prototype.focus=function(){this.editor&&this.editor.focus()},s.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},s.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},s.prototype.clear=function(e){this.setHtml("",e)},t.exports=s}(t)},{"../External/underscore.js":31,"../External/window.js":32,"../Storages/AppSettings.js":68,"./Globals.js":9}],12:[function(e,t){!function(t){"use strict";var s={__boot:null,__remote:null,__data:null},o=e("../External/underscore.js"),i=e("./Utils.js");s.oViewModelsHooks={},s.oSimpleHooks={},s.regViewModelHook=function(e,t){t&&(t.__hookName=e)},s.addHook=function(e,t){i.isFunc(t)&&(i.isArray(s.oSimpleHooks[e])||(s.oSimpleHooks[e]=[]),s.oSimpleHooks[e].push(t))},s.runHook=function(e,t){i.isArray(s.oSimpleHooks[e])&&(t=t||[],o.each(s.oSimpleHooks[e],function(e){e.apply(null,t)}))},s.mainSettingsGet=function(e){return s.__boot?s.__boot.settingsGet(e):null},s.remoteRequest=function(e,t,o,i,n,r){s.__remote&&s.__remote.defaultRequest(e,t,o,i,n,r)},s.settingsGet=function(e,t){var o=s.mainSettingsGet("Plugins");return o=o&&i.isUnd(o[e])?null:o[e],o?i.isUnd(o[t])?null:o[t]:null},t.exports=s}(t)},{"../External/underscore.js":31,"./Utils.js":14}],13:[function(e,t){!function(t){"use strict";function s(e,t,s,o,r,a){this.list=e,this.listChecked=n.computed(function(){return i.filter(this.list(),function(e){return e.checked()})},this).extend({rateLimit:0}),this.isListChecked=n.computed(function(){return 00&&-10)return i.newSelectPosition(s,r.shift),!1}})}},s.prototype.autoSelect=function(e){this.bAutoSelect=!!e},s.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},s.prototype.newSelectPosition=function(e,t,s){var o=0,n=10,r=!1,l=!1,c=null,u=this.list(),d=u?u.length:0,p=this.focusedItem();if(d>0)if(p){if(p)if(a.EventKeyCode.Down===e||a.EventKeyCode.Up===e||a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)i.each(u,function(t){if(!l)switch(e){case a.EventKeyCode.Up:p===t?l=!0:c=t;break;case a.EventKeyCode.Down:case a.EventKeyCode.Insert:r?(c=t,l=!0):p===t&&(r=!0)}});else if(a.EventKeyCode.Home===e||a.EventKeyCode.End===e)a.EventKeyCode.Home===e?c=u[0]:a.EventKeyCode.End===e&&(c=u[u.length-1]);else if(a.EventKeyCode.PageDown===e){for(;d>o;o++)if(p===u[o]){o+=n,o=o>d-1?d-1:o,c=u[o];break}}else if(a.EventKeyCode.PageUp===e)for(o=d;o>=0;o--)if(p===u[o]){o-=n,o=0>o?0:o,c=u[o];break}}else a.EventKeyCode.Down===e||a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e||a.EventKeyCode.Home===e||a.EventKeyCode.PageUp===e?c=u[0]:(a.EventKeyCode.Up===e||a.EventKeyCode.End===e||a.EventKeyCode.PageDown===e)&&(c=u[u.length-1]);c?(this.focusedItem(c),p&&(t?(a.EventKeyCode.Up===e||a.EventKeyCode.Down===e)&&p.checked(!p.checked()):(a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)&&p.checked(!p.checked())),!this.bAutoSelect&&!s||this.isListChecked()||a.EventKeyCode.Space===e||this.selectedItem(c),this.scrollToFocused()):p&&(!t||a.EventKeyCode.Up!==e&&a.EventKeyCode.Down!==e?(a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)&&p.checked(!p.checked()):p.checked(!p.checked()),this.focusedItem(p))},s.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,t=o(this.sItemFocusedSelector,this.oContentScrollable),s=t.position(),i=this.oContentVisible.height(),n=t.outerHeight();return s&&(s.top<0||s.top+n>i)?(this.oContentScrollable.scrollTop(s.top<0?this.oContentScrollable.scrollTop()+s.top-e:this.oContentScrollable.scrollTop()+s.top-i+n+e),!0):!1},s.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},s.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),o=0,i=0,n=null,r="",a=!1,l=!1,c=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(c=this.list(),u=e.checked(),o=0,i=c.length;i>o;o++)n=c[o],r=this.getItemUid(n),a=!1,(r===this.sLastUid||r===s)&&(a=!0),a&&(l=!l),(l||a)&&n.checked(u);this.sLastUid=""===s?"":s},s.prototype.actionClick=function(e,t){if(e){var s=!0,o=this.getItemUid(e);t&&(!t.shiftKey||t.ctrlKey||t.altKey?!t.ctrlKey||t.shiftKey||t.altKey||(s=!1,this.focusedItem(e),this.selectedItem()&&e!==this.selectedItem()&&this.selectedItem().checked(!0),e.checked(!e.checked())):(s=!1,""===this.sLastUid&&(this.sLastUid=o),e.checked(!e.checked()),this.eventClickFunction(e,t),this.focusedItem(e))),s&&(this.focusedItem(e),this.selectedItem(e),this.scrollToFocused())}},s.prototype.on=function(e,t){this.oCallbacks[e]=t},t.exports=s}(t)},{"../External/jquery.js":26,"../External/key.js":27,"../External/ko.js":28,"../External/underscore.js":31,"./Enums.js":7,"./Utils.js":14}],14:[function(e,t){!function(t){"use strict";var s={},o=e("../External/jquery.js"),i=e("../External/underscore.js"),n=e("../External/ko.js"),r=e("../External/window.js"),a=e("../External/$window.js"),l=e("../External/$html.js"),c=e("../External/$div.js"),u=e("../External/$doc.js"),d=e("../External/NotificationClass.js"),p=e("./Enums.js"),h=e("./Consts.js"),m=e("./Globals.js");s.trim=o.trim,s.inArray=o.inArray,s.isArray=i.isArray,s.isFunc=i.isFunction,s.isUnd=i.isUndefined,s.isNull=i.isNull,s.emptyFunction=function(){},s.isNormal=function(e){return!s.isUnd(e)&&!s.isNull(e)},s.windowResize=i.debounce(function(e){s.isUnd(e)?a.resize():r.setTimeout(function(){a.resize()},e)},50),s.isPosNumeric=function(e,t){return s.isNormal(e)?(s.isUnd(t)?0:!t)?/^[1-9]+[0-9]*$/.test(e.toString()):/^[0-9]*$/.test(e.toString()):!1},s.pInt=function(e,t){var o=s.isNormal(e)&&""!==e?r.parseInt(e,10):t||0;return r.isNaN(o)?t||0:o},s.pString=function(e){return s.isNormal(e)?""+e:""},s.isNonEmptyArray=function(e){return s.isArray(e)&&0i;i++)o=s[i].split("="),t[r.decodeURIComponent(o[0])]=r.decodeURIComponent(o[1]);return t},s.rsaEncode=function(e,t,o,i){if(r.crypto&&r.crypto.getRandomValues&&r.RSAKey&&t&&o&&i){var n=new r.RSAKey;if(n.setPublic(i,o),e=n.encrypt(s.fakeMd5()+":"+e+":"+s.fakeMd5()),!1!==e)return"rsa:"+t+":"+e}return!1},s.rsaEncode.supported=!!(r.crypto&&r.crypto.getRandomValues&&r.RSAKey),s.exportPath=function(e,t,o){for(var i=null,n=e.split("."),a=o||r;n.length&&(i=n.shift());)n.length||s.isUnd(t)?a=a[i]?a[i]:a[i]={}:a[i]=t},s.pImport=function(e,t,s){e[t]=s},s.pExport=function(e,t,o){return s.isUnd(e[t])?o:e[t]},s.encodeHtml=function(e){return s.isNormal(e)?e.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):""},s.splitPlainText=function(e,t){var o="",i="",n=e,r=0,a=0;for(t=s.isUnd(t)?100:t;n.length>t;)i=n.substring(0,t),r=i.lastIndexOf(" "),a=i.lastIndexOf("\n"),-1!==a&&(r=a),-1===r&&(r=t),o+=i.substring(0,r)+"\n",n=n.substring(r+1);return o+n},s.timeOutAction=function(){var e={};return function(t,o,i){s.isUnd(e[t])&&(e[t]=0),r.clearTimeout(e[t]),e[t]=r.setTimeout(o,i)}}(),s.timeOutActionSecond=function(){var e={};return function(t,s,o){e[t]||(e[t]=r.setTimeout(function(){s(),e[t]=0},o))}}(),s.audio=function(){var e=!1;return function(t,s){if(!1===e)if(m.bIsiOSDevice)e=null;else{var o=!1,i=!1,n=r.Audio?new r.Audio:null;n&&n.canPlayType&&n.play?(o=""!==n.canPlayType('audio/mpeg; codecs="mp3"'),o||(i=""!==n.canPlayType('audio/ogg; codecs="vorbis"')),o||i?(e=n,e.preload="none",e.loop=!1,e.autoplay=!1,e.muted=!1,e.src=o?t:s):e=null):e=null}return e}}(),s.hos=function(e,t){return e&&r.Object&&r.Object.hasOwnProperty?r.Object.hasOwnProperty.call(e,t):!1},s.i18n=function(e,t,o){var i="",n=s.isUnd(m.oI18N[e])?s.isUnd(o)?e:o:m.oI18N[e];if(!s.isUnd(t)&&!s.isNull(t))for(i in t)s.hos(t,i)&&(n=n.replace("%"+i+"%",t[i]));return n},s.i18nToNode=function(e){i.defer(function(){o(".i18n",e).each(function(){var e=o(this),t="";t=e.data("i18n-text"),t?e.text(s.i18n(t)):(t=e.data("i18n-html"),t&&e.html(s.i18n(t)),t=e.data("i18n-placeholder"),t&&e.attr("placeholder",s.i18n(t)),t=e.data("i18n-title"),t&&e.attr("title",s.i18n(t)))})})},s.i18nReload=function(){r.rainloopI18N&&(m.oI18N=r.rainloopI18N||{},s.i18nToNode(u),m.langChangeTrigger(!m.langChangeTrigger())),r.rainloopI18N=null},s.initOnStartOrLangChange=function(e,t,s){e&&e.call(t),s?m.langChangeTrigger.subscribe(function(){e&&e.call(t),s.call(t)}):e&&m.langChangeTrigger.subscribe(e,t)},s.inFocus=function(){return r.document.activeElement?(s.isUnd(r.document.activeElement.__inFocusCache)&&(r.document.activeElement.__inFocusCache=o(r.document.activeElement).is("input,textarea,iframe,.cke_editable")),!!r.document.activeElement.__inFocusCache):!1},s.removeInFocus=function(){if(r.document&&r.document.activeElement&&r.document.activeElement.blur){var e=o(r.document.activeElement);e.is("input,textarea")&&r.document.activeElement.blur()}},s.removeSelection=function(){if(r&&r.getSelection){var e=r.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}else r.document&&r.document.selection&&r.document.selection.empty&&r.document.selection.empty()},s.replySubjectAdd=function(e,t){e=s.trim(e.toUpperCase()),t=s.trim(t.replace(/[\s]+/," "));var o=0,i="",n=!1,r="",a=[],l=[],c="RE"===e,u="FWD"===e,d=!u;if(""!==t){for(n=!1,l=t.split(":"),o=0;o0);return e.replace(/[\s]+/," ")},s._replySubjectAdd_=function(e,t,o){var i=null,n=s.trim(t);return n=null===(i=new r.RegExp("^"+e+"[\\s]?\\:(.*)$","gi").exec(t))||s.isUnd(i[1])?null===(i=new r.RegExp("^("+e+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(t))||s.isUnd(i[1])||s.isUnd(i[2])||s.isUnd(i[3])?e+": "+t:i[1]+(s.pInt(i[2])+1)+i[3]:e+"[2]: "+i[1],n=n.replace(/[\s]+/g," "),n=(s.isUnd(o)?!0:o)?s.fixLongSubject(n):n},s._fixLongSubject_=function(e){var t=0,o=null;e=s.trim(e.replace(/[\s]+/," "));do o=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!o||s.isUnd(o[0]))&&(o=null),o&&(t=0,t+=s.isUnd(o[2])?1:0+s.pInt(o[2]),t+=s.isUnd(o[4])?1:0+s.pInt(o[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(o);return e=e.replace(/[\s]+/," ")},s.roundNumber=function(e,t){return r.Math.round(e*r.Math.pow(10,t))/r.Math.pow(10,t)},s.friendlySize=function(e){return e=s.pInt(e),e>=1073741824?s.roundNumber(e/1073741824,1)+"GB":e>=1048576?s.roundNumber(e/1048576,1)+"MB":e>=1024?s.roundNumber(e/1024,0)+"KB":e+"B"},s.log=function(e){r.console&&r.console.log&&r.console.log(e)},s.getNotification=function(e,t){return e=s.pInt(e),p.Notification.ClientViewError===e&&t?t:s.isUnd(m.oNotificationI18N[e])?"":m.oNotificationI18N[e]},s.initNotificationLanguage=function(){var e=m.oNotificationI18N||{};e[p.Notification.InvalidToken]=s.i18n("NOTIFICATIONS/INVALID_TOKEN"),e[p.Notification.AuthError]=s.i18n("NOTIFICATIONS/AUTH_ERROR"),e[p.Notification.AccessError]=s.i18n("NOTIFICATIONS/ACCESS_ERROR"),e[p.Notification.ConnectionError]=s.i18n("NOTIFICATIONS/CONNECTION_ERROR"),e[p.Notification.CaptchaError]=s.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),e[p.Notification.SocialFacebookLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),e[p.Notification.SocialTwitterLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),e[p.Notification.SocialGoogleLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),e[p.Notification.DomainNotAllowed]=s.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),e[p.Notification.AccountNotAllowed]=s.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),e[p.Notification.AccountTwoFactorAuthRequired]=s.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),e[p.Notification.AccountTwoFactorAuthError]=s.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),e[p.Notification.CouldNotSaveNewPassword]=s.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),e[p.Notification.CurrentPasswordIncorrect]=s.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),e[p.Notification.NewPasswordShort]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),e[p.Notification.NewPasswordWeak]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),e[p.Notification.NewPasswordForbidden]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),e[p.Notification.ContactsSyncError]=s.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),e[p.Notification.CantGetMessageList]=s.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),e[p.Notification.CantGetMessage]=s.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),e[p.Notification.CantDeleteMessage]=s.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),e[p.Notification.CantMoveMessage]=s.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[p.Notification.CantCopyMessage]=s.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[p.Notification.CantSaveMessage]=s.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),e[p.Notification.CantSendMessage]=s.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),e[p.Notification.InvalidRecipients]=s.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),e[p.Notification.CantCreateFolder]=s.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),e[p.Notification.CantRenameFolder]=s.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),e[p.Notification.CantDeleteFolder]=s.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),e[p.Notification.CantDeleteNonEmptyFolder]=s.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),e[p.Notification.CantSubscribeFolder]=s.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),e[p.Notification.CantUnsubscribeFolder]=s.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),e[p.Notification.CantSaveSettings]=s.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),e[p.Notification.CantSavePluginSettings]=s.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),e[p.Notification.DomainAlreadyExists]=s.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),e[p.Notification.CantInstallPackage]=s.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),e[p.Notification.CantDeletePackage]=s.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),e[p.Notification.InvalidPluginPackage]=s.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),e[p.Notification.UnsupportedPluginPackage]=s.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),e[p.Notification.LicensingServerIsUnavailable]=s.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),e[p.Notification.LicensingExpired]=s.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),e[p.Notification.LicensingBanned]=s.i18n("NOTIFICATIONS/LICENSING_BANNED"),e[p.Notification.DemoSendMessageError]=s.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),e[p.Notification.AccountAlreadyExists]=s.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),e[p.Notification.MailServerError]=s.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),e[p.Notification.InvalidInputArgument]=s.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),e[p.Notification.UnknownNotification]=s.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),e[p.Notification.UnknownError]=s.i18n("NOTIFICATIONS/UNKNOWN_ERROR")
-},s.getUploadErrorDescByCode=function(e){var t="";switch(s.pInt(e)){case p.UploadErrorCode.FileIsTooBig:t=s.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case p.UploadErrorCode.FilePartiallyUploaded:t=s.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case p.UploadErrorCode.FileNoUploaded:t=s.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case p.UploadErrorCode.MissingTempFolder:t=s.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case p.UploadErrorCode.FileOnSaveingError:t=s.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case p.UploadErrorCode.FileType:t=s.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=s.i18n("UPLOAD/ERROR_UNKNOWN")}return t},s.delegateRun=function(e,t,o,n){e&&e[t]&&(n=s.pInt(n),0>=n?e[t].apply(e,s.isArray(o)?o:[]):i.delay(function(){e[t].apply(e,s.isArray(o)?o:[])},n))},s.killCtrlAandS=function(e){if(e=e||r.event,e&&e.ctrlKey&&!e.shiftKey&&!e.altKey){var t=e.target||e.srcElement,s=e.keyCode||e.which;if(s===p.EventKeyCode.S)return void e.preventDefault();if(t&&t.tagName&&t.tagName.match(/INPUT|TEXTAREA/i))return;s===p.EventKeyCode.A&&(r.getSelection?r.getSelection().removeAllRanges():r.document.selection&&r.document.selection.clear&&r.document.selection.clear(),e.preventDefault())}},s.createCommand=function(e,t,o){var i=t?function(){return i&&i.canExecute&&i.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return i.enabled=n.observable(!0),o=s.isUnd(o)?!0:o,i.canExecute=n.computed(s.isFunc(o)?function(){return i.enabled()&&o.call(e)}:function(){return i.enabled()&&!!o}),i},s.initDataConstructorBySettings=function(e){e.editorDefaultType=n.observable(p.EditorDefaultType.Html),e.showImages=n.observable(!1),e.interfaceAnimation=n.observable(p.InterfaceAnimation.Full),e.contactsAutosave=n.observable(!1),m.sAnimationType=p.InterfaceAnimation.Full,e.capaThemes=n.observable(!1),e.allowLanguagesOnSettings=n.observable(!0),e.allowLanguagesOnLogin=n.observable(!0),e.useLocalProxyForExternalImages=n.observable(!1),e.desktopNotifications=n.observable(!1),e.useThreads=n.observable(!0),e.replySameFolder=n.observable(!0),e.useCheckboxesInList=n.observable(!0),e.layout=n.observable(p.Layout.SidePreview),e.usePreviewPane=n.computed(function(){return p.Layout.NoPreview!==e.layout()}),e.interfaceAnimation.subscribe(function(e){if(m.bMobileDevice||e===p.InterfaceAnimation.None)l.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),m.sAnimationType=p.InterfaceAnimation.None;else switch(e){case p.InterfaceAnimation.Full:l.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),m.sAnimationType=e;break;case p.InterfaceAnimation.Normal:l.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),m.sAnimationType=e}}),e.interfaceAnimation.valueHasMutated(),e.desktopNotificationsPermisions=n.computed(function(){e.desktopNotifications();var t=p.DesktopNotifications.NotSupported;if(d&&d.permission)switch(d.permission.toLowerCase()){case"granted":t=p.DesktopNotifications.Allowed;break;case"denied":t=p.DesktopNotifications.Denied;break;case"default":t=p.DesktopNotifications.NotAllowed}else r.webkitNotifications&&r.webkitNotifications.checkPermission&&(t=r.webkitNotifications.checkPermission());return t}),e.useDesktopNotifications=n.computed({read:function(){return e.desktopNotifications()&&p.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()},write:function(t){if(t){var s=e.desktopNotificationsPermisions();p.DesktopNotifications.Allowed===s?e.desktopNotifications(!0):p.DesktopNotifications.NotAllowed===s?d.requestPermission(function(){e.desktopNotifications.valueHasMutated(),p.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()?e.desktopNotifications()?e.desktopNotifications.valueHasMutated():e.desktopNotifications(!0):e.desktopNotifications()?e.desktopNotifications(!1):e.desktopNotifications.valueHasMutated()}):e.desktopNotifications(!1)}else e.desktopNotifications(!1)}}),e.language=n.observable(""),e.languages=n.observableArray([]),e.mainLanguage=n.computed({read:e.language,write:function(t){t!==e.language()?-1=t.diff(o,"hours")?i:t.format("L")===o.format("L")?s.i18n("MESSAGE_LIST/TODAY_AT",{TIME:o.format("LT")}):t.clone().subtract("days",1).format("L")===o.format("L")?s.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:o.format("LT")}):o.format(t.year()===o.year()?"D MMM.":"LL")},e)},s.initBlockquoteSwitcher=function(e){if(e){var t=o("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===o(this).parent().closest("blockquote",e).length});t&&0100)&&(e.addClass("rl-bq-switcher hidden-bq"),o('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),s.windowResize()}).after("
").before("
"))})}},s.removeBlockquoteSwitcher=function(e){e&&(o(e).find("blockquote.rl-bq-switcher").each(function(){o(this).removeClass("rl-bq-switcher hidden-bq")}),o(e).find(".rlBlockquoteSwitcher").each(function(){o(this).remove()}))},s.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},s.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=s.trim(e.substring(0,e.length-7))),s.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},s.quoteName=function(e){return e.replace(/["]/g,'\\"')},s.microtime=function(){return(new Date).getTime()},s.convertLangName=function(e,t){return s.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},s.fakeMd5=function(e){var t="",o="0123456789abcdefghijklmnopqrstuvwxyz";for(e=s.isUnd(e)?32:s.pInt(e);t.length>>32-t}function s(e,t){var s,o,i,n,r;return i=2147483648&e,n=2147483648&t,s=1073741824&e,o=1073741824&t,r=(1073741823&e)+(1073741823&t),s&o?2147483648^r^i^n:s|o?1073741824&r?3221225472^r^i^n:1073741824^r^i^n:r^i^n}function o(e,t,s){return e&t|~e&s}function i(e,t,s){return e&s|t&~s}function n(e,t,s){return e^t^s}function r(e,t,s){return t^(e|~s)}function a(e,i,n,r,a,l,c){return e=s(e,s(s(o(i,n,r),a),c)),s(t(e,l),i)}function l(e,o,n,r,a,l,c){return e=s(e,s(s(i(o,n,r),a),c)),s(t(e,l),o)}function c(e,o,i,r,a,l,c){return e=s(e,s(s(n(o,i,r),a),c)),s(t(e,l),o)}function u(e,o,i,n,a,l,c){return e=s(e,s(s(r(o,i,n),a),c)),s(t(e,l),o)}function d(e){for(var t,s=e.length,o=s+8,i=(o-o%64)/64,n=16*(i+1),r=Array(n-1),a=0,l=0;s>l;)t=(l-l%4)/4,a=l%4*8,r[t]=r[t]|e.charCodeAt(l)<>>29,r}function p(e){var t,s,o="",i="";for(s=0;3>=s;s++)t=e>>>8*s&255,i="0"+t.toString(16),o+=i.substr(i.length-2,2);return o}function h(e){e=e.replace(/rn/g,"n");for(var t="",s=0;so?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128))}return t}var m,g,f,b,S,y,v,C,w,E=Array(),A=7,j=12,T=17,F=22,M=5,N=9,R=14,L=20,P=4,I=11,x=16,k=23,D=6,U=10,O=15,_=21;for(e=h(e),E=d(e),y=1732584193,v=4023233417,C=2562383102,w=271733878,m=0;m /g,">").replace(/")},s.draggeblePlace=function(){return o(' ').appendTo("#rl-hidden")},s.defautOptionsAfterRender=function(e,t){t&&!s.isUnd(t.disabled)&&e&&o(e).toggleClass("disabled",t.disabled).prop("disabled",t.disabled)},s.windowPopupKnockout=function(e,t,i,a){var l=null,c=r.open(""),u="__OpenerApplyBindingsUid"+s.fakeMd5()+"__",d=o("#"+t);r[u]=function(){if(c&&c.document.body&&d&&d[0]){var t=o(c.document.body);o("#rl-content",t).html(d.html()),o("html",c.document).addClass("external "+o("html").attr("class")),s.i18nToNode(t),e&&o("#rl-content",t)[0]&&n.applyBindings(e,o("#rl-content",t)[0]),r[u]=null,a(c)}},c.document.open(),c.document.write(''+s.encodeHtml(i)+' '),c.document.close(),l=c.document.createElement("script"),l.type="text/javascript",l.innerHTML="if(window&&window.opener&&window.opener['"+u+"']){window.opener['"+u+"']();window.opener['"+u+"']=null}",c.document.getElementsByTagName("head")[0].appendChild(l)},s.settingsSaveHelperFunction=function(e,t,o,n){return o=o||null,n=s.isUnd(n)?1e3:s.pInt(n),function(s,r,a,l,c){t.call(o,r&&r.Result?p.SaveSettingsStep.TrueResult:p.SaveSettingsStep.FalseResult),e&&e.call(o,s,r,a,l,c),i.delay(function(){t.call(o,p.SaveSettingsStep.Idle)},n)}},s.settingsSaveHelperSimpleFunction=function(e,t){return s.settingsSaveHelperFunction(null,e,t,1e3)},s.htmlToPlain=function(e){var t=0,s=0,i=0,n=0,r=0,a="",l=function(e){for(var t=100,s="",o="",i=e,n=0,r=0;i.length>t;)o=i.substring(0,t),n=o.lastIndexOf(" "),r=o.lastIndexOf("\n"),-1!==r&&(n=r),-1===n&&(n=t),s+=o.substring(0,n)+"\n",i=i.substring(n+1);return s+i},u=function(e){return e=l(o.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2]*>([\s\S\r\n]*)<\/div>/gim,d),e="\n"+o.trim(e)+"\n"),e}return""},p=function(){return arguments&&1 "):""},h=function(){return arguments&&1 /g,">"):""},m=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,p).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,h).replace(/
]*>/gim,"\n").replace(/<\/h[\d]>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>([\s\S\r\n]*)<\/div>/gim,d).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S\r\n]*?)<\/a>/gim,m).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),a=c.html(a).text(),a=a.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),t=0,r=100;r>0&&(r--,s=a.indexOf("__bq__start__",t),s>-1);)i=a.indexOf("__bq__start__",s+5),n=a.indexOf("__bq__end__",s+5),(-1===i||i>n)&&n>s?(a=a.substring(0,s)+u(a.substring(s+13,n))+a.substring(n+11),t=0):t=i>-1&&n>i?i-1:0;return a=a.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},s.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var o=!1,i=!0,n=!0,r=[],a="",l=0,c=e.split("\n");do{for(i=!1,r=[],l=0;l"===a.substr(0,1),n&&!o?(i=!0,o=!0,r.push("~~~blockquote~~~"),r.push(a.substr(1))):!n&&o?(o=!1,r.push("~~~/blockquote~~~"),r.push(a)):r.push(n&&o?a.substr(1):a);o&&(o=!1,r.push("~~~/blockquote~~~")),c=r}while(i);return e=c.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/[\s]*~~~\/blockquote~~~/g,"
").replace(/[\-_~]{10,}/g,"
").replace(/\n/g,"
"),t?s.linkify(e):e},r.rainloop_Utils_htmlToPlain=s.htmlToPlain,r.rainloop_Utils_plainToHtml=s.plainToHtml,s.linkify=function(e){return o.fn&&o.fn.linkify&&(e=c.html(e.replace(/&/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&")),e},s.resizeAndCrop=function(e,t,s){var o=new r.Image;o.onload=function(){var e=[0,0],o=r.document.createElement("canvas"),i=o.getContext("2d");o.width=t,o.height=t,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],i.fillStyle="#fff",i.fillRect(0,0,t,t),i.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,t,t),s(o.toDataURL("image/jpeg"))},o.src=e},s.folderListOptionsBuilder=function(e,t,o,i,n,a,l,c,u,d){var h=null,m=!1,g=0,f=0,b="Â Â Â ",S=[];for(u=s.isNormal(u)?u:0g;g++)S.push({id:i[g][0],name:i[g][1],system:!1,seporator:!1,disabled:!1});for(m=!0,g=0,f=e.length;f>g;g++)h=e[g],(l?l.call(null,h):!0)&&(m&&0g;g++)h=t[g],(h.subScribed()||!h.existen)&&(l?l.call(null,h):!0)&&(p.FolderType.User===h.type()||!u||01||c>0&&l>c){for(l>c?(u(c),o=c,i=c):((3>=l||l>=c-2)&&(n+=2),u(l),o=l,i=l);n>0;)if(o-=1,i+=1,o>0&&(u(o,!1),n--),c>=i)u(i,!0),n--;else if(0>=o)break;3===o?u(2,!1):o>3&&u(r.Math.round((o-1)/2),!1,"..."),c-2===i?u(c-1,!0):c-2>i&&u(r.Math.round((c+i)/2),!0,"..."),o>1&&u(1,!1),c>i&&u(c,!0)}return a}},s.selectElement=function(e){if(r.getSelection){var t=r.getSelection();t.removeAllRanges();var s=r.document.createRange();s.selectNodeContents(e),t.addRange(s)}else if(r.document.selection){var o=r.document.body.createTextRange();o.moveToElementText(e),o.select()}},s.detectDropdownVisibility=i.debounce(function(){m.dropdownVisibility(!!i.find(m.aBootstrapDropdowns,function(e){return e.hasClass("open")}))},50),s.triggerAutocompleteInputChange=function(e){var t=function(){o(".checkAutocomplete").trigger("change")};e?i.delay(t,100):t()},t.exports=s}(t)},{"../External/$div.js":15,"../External/$doc.js":16,"../External/$html.js":17,"../External/$window.js":18,"../External/NotificationClass.js":22,"../External/jquery.js":26,"../External/ko.js":28,"../External/underscore.js":31,"../External/window.js":32,"./Consts.js":6,"./Enums.js":7,"./Globals.js":9}],15:[function(e,t){"use strict";t.exports=e("./jquery.js")("")},{"./jquery.js":26}],16:[function(e,t){"use strict";t.exports=e("./jquery.js")(window.document)},{"./jquery.js":26}],17:[function(e,t){"use strict";t.exports=e("./jquery.js")("html")},{"./jquery.js":26}],18:[function(e,t){"use strict";t.exports=e("./jquery.js")(window)},{"./jquery.js":26}],19:[function(e,t){"use strict";t.exports=e("./window.js").rainloopAppData||{}},{"./window.js":32}],20:[function(e,t){"use strict";t.exports=JSON},{}],21:[function(e,t){"use strict";t.exports=Jua},{}],22:[function(e,t){"use strict";var s=e("./window.js");t.exports=s.Notification&&s.Notification.requestPermission?s.Notification:null},{"./window.js":32}],23:[function(e,t){"use strict";t.exports=crossroads},{}],24:[function(e,t){"use strict";t.exports=hasher},{}],25:[function(e,t){"use strict";t.exports=ifvisible},{}],26:[function(e,t){"use strict";t.exports=$},{}],27:[function(e,t){"use strict";t.exports=key},{}],28:[function(e,t){!function(t,s){"use strict";var o=e("./window.js"),i=e("./underscore.js"),n=e("./jquery.js"),r=e("./$window.js"),a=e("./$doc.js");s.bindingHandlers.tooltip={init:function(t,o){var i=e("../Common/Globals.js"),r=e("../Common/Utils.js");if(!i.bMobileDevice){var a=n(t),l=a.data("tooltip-class")||"",c=a.data("tooltip-placement")||"top";a.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:c,trigger:"hover",title:function(){return a.is(".disabled")||i.dropdownVisibility()?"":''+r.i18n(s.utils.unwrapObservable(o()))+""}}).click(function(){a.tooltip("hide")}),i.tooltipTrigger.subscribe(function(){a.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(t,s){var o=e("../Common/Globals.js"),i=n(t),r=i.data("tooltip-class")||"",a=i.data("tooltip-placement")||"top";i.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,title:function(){return i.is(".disabled")||o.dropdownVisibility()?"":''+s()()+""}}).click(function(){i.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){i.tooltip("hide")})}},s.bindingHandlers.tooltip3={init:function(t){var s=n(t),o=e("../Common/Globals.js");s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),a.click(function(){s.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){s.tooltip("hide")})},update:function(e,t){var o=s.utils.unwrapObservable(t());""===o?n(e).data("tooltip3-data","").tooltip("hide"):n(e).data("tooltip3-data",o).tooltip("show")}},s.bindingHandlers.registrateBootstrapDropdown={init:function(t){var s=e("../Common/Globals.js");s.aBootstrapDropdowns.push(n(t))}},s.bindingHandlers.openDropdownTrigger={update:function(t,o){if(s.utils.unwrapObservable(o())){var i=n(t),r=e("../Common/Utils.js");i.hasClass("open")||(i.find(".dropdown-toggle").dropdown("toggle"),r.detectDropdownVisibility()),o()(!1)}}},s.bindingHandlers.dropdownCloser={init:function(e){n(e).closest(".dropdown").on("click",".e-item",function(){n(e).dropdown("toggle")})}},s.bindingHandlers.popover={init:function(e,t){n(e).popover(s.utils.unwrapObservable(t()))}},s.bindingHandlers.csstext={init:function(t,o){var i=e("../Common/Utils.js");t&&t.styleSheet&&!i.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=s.utils.unwrapObservable(o()):n(t).text(s.utils.unwrapObservable(o()))},update:function(t,o){var i=e("../Common/Utils.js");t&&t.styleSheet&&!i.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=s.utils.unwrapObservable(o()):n(t).text(s.utils.unwrapObservable(o()))}},s.bindingHandlers.resizecrop={init:function(e){n(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,t){t()(),n(e).resizecrop({width:"100",height:"100"})}},s.bindingHandlers.onEnter={init:function(e,t,s,i){n(e).on("keypress",function(s){s&&13===o.parseInt(s.keyCode,10)&&(n(e).trigger("change"),t().call(i))})}},s.bindingHandlers.onEsc={init:function(e,t,s,i){n(e).on("keypress",function(s){s&&27===o.parseInt(s.keyCode,10)&&(n(e).trigger("change"),t().call(i))})}},s.bindingHandlers.clickOnTrue={update:function(e,t){s.utils.unwrapObservable(t())&&n(e).click()}},s.bindingHandlers.modal={init:function(t,o){var i=e("../Common/Globals.js"),r=e("../Common/Utils.js");n(t).toggleClass("fade",!i.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(o())}).on("shown",function(){r.windowResize()}).find(".close").click(function(){o()(!1)})},update:function(e,t){n(e).modal(s.utils.unwrapObservable(t())?"show":"hide")}},s.bindingHandlers.i18nInit={init:function(t){var s=e("../Common/Utils.js");s.i18nToNode(t)}},s.bindingHandlers.i18nUpdate={update:function(t,o){var i=e("../Common/Utils.js");s.utils.unwrapObservable(o()),i.i18nToNode(t)}},s.bindingHandlers.link={update:function(e,t){n(e).attr("href",s.utils.unwrapObservable(t()))}},s.bindingHandlers.title={update:function(e,t){n(e).attr("title",s.utils.unwrapObservable(t()))}},s.bindingHandlers.textF={init:function(e,t){n(e).text(s.utils.unwrapObservable(t()))}},s.bindingHandlers.initDom={init:function(e,t){t()(e)}},s.bindingHandlers.initResizeTrigger={init:function(e,t){var o=s.utils.unwrapObservable(t());n(e).css({height:o[1],"min-height":o[1]})},update:function(t,o){var i=e("../Common/Utils.js"),a=s.utils.unwrapObservable(o()),l=i.pInt(a[1]),c=0,u=n(t).offset().top;u>0&&(u+=i.pInt(a[2]),c=r.height()-u,c>l&&(l=c),n(t).css({height:l,"min-height":l}))}},s.bindingHandlers.appendDom={update:function(e,t){n(e).hide().empty().append(s.utils.unwrapObservable(t())).show()}},s.bindingHandlers.draggable={init:function(t,i,r){var a=e("../Common/Globals.js"),l=e("../Common/Utils.js");if(!a.bMobileDevice){var c=100,u=3,d=r(),p=d&&d.droppableSelector?d.droppableSelector:"",h={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};p&&(h.drag=function(e){n(p).each(function(){var t=null,s=null,i=n(this),r=i.offset(),a=r.top+i.height();o.clearInterval(i.data("timerScroll")),i.data("timerScroll",!1),e.pageX>=r.left&&e.pageX<=r.left+i.width()&&(e.pageY>=a-c&&e.pageY<=a&&(t=function(){i.scrollTop(i.scrollTop()+u),l.windowResize()},i.data("timerScroll",o.setInterval(t,10)),t()),e.pageY>=r.top&&e.pageY<=r.top+c&&(s=function(){i.scrollTop(i.scrollTop()-u),l.windowResize()},i.data("timerScroll",o.setInterval(s,10)),s()))})},h.stop=function(){n(p).each(function(){o.clearInterval(n(this).data("timerScroll")),n(this).data("timerScroll",!1)})}),h.helper=function(e){return i()(e&&e.target?s.dataFor(e.target):null)},n(t).draggable(h).on("mousedown",function(){l.removeInFocus()})}}},s.bindingHandlers.droppable={init:function(t,s,o){var i=e("../Common/Globals.js");if(!i.bMobileDevice){var r=s(),a=o(),l=a&&a.droppableOver?a.droppableOver:null,c=a&&a.droppableOut?a.droppableOut:null,u={tolerance:"pointer",hoverClass:"droppableHover"};r&&(u.drop=function(e,t){r(e,t)},l&&(u.over=function(e,t){l(e,t)}),c&&(u.out=function(e,t){c(e,t)}),n(t).droppable(u))}}},s.bindingHandlers.nano={init:function(t){var s=e("../Common/Globals.js");s.bDisableNanoScroll||n(t).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},s.bindingHandlers.saveTrigger={init:function(e){var t=n(e);t.data("save-trigger-type",t.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===t.data("save-trigger-type")?t.append(' ').addClass("settings-saved-trigger"):t.addClass("settings-saved-trigger-input")},update:function(e,t){var o=s.utils.unwrapObservable(t()),i=n(e);if("custom"===i.data("save-trigger-type"))switch(o.toString()){case"1":i.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":i.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":i.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:i.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(o.toString()){case"1":i.addClass("success").removeClass("error");break;case"0":i.addClass("error").removeClass("success");break;case"-2":break;default:i.removeClass("error success")}}},s.bindingHandlers.emailsTags={init:function(t,s,o){var r=e("../Common/Utils.js"),a=e("../Models/EmailModel.js"),l=n(t),c=s(),u=o(),d=u.autoCompleteSource||null,p=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:p,inputDelimiters:[",",";"],autoCompleteSource:d,parseHook:function(e){return i.map(e,function(e){var t=r.trim(e),s=null;return""!==t?(s=new a,s.mailsoParse(t),s.clearDuplicateName(),[s.toLine(!1),s]):[t,null]})},change:i.bind(function(e){l.data("EmailsTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,o){var i=n(e),r=o(),a=r.emailsTagsFilter||null,l=s.utils.unwrapObservable(t());i.data("EmailsTagsValue")!==l&&(i.val(l),i.data("EmailsTagsValue",l),i.inputosaurus("refresh")),a&&s.utils.unwrapObservable(a)&&i.inputosaurus("focus")}},s.bindingHandlers.contactTags={init:function(t,s,o){var r=e("../Common/Utils.js"),a=e("../Models/ContactTagModel.js"),l=n(t),c=s(),u=o(),d=u.autoCompleteSource||null,p=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:p,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:d,parseHook:function(e){return i.map(e,function(e){var t=r.trim(e),s=null;return""!==t?(s=new a,s.name(t),[s.toLine(!1),s]):[t,null]})},change:i.bind(function(e){l.data("ContactTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,o){var i=n(e),r=o(),a=r.contactTagsFilter||null,l=s.utils.unwrapObservable(t());i.data("ContactTagsValue")!==l&&(i.val(l),i.data("ContactTagsValue",l),i.inputosaurus("refresh")),a&&s.utils.unwrapObservable(a)&&i.inputosaurus("focus")}},s.bindingHandlers.command={init:function(e,t,o,i){var r=n(e),a=t();if(!a||!a.enabled||!a.canExecute)throw new Error("You are not using command function");r.addClass("command"),s.bindingHandlers[r.is("form")?"submit":"click"].init.apply(i,arguments)},update:function(e,t){var s=!0,o=n(e),i=t();s=i.enabled(),o.toggleClass("command-not-enabled",!s),s&&(s=i.canExecute(),o.toggleClass("command-can-not-be-execute",!s)),o.toggleClass("command-disabled disable disabled",!s).toggleClass("no-disabled",!!s),(o.is("input")||o.is("button"))&&o.prop("disabled",!s)}},s.extenders.trimmer=function(t){var o=e("../Common/Utils.js"),i=s.computed({read:t,write:function(e){t(o.trim(e.toString()))},owner:this});return i(t()),i},s.extenders.posInterer=function(t,o){var i=e("../Common/Utils.js"),n=s.computed({read:t,write:function(e){var s=i.pInt(e.toString(),o);0>=s&&(s=o),s===t()&&""+s!=""+e&&t(s+1),t(s)}});return n(t()),n},s.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},s.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},s.extenders.falseTimeout=function(t,s){var i=e("../Common/Utils.js");return t.iTimeout=0,t.subscribe(function(e){e&&(o.clearTimeout(t.iTimeout),t.iTimeout=o.setTimeout(function(){t(!1),t.iTimeout=0},i.pInt(s)))}),t},s.observable.fn.validateNone=function(){return this.hasError=s.observable(!1),this},s.observable.fn.validateEmail=function(){var t=e("../Common/Utils.js");return this.hasError=s.observable(!1),this.subscribe(function(e){e=t.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateSimpleEmail=function(){var t=e("../Common/Utils.js");return this.hasError=s.observable(!1),this.subscribe(function(e){e=t.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateFunc=function(t){var o=e("../Common/Utils.js");return this.hasFuncError=s.observable(!1),o.isFunc(t)&&(this.subscribe(function(e){this.hasFuncError(!t(e))},this),this.valueHasMutated()),this},t.exports=s}(t,ko)},{"../Common/Globals.js":9,"../Common/Utils.js":14,"../Models/ContactTagModel.js":42,"../Models/EmailModel.js":43,"./$doc.js":16,"./$window.js":18,"./jquery.js":26,"./underscore.js":31,"./window.js":32}],29:[function(e,t){"use strict";t.exports=moment},{}],30:[function(e,t){"use strict";t.exports=ssm},{}],31:[function(e,t){"use strict";t.exports=_},{}],32:[function(e,t){"use strict";t.exports=window},{}],33:[function(e,t){!function(t){"use strict";function s(){this.sDefaultScreenName="",this.oScreens={},this.oCurrentScreen=null}var o=e("../External/jquery.js"),i=e("../External/underscore.js"),n=e("../External/ko.js"),r=e("../External/hasher.js"),a=e("../External/crossroads.js"),l=e("../External/$html.js"),c=e("../Common/Globals.js"),u=e("../Common/Plugins.js"),d=e("../Common/Utils.js"),p=e("../Knoin/KnoinAbstractViewModel.js");
-s.prototype.sDefaultScreenName="",s.prototype.oScreens={},s.prototype.oCurrentScreen=null,s.prototype.hideLoading=function(){o("#rl-loading").hide()},s.prototype.constructorEnd=function(e){d.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},s.prototype.extendAsViewModel=function(e,t,s){t&&(s||(s=p),t.__name=e,u.regViewModelHook(e,t),i.extend(t.prototype,s.prototype))},s.prototype.addSettingsViewModel=function(e,t,s,o,i){e.__rlSettingsData={Label:s,Template:t,Route:o,IsDefault:!!i},c.aViewModels.settings.push(e)},s.prototype.removeSettingsViewModel=function(e){c.aViewModels["settings-removed"].push(e)},s.prototype.disableSettingsViewModel=function(e){c.aViewModels["settings-disabled"].push(e)},s.prototype.routeOff=function(){r.changed.active=!1},s.prototype.routeOn=function(){r.changed.active=!0},s.prototype.screen=function(e){return""===e||d.isUnd(this.oScreens[e])?null:this.oScreens[e]},s.prototype.buildViewModel=function(e,t){if(e&&!e.__builded){var s=this,r=new e(t),a=r.viewModelPosition(),l=o("#rl-content #rl-"+a.toLowerCase()),p=null;e.__builded=!0,e.__vm=r,r.viewModelName=e.__name,l&&1===l.length?(p=o("").addClass("rl-view-model").addClass("RL-"+r.viewModelTemplate()).hide(),p.appendTo(l),r.viewModelDom=p,e.__dom=p,"Popups"===a&&(r.cancelCommand=r.closeCommand=d.createCommand(r,function(){s.hideScreenPopup(e)}),r.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),c.popupVisibilityNames.push(this.viewModelName),r.viewModelDom.css("z-index",3e3+c.popupVisibilityNames().length+10),d.delegateRun(this,"onFocus",[],500)):(d.delegateRun(this,"onHide"),this.restoreKeyScope(),c.popupVisibilityNames.remove(this.viewModelName),r.viewModelDom.css("z-index",2e3),c.tooltipTrigger(!c.tooltipTrigger()),i.delay(function(){t.viewModelDom.hide()},300))},r)),u.runHook("view-model-pre-build",[e.__name,r,p]),n.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:r.viewModelTemplate()}}},r),d.delegateRun(r,"onBuild",[p]),r&&"Popups"===a&&r.registerPopupKeyDown(),u.runHook("view-model-post-build",[e.__name,r,p])):d.log("Cannot find view model position: "+a)}return e?e.__vm:null},s.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),u.runHook("view-model-on-hide",[e.__name,e.__vm]))},s.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),d.delegateRun(e.__vm,"onShow",t||[]),u.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},s.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},s.prototype.screenOnRoute=function(e,t){var s=this,o=null,n=null;""===d.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(o=this.screen(e),o||(o=this.screen(this.sDefaultScreenName),o&&(t=e+"/"+t,e=this.sDefaultScreenName)),o&&o.__started&&(o.__builded||(o.__builded=!0,d.isNonEmptyArray(o.viewModels())&&i.each(o.viewModels(),function(e){this.buildViewModel(e,o)},this),d.delegateRun(o,"onBuild")),i.defer(function(){s.oCurrentScreen&&(d.delegateRun(s.oCurrentScreen,"onHide"),d.isNonEmptyArray(s.oCurrentScreen.viewModels())&&i.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),d.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=o,s.oCurrentScreen&&(d.delegateRun(s.oCurrentScreen,"onShow"),u.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),d.isNonEmptyArray(s.oCurrentScreen.viewModels())&&i.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),d.delegateRun(e.__vm,"onShow"),d.delegateRun(e.__vm,"onFocus",[],200),u.runHook("view-model-on-show",[e.__name,e.__vm]))},s)),n=o.__cross(),n&&n.parse(t)})))},s.prototype.startScreens=function(e){o("#rl-content").css({visibility:"hidden"}),i.each(e,function(e){var t=new e,s=t?t.screenName():"";t&&""!==s&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=s),this.oScreens[s]=t)},this),i.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),u.runHook("screen-pre-start",[e.screenName(),e]),d.delegateRun(e,"onStart"),u.runHook("screen-post-start",[e.screenName(),e]))},this);var t=a.create();t.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this)),r.initialized.add(t.parse,t),r.changed.add(t.parse,t),r.init(),o("#rl-content").css({visibility:"visible"}),i.delay(function(){l.removeClass("rl-started-trigger").addClass("rl-started")},50)},s.prototype.setHash=function(e,t,s){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,s=d.isUnd(s)?!1:!!s,(d.isUnd(t)?1:!t)?(r.changed.active=!0,r[s?"replaceHash":"setHash"](e),r.setHash(e)):(r.changed.active=!1,r[s?"replaceHash":"setHash"](e),r.changed.active=!0)},t.exports=new s}(t)},{"../Common/Globals.js":9,"../Common/Plugins.js":12,"../Common/Utils.js":14,"../External/$html.js":17,"../External/crossroads.js":23,"../External/hasher.js":24,"../External/jquery.js":26,"../External/ko.js":28,"../External/underscore.js":31,"../Knoin/KnoinAbstractViewModel.js":36}],34:[function(e,t){!function(e){"use strict";function t(){}t.prototype.bootstart=function(){},e.exports=t}(t)},{}],35:[function(e,t){!function(t){"use strict";function s(e,t){this.sScreenName=e,this.aViewModels=i.isArray(t)?t:[]}var o=e("../External/crossroads.js"),i=e("../Common/Utils.js");s.prototype.oCross=null,s.prototype.sScreenName="",s.prototype.aViewModels=[],s.prototype.viewModels=function(){return this.aViewModels},s.prototype.screenName=function(){return this.sScreenName},s.prototype.routes=function(){return null},s.prototype.__cross=function(){return this.oCross},s.prototype.__start=function(){var e=this.routes(),t=null,s=null;i.isNonEmptyArray(e)&&(s=_.bind(this.onRoute||i.emptyFunction,this),t=o.create(),_.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},t.exports=s}(t)},{"../Common/Utils.js":14,"../External/crossroads.js":23}],36:[function(e,t){!function(t){"use strict";function s(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=a.pString(e),this.sTemplate=a.pString(t),this.sDefaultKeyScope=n.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=o.observable(!1),this.modalVisibility=o.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}var o=e("../External/ko.js"),i=e("../External/$window.js"),n=e("../Common/Enums.js"),r=e("../Common/Globals.js"),a=e("../Common/Utils.js");s.prototype.sPosition="",s.prototype.sTemplate="",s.prototype.viewModelName="",s.prototype.viewModelDom=null,s.prototype.viewModelTemplate=function(){return this.sTemplate},s.prototype.viewModelPosition=function(){return this.sPosition},s.prototype.cancelCommand=function(){},s.prototype.closeCommand=function(){},s.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=r.keyScope(),r.keyScope(this.sDefaultKeyScope)},s.prototype.restoreKeyScope=function(){r.keyScope(this.sCurrentKeyScope)},s.prototype.registerPopupKeyDown=function(){var e=this;i.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&n.EventKeyCode.Esc===t.keyCode)return a.delegateRun(e,"cancelCommand"),!1;if(n.EventKeyCode.Backspace===t.keyCode&&!a.inFocus())return!1}return!0})},t.exports=s}(t)},{"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$window.js":18,"../External/ko.js":28}],37:[function(e,t){!function(t){"use strict";function s(e,t){this.email=e,this.deleteAccess=o.observable(!1),this.canBeDalete=o.observable(t)}var o=e("../External/ko.js");s.prototype.email="",s.prototype.changeAccountLink=function(){return e("../Common/LinkBuilder.js").change(this.email)},t.exports=s}(t)},{"../Common/LinkBuilder.js":10,"../External/ko.js":28}],38:[function(e,t){!function(t){"use strict";function s(){this.mimeType="",this.fileName="",this.estimatedSize=0,this.friendlySize="",this.isInline=!1,this.isLinked=!1,this.cid="",this.cidWithOutTags="",this.contentLocation="",this.download="",this.folder="",this.uid="",this.mimeIndex=""}var o=e("../External/window.js"),i=e("../Common/Globals.js"),n=e("../Common/Utils.js"),r=e("../Common/LinkBuilder.js");s.newInstanceFromJson=function(e){var t=new s;return t.initByJson(e)?t:null},s.prototype.mimeType="",s.prototype.fileName="",s.prototype.estimatedSize=0,s.prototype.friendlySize="",s.prototype.isInline=!1,s.prototype.isLinked=!1,s.prototype.cid="",s.prototype.cidWithOutTags="",s.prototype.contentLocation="",s.prototype.download="",s.prototype.folder="",s.prototype.uid="",s.prototype.mimeIndex="",s.prototype.initByJson=function(e){var t=!1;return e&&"Object/Attachment"===e["@Object"]&&(this.mimeType=(e.MimeType||"").toLowerCase(),this.fileName=e.FileName,this.estimatedSize=n.pInt(e.EstimatedSize),this.isInline=!!e.IsInline,this.isLinked=!!e.IsLinked,this.cid=e.CID,this.contentLocation=e.ContentLocation,this.download=e.Download,this.folder=e.Folder,this.uid=e.Uid,this.mimeIndex=e.MimeIndex,this.friendlySize=n.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),t=!0),t},s.prototype.isImage=function(){return-1,]+)>?,? ?/g,s=t.exec(e);s?(this.name=s[1]||"",this.email=s[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},s.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=i.trim(e.Name),this.email=i.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},s.prototype.toLine=function(e,t,s){var o="";return""!==this.email&&(t=i.isUnd(t)?!1:!!t,s=i.isUnd(s)?!1:!!s,e&&""!==this.name?o=t?'")+'" target="_blank" tabindex="-1">'+i.encodeHtml(this.name)+"":s?i.encodeHtml(this.name):this.name:(o=this.email,""!==this.name?t?o=i.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+i.encodeHtml(o)+""+i.encodeHtml(">"):(o='"'+this.name+'" <'+o+">",s&&(o=i.encodeHtml(o))):t&&(o=''+i.encodeHtml(this.email)+""))),o},s.prototype.mailsoParse=function(e){if(e=i.trim(e),""===e)return!1;for(var t=function(e,t,s){e+="";var o=e.length;return 0>t&&(t+=o),o="undefined"==typeof s?o:0>s?s+o:s+t,t>=e.length||0>t||t>o?!1:e.slice(t,o)},s=function(e,t,s,o){return 0>s&&(s+=e.length),o=void 0!==o?o:e.length,0>o&&(o=o+e.length-s),e.slice(0,s)+t.substr(0,o)+t.slice(o)+e.slice(s+o)},o="",n="",r="",a=!1,l=!1,c=!1,u=null,d=0,p=0,h=0;h0&&0===o.length&&(o=t(e,0,h)),l=!0,d=h);break;case">":l&&(p=h,n=t(e,d+1,p-d-1),e=s(e,"",d,p-d+1),p=0,h=0,d=0,l=!1);break;case"(":a||l||c||(c=!0,d=h);break;case")":c&&(p=h,r=t(e,d+1,p-d-1),e=s(e,"",d,p-d+1),p=0,h=0,d=0,c=!1);break;case"\\":h++}h++}return 0===n.length&&(u=e.match(/[^@\s]+@\S+/i),u&&u[0]?n=u[0]:o=e),n.length>0&&0===o.length&&0===r.length&&(o=e.replace(n,"")),n=i.trim(n).replace(/^[<]+/,"").replace(/[>]+$/,""),o=i.trim(o).replace(/^["']+/,"").replace(/["']+$/,""),r=i.trim(r).replace(/^[(]+/,"").replace(/[)]+$/,""),o=o.replace(/\\\\(.)/,"$1"),r=r.replace(/\\\\(.)/,"$1"),this.name=o,this.email=n,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 00){if(r.FolderType.Draft===s)return""+e;if(t>0&&r.FolderType.Trash!==s&&r.FolderType.Archive!==s&&r.FolderType.SentItems!==s)return""+t}return""},this),this.canBeDeleted=i.computed(function(){var e=this.isSystemFolder();return!e&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=i.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){l.timeOutAction("folder-list-folder-visibility-change",function(){n.trigger("folder-list-folder-visibility-change")},100)}),this.localName=i.computed(function(){a.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case r.FolderType.Inbox:t=l.i18n("FOLDER_LIST/INBOX_NAME");break;case r.FolderType.SentItems:t=l.i18n("FOLDER_LIST/SENT_NAME");break;case r.FolderType.Draft:t=l.i18n("FOLDER_LIST/DRAFTS_NAME");break;case r.FolderType.Spam:t=l.i18n("FOLDER_LIST/SPAM_NAME");break;case r.FolderType.Trash:t=l.i18n("FOLDER_LIST/TRASH_NAME");break;case r.FolderType.Archive:t=l.i18n("FOLDER_LIST/ARCHIVE_NAME")}return t},this),this.manageFolderSystemName=i.computed(function(){a.langChangeTrigger();var e="",t=this.type(),s=this.name();if(this.isSystemFolder())switch(t){case r.FolderType.Inbox:e="("+l.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case r.FolderType.SentItems:e="("+l.i18n("FOLDER_LIST/SENT_NAME")+")";break;case r.FolderType.Draft:e="("+l.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case r.FolderType.Spam:e="("+l.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case r.FolderType.Trash:e="("+l.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case r.FolderType.Archive:e="("+l.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==e&&"("+s+")"===e||"(inbox)"===e.toLowerCase())&&(e=""),e},this),this.collapsed=i.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(e){this.collapsedPrivate(e)},owner:this}),this.hasUnreadMessages=i.computed(function(){return 0"},s.prototype.formattedNameForCompose=function(){var e=this.name();return""===e?this.email():e+" ("+this.email()+")"},s.prototype.formattedNameForEmail=function(){var e=this.name();return""===e?this.email():'"'+i.quoteName(e)+'" <'+this.email()+">"},t.exports=s}(t)},{"../Common/Utils.js":14,"../External/ko.js":28}],48:[function(e,t){!function(t){"use strict";function s(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject=r.observable(""),this.subjectPrefix=r.observable(""),this.subjectSuffix=r.observable(""),this.size=r.observable(0),this.dateTimeStampInUTC=r.observable(0),this.priority=r.observable(u.MessagePriority.Normal),this.proxy=!1,this.fromEmailString=r.observable(""),this.fromClearEmailString=r.observable(""),this.toEmailsString=r.observable(""),this.toClearEmailsString=r.observable(""),this.senderEmailsString=r.observable(""),this.senderClearEmailsString=r.observable(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation=r.observable(!1),this.deleted=r.observable(!1),this.unseen=r.observable(!1),this.flagged=r.observable(!1),this.answered=r.observable(!1),this.forwarded=r.observable(!1),this.isReadReceipt=r.observable(!1),this.focused=r.observable(!1),this.selected=r.observable(!1),this.checked=r.observable(!1),this.hasAttachments=r.observable(!1),this.attachmentsMainType=r.observable(""),this.moment=r.observable(a(a.unix(0))),this.attachmentIconClass=r.computed(function(){var e="";if(this.hasAttachments())switch(e="icon-attachment",this.attachmentsMainType()){case"image":e="icon-image";break;case"archive":e="icon-file-zip";break;case"doc":e="icon-file-text"}return e},this),this.fullFormatDateValue=r.computed(function(){return s.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=d.createMomentDate(this),this.momentShortDate=d.createMomentShortDate(this),this.dateTimeStampInUTC.subscribe(function(e){var t=a().unix();this.moment(a.unix(e>t?t:e))},this),this.body=null,this.plainRaw="",this.isHtml=r.observable(!1),this.hasImages=r.observable(!1),this.attachments=r.observableArray([]),this.isPgpSigned=r.observable(!1),this.isPgpEncrypted=r.observable(!1),this.pgpSignedVerifyStatus=r.observable(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser=r.observable(""),this.priority=r.observable(u.MessagePriority.Normal),this.readReceipt=r.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=r.observable(0),this.threads=r.observableArray([]),this.threadsLen=r.observable(0),this.hasUnseenSubMessage=r.observable(!1),this.hasFlaggedSubMessage=r.observable(!1),this.lastInCollapsedThread=r.observable(!1),this.lastInCollapsedThreadLoading=r.observable(!1),this.threadsLenResult=r.computed(function(){var e=this.threadsLen();return 0===this.parentUid()&&e>0?e+1:""},this)}var o=e("../External/window.js"),i=e("../External/jquery.js"),n=e("../External/underscore.js"),r=e("../External/ko.js"),a=e("../External/moment.js"),l=e("../External/$window.js"),c=e("../External/$div.js"),u=e("../Common/Enums.js"),d=e("../Common/Utils.js"),p=e("../Common/LinkBuilder.js"),h=e("./EmailModel.js"),m=e("./AttachmentModel.js");s.newInstanceFromJson=function(e){var t=new s;return t.initByJson(e)?t:null},s.calculateFullFromatDateValue=function(e){return e>0?a.unix(e).format("LLL"):""},s.emailsToLine=function(e,t,s){var o=[],i=0,n=0;if(d.isNonEmptyArray(e))for(i=0,n=e.length;n>i;i++)o.push(e[i].toLine(t,s));return o.join(", ")},s.emailsToLineClear=function(e){var t=[],s=0,o=0;if(d.isNonEmptyArray(e))for(s=0,o=e.length;o>s;s++)e[s]&&e[s].email&&""!==e[s].name&&t.push(e[s].email);return t.join(", ")},s.initEmailsFromJson=function(e){var t=0,s=0,o=null,i=[];
-if(d.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)o=h.newInstanceFromJson(e[t]),o&&i.push(o);return i},s.replyHelper=function(e,t,s){if(e&&0o;o++)d.isUnd(t[e[o].email])&&(t[e[o].email]=!0,s.push(e[o]))},s.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.subjectPrefix(""),this.subjectSuffix(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(u.MessagePriority.Normal),this.proxy=!1,this.fromEmailString(""),this.fromClearEmailString(""),this.toEmailsString(""),this.toClearEmailsString(""),this.senderEmailsString(""),this.senderClearEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(u.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},s.prototype.computeSenderEmail=function(){var t=e("../Storages/WebMailDataStorage.js"),s=t.sentFolder(),o=t.draftFolder();this.senderEmailsString(this.folderFullNameRaw===s||this.folderFullNameRaw===o?this.toEmailsString():this.fromEmailString()),this.senderClearEmailsString(this.folderFullNameRaw===s||this.folderFullNameRaw===o?this.toClearEmailsString():this.fromClearEmailString())},s.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.proxy=!!e.ExternalProxy,this.size(d.pInt(e.Size)),this.from=s.initEmailsFromJson(e.From),this.to=s.initEmailsFromJson(e.To),this.cc=s.initEmailsFromJson(e.Cc),this.bcc=s.initEmailsFromJson(e.Bcc),this.replyTo=s.initEmailsFromJson(e.ReplyTo),this.deliveredTo=s.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),d.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(d.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(s.emailsToLine(this.from,!0)),this.fromClearEmailString(s.emailsToLineClear(this.from)),this.toEmailsString(s.emailsToLine(this.to,!0)),this.toClearEmailsString(s.emailsToLineClear(this.to)),this.parentUid(d.pInt(e.ParentThread)),this.threads(d.isArray(e.Threads)?e.Threads:[]),this.threadsLen(d.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},s.prototype.initUpdateByMessageJson=function(t){var s=e("../Storages/WebMailDataStorage.js"),o=!1,i=u.MessagePriority.Normal;return t&&"Object/Message"===t["@Object"]&&(i=d.pInt(t.Priority),this.priority(-1t;t++)o=m.newInstanceFromJson(e["@Collection"][t]),o&&(""!==o.cidWithOutTags&&0 +$/,""),t=n.find(s,function(t){return e===t.cidWithOutTags})),t||null},s.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return d.isNonEmptyArray(s)&&(t=n.find(s,function(t){return e===t.contentLocation})),t||null},s.prototype.messageId=function(){return this.sMessageId},s.prototype.inReplyTo=function(){return this.sInReplyTo},s.prototype.references=function(){return this.sReferences},s.prototype.fromAsSingleEmail=function(){return d.isArray(this.from)&&this.from[0]?this.from[0].email:""},s.prototype.viewLink=function(){return p.messageViewLink(this.requestHash)},s.prototype.downloadLink=function(){return p.messageDownloadLink(this.requestHash)},s.prototype.replyEmails=function(e){var t=[],o=d.isUnd(e)?{}:e;return s.replyHelper(this.replyTo,o,t),0===t.length&&s.replyHelper(this.from,o,t),t},s.prototype.replyAllEmails=function(e){var t=[],o=[],i=d.isUnd(e)?{}:e;return s.replyHelper(this.replyTo,i,t),0===t.length&&s.replyHelper(this.from,i,t),s.replyHelper(this.to,i,t),s.replyHelper(this.cc,i,o),[t,o]},s.prototype.textBodyToString=function(){return this.body?this.body.html():""},s.prototype.attachmentsToStringLine=function(){var e=n.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0=0&&o&&!n&&s.attr("src",o)}),e&&o.setTimeout(function(){t.print()},100))})},s.prototype.printMessage=function(){this.viewPopupMessage(!0)},s.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},s.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.subjectPrefix(this.subjectPrefix()),this.subjectSuffix(this.subjectSuffix()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.proxy=e.proxy,this.fromEmailString(e.fromEmailString()),this.fromClearEmailString(e.fromClearEmailString()),this.toEmailsString(e.toEmailsString()),this.toClearEmailsString(e.toClearEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(u.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},s.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var t="";e=d.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),t=this.proxy?"data-x-additional-src":"data-x-src",i("["+t+"]",this.body).each(function(){e&&i(this).is("img")?i(this).addClass("lazy").attr("data-original",i(this).attr(t)).removeAttr(t):i(this).attr("src",i(this).attr(t)).removeAttr(t)}),t=this.proxy?"data-x-additional-style-url":"data-x-style-url",i("["+t+"]",this.body).each(function(){var e=d.trim(i(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",i(this).attr("style",e+i(this).attr(t)).removeAttr(t)}),e&&(i("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:i(".RL-MailMessageView .messageView .messageItem .content")[0]}),l.resize()),d.windowResize(500)}},s.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=d.isUnd(e)?!1:e;var t=this;i("[data-x-src-cid]",this.body).each(function(){var s=t.findAttachmentByCid(i(this).attr("data-x-src-cid"));s&&s.download&&(e&&i(this).is("img")?i(this).addClass("lazy").attr("data-original",s.linkPreview()):i(this).attr("src",s.linkPreview()))}),i("[data-x-src-location]",this.body).each(function(){var s=t.findAttachmentByContentLocation(i(this).attr("data-x-src-location"));s||(s=t.findAttachmentByCid(i(this).attr("data-x-src-location"))),s&&s.download&&(e&&i(this).is("img")?i(this).addClass("lazy").attr("data-original",s.linkPreview()):i(this).attr("src",s.linkPreview()))}),i("[data-x-style-cid]",this.body).each(function(){var e="",s="",o=t.findAttachmentByCid(i(this).attr("data-x-style-cid"));o&&o.linkPreview&&(s=i(this).attr("data-x-style-cid-name"),""!==s&&(e=d.trim(i(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",i(this).attr("style",e+s+": url('"+o.linkPreview()+"')")))}),e&&!function(e,t){n.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(i("img.lazy",t.body),i(".RL-MailMessageView .messageView .messageItem .content")[0]),d.windowResize(500)}},s.prototype.storeDataToDom=function(){if(this.body){this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw);var t=e("../Storages/WebMailDataStorage.js");t.capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))}},s.prototype.storePgpVerifyDataToDom=function(){var t=e("../Storages/WebMailDataStorage.js");this.body&&t.capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},s.prototype.fetchDataToDom=function(){if(this.body){this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=d.pString(this.body.data("rl-plain-raw"));var t=e("../Storages/WebMailDataStorage.js");t.capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""))}},s.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var t=[],s=null,r=e("../Storages/WebMailDataStorage.js"),a=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=r.findPublicKeysByEmail(a),d=null,p=null,h="";this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{s=o.openpgp.cleartext.readArmored(this.plainRaw),s&&s.getText&&(this.pgpSignedVerifyStatus(l.length?u.SignedVerifyStatus.Unverified:u.SignedVerifyStatus.UnknownPublicKeys),t=s.verify(l),t&&0').text(h)).html(),c.empty(),this.replacePlaneTextBody(h)))))}catch(m){}this.storePgpVerifyDataToDom()}},s.prototype.decryptPgpEncryptedMessage=function(t){if(this.isPgpEncrypted()){var s=[],r=null,a=null,l=e("../Storages/WebMailDataStorage.js"),d=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",p=l.findPublicKeysByEmail(d),h=l.findSelfPrivateKey(t),m=null,g=null,f="";this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),h||this.pgpSignedVerifyStatus(u.SignedVerifyStatus.UnknownPrivateKey);try{r=o.openpgp.message.readArmored(this.plainRaw),r&&h&&r.decrypt&&(this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Unverified),a=r.decrypt(h),a&&(s=a.verify(p),s&&0').text(f)).html(),c.empty(),this.replacePlaneTextBody(f)))}catch(b){}this.storePgpVerifyDataToDom()}},s.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},s.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},t.exports=s}(t)},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/$div.js":15,"../External/$window.js":18,"../External/jquery.js":26,"../External/ko.js":28,"../External/moment.js":29,"../External/underscore.js":31,"../External/window.js":32,"../Storages/WebMailDataStorage.js":74,"./AttachmentModel.js":38,"./EmailModel.js":43}],49:[function(e,t){!function(t){"use strict";function s(e,t,s,i,n,r,a){this.index=e,this.id=s,this.guid=t,this.user=i,this.email=n,this.armor=a,this.isPrivate=!!r,this.deleteAccess=o.observable(!1)}var o=e("../External/ko.js");s.prototype.index=0,s.prototype.id="",s.prototype.guid="",s.prototype.user="",s.prototype.email="",s.prototype.armor="",s.prototype.isPrivate=!1,t.exports=s}(t)},{"../External/ko.js":28}],50:[function(e,t){!function(t){"use strict";function s(e){u.call(this,"settings",e),this.menu=n.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}var o=e("../External/jquery.js"),i=e("../External/underscore.js"),n=e("../External/ko.js"),r=e("../Common/Globals.js"),a=e("../Common/Utils.js"),l=e("../Common/LinkBuilder.js"),c=e("../Knoin/Knoin.js"),u=e("../Knoin/KnoinAbstractScreen.js");i.extend(s.prototype,u.prototype),s.prototype.onRoute=function(e){var t=this,s=null,u=null,d=null,p=null;u=i.find(r.aViewModels.settings,function(t){return t&&t.__rlSettingsData&&e===t.__rlSettingsData.Route}),u&&(i.find(r.aViewModels["settings-removed"],function(e){return e&&e===u})&&(u=null),u&&i.find(r.aViewModels["settings-disabled"],function(e){return e&&e===u})&&(u=null)),u?(u.__builded&&u.__vm?s=u.__vm:(d=this.oViewModelPlace,d&&1===d.length?(u=u,s=new u,p=o("").addClass("rl-settings-view-model").hide(),p.appendTo(d),s.viewModelDom=p,s.__rlSettingsData=u.__rlSettingsData,u.__dom=p,u.__builded=!0,u.__vm=s,n.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:u.__rlSettingsData.Template}}},s),a.delegateRun(s,"onBuild",[p])):a.log("Cannot find sub settings view model position: SettingsSubScreen")),s&&i.defer(function(){t.oCurrentSubScreen&&(a.delegateRun(t.oCurrentSubScreen,"onHide"),t.oCurrentSubScreen.viewModelDom.hide()),t.oCurrentSubScreen=s,t.oCurrentSubScreen&&(t.oCurrentSubScreen.viewModelDom.show(),a.delegateRun(t.oCurrentSubScreen,"onShow"),a.delegateRun(t.oCurrentSubScreen,"onFocus",[],200),i.each(t.menu(),function(e){e.selected(s&&s.__rlSettingsData&&e.route===s.__rlSettingsData.Route)}),o("#rl-content .b-settings .b-content .content").scrollTop(0)),a.windowResize()})):c.setHash(l.settings(),!1,!0)},s.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(a.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},s.prototype.onBuild=function(){i.each(r.aViewModels.settings,function(e){e&&e.__rlSettingsData&&!i.find(r.aViewModels["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:n.observable(!1),disabled:!!i.find(r.aViewModels["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=o("#rl-content #rl-settings-subscreen")},s.prototype.routes=function(){var e=i.find(r.aViewModels.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",s={subname:/^(.*)$/,normalize_:function(e,s){return s.subname=a.isUnd(s.subname)?t:a.pString(s.subname),[s.subname]}};return[["{subname}/",s],["{subname}",s],["",s]]},t.exports=s}(t)},{"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/ko.js":28,"../External/underscore.js":31,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractScreen.js":35}],51:[function(e,t){!function(t){"use strict";function s(){var t=e("../ViewModels/LoginViewModel.js");i.call(this,"login",[t])}var o=e("../External/underscore.js"),i=e("../Knoin/KnoinAbstractScreen.js");o.extend(s.prototype,i.prototype),s.prototype.onShow=function(){var t=e("../Boots/RainLoopApp.js");t.setTitle("")},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../External/underscore.js":31,"../Knoin/KnoinAbstractScreen.js":35,"../ViewModels/LoginViewModel.js":76}],52:[function(e,t){!function(t){"use strict";function s(){var t=e("../ViewModels/MailBoxSystemDropDownViewModel.js"),s=e("../ViewModels/MailBoxFolderListViewModel.js"),o=e("../ViewModels/MailBoxMessageListViewModel.js"),i=e("../ViewModels/MailBoxMessageViewViewModel.js");c.call(this,"mailbox",[t,s,o,i]),this.oLastRoute={}}var o=e("../External/underscore.js"),i=e("../External/$html.js"),n=e("../Common/Enums.js"),r=e("../Common/Globals.js"),a=e("../Common/Utils.js"),l=e("../Common/Events.js"),c=e("../Knoin/KnoinAbstractScreen.js"),u=e("../Storages/AppSettings.js"),d=e("../Storages/WebMailDataStorage.js"),p=e("../Storages/WebMailCacheStorage.js"),h=e("../Storages/WebMailAjaxRemoteStorage.js");o.extend(s.prototype,c.prototype),s.prototype.oLastRoute={},s.prototype.setNewTitle=function(){var t=e("../Boots/RainLoopApp.js"),s=d.accountEmail(),o=d.foldersInboxUnreadCount();t.setTitle((""===s?"":(o>0?"("+o+") ":" ")+s+" - ")+a.i18n("TITLES/MAILBOX"))},s.prototype.onShow=function(){this.setNewTitle(),r.keyScope(n.KeyState.MessageList)},s.prototype.onRoute=function(t,s,o,i){var r=e("../Boots/RainLoopApp.js");if(a.isUnd(i)?1:!i){var l=p.getFolderFullNameRaw(t),c=p.getFolderFromCacheList(l);c&&(d.currentFolder(c).messageListPage(s).messageListSearch(o),n.Layout.NoPreview===d.layout()&&d.message()&&d.message(null),r.reloadMessageList())}else n.Layout.NoPreview!==d.layout()||d.message()||r.historyBack()},s.prototype.onStart=function(){var t=e("../Boots/RainLoopApp.js"),s=function(){a.windowResize()};(u.capa(n.Capa.AdditionalAccounts)||u.capa(n.Capa.AdditionalIdentities))&&t.accountsAndIdentities(),o.delay(function(){"INBOX"!==d.currentFolderFullNameRaw()&&t.folderInformation("INBOX")},1e3),o.delay(function(){t.quota()},5e3),o.delay(function(){h.appDelayStart(a.emptyFunction)},35e3),i.toggleClass("rl-no-preview-pane",n.Layout.NoPreview===d.layout()),d.folderList.subscribe(s),d.messageList.subscribe(s),d.message.subscribe(s),d.layout.subscribe(function(e){i.toggleClass("rl-no-preview-pane",n.Layout.NoPreview===e)}),l.sub("mailbox.inbox-unread-count",function(e){d.foldersInboxUnreadCount(e)}),d.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},s.prototype.routes=function(){var e=function(){return["Inbox",1,"",!0]},t=function(e,t){return t[0]=a.pString(t[0]),t[1]=a.pInt(t[1]),t[1]=0>=t[1]?1:t[1],t[2]=a.pString(t[2]),""===e&&(t[0]="Inbox",t[1]=1),[decodeURI(t[0]),t[1],decodeURI(t[2]),!1]},s=function(e,t){return t[0]=a.pString(t[0]),t[1]=a.pString(t[1]),""===e&&(t[0]="Inbox"),[decodeURI(t[0]),1,decodeURI(t[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:s}],[/^message-preview$/,{normalize_:e}],[/^([^\/]*)$/,{normalize_:t}]]},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$html.js":17,"../External/underscore.js":31,"../Knoin/KnoinAbstractScreen.js":35,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/MailBoxFolderListViewModel.js":77,"../ViewModels/MailBoxMessageListViewModel.js":78,"../ViewModels/MailBoxMessageViewViewModel.js":79,"../ViewModels/MailBoxSystemDropDownViewModel.js":80}],53:[function(e,t){!function(t){"use strict";function s(){var t=e("../Boots/RainLoopApp.js"),s=e("../ViewModels/SettingsSystemDropDownViewModel.js"),o=e("../ViewModels/SettingsMenuViewModel.js"),i=e("../ViewModels/SettingsPaneViewModel.js");a.call(this,[s,o,i]),n.initOnStartOrLangChange(function(){this.sSettingsTitle=n.i18n("TITLES/SETTINGS")},this,function(){t.setTitle(this.sSettingsTitle)})}var o=e("../External/underscore.js"),i=e("../Common/Enums.js"),n=e("../Common/Utils.js"),r=e("../Common/Globals.js"),a=e("./AbstractSettings.js");o.extend(s.prototype,a.prototype),s.prototype.onShow=function(){var t=e("../Boots/RainLoopApp.js");t.setTitle(this.sSettingsTitle),r.keyScope(i.KeyState.Settings)},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/underscore.js":31,"../ViewModels/SettingsMenuViewModel.js":98,"../ViewModels/SettingsPaneViewModel.js":99,"../ViewModels/SettingsSystemDropDownViewModel.js":100,"./AbstractSettings.js":50}],54:[function(e,t){!function(t){"use strict";function s(){this.accounts=c.accounts,this.processText=n.computed(function(){return c.accountsLoading()?a.i18n("SETTINGS_ACCOUNTS/LOADING_PROCESS"):""},this),this.visibility=n.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.accountForDeletion=n.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}var o=e("../External/window.js"),i=e("../External/underscore.js"),n=e("../External/ko.js"),r=e("../Common/Enums.js"),a=e("../Common/Utils.js"),l=e("../Common/LinkBuilder.js"),c=e("../Storages/WebMailDataStorage.js"),u=e("../Storages/WebMailAjaxRemoteStorage.js"),d=e("../Knoin/Knoin.js"),p=e("../ViewModels/Popups/PopupsAddAccountViewModel.js");s.prototype.addNewAccount=function(){d.showScreenPopup(p)},s.prototype.deleteAccount=function(t){if(t&&t.deleteAccess()){this.accountForDeletion(null);var s=e("../Boots/RainLoopApp.js"),n=function(e){return t===e};t&&(this.accounts.remove(n),u.accountDelete(function(e,t){r.StorageResultType.Success===e&&t&&t.Result&&t.Reload?(d.routeOff(),d.setHash(l.root(),!0),d.routeOff(),i.defer(function(){o.location.reload()})):s.accountsAndIdentities()},t.email))}},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/ko.js":28,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddAccountViewModel.js":81}],55:[function(e,t){!function(t){"use strict";function s(){this.changeProcess=i.observable(!1),this.errorDescription=i.observable(""),this.passwordMismatch=i.observable(!1),this.passwordUpdateError=i.observable(!1),this.passwordUpdateSuccess=i.observable(!1),this.currentPassword=i.observable(""),this.currentPassword.error=i.observable(!1),this.newPassword=i.observable(""),this.newPassword2=i.observable(""),this.currentPassword.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.currentPassword.error(!1)},this),this.newPassword.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.passwordMismatch(!1)},this),this.newPassword2.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.passwordMismatch(!1)},this),this.saveNewPasswordCommand=r.createCommand(this,function(){this.newPassword()!==this.newPassword2()?(this.passwordMismatch(!0),this.errorDescription(r.i18n("SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH"))):(this.changeProcess(!0),this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.currentPassword.error(!1),this.passwordMismatch(!1),this.errorDescription(""),a.changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword()))},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()&&""!==this.newPassword2()}),this.onChangePasswordResponse=o.bind(this.onChangePasswordResponse,this)}var o=e("../External/underscore.js"),i=e("../External/ko.js"),n=e("../Common/Enums.js"),r=e("../Common/Utils.js"),a=e("../Storages/WebMailAjaxRemoteStorage.js");s.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},s.prototype.onChangePasswordResponse=function(e,t){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),n.StorageResultType.Success===e&&t&&t.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(t&&n.Notification.CurrentPasswordIncorrect===t.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(r.getNotification(t&&t.ErrorCode?t.ErrorCode:n.Notification.CouldNotSaveNewPassword)))},t.exports=s}(t)},{"../Common/Enums.js":7,"../Common/Utils.js":14,"../External/ko.js":28,"../External/underscore.js":31,"../Storages/WebMailAjaxRemoteStorage.js":72}],56:[function(e,t){!function(t){"use strict";function s(){this.contactsAutosave=r.contactsAutosave,this.allowContactsSync=r.allowContactsSync,this.enableContactsSync=r.enableContactsSync,this.contactsSyncUrl=r.contactsSyncUrl,this.contactsSyncUser=r.contactsSyncUser,this.contactsSyncPass=r.contactsSyncPass,this.saveTrigger=o.computed(function(){return[this.enableContactsSync()?"1":"0",this.contactsSyncUrl(),this.contactsSyncUser(),this.contactsSyncPass()].join("|")},this).extend({throttle:500}),this.saveTrigger.subscribe(function(){n.saveContactsSyncData(null,this.enableContactsSync(),this.contactsSyncUrl(),this.contactsSyncUser(),this.contactsSyncPass())},this)}var o=e("../External/ko.js"),i=e("../Common/Utils.js"),n=e("../Storages/WebMailAjaxRemoteStorage.js"),r=e("../Storages/WebMailDataStorage.js");s.prototype.onBuild=function(){r.contactsAutosave.subscribe(function(e){n.saveSettings(i.emptyFunction,{ContactsAutosave:e?"1":"0"})})},t.exports=s}(t)},{"../Common/Utils.js":14,"../External/ko.js":28,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74}],57:[function(e,t){!function(t){"use strict";function s(){this.filters=o.observableArray([]),this.filters.loading=o.observable(!1),this.filters.subscribe(function(){i.windowResize()})}var o=e("../External/ko.js"),i=e("../Common/Utils.js");s.prototype.deleteFilter=function(e){this.filters.remove(e)},s.prototype.addFilter=function(){var t=e("../Knoin/Knoin.js"),s=e("../Models/FilterModel.js"),o=e("../ViewModels/Popups/PopupsFilterViewModel.js");t.showScreenPopup(o,[new s])},t.exports=s}(t)},{"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Models/FilterModel.js":45,"../ViewModels/Popups/PopupsFilterViewModel.js":88}],58:[function(e,t){!function(t){"use strict";function s(){this.foldersListError=c.foldersListError,this.folderList=c.folderList,this.processText=o.computed(function(){var e=c.foldersLoading(),t=c.foldersCreating(),s=c.foldersDeleting(),o=c.foldersRenaming();return t?n.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):s?n.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):o?n.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):e?n.i18n("SETTINGS_FOLDERS/LOADING_PROCESS"):""},this),this.visibility=o.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.folderForDeletion=o.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]}),this.folderForEdit=o.observable(null).extend({toggleSubscribe:[this,function(e){e&&e.edited(!1)},function(e){e&&e.canBeEdited()&&e.edited(!0)}]}),this.useImapSubscribe=!!a.settingsGet("UseImapSubscribe")}var o=e("../External/ko.js"),i=e("../Common/Enums.js"),n=e("../Common/Utils.js"),r=e("../Knoin/Knoin.js"),a=e("../Storages/AppSettings.js"),l=e("../Storages/LocalStorage.js"),c=e("../Storages/WebMailDataStorage.js"),u=e("../Storages/WebMailCacheStorage.js"),d=e("../Storages/WebMailAjaxRemoteStorage.js"),p=e("../ViewModels/Popups/PopupsFolderCreateViewModel.js"),h=e("../ViewModels/Popups/PopupsFolderSystemViewModel.js");s.prototype.folderEditOnEnter=function(t){var s=e("../Boots/RainLoopApp.js"),o=t?n.trim(t.nameForEdit()):"";""!==o&&t.name()!==o&&(l.set(i.ClientSideKeyName.FoldersLashHash,""),c.foldersRenaming(!0),d.folderRename(function(e,t){c.foldersRenaming(!1),i.StorageResultType.Success===e&&t&&t.Result||c.foldersListError(t&&t.ErrorCode?n.getNotification(t.ErrorCode):n.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),s.folders()},t.fullNameRaw,o),u.removeFolderFromCacheList(t.fullNameRaw),t.name(o)),t.edited(!1)},s.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},s.prototype.onShow=function(){c.foldersListError("")},s.prototype.createFolder=function(){r.showScreenPopup(p)},s.prototype.systemFolder=function(){r.showScreenPopup(h)},s.prototype.deleteFolder=function(t){if(t&&t.canBeDeleted()&&t.deleteAccess()&&0===t.privateMessageCountAll()){this.folderForDeletion(null);var s=e("../Boots/RainLoopApp.js"),o=function(e){return t===e?!0:(e.subFolders.remove(o),!1)
-};t&&(l.set(i.ClientSideKeyName.FoldersLashHash,""),c.folderList.remove(o),c.foldersDeleting(!0),d.folderDelete(function(e,t){c.foldersDeleting(!1),i.StorageResultType.Success===e&&t&&t.Result||c.foldersListError(t&&t.ErrorCode?n.getNotification(t.ErrorCode):n.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),s.folders()},t.fullNameRaw),u.removeFolderFromCacheList(t.fullNameRaw))}else 0"},s.prototype.addNewIdentity=function(){c.showScreenPopup(u)},s.prototype.editIdentity=function(e){c.showScreenPopup(u,[e])},s.prototype.deleteIdentity=function(t){if(t&&t.deleteAccess()){this.identityForDeletion(null);var s=e("../Boots/RainLoopApp.js"),o=function(e){return t===e};t&&(this.identities.remove(o),l.identityDelete(function(){s.accountsAndIdentities()},t.id))}},s.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=a.signature();this.editor=new r(e.signatureDom(),function(){a.signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},s.prototype.onBuild=function(e){var t=this;e.on("click",".identity-item .e-action",function(){var e=o.dataFor(this);e&&t.editIdentity(e)}),_.delay(function(){var e=n.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),s=n.settingsSaveHelperSimpleFunction(t.replyTrigger,t),o=n.settingsSaveHelperSimpleFunction(t.signatureTrigger,t),i=n.settingsSaveHelperSimpleFunction(t.defaultIdentityIDTrigger,t);a.defaultIdentityID.subscribe(function(e){l.saveSettings(i,{DefaultIdentityID:e})}),a.displayName.subscribe(function(t){l.saveSettings(e,{DisplayName:t})}),a.replyTo.subscribe(function(e){l.saveSettings(s,{ReplyTo:e})}),a.signature.subscribe(function(e){l.saveSettings(o,{Signature:e})}),a.signatureToAll.subscribe(function(e){l.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/NewHtmlEditorWrapper.js":11,"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsIdentityViewModel.js":93}],61:[function(e,t){!function(t){"use strict";function s(){this.editor=null,this.displayName=a.displayName,this.signature=a.signature,this.signatureToAll=a.signatureToAll,this.replyTo=a.replyTo,this.signatureDom=o.observable(null),this.displayNameTrigger=o.observable(i.SaveSettingsStep.Idle),this.replyTrigger=o.observable(i.SaveSettingsStep.Idle),this.signatureTrigger=o.observable(i.SaveSettingsStep.Idle)}var o=e("../External/ko.js"),i=e("../Common/Enums.js"),n=e("../Common/Utils.js"),r=e("../Common/NewHtmlEditorWrapper.js"),a=e("../Storages/WebMailDataStorage.js"),l=e("../Storages/WebMailAjaxRemoteStorage.js");s.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=a.signature();this.editor=new r(e.signatureDom(),function(){a.signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},s.prototype.onBuild=function(){var e=this;_.delay(function(){var t=n.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),s=n.settingsSaveHelperSimpleFunction(e.replyTrigger,e),o=n.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);a.displayName.subscribe(function(e){l.saveSettings(t,{DisplayName:e})}),a.replyTo.subscribe(function(e){l.saveSettings(s,{ReplyTo:e})}),a.signature.subscribe(function(e){l.saveSettings(o,{Signature:e})}),a.signatureToAll.subscribe(function(e){l.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},t.exports=s}(t)},{"../Common/Enums.js":7,"../Common/NewHtmlEditorWrapper.js":11,"../Common/Utils.js":14,"../External/ko.js":28,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74}],62:[function(e,t){!function(t){"use strict";function s(){this.openpgpkeys=n.openpgpkeys,this.openpgpkeysPublic=n.openpgpkeysPublic,this.openpgpkeysPrivate=n.openpgpkeysPrivate,this.openPgpKeyForDeletion=o.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}var o=e("../External/ko.js"),i=e("../Knoin/Knoin.js"),n=e("../Storages/WebMailDataStorage.js"),r=e("../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js"),a=e("../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js"),l=e("../ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js");s.prototype.addOpenPgpKey=function(){i.showScreenPopup(r)},s.prototype.generateOpenPgpKey=function(){i.showScreenPopup(a)},s.prototype.viewOpenPgpKey=function(e){e&&i.showScreenPopup(l,[e])},s.prototype.deleteOpenPgpKey=function(t){if(t&&t.deleteAccess()&&(this.openPgpKeyForDeletion(null),t&&n.openpgpKeyring)){this.openpgpkeys.remove(function(e){return t===e}),n.openpgpKeyring[t.isPrivate?"privateKeys":"publicKeys"].removeForId(t.guid),n.openpgpKeyring.store();var s=e("../Boots/RainLoopApp.js");s.reloadOpenPgpKeys()}},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js":82,"../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js":92,"../ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js":97}],63:[function(e,t){!function(t){"use strict";function s(){this.processing=o.observable(!1),this.clearing=o.observable(!1),this.secreting=o.observable(!1),this.viewUser=o.observable(""),this.viewEnable=o.observable(!1),this.viewEnable.subs=!0,this.twoFactorStatus=o.observable(!1),this.viewSecret=o.observable(""),this.viewBackupCodes=o.observable(""),this.viewUrl=o.observable(""),this.bFirst=!0,this.viewTwoFactorStatus=o.computed(function(){return n.langChangeTrigger(),r.i18n(this.twoFactorStatus()?"SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC":"SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC")},this),this.onResult=_.bind(this.onResult,this),this.onSecretResult=_.bind(this.onSecretResult,this)}var o=e("../External/ko.js"),i=e("../Common/Enums.js"),n=e("../Common/Globals.js"),r=e("../Common/Utils.js"),a=e("../Storages/WebMailAjaxRemoteStorage.js"),l=e("../Knoin/Knoin.js"),c=e("../ViewModels/Popups/PopupsTwoFactorTestViewModel.js");s.prototype.showSecret=function(){this.secreting(!0),a.showTwoFactorSecret(this.onSecretResult)},s.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},s.prototype.createTwoFactor=function(){this.processing(!0),a.createTwoFactor(this.onResult)},s.prototype.enableTwoFactor=function(){this.processing(!0),a.enableTwoFactor(this.onResult,this.viewEnable())},s.prototype.testTwoFactor=function(){l.showScreenPopup(c)},s.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),a.clearTwoFactor(this.onResult)},s.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},s.prototype.onResult=function(e,t){if(this.processing(!1),this.clearing(!1),i.StorageResultType.Success===e&&t&&t.Result?(this.viewUser(r.pString(t.Result.User)),this.viewEnable(!!t.Result.Enable),this.twoFactorStatus(!!t.Result.IsSet),this.viewSecret(r.pString(t.Result.Secret)),this.viewBackupCodes(r.pString(t.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(r.pString(t.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var s=this;this.viewEnable.subscribe(function(e){this.viewEnable.subs&&a.enableTwoFactor(function(e,t){i.StorageResultType.Success===e&&t&&t.Result||(s.viewEnable.subs=!1,s.viewEnable(!1),s.viewEnable.subs=!0)},e)},this)}},s.prototype.onSecretResult=function(e,t){this.secreting(!1),i.StorageResultType.Success===e&&t&&t.Result?(this.viewSecret(r.pString(t.Result.Secret)),this.viewUrl(r.pString(t.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},s.prototype.onBuild=function(){this.processing(!0),a.getTwoFactor(this.onResult)},t.exports=s}(t)},{"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Storages/WebMailAjaxRemoteStorage.js":72,"../ViewModels/Popups/PopupsTwoFactorTestViewModel.js":96}],64:[function(e,t){!function(t){"use strict";function s(){var t=e("../Common/Utils.js"),s=e("../Boots/RainLoopApp.js"),o=e("../Storages/WebMailDataStorage.js");this.googleEnable=o.googleEnable,this.googleActions=o.googleActions,this.googleLoggined=o.googleLoggined,this.googleUserName=o.googleUserName,this.facebookEnable=o.facebookEnable,this.facebookActions=o.facebookActions,this.facebookLoggined=o.facebookLoggined,this.facebookUserName=o.facebookUserName,this.twitterEnable=o.twitterEnable,this.twitterActions=o.twitterActions,this.twitterLoggined=o.twitterLoggined,this.twitterUserName=o.twitterUserName,this.connectGoogle=t.createCommand(this,function(){this.googleLoggined()||s.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=t.createCommand(this,function(){s.googleDisconnect()}),this.connectFacebook=t.createCommand(this,function(){this.facebookLoggined()||s.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=t.createCommand(this,function(){s.facebookDisconnect()}),this.connectTwitter=t.createCommand(this,function(){this.twitterLoggined()||s.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=t.createCommand(this,function(){s.twitterDisconnect()})}t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Utils.js":14,"../Storages/WebMailDataStorage.js":74}],65:[function(e,t){!function(t){"use strict";function s(){var e=this;this.mainTheme=c.mainTheme,this.themesObjects=n.observableArray([]),this.themeTrigger=n.observable(r.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,c.theme.subscribe(function(t){_.each(this.themesObjects(),function(e){e.selected(t===e.name)});var s=i("#rlThemeLink"),n=i("#rlThemeStyle"),l=s.attr("href");l||(l=n.attr("data-href")),l&&(l=l.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+t+"/-/"),l=l.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/0/User/"),"Json/"!==l.substring(l.length-5,l.length)&&(l+="Json/"),o.clearTimeout(e.iTimer),e.themeTrigger(r.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=i.ajax({url:l,dataType:"json"}).done(function(t){t&&a.isArray(t)&&2===t.length&&(!s||!s[0]||n&&n[0]||(n=i(''),s.after(n),s.remove()),n&&n[0]&&(n.attr("data-href",l).attr("data-theme",t[0]),n&&n[0]&&n[0].styleSheet&&!a.isUnd(n[0].styleSheet.cssText)?n[0].styleSheet.cssText=t[1]:n.text(t[1])),e.themeTrigger(r.SaveSettingsStep.TrueResult))}).always(function(){e.iTimer=o.setTimeout(function(){e.themeTrigger(r.SaveSettingsStep.Idle)},1e3),e.oLastAjax=null})),u.saveSettings(null,{Theme:t})},this)}var o=e("../External/window.js"),i=e("../External/jquery.js"),n=e("../External/ko.js"),r=e("../Common/Enums.js"),a=e("../Common/Utils.js"),l=e("../Common/LinkBuilder.js"),c=e("../Storages/WebMailDataStorage.js"),u=e("../Storages/WebMailAjaxRemoteStorage.js");s.prototype.onBuild=function(){var e=c.theme();this.themesObjects(_.map(c.themes(),function(t){return{name:t,nameDisplay:a.convertThemeName(t),selected:n.observable(t===e),themePreviewSrc:l.themePreviewLink(t)}}))},t.exports=s}(t)},{"../Common/Enums.js":7,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/jquery.js":26,"../External/ko.js":28,"../External/window.js":32,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74}],66:[function(e,t){!function(t){"use strict";function s(){this.oRequests={}}var o=e("../External/window.js"),i=e("../External/jquery.js"),n=e("../Common/Consts.js"),r=e("../Common/Enums.js"),a=e("../Common/Globals.js"),l=e("../Common/Utils.js"),c=e("../Common/Plugins.js"),u=e("../Common/LinkBuilder.js"),d=e("./AppSettings.js");s.prototype.oRequests={},s.prototype.defaultResponse=function(e,t,s,i,u,d){var p=function(){r.StorageResultType.Success!==s&&a.bUnload&&(s=r.StorageResultType.Unload),r.StorageResultType.Success===s&&i&&!i.Result?(i&&-1(new o.Date).getTime()-h),g&&a.oRequests[g]&&(a.oRequests[g].__aborted&&(i="abort"),a.oRequests[g]=null),a.defaultResponse(e,g,i,s,n,t)}),g&&00?(this.defaultRequest(e,"Message",{},null,"Message/"+a.urlsafe_encode([t,s,u.projectHash(),u.threading()&&u.useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},s.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},s.prototype.composeUploadDrive=function(e,t,s){this.defaultRequest(e,"ComposeUploadDrive",{AccessToken:s,Url:t},999e3)},s.prototype.folderInformation=function(e,t,s){var n=!0,a=[];i.isArray(s)&&0=e?1:e},this),this.mainMessageListSearch=r.computed({read:this.messageListSearch,write:function(e){b.setHash(m.mailBox(this.currentFolderFullNameHash(),1,h.trim(e.toString())))},owner:this}),this.messageListError=r.observable(""),this.messageListLoading=r.observable(!1),this.messageListIsNotCompleted=r.observable(!1),this.messageListCompleteLoadingThrottle=r.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=r.computed(function(){var e=this.messageListLoading(),t=this.messageListIsNotCompleted();return e||t},this),this.messageListCompleteLoading.subscribe(function(e){this.messageListCompleteLoadingThrottle(e)},this),this.messageList.subscribe(n.debounce(function(e){n.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new S,this.message=r.observable(null),this.messageLoading=r.observable(!1),this.messageLoadingThrottle=r.observable(!1).extend({throttle:50}),this.message.focused=r.observable(!1),this.message.subscribe(function(e){e?d.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),d.Layout.NoPreview===this.layout()&&-10?o.Math.ceil(t/e*100):0},this),this.capaOpenPGP=r.observable(!1),this.openpgpkeys=r.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(e){return!(!e||e.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(e){return!(!e||!e.isPrivate)}),this.googleActions=r.observable(!1),this.googleLoggined=r.observable(!1),this.googleUserName=r.observable(""),this.facebookActions=r.observable(!1),this.facebookLoggined=r.observable(!1),this.facebookUserName=r.observable(""),this.twitterActions=r.observable(!1),this.twitterLoggined=r.observable(!1),this.twitterUserName=r.observable(""),this.customThemeType=r.observable(d.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=n.throttle(this.purgeMessageBodyCache,3e4)}var o=e("../External/window.js"),i=e("../External/jquery.js"),n=e("../External/underscore.js"),r=e("../External/ko.js"),a=e("../External/moment.js"),l=e("../External/$div.js"),c=e("../External/NotificationClass.js"),u=e("../Common/Consts.js"),d=e("../Common/Enums.js"),p=e("../Common/Globals.js"),h=e("../Common/Utils.js"),m=e("../Common/LinkBuilder.js"),g=e("./AppSettings.js"),f=e("./WebMailCacheStorage.js"),b=e("../Knoin/Knoin.js"),S=e("../Models/MessageModel.js"),y=e("./LocalStorage.js"),v=e("./AbstractData.js");n.extend(s.prototype,v.prototype),s.prototype.purgeMessageBodyCache=function(){var e=0,t=null,s=p.iMessageBodyCacheCount-u.Values.MessageBodyCacheLimit;s>0&&(t=this.messagesBodiesDom(),t&&(t.find(".rl-cache-class").each(function(){var t=i(this);s>t.data("rl-cache-count")&&(t.addClass("rl-cache-purge"),e++)}),e>0&&n.delay(function(){t.find(".rl-cache-purge").remove()},300)))},s.prototype.populateDataOnStart=function(){v.prototype.populateDataOnStart.call(this),this.accountEmail(g.settingsGet("Email")),this.accountIncLogin(g.settingsGet("IncLogin")),this.accountOutLogin(g.settingsGet("OutLogin")),this.projectHash(g.settingsGet("ProjectHash")),this.defaultIdentityID(g.settingsGet("DefaultIdentityID")),this.displayName(g.settingsGet("DisplayName")),this.replyTo(g.settingsGet("ReplyTo")),this.signature(g.settingsGet("Signature")),this.signatureToAll(!!g.settingsGet("SignatureToAll")),this.enableTwoFactor(!!g.settingsGet("EnableTwoFactor")),this.lastFoldersHash=y.get(d.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!g.settingsGet("RemoteSuggestions"),this.devEmail=g.settingsGet("DevEmail"),this.devPassword=g.settingsGet("DevPassword")},s.prototype.initUidNextAndNewMessages=function(e,t,s){if("INBOX"===e&&h.isNormal(t)&&""!==t){if(h.isArray(s)&&03)l(m.notificationMailIcon(),this.accountEmail(),h.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:a}));else for(;a>r;r++)l(m.notificationMailIcon(),S.emailsToLine(S.initEmailsFromJson(s[r].From),!1),s[r].Subject)}f.setFolderUidNext(e,t)}},s.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},s.prototype.getNextFolderNames=function(e){e=h.isUnd(e)?!1:!!e;var t=[],s=10,o=a().unix(),i=o-300,r=[],l=function(t){n.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&i>t.interval&&(!e||t.subScribed())&&r.push([t.interval,t.fullNameRaw]),t&&0t[0]?1:0}),n.find(r,function(e){var i=f.getFolderFromCacheList(e[1]);return i&&(i.interval=o,t.push(e[1])),s<=t.length}),n.uniq(t)},s.prototype.removeMessagesFromList=function(e,t,s,o){s=h.isNormal(s)?s:"",o=h.isUnd(o)?!1:!!o,t=n.map(t,function(e){return h.pInt(e)});var i=this,r=0,a=this.messageList(),l=f.getFolderFromCacheList(e),c=""===s?null:f.getFolderFromCacheList(s||""),u=this.currentFolderFullNameRaw(),d=this.message(),p=u===e?n.filter(a,function(e){return e&&-10&&l.messageCountUnread(0<=l.messageCountUnread()-r?l.messageCountUnread()-r:0)),c&&(c.messageCountAll(c.messageCountAll()+t.length),r>0&&c.messageCountUnread(c.messageCountUnread()+r),c.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),r.data("rl-cache-count",++p.iMessageBodyCacheCount),h.isNormal(e.Result.Html)&&""!==e.Result.Html?(s=!0,u=e.Result.Html.toString()):h.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(s=!1,u=h.plainToHtml(e.Result.Plain.toString(),!1),(S.isPgpSigned()||S.isPgpEncrypted())&&this.capaOpenPGP()&&(S.plainRaw=h.pString(e.Result.Plain),g=/---BEGIN PGP MESSAGE---/.test(S.plainRaw),g||(m=/-----BEGIN PGP SIGNED MESSAGE-----/.test(S.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(S.plainRaw)),l.empty(),m&&S.isPgpSigned()?u=l.append(i('').text(S.plainRaw)).html():g&&S.isPgpEncrypted()&&(u=l.append(i('').text(S.plainRaw)).html()),l.empty(),S.isPgpSigned(m),S.isPgpEncrypted(g))):s=!1,r.html(h.linkify(u)).addClass("b-text-part "+(s?"html":"plain")),S.isHtml(!!s),S.hasImages(!!o),S.pgpSignedVerifyStatus(d.SignedVerifyStatus.None),S.pgpSignedVerifyUser(""),S.body=r,S.body&&b.append(S.body),S.storeDataToDom(),n&&S.showInternalImages(!0),S.hasImages()&&this.showImages()&&S.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(S.body),this.hideMessageBodies(),S.body.show(),r&&h.initBlockquoteSwitcher(r)),f.initMessageFlagsFromCache(S),S.unseen()&&p.__RL&&p.__RL.setMessageSeen(S),h.windowResize())},s.prototype.calculateMessageListHash=function(e){return n.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},s.prototype.findPublicKeyByHex=function(e){return n.find(this.openpgpkeysPublic(),function(t){return t&&e===t.id})},s.prototype.findPublicKeysByEmail=function(e){return n.compact(n.map(this.openpgpkeysPublic(),function(t){var s=null;if(t&&e===t.email)try{if(s=o.openpgp.key.readArmored(t.armor),s&&!s.err&&s.keys&&s.keys[0])return s.keys[0]}catch(i){}return null}))},s.prototype.findPrivateKeyByEmail=function(e,t){var s=null,i=n.find(this.openpgpkeysPrivate(),function(t){return t&&e===t.email});if(i)try{s=o.openpgp.key.readArmored(i.armor),s&&!s.err&&s.keys&&s.keys[0]?(s=s.keys[0],s.decrypt(h.pString(t))):s=null}catch(r){s=null}return s},s.prototype.findSelfPrivateKey=function(e){return this.findPrivateKeyByEmail(this.accountEmail(),e)},t.exports=new s}(t)},{"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/$div.js":15,"../External/NotificationClass.js":22,"../External/jquery.js":26,"../External/ko.js":28,"../External/moment.js":29,"../External/underscore.js":31,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Models/MessageModel.js":48,"./AbstractData.js":67,"./AppSettings.js":68,"./LocalStorage.js":69,"./WebMailCacheStorage.js":73}],75:[function(e,t){!function(t){"use strict";function s(){f.call(this,"Right","SystemDropDown"),this.accounts=d.accounts,this.accountEmail=d.accountEmail,this.accountsLoading=d.accountsLoading,this.accountMenuDropdownTrigger=i.observable(!1),this.capaAdditionalAccounts=u.capa(a.Capa.AdditionalAccounts),this.loading=i.computed(function(){return this.accountsLoading()},this),this.accountClick=o.bind(this.accountClick,this)}var o=e("../External/underscore.js"),i=e("../External/ko.js"),n=e("../External/window.js"),r=e("../External/key.js"),a=e("../Common/Enums.js"),l=e("../Common/Utils.js"),c=e("../Common/LinkBuilder.js"),u=e("../Storages/AppSettings.js"),d=e("../Storages/WebMailDataStorage.js"),p=e("../Storages/WebMailAjaxRemoteStorage.js"),h=e("../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js"),m=e("../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js"),g=e("../Knoin/Knoin.js"),f=e("../Knoin/KnoinAbstractViewModel.js");o.extend(s.prototype,f.prototype),s.prototype.accountClick=function(e,t){if(e&&t&&!l.isUnd(t.which)&&1===t.which){var s=this;this.accountsLoading(!0),o.delay(function(){s.accountsLoading(!1)},1e3)}return!0},s.prototype.emailTitle=function(){return d.accountEmail()},s.prototype.settingsClick=function(){g.setHash(c.settings())},s.prototype.settingsHelp=function(){g.showScreenPopup(h)},s.prototype.addAccountClick=function(){this.capaAdditionalAccounts&&g.showScreenPopup(m)},s.prototype.logoutClick=function(){var t=e("../Boots/RainLoopApp.js");p.logout(function(){n.__rlah_clear&&n.__rlah_clear(),t.loginAndLogoutReload(!0,u.settingsGet("ParentEmail")&&0-1&&a.eq(n).removeClass("focused"),38===r&&n>0?n--:40===r&&no)?(this.oContentScrollable.scrollTop(s.top<0?this.oContentScrollable.scrollTop()+s.top-e:this.oContentScrollable.scrollTop()+s.top-o+n+e),!0):!1},s.prototype.messagesDrop=function(t,s){if(t&&s&&s.helper){var o=e("../Boots/RainLoopApp.js"),i=s.helper.data("rl-folder"),n=a.hasClass("rl-ctrl-key-pressed"),r=s.helper.data("rl-uids");l.isNormal(i)&&""!==i&&l.isArray(r)&&o.moveMessagesToFolder(i,r,t.fullNameRaw,n)}},s.prototype.composeClick=function(){S.showScreenPopup(g)},s.prototype.createFolder=function(){S.showScreenPopup(f)},s.prototype.configureFolders=function(){S.setHash(d.settings("folders"))},s.prototype.contactsClick=function(){this.allowContacts&&S.showScreenPopup(b)},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Enums.js":7,"../Common/Globals.js":9,"../Common/LinkBuilder.js":10,"../Common/Utils.js":14,"../External/$html.js":17,"../External/jquery.js":26,"../External/key.js":27,"../External/ko.js":28,"../External/window.js":32,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/AppSettings.js":68,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86,"./Popups/PopupsContactsViewModel.js":87,"./Popups/PopupsFolderCreateViewModel.js":90}],78:[function(e,t){!function(t){"use strict";function s(){var t=e("../Boots/RainLoopApp.js");C.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="",this.hideDangerousActions=!!f.settingsGet("HideDangerousActions"),this.popupVisibility=d.popupVisibility,this.message=S.message,this.messageList=S.messageList,this.folderList=S.folderList,this.currentMessage=S.currentMessage,this.isMessageSelected=S.isMessageSelected,this.messageListSearch=S.messageListSearch,this.messageListError=S.messageListError,this.folderMenuForMove=S.folderMenuForMove,this.useCheckboxesInList=S.useCheckboxesInList,this.mainMessageListSearch=S.mainMessageListSearch,this.messageListEndFolder=S.messageListEndFolder,this.messageListChecked=S.messageListChecked,this.messageListCheckedOrSelected=S.messageListCheckedOrSelected,this.messageListCheckedOrSelectedUidsWithSubMails=S.messageListCheckedOrSelectedUidsWithSubMails,this.messageListCompleteLoadingThrottle=S.messageListCompleteLoadingThrottle,p.initOnStartOrLangChange(function(){this.emptySubjectValue=p.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=S.userQuota,this.userUsageSize=S.userUsageSize,this.userUsageProc=S.userUsageProc,this.moveDropdownTrigger=n.observable(!1),this.moreDropdownTrigger=n.observable(!1),this.dragOver=n.observable(!1).extend({throttle:1}),this.dragOverEnter=n.observable(!1).extend({throttle:1}),this.dragOverArea=n.observable(null),this.dragOverBodyArea=n.observable(null),this.messageListItemTemplate=n.computed(function(){return c.Layout.NoPreview!==S.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=n.computed(function(){var e=S.messageListEndSearch();return""===e?"":p.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:e})}),this.messageListPagenator=n.computed(p.computedPagenatorHelper(S.messageListPage,S.messageListPageCount)),this.checkAll=n.computed({read:function(){return 00&&t>0&&e>t},this),this.hasMessages=n.computed(function(){return 01?" ("+(100>e?e:"99+")+")":""},s.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},s.prototype.moveSelectedMessagesToFolder=function(e,t){return this.canBeMoved()&&RL.moveMessagesToFolder(S.currentFolderFullNameRaw(),S.messageListCheckedOrSelectedUidsWithSubMails(),e,t),!1},s.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=p.draggeblePlace(),s=S.messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",S.currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),i.defer(function(){var e=S.messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},s.prototype.onMessageResponse=function(e,t,s){S.hideMessageBodies(),S.messageLoading(!1),c.StorageResultType.Success===e&&t&&t.Result?S.setMessage(t,s):c.StorageResultType.Unload===e?(S.message(null),S.messageError("")):c.StorageResultType.Abort!==e&&(S.message(null),S.messageError(p.getNotification(t&&t.ErrorCode?t.ErrorCode:c.Notification.UnknownError)))},s.prototype.populateMessageBody=function(e){e&&(y.message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?S.messageLoading(!0):p.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},s.prototype.setAction=function(e,t,s){var o=[],n=null,r=0;if(p.isUnd(s)&&(s=S.messageListChecked()),o=i.map(s,function(e){return e.uid}),""!==e&&00?100>e?e:"99+":""},s.prototype.verifyPgpSignedClearMessage=function(e){e&&e.verifyPgpSignedClearMessage()},s.prototype.decryptPgpEncryptedMessage=function(e){e&&e.decryptPgpEncryptedMessage(this.viewPgpPassword())},s.prototype.readReceipt=function(t){if(t&&""!==t.readReceipt()){m.sendReadReceiptMessage(u.emptyFunction,t.folderFullNameRaw,t.uid,t.readReceipt(),u.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:t.subject()}),u.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":h.accountEmail()})),t.isReadReceipt(!0),p.storeMessageFlagsToCache(t);var s=e("../Boots/RainLoopApp.js");s.reloadFlagsCurrentMessageListAndMessageFromCache()}},t.exports=s}(t)},{"../Boots/RainLoopApp.js":4,"../Common/Consts.js":6,"../Common/Enums.js":7,"../Common/Events.js":8,"../Common/Globals.js":9,"../Common/Utils.js":14,"../External/$html.js":17,"../External/jquery.js":26,"../External/key.js":27,"../External/ko.js":28,"../Knoin/Knoin.js":33,"../Knoin/KnoinAbstractViewModel.js":36,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86}],80:[function(e,t){!function(t){"use strict";function s(){i.call(this),o.constructorEnd(this)}var o=e("../Knoin/Knoin.js"),i=e("./AbstractSystemDropDownViewModel.js");o.extendAsViewModel("MailBoxSystemDropDownViewModel",s,i),t.exports=s}(t)},{"../Knoin/Knoin.js":33,"./AbstractSystemDropDownViewModel.js":75}],81:[function(e,t){!function(t){"use strict";function s(){c.call(this,"Popups","PopupsAddAccount");var t=e("../../Boots/RainLoopApp.js");this.email=i.observable(""),this.password=i.observable(""),this.emailError=i.observable(!1),this.passwordError=i.observable(!1),this.email.subscribe(function(){this.emailError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=i.observable(!1),this.submitError=i.observable(""),this.emailFocus=i.observable(!1),this.addAccountCommand=r.createCommand(this,function(){return this.emailError(""===r.trim(this.email())),this.passwordError(""===r.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),a.accountAdd(o.bind(function(e,s){this.submitRequest(!1),n.StorageResultType.Success===e&&s&&"AccountAdd"===s.Action?s.Result?(t.accountsAndIdentities(),this.cancelCommand()):s.ErrorCode&&this.submitError(r.getNotification(s.ErrorCode)):this.submitError(r.getNotification(n.Notification.UnknownError))},this),this.email(),"",this.password()),!0)},function(){return!this.submitRequest()}),l.constructorEnd(this)}var o=e("../../External/underscore.js"),i=e("../../External/ko.js"),n=e("../../Common/Enums.js"),r=e("../../Common/Utils.js"),a=e("../../Storages/WebMailAjaxRemoteStorage.js"),l=e("../../Knoin/Knoin.js"),c=e("../../Knoin/KnoinAbstractViewModel.js");l.extendAsViewModel("PopupsAddAccountViewModel",s),s.prototype.clearPopup=function(){this.email(""),this.password(""),this.emailError(!1),this.passwordError(!1),this.submitRequest(!1),this.submitError("")},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.emailFocus(!0)},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../External/underscore.js":31,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72}],82:[function(e,t){!function(t){"use strict";function s(){a.call(this,"Popups","PopupsAddOpenPgpKey");var t=e("../../Boots/RainLoopApp.js");this.key=o.observable(""),this.key.error=o.observable(!1),this.key.focus=o.observable(!1),this.key.subscribe(function(){this.key.error(!1)},this),this.addOpenPgpKeyCommand=i.createCommand(this,function(){var e=30,s=null,o=i.trim(this.key()),r=/[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi,a=n.openpgpKeyring;if(o=o.replace(/[\r\n]([a-zA-Z0-9]{2,}:[^\r\n]+)[\r\n]+([a-zA-Z0-9\/\\+=]{10,})/g,"\n$1!-!N!-!$2").replace(/[\n\r]+/g,"\n").replace(/!-!N!-!/g,"\n\n"),this.key.error(""===o),!a||this.key.error())return!1;for(;;){if(s=r.exec(o),!s||0>e)break;s[0]&&s[1]&&s[2]&&s[1]===s[2]&&("PRIVATE"===s[1]?a.privateKeys.importKey(s[0]):"PUBLIC"===s[1]&&a.publicKeys.importKey(s[0])),e--}return a.store(),t.reloadOpenPgpKeys(),i.delegateRun(this,"cancelCommand"),!0}),r.constructorEnd(this)}var o=e("../../External/ko.js"),i=e("../../Common/Utils.js"),n=e("../../Storages/WebMailDataStorage.js"),r=e("../../Knoin/Knoin.js"),a=e("../../Knoin/KnoinAbstractViewModel.js");r.extendAsViewModel("PopupsAddOpenPgpKeyViewModel",s),s.prototype.clearPopup=function(){this.key(""),this.key.error(!1)},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.key.focus(!0)},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],83:[function(e,t){!function(t){"use strict";function s(){l.call(this,"Popups","PopupsAdvancedSearch"),this.fromFocus=o.observable(!1),this.from=o.observable(""),this.to=o.observable(""),this.subject=o.observable(""),this.text=o.observable(""),this.selectedDateValue=o.observable(-1),this.hasAttachment=o.observable(!1),this.starred=o.observable(!1),this.unseen=o.observable(!1),this.searchCommand=n.createCommand(this,function(){var e=this.buildSearchString();""!==e&&r.mainMessageListSearch(e),this.cancelCommand()}),a.constructorEnd(this)}var o=e("../../External/ko.js"),i=e("../../External/moment.js"),n=e("../../Common/Utils.js"),r=e("../../Storages/WebMailDataStorage.js"),a=e("../../Knoin/Knoin.js"),l=e("../../Knoin/KnoinAbstractViewModel.js");a.extendAsViewModel("PopupsAdvancedSearchViewModel",s),s.prototype.buildSearchStringValue=function(e){return-1"},s.prototype.sendMessageResponse=function(e,t){var s=!1,i="";this.sending(!1),u.StorageResultType.Success===e&&t&&t.Result&&(s=!0,this.modalVisibility()&&p.delegateRun(this,"closeCommand")),this.modalVisibility()&&!s&&(t&&u.Notification.CantSaveMessage===t.ErrorCode?(this.sendSuccessButSaveError(!0),o.alert(p.trim(p.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(i=p.getNotification(t&&t.ErrorCode?t.ErrorCode:u.Notification.CantSendMessage,t&&t.ErrorMessage?t.ErrorMessage:""),this.sendError(!0),o.alert(i||p.getNotification(u.Notification.CantSendMessage)))),this.reloadDraftFolder()},s.prototype.saveMessageResponse=function(e,t){var s=!1,i=null;this.saving(!1),u.StorageResultType.Success===e&&t&&t.Result&&t.Result.NewFolder&&t.Result.NewUid&&(this.bFromDraft&&(i=S.message(),i&&this.draftFolder()===i.folderFullNameRaw&&this.draftUid()===i.uid&&S.message(null)),this.draftFolder(t.Result.NewFolder),this.draftUid(t.Result.NewUid),this.modalVisibility()&&(this.savedTime(o.Math.round((new o.Date).getTime()/1e3)),this.savedOrSendingText(0 "+e;break;default:e=e+"
"+s}return e},s.prototype.editor=function(e){if(e){var t=this;!this.oEditor&&this.composeEditorArea()?n.delay(function(){t.oEditor=new f(t.composeEditorArea(),null,function(){e(t.oEditor)},function(e){t.isHtml(!!e)})},300):this.oEditor&&e(this.oEditor)}},s.prototype.onShow=function(e,t,s,o,r){j.routeOff();var a=this,l="",c="",d="",h="",m="",g=null,f=null,b="",y="",C=[],w={},E=S.accountEmail(),A=S.signature(),T=S.signatureToAll(),F=[],M=null,N=null,R=e||u.ComposeType.Empty,L=function(e,t){for(var s=0,o=e.length,i=[];o>s;s++)i.push(e[s].toLine(!!t));return i.join(", ")};if(t=t||null,t&&p.isNormal(t)&&(N=p.isArray(t)&&1===t.length?t[0]:p.isArray(t)?null:t),null!==E&&(w[E]=!0),this.currentIdentityID(this.findIdentityIdByMessage(R,N)),this.reset(),p.isNonEmptyArray(s)&&this.to(L(s)),""!==R&&N){switch(h=N.fullFormatDateValue(),m=N.subject(),M=N.aDraftInfo,g=i(N.body).clone(),p.removeBlockquoteSwitcher(g),f=g.find("[data-html-editor-font-wrapper=true]"),b=f&&f[0]?f.html():g.html(),R){case u.ComposeType.Empty:break;case u.ComposeType.Reply:this.to(L(N.replyEmails(w))),this.subject(p.replySubjectAdd("Re",m)),this.prepearMessageAttachments(N,R),this.aDraftInfo=["reply",N.uid,N.folderFullNameRaw],this.sInReplyTo=N.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+N.sReferences);break;case u.ComposeType.ReplyAll:C=N.replyAllEmails(w),this.to(L(C[0])),this.cc(L(C[1])),this.subject(p.replySubjectAdd("Re",m)),this.prepearMessageAttachments(N,R),this.aDraftInfo=["reply",N.uid,N.folderFullNameRaw],this.sInReplyTo=N.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+N.references());break;case u.ComposeType.Forward:this.subject(p.replySubjectAdd("Fwd",m)),this.prepearMessageAttachments(N,R),this.aDraftInfo=["forward",N.uid,N.folderFullNameRaw],this.sInReplyTo=N.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+N.sReferences);break;case u.ComposeType.ForwardAsAttachment:this.subject(p.replySubjectAdd("Fwd",m)),this.prepearMessageAttachments(N,R),this.aDraftInfo=["forward",N.uid,N.folderFullNameRaw],this.sInReplyTo=N.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+N.sReferences);break;case u.ComposeType.Draft:this.to(L(N.to)),this.cc(L(N.cc)),this.bcc(L(N.bcc)),this.bFromDraft=!0,this.draftFolder(N.folderFullNameRaw),this.draftUid(N.uid),this.subject(m),this.prepearMessageAttachments(N,R),this.aDraftInfo=p.isNonEmptyArray(M)&&3===M.length?M:null,this.sInReplyTo=N.sInReplyTo,this.sReferences=N.sReferences;break;case u.ComposeType.EditAsNew:this.to(L(N.to)),this.cc(L(N.cc)),this.bcc(L(N.bcc)),this.subject(m),this.prepearMessageAttachments(N,R),this.aDraftInfo=p.isNonEmptyArray(M)&&3===M.length?M:null,this.sInReplyTo=N.sInReplyTo,this.sReferences=N.sReferences}switch(R){case u.ComposeType.Reply:case u.ComposeType.ReplyAll:l=N.fromToLine(!1,!0),y=p.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:h,EMAIL:l}),b="
"+y+":"+b+"
";break;case u.ComposeType.Forward:l=N.fromToLine(!1,!0),c=N.toToLine(!1,!0),d=N.ccToLine(!1,!0),b="
"+p.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+p.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+l+"
"+p.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+c+(0 "+p.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+d:"")+"
"+p.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+p.encodeHtml(h)+"
"+p.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+p.encodeHtml(m)+"
"+b;break;case u.ComposeType.ForwardAsAttachment:b=""}T&&""!==A&&u.ComposeType.EditAsNew!==R&&u.ComposeType.Draft!==R&&(b=this.convertSignature(A,L(N.from,!0),b,R)),this.editor(function(e){e.setHtml(b,!1),N.isHtml()||e.modeToggle(!1)})}else u.ComposeType.Empty===R?(this.subject(p.isNormal(o)?""+o:""),b=p.isNormal(r)?""+r:"",T&&""!==A&&(b=this.convertSignature(A,"",p.convertPlainTextToHtml(b),R)),this.editor(function(e){e.setHtml(b,!1),u.EditorDefaultType.Html!==S.editorDefaultType()&&e.modeToggle(!1)})):p.isNonEmptyArray(t)&&n.each(t,function(e){a.addMessageAsAttachment(e)});F=this.getAttachmentsDownloadsForUpload(),p.isNonEmptyArray(F)&&v.messageUploadAttachments(function(e,t){if(u.StorageResultType.Success===e&&t&&t.Result){var s=null,o="";if(!a.viewModelVisibility())for(o in t.Result)t.Result.hasOwnProperty(o)&&(s=a.getAttachmentById(t.Result[o]),s&&s.tempName(o))}else a.setMessageAttachmentFailedDowbloadText()},F),this.triggerForResize()},s.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},s.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},s.prototype.tryToClosePopup=function(){var e=this;j.isPopupVisible(A)||j.showScreenPopup(A,[p.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&p.delegateRun(e,"closeCommand")}])},s.prototype.onBuild=function(){this.initUploader();var e=this,t=null;key("ctrl+q, command+q",u.KeyState.Compose,function(){return e.identitiesDropdownTrigger(!0),!1}),key("ctrl+s, command+s",u.KeyState.Compose,function(){return e.saveCommand(),!1}),key("ctrl+enter, command+enter",u.KeyState.Compose,function(){return e.sendCommand(),!1}),key("esc",u.KeyState.Compose,function(){return e.modalVisibility()&&e.tryToClosePopup(),!1}),l.on("resize",function(){e.triggerForResize()}),this.dropboxEnabled()&&(t=o.document.createElement("script"),t.type="text/javascript",t.src="https://www.dropbox.com/static/api/1/dropins.js",i(t).attr("id","dropboxjs").attr("data-app-key",b.settingsGet("DropboxApiKey")),o.document.body.appendChild(t)),this.driveEnabled()&&i.getScript("https://apis.google.com/js/api.js",function(){o.gapi&&e.driveVisible(!0)})},s.prototype.driveCallback=function(e,t){if(t&&o.XMLHttpRequest&&o.google&&t[o.google.picker.Response.ACTION]===o.google.picker.Action.PICKED&&t[o.google.picker.Response.DOCUMENTS]&&t[o.google.picker.Response.DOCUMENTS][0]&&t[o.google.picker.Response.DOCUMENTS][0].id){var s=this,i=new o.XMLHttpRequest;i.open("GET","https://www.googleapis.com/drive/v2/files/"+t[o.google.picker.Response.DOCUMENTS][0].id),i.setRequestHeader("Authorization","Bearer "+e),i.addEventListener("load",function(){if(i&&i.responseText){var t=c.parse(i.responseText),o=function(e,t,s){e&&e.exportLinks&&(e.exportLinks[t]?(e.downloadUrl=e.exportLinks[t],e.title=e.title+"."+s,e.mimeType=t):e.exportLinks["application/pdf"]&&(e.downloadUrl=e.exportLinks["application/pdf"],e.title=e.title+".pdf",e.mimeType="application/pdf"))
-};if(t&&!t.downloadUrl&&t.mimeType&&t.exportLinks)switch(t.mimeType.toString().toLowerCase()){case"application/vnd.google-apps.document":o(t,"application/vnd.openxmlformats-officedocument.wordprocessingml.document","docx");break;case"application/vnd.google-apps.spreadsheet":o(t,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsx");break;case"application/vnd.google-apps.drawing":o(t,"image/png","png");break;case"application/vnd.google-apps.presentation":o(t,"application/vnd.openxmlformats-officedocument.presentationml.presentation","pptx");break;default:o(t,"application/pdf","pdf")}t&&t.downloadUrl&&s.addDriveAttachment(t,e)}}),i.send()}},s.prototype.driveCreatePiker=function(e){if(o.gapi&&e&&e.access_token){var t=this;o.gapi.load("picker",{callback:function(){if(o.google&&o.google.picker){var s=(new o.google.picker.PickerBuilder).addView((new o.google.picker.DocsView).setIncludeFolders(!0)).setAppId(b.settingsGet("GoogleClientID")).setOAuthToken(e.access_token).setCallback(n.bind(t.driveCallback,t,e.access_token)).enableFeature(o.google.picker.Feature.NAV_HIDDEN).build();s.setVisible(!0)}}})}},s.prototype.driveOpenPopup=function(){if(o.gapi){var e=this;o.gapi.load("auth",{callback:function(){var t=o.gapi.auth.getToken();t?e.driveCreatePiker(t):o.gapi.auth.authorize({client_id:b.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!0},function(t){if(t&&!t.error){var s=o.gapi.auth.getToken();s&&e.driveCreatePiker(s)}else o.gapi.auth.authorize({client_id:b.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!1},function(t){if(t&&!t.error){var s=o.gapi.auth.getToken();s&&e.driveCreatePiker(s)}})})}})}},s.prototype.getAttachmentById=function(e){for(var t=this.attachments(),s=0,o=t.length;o>s;s++)if(t[s]&&e===t[s].id)return t[s];return null},s.prototype.initUploader=function(){if(this.composeUploaderButton()){var e={},t=p.pInt(b.settingsGet("AttachmentLimit")),s=new Jua({action:m.upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",n.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",n.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",n.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",n.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",n.bind(function(t,s,i){var n=null;p.isUnd(e[t])?(n=this.getAttachmentById(t),n&&(e[t]=n)):n=e[t],n&&n.progress(" - "+o.Math.floor(s/i*100)+"%")},this)).on("onSelect",n.bind(function(e,o){this.dragAndDropOver(!1);var i=this,n=p.isUnd(o.FileName)?"":o.FileName.toString(),r=p.isNormal(o.Size)?p.pInt(o.Size):null,a=new C(e,n,r);return a.cancel=function(e){return function(){i.attachments.remove(function(t){return t&&t.id===e}),s&&s.cancel(e)}}(e),this.attachments.push(a),r>0&&t>0&&r>t?(a.error(p.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",n.bind(function(t){var s=null;p.isUnd(e[t])?(s=this.getAttachmentById(t),s&&(e[t]=s)):s=e[t],s&&(s.waiting(!1),s.uploading(!0))},this)).on("onComplete",n.bind(function(t,s,o){var i="",n=null,r=null,a=this.getAttachmentById(t);r=s&&o&&o.Result&&o.Result.Attachment?o.Result.Attachment:null,n=o&&o.Result&&o.Result.ErrorCode?o.Result.ErrorCode:null,null!==n?i=p.getUploadErrorDescByCode(n):r||(i=p.i18n("UPLOAD/ERROR_UNKNOWN")),a&&(""!==i&&00&&i>0&&n>i?(s.uploading(!1),s.error(p.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(v.composeUploadExternals(function(e,t){var o=!1;s.uploading(!1),u.StorageResultType.Success===e&&t&&t.Result&&t.Result[s.id]&&(o=!0,s.tempName(t.Result[s.id])),o||s.error(p.getUploadErrorDescByCode(u.UploadErrorCode.FileNoUploaded))},[e.link]),!0)},s.prototype.addDriveAttachment=function(e,t){var s=this,o=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}},i=p.pInt(b.settingsGet("AttachmentLimit")),n=null,r=e.fileSize?p.pInt(e.fileSize):0;return n=new C(e.downloadUrl,e.title,r),n.fromMessage=!1,n.cancel=o(e.downloadUrl),n.waiting(!1).uploading(!0),this.attachments.push(n),r>0&&i>0&&r>i?(n.uploading(!1),n.error(p.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(v.composeUploadDrive(function(e,t){var s=!1;n.uploading(!1),u.StorageResultType.Success===e&&t&&t.Result&&t.Result[n.id]&&(s=!0,n.tempName(t.Result[n.id][0]),n.size(p.pInt(t.Result[n.id][1]))),s||n.error(p.getUploadErrorDescByCode(u.UploadErrorCode.FileNoUploaded))},e.downloadUrl,t),!0)},s.prototype.prepearMessageAttachments=function(e,t){if(e){var s=this,o=p.isNonEmptyArray(e.attachments())?e.attachments():[],i=0,n=o.length,r=null,a=null,l=!1,c=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}};if(u.ComposeType.ForwardAsAttachment===t)this.addMessageAsAttachment(e);else for(;n>i;i++){switch(a=o[i],l=!1,t){case u.ComposeType.Reply:case u.ComposeType.ReplyAll:l=a.isLinked;break;case u.ComposeType.Forward:case u.ComposeType.Draft:case u.ComposeType.EditAsNew:l=!0}l&&(r=new C(a.download,a.fileName,a.estimatedSize,a.isInline,a.isLinked,a.cid,a.contentLocation),r.fromMessage=!0,r.cancel=c(a.download),r.waiting(!1).uploading(!0),this.attachments.push(r))}}},s.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},s.prototype.setMessageAttachmentFailedDowbloadText=function(){n.each(this.attachments(),function(e){e&&e.fromMessage&&e.waiting(!1).uploading(!1).error(p.getUploadErrorDescByCode(u.UploadErrorCode.FileNoUploaded))},this)},s.prototype.isEmptyForm=function(e){e=p.isUnd(e)?!0:!!e;var t=e?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&t&&(!this.oEditor||""===this.oEditor.getData())},s.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.attachmentsInProcessError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},s.prototype.getAttachmentsDownloadsForUpload=function(){return n.map(n.filter(this.attachments(),function(e){return e&&""===e.tempName()}),function(e){return e.id})},s.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Consts.js":6,"../../Common/Enums.js":7,"../../Common/Events.js":8,"../../Common/Globals.js":9,"../../Common/LinkBuilder.js":10,"../../Common/NewHtmlEditorWrapper.js":11,"../../Common/Utils.js":14,"../../External/$window.js":18,"../../External/JSON.js":20,"../../External/jquery.js":26,"../../External/ko.js":28,"../../External/moment.js":29,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Models/ComposeAttachmentModel.js":39,"../../Storages/AppSettings.js":68,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74,"./PopupsAskViewModel.js":84,"./PopupsComposeOpenPgpViewModel.js":85,"./PopupsFolderSystemViewModel.js":91}],87:[function(e,t){!function(t){"use strict";function s(){w.call(this,"Popups","PopupsContacts");var t=this,i=function(e){e&&0=e?1:e},this),this.contactsPagenator=r.computed(d.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=r.observable(!0),this.viewClearSearch=r.observable(!1),this.viewID=r.observable(""),this.viewReadOnly=r.observable(!1),this.viewProperties=r.observableArray([]),this.viewTags=r.observable(""),this.viewTags.visibility=r.observable(!1),this.viewTags.focusTrigger=r.observable(!1),this.viewTags.focusTrigger.subscribe(function(e){e||""!==this.viewTags()?e&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=r.observable(l.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(e){return-1=o&&(this.bDropPageAfterDelete=!0),n.delay(function(){n.each(i,function(e){t.remove(e)})},500))},s.prototype.deleteSelectedContacts=function(){00?o:0),d.isNonEmptyArray(s.Result.Tags)&&(r=n.map(s.Result.Tags,function(e){var t=new S;return t.parse(e)?t:null}),r=n.compact(r))),t.contactsCount(o),t.contacts(i),t.contacts.loading(!1),t.contactTags(r),t.viewClearSearch(""!==t.search())},s,c.Defaults.ContactsPerPage,this.search())},s.prototype.onBuild=function(e){this.oContentVisible=i(".b-list-content",e),this.oContentScrollable=i(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,l.KeyState.ContactList);var t=this;a("delete",l.KeyState.ContactList,function(){return t.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=r.dataFor(this);e&&(t.contactsPage(d.pInt(e.value)),t.reloadContactList())}),this.initUploader()},s.prototype.onShow=function(){C.routeOff(),this.reloadContactList(!0)},s.prototype.onHide=function(){C.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Consts.js":6,"../../Common/Enums.js":7,"../../Common/Globals.js":9,"../../Common/LinkBuilder.js":10,"../../Common/Selector.js":13,"../../Common/Utils.js":14,"../../External/jquery.js":26,"../../External/key.js":27,"../../External/ko.js":28,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Models/ContactModel.js":40,"../../Models/ContactPropertyModel.js":41,"../../Models/ContactTagModel.js":42,"../../Models/EmailModel.js":43,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"./PopupsComposeViewModel.js":86}],88:[function(e,t){!function(t){"use strict";function s(){l.call(this,"Popups","PopupsFilter"),this.filter=o.observable(null),this.selectedFolderValue=o.observable(i.Values.UnuseOptionValue),this.folderSelectList=r.folderMenuForMove,this.defautOptionsAfterRender=n.defautOptionsAfterRender,a.constructorEnd(this)}var o=e("../../External/ko.js"),i=e("../../Common/Consts.js"),n=e("../../Common/Utils.js"),r=e("../../Storages/WebMailDataStorage.js"),a=e("../../Knoin/Knoin.js"),l=e("../../Knoin/KnoinAbstractViewModel.js");a.extendAsViewModel("PopupsFilterViewModel",s),s.prototype.clearPopup=function(){},s.prototype.onShow=function(e){this.clearPopup(),this.filter(e)},t.exports=s}(t)},{"../../Common/Consts.js":6,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],89:[function(e,t){!function(t){"use strict";function s(){u.call(this,"Popups","PopupsFolderClear");var t=e("../../Boots/RainLoopApp.js");this.selectedFolder=o.observable(null),this.clearingProcess=o.observable(!1),this.clearingError=o.observable(""),this.folderFullNameForClear=o.computed(function(){var e=this.selectedFolder();return e?e.printableFullName():""},this),this.folderNameForClear=o.computed(function(){var e=this.selectedFolder();return e?e.localName():""},this),this.dangerDescHtml=o.computed(function(){return n.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=n.createCommand(this,function(){var e=this,s=this.selectedFolder();s&&(r.message(null),r.messageList([]),this.clearingProcess(!0),a.setFolderHash(s.fullNameRaw,""),l.folderClear(function(s,o){e.clearingProcess(!1),i.StorageResultType.Success===s&&o&&o.Result?(t.reloadMessageList(!0),e.cancelCommand()):e.clearingError(o&&o.ErrorCode?n.getNotification(o.ErrorCode):n.getNotification(i.Notification.MailServerError))},s.fullNameRaw))},function(){var e=this.selectedFolder(),t=this.clearingProcess();return!t&&null!==e}),c.constructorEnd(this)}var o=e("../../External/ko.js"),i=e("../../Common/Enums.js"),n=e("../../Common/Utils.js"),r=e("../../Storages/WebMailDataStorage.js"),a=e("../../Storages/WebMailCacheStorage.js"),l=e("../../Storages/WebMailAjaxRemoteStorage.js"),c=e("../../Knoin/Knoin.js"),u=e("../../Knoin/KnoinAbstractViewModel.js");c.extendAsViewModel("PopupsFolderClearViewModel",s),s.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},s.prototype.onShow=function(e){this.clearPopup(),e&&this.selectedFolder(e)},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74}],90:[function(e,t){!function(t){"use strict";function s(){u.call(this,"Popups","PopupsFolderCreate"),r.initOnStartOrLangChange(function(){this.sNoParentText=r.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=o.observable(""),this.folderName.focused=o.observable(!1),this.selectedParentValue=o.observable(n.Values.UnuseOptionValue),this.parentFolderSelectList=o.computed(function(){var e=[],t=null,s=null,o=a.folderList(),i=function(e){return e?e.isSystemFolder()?e.name()+" "+e.manageFolderSystemName():e.name():""};return e.push(["",this.sNoParentText]),""!==a.namespace&&(t=function(e){return a.namespace!==e.fullNameRaw.substr(0,a.namespace.length)}),r.folderListOptionsBuilder([],o,[],e,null,t,s,i)},this),this.createFolder=r.createCommand(this,function(){var t=e("../../Boots/RainLoopApp.js"),s=this.selectedParentValue();""===s&&1"),this.submitRequest(!0),i.delay(function(){n=o.openpgp.generateKeyPair({userId:s,numBits:r.pInt(e.keyBitLength()),passphrase:r.trim(e.password())}),n&&n.privateKeyArmored&&(l.privateKeys.importKey(n.privateKeyArmored),l.publicKeys.importKey(n.publicKeyArmored),l.store(),t.reloadOpenPgpKeys(),r.delegateRun(e,"cancelCommand")),e.submitRequest(!1)},100),!0)}),l.constructorEnd(this)}var o=e("../../External/window.js"),i=e("../../External/underscore.js"),n=e("../../External/ko.js"),r=e("../../Common/Utils.js"),a=e("../../Storages/WebMailDataStorage.js"),l=e("../../Knoin/Knoin.js"),c=e("../../Knoin/KnoinAbstractViewModel.js");l.extendAsViewModel("PopupsGenerateNewOpenPgpKeyViewModel",s),s.prototype.clearPopup=function(){this.name(""),this.password(""),this.email(""),this.email.error(!1),this.keyBitLength(2048)
-},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.email.focus(!0)},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../External/underscore.js":31,"../../External/window.js":32,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailDataStorage.js":74}],93:[function(e,t){!function(t){"use strict";function s(){c.call(this,"Popups","PopupsIdentity");var t=e("../../Boots/RainLoopApp.js");this.id="",this.edit=o.observable(!1),this.owner=o.observable(!1),this.email=o.observable("").validateEmail(),this.email.focused=o.observable(!1),this.name=o.observable(""),this.name.focused=o.observable(!1),this.replyTo=o.observable("").validateSimpleEmail(),this.replyTo.focused=o.observable(!1),this.bcc=o.observable("").validateSimpleEmail(),this.bcc.focused=o.observable(!1),this.submitRequest=o.observable(!1),this.submitError=o.observable(""),this.addOrEditIdentityCommand=n.createCommand(this,function(){return this.email.hasError()||this.email.hasError(""===n.trim(this.email())),this.email.hasError()?(this.owner()||this.email.focused(!0),!1):this.replyTo.hasError()?(this.replyTo.focused(!0),!1):this.bcc.hasError()?(this.bcc.focused(!0),!1):(this.submitRequest(!0),a.identityUpdate(_.bind(function(e,s){this.submitRequest(!1),i.StorageResultType.Success===e&&s?s.Result?(t.accountsAndIdentities(),this.cancelCommand()):s.ErrorCode&&this.submitError(n.getNotification(s.ErrorCode)):this.submitError(n.getNotification(i.Notification.UnknownError))},this),this.id,this.email(),this.name(),this.replyTo(),this.bcc()),!0)},function(){return!this.submitRequest()}),this.label=o.computed(function(){return n.i18n("POPUPS_IDENTITIES/"+(this.edit()?"TITLE_UPDATE_IDENTITY":"TITLE_ADD_IDENTITY"))},this),this.button=o.computed(function(){return n.i18n("POPUPS_IDENTITIES/"+(this.edit()?"BUTTON_UPDATE_IDENTITY":"BUTTON_ADD_IDENTITY"))},this),r.constructorEnd(this)}var o=e("../../External/ko.js"),i=e("../../Common/Enums.js"),n=e("../../Common/Utils.js"),r=e("../../Knoin/Knoin.js"),a=e("../../Storages/WebMailAjaxRemoteStorage.js"),l=e("../../Storages/WebMailDataStorage.js"),c=e("../../Knoin/KnoinAbstractViewModel.js");r.extendAsViewModel("PopupsIdentityViewModel",s),s.prototype.clearPopup=function(){this.id="",this.edit(!1),this.owner(!1),this.name(""),this.email(""),this.replyTo(""),this.bcc(""),this.email.hasError(!1),this.replyTo.hasError(!1),this.bcc.hasError(!1),this.submitRequest(!1),this.submitError("")},s.prototype.onShow=function(e){this.clearPopup(),e&&(this.edit(!0),this.id=e.id,this.name(e.name()),this.email(e.email()),this.replyTo(e.replyTo()),this.bcc(e.bcc()),this.owner(this.id===l.accountEmail()))},s.prototype.onFocus=function(){this.owner()||this.email.focused(!0)},t.exports=s}(t)},{"../../Boots/RainLoopApp.js":4,"../../Common/Enums.js":7,"../../Common/Utils.js":14,"../../External/ko.js":28,"../../Knoin/Knoin.js":33,"../../Knoin/KnoinAbstractViewModel.js":36,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74}],94:[function(e,t){!function(t){"use strict";function s(){a.call(this,"Popups","PopupsKeyboardShortcutsHelp"),this.sDefaultKeyScope=n.KeyState.PopupKeyboardShortcutsHelp,r.constructorEnd(this)}var o=e("../../External/underscore.js"),i=e("../../External/key.js"),n=e("../../Common/Enums.js"),r=e("../../Knoin/Knoin.js"),a=e("../../Knoin/KnoinAbstractViewModel.js");r.extendAsViewModel("PopupsKeyboardShortcutsHelpViewModel",s),s.prototype.onBuild=function(e){i("tab, shift+tab, left, right",n.KeyState.PopupKeyboardShortcutsHelp,o.bind(function(t,s){if(t&&s){var o=e.find(".nav.nav-tabs > li"),i=s&&("tab"===s.shortcut||"right"===s.shortcut),n=o.index(o.filter(".active"));return!i&&n>0?n--:i&&n').appendTo("body"),a.on("error",function(t){t&&t.originalEvent&&t.originalEvent.message&&-1===u.inArray(t.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&e.jsError(u.emptyFunction,t.originalEvent.message,t.originalEvent.filename,t.originalEvent.lineno,n.location&&n.location.toString?n.location.toString():"",r.attr("class"),u.microtime()-c.now)}),l.on("keydown",function(e){e&&e.ctrlKey&&r.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&r.removeClass("rl-ctrl-key-pressed")})}var i=t("$"),o=t("_"),n=t("window"),r=t("$html"),a=t("$window"),l=t("$doc"),c=t("Globals"),u=t("Utils"),d=t("LinkBuilder"),p=t("Events"),h=t("../Storages/AppSettings.js"),g=t("KnoinAbstractBoot");o.extend(s.prototype,g.prototype),s.prototype.remote=function(){return null},s.prototype.data=function(){return null},s.prototype.setupSettings=function(){return!0},s.prototype.download=function(e){var t=null,s=null,i=n.navigator.userAgent.toLowerCase();return i&&(i.indexOf("chrome")>-1||i.indexOf("chrome")>-1)&&(s=n.document.createElement("a"),s.href=e,n.document.createEvent&&(t=n.document.createEvent("MouseEvents"),t&&t.initEvent&&s.dispatchEvent))?(t.initEvent("click",!0,!0),s.dispatchEvent(t),!0):(c.bMobileDevice?(n.open(e,"_self"),n.focus()):this.iframe.attr("src",e),!0)},s.prototype.setTitle=function(e){e=(u.isNormal(e)&&0o;o++)g=e.Result["@Collection"][o],g&&"Object/Message"===g["@Object"]&&(m=h[o],m&&m.initByJson(g)||(m=C.newInstanceFromJson(g)),m&&(S.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=y&&(y++,m.newForAnimation(!0)),m.deleted(!1),t?S.initMessageFlagsFromCache(m):S.storeMessageFlagsToCache(m),m.lastInCollapsedThread(s&&-1i;i++)n=t[i],n&&(a=n.FullNameRaw,r=S.getFolderFromCacheList(a),r||(r=w.newInstanceFromJson(n),r&&(S.setFolderToCacheList(a,r),S.setFolderFullNameRaw(r.fullNameHash,a))),r&&(r.collapsed(!s.isFolderExpanded(r.fullNameHash)),n.Extended&&(n.Extended.Hash&&S.setFolderHash(r.fullNameRaw,n.Extended.Hash),d.isNormal(n.Extended.MessageCount)&&r.messageCountAll(n.Extended.MessageCount),d.isNormal(n.Extended.MessageUnseenCount)&&r.messageCountUnread(n.Extended.MessageUnseenCount)),l=n.SubFolders,l&&"Collection/FolderCollection"===l["@Object"]&&l["@Collection"]&&d.isArray(l["@Collection"])&&r.subFolders(this.folderResponseParseRec(e,l["@Collection"])),c.push(r)));return c},s.prototype.setFolders=function(e){var t=[],s=!1,i=function(e){return""===e||c.Values.UnuseOptionValue===e||null!==S.getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&d.isArray(e.Result["@Collection"])&&(d.isUnd(e.Result.Namespace)||(b.namespace=e.Result.Namespace),b.threading(!!f.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(b.namespace,e.Result["@Collection"]),b.folderList(t),e.Result.SystemFolders&&""==""+f.settingsGet("SentFolder")+f.settingsGet("DraftFolder")+f.settingsGet("SpamFolder")+f.settingsGet("TrashFolder")+f.settingsGet("ArchiveFolder")+f.settingsGet("NullFolder")&&(f.settingsSet("SentFolder",e.Result.SystemFolders[2]||null),f.settingsSet("DraftFolder",e.Result.SystemFolders[3]||null),f.settingsSet("SpamFolder",e.Result.SystemFolders[4]||null),f.settingsSet("TrashFolder",e.Result.SystemFolders[5]||null),f.settingsSet("ArchiveFolder",e.Result.SystemFolders[12]||null),s=!0),b.sentFolder(i(f.settingsGet("SentFolder"))),b.draftFolder(i(f.settingsGet("DraftFolder"))),b.spamFolder(i(f.settingsGet("SpamFolder"))),b.trashFolder(i(f.settingsGet("TrashFolder"))),b.archiveFolder(i(f.settingsGet("ArchiveFolder"))),s&&y.saveSystemFolders(d.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder(),ArchiveFolder:b.archiveFolder(),NullFolder:"NullFolder"}),m.set(a.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},s.prototype.isFolderExpanded=function(e){var t=m.get(a.ClientSideKeyName.ExpandedFolders);return n.isArray(t)&&-1!==n.indexOf(t,e)},s.prototype.setExpandedFolder=function(e,t){var s=m.get(a.ClientSideKeyName.ExpandedFolders);n.isArray(s)||(s=[]),t?(s.push(e),s=n.uniq(s)):s=n.without(s,e),m.set(a.ClientSideKeyName.ExpandedFolders,s)},s.prototype.initLayoutResizer=function(e,t,s){var i=60,n=155,r=o(e),a=o(t),l=m.get(s)||null,c=function(e){e&&(r.css({width:""+e+"px"}),a.css({left:""+e+"px"}))},u=function(e){if(e)r.resizable("disable"),c(i);else{r.resizable("enable");var t=d.pInt(m.get(s))||n;c(t>n?t:n)}},p=function(e,t){t&&t.size&&t.size.width&&(m.set(s,t.size.width),a.css({left:""+t.size.width+"px"}))};null!==l&&c(l>n?l:n),r.resizable({helper:"ui-resizable-helper",minWidth:n,maxWidth:350,handles:"e",stop:p}),h.sub("left-panel.off",function(){u(!0)}),h.sub("left-panel.on",function(){u(!1)})},s.prototype.mailToHelper=function(e){if(e&&"mailto:"===e.toString().substr(0,7).toLowerCase()){e=e.toString().substr(7);var t={},s=null,o=e.replace(/\?.+$/,""),n=e.replace(/^[^\?]*\?/,"");return s=new v,s.parse(i.decodeURIComponent(o)),s&&s.email&&(t=d.simpleQueryParser(n),g.showScreenPopup(N,[a.ComposeType.Empty,null,[s],d.isUnd(t.subject)?null:d.pString(t.subject),d.isUnd(t.body)?null:d.plainToHtml(d.pString(t.body))])),!0}return!1},s.prototype.bootstart=function(){I.prototype.bootstart.call(this),b.populateDataOnStart();var e=this,t="",s=f.settingsGet("JsHash"),r=d.pInt(f.settingsGet("ContactsSyncInterval")),c=f.settingsGet("AllowGoogleSocial"),m=f.settingsGet("AllowFacebookSocial"),S=f.settingsGet("AllowTwitterSocial");d.initOnStartOrLangChange(function(){o.extend(!0,o.magnificPopup.defaults,{tClose:d.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:d.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:d.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:d.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:d.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:d.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:d.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this),i.SimplePace&&(i.SimplePace.set(70),i.SimplePace.sleep()),l.leftPanelDisabled.subscribe(function(e){h.pub("left-panel."+(e?"off":"on"))}),f.settingsGet("Auth")?(this.setTitle(d.i18n("TITLES/LOADING")),this.folders(n.bind(function(t){g.hideLoading(),t?(i.$LAB&&i.crypto&&i.crypto.getRandomValues&&f.capa(a.Capa.OpenPGP)?i.$LAB.script(i.openpgp?"":p.openPgpJs()).wait(function(){i.openpgp&&(b.openpgpKeyring=new i.openpgp.Keyring,b.capaOpenPGP(!0),h.pub("openpgp.init"),e.reloadOpenPgpKeys())}):b.capaOpenPGP(!1),g.startScreens([R,L]),(c||m||S)&&e.socialUsers(!0),h.sub("interval.2m",function(){e.folderInformation("INBOX")}),h.sub("interval.2m",function(){var t=b.currentFolderFullNameRaw();"INBOX"!==t&&e.folderInformation(t)}),h.sub("interval.3m",function(){e.folderInformationMultiply()}),h.sub("interval.5m",function(){e.quota()}),h.sub("interval.10m",function(){e.folders()}),r=r>=5?r:20,r=320>=r?r:320,i.setInterval(function(){e.contactsSync()},6e4*r+5e3),n.delay(function(){e.contactsSync()},5e3),n.delay(function(){e.folderInformationMultiply(!0)},500),u.runHook("rl-start-user-screens"),h.pub("rl.bootstart-user-screens"),f.settingsGet("AccountSignMe")&&i.navigator.registerProtocolHandler&&n.delay(function(){try{i.navigator.registerProtocolHandler("mailto",i.location.protocol+"//"+i.location.host+i.location.pathname+"?mailto&to=%s",""+(f.settingsGet("Title")||"RainLoop"))}catch(t){}f.settingsGet("MailToEmail")&&e.mailToHelper(f.settingsGet("MailToEmail"))},500)):(g.startScreens([P]),u.runHook("rl-start-login-screens"),h.pub("rl.bootstart-login-screens")),i.SimplePace&&i.SimplePace.set(100),l.bMobileDevice||n.defer(function(){e.initLayoutResizer("#rl-left","#rl-right",a.ClientSideKeyName.FolderListSize)})},this))):(t=d.pString(f.settingsGet("CustomLoginLink")),t?(g.routeOff(),g.setHash(p.root(),!0),g.routeOff(),n.defer(function(){i.location.href=t})):(g.hideLoading(),g.startScreens([P]),u.runHook("rl-start-login-screens"),h.pub("rl.bootstart-login-screens"),i.SimplePace&&i.SimplePace.set(100))),c&&(i["rl_"+s+"_google_service"]=function(){b.googleActions(!0),e.socialUsers()}),m&&(i["rl_"+s+"_facebook_service"]=function(){b.facebookActions(!0),e.socialUsers()}),S&&(i["rl_"+s+"_twitter_service"]=function(){b.twitterActions(!0),e.socialUsers()}),h.sub("interval.1m",function(){l.momentTrigger(!l.momentTrigger())}),u.runHook("rl-start-screens"),h.pub("rl.bootstart-end")},e.exports=new s}(t,e)},{$:26,"../Models/AccountModel.js":37,"../Models/EmailModel.js":43,"../Models/FolderModel.js":46,"../Models/IdentityModel.js":47,"../Models/MessageModel.js":48,"../Models/OpenPgpKeyModel.js":49,"../Screens/LoginScreen.js":51,"../Screens/MailBoxScreen.js":52,"../Screens/SettingsScreen.js":53,"../Settings/SettingsAccounts.js":54,"../Settings/SettingsChangePassword.js":55,"../Settings/SettingsContacts.js":56,"../Settings/SettingsFilters.js":57,"../Settings/SettingsFolders.js":58,"../Settings/SettingsGeneral.js":59,"../Settings/SettingsIdentities.js":60,"../Settings/SettingsIdentity.js":61,"../Settings/SettingsOpenPGP.js":62,"../Settings/SettingsSecurity.js":63,"../Settings/SettingsSocial.js":64,"../Settings/SettingsThemes.js":65,"../Storages/AppSettings.js":68,"../Storages/LocalStorage.js":69,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAskViewModel.js":84,"../ViewModels/Popups/PopupsComposeViewModel.js":86,"./AbstractApp.js":2,Consts:6,Enums:7,Events:8,Globals:9,LinkBuilder:10,Plugins:12,Utils:14,_:31,kn:33,moment:29,window:32}],5:[function(e,t){!function(e){"use strict";var t={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(e){return t.encode(e).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(e){var s,i,o,n,r,a,l,c="",u=0;for(e=t._utf8_encode(e);u>2,r=(3&s)<<4|i>>4,a=(15&i)<<2|o>>6,l=63&o,isNaN(i)?a=l=64:isNaN(o)&&(l=64),c=c+this._keyStr.charAt(n)+this._keyStr.charAt(r)+this._keyStr.charAt(a)+this._keyStr.charAt(l);return c},decode:function(e){var s,i,o,n,r,a,l,c="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u>4,i=(15&r)<<4|a>>2,o=(3&a)<<6|l,c+=String.fromCharCode(s),64!==a&&(c+=String.fromCharCode(i)),64!==l&&(c+=String.fromCharCode(o));return t._utf8_decode(c)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",s=0,i=e.length,o=0;i>s;s++)o=e.charCodeAt(s),128>o?t+=String.fromCharCode(o):o>127&&2048>o?(t+=String.fromCharCode(o>>6|192),t+=String.fromCharCode(63&o|128)):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128),t+=String.fromCharCode(63&o|128));return t},_utf8_decode:function(e){for(var t="",s=0,i=0,o=0,n=0;si?(t+=String.fromCharCode(i),s++):i>191&&224>i?(o=e.charCodeAt(s+1),t+=String.fromCharCode((31&i)<<6|63&o),s+=2):(o=e.charCodeAt(s+1),n=e.charCodeAt(s+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&n),s+=3);return t}};e.exports=t}(t,e)},{}],6:[function(e,t){!function(e){"use strict";var t={};t.Values={},t.DataImages={},t.Defaults={},t.Defaults.MessagesPerPage=20,t.Defaults.ContactsPerPage=50,t.Defaults.MessagesPerPageArray=[10,20,30,50,100],t.Defaults.DefaultAjaxTimeout=3e4,t.Defaults.SearchAjaxTimeout=3e5,t.Defaults.SendMessageAjaxTimeout=3e5,t.Defaults.SaveMessageAjaxTimeout=2e5,t.Defaults.ContactsSyncAjaxTimeout=2e5,t.Values.UnuseOptionValue="__UNUSE__",t.Values.ClientSideCookieIndexName="rlcsc",t.Values.ImapDefaulPort=143,t.Values.ImapDefaulSecurePort=993,t.Values.SmtpDefaulPort=25,t.Values.SmtpDefaulSecurePort=465,t.Values.MessageBodyCacheLimit=15,t.Values.AjaxErrorLimit=7,t.Values.TokenErrorLimit=10,t.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",t.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",e.exports=t}(t,e)},{}],7:[function(e,t){!function(e){"use strict";var t={};t.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},t.State={Empty:10,Login:20,Auth:30},t.StateType={Webmail:0,Admin:1},t.Capa={Prem:"PREM",TwoFactor:"TWO_FACTOR",OpenPGP:"OPEN_PGP",Prefetch:"PREFETCH",Gravatar:"GRAVATAR",Themes:"THEMES",Filters:"FILTERS",AdditionalAccounts:"ADDITIONAL_ACCOUNTS",AdditionalIdentities:"ADDITIONAL_IDENTITIES"},t.KeyState={All:"all",None:"none",ContactList:"contact-list",MessageList:"message-list",FolderList:"folder-list",MessageView:"message-view",Compose:"compose",Settings:"settings",Menu:"menu",PopupComposeOpenPGP:"compose-open-pgp",PopupKeyboardShortcutsHelp:"popup-keyboard-shortcuts-help",PopupAsk:"popup-ask"},t.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,NotSpam:80,User:99},t.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},t.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},t.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},t.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},t.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},t.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},t.EventKeyCode={Backspace:8,Tab:9,Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Space:32,Insert:45,Delete:46,A:65,S:83},t.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},t.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},t.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},t.MessagePriority={Low:5,Normal:3,High:1},t.EditorDefaultType={Html:"Html",Plain:"Plain"},t.CustomThemeType={Light:"Light",Dark:"Dark"},t.ServerSecure={None:0,SSL:1,TLS:2},t.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},t.EmailType={Defailt:0,Facebook:1,Google:2},t.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},t.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},t.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},t.FilterConditionField={From:"From",To:"To",Recipient:"Recipient",Subject:"Subject"},t.FilterConditionType={Contains:"Contains",NotContains:"NotContains",EqualTo:"EqualTo",NotEqualTo:"NotEqualTo"},t.FiltersAction={None:"None",Move:"Move",Discard:"Discard",Forward:"Forward"},t.FilterRulesType={And:"And",Or:"Or"},t.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},t.ContactPropertyType={Unknown:0,FullName:10,FirstName:15,LastName:16,MiddleName:16,Nick:18,NamePrefix:20,NameSuffix:21,Email:30,Phone:31,Web:32,Birthday:40,Facebook:90,Skype:91,GitHub:92,Note:110,Custom:250},t.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,AccountTwoFactorAuthRequired:120,AccountTwoFactorAuthError:121,CouldNotSaveNewPassword:130,CurrentPasswordIncorrect:131,NewPasswordShort:132,NewPasswordWeak:133,NewPasswordForbidden:134,ContactsSyncError:140,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantCopyMessage:205,CantSaveMessage:301,CantSendMessage:302,InvalidRecipients:303,CantCreateFolder:400,CantRenameFolder:401,CantDeleteFolder:402,CantSubscribeFolder:403,CantUnsubscribeFolder:404,CantDeleteNonEmptyFolder:405,CantSaveSettings:501,CantSavePluginSettings:502,DomainAlreadyExists:601,CantInstallPackage:701,CantDeletePackage:702,InvalidPluginPackage:703,UnsupportedPluginPackage:704,LicensingServerIsUnavailable:710,LicensingExpired:711,LicensingBanned:712,DemoSendMessageError:750,AccountAlreadyExists:801,MailServerError:901,ClientViewError:902,InvalidInputArgument:903,UnknownNotification:999,UnknownError:999},e.exports=t
+}(t,e)},{}],8:[function(e,t){!function(e,t){"use strict";function s(){this.oSubs={}}var i=t("_"),o=t("Utils"),n=t("Plugins");s.prototype.oSubs={},s.prototype.sub=function(e,t,s){return o.isUnd(this.oSubs[e])&&(this.oSubs[e]=[]),this.oSubs[e].push([t,s]),this},s.prototype.pub=function(e,t){return n.runHook("rl-pub",[e,t]),o.isUnd(this.oSubs[e])||i.each(this.oSubs[e],function(e){e[0]&&e[0].apply(e[1]||null,t||[])}),this},e.exports=new s}(t,e)},{Plugins:12,Utils:14,_:31}],9:[function(e,t){!function(e,t){"use strict";var s={},i=t("window"),o=t("ko"),n=t("key"),r=t("$html"),a=t("Enums");s.now=(new i.Date).getTime(),s.momentTrigger=o.observable(!0),s.dropdownVisibility=o.observable(!1).extend({rateLimit:0}),s.tooltipTrigger=o.observable(!1).extend({rateLimit:0}),s.langChangeTrigger=o.observable(!0),s.useKeyboardShortcuts=o.observable(!0),s.iAjaxErrorCount=0,s.iTokenErrorCount=0,s.iMessageBodyCacheCount=0,s.bUnload=!1,s.sUserAgent=(i.navigator.userAgent||"").toLowerCase(),s.bIsiOSDevice=-11&&(i=i.replace(/[\/]+$/,""),i+="/p"+t),""!==s&&(i=i.replace(/[\/]+$/,""),i+="/"+encodeURI(s)),i},s.prototype.phpInfo=function(){return this.sServer+"Info"},s.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},s.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},s.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},s.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},s.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},s.prototype.themePreviewLink=function(e){var t="rainloop/v/"+this.sVersion+"/";return"@custom"===e.substr(-7)&&(e=o.trim(e.substring(0,e.length-7)),t=""),t+"themes/"+encodeURI(e)+"/images/preview.png"},s.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},s.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/openpgp.min.js"},s.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},s.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},s.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},e.exports=new s}(t,e)},{"../Storages/AppSettings.js":68,Utils:14,window:32}],11:[function(e,t){!function(e,t){"use strict";function s(e,t,s,i){this.editor=null,this.iBlurTimer=0,this.fOnBlur=t||null,this.fOnReady=s||null,this.fOnModeChange=i||null,this.$element=$(e),this.resize=o.throttle(o.bind(this.resize,this),100),this.init()}var i=t("window"),o=t("_"),n=t("Globals"),r=t("../Storages/AppSettings.js");s.prototype.blurTrigger=function(){if(this.fOnBlur){var e=this;i.clearTimeout(this.iBlurTimer),this.iBlurTimer=i.setTimeout(function(){e.fOnBlur()},200)}},s.prototype.focusTrigger=function(){this.fOnBlur&&i.clearTimeout(this.iBlurTimer)},s.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},s.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},s.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},s.prototype.getData=function(e){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():e?''+this.editor.getData()+"":this.editor.getData():""},s.prototype.modeToggle=function(e){this.editor&&(e?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"),this.resize())},s.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},s.prototype.setPlain=function(e,t){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(e);this.editor.setData(e),t&&this.focus()}},s.prototype.init=function(){if(this.$element&&this.$element[0]){var e=this,t=function(){var t=n.oHtmlEditorDefaultConfig,s=r.settingsGet("Language"),o=!!r.settingsGet("AllowHtmlEditorSourceButton");o&&t.toolbarGroups&&!t.toolbarGroups.__SourceInited&&(t.toolbarGroups.__SourceInited=!0,t.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),t.enterMode=i.CKEDITOR.ENTER_BR,t.shiftEnterMode=i.CKEDITOR.ENTER_BR,t.language=n.oHtmlEditorLangsMap[s]||"en",i.CKEDITOR.env&&(i.CKEDITOR.env.isCompatible=!0),e.editor=i.CKEDITOR.appendTo(e.$element[0],t),e.editor.on("key",function(e){return e&&e.data&&9===e.data.keyCode?!1:void 0}),e.editor.on("blur",function(){e.blurTrigger()}),e.editor.on("mode",function(){e.blurTrigger(),e.fOnModeChange&&e.fOnModeChange("plain"!==e.editor.mode)}),e.editor.on("focus",function(){e.focusTrigger()}),e.fOnReady&&e.editor.on("instanceReady",function(){e.editor.setKeystroke(i.CKEDITOR.CTRL+65,"selectAll"),e.fOnReady(),e.__resizable=!0,e.resize()})};i.CKEDITOR?t():i.__initEditor=t}},s.prototype.focus=function(){this.editor&&this.editor.focus()},s.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},s.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},s.prototype.clear=function(e){this.setHtml("",e)},e.exports=s}(t,e)},{"../Storages/AppSettings.js":68,Globals:9,_:31,window:32}],12:[function(e,t){!function(e,t){"use strict";var s={__boot:null,__remote:null,__data:null},i=t("_"),o=t("Utils");s.oViewModelsHooks={},s.oSimpleHooks={},s.regViewModelHook=function(e,t){t&&(t.__hookName=e)},s.addHook=function(e,t){o.isFunc(t)&&(o.isArray(s.oSimpleHooks[e])||(s.oSimpleHooks[e]=[]),s.oSimpleHooks[e].push(t))},s.runHook=function(e,t){o.isArray(s.oSimpleHooks[e])&&(t=t||[],i.each(s.oSimpleHooks[e],function(e){e.apply(null,t)}))},s.mainSettingsGet=function(e){return s.__boot?s.__boot.settingsGet(e):null},s.remoteRequest=function(e,t,i,o,n,r){s.__remote&&s.__remote.defaultRequest(e,t,i,o,n,r)},s.settingsGet=function(e,t){var i=s.mainSettingsGet("Plugins");return i=i&&o.isUnd(i[e])?null:i[e],i?o.isUnd(i[t])?null:i[t]:null},e.exports=s}(t,e)},{Utils:14,_:31}],13:[function(e,t){!function(e,t){"use strict";function s(e,t,s,i,r,a){this.list=e,this.listChecked=n.computed(function(){return o.filter(this.list(),function(e){return e.checked()})},this).extend({rateLimit:0}),this.isListChecked=n.computed(function(){return 00&&-10)return o.newSelectPosition(s,r.shift),!1}})}},s.prototype.autoSelect=function(e){this.bAutoSelect=!!e},s.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},s.prototype.newSelectPosition=function(e,t,s){var i=0,n=10,r=!1,l=!1,c=null,u=this.list(),d=u?u.length:0,p=this.focusedItem();if(d>0)if(p){if(p)if(a.EventKeyCode.Down===e||a.EventKeyCode.Up===e||a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)o.each(u,function(t){if(!l)switch(e){case a.EventKeyCode.Up:p===t?l=!0:c=t;break;case a.EventKeyCode.Down:case a.EventKeyCode.Insert:r?(c=t,l=!0):p===t&&(r=!0)}});else if(a.EventKeyCode.Home===e||a.EventKeyCode.End===e)a.EventKeyCode.Home===e?c=u[0]:a.EventKeyCode.End===e&&(c=u[u.length-1]);else if(a.EventKeyCode.PageDown===e){for(;d>i;i++)if(p===u[i]){i+=n,i=i>d-1?d-1:i,c=u[i];break}}else if(a.EventKeyCode.PageUp===e)for(i=d;i>=0;i--)if(p===u[i]){i-=n,i=0>i?0:i,c=u[i];break}}else a.EventKeyCode.Down===e||a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e||a.EventKeyCode.Home===e||a.EventKeyCode.PageUp===e?c=u[0]:(a.EventKeyCode.Up===e||a.EventKeyCode.End===e||a.EventKeyCode.PageDown===e)&&(c=u[u.length-1]);c?(this.focusedItem(c),p&&(t?(a.EventKeyCode.Up===e||a.EventKeyCode.Down===e)&&p.checked(!p.checked()):(a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)&&p.checked(!p.checked())),!this.bAutoSelect&&!s||this.isListChecked()||a.EventKeyCode.Space===e||this.selectedItem(c),this.scrollToFocused()):p&&(!t||a.EventKeyCode.Up!==e&&a.EventKeyCode.Down!==e?(a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)&&p.checked(!p.checked()):p.checked(!p.checked()),this.focusedItem(p))},s.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var e=20,t=i(this.sItemFocusedSelector,this.oContentScrollable),s=t.position(),o=this.oContentVisible.height(),n=t.outerHeight();return s&&(s.top<0||s.top+n>o)?(this.oContentScrollable.scrollTop(s.top<0?this.oContentScrollable.scrollTop()+s.top-e:this.oContentScrollable.scrollTop()+s.top-o+n+e),!0):!1},s.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},s.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),i=0,o=0,n=null,r="",a=!1,l=!1,c=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(c=this.list(),u=e.checked(),i=0,o=c.length;o>i;i++)n=c[i],r=this.getItemUid(n),a=!1,(r===this.sLastUid||r===s)&&(a=!0),a&&(l=!l),(l||a)&&n.checked(u);this.sLastUid=""===s?"":s},s.prototype.actionClick=function(e,t){if(e){var s=!0,i=this.getItemUid(e);t&&(!t.shiftKey||t.ctrlKey||t.altKey?!t.ctrlKey||t.shiftKey||t.altKey||(s=!1,this.focusedItem(e),this.selectedItem()&&e!==this.selectedItem()&&this.selectedItem().checked(!0),e.checked(!e.checked())):(s=!1,""===this.sLastUid&&(this.sLastUid=i),e.checked(!e.checked()),this.eventClickFunction(e,t),this.focusedItem(e))),s&&(this.focusedItem(e),this.selectedItem(e),this.scrollToFocused())}},s.prototype.on=function(e,t){this.oCallbacks[e]=t},e.exports=s}(t,e)},{$:26,Enums:7,Utils:14,_:31,key:27,ko:28}],14:[function(e,t){!function(e,t){"use strict";var s={},i=t("$"),o=t("_"),n=t("ko"),r=t("window"),a=t("$window"),l=t("$html"),c=t("$div"),u=t("$doc"),d=t("NotificationClass"),p=t("Enums"),h=t("Consts"),g=t("Globals");s.trim=i.trim,s.inArray=i.inArray,s.isArray=o.isArray,s.isFunc=o.isFunction,s.isUnd=o.isUndefined,s.isNull=o.isNull,s.emptyFunction=function(){},s.isNormal=function(e){return!s.isUnd(e)&&!s.isNull(e)},s.windowResize=o.debounce(function(e){s.isUnd(e)?a.resize():r.setTimeout(function(){a.resize()},e)},50),s.isPosNumeric=function(e,t){return s.isNormal(e)?(s.isUnd(t)?0:!t)?/^[1-9]+[0-9]*$/.test(e.toString()):/^[0-9]*$/.test(e.toString()):!1},s.pInt=function(e,t){var i=s.isNormal(e)&&""!==e?r.parseInt(e,10):t||0;return r.isNaN(i)?t||0:i},s.pString=function(e){return s.isNormal(e)?""+e:""},s.isNonEmptyArray=function(e){return s.isArray(e)&&0o;o++)i=s[o].split("="),t[r.decodeURIComponent(i[0])]=r.decodeURIComponent(i[1]);return t},s.rsaEncode=function(e,t,i,o){if(r.crypto&&r.crypto.getRandomValues&&r.RSAKey&&t&&i&&o){var n=new r.RSAKey;if(n.setPublic(o,i),e=n.encrypt(s.fakeMd5()+":"+e+":"+s.fakeMd5()),!1!==e)return"rsa:"+t+":"+e}return!1},s.rsaEncode.supported=!!(r.crypto&&r.crypto.getRandomValues&&r.RSAKey),s.exportPath=function(e,t,i){for(var o=null,n=e.split("."),a=i||r;n.length&&(o=n.shift());)n.length||s.isUnd(t)?a=a[o]?a[o]:a[o]={}:a[o]=t},s.pImport=function(e,t,s){e[t]=s},s.pExport=function(e,t,i){return s.isUnd(e[t])?i:e[t]},s.encodeHtml=function(e){return s.isNormal(e)?e.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):""},s.splitPlainText=function(e,t){var i="",o="",n=e,r=0,a=0;for(t=s.isUnd(t)?100:t;n.length>t;)o=n.substring(0,t),r=o.lastIndexOf(" "),a=o.lastIndexOf("\n"),-1!==a&&(r=a),-1===r&&(r=t),i+=o.substring(0,r)+"\n",n=n.substring(r+1);return i+n},s.timeOutAction=function(){var e={};return function(t,i,o){s.isUnd(e[t])&&(e[t]=0),r.clearTimeout(e[t]),e[t]=r.setTimeout(i,o)}}(),s.timeOutActionSecond=function(){var e={};return function(t,s,i){e[t]||(e[t]=r.setTimeout(function(){s(),e[t]=0},i))}}(),s.audio=function(){var e=!1;return function(t,s){if(!1===e)if(g.bIsiOSDevice)e=null;else{var i=!1,o=!1,n=r.Audio?new r.Audio:null;n&&n.canPlayType&&n.play?(i=""!==n.canPlayType('audio/mpeg; codecs="mp3"'),i||(o=""!==n.canPlayType('audio/ogg; codecs="vorbis"')),i||o?(e=n,e.preload="none",e.loop=!1,e.autoplay=!1,e.muted=!1,e.src=i?t:s):e=null):e=null}return e}}(),s.hos=function(e,t){return e&&r.Object&&r.Object.hasOwnProperty?r.Object.hasOwnProperty.call(e,t):!1},s.i18n=function(e,t,i){var o="",n=s.isUnd(g.oI18N[e])?s.isUnd(i)?e:i:g.oI18N[e];if(!s.isUnd(t)&&!s.isNull(t))for(o in t)s.hos(t,o)&&(n=n.replace("%"+o+"%",t[o]));return n},s.i18nToNode=function(e){o.defer(function(){i(".i18n",e).each(function(){var e=i(this),t="";t=e.data("i18n-text"),t?e.text(s.i18n(t)):(t=e.data("i18n-html"),t&&e.html(s.i18n(t)),t=e.data("i18n-placeholder"),t&&e.attr("placeholder",s.i18n(t)),t=e.data("i18n-title"),t&&e.attr("title",s.i18n(t)))})})},s.i18nReload=function(){r.rainloopI18N&&(g.oI18N=r.rainloopI18N||{},s.i18nToNode(u),g.langChangeTrigger(!g.langChangeTrigger())),r.rainloopI18N=null},s.initOnStartOrLangChange=function(e,t,s){e&&e.call(t),s?g.langChangeTrigger.subscribe(function(){e&&e.call(t),s.call(t)}):e&&g.langChangeTrigger.subscribe(e,t)},s.inFocus=function(){return r.document.activeElement?(s.isUnd(r.document.activeElement.__inFocusCache)&&(r.document.activeElement.__inFocusCache=i(r.document.activeElement).is("input,textarea,iframe,.cke_editable")),!!r.document.activeElement.__inFocusCache):!1},s.removeInFocus=function(){if(r.document&&r.document.activeElement&&r.document.activeElement.blur){var e=i(r.document.activeElement);e.is("input,textarea")&&r.document.activeElement.blur()}},s.removeSelection=function(){if(r&&r.getSelection){var e=r.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}else r.document&&r.document.selection&&r.document.selection.empty&&r.document.selection.empty()},s.replySubjectAdd=function(e,t){e=s.trim(e.toUpperCase()),t=s.trim(t.replace(/[\s]+/," "));var i=0,o="",n=!1,r="",a=[],l=[],c="RE"===e,u="FWD"===e,d=!u;if(""!==t){for(n=!1,l=t.split(":"),i=0;i0);return e.replace(/[\s]+/," ")},s._replySubjectAdd_=function(e,t,i){var o=null,n=s.trim(t);return n=null===(o=new r.RegExp("^"+e+"[\\s]?\\:(.*)$","gi").exec(t))||s.isUnd(o[1])?null===(o=new r.RegExp("^("+e+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(t))||s.isUnd(o[1])||s.isUnd(o[2])||s.isUnd(o[3])?e+": "+t:o[1]+(s.pInt(o[2])+1)+o[3]:e+"[2]: "+o[1],n=n.replace(/[\s]+/g," "),n=(s.isUnd(i)?!0:i)?s.fixLongSubject(n):n},s._fixLongSubject_=function(e){var t=0,i=null;e=s.trim(e.replace(/[\s]+/," "));do i=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(e),(!i||s.isUnd(i[0]))&&(i=null),i&&(t=0,t+=s.isUnd(i[2])?1:0+s.pInt(i[2]),t+=s.isUnd(i[4])?1:0+s.pInt(i[4]),e=e.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(t>0?"["+t+"]":"")+":"));while(i);return e=e.replace(/[\s]+/," ")},s.roundNumber=function(e,t){return r.Math.round(e*r.Math.pow(10,t))/r.Math.pow(10,t)},s.friendlySize=function(e){return e=s.pInt(e),e>=1073741824?s.roundNumber(e/1073741824,1)+"GB":e>=1048576?s.roundNumber(e/1048576,1)+"MB":e>=1024?s.roundNumber(e/1024,0)+"KB":e+"B"},s.log=function(e){r.console&&r.console.log&&r.console.log(e)},s.getNotification=function(e,t){return e=s.pInt(e),p.Notification.ClientViewError===e&&t?t:s.isUnd(g.oNotificationI18N[e])?"":g.oNotificationI18N[e]},s.initNotificationLanguage=function(){var e=g.oNotificationI18N||{};e[p.Notification.InvalidToken]=s.i18n("NOTIFICATIONS/INVALID_TOKEN"),e[p.Notification.AuthError]=s.i18n("NOTIFICATIONS/AUTH_ERROR"),e[p.Notification.AccessError]=s.i18n("NOTIFICATIONS/ACCESS_ERROR"),e[p.Notification.ConnectionError]=s.i18n("NOTIFICATIONS/CONNECTION_ERROR"),e[p.Notification.CaptchaError]=s.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),e[p.Notification.SocialFacebookLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),e[p.Notification.SocialTwitterLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),e[p.Notification.SocialGoogleLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),e[p.Notification.DomainNotAllowed]=s.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),e[p.Notification.AccountNotAllowed]=s.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),e[p.Notification.AccountTwoFactorAuthRequired]=s.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),e[p.Notification.AccountTwoFactorAuthError]=s.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),e[p.Notification.CouldNotSaveNewPassword]=s.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),e[p.Notification.CurrentPasswordIncorrect]=s.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),e[p.Notification.NewPasswordShort]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),e[p.Notification.NewPasswordWeak]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),e[p.Notification.NewPasswordForbidden]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),e[p.Notification.ContactsSyncError]=s.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),e[p.Notification.CantGetMessageList]=s.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),e[p.Notification.CantGetMessage]=s.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),e[p.Notification.CantDeleteMessage]=s.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),e[p.Notification.CantMoveMessage]=s.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[p.Notification.CantCopyMessage]=s.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[p.Notification.CantSaveMessage]=s.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),e[p.Notification.CantSendMessage]=s.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),e[p.Notification.InvalidRecipients]=s.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),e[p.Notification.CantCreateFolder]=s.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),e[p.Notification.CantRenameFolder]=s.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),e[p.Notification.CantDeleteFolder]=s.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),e[p.Notification.CantDeleteNonEmptyFolder]=s.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),e[p.Notification.CantSubscribeFolder]=s.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),e[p.Notification.CantUnsubscribeFolder]=s.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),e[p.Notification.CantSaveSettings]=s.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),e[p.Notification.CantSavePluginSettings]=s.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),e[p.Notification.DomainAlreadyExists]=s.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),e[p.Notification.CantInstallPackage]=s.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),e[p.Notification.CantDeletePackage]=s.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),e[p.Notification.InvalidPluginPackage]=s.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),e[p.Notification.UnsupportedPluginPackage]=s.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),e[p.Notification.LicensingServerIsUnavailable]=s.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),e[p.Notification.LicensingExpired]=s.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),e[p.Notification.LicensingBanned]=s.i18n("NOTIFICATIONS/LICENSING_BANNED"),e[p.Notification.DemoSendMessageError]=s.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),e[p.Notification.AccountAlreadyExists]=s.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),e[p.Notification.MailServerError]=s.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),e[p.Notification.InvalidInputArgument]=s.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),e[p.Notification.UnknownNotification]=s.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),e[p.Notification.UnknownError]=s.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},s.getUploadErrorDescByCode=function(e){var t="";switch(s.pInt(e)){case p.UploadErrorCode.FileIsTooBig:t=s.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case p.UploadErrorCode.FilePartiallyUploaded:t=s.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case p.UploadErrorCode.FileNoUploaded:t=s.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case p.UploadErrorCode.MissingTempFolder:t=s.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case p.UploadErrorCode.FileOnSaveingError:t=s.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case p.UploadErrorCode.FileType:t=s.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=s.i18n("UPLOAD/ERROR_UNKNOWN")}return t},s.delegateRun=function(e,t,i,n){e&&e[t]&&(n=s.pInt(n),0>=n?e[t].apply(e,s.isArray(i)?i:[]):o.delay(function(){e[t].apply(e,s.isArray(i)?i:[])},n))},s.killCtrlAandS=function(e){if(e=e||r.event,e&&e.ctrlKey&&!e.shiftKey&&!e.altKey){var t=e.target||e.srcElement,s=e.keyCode||e.which;if(s===p.EventKeyCode.S)return void e.preventDefault();if(t&&t.tagName&&t.tagName.match(/INPUT|TEXTAREA/i))return;s===p.EventKeyCode.A&&(r.getSelection?r.getSelection().removeAllRanges():r.document.selection&&r.document.selection.clear&&r.document.selection.clear(),e.preventDefault())}},s.createCommand=function(e,t,i){var o=t?function(){return o&&o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=n.observable(!0),i=s.isUnd(i)?!0:i,o.canExecute=n.computed(s.isFunc(i)?function(){return o.enabled()&&i.call(e)}:function(){return o.enabled()&&!!i}),o},s.initDataConstructorBySettings=function(e){e.editorDefaultType=n.observable(p.EditorDefaultType.Html),e.showImages=n.observable(!1),e.interfaceAnimation=n.observable(p.InterfaceAnimation.Full),e.contactsAutosave=n.observable(!1),g.sAnimationType=p.InterfaceAnimation.Full,e.capaThemes=n.observable(!1),e.allowLanguagesOnSettings=n.observable(!0),e.allowLanguagesOnLogin=n.observable(!0),e.useLocalProxyForExternalImages=n.observable(!1),e.desktopNotifications=n.observable(!1),e.useThreads=n.observable(!0),e.replySameFolder=n.observable(!0),e.useCheckboxesInList=n.observable(!0),e.layout=n.observable(p.Layout.SidePreview),e.usePreviewPane=n.computed(function(){return p.Layout.NoPreview!==e.layout()}),e.interfaceAnimation.subscribe(function(e){if(g.bMobileDevice||e===p.InterfaceAnimation.None)l.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),g.sAnimationType=p.InterfaceAnimation.None;else switch(e){case p.InterfaceAnimation.Full:l.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),g.sAnimationType=e;break;case p.InterfaceAnimation.Normal:l.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),g.sAnimationType=e}}),e.interfaceAnimation.valueHasMutated(),e.desktopNotificationsPermisions=n.computed(function(){e.desktopNotifications();var t=p.DesktopNotifications.NotSupported;if(d&&d.permission)switch(d.permission.toLowerCase()){case"granted":t=p.DesktopNotifications.Allowed;break;case"denied":t=p.DesktopNotifications.Denied;break;case"default":t=p.DesktopNotifications.NotAllowed}else r.webkitNotifications&&r.webkitNotifications.checkPermission&&(t=r.webkitNotifications.checkPermission());return t}),e.useDesktopNotifications=n.computed({read:function(){return e.desktopNotifications()&&p.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()},write:function(t){if(t){var s=e.desktopNotificationsPermisions();
+p.DesktopNotifications.Allowed===s?e.desktopNotifications(!0):p.DesktopNotifications.NotAllowed===s?d.requestPermission(function(){e.desktopNotifications.valueHasMutated(),p.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()?e.desktopNotifications()?e.desktopNotifications.valueHasMutated():e.desktopNotifications(!0):e.desktopNotifications()?e.desktopNotifications(!1):e.desktopNotifications.valueHasMutated()}):e.desktopNotifications(!1)}else e.desktopNotifications(!1)}}),e.language=n.observable(""),e.languages=n.observableArray([]),e.mainLanguage=n.computed({read:e.language,write:function(t){t!==e.language()?-1=t.diff(i,"hours")?o:t.format("L")===i.format("L")?s.i18n("MESSAGE_LIST/TODAY_AT",{TIME:i.format("LT")}):t.clone().subtract("days",1).format("L")===i.format("L")?s.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:i.format("LT")}):i.format(t.year()===i.year()?"D MMM.":"LL")},e)},s.initBlockquoteSwitcher=function(e){if(e){var t=i("blockquote:not(.rl-bq-switcher)",e).filter(function(){return 0===i(this).parent().closest("blockquote",e).length});t&&0100)&&(e.addClass("rl-bq-switcher hidden-bq"),i('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),s.windowResize()}).after("
").before("
"))})}},s.removeBlockquoteSwitcher=function(e){e&&(i(e).find("blockquote.rl-bq-switcher").each(function(){i(this).removeClass("rl-bq-switcher hidden-bq")}),i(e).find(".rlBlockquoteSwitcher").each(function(){i(this).remove()}))},s.toggleMessageBlockquote=function(e){e&&e.find(".rlBlockquoteSwitcher").click()},s.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=s.trim(e.substring(0,e.length-7))),s.trim(e.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},s.quoteName=function(e){return e.replace(/["]/g,'\\"')},s.microtime=function(){return(new Date).getTime()},s.convertLangName=function(e,t){return s.i18n("LANGS_NAMES"+(!0===t?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,e)},s.fakeMd5=function(e){var t="",i="0123456789abcdefghijklmnopqrstuvwxyz";for(e=s.isUnd(e)?32:s.pInt(e);t.length>>32-t}function s(e,t){var s,i,o,n,r;return o=2147483648&e,n=2147483648&t,s=1073741824&e,i=1073741824&t,r=(1073741823&e)+(1073741823&t),s&i?2147483648^r^o^n:s|i?1073741824&r?3221225472^r^o^n:1073741824^r^o^n:r^o^n}function i(e,t,s){return e&t|~e&s}function o(e,t,s){return e&s|t&~s}function n(e,t,s){return e^t^s}function r(e,t,s){return t^(e|~s)}function a(e,o,n,r,a,l,c){return e=s(e,s(s(i(o,n,r),a),c)),s(t(e,l),o)}function l(e,i,n,r,a,l,c){return e=s(e,s(s(o(i,n,r),a),c)),s(t(e,l),i)}function c(e,i,o,r,a,l,c){return e=s(e,s(s(n(i,o,r),a),c)),s(t(e,l),i)}function u(e,i,o,n,a,l,c){return e=s(e,s(s(r(i,o,n),a),c)),s(t(e,l),i)}function d(e){for(var t,s=e.length,i=s+8,o=(i-i%64)/64,n=16*(o+1),r=Array(n-1),a=0,l=0;s>l;)t=(l-l%4)/4,a=l%4*8,r[t]=r[t]|e.charCodeAt(l)<>>29,r}function p(e){var t,s,i="",o="";for(s=0;3>=s;s++)t=e>>>8*s&255,o="0"+t.toString(16),i+=o.substr(o.length-2,2);return i}function h(e){e=e.replace(/rn/g,"n");for(var t="",s=0;si?t+=String.fromCharCode(i):i>127&&2048>i?(t+=String.fromCharCode(i>>6|192),t+=String.fromCharCode(63&i|128)):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(63&i|128))}return t}var g,m,f,b,S,y,v,w,C,A=Array(),T=7,F=12,E=17,M=22,N=5,R=9,L=14,P=20,I=4,k=11,D=16,_=23,U=6,O=10,x=15,j=21;for(e=h(e),A=d(e),y=1732584193,v=4023233417,w=2562383102,C=271733878,g=0;g /g,">").replace(/")},s.draggeblePlace=function(){return i(' ').appendTo("#rl-hidden")},s.defautOptionsAfterRender=function(e,t){t&&!s.isUnd(t.disabled)&&e&&i(e).toggleClass("disabled",t.disabled).prop("disabled",t.disabled)},s.windowPopupKnockout=function(e,t,o,a){var l=null,c=r.open(""),u="__OpenerApplyBindingsUid"+s.fakeMd5()+"__",d=i("#"+t);r[u]=function(){if(c&&c.document.body&&d&&d[0]){var t=i(c.document.body);i("#rl-content",t).html(d.html()),i("html",c.document).addClass("external "+i("html").attr("class")),s.i18nToNode(t),e&&i("#rl-content",t)[0]&&n.applyBindings(e,i("#rl-content",t)[0]),r[u]=null,a(c)}},c.document.open(),c.document.write(''+s.encodeHtml(o)+' '),c.document.close(),l=c.document.createElement("script"),l.type="text/javascript",l.innerHTML="if(window&&window.opener&&window.opener['"+u+"']){window.opener['"+u+"']();window.opener['"+u+"']=null}",c.document.getElementsByTagName("head")[0].appendChild(l)},s.settingsSaveHelperFunction=function(e,t,i,n){return i=i||null,n=s.isUnd(n)?1e3:s.pInt(n),function(s,r,a,l,c){t.call(i,r&&r.Result?p.SaveSettingsStep.TrueResult:p.SaveSettingsStep.FalseResult),e&&e.call(i,s,r,a,l,c),o.delay(function(){t.call(i,p.SaveSettingsStep.Idle)},n)}},s.settingsSaveHelperSimpleFunction=function(e,t){return s.settingsSaveHelperFunction(null,e,t,1e3)},s.htmlToPlain=function(e){var t=0,s=0,o=0,n=0,r=0,a="",l=function(e){for(var t=100,s="",i="",o=e,n=0,r=0;o.length>t;)i=o.substring(0,t),n=i.lastIndexOf(" "),r=i.lastIndexOf("\n"),-1!==r&&(n=r),-1===n&&(n=t),s+=i.substring(0,n)+"\n",o=o.substring(n+1);return s+o},u=function(e){return e=l(i.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2]*>([\s\S\r\n]*)<\/div>/gim,d),e="\n"+i.trim(e)+"\n"),e}return""},p=function(){return arguments&&1 "):""},h=function(){return arguments&&1 /g,">"):""},g=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,p).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,h).replace(/
]*>/gim,"\n").replace(/<\/h[\d]>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>([\s\S\r\n]*)<\/div>/gim,d).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S\r\n]*?)<\/a>/gim,g).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),a=c.html(a).text(),a=a.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),t=0,r=100;r>0&&(r--,s=a.indexOf("__bq__start__",t),s>-1);)o=a.indexOf("__bq__start__",s+5),n=a.indexOf("__bq__end__",s+5),(-1===o||o>n)&&n>s?(a=a.substring(0,s)+u(a.substring(s+13,n))+a.substring(n+11),t=0):t=o>-1&&n>o?o-1:0;return a=a.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},s.plainToHtml=function(e,t){e=e.toString().replace(/\r/g,"");var i=!1,o=!0,n=!0,r=[],a="",l=0,c=e.split("\n");do{for(o=!1,r=[],l=0;l"===a.substr(0,1),n&&!i?(o=!0,i=!0,r.push("~~~blockquote~~~"),r.push(a.substr(1))):!n&&i?(i=!1,r.push("~~~/blockquote~~~"),r.push(a)):r.push(n&&i?a.substr(1):a);i&&(i=!1,r.push("~~~/blockquote~~~")),c=r}while(o);return e=c.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/[\s]*~~~\/blockquote~~~/g,"
").replace(/[\-_~]{10,}/g,"
").replace(/\n/g,"
"),t?s.linkify(e):e},r.rainloop_Utils_htmlToPlain=s.htmlToPlain,r.rainloop_Utils_plainToHtml=s.plainToHtml,s.linkify=function(e){return i.fn&&i.fn.linkify&&(e=c.html(e.replace(/&/gi,"amp_amp_12345_amp_amp")).linkify().find(".linkified").removeClass("linkified").end().html().replace(/amp_amp_12345_amp_amp/g,"&")),e},s.resizeAndCrop=function(e,t,s){var i=new r.Image;i.onload=function(){var e=[0,0],i=r.document.createElement("canvas"),o=i.getContext("2d");i.width=t,i.height=t,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],o.fillStyle="#fff",o.fillRect(0,0,t,t),o.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,t,t),s(i.toDataURL("image/jpeg"))},i.src=e},s.folderListOptionsBuilder=function(e,t,i,o,n,a,l,c,u,d){var h=null,g=!1,m=0,f=0,b="Â Â Â ",S=[];for(u=s.isNormal(u)?u:0m;m++)S.push({id:o[m][0],name:o[m][1],system:!1,seporator:!1,disabled:!1});for(g=!0,m=0,f=e.length;f>m;m++)h=e[m],(l?l.call(null,h):!0)&&(g&&0m;m++)h=t[m],(h.subScribed()||!h.existen)&&(l?l.call(null,h):!0)&&(p.FolderType.User===h.type()||!u||01||c>0&&l>c){for(l>c?(u(c),i=c,o=c):((3>=l||l>=c-2)&&(n+=2),u(l),i=l,o=l);n>0;)if(i-=1,o+=1,i>0&&(u(i,!1),n--),c>=o)u(o,!0),n--;else if(0>=i)break;3===i?u(2,!1):i>3&&u(r.Math.round((i-1)/2),!1,"..."),c-2===o?u(c-1,!0):c-2>o&&u(r.Math.round((c+o)/2),!0,"..."),i>1&&u(1,!1),c>o&&u(c,!0)}return a}},s.selectElement=function(e){if(r.getSelection){var t=r.getSelection();t.removeAllRanges();var s=r.document.createRange();s.selectNodeContents(e),t.addRange(s)}else if(r.document.selection){var i=r.document.body.createTextRange();i.moveToElementText(e),i.select()}},s.detectDropdownVisibility=o.debounce(function(){g.dropdownVisibility(!!o.find(g.aBootstrapDropdowns,function(e){return e.hasClass("open")}))},50),s.triggerAutocompleteInputChange=function(e){var t=function(){i(".checkAutocomplete").trigger("change")};e?o.delay(t,100):t()},e.exports=s}(t,e)},{$:26,$div:15,$doc:16,$html:17,$window:18,Consts:6,Enums:7,Globals:9,NotificationClass:22,_:31,ko:28,window:32}],15:[function(e,t){t.exports=e("$")("")},{$:26}],16:[function(e,t){t.exports=e("$")(window.document)},{$:26}],17:[function(e,t){t.exports=e("$")("html")},{$:26}],18:[function(e,t){t.exports=e("$")(window)},{$:26}],19:[function(e,t){t.exports=e("window").rainloopAppData||{}},{window:32}],20:[function(e,t){t.exports=JSON},{}],21:[function(e,t){t.exports=Jua},{}],22:[function(e,t){var s=e("window");t.exports=s.Notification&&s.Notification.requestPermission?s.Notification:null},{window:32}],23:[function(e,t){t.exports=crossroads},{}],24:[function(e,t){t.exports=hasher},{}],25:[function(e,t){t.exports=ifvisible},{}],26:[function(e,t){t.exports=$},{}],27:[function(e,t){t.exports=key},{}],28:[function(e,t){!function(t,s){"use strict";var i=e("window"),o=e("_"),n=e("$"),r=e("$window"),a=e("$doc");s.bindingHandlers.tooltip={init:function(t,i){var o=e("Globals"),r=e("Utils");if(!o.bMobileDevice){var a=n(t),l=a.data("tooltip-class")||"",c=a.data("tooltip-placement")||"top";a.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:c,trigger:"hover",title:function(){return a.is(".disabled")||o.dropdownVisibility()?"":''+r.i18n(s.utils.unwrapObservable(i()))+""}}).click(function(){a.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){a.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(t,s){var i=e("Globals"),o=n(t),r=o.data("tooltip-class")||"",a=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:a,title:function(){return o.is(".disabled")||i.dropdownVisibility()?"":''+s()()+""}}).click(function(){o.tooltip("hide")}),i.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}},s.bindingHandlers.tooltip3={init:function(t){var s=n(t),i=e("Globals");s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),a.click(function(){s.tooltip("hide")}),i.tooltipTrigger.subscribe(function(){s.tooltip("hide")})},update:function(e,t){var i=s.utils.unwrapObservable(t());""===i?n(e).data("tooltip3-data","").tooltip("hide"):n(e).data("tooltip3-data",i).tooltip("show")}},s.bindingHandlers.registrateBootstrapDropdown={init:function(t){var s=e("Globals");s.aBootstrapDropdowns.push(n(t))}},s.bindingHandlers.openDropdownTrigger={update:function(t,i){if(s.utils.unwrapObservable(i())){var o=n(t),r=e("Utils");o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),r.detectDropdownVisibility()),i()(!1)}}},s.bindingHandlers.dropdownCloser={init:function(e){n(e).closest(".dropdown").on("click",".e-item",function(){n(e).dropdown("toggle")})}},s.bindingHandlers.popover={init:function(e,t){n(e).popover(s.utils.unwrapObservable(t()))}},s.bindingHandlers.csstext={init:function(t,i){var o=e("Utils");t&&t.styleSheet&&!o.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=s.utils.unwrapObservable(i()):n(t).text(s.utils.unwrapObservable(i()))},update:function(t,i){var o=e("Utils");t&&t.styleSheet&&!o.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=s.utils.unwrapObservable(i()):n(t).text(s.utils.unwrapObservable(i()))}},s.bindingHandlers.resizecrop={init:function(e){n(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,t){t()(),n(e).resizecrop({width:"100",height:"100"})}},s.bindingHandlers.onEnter={init:function(e,t,s,o){n(e).on("keypress",function(s){s&&13===i.parseInt(s.keyCode,10)&&(n(e).trigger("change"),t().call(o))})}},s.bindingHandlers.onEsc={init:function(e,t,s,o){n(e).on("keypress",function(s){s&&27===i.parseInt(s.keyCode,10)&&(n(e).trigger("change"),t().call(o))})}},s.bindingHandlers.clickOnTrue={update:function(e,t){s.utils.unwrapObservable(t())&&n(e).click()}},s.bindingHandlers.modal={init:function(t,i){var o=e("Globals"),r=e("Utils");n(t).toggleClass("fade",!o.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(i())}).on("shown",function(){r.windowResize()}).find(".close").click(function(){i()(!1)})},update:function(e,t){n(e).modal(s.utils.unwrapObservable(t())?"show":"hide")}},s.bindingHandlers.i18nInit={init:function(t){var s=e("Utils");s.i18nToNode(t)}},s.bindingHandlers.i18nUpdate={update:function(t,i){var o=e("Utils");s.utils.unwrapObservable(i()),o.i18nToNode(t)}},s.bindingHandlers.link={update:function(e,t){n(e).attr("href",s.utils.unwrapObservable(t()))}},s.bindingHandlers.title={update:function(e,t){n(e).attr("title",s.utils.unwrapObservable(t()))}},s.bindingHandlers.textF={init:function(e,t){n(e).text(s.utils.unwrapObservable(t()))}},s.bindingHandlers.initDom={init:function(e,t){t()(e)}},s.bindingHandlers.initResizeTrigger={init:function(e,t){var i=s.utils.unwrapObservable(t());n(e).css({height:i[1],"min-height":i[1]})},update:function(t,i){var o=e("Utils"),a=s.utils.unwrapObservable(i()),l=o.pInt(a[1]),c=0,u=n(t).offset().top;u>0&&(u+=o.pInt(a[2]),c=r.height()-u,c>l&&(l=c),n(t).css({height:l,"min-height":l}))}},s.bindingHandlers.appendDom={update:function(e,t){n(e).hide().empty().append(s.utils.unwrapObservable(t())).show()}},s.bindingHandlers.draggable={init:function(t,o,r){var a=e("Globals"),l=e("Utils");if(!a.bMobileDevice){var c=100,u=3,d=r(),p=d&&d.droppableSelector?d.droppableSelector:"",h={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};p&&(h.drag=function(e){n(p).each(function(){var t=null,s=null,o=n(this),r=o.offset(),a=r.top+o.height();i.clearInterval(o.data("timerScroll")),o.data("timerScroll",!1),e.pageX>=r.left&&e.pageX<=r.left+o.width()&&(e.pageY>=a-c&&e.pageY<=a&&(t=function(){o.scrollTop(o.scrollTop()+u),l.windowResize()},o.data("timerScroll",i.setInterval(t,10)),t()),e.pageY>=r.top&&e.pageY<=r.top+c&&(s=function(){o.scrollTop(o.scrollTop()-u),l.windowResize()},o.data("timerScroll",i.setInterval(s,10)),s()))})},h.stop=function(){n(p).each(function(){i.clearInterval(n(this).data("timerScroll")),n(this).data("timerScroll",!1)})}),h.helper=function(e){return o()(e&&e.target?s.dataFor(e.target):null)},n(t).draggable(h).on("mousedown",function(){l.removeInFocus()})}}},s.bindingHandlers.droppable={init:function(t,s,i){var o=e("Globals");if(!o.bMobileDevice){var r=s(),a=i(),l=a&&a.droppableOver?a.droppableOver:null,c=a&&a.droppableOut?a.droppableOut:null,u={tolerance:"pointer",hoverClass:"droppableHover"};r&&(u.drop=function(e,t){r(e,t)},l&&(u.over=function(e,t){l(e,t)}),c&&(u.out=function(e,t){c(e,t)}),n(t).droppable(u))}}},s.bindingHandlers.nano={init:function(t){var s=e("Globals");s.bDisableNanoScroll||n(t).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},s.bindingHandlers.saveTrigger={init:function(e){var t=n(e);t.data("save-trigger-type",t.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===t.data("save-trigger-type")?t.append(' ').addClass("settings-saved-trigger"):t.addClass("settings-saved-trigger-input")},update:function(e,t){var i=s.utils.unwrapObservable(t()),o=n(e);if("custom"===o.data("save-trigger-type"))switch(i.toString()){case"1":o.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":o.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":o.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:o.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(i.toString()){case"1":o.addClass("success").removeClass("error");break;case"0":o.addClass("error").removeClass("success");break;case"-2":break;default:o.removeClass("error success")}}},s.bindingHandlers.emailsTags={init:function(t,s,i){var r=e("Utils"),a=e("../Models/EmailModel.js"),l=n(t),c=s(),u=i(),d=u.autoCompleteSource||null,p=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:p,inputDelimiters:[",",";"],autoCompleteSource:d,parseHook:function(e){return o.map(e,function(e){var t=r.trim(e),s=null;return""!==t?(s=new a,s.mailsoParse(t),s.clearDuplicateName(),[s.toLine(!1),s]):[t,null]})},change:o.bind(function(e){l.data("EmailsTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,i){var o=n(e),r=i(),a=r.emailsTagsFilter||null,l=s.utils.unwrapObservable(t());o.data("EmailsTagsValue")!==l&&(o.val(l),o.data("EmailsTagsValue",l),o.inputosaurus("refresh")),a&&s.utils.unwrapObservable(a)&&o.inputosaurus("focus")}},s.bindingHandlers.contactTags={init:function(t,s,i){var r=e("Utils"),a=e("../Models/ContactTagModel.js"),l=n(t),c=s(),u=i(),d=u.autoCompleteSource||null,p=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:p,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:d,parseHook:function(e){return o.map(e,function(e){var t=r.trim(e),s=null;return""!==t?(s=new a,s.name(t),[s.toLine(!1),s]):[t,null]})},change:o.bind(function(e){l.data("ContactTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,i){var o=n(e),r=i(),a=r.contactTagsFilter||null,l=s.utils.unwrapObservable(t());o.data("ContactTagsValue")!==l&&(o.val(l),o.data("ContactTagsValue",l),o.inputosaurus("refresh")),a&&s.utils.unwrapObservable(a)&&o.inputosaurus("focus")}},s.bindingHandlers.command={init:function(e,t,i,o){var r=n(e),a=t();if(!a||!a.enabled||!a.canExecute)throw new Error("You are not using command function");r.addClass("command"),s.bindingHandlers[r.is("form")?"submit":"click"].init.apply(o,arguments)},update:function(e,t){var s=!0,i=n(e),o=t();s=o.enabled(),i.toggleClass("command-not-enabled",!s),s&&(s=o.canExecute(),i.toggleClass("command-can-not-be-execute",!s)),i.toggleClass("command-disabled disable disabled",!s).toggleClass("no-disabled",!!s),(i.is("input")||i.is("button"))&&i.prop("disabled",!s)}},s.extenders.trimmer=function(t){var i=e("Utils"),o=s.computed({read:t,write:function(e){t(i.trim(e.toString()))},owner:this});return o(t()),o},s.extenders.posInterer=function(t,i){var o=e("Utils"),n=s.computed({read:t,write:function(e){var s=o.pInt(e.toString(),i);0>=s&&(s=i),s===t()&&""+s!=""+e&&t(s+1),t(s)}});return n(t()),n},s.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},s.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},s.extenders.falseTimeout=function(t,s){var o=e("Utils");return t.iTimeout=0,t.subscribe(function(e){e&&(i.clearTimeout(t.iTimeout),t.iTimeout=i.setTimeout(function(){t(!1),t.iTimeout=0},o.pInt(s)))}),t},s.observable.fn.validateNone=function(){return this.hasError=s.observable(!1),this},s.observable.fn.validateEmail=function(){var t=e("Utils");return this.hasError=s.observable(!1),this.subscribe(function(e){e=t.trim(e),this.hasError(""!==e&&!/^[^@\s]+@[^@\s]+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateSimpleEmail=function(){var t=e("Utils");return this.hasError=s.observable(!1),this.subscribe(function(e){e=t.trim(e),this.hasError(""!==e&&!/^.+@.+$/.test(e))},this),this.valueHasMutated(),this},s.observable.fn.validateFunc=function(t){var i=e("Utils");return this.hasFuncError=s.observable(!1),i.isFunc(t)&&(this.subscribe(function(e){this.hasFuncError(!t(e))},this),this.valueHasMutated()),this},t.exports=s}(t,ko)},{$:26,$doc:16,$window:18,"../Models/ContactTagModel.js":42,"../Models/EmailModel.js":43,Globals:9,Utils:14,_:31,window:32}],29:[function(e,t){t.exports=moment},{}],30:[function(e,t){t.exports=ssm},{}],31:[function(e,t){t.exports=_},{}],32:[function(e,t){t.exports=window},{}],33:[function(e,t){!function(e,t){"use strict";function s(){this.sDefaultScreenName="",this.oScreens={},this.oCurrentScreen=null}var i=t("$"),o=t("_"),n=t("ko"),r=t("hasher"),a=t("crossroads"),l=t("$html"),c=t("Globals"),u=t("Plugins"),d=t("Utils"),p=t("KnoinAbstractViewModel");s.prototype.sDefaultScreenName="",s.prototype.oScreens={},s.prototype.oCurrentScreen=null,s.prototype.hideLoading=function(){i("#rl-loading").hide()},s.prototype.constructorEnd=function(e){d.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},s.prototype.extendAsViewModel=function(e,t,s){t&&(s||(s=p),t.__name=e,u.regViewModelHook(e,t),o.extend(t.prototype,s.prototype))},s.prototype.addSettingsViewModel=function(e,t,s,i,o){e.__rlSettingsData={Label:s,Template:t,Route:i,IsDefault:!!o},c.aViewModels.settings.push(e)},s.prototype.removeSettingsViewModel=function(e){c.aViewModels["settings-removed"].push(e)},s.prototype.disableSettingsViewModel=function(e){c.aViewModels["settings-disabled"].push(e)},s.prototype.routeOff=function(){r.changed.active=!1},s.prototype.routeOn=function(){r.changed.active=!0},s.prototype.screen=function(e){return""===e||d.isUnd(this.oScreens[e])?null:this.oScreens[e]},s.prototype.buildViewModel=function(e,t){if(e&&!e.__builded){var s=this,r=new e(t),a=r.viewModelPosition(),l=i("#rl-content #rl-"+a.toLowerCase()),p=null;e.__builded=!0,e.__vm=r,r.viewModelName=e.__name,l&&1===l.length?(p=i("").addClass("rl-view-model").addClass("RL-"+r.viewModelTemplate()).hide(),p.appendTo(l),r.viewModelDom=p,e.__dom=p,"Popups"===a&&(r.cancelCommand=r.closeCommand=d.createCommand(r,function(){s.hideScreenPopup(e)}),r.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),c.popupVisibilityNames.push(this.viewModelName),r.viewModelDom.css("z-index",3e3+c.popupVisibilityNames().length+10),d.delegateRun(this,"onFocus",[],500)):(d.delegateRun(this,"onHide"),this.restoreKeyScope(),c.popupVisibilityNames.remove(this.viewModelName),r.viewModelDom.css("z-index",2e3),c.tooltipTrigger(!c.tooltipTrigger()),o.delay(function(){t.viewModelDom.hide()},300))},r)),u.runHook("view-model-pre-build",[e.__name,r,p]),n.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:r.viewModelTemplate()}}},r),d.delegateRun(r,"onBuild",[p]),r&&"Popups"===a&&r.registerPopupKeyDown(),u.runHook("view-model-post-build",[e.__name,r,p])):d.log("Cannot find view model position: "+a)}return e?e.__vm:null},s.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&(e.__vm.modalVisibility(!1),u.runHook("view-model-on-hide",[e.__name,e.__vm]))},s.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),d.delegateRun(e.__vm,"onShow",t||[]),u.runHook("view-model-on-show",[e.__name,e.__vm,t||[]])))},s.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},s.prototype.screenOnRoute=function(e,t){var s=this,i=null,n=null;""===d.pString(e)&&(e=this.sDefaultScreenName),""!==e&&(i=this.screen(e),i||(i=this.screen(this.sDefaultScreenName),i&&(t=e+"/"+t,e=this.sDefaultScreenName)),i&&i.__started&&(i.__builded||(i.__builded=!0,d.isNonEmptyArray(i.viewModels())&&o.each(i.viewModels(),function(e){this.buildViewModel(e,i)},this),d.delegateRun(i,"onBuild")),o.defer(function(){s.oCurrentScreen&&(d.delegateRun(s.oCurrentScreen,"onHide"),d.isNonEmptyArray(s.oCurrentScreen.viewModels())&&o.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),d.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=i,s.oCurrentScreen&&(d.delegateRun(s.oCurrentScreen,"onShow"),u.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),d.isNonEmptyArray(s.oCurrentScreen.viewModels())&&o.each(s.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),d.delegateRun(e.__vm,"onShow"),d.delegateRun(e.__vm,"onFocus",[],200),u.runHook("view-model-on-show",[e.__name,e.__vm]))},s)),n=i.__cross(),n&&n.parse(t)})))},s.prototype.startScreens=function(e){i("#rl-content").css({visibility:"hidden"}),o.each(e,function(e){var t=new e,s=t?t.screenName():"";t&&""!==s&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=s),this.oScreens[s]=t)},this),o.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),u.runHook("screen-pre-start",[e.screenName(),e]),d.delegateRun(e,"onStart"),u.runHook("screen-post-start",[e.screenName(),e]))
+},this);var t=a.create();t.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,o.bind(this.screenOnRoute,this)),r.initialized.add(t.parse,t),r.changed.add(t.parse,t),r.init(),i("#rl-content").css({visibility:"visible"}),o.delay(function(){l.removeClass("rl-started-trigger").addClass("rl-started")},50)},s.prototype.setHash=function(e,t,s){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,s=d.isUnd(s)?!1:!!s,(d.isUnd(t)?1:!t)?(r.changed.active=!0,r[s?"replaceHash":"setHash"](e),r.setHash(e)):(r.changed.active=!1,r[s?"replaceHash":"setHash"](e),r.changed.active=!0)},e.exports=new s}(t,e)},{$:26,$html:17,Globals:9,KnoinAbstractViewModel:36,Plugins:12,Utils:14,_:31,crossroads:23,hasher:24,ko:28}],34:[function(e,t){!function(e){"use strict";function t(){}t.prototype.bootstart=function(){},e.exports=t}(t,e)},{}],35:[function(e,t){!function(e,t){"use strict";function s(e,t){this.sScreenName=e,this.aViewModels=o.isArray(t)?t:[]}var i=t("crossroads"),o=t("Utils");s.prototype.oCross=null,s.prototype.sScreenName="",s.prototype.aViewModels=[],s.prototype.viewModels=function(){return this.aViewModels},s.prototype.screenName=function(){return this.sScreenName},s.prototype.routes=function(){return null},s.prototype.__cross=function(){return this.oCross},s.prototype.__start=function(){var e=this.routes(),t=null,s=null;o.isNonEmptyArray(e)&&(s=_.bind(this.onRoute||o.emptyFunction,this),t=i.create(),_.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},e.exports=s}(t,e)},{Utils:14,crossroads:23}],36:[function(e,t){!function(e,t){"use strict";function s(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=a.pString(e),this.sTemplate=a.pString(t),this.sDefaultKeyScope=n.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=i.observable(!1),this.modalVisibility=i.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}var i=t("ko"),o=t("$window"),n=t("Enums"),r=t("Globals"),a=t("Utils");s.prototype.sPosition="",s.prototype.sTemplate="",s.prototype.viewModelName="",s.prototype.viewModelDom=null,s.prototype.viewModelTemplate=function(){return this.sTemplate},s.prototype.viewModelPosition=function(){return this.sPosition},s.prototype.cancelCommand=function(){},s.prototype.closeCommand=function(){},s.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=r.keyScope(),r.keyScope(this.sDefaultKeyScope)},s.prototype.restoreKeyScope=function(){r.keyScope(this.sCurrentKeyScope)},s.prototype.registerPopupKeyDown=function(){var e=this;o.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&n.EventKeyCode.Esc===t.keyCode)return a.delegateRun(e,"cancelCommand"),!1;if(n.EventKeyCode.Backspace===t.keyCode&&!a.inFocus())return!1}return!0})},e.exports=s}(t,e)},{$window:18,Enums:7,Globals:9,Utils:14,ko:28}],37:[function(e,t){!function(e,t){"use strict";function s(e,t){this.email=e,this.deleteAccess=i.observable(!1),this.canBeDalete=i.observable(t)}var i=t("ko");s.prototype.email="",s.prototype.changeAccountLink=function(){return t("LinkBuilder").change(this.email)},e.exports=s}(t,e)},{LinkBuilder:10,ko:28}],38:[function(e,t){!function(e,t){"use strict";function s(){this.mimeType="",this.fileName="",this.estimatedSize=0,this.friendlySize="",this.isInline=!1,this.isLinked=!1,this.cid="",this.cidWithOutTags="",this.contentLocation="",this.download="",this.folder="",this.uid="",this.mimeIndex=""}var i=t("window"),o=t("Globals"),n=t("Utils"),r=t("LinkBuilder");s.newInstanceFromJson=function(e){var t=new s;return t.initByJson(e)?t:null},s.prototype.mimeType="",s.prototype.fileName="",s.prototype.estimatedSize=0,s.prototype.friendlySize="",s.prototype.isInline=!1,s.prototype.isLinked=!1,s.prototype.cid="",s.prototype.cidWithOutTags="",s.prototype.contentLocation="",s.prototype.download="",s.prototype.folder="",s.prototype.uid="",s.prototype.mimeIndex="",s.prototype.initByJson=function(e){var t=!1;return e&&"Object/Attachment"===e["@Object"]&&(this.mimeType=(e.MimeType||"").toLowerCase(),this.fileName=e.FileName,this.estimatedSize=n.pInt(e.EstimatedSize),this.isInline=!!e.IsInline,this.isLinked=!!e.IsLinked,this.cid=e.CID,this.contentLocation=e.ContentLocation,this.download=e.Download,this.folder=e.Folder,this.uid=e.Uid,this.mimeIndex=e.MimeIndex,this.friendlySize=n.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),t=!0),t},s.prototype.isImage=function(){return-1,]+)>?,? ?/g,s=t.exec(e);s?(this.name=s[1]||"",this.email=s[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},s.prototype.initByJson=function(e){var t=!1;return e&&"Object/Email"===e["@Object"]&&(this.name=o.trim(e.Name),this.email=o.trim(e.Email),t=""!==this.email,this.clearDuplicateName()),t},s.prototype.toLine=function(e,t,s){var i="";return""!==this.email&&(t=o.isUnd(t)?!1:!!t,s=o.isUnd(s)?!1:!!s,e&&""!==this.name?i=t?'")+'" target="_blank" tabindex="-1">'+o.encodeHtml(this.name)+"":s?o.encodeHtml(this.name):this.name:(i=this.email,""!==this.name?t?i=o.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+o.encodeHtml(i)+""+o.encodeHtml(">"):(i='"'+this.name+'" <'+i+">",s&&(i=o.encodeHtml(i))):t&&(i=''+o.encodeHtml(this.email)+""))),i},s.prototype.mailsoParse=function(e){if(e=o.trim(e),""===e)return!1;for(var t=function(e,t,s){e+="";var i=e.length;return 0>t&&(t+=i),i="undefined"==typeof s?i:0>s?s+i:s+t,t>=e.length||0>t||t>i?!1:e.slice(t,i)},s=function(e,t,s,i){return 0>s&&(s+=e.length),i=void 0!==i?i:e.length,0>i&&(i=i+e.length-s),e.slice(0,s)+t.substr(0,i)+t.slice(i)+e.slice(s+i)},i="",n="",r="",a=!1,l=!1,c=!1,u=null,d=0,p=0,h=0;h0&&0===i.length&&(i=t(e,0,h)),l=!0,d=h);break;case">":l&&(p=h,n=t(e,d+1,p-d-1),e=s(e,"",d,p-d+1),p=0,h=0,d=0,l=!1);break;case"(":a||l||c||(c=!0,d=h);break;case")":c&&(p=h,r=t(e,d+1,p-d-1),e=s(e,"",d,p-d+1),p=0,h=0,d=0,c=!1);break;case"\\":h++}h++}return 0===n.length&&(u=e.match(/[^@\s]+@\S+/i),u&&u[0]?n=u[0]:i=e),n.length>0&&0===i.length&&0===r.length&&(i=e.replace(n,"")),n=o.trim(n).replace(/^[<]+/,"").replace(/[>]+$/,""),i=o.trim(i).replace(/^["']+/,"").replace(/["']+$/,""),r=o.trim(r).replace(/^[(]+/,"").replace(/[)]+$/,""),i=i.replace(/\\\\(.)/,"$1"),r=r.replace(/\\\\(.)/,"$1"),this.name=i,this.email=n,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 00){if(r.FolderType.Draft===s)return""+e;if(t>0&&r.FolderType.Trash!==s&&r.FolderType.Archive!==s&&r.FolderType.SentItems!==s)return""+t}return""},this),this.canBeDeleted=o.computed(function(){var e=this.isSystemFolder();return!e&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=o.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){l.timeOutAction("folder-list-folder-visibility-change",function(){n.trigger("folder-list-folder-visibility-change")},100)}),this.localName=o.computed(function(){a.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case r.FolderType.Inbox:t=l.i18n("FOLDER_LIST/INBOX_NAME");break;case r.FolderType.SentItems:t=l.i18n("FOLDER_LIST/SENT_NAME");break;case r.FolderType.Draft:t=l.i18n("FOLDER_LIST/DRAFTS_NAME");break;case r.FolderType.Spam:t=l.i18n("FOLDER_LIST/SPAM_NAME");break;case r.FolderType.Trash:t=l.i18n("FOLDER_LIST/TRASH_NAME");break;case r.FolderType.Archive:t=l.i18n("FOLDER_LIST/ARCHIVE_NAME")}return t},this),this.manageFolderSystemName=o.computed(function(){a.langChangeTrigger();var e="",t=this.type(),s=this.name();if(this.isSystemFolder())switch(t){case r.FolderType.Inbox:e="("+l.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case r.FolderType.SentItems:e="("+l.i18n("FOLDER_LIST/SENT_NAME")+")";break;case r.FolderType.Draft:e="("+l.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case r.FolderType.Spam:e="("+l.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case r.FolderType.Trash:e="("+l.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case r.FolderType.Archive:e="("+l.i18n("FOLDER_LIST/ARCHIVE_NAME")+")"}return(""!==e&&"("+s+")"===e||"(inbox)"===e.toLowerCase())&&(e=""),e},this),this.collapsed=o.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(e){this.collapsedPrivate(e)},owner:this}),this.hasUnreadMessages=o.computed(function(){return 0"},s.prototype.formattedNameForCompose=function(){var e=this.name();return""===e?this.email():e+" ("+this.email()+")"},s.prototype.formattedNameForEmail=function(){var e=this.name();return""===e?this.email():'"'+o.quoteName(e)+'" <'+this.email()+">"},e.exports=s}(t,e)},{Utils:14,ko:28}],48:[function(e,t){!function(e,t){"use strict";function s(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject=r.observable(""),this.subjectPrefix=r.observable(""),this.subjectSuffix=r.observable(""),this.size=r.observable(0),this.dateTimeStampInUTC=r.observable(0),this.priority=r.observable(u.MessagePriority.Normal),this.proxy=!1,this.fromEmailString=r.observable(""),this.fromClearEmailString=r.observable(""),this.toEmailsString=r.observable(""),this.toClearEmailsString=r.observable(""),this.senderEmailsString=r.observable(""),this.senderClearEmailsString=r.observable(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation=r.observable(!1),this.deleted=r.observable(!1),this.unseen=r.observable(!1),this.flagged=r.observable(!1),this.answered=r.observable(!1),this.forwarded=r.observable(!1),this.isReadReceipt=r.observable(!1),this.focused=r.observable(!1),this.selected=r.observable(!1),this.checked=r.observable(!1),this.hasAttachments=r.observable(!1),this.attachmentsMainType=r.observable(""),this.moment=r.observable(a(a.unix(0))),this.attachmentIconClass=r.computed(function(){var e="";if(this.hasAttachments())switch(e="icon-attachment",this.attachmentsMainType()){case"image":e="icon-image";break;case"archive":e="icon-file-zip";break;case"doc":e="icon-file-text"}return e},this),this.fullFormatDateValue=r.computed(function(){return s.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=d.createMomentDate(this),this.momentShortDate=d.createMomentShortDate(this),this.dateTimeStampInUTC.subscribe(function(e){var t=a().unix();this.moment(a.unix(e>t?t:e))},this),this.body=null,this.plainRaw="",this.isHtml=r.observable(!1),this.hasImages=r.observable(!1),this.attachments=r.observableArray([]),this.isPgpSigned=r.observable(!1),this.isPgpEncrypted=r.observable(!1),this.pgpSignedVerifyStatus=r.observable(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser=r.observable(""),this.priority=r.observable(u.MessagePriority.Normal),this.readReceipt=r.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=r.observable(0),this.threads=r.observableArray([]),this.threadsLen=r.observable(0),this.hasUnseenSubMessage=r.observable(!1),this.hasFlaggedSubMessage=r.observable(!1),this.lastInCollapsedThread=r.observable(!1),this.lastInCollapsedThreadLoading=r.observable(!1),this.threadsLenResult=r.computed(function(){var e=this.threadsLen();return 0===this.parentUid()&&e>0?e+1:""},this)}var i=t("window"),o=t("$"),n=t("_"),r=t("ko"),a=t("moment"),l=t("$window"),c=t("$div"),u=t("Enums"),d=t("Utils"),p=t("LinkBuilder"),h=t("./EmailModel.js"),g=t("./AttachmentModel.js");s.newInstanceFromJson=function(e){var t=new s;return t.initByJson(e)?t:null},s.calculateFullFromatDateValue=function(e){return e>0?a.unix(e).format("LLL"):""},s.emailsToLine=function(e,t,s){var i=[],o=0,n=0;if(d.isNonEmptyArray(e))for(o=0,n=e.length;n>o;o++)i.push(e[o].toLine(t,s));return i.join(", ")},s.emailsToLineClear=function(e){var t=[],s=0,i=0;if(d.isNonEmptyArray(e))for(s=0,i=e.length;i>s;s++)e[s]&&e[s].email&&""!==e[s].name&&t.push(e[s].email);return t.join(", ")},s.initEmailsFromJson=function(e){var t=0,s=0,i=null,o=[];if(d.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=h.newInstanceFromJson(e[t]),i&&o.push(i);return o},s.replyHelper=function(e,t,s){if(e&&0i;i++)d.isUnd(t[e[i].email])&&(t[e[i].email]=!0,s.push(e[i]))},s.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.subjectPrefix(""),this.subjectSuffix(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(u.MessagePriority.Normal),this.proxy=!1,this.fromEmailString(""),this.fromClearEmailString(""),this.toEmailsString(""),this.toClearEmailsString(""),this.senderEmailsString(""),this.senderClearEmailsString(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation(!1),this.deleted(!1),this.unseen(!1),this.flagged(!1),this.answered(!1),this.forwarded(!1),this.isReadReceipt(!1),this.selected(!1),this.checked(!1),this.hasAttachments(!1),this.attachmentsMainType(""),this.body=null,this.isHtml(!1),this.hasImages(!1),this.attachments([]),this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(u.MessagePriority.Normal),this.readReceipt(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(0),this.threads([]),this.threadsLen(0),this.hasUnseenSubMessage(!1),this.hasFlaggedSubMessage(!1),this.lastInCollapsedThread(!1),this.lastInCollapsedThreadLoading(!1)},s.prototype.computeSenderEmail=function(){var e=t("../Storages/WebMailDataStorage.js"),s=e.sentFolder(),i=e.draftFolder();this.senderEmailsString(this.folderFullNameRaw===s||this.folderFullNameRaw===i?this.toEmailsString():this.fromEmailString()),this.senderClearEmailsString(this.folderFullNameRaw===s||this.folderFullNameRaw===i?this.toClearEmailsString():this.fromClearEmailString())},s.prototype.initByJson=function(e){var t=!1;return e&&"Object/Message"===e["@Object"]&&(this.folderFullNameRaw=e.Folder,this.uid=e.Uid,this.hash=e.Hash,this.requestHash=e.RequestHash,this.proxy=!!e.ExternalProxy,this.size(d.pInt(e.Size)),this.from=s.initEmailsFromJson(e.From),this.to=s.initEmailsFromJson(e.To),this.cc=s.initEmailsFromJson(e.Cc),this.bcc=s.initEmailsFromJson(e.Bcc),this.replyTo=s.initEmailsFromJson(e.ReplyTo),this.deliveredTo=s.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),d.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(d.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(s.emailsToLine(this.from,!0)),this.fromClearEmailString(s.emailsToLineClear(this.from)),this.toEmailsString(s.emailsToLine(this.to,!0)),this.toClearEmailsString(s.emailsToLineClear(this.to)),this.parentUid(d.pInt(e.ParentThread)),this.threads(d.isArray(e.Threads)?e.Threads:[]),this.threadsLen(d.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},s.prototype.initUpdateByMessageJson=function(e){var s=t("../Storages/WebMailDataStorage.js"),i=!1,o=u.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(o=d.pInt(e.Priority),this.priority(-1t;t++)i=g.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0 +$/,""),t=n.find(s,function(t){return e===t.cidWithOutTags})),t||null},s.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return d.isNonEmptyArray(s)&&(t=n.find(s,function(t){return e===t.contentLocation})),t||null},s.prototype.messageId=function(){return this.sMessageId},s.prototype.inReplyTo=function(){return this.sInReplyTo},s.prototype.references=function(){return this.sReferences},s.prototype.fromAsSingleEmail=function(){return d.isArray(this.from)&&this.from[0]?this.from[0].email:""},s.prototype.viewLink=function(){return p.messageViewLink(this.requestHash)},s.prototype.downloadLink=function(){return p.messageDownloadLink(this.requestHash)},s.prototype.replyEmails=function(e){var t=[],i=d.isUnd(e)?{}:e;return s.replyHelper(this.replyTo,i,t),0===t.length&&s.replyHelper(this.from,i,t),t},s.prototype.replyAllEmails=function(e){var t=[],i=[],o=d.isUnd(e)?{}:e;return s.replyHelper(this.replyTo,o,t),0===t.length&&s.replyHelper(this.from,o,t),s.replyHelper(this.to,o,t),s.replyHelper(this.cc,o,i),[t,i]},s.prototype.textBodyToString=function(){return this.body?this.body.html():""},s.prototype.attachmentsToStringLine=function(){var e=n.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0=0&&i&&!n&&s.attr("src",i)}),e&&i.setTimeout(function(){t.print()},100))})},s.prototype.printMessage=function(){this.viewPopupMessage(!0)},s.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},s.prototype.populateByMessageListItem=function(e){return this.folderFullNameRaw=e.folderFullNameRaw,this.uid=e.uid,this.hash=e.hash,this.requestHash=e.requestHash,this.subject(e.subject()),this.subjectPrefix(this.subjectPrefix()),this.subjectSuffix(this.subjectSuffix()),this.size(e.size()),this.dateTimeStampInUTC(e.dateTimeStampInUTC()),this.priority(e.priority()),this.proxy=e.proxy,this.fromEmailString(e.fromEmailString()),this.fromClearEmailString(e.fromClearEmailString()),this.toEmailsString(e.toEmailsString()),this.toClearEmailsString(e.toClearEmailsString()),this.emails=e.emails,this.from=e.from,this.to=e.to,this.cc=e.cc,this.bcc=e.bcc,this.replyTo=e.replyTo,this.deliveredTo=e.deliveredTo,this.unseen(e.unseen()),this.flagged(e.flagged()),this.answered(e.answered()),this.forwarded(e.forwarded()),this.isReadReceipt(e.isReadReceipt()),this.selected(e.selected()),this.checked(e.checked()),this.hasAttachments(e.hasAttachments()),this.attachmentsMainType(e.attachmentsMainType()),this.moment(e.moment()),this.body=null,this.priority(u.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(e.parentUid()),this.threads(e.threads()),this.threadsLen(e.threadsLen()),this.computeSenderEmail(),this},s.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var t="";e=d.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),t=this.proxy?"data-x-additional-src":"data-x-src",o("["+t+"]",this.body).each(function(){e&&o(this).is("img")?o(this).addClass("lazy").attr("data-original",o(this).attr(t)).removeAttr(t):o(this).attr("src",o(this).attr(t)).removeAttr(t)}),t=this.proxy?"data-x-additional-style-url":"data-x-style-url",o("["+t+"]",this.body).each(function(){var e=d.trim(o(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",o(this).attr("style",e+o(this).attr(t)).removeAttr(t)}),e&&(o("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:o(".RL-MailMessageView .messageView .messageItem .content")[0]}),l.resize()),d.windowResize(500)}},s.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=d.isUnd(e)?!1:e;var t=this;o("[data-x-src-cid]",this.body).each(function(){var s=t.findAttachmentByCid(o(this).attr("data-x-src-cid"));s&&s.download&&(e&&o(this).is("img")?o(this).addClass("lazy").attr("data-original",s.linkPreview()):o(this).attr("src",s.linkPreview()))}),o("[data-x-src-location]",this.body).each(function(){var s=t.findAttachmentByContentLocation(o(this).attr("data-x-src-location"));s||(s=t.findAttachmentByCid(o(this).attr("data-x-src-location"))),s&&s.download&&(e&&o(this).is("img")?o(this).addClass("lazy").attr("data-original",s.linkPreview()):o(this).attr("src",s.linkPreview()))}),o("[data-x-style-cid]",this.body).each(function(){var e="",s="",i=t.findAttachmentByCid(o(this).attr("data-x-style-cid"));i&&i.linkPreview&&(s=o(this).attr("data-x-style-cid-name"),""!==s&&(e=d.trim(o(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",o(this).attr("style",e+s+": url('"+i.linkPreview()+"')")))}),e&&!function(e,t){n.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(o("img.lazy",t.body),o(".RL-MailMessageView .messageView .messageItem .content")[0]),d.windowResize(500)}},s.prototype.storeDataToDom=function(){if(this.body){this.body.data("rl-is-html",!!this.isHtml()),this.body.data("rl-has-images",!!this.hasImages()),this.body.data("rl-plain-raw",this.plainRaw);var e=t("../Storages/WebMailDataStorage.js");e.capaOpenPGP()&&(this.body.data("rl-plain-pgp-signed",!!this.isPgpSigned()),this.body.data("rl-plain-pgp-encrypted",!!this.isPgpEncrypted()),this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))}},s.prototype.storePgpVerifyDataToDom=function(){var e=t("../Storages/WebMailDataStorage.js");this.body&&e.capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},s.prototype.fetchDataToDom=function(){if(this.body){this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=d.pString(this.body.data("rl-plain-raw"));var e=t("../Storages/WebMailDataStorage.js");e.capaOpenPGP()?(this.isPgpSigned(!!this.body.data("rl-plain-pgp-signed")),this.isPgpEncrypted(!!this.body.data("rl-plain-pgp-encrypted")),this.pgpSignedVerifyStatus(this.body.data("rl-pgp-verify-status")),this.pgpSignedVerifyUser(this.body.data("rl-pgp-verify-user"))):(this.isPgpSigned(!1),this.isPgpEncrypted(!1),this.pgpSignedVerifyStatus(u.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""))}},s.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var e=[],s=null,r=t("../Storages/WebMailDataStorage.js"),a=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",l=r.findPublicKeysByEmail(a),d=null,p=null,h="";this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{s=i.openpgp.cleartext.readArmored(this.plainRaw),s&&s.getText&&(this.pgpSignedVerifyStatus(l.length?u.SignedVerifyStatus.Unverified:u.SignedVerifyStatus.UnknownPublicKeys),e=s.verify(l),e&&0').text(h)).html(),c.empty(),this.replacePlaneTextBody(h)))))}catch(g){}this.storePgpVerifyDataToDom()}},s.prototype.decryptPgpEncryptedMessage=function(e){if(this.isPgpEncrypted()){var s=[],r=null,a=null,l=t("../Storages/WebMailDataStorage.js"),d=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",p=l.findPublicKeysByEmail(d),h=l.findSelfPrivateKey(e),g=null,m=null,f="";this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),h||this.pgpSignedVerifyStatus(u.SignedVerifyStatus.UnknownPrivateKey);try{r=i.openpgp.message.readArmored(this.plainRaw),r&&h&&r.decrypt&&(this.pgpSignedVerifyStatus(u.SignedVerifyStatus.Unverified),a=r.decrypt(h),a&&(s=a.verify(p),s&&0').text(f)).html(),c.empty(),this.replacePlaneTextBody(f)))}catch(b){}this.storePgpVerifyDataToDom()}},s.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},s.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},e.exports=s}(t,e)},{$:26,$div:15,$window:18,"../Storages/WebMailDataStorage.js":74,"./AttachmentModel.js":38,"./EmailModel.js":43,Enums:7,LinkBuilder:10,Utils:14,_:31,ko:28,moment:29,window:32}],49:[function(e,t){!function(e,t){"use strict";function s(e,t,s,o,n,r,a){this.index=e,this.id=s,this.guid=t,this.user=o,this.email=n,this.armor=a,this.isPrivate=!!r,this.deleteAccess=i.observable(!1)}var i=t("ko");s.prototype.index=0,s.prototype.id="",s.prototype.guid="",s.prototype.user="",s.prototype.email="",s.prototype.armor="",s.prototype.isPrivate=!1,e.exports=s}(t,e)},{ko:28}],50:[function(e,t){!function(e,t){"use strict";function s(e){u.call(this,"settings",e),this.menu=n.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}var i=t("$"),o=t("_"),n=t("ko"),r=t("Globals"),a=t("Utils"),l=t("LinkBuilder"),c=t("kn"),u=t("KnoinAbstractScreen");o.extend(s.prototype,u.prototype),s.prototype.onRoute=function(e){var t=this,s=null,u=null,d=null,p=null;u=o.find(r.aViewModels.settings,function(t){return t&&t.__rlSettingsData&&e===t.__rlSettingsData.Route}),u&&(o.find(r.aViewModels["settings-removed"],function(e){return e&&e===u})&&(u=null),u&&o.find(r.aViewModels["settings-disabled"],function(e){return e&&e===u})&&(u=null)),u?(u.__builded&&u.__vm?s=u.__vm:(d=this.oViewModelPlace,d&&1===d.length?(u=u,s=new u,p=i("").addClass("rl-settings-view-model").hide(),p.appendTo(d),s.viewModelDom=p,s.__rlSettingsData=u.__rlSettingsData,u.__dom=p,u.__builded=!0,u.__vm=s,n.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:u.__rlSettingsData.Template}}},s),a.delegateRun(s,"onBuild",[p])):a.log("Cannot find sub settings view model position: SettingsSubScreen")),s&&o.defer(function(){t.oCurrentSubScreen&&(a.delegateRun(t.oCurrentSubScreen,"onHide"),t.oCurrentSubScreen.viewModelDom.hide()),t.oCurrentSubScreen=s,t.oCurrentSubScreen&&(t.oCurrentSubScreen.viewModelDom.show(),a.delegateRun(t.oCurrentSubScreen,"onShow"),a.delegateRun(t.oCurrentSubScreen,"onFocus",[],200),o.each(t.menu(),function(e){e.selected(s&&s.__rlSettingsData&&e.route===s.__rlSettingsData.Route)}),i("#rl-content .b-settings .b-content .content").scrollTop(0)),a.windowResize()})):c.setHash(l.settings(),!1,!0)},s.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(a.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},s.prototype.onBuild=function(){o.each(r.aViewModels.settings,function(e){e&&e.__rlSettingsData&&!o.find(r.aViewModels["settings-removed"],function(t){return t&&t===e})&&this.menu.push({route:e.__rlSettingsData.Route,label:e.__rlSettingsData.Label,selected:n.observable(!1),disabled:!!o.find(r.aViewModels["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=i("#rl-content #rl-settings-subscreen")},s.prototype.routes=function(){var e=o.find(r.aViewModels.settings,function(e){return e&&e.__rlSettingsData&&e.__rlSettingsData.IsDefault}),t=e?e.__rlSettingsData.Route:"general",s={subname:/^(.*)$/,normalize_:function(e,s){return s.subname=a.isUnd(s.subname)?t:a.pString(s.subname),[s.subname]}};return[["{subname}/",s],["{subname}",s],["",s]]},e.exports=s}(t,e)},{$:26,Globals:9,KnoinAbstractScreen:35,LinkBuilder:10,Utils:14,_:31,kn:33,ko:28}],51:[function(e,t){!function(e,t){"use strict";function s(){var e=t("../ViewModels/LoginViewModel.js");o.call(this,"login",[e])}var i=t("_"),o=t("KnoinAbstractScreen");i.extend(s.prototype,o.prototype),s.prototype.onShow=function(){var e=t("../Boots/RainLoopApp.js");e.setTitle("")},e.exports=s}(t,e)},{"../Boots/RainLoopApp.js":4,"../ViewModels/LoginViewModel.js":76,KnoinAbstractScreen:35,_:31}],52:[function(e,t){!function(e,t){"use strict";function s(){var e=t("../ViewModels/MailBoxSystemDropDownViewModel.js"),s=t("../ViewModels/MailBoxFolderListViewModel.js"),i=t("../ViewModels/MailBoxMessageListViewModel.js"),o=t("../ViewModels/MailBoxMessageViewViewModel.js");c.call(this,"mailbox",[e,s,i,o]),this.oLastRoute={}}var i=t("_"),o=t("$html"),n=t("Enums"),r=t("Globals"),a=t("Utils"),l=t("Events"),c=t("KnoinAbstractScreen"),u=t("../Storages/AppSettings.js"),d=t("../Storages/WebMailDataStorage.js"),p=t("../Storages/WebMailCacheStorage.js"),h=t("../Storages/WebMailAjaxRemoteStorage.js");i.extend(s.prototype,c.prototype),s.prototype.oLastRoute={},s.prototype.setNewTitle=function(){var e=t("../Boots/RainLoopApp.js"),s=d.accountEmail(),i=d.foldersInboxUnreadCount();e.setTitle((""===s?"":(i>0?"("+i+") ":" ")+s+" - ")+a.i18n("TITLES/MAILBOX"))},s.prototype.onShow=function(){this.setNewTitle(),r.keyScope(n.KeyState.MessageList)},s.prototype.onRoute=function(e,s,i,o){var r=t("../Boots/RainLoopApp.js");if(a.isUnd(o)?1:!o){var l=p.getFolderFullNameRaw(e),c=p.getFolderFromCacheList(l);c&&(d.currentFolder(c).messageListPage(s).messageListSearch(i),n.Layout.NoPreview===d.layout()&&d.message()&&d.message(null),r.reloadMessageList())}else n.Layout.NoPreview!==d.layout()||d.message()||r.historyBack()},s.prototype.onStart=function(){var e=t("../Boots/RainLoopApp.js"),s=function(){a.windowResize()};(u.capa(n.Capa.AdditionalAccounts)||u.capa(n.Capa.AdditionalIdentities))&&e.accountsAndIdentities(),i.delay(function(){"INBOX"!==d.currentFolderFullNameRaw()&&e.folderInformation("INBOX")},1e3),i.delay(function(){e.quota()},5e3),i.delay(function(){h.appDelayStart(a.emptyFunction)},35e3),o.toggleClass("rl-no-preview-pane",n.Layout.NoPreview===d.layout()),d.folderList.subscribe(s),d.messageList.subscribe(s),d.message.subscribe(s),d.layout.subscribe(function(e){o.toggleClass("rl-no-preview-pane",n.Layout.NoPreview===e)}),l.sub("mailbox.inbox-unread-count",function(e){d.foldersInboxUnreadCount(e)}),d.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},s.prototype.routes=function(){var e=function(){return["Inbox",1,"",!0]},t=function(e,t){return t[0]=a.pString(t[0]),t[1]=a.pInt(t[1]),t[1]=0>=t[1]?1:t[1],t[2]=a.pString(t[2]),""===e&&(t[0]="Inbox",t[1]=1),[decodeURI(t[0]),t[1],decodeURI(t[2]),!1]},s=function(e,t){return t[0]=a.pString(t[0]),t[1]=a.pString(t[1]),""===e&&(t[0]="Inbox"),[decodeURI(t[0]),1,decodeURI(t[1]),!1]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/,{normalize_:t}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:s}],[/^message-preview$/,{normalize_:e}],[/^([^\/]*)$/,{normalize_:t}]]},e.exports=s}(t,e)},{$html:17,"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"../ViewModels/MailBoxFolderListViewModel.js":77,"../ViewModels/MailBoxMessageListViewModel.js":78,"../ViewModels/MailBoxMessageViewViewModel.js":79,"../ViewModels/MailBoxSystemDropDownViewModel.js":80,Enums:7,Events:8,Globals:9,KnoinAbstractScreen:35,Utils:14,_:31}],53:[function(e,t){!function(e,t){"use strict";function s(){var e=t("../Boots/RainLoopApp.js"),s=t("../ViewModels/SettingsSystemDropDownViewModel.js"),i=t("../ViewModels/SettingsMenuViewModel.js"),o=t("../ViewModels/SettingsPaneViewModel.js");a.call(this,[s,i,o]),n.initOnStartOrLangChange(function(){this.sSettingsTitle=n.i18n("TITLES/SETTINGS")},this,function(){e.setTitle(this.sSettingsTitle)})}var i=t("_"),o=t("Enums"),n=t("Utils"),r=t("Globals"),a=t("./AbstractSettings.js");i.extend(s.prototype,a.prototype),s.prototype.onShow=function(){var e=t("../Boots/RainLoopApp.js");e.setTitle(this.sSettingsTitle),r.keyScope(o.KeyState.Settings)},e.exports=s}(t,e)},{"../Boots/RainLoopApp.js":4,"../ViewModels/SettingsMenuViewModel.js":98,"../ViewModels/SettingsPaneViewModel.js":99,"../ViewModels/SettingsSystemDropDownViewModel.js":100,"./AbstractSettings.js":50,Enums:7,Globals:9,Utils:14,_:31}],54:[function(e,t){!function(e,t){"use strict";function s(){this.accounts=c.accounts,this.processText=n.computed(function(){return c.accountsLoading()?a.i18n("SETTINGS_ACCOUNTS/LOADING_PROCESS"):""},this),this.visibility=n.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.accountForDeletion=n.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}var i=t("window"),o=t("_"),n=t("ko"),r=t("Enums"),a=t("Utils"),l=t("LinkBuilder"),c=t("../Storages/WebMailDataStorage.js"),u=t("../Storages/WebMailAjaxRemoteStorage.js"),d=t("kn"),p=t("../ViewModels/Popups/PopupsAddAccountViewModel.js");s.prototype.addNewAccount=function(){d.showScreenPopup(p)},s.prototype.deleteAccount=function(e){if(e&&e.deleteAccess()){this.accountForDeletion(null);var s=t("../Boots/RainLoopApp.js"),n=function(t){return e===t};e&&(this.accounts.remove(n),u.accountDelete(function(e,t){r.StorageResultType.Success===e&&t&&t.Result&&t.Reload?(d.routeOff(),d.setHash(l.root(),!0),d.routeOff(),o.defer(function(){i.location.reload()})):s.accountsAndIdentities()},e.email))}},e.exports=s}(t,e)},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddAccountViewModel.js":81,Enums:7,LinkBuilder:10,Utils:14,_:31,kn:33,ko:28,window:32}],55:[function(e,t){!function(e,t){"use strict";function s(){this.changeProcess=o.observable(!1),this.errorDescription=o.observable(""),this.passwordMismatch=o.observable(!1),this.passwordUpdateError=o.observable(!1),this.passwordUpdateSuccess=o.observable(!1),this.currentPassword=o.observable(""),this.currentPassword.error=o.observable(!1),this.newPassword=o.observable(""),this.newPassword2=o.observable(""),this.currentPassword.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.currentPassword.error(!1)},this),this.newPassword.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.passwordMismatch(!1)},this),this.newPassword2.subscribe(function(){this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.passwordMismatch(!1)},this),this.saveNewPasswordCommand=r.createCommand(this,function(){this.newPassword()!==this.newPassword2()?(this.passwordMismatch(!0),this.errorDescription(r.i18n("SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH"))):(this.changeProcess(!0),this.passwordUpdateError(!1),this.passwordUpdateSuccess(!1),this.currentPassword.error(!1),this.passwordMismatch(!1),this.errorDescription(""),a.changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword()))},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()&&""!==this.newPassword2()}),this.onChangePasswordResponse=i.bind(this.onChangePasswordResponse,this)}var i=t("_"),o=t("ko"),n=t("Enums"),r=t("Utils"),a=t("../Storages/WebMailAjaxRemoteStorage.js");s.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},s.prototype.onChangePasswordResponse=function(e,t){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),n.StorageResultType.Success===e&&t&&t.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(t&&n.Notification.CurrentPasswordIncorrect===t.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(r.getNotification(t&&t.ErrorCode?t.ErrorCode:n.Notification.CouldNotSaveNewPassword)))},e.exports=s}(t,e)},{"../Storages/WebMailAjaxRemoteStorage.js":72,Enums:7,Utils:14,_:31,ko:28}],56:[function(e,t){!function(e,t){"use strict";function s(){this.contactsAutosave=r.contactsAutosave,this.allowContactsSync=r.allowContactsSync,this.enableContactsSync=r.enableContactsSync,this.contactsSyncUrl=r.contactsSyncUrl,this.contactsSyncUser=r.contactsSyncUser,this.contactsSyncPass=r.contactsSyncPass,this.saveTrigger=i.computed(function(){return[this.enableContactsSync()?"1":"0",this.contactsSyncUrl(),this.contactsSyncUser(),this.contactsSyncPass()].join("|")},this).extend({throttle:500}),this.saveTrigger.subscribe(function(){n.saveContactsSyncData(null,this.enableContactsSync(),this.contactsSyncUrl(),this.contactsSyncUser(),this.contactsSyncPass())},this)}var i=t("ko"),o=t("Utils"),n=t("../Storages/WebMailAjaxRemoteStorage.js"),r=t("../Storages/WebMailDataStorage.js");s.prototype.onBuild=function(){r.contactsAutosave.subscribe(function(e){n.saveSettings(o.emptyFunction,{ContactsAutosave:e?"1":"0"})})},e.exports=s}(t,e)},{"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,Utils:14,ko:28}],57:[function(e,t){!function(e,t){"use strict";function s(){this.filters=i.observableArray([]),this.filters.loading=i.observable(!1),this.filters.subscribe(function(){o.windowResize()})}var i=t("ko"),o=t("Utils");s.prototype.deleteFilter=function(e){this.filters.remove(e)},s.prototype.addFilter=function(){var e=t("kn"),s=t("../Models/FilterModel.js"),i=t("../ViewModels/Popups/PopupsFilterViewModel.js");e.showScreenPopup(i,[new s])},e.exports=s}(t,e)},{"../Models/FilterModel.js":45,"../ViewModels/Popups/PopupsFilterViewModel.js":88,Utils:14,kn:33,ko:28}],58:[function(e,t){!function(e,t){"use strict";function s(){this.foldersListError=c.foldersListError,this.folderList=c.folderList,this.processText=i.computed(function(){var e=c.foldersLoading(),t=c.foldersCreating(),s=c.foldersDeleting(),i=c.foldersRenaming();return t?n.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):s?n.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):i?n.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):e?n.i18n("SETTINGS_FOLDERS/LOADING_PROCESS"):""},this),this.visibility=i.computed(function(){return""===this.processText()?"hidden":"visible"},this),this.folderForDeletion=i.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]}),this.folderForEdit=i.observable(null).extend({toggleSubscribe:[this,function(e){e&&e.edited(!1)},function(e){e&&e.canBeEdited()&&e.edited(!0)}]}),this.useImapSubscribe=!!a.settingsGet("UseImapSubscribe")}var i=t("ko"),o=t("Enums"),n=t("Utils"),r=t("kn"),a=t("../Storages/AppSettings.js"),l=t("../Storages/LocalStorage.js"),c=t("../Storages/WebMailDataStorage.js"),u=t("../Storages/WebMailCacheStorage.js"),d=t("../Storages/WebMailAjaxRemoteStorage.js"),p=t("../ViewModels/Popups/PopupsFolderCreateViewModel.js"),h=t("../ViewModels/Popups/PopupsFolderSystemViewModel.js");s.prototype.folderEditOnEnter=function(e){var s=t("../Boots/RainLoopApp.js"),i=e?n.trim(e.nameForEdit()):"";""!==i&&e.name()!==i&&(l.set(o.ClientSideKeyName.FoldersLashHash,""),c.foldersRenaming(!0),d.folderRename(function(e,t){c.foldersRenaming(!1),o.StorageResultType.Success===e&&t&&t.Result||c.foldersListError(t&&t.ErrorCode?n.getNotification(t.ErrorCode):n.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),s.folders()},e.fullNameRaw,i),u.removeFolderFromCacheList(e.fullNameRaw),e.name(i)),e.edited(!1)},s.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},s.prototype.onShow=function(){c.foldersListError("")},s.prototype.createFolder=function(){r.showScreenPopup(p)},s.prototype.systemFolder=function(){r.showScreenPopup(h)},s.prototype.deleteFolder=function(e){if(e&&e.canBeDeleted()&&e.deleteAccess()&&0===e.privateMessageCountAll()){this.folderForDeletion(null);var s=t("../Boots/RainLoopApp.js"),i=function(t){return e===t?!0:(t.subFolders.remove(i),!1)};e&&(l.set(o.ClientSideKeyName.FoldersLashHash,""),c.folderList.remove(i),c.foldersDeleting(!0),d.folderDelete(function(e,t){c.foldersDeleting(!1),o.StorageResultType.Success===e&&t&&t.Result||c.foldersListError(t&&t.ErrorCode?n.getNotification(t.ErrorCode):n.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),s.folders()},e.fullNameRaw),u.removeFolderFromCacheList(e.fullNameRaw))}else 0"},s.prototype.addNewIdentity=function(){c.showScreenPopup(u)},s.prototype.editIdentity=function(e){c.showScreenPopup(u,[e])},s.prototype.deleteIdentity=function(e){if(e&&e.deleteAccess()){this.identityForDeletion(null);var s=t("../Boots/RainLoopApp.js"),i=function(t){return e===t};e&&(this.identities.remove(i),l.identityDelete(function(){s.accountsAndIdentities()},e.id))}},s.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=a.signature();this.editor=new r(e.signatureDom(),function(){a.signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},s.prototype.onBuild=function(e){var t=this;e.on("click",".identity-item .e-action",function(){var e=i.dataFor(this);e&&t.editIdentity(e)}),_.delay(function(){var e=n.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),s=n.settingsSaveHelperSimpleFunction(t.replyTrigger,t),i=n.settingsSaveHelperSimpleFunction(t.signatureTrigger,t),o=n.settingsSaveHelperSimpleFunction(t.defaultIdentityIDTrigger,t);
+a.defaultIdentityID.subscribe(function(e){l.saveSettings(o,{DefaultIdentityID:e})}),a.displayName.subscribe(function(t){l.saveSettings(e,{DisplayName:t})}),a.replyTo.subscribe(function(e){l.saveSettings(s,{ReplyTo:e})}),a.signature.subscribe(function(e){l.saveSettings(i,{Signature:e})}),a.signatureToAll.subscribe(function(e){l.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},e.exports=s}(t,e)},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsIdentityViewModel.js":93,Enums:7,NewHtmlEditorWrapper:11,Utils:14,kn:33,ko:28}],61:[function(e,t){!function(e,t){"use strict";function s(){this.editor=null,this.displayName=a.displayName,this.signature=a.signature,this.signatureToAll=a.signatureToAll,this.replyTo=a.replyTo,this.signatureDom=i.observable(null),this.displayNameTrigger=i.observable(o.SaveSettingsStep.Idle),this.replyTrigger=i.observable(o.SaveSettingsStep.Idle),this.signatureTrigger=i.observable(o.SaveSettingsStep.Idle)}var i=t("ko"),o=t("Enums"),n=t("Utils"),r=t("NewHtmlEditorWrapper"),a=t("../Storages/WebMailDataStorage.js"),l=t("../Storages/WebMailAjaxRemoteStorage.js");s.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=a.signature();this.editor=new r(e.signatureDom(),function(){a.signature((e.editor.isHtml()?":HTML:":"")+e.editor.getData())},function(){":HTML:"===t.substr(0,6)?e.editor.setHtml(t.substr(6),!1):e.editor.setPlain(t,!1)})}},s.prototype.onBuild=function(){var e=this;_.delay(function(){var t=n.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),s=n.settingsSaveHelperSimpleFunction(e.replyTrigger,e),i=n.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);a.displayName.subscribe(function(e){l.saveSettings(t,{DisplayName:e})}),a.replyTo.subscribe(function(e){l.saveSettings(s,{ReplyTo:e})}),a.signature.subscribe(function(e){l.saveSettings(i,{Signature:e})}),a.signatureToAll.subscribe(function(e){l.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},e.exports=s}(t,e)},{"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,Enums:7,NewHtmlEditorWrapper:11,Utils:14,ko:28}],62:[function(e,t){!function(e,t){"use strict";function s(){this.openpgpkeys=n.openpgpkeys,this.openpgpkeysPublic=n.openpgpkeysPublic,this.openpgpkeysPrivate=n.openpgpkeysPrivate,this.openPgpKeyForDeletion=i.observable(null).extend({falseTimeout:3e3}).extend({toggleSubscribe:[this,function(e){e&&e.deleteAccess(!1)},function(e){e&&e.deleteAccess(!0)}]})}var i=t("ko"),o=t("kn"),n=t("../Storages/WebMailDataStorage.js"),r=t("../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js"),a=t("../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js"),l=t("../ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js");s.prototype.addOpenPgpKey=function(){o.showScreenPopup(r)},s.prototype.generateOpenPgpKey=function(){o.showScreenPopup(a)},s.prototype.viewOpenPgpKey=function(e){e&&o.showScreenPopup(l,[e])},s.prototype.deleteOpenPgpKey=function(e){if(e&&e.deleteAccess()&&(this.openPgpKeyForDeletion(null),e&&n.openpgpKeyring)){this.openpgpkeys.remove(function(t){return e===t}),n.openpgpKeyring[e.isPrivate?"privateKeys":"publicKeys"].removeForId(e.guid),n.openpgpKeyring.store();var s=t("../Boots/RainLoopApp.js");s.reloadOpenPgpKeys()}},e.exports=s}(t,e)},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailDataStorage.js":74,"../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js":82,"../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js":92,"../ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js":97,kn:33,ko:28}],63:[function(e,t){!function(e,t){"use strict";function s(){this.processing=i.observable(!1),this.clearing=i.observable(!1),this.secreting=i.observable(!1),this.viewUser=i.observable(""),this.viewEnable=i.observable(!1),this.viewEnable.subs=!0,this.twoFactorStatus=i.observable(!1),this.viewSecret=i.observable(""),this.viewBackupCodes=i.observable(""),this.viewUrl=i.observable(""),this.bFirst=!0,this.viewTwoFactorStatus=i.computed(function(){return n.langChangeTrigger(),r.i18n(this.twoFactorStatus()?"SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC":"SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC")},this),this.onResult=_.bind(this.onResult,this),this.onSecretResult=_.bind(this.onSecretResult,this)}var i=t("ko"),o=t("Enums"),n=t("Globals"),r=t("Utils"),a=t("../Storages/WebMailAjaxRemoteStorage.js"),l=t("kn"),c=t("../ViewModels/Popups/PopupsTwoFactorTestViewModel.js");s.prototype.showSecret=function(){this.secreting(!0),a.showTwoFactorSecret(this.onSecretResult)},s.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},s.prototype.createTwoFactor=function(){this.processing(!0),a.createTwoFactor(this.onResult)},s.prototype.enableTwoFactor=function(){this.processing(!0),a.enableTwoFactor(this.onResult,this.viewEnable())},s.prototype.testTwoFactor=function(){l.showScreenPopup(c)},s.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),a.clearTwoFactor(this.onResult)},s.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},s.prototype.onResult=function(e,t){if(this.processing(!1),this.clearing(!1),o.StorageResultType.Success===e&&t&&t.Result?(this.viewUser(r.pString(t.Result.User)),this.viewEnable(!!t.Result.Enable),this.twoFactorStatus(!!t.Result.IsSet),this.viewSecret(r.pString(t.Result.Secret)),this.viewBackupCodes(r.pString(t.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(r.pString(t.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var s=this;this.viewEnable.subscribe(function(e){this.viewEnable.subs&&a.enableTwoFactor(function(e,t){o.StorageResultType.Success===e&&t&&t.Result||(s.viewEnable.subs=!1,s.viewEnable(!1),s.viewEnable.subs=!0)},e)},this)}},s.prototype.onSecretResult=function(e,t){this.secreting(!1),o.StorageResultType.Success===e&&t&&t.Result?(this.viewSecret(r.pString(t.Result.Secret)),this.viewUrl(r.pString(t.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},s.prototype.onBuild=function(){this.processing(!0),a.getTwoFactor(this.onResult)},e.exports=s}(t,e)},{"../Storages/WebMailAjaxRemoteStorage.js":72,"../ViewModels/Popups/PopupsTwoFactorTestViewModel.js":96,Enums:7,Globals:9,Utils:14,kn:33,ko:28}],64:[function(e,t){!function(e,t){"use strict";function s(){var e=t("Utils"),s=t("../Boots/RainLoopApp.js"),i=t("../Storages/WebMailDataStorage.js");this.googleEnable=i.googleEnable,this.googleActions=i.googleActions,this.googleLoggined=i.googleLoggined,this.googleUserName=i.googleUserName,this.facebookEnable=i.facebookEnable,this.facebookActions=i.facebookActions,this.facebookLoggined=i.facebookLoggined,this.facebookUserName=i.facebookUserName,this.twitterEnable=i.twitterEnable,this.twitterActions=i.twitterActions,this.twitterLoggined=i.twitterLoggined,this.twitterUserName=i.twitterUserName,this.connectGoogle=e.createCommand(this,function(){this.googleLoggined()||s.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=e.createCommand(this,function(){s.googleDisconnect()}),this.connectFacebook=e.createCommand(this,function(){this.facebookLoggined()||s.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=e.createCommand(this,function(){s.facebookDisconnect()}),this.connectTwitter=e.createCommand(this,function(){this.twitterLoggined()||s.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=e.createCommand(this,function(){s.twitterDisconnect()})}e.exports=s}(t,e)},{"../Boots/RainLoopApp.js":4,"../Storages/WebMailDataStorage.js":74,Utils:14}],65:[function(e,t){!function(e,t){"use strict";function s(){var e=this;this.mainTheme=c.mainTheme,this.themesObjects=n.observableArray([]),this.themeTrigger=n.observable(r.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,c.theme.subscribe(function(t){_.each(this.themesObjects(),function(e){e.selected(t===e.name)});var s=o("#rlThemeLink"),n=o("#rlThemeStyle"),l=s.attr("href");l||(l=n.attr("data-href")),l&&(l=l.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+t+"/-/"),l=l.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/0/User/"),"Json/"!==l.substring(l.length-5,l.length)&&(l+="Json/"),i.clearTimeout(e.iTimer),e.themeTrigger(r.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=o.ajax({url:l,dataType:"json"}).done(function(t){t&&a.isArray(t)&&2===t.length&&(!s||!s[0]||n&&n[0]||(n=o(''),s.after(n),s.remove()),n&&n[0]&&(n.attr("data-href",l).attr("data-theme",t[0]),n&&n[0]&&n[0].styleSheet&&!a.isUnd(n[0].styleSheet.cssText)?n[0].styleSheet.cssText=t[1]:n.text(t[1])),e.themeTrigger(r.SaveSettingsStep.TrueResult))}).always(function(){e.iTimer=i.setTimeout(function(){e.themeTrigger(r.SaveSettingsStep.Idle)},1e3),e.oLastAjax=null})),u.saveSettings(null,{Theme:t})},this)}var i=t("window"),o=t("$"),n=t("ko"),r=t("Enums"),a=t("Utils"),l=t("LinkBuilder"),c=t("../Storages/WebMailDataStorage.js"),u=t("../Storages/WebMailAjaxRemoteStorage.js");s.prototype.onBuild=function(){var e=c.theme();this.themesObjects(_.map(c.themes(),function(t){return{name:t,nameDisplay:a.convertThemeName(t),selected:n.observable(t===e),themePreviewSrc:l.themePreviewLink(t)}}))},e.exports=s}(t,e)},{$:26,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailDataStorage.js":74,Enums:7,LinkBuilder:10,Utils:14,ko:28,window:32}],66:[function(e,t){!function(e,t){"use strict";function s(){this.oRequests={}}var i=t("window"),o=t("$"),n=t("Consts"),r=t("Enums"),a=t("Globals"),l=t("Utils"),c=t("Plugins"),u=t("LinkBuilder"),d=t("./AppSettings.js");s.prototype.oRequests={},s.prototype.defaultResponse=function(e,t,s,o,u,d){var p=function(){r.StorageResultType.Success!==s&&a.bUnload&&(s=r.StorageResultType.Unload),r.StorageResultType.Success===s&&o&&!o.Result?(o&&-1(new i.Date).getTime()-h),m&&a.oRequests[m]&&(a.oRequests[m].__aborted&&(o="abort"),a.oRequests[m]=null),a.defaultResponse(e,m,o,s,n,t)}),m&&00?(this.defaultRequest(e,"Message",{},null,"Message/"+a.urlsafe_encode([t,s,u.projectHash(),u.threading()&&u.useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},s.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},s.prototype.composeUploadDrive=function(e,t,s){this.defaultRequest(e,"ComposeUploadDrive",{AccessToken:s,Url:t},999e3)},s.prototype.folderInformation=function(e,t,s){var n=!0,a=[];o.isArray(s)&&0=e?1:e},this),this.mainMessageListSearch=r.computed({read:this.messageListSearch,write:function(e){b.setHash(g.mailBox(this.currentFolderFullNameHash(),1,h.trim(e.toString())))},owner:this}),this.messageListError=r.observable(""),this.messageListLoading=r.observable(!1),this.messageListIsNotCompleted=r.observable(!1),this.messageListCompleteLoadingThrottle=r.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=r.computed(function(){var e=this.messageListLoading(),t=this.messageListIsNotCompleted();return e||t},this),this.messageListCompleteLoading.subscribe(function(e){this.messageListCompleteLoadingThrottle(e)},this),this.messageList.subscribe(n.debounce(function(e){n.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new S,this.message=r.observable(null),this.messageLoading=r.observable(!1),this.messageLoadingThrottle=r.observable(!1).extend({throttle:50}),this.message.focused=r.observable(!1),this.message.subscribe(function(e){e?d.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),d.Layout.NoPreview===this.layout()&&-10?i.Math.ceil(t/e*100):0},this),this.capaOpenPGP=r.observable(!1),this.openpgpkeys=r.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(e){return!(!e||e.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(e){return!(!e||!e.isPrivate)}),this.googleActions=r.observable(!1),this.googleLoggined=r.observable(!1),this.googleUserName=r.observable(""),this.facebookActions=r.observable(!1),this.facebookLoggined=r.observable(!1),this.facebookUserName=r.observable(""),this.twitterActions=r.observable(!1),this.twitterLoggined=r.observable(!1),this.twitterUserName=r.observable(""),this.customThemeType=r.observable(d.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=n.throttle(this.purgeMessageBodyCache,3e4)}var i=t("window"),o=t("$"),n=t("_"),r=t("ko"),a=t("moment"),l=t("$div"),c=t("NotificationClass"),u=t("Consts"),d=t("Enums"),p=t("Globals"),h=t("Utils"),g=t("LinkBuilder"),m=t("./AppSettings.js"),f=t("./WebMailCacheStorage.js"),b=t("kn"),S=t("../Models/MessageModel.js"),y=t("./LocalStorage.js"),v=t("./AbstractData.js");n.extend(s.prototype,v.prototype),s.prototype.purgeMessageBodyCache=function(){var e=0,t=null,s=p.iMessageBodyCacheCount-u.Values.MessageBodyCacheLimit;s>0&&(t=this.messagesBodiesDom(),t&&(t.find(".rl-cache-class").each(function(){var t=o(this);s>t.data("rl-cache-count")&&(t.addClass("rl-cache-purge"),e++)}),e>0&&n.delay(function(){t.find(".rl-cache-purge").remove()},300)))},s.prototype.populateDataOnStart=function(){v.prototype.populateDataOnStart.call(this),this.accountEmail(m.settingsGet("Email")),this.accountIncLogin(m.settingsGet("IncLogin")),this.accountOutLogin(m.settingsGet("OutLogin")),this.projectHash(m.settingsGet("ProjectHash")),this.defaultIdentityID(m.settingsGet("DefaultIdentityID")),this.displayName(m.settingsGet("DisplayName")),this.replyTo(m.settingsGet("ReplyTo")),this.signature(m.settingsGet("Signature")),this.signatureToAll(!!m.settingsGet("SignatureToAll")),this.enableTwoFactor(!!m.settingsGet("EnableTwoFactor")),this.lastFoldersHash=y.get(d.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!m.settingsGet("RemoteSuggestions"),this.devEmail=m.settingsGet("DevEmail"),this.devPassword=m.settingsGet("DevPassword")},s.prototype.initUidNextAndNewMessages=function(e,t,s){if("INBOX"===e&&h.isNormal(t)&&""!==t){if(h.isArray(s)&&03)l(g.notificationMailIcon(),this.accountEmail(),h.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:a}));else for(;a>r;r++)l(g.notificationMailIcon(),S.emailsToLine(S.initEmailsFromJson(s[r].From),!1),s[r].Subject)}f.setFolderUidNext(e,t)}},s.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},s.prototype.getNextFolderNames=function(e){e=h.isUnd(e)?!1:!!e;var t=[],s=10,i=a().unix(),o=i-300,r=[],l=function(t){n.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&o>t.interval&&(!e||t.subScribed())&&r.push([t.interval,t.fullNameRaw]),t&&0t[0]?1:0}),n.find(r,function(e){var o=f.getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),n.uniq(t)},s.prototype.removeMessagesFromList=function(e,t,s,i){s=h.isNormal(s)?s:"",i=h.isUnd(i)?!1:!!i,t=n.map(t,function(e){return h.pInt(e)});var o=this,r=0,a=this.messageList(),l=f.getFolderFromCacheList(e),c=""===s?null:f.getFolderFromCacheList(s||""),u=this.currentFolderFullNameRaw(),d=this.message(),p=u===e?n.filter(a,function(e){return e&&-10&&l.messageCountUnread(0<=l.messageCountUnread()-r?l.messageCountUnread()-r:0)),c&&(c.messageCountAll(c.messageCountAll()+t.length),r>0&&c.messageCountUnread(c.messageCountUnread()+r),c.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),r.data("rl-cache-count",++p.iMessageBodyCacheCount),h.isNormal(e.Result.Html)&&""!==e.Result.Html?(s=!0,u=e.Result.Html.toString()):h.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(s=!1,u=h.plainToHtml(e.Result.Plain.toString(),!1),(S.isPgpSigned()||S.isPgpEncrypted())&&this.capaOpenPGP()&&(S.plainRaw=h.pString(e.Result.Plain),m=/---BEGIN PGP MESSAGE---/.test(S.plainRaw),m||(g=/-----BEGIN PGP SIGNED MESSAGE-----/.test(S.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(S.plainRaw)),l.empty(),g&&S.isPgpSigned()?u=l.append(o('').text(S.plainRaw)).html():m&&S.isPgpEncrypted()&&(u=l.append(o('').text(S.plainRaw)).html()),l.empty(),S.isPgpSigned(g),S.isPgpEncrypted(m))):s=!1,r.html(h.linkify(u)).addClass("b-text-part "+(s?"html":"plain")),S.isHtml(!!s),S.hasImages(!!i),S.pgpSignedVerifyStatus(d.SignedVerifyStatus.None),S.pgpSignedVerifyUser(""),S.body=r,S.body&&b.append(S.body),S.storeDataToDom(),n&&S.showInternalImages(!0),S.hasImages()&&this.showImages()&&S.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(S.body),this.hideMessageBodies(),S.body.show(),r&&h.initBlockquoteSwitcher(r)),f.initMessageFlagsFromCache(S),S.unseen()&&p.__RL&&p.__RL.setMessageSeen(S),h.windowResize())},s.prototype.calculateMessageListHash=function(e){return n.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},s.prototype.findPublicKeyByHex=function(e){return n.find(this.openpgpkeysPublic(),function(t){return t&&e===t.id})},s.prototype.findPublicKeysByEmail=function(e){return n.compact(n.map(this.openpgpkeysPublic(),function(t){var s=null;if(t&&e===t.email)try{if(s=i.openpgp.key.readArmored(t.armor),s&&!s.err&&s.keys&&s.keys[0])return s.keys[0]}catch(o){}return null}))},s.prototype.findPrivateKeyByEmail=function(e,t){var s=null,o=n.find(this.openpgpkeysPrivate(),function(t){return t&&e===t.email});if(o)try{s=i.openpgp.key.readArmored(o.armor),s&&!s.err&&s.keys&&s.keys[0]?(s=s.keys[0],s.decrypt(h.pString(t))):s=null}catch(r){s=null}return s},s.prototype.findSelfPrivateKey=function(e){return this.findPrivateKeyByEmail(this.accountEmail(),e)},e.exports=new s}(t,e)},{$:26,$div:15,"../Models/MessageModel.js":48,"./AbstractData.js":67,"./AppSettings.js":68,"./LocalStorage.js":69,"./WebMailCacheStorage.js":73,Consts:6,Enums:7,Globals:9,LinkBuilder:10,NotificationClass:22,Utils:14,_:31,kn:33,ko:28,moment:29,window:32}],75:[function(e,t){!function(e,t){"use strict";function s(){f.call(this,"Right","SystemDropDown"),this.accounts=d.accounts,this.accountEmail=d.accountEmail,this.accountsLoading=d.accountsLoading,this.accountMenuDropdownTrigger=o.observable(!1),this.capaAdditionalAccounts=u.capa(a.Capa.AdditionalAccounts),this.loading=o.computed(function(){return this.accountsLoading()},this),this.accountClick=i.bind(this.accountClick,this)}var i=t("_"),o=t("ko"),n=t("window"),r=t("key"),a=t("Enums"),l=t("Utils"),c=t("LinkBuilder"),u=t("../Storages/AppSettings.js"),d=t("../Storages/WebMailDataStorage.js"),p=t("../Storages/WebMailAjaxRemoteStorage.js"),h=t("../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js"),g=t("../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js"),m=t("kn"),f=t("KnoinAbstractViewModel");i.extend(s.prototype,f.prototype),s.prototype.accountClick=function(e,t){if(e&&t&&!l.isUnd(t.which)&&1===t.which){var s=this;this.accountsLoading(!0),i.delay(function(){s.accountsLoading(!1)},1e3)}return!0},s.prototype.emailTitle=function(){return d.accountEmail()},s.prototype.settingsClick=function(){m.setHash(c.settings())},s.prototype.settingsHelp=function(){m.showScreenPopup(h)},s.prototype.addAccountClick=function(){this.capaAdditionalAccounts&&m.showScreenPopup(g)},s.prototype.logoutClick=function(){var e=t("../Boots/RainLoopApp.js");p.logout(function(){n.__rlah_clear&&n.__rlah_clear(),e.loginAndLogoutReload(!0,u.settingsGet("ParentEmail")&&0-1&&a.eq(n).removeClass("focused"),38===r&&n>0?n--:40===r&&ni)?(this.oContentScrollable.scrollTop(s.top<0?this.oContentScrollable.scrollTop()+s.top-e:this.oContentScrollable.scrollTop()+s.top-i+n+e),!0):!1},s.prototype.messagesDrop=function(e,s){if(e&&s&&s.helper){var i=t("../Boots/RainLoopApp.js"),o=s.helper.data("rl-folder"),n=a.hasClass("rl-ctrl-key-pressed"),r=s.helper.data("rl-uids");l.isNormal(o)&&""!==o&&l.isArray(r)&&i.moveMessagesToFolder(o,r,e.fullNameRaw,n)}},s.prototype.composeClick=function(){S.showScreenPopup(m)},s.prototype.createFolder=function(){S.showScreenPopup(f)},s.prototype.configureFolders=function(){S.setHash(d.settings("folders"))},s.prototype.contactsClick=function(){this.allowContacts&&S.showScreenPopup(b)},e.exports=s}(t,e)},{$:26,$html:17,"../Boots/RainLoopApp.js":4,"../Storages/AppSettings.js":68,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86,"./Popups/PopupsContactsViewModel.js":87,"./Popups/PopupsFolderCreateViewModel.js":90,Enums:7,Globals:9,KnoinAbstractViewModel:36,LinkBuilder:10,Utils:14,key:27,kn:33,ko:28,window:32}],78:[function(e,t){!function(e,t){"use strict";function s(){var e=t("../Boots/RainLoopApp.js");w.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="",this.hideDangerousActions=!!f.settingsGet("HideDangerousActions"),this.popupVisibility=d.popupVisibility,this.message=S.message,this.messageList=S.messageList,this.folderList=S.folderList,this.currentMessage=S.currentMessage,this.isMessageSelected=S.isMessageSelected,this.messageListSearch=S.messageListSearch,this.messageListError=S.messageListError,this.folderMenuForMove=S.folderMenuForMove,this.useCheckboxesInList=S.useCheckboxesInList,this.mainMessageListSearch=S.mainMessageListSearch,this.messageListEndFolder=S.messageListEndFolder,this.messageListChecked=S.messageListChecked,this.messageListCheckedOrSelected=S.messageListCheckedOrSelected,this.messageListCheckedOrSelectedUidsWithSubMails=S.messageListCheckedOrSelectedUidsWithSubMails,this.messageListCompleteLoadingThrottle=S.messageListCompleteLoadingThrottle,p.initOnStartOrLangChange(function(){this.emptySubjectValue=p.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=S.userQuota,this.userUsageSize=S.userUsageSize,this.userUsageProc=S.userUsageProc,this.moveDropdownTrigger=n.observable(!1),this.moreDropdownTrigger=n.observable(!1),this.dragOver=n.observable(!1).extend({throttle:1}),this.dragOverEnter=n.observable(!1).extend({throttle:1}),this.dragOverArea=n.observable(null),this.dragOverBodyArea=n.observable(null),this.messageListItemTemplate=n.computed(function(){return c.Layout.NoPreview!==S.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=n.computed(function(){var e=S.messageListEndSearch();return""===e?"":p.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:e})}),this.messageListPagenator=n.computed(p.computedPagenatorHelper(S.messageListPage,S.messageListPageCount)),this.checkAll=n.computed({read:function(){return 00&&t>0&&e>t},this),this.hasMessages=n.computed(function(){return 01?" ("+(100>e?e:"99+")+")":""},s.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},s.prototype.moveSelectedMessagesToFolder=function(e,s){if(this.canBeMoved()){var i=t("../Boots/RainLoopApp.js");i.moveMessagesToFolder(S.currentFolderFullNameRaw(),S.messageListCheckedOrSelectedUidsWithSubMails(),e,s)}return!1},s.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=p.draggeblePlace(),s=S.messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",S.currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),o.defer(function(){var e=S.messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},s.prototype.onMessageResponse=function(e,t,s){S.hideMessageBodies(),S.messageLoading(!1),c.StorageResultType.Success===e&&t&&t.Result?S.setMessage(t,s):c.StorageResultType.Unload===e?(S.message(null),S.messageError("")):c.StorageResultType.Abort!==e&&(S.message(null),S.messageError(p.getNotification(t&&t.ErrorCode?t.ErrorCode:c.Notification.UnknownError)))},s.prototype.populateMessageBody=function(e){e&&(y.message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?S.messageLoading(!0):p.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},s.prototype.setAction=function(e,s,i){var n=[],r=null,a=0,l=t("../Boots/RainLoopApp.js");if(p.isUnd(i)&&(i=S.messageListChecked()),n=o.map(i,function(e){return e.uid}),""!==e&&00?100>e?e:"99+":""},s.prototype.verifyPgpSignedClearMessage=function(e){e&&e.verifyPgpSignedClearMessage()},s.prototype.decryptPgpEncryptedMessage=function(e){e&&e.decryptPgpEncryptedMessage(this.viewPgpPassword())},s.prototype.readReceipt=function(e){if(e&&""!==e.readReceipt()){g.sendReadReceiptMessage(u.emptyFunction,e.folderFullNameRaw,e.uid,e.readReceipt(),u.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:e.subject()}),u.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":h.accountEmail()})),e.isReadReceipt(!0),p.storeMessageFlagsToCache(e);var s=t("../Boots/RainLoopApp.js");s.reloadFlagsCurrentMessageListAndMessageFromCache()}},e.exports=s}(t,e)},{$:26,$html:17,"../Boots/RainLoopApp.js":4,"../Storages/WebMailAjaxRemoteStorage.js":72,"../Storages/WebMailCacheStorage.js":73,"../Storages/WebMailDataStorage.js":74,"./Popups/PopupsComposeViewModel.js":86,Consts:6,Enums:7,Events:8,Globals:9,KnoinAbstractViewModel:36,Utils:14,key:27,kn:33,ko:28}],80:[function(e,t){!function(e,t){"use strict";function s(){o.call(this),i.constructorEnd(this)}var i=t("kn"),o=t("./AbstractSystemDropDownViewModel.js");i.extendAsViewModel("MailBoxSystemDropDownViewModel",s,o),e.exports=s}(t,e)},{"./AbstractSystemDropDownViewModel.js":75,kn:33}],81:[function(e,t){!function(e,t){"use strict";function s(){c.call(this,"Popups","PopupsAddAccount");var e=t("../../Boots/RainLoopApp.js");this.email=o.observable(""),this.password=o.observable(""),this.emailError=o.observable(!1),this.passwordError=o.observable(!1),this.email.subscribe(function(){this.emailError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=o.observable(!1),this.submitError=o.observable(""),this.emailFocus=o.observable(!1),this.addAccountCommand=r.createCommand(this,function(){return this.emailError(""===r.trim(this.email())),this.passwordError(""===r.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),a.accountAdd(i.bind(function(t,s){this.submitRequest(!1),n.StorageResultType.Success===t&&s&&"AccountAdd"===s.Action?s.Result?(e.accountsAndIdentities(),this.cancelCommand()):s.ErrorCode&&this.submitError(r.getNotification(s.ErrorCode)):this.submitError(r.getNotification(n.Notification.UnknownError))},this),this.email(),"",this.password()),!0)},function(){return!this.submitRequest()}),l.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("Enums"),r=t("Utils"),a=t("../../Storages/WebMailAjaxRemoteStorage.js"),l=t("kn"),c=t("KnoinAbstractViewModel");l.extendAsViewModel("PopupsAddAccountViewModel",s),s.prototype.clearPopup=function(){this.email(""),this.password(""),this.emailError(!1),this.passwordError(!1),this.submitRequest(!1),this.submitError("")},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.emailFocus(!0)},e.exports=s}(t,e)},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,Enums:7,KnoinAbstractViewModel:36,Utils:14,_:31,kn:33,ko:28}],82:[function(e,t){!function(e,t){"use strict";function s(){a.call(this,"Popups","PopupsAddOpenPgpKey");var e=t("../../Boots/RainLoopApp.js");this.key=i.observable(""),this.key.error=i.observable(!1),this.key.focus=i.observable(!1),this.key.subscribe(function(){this.key.error(!1)},this),this.addOpenPgpKeyCommand=o.createCommand(this,function(){var t=30,s=null,i=o.trim(this.key()),r=/[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi,a=n.openpgpKeyring;if(i=i.replace(/[\r\n]([a-zA-Z0-9]{2,}:[^\r\n]+)[\r\n]+([a-zA-Z0-9\/\\+=]{10,})/g,"\n$1!-!N!-!$2").replace(/[\n\r]+/g,"\n").replace(/!-!N!-!/g,"\n\n"),this.key.error(""===i),!a||this.key.error())return!1;for(;;){if(s=r.exec(i),!s||0>t)break;s[0]&&s[1]&&s[2]&&s[1]===s[2]&&("PRIVATE"===s[1]?a.privateKeys.importKey(s[0]):"PUBLIC"===s[1]&&a.publicKeys.importKey(s[0])),t--}return a.store(),e.reloadOpenPgpKeys(),o.delegateRun(this,"cancelCommand"),!0}),r.constructorEnd(this)}var i=t("ko"),o=t("Utils"),n=t("../../Storages/WebMailDataStorage.js"),r=t("kn"),a=t("KnoinAbstractViewModel");r.extendAsViewModel("PopupsAddOpenPgpKeyViewModel",s),s.prototype.clearPopup=function(){this.key(""),this.key.error(!1)},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.key.focus(!0)},e.exports=s}(t,e)},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailDataStorage.js":74,KnoinAbstractViewModel:36,Utils:14,kn:33,ko:28}],83:[function(e,t){!function(e,t){"use strict";function s(){l.call(this,"Popups","PopupsAdvancedSearch"),this.fromFocus=i.observable(!1),this.from=i.observable(""),this.to=i.observable(""),this.subject=i.observable(""),this.text=i.observable(""),this.selectedDateValue=i.observable(-1),this.hasAttachment=i.observable(!1),this.starred=i.observable(!1),this.unseen=i.observable(!1),this.searchCommand=n.createCommand(this,function(){var e=this.buildSearchString();""!==e&&r.mainMessageListSearch(e),this.cancelCommand()}),a.constructorEnd(this)}var i=t("ko"),o=t("moment"),n=t("Utils"),r=t("../../Storages/WebMailDataStorage.js"),a=t("kn"),l=t("KnoinAbstractViewModel");a.extendAsViewModel("PopupsAdvancedSearchViewModel",s),s.prototype.buildSearchStringValue=function(e){return-1"},s.prototype.sendMessageResponse=function(e,t){var s=!1,o="";this.sending(!1),d.StorageResultType.Success===e&&t&&t.Result&&(s=!0,this.modalVisibility()&&h.delegateRun(this,"closeCommand")),this.modalVisibility()&&!s&&(t&&d.Notification.CantSaveMessage===t.ErrorCode?(this.sendSuccessButSaveError(!0),i.alert(h.trim(h.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(o=h.getNotification(t&&t.ErrorCode?t.ErrorCode:d.Notification.CantSendMessage,t&&t.ErrorMessage?t.ErrorMessage:""),this.sendError(!0),i.alert(o||h.getNotification(d.Notification.CantSendMessage)))),this.reloadDraftFolder()},s.prototype.saveMessageResponse=function(e,t){var s=!1,o=null;this.saving(!1),d.StorageResultType.Success===e&&t&&t.Result&&t.Result.NewFolder&&t.Result.NewUid&&(this.bFromDraft&&(o=y.message(),o&&this.draftFolder()===o.folderFullNameRaw&&this.draftUid()===o.uid&&y.message(null)),this.draftFolder(t.Result.NewFolder),this.draftUid(t.Result.NewUid),this.modalVisibility()&&(this.savedTime(i.Math.round((new i.Date).getTime()/1e3)),this.savedOrSendingText(0 "+e;break;default:e=e+"
"+s}return e},s.prototype.editor=function(e){if(e){var t=this;!this.oEditor&&this.composeEditorArea()?n.delay(function(){t.oEditor=new b(t.composeEditorArea(),null,function(){e(t.oEditor)},function(e){t.isHtml(!!e)})},300):this.oEditor&&e(this.oEditor)}},s.prototype.onShow=function(e,t,s,i,r){E.routeOff();var a=this,l="",c="",u="",p="",g="",m=null,f=null,b="",S="",v=[],C={},A=y.accountEmail(),T=y.signature(),F=y.signatureToAll(),M=[],N=null,R=null,L=e||d.ComposeType.Empty,P=function(e,t){for(var s=0,i=e.length,o=[];i>s;s++)o.push(e[s].toLine(!!t));return o.join(", ")};if(t=t||null,t&&h.isNormal(t)&&(R=h.isArray(t)&&1===t.length?t[0]:h.isArray(t)?null:t),null!==A&&(C[A]=!0),this.currentIdentityID(this.findIdentityIdByMessage(L,R)),this.reset(),h.isNonEmptyArray(s)&&this.to(P(s)),""!==L&&R){switch(p=R.fullFormatDateValue(),g=R.subject(),N=R.aDraftInfo,m=o(R.body).clone(),h.removeBlockquoteSwitcher(m),f=m.find("[data-html-editor-font-wrapper=true]"),b=f&&f[0]?f.html():m.html(),L){case d.ComposeType.Empty:break;case d.ComposeType.Reply:this.to(P(R.replyEmails(C))),this.subject(h.replySubjectAdd("Re",g)),this.prepearMessageAttachments(R,L),this.aDraftInfo=["reply",R.uid,R.folderFullNameRaw],this.sInReplyTo=R.sMessageId,this.sReferences=h.trim(this.sInReplyTo+" "+R.sReferences);break;case d.ComposeType.ReplyAll:v=R.replyAllEmails(C),this.to(P(v[0])),this.cc(P(v[1])),this.subject(h.replySubjectAdd("Re",g)),this.prepearMessageAttachments(R,L),this.aDraftInfo=["reply",R.uid,R.folderFullNameRaw],this.sInReplyTo=R.sMessageId,this.sReferences=h.trim(this.sInReplyTo+" "+R.references());break;case d.ComposeType.Forward:this.subject(h.replySubjectAdd("Fwd",g)),this.prepearMessageAttachments(R,L),this.aDraftInfo=["forward",R.uid,R.folderFullNameRaw],this.sInReplyTo=R.sMessageId,this.sReferences=h.trim(this.sInReplyTo+" "+R.sReferences);break;case d.ComposeType.ForwardAsAttachment:this.subject(h.replySubjectAdd("Fwd",g)),this.prepearMessageAttachments(R,L),this.aDraftInfo=["forward",R.uid,R.folderFullNameRaw],this.sInReplyTo=R.sMessageId,this.sReferences=h.trim(this.sInReplyTo+" "+R.sReferences);break;case d.ComposeType.Draft:this.to(P(R.to)),this.cc(P(R.cc)),this.bcc(P(R.bcc)),this.bFromDraft=!0,this.draftFolder(R.folderFullNameRaw),this.draftUid(R.uid),this.subject(g),this.prepearMessageAttachments(R,L),this.aDraftInfo=h.isNonEmptyArray(N)&&3===N.length?N:null,this.sInReplyTo=R.sInReplyTo,this.sReferences=R.sReferences;break;case d.ComposeType.EditAsNew:this.to(P(R.to)),this.cc(P(R.cc)),this.bcc(P(R.bcc)),this.subject(g),this.prepearMessageAttachments(R,L),this.aDraftInfo=h.isNonEmptyArray(N)&&3===N.length?N:null,this.sInReplyTo=R.sInReplyTo,this.sReferences=R.sReferences}switch(L){case d.ComposeType.Reply:case d.ComposeType.ReplyAll:l=R.fromToLine(!1,!0),S=h.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:p,EMAIL:l}),b="
"+S+":"+b+"
";break;case d.ComposeType.Forward:l=R.fromToLine(!1,!0),c=R.toToLine(!1,!0),u=R.ccToLine(!1,!0),b="
"+h.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+h.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+l+"
"+h.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+c+(0 "+h.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+u:"")+"
"+h.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+h.encodeHtml(p)+"
"+h.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+h.encodeHtml(g)+"
"+b;break;case d.ComposeType.ForwardAsAttachment:b=""}F&&""!==T&&d.ComposeType.EditAsNew!==L&&d.ComposeType.Draft!==L&&(b=this.convertSignature(T,P(R.from,!0),b,L)),this.editor(function(e){e.setHtml(b,!1),R.isHtml()||e.modeToggle(!1)})}else d.ComposeType.Empty===L?(this.subject(h.isNormal(i)?""+i:""),b=h.isNormal(r)?""+r:"",F&&""!==T&&(b=this.convertSignature(T,"",h.convertPlainTextToHtml(b),L)),this.editor(function(e){e.setHtml(b,!1),d.EditorDefaultType.Html!==y.editorDefaultType()&&e.modeToggle(!1)})):h.isNonEmptyArray(t)&&n.each(t,function(e){a.addMessageAsAttachment(e)});M=this.getAttachmentsDownloadsForUpload(),h.isNonEmptyArray(M)&&w.messageUploadAttachments(function(e,t){if(d.StorageResultType.Success===e&&t&&t.Result){var s=null,i="";if(!a.viewModelVisibility())for(i in t.Result)t.Result.hasOwnProperty(i)&&(s=a.getAttachmentById(t.Result[i]),s&&s.tempName(i))}else a.setMessageAttachmentFailedDowbloadText()},M),this.triggerForResize()},s.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},s.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},s.prototype.tryToClosePopup=function(){var e=this;E.isPopupVisible(F)||E.showScreenPopup(F,[h.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&h.delegateRun(e,"closeCommand")}])},s.prototype.onBuild=function(){this.initUploader();var e=this,t=null;key("ctrl+q, command+q",d.KeyState.Compose,function(){return e.identitiesDropdownTrigger(!0),!1}),key("ctrl+s, command+s",d.KeyState.Compose,function(){return e.saveCommand(),!1}),key("ctrl+enter, command+enter",d.KeyState.Compose,function(){return e.sendCommand(),!1}),key("esc",d.KeyState.Compose,function(){return e.modalVisibility()&&e.tryToClosePopup(),!1}),l.on("resize",function(){e.triggerForResize()}),this.dropboxEnabled()&&(t=i.document.createElement("script"),t.type="text/javascript",t.src="https://www.dropbox.com/static/api/1/dropins.js",o(t).attr("id","dropboxjs").attr("data-app-key",S.settingsGet("DropboxApiKey")),i.document.body.appendChild(t)),this.driveEnabled()&&o.getScript("https://apis.google.com/js/api.js",function(){i.gapi&&e.driveVisible(!0)})},s.prototype.driveCallback=function(e,t){if(t&&i.XMLHttpRequest&&i.google&&t[i.google.picker.Response.ACTION]===i.google.picker.Action.PICKED&&t[i.google.picker.Response.DOCUMENTS]&&t[i.google.picker.Response.DOCUMENTS][0]&&t[i.google.picker.Response.DOCUMENTS][0].id){var s=this,o=new i.XMLHttpRequest;o.open("GET","https://www.googleapis.com/drive/v2/files/"+t[i.google.picker.Response.DOCUMENTS][0].id),o.setRequestHeader("Authorization","Bearer "+e),o.addEventListener("load",function(){if(o&&o.responseText){var t=c.parse(o.responseText),i=function(e,t,s){e&&e.exportLinks&&(e.exportLinks[t]?(e.downloadUrl=e.exportLinks[t],e.title=e.title+"."+s,e.mimeType=t):e.exportLinks["application/pdf"]&&(e.downloadUrl=e.exportLinks["application/pdf"],e.title=e.title+".pdf",e.mimeType="application/pdf"))};if(t&&!t.downloadUrl&&t.mimeType&&t.exportLinks)switch(t.mimeType.toString().toLowerCase()){case"application/vnd.google-apps.document":i(t,"application/vnd.openxmlformats-officedocument.wordprocessingml.document","docx");break;case"application/vnd.google-apps.spreadsheet":i(t,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsx");break;case"application/vnd.google-apps.drawing":i(t,"image/png","png");break;case"application/vnd.google-apps.presentation":i(t,"application/vnd.openxmlformats-officedocument.presentationml.presentation","pptx");break;default:i(t,"application/pdf","pdf")}t&&t.downloadUrl&&s.addDriveAttachment(t,e)}}),o.send()}},s.prototype.driveCreatePiker=function(e){if(i.gapi&&e&&e.access_token){var t=this;i.gapi.load("picker",{callback:function(){if(i.google&&i.google.picker){var s=(new i.google.picker.PickerBuilder).addView((new i.google.picker.DocsView).setIncludeFolders(!0)).setAppId(S.settingsGet("GoogleClientID")).setOAuthToken(e.access_token).setCallback(n.bind(t.driveCallback,t,e.access_token)).enableFeature(i.google.picker.Feature.NAV_HIDDEN).build();s.setVisible(!0)}}})}},s.prototype.driveOpenPopup=function(){if(i.gapi){var e=this;i.gapi.load("auth",{callback:function(){var t=i.gapi.auth.getToken();t?e.driveCreatePiker(t):i.gapi.auth.authorize({client_id:S.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!0},function(t){if(t&&!t.error){var s=i.gapi.auth.getToken();s&&e.driveCreatePiker(s)}else i.gapi.auth.authorize({client_id:S.settingsGet("GoogleClientID"),scope:"https://www.googleapis.com/auth/drive.readonly",immediate:!1},function(t){if(t&&!t.error){var s=i.gapi.auth.getToken();s&&e.driveCreatePiker(s)}})})}})}},s.prototype.getAttachmentById=function(e){for(var t=this.attachments(),s=0,i=t.length;i>s;s++)if(t[s]&&e===t[s].id)return t[s];return null},s.prototype.initUploader=function(){if(this.composeUploaderButton()){var e={},t=h.pInt(S.settingsGet("AttachmentLimit")),s=new u({action:m.upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",n.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",n.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",n.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",n.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",n.bind(function(t,s,o){var n=null;h.isUnd(e[t])?(n=this.getAttachmentById(t),n&&(e[t]=n)):n=e[t],n&&n.progress(" - "+i.Math.floor(s/o*100)+"%")},this)).on("onSelect",n.bind(function(e,i){this.dragAndDropOver(!1);var o=this,n=h.isUnd(i.FileName)?"":i.FileName.toString(),r=h.isNormal(i.Size)?h.pInt(i.Size):null,a=new C(e,n,r);return a.cancel=function(e){return function(){o.attachments.remove(function(t){return t&&t.id===e}),s&&s.cancel(e)}}(e),this.attachments.push(a),r>0&&t>0&&r>t?(a.error(h.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",n.bind(function(t){var s=null;h.isUnd(e[t])?(s=this.getAttachmentById(t),s&&(e[t]=s)):s=e[t],s&&(s.waiting(!1),s.uploading(!0))},this)).on("onComplete",n.bind(function(t,s,i){var o="",n=null,r=null,a=this.getAttachmentById(t);r=s&&i&&i.Result&&i.Result.Attachment?i.Result.Attachment:null,n=i&&i.Result&&i.Result.ErrorCode?i.Result.ErrorCode:null,null!==n?o=h.getUploadErrorDescByCode(n):r||(o=h.i18n("UPLOAD/ERROR_UNKNOWN")),a&&(""!==o&&00&&o>0&&n>o?(s.uploading(!1),s.error(h.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(w.composeUploadExternals(function(e,t){var i=!1;s.uploading(!1),d.StorageResultType.Success===e&&t&&t.Result&&t.Result[s.id]&&(i=!0,s.tempName(t.Result[s.id])),i||s.error(h.getUploadErrorDescByCode(d.UploadErrorCode.FileNoUploaded))},[e.link]),!0)},s.prototype.addDriveAttachment=function(e,t){var s=this,i=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}},o=h.pInt(S.settingsGet("AttachmentLimit")),n=null,r=e.fileSize?h.pInt(e.fileSize):0;return n=new C(e.downloadUrl,e.title,r),n.fromMessage=!1,n.cancel=i(e.downloadUrl),n.waiting(!1).uploading(!0),this.attachments.push(n),r>0&&o>0&&r>o?(n.uploading(!1),n.error(h.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(w.composeUploadDrive(function(e,t){var s=!1;n.uploading(!1),d.StorageResultType.Success===e&&t&&t.Result&&t.Result[n.id]&&(s=!0,n.tempName(t.Result[n.id][0]),n.size(h.pInt(t.Result[n.id][1]))),s||n.error(h.getUploadErrorDescByCode(d.UploadErrorCode.FileNoUploaded))},e.downloadUrl,t),!0)},s.prototype.prepearMessageAttachments=function(e,t){if(e){var s=this,i=h.isNonEmptyArray(e.attachments())?e.attachments():[],o=0,n=i.length,r=null,a=null,l=!1,c=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}};if(d.ComposeType.ForwardAsAttachment===t)this.addMessageAsAttachment(e);else for(;n>o;o++){switch(a=i[o],l=!1,t){case d.ComposeType.Reply:case d.ComposeType.ReplyAll:l=a.isLinked;break;case d.ComposeType.Forward:case d.ComposeType.Draft:case d.ComposeType.EditAsNew:l=!0}l&&(r=new C(a.download,a.fileName,a.estimatedSize,a.isInline,a.isLinked,a.cid,a.contentLocation),r.fromMessage=!0,r.cancel=c(a.download),r.waiting(!1).uploading(!0),this.attachments.push(r))}}},s.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},s.prototype.setMessageAttachmentFailedDowbloadText=function(){n.each(this.attachments(),function(e){e&&e.fromMessage&&e.waiting(!1).uploading(!1).error(h.getUploadErrorDescByCode(d.UploadErrorCode.FileNoUploaded))},this)},s.prototype.isEmptyForm=function(e){e=h.isUnd(e)?!0:!!e;var t=e?0===this.attachments().length:0===this.attachmentsInReady().length;return 0===this.to().length&&0===this.cc().length&&0===this.bcc().length&&0===this.subject().length&&t&&(!this.oEditor||""===this.oEditor.getData())},s.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),this.subject(""),this.requestReadReceipt(!1),this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.sReferences="",this.sendError(!1),this.sendSuccessButSaveError(!1),this.savedError(!1),this.savedTime(0),this.savedOrSendingText(""),this.emptyToError(!1),this.attachmentsInProcessError(!1),this.showCcAndBcc(!1),this.attachments([]),this.dragAndDropOver(!1),this.dragAndDropVisible(!1),this.draftFolder(""),this.draftUid(""),this.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear(!1)},s.prototype.getAttachmentsDownloadsForUpload=function(){return n.map(n.filter(this.attachments(),function(e){return e&&""===e.tempName()}),function(e){return e.id})},s.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},e.exports=s}(t,e)},{$:26,$window:18,"../../Boots/RainLoopApp.js":4,"../../Models/ComposeAttachmentModel.js":39,"../../Storages/AppSettings.js":68,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74,"./PopupsAskViewModel.js":84,"./PopupsComposeOpenPgpViewModel.js":85,"./PopupsFolderSystemViewModel.js":91,Consts:6,Enums:7,Events:8,Globals:9,JSON:20,Jua:21,KnoinAbstractViewModel:36,LinkBuilder:10,NewHtmlEditorWrapper:11,Utils:14,_:31,kn:33,ko:28,moment:29,window:32}],87:[function(e,t){!function(e,t){"use strict";function s(){C.call(this,"Popups","PopupsContacts");var e=this,o=function(t){t&&0=e?1:e},this),this.contactsPagenator=r.computed(d.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=r.observable(!0),this.viewClearSearch=r.observable(!1),this.viewID=r.observable(""),this.viewReadOnly=r.observable(!1),this.viewProperties=r.observableArray([]),this.viewTags=r.observable(""),this.viewTags.visibility=r.observable(!1),this.viewTags.focusTrigger=r.observable(!1),this.viewTags.focusTrigger.subscribe(function(e){e||""!==this.viewTags()?e&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=r.observable(l.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(e){return-1=i&&(this.bDropPageAfterDelete=!0),n.delay(function(){n.each(o,function(e){t.remove(e)})},500))},s.prototype.deleteSelectedContacts=function(){00?i:0),d.isNonEmptyArray(s.Result.Tags)&&(r=n.map(s.Result.Tags,function(e){var t=new S;return t.parse(e)?t:null}),r=n.compact(r))),t.contactsCount(i),t.contacts(o),t.contacts.loading(!1),t.contactTags(r),t.viewClearSearch(""!==t.search())},s,c.Defaults.ContactsPerPage,this.search())},s.prototype.onBuild=function(e){this.oContentVisible=o(".b-list-content",e),this.oContentScrollable=o(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,l.KeyState.ContactList);var t=this;a("delete",l.KeyState.ContactList,function(){return t.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=r.dataFor(this);e&&(t.contactsPage(d.pInt(e.value)),t.reloadContactList())}),this.initUploader()},s.prototype.onShow=function(){w.routeOff(),this.reloadContactList(!0)},s.prototype.onHide=function(){w.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},e.exports=s}(t,e)},{$:26,"../../Boots/RainLoopApp.js":4,"../../Models/ContactModel.js":40,"../../Models/ContactPropertyModel.js":41,"../../Models/ContactTagModel.js":42,"../../Models/EmailModel.js":43,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,"./PopupsComposeViewModel.js":86,Consts:6,Enums:7,Globals:9,KnoinAbstractViewModel:36,LinkBuilder:10,Selector:13,Utils:14,_:31,key:27,kn:33,ko:28,window:32}],88:[function(e,t){!function(e,t){"use strict";function s(){l.call(this,"Popups","PopupsFilter"),this.filter=i.observable(null),this.selectedFolderValue=i.observable(o.Values.UnuseOptionValue),this.folderSelectList=r.folderMenuForMove,this.defautOptionsAfterRender=n.defautOptionsAfterRender,a.constructorEnd(this)}var i=t("ko"),o=t("Consts"),n=t("Utils"),r=t("../../Storages/WebMailDataStorage.js"),a=t("kn"),l=t("KnoinAbstractViewModel");a.extendAsViewModel("PopupsFilterViewModel",s),s.prototype.clearPopup=function(){},s.prototype.onShow=function(e){this.clearPopup(),this.filter(e)},e.exports=s}(t,e)},{"../../Storages/WebMailDataStorage.js":74,Consts:6,KnoinAbstractViewModel:36,Utils:14,kn:33,ko:28}],89:[function(e,t){!function(e,t){"use strict";function s(){u.call(this,"Popups","PopupsFolderClear");var e=t("../../Boots/RainLoopApp.js");this.selectedFolder=i.observable(null),this.clearingProcess=i.observable(!1),this.clearingError=i.observable(""),this.folderFullNameForClear=i.computed(function(){var e=this.selectedFolder();return e?e.printableFullName():""},this),this.folderNameForClear=i.computed(function(){var e=this.selectedFolder();return e?e.localName():""},this),this.dangerDescHtml=i.computed(function(){return n.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=n.createCommand(this,function(){var t=this,s=this.selectedFolder();s&&(r.message(null),r.messageList([]),this.clearingProcess(!0),a.setFolderHash(s.fullNameRaw,""),l.folderClear(function(s,i){t.clearingProcess(!1),o.StorageResultType.Success===s&&i&&i.Result?(e.reloadMessageList(!0),t.cancelCommand()):t.clearingError(i&&i.ErrorCode?n.getNotification(i.ErrorCode):n.getNotification(o.Notification.MailServerError))},s.fullNameRaw))},function(){var e=this.selectedFolder(),t=this.clearingProcess();return!t&&null!==e}),c.constructorEnd(this)}var i=t("ko"),o=t("Enums"),n=t("Utils"),r=t("../../Storages/WebMailDataStorage.js"),a=t("../../Storages/WebMailCacheStorage.js"),l=t("../../Storages/WebMailAjaxRemoteStorage.js"),c=t("kn"),u=t("KnoinAbstractViewModel");c.extendAsViewModel("PopupsFolderClearViewModel",s),s.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},s.prototype.onShow=function(e){this.clearPopup(),e&&this.selectedFolder(e)},e.exports=s}(t,e)},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailCacheStorage.js":73,"../../Storages/WebMailDataStorage.js":74,Enums:7,KnoinAbstractViewModel:36,Utils:14,kn:33,ko:28}],90:[function(e,t){!function(e,t){"use strict";function s(){u.call(this,"Popups","PopupsFolderCreate"),r.initOnStartOrLangChange(function(){this.sNoParentText=r.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=i.observable(""),this.folderName.focused=i.observable(!1),this.selectedParentValue=i.observable(n.Values.UnuseOptionValue),this.parentFolderSelectList=i.computed(function(){var e=[],t=null,s=null,i=a.folderList(),o=function(e){return e?e.isSystemFolder()?e.name()+" "+e.manageFolderSystemName():e.name():""};return e.push(["",this.sNoParentText]),""!==a.namespace&&(t=function(e){return a.namespace!==e.fullNameRaw.substr(0,a.namespace.length)}),r.folderListOptionsBuilder([],i,[],e,null,t,s,o)},this),this.createFolder=r.createCommand(this,function(){var e=t("../../Boots/RainLoopApp.js"),s=this.selectedParentValue();""===s&&1"),this.submitRequest(!0),o.delay(function(){n=i.openpgp.generateKeyPair({userId:s,numBits:r.pInt(t.keyBitLength()),passphrase:r.trim(t.password())}),n&&n.privateKeyArmored&&(l.privateKeys.importKey(n.privateKeyArmored),l.publicKeys.importKey(n.publicKeyArmored),l.store(),e.reloadOpenPgpKeys(),r.delegateRun(t,"cancelCommand")),t.submitRequest(!1)},100),!0)}),l.constructorEnd(this)}var i=t("window"),o=t("_"),n=t("ko"),r=t("Utils"),a=t("../../Storages/WebMailDataStorage.js"),l=t("kn"),c=t("KnoinAbstractViewModel");l.extendAsViewModel("PopupsGenerateNewOpenPgpKeyViewModel",s),s.prototype.clearPopup=function(){this.name(""),this.password(""),this.email(""),this.email.error(!1),this.keyBitLength(2048)},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.email.focus(!0)},e.exports=s}(t,e)},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailDataStorage.js":74,KnoinAbstractViewModel:36,Utils:14,_:31,kn:33,ko:28,window:32}],93:[function(e,t){!function(e,t){"use strict";function s(){c.call(this,"Popups","PopupsIdentity");var e=t("../../Boots/RainLoopApp.js");this.id="",this.edit=i.observable(!1),this.owner=i.observable(!1),this.email=i.observable("").validateEmail(),this.email.focused=i.observable(!1),this.name=i.observable(""),this.name.focused=i.observable(!1),this.replyTo=i.observable("").validateSimpleEmail(),this.replyTo.focused=i.observable(!1),this.bcc=i.observable("").validateSimpleEmail(),this.bcc.focused=i.observable(!1),this.submitRequest=i.observable(!1),this.submitError=i.observable(""),this.addOrEditIdentityCommand=n.createCommand(this,function(){return this.email.hasError()||this.email.hasError(""===n.trim(this.email())),this.email.hasError()?(this.owner()||this.email.focused(!0),!1):this.replyTo.hasError()?(this.replyTo.focused(!0),!1):this.bcc.hasError()?(this.bcc.focused(!0),!1):(this.submitRequest(!0),a.identityUpdate(_.bind(function(t,s){this.submitRequest(!1),o.StorageResultType.Success===t&&s?s.Result?(e.accountsAndIdentities(),this.cancelCommand()):s.ErrorCode&&this.submitError(n.getNotification(s.ErrorCode)):this.submitError(n.getNotification(o.Notification.UnknownError))},this),this.id,this.email(),this.name(),this.replyTo(),this.bcc()),!0)},function(){return!this.submitRequest()}),this.label=i.computed(function(){return n.i18n("POPUPS_IDENTITIES/"+(this.edit()?"TITLE_UPDATE_IDENTITY":"TITLE_ADD_IDENTITY"))},this),this.button=i.computed(function(){return n.i18n("POPUPS_IDENTITIES/"+(this.edit()?"BUTTON_UPDATE_IDENTITY":"BUTTON_ADD_IDENTITY"))},this),r.constructorEnd(this)}var i=t("ko"),o=t("Enums"),n=t("Utils"),r=t("kn"),a=t("../../Storages/WebMailAjaxRemoteStorage.js"),l=t("../../Storages/WebMailDataStorage.js"),c=t("KnoinAbstractViewModel");r.extendAsViewModel("PopupsIdentityViewModel",s),s.prototype.clearPopup=function(){this.id="",this.edit(!1),this.owner(!1),this.name(""),this.email(""),this.replyTo(""),this.bcc(""),this.email.hasError(!1),this.replyTo.hasError(!1),this.bcc.hasError(!1),this.submitRequest(!1),this.submitError("")},s.prototype.onShow=function(e){this.clearPopup(),e&&(this.edit(!0),this.id=e.id,this.name(e.name()),this.email(e.email()),this.replyTo(e.replyTo()),this.bcc(e.bcc()),this.owner(this.id===l.accountEmail()))},s.prototype.onFocus=function(){this.owner()||this.email.focused(!0)},e.exports=s}(t,e)},{"../../Boots/RainLoopApp.js":4,"../../Storages/WebMailAjaxRemoteStorage.js":72,"../../Storages/WebMailDataStorage.js":74,Enums:7,KnoinAbstractViewModel:36,Utils:14,kn:33,ko:28}],94:[function(e,t){!function(e,t){"use strict";function s(){a.call(this,"Popups","PopupsKeyboardShortcutsHelp"),this.sDefaultKeyScope=n.KeyState.PopupKeyboardShortcutsHelp,r.constructorEnd(this)}var i=t("_"),o=t("key"),n=t("Enums"),r=t("kn"),a=t("KnoinAbstractViewModel");r.extendAsViewModel("PopupsKeyboardShortcutsHelpViewModel",s),s.prototype.onBuild=function(e){o("tab, shift+tab, left, right",n.KeyState.PopupKeyboardShortcutsHelp,i.bind(function(t,s){if(t&&s){var i=e.find(".nav.nav-tabs > li"),o=s&&("tab"===s.shortcut||"right"===s.shortcut),n=i.index(i.filter(".active"));return!o&&n>0?n--:o&&n