diff --git a/dev/Apps/AbstractApp.js b/dev/Apps/AbstractApp.js
index a79777d8b..8525e9886 100644
--- a/dev/Apps/AbstractApp.js
+++ b/dev/Apps/AbstractApp.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,10 +8,10 @@
_ = require('_'),
$ = require('$'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
- Events = require('Events'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
+ Events = require('Common/Events'),
Settings = require('Storage:Settings'),
@@ -74,11 +74,6 @@
return null;
};
- AbstractApp.prototype.setupSettings = function ()
- {
- return true;
- };
-
/**
* @param {string} sLink
* @return {boolean}
@@ -270,4 +265,4 @@
module.exports = AbstractApp;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Apps/AdminApp.js b/dev/Apps/AdminApp.js
index b1e6c7db1..cab11dce3 100644
--- a/dev/Apps/AdminApp.js
+++ b/dev/Apps/AdminApp.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,9 +8,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Data = require('Storage:Admin:Data'),
@@ -44,47 +44,6 @@
return Data;
};
- AdminApp.prototype.setupSettings = function ()
- {
- kn.addSettingsViewModel(require('Settings:Admin:General'),
- 'AdminSettingsGeneral', 'General', 'general', true);
-
- kn.addSettingsViewModel(require('Settings:Admin:Login'),
- 'AdminSettingsLogin', 'Login', 'login');
-
- if (Settings.capa(Enums.Capa.Prem))
- {
- kn.addSettingsViewModel(require('Settings:Admin:Branding'),
- 'AdminSettingsBranding', 'Branding', 'branding');
- }
-
- kn.addSettingsViewModel(require('Settings:Admin:Contacts'),
- 'AdminSettingsContacts', 'Contacts', 'contacts');
-
- kn.addSettingsViewModel(require('Settings:Admin:Domains'),
- 'AdminSettingsDomains', 'Domains', 'domains');
-
- kn.addSettingsViewModel(require('Settings:Admin:Security'),
- 'AdminSettingsSecurity', 'Security', 'security');
-
- kn.addSettingsViewModel(require('Settings:Admin:Social'),
- 'AdminSettingsSocial', 'Social', 'social');
-
- kn.addSettingsViewModel(require('Settings:Admin:Plugins'),
- 'AdminSettingsPlugins', 'Plugins', 'plugins');
-
- kn.addSettingsViewModel(require('Settings:Admin:Packages'),
- 'AdminSettingsPackages', 'Packages', 'packages');
-
- kn.addSettingsViewModel(require('Settings:Admin:Licensing'),
- 'AdminSettingsLicensing', 'Licensing', 'licensing');
-
- kn.addSettingsViewModel(require('Settings:Admin:About'),
- 'AdminSettingsAbout', 'About', 'about');
-
- return true;
- };
-
AdminApp.prototype.reloadDomainList = function ()
{
Data.domainsLoading(true);
@@ -311,4 +270,4 @@
module.exports = new AdminApp();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Apps/RainLoopApp.js b/dev/Apps/RainLoopApp.js
index 21e2f3ece..b94a981d8 100644
--- a/dev/Apps/RainLoopApp.js
+++ b/dev/Apps/RainLoopApp.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,13 +9,13 @@
$ = require('$'),
moment = require('moment'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Consts = require('Consts'),
- Plugins = require('Plugins'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
- Events = require('Events'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Consts = require('Common/Consts'),
+ Plugins = require('Common/Plugins'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
+ Events = require('Common/Events'),
kn = require('App:Knoin'),
@@ -114,78 +114,6 @@
return Data;
};
- RainLoopApp.prototype.setupSettings = function ()
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:General'),
- 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
-
- if (Settings.settingsGet('ContactsIsAllowed'))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Contacts'),
- 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
- }
-
- if (Settings.capa(Enums.Capa.AdditionalAccounts))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Accounts'),
- 'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
- }
-
- if (Settings.capa(Enums.Capa.AdditionalIdentities))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Identities'),
- 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
- }
- else
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Identity'),
- 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
- }
-
- if (Settings.capa(Enums.Capa.Filters))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Filters'),
- 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
- }
-
- if (Settings.capa(Enums.Capa.TwoFactor))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Security'),
- 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
- }
-
- if (Settings.settingsGet('AllowGoogleSocial') ||
- Settings.settingsGet('AllowFacebookSocial') ||
- Settings.settingsGet('AllowTwitterSocial'))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Social'),
- 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
- }
-
- if (Settings.settingsGet('ChangePasswordIsAllowed'))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:ChangePassword'),
- 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
- }
-
- kn.addSettingsViewModel(require('Settings:RainLoop:Folders'),
- 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
-
- if (Settings.capa(Enums.Capa.Themes))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Themes'),
- 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
- }
-
- if (Settings.capa(Enums.Capa.OpenPGP))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:OpenPGP'),
- 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
- }
-
- return true;
- };
-
RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
{
_.each(Data.messageList(), function (oMessage) {
@@ -1372,107 +1300,112 @@
this.folders(_.bind(function (bValue) {
- kn.hideLoading();
-
if (bValue)
{
- if (window.$LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
- {
- window.$LAB.script(window.openpgp ? '' : LinkBuilder.openPgpJs()).wait(function () {
- if (window.openpgp)
+ require.ensure([], function () {
+
+ kn.hideLoading();
+
+ if (window.$LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
+ {
+ window.$LAB.script(window.openpgp ? '' : LinkBuilder.openPgpJs()).wait(function () {
+ if (window.openpgp)
+ {
+ Data.openpgpKeyring = new window.openpgp.Keyring();
+ Data.capaOpenPGP(true);
+
+ Events.pub('openpgp.init');
+
+ self.reloadOpenPgpKeys();
+ }
+ });
+ }
+ else
+ {
+ Data.capaOpenPGP(false);
+ }
+
+ kn.startScreens([
+ require('Screen:RainLoop:MailBox'),
+ require('Screen:RainLoop:Settings'),
+ require('Screen:RainLoop:About')
+ ]);
+
+ if (bGoogle || bFacebook || bTwitter)
+ {
+ self.socialUsers(true);
+ }
+
+ Events.sub('interval.2m', function () {
+ self.folderInformation('INBOX');
+ });
+
+ Events.sub('interval.2m', function () {
+ var sF = Data.currentFolderFullNameRaw();
+ if ('INBOX' !== sF)
{
- Data.openpgpKeyring = new window.openpgp.Keyring();
- Data.capaOpenPGP(true);
-
- Events.pub('openpgp.init');
-
- self.reloadOpenPgpKeys();
+ self.folderInformation(sF);
}
});
- }
- else
- {
- Data.capaOpenPGP(false);
- }
- kn.startScreens([
- require('Screen:RainLoop:MailBox'),
- require('Screen:RainLoop:Settings'),
- require('Screen:RainLoop:About')
- ]);
+ Events.sub('interval.3m', function () {
+ self.folderInformationMultiply();
+ });
- if (bGoogle || bFacebook || bTwitter)
- {
- self.socialUsers(true);
- }
+ Events.sub('interval.5m', function () {
+ self.quota();
+ });
- Events.sub('interval.2m', function () {
- self.folderInformation('INBOX');
- });
+ Events.sub('interval.10m', function () {
+ self.folders();
+ });
- Events.sub('interval.2m', function () {
- var sF = Data.currentFolderFullNameRaw();
- if ('INBOX' !== sF)
+ iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
+ iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
+
+ window.setInterval(function () {
+ self.contactsSync();
+ }, iContactsSyncInterval * 60000 + 5000);
+
+ _.delay(function () {
+ self.contactsSync();
+ }, 5000);
+
+ _.delay(function () {
+ self.folderInformationMultiply(true);
+ }, 500);
+
+ Plugins.runHook('rl-start-user-screens');
+ Events.pub('rl.bootstart-user-screens');
+
+ if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
{
- self.folderInformation(sF);
+ _.delay(function () {
+ try {
+ window.navigator.registerProtocolHandler('mailto',
+ window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
+ '' + (Settings.settingsGet('Title') || 'RainLoop'));
+ } catch(e) {}
+
+ if (Settings.settingsGet('MailToEmail'))
+ {
+ Utils.mailToHelper(Settings.settingsGet('MailToEmail'), require('View:Popup:Compose'));
+ }
+ }, 500);
+ }
+
+ if (!Globals.bMobileDevice)
+ {
+ _.defer(function () {
+ self.initLayoutResizer('#rl-left', '#rl-right', Enums.ClientSideKeyName.FolderListSize);
+ });
}
});
-
- Events.sub('interval.3m', function () {
- self.folderInformationMultiply();
- });
-
- Events.sub('interval.5m', function () {
- self.quota();
- });
-
- Events.sub('interval.10m', function () {
- self.folders();
- });
-
- iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
- iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
-
- window.setInterval(function () {
- self.contactsSync();
- }, iContactsSyncInterval * 60000 + 5000);
-
- _.delay(function () {
- self.contactsSync();
- }, 5000);
-
- _.delay(function () {
- self.folderInformationMultiply(true);
- }, 500);
-
- Plugins.runHook('rl-start-user-screens');
- Events.pub('rl.bootstart-user-screens');
-
- if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
- {
- _.delay(function () {
- try {
- window.navigator.registerProtocolHandler('mailto',
- window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
- '' + (Settings.settingsGet('Title') || 'RainLoop'));
- } catch(e) {}
-
- if (Settings.settingsGet('MailToEmail'))
- {
- Utils.mailToHelper(Settings.settingsGet('MailToEmail'), require('View:Popup:Compose'));
- }
- }, 500);
- }
-
- if (!Globals.bMobileDevice)
- {
- _.defer(function () {
- self.initLayoutResizer('#rl-left', '#rl-right', Enums.ClientSideKeyName.FolderListSize);
- });
- }
}
else
{
+ kn.hideLoading();
+
self.bootstartLoginScreen();
}
@@ -1527,4 +1460,4 @@
module.exports = new RainLoopApp();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Boot.js b/dev/Boot.js
index 4938bc995..7859b25d7 100644
--- a/dev/Boot.js
+++ b/dev/Boot.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -10,18 +10,16 @@
_ = require('_'),
$ = require('$'),
- Globals = require('Globals'),
- Plugins = require('Plugins'),
- Utils = require('Utils'),
- Enums = require('Enums'),
+ Globals = require('Common/Globals'),
+ Plugins = require('Common/Plugins'),
+ Utils = require('Common/Utils'),
+ Enums = require('Common/Enums'),
EmailModel = require('Model:Email')
;
Globals.__APP = App;
- App.setupSettings();
-
Plugins.__boot = App;
Plugins.__remote = App.remote();
Plugins.__data = App.data();
@@ -76,4 +74,4 @@
};
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Base64.js b/dev/Common/Base64.js
index 37758e523..2f0d355a1 100644
--- a/dev/Common/Base64.js
+++ b/dev/Common/Base64.js
@@ -1,7 +1,7 @@
// Base64 encode / decode
// http://www.webtoolkit.info/
-(function (module) {
+(function () {
'use strict';
@@ -168,4 +168,4 @@
module.exports = Base64;
/*jslint bitwise: false*/
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Consts.js b/dev/Common/Consts.js
index c46d1ce8b..f5536279e 100644
--- a/dev/Common/Consts.js
+++ b/dev/Common/Consts.js
@@ -1,5 +1,5 @@
-(function (module) {
+(function () {
'use strict';
diff --git a/dev/Common/Enums.js b/dev/Common/Enums.js
index f26c03bb6..ed0b73545 100644
--- a/dev/Common/Enums.js
+++ b/dev/Common/Enums.js
@@ -1,5 +1,5 @@
-(function (module) {
+(function () {
'use strict';
@@ -427,4 +427,4 @@
module.exports = Enums;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Events.js b/dev/Common/Events.js
index 09ba23f46..b8198fb1f 100644
--- a/dev/Common/Events.js
+++ b/dev/Common/Events.js
@@ -1,13 +1,13 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Utils = require('Utils'),
- Plugins = require('Plugins')
+ Utils = require('Common/Utils'),
+ Plugins = require('Common/Plugins')
;
/**
@@ -62,4 +62,4 @@
module.exports = new Events();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js
index d16aa9c7e..7f4e4f65e 100644
--- a/dev/Common/Globals.js
+++ b/dev/Common/Globals.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -12,7 +12,7 @@
ko = require('ko'),
key = require('key'),
- Enums = require('Enums')
+ Enums = require('Common/Enums')
;
Globals.$win = $(window);
@@ -284,4 +284,4 @@
module.exports = Globals;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/HtmlEditor.js b/dev/Common/HtmlEditor.js
index 8c223c149..b099bb6c7 100644
--- a/dev/Common/HtmlEditor.js
+++ b/dev/Common/HtmlEditor.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,7 +7,7 @@
window = require('window'),
_ = require('_'),
- Globals = require('Globals'),
+ Globals = require('Common/Globals'),
Settings = require('Storage:Settings')
;
@@ -272,4 +272,4 @@
module.exports = HtmlEditor;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/LinkBuilder.js b/dev/Common/LinkBuilder.js
index d76cd7971..428a660da 100644
--- a/dev/Common/LinkBuilder.js
+++ b/dev/Common/LinkBuilder.js
@@ -1,11 +1,10 @@
-(function (module, require) {
+(function () {
'use strict';
var
- window = require('window'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -95,7 +94,7 @@
*/
LinkBuilder.prototype.change = function (sEmail)
{
- return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
+ return this.sServer + '/Change/' + this.sSpecSuffix + '/' + Utils.encodeURIComponent(sEmail) + '/';
};
/**
@@ -131,7 +130,7 @@
*/
LinkBuilder.prototype.avatarLink = function (sEmail)
{
- return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
+ return this.sServer + '/Raw/0/Avatar/' + Utils.encodeURIComponent(sEmail) + '/';
};
/**
@@ -304,7 +303,7 @@
*/
LinkBuilder.prototype.openPgpJs = function ()
{
- return this.sStaticPrefix + 'js/openpgp.min.js';
+ return this.sStaticPrefix + 'js/min/openpgp.js';
};
/**
@@ -333,4 +332,4 @@
module.exports = new LinkBuilder();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Plugins.js b/dev/Common/Plugins.js
index 8c56833d4..da37b5223 100644
--- a/dev/Common/Plugins.js
+++ b/dev/Common/Plugins.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -110,4 +110,4 @@
module.exports = new Plugins();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Selector.js b/dev/Common/Selector.js
index 1f1090232..98e7ff875 100644
--- a/dev/Common/Selector.js
+++ b/dev/Common/Selector.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,8 +9,8 @@
ko = require('ko'),
key = require('key'),
- Enums = require('Enums'),
- Utils = require('Utils')
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils')
;
/**
@@ -726,4 +726,4 @@
module.exports = Selector;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js
index 290ed4679..702b94cc4 100644
--- a/dev/Common/Utils.js
+++ b/dev/Common/Utils.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -11,11 +11,11 @@
$ = require('$'),
ko = require('ko'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals')
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Globals = require('Common/Globals')
;
-
+
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@@ -80,6 +80,15 @@
return Utils.isNormal(mValue) ? '' + mValue : '';
};
+ /**
+ * @param {string} sComponent
+ * @return {string}
+ */
+ Utils.encodeURIComponent = function (sComponent)
+ {
+ return window.encodeURIComponent(sComponent);
+ };
+
/**
* @param {*} aValue
* @return {boolean}
@@ -1929,4 +1938,4 @@
module.exports = Utils;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/External/JSON.js b/dev/External/JSON.js
deleted file mode 100644
index 4a1798c8d..000000000
--- a/dev/External/JSON.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = JSON;
\ No newline at end of file
diff --git a/dev/External/Jua.js b/dev/External/Jua.js
deleted file mode 100644
index 3b736d2d6..000000000
--- a/dev/External/Jua.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = Jua;
\ No newline at end of file
diff --git a/dev/External/crossroads.js b/dev/External/crossroads.js
deleted file mode 100644
index 7c51abb2f..000000000
--- a/dev/External/crossroads.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = crossroads;
\ No newline at end of file
diff --git a/dev/External/hasher.js b/dev/External/hasher.js
deleted file mode 100644
index d090af6a8..000000000
--- a/dev/External/hasher.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = hasher;
\ No newline at end of file
diff --git a/dev/External/ifvisible.js b/dev/External/ifvisible.js
deleted file mode 100644
index c65bee98d..000000000
--- a/dev/External/ifvisible.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = ifvisible;
\ No newline at end of file
diff --git a/dev/External/jquery.js b/dev/External/jquery.js
deleted file mode 100644
index b27a8d9ec..000000000
--- a/dev/External/jquery.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = $;
\ No newline at end of file
diff --git a/dev/External/key.js b/dev/External/key.js
deleted file mode 100644
index 8477df378..000000000
--- a/dev/External/key.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = key;
\ No newline at end of file
diff --git a/dev/External/ko.js b/dev/External/ko.js
index b88740728..fd2cbc7e6 100644
--- a/dev/External/ko.js
+++ b/dev/External/ko.js
@@ -13,8 +13,8 @@
'init': function (oElement, fValueAccessor) {
var
- Globals = require('Globals'),
- Utils = require('Utils')
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils')
;
if (!Globals.bMobileDevice)
@@ -52,7 +52,7 @@
ko.bindingHandlers.tooltip2 = {
'init': function (oElement, fValueAccessor) {
var
- Globals = require('Globals'),
+ Globals = require('Common/Globals'),
$oEl = $(oElement),
sClass = $oEl.data('tooltip-class') || '',
sPlacement = $oEl.data('tooltip-placement') || 'top'
@@ -85,7 +85,7 @@
var
$oEl = $(oElement),
- Globals = require('Globals')
+ Globals = require('Common/Globals')
;
$oEl.tooltip({
@@ -119,7 +119,7 @@
ko.bindingHandlers.registrateBootstrapDropdown = {
'init': function (oElement) {
- var Globals = require('Globals');
+ var Globals = require('Common/Globals');
Globals.aBootstrapDropdowns.push($(oElement));
}
};
@@ -130,7 +130,7 @@
{
var
$el = $(oElement),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
if (!$el.hasClass('open'))
@@ -160,7 +160,7 @@
ko.bindingHandlers.csstext = {
'init': function (oElement, fValueAccessor) {
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
{
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
@@ -171,7 +171,7 @@
}
},
'update': function (oElement, fValueAccessor) {
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
{
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
@@ -239,8 +239,8 @@
'init': function (oElement, fValueAccessor) {
var
- Globals = require('Globals'),
- Utils = require('Utils')
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils')
;
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
@@ -262,14 +262,14 @@
ko.bindingHandlers.i18nInit = {
'init': function (oElement) {
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
Utils.i18nToNode(oElement);
}
};
ko.bindingHandlers.i18nUpdate = {
'update': function (oElement, fValueAccessor) {
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
ko.utils.unwrapObservable(fValueAccessor());
Utils.i18nToNode(oElement);
}
@@ -310,8 +310,8 @@
'update': function (oElement, fValueAccessor) {
var
- Utils = require('Utils'),
- Globals = require('Globals'),
+ Utils = require('Common/Utils'),
+ Globals = require('Common/Globals'),
aValues = ko.utils.unwrapObservable(fValueAccessor()),
iValue = Utils.pInt(aValues[1]),
iSize = 0,
@@ -345,8 +345,8 @@
ko.bindingHandlers.draggable = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
var
- Globals = require('Globals'),
- Utils = require('Utils')
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils')
;
if (!Globals.bMobileDevice)
{
@@ -428,7 +428,7 @@
ko.bindingHandlers.droppable = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
- var Globals = require('Globals');
+ var Globals = require('Common/Globals');
if (!Globals.bMobileDevice)
{
var
@@ -470,7 +470,7 @@
ko.bindingHandlers.nano = {
'init': function (oElement) {
- var Globals = require('Globals');
+ var Globals = require('Common/Globals');
if (!Globals.bDisableNanoScroll)
{
$(oElement)
@@ -567,7 +567,7 @@
'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
var
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
EmailModel = require('Model:Email'),
$oEl = $(oElement),
@@ -641,7 +641,7 @@
'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
var
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
ContactTagModel = require('Model:ContactTag'),
$oEl = $(oElement),
@@ -756,7 +756,7 @@
ko.extenders.trimmer = function (oTarget)
{
var
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
oResult = ko.computed({
'read': oTarget,
'write': function (sNewValue) {
@@ -773,7 +773,7 @@
ko.extenders.posInterer = function (oTarget, iDefault)
{
var
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
oResult = ko.computed({
'read': oTarget,
'write': function (sNewValue) {
@@ -829,7 +829,7 @@
ko.extenders.falseTimeout = function (oTarget, iOption)
{
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
oTarget.iTimeout = 0;
oTarget.subscribe(function (bValue) {
@@ -854,7 +854,7 @@
ko.observable.fn.validateEmail = function ()
{
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
this.hasError = ko.observable(false);
@@ -869,7 +869,7 @@
ko.observable.fn.validateSimpleEmail = function ()
{
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
this.hasError = ko.observable(false);
@@ -884,7 +884,7 @@
ko.observable.fn.validateFunc = function (fFunc)
{
- var Utils = require('Utils');
+ var Utils = require('Common/Utils');
this.hasFuncError = ko.observable(false);
diff --git a/dev/External/moment.js b/dev/External/moment.js
deleted file mode 100644
index 6f58042c2..000000000
--- a/dev/External/moment.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = moment;
\ No newline at end of file
diff --git a/dev/External/ssm.js b/dev/External/ssm.js
deleted file mode 100644
index eb6bc0227..000000000
--- a/dev/External/ssm.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = ssm;
\ No newline at end of file
diff --git a/dev/External/underscore.js b/dev/External/underscore.js
deleted file mode 100644
index e055bcc62..000000000
--- a/dev/External/underscore.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = _;
\ No newline at end of file
diff --git a/dev/External/window.js b/dev/External/window.js
deleted file mode 100644
index 1150c0e0f..000000000
--- a/dev/External/window.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = window;
\ No newline at end of file
diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js
index 3dcd88082..ea089f220 100644
--- a/dev/Knoin/Knoin.js
+++ b/dev/Knoin/Knoin.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -10,9 +10,9 @@
hasher = require('hasher'),
crossroads = require('crossroads'),
- Globals = require('Globals'),
- Plugins = require('Plugins'),
- Utils = require('Utils')
+ Globals = require('Common/Globals'),
+ Plugins = require('Common/Plugins'),
+ Utils = require('Common/Utils')
;
/**
@@ -458,4 +458,4 @@
module.exports = new Knoin();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Knoin/KnoinAbstractBoot.js b/dev/Knoin/KnoinAbstractBoot.js
index 08a39ff17..cda1e7ef1 100644
--- a/dev/Knoin/KnoinAbstractBoot.js
+++ b/dev/Knoin/KnoinAbstractBoot.js
@@ -1,5 +1,5 @@
-(function (module) {
+(function () {
'use strict';
@@ -18,4 +18,4 @@
module.exports = KnoinAbstractBoot;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Knoin/KnoinAbstractScreen.js b/dev/Knoin/KnoinAbstractScreen.js
index 060762b07..f4e6ef515 100644
--- a/dev/Knoin/KnoinAbstractScreen.js
+++ b/dev/Knoin/KnoinAbstractScreen.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,7 +7,7 @@
_ = require('_'),
crossroads = require('crossroads'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -88,4 +88,4 @@
module.exports = KnoinAbstractScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Knoin/KnoinAbstractViewModel.js b/dev/Knoin/KnoinAbstractViewModel.js
index c2067a132..e06e4ca23 100644
--- a/dev/Knoin/KnoinAbstractViewModel.js
+++ b/dev/Knoin/KnoinAbstractViewModel.js
@@ -1,14 +1,14 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals')
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ Globals = require('Common/Globals')
;
/**
@@ -127,4 +127,4 @@
module.exports = KnoinAbstractViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/AccountModel.js b/dev/Models/AccountModel.js
index d1fb95fc9..9f7aba2f4 100644
--- a/dev/Models/AccountModel.js
+++ b/dev/Models/AccountModel.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -33,9 +33,9 @@
*/
AccountModel.prototype.changeAccountLink = function ()
{
- return require('LinkBuilder').change(this.email);
+ return require('Common/LinkBuilder').change(this.email);
};
module.exports = AccountModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/AttachmentModel.js b/dev/Models/AttachmentModel.js
index 3859c5546..adf42549d 100644
--- a/dev/Models/AttachmentModel.js
+++ b/dev/Models/AttachmentModel.js
@@ -1,14 +1,14 @@
-(function (module, require) {
+(function () {
'use strict';
var
window = require('window'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder')
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder')
;
/**
@@ -249,4 +249,4 @@
module.exports = AttachmentModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/ComposeAttachmentModel.js b/dev/Models/ComposeAttachmentModel.js
index 0365f083c..346f67413 100644
--- a/dev/Models/ComposeAttachmentModel.js
+++ b/dev/Models/ComposeAttachmentModel.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -73,4 +73,4 @@
module.exports = ComposeAttachmentModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/ContactModel.js b/dev/Models/ContactModel.js
index 660aa7d66..bf79f5ac3 100644
--- a/dev/Models/ContactModel.js
+++ b/dev/Models/ContactModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder')
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder')
;
/**
@@ -138,4 +138,4 @@
module.exports = ContactModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/ContactPropertyModel.js b/dev/Models/ContactPropertyModel.js
index 283704310..d7f55ed19 100644
--- a/dev/Models/ContactPropertyModel.js
+++ b/dev/Models/ContactPropertyModel.js
@@ -1,13 +1,13 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils')
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils')
;
/**
@@ -39,4 +39,4 @@
module.exports = ContactPropertyModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/ContactTagModel.js b/dev/Models/ContactTagModel.js
index 94ecc3189..0531b1b78 100644
--- a/dev/Models/ContactTagModel.js
+++ b/dev/Models/ContactTagModel.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -55,4 +55,4 @@
module.exports = ContactTagModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/EmailModel.js b/dev/Models/EmailModel.js
index 457012836..bb26edb39 100644
--- a/dev/Models/EmailModel.js
+++ b/dev/Models/EmailModel.js
@@ -1,10 +1,10 @@
-(function (module, require) {
+(function () {
'use strict';
var
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -345,4 +345,4 @@
module.exports = EmailModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/FilterConditionModel.js b/dev/Models/FilterConditionModel.js
index 8b67f4b7e..7bde5f94a 100644
--- a/dev/Models/FilterConditionModel.js
+++ b/dev/Models/FilterConditionModel.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Enums = require('Enums')
+ Enums = require('Common/Enums')
;
/**
@@ -59,4 +59,4 @@
module.exports = FilterConditionModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/FilterModel.js b/dev/Models/FilterModel.js
index 9d236ab01..54f0a26b0 100644
--- a/dev/Models/FilterModel.js
+++ b/dev/Models/FilterModel.js
@@ -1,13 +1,13 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
FilterConditionModel = require('Model:FilterCondition')
;
@@ -91,4 +91,4 @@
module.exports = FilterModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/FolderModel.js b/dev/Models/FolderModel.js
index 5913aca71..f5794ffa7 100644
--- a/dev/Models/FolderModel.js
+++ b/dev/Models/FolderModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,10 +7,10 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Events = require('Events')
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ Events = require('Common/Events')
;
/**
@@ -350,4 +350,4 @@
module.exports = FolderModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/IdentityModel.js b/dev/Models/IdentityModel.js
index e248f5f31..0a8f512a1 100644
--- a/dev/Models/IdentityModel.js
+++ b/dev/Models/IdentityModel.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -47,4 +47,4 @@
module.exports = IdentityModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/MessageModel.js b/dev/Models/MessageModel.js
index 5c4c1ef11..33a380f90 100644
--- a/dev/Models/MessageModel.js
+++ b/dev/Models/MessageModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -10,10 +10,10 @@
ko = require('ko'),
moment = require('moment'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ Globals = require('Common/Globals'),
+ LinkBuilder = require('Common/LinkBuilder'),
EmailModel = require('Model:Email'),
AttachmentModel = require('Model:Attachment')
@@ -1291,4 +1291,4 @@
module.exports = MessageModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Models/OpenPgpKeyModel.js b/dev/Models/OpenPgpKeyModel.js
index 1d5b54919..d2b0abfc2 100644
--- a/dev/Models/OpenPgpKeyModel.js
+++ b/dev/Models/OpenPgpKeyModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -40,4 +40,4 @@
module.exports = OpenPgpKeyModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/AboutScreen.js b/dev/Screens/AboutScreen.js
index 3464768c3..daa60d213 100644
--- a/dev/Screens/AboutScreen.js
+++ b/dev/Screens/AboutScreen.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -29,4 +29,4 @@
module.exports = AboutScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/AbstractSettingsScreen.js b/dev/Screens/AbstractSettingsScreen.js
index 4da910aa5..ee99b7af7 100644
--- a/dev/Screens/AbstractSettingsScreen.js
+++ b/dev/Screens/AbstractSettingsScreen.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,9 +8,9 @@
$ = require('$'),
ko = require('ko'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
kn = require('App:Knoin'),
KnoinAbstractScreen = require('Knoin:AbstractScreen')
@@ -29,10 +29,23 @@
this.oCurrentSubScreen = null;
this.oViewModelPlace = null;
+
+ this.setupSettings();
}
_.extend(AbstractSettingsScreen.prototype, KnoinAbstractScreen.prototype);
+ /**
+ * @param {Function=} fCallback
+ */
+ AbstractSettingsScreen.prototype.setupSettings = function (fCallback)
+ {
+ if (fCallback)
+ {
+ fCallback();
+ }
+ };
+
AbstractSettingsScreen.prototype.onRoute = function (sSubName)
{
var
@@ -196,4 +209,4 @@
module.exports = AbstractSettingsScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/AdminLoginScreen.js b/dev/Screens/AdminLoginScreen.js
index cabd9502c..da90a2001 100644
--- a/dev/Screens/AdminLoginScreen.js
+++ b/dev/Screens/AdminLoginScreen.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -29,4 +29,4 @@
module.exports = AdminLoginScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/AdminSettingsScreen.js b/dev/Screens/AdminSettingsScreen.js
index 751220820..c653f99f0 100644
--- a/dev/Screens/AdminSettingsScreen.js
+++ b/dev/Screens/AdminSettingsScreen.js
@@ -1,11 +1,13 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
+ kn = require('App:Knoin'),
+
AbstractSettings = require('Screen:AbstractSettings')
;
@@ -23,6 +25,50 @@
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
+ /**
+ * @param {Function=} fCallback
+ */
+ AdminSettingsScreen.prototype.setupSettings = function (fCallback)
+ {
+ kn.addSettingsViewModel(require('Settings:Admin:General'),
+ 'AdminSettingsGeneral', 'General', 'general', true);
+
+ kn.addSettingsViewModel(require('Settings:Admin:Login'),
+ 'AdminSettingsLogin', 'Login', 'login');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Branding'),
+ 'AdminSettingsBranding', 'Branding', 'branding');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Contacts'),
+ 'AdminSettingsContacts', 'Contacts', 'contacts');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Domains'),
+ 'AdminSettingsDomains', 'Domains', 'domains');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Security'),
+ 'AdminSettingsSecurity', 'Security', 'security');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Social'),
+ 'AdminSettingsSocial', 'Social', 'social');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Plugins'),
+ 'AdminSettingsPlugins', 'Plugins', 'plugins');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Packages'),
+ 'AdminSettingsPackages', 'Packages', 'packages');
+
+ kn.addSettingsViewModel(require('Settings:Admin:Licensing'),
+ 'AdminSettingsLicensing', 'Licensing', 'licensing');
+
+ kn.addSettingsViewModel(require('Settings:Admin:About'),
+ 'AdminSettingsAbout', 'About', 'about');
+
+ if (fCallback)
+ {
+ fCallback();
+ }
+ };
+
AdminSettingsScreen.prototype.onShow = function ()
{
require('App:Admin').setTitle('');
@@ -30,4 +76,4 @@
module.exports = AdminSettingsScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/LoginScreen.js b/dev/Screens/LoginScreen.js
index 5a61daea2..f809ebf45 100644
--- a/dev/Screens/LoginScreen.js
+++ b/dev/Screens/LoginScreen.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -29,4 +29,4 @@
module.exports = LoginScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/MailBoxScreen.js b/dev/Screens/MailBoxScreen.js
index c6391634b..15bb8c041 100644
--- a/dev/Screens/MailBoxScreen.js
+++ b/dev/Screens/MailBoxScreen.js
@@ -1,15 +1,15 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Events = require('Events'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ Events = require('Common/Events'),
KnoinAbstractScreen = require('Knoin:AbstractScreen'),
@@ -193,4 +193,4 @@
module.exports = MailBoxScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Screens/SettingsScreen.js b/dev/Screens/SettingsScreen.js
index d3c6ddd64..20dbec296 100644
--- a/dev/Screens/SettingsScreen.js
+++ b/dev/Screens/SettingsScreen.js
@@ -1,14 +1,18 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ Globals = require('Common/Globals'),
+
+ Settings = require('Storage:Settings'),
+
+ kn = require('App:Knoin'),
AbstractSettingsScreen = require('Screen:AbstractSettings')
;
@@ -34,6 +38,84 @@
_.extend(SettingsScreen.prototype, AbstractSettingsScreen.prototype);
+ /**
+ * @param {Function=} fCallback
+ */
+ SettingsScreen.prototype.setupSettings = function (fCallback)
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:General'),
+ 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
+
+ if (Settings.settingsGet('ContactsIsAllowed'))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Contacts'),
+ 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
+ }
+
+ if (Settings.capa(Enums.Capa.AdditionalAccounts))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Accounts'),
+ 'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
+ }
+
+ if (Settings.capa(Enums.Capa.AdditionalIdentities))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Identities'),
+ 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
+ }
+ else
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Identity'),
+ 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
+ }
+
+ if (Settings.capa(Enums.Capa.Filters))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Filters'),
+ 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
+ }
+
+ if (Settings.capa(Enums.Capa.TwoFactor))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Security'),
+ 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
+ }
+
+ if (Settings.settingsGet('AllowGoogleSocial') ||
+ Settings.settingsGet('AllowFacebookSocial') ||
+ Settings.settingsGet('AllowTwitterSocial'))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Social'),
+ 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
+ }
+
+ if (Settings.settingsGet('ChangePasswordIsAllowed'))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:ChangePassword'),
+ 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
+ }
+
+ kn.addSettingsViewModel(require('Settings:RainLoop:Folders'),
+ 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
+
+ if (Settings.capa(Enums.Capa.Themes))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:Themes'),
+ 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
+ }
+
+ if (Settings.capa(Enums.Capa.OpenPGP))
+ {
+ kn.addSettingsViewModel(require('Settings:RainLoop:OpenPGP'),
+ 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
+ }
+
+ if (fCallback)
+ {
+ fCallback();
+ }
+ };
+
SettingsScreen.prototype.onShow = function ()
{
this.setSettingsTitle();
@@ -47,4 +129,4 @@
module.exports = SettingsScreen;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsAbout.js b/dev/Settings/Admin/AdminSettingsAbout.js
index 5fb3b61bd..92e3253c7 100644
--- a/dev/Settings/Admin/AdminSettingsAbout.js
+++ b/dev/Settings/Admin/AdminSettingsAbout.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -85,4 +85,4 @@
module.exports = AdminSettingsAbout;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsBranding.js b/dev/Settings/Admin/AdminSettingsBranding.js
index 2986c7ed7..8f9c6c9e7 100644
--- a/dev/Settings/Admin/AdminSettingsBranding.js
+++ b/dev/Settings/Admin/AdminSettingsBranding.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,7 +7,7 @@
_ = require('_'),
ko = require('ko'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -16,7 +16,7 @@
function AdminSettingsBranding()
{
var
- Enums = require('Enums'),
+ Enums = require('Common/Enums'),
Settings = require('Storage:Settings')
;
@@ -88,4 +88,4 @@
module.exports = AdminSettingsBranding;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsContacts.js b/dev/Settings/Admin/AdminSettingsContacts.js
index 9c5673108..d0c25e2c8 100644
--- a/dev/Settings/Admin/AdminSettingsContacts.js
+++ b/dev/Settings/Admin/AdminSettingsContacts.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings')
;
@@ -239,4 +239,4 @@
module.exports = AdminSettingsContacts;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsDomains.js b/dev/Settings/Admin/AdminSettingsDomains.js
index 9f0b83bb8..b14fa0330 100644
--- a/dev/Settings/Admin/AdminSettingsDomains.js
+++ b/dev/Settings/Admin/AdminSettingsDomains.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,7 +8,7 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
+ Enums = require('Common/Enums'),
PopupsDomainViewModel = require('View:Popup:Domain'),
@@ -103,4 +103,4 @@
module.exports = AdminSettingsDomains;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsGeneral.js b/dev/Settings/Admin/AdminSettingsGeneral.js
index 6f68d79f4..b287f371e 100644
--- a/dev/Settings/Admin/AdminSettingsGeneral.js
+++ b/dev/Settings/Admin/AdminSettingsGeneral.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Data = require('Storage:Admin:Data')
@@ -142,4 +142,4 @@
module.exports = AdminSettingsGeneral;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsLicensing.js b/dev/Settings/Admin/AdminSettingsLicensing.js
index 3cb89caa4..c17781c78 100644
--- a/dev/Settings/Admin/AdminSettingsLicensing.js
+++ b/dev/Settings/Admin/AdminSettingsLicensing.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -67,4 +67,4 @@
module.exports = AdminSettingsLicensing;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsLogin.js b/dev/Settings/Admin/AdminSettingsLogin.js
index 45e6545d6..801b7694e 100644
--- a/dev/Settings/Admin/AdminSettingsLogin.js
+++ b/dev/Settings/Admin/AdminSettingsLogin.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings'),
Data = require('Storage:Admin:Data')
@@ -68,4 +68,4 @@
module.exports = AdminSettingsLogin;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsPackages.js b/dev/Settings/Admin/AdminSettingsPackages.js
index 1b066f57b..22a60fc15 100644
--- a/dev/Settings/Admin/AdminSettingsPackages.js
+++ b/dev/Settings/Admin/AdminSettingsPackages.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
window = require('window'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Data = require('Storage:Admin:Data'),
Remote = require('Storage:Admin:Remote')
@@ -110,4 +110,4 @@
module.exports = AdminSettingsPackages;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsPlugins.js b/dev/Settings/Admin/AdminSettingsPlugins.js
index 1c00a8507..8471c21d7 100644
--- a/dev/Settings/Admin/AdminSettingsPlugins.js
+++ b/dev/Settings/Admin/AdminSettingsPlugins.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings'),
Data = require('Storage:Admin:Data'),
@@ -110,4 +110,4 @@
module.exports = AdminSettingsPlugins;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/Admin/AdminSettingsSecurity.js b/dev/Settings/Admin/AdminSettingsSecurity.js
index d4af8eb03..1e882f306 100644
--- a/dev/Settings/Admin/AdminSettingsSecurity.js
+++ b/dev/Settings/Admin/AdminSettingsSecurity.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Data = require('Storage:Admin:Data'),
@@ -133,4 +133,4 @@
module.exports = AdminSettingsSecurity;
-}(module, require));
+}());
diff --git a/dev/Settings/Admin/AdminSettingsSocial.js b/dev/Settings/Admin/AdminSettingsSocial.js
index 304a87c70..7924727df 100644
--- a/dev/Settings/Admin/AdminSettingsSocial.js
+++ b/dev/Settings/Admin/AdminSettingsSocial.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils')
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils')
;
/**
@@ -150,4 +150,4 @@
module.exports = AdminSettingsSocial;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsAccounts.js b/dev/Settings/App/SettingsAccounts.js
index 3903814e7..50ff86c05 100644
--- a/dev/Settings/App/SettingsAccounts.js
+++ b/dev/Settings/App/SettingsAccounts.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,9 +8,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote')
@@ -96,4 +96,4 @@
module.exports = SettingsAccounts;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsChangePassword.js b/dev/Settings/App/SettingsChangePassword.js
index 742657bfc..c11c67353 100644
--- a/dev/Settings/App/SettingsChangePassword.js
+++ b/dev/Settings/App/SettingsChangePassword.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:RainLoop:Remote')
;
@@ -118,4 +118,4 @@
module.exports = SettingsChangePassword;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsContacts.js b/dev/Settings/App/SettingsContacts.js
index 535682357..d0993a438 100644
--- a/dev/Settings/App/SettingsContacts.js
+++ b/dev/Settings/App/SettingsContacts.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:RainLoop:Remote'),
Data = require('Storage:RainLoop:Data')
@@ -55,4 +55,4 @@
module.exports = SettingsContacts;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsFilters.js b/dev/Settings/App/SettingsFilters.js
index c8eeed848..244d3666c 100644
--- a/dev/Settings/App/SettingsFilters.js
+++ b/dev/Settings/App/SettingsFilters.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -39,4 +39,4 @@
module.exports = SettingsFilters;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsFolders.js b/dev/Settings/App/SettingsFolders.js
index e47fa1caf..d505428ec 100644
--- a/dev/Settings/App/SettingsFolders.js
+++ b/dev/Settings/App/SettingsFolders.js
@@ -1,13 +1,13 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings'),
Data = require('Storage:RainLoop:Data'),
@@ -211,4 +211,4 @@
module.exports = SettingsFolders;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsGeneral.js b/dev/Settings/App/SettingsGeneral.js
index 9aea8ffea..74a6b7ca7 100644
--- a/dev/Settings/App/SettingsGeneral.js
+++ b/dev/Settings/App/SettingsGeneral.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,11 +8,11 @@
$ = require('$'),
ko = require('ko'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote')
@@ -175,4 +175,4 @@
module.exports = SettingsGeneral;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsIdentities.js b/dev/Settings/App/SettingsIdentities.js
index 8a824d2bd..d3b1f9edf 100644
--- a/dev/Settings/App/SettingsIdentities.js
+++ b/dev/Settings/App/SettingsIdentities.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- HtmlEditor = require('HtmlEditor'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ HtmlEditor = require('Common/HtmlEditor'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote')
@@ -230,4 +230,4 @@
module.exports = SettingsIdentities;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsIdentity.js b/dev/Settings/App/SettingsIdentity.js
index 47c3f29c2..8c0e1e64e 100644
--- a/dev/Settings/App/SettingsIdentity.js
+++ b/dev/Settings/App/SettingsIdentity.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- HtmlEditor = require('HtmlEditor'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ HtmlEditor = require('Common/HtmlEditor'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote')
@@ -100,4 +100,4 @@
module.exports = SettingsIdentity;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsOpenPGP.js b/dev/Settings/App/SettingsOpenPGP.js
index 8d0e85a7a..3ca65d6ed 100644
--- a/dev/Settings/App/SettingsOpenPGP.js
+++ b/dev/Settings/App/SettingsOpenPGP.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -80,4 +80,4 @@
module.exports = SettingsOpenPGP;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsSecurity.js b/dev/Settings/App/SettingsSecurity.js
index 119050493..18f576e8f 100644
--- a/dev/Settings/App/SettingsSecurity.js
+++ b/dev/Settings/App/SettingsSecurity.js
@@ -1,14 +1,14 @@
-(function (module, require) {
+(function () {
'use strict';
var
ko = require('ko'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:RainLoop:Remote')
;
@@ -163,4 +163,4 @@
module.exports = SettingsSecurity;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsSocial.js b/dev/Settings/App/SettingsSocial.js
index 34ca6018d..1f753d2a5 100644
--- a/dev/Settings/App/SettingsSocial.js
+++ b/dev/Settings/App/SettingsSocial.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,7 +9,7 @@
function SettingsSocial()
{
var
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data')
;
@@ -73,4 +73,4 @@
module.exports = SettingsSocial;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Settings/App/SettingsThemes.js b/dev/Settings/App/SettingsThemes.js
index 8cb5dc07d..bb10a685a 100644
--- a/dev/Settings/App/SettingsThemes.js
+++ b/dev/Settings/App/SettingsThemes.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,9 +9,9 @@
$ = require('$'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote')
@@ -129,4 +129,4 @@
module.exports = SettingsThemes;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/AbstractData.js b/dev/Storages/AbstractData.js
index 8ed4fd3f6..84b2021a9 100644
--- a/dev/Storages/AbstractData.js
+++ b/dev/Storages/AbstractData.js
@@ -1,12 +1,12 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
var
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings')
;
@@ -90,4 +90,4 @@
module.exports = AbstractData;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/AbstractRemoteStorage.js b/dev/Storages/AbstractRemoteStorage.js
index 87d6b0662..356ba6d33 100644
--- a/dev/Storages/AbstractRemoteStorage.js
+++ b/dev/Storages/AbstractRemoteStorage.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -9,12 +9,12 @@
_ = require('_'),
$ = require('$'),
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Plugins = require('Plugins'),
- LinkBuilder = require('LinkBuilder'),
+ Consts = require('Common/Consts'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ Plugins = require('Common/Plugins'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings')
;
@@ -309,4 +309,4 @@
module.exports = AbstractRemoteStorage;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/AdminDataStorage.js b/dev/Storages/AdminDataStorage.js
index f5687482d..eb3d4602d 100644
--- a/dev/Storages/AdminDataStorage.js
+++ b/dev/Storages/AdminDataStorage.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -65,4 +65,4 @@
module.exports = new AdminDataStorage();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/AdminRemoteStorage.js b/dev/Storages/AdminRemoteStorage.js
index e912a05ed..7851551a9 100644
--- a/dev/Storages/AdminRemoteStorage.js
+++ b/dev/Storages/AdminRemoteStorage.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -273,4 +273,4 @@
module.exports = new AdminRemoteStorage();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/CacheStorage.js b/dev/Storages/CacheStorage.js
index 3f040850d..0f52a618f 100644
--- a/dev/Storages/CacheStorage.js
+++ b/dev/Storages/CacheStorage.js
@@ -1,15 +1,15 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings')
;
@@ -346,4 +346,4 @@
module.exports = new CacheStorage();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/DataStorage.js b/dev/Storages/DataStorage.js
index 1696c5485..8e5947c78 100644
--- a/dev/Storages/DataStorage.js
+++ b/dev/Storages/DataStorage.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -11,11 +11,11 @@
ko = require('ko'),
moment = require('moment'),
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Consts = require('Common/Consts'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Cache = require('Storage:RainLoop:Cache'),
@@ -1061,4 +1061,4 @@
module.exports = new DataStorage();
-}(module, require));
+}());
diff --git a/dev/Storages/LocalStorage.js b/dev/Storages/LocalStorage.js
index a6b55584d..8ac649ba4 100644
--- a/dev/Storages/LocalStorage.js
+++ b/dev/Storages/LocalStorage.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -52,4 +52,4 @@
module.exports = new LocalStorage();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/LocalStorages/CookieDriver.js b/dev/Storages/LocalStorages/CookieDriver.js
index 2d2dbc251..5f544245b 100644
--- a/dev/Storages/LocalStorages/CookieDriver.js
+++ b/dev/Storages/LocalStorages/CookieDriver.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -8,8 +8,8 @@
$ = require('$'),
JSON = require('JSON'),
- Consts = require('Consts'),
- Utils = require('Utils')
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils')
;
/**
@@ -97,4 +97,4 @@
module.exports = CookieDriver;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/LocalStorages/LocalStorageDriver.js b/dev/Storages/LocalStorages/LocalStorageDriver.js
index e72aaf6d1..d91217ce3 100644
--- a/dev/Storages/LocalStorages/LocalStorageDriver.js
+++ b/dev/Storages/LocalStorages/LocalStorageDriver.js
@@ -1,6 +1,6 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
@@ -8,8 +8,8 @@
window = require('window'),
JSON = require('JSON'),
- Consts = require('Consts'),
- Utils = require('Utils')
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils')
;
/**
@@ -95,4 +95,4 @@
module.exports = LocalStorageDriver;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/RemoteStorage.js b/dev/Storages/RemoteStorage.js
index aeff1053d..d8b587667 100644
--- a/dev/Storages/RemoteStorage.js
+++ b/dev/Storages/RemoteStorage.js
@@ -1,16 +1,16 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
-
+(function () {
+
'use strict';
var
_ = require('_'),
- Utils = require('Utils'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Base64 = require('Base64'),
+ Utils = require('Common/Utils'),
+ Consts = require('Common/Consts'),
+ Globals = require('Common/Globals'),
+ Base64 = require('Common/Base64'),
Settings = require('Storage:Settings'),
Cache = require('Storage:RainLoop:Cache'),
@@ -811,4 +811,4 @@
module.exports = new RemoteStorage();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/Storages/SettingsStorage.js b/dev/Storages/SettingsStorage.js
index 4f224de9b..9497d3657 100644
--- a/dev/Storages/SettingsStorage.js
+++ b/dev/Storages/SettingsStorage.js
@@ -1,13 +1,13 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-(function (module, require) {
+(function () {
'use strict';
var
window = require('window'),
- Utils = require('Utils')
+ Utils = require('Common/Utils')
;
/**
@@ -52,4 +52,4 @@
module.exports = new SettingsStorage();
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/AboutViewModel.js b/dev/ViewModels/AboutViewModel.js
index 8d2d57d7d..52eea8a1a 100644
--- a/dev/ViewModels/AboutViewModel.js
+++ b/dev/ViewModels/AboutViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -31,4 +31,4 @@
module.exports = AboutViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/AbstractSystemDropDownViewModel.js b/dev/ViewModels/AbstractSystemDropDownViewModel.js
index 41a48c352..9bc69a438 100644
--- a/dev/ViewModels/AbstractSystemDropDownViewModel.js
+++ b/dev/ViewModels/AbstractSystemDropDownViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,9 +9,9 @@
ko = require('ko'),
key = require('key'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Data = require('Storage:RainLoop:Data'),
@@ -117,4 +117,4 @@
module.exports = AbstractSystemDropDownViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/AdminLoginViewModel.js b/dev/ViewModels/AdminLoginViewModel.js
index 174a72449..9d4791a29 100644
--- a/dev/ViewModels/AdminLoginViewModel.js
+++ b/dev/ViewModels/AdminLoginViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:Admin:Remote'),
@@ -118,4 +118,4 @@
module.exports = AdminLoginViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/AdminSettingsMenuViewModel.js b/dev/ViewModels/AdminSettingsMenuViewModel.js
index 8a3435d27..59a4ba430 100644
--- a/dev/ViewModels/AdminSettingsMenuViewModel.js
+++ b/dev/ViewModels/AdminSettingsMenuViewModel.js
@@ -1,12 +1,12 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Globals = require('Globals'),
+ Globals = require('Common/Globals'),
kn = require('App:Knoin'),
KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
@@ -39,4 +39,4 @@
module.exports = AdminSettingsMenuViewModel;
-}(module, require));
+}());
diff --git a/dev/ViewModels/AdminSettingsPaneViewModel.js b/dev/ViewModels/AdminSettingsPaneViewModel.js
index 0c7cbb9fb..7dc933a61 100644
--- a/dev/ViewModels/AdminSettingsPaneViewModel.js
+++ b/dev/ViewModels/AdminSettingsPaneViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -43,4 +43,4 @@
module.exports = AdminSettingsPaneViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/LoginViewModel.js b/dev/ViewModels/LoginViewModel.js
index 707481e5f..b9330a60d 100644
--- a/dev/ViewModels/LoginViewModel.js
+++ b/dev/ViewModels/LoginViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,9 +9,9 @@
$ = require('$'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Data = require('Storage:RainLoop:Data'),
@@ -367,4 +367,4 @@
module.exports = LoginViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/MailBoxFolderListViewModel.js b/dev/ViewModels/MailBoxFolderListViewModel.js
index 8e04428f3..215587556 100644
--- a/dev/ViewModels/MailBoxFolderListViewModel.js
+++ b/dev/ViewModels/MailBoxFolderListViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -10,10 +10,10 @@
ko = require('ko'),
key = require('key'),
- Utils = require('Utils'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- LinkBuilder = require('LinkBuilder'),
+ Utils = require('Common/Utils'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ LinkBuilder = require('Common/LinkBuilder'),
Settings = require('Storage:Settings'),
Cache = require('Storage:RainLoop:Cache'),
@@ -271,4 +271,4 @@
module.exports = MailBoxFolderListViewModel;
-}(module, require));
+}());
diff --git a/dev/ViewModels/MailBoxMessageListViewModel.js b/dev/ViewModels/MailBoxMessageListViewModel.js
index 1c5c318bc..53d974f9c 100644
--- a/dev/ViewModels/MailBoxMessageListViewModel.js
+++ b/dev/ViewModels/MailBoxMessageListViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -11,13 +11,13 @@
Jua = require('Jua'),
ifvisible = require('ifvisible'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
- Events = require('Events'),
- Selector = require('Selector'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ LinkBuilder = require('Common/LinkBuilder'),
+ Events = require('Common/Events'),
+ Selector = require('Common/Selector'),
Settings = require('Storage:Settings'),
Cache = require('Storage:RainLoop:Cache'),
@@ -932,4 +932,4 @@
module.exports = MailBoxMessageListViewModel;
-}(module, require));
+}());
diff --git a/dev/ViewModels/MailBoxMessageViewViewModel.js b/dev/ViewModels/MailBoxMessageViewViewModel.js
index 6d70588ef..c91d7ade2 100644
--- a/dev/ViewModels/MailBoxMessageViewViewModel.js
+++ b/dev/ViewModels/MailBoxMessageViewViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,11 +9,11 @@
ko = require('ko'),
key = require('key'),
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Events = require('Events'),
+ Consts = require('Common/Consts'),
+ Enums = require('Common/Enums'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ Events = require('Common/Events'),
Cache = require('Storage:RainLoop:Cache'),
Data = require('Storage:RainLoop:Data'),
@@ -719,4 +719,4 @@
module.exports = MailBoxMessageViewViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/MailBoxSystemDropDownViewModel.js b/dev/ViewModels/MailBoxSystemDropDownViewModel.js
index ab3d09de0..09d715b7e 100644
--- a/dev/ViewModels/MailBoxSystemDropDownViewModel.js
+++ b/dev/ViewModels/MailBoxSystemDropDownViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -25,4 +25,4 @@
module.exports = MailBoxSystemDropDownViewModel;
-}(module, require));
+}());
diff --git a/dev/ViewModels/Popups/PopupsActivateViewModel.js b/dev/ViewModels/Popups/PopupsActivateViewModel.js
index 76d24d69c..6c9f3afb7 100644
--- a/dev/ViewModels/Popups/PopupsActivateViewModel.js
+++ b/dev/ViewModels/Popups/PopupsActivateViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings'),
Data = require('Storage:Admin:Data'),
@@ -138,4 +138,4 @@
module.exports = PopupsActivateViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsAddAccountViewModel.js b/dev/ViewModels/Popups/PopupsAddAccountViewModel.js
index 930ef39e3..94c035783 100644
--- a/dev/ViewModels/Popups/PopupsAddAccountViewModel.js
+++ b/dev/ViewModels/Popups/PopupsAddAccountViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:RainLoop:Remote'),
@@ -113,4 +113,4 @@
module.exports = PopupsAddAccountViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js b/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js
index 4f7b87760..d8ef0344a 100644
--- a/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js
+++ b/dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,7 +7,7 @@
_ = require('_'),
ko = require('ko'),
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data'),
@@ -107,4 +107,4 @@
module.exports = PopupsAddOpenPgpKeyViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js b/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js
index fcac81fdf..df6aabdcb 100644
--- a/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js
+++ b/dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,7 +8,7 @@
ko = require('ko'),
moment = require('moment'),
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data'),
@@ -155,4 +155,4 @@
module.exports = PopupsAdvancedSearchViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsAskViewModel.js b/dev/ViewModels/Popups/PopupsAskViewModel.js
index 1a6134522..166bb48af 100644
--- a/dev/ViewModels/Popups/PopupsAskViewModel.js
+++ b/dev/ViewModels/Popups/PopupsAskViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,8 +8,8 @@
ko = require('ko'),
key = require('key'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
kn = require('App:Knoin'),
KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
@@ -128,4 +128,4 @@
module.exports = PopupsAskViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js b/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js
index 4b3bdc3aa..2e7d531f9 100644
--- a/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js
+++ b/dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -9,8 +9,8 @@
ko = require('ko'),
key = require('key'),
- Utils = require('Utils'),
- Enums = require('Enums'),
+ Utils = require('Common/Utils'),
+ Enums = require('Common/Enums'),
Data = require('Storage:RainLoop:Data'),
@@ -262,4 +262,4 @@
module.exports = PopupsComposeOpenPgpViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsComposeViewModel.js b/dev/ViewModels/Popups/PopupsComposeViewModel.js
index f8e8d5c29..df419f739 100644
--- a/dev/ViewModels/Popups/PopupsComposeViewModel.js
+++ b/dev/ViewModels/Popups/PopupsComposeViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -12,13 +12,13 @@
JSON = require('JSON'),
Jua = require('Jua'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
- Globals = require('Globals'),
- Events = require('Events'),
- LinkBuilder = require('LinkBuilder'),
- HtmlEditor = require('HtmlEditor'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils'),
+ Globals = require('Common/Globals'),
+ Events = require('Common/Events'),
+ LinkBuilder = require('Common/LinkBuilder'),
+ HtmlEditor = require('Common/HtmlEditor'),
Settings = require('Storage:Settings'),
Data = require('Storage:RainLoop:Data'),
@@ -1787,4 +1787,4 @@
module.exports = PopupsComposeViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsContactsViewModel.js b/dev/ViewModels/Popups/PopupsContactsViewModel.js
index 415fd0c09..1af7befeb 100644
--- a/dev/ViewModels/Popups/PopupsContactsViewModel.js
+++ b/dev/ViewModels/Popups/PopupsContactsViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -10,12 +10,12 @@
ko = require('ko'),
key = require('key'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Selector = require('Selector'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Globals = require('Common/Globals'),
+ Utils = require('Common/Utils'),
+ Selector = require('Common/Selector'),
+ LinkBuilder = require('Common/LinkBuilder'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote'),
@@ -778,4 +778,4 @@
module.exports = PopupsContactsViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsDomainViewModel.js b/dev/ViewModels/Popups/PopupsDomainViewModel.js
index 89bfae193..19713affb 100644
--- a/dev/ViewModels/Popups/PopupsDomainViewModel.js
+++ b/dev/ViewModels/Popups/PopupsDomainViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:Admin:Remote'),
@@ -315,4 +315,4 @@
module.exports = PopupsDomainViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsFilterViewModel.js b/dev/ViewModels/Popups/PopupsFilterViewModel.js
index 63921bcd7..999ecac69 100644
--- a/dev/ViewModels/Popups/PopupsFilterViewModel.js
+++ b/dev/ViewModels/Popups/PopupsFilterViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Consts = require('Consts'),
- Utils = require('Utils'),
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data'),
@@ -50,4 +50,4 @@
module.exports = PopupsFilterViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsFolderClearViewModel.js b/dev/ViewModels/Popups/PopupsFolderClearViewModel.js
index 94dda63a3..449dffb9d 100644
--- a/dev/ViewModels/Popups/PopupsFolderClearViewModel.js
+++ b/dev/ViewModels/Popups/PopupsFolderClearViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data'),
Cache = require('Storage:RainLoop:Cache'),
@@ -121,4 +121,4 @@
module.exports = PopupsFolderClearViewModel;
-}(module, require));
+}());
diff --git a/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js b/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js
index 41278d32d..a2bfec538 100644
--- a/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js
+++ b/dev/ViewModels/Popups/PopupsFolderCreateViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data'),
Remote = require('Storage:RainLoop:Remote'),
@@ -129,4 +129,4 @@
module.exports = PopupsFolderCreateViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js b/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js
index 2189386ae..9c8dca18f 100644
--- a/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js
+++ b/dev/ViewModels/Popups/PopupsFolderSystemViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,9 +7,9 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Consts = require('Common/Consts'),
+ Utils = require('Common/Utils'),
Settings = require('Storage:Settings'),
Data = require('Storage:RainLoop:Data'),
@@ -133,4 +133,4 @@
module.exports = PopupsFolderSystemViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsIdentityViewModel.js b/dev/ViewModels/Popups/PopupsIdentityViewModel.js
index 9bf754f4e..6e3f823fc 100644
--- a/dev/ViewModels/Popups/PopupsIdentityViewModel.js
+++ b/dev/ViewModels/Popups/PopupsIdentityViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:RainLoop:Remote'),
Data = require('Storage:RainLoop:Data'),
@@ -168,4 +168,4 @@
module.exports = PopupsIdentityViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js b/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js
index 18d34adb5..f28200b11 100644
--- a/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js
+++ b/dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,7 +7,7 @@
_ = require('_'),
key = require('key'),
- Enums = require('Enums'),
+ Enums = require('Common/Enums'),
kn = require('App:Knoin'),
KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
@@ -61,4 +61,4 @@
module.exports = PopupsKeyboardShortcutsHelpViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsLanguagesViewModel.js b/dev/ViewModels/Popups/PopupsLanguagesViewModel.js
index 435757623..48543f7a9 100644
--- a/dev/ViewModels/Popups/PopupsLanguagesViewModel.js
+++ b/dev/ViewModels/Popups/PopupsLanguagesViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Utils = require('Utils'),
- Globals = require('Globals'),
+ Utils = require('Common/Utils'),
+ Globals = require('Common/Globals'),
kn = require('App:Knoin'),
KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
@@ -79,4 +79,4 @@
module.exports = PopupsLanguagesViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsNewOpenPgpKeyViewModel.js b/dev/ViewModels/Popups/PopupsNewOpenPgpKeyViewModel.js
index 9332340d8..1c46ba562 100644
--- a/dev/ViewModels/Popups/PopupsNewOpenPgpKeyViewModel.js
+++ b/dev/ViewModels/Popups/PopupsNewOpenPgpKeyViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,7 +8,7 @@
_ = require('_'),
ko = require('ko'),
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
Data = require('Storage:RainLoop:Data'),
@@ -113,4 +113,4 @@
module.exports = PopupsNewOpenPgpKeyViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsPluginViewModel.js b/dev/ViewModels/Popups/PopupsPluginViewModel.js
index 150ae09b2..24c181b0d 100644
--- a/dev/ViewModels/Popups/PopupsPluginViewModel.js
+++ b/dev/ViewModels/Popups/PopupsPluginViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -8,8 +8,8 @@
ko = require('ko'),
key = require('key'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:Admin:Remote'),
@@ -166,4 +166,4 @@
module.exports = PopupsPluginViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js b/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js
index 3b23f7f73..cd6edf5f7 100644
--- a/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js
+++ b/dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
ko = require('ko'),
- Enums = require('Enums'),
- Utils = require('Utils'),
+ Enums = require('Common/Enums'),
+ Utils = require('Common/Utils'),
Remote = require('Storage:RainLoop:Remote'),
@@ -73,4 +73,4 @@
module.exports = PopupsTwoFactorTestViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js b/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js
index 3e3079d24..f97330e25 100644
--- a/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js
+++ b/dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,7 +7,7 @@
_ = require('_'),
ko = require('ko'),
- Utils = require('Utils'),
+ Utils = require('Common/Utils'),
kn = require('App:Knoin'),
KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
@@ -56,4 +56,4 @@
module.exports = PopupsViewOpenPgpKeyViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/SettingsMenuViewModel.js b/dev/ViewModels/SettingsMenuViewModel.js
index f756d1cc2..eeb4b6f90 100644
--- a/dev/ViewModels/SettingsMenuViewModel.js
+++ b/dev/ViewModels/SettingsMenuViewModel.js
@@ -1,13 +1,13 @@
-(function (module, require) {
+(function () {
'use strict';
var
_ = require('_'),
- Globals = require('Globals'),
- LinkBuilder = require('LinkBuilder'),
+ Globals = require('Common/Globals'),
+ LinkBuilder = require('Common/LinkBuilder'),
kn = require('App:Knoin'),
KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
@@ -45,4 +45,4 @@
module.exports = SettingsMenuViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/SettingsPaneViewModel.js b/dev/ViewModels/SettingsPaneViewModel.js
index 86ca294e5..b48720613 100644
--- a/dev/ViewModels/SettingsPaneViewModel.js
+++ b/dev/ViewModels/SettingsPaneViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -7,8 +7,8 @@
_ = require('_'),
key = require('key'),
- Enums = require('Enums'),
- LinkBuilder = require('LinkBuilder'),
+ Enums = require('Common/Enums'),
+ LinkBuilder = require('Common/LinkBuilder'),
Data = require('Storage:RainLoop:Data'),
@@ -50,4 +50,4 @@
module.exports = SettingsPaneViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/dev/ViewModels/SettingsSystemDropDownViewModel.js b/dev/ViewModels/SettingsSystemDropDownViewModel.js
index 3a79515c4..7c8adf4c4 100644
--- a/dev/ViewModels/SettingsSystemDropDownViewModel.js
+++ b/dev/ViewModels/SettingsSystemDropDownViewModel.js
@@ -1,5 +1,5 @@
-(function (module, require) {
+(function () {
'use strict';
@@ -25,4 +25,4 @@
module.exports = SettingsSystemDropDownViewModel;
-}(module, require));
\ No newline at end of file
+}());
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 3547da056..9acef14a2 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -20,8 +20,7 @@ var
},
uglify: {
mangle: true,
- compress: true,
- preserveComments: 'some'
+ compress: true
}
},
@@ -32,6 +31,7 @@ var
header = require('gulp-header'),
footer = require('gulp-footer'),
rename = require('gulp-rename'),
+ replace = require('gulp-replace'),
uglify = require('gulp-uglify'),
gutil = require('gulp-util')
;
@@ -69,6 +69,7 @@ function renameFileWothMd5Hash(sFile)
cfg.paths.globjs = 'dev/**/*.js';
cfg.paths.staticJS = 'rainloop/v/' + cfg.devVersion + '/static/js/';
+cfg.paths.staticMinJS = 'rainloop/v/' + cfg.devVersion + '/static/js/min/';
cfg.paths.staticCSS = 'rainloop/v/' + cfg.devVersion + '/static/css/';
cfg.paths.less = {
@@ -111,13 +112,13 @@ cfg.paths.js = {
]
},
openpgp: {
- name: 'openpgp.min.js',
+ name: 'openpgp.js',
src: [
'vendors/openpgp/openpgp-0.7.2.min.js'
]
},
encrypt: {
- name: '_encrypt.min.js',
+ name: 'bundle.js',
header: '(function (window) {',
footer: '}(window));',
dest: 'vendors/jsbn/',
@@ -126,7 +127,7 @@ cfg.paths.js = {
'vendors/jsbn/prng4.js',
'vendors/jsbn/rng.js',
'vendors/jsbn/rsa.js',
- 'vendors/jsbn/_fix.js'
+ 'vendors/jsbn/fix.js'
]
},
libs: {
@@ -153,13 +154,16 @@ cfg.paths.js = {
'vendors/knockout-projections/knockout-projections-1.0.0.min.js',
'vendors/ssm/ssm.min.js',
'vendors/jua/jua.min.js',
- 'vendors/jsbn/_encrypt.min.js',
+ 'vendors/jsbn/bundle.js',
'vendors/keymaster/keymaster.js',
'vendors/ifvisible/ifvisible.min.js',
'vendors/jquery-magnific-popup/jquery.magnific-popup.min.js',
'vendors/bootstrap/js/bootstrap.min.js'
]
},
+ common: {
+ name: 'common.js'
+ },
app: {
name: 'app.js'
},
@@ -211,7 +215,7 @@ gulp.task('css:main:min', ['css:main'], function() {
gulp.task('js:boot', function() {
return gulp.src(cfg.paths.js.boot.src)
.pipe(concat(cfg.paths.js.boot.name))
- .pipe(gulp.dest(cfg.paths.staticJS));
+ .pipe(gulp.dest(cfg.paths.staticMinJS));
});
gulp.task('js:encrypt', function() {
@@ -220,65 +224,69 @@ gulp.task('js:encrypt', function() {
.pipe(header(cfg.paths.js.encrypt.header || ''))
.pipe(footer(cfg.paths.js.encrypt.footer || ''))
.pipe(uglify(cfg.uglify))
- .pipe(gulp.dest(cfg.paths.js.encrypt.dest || cfg.paths.staticJS))
+ .pipe(gulp.dest(cfg.paths.js.encrypt.dest))
.on('error', gutil.log);
});
gulp.task('js:openpgp', function() {
return gulp.src(cfg.paths.js.openpgp.src)
.pipe(rename(cfg.paths.js.openpgp.name))
- .pipe(gulp.dest(cfg.paths.staticJS));
+ .pipe(gulp.dest(cfg.paths.staticMinJS));
});
-gulp.task('js:libs', function() {
+gulp.task('js:libs', ['js:encrypt'], function() {
return gulp.src(cfg.paths.js.libs.src)
.pipe(concat(cfg.paths.js.libs.name, {separator: '\n\n'}))
- .pipe(gulp.dest(cfg.paths.staticJS));
+ .pipe(gulp.dest(cfg.paths.staticMinJS));
});
-gulp.task('js:app', function() {
-
+gulp.task('js:webpack:clear', function() {
+ return gulp.src([cfg.paths.staticJS + '*.chunk.js', cfg.paths.staticMinJS + '*.chunk.js'], {read: false})
+ .pipe(require('gulp-rimraf')());
+});
+gulp.task('js:webpack', ['js:webpack:clear'], function(callback) {
var
- browserify = require('browserify'),
-// exorcist = require('exorcist'),
- source = require('vinyl-source-stream'),
- buffer = require('vinyl-buffer')
+ webpack = require('webpack'),
+ webpackCfg = require('./webpack.config.js')
;
- return browserify({
- 'basedir': './dev/',
- 'entries': './RainLoop.js',
- 'detectGlobals': false,
- 'debug': false
- })
- .bundle()
-// .pipe(exorcist(cfg.paths.staticJS + cfg.paths.js.app.name + '.map'))
- .pipe(source(cfg.paths.js.app.name))
- .pipe(buffer())
+ if (webpackCfg && webpackCfg.output)
+ {
+ webpackCfg.output.publicPath = cfg.paths.staticJS;
+ }
+
+ webpack(webpackCfg, function(err, stats) {
+ if (err) {
+ throw new gutil.PluginError('webpack', err);
+ }
+ gutil.log('[webpack]', stats.toString({}));
+ callback();
+ });
+});
+
+gulp.task('js:app', ['js:webpack'], function() {
+ return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name)
.pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
.pipe(gulp.dest(cfg.paths.staticJS))
.on('error', gutil.log);
});
-gulp.task('js:admin', function() {
+gulp.task('js:admin', ['js:webpack'], function() {
+ return gulp.src(cfg.paths.staticJS + cfg.paths.js.admin.name)
+ .pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
+ .pipe(gulp.dest(cfg.paths.staticJS))
+ .on('error', gutil.log);
+});
- var
- browserify = require('browserify'),
-// exorcist = require('exorcist'),
- source = require('vinyl-source-stream'),
- buffer = require('vinyl-buffer')
- ;
+gulp.task('js:common', ['js:webpack'], function() {
+ return gulp.src(cfg.paths.staticJS + cfg.paths.js.common.name)
+ .pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
+ .pipe(gulp.dest(cfg.paths.staticJS))
+ .on('error', gutil.log);
+});
- return browserify({
- 'basedir': './dev/',
- 'entries': './Admin.js',
- 'detectGlobals': false,
- 'debug': false
- })
- .bundle()
-// .pipe(exorcist(cfg.paths.staticJS + cfg.paths.js.admin.name + '.map'))
- .pipe(source(cfg.paths.js.admin.name))
- .pipe(buffer())
+gulp.task('js:chunks', ['js:webpack'], function() {
+ return gulp.src(cfg.paths.staticJS + '*.chunk.js')
.pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
.pipe(gulp.dest(cfg.paths.staticJS))
.on('error', gutil.log);
@@ -288,18 +296,37 @@ gulp.task('js:admin', function() {
gulp.task('js:app:min', ['js:app'], function() {
return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name)
.pipe(uglify(cfg.uglify))
- .pipe(rename({suffix: '.min'}))
+// .pipe(rename({suffix: '.min'}))
.pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
- .pipe(gulp.dest(cfg.paths.staticJS))
+ .pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log);
});
gulp.task('js:admin:min', ['js:admin'], function() {
return gulp.src(cfg.paths.staticJS + cfg.paths.js.admin.name)
.pipe(uglify(cfg.uglify))
- .pipe(rename({suffix: '.min'}))
+// .pipe(rename({suffix: '.min'}))
.pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
- .pipe(gulp.dest(cfg.paths.staticJS))
+ .pipe(gulp.dest(cfg.paths.staticMinJS))
+ .on('error', gutil.log);
+});
+
+gulp.task('js:common:min', ['js:common'], function() {
+ return gulp.src(cfg.paths.staticJS + cfg.paths.js.common.name)
+ .pipe(uglify(cfg.uglify))
+// .pipe(rename({suffix: '.min'}))
+ .pipe(replace(/rainloop\/v\/([^\/]+)\/static\/js\//g, 'rainloop/v/$1/static/js/min/'))
+ .pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
+ .pipe(gulp.dest(cfg.paths.staticMinJS))
+ .on('error', gutil.log);
+});
+
+gulp.task('js:chunks:min', ['js:chunks'], function() {
+ return gulp.src(cfg.paths.staticJS + '*.chunk.js')
+ .pipe(uglify(cfg.uglify))
+// .pipe(rename({suffix: '.min'}))
+ .pipe(header('/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */\n'))
+ .pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log);
});
@@ -462,8 +489,8 @@ gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:ownclo
});
// MAIN
-gulp.task('default', [ 'js:libs', 'js:boot', 'js:encrypt', 'js:openpgp', 'js:lint', 'js:app:min', 'js:admin:min', 'css:main:min']);
-gulp.task('fast', ['js:app', 'js:admin', 'css:main']);
+gulp.task('default', [ 'js:libs', 'js:boot', 'js:encrypt', 'js:openpgp', 'js:lint', 'js:app:min', 'js:admin:min', 'js:common:min', 'js:chunks:min', 'css:main:min']);
+gulp.task('fast', ['js:app', 'js:admin', 'js:common', 'js:chunks', 'css:main']);
gulp.task('rainloop', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip', 'rainloop:md5', 'rainloop:clean']);
gulp.task('rainloop+', ['rainloop', 'package-inc-release']);
diff --git a/package.json b/package.json
index f7a3b7ecd..e88dc6e28 100644
--- a/package.json
+++ b/package.json
@@ -40,152 +40,12 @@
"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",
-
- "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",
- "HtmlEditor": "./dev/Common/HtmlEditor.js",
-
- "Knoin:AbstractBoot": "./dev/Knoin/KnoinAbstractBoot.js",
- "Knoin:AbstractScreen": "./dev/Knoin/KnoinAbstractScreen.js",
- "Knoin:AbstractViewModel": "./dev/Knoin/KnoinAbstractViewModel.js",
-
- "App:Boot": "./dev/Boot.js",
- "App:Knoin": "./dev/Knoin/Knoin.js",
- "App:Abstract": "./dev/Apps/AbstractApp.js",
- "App:RainLoop": "./dev/Apps/RainLoopApp.js",
- "App:Admin": "./dev/Apps/AdminApp.js",
-
- "Model:Account": "./dev/Models/AccountModel.js",
- "Model:Attachment": "./dev/Models/AttachmentModel.js",
- "Model:ComposeAttachment": "./dev/Models/ComposeAttachmentModel.js",
- "Model:Contact": "./dev/Models/ContactModel.js",
- "Model:ContactProperty": "./dev/Models/ContactPropertyModel.js",
- "Model:ContactTag": "./dev/Models/ContactTagModel.js",
- "Model:Email": "./dev/Models/EmailModel.js",
- "Model:Filter": "./dev/Models/FilterModel.js",
- "Model:FilterCondition": "./dev/Models/FilterConditionModel.js",
- "Model:Folder": "./dev/Models/FolderModel.js",
- "Model:Identity": "./dev/Models/IdentityModel.js",
- "Model:Message": "./dev/Models/MessageModel.js",
- "Model:OpenPgpKey": "./dev/Models/OpenPgpKeyModel.js",
-
- "Storage:LocalStorage": "./dev/Storages/LocalStorage.js",
- "Storage:LocalStorage:Cookie": "./dev/Storages/LocalStorages/CookieDriver.js",
- "Storage:LocalStorage:LocalStorage": "./dev/Storages/LocalStorages/LocalStorageDriver.js",
-
- "Storage:Settings": "./dev/Storages/SettingsStorage.js",
-
- "Storage:Abstract:Remote": "./dev/Storages/AbstractRemoteStorage.js",
- "Storage:Abstract:Data": "./dev/Storages/AbstractData.js",
-
- "Storage:RainLoop:Cache": "./dev/Storages/CacheStorage.js",
- "Storage:RainLoop:Remote": "./dev/Storages/RemoteStorage.js",
- "Storage:RainLoop:Data": "./dev/Storages/DataStorage.js",
-
- "Storage:Admin:Remote": "./dev/Storages/AdminRemoteStorage.js",
- "Storage:Admin:Data": "./dev/Storages/AdminDataStorage.js",
-
- "Screen:AbstractSettings": "./dev/Screens/AbstractSettingsScreen.js",
- "Screen:RainLoop:Login": "./dev/Screens/LoginScreen.js",
- "Screen:RainLoop:About": "./dev/Screens/AboutScreen.js",
- "Screen:RainLoop:MailBox": "./dev/Screens/MailBoxScreen.js",
- "Screen:RainLoop:Settings": "./dev/Screens/SettingsScreen.js",
- "Screen:Admin:Login": "./dev/Screens/AdminLoginScreen.js",
- "Screen:Admin:Settings": "./dev/Screens/AdminSettingsScreen.js",
-
- "Settings:RainLoop:General": "./dev/Settings/App/SettingsGeneral.js",
- "Settings:RainLoop:ChangePassword": "./dev/Settings/App/SettingsChangePassword.js",
- "Settings:RainLoop:Accounts": "./dev/Settings/App/SettingsAccounts.js",
- "Settings:RainLoop:Contacts": "./dev/Settings/App/SettingsContacts.js",
- "Settings:RainLoop:Filters": "./dev/Settings/App/SettingsFilters.js",
- "Settings:RainLoop:Folders": "./dev/Settings/App/SettingsFolders.js",
- "Settings:RainLoop:Identity": "./dev/Settings/App/SettingsIdentity.js",
- "Settings:RainLoop:Identities": "./dev/Settings/App/SettingsIdentities.js",
- "Settings:RainLoop:OpenPGP": "./dev/Settings/App/SettingsOpenPGP.js",
- "Settings:RainLoop:Security": "./dev/Settings/App/SettingsSecurity.js",
- "Settings:RainLoop:Social": "./dev/Settings/App/SettingsSocial.js",
- "Settings:RainLoop:Themes": "./dev/Settings/App/SettingsThemes.js",
-
- "Settings:Admin:General": "./dev/Settings/Admin/AdminSettingsGeneral.js",
- "Settings:Admin:Login": "./dev/Settings/Admin/AdminSettingsLogin.js",
- "Settings:Admin:Branding": "./dev/Settings/Admin/AdminSettingsBranding.js",
- "Settings:Admin:Contacts": "./dev/Settings/Admin/AdminSettingsContacts.js",
- "Settings:Admin:Domains": "./dev/Settings/Admin/AdminSettingsDomains.js",
- "Settings:Admin:Social": "./dev/Settings/Admin/AdminSettingsSocial.js",
- "Settings:Admin:Security": "./dev/Settings/Admin/AdminSettingsSecurity.js",
- "Settings:Admin:Plugins": "./dev/Settings/Admin/AdminSettingsPlugins.js",
- "Settings:Admin:Packages": "./dev/Settings/Admin/AdminSettingsPackages.js",
- "Settings:Admin:Licensing": "./dev/Settings/Admin/AdminSettingsLicensing.js",
- "Settings:Admin:About": "./dev/Settings/Admin/AdminSettingsAbout.js",
-
- "View:Admin:Login": "./dev/ViewModels/AdminLoginViewModel.js",
- "View:Admin:SettingsMenu": "./dev/ViewModels/AdminSettingsMenuViewModel.js",
- "View:Admin:SettingsPane": "./dev/ViewModels/AdminSettingsPaneViewModel.js",
-
- "View:RainLoop:AbstractSystemDropDown": "./dev/ViewModels/AbstractSystemDropDownViewModel.js",
- "View:RainLoop:MailBoxSystemDropDown": "./dev/ViewModels/MailBoxSystemDropDownViewModel.js",
- "View:RainLoop:SettingsSystemDropDown": "./dev/ViewModels/SettingsSystemDropDownViewModel.js",
- "View:RainLoop:SettingsMenu": "./dev/ViewModels/SettingsMenuViewModel.js",
- "View:RainLoop:SettingsPane": "./dev/ViewModels/SettingsPaneViewModel.js",
- "View:RainLoop:MailBoxMessageView": "./dev/ViewModels/MailBoxMessageViewViewModel.js",
- "View:RainLoop:MailBoxMessageList": "./dev/ViewModels/MailBoxMessageListViewModel.js",
- "View:RainLoop:MailBoxFolderList": "./dev/ViewModels/MailBoxFolderListViewModel.js",
- "View:RainLoop:Login": "./dev/ViewModels/LoginViewModel.js",
- "View:RainLoop:About": "./dev/ViewModels/AboutViewModel.js",
-
- "View:Popup:Activate": "./dev/ViewModels/Popups/PopupsActivateViewModel.js",
- "View:Popup:AddAccount": "./dev/ViewModels/Popups/PopupsAddAccountViewModel.js",
- "View:Popup:AddOpenPgpKey": "./dev/ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js",
- "View:Popup:AdvancedSearch": "./dev/ViewModels/Popups/PopupsAdvancedSearchViewModel.js",
- "View:Popup:Ask": "./dev/ViewModels/Popups/PopupsAskViewModel.js",
- "View:Popup:ComposeOpenPgp": "./dev/ViewModels/Popups/PopupsComposeOpenPgpViewModel.js",
- "View:Popup:Compose": "./dev/ViewModels/Popups/PopupsComposeViewModel.js",
- "View:Popup:Contacts": "./dev/ViewModels/Popups/PopupsContactsViewModel.js",
- "View:Popup:Domain": "./dev/ViewModels/Popups/PopupsDomainViewModel.js",
- "View:Popup:Filter": "./dev/ViewModels/Popups/PopupsFilterViewModel.js",
- "View:Popup:FolderClear": "./dev/ViewModels/Popups/PopupsFolderClearViewModel.js",
- "View:Popup:FolderCreate": "./dev/ViewModels/Popups/PopupsFolderCreateViewModel.js",
- "View:Popup:FolderSystem": "./dev/ViewModels/Popups/PopupsFolderSystemViewModel.js",
- "View:Popup:Identity": "./dev/ViewModels/Popups/PopupsIdentityViewModel.js",
- "View:Popup:KeyboardShortcutsHelp": "./dev/ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js",
- "View:Popup:Languages": "./dev/ViewModels/Popups/PopupsLanguagesViewModel.js",
- "View:Popup:NewOpenPgpKey": "./dev/ViewModels/Popups/PopupsNewOpenPgpKeyViewModel.js",
- "View:Popup:Plugin": "./dev/ViewModels/Popups/PopupsPluginViewModel.js",
- "View:Popup:TwoFactorTest": "./dev/ViewModels/Popups/PopupsTwoFactorTestViewModel.js",
- "View:Popup:ViewOpenPgpKey": "./dev/ViewModels/Popups/PopupsViewOpenPgpKeyViewModel.js"
- },
"devDependencies": {
- "crypto": "*",
"node-fs": "*",
"jshint-summary": "*",
- "browserify": "*",
- "exorcist": "*",
- "vinyl-source-stream": "*",
- "vinyl-buffer": "*",
+ "webpack": "*",
"gulp": "*",
"gulp-util": "*",
@@ -195,6 +55,7 @@
"gulp-less": "*",
"gulp-zip": "*",
"gulp-rename": "*",
+ "gulp-replace": "*",
"gulp-header": "*",
"gulp-footer": "*",
"gulp-minify-css": "*",
diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php
index 092436335..edc7a6f56 100644
--- a/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php
+++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Service.php
@@ -200,11 +200,12 @@ class Service
'FaviconPngLink' => $sStaticPrefix.'favicon.png',
'AppleTouchLink' => $sStaticPrefix.'apple-touch-icon.png',
'AppCssLink' => $sStaticPrefix.'css/app'.($bAppCssDebug ? '' : '.min').'.css',
- 'BootJsLink' => $sStaticPrefix.'js/boot.js',
- 'LibJsLink' => $sStaticPrefix.'js/libs.js',
+ 'BootJsLink' => $sStaticPrefix.'js/min/boot.js',
+ 'LibJsLink' => $sStaticPrefix.'js/min/libs.js',
'EditorJsLink' => $sStaticPrefix.'ckeditor/ckeditor.js',
- 'OpenPgpJsLink' => $sStaticPrefix.'js/openpgp.min.js',
- 'AppJsLink' => $sStaticPrefix.'js/'.($bAdmin ? 'admin' : 'app').($bAppJsDebug ? '' : '.min').'.js'
+ 'OpenPgpJsLink' => $sStaticPrefix.'js/min/openpgp.min.js',
+ 'CommonJsLink' => $sStaticPrefix.'js/'.($bAppJsDebug ? '' : 'min/').'common.js',
+ 'AppJsLink' => $sStaticPrefix.'js/'.($bAppJsDebug ? '' : 'min/').($bAdmin ? 'admin' : 'app').'.js'
);
$aTemplateParameters = array(
@@ -217,6 +218,7 @@ class Service
'{{BaseAppLibsScriptLink}}' => $aData['LibJsLink'],
'{{BaseAppEditorScriptLink}}' => $aData['EditorJsLink'],
'{{BaseAppOpenPgpScriptLink}}' => $aData['OpenPgpJsLink'],
+ '{{BaseCommonMainScriptLink}}' => $aData['CommonJsLink'],
'{{BaseAppMainScriptLink}}' => $aData['AppJsLink'],
'{{BaseAppLoadingDescription}}' => \htmlspecialchars($aData['LoadingDescription'], ENT_QUOTES|ENT_IGNORE, 'UTF-8'),
'{{BaseDir}}' => \in_array($aData['Language'], array('ar', 'he', 'ur')) ? 'rtl' : 'ltr'
diff --git a/rainloop/v/0.0.0/app/templates/Index.html b/rainloop/v/0.0.0/app/templates/Index.html
index cb5187b58..bf39dc35a 100644
--- a/rainloop/v/0.0.0/app/templates/Index.html
+++ b/rainloop/v/0.0.0/app/templates/Index.html
@@ -82,9 +82,13 @@
.wait(function () {
__simplePace(30);
})
+ .script('{{BaseCommonMainScriptLink}}')
+ .wait(function () {
+ __simplePace(5);
+ })
.script('{{BaseAppMainScriptLink}}')
.wait(function () {
- __simplePace(20);
+ __simplePace(15);
})
.script(function () {
return window.rainloopAppData['PluginsLink'] || null;
diff --git a/rainloop/v/0.0.0/static/css/app.css b/rainloop/v/0.0.0/static/css/app.css
index 5fee38042..6bf1bc69f 100644
--- a/rainloop/v/0.0.0/static/css/app.css
+++ b/rainloop/v/0.0.0/static/css/app.css
@@ -637,7 +637,7 @@
filter: Alpha(Opacity=30);
}
-
+
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
@@ -1150,7 +1150,7 @@ table {
border-spacing: 0;
border-collapse: collapse;
}
-
+
@charset "UTF-8";
@font-face {
@@ -1522,7 +1522,7 @@ table {
.icon-resize-out:before {
content: "\e06d";
}
-
+
/** initial setup **/
.nano {
/*
@@ -1638,7 +1638,7 @@ table {
.nano > .pane2.active > .slider2 {
background-color: rgba(0, 0, 0, 0.4);
}
-
+
/* Magnific Popup CSS */
.mfp-bg {
position: fixed;
@@ -2094,7 +2094,7 @@ img.mfp-img {
padding-top: 0;
}
-
+
/* overlay at start */
.mfp-fade.mfp-bg {
@@ -2135,7 +2135,7 @@ img.mfp-img {
-ms-transform: translateX(50px);
transform: translateX(50px);
}
-
+
.simple-pace {
pointer-events: none;
@@ -2210,7 +2210,7 @@ img.mfp-img {
transform: translate(-32px, 0);
transform: translate(-32px, 0);
}
-}
+}
.inputosaurus-container {
display: inline-block;
margin: 0 5px 0 0;
@@ -2275,7 +2275,7 @@ img.mfp-img {
.inputosaurus-input-hidden {
display: none;
}
-
+
.flag-wrapper {
display: inline-block;
width: 24px;
@@ -2401,7 +2401,7 @@ img.mfp-img {
.flag.flag-zh-cn,
.flag.flag-zh-hk {
background-position: -208px -22px;
-}
+}
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
.clearfix {
*zoom: 1;
diff --git a/rainloop/v/0.0.0/static/js/701a517c70faed82fff3.chunk.js b/rainloop/v/0.0.0/static/js/701a517c70faed82fff3.chunk.js
new file mode 100644
index 000000000..ac61aeac3
--- /dev/null
+++ b/rainloop/v/0.0.0/static/js/701a517c70faed82fff3.chunk.js
@@ -0,0 +1,10194 @@
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+webpackJsonp([0],Array(21).concat([
+/* 21 */
+/*!*********************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsComposeViewModel.js ***!
+ \*********************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+ moment = __webpack_require__(/*! moment */ 25),
+ JSON = __webpack_require__(/*! JSON */ 33),
+ Jua = __webpack_require__(/*! Jua */ 47),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Events = __webpack_require__(/*! Common/Events */ 22),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+ HtmlEditor = __webpack_require__(/*! Common/HtmlEditor */ 28),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ Cache = __webpack_require__(/*! Storage:RainLoop:Cache */ 20),
+ Remote = __webpack_require__(/*! Storage:RainLoop:Remote */ 13),
+
+ ComposeAttachmentModel = __webpack_require__(/*! Model:ComposeAttachment */ 53),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @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 = Settings.capa(Enums.Capa.AdditionalIdentities);
+
+ var
+ self = this,
+ fCcAndBccCheckHelper = function (aValue) {
+ if (false === self.showCcAndBcc() && 0 < aValue.length)
+ {
+ self.showCcAndBcc(true);
+ }
+ }
+ ;
+
+ this.capaOpenPGP = Data.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 = Data.identities;
+ this.defaultIdentityID = Data.defaultIdentityID;
+ this.currentIdentityID = ko.observable('');
+
+ this.currentIdentityString = ko.observable('');
+ this.currentIdentityResultEmail = ko.observable('');
+
+ this.identitiesOptions = ko.computed(function () {
+
+ var aList = [{
+ 'optValue': Data.accountEmail(),
+ 'optText': this.formattedFrom(false)
+ }];
+
+ _.each(Data.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 !== 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 () {
+
+ __webpack_require__(/*! App:RainLoop */ 4).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 = Data.sentFolder(),
+ aFlagsCache = []
+ ;
+
+ if (0 < this.attachmentsInProcess().length)
+ {
+ this.attachmentsInProcessError(true);
+ }
+ else if (0 === sTo.length)
+ {
+ this.emptyToError(true);
+ }
+ else
+ {
+ if (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(__webpack_require__(/*! View:Popup:FolderSystem */ 27), [Enums.SetSystemFoldersNotification.Sent]);
+ }
+ else
+ {
+ this.sendError(false);
+ this.sending(true);
+
+ if (Utils.isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length)
+ {
+ aFlagsCache = Cache.getMessageFlagsFromCache(this.aDraftInfo[2], this.aDraftInfo[1]);
+ if (aFlagsCache)
+ {
+ if ('forward' === this.aDraftInfo[0])
+ {
+ aFlagsCache[3] = true;
+ }
+ else
+ {
+ aFlagsCache[2] = true;
+ }
+
+ Cache.setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], aFlagsCache);
+ __webpack_require__(/*! App:RainLoop */ 4).reloadFlagsCurrentMessageListAndMessageFromCache();
+ Cache.setFolderHash(this.aDraftInfo[2], '');
+ }
+ }
+
+ sSentFolder = Consts.Values.UnuseOptionValue === sSentFolder ? '' : sSentFolder;
+
+ Cache.setFolderHash(this.draftFolder(), '');
+ Cache.setFolderHash(sSentFolder, '');
+
+ 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 (Data.draftFolderNotEnabled())
+ {
+ kn.showScreenPopup(__webpack_require__(/*! View:Popup:FolderSystem */ 27), [Enums.SetSystemFoldersNotification.Draft]);
+ }
+ else
+ {
+ this.savedError(false);
+ this.saving(true);
+
+ this.bSkipNext = true;
+
+ Cache.setFolderHash(Data.draftFolder(), '');
+
+ Remote.saveMessage(
+ this.saveMessageResponse,
+ this.draftFolder(),
+ this.draftUid(),
+ 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);
+
+ Events.sub('interval.1m', function () {
+ if (this.modalVisibility() && !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(!!Settings.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 &&
+ !!Settings.settingsGet('GoogleClientID') && !!Settings.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);
+
+ this.emailsSource = _.bind(this.emailsSource, this);
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel(['View:Popup:Compose', 'PopupsComposeViewModel'], PopupsComposeViewModel);
+ _.extend(PopupsComposeViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ PopupsComposeViewModel.prototype.emailsSource = function (oData, fResponse)
+ {
+ __webpack_require__(/*! App:RainLoop */ 4).getAutocomplete(oData.term, function (aData) {
+ fResponse(_.map(aData, function (oEmailItem) {
+ return oEmailItem.toLine(false);
+ }));
+ });
+ };
+
+ PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
+ {
+ if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
+ {
+ var self = this;
+ kn.showScreenPopup(__webpack_require__(/*! View:Popup:ComposeOpenPgp */ 104), [
+ 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 = Data.draftFolder()
+ ;
+
+ if ('' !== sDraftFolder)
+ {
+ Cache.setFolderHash(sDraftFolder, '');
+ if (Data.currentFolderFullNameRaw() === sDraftFolder)
+ {
+ __webpack_require__(/*! App:RainLoop */ 4).reloadMessageList(true);
+ }
+ else
+ {
+ __webpack_require__(/*! App:RainLoop */ 4).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[Data.accountEmail()] = 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 = 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 = Data.displayName(),
+ sEmail = 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 = Data.message();
+ if (oMessage && this.draftFolder() === oMessage.folderFullNameRaw && this.draftUid() === oMessage.uid)
+ {
+ Data.message(null);
+ }
+ }
+
+ this.draftFolder(oData.Result.NewFolder);
+ this.draftUid(oData.Result.NewUid);
+
+ if (this.modalVisibility())
+ {
+ this.savedTime(window.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)
+ {
+ 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]/g, '');
+
+ sFrom = Utils.pString(sFrom);
+ if ('' !== sFrom)
+ {
+ sSignature = sSignature.replace(/{{FROM}}/g, sFrom);
+ }
+
+ sSignature = sSignature.replace(/[\s]{1,2}{{FROM}}/g, '{{FROM}}');
+
+ sSignature = sSignature.replace(/{{FROM}}/g, '');
+ sSignature = sSignature.replace(/{{DATE}}/g, moment().format('llll'));
+
+ if (sData && Enums.ComposeType.Empty === sComposeType &&
+ -1 < sSignature.indexOf('{{DATA}}'))
+ {
+ bData = true;
+ sSignature = sSignature.replace('{{DATA}}', sData);
+ }
+
+ sSignature = sSignature.replace(/{{DATA}}/g, '');
+
+ 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 HtmlEditor(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,
+ sText = '',
+ sReplyTitle = '',
+ aResplyAllParts = [],
+ oExcludeEmail = {},
+ mEmail = Data.accountEmail(),
+ sSignature = Data.signature(),
+ bSignatureToAll = 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();
+ if (oText)
+ {
+ oText.find('blockquote.rl-bq-switcher').each(function () {
+ $(this).removeClass('rl-bq-switcher hidden-bq');
+ });
+ oText.find('.rlBlockquoteSwitcher').each(function () {
+ $(this).remove();
+ });
+ }
+
+ oText.find('[data-html-editor-font-wrapper]').removeAttr('data-html-editor-font-wrapper');
+ sText = 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 + ':' +
+ '
'; + + break; + + case Enums.ComposeType.Forward: + sFrom = oMessage.fromToLine(false, true); + sTo = oMessage.toToLine(false, true); + sCc = oMessage.ccToLine(false, true); + sText = '' + sText + '
]*>([\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 = Globals.$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 = Globals.$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;
- };
-
- /**
- * @param {string} sUrl
- * @param {number} iValue
- * @param {Function} fCallback
- */
- Utils.resizeAndCrop = function (sUrl, iValue, fCallback)
- {
- var oTempImg = new window.Image();
- oTempImg.onload = function() {
-
- var
- aDiff = [0, 0],
- oCanvas = window.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;
- };
-
- /**
- * @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() {
-
- var
- iPrev = 0,
- iNext = 0,
- iLimit = 2,
- aResult = [],
- iCurrentPage = koCurrentPage(),
- iPageCount = koPageCount(),
-
- /**
- * @param {number} iIndex
- * @param {boolean=} bPush = true
- * @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(window.Math.round((iPrev - 1) / 2), false, '...');
- }
-
- if (iPageCount - 2 === iNext)
- {
- fAdd(iPageCount - 1, true);
- }
- else if (iPageCount - 2 > iNext)
- {
- fAdd(window.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)
- {
- var sel, range;
- if (window.getSelection)
- {
- sel = window.getSelection();
- sel.removeAllRanges();
- range = window.document.createRange();
- range.selectNodeContents(element);
- sel.addRange(range);
- }
- else if (window.document.selection)
- {
- range = window.document.body.createTextRange();
- range.moveToElementText(element);
- range.select();
- }
- };
-
- Utils.detectDropdownVisibility = _.debounce(function () {
- Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) {
- return oItem.hasClass('open');
- }));
- }, 50);
-
- /**
- * @param {boolean=} bDelay = false
- */
- Utils.triggerAutocompleteInputChange = function (bDelay) {
-
- var fFunc = function () {
- $('.checkAutocomplete').trigger('change');
- };
-
- if (Utils.isUnd(bDelay) ? false : !!bDelay)
- {
- _.delay(fFunc, 100);
- }
- else
- {
- fFunc();
- }
- };
-
- module.exports = Utils;
-
-}(module, require));
-},{"$":14,"App:Knoin":21,"Consts":5,"Enums":6,"Globals":8,"Model:Email":26,"_":19,"ko":16,"window":20}],12:[function(require,module,exports){
-module.exports = crossroads;
-},{}],13:[function(require,module,exports){
-module.exports = hasher;
-},{}],14:[function(require,module,exports){
-module.exports = $;
-},{}],15:[function(require,module,exports){
-module.exports = key;
-},{}],16:[function(require,module,exports){
-
-(function (module, ko) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$')
- ;
-
- ko.bindingHandlers.tooltip = {
- 'init': function (oElement, fValueAccessor) {
-
- var
- Globals = require('Globals'),
- Utils = require('Utils')
- ;
-
- 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
- Globals = require('Globals'),
- $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),
- Globals = require('Globals')
- ;
-
- $oEl.tooltip({
- 'container': 'body',
- 'trigger': 'hover manual',
- 'title': function () {
- return $oEl.data('tooltip3-data') || '';
- }
- });
-
- $(window.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) {
- var Globals = require('Globals');
- Globals.aBootstrapDropdowns.push($(oElement));
- }
- };
-
- ko.bindingHandlers.openDropdownTrigger = {
- 'update': function (oElement, fValueAccessor) {
- if (ko.utils.unwrapObservable(fValueAccessor()))
- {
- 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
- {
- $(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()));
- }
- }
- };
-
- 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) {
-
- 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'),
- Globals = require('Globals'),
- 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 = Globals.$win.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('Model:Email'),
-
- $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('Model:ContactTag'),
-
- $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
- Utils = require('Utils'),
- 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
- 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 ()
- {
- 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));
+ 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.valueHasMutated();
+ this.adminManLoadingVisibility = ko.computed(function () {
+ return this.adminManLoading() ? 'visible' : 'hidden';
+ }, this).extend({'rateLimit': 300});
}
- return this;
- };
+ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
- module.exports = ko;
-
-}(module, ko));
-
-},{"$":14,"Globals":8,"Model:ContactTag":25,"Model:Email":26,"Utils":11,"_":19,"window":20}],17:[function(require,module,exports){
-module.exports = moment;
-},{}],18:[function(require,module,exports){
-module.exports = ssm;
-},{}],19:[function(require,module,exports){
-module.exports = _;
-},{}],20:[function(require,module,exports){
-module.exports = window;
-},{}],21:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- hasher = require('hasher'),
- crossroads = require('crossroads'),
-
- Globals = require('Globals'),
- Plugins = require('Plugins'),
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function Knoin()
- {
- this.oScreens = {};
- this.sDefaultScreenName = '';
- this.oCurrentScreen = null;
- }
-
- Knoin.prototype.oScreens = {};
- Knoin.prototype.sDefaultScreenName = '';
- Knoin.prototype.oCurrentScreen = null;
-
- Knoin.prototype.hideLoading = function ()
- {
- $('#rl-loading').hide();
- };
-
- /**
- * @param {Object} thisObject
- */
- Knoin.prototype.constructorEnd = function (thisObject)
- {
- if (Utils.isFunc(thisObject['__constructor_end']))
+ AdminDataStorage.prototype.populateDataOnStart = function()
{
- thisObject['__constructor_end'].call(thisObject);
- }
- };
-
- /**
- * @param {string|Array} mName
- * @param {Function} ViewModelClass
- */
- Knoin.prototype.extendAsViewModel = function (mName, ViewModelClass)
- {
- if (ViewModelClass)
- {
- if (Utils.isArray(mName))
- {
- ViewModelClass.__names = mName;
- }
- else
- {
- ViewModelClass.__names = [mName];
- }
-
- ViewModelClass.__name = ViewModelClass.__names[0];
- }
- };
-
- /**
- * @param {Function} SettingsViewModelClass
- * @param {string} sLabelName
- * @param {string} sTemplate
- * @param {string} sRoute
- * @param {boolean=} bDefault
- */
- Knoin.prototype.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabelName, sRoute, bDefault)
- {
- SettingsViewModelClass.__rlSettingsData = {
- 'Label': sLabelName,
- 'Template': sTemplate,
- 'Route': sRoute,
- 'IsDefault': !!bDefault
+ AbstractData.prototype.populateDataOnStart.call(this);
};
- Globals.aViewModels['settings'].push(SettingsViewModelClass);
- };
+ module.exports = new AdminDataStorage();
- /**
- * @param {Function} SettingsViewModelClass
- */
- Knoin.prototype.removeSettingsViewModel = function (SettingsViewModelClass)
- {
- Globals.aViewModels['settings-removed'].push(SettingsViewModelClass);
- };
+ }());
- /**
- * @param {Function} SettingsViewModelClass
- */
- Knoin.prototype.disableSettingsViewModel = function (SettingsViewModelClass)
- {
- Globals.aViewModels['settings-disabled'].push(SettingsViewModelClass);
- };
+/***/ },
- Knoin.prototype.routeOff = function ()
- {
- hasher.changed.active = false;
- };
+/***/ 29:
+/*!***********************************************!*\
+ !*** ./dev/Screens/AbstractSettingsScreen.js ***!
+ \***********************************************/
+/***/ function(module, exports, __webpack_require__) {
- Knoin.prototype.routeOn = function ()
- {
- hasher.changed.active = true;
- };
+
+ (function () {
- /**
- * @param {string} sScreenName
- * @return {?Object}
- */
- Knoin.prototype.screen = function (sScreenName)
- {
- return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null;
- };
+ 'use strict';
- /**
- * @param {Function} ViewModelClass
- * @param {Object=} oScreen
- */
- Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
- {
- if (ViewModelClass && !ViewModelClass.__builded)
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractScreen = __webpack_require__(/*! Knoin:AbstractScreen */ 24)
+ ;
+
+ /**
+ * @constructor
+ * @param {Array} aViewModels
+ * @extends KnoinAbstractScreen
+ */
+ function AbstractSettingsScreen(aViewModels)
+ {
+ KnoinAbstractScreen.call(this, 'settings', aViewModels);
+
+ this.menu = ko.observableArray([]);
+
+ this.oCurrentSubScreen = null;
+ this.oViewModelPlace = null;
+
+ this.setupSettings();
+ }
+
+ _.extend(AbstractSettingsScreen.prototype, KnoinAbstractScreen.prototype);
+
+ /**
+ * @param {Function=} fCallback
+ */
+ AbstractSettingsScreen.prototype.setupSettings = function (fCallback)
+ {
+ if (fCallback)
+ {
+ fCallback();
+ }
+ };
+
+ AbstractSettingsScreen.prototype.onRoute = function (sSubName)
{
var
- kn = this,
- oViewModel = new ViewModelClass(oScreen),
- sPosition = oViewModel.viewModelPosition(),
- oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
+ self = this,
+ oSettingsScreen = null,
+ RoutedSettingsViewModel = null,
+ oViewModelPlace = null,
oViewModelDom = null
;
- ViewModelClass.__builded = true;
- ViewModelClass.__vm = oViewModel;
-
- oViewModel.viewModelName = ViewModelClass.__name;
- oViewModel.viewModelNames = ViewModelClass.__names;
-
- 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();
-
- 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();
-
- _.each(this.viewModelNames, function (sName) {
- Plugins.runHook('view-model-on-hide', [sName, self]);
- });
-
- Globals.popupVisibilityNames.remove(this.viewModelName);
- oViewModel.viewModelDom.css('z-index', 2000);
-
- Globals.tooltipTrigger(!Globals.tooltipTrigger());
-
- _.delay(function () {
- self.viewModelDom.hide();
- }, 300);
- }
-
- }, oViewModel);
- }
-
- _.each(ViewModelClass.__names, function (sName) {
- Plugins.runHook('view-model-pre-build', [sName, 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();
- }
-
- _.each(ViewModelClass.__names, function (sName) {
- Plugins.runHook('view-model-post-build', [sName, oViewModel, oViewModelDom]);
- });
- }
- else
- {
- Utils.log('Cannot find view model position: ' + sPosition);
- }
- }
-
- return ViewModelClass ? ViewModelClass.__vm : null;
- };
-
- /**
- * @param {Function} ViewModelClassToHide
- */
- Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
- {
- if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
- {
- ViewModelClassToHide.__vm.modalVisibility(false);
- }
- };
-
- /**
- * @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 || []);
-
- _.each(ViewModelClassToShow.__names, function (sName) {
- Plugins.runHook('view-model-on-show', [sName, 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);
-
- _.each(ViewModelClass.__names, function (sName) {
- Plugins.runHook('view-model-on-show', [sName, ViewModelClass.__vm]);
- });
- }
-
- }, self);
- }
- }
- // --
-
- oCross = oScreen.__cross ? oScreen.__cross() : null;
- 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 () {
- Globals.$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);
- }
- };
-
- module.exports = new Knoin();
-
-}(module, require));
-},{"$":14,"Globals":8,"Plugins":10,"Utils":11,"_":19,"crossroads":12,"hasher":13,"ko":16}],22:[function(require,module,exports){
-
-(function (module) {
-
- 'use strict';
-
- /**
- * @constructor
- */
- function KnoinAbstractBoot()
- {
-
- }
-
- KnoinAbstractBoot.prototype.bootstart = function ()
- {
-
- };
-
- module.exports = KnoinAbstractBoot;
-
-}(module, require));
-},{}],23:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- 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];
+ RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
+ return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
+ sSubName === SettingsViewModel.__rlSettingsData.Route;
});
- this.oCross = oRoute;
- }
- };
-
- module.exports = KnoinAbstractScreen;
-
-}(module, require));
-},{"Utils":11,"_":19,"crossroads":12}],24:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals')
- ;
-
- /**
- * @constructor
- * @param {string=} sPosition = ''
- * @param {string=} sTemplate = ''
- */
- 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.viewModelVisibility = ko.observable(false);
- this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
-
- this.viewModelName = '';
- this.viewModelNames = [];
- this.viewModelDom = null;
- }
-
- /**
- * @type {boolean}
- */
- KnoinAbstractViewModel.prototype.bDisabeCloseOnEsc = false;
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sPosition = '';
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sTemplate = '';
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sDefaultKeyScope = Enums.KeyState.None;
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sCurrentKeyScope = Enums.KeyState.None;
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.viewModelName = '';
-
- /**
- * @type {Array}
- */
- KnoinAbstractViewModel.prototype.viewModelNames = [];
-
- /**
- * @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;
-
- Globals.$win.on('keydown', function (oEvent) {
- if (oEvent && self.modalVisibility && self.modalVisibility())
+ if (RoutedSettingsViewModel)
{
- if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
+ if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
+ return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
+ }))
{
- Utils.delegateRun(self, 'cancelCommand');
- return false;
+ RoutedSettingsViewModel = null;
}
- else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus())
+
+ if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
+ return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
+ }))
{
- return false;
+ RoutedSettingsViewModel = null;
}
}
- return true;
- });
- };
-
- module.exports = KnoinAbstractViewModel;
-
-}(module, require));
-},{"Enums":6,"Globals":8,"Utils":11,"ko":16}],25:[function(require,module,exports){
-
-(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":11,"ko":16}],26:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- Utils = require('Utils')
- ;
-
- /**
- * @param {string=} sEmail
- * @param {string=} sName
- *
- * @constructor
- */
- function EmailModel(sEmail, sName)
- {
- this.email = sEmail || '';
- this.name = sName || '';
-
- 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 = '';
-
- EmailModel.prototype.clear = function ()
- {
- this.email = '';
- this.name = '';
- };
-
- /**
- * @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 = '';
- }
- };
-
- /**
- * @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)
+ if (RoutedSettingsViewModel)
{
- 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 (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
{
- if (bWrapWithLink)
+ oSettingsScreen = RoutedSettingsViewModel.__vm;
+ }
+ else
+ {
+ oViewModelPlace = this.oViewModelPlace;
+ if (oViewModelPlace && 1 === oViewModelPlace.length)
{
- sResult = Utils.encodeHtml('"' + this.name + '" <') +
- '') + '" target="_blank" tabindex="-1">' + Utils.encodeHtml(sResult) + '' + Utils.encodeHtml('>');
+ 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
{
- sResult = '"' + this.name + '" <' + sResult + '>';
- if (bEncodeHtml)
+ Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
+ }
+ }
+
+ if (oSettingsScreen)
+ {
+ _.defer(function () {
+ // hide
+ if (self.oCurrentSubScreen)
{
- sResult = Utils.encodeHtml(sResult);
+ Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
+ self.oCurrentSubScreen.viewModelDom.hide();
}
- }
- }
- else if (bWrapWithLink)
- {
- sResult = '' + Utils.encodeHtml(this.email) + '';
- }
- }
- }
+ // --
- return sResult;
- };
+ self.oCurrentSubScreen = oSettingsScreen;
- /**
- * @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)
+ // show
+ if (self.oCurrentSubScreen)
{
- $sName = substr($sEmailAddress, 0, $iCurrentIndex);
+ 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);
}
+ // --
- $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];
+ Utils.windowResize();
+ });
+ }
}
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(/\\\\(.)/g, '$1');
- $sComment = $sComment.replace(/\\\\(.)/g, '$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;
- };
-
- module.exports = EmailModel;
-
-}(module, require));
-},{"Utils":11}],27:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
-
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- kn = require('App:Knoin'),
- KnoinAbstractScreen = require('Knoin:AbstractScreen')
- ;
-
- /**
- * @constructor
- * @param {Array} aViewModels
- * @extends KnoinAbstractScreen
- */
- function AbstractSettingsScreen(aViewModels)
- {
- KnoinAbstractScreen.call(this, 'settings', aViewModels);
-
- this.menu = ko.observableArray([]);
-
- this.oCurrentSubScreen = null;
- this.oViewModelPlace = null;
- }
-
- _.extend(AbstractSettingsScreen.prototype, KnoinAbstractScreen.prototype);
-
- AbstractSettingsScreen.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)
- {
- 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);
- }
- };
-
- AbstractSettingsScreen.prototype.onHide = function ()
- {
- if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
- {
- Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
- this.oCurrentSubScreen.viewModelDom.hide();
- }
- };
-
- AbstractSettingsScreen.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');
- };
-
- AbstractSettingsScreen.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 = AbstractSettingsScreen;
-
-}(module, require));
-},{"$":14,"App:Knoin":21,"Globals":8,"Knoin:AbstractScreen":23,"LinkBuilder":9,"Utils":11,"_":19,"ko":16}],28:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- KnoinAbstractScreen = require('Knoin:AbstractScreen')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractScreen
- */
- function AdminLoginScreen()
- {
- KnoinAbstractScreen.call(this, 'login', [
- require('View:Admin:Login')
- ]);
- }
-
- _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
-
- AdminLoginScreen.prototype.onShow = function ()
- {
- require('App:Admin').setTitle('');
- };
-
- module.exports = AdminLoginScreen;
-
-}(module, require));
-},{"App:Admin":3,"Knoin:AbstractScreen":23,"View:Admin:Login":46,"_":19}],29:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- AbstractSettings = require('Screen:AbstractSettings')
- ;
-
- /**
- * @constructor
- * @extends AbstractSettings
- */
- function AdminSettingsScreen()
- {
- AbstractSettings.call(this, [
- require('View:Admin:SettingsMenu'),
- require('View:Admin:SettingsPane')
- ]);
- }
-
- _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
-
- AdminSettingsScreen.prototype.onShow = function ()
- {
- require('App:Admin').setTitle('');
- };
-
- module.exports = AdminSettingsScreen;
-
-}(module, require));
-},{"App:Admin":3,"Screen:AbstractSettings":27,"View:Admin:SettingsMenu":47,"View:Admin:SettingsPane":48,"_":19}],30:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsAbout()
- {
- var
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data')
- ;
-
- this.version = ko.observable(Settings.settingsGet('Version'));
- this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
- this.errorDesc = ko.observable('');
-
- this.coreReal = Data.coreReal;
- this.coreUpdatable = Data.coreUpdatable;
- this.coreAccess = Data.coreAccess;
- this.coreChecking = Data.coreChecking;
- this.coreUpdating = Data.coreUpdating;
- this.coreRemoteVersion = Data.coreRemoteVersion;
- this.coreRemoteRelease = Data.coreRemoteRelease;
- this.coreVersionCompare = Data.coreVersionCompare;
-
- this.statusType = ko.computed(function () {
-
- var
- sType = '',
- iVersionCompare = this.coreVersionCompare(),
- bChecking = this.coreChecking(),
- bUpdating = this.coreUpdating(),
- bReal = this.coreReal()
- ;
-
- if (bChecking)
- {
- sType = 'checking';
- }
- else if (bUpdating)
- {
- sType = 'updating';
- }
- else if (bReal && 0 === iVersionCompare)
- {
- sType = 'up-to-date';
- }
- else if (bReal && -1 === iVersionCompare)
- {
- sType = 'available';
- }
- else if (!bReal)
- {
- sType = 'error';
- this.errorDesc('Cannot access the repository at the moment.');
- }
-
- return sType;
-
- }, this);
- }
-
- AdminSettingsAbout.prototype.onBuild = function ()
- {
- if (this.access())
- {
- require('App:Admin').reloadCoreData();
- }
- };
-
- AdminSettingsAbout.prototype.updateCoreData = function ()
- {
- if (!this.coreUpdating())
- {
- require('App:Admin').updateCoreData();
- }
- };
-
- module.exports = AdminSettingsAbout;
-
-}(module, require));
-},{"App:Admin":3,"Storage:Admin:Data":43,"Storage:Settings":45,"ko":16}],31:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsBranding()
- {
- var
- Enums = require('Enums'),
- Settings = require('Storage:Settings')
- ;
-
- this.title = ko.observable(Settings.settingsGet('Title'));
- this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
- this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo'));
- this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.loginDescription = ko.observable(Settings.settingsGet('LoginDescription'));
- this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.loginCss = ko.observable(Settings.settingsGet('LoginCss'));
- this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
- }
-
- AdminSettingsBranding.prototype.onBuild = function ()
- {
- var
- self = this,
- Remote = require('Storage:Admin:Remote')
- ;
-
- _.delay(function () {
-
- var
- f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.loginLogo.trigger, self),
- f4 = Utils.settingsSaveHelperSimpleFunction(self.loginDescription.trigger, self),
- f5 = Utils.settingsSaveHelperSimpleFunction(self.loginCss.trigger, self)
- ;
-
- self.title.subscribe(function (sValue) {
- Remote.saveAdminConfig(f1, {
- 'Title': Utils.trim(sValue)
- });
- });
-
- self.loadingDesc.subscribe(function (sValue) {
- Remote.saveAdminConfig(f2, {
- 'LoadingDescription': Utils.trim(sValue)
- });
- });
-
- self.loginLogo.subscribe(function (sValue) {
- Remote.saveAdminConfig(f3, {
- 'LoginLogo': Utils.trim(sValue)
- });
- });
-
- self.loginDescription.subscribe(function (sValue) {
- Remote.saveAdminConfig(f4, {
- 'LoginDescription': Utils.trim(sValue)
- });
- });
-
- self.loginCss.subscribe(function (sValue) {
- Remote.saveAdminConfig(f5, {
- 'LoginCss': Utils.trim(sValue)
- });
- });
-
- }, 50);
- };
-
- module.exports = AdminSettingsBranding;
-
-}(module, require));
-},{"Enums":6,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"_":19,"ko":16}],32:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsContacts()
- {
- var
- Remote = require('Storage:Admin:Remote')
- ;
-
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
- this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable'));
- this.contactsSharing = ko.observable(!!Settings.settingsGet('ContactsSharing'));
- this.contactsSync = ko.observable(!!Settings.settingsGet('ContactsSync'));
-
- var
- aTypes = ['sqlite', 'mysql', 'pgsql'],
- aSupportedTypes = [],
- getTypeName = function(sName) {
- switch (sName)
- {
- case 'sqlite':
- sName = 'SQLite';
- break;
- case 'mysql':
- sName = 'MySQL';
- break;
- case 'pgsql':
- sName = 'PostgreSQL';
- break;
- }
-
- return sName;
- }
- ;
-
- if (!!Settings.settingsGet('SQLiteIsSupported'))
- {
- aSupportedTypes.push('sqlite');
- }
- if (!!Settings.settingsGet('MySqlIsSupported'))
- {
- aSupportedTypes.push('mysql');
- }
- if (!!Settings.settingsGet('PostgreSqlIsSupported'))
- {
- aSupportedTypes.push('pgsql');
- }
-
- this.contactsSupported = 0 < aSupportedTypes.length;
-
- this.contactsTypes = ko.observableArray([]);
- this.contactsTypesOptions = this.contactsTypes.map(function (sValue) {
- var bDisabled = -1 === Utils.inArray(sValue, aSupportedTypes);
- return {
- 'id': sValue,
- 'name': getTypeName(sValue) + (bDisabled ? ' (not supported)' : ''),
- 'disabled': bDisabled
- };
- });
-
- this.contactsTypes(aTypes);
- this.contactsType = ko.observable('');
-
- this.mainContactsType = ko.computed({
- 'owner': this,
- 'read': this.contactsType,
- 'write': function (sValue) {
- if (sValue !== this.contactsType())
- {
- if (-1 < Utils.inArray(sValue, aSupportedTypes))
- {
- this.contactsType(sValue);
- }
- else if (0 < aSupportedTypes.length)
- {
- this.contactsType('');
- }
- }
- else
- {
- this.contactsType.valueHasMutated();
- }
- }
- });
-
- this.contactsType.subscribe(function () {
- this.testContactsSuccess(false);
- this.testContactsError(false);
- this.testContactsErrorMessage('');
- }, this);
-
- this.pdoDsn = ko.observable(Settings.settingsGet('ContactsPdoDsn'));
- this.pdoUser = ko.observable(Settings.settingsGet('ContactsPdoUser'));
- this.pdoPassword = ko.observable(Settings.settingsGet('ContactsPdoPassword'));
-
- this.pdoDsnTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.pdoUserTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.pdoPasswordTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.contactsTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.testing = ko.observable(false);
- this.testContactsSuccess = ko.observable(false);
- this.testContactsError = ko.observable(false);
- this.testContactsErrorMessage = ko.observable('');
-
- this.testContactsCommand = Utils.createCommand(this, function () {
-
- this.testContactsSuccess(false);
- this.testContactsError(false);
- this.testContactsErrorMessage('');
- this.testing(true);
-
- Remote.testContacts(this.onTestContactsResponse, {
- 'ContactsPdoType': this.contactsType(),
- 'ContactsPdoDsn': this.pdoDsn(),
- 'ContactsPdoUser': this.pdoUser(),
- 'ContactsPdoPassword': this.pdoPassword()
- });
-
- }, function () {
- return '' !== this.pdoDsn() && '' !== this.pdoUser();
- });
-
- this.contactsType(Settings.settingsGet('ContactsPdoType'));
-
- this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
- }
-
- AdminSettingsContacts.prototype.onTestContactsResponse = function (sResult, oData)
- {
- this.testContactsSuccess(false);
- this.testContactsError(false);
- this.testContactsErrorMessage('');
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.Result)
- {
- this.testContactsSuccess(true);
- }
- else
- {
- this.testContactsError(true);
- if (oData && oData.Result)
- {
- this.testContactsErrorMessage(oData.Result.Message || '');
- }
- else
- {
- this.testContactsErrorMessage('');
- }
- }
-
- this.testing(false);
- };
-
- AdminSettingsContacts.prototype.onShow = function ()
- {
- this.testContactsSuccess(false);
- this.testContactsError(false);
- this.testContactsErrorMessage('');
- };
-
- AdminSettingsContacts.prototype.onBuild = function ()
- {
- var
- self = this,
- Remote = require('Storage:Admin:Remote')
- ;
-
- _.delay(function () {
-
- var
- f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self),
- f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self),
- f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self)
- ;
-
- self.enableContacts.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'ContactsEnable': bValue ? '1' : '0'
- });
- });
-
- self.contactsSharing.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'ContactsSharing': bValue ? '1' : '0'
- });
- });
-
- self.contactsSync.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'ContactsSync': bValue ? '1' : '0'
- });
- });
-
- self.contactsType.subscribe(function (sValue) {
- Remote.saveAdminConfig(f5, {
- 'ContactsPdoType': sValue
- });
- });
-
- self.pdoDsn.subscribe(function (sValue) {
- Remote.saveAdminConfig(f1, {
- 'ContactsPdoDsn': Utils.trim(sValue)
- });
- });
-
- self.pdoUser.subscribe(function (sValue) {
- Remote.saveAdminConfig(f3, {
- 'ContactsPdoUser': Utils.trim(sValue)
- });
- });
-
- self.pdoPassword.subscribe(function (sValue) {
- Remote.saveAdminConfig(f4, {
- 'ContactsPdoPassword': Utils.trim(sValue)
- });
- });
-
- self.contactsType(Settings.settingsGet('ContactsPdoType'));
-
- }, 50);
- };
-
- module.exports = AdminSettingsContacts;
-
-}(module, require));
-},{"Enums":6,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"_":19,"ko":16}],33:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
-
- PopupsDomainViewModel = require('View:Popup:Domain'),
-
- Data = require('Storage:Admin:Data'),
- Remote = require('Storage:Admin:Remote')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsDomains()
- {
- this.domains = Data.domains;
- this.domainsLoading = Data.domainsLoading;
-
- this.iDomainForDeletionTimeout = 0;
-
- this.visibility = ko.computed(function () {
- return Data.domainsLoading() ? 'visible' : 'hidden';
- }, this);
-
- this.domainForDeletion = ko.observable(null).extend({'toggleSubscribe': [this,
- function (oPrev) {
- if (oPrev)
- {
- oPrev.deleteAccess(false);
- }
- }, function (oNext) {
- if (oNext)
- {
- oNext.deleteAccess(true);
- this.startDomainForDeletionTimeout();
- }
- }
- ]});
- }
-
- AdminSettingsDomains.prototype.startDomainForDeletionTimeout = function ()
- {
- var self = this;
- window.clearInterval(this.iDomainForDeletionTimeout);
- this.iDomainForDeletionTimeout = window.setTimeout(function () {
- self.domainForDeletion(null);
- }, 1000 * 3);
- };
-
- AdminSettingsDomains.prototype.createDomain = function ()
- {
- require('App:Knoin').showScreenPopup(PopupsDomainViewModel);
- };
-
- AdminSettingsDomains.prototype.deleteDomain = function (oDomain)
- {
- this.domains.remove(oDomain);
- Remote.domainDelete(_.bind(this.onDomainListChangeRequest, this), oDomain.name);
- };
-
- AdminSettingsDomains.prototype.disableDomain = function (oDomain)
- {
- oDomain.disabled(!oDomain.disabled());
- Remote.domainDisable(_.bind(this.onDomainListChangeRequest, this), oDomain.name, oDomain.disabled());
- };
-
- AdminSettingsDomains.prototype.onBuild = function (oDom)
- {
- var self = this;
- oDom
- .on('click', '.b-admin-domains-list-table .e-item .e-action', function () {
- var oDomainItem = ko.dataFor(this);
- if (oDomainItem)
- {
- Remote.domain(_.bind(self.onDomainLoadRequest, self), oDomainItem.name);
- }
- })
- ;
-
- require('App:Admin').reloadDomainList();
- };
-
- AdminSettingsDomains.prototype.onDomainLoadRequest = function (sResult, oData)
- {
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- require('App:Knoin').showScreenPopup(PopupsDomainViewModel, [oData.Result]);
- }
- };
-
- AdminSettingsDomains.prototype.onDomainListChangeRequest = function ()
- {
- require('App:Admin').reloadDomainList();
- };
-
- module.exports = AdminSettingsDomains;
-
-}(module, require));
-},{"App:Admin":3,"App:Knoin":21,"Enums":6,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"View:Popup:Domain":51,"_":19,"ko":16,"window":20}],34:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsGeneral()
- {
- this.mainLanguage = Data.mainLanguage;
- this.mainTheme = Data.mainTheme;
-
- this.language = Data.language;
- this.theme = Data.theme;
-
- this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
- this.capaThemes = Data.capaThemes;
- this.capaGravatar = Data.capaGravatar;
- this.capaAdditionalAccounts = Data.capaAdditionalAccounts;
- this.capaAdditionalIdentities = Data.capaAdditionalIdentities;
-
- this.mainAttachmentLimit = ko.observable(Utils.pInt(Settings.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
- this.uploadData = Settings.settingsGet('PhpUploadSizes');
- this.uploadDataDesc = this.uploadData && (this.uploadData['upload_max_filesize'] || this.uploadData['post_max_size']) ?
- [
- this.uploadData['upload_max_filesize'] ? 'upload_max_filesize = ' + this.uploadData['upload_max_filesize'] + '; ' : '',
- this.uploadData['post_max_size'] ? 'post_max_size = ' + this.uploadData['post_max_size'] : ''
- ].join('')
- : '';
-
- this.themesOptions = ko.computed(function () {
- return _.map(Data.themes(), function (sTheme) {
- return {
- 'optValue': sTheme,
- 'optText': Utils.convertThemeName(sTheme)
- };
- });
- });
-
- this.mainLanguageFullName = ko.computed(function () {
- return Utils.convertLangName(this.mainLanguage());
- }, this);
-
- this.weakPassword = !!Settings.settingsGet('WeakPassword');
-
- this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- }
-
- AdminSettingsGeneral.prototype.onBuild = function ()
- {
- var
- self = this,
- Remote = require('Storage:Admin:Remote')
- ;
-
- _.delay(function () {
-
- var
- f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self)
- ;
-
- self.mainAttachmentLimit.subscribe(function (sValue) {
- Remote.saveAdminConfig(f1, {
- 'AttachmentLimit': Utils.pInt(sValue)
- });
- });
-
- self.language.subscribe(function (sValue) {
- Remote.saveAdminConfig(f2, {
- 'Language': Utils.trim(sValue)
- });
- });
-
- self.theme.subscribe(function (sValue) {
- Remote.saveAdminConfig(f3, {
- 'Theme': Utils.trim(sValue)
- });
- });
-
- self.capaAdditionalAccounts.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'CapaAdditionalAccounts': bValue ? '1' : '0'
- });
- });
-
- self.capaAdditionalIdentities.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'CapaAdditionalIdentities': bValue ? '1' : '0'
- });
- });
-
- self.capaGravatar.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'CapaGravatar': bValue ? '1' : '0'
- });
- });
-
- self.capaThemes.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'CapaThemes': bValue ? '1' : '0'
- });
- });
-
- self.allowLanguagesOnSettings.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'AllowLanguagesOnSettings': bValue ? '1' : '0'
- });
- });
-
- }, 50);
- };
-
- AdminSettingsGeneral.prototype.selectLanguage = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:Languages'));
- };
-
- /**
- * @return {string}
- */
- AdminSettingsGeneral.prototype.phpInfoLink = function ()
- {
- return LinkBuilder.phpInfo();
- };
-
- module.exports = AdminSettingsGeneral;
-
-}(module, require));
-},{"App:Knoin":21,"Enums":6,"LinkBuilder":9,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"View:Popup:Languages":52,"_":19,"ko":16}],35:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
- moment = require('moment'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsLicensing()
- {
- this.licensing = Data.licensing;
- this.licensingProcess = Data.licensingProcess;
- this.licenseValid = Data.licenseValid;
- this.licenseExpired = Data.licenseExpired;
- this.licenseError = Data.licenseError;
- this.licenseTrigger = Data.licenseTrigger;
-
- this.adminDomain = ko.observable('');
- this.subscriptionEnabled = ko.observable(!!Settings.settingsGet('SubscriptionEnabled'));
-
- this.licenseTrigger.subscribe(function () {
- if (this.subscriptionEnabled())
- {
- require('App:Admin').reloadLicensing(true);
- }
- }, this);
- }
-
- AdminSettingsLicensing.prototype.onBuild = function ()
- {
- if (this.subscriptionEnabled())
- {
- require('App:Admin').reloadLicensing(false);
- }
- };
-
- AdminSettingsLicensing.prototype.onShow = function ()
- {
- this.adminDomain(Settings.settingsGet('AdminDomain'));
- };
-
- AdminSettingsLicensing.prototype.showActivationForm = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:Activate'));
- };
-
- /**
- * @returns {string}
- */
- AdminSettingsLicensing.prototype.licenseExpiredMomentValue = function ()
- {
- var
- iTime = this.licenseExpired(),
- oDate = moment.unix(iTime)
- ;
-
- return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')');
- };
-
- module.exports = AdminSettingsLicensing;
-
-}(module, require));
-},{"App:Admin":3,"App:Knoin":21,"Storage:Admin:Data":43,"Storage:Settings":45,"View:Popup:Activate":49,"ko":16,"moment":17}],36:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsLogin()
- {
- this.determineUserLanguage = Data.determineUserLanguage;
- this.determineUserDomain = Data.determineUserDomain;
-
- this.defaultDomain = ko.observable(Settings.settingsGet('LoginDefaultDomain'));
-
- this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
- this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
- }
-
- AdminSettingsLogin.prototype.onBuild = function ()
- {
- var
- self = this,
- Remote = require('Storage:Admin:Remote')
- ;
-
- _.delay(function () {
-
- var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
-
- self.determineUserLanguage.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'DetermineUserLanguage': bValue ? '1' : '0'
- });
- });
-
- self.determineUserDomain.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'DetermineUserDomain': bValue ? '1' : '0'
- });
- });
-
- self.allowLanguagesOnLogin.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'AllowLanguagesOnLogin': bValue ? '1' : '0'
- });
- });
-
- self.defaultDomain.subscribe(function (sValue) {
- Remote.saveAdminConfig(f1, {
- 'LoginDefaultDomain': Utils.trim(sValue)
- });
- });
-
- }, 50);
- };
-
- module.exports = AdminSettingsLogin;
-
-}(module, require));
-},{"Enums":6,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"_":19,"ko":16}],37:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Data = require('Storage:Admin:Data'),
- Remote = require('Storage:Admin:Remote')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsPackages()
- {
- this.packagesError = ko.observable('');
-
- this.packages = Data.packages;
- this.packagesLoading = Data.packagesLoading;
- this.packagesReal = Data.packagesReal;
- this.packagesMainUpdatable = Data.packagesMainUpdatable;
-
- this.packagesCurrent = this.packages.filter(function (oItem) {
- return oItem && '' !== oItem['installed'] && !oItem['compare'];
- });
-
- this.packagesAvailableForUpdate = this.packages.filter(function (oItem) {
- return oItem && '' !== oItem['installed'] && !!oItem['compare'];
- });
-
- this.packagesAvailableForInstallation = this.packages.filter(function (oItem) {
- return oItem && '' === oItem['installed'];
- });
-
- this.visibility = ko.computed(function () {
- return Data.packagesLoading() ? 'visible' : 'hidden';
- }, this);
- }
-
- AdminSettingsPackages.prototype.onShow = function ()
- {
- this.packagesError('');
- };
-
- AdminSettingsPackages.prototype.onBuild = function ()
- {
- require('App:Admin').reloadPackagesList();
- };
-
- AdminSettingsPackages.prototype.requestHelper = function (oPackage, bInstall)
- {
- var self = this;
- return function (sResult, oData) {
-
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- if (oData && oData.ErrorCode)
- {
- self.packagesError(Utils.getNotification(oData.ErrorCode));
- }
- else
- {
- self.packagesError(Utils.getNotification(
- bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
- }
- }
-
- _.each(Data.packages(), function (oItem) {
- if (oItem && oPackage && oItem['loading']() && oPackage['file'] === oItem['file'])
- {
- oPackage['loading'](false);
- oItem['loading'](false);
- }
- });
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result['Reload'])
- {
- window.location.reload();
- }
- else
- {
- require('App:Admin').reloadPackagesList();
+ kn.setHash(LinkBuilder.settings(), false, true);
}
};
- };
- AdminSettingsPackages.prototype.deletePackage = function (oPackage)
- {
- if (oPackage)
+ AbstractSettingsScreen.prototype.onHide = function ()
{
- oPackage['loading'](true);
- Remote.packageDelete(this.requestHelper(oPackage, false), oPackage);
- }
- };
+ if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
+ {
+ Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
+ this.oCurrentSubScreen.viewModelDom.hide();
+ }
+ };
- AdminSettingsPackages.prototype.installPackage = function (oPackage)
- {
- if (oPackage)
+ AbstractSettingsScreen.prototype.onBuild = function ()
{
- oPackage['loading'](true);
- Remote.packageInstall(this.requestHelper(oPackage, true), oPackage);
- }
- };
-
- module.exports = AdminSettingsPackages;
-
-}(module, require));
-},{"App:Admin":3,"Enums":6,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Utils":11,"ko":16,"window":20}],38:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data'),
- Remote = require('Storage:Admin:Remote')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsPlugins()
- {
- this.enabledPlugins = ko.observable(!!Settings.settingsGet('EnabledPlugins'));
-
- this.pluginsError = ko.observable('');
-
- this.plugins = Data.plugins;
- this.pluginsLoading = Data.pluginsLoading;
-
- this.visibility = ko.computed(function () {
- return Data.pluginsLoading() ? 'visible' : 'hidden';
- }, this);
-
- this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
- this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
- }
-
- AdminSettingsPlugins.prototype.disablePlugin = function (oPlugin)
- {
- oPlugin.disabled(!oPlugin.disabled());
- Remote.pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
- };
-
- AdminSettingsPlugins.prototype.configurePlugin = function (oPlugin)
- {
- Remote.plugin(this.onPluginLoadRequest, oPlugin.name);
- };
-
- AdminSettingsPlugins.prototype.onBuild = function (oDom)
- {
- var self = this;
-
- oDom
- .on('click', '.e-item .configure-plugin-action', function () {
- var oPlugin = ko.dataFor(this);
- if (oPlugin)
+ _.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
+ if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
+ !_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
+ return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
+ }))
{
- self.configurePlugin(oPlugin);
+ 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;
+ })
+ });
}
- })
- .on('click', '.e-item .disabled-plugin', function () {
- var oPlugin = ko.dataFor(this);
- if (oPlugin)
- {
- self.disablePlugin(oPlugin);
+ }, this);
+
+ this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
+ };
+
+ AbstractSettingsScreen.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 = AbstractSettingsScreen;
+
+ }());
+
+/***/ },
+
+/***/ 62:
+/*!*****************************************!*\
+ !*** ./dev/Screens/AdminLoginScreen.js ***!
+ \*****************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ KnoinAbstractScreen = __webpack_require__(/*! Knoin:AbstractScreen */ 24)
;
- this.enabledPlugins.subscribe(function (bValue) {
- Remote.saveAdminConfig(Utils.emptyFunction, {
- 'EnabledPlugins': bValue ? '1' : '0'
- });
- });
- };
-
- AdminSettingsPlugins.prototype.onShow = function ()
- {
- this.pluginsError('');
- require('App:Admin').reloadPluginList();
- };
-
- AdminSettingsPlugins.prototype.onPluginLoadRequest = function (sResult, oData)
- {
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ /**
+ * @constructor
+ * @extends KnoinAbstractScreen
+ */
+ function AdminLoginScreen()
{
- require('App:Knoin').showScreenPopup(require('View:Popup:Plugin'), [oData.Result]);
+ KnoinAbstractScreen.call(this, 'login', [
+ __webpack_require__(/*! View:Admin:Login */ 93)
+ ]);
}
- };
- AdminSettingsPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
- {
- if (Enums.StorageResultType.Success === sResult && oData)
+ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
+
+ AdminLoginScreen.prototype.onShow = function ()
{
- if (!oData.Result && oData.ErrorCode)
+ __webpack_require__(/*! App:Admin */ 16).setTitle('');
+ };
+
+ module.exports = AdminLoginScreen;
+
+ }());
+
+/***/ },
+
+/***/ 63:
+/*!********************************************!*\
+ !*** ./dev/Screens/AdminSettingsScreen.js ***!
+ \********************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+
+ AbstractSettings = __webpack_require__(/*! Screen:AbstractSettings */ 29)
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractSettings
+ */
+ function AdminSettingsScreen()
+ {
+ AbstractSettings.call(this, [
+ __webpack_require__(/*! View:Admin:SettingsMenu */ 94),
+ __webpack_require__(/*! View:Admin:SettingsPane */ 95)
+ ]);
+ }
+
+ _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
+
+ /**
+ * @param {Function=} fCallback
+ */
+ AdminSettingsScreen.prototype.setupSettings = function (fCallback)
+ {
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:General */ 71),
+ 'AdminSettingsGeneral', 'General', 'general', true);
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Login */ 73),
+ 'AdminSettingsLogin', 'Login', 'login');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Branding */ 68),
+ 'AdminSettingsBranding', 'Branding', 'branding');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Contacts */ 69),
+ 'AdminSettingsContacts', 'Contacts', 'contacts');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Domains */ 70),
+ 'AdminSettingsDomains', 'Domains', 'domains');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Security */ 76),
+ 'AdminSettingsSecurity', 'Security', 'security');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Social */ 77),
+ 'AdminSettingsSocial', 'Social', 'social');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Plugins */ 75),
+ 'AdminSettingsPlugins', 'Plugins', 'plugins');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Packages */ 74),
+ 'AdminSettingsPackages', 'Packages', 'packages');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:Licensing */ 72),
+ 'AdminSettingsLicensing', 'Licensing', 'licensing');
+
+ kn.addSettingsViewModel(__webpack_require__(/*! Settings:Admin:About */ 67),
+ 'AdminSettingsAbout', 'About', 'about');
+
+ if (fCallback)
{
- if (Enums.Notification.UnsupportedPluginPackage === oData.ErrorCode && oData.ErrorMessage && '' !== oData.ErrorMessage)
+ fCallback();
+ }
+ };
+
+ AdminSettingsScreen.prototype.onShow = function ()
+ {
+ __webpack_require__(/*! App:Admin */ 16).setTitle('');
+ };
+
+ module.exports = AdminSettingsScreen;
+
+ }());
+
+/***/ },
+
+/***/ 67:
+/*!**************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsAbout.js ***!
+ \**************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ ko = __webpack_require__(/*! ko */ 3)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsAbout()
+ {
+ var
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18)
+ ;
+
+ this.version = ko.observable(Settings.settingsGet('Version'));
+ this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
+ this.errorDesc = ko.observable('');
+
+ this.coreReal = Data.coreReal;
+ this.coreUpdatable = Data.coreUpdatable;
+ this.coreAccess = Data.coreAccess;
+ this.coreChecking = Data.coreChecking;
+ this.coreUpdating = Data.coreUpdating;
+ this.coreRemoteVersion = Data.coreRemoteVersion;
+ this.coreRemoteRelease = Data.coreRemoteRelease;
+ this.coreVersionCompare = Data.coreVersionCompare;
+
+ this.statusType = ko.computed(function () {
+
+ var
+ sType = '',
+ iVersionCompare = this.coreVersionCompare(),
+ bChecking = this.coreChecking(),
+ bUpdating = this.coreUpdating(),
+ bReal = this.coreReal()
+ ;
+
+ if (bChecking)
{
- this.pluginsError(oData.ErrorMessage);
+ sType = 'checking';
+ }
+ else if (bUpdating)
+ {
+ sType = 'updating';
+ }
+ else if (bReal && 0 === iVersionCompare)
+ {
+ sType = 'up-to-date';
+ }
+ else if (bReal && -1 === iVersionCompare)
+ {
+ sType = 'available';
+ }
+ else if (!bReal)
+ {
+ sType = 'error';
+ this.errorDesc('Cannot access the repository at the moment.');
+ }
+
+ return sType;
+
+ }, this);
+ }
+
+ AdminSettingsAbout.prototype.onBuild = function ()
+ {
+ if (this.access())
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadCoreData();
+ }
+ };
+
+ AdminSettingsAbout.prototype.updateCoreData = function ()
+ {
+ if (!this.coreUpdating())
+ {
+ __webpack_require__(/*! App:Admin */ 16).updateCoreData();
+ }
+ };
+
+ module.exports = AdminSettingsAbout;
+
+ }());
+
+/***/ },
+
+/***/ 68:
+/*!*****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsBranding.js ***!
+ \*****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsBranding()
+ {
+ var
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Settings = __webpack_require__(/*! Storage:Settings */ 10)
+ ;
+
+ this.title = ko.observable(Settings.settingsGet('Title'));
+ this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
+ this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo'));
+ this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.loginDescription = ko.observable(Settings.settingsGet('LoginDescription'));
+ this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.loginCss = ko.observable(Settings.settingsGet('LoginCss'));
+ this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ }
+
+ AdminSettingsBranding.prototype.onBuild = function ()
+ {
+ var
+ self = this,
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ _.delay(function () {
+
+ var
+ f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
+ f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
+ f3 = Utils.settingsSaveHelperSimpleFunction(self.loginLogo.trigger, self),
+ f4 = Utils.settingsSaveHelperSimpleFunction(self.loginDescription.trigger, self),
+ f5 = Utils.settingsSaveHelperSimpleFunction(self.loginCss.trigger, self)
+ ;
+
+ self.title.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f1, {
+ 'Title': Utils.trim(sValue)
+ });
+ });
+
+ self.loadingDesc.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f2, {
+ 'LoadingDescription': Utils.trim(sValue)
+ });
+ });
+
+ self.loginLogo.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f3, {
+ 'LoginLogo': Utils.trim(sValue)
+ });
+ });
+
+ self.loginDescription.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f4, {
+ 'LoginDescription': Utils.trim(sValue)
+ });
+ });
+
+ self.loginCss.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f5, {
+ 'LoginCss': Utils.trim(sValue)
+ });
+ });
+
+ }, 50);
+ };
+
+ module.exports = AdminSettingsBranding;
+
+ }());
+
+/***/ },
+
+/***/ 69:
+/*!*****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsContacts.js ***!
+ \*****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsContacts()
+ {
+ var
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
+ this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable'));
+ this.contactsSharing = ko.observable(!!Settings.settingsGet('ContactsSharing'));
+ this.contactsSync = ko.observable(!!Settings.settingsGet('ContactsSync'));
+
+ var
+ aTypes = ['sqlite', 'mysql', 'pgsql'],
+ aSupportedTypes = [],
+ getTypeName = function(sName) {
+ switch (sName)
+ {
+ case 'sqlite':
+ sName = 'SQLite';
+ break;
+ case 'mysql':
+ sName = 'MySQL';
+ break;
+ case 'pgsql':
+ sName = 'PostgreSQL';
+ break;
+ }
+
+ return sName;
+ }
+ ;
+
+ if (!!Settings.settingsGet('SQLiteIsSupported'))
+ {
+ aSupportedTypes.push('sqlite');
+ }
+ if (!!Settings.settingsGet('MySqlIsSupported'))
+ {
+ aSupportedTypes.push('mysql');
+ }
+ if (!!Settings.settingsGet('PostgreSqlIsSupported'))
+ {
+ aSupportedTypes.push('pgsql');
+ }
+
+ this.contactsSupported = 0 < aSupportedTypes.length;
+
+ this.contactsTypes = ko.observableArray([]);
+ this.contactsTypesOptions = this.contactsTypes.map(function (sValue) {
+ var bDisabled = -1 === Utils.inArray(sValue, aSupportedTypes);
+ return {
+ 'id': sValue,
+ 'name': getTypeName(sValue) + (bDisabled ? ' (not supported)' : ''),
+ 'disabled': bDisabled
+ };
+ });
+
+ this.contactsTypes(aTypes);
+ this.contactsType = ko.observable('');
+
+ this.mainContactsType = ko.computed({
+ 'owner': this,
+ 'read': this.contactsType,
+ 'write': function (sValue) {
+ if (sValue !== this.contactsType())
+ {
+ if (-1 < Utils.inArray(sValue, aSupportedTypes))
+ {
+ this.contactsType(sValue);
+ }
+ else if (0 < aSupportedTypes.length)
+ {
+ this.contactsType('');
+ }
+ }
+ else
+ {
+ this.contactsType.valueHasMutated();
+ }
+ }
+ });
+
+ this.contactsType.subscribe(function () {
+ this.testContactsSuccess(false);
+ this.testContactsError(false);
+ this.testContactsErrorMessage('');
+ }, this);
+
+ this.pdoDsn = ko.observable(Settings.settingsGet('ContactsPdoDsn'));
+ this.pdoUser = ko.observable(Settings.settingsGet('ContactsPdoUser'));
+ this.pdoPassword = ko.observable(Settings.settingsGet('ContactsPdoPassword'));
+
+ this.pdoDsnTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.pdoUserTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.pdoPasswordTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.contactsTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.testing = ko.observable(false);
+ this.testContactsSuccess = ko.observable(false);
+ this.testContactsError = ko.observable(false);
+ this.testContactsErrorMessage = ko.observable('');
+
+ this.testContactsCommand = Utils.createCommand(this, function () {
+
+ this.testContactsSuccess(false);
+ this.testContactsError(false);
+ this.testContactsErrorMessage('');
+ this.testing(true);
+
+ Remote.testContacts(this.onTestContactsResponse, {
+ 'ContactsPdoType': this.contactsType(),
+ 'ContactsPdoDsn': this.pdoDsn(),
+ 'ContactsPdoUser': this.pdoUser(),
+ 'ContactsPdoPassword': this.pdoPassword()
+ });
+
+ }, function () {
+ return '' !== this.pdoDsn() && '' !== this.pdoUser();
+ });
+
+ this.contactsType(Settings.settingsGet('ContactsPdoType'));
+
+ this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
+ }
+
+ AdminSettingsContacts.prototype.onTestContactsResponse = function (sResult, oData)
+ {
+ this.testContactsSuccess(false);
+ this.testContactsError(false);
+ this.testContactsErrorMessage('');
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.Result)
+ {
+ this.testContactsSuccess(true);
+ }
+ else
+ {
+ this.testContactsError(true);
+ if (oData && oData.Result)
+ {
+ this.testContactsErrorMessage(oData.Result.Message || '');
}
else
{
- this.pluginsError(Utils.getNotification(oData.ErrorCode));
+ this.testContactsErrorMessage('');
}
}
+
+ this.testing(false);
+ };
+
+ AdminSettingsContacts.prototype.onShow = function ()
+ {
+ this.testContactsSuccess(false);
+ this.testContactsError(false);
+ this.testContactsErrorMessage('');
+ };
+
+ AdminSettingsContacts.prototype.onBuild = function ()
+ {
+ var
+ self = this,
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ _.delay(function () {
+
+ var
+ f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self),
+ f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self),
+ f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self),
+ f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self)
+ ;
+
+ self.enableContacts.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'ContactsEnable': bValue ? '1' : '0'
+ });
+ });
+
+ self.contactsSharing.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'ContactsSharing': bValue ? '1' : '0'
+ });
+ });
+
+ self.contactsSync.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'ContactsSync': bValue ? '1' : '0'
+ });
+ });
+
+ self.contactsType.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f5, {
+ 'ContactsPdoType': sValue
+ });
+ });
+
+ self.pdoDsn.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f1, {
+ 'ContactsPdoDsn': Utils.trim(sValue)
+ });
+ });
+
+ self.pdoUser.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f3, {
+ 'ContactsPdoUser': Utils.trim(sValue)
+ });
+ });
+
+ self.pdoPassword.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f4, {
+ 'ContactsPdoPassword': Utils.trim(sValue)
+ });
+ });
+
+ self.contactsType(Settings.settingsGet('ContactsPdoType'));
+
+ }, 50);
+ };
+
+ module.exports = AdminSettingsContacts;
+
+ }());
+
+/***/ },
+
+/***/ 70:
+/*!****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsDomains.js ***!
+ \****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+
+ PopupsDomainViewModel = __webpack_require__(/*! View:Popup:Domain */ 105),
+
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18),
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsDomains()
+ {
+ this.domains = Data.domains;
+ this.domainsLoading = Data.domainsLoading;
+
+ this.iDomainForDeletionTimeout = 0;
+
+ this.visibility = ko.computed(function () {
+ return Data.domainsLoading() ? 'visible' : 'hidden';
+ }, this);
+
+ this.domainForDeletion = ko.observable(null).extend({'toggleSubscribe': [this,
+ function (oPrev) {
+ if (oPrev)
+ {
+ oPrev.deleteAccess(false);
+ }
+ }, function (oNext) {
+ if (oNext)
+ {
+ oNext.deleteAccess(true);
+ this.startDomainForDeletionTimeout();
+ }
+ }
+ ]});
}
- require('App:Admin').reloadPluginList();
- };
+ AdminSettingsDomains.prototype.startDomainForDeletionTimeout = function ()
+ {
+ var self = this;
+ window.clearInterval(this.iDomainForDeletionTimeout);
+ this.iDomainForDeletionTimeout = window.setTimeout(function () {
+ self.domainForDeletion(null);
+ }, 1000 * 3);
+ };
- module.exports = AdminSettingsPlugins;
+ AdminSettingsDomains.prototype.createDomain = function ()
+ {
+ __webpack_require__(/*! App:Knoin */ 5).showScreenPopup(PopupsDomainViewModel);
+ };
-}(module, require));
-},{"App:Admin":3,"App:Knoin":21,"Enums":6,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"View:Popup:Plugin":53,"_":19,"ko":16}],39:[function(require,module,exports){
+ AdminSettingsDomains.prototype.deleteDomain = function (oDomain)
+ {
+ this.domains.remove(oDomain);
+ Remote.domainDelete(_.bind(this.onDomainListChangeRequest, this), oDomain.name);
+ };
-(function (module, require) {
+ AdminSettingsDomains.prototype.disableDomain = function (oDomain)
+ {
+ oDomain.disabled(!oDomain.disabled());
+ Remote.domainDisable(_.bind(this.onDomainListChangeRequest, this), oDomain.name, oDomain.disabled());
+ };
- 'use strict';
+ AdminSettingsDomains.prototype.onBuild = function (oDom)
+ {
+ var self = this;
+ oDom
+ .on('click', '.b-admin-domains-list-table .e-item .e-action', function () {
+ var oDomainItem = ko.dataFor(this);
+ if (oDomainItem)
+ {
+ Remote.domain(_.bind(self.onDomainLoadRequest, self), oDomainItem.name);
+ }
+ })
+ ;
- var
- _ = require('_'),
- ko = require('ko'),
+ __webpack_require__(/*! App:Admin */ 16).reloadDomainList();
+ };
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data'),
- Remote = require('Storage:Admin:Remote')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsSecurity()
- {
- this.useLocalProxyForExternalImages = Data.useLocalProxyForExternalImages;
-
- this.capaOpenPGP = ko.observable(Settings.capa(Enums.Capa.OpenPGP));
- this.capaTwoFactorAuth = ko.observable(Settings.capa(Enums.Capa.TwoFactor));
-
- this.adminLogin = ko.observable(Settings.settingsGet('AdminLogin'));
- this.adminPassword = ko.observable('');
- this.adminPasswordNew = ko.observable('');
- this.adminPasswordNew2 = ko.observable('');
- this.adminPasswordNewError = ko.observable(false);
-
- this.adminPasswordUpdateError = ko.observable(false);
- this.adminPasswordUpdateSuccess = ko.observable(false);
-
- this.adminPassword.subscribe(function () {
- this.adminPasswordUpdateError(false);
- this.adminPasswordUpdateSuccess(false);
- }, this);
-
- this.adminPasswordNew.subscribe(function () {
- this.adminPasswordUpdateError(false);
- this.adminPasswordUpdateSuccess(false);
- this.adminPasswordNewError(false);
- }, this);
-
- this.adminPasswordNew2.subscribe(function () {
- this.adminPasswordUpdateError(false);
- this.adminPasswordUpdateSuccess(false);
- this.adminPasswordNewError(false);
- }, this);
-
- this.saveNewAdminPasswordCommand = Utils.createCommand(this, function () {
-
- if (this.adminPasswordNew() !== this.adminPasswordNew2())
+ AdminSettingsDomains.prototype.onDomainLoadRequest = function (sResult, oData)
+ {
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
- this.adminPasswordNewError(true);
- return false;
+ __webpack_require__(/*! App:Knoin */ 5).showScreenPopup(PopupsDomainViewModel, [oData.Result]);
}
+ };
- this.adminPasswordUpdateError(false);
- this.adminPasswordUpdateSuccess(false);
+ AdminSettingsDomains.prototype.onDomainListChangeRequest = function ()
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadDomainList();
+ };
- Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
- 'Password': this.adminPassword(),
- 'NewPassword': this.adminPasswordNew()
+ module.exports = AdminSettingsDomains;
+
+ }());
+
+/***/ },
+
+/***/ 71:
+/*!****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsGeneral.js ***!
+ \****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsGeneral()
+ {
+ this.mainLanguage = Data.mainLanguage;
+ this.mainTheme = Data.mainTheme;
+
+ this.language = Data.language;
+ this.theme = Data.theme;
+
+ this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
+ this.capaThemes = Data.capaThemes;
+ this.capaGravatar = Data.capaGravatar;
+ this.capaAdditionalAccounts = Data.capaAdditionalAccounts;
+ this.capaAdditionalIdentities = Data.capaAdditionalIdentities;
+
+ this.mainAttachmentLimit = ko.observable(Utils.pInt(Settings.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
+ this.uploadData = Settings.settingsGet('PhpUploadSizes');
+ this.uploadDataDesc = this.uploadData && (this.uploadData['upload_max_filesize'] || this.uploadData['post_max_size']) ?
+ [
+ this.uploadData['upload_max_filesize'] ? 'upload_max_filesize = ' + this.uploadData['upload_max_filesize'] + '; ' : '',
+ this.uploadData['post_max_size'] ? 'post_max_size = ' + this.uploadData['post_max_size'] : ''
+ ].join('')
+ : '';
+
+ this.themesOptions = ko.computed(function () {
+ return _.map(Data.themes(), function (sTheme) {
+ return {
+ 'optValue': sTheme,
+ 'optText': Utils.convertThemeName(sTheme)
+ };
+ });
});
- }, function () {
- return '' !== this.adminPassword() && '' !== this.adminPasswordNew() && '' !== this.adminPasswordNew2();
- });
+ this.mainLanguageFullName = ko.computed(function () {
+ return Utils.convertLangName(this.mainLanguage());
+ }, this);
- this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
- }
+ this.weakPassword = !!Settings.settingsGet('WeakPassword');
- AdminSettingsSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData)
- {
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ }
+
+ AdminSettingsGeneral.prototype.onBuild = function ()
+ {
+ var
+ self = this,
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ _.delay(function () {
+
+ var
+ f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
+ f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
+ f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self)
+ ;
+
+ self.mainAttachmentLimit.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f1, {
+ 'AttachmentLimit': Utils.pInt(sValue)
+ });
+ });
+
+ self.language.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f2, {
+ 'Language': Utils.trim(sValue)
+ });
+ });
+
+ self.theme.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f3, {
+ 'Theme': Utils.trim(sValue)
+ });
+ });
+
+ self.capaAdditionalAccounts.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'CapaAdditionalAccounts': bValue ? '1' : '0'
+ });
+ });
+
+ self.capaAdditionalIdentities.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'CapaAdditionalIdentities': bValue ? '1' : '0'
+ });
+ });
+
+ self.capaGravatar.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'CapaGravatar': bValue ? '1' : '0'
+ });
+ });
+
+ self.capaThemes.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'CapaThemes': bValue ? '1' : '0'
+ });
+ });
+
+ self.allowLanguagesOnSettings.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'AllowLanguagesOnSettings': bValue ? '1' : '0'
+ });
+ });
+
+ }, 50);
+ };
+
+ AdminSettingsGeneral.prototype.selectLanguage = function ()
+ {
+ __webpack_require__(/*! App:Knoin */ 5).showScreenPopup(__webpack_require__(/*! View:Popup:Languages */ 32));
+ };
+
+ /**
+ * @return {string}
+ */
+ AdminSettingsGeneral.prototype.phpInfoLink = function ()
+ {
+ return LinkBuilder.phpInfo();
+ };
+
+ module.exports = AdminSettingsGeneral;
+
+ }());
+
+/***/ },
+
+/***/ 72:
+/*!******************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsLicensing.js ***!
+ \******************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ ko = __webpack_require__(/*! ko */ 3),
+ moment = __webpack_require__(/*! moment */ 25),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsLicensing()
+ {
+ this.licensing = Data.licensing;
+ this.licensingProcess = Data.licensingProcess;
+ this.licenseValid = Data.licenseValid;
+ this.licenseExpired = Data.licenseExpired;
+ this.licenseError = Data.licenseError;
+ this.licenseTrigger = Data.licenseTrigger;
+
+ this.adminDomain = ko.observable('');
+ this.subscriptionEnabled = ko.observable(!!Settings.settingsGet('SubscriptionEnabled'));
+
+ this.licenseTrigger.subscribe(function () {
+ if (this.subscriptionEnabled())
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadLicensing(true);
+ }
+ }, this);
+ }
+
+ AdminSettingsLicensing.prototype.onBuild = function ()
+ {
+ if (this.subscriptionEnabled())
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadLicensing(false);
+ }
+ };
+
+ AdminSettingsLicensing.prototype.onShow = function ()
+ {
+ this.adminDomain(Settings.settingsGet('AdminDomain'));
+ };
+
+ AdminSettingsLicensing.prototype.showActivationForm = function ()
+ {
+ __webpack_require__(/*! App:Knoin */ 5).showScreenPopup(__webpack_require__(/*! View:Popup:Activate */ 101));
+ };
+
+ /**
+ * @returns {string}
+ */
+ AdminSettingsLicensing.prototype.licenseExpiredMomentValue = function ()
+ {
+ var
+ iTime = this.licenseExpired(),
+ oDate = moment.unix(iTime)
+ ;
+
+ return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')');
+ };
+
+ module.exports = AdminSettingsLicensing;
+
+ }());
+
+/***/ },
+
+/***/ 73:
+/*!**************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsLogin.js ***!
+ \**************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsLogin()
+ {
+ this.determineUserLanguage = Data.determineUserLanguage;
+ this.determineUserDomain = Data.determineUserDomain;
+
+ this.defaultDomain = ko.observable(Settings.settingsGet('LoginDefaultDomain'));
+
+ this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
+ this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
+ }
+
+ AdminSettingsLogin.prototype.onBuild = function ()
+ {
+ var
+ self = this,
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ _.delay(function () {
+
+ var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
+
+ self.determineUserLanguage.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'DetermineUserLanguage': bValue ? '1' : '0'
+ });
+ });
+
+ self.determineUserDomain.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'DetermineUserDomain': bValue ? '1' : '0'
+ });
+ });
+
+ self.allowLanguagesOnLogin.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'AllowLanguagesOnLogin': bValue ? '1' : '0'
+ });
+ });
+
+ self.defaultDomain.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f1, {
+ 'LoginDefaultDomain': Utils.trim(sValue)
+ });
+ });
+
+ }, 50);
+ };
+
+ module.exports = AdminSettingsLogin;
+
+ }());
+
+/***/ },
+
+/***/ 74:
+/*!*****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsPackages.js ***!
+ \*****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18),
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsPackages()
+ {
+ this.packagesError = ko.observable('');
+
+ this.packages = Data.packages;
+ this.packagesLoading = Data.packagesLoading;
+ this.packagesReal = Data.packagesReal;
+ this.packagesMainUpdatable = Data.packagesMainUpdatable;
+
+ this.packagesCurrent = this.packages.filter(function (oItem) {
+ return oItem && '' !== oItem['installed'] && !oItem['compare'];
+ });
+
+ this.packagesAvailableForUpdate = this.packages.filter(function (oItem) {
+ return oItem && '' !== oItem['installed'] && !!oItem['compare'];
+ });
+
+ this.packagesAvailableForInstallation = this.packages.filter(function (oItem) {
+ return oItem && '' === oItem['installed'];
+ });
+
+ this.visibility = ko.computed(function () {
+ return Data.packagesLoading() ? 'visible' : 'hidden';
+ }, this);
+ }
+
+ AdminSettingsPackages.prototype.onShow = function ()
+ {
+ this.packagesError('');
+ };
+
+ AdminSettingsPackages.prototype.onBuild = function ()
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadPackagesList();
+ };
+
+ AdminSettingsPackages.prototype.requestHelper = function (oPackage, bInstall)
+ {
+ var self = this;
+ return function (sResult, oData) {
+
+ if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
+ {
+ if (oData && oData.ErrorCode)
+ {
+ self.packagesError(Utils.getNotification(oData.ErrorCode));
+ }
+ else
+ {
+ self.packagesError(Utils.getNotification(
+ bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
+ }
+ }
+
+ _.each(Data.packages(), function (oItem) {
+ if (oItem && oPackage && oItem['loading']() && oPackage['file'] === oItem['file'])
+ {
+ oPackage['loading'](false);
+ oItem['loading'](false);
+ }
+ });
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result['Reload'])
+ {
+ window.location.reload();
+ }
+ else
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadPackagesList();
+ }
+ };
+ };
+
+ AdminSettingsPackages.prototype.deletePackage = function (oPackage)
+ {
+ if (oPackage)
+ {
+ oPackage['loading'](true);
+ Remote.packageDelete(this.requestHelper(oPackage, false), oPackage);
+ }
+ };
+
+ AdminSettingsPackages.prototype.installPackage = function (oPackage)
+ {
+ if (oPackage)
+ {
+ oPackage['loading'](true);
+ Remote.packageInstall(this.requestHelper(oPackage, true), oPackage);
+ }
+ };
+
+ module.exports = AdminSettingsPackages;
+
+ }());
+
+/***/ },
+
+/***/ 75:
+/*!****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsPlugins.js ***!
+ \****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18),
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsPlugins()
+ {
+ this.enabledPlugins = ko.observable(!!Settings.settingsGet('EnabledPlugins'));
+
+ this.pluginsError = ko.observable('');
+
+ this.plugins = Data.plugins;
+ this.pluginsLoading = Data.pluginsLoading;
+
+ this.visibility = ko.computed(function () {
+ return Data.pluginsLoading() ? 'visible' : 'hidden';
+ }, this);
+
+ this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
+ this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
+ }
+
+ AdminSettingsPlugins.prototype.disablePlugin = function (oPlugin)
+ {
+ oPlugin.disabled(!oPlugin.disabled());
+ Remote.pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
+ };
+
+ AdminSettingsPlugins.prototype.configurePlugin = function (oPlugin)
+ {
+ Remote.plugin(this.onPluginLoadRequest, oPlugin.name);
+ };
+
+ AdminSettingsPlugins.prototype.onBuild = function (oDom)
+ {
+ var self = this;
+
+ oDom
+ .on('click', '.e-item .configure-plugin-action', function () {
+ var oPlugin = ko.dataFor(this);
+ if (oPlugin)
+ {
+ self.configurePlugin(oPlugin);
+ }
+ })
+ .on('click', '.e-item .disabled-plugin', function () {
+ var oPlugin = ko.dataFor(this);
+ if (oPlugin)
+ {
+ self.disablePlugin(oPlugin);
+ }
+ })
+ ;
+
+ this.enabledPlugins.subscribe(function (bValue) {
+ Remote.saveAdminConfig(Utils.emptyFunction, {
+ 'EnabledPlugins': bValue ? '1' : '0'
+ });
+ });
+ };
+
+ AdminSettingsPlugins.prototype.onShow = function ()
+ {
+ this.pluginsError('');
+ __webpack_require__(/*! App:Admin */ 16).reloadPluginList();
+ };
+
+ AdminSettingsPlugins.prototype.onPluginLoadRequest = function (sResult, oData)
+ {
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ __webpack_require__(/*! App:Knoin */ 5).showScreenPopup(__webpack_require__(/*! View:Popup:Plugin */ 109), [oData.Result]);
+ }
+ };
+
+ AdminSettingsPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
+ {
+ if (Enums.StorageResultType.Success === sResult && oData)
+ {
+ if (!oData.Result && oData.ErrorCode)
+ {
+ if (Enums.Notification.UnsupportedPluginPackage === oData.ErrorCode && oData.ErrorMessage && '' !== oData.ErrorMessage)
+ {
+ this.pluginsError(oData.ErrorMessage);
+ }
+ else
+ {
+ this.pluginsError(Utils.getNotification(oData.ErrorCode));
+ }
+ }
+ }
+
+ __webpack_require__(/*! App:Admin */ 16).reloadPluginList();
+ };
+
+ module.exports = AdminSettingsPlugins;
+
+ }());
+
+/***/ },
+
+/***/ 76:
+/*!*****************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsSecurity.js ***!
+ \*****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18),
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsSecurity()
+ {
+ this.useLocalProxyForExternalImages = Data.useLocalProxyForExternalImages;
+
+ this.capaOpenPGP = ko.observable(Settings.capa(Enums.Capa.OpenPGP));
+ this.capaTwoFactorAuth = ko.observable(Settings.capa(Enums.Capa.TwoFactor));
+
+ this.adminLogin = ko.observable(Settings.settingsGet('AdminLogin'));
+ this.adminPassword = ko.observable('');
+ this.adminPasswordNew = ko.observable('');
+ this.adminPasswordNew2 = ko.observable('');
+ this.adminPasswordNewError = ko.observable(false);
+
+ this.adminPasswordUpdateError = ko.observable(false);
+ this.adminPasswordUpdateSuccess = ko.observable(false);
+
+ this.adminPassword.subscribe(function () {
+ this.adminPasswordUpdateError(false);
+ this.adminPasswordUpdateSuccess(false);
+ }, this);
+
+ this.adminPasswordNew.subscribe(function () {
+ this.adminPasswordUpdateError(false);
+ this.adminPasswordUpdateSuccess(false);
+ this.adminPasswordNewError(false);
+ }, this);
+
+ this.adminPasswordNew2.subscribe(function () {
+ this.adminPasswordUpdateError(false);
+ this.adminPasswordUpdateSuccess(false);
+ this.adminPasswordNewError(false);
+ }, this);
+
+ this.saveNewAdminPasswordCommand = Utils.createCommand(this, function () {
+
+ if (this.adminPasswordNew() !== this.adminPasswordNew2())
+ {
+ this.adminPasswordNewError(true);
+ return false;
+ }
+
+ this.adminPasswordUpdateError(false);
+ this.adminPasswordUpdateSuccess(false);
+
+ Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
+ 'Password': this.adminPassword(),
+ 'NewPassword': this.adminPasswordNew()
+ });
+
+ }, function () {
+ return '' !== this.adminPassword() && '' !== this.adminPasswordNew() && '' !== this.adminPasswordNew2();
+ });
+
+ this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
+ }
+
+ AdminSettingsSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData)
+ {
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ this.adminPassword('');
+ this.adminPasswordNew('');
+ this.adminPasswordNew2('');
+
+ this.adminPasswordUpdateSuccess(true);
+ }
+ else
+ {
+ this.adminPasswordUpdateError(true);
+ }
+ };
+
+ AdminSettingsSecurity.prototype.onBuild = function ()
+ {
+ var
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
+ ;
+
+ this.capaOpenPGP.subscribe(function (bValue) {
+ Remote.saveAdminConfig(Utils.emptyFunction, {
+ 'CapaOpenPGP': bValue ? '1' : '0'
+ });
+ });
+
+ this.capaTwoFactorAuth.subscribe(function (bValue) {
+ Remote.saveAdminConfig(Utils.emptyFunction, {
+ 'CapaTwoFactorAuth': bValue ? '1' : '0'
+ });
+ });
+
+ this.useLocalProxyForExternalImages.subscribe(function (bValue) {
+ Remote.saveAdminConfig(null, {
+ 'UseLocalProxyForExternalImages': bValue ? '1' : '0'
+ });
+ });
+ };
+
+ AdminSettingsSecurity.prototype.onHide = function ()
{
this.adminPassword('');
this.adminPasswordNew('');
this.adminPasswordNew2('');
+ };
- this.adminPasswordUpdateSuccess(true);
- }
- else
+ /**
+ * @return {string}
+ */
+ AdminSettingsSecurity.prototype.phpInfoLink = function ()
{
- this.adminPasswordUpdateError(true);
+ return LinkBuilder.phpInfo();
+ };
+
+ module.exports = AdminSettingsSecurity;
+
+ }());
+
+
+/***/ },
+
+/***/ 77:
+/*!***************************************************!*\
+ !*** ./dev/Settings/Admin/AdminSettingsSocial.js ***!
+ \***************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AdminSettingsSocial()
+ {
+ var Data = __webpack_require__(/*! Storage:Admin:Data */ 18);
+
+ this.googleEnable = Data.googleEnable;
+ this.googleClientID = Data.googleClientID;
+ this.googleApiKey = Data.googleApiKey;
+ this.googleClientSecret = Data.googleClientSecret;
+ this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.facebookSupported = Data.facebookSupported;
+ this.facebookEnable = Data.facebookEnable;
+ this.facebookAppID = Data.facebookAppID;
+ this.facebookAppSecret = Data.facebookAppSecret;
+ this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.twitterEnable = Data.twitterEnable;
+ this.twitterConsumerKey = Data.twitterConsumerKey;
+ this.twitterConsumerSecret = Data.twitterConsumerSecret;
+ this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
+ this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
+
+ this.dropboxEnable = Data.dropboxEnable;
+ this.dropboxApiKey = Data.dropboxApiKey;
+ this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
}
- };
-
- AdminSettingsSecurity.prototype.onBuild = function ()
- {
- var
- Remote = require('Storage:Admin:Remote')
- ;
-
- this.capaOpenPGP.subscribe(function (bValue) {
- Remote.saveAdminConfig(Utils.emptyFunction, {
- 'CapaOpenPGP': bValue ? '1' : '0'
- });
- });
-
- this.capaTwoFactorAuth.subscribe(function (bValue) {
- Remote.saveAdminConfig(Utils.emptyFunction, {
- 'CapaTwoFactorAuth': bValue ? '1' : '0'
- });
- });
-
- this.useLocalProxyForExternalImages.subscribe(function (bValue) {
- Remote.saveAdminConfig(null, {
- 'UseLocalProxyForExternalImages': bValue ? '1' : '0'
- });
- });
- };
-
- AdminSettingsSecurity.prototype.onHide = function ()
- {
- this.adminPassword('');
- this.adminPasswordNew('');
- this.adminPasswordNew2('');
- };
-
- /**
- * @return {string}
- */
- AdminSettingsSecurity.prototype.phpInfoLink = function ()
- {
- return LinkBuilder.phpInfo();
- };
-
- module.exports = AdminSettingsSecurity;
-
-}(module, require));
-
-},{"Enums":6,"LinkBuilder":9,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"_":19,"ko":16}],40:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function AdminSettingsSocial()
- {
- var Data = require('Storage:Admin:Data');
-
- this.googleEnable = Data.googleEnable;
- this.googleClientID = Data.googleClientID;
- this.googleApiKey = Data.googleApiKey;
- this.googleClientSecret = Data.googleClientSecret;
- this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
- this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
- this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.facebookSupported = Data.facebookSupported;
- this.facebookEnable = Data.facebookEnable;
- this.facebookAppID = Data.facebookAppID;
- this.facebookAppSecret = Data.facebookAppSecret;
- this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
- this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.twitterEnable = Data.twitterEnable;
- this.twitterConsumerKey = Data.twitterConsumerKey;
- this.twitterConsumerSecret = Data.twitterConsumerSecret;
- this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
- this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
-
- this.dropboxEnable = Data.dropboxEnable;
- this.dropboxApiKey = Data.dropboxApiKey;
- this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
- }
-
- AdminSettingsSocial.prototype.onBuild = function ()
- {
- var
- self = this,
- Remote = require('Storage:Admin:Remote')
- ;
-
- _.delay(function () {
+ AdminSettingsSocial.prototype.onBuild = function ()
+ {
var
- f1 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger1, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger2, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger1, self),
- f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
- f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
- f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
- f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
- f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
+ self = this,
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15)
;
- self.facebookEnable.subscribe(function (bValue) {
- if (self.facebookSupported())
- {
+ _.delay(function () {
+
+ var
+ f1 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger1, self),
+ f2 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger2, self),
+ f3 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger1, self),
+ f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
+ f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
+ f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
+ f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
+ f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
+ ;
+
+ self.facebookEnable.subscribe(function (bValue) {
+ if (self.facebookSupported())
+ {
+ Remote.saveAdminConfig(Utils.emptyFunction, {
+ 'FacebookEnable': bValue ? '1' : '0'
+ });
+ }
+ });
+
+ self.facebookAppID.subscribe(function (sValue) {
+ if (self.facebookSupported())
+ {
+ Remote.saveAdminConfig(f1, {
+ 'FacebookAppID': Utils.trim(sValue)
+ });
+ }
+ });
+
+ self.facebookAppSecret.subscribe(function (sValue) {
+ if (self.facebookSupported())
+ {
+ Remote.saveAdminConfig(f2, {
+ 'FacebookAppSecret': Utils.trim(sValue)
+ });
+ }
+ });
+
+ self.twitterEnable.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, {
- 'FacebookEnable': bValue ? '1' : '0'
+ 'TwitterEnable': bValue ? '1' : '0'
});
- }
- });
+ });
- self.facebookAppID.subscribe(function (sValue) {
- if (self.facebookSupported())
- {
- Remote.saveAdminConfig(f1, {
- 'FacebookAppID': Utils.trim(sValue)
+ self.twitterConsumerKey.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f3, {
+ 'TwitterConsumerKey': Utils.trim(sValue)
});
- }
- });
+ });
- self.facebookAppSecret.subscribe(function (sValue) {
- if (self.facebookSupported())
- {
- Remote.saveAdminConfig(f2, {
- 'FacebookAppSecret': Utils.trim(sValue)
+ self.twitterConsumerSecret.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f4, {
+ 'TwitterConsumerSecret': Utils.trim(sValue)
});
- }
- });
-
- self.twitterEnable.subscribe(function (bValue) {
- Remote.saveAdminConfig(Utils.emptyFunction, {
- 'TwitterEnable': bValue ? '1' : '0'
});
- });
- self.twitterConsumerKey.subscribe(function (sValue) {
- Remote.saveAdminConfig(f3, {
- 'TwitterConsumerKey': Utils.trim(sValue)
+ self.googleEnable.subscribe(function (bValue) {
+ Remote.saveAdminConfig(Utils.emptyFunction, {
+ 'GoogleEnable': bValue ? '1' : '0'
+ });
});
- });
- self.twitterConsumerSecret.subscribe(function (sValue) {
- Remote.saveAdminConfig(f4, {
- 'TwitterConsumerSecret': Utils.trim(sValue)
+ self.googleClientID.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f5, {
+ 'GoogleClientID': Utils.trim(sValue)
+ });
});
- });
- self.googleEnable.subscribe(function (bValue) {
- Remote.saveAdminConfig(Utils.emptyFunction, {
- 'GoogleEnable': bValue ? '1' : '0'
+ self.googleClientSecret.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f6, {
+ 'GoogleClientSecret': Utils.trim(sValue)
+ });
});
- });
- self.googleClientID.subscribe(function (sValue) {
- Remote.saveAdminConfig(f5, {
- 'GoogleClientID': Utils.trim(sValue)
+ self.googleApiKey.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f7, {
+ 'GoogleApiKey': Utils.trim(sValue)
+ });
});
- });
- self.googleClientSecret.subscribe(function (sValue) {
- Remote.saveAdminConfig(f6, {
- 'GoogleClientSecret': Utils.trim(sValue)
+ self.dropboxEnable.subscribe(function (bValue) {
+ Remote.saveAdminConfig(Utils.emptyFunction, {
+ 'DropboxEnable': bValue ? '1' : '0'
+ });
});
- });
- self.googleApiKey.subscribe(function (sValue) {
- Remote.saveAdminConfig(f7, {
- 'GoogleApiKey': Utils.trim(sValue)
+ self.dropboxApiKey.subscribe(function (sValue) {
+ Remote.saveAdminConfig(f8, {
+ 'DropboxApiKey': Utils.trim(sValue)
+ });
});
- });
- self.dropboxEnable.subscribe(function (bValue) {
- Remote.saveAdminConfig(Utils.emptyFunction, {
- 'DropboxEnable': bValue ? '1' : '0'
- });
- });
+ }, 50);
+ };
- self.dropboxApiKey.subscribe(function (sValue) {
- Remote.saveAdminConfig(f8, {
- 'DropboxApiKey': Utils.trim(sValue)
- });
- });
+ module.exports = AdminSettingsSocial;
- }, 50);
- };
+ }());
- module.exports = AdminSettingsSocial;
+/***/ },
-}(module, require));
-},{"Enums":6,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Utils":11,"_":19,"ko":16}],41:[function(require,module,exports){
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+/***/ 93:
+/*!***********************************************!*\
+ !*** ./dev/ViewModels/AdminLoginViewModel.js ***!
+ \***********************************************/
+/***/ function(module, exports, __webpack_require__) {
-(function (module, require) {
+
+ (function () {
- 'use strict';
+ 'use strict';
- var
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- */
- function AbstractData()
- {
- Utils.initDataConstructorBySettings(this);
- }
-
- AbstractData.prototype.populateDataOnStart = function()
- {
var
- mLayout = Utils.pInt(Settings.settingsGet('Layout')),
- aLanguages = Settings.settingsGet('Languages'),
- aThemes = Settings.settingsGet('Themes')
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
;
- if (Utils.isArray(aLanguages))
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function AdminLoginViewModel()
{
- this.languages(aLanguages);
- }
+ KnoinAbstractViewModel.call(this, 'Center', 'AdminLogin');
- if (Utils.isArray(aThemes))
- {
- this.themes(aThemes);
- }
+ this.login = ko.observable('');
+ this.password = ko.observable('');
- this.mainLanguage(Settings.settingsGet('Language'));
- this.mainTheme(Settings.settingsGet('Theme'));
+ this.loginError = ko.observable(false);
+ this.passwordError = ko.observable(false);
- this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
- this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
- this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
- this.determineUserLanguage(!!Settings.settingsGet('DetermineUserLanguage'));
- this.determineUserDomain(!!Settings.settingsGet('DetermineUserDomain'));
+ this.loginFocus = ko.observable(false);
- this.capaThemes(Settings.capa(Enums.Capa.Themes));
- this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
- this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
- this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
+ this.login.subscribe(function () {
+ this.loginError(false);
+ }, this);
- this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
- this.showImages(!!Settings.settingsGet('ShowImages'));
- this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
- this.interfaceAnimation(Settings.settingsGet('InterfaceAnimation'));
+ this.password.subscribe(function () {
+ this.passwordError(false);
+ }, this);
- this.mainMessagesPerPage(Settings.settingsGet('MPP'));
+ this.submitRequest = ko.observable(false);
+ this.submitError = ko.observable('');
- this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
- this.useThreads(!!Settings.settingsGet('UseThreads'));
- this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
- this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
+ this.submitCommand = Utils.createCommand(this, function () {
- this.layout(Enums.Layout.SidePreview);
- if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
- {
- this.layout(mLayout);
- }
- this.facebookSupported(!!Settings.settingsGet('SupportedFacebookSocial'));
- this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
- this.facebookAppID(Settings.settingsGet('FacebookAppID'));
- this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
+ Utils.triggerAutocompleteInputChange();
- this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
- this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
- this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
+ this.loginError('' === Utils.trim(this.login()));
+ this.passwordError('' === Utils.trim(this.password()));
- this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
- this.googleClientID(Settings.settingsGet('GoogleClientID'));
- this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
- this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
-
- this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
- this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
-
- this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
- };
-
- module.exports = AbstractData;
-
-}(module, require));
-},{"Enums":6,"Storage:Settings":45,"Utils":11}],42:[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('$'),
-
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Plugins = require('Plugins'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- */
- function AbstractRemoteStorage()
- {
- this.oRequests = {};
- }
-
- AbstractRemoteStorage.prototype.oRequests = {};
-
- /**
- * @param {?Function} fCallback
- * @param {string} sRequestAction
- * @param {string} sType
- * @param {?AjaxJsonDefaultResponse} oData
- * @param {boolean} bCached
- * @param {*=} oRequestParameters
- */
- AbstractRemoteStorage.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.__APP)
- {
- Globals.__APP.loginAndLogoutReload(true);
- }
- }
-
- if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
- {
- if (window.__rlah_clear)
- {
- window.__rlah_clear();
- }
-
- if (Globals.__APP)
- {
- Globals.__APP.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}
- */
- AbstractRemoteStorage.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'] = Settings.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 = []
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.prototype.getPublicKey = function (fCallback)
- {
- this.defaultRequest(fCallback, 'GetPublicKey');
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sVersion
- */
- AbstractRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
- {
- this.defaultRequest(fCallback, 'Version', {
- 'Version': sVersion
- });
- };
-
- module.exports = AbstractRemoteStorage;
-
-}(module, require));
-},{"$":14,"Consts":5,"Enums":6,"Globals":8,"LinkBuilder":9,"Plugins":10,"Storage:Settings":45,"Utils":11,"_":19,"window":20}],43:[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('Storage:Abstract:Data')
- ;
-
- /**
- * @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));
-},{"Storage:Abstract:Data":41,"_":19,"ko":16}],44:[function(require,module,exports){
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- AbstractRemoteStorage = require('Storage:Abstract:Remote')
- ;
-
- /**
- * @constructor
- * @extends AbstractRemoteStorage
- */
- function AdminRemoteStorage()
- {
- AbstractRemoteStorage.call(this);
-
- this.oRequests = {};
- }
-
- _.extend(AdminRemoteStorage.prototype, AbstractRemoteStorage.prototype);
-
- /**
- * @param {?Function} fCallback
- * @param {string} sLogin
- * @param {string} sPassword
- */
- AdminRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
- {
- this.defaultRequest(fCallback, 'AdminLogin', {
- 'Login': sLogin,
- 'Password': sPassword
- });
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.adminLogout = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminLogout');
- };
-
- /**
- * @param {?Function} fCallback
- * @param {?} oData
- */
- AdminRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
- {
- this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.domainList = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminDomainList');
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.pluginList = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminPluginList');
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.packagesList = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminPackagesList');
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.coreData = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminCoreData');
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.updateCoreData = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {Object} oPackage
- */
- AdminRemoteStorage.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
- */
- AdminRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
- {
- this.defaultRequest(fCallback, 'AdminPackageDelete', {
- 'Id': oPackage.id
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sName
- */
- AdminRemoteStorage.prototype.domain = function (fCallback, sName)
- {
- this.defaultRequest(fCallback, 'AdminDomainLoad', {
- 'Name': sName
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sName
- */
- AdminRemoteStorage.prototype.plugin = function (fCallback, sName)
- {
- this.defaultRequest(fCallback, 'AdminPluginLoad', {
- 'Name': sName
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sName
- */
- AdminRemoteStorage.prototype.domainDelete = function (fCallback, sName)
- {
- this.defaultRequest(fCallback, 'AdminDomainDelete', {
- 'Name': sName
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sName
- * @param {boolean} bDisabled
- */
- AdminRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
- {
- return this.defaultRequest(fCallback, 'AdminDomainDisable', {
- 'Name': sName,
- 'Disabled': !!bDisabled ? '1' : '0'
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {Object} oConfig
- */
- AdminRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
- {
- return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {boolean} bForce
- */
- AdminRemoteStorage.prototype.licensing = function (fCallback, bForce)
- {
- return this.defaultRequest(fCallback, 'AdminLicensing', {
- 'Force' : bForce ? '1' : '0'
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sDomain
- * @param {string} sKey
- */
- AdminRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
- {
- return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
- 'Domain' : sDomain,
- 'Key' : sKey
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sName
- * @param {boolean} bDisabled
- */
- AdminRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
- {
- return this.defaultRequest(fCallback, 'AdminPluginDisable', {
- 'Name': sName,
- 'Disabled': !!bDisabled ? '1' : '0'
- });
- };
-
- AdminRemoteStorage.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
- });
- };
-
- AdminRemoteStorage.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
- */
- AdminRemoteStorage.prototype.testContacts = function (fCallback, oData)
- {
- this.defaultRequest(fCallback, 'AdminContactsTest', oData);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {?} oData
- */
- AdminRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
- {
- this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
- };
-
- /**
- * @param {?Function} fCallback
- */
- AdminRemoteStorage.prototype.adminPing = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AdminPing');
- };
-
- module.exports = new AdminRemoteStorage();
-
-}(module, require));
-},{"Storage:Abstract:Remote":42,"_":19}],45:[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'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function SettingsStorage()
- {
- this.oSettings = window['rainloopAppData'] || {};
- this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
- }
-
- SettingsStorage.prototype.oSettings = null;
-
- /**
- * @param {string} sName
- * @return {?}
- */
- SettingsStorage.prototype.settingsGet = function (sName)
- {
- return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
- };
-
- /**
- * @param {string} sName
- * @param {?} mValue
- */
- SettingsStorage.prototype.settingsSet = function (sName, mValue)
- {
- this.oSettings[sName] = mValue;
- };
-
- /**
- * @param {string} sName
- * @return {boolean}
- */
- SettingsStorage.prototype.capa = function (sName)
- {
- var mCapa = this.settingsGet('Capa');
- return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
- };
-
-
- module.exports = new SettingsStorage();
-
-}(module, require));
-},{"Utils":11,"window":20}],46:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Remote = require('Storage:Admin:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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 (this.loginError() || this.passwordError())
{
- if (oData.Result)
- {
- require('App:Admin').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));
+ return false;
}
- }, this), this.login(), this.password());
+ this.submitRequest(true);
- return true;
+ Remote.adminLogin(_.bind(function (sResult, oData) {
- }, function () {
- return !this.submitRequest();
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Admin:Login', 'AdminLoginViewModel'], AdminLoginViewModel);
- _.extend(AdminLoginViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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));
-},{"App:Admin":3,"App:Knoin":21,"Enums":6,"Knoin:AbstractViewModel":24,"Storage:Admin:Remote":44,"Utils":11,"_":19,"ko":16}],47:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- Globals = require('Globals'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @param {?} oScreen
- *
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AdminSettingsMenuViewModel(oScreen)
- {
- KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu');
-
- this.leftPanelDisabled = Globals.leftPanelDisabled;
-
- this.menu = oScreen.menu;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Admin:SettingsMenu', 'AdminSettingsMenuViewModel'], AdminSettingsMenuViewModel);
- _.extend(AdminSettingsMenuViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- AdminSettingsMenuViewModel.prototype.link = function (sRoute)
- {
- return '#/' + sRoute;
- };
-
- module.exports = AdminSettingsMenuViewModel;
-
-}(module, require));
-
-},{"App:Knoin":21,"Globals":8,"Knoin:AbstractViewModel":24,"_":19}],48:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data'),
- Remote = require('Storage:Admin:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AdminSettingsPaneViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Right', 'AdminPane');
-
- this.adminDomain = ko.observable(Settings.settingsGet('AdminDomain'));
- this.version = ko.observable(Settings.settingsGet('Version'));
-
- this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Admin:SettingsPane', 'AdminSettingsPaneViewModel'], AdminSettingsPaneViewModel);
- _.extend(AdminSettingsPaneViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- AdminSettingsPaneViewModel.prototype.logoutClick = function ()
- {
- Remote.adminLogout(function () {
- require('App:Admin').loginAndLogoutReload();
- });
- };
-
- module.exports = AdminSettingsPaneViewModel;
-
-}(module, require));
-},{"App:Admin":3,"App:Knoin":21,"Knoin:AbstractViewModel":24,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Storage:Settings":45,"_":19,"ko":16}],49:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:Admin:Data'),
- Remote = require('Storage:Admin:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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 (Enums.StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action)
{
- if (true === oData.Result)
+ if (oData.Result)
{
- self.activationSuccessed(true);
- self.activateText('Subscription Key Activated Successfully');
- self.activateText.isError(false);
+ __webpack_require__(/*! App:Admin */ 16).loginAndLogoutReload();
}
- else
+ else if (oData.ErrorCode)
{
- self.activateText(oData.Result);
- self.activateText.isError(true);
- self.key.focus(true);
+ this.submitRequest(false);
+ this.submitError(Utils.getNotification(oData.ErrorCode));
}
}
- 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.submitRequest(false);
+ this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
}
- }, this.domain(), this.key());
- }
- else
- {
- this.activateProcess(false);
- this.activateText('Invalid Subscription Key');
- this.activateText.isError(true);
- this.key.focus(true);
- }
+ }, this), this.login(), this.password());
- }, function () {
- return !this.activateProcess() && '' !== this.domain() && '' !== this.key() && !this.activationSuccessed();
- });
+ return true;
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Activate', 'PopupsActivateViewModel'], PopupsActivateViewModel);
- _.extend(PopupsActivateViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsActivateViewModel.prototype.onShow = function ()
- {
- this.domain(Settings.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));
-},{"App:Knoin":21,"Enums":6,"Knoin:AbstractViewModel":24,"Storage:Admin:Data":43,"Storage:Admin:Remote":44,"Storage:Settings":45,"Utils":11,"_":19,"ko":16}],50:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
- key = require('key'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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(['View:Popup:Ask', 'PopupsAskViewModel'], PopupsAskViewModel);
- _.extend(PopupsAskViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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));
-},{"App:Knoin":21,"Enums":6,"Knoin:AbstractViewModel":24,"Utils":11,"_":19,"key":15,"ko":16}],51:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
-
- Remote = require('Storage:Admin:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsDomainViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsDomain');
-
- this.edit = ko.observable(false);
- this.saving = ko.observable(false);
- this.savingError = ko.observable('');
- this.whiteListPage = ko.observable(false);
-
- this.testing = ko.observable(false);
- this.testingDone = ko.observable(false);
- this.testingImapError = ko.observable(false);
- this.testingSmtpError = ko.observable(false);
- this.testingImapErrorDesc = ko.observable('');
- this.testingSmtpErrorDesc = ko.observable('');
-
- this.testingImapError.subscribe(function (bValue) {
- if (!bValue)
- {
- this.testingImapErrorDesc('');
- }
- }, this);
-
- this.testingSmtpError.subscribe(function (bValue) {
- if (!bValue)
- {
- this.testingSmtpErrorDesc('');
- }
- }, this);
-
- this.testingImapErrorDesc = ko.observable('');
- this.testingSmtpErrorDesc = ko.observable('');
-
- this.imapServerFocus = ko.observable(false);
- this.smtpServerFocus = ko.observable(false);
-
- this.name = ko.observable('');
- this.name.focused = ko.observable(false);
-
- this.imapServer = ko.observable('');
- this.imapPort = ko.observable('' + Consts.Values.ImapDefaulPort);
- this.imapSecure = ko.observable(Enums.ServerSecure.None);
- this.imapShortLogin = ko.observable(false);
- this.smtpServer = ko.observable('');
- this.smtpPort = ko.observable('' + Consts.Values.SmtpDefaulPort);
- this.smtpSecure = ko.observable(Enums.ServerSecure.None);
- this.smtpShortLogin = ko.observable(false);
- this.smtpAuth = ko.observable(true);
- this.whiteList = ko.observable('');
-
- this.headerText = ko.computed(function () {
- var sName = this.name();
- return this.edit() ? 'Edit Domain "' + sName + '"' :
- 'Add Domain' + ('' === sName ? '' : ' "' + sName + '"');
- }, this);
-
- this.domainIsComputed = ko.computed(function () {
- return '' !== this.name() &&
- '' !== this.imapServer() &&
- '' !== this.imapPort() &&
- '' !== this.smtpServer() &&
- '' !== this.smtpPort();
- }, this);
-
- this.canBeTested = ko.computed(function () {
- return !this.testing() && this.domainIsComputed();
- }, this);
-
- this.canBeSaved = ko.computed(function () {
- return !this.saving() && this.domainIsComputed();
- }, this);
-
- this.createOrAddCommand = Utils.createCommand(this, function () {
- this.saving(true);
- Remote.createOrUpdateDomain(
- _.bind(this.onDomainCreateOrSaveResponse, this),
- !this.edit(),
- this.name(),
- this.imapServer(),
- Utils.pInt(this.imapPort()),
- this.imapSecure(),
- this.imapShortLogin(),
- this.smtpServer(),
- Utils.pInt(this.smtpPort()),
- this.smtpSecure(),
- this.smtpShortLogin(),
- this.smtpAuth(),
- this.whiteList()
- );
- }, this.canBeSaved);
-
- this.testConnectionCommand = Utils.createCommand(this, function () {
- this.whiteListPage(false);
- this.testingDone(false);
- this.testingImapError(false);
- this.testingSmtpError(false);
- this.testing(true);
- Remote.testConnectionForDomain(
- _.bind(this.onTestConnectionResponse, this),
- this.name(),
- this.imapServer(),
- Utils.pInt(this.imapPort()),
- this.imapSecure(),
- this.smtpServer(),
- Utils.pInt(this.smtpPort()),
- this.smtpSecure(),
- this.smtpAuth()
- );
- }, this.canBeTested);
-
- this.whiteListCommand = Utils.createCommand(this, function () {
- this.whiteListPage(!this.whiteListPage());
- });
-
- // smart form improvements
- this.imapServerFocus.subscribe(function (bValue) {
- if (bValue && '' !== this.name() && '' === this.imapServer())
- {
- this.imapServer(this.name().replace(/[.]?[*][.]?/g, ''));
- }
- }, this);
-
- this.smtpServerFocus.subscribe(function (bValue) {
- if (bValue && '' !== this.imapServer() && '' === this.smtpServer())
- {
- this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
- }
- }, this);
-
- this.imapSecure.subscribe(function (sValue) {
- var iPort = Utils.pInt(this.imapPort());
- sValue = Utils.pString(sValue);
- switch (sValue)
- {
- case '0':
- if (993 === iPort)
- {
- this.imapPort('143');
- }
- break;
- case '1':
- if (143 === iPort)
- {
- this.imapPort('993');
- }
- break;
- }
- }, this);
-
- this.smtpSecure.subscribe(function (sValue) {
- var iPort = Utils.pInt(this.smtpPort());
- sValue = Utils.pString(sValue);
- switch (sValue)
- {
- case '0':
- if (465 === iPort || 587 === iPort)
- {
- this.smtpPort('25');
- }
- break;
- case '1':
- if (25 === iPort || 587 === iPort)
- {
- this.smtpPort('465');
- }
- break;
- case '2':
- if (25 === iPort || 465 === iPort)
- {
- this.smtpPort('587');
- }
- break;
- }
- }, this);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Domain', 'PopupsDomainViewModel'], PopupsDomainViewModel);
- _.extend(PopupsDomainViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsDomainViewModel.prototype.onTestConnectionResponse = function (sResult, oData)
- {
- this.testing(false);
- if (Enums.StorageResultType.Success === sResult && oData.Result)
- {
- this.testingDone(true);
- this.testingImapError(true !== oData.Result.Imap);
- this.testingSmtpError(true !== oData.Result.Smtp);
-
- if (this.testingImapError() && oData.Result.Imap)
- {
- this.testingImapErrorDesc(oData.Result.Imap);
- }
-
- if (this.testingSmtpError() && oData.Result.Smtp)
- {
- this.testingSmtpErrorDesc(oData.Result.Smtp);
- }
- }
- else
- {
- this.testingImapError(true);
- this.testingSmtpError(true);
- }
- };
-
- PopupsDomainViewModel.prototype.onDomainCreateOrSaveResponse = function (sResult, oData)
- {
- this.saving(false);
- if (Enums.StorageResultType.Success === sResult && oData)
- {
- if (oData.Result)
- {
- require('App:Admin').reloadDomainList();
- this.closeCommand();
- }
- else if (Enums.Notification.DomainAlreadyExists === oData.ErrorCode)
- {
- this.savingError('Domain already exists');
- }
- }
- else
- {
- this.savingError('Unknown error');
- }
- };
-
- PopupsDomainViewModel.prototype.onHide = function ()
- {
- this.whiteListPage(false);
- };
-
- PopupsDomainViewModel.prototype.onShow = function (oDomain)
- {
- this.saving(false);
- this.whiteListPage(false);
-
- this.testing(false);
- this.testingDone(false);
- this.testingImapError(false);
- this.testingSmtpError(false);
-
- this.clearForm();
- if (oDomain)
- {
- this.edit(true);
-
- this.name(Utils.trim(oDomain.Name));
- this.imapServer(Utils.trim(oDomain.IncHost));
- this.imapPort('' + Utils.pInt(oDomain.IncPort));
- this.imapSecure(Utils.trim(oDomain.IncSecure));
- this.imapShortLogin(!!oDomain.IncShortLogin);
- this.smtpServer(Utils.trim(oDomain.OutHost));
- this.smtpPort('' + Utils.pInt(oDomain.OutPort));
- this.smtpSecure(Utils.trim(oDomain.OutSecure));
- this.smtpShortLogin(!!oDomain.OutShortLogin);
- this.smtpAuth(!!oDomain.OutAuth);
- this.whiteList(Utils.trim(oDomain.WhiteList));
- }
- };
-
- PopupsDomainViewModel.prototype.onFocus = function ()
- {
- if ('' === this.name())
- {
- this.name.focused(true);
- }
- };
-
- PopupsDomainViewModel.prototype.clearForm = function ()
- {
- this.edit(false);
- this.whiteListPage(false);
-
- this.savingError('');
-
- this.name('');
- this.name.focused(false);
-
- this.imapServer('');
- this.imapPort('' + Consts.Values.ImapDefaulPort);
- this.imapSecure(Enums.ServerSecure.None);
- this.imapShortLogin(false);
- this.smtpServer('');
- this.smtpPort('' + Consts.Values.SmtpDefaulPort);
- this.smtpSecure(Enums.ServerSecure.None);
- this.smtpShortLogin(false);
- this.smtpAuth(true);
- this.whiteList('');
- };
-
- module.exports = PopupsDomainViewModel;
-
-}(module, require));
-},{"App:Admin":3,"App:Knoin":21,"Consts":5,"Enums":6,"Knoin:AbstractViewModel":24,"Storage:Admin:Remote":44,"Utils":11,"_":19,"ko":16}],52:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Utils = require('Utils'),
- Globals = require('Globals'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsLanguagesViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
-
- this.Data = Globals.__APP.data(); // TODO
-
- this.exp = ko.observable(false);
-
- this.languages = ko.computed(function () {
- return _.map(this.Data.languages(), function (sLanguage) {
- return {
- 'key': sLanguage,
- 'selected': ko.observable(false),
- 'fullName': Utils.convertLangName(sLanguage)
- };
+ }, function () {
+ return !this.submitRequest();
});
- }, this);
- this.Data.mainLanguage.subscribe(function () {
- this.resetMainLanguage();
- }, this);
+ kn.constructorEnd(this);
+ }
- kn.constructorEnd(this);
- }
+ kn.extendAsViewModel(['View:Admin:Login', 'AdminLoginViewModel'], AdminLoginViewModel);
+ _.extend(AdminLoginViewModel.prototype, KnoinAbstractViewModel.prototype);
- kn.extendAsViewModel(['View:Popup:Languages', 'PopupsLanguagesViewModel'], PopupsLanguagesViewModel);
- _.extend(PopupsLanguagesViewModel.prototype, KnoinAbstractViewModel.prototype);
+ AdminLoginViewModel.prototype.onShow = function ()
+ {
+ kn.routeOff();
- PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
- {
- return Utils.convertLangName(sLanguage, true);
- };
+ _.delay(_.bind(function () {
+ this.loginFocus(true);
+ }, this), 100);
- PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
- {
- var sCurrent = this.Data.mainLanguage();
- _.each(this.languages(), function (oItem) {
- oItem['selected'](oItem['key'] === sCurrent);
- });
- };
+ };
- PopupsLanguagesViewModel.prototype.onShow = function ()
- {
- this.exp(true);
+ AdminLoginViewModel.prototype.onHide = function ()
+ {
+ this.loginFocus(false);
+ };
- this.resetMainLanguage();
- };
+ AdminLoginViewModel.prototype.onBuild = function ()
+ {
+ Utils.triggerAutocompleteInputChange(true);
+ };
- PopupsLanguagesViewModel.prototype.onHide = function ()
- {
- this.exp(false);
- };
+ AdminLoginViewModel.prototype.submitForm = function ()
+ {
+ this.submitCommand();
+ };
- PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
- {
- this.Data.mainLanguage(sLang);
- this.cancelCommand();
- };
+ module.exports = AdminLoginViewModel;
- module.exports = PopupsLanguagesViewModel;
+ }());
-}(module, require));
-},{"App:Knoin":21,"Globals":8,"Knoin:AbstractViewModel":24,"Utils":11,"_":19,"ko":16}],53:[function(require,module,exports){
+/***/ },
-(function (module, require) {
+/***/ 94:
+/*!******************************************************!*\
+ !*** ./dev/ViewModels/AdminSettingsMenuViewModel.js ***!
+ \******************************************************/
+/***/ function(module, exports, __webpack_require__) {
- 'use strict';
+
+ (function () {
- var
- _ = require('_'),
- ko = require('ko'),
- key = require('key'),
+ 'use strict';
- Enums = require('Enums'),
- Utils = require('Utils'),
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
- Remote = require('Storage:Admin:Remote'),
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
+ /**
+ * @param {?} oScreen
+ *
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function AdminSettingsMenuViewModel(oScreen)
+ {
+ KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu');
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsPluginViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsPlugin');
+ this.leftPanelDisabled = Globals.leftPanelDisabled;
- var self = this;
+ this.menu = oScreen.menu;
- this.onPluginSettingsUpdateResponse = _.bind(this.onPluginSettingsUpdateResponse, this);
+ kn.constructorEnd(this);
+ }
- this.saveError = ko.observable('');
+ kn.extendAsViewModel(['View:Admin:SettingsMenu', 'AdminSettingsMenuViewModel'], AdminSettingsMenuViewModel);
+ _.extend(AdminSettingsMenuViewModel.prototype, KnoinAbstractViewModel.prototype);
- this.name = ko.observable('');
- this.readme = ko.observable('');
+ AdminSettingsMenuViewModel.prototype.link = function (sRoute)
+ {
+ return '#/' + sRoute;
+ };
- this.configures = ko.observableArray([]);
+ module.exports = AdminSettingsMenuViewModel;
- this.hasReadme = ko.computed(function () {
- return '' !== this.readme();
- }, this);
+ }());
- this.hasConfiguration = ko.computed(function () {
- return 0 < this.configures().length;
- }, this);
- this.readmePopoverConf = {
- 'placement': 'top',
- 'trigger': 'hover',
- 'title': 'About',
- 'content': function () {
- return self.readme();
+/***/ },
+
+/***/ 95:
+/*!******************************************************!*\
+ !*** ./dev/ViewModels/AdminSettingsPaneViewModel.js ***!
+ \******************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18),
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function AdminSettingsPaneViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Right', 'AdminPane');
+
+ this.adminDomain = ko.observable(Settings.settingsGet('AdminDomain'));
+ this.version = ko.observable(Settings.settingsGet('Version'));
+
+ this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel(['View:Admin:SettingsPane', 'AdminSettingsPaneViewModel'], AdminSettingsPaneViewModel);
+ _.extend(AdminSettingsPaneViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ AdminSettingsPaneViewModel.prototype.logoutClick = function ()
+ {
+ Remote.adminLogout(function () {
+ __webpack_require__(/*! App:Admin */ 16).loginAndLogoutReload();
+ });
+ };
+
+ module.exports = AdminSettingsPaneViewModel;
+
+ }());
+
+/***/ },
+
+/***/ 101:
+/*!**********************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsActivateViewModel.js ***!
+ \**********************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:Admin:Data */ 18),
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @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(['View:Popup:Activate', 'PopupsActivateViewModel'], PopupsActivateViewModel);
+ _.extend(PopupsActivateViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ PopupsActivateViewModel.prototype.onShow = function ()
+ {
+ this.domain(Settings.settingsGet('AdminDomain'));
+ if (!this.activateProcess())
+ {
+ this.key('');
+ this.activateText('');
+ this.activateText.isError(false);
+ this.activationSuccessed(false);
}
};
- this.saveCommand = Utils.createCommand(this, function () {
+ PopupsActivateViewModel.prototype.onFocus = function ()
+ {
+ if (!this.activateProcess())
+ {
+ this.key.focus(true);
+ }
+ };
- var oList = {};
+ /**
+ * @returns {boolean}
+ */
+ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
+ {
+ var sValue = this.key();
+ return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
+ };
- oList['Name'] = this.name();
+ module.exports = PopupsActivateViewModel;
- _.each(this.configures(), function (oItem) {
+ }());
- var mValue = oItem.value();
- if (false === mValue || true === mValue)
+/***/ },
+
+/***/ 105:
+/*!********************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsDomainViewModel.js ***!
+ \********************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function PopupsDomainViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Popups', 'PopupsDomain');
+
+ this.edit = ko.observable(false);
+ this.saving = ko.observable(false);
+ this.savingError = ko.observable('');
+ this.whiteListPage = ko.observable(false);
+
+ this.testing = ko.observable(false);
+ this.testingDone = ko.observable(false);
+ this.testingImapError = ko.observable(false);
+ this.testingSmtpError = ko.observable(false);
+ this.testingImapErrorDesc = ko.observable('');
+ this.testingSmtpErrorDesc = ko.observable('');
+
+ this.testingImapError.subscribe(function (bValue) {
+ if (!bValue)
{
- mValue = mValue ? '1' : '0';
+ this.testingImapErrorDesc('');
}
-
- oList['_' + oItem['Name']] = mValue;
-
}, this);
- this.saveError('');
- Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, oList);
+ this.testingSmtpError.subscribe(function (bValue) {
+ if (!bValue)
+ {
+ this.testingSmtpErrorDesc('');
+ }
+ }, this);
- }, this.hasConfiguration);
+ this.testingImapErrorDesc = ko.observable('');
+ this.testingSmtpErrorDesc = ko.observable('');
- this.bDisabeCloseOnEsc = true;
- this.sDefaultKeyScope = Enums.KeyState.All;
+ this.imapServerFocus = ko.observable(false);
+ this.smtpServerFocus = ko.observable(false);
- this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
+ this.name = ko.observable('');
+ this.name.focused = ko.observable(false);
- kn.constructorEnd(this);
- }
+ this.imapServer = ko.observable('');
+ this.imapPort = ko.observable('' + Consts.Values.ImapDefaulPort);
+ this.imapSecure = ko.observable(Enums.ServerSecure.None);
+ this.imapShortLogin = ko.observable(false);
+ this.smtpServer = ko.observable('');
+ this.smtpPort = ko.observable('' + Consts.Values.SmtpDefaulPort);
+ this.smtpSecure = ko.observable(Enums.ServerSecure.None);
+ this.smtpShortLogin = ko.observable(false);
+ this.smtpAuth = ko.observable(true);
+ this.whiteList = ko.observable('');
- kn.extendAsViewModel(['View:Popup:Plugin', 'PopupsPluginViewModel'], PopupsPluginViewModel);
- _.extend(PopupsPluginViewModel.prototype, KnoinAbstractViewModel.prototype);
+ this.headerText = ko.computed(function () {
+ var sName = this.name();
+ return this.edit() ? 'Edit Domain "' + sName + '"' :
+ 'Add Domain' + ('' === sName ? '' : ' "' + sName + '"');
+ }, this);
- PopupsPluginViewModel.prototype.onPluginSettingsUpdateResponse = function (sResult, oData)
- {
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- this.cancelCommand();
+ this.domainIsComputed = ko.computed(function () {
+ return '' !== this.name() &&
+ '' !== this.imapServer() &&
+ '' !== this.imapPort() &&
+ '' !== this.smtpServer() &&
+ '' !== this.smtpPort();
+ }, this);
+
+ this.canBeTested = ko.computed(function () {
+ return !this.testing() && this.domainIsComputed();
+ }, this);
+
+ this.canBeSaved = ko.computed(function () {
+ return !this.saving() && this.domainIsComputed();
+ }, this);
+
+ this.createOrAddCommand = Utils.createCommand(this, function () {
+ this.saving(true);
+ Remote.createOrUpdateDomain(
+ _.bind(this.onDomainCreateOrSaveResponse, this),
+ !this.edit(),
+ this.name(),
+ this.imapServer(),
+ Utils.pInt(this.imapPort()),
+ this.imapSecure(),
+ this.imapShortLogin(),
+ this.smtpServer(),
+ Utils.pInt(this.smtpPort()),
+ this.smtpSecure(),
+ this.smtpShortLogin(),
+ this.smtpAuth(),
+ this.whiteList()
+ );
+ }, this.canBeSaved);
+
+ this.testConnectionCommand = Utils.createCommand(this, function () {
+ this.whiteListPage(false);
+ this.testingDone(false);
+ this.testingImapError(false);
+ this.testingSmtpError(false);
+ this.testing(true);
+ Remote.testConnectionForDomain(
+ _.bind(this.onTestConnectionResponse, this),
+ this.name(),
+ this.imapServer(),
+ Utils.pInt(this.imapPort()),
+ this.imapSecure(),
+ this.smtpServer(),
+ Utils.pInt(this.smtpPort()),
+ this.smtpSecure(),
+ this.smtpAuth()
+ );
+ }, this.canBeTested);
+
+ this.whiteListCommand = Utils.createCommand(this, function () {
+ this.whiteListPage(!this.whiteListPage());
+ });
+
+ // smart form improvements
+ this.imapServerFocus.subscribe(function (bValue) {
+ if (bValue && '' !== this.name() && '' === this.imapServer())
+ {
+ this.imapServer(this.name().replace(/[.]?[*][.]?/g, ''));
+ }
+ }, this);
+
+ this.smtpServerFocus.subscribe(function (bValue) {
+ if (bValue && '' !== this.imapServer() && '' === this.smtpServer())
+ {
+ this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
+ }
+ }, this);
+
+ this.imapSecure.subscribe(function (sValue) {
+ var iPort = Utils.pInt(this.imapPort());
+ sValue = Utils.pString(sValue);
+ switch (sValue)
+ {
+ case '0':
+ if (993 === iPort)
+ {
+ this.imapPort('143');
+ }
+ break;
+ case '1':
+ if (143 === iPort)
+ {
+ this.imapPort('993');
+ }
+ break;
+ }
+ }, this);
+
+ this.smtpSecure.subscribe(function (sValue) {
+ var iPort = Utils.pInt(this.smtpPort());
+ sValue = Utils.pString(sValue);
+ switch (sValue)
+ {
+ case '0':
+ if (465 === iPort || 587 === iPort)
+ {
+ this.smtpPort('25');
+ }
+ break;
+ case '1':
+ if (25 === iPort || 587 === iPort)
+ {
+ this.smtpPort('465');
+ }
+ break;
+ case '2':
+ if (25 === iPort || 465 === iPort)
+ {
+ this.smtpPort('587');
+ }
+ break;
+ }
+ }, this);
+
+ kn.constructorEnd(this);
}
- else
+
+ kn.extendAsViewModel(['View:Popup:Domain', 'PopupsDomainViewModel'], PopupsDomainViewModel);
+ _.extend(PopupsDomainViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ PopupsDomainViewModel.prototype.onTestConnectionResponse = function (sResult, oData)
{
- this.saveError('');
- if (oData && oData.ErrorCode)
+ this.testing(false);
+ if (Enums.StorageResultType.Success === sResult && oData.Result)
{
- this.saveError(Utils.getNotification(oData.ErrorCode));
+ this.testingDone(true);
+ this.testingImapError(true !== oData.Result.Imap);
+ this.testingSmtpError(true !== oData.Result.Smtp);
+
+ if (this.testingImapError() && oData.Result.Imap)
+ {
+ this.testingImapErrorDesc(oData.Result.Imap);
+ }
+
+ if (this.testingSmtpError() && oData.Result.Smtp)
+ {
+ this.testingSmtpErrorDesc(oData.Result.Smtp);
+ }
}
else
{
- this.saveError(Utils.getNotification(Enums.Notification.CantSavePluginSettings));
+ this.testingImapError(true);
+ this.testingSmtpError(true);
}
- }
- };
+ };
- PopupsPluginViewModel.prototype.onShow = function (oPlugin)
- {
- this.name();
- this.readme();
- this.configures([]);
-
- if (oPlugin)
+ PopupsDomainViewModel.prototype.onDomainCreateOrSaveResponse = function (sResult, oData)
{
- this.name(oPlugin['Name']);
- this.readme(oPlugin['Readme']);
-
- var aConfig = oPlugin['Config'];
- if (Utils.isNonEmptyArray(aConfig))
+ this.saving(false);
+ if (Enums.StorageResultType.Success === sResult && oData)
{
- this.configures(_.map(aConfig, function (aItem) {
- return {
- 'value': ko.observable(aItem[0]),
- 'Name': aItem[1],
- 'Type': aItem[2],
- 'Label': aItem[3],
- 'Default': aItem[4],
- 'Desc': aItem[5]
- };
- }));
+ if (oData.Result)
+ {
+ __webpack_require__(/*! App:Admin */ 16).reloadDomainList();
+ this.closeCommand();
+ }
+ else if (Enums.Notification.DomainAlreadyExists === oData.ErrorCode)
+ {
+ this.savingError('Domain already exists');
+ }
}
- }
- };
+ else
+ {
+ this.savingError('Unknown error');
+ }
+ };
+
+ PopupsDomainViewModel.prototype.onHide = function ()
+ {
+ this.whiteListPage(false);
+ };
+
+ PopupsDomainViewModel.prototype.onShow = function (oDomain)
+ {
+ this.saving(false);
+ this.whiteListPage(false);
+
+ this.testing(false);
+ this.testingDone(false);
+ this.testingImapError(false);
+ this.testingSmtpError(false);
+
+ this.clearForm();
+ if (oDomain)
+ {
+ this.edit(true);
+
+ this.name(Utils.trim(oDomain.Name));
+ this.imapServer(Utils.trim(oDomain.IncHost));
+ this.imapPort('' + Utils.pInt(oDomain.IncPort));
+ this.imapSecure(Utils.trim(oDomain.IncSecure));
+ this.imapShortLogin(!!oDomain.IncShortLogin);
+ this.smtpServer(Utils.trim(oDomain.OutHost));
+ this.smtpPort('' + Utils.pInt(oDomain.OutPort));
+ this.smtpSecure(Utils.trim(oDomain.OutSecure));
+ this.smtpShortLogin(!!oDomain.OutShortLogin);
+ this.smtpAuth(!!oDomain.OutAuth);
+ this.whiteList(Utils.trim(oDomain.WhiteList));
+ }
+ };
+
+ PopupsDomainViewModel.prototype.onFocus = function ()
+ {
+ if ('' === this.name())
+ {
+ this.name.focused(true);
+ }
+ };
+
+ PopupsDomainViewModel.prototype.clearForm = function ()
+ {
+ this.edit(false);
+ this.whiteListPage(false);
+
+ this.savingError('');
+
+ this.name('');
+ this.name.focused(false);
+
+ this.imapServer('');
+ this.imapPort('' + Consts.Values.ImapDefaulPort);
+ this.imapSecure(Enums.ServerSecure.None);
+ this.imapShortLogin(false);
+ this.smtpServer('');
+ this.smtpPort('' + Consts.Values.SmtpDefaulPort);
+ this.smtpSecure(Enums.ServerSecure.None);
+ this.smtpShortLogin(false);
+ this.smtpAuth(true);
+ this.whiteList('');
+ };
+
+ module.exports = PopupsDomainViewModel;
+
+ }());
+
+/***/ },
+
+/***/ 109:
+/*!********************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsPluginViewModel.js ***!
+ \********************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
- PopupsPluginViewModel.prototype.tryToClosePopup = function ()
- {
var
- self = this,
- PopupsAskViewModel = require('View:Popup:Ask')
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+ key = __webpack_require__(/*! key */ 19),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Remote = __webpack_require__(/*! Storage:Admin:Remote */ 15),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
;
- if (!kn.isPopupVisible(PopupsAskViewModel))
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function PopupsPluginViewModel()
{
- kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
- if (self.modalVisibility())
- {
- Utils.delegateRun(self, 'cancelCommand');
+ KnoinAbstractViewModel.call(this, 'Popups', 'PopupsPlugin');
+
+ var self = this;
+
+ this.onPluginSettingsUpdateResponse = _.bind(this.onPluginSettingsUpdateResponse, this);
+
+ this.saveError = ko.observable('');
+
+ this.name = ko.observable('');
+ this.readme = ko.observable('');
+
+ this.configures = ko.observableArray([]);
+
+ this.hasReadme = ko.computed(function () {
+ return '' !== this.readme();
+ }, this);
+
+ this.hasConfiguration = ko.computed(function () {
+ return 0 < this.configures().length;
+ }, this);
+
+ this.readmePopoverConf = {
+ 'placement': 'top',
+ 'trigger': 'hover',
+ 'title': 'About',
+ 'content': function () {
+ return self.readme();
}
- }]);
+ };
+
+ this.saveCommand = Utils.createCommand(this, function () {
+
+ var oList = {};
+
+ oList['Name'] = this.name();
+
+ _.each(this.configures(), function (oItem) {
+
+ var mValue = oItem.value();
+ if (false === mValue || true === mValue)
+ {
+ mValue = mValue ? '1' : '0';
+ }
+
+ oList['_' + oItem['Name']] = mValue;
+
+ }, this);
+
+ this.saveError('');
+ Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, oList);
+
+ }, this.hasConfiguration);
+
+ this.bDisabeCloseOnEsc = true;
+ this.sDefaultKeyScope = Enums.KeyState.All;
+
+ this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
+
+ kn.constructorEnd(this);
}
- };
- PopupsPluginViewModel.prototype.onBuild = function ()
- {
- key('esc', Enums.KeyState.All, _.bind(function () {
- if (this.modalVisibility())
+ kn.extendAsViewModel(['View:Popup:Plugin', 'PopupsPluginViewModel'], PopupsPluginViewModel);
+ _.extend(PopupsPluginViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ PopupsPluginViewModel.prototype.onPluginSettingsUpdateResponse = function (sResult, oData)
+ {
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
- this.tryToClosePopup();
+ this.cancelCommand();
}
- return false;
- }, this));
- };
+ else
+ {
+ this.saveError('');
+ if (oData && oData.ErrorCode)
+ {
+ this.saveError(Utils.getNotification(oData.ErrorCode));
+ }
+ else
+ {
+ this.saveError(Utils.getNotification(Enums.Notification.CantSavePluginSettings));
+ }
+ }
+ };
- module.exports = PopupsPluginViewModel;
+ PopupsPluginViewModel.prototype.onShow = function (oPlugin)
+ {
+ this.name();
+ this.readme();
+ this.configures([]);
-}(module, require));
-},{"App:Knoin":21,"Enums":6,"Knoin:AbstractViewModel":24,"Storage:Admin:Remote":44,"Utils":11,"View:Popup:Ask":50,"_":19,"key":15,"ko":16}]},{},[1]);
+ if (oPlugin)
+ {
+ this.name(oPlugin['Name']);
+ this.readme(oPlugin['Readme']);
+
+ var aConfig = oPlugin['Config'];
+ if (Utils.isNonEmptyArray(aConfig))
+ {
+ this.configures(_.map(aConfig, function (aItem) {
+ return {
+ 'value': ko.observable(aItem[0]),
+ 'Name': aItem[1],
+ 'Type': aItem[2],
+ 'Label': aItem[3],
+ 'Default': aItem[4],
+ 'Desc': aItem[5]
+ };
+ }));
+ }
+ }
+ };
+
+ PopupsPluginViewModel.prototype.tryToClosePopup = function ()
+ {
+ var
+ self = this,
+ PopupsAskViewModel = __webpack_require__(/*! View:Popup:Ask */ 31)
+ ;
+
+ if (!kn.isPopupVisible(PopupsAskViewModel))
+ {
+ kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
+ if (self.modalVisibility())
+ {
+ Utils.delegateRun(self, 'cancelCommand');
+ }
+ }]);
+ }
+ };
+
+ PopupsPluginViewModel.prototype.onBuild = function ()
+ {
+ key('esc', Enums.KeyState.All, _.bind(function () {
+ if (this.modalVisibility())
+ {
+ this.tryToClosePopup();
+ }
+ return false;
+ }, this));
+ };
+
+ module.exports = PopupsPluginViewModel;
+
+ }());
+
+/***/ }
+
+});
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/admin.min.js b/rainloop/v/0.0.0/static/js/admin.min.js
deleted file mode 100644
index 4c146cc67..000000000
--- a/rainloop/v/0.0.0/static/js/admin.min.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-!function e(t,i,n){function o(a,r){if(!i[a]){if(!t[a]){var l="function"==typeof require&&require;if(!r&&l)return l(a,!0);if(s)return s(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[a]={exports:{}};t[a][0].call(u.exports,function(e){var i=t[a][1][e];return o(i?i:e)},u,u.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a').appendTo("body"),a.$win.on("error",function(t){t&&t.originalEvent&&t.originalEvent.message&&-1===r.inArray(t.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&e.jsError(r.emptyFunction,t.originalEvent.message,t.originalEvent.filename,t.originalEvent.lineno,n.location&&n.location.toString?n.location.toString():"",a.$html.attr("class"),r.microtime()-a.now)}),a.$doc.on("keydown",function(e){e&&e.ctrlKey&&a.$html.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&a.$html.removeClass("rl-ctrl-key-pressed")})}var n=t("window"),o=t("_"),s=t("$"),a=t("Globals"),r=t("Utils"),l=t("LinkBuilder"),c=t("Events"),u=t("Storage:Settings"),p=t("Knoin:AbstractBoot");o.extend(i.prototype,p.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,o=n.navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(i=n.document.createElement("a"),i.href=e,n.document.createEvent&&(t=n.document.createEvent("MouseEvents"),t&&t.initEvent&&i.dispatchEvent))?(t.initEvent("click",!0,!0),i.dispatchEvent(t),!0):(a.bMobileDevice?(n.open(e,"_self"),n.focus()):this.iframe.attr("src",e),!0)},i.prototype.setTitle=function(e){e=(r.isNormal(e)&&0 "),i.now=(new n.Date).getTime(),i.momentTrigger=a.observable(!0),i.dropdownVisibility=a.observable(!1).extend({rateLimit:0}),i.tooltipTrigger=a.observable(!1).extend({rateLimit:0}),i.langChangeTrigger=a.observable(!0),i.useKeyboardShortcuts=a.observable(!0),i.iAjaxErrorCount=0,i.iTokenErrorCount=0,i.iMessageBodyCacheCount=0,i.bUnload=!1,i.sUserAgent=(n.navigator.userAgent||"").toLowerCase(),i.bIsiOSDevice=-11&&(n=n.replace(/[\/]+$/,""),n+="/p"+t),""!==i&&(n=n.replace(/[\/]+$/,""),n+="/"+encodeURI(i)),n},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=o.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)},{"Storage:Settings":45,Utils:11,window:20}],10:[function(e,t){!function(e,t){"use strict";function i(){this.__boot=null,this.__data=null,this.__remote=null,this.oSettings=t("Storage:Settings"),this.oViewModelsHooks={},this.oSimpleHooks={}}var n=t("_"),o=t("Utils");i.prototype.__boot=null,i.prototype.__data=null,i.prototype.__remote=null,i.prototype.oViewModelsHooks={},i.prototype.oSimpleHooks={},i.prototype.addHook=function(e,t){o.isFunc(t)&&(o.isArray(this.oSimpleHooks[e])||(this.oSimpleHooks[e]=[]),this.oSimpleHooks[e].push(t))},i.prototype.runHook=function(e,t){o.isArray(this.oSimpleHooks[e])&&(t=t||[],n.each(this.oSimpleHooks[e],function(e){e.apply(null,t)}))},i.prototype.mainSettingsGet=function(e){return this.oSettings.settingsGet(e)},i.prototype.remoteRequest=function(e,t,i,n,o,s){this.__remote&&this.__remote.defaultRequest(e,t,i,n,o,s)},i.prototype.settingsGet=function(e,t){var i=this.oSettings.settingsGet("Plugins");return i=i&&!o.isUnd(i[e])?i[e]:null,i?o.isUnd(i[t])?null:i[t]:null},e.exports=new i}(t,e)},{"Storage:Settings":45,Utils:11,_:19}],11:[function(e,t){!function(e,t){"use strict";var i={},n=t("window"),o=t("_"),s=t("$"),a=t("ko"),r=t("Enums"),l=t("Consts"),c=t("Globals");i.trim=s.trim,i.inArray=s.inArray,i.isArray=o.isArray,i.isFunc=o.isFunction,i.isUnd=o.isUndefined,i.isNull=o.isNull,i.emptyFunction=function(){},i.isNormal=function(e){return!i.isUnd(e)&&!i.isNull(e)},i.windowResize=o.debounce(function(e){i.isUnd(e)?c.$win.resize():n.setTimeout(function(){c.$win.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 o=i.isNormal(e)&&""!==e?n.parseInt(e,10):t||0;return n.isNaN(o)?t||0:o},i.pString=function(e){return i.isNormal(e)?""+e:""},i.isNonEmptyArray=function(e){return i.isArray(e)&&0s;s++)o=i[s].split("="),t[n.decodeURIComponent(o[0])]=n.decodeURIComponent(o[1]);return t},i.mailToHelper=function(e,o){if(e&&"mailto:"===e.toString().substr(0,7).toLowerCase()){e=e.toString().substr(7);var s={},a=null,l=e.replace(/\?.+$/,""),c=e.replace(/^[^\?]*\?/,""),u=t("Model:Email");return a=new u,a.parse(n.decodeURIComponent(l)),a&&a.email&&(s=i.simpleQueryParser(c),t("App:Knoin").showScreenPopup(o,[r.ComposeType.Empty,null,[a],i.isUnd(s.subject)?null:i.pString(s.subject),i.isUnd(s.body)?null:i.plainToHtml(i.pString(s.body))])),!0}return!1},i.rsaEncode=function(e,t,o,s){if(n.crypto&&n.crypto.getRandomValues&&n.RSAKey&&t&&o&&s){var a=new n.RSAKey;if(a.setPublic(s,o),e=a.encrypt(i.fakeMd5()+":"+e+":"+i.fakeMd5()),!1!==e)return"rsa:"+t+":"+e}return!1},i.rsaEncode.supported=!!(n.crypto&&n.crypto.getRandomValues&&n.RSAKey),i.exportPath=function(e,t,o){for(var s=null,a=e.split("."),r=o||n;a.length&&(s=a.shift());)a.length||i.isUnd(t)?r=r[s]?r[s]:r[s]={}:r[s]=t},i.pImport=function(e,t,i){e[t]=i},i.pExport=function(e,t,n){return i.isUnd(e[t])?n: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 n="",o="",s=e,a=0,r=0;for(t=i.isUnd(t)?100:t;s.length>t;)o=s.substring(0,t),a=o.lastIndexOf(" "),r=o.lastIndexOf("\n"),-1!==r&&(a=r),-1===a&&(a=t),n+=o.substring(0,a)+"\n",s=s.substring(a+1);return n+s},i.timeOutAction=function(){var e={};return function(t,o,s){i.isUnd(e[t])&&(e[t]=0),n.clearTimeout(e[t]),e[t]=n.setTimeout(o,s)}}(),i.timeOutActionSecond=function(){var e={};return function(t,i,o){e[t]||(e[t]=n.setTimeout(function(){i(),e[t]=0},o))}}(),i.audio=function(){var e=!1;return function(t,i){if(!1===e)if(c.bIsiOSDevice)e=null;else{var o=!1,s=!1,a=n.Audio?new n.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(s=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||s?(e=a,e.preload="none",e.loop=!1,e.autoplay=!1,e.muted=!1,e.src=o?t:i):e=null):e=null}return e}}(),i.hos=function(e,t){return e&&n.Object&&n.Object.hasOwnProperty?n.Object.hasOwnProperty.call(e,t):!1},i.i18n=function(e,t,n){var o="",s=i.isUnd(c.oI18N[e])?i.isUnd(n)?e:n:c.oI18N[e];if(!i.isUnd(t)&&!i.isNull(t))for(o in t)i.hos(t,o)&&(s=s.replace("%"+o+"%",t[o]));return s},i.i18nToNode=function(e){o.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(){n.rainloopI18N&&(c.oI18N=n.rainloopI18N||{},i.i18nToNode(c.$doc),c.langChangeTrigger(!c.langChangeTrigger())),n.rainloopI18N=null},i.initOnStartOrLangChange=function(e,t,i){e&&e.call(t),i?c.langChangeTrigger.subscribe(function(){e&&e.call(t),i.call(t)}):e&&c.langChangeTrigger.subscribe(e,t)},i.inFocus=function(){return n.document.activeElement?(i.isUnd(n.document.activeElement.__inFocusCache)&&(n.document.activeElement.__inFocusCache=s(n.document.activeElement).is("input,textarea,iframe,.cke_editable")),!!n.document.activeElement.__inFocusCache):!1},i.removeInFocus=function(){if(n.document&&n.document.activeElement&&n.document.activeElement.blur){var e=s(n.document.activeElement);e.is("input,textarea")&&n.document.activeElement.blur()}},i.removeSelection=function(){if(n&&n.getSelection){var e=n.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}else n.document&&n.document.selection&&n.document.selection.empty&&n.document.selection.empty()},i.replySubjectAdd=function(e,t){e=i.trim(e.toUpperCase()),t=i.trim(t.replace(/[\s]+/g," "));var n=!1,s=[],a="RE"===e,r="FWD"===e,l=!r;return""!==t&&o.each(t.split(":"),function(e){var t=i.trim(e);n||!/^(RE|FWD)$/i.test(t)&&!/^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(t)?(s.push(e),n=!0):(a||(a=!!/^RE/i.test(t)),r||(r=!!/^FWD/i.test(t)))}),l?a=!1:r=!1,i.trim((l?"Re: ":"Fwd: ")+(a?"Re: ":"")+(r?"Fwd: ":"")+i.trim(s.join(":")))},i.roundNumber=function(e,t){return n.Math.round(e*n.Math.pow(10,t))/n.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){n.console&&n.console.log&&n.console.log(e)},i.getNotification=function(e,t){return e=i.pInt(e),r.Notification.ClientViewError===e&&t?t:i.isUnd(c.oNotificationI18N[e])?"":c.oNotificationI18N[e]},i.initNotificationLanguage=function(){var e=c.oNotificationI18N||{};e[r.Notification.InvalidToken]=i.i18n("NOTIFICATIONS/INVALID_TOKEN"),e[r.Notification.AuthError]=i.i18n("NOTIFICATIONS/AUTH_ERROR"),e[r.Notification.AccessError]=i.i18n("NOTIFICATIONS/ACCESS_ERROR"),e[r.Notification.ConnectionError]=i.i18n("NOTIFICATIONS/CONNECTION_ERROR"),e[r.Notification.CaptchaError]=i.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),e[r.Notification.SocialFacebookLoginAccessDisable]=i.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),e[r.Notification.SocialTwitterLoginAccessDisable]=i.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),e[r.Notification.SocialGoogleLoginAccessDisable]=i.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),e[r.Notification.DomainNotAllowed]=i.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),e[r.Notification.AccountNotAllowed]=i.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),e[r.Notification.AccountTwoFactorAuthRequired]=i.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),e[r.Notification.AccountTwoFactorAuthError]=i.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),e[r.Notification.CouldNotSaveNewPassword]=i.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),e[r.Notification.CurrentPasswordIncorrect]=i.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),e[r.Notification.NewPasswordShort]=i.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),e[r.Notification.NewPasswordWeak]=i.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),e[r.Notification.NewPasswordForbidden]=i.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),e[r.Notification.ContactsSyncError]=i.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),e[r.Notification.CantGetMessageList]=i.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),e[r.Notification.CantGetMessage]=i.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),e[r.Notification.CantDeleteMessage]=i.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),e[r.Notification.CantMoveMessage]=i.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[r.Notification.CantCopyMessage]=i.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[r.Notification.CantSaveMessage]=i.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),e[r.Notification.CantSendMessage]=i.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),e[r.Notification.InvalidRecipients]=i.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),e[r.Notification.CantCreateFolder]=i.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),e[r.Notification.CantRenameFolder]=i.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),e[r.Notification.CantDeleteFolder]=i.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),e[r.Notification.CantDeleteNonEmptyFolder]=i.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),e[r.Notification.CantSubscribeFolder]=i.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),e[r.Notification.CantUnsubscribeFolder]=i.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),e[r.Notification.CantSaveSettings]=i.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),e[r.Notification.CantSavePluginSettings]=i.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),e[r.Notification.DomainAlreadyExists]=i.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),e[r.Notification.CantInstallPackage]=i.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),e[r.Notification.CantDeletePackage]=i.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),e[r.Notification.InvalidPluginPackage]=i.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),e[r.Notification.UnsupportedPluginPackage]=i.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),e[r.Notification.LicensingServerIsUnavailable]=i.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),e[r.Notification.LicensingExpired]=i.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),e[r.Notification.LicensingBanned]=i.i18n("NOTIFICATIONS/LICENSING_BANNED"),e[r.Notification.DemoSendMessageError]=i.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),e[r.Notification.AccountAlreadyExists]=i.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),e[r.Notification.MailServerError]=i.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),e[r.Notification.InvalidInputArgument]=i.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),e[r.Notification.UnknownNotification]=i.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),e[r.Notification.UnknownError]=i.i18n("NOTIFICATIONS/UNKNOWN_ERROR")
-},i.getUploadErrorDescByCode=function(e){var t="";switch(i.pInt(e)){case r.UploadErrorCode.FileIsTooBig:t=i.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case r.UploadErrorCode.FilePartiallyUploaded:t=i.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case r.UploadErrorCode.FileNoUploaded:t=i.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case r.UploadErrorCode.MissingTempFolder:t=i.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case r.UploadErrorCode.FileOnSaveingError:t=i.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case r.UploadErrorCode.FileType:t=i.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:t=i.i18n("UPLOAD/ERROR_UNKNOWN")}return t},i.delegateRun=function(e,t,n,s){e&&e[t]&&(s=i.pInt(s),0>=s?e[t].apply(e,i.isArray(n)?n:[]):o.delay(function(){e[t].apply(e,i.isArray(n)?n:[])},s))},i.killCtrlAandS=function(e){if(e=e||n.event,e&&e.ctrlKey&&!e.shiftKey&&!e.altKey){var t=e.target||e.srcElement,i=e.keyCode||e.which;if(i===r.EventKeyCode.S)return void e.preventDefault();if(t&&t.tagName&&t.tagName.match(/INPUT|TEXTAREA/i))return;i===r.EventKeyCode.A&&(n.getSelection?n.getSelection().removeAllRanges():n.document.selection&&n.document.selection.clear&&n.document.selection.clear(),e.preventDefault())}},i.createCommand=function(e,t,n){var o=t?function(){return o&&o.canExecute&&o.canExecute()&&t.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=a.observable(!0),n=i.isUnd(n)?!0:n,o.canExecute=a.computed(i.isFunc(n)?function(){return o.enabled()&&n.call(e)}:function(){return o.enabled()&&!!n}),o},i.initDataConstructorBySettings=function(e){e.editorDefaultType=a.observable(r.EditorDefaultType.Html),e.showImages=a.observable(!1),e.interfaceAnimation=a.observable(r.InterfaceAnimation.Full),e.contactsAutosave=a.observable(!1),c.sAnimationType=r.InterfaceAnimation.Full,e.capaThemes=a.observable(!1),e.allowLanguagesOnSettings=a.observable(!0),e.allowLanguagesOnLogin=a.observable(!0),e.useLocalProxyForExternalImages=a.observable(!1),e.desktopNotifications=a.observable(!1),e.useThreads=a.observable(!0),e.replySameFolder=a.observable(!0),e.useCheckboxesInList=a.observable(!0),e.layout=a.observable(r.Layout.SidePreview),e.usePreviewPane=a.computed(function(){return r.Layout.NoPreview!==e.layout()}),e.interfaceAnimation.subscribe(function(e){if(c.bMobileDevice||e===r.InterfaceAnimation.None)c.$html.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),c.sAnimationType=r.InterfaceAnimation.None;else switch(e){case r.InterfaceAnimation.Full:c.$html.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),c.sAnimationType=e;break;case r.InterfaceAnimation.Normal:c.$html.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),c.sAnimationType=e}}),e.interfaceAnimation.valueHasMutated(),e.desktopNotificationsPermisions=a.computed(function(){e.desktopNotifications();var t=i.notificationClass(),o=r.DesktopNotifications.NotSupported;if(t&&t.permission)switch(t.permission.toLowerCase()){case"granted":o=r.DesktopNotifications.Allowed;break;case"denied":o=r.DesktopNotifications.Denied;break;case"default":o=r.DesktopNotifications.NotAllowed}else n.webkitNotifications&&n.webkitNotifications.checkPermission&&(o=n.webkitNotifications.checkPermission());return o}),e.useDesktopNotifications=a.computed({read:function(){return e.desktopNotifications()&&r.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()},write:function(t){if(t){var n=i.notificationClass(),o=e.desktopNotificationsPermisions();n&&r.DesktopNotifications.Allowed===o?e.desktopNotifications(!0):n&&r.DesktopNotifications.NotAllowed===o?n.requestPermission(function(){e.desktopNotifications.valueHasMutated(),r.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=a.observable(""),e.languages=a.observableArray([]),e.mainLanguage=a.computed({read:e.language,write:function(t){t!==e.language()?-1=t.diff(n,"hours")?o:t.format("L")===n.format("L")?i.i18n("MESSAGE_LIST/TODAY_AT",{TIME:n.format("LT")}):t.clone().subtract("days",1).format("L")===n.format("L")?i.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:n.format("LT")}):n.format(t.year()===n.year()?"D MMM.":"LL")},e)},i.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=i.trim(e.substring(0,e.length-7))),i.trim(e.replace(/[^a-zA-Z0-9]+/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]+/g,"_"),null,e)},i.fakeMd5=function(e){var t="",o="0123456789abcdefghijklmnopqrstuvwxyz";for(e=i.isUnd(e)?32:i.pInt(e);t.length /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,o,r){var l=null,c=n.open(""),u="__OpenerApplyBindingsUid"+i.fakeMd5()+"__",p=s("#"+t);n[u]=function(){if(c&&c.document.body&&p&&p[0]){var t=s(c.document.body);s("#rl-content",t).html(p.html()),s("html",c.document).addClass("external "+s("html").attr("class")),i.i18nToNode(t),e&&s("#rl-content",t)[0]&&a.applyBindings(e,s("#rl-content",t)[0]),n[u]=null,r(c)}},c.document.open(),c.document.write(''+i.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)},i.settingsSaveHelperFunction=function(e,t,n,s){return n=n||null,s=i.isUnd(s)?1e3:i.pInt(s),function(i,a,l,c,u){t.call(n,a&&a.Result?r.SaveSettingsStep.TrueResult:r.SaveSettingsStep.FalseResult),e&&e.call(n,i,a,l,c,u),o.delay(function(){t.call(n,r.SaveSettingsStep.Idle)},s)}},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="",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},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,p),e="\n"+s.trim(e)+"\n"),e}return""},d=function(){return arguments&&1 "):""},g=function(){return arguments&&1 /g,">"):""},m=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,d).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,g).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,p).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,""),r=c.$div.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 n=!1,o=!0,s=!0,a=[],r="",l=0,c=e.split("\n");do{for(o=!1,a=[],l=0;l"===r.substr(0,1),s&&!n?(o=!0,n=!0,a.push("~~~blockquote~~~"),a.push(r.substr(1))):!s&&n?(n=!1,a.push("~~~/blockquote~~~"),a.push(r)):a.push(s&&n?r.substr(1):r);n&&(n=!1,a.push("~~~/blockquote~~~")),c=a}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?i.linkify(e):e},n.rainloop_Utils_htmlToPlain=i.htmlToPlain,n.rainloop_Utils_plainToHtml=i.plainToHtml,i.linkify=function(e){return s.fn&&s.fn.linkify&&(e=c.$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},i.resizeAndCrop=function(e,t,i){var o=new n.Image;o.onload=function(){var e=[0,0],o=n.document.createElement("canvas"),s=o.getContext("2d");o.width=t,o.height=t,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],s.fillStyle="#fff",s.fillRect(0,0,t,t),s.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,t,t),i(o.toDataURL("image/jpeg"))},o.src=e},i.folderListOptionsBuilder=function(e,t,o,s,a,l,c,u,p,d){var g=null,m=!1,h=0,f=0,b="Â Â Â ",S=[];for(p=i.isNormal(p)?p:0h;h++)S.push({id:s[h][0],name:s[h][1],system:!1,seporator:!1,disabled:!1});for(m=!0,h=0,f=e.length;f>h;h++)g=e[h],(c?c.call(null,g):!0)&&(m&&0h;h++)g=t[h],(g.subScribed()||!g.existen)&&(c?c.call(null,g):!0)&&(r.FolderType.User===g.type()||!p||01||c>0&&l>c){for(l>c?(u(c),o=c,s=c):((3>=l||l>=c-2)&&(a+=2),u(l),o=l,s=l);a>0;)if(o-=1,s+=1,o>0&&(u(o,!1),a--),c>=s)u(s,!0),a--;else if(0>=o)break;3===o?u(2,!1):o>3&&u(n.Math.round((o-1)/2),!1,"..."),c-2===s?u(c-1,!0):c-2>s&&u(n.Math.round((c+s)/2),!0,"..."),o>1&&u(1,!1),c>s&&u(c,!0)}return r}},i.selectElement=function(e){var t,i;n.getSelection?(t=n.getSelection(),t.removeAllRanges(),i=n.document.createRange(),i.selectNodeContents(e),t.addRange(i)):n.document.selection&&(i=n.document.body.createTextRange(),i.moveToElementText(e),i.select())},i.detectDropdownVisibility=o.debounce(function(){c.dropdownVisibility(!!o.find(c.aBootstrapDropdowns,function(e){return e.hasClass("open")}))},50),i.triggerAutocompleteInputChange=function(e){var t=function(){s(".checkAutocomplete").trigger("change")};(i.isUnd(e)?1:!e)?t():o.delay(t,100)},e.exports=i}(t,e)},{$:14,"App:Knoin":21,Consts:5,Enums:6,Globals:8,"Model:Email":26,_:19,ko:16,window:20}],12:[function(e,t){t.exports=crossroads},{}],13:[function(e,t){t.exports=hasher},{}],14:[function(e,t){t.exports=$},{}],15:[function(e,t){t.exports=key},{}],16:[function(e,t){!function(t,i){"use strict";var n=e("window"),o=e("_"),s=e("$");i.bindingHandlers.tooltip={init:function(t,n){var o=e("Globals"),a=e("Utils");if(!o.bMobileDevice){var r=s(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")||o.dropdownVisibility()?"":''+a.i18n(i.utils.unwrapObservable(n()))+""}}).click(function(){r.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){r.tooltip("hide")})}}},i.bindingHandlers.tooltip2={init:function(t,i){var n=e("Globals"),o=s(t),a=o.data("tooltip-class")||"",r=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:r,title:function(){return o.is(".disabled")||n.dropdownVisibility()?"":''+i()()+""}}).click(function(){o.tooltip("hide")}),n.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}},i.bindingHandlers.tooltip3={init:function(t){var i=s(t),o=e("Globals");i.tooltip({container:"body",trigger:"hover manual",title:function(){return i.data("tooltip3-data")||""}}),s(n.document).click(function(){i.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){i.tooltip("hide")})},update:function(e,t){var n=i.utils.unwrapObservable(t());""===n?s(e).data("tooltip3-data","").tooltip("hide"):s(e).data("tooltip3-data",n).tooltip("show")}},i.bindingHandlers.registrateBootstrapDropdown={init:function(t){var i=e("Globals");i.aBootstrapDropdowns.push(s(t))}},i.bindingHandlers.openDropdownTrigger={update:function(t,n){if(i.utils.unwrapObservable(n())){var o=s(t),a=e("Utils");o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),a.detectDropdownVisibility()),n()(!1)}}},i.bindingHandlers.dropdownCloser={init:function(e){s(e).closest(".dropdown").on("click",".e-item",function(){s(e).dropdown("toggle")})}},i.bindingHandlers.popover={init:function(e,t){s(e).popover(i.utils.unwrapObservable(t()))}},i.bindingHandlers.csstext={init:function(t,n){var o=e("Utils");t&&t.styleSheet&&!o.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=i.utils.unwrapObservable(n()):s(t).text(i.utils.unwrapObservable(n()))},update:function(t,n){var o=e("Utils");t&&t.styleSheet&&!o.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=i.utils.unwrapObservable(n()):s(t).text(i.utils.unwrapObservable(n()))}},i.bindingHandlers.resizecrop={init:function(e){s(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,t){t()(),s(e).resizecrop({width:"100",height:"100"})}},i.bindingHandlers.onEnter={init:function(e,t,i,o){s(e).on("keypress",function(i){i&&13===n.parseInt(i.keyCode,10)&&(s(e).trigger("change"),t().call(o))})}},i.bindingHandlers.onEsc={init:function(e,t,i,o){s(e).on("keypress",function(i){i&&27===n.parseInt(i.keyCode,10)&&(s(e).trigger("change"),t().call(o))})}},i.bindingHandlers.clickOnTrue={update:function(e,t){i.utils.unwrapObservable(t())&&s(e).click()}},i.bindingHandlers.modal={init:function(t,n){var o=e("Globals"),a=e("Utils");s(t).toggleClass("fade",!o.bMobileDevice).modal({keyboard:!1,show:i.utils.unwrapObservable(n())}).on("shown",function(){a.windowResize()}).find(".close").click(function(){n()(!1)})},update:function(e,t){s(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,n){var o=e("Utils");i.utils.unwrapObservable(n()),o.i18nToNode(t)}},i.bindingHandlers.link={update:function(e,t){s(e).attr("href",i.utils.unwrapObservable(t()))}},i.bindingHandlers.title={update:function(e,t){s(e).attr("title",i.utils.unwrapObservable(t()))}},i.bindingHandlers.textF={init:function(e,t){s(e).text(i.utils.unwrapObservable(t()))}},i.bindingHandlers.initDom={init:function(e,t){t()(e)}},i.bindingHandlers.initResizeTrigger={init:function(e,t){var n=i.utils.unwrapObservable(t());s(e).css({height:n[1],"min-height":n[1]})},update:function(t,n){var o=e("Utils"),a=e("Globals"),r=i.utils.unwrapObservable(n()),l=o.pInt(r[1]),c=0,u=s(t).offset().top;u>0&&(u+=o.pInt(r[2]),c=a.$win.height()-u,c>l&&(l=c),s(t).css({height:l,"min-height":l}))}},i.bindingHandlers.appendDom={update:function(e,t){s(e).hide().empty().append(i.utils.unwrapObservable(t())).show()}},i.bindingHandlers.draggable={init:function(t,o,a){var r=e("Globals"),l=e("Utils");if(!r.bMobileDevice){var c=100,u=3,p=a(),d=p&&p.droppableSelector?p.droppableSelector:"",g={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};d&&(g.drag=function(e){s(d).each(function(){var t=null,i=null,o=s(this),a=o.offset(),r=a.top+o.height();n.clearInterval(o.data("timerScroll")),o.data("timerScroll",!1),e.pageX>=a.left&&e.pageX<=a.left+o.width()&&(e.pageY>=r-c&&e.pageY<=r&&(t=function(){o.scrollTop(o.scrollTop()+u),l.windowResize()},o.data("timerScroll",n.setInterval(t,10)),t()),e.pageY>=a.top&&e.pageY<=a.top+c&&(i=function(){o.scrollTop(o.scrollTop()-u),l.windowResize()},o.data("timerScroll",n.setInterval(i,10)),i()))})},g.stop=function(){s(d).each(function(){n.clearInterval(s(this).data("timerScroll")),s(this).data("timerScroll",!1)})}),g.helper=function(e){return o()(e&&e.target?i.dataFor(e.target):null)},s(t).draggable(g).on("mousedown",function(){l.removeInFocus()})}}},i.bindingHandlers.droppable={init:function(t,i,n){var o=e("Globals");if(!o.bMobileDevice){var a=i(),r=n(),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)}),s(t).droppable(u))}}},i.bindingHandlers.nano={init:function(t){var i=e("Globals");i.bDisableNanoScroll||s(t).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},i.bindingHandlers.saveTrigger={init:function(e){var t=s(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 n=i.utils.unwrapObservable(t()),o=s(e);if("custom"===o.data("save-trigger-type"))switch(n.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(n.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")}}},i.bindingHandlers.emailsTags={init:function(t,i,n){var a=e("Utils"),r=e("Model:Email"),l=s(t),c=i(),u=n(),p=u.autoCompleteSource||null,d=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:d,inputDelimiters:[",",";"],autoCompleteSource:p,parseHook:function(e){return o.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:o.bind(function(e){l.data("EmailsTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,n){var o=s(e),a=n(),r=a.emailsTagsFilter||null,l=i.utils.unwrapObservable(t());o.data("EmailsTagsValue")!==l&&(o.val(l),o.data("EmailsTagsValue",l),o.inputosaurus("refresh")),r&&i.utils.unwrapObservable(r)&&o.inputosaurus("focus")}},i.bindingHandlers.contactTags={init:function(t,i,n){var a=e("Utils"),r=e("Model:ContactTag"),l=s(t),c=i(),u=n(),p=u.autoCompleteSource||null,d=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:d,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:p,parseHook:function(e){return o.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:o.bind(function(e){l.data("ContactTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,t,n){var o=s(e),a=n(),r=a.contactTagsFilter||null,l=i.utils.unwrapObservable(t());o.data("ContactTagsValue")!==l&&(o.val(l),o.data("ContactTagsValue",l),o.inputosaurus("refresh")),r&&i.utils.unwrapObservable(r)&&o.inputosaurus("focus")}},i.bindingHandlers.command={init:function(e,t,n,o){var a=s(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(o,arguments)},update:function(e,t){var i=!0,n=s(e),o=t();i=o.enabled(),n.toggleClass("command-not-enabled",!i),i&&(i=o.canExecute(),n.toggleClass("command-can-not-be-execute",!i)),n.toggleClass("command-disabled disable disabled",!i).toggleClass("no-disabled",!!i),(n.is("input")||n.is("button"))&&n.prop("disabled",!i)}},i.extenders.trimmer=function(t){var n=e("Utils"),o=i.computed({read:t,write:function(e){t(n.trim(e.toString()))},owner:this});return o(t()),o},i.extenders.posInterer=function(t,n){var o=e("Utils"),s=i.computed({read:t,write:function(e){var i=o.pInt(e.toString(),n);0>=i&&(i=n),i===t()&&""+i!=""+e&&t(i+1),t(i)}});return s(t()),s},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 o=e("Utils");return t.iTimeout=0,t.subscribe(function(e){e&&(n.clearTimeout(t.iTimeout),t.iTimeout=n.setTimeout(function(){t(!1),t.iTimeout=0},o.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 n=e("Utils");return this.hasFuncError=i.observable(!1),n.isFunc(t)&&(this.subscribe(function(e){this.hasFuncError(!t(e))},this),this.valueHasMutated()),this},t.exports=i}(t,ko)},{$:14,Globals:8,"Model:ContactTag":25,"Model:Email":26,Utils:11,_:19,window:20}],17:[function(e,t){t.exports=moment},{}],18:[function(e,t){t.exports=ssm},{}],19:[function(e,t){t.exports=_},{}],20:[function(e,t){t.exports=window},{}],21:[function(e,t){!function(e,t){"use strict";function i(){this.oScreens={},this.sDefaultScreenName="",this.oCurrentScreen=null}var n=t("_"),o=t("$"),s=t("ko"),a=t("hasher"),r=t("crossroads"),l=t("Globals"),c=t("Plugins"),u=t("Utils");i.prototype.oScreens={},i.prototype.sDefaultScreenName="",i.prototype.oCurrentScreen=null,i.prototype.hideLoading=function(){o("#rl-loading").hide()},i.prototype.constructorEnd=function(e){u.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},i.prototype.extendAsViewModel=function(e,t){t&&(t.__names=u.isArray(e)?e:[e],t.__name=t.__names[0])},i.prototype.addSettingsViewModel=function(e,t,i,n,o){e.__rlSettingsData={Label:i,Template:t,Route:n,IsDefault:!!o},l.aViewModels.settings.push(e)},i.prototype.removeSettingsViewModel=function(e){l.aViewModels["settings-removed"].push(e)},i.prototype.disableSettingsViewModel=function(e){l.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||u.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(),p=o("#rl-content #rl-"+r.toLowerCase()),d=null;e.__builded=!0,e.__vm=a,a.viewModelName=e.__name,a.viewModelNames=e.__names,p&&1===p.length?(d=o("").addClass("rl-view-model").addClass("RL-"+a.viewModelTemplate()).hide(),d.appendTo(p),a.viewModelDom=d,e.__dom=d,"Popups"===r&&(a.cancelCommand=a.closeCommand=u.createCommand(a,function(){i.hideScreenPopup(e)}),a.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),l.popupVisibilityNames.push(this.viewModelName),a.viewModelDom.css("z-index",3e3+l.popupVisibilityNames().length+10),u.delegateRun(this,"onFocus",[],500)):(u.delegateRun(this,"onHide"),this.restoreKeyScope(),n.each(this.viewModelNames,function(e){c.runHook("view-model-on-hide",[e,t])}),l.popupVisibilityNames.remove(this.viewModelName),a.viewModelDom.css("z-index",2e3),l.tooltipTrigger(!l.tooltipTrigger()),n.delay(function(){t.viewModelDom.hide()},300))},a)),n.each(e.__names,function(e){c.runHook("view-model-pre-build",[e,a,d])}),s.applyBindingAccessorsToNode(d[0],{i18nInit:!0,template:function(){return{name:a.viewModelTemplate()}}},a),u.delegateRun(a,"onBuild",[d]),a&&"Popups"===r&&a.registerPopupKeyDown(),n.each(e.__names,function(e){c.runHook("view-model-post-build",[e,a,d])})):u.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)},i.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),u.delegateRun(e.__vm,"onShow",t||[]),n.each(e.__names,function(i){c.runHook("view-model-on-show",[i,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,o=null,s=null;""===u.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,u.isNonEmptyArray(o.viewModels())&&n.each(o.viewModels(),function(e){this.buildViewModel(e,o)},this),u.delegateRun(o,"onBuild")),n.defer(function(){i.oCurrentScreen&&(u.delegateRun(i.oCurrentScreen,"onHide"),u.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),u.delegateRun(e.__vm,"onHide"))})),i.oCurrentScreen=o,i.oCurrentScreen&&(u.delegateRun(i.oCurrentScreen,"onShow"),c.runHook("screen-on-show",[i.oCurrentScreen.screenName(),i.oCurrentScreen]),u.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),u.delegateRun(e.__vm,"onShow"),u.delegateRun(e.__vm,"onFocus",[],200),n.each(e.__names,function(t){c.runHook("view-model-on-show",[t,e.__vm])}))},i)),s=o.__cross?o.__cross():null,s&&s.parse(t)})))},i.prototype.startScreens=function(e){o("#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(),c.runHook("screen-pre-start",[e.screenName(),e]),u.delegateRun(e,"onStart"),c.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(),o("#rl-content").css({visibility:"visible"}),n.delay(function(){l.$html.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=u.isUnd(i)?!1:!!i,(u.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)},{$:14,Globals:8,Plugins:10,Utils:11,_:19,crossroads:12,hasher:13,ko:16}],22:[function(e,t){!function(e){"use strict";function t(){}t.prototype.bootstart=function(){},e.exports=t}(t,e)},{}],23:[function(e,t){!function(e,t){"use strict";function i(e,t){this.sScreenName=e,this.aViewModels=s.isArray(t)?t:[]}var n=t("_"),o=t("crossroads"),s=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;s.isNonEmptyArray(e)&&(i=n.bind(this.onRoute||s.emptyFunction,this),t=o.create(),n.each(e,function(e){t.addRoute(e[0],i).rules=e[1]}),this.oCross=t)},e.exports=i}(t,e)},{Utils:11,_:19,crossroads:12}],24:[function(e,t){!function(e,t){"use strict";
-function i(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=s.pString(e),this.sTemplate=s.pString(t),this.sDefaultKeyScope=o.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelVisibility=n.observable(!1),this.modalVisibility=n.observable(!1).extend({rateLimit:0}),this.viewModelName="",this.viewModelNames=[],this.viewModelDom=null}var n=t("ko"),o=t("Enums"),s=t("Utils"),a=t("Globals");i.prototype.bDisabeCloseOnEsc=!1,i.prototype.sPosition="",i.prototype.sTemplate="",i.prototype.sDefaultKeyScope=o.KeyState.None,i.prototype.sCurrentKeyScope=o.KeyState.None,i.prototype.viewModelName="",i.prototype.viewModelNames=[],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;a.$win.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&o.EventKeyCode.Esc===t.keyCode)return s.delegateRun(e,"cancelCommand"),!1;if(o.EventKeyCode.Backspace===t.keyCode&&!s.inFocus())return!1}return!0})},e.exports=i}(t,e)},{Enums:6,Globals:8,Utils:11,ko:16}],25:[function(e,t){!function(e,t){"use strict";function i(){this.idContactTag=0,this.name=n.observable(""),this.readOnly=!1}var n=t("ko"),o=t("Utils");i.prototype.parse=function(e){var t=!1;return e&&"Object/Tag"===e["@Object"]&&(this.idContact=o.pInt(e.IdContactTag),this.name(o.pString(e.Name)),this.readOnly=!!e.ReadOnly,t=!0),t},i.prototype.filterHelper=function(e){return-1!==this.name().toLowerCase().indexOf(e.toLowerCase())},i.prototype.toLine=function(e){return(o.isUnd(e)?1:!e)?this.name():o.encodeHtml(this.name())},e.exports=i}(t,e)},{Utils:11,ko:16}],26:[function(e,t){!function(e,t){"use strict";function i(e,t){this.email=e||"",this.name=t||"",this.clearDuplicateName()}var n=t("Utils");i.newInstanceFromJson=function(e){var t=new i;return t.initByJson(e)?t:null},i.prototype.name="",i.prototype.email="",i.prototype.clear=function(){this.email="",this.name=""},i.prototype.validate=function(){return""!==this.name||""!==this.email},i.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},i.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},i.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},i.prototype.parse=function(e){this.clear(),e=n.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)},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 o="";return""!==this.email&&(t=n.isUnd(t)?!1:!!t,i=n.isUnd(i)?!1:!!i,e&&""!==this.name?o=t?'")+'" target="_blank" tabindex="-1">'+n.encodeHtml(this.name)+"":i?n.encodeHtml(this.name):this.name:(o=this.email,""!==this.name?t?o=n.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+n.encodeHtml(o)+""+n.encodeHtml(">"):(o='"'+this.name+'" <'+o+">",i&&(o=n.encodeHtml(o))):t&&(o=''+n.encodeHtml(this.email)+""))),o},i.prototype.mailsoParse=function(e){if(e=n.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)},o="",s="",a="",r=!1,l=!1,c=!1,u=null,p=0,d=0,g=0;g0&&0===o.length&&(o=t(e,0,g)),l=!0,p=g);break;case">":l&&(d=g,s=t(e,p+1,d-p-1),e=i(e,"",p,d-p+1),d=0,g=0,p=0,l=!1);break;case"(":r||l||c||(c=!0,p=g);break;case")":c&&(d=g,a=t(e,p+1,d-p-1),e=i(e,"",p,d-p+1),d=0,g=0,p=0,c=!1);break;case"\\":g++}g++}return 0===s.length&&(u=e.match(/[^@\s]+@\S+/i),u&&u[0]?s=u[0]:o=e),s.length>0&&0===o.length&&0===a.length&&(o=e.replace(s,"")),s=n.trim(s).replace(/^[<]+/,"").replace(/[>]+$/,""),o=n.trim(o).replace(/^["']+/,"").replace(/["']+$/,""),a=n.trim(a).replace(/^[(]+/,"").replace(/[)]+$/,""),o=o.replace(/\\\\(.)/g,"$1"),a=a.replace(/\\\\(.)/g,"$1"),this.name=o,this.email=s,this.clearDuplicateName(),!0},i.prototype.inputoTagLine=function(){return 0 ").addClass("rl-settings-view-model").hide(),d.appendTo(p),i.viewModelDom=d,i.__rlSettingsData=u.__rlSettingsData,u.__dom=d,u.__builded=!0,u.__vm=i,s.applyBindingAccessorsToNode(d[0],{i18nInit:!0,template:function(){return{name:u.__rlSettingsData.Template}}},i),r.delegateRun(i,"onBuild",[d])):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)}),o("#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:s.observable(!1),disabled:!!n.find(a.aViewModels["settings-disabled"],function(t){return t&&t===e})})},this),this.oViewModelPlace=o("#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)},{$:14,"App:Knoin":21,Globals:8,"Knoin:AbstractScreen":23,LinkBuilder:9,Utils:11,_:19,ko:16}],28:[function(e,t){!function(e,t){"use strict";function i(){o.call(this,"login",[t("View:Admin:Login")])}var n=t("_"),o=t("Knoin:AbstractScreen");n.extend(i.prototype,o.prototype),i.prototype.onShow=function(){t("App:Admin").setTitle("")},e.exports=i}(t,e)},{"App:Admin":3,"Knoin:AbstractScreen":23,"View:Admin:Login":46,_:19}],29:[function(e,t){!function(e,t){"use strict";function i(){o.call(this,[t("View:Admin:SettingsMenu"),t("View:Admin:SettingsPane")])}var n=t("_"),o=t("Screen:AbstractSettings");n.extend(i.prototype,o.prototype),i.prototype.onShow=function(){t("App:Admin").setTitle("")},e.exports=i}(t,e)},{"App:Admin":3,"Screen:AbstractSettings":27,"View:Admin:SettingsMenu":47,"View:Admin:SettingsPane":48,_:19}],30:[function(e,t){!function(e,t){"use strict";function i(){var e=t("Storage:Settings"),i=t("Storage:Admin:Data");this.version=n.observable(e.settingsGet("Version")),this.access=n.observable(!!e.settingsGet("CoreAccess")),this.errorDesc=n.observable(""),this.coreReal=i.coreReal,this.coreUpdatable=i.coreUpdatable,this.coreAccess=i.coreAccess,this.coreChecking=i.coreChecking,this.coreUpdating=i.coreUpdating,this.coreRemoteVersion=i.coreRemoteVersion,this.coreRemoteRelease=i.coreRemoteRelease,this.coreVersionCompare=i.coreVersionCompare,this.statusType=n.computed(function(){var e="",t=this.coreVersionCompare(),i=this.coreChecking(),n=this.coreUpdating(),o=this.coreReal();return i?e="checking":n?e="updating":o&&0===t?e="up-to-date":o&&-1===t?e="available":o||(e="error",this.errorDesc("Cannot access the repository at the moment.")),e},this)}var n=t("ko");i.prototype.onBuild=function(){this.access()&&t("App:Admin").reloadCoreData()},i.prototype.updateCoreData=function(){this.coreUpdating()||t("App:Admin").updateCoreData()},e.exports=i}(t,e)},{"App:Admin":3,"Storage:Admin:Data":43,"Storage:Settings":45,ko:16}],31:[function(e,t){!function(e,t){"use strict";function i(){var e=t("Enums"),i=t("Storage:Settings");this.title=o.observable(i.settingsGet("Title")),this.title.trigger=o.observable(e.SaveSettingsStep.Idle),this.loadingDesc=o.observable(i.settingsGet("LoadingDescription")),this.loadingDesc.trigger=o.observable(e.SaveSettingsStep.Idle),this.loginLogo=o.observable(i.settingsGet("LoginLogo")),this.loginLogo.trigger=o.observable(e.SaveSettingsStep.Idle),this.loginDescription=o.observable(i.settingsGet("LoginDescription")),this.loginDescription.trigger=o.observable(e.SaveSettingsStep.Idle),this.loginCss=o.observable(i.settingsGet("LoginCss")),this.loginCss.trigger=o.observable(e.SaveSettingsStep.Idle)}var n=t("_"),o=t("ko"),s=t("Utils");i.prototype.onBuild=function(){var e=this,i=t("Storage:Admin:Remote");n.delay(function(){var t=s.settingsSaveHelperSimpleFunction(e.title.trigger,e),n=s.settingsSaveHelperSimpleFunction(e.loadingDesc.trigger,e),o=s.settingsSaveHelperSimpleFunction(e.loginLogo.trigger,e),a=s.settingsSaveHelperSimpleFunction(e.loginDescription.trigger,e),r=s.settingsSaveHelperSimpleFunction(e.loginCss.trigger,e);e.title.subscribe(function(e){i.saveAdminConfig(t,{Title:s.trim(e)})}),e.loadingDesc.subscribe(function(e){i.saveAdminConfig(n,{LoadingDescription:s.trim(e)})}),e.loginLogo.subscribe(function(e){i.saveAdminConfig(o,{LoginLogo:s.trim(e)})}),e.loginDescription.subscribe(function(e){i.saveAdminConfig(a,{LoginDescription:s.trim(e)})}),e.loginCss.subscribe(function(e){i.saveAdminConfig(r,{LoginCss:s.trim(e)})})},50)},e.exports=i}(t,e)},{Enums:6,"Storage:Admin:Remote":44,"Storage:Settings":45,Utils:11,_:19,ko:16}],32:[function(e,t){!function(e,t){"use strict";function i(){var e=t("Storage:Admin:Remote");this.defautOptionsAfterRender=a.defautOptionsAfterRender,this.enableContacts=o.observable(!!r.settingsGet("ContactsEnable")),this.contactsSharing=o.observable(!!r.settingsGet("ContactsSharing")),this.contactsSync=o.observable(!!r.settingsGet("ContactsSync"));var i=["sqlite","mysql","pgsql"],l=[],c=function(e){switch(e){case"sqlite":e="SQLite";break;case"mysql":e="MySQL";break;case"pgsql":e="PostgreSQL"}return e};r.settingsGet("SQLiteIsSupported")&&l.push("sqlite"),r.settingsGet("MySqlIsSupported")&&l.push("mysql"),r.settingsGet("PostgreSqlIsSupported")&&l.push("pgsql"),this.contactsSupported=0(new n.Date).getTime()-m),f&&l.oRequests[f]&&(l.oRequests[f].__aborted&&(o="abort"),l.oRequests[f]=null),l.defaultResponse(e,f,o,i,s,t)}),f&&0').appendTo('body');
-
- Globals.$win.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() : '',
- Globals.$html.attr('class'),
- Utils.microtime() - Globals.now
- );
- }
- });
-
- Globals.$doc.on('keydown', function (oEvent) {
- if (oEvent && oEvent.ctrlKey)
- {
- Globals.$html.addClass('rl-ctrl-key-pressed');
- }
- }).on('keyup', function (oEvent) {
- if (oEvent && !oEvent.ctrlKey)
- {
- Globals.$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()
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ moment = __webpack_require__(/*! moment */ 25),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Plugins = __webpack_require__(/*! Common/Plugins */ 26),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+ Events = __webpack_require__(/*! Common/Events */ 22),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+
+ Local = __webpack_require__(/*! Storage:LocalStorage */ 30),
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ Cache = __webpack_require__(/*! Storage:RainLoop:Cache */ 20),
+ Remote = __webpack_require__(/*! Storage:RainLoop:Remote */ 13),
+
+ EmailModel = __webpack_require__(/*! Model:Email */ 23),
+ FolderModel = __webpack_require__(/*! Model:Folder */ 58),
+ MessageModel = __webpack_require__(/*! Model:Message */ 38),
+ AccountModel = __webpack_require__(/*! Model:Account */ 51),
+ IdentityModel = __webpack_require__(/*! Model:Identity */ 59),
+ OpenPgpKeyModel = __webpack_require__(/*! Model:OpenPgpKey */ 60),
+
+ AbstractApp = __webpack_require__(/*! App:Abstract */ 34)
;
- if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
+ /**
+ * @constructor
+ * @extends AbstractApp
+ */
+ function RainLoopApp()
{
- oLink = window.document.createElement('a');
- oLink['href'] = sLink;
+ AbstractApp.call(this, Remote);
- 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;
- }
- }
- }
+ this.oMoveCache = {};
- if (Globals.bMobileDevice)
- {
- window.open(sLink, '_self');
- window.focus();
- }
- else
- {
- this.iframe.attr('src', sLink);
- // window.document.location.href = sLink;
- }
+ this.quotaDebounce = _.debounce(this.quota, 1000 * 30);
+ this.moveOrDeleteResponseHelper = _.bind(this.moveOrDeleteResponseHelper, this);
- return true;
- };
+ this.messagesMoveTrigger = _.debounce(this.messagesMoveTrigger, 500);
- /**
- * @param {string} sTitle
- */
- AbstractApp.prototype.setTitle = function (sTitle)
- {
- sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
- Settings.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('App:Knoin'),
- sCustomLogoutLink = Utils.pString(Settings.settingsGet('CustomLogoutLink')),
- bInIframe = !!Settings.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('ssm');
-
- Utils.initOnStartOrLangChange(function () {
- Utils.initNotificationLanguage();
- }, null);
-
- _.delay(function () {
- Utils.windowResize();
- }, 1000);
-
- ssm.addState({
- 'id': 'mobile',
- 'maxWidth': 767,
- 'onEnter': function() {
- Globals.$html.addClass('ssm-state-mobile');
- Events.pub('ssm.mobile-enter');
- },
- 'onLeave': function() {
- Globals.$html.removeClass('ssm-state-mobile');
- Events.pub('ssm.mobile-leave');
- }
- });
-
- ssm.addState({
- 'id': 'tablet',
- 'minWidth': 768,
- 'maxWidth': 999,
- 'onEnter': function() {
- Globals.$html.addClass('ssm-state-tablet');
- },
- 'onLeave': function() {
- Globals.$html.removeClass('ssm-state-tablet');
- }
- });
-
- ssm.addState({
- 'id': 'desktop',
- 'minWidth': 1000,
- 'maxWidth': 1400,
- 'onEnter': function() {
- Globals.$html.addClass('ssm-state-desktop');
- },
- 'onLeave': function() {
- Globals.$html.removeClass('ssm-state-desktop');
- }
- });
-
- ssm.addState({
- 'id': 'desktop-large',
- 'minWidth': 1400,
- 'onEnter': function() {
- Globals.$html.addClass('ssm-state-desktop-large');
- },
- 'onLeave': function() {
- Globals.$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) {
- Globals.$html.toggleClass('rl-left-panel-disabled', bValue);
- });
-
- ssm.ready();
- };
-
- module.exports = AbstractApp;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"Events":8,"Globals":9,"Knoin:AbstractBoot":28,"LinkBuilder":11,"Storage:Settings":69,"Utils":14,"_":25,"ssm":24,"window":26}],3:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- moment = require('moment'),
-
- Enums = require('Enums'),
- Globals = require('Globals'),
- Consts = require('Consts'),
- Plugins = require('Plugins'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
- Events = require('Events'),
-
- kn = require('App:Knoin'),
-
- Local = require('Storage:LocalStorage'),
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Cache = require('Storage:RainLoop:Cache'),
- Remote = require('Storage:RainLoop:Remote'),
-
- EmailModel = require('Model:Email'),
- FolderModel = require('Model:Folder'),
- MessageModel = require('Model:Message'),
- AccountModel = require('Model:Account'),
- IdentityModel = require('Model:Identity'),
- OpenPgpKeyModel = require('Model:OpenPgpKey'),
-
- AbstractApp = require('App:Abstract')
- ;
-
- /**
- * @constructor
- * @extends AbstractApp
- */
- function RainLoopApp()
- {
- AbstractApp.call(this, Remote);
-
- this.oMoveCache = {};
-
- this.quotaDebounce = _.debounce(this.quota, 1000 * 30);
- this.moveOrDeleteResponseHelper = _.bind(this.moveOrDeleteResponseHelper, this);
-
- this.messagesMoveTrigger = _.debounce(this.messagesMoveTrigger, 500);
-
- window.setInterval(function () {
- Events.pub('interval.30s');
- }, 30000);
-
- window.setInterval(function () {
- Events.pub('interval.1m');
- }, 60000);
-
- window.setInterval(function () {
- Events.pub('interval.2m');
- }, 60000 * 2);
-
- window.setInterval(function () {
- Events.pub('interval.3m');
- }, 60000 * 3);
-
- window.setInterval(function () {
- Events.pub('interval.5m');
- }, 60000 * 5);
-
- window.setInterval(function () {
- Events.pub('interval.10m');
- }, 60000 * 10);
-
- window.setTimeout(function () {
window.setInterval(function () {
- Events.pub('interval.10m-after5m');
+ Events.pub('interval.30s');
+ }, 30000);
+
+ window.setInterval(function () {
+ Events.pub('interval.1m');
+ }, 60000);
+
+ window.setInterval(function () {
+ Events.pub('interval.2m');
+ }, 60000 * 2);
+
+ window.setInterval(function () {
+ Events.pub('interval.3m');
+ }, 60000 * 3);
+
+ window.setInterval(function () {
+ Events.pub('interval.5m');
+ }, 60000 * 5);
+
+ window.setInterval(function () {
+ Events.pub('interval.10m');
}, 60000 * 10);
- }, 60000 * 5);
- $.wakeUp(function () {
+ window.setTimeout(function () {
+ window.setInterval(function () {
+ Events.pub('interval.10m-after5m');
+ }, 60000 * 10);
+ }, 60000 * 5);
- Remote.jsVersion(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
- {
- if (window.parent && !!Settings.settingsGet('InIframe'))
+ $.wakeUp(function () {
+
+ Remote.jsVersion(function (sResult, oData) {
+ if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
{
- window.parent.location.reload();
+ if (window.parent && !!Settings.settingsGet('InIframe'))
+ {
+ window.parent.location.reload();
+ }
+ else
+ {
+ window.location.reload();
+ }
}
- else
- {
- window.location.reload();
- }
- }
- }, Settings.settingsGet('Version'));
+ }, Settings.settingsGet('Version'));
- }, {}, 60 * 60 * 1000);
+ }, {}, 60 * 60 * 1000);
- this.socialUsers = _.bind(this.socialUsers, this);
- }
-
- _.extend(RainLoopApp.prototype, AbstractApp.prototype);
-
- RainLoopApp.prototype.remote = function ()
- {
- return Remote;
- };
-
- RainLoopApp.prototype.data = function ()
- {
- return Data;
- };
-
- RainLoopApp.prototype.setupSettings = function ()
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:General'),
- 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
-
- if (Settings.settingsGet('ContactsIsAllowed'))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Contacts'),
- 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
+ this.socialUsers = _.bind(this.socialUsers, this);
}
- if (Settings.capa(Enums.Capa.AdditionalAccounts))
+ _.extend(RainLoopApp.prototype, AbstractApp.prototype);
+
+ RainLoopApp.prototype.remote = function ()
{
- kn.addSettingsViewModel(require('Settings:RainLoop:Accounts'),
- 'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
- }
+ return Remote;
+ };
- if (Settings.capa(Enums.Capa.AdditionalIdentities))
+ RainLoopApp.prototype.data = function ()
{
- kn.addSettingsViewModel(require('Settings:RainLoop:Identities'),
- 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
- }
- else
+ return Data;
+ };
+
+ RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
{
- kn.addSettingsViewModel(require('Settings:RainLoop:Identity'),
- 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
- }
+ _.each(Data.messageList(), function (oMessage) {
+ Cache.initMessageFlagsFromCache(oMessage);
+ });
- if (Settings.capa(Enums.Capa.Filters))
+ Cache.initMessageFlagsFromCache(Data.message());
+ };
+
+ /**
+ * @param {boolean=} bDropPagePosition = false
+ * @param {boolean=} bDropCurrenFolderCache = false
+ */
+ RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
{
- kn.addSettingsViewModel(require('Settings:RainLoop:Filters'),
- 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
- }
-
- if (Settings.capa(Enums.Capa.TwoFactor))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Security'),
- 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
- }
-
- if (Settings.settingsGet('AllowGoogleSocial') ||
- Settings.settingsGet('AllowFacebookSocial') ||
- Settings.settingsGet('AllowTwitterSocial'))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Social'),
- 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
- }
-
- if (Settings.settingsGet('ChangePasswordIsAllowed'))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:ChangePassword'),
- 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
- }
-
- kn.addSettingsViewModel(require('Settings:RainLoop:Folders'),
- 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
-
- if (Settings.capa(Enums.Capa.Themes))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:Themes'),
- 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
- }
-
- if (Settings.capa(Enums.Capa.OpenPGP))
- {
- kn.addSettingsViewModel(require('Settings:RainLoop:OpenPGP'),
- 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
- }
-
- return true;
- };
-
- RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
- {
- _.each(Data.messageList(), function (oMessage) {
- Cache.initMessageFlagsFromCache(oMessage);
- });
-
- Cache.initMessageFlagsFromCache(Data.message());
- };
-
- /**
- * @param {boolean=} bDropPagePosition = false
- * @param {boolean=} bDropCurrenFolderCache = false
- */
- RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
- {
- var
- self = this,
- iOffset = (Data.messageListPage() - 1) * Data.messagesPerPage()
- ;
-
- if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache)
- {
- Cache.setFolderHash(Data.currentFolderFullNameRaw(), '');
- }
-
- if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition)
- {
- Data.messageListPage(1);
- iOffset = 0;
- }
-
- Data.messageListLoading(true);
- Remote.messageList(function (sResult, oData, bCached) {
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- Data.messageListError('');
- Data.messageListLoading(false);
- self.setMessageList(oData, bCached);
- }
- else if (Enums.StorageResultType.Unload === sResult)
- {
- Data.messageListError('');
- Data.messageListLoading(false);
- }
- else if (Enums.StorageResultType.Abort !== sResult)
- {
- Data.messageList([]);
- Data.messageListLoading(false);
- Data.messageListError(oData && oData.ErrorCode ?
- Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST')
- );
- }
-
- }, Data.currentFolderFullNameRaw(), iOffset, Data.messagesPerPage(), Data.messageListSearch());
- };
-
- RainLoopApp.prototype.recacheInboxMessageList = function ()
- {
- Remote.messageList(Utils.emptyFunction, 'INBOX', 0, Data.messagesPerPage(), '', true);
- };
-
- RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
- {
- this.reloadMessageList(bEmptyList);
- };
-
- /**
- * @param {Function} fResultFunc
- * @returns {boolean}
- */
- RainLoopApp.prototype.contactsSync = function (fResultFunc)
- {
- var oContacts = Data.contacts;
- if (oContacts.importing() || oContacts.syncing() || !Data.enableContactsSync() || !Data.allowContactsSync())
- {
- return false;
- }
-
- oContacts.syncing(true);
-
- Remote.contactsSync(function (sResult, oData) {
-
- oContacts.syncing(false);
-
- if (fResultFunc)
- {
- fResultFunc(sResult, oData);
- }
- });
-
- return true;
- };
-
- RainLoopApp.prototype.messagesMoveTrigger = function ()
- {
- var
- self = this,
- sSpamFolder = Data.spamFolder()
- ;
-
- _.each(this.oMoveCache, function (oItem) {
-
var
- bSpam = sSpamFolder === oItem['To'],
- bHam = !bSpam && sSpamFolder === oItem['From'] && 'INBOX' === oItem['To']
+ self = this,
+ iOffset = (Data.messageListPage() - 1) * Data.messagesPerPage()
;
- 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)
- {
- Remote.messagesCopy(
- this.moveOrDeleteResponseHelper,
- sFromFolderFullNameRaw,
- sToFolderFullNameRaw,
- aUidForCopy
- );
- };
-
- RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
- {
- Remote.messagesDelete(
- this.moveOrDeleteResponseHelper,
- sFromFolderFullNameRaw,
- aUidForRemove
- );
- };
-
- RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
- {
- if (Enums.StorageResultType.Success === sResult && Data.currentFolder())
- {
- if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length)
- {
- Cache.setFolderHash(oData.Result[0], oData.Result[1]);
- }
- else
+ if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache)
{
Cache.setFolderHash(Data.currentFolderFullNameRaw(), '');
-
- if (oData && -1 < Utils.inArray(oData.ErrorCode,
- [Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
- {
- window.alert(Utils.getNotification(oData.ErrorCode));
- }
}
- this.reloadMessageListHelper(0 === Data.messageList().length);
- this.quotaDebounce();
- }
- };
-
- /**
- * @param {string} sFromFolderFullNameRaw
- * @param {Array} aUidForRemove
- */
- RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
- {
- this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
- 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,
- oMoveFolder = null,
- nSetSystemFoldersNotification = null
- ;
-
- switch (iDeleteType)
- {
- case Enums.FolderType.Spam:
- oMoveFolder = Cache.getFolderFromCacheList(Data.spamFolder());
- nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam;
- break;
- case Enums.FolderType.NotSpam:
- oMoveFolder = Cache.getFolderFromCacheList('INBOX');
- break;
- case Enums.FolderType.Trash:
- oMoveFolder = Cache.getFolderFromCacheList(Data.trashFolder());
- nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash;
- break;
- case Enums.FolderType.Archive:
- oMoveFolder = Cache.getFolderFromCacheList(Data.archiveFolder());
- nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive;
- break;
- }
-
- bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder;
- if (bUseFolder)
- {
- if ((Enums.FolderType.Spam === iDeleteType && Consts.Values.UnuseOptionValue === Data.spamFolder()) ||
- (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === Data.trashFolder()) ||
- (Enums.FolderType.Archive === iDeleteType && Consts.Values.UnuseOptionValue === Data.archiveFolder()))
+ if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition)
{
- bUseFolder = false;
+ Data.messageListPage(1);
+ iOffset = 0;
}
- }
- if (!oMoveFolder && bUseFolder)
+ Data.messageListLoading(true);
+ Remote.messageList(function (sResult, oData, bCached) {
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
+ {
+ Data.messageListError('');
+ Data.messageListLoading(false);
+ self.setMessageList(oData, bCached);
+ }
+ else if (Enums.StorageResultType.Unload === sResult)
+ {
+ Data.messageListError('');
+ Data.messageListLoading(false);
+ }
+ else if (Enums.StorageResultType.Abort !== sResult)
+ {
+ Data.messageList([]);
+ Data.messageListLoading(false);
+ Data.messageListError(oData && oData.ErrorCode ?
+ Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST')
+ );
+ }
+
+ }, Data.currentFolderFullNameRaw(), iOffset, Data.messagesPerPage(), Data.messageListSearch());
+ };
+
+ RainLoopApp.prototype.recacheInboxMessageList = function ()
{
- kn.showScreenPopup(require('View:Popup:FolderSystem'), [nSetSystemFoldersNotification]);
- }
- else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType &&
- (sFromFolderFullNameRaw === Data.spamFolder() || sFromFolderFullNameRaw === Data.trashFolder())))
+ Remote.messageList(Utils.emptyFunction, 'INBOX', 0, Data.messagesPerPage(), '', true);
+ };
+
+ RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
{
- kn.showScreenPopup(require('View:Popup:Ask'), [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () {
+ this.reloadMessageList(bEmptyList);
+ };
- self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
- Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
-
- }]);
- }
- else if (oMoveFolder)
+ /**
+ * @param {Function} fResultFunc
+ * @returns {boolean}
+ */
+ RainLoopApp.prototype.contactsSync = function (fResultFunc)
{
- this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove);
- Data.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 = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
- oToFolder = Cache.getFolderFromCacheList(sToFolderFullNameRaw)
- ;
-
- if (oFromFolder && oToFolder)
+ var oContacts = Data.contacts;
+ if (oContacts.importing() || oContacts.syncing() || !Data.enableContactsSync() || !Data.allowContactsSync())
{
- if (Utils.isUnd(bCopy) ? false : !!bCopy)
- {
- this.messagesCopyHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove);
- }
- else
- {
- this.messagesMoveHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove);
- }
-
- Data.removeMessagesFromList(oFromFolder.fullNameRaw, aUidForMove, oToFolder.fullNameRaw, bCopy);
- return true;
+ return false;
}
- }
- return false;
- };
+ oContacts.syncing(true);
- /**
- * @param {Function=} fCallback
- */
- RainLoopApp.prototype.folders = function (fCallback)
- {
- Data.foldersLoading(true);
- Remote.folders(_.bind(function (sResult, oData) {
+ Remote.contactsSync(function (sResult, oData) {
- Data.foldersLoading(false);
- if (Enums.StorageResultType.Success === sResult)
- {
- this.setFolders(oData);
- if (fCallback)
+ oContacts.syncing(false);
+
+ if (fResultFunc)
{
- fCallback(true);
- }
- }
- else
- {
- if (fCallback)
- {
- fCallback(false);
- }
- }
- }, this));
- };
-
- RainLoopApp.prototype.reloadOpenPgpKeys = function ()
- {
- if (Data.capaOpenPGP())
- {
- var
- aKeys = [],
- oEmail = new EmailModel(),
- oOpenpgpKeyring = 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())
- );
- }
+ fResultFunc(sResult, oData);
}
});
- Data.openpgpkeys(aKeys);
- }
- };
+ return true;
+ };
- RainLoopApp.prototype.accountsAndIdentities = function ()
- {
- Data.accountsLoading(true);
- Data.identitiesLoading(true);
+ RainLoopApp.prototype.messagesMoveTrigger = function ()
+ {
+ var
+ self = this,
+ sSpamFolder = Data.spamFolder()
+ ;
- Remote.accountsAndIdentities(function (sResult, oData) {
+ _.each(this.oMoveCache, function (oItem) {
- Data.accountsLoading(false);
- Data.identitiesLoading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData.Result)
- {
var
- sParentEmail = Settings.settingsGet('ParentEmail'),
- sAccountEmail = Data.accountEmail()
+ bSpam = sSpamFolder === oItem['To'],
+ bHam = !bSpam && sSpamFolder === oItem['From'] && 'INBOX' === oItem['To']
;
- sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
+ Remote.messagesMove(self.moveOrDeleteResponseHelper, oItem['From'], oItem['To'], oItem['Uid'],
+ bSpam ? 'SPAM' : (bHam ? 'HAM' : ''));
+ });
- if (Utils.isArray(oData.Result['Accounts']))
- {
- Data.accounts(_.map(oData.Result['Accounts'], function (sValue) {
- return new AccountModel(sValue, sValue !== sParentEmail);
- }));
- }
+ this.oMoveCache = {};
+ };
- if (Utils.isArray(oData.Result['Identities']))
- {
- Data.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 ()
- {
- 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))
- {
- Data.userQuota(Utils.pInt(oData.Result[1]) * 1024);
- Data.userUsageSize(Utils.pInt(oData.Result[0]) * 1024);
- }
- });
- };
-
- /**
- * @param {string} sFolder
- * @param {Array=} aList = []
- */
- RainLoopApp.prototype.folderInformation = function (sFolder, aList)
- {
- if ('' !== Utils.trim(sFolder))
+ RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove)
{
- var self = this;
- Remote.folderInformation(function (sResult, oData) {
- if (Enums.StorageResultType.Success === sResult)
+ 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)
+ {
+ Remote.messagesCopy(
+ this.moveOrDeleteResponseHelper,
+ sFromFolderFullNameRaw,
+ sToFolderFullNameRaw,
+ aUidForCopy
+ );
+ };
+
+ RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
+ {
+ Remote.messagesDelete(
+ this.moveOrDeleteResponseHelper,
+ sFromFolderFullNameRaw,
+ aUidForRemove
+ );
+ };
+
+ RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
+ {
+ if (Enums.StorageResultType.Success === sResult && Data.currentFolder())
+ {
+ if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length)
{
- if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder)
+ Cache.setFolderHash(oData.Result[0], oData.Result[1]);
+ }
+ else
+ {
+ Cache.setFolderHash(Data.currentFolderFullNameRaw(), '');
+
+ if (oData && -1 < Utils.inArray(oData.ErrorCode,
+ [Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
{
- var
- iUtc = moment().unix(),
- sHash = Cache.getFolderHash(oData.Result.Folder),
- oFolder = Cache.getFolderFromCacheList(oData.Result.Folder),
- bCheck = false,
- sUid = '',
- aList = [],
- bUnreadCountChange = false,
- oFlags = null
- ;
-
- if (oFolder)
- {
- oFolder.interval = iUtc;
-
- if (oData.Result.Hash)
- {
- 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)
- {
- 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];
- Cache.storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
- !oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded'], !!oFlags['IsReadReceipt']
- ]);
- }
- }
-
- if (bCheck)
- {
- self.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- }
-
- Data.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
-
- if (oData.Result.Hash !== sHash || '' === sHash)
- {
- if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
- {
- self.reloadMessageList();
- }
- else if ('INBOX' === oFolder.fullNameRaw)
- {
- self.recacheInboxMessageList();
- }
- }
- else if (bUnreadCountChange)
- {
- if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
- {
- aList = Data.messageList();
- if (Utils.isNonEmptyArray(aList))
- {
- self.folderInformation(oFolder.fullNameRaw, aList);
- }
- }
- }
- }
+ window.alert(Utils.getNotification(oData.ErrorCode));
}
}
- }, sFolder, aList);
- }
- };
- /**
- * @param {boolean=} bBoot = false
- */
- RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
- {
- bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
+ this.reloadMessageListHelper(0 === Data.messageList().length);
+ this.quotaDebounce();
+ }
+ };
- var
- self = this,
- iUtc = moment().unix(),
- aFolders = Data.getNextFolderNames(bBoot)
- ;
-
- if (Utils.isNonEmptyArray(aFolders))
+ /**
+ * @param {string} sFromFolderFullNameRaw
+ * @param {Array} aUidForRemove
+ */
+ RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
{
- Remote.folderInformationMultiply(function (sResult, oData) {
+ this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
+ 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,
+ oMoveFolder = null,
+ nSetSystemFoldersNotification = null
+ ;
+
+ switch (iDeleteType)
+ {
+ case Enums.FolderType.Spam:
+ oMoveFolder = Cache.getFolderFromCacheList(Data.spamFolder());
+ nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam;
+ break;
+ case Enums.FolderType.NotSpam:
+ oMoveFolder = Cache.getFolderFromCacheList('INBOX');
+ break;
+ case Enums.FolderType.Trash:
+ oMoveFolder = Cache.getFolderFromCacheList(Data.trashFolder());
+ nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash;
+ break;
+ case Enums.FolderType.Archive:
+ oMoveFolder = Cache.getFolderFromCacheList(Data.archiveFolder());
+ nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive;
+ break;
+ }
+
+ bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder;
+ if (bUseFolder)
+ {
+ if ((Enums.FolderType.Spam === iDeleteType && Consts.Values.UnuseOptionValue === Data.spamFolder()) ||
+ (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === Data.trashFolder()) ||
+ (Enums.FolderType.Archive === iDeleteType && Consts.Values.UnuseOptionValue === Data.archiveFolder()))
+ {
+ bUseFolder = false;
+ }
+ }
+
+ if (!oMoveFolder && bUseFolder)
+ {
+ kn.showScreenPopup(__webpack_require__(/*! View:Popup:FolderSystem */ 27), [nSetSystemFoldersNotification]);
+ }
+ else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType &&
+ (sFromFolderFullNameRaw === Data.spamFolder() || sFromFolderFullNameRaw === Data.trashFolder())))
+ {
+ kn.showScreenPopup(__webpack_require__(/*! View:Popup:Ask */ 31), [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () {
+
+ self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
+ Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
+
+ }]);
+ }
+ else if (oMoveFolder)
+ {
+ this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove);
+ Data.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 = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
+ oToFolder = 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);
+ }
+
+ Data.removeMessagesFromList(oFromFolder.fullNameRaw, aUidForMove, oToFolder.fullNameRaw, bCopy);
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ /**
+ * @param {Function=} fCallback
+ */
+ RainLoopApp.prototype.folders = function (fCallback)
+ {
+ Data.foldersLoading(true);
+ Remote.folders(_.bind(function (sResult, oData) {
+
+ Data.foldersLoading(false);
if (Enums.StorageResultType.Success === sResult)
{
- if (oData && oData.Result && oData.Result.List && Utils.isNonEmptyArray(oData.Result.List))
+ this.setFolders(oData);
+ if (fCallback)
{
- _.each(oData.Result.List, function (oItem) {
+ fCallback(true);
+ }
+ }
+ else
+ {
+ if (fCallback)
+ {
+ fCallback(false);
+ }
+ }
+ }, this));
+ };
+
+ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
+ {
+ if (Data.capaOpenPGP())
+ {
+ var
+ aKeys = [],
+ oEmail = new EmailModel(),
+ oOpenpgpKeyring = 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())
+ );
+ }
+ }
+ });
+
+ Data.openpgpkeys(aKeys);
+ }
+ };
+
+ RainLoopApp.prototype.accountsAndIdentities = function ()
+ {
+ Data.accountsLoading(true);
+ Data.identitiesLoading(true);
+
+ Remote.accountsAndIdentities(function (sResult, oData) {
+
+ Data.accountsLoading(false);
+ Data.identitiesLoading(false);
+
+ if (Enums.StorageResultType.Success === sResult && oData.Result)
+ {
+ var
+ sParentEmail = Settings.settingsGet('ParentEmail'),
+ sAccountEmail = Data.accountEmail()
+ ;
+
+ sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
+
+ if (Utils.isArray(oData.Result['Accounts']))
+ {
+ Data.accounts(_.map(oData.Result['Accounts'], function (sValue) {
+ return new AccountModel(sValue, sValue !== sParentEmail);
+ }));
+ }
+
+ if (Utils.isArray(oData.Result['Identities']))
+ {
+ Data.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 ()
+ {
+ 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))
+ {
+ Data.userQuota(Utils.pInt(oData.Result[1]) * 1024);
+ Data.userUsageSize(Utils.pInt(oData.Result[0]) * 1024);
+ }
+ });
+ };
+
+ /**
+ * @param {string} sFolder
+ * @param {Array=} aList = []
+ */
+ RainLoopApp.prototype.folderInformation = function (sFolder, aList)
+ {
+ if ('' !== Utils.trim(sFolder))
+ {
+ var self = 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 = Cache.getFolderHash(oData.Result.Folder),
+ oFolder = Cache.getFolderFromCacheList(oData.Result.Folder),
+ bCheck = false,
+ sUid = '',
aList = [],
- sHash = Cache.getFolderHash(oItem.Folder),
- oFolder = Cache.getFolderFromCacheList(oItem.Folder),
- bUnreadCountChange = false
+ bUnreadCountChange = false,
+ oFlags = null
;
if (oFolder)
{
oFolder.interval = iUtc;
- if (oItem.Hash)
+ if (oData.Result.Hash)
{
- Cache.setFolderHash(oItem.Folder, oItem.Hash);
+ Cache.setFolderHash(oData.Result.Folder, oData.Result.Hash);
}
- if (Utils.isNormal(oItem.MessageCount))
+ if (Utils.isNormal(oData.Result.MessageCount))
{
- oFolder.messageCountAll(oItem.MessageCount);
+ oFolder.messageCountAll(oData.Result.MessageCount);
}
- if (Utils.isNormal(oItem.MessageUnseenCount))
+ if (Utils.isNormal(oData.Result.MessageUnseenCount))
{
- if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oItem.MessageUnseenCount))
+ if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
{
bUnreadCountChange = true;
}
- oFolder.messageCountUnread(oItem.MessageUnseenCount);
+ oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
}
if (bUnreadCountChange)
@@ -1043,12 +603,38 @@
Cache.clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
}
- if (oItem.Hash !== sHash || '' === sHash)
+ if (oData.Result.Flags)
+ {
+ for (sUid in oData.Result.Flags)
+ {
+ if (oData.Result.Flags.hasOwnProperty(sUid))
+ {
+ bCheck = true;
+ oFlags = oData.Result.Flags[sUid];
+ Cache.storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [
+ !oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded'], !!oFlags['IsReadReceipt']
+ ]);
+ }
+ }
+
+ if (bCheck)
+ {
+ self.reloadFlagsCurrentMessageListAndMessageFromCache();
+ }
+ }
+
+ Data.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
+
+ if (oData.Result.Hash !== sHash || '' === sHash)
{
if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
{
self.reloadMessageList();
}
+ else if ('INBOX' === oFolder.fullNameRaw)
+ {
+ self.recacheInboxMessageList();
+ }
}
else if (bUnreadCountChange)
{
@@ -1062,9711 +648,4489 @@
}
}
}
- });
-
- if (bBoot)
- {
- self.folderInformationMultiply(true);
}
}
- }
- }, aFolders);
- }
- };
+ }, sFolder, aList);
+ }
+ };
- RainLoopApp.prototype.setMessageSeen = function (oMessage)
- {
- if (oMessage.unseen())
+ /**
+ * @param {boolean=} bBoot = false
+ */
+ RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
{
- oMessage.unseen(false);
+ bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
- var oFolder = Cache.getFolderFromCacheList(oMessage.folderFullNameRaw);
- if (oFolder)
- {
- oFolder.messageCountUnread(0 <= oFolder.messageCountUnread() - 1 ?
- oFolder.messageCountUnread() - 1 : 0);
- }
-
- Cache.storeMessageFlagsToCache(oMessage);
- this.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
-
- Remote.messageSetSeen(Utils.emptyFunction, oMessage.folderFullNameRaw, [oMessage.uid], true);
- };
-
- RainLoopApp.prototype.googleConnect = function ()
- {
- window.open(LinkBuilder.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
- };
-
- RainLoopApp.prototype.twitterConnect = function ()
- {
- window.open(LinkBuilder.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
- };
-
- RainLoopApp.prototype.facebookConnect = function ()
- {
- window.open(LinkBuilder.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)
- {
- if (bFireAllActions)
- {
- Data.googleActions(true);
- Data.facebookActions(true);
- Data.twitterActions(true);
- }
-
- Remote.socialUsers(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- Data.googleUserName(oData.Result['Google'] || '');
- Data.facebookUserName(oData.Result['Facebook'] || '');
- Data.twitterUserName(oData.Result['Twitter'] || '');
- }
- else
- {
- Data.googleUserName('');
- Data.facebookUserName('');
- Data.twitterUserName('');
- }
-
- Data.googleLoggined('' !== Data.googleUserName());
- Data.facebookLoggined('' !== Data.facebookUserName());
- Data.twitterLoggined('' !== Data.twitterUserName());
-
- Data.googleActions(false);
- Data.facebookActions(false);
- Data.twitterActions(false);
- });
- };
-
- RainLoopApp.prototype.googleDisconnect = function ()
- {
- Data.googleActions(true);
- Remote.googleDisconnect(this.socialUsers);
- };
-
- RainLoopApp.prototype.facebookDisconnect = function ()
- {
- Data.facebookActions(true);
- Remote.facebookDisconnect(this.socialUsers);
- };
-
- RainLoopApp.prototype.twitterDisconnect = function ()
- {
- Data.twitterActions(true);
- Remote.twitterDisconnect(this.socialUsers);
- };
-
- /**
- * @param {string} sQuery
- * @param {Function} fCallback
- */
- RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
- {
- var
- aData = []
- ;
-
- 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(Data.contactTags(), function (oContactTag) {
- return oContactTag && oContactTag.filterHelper(sQuery);
- }));
- };
-
- RainLoopApp.prototype.setMessageList = function (oData, bCached)
- {
- if (oData && oData.Result && 'Collection/MessageCollection' === oData.Result['@Object'] &&
- oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
- {
var
- mLastCollapsedThreadUids = null,
- iIndex = 0,
- iLen = 0,
- iCount = 0,
- iOffset = 0,
- aList = [],
+ self = this,
iUtc = moment().unix(),
- aStaticList = Data.staticMessageList,
- oJsonMessage = null,
- oMessage = null,
- oFolder = null,
- iNewCount = 0,
- bUnreadCountChange = false
+ aFolders = Data.getNextFolderNames(bBoot)
;
- iCount = Utils.pInt(oData.Result.MessageResultCount);
- iOffset = Utils.pInt(oData.Result.Offset);
-
- if (Utils.isNonEmptyArray(oData.Result.LastCollapsedThreadUids))
+ if (Utils.isNonEmptyArray(aFolders))
{
- mLastCollapsedThreadUids = oData.Result.LastCollapsedThreadUids;
- }
-
- oFolder = Cache.getFolderFromCacheList(
- Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
-
- if (oFolder && !bCached)
- {
- oFolder.interval = iUtc;
-
- 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))
+ Remote.folderInformationMultiply(function (sResult, oData) {
+ if (Enums.StorageResultType.Success === sResult)
{
- bUnreadCountChange = true;
- }
-
- oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
- }
-
- Data.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
- }
-
- if (bUnreadCountChange && oFolder)
- {
- 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 (Cache.hasNewMessageAndRemoveFromCache(oMessage.folderFullNameRaw, oMessage.uid) && 5 >= iNewCount)
+ if (oData && oData.Result && oData.Result.List && Utils.isNonEmptyArray(oData.Result.List))
{
- iNewCount++;
- oMessage.newForAnimation(true);
- }
+ _.each(oData.Result.List, function (oItem) {
- oMessage.deleted(false);
+ var
+ aList = [],
+ sHash = Cache.getFolderHash(oItem.Folder),
+ oFolder = Cache.getFolderFromCacheList(oItem.Folder),
+ bUnreadCountChange = false
+ ;
- if (bCached)
- {
- Cache.initMessageFlagsFromCache(oMessage);
- }
- else
- {
- Cache.storeMessageFlagsToCache(oMessage);
- }
+ if (oFolder)
+ {
+ oFolder.interval = iUtc;
- oMessage.lastInCollapsedThread(mLastCollapsedThreadUids && -1 < Utils.inArray(Utils.pInt(oMessage.uid), mLastCollapsedThreadUids) ? true : false);
+ if (oItem.Hash)
+ {
+ Cache.setFolderHash(oItem.Folder, oItem.Hash);
+ }
- aList.push(oMessage);
- }
- }
- }
+ if (Utils.isNormal(oItem.MessageCount))
+ {
+ oFolder.messageCountAll(oItem.MessageCount);
+ }
- Data.messageListCount(iCount);
- Data.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
- Data.messageListPage(window.Math.ceil((iOffset / Data.messagesPerPage()) + 1));
- Data.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
- Data.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
- Data.messageListEndPage(Data.messageListPage());
+ if (Utils.isNormal(oItem.MessageUnseenCount))
+ {
+ if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oItem.MessageUnseenCount))
+ {
+ bUnreadCountChange = true;
+ }
- Data.messageList(aList);
- Data.messageListIsNotCompleted(false);
+ oFolder.messageCountUnread(oItem.MessageUnseenCount);
+ }
- if (aStaticList.length < aList.length)
- {
- Data.staticMessageList = aList;
- }
+ if (bUnreadCountChange)
+ {
+ Cache.clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
+ }
- Cache.clearNewMessageCache();
+ if (oItem.Hash !== sHash || '' === sHash)
+ {
+ if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
+ {
+ self.reloadMessageList();
+ }
+ }
+ else if (bUnreadCountChange)
+ {
+ if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
+ {
+ aList = Data.messageList();
+ if (Utils.isNonEmptyArray(aList))
+ {
+ self.folderInformation(oFolder.fullNameRaw, aList);
+ }
+ }
+ }
+ }
+ });
- if (oFolder && (bCached || bUnreadCountChange || Data.useThreads()))
- {
- this.folderInformation(oFolder.fullNameRaw, aList);
- }
- }
- else
- {
- Data.messageListCount(0);
- Data.messageList([]);
- Data.messageListError(Utils.getNotification(
- oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList
- ));
- }
- };
-
- /**
- * @param {string} sNamespace
- * @param {Array} aFolders
- * @return {Array}
- */
- RainLoopApp.prototype.folderResponseParseRec = function (sNamespace, aFolders)
- {
- var
- self = this,
- 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 = Cache.getFolderFromCacheList(sFolderFullNameRaw);
- if (!oCacheFolder)
- {
- oCacheFolder = FolderModel.newInstanceFromJson(oFolder);
- if (oCacheFolder)
- {
- Cache.setFolderToCacheList(sFolderFullNameRaw, oCacheFolder);
- Cache.setFolderFullNameRaw(oCacheFolder.fullNameHash, sFolderFullNameRaw);
- }
- }
-
- if (oCacheFolder)
- {
- oCacheFolder.collapsed(!self.isFolderExpanded(oCacheFolder.fullNameHash));
-
- if (oFolder.Extended)
- {
- if (oFolder.Extended.Hash)
- {
- 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);
+ if (bBoot)
+ {
+ self.folderInformationMultiply(true);
+ }
}
}
-
- 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);
- }
+ }, aFolders);
}
- }
+ };
- return aList;
- };
-
- /**
- * @param {*} oData
- */
- RainLoopApp.prototype.setFolders = function (oData)
- {
- var
- aList = [],
- bUpdate = false,
- fNormalizeFolder = function (sFolderFullNameRaw) {
- return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw ||
- null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : '';
- }
- ;
-
- if (oData && oData.Result && 'Collection/FolderCollection' === oData.Result['@Object'] &&
- oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
+ RainLoopApp.prototype.setMessageSeen = function (oMessage)
{
- if (!Utils.isUnd(oData.Result.Namespace))
+ if (oMessage.unseen())
{
- Data.namespace = oData.Result.Namespace;
- }
+ oMessage.unseen(false);
- Data.threading(!!Settings.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true);
-
- aList = this.folderResponseParseRec(Data.namespace, oData.Result['@Collection']);
- Data.folderList(aList);
-
- if (oData.Result['SystemFolders'] &&
- '' === '' + Settings.settingsGet('SentFolder') + Settings.settingsGet('DraftFolder') +
- Settings.settingsGet('SpamFolder') + Settings.settingsGet('TrashFolder') + Settings.settingsGet('ArchiveFolder') +
- Settings.settingsGet('NullFolder'))
- {
- // TODO Magic Numbers
- Settings.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null);
- Settings.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null);
- Settings.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null);
- Settings.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null);
- Settings.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null);
-
- bUpdate = true;
- }
-
- Data.sentFolder(fNormalizeFolder(Settings.settingsGet('SentFolder')));
- Data.draftFolder(fNormalizeFolder(Settings.settingsGet('DraftFolder')));
- Data.spamFolder(fNormalizeFolder(Settings.settingsGet('SpamFolder')));
- Data.trashFolder(fNormalizeFolder(Settings.settingsGet('TrashFolder')));
- Data.archiveFolder(fNormalizeFolder(Settings.settingsGet('ArchiveFolder')));
-
- if (bUpdate)
- {
- Remote.saveSystemFolders(Utils.emptyFunction, {
- 'SentFolder': Data.sentFolder(),
- 'DraftFolder': Data.draftFolder(),
- 'SpamFolder': Data.spamFolder(),
- 'TrashFolder': Data.trashFolder(),
- 'ArchiveFolder': Data.archiveFolder(),
- 'NullFolder': 'NullFolder'
- });
- }
-
- Local.set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
- }
- };
-
- /**
- * @param {string} sFullNameHash
- * @return {boolean}
- */
- RainLoopApp.prototype.isFolderExpanded = function (sFullNameHash)
- {
- var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders);
- return Utils.isArray(aExpandedList) && -1 !== _.indexOf(aExpandedList, sFullNameHash);
- };
-
- /**
- * @param {string} sFullNameHash
- * @param {boolean} bExpanded
- */
- RainLoopApp.prototype.setExpandedFolder = function (sFullNameHash, bExpanded)
- {
- var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders);
- if (!Utils.isArray(aExpandedList))
- {
- aExpandedList = [];
- }
-
- if (bExpanded)
- {
- aExpandedList.push(sFullNameHash);
- aExpandedList = _.uniq(aExpandedList);
- }
- else
- {
- aExpandedList = _.without(aExpandedList, sFullNameHash);
- }
-
- Local.set(Enums.ClientSideKeyName.ExpandedFolders, aExpandedList);
- };
-
- RainLoopApp.prototype.initLayoutResizer = function (sLeft, sRight, sClientSideKeyName)
- {
- var
- iDisabledWidth = 60,
- iMinWidth = 155,
- oLeft = $(sLeft),
- oRight = $(sRight),
-
- mLeftWidth = Local.get(sClientSideKeyName) || null,
-
- fSetWidth = function (iWidth) {
- if (iWidth)
+ var oFolder = Cache.getFolderFromCacheList(oMessage.folderFullNameRaw);
+ if (oFolder)
{
- oLeft.css({
- 'width': '' + iWidth + 'px'
- });
-
- oRight.css({
- 'left': '' + iWidth + 'px'
- });
+ oFolder.messageCountUnread(0 <= oFolder.messageCountUnread() - 1 ?
+ oFolder.messageCountUnread() - 1 : 0);
}
- },
- fDisable = function (bDisable) {
- if (bDisable)
+ Cache.storeMessageFlagsToCache(oMessage);
+ this.reloadFlagsCurrentMessageListAndMessageFromCache();
+ }
+
+ Remote.messageSetSeen(Utils.emptyFunction, oMessage.folderFullNameRaw, [oMessage.uid], true);
+ };
+
+ RainLoopApp.prototype.googleConnect = function ()
+ {
+ window.open(LinkBuilder.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
+ };
+
+ RainLoopApp.prototype.twitterConnect = function ()
+ {
+ window.open(LinkBuilder.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
+ };
+
+ RainLoopApp.prototype.facebookConnect = function ()
+ {
+ window.open(LinkBuilder.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)
+ {
+ if (bFireAllActions)
+ {
+ Data.googleActions(true);
+ Data.facebookActions(true);
+ Data.twitterActions(true);
+ }
+
+ Remote.socialUsers(function (sResult, oData) {
+
+ if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
- oLeft.resizable('disable');
- fSetWidth(iDisabledWidth);
+ Data.googleUserName(oData.Result['Google'] || '');
+ Data.facebookUserName(oData.Result['Facebook'] || '');
+ Data.twitterUserName(oData.Result['Twitter'] || '');
}
else
{
- oLeft.resizable('enable');
- var iWidth = Utils.pInt(Local.get(sClientSideKeyName)) || iMinWidth;
- fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth);
+ Data.googleUserName('');
+ Data.facebookUserName('');
+ Data.twitterUserName('');
}
- },
- fResizeFunction = function (oEvent, oObject) {
- if (oObject && oObject.size && oObject.size.width)
+ Data.googleLoggined('' !== Data.googleUserName());
+ Data.facebookLoggined('' !== Data.facebookUserName());
+ Data.twitterLoggined('' !== Data.twitterUserName());
+
+ Data.googleActions(false);
+ Data.facebookActions(false);
+ Data.twitterActions(false);
+ });
+ };
+
+ RainLoopApp.prototype.googleDisconnect = function ()
+ {
+ Data.googleActions(true);
+ Remote.googleDisconnect(this.socialUsers);
+ };
+
+ RainLoopApp.prototype.facebookDisconnect = function ()
+ {
+ Data.facebookActions(true);
+ Remote.facebookDisconnect(this.socialUsers);
+ };
+
+ RainLoopApp.prototype.twitterDisconnect = function ()
+ {
+ Data.twitterActions(true);
+ Remote.twitterDisconnect(this.socialUsers);
+ };
+
+ /**
+ * @param {string} sQuery
+ * @param {Function} fCallback
+ */
+ RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
+ {
+ var
+ aData = []
+ ;
+
+ Remote.suggestions(function (sResult, oData) {
+ if (Enums.StorageResultType.Success === sResult && oData && Utils.isArray(oData.Result))
{
- Local.set(sClientSideKeyName, oObject.size.width);
-
- oRight.css({
- 'left': '' + oObject.size.width + 'px'
+ 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(Data.contactTags(), function (oContactTag) {
+ return oContactTag && oContactTag.filterHelper(sQuery);
+ }));
+ };
+
+ RainLoopApp.prototype.setMessageList = function (oData, bCached)
+ {
+ if (oData && oData.Result && 'Collection/MessageCollection' === oData.Result['@Object'] &&
+ oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
+ {
+ var
+ mLastCollapsedThreadUids = null,
+ iIndex = 0,
+ iLen = 0,
+ iCount = 0,
+ iOffset = 0,
+ aList = [],
+ iUtc = moment().unix(),
+ aStaticList = Data.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 = Cache.getFolderFromCacheList(
+ Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
+
+ if (oFolder && !bCached)
+ {
+ oFolder.interval = iUtc;
+
+ 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);
+ }
+
+ Data.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
+ }
+
+ if (bUnreadCountChange && oFolder)
+ {
+ 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 (Cache.hasNewMessageAndRemoveFromCache(oMessage.folderFullNameRaw, oMessage.uid) && 5 >= iNewCount)
+ {
+ iNewCount++;
+ oMessage.newForAnimation(true);
+ }
+
+ oMessage.deleted(false);
+
+ if (bCached)
+ {
+ Cache.initMessageFlagsFromCache(oMessage);
+ }
+ else
+ {
+ Cache.storeMessageFlagsToCache(oMessage);
+ }
+
+ oMessage.lastInCollapsedThread(mLastCollapsedThreadUids && -1 < Utils.inArray(Utils.pInt(oMessage.uid), mLastCollapsedThreadUids) ? true : false);
+
+ aList.push(oMessage);
+ }
+ }
+ }
+
+ Data.messageListCount(iCount);
+ Data.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
+ Data.messageListPage(window.Math.ceil((iOffset / Data.messagesPerPage()) + 1));
+ Data.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
+ Data.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
+ Data.messageListEndPage(Data.messageListPage());
+
+ Data.messageList(aList);
+ Data.messageListIsNotCompleted(false);
+
+ if (aStaticList.length < aList.length)
+ {
+ Data.staticMessageList = aList;
+ }
+
+ Cache.clearNewMessageCache();
+
+ if (oFolder && (bCached || bUnreadCountChange || Data.useThreads()))
+ {
+ this.folderInformation(oFolder.fullNameRaw, aList);
}
}
- ;
+ else
+ {
+ Data.messageListCount(0);
+ Data.messageList([]);
+ Data.messageListError(Utils.getNotification(
+ oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList
+ ));
+ }
+ };
- if (null !== mLeftWidth)
+ /**
+ * @param {string} sNamespace
+ * @param {Array} aFolders
+ * @return {Array}
+ */
+ RainLoopApp.prototype.folderResponseParseRec = function (sNamespace, aFolders)
{
- fSetWidth(mLeftWidth > iMinWidth ? mLeftWidth : iMinWidth);
- }
+ var
+ self = this,
+ iIndex = 0,
+ iLen = 0,
+ oFolder = null,
+ oCacheFolder = null,
+ sFolderFullNameRaw = '',
+ aSubFolders = [],
+ aList = []
+ ;
- oLeft.resizable({
- 'helper': 'ui-resizable-helper',
- 'minWidth': iMinWidth,
- 'maxWidth': 350,
- 'handles': 'e',
- 'stop': fResizeFunction
- });
+ for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
+ {
+ oFolder = aFolders[iIndex];
+ if (oFolder)
+ {
+ sFolderFullNameRaw = oFolder.FullNameRaw;
- Events.sub('left-panel.off', function () {
- fDisable(true);
- });
+ oCacheFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
+ if (!oCacheFolder)
+ {
+ oCacheFolder = FolderModel.newInstanceFromJson(oFolder);
+ if (oCacheFolder)
+ {
+ Cache.setFolderToCacheList(sFolderFullNameRaw, oCacheFolder);
+ Cache.setFolderFullNameRaw(oCacheFolder.fullNameHash, sFolderFullNameRaw);
+ }
+ }
- Events.sub('left-panel.on', function () {
- fDisable(false);
- });
- };
+ if (oCacheFolder)
+ {
+ oCacheFolder.collapsed(!self.isFolderExpanded(oCacheFolder.fullNameHash));
- RainLoopApp.prototype.bootstartLoginScreen = function ()
- {
- var sCustomLoginLink = Utils.pString(Settings.settingsGet('CustomLoginLink'));
- if (!sCustomLoginLink)
- {
- kn.hideLoading();
+ if (oFolder.Extended)
+ {
+ if (oFolder.Extended.Hash)
+ {
+ Cache.setFolderHash(oCacheFolder.fullNameRaw, oFolder.Extended.Hash);
+ }
- kn.startScreens([
- require('Screen:RainLoop:Login')
- ]);
+ if (Utils.isNormal(oFolder.Extended.MessageCount))
+ {
+ oCacheFolder.messageCountAll(oFolder.Extended.MessageCount);
+ }
- Plugins.runHook('rl-start-login-screens');
- Events.pub('rl.bootstart-login-screens');
- }
- else
- {
- kn.routeOff();
- kn.setHash(LinkBuilder.root(), true);
- kn.routeOff();
+ if (Utils.isNormal(oFolder.Extended.MessageUnseenCount))
+ {
+ oCacheFolder.messageCountUnread(oFolder.Extended.MessageUnseenCount);
+ }
+ }
- _.defer(function () {
- window.location.href = sCustomLoginLink;
- });
- }
- };
+ aSubFolders = oFolder['SubFolders'];
+ if (aSubFolders && 'Collection/FolderCollection' === aSubFolders['@Object'] &&
+ aSubFolders['@Collection'] && Utils.isArray(aSubFolders['@Collection']))
+ {
+ oCacheFolder.subFolders(
+ this.folderResponseParseRec(sNamespace, aSubFolders['@Collection']));
+ }
- RainLoopApp.prototype.bootstart = function ()
- {
- AbstractApp.prototype.bootstart.call(this);
-
- Data.populateDataOnStart();
-
- var
- self = this,
- sJsHash = Settings.settingsGet('JsHash'),
- iContactsSyncInterval = Utils.pInt(Settings.settingsGet('ContactsSyncInterval')),
- bGoogle = Settings.settingsGet('AllowGoogleSocial'),
- bFacebook = Settings.settingsGet('AllowFacebookSocial'),
- bTwitter = Settings.settingsGet('AllowTwitterSocial')
- ;
-
- 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')
+ aList.push(oCacheFolder);
+ }
}
+ }
+
+ return aList;
+ };
+
+ /**
+ * @param {*} oData
+ */
+ RainLoopApp.prototype.setFolders = function (oData)
+ {
+ var
+ aList = [],
+ bUpdate = false,
+ fNormalizeFolder = function (sFolderFullNameRaw) {
+ return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw ||
+ null !== 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))
+ {
+ Data.namespace = oData.Result.Namespace;
+ }
+
+ Data.threading(!!Settings.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true);
+
+ aList = this.folderResponseParseRec(Data.namespace, oData.Result['@Collection']);
+ Data.folderList(aList);
+
+ if (oData.Result['SystemFolders'] &&
+ '' === '' + Settings.settingsGet('SentFolder') + Settings.settingsGet('DraftFolder') +
+ Settings.settingsGet('SpamFolder') + Settings.settingsGet('TrashFolder') + Settings.settingsGet('ArchiveFolder') +
+ Settings.settingsGet('NullFolder'))
+ {
+ // TODO Magic Numbers
+ Settings.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null);
+ Settings.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null);
+ Settings.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null);
+ Settings.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null);
+ Settings.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null);
+
+ bUpdate = true;
+ }
+
+ Data.sentFolder(fNormalizeFolder(Settings.settingsGet('SentFolder')));
+ Data.draftFolder(fNormalizeFolder(Settings.settingsGet('DraftFolder')));
+ Data.spamFolder(fNormalizeFolder(Settings.settingsGet('SpamFolder')));
+ Data.trashFolder(fNormalizeFolder(Settings.settingsGet('TrashFolder')));
+ Data.archiveFolder(fNormalizeFolder(Settings.settingsGet('ArchiveFolder')));
+
+ if (bUpdate)
+ {
+ Remote.saveSystemFolders(Utils.emptyFunction, {
+ 'SentFolder': Data.sentFolder(),
+ 'DraftFolder': Data.draftFolder(),
+ 'SpamFolder': Data.spamFolder(),
+ 'TrashFolder': Data.trashFolder(),
+ 'ArchiveFolder': Data.archiveFolder(),
+ 'NullFolder': 'NullFolder'
+ });
+ }
+
+ Local.set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
+ }
+ };
+
+ /**
+ * @param {string} sFullNameHash
+ * @return {boolean}
+ */
+ RainLoopApp.prototype.isFolderExpanded = function (sFullNameHash)
+ {
+ var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders);
+ return Utils.isArray(aExpandedList) && -1 !== _.indexOf(aExpandedList, sFullNameHash);
+ };
+
+ /**
+ * @param {string} sFullNameHash
+ * @param {boolean} bExpanded
+ */
+ RainLoopApp.prototype.setExpandedFolder = function (sFullNameHash, bExpanded)
+ {
+ var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders);
+ if (!Utils.isArray(aExpandedList))
+ {
+ aExpandedList = [];
+ }
+
+ if (bExpanded)
+ {
+ aExpandedList.push(sFullNameHash);
+ aExpandedList = _.uniq(aExpandedList);
+ }
+ else
+ {
+ aExpandedList = _.without(aExpandedList, sFullNameHash);
+ }
+
+ Local.set(Enums.ClientSideKeyName.ExpandedFolders, aExpandedList);
+ };
+
+ RainLoopApp.prototype.initLayoutResizer = function (sLeft, sRight, sClientSideKeyName)
+ {
+ var
+ iDisabledWidth = 60,
+ iMinWidth = 155,
+ oLeft = $(sLeft),
+ oRight = $(sRight),
+
+ mLeftWidth = Local.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(Local.get(sClientSideKeyName)) || iMinWidth;
+ fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth);
+ }
+ },
+
+ fResizeFunction = function (oEvent, oObject) {
+ if (oObject && oObject.size && oObject.size.width)
+ {
+ Local.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
});
- }, this);
+ Events.sub('left-panel.off', function () {
+ fDisable(true);
+ });
- if (window.SimplePace)
+ Events.sub('left-panel.on', function () {
+ fDisable(false);
+ });
+ };
+
+ RainLoopApp.prototype.bootstartLoginScreen = function ()
{
- window.SimplePace.set(70);
- window.SimplePace.sleep();
- }
-
- Globals.leftPanelDisabled.subscribe(function (bValue) {
- Events.pub('left-panel.' + (bValue ? 'off' : 'on'));
- });
-
- if (!!Settings.settingsGet('Auth'))
- {
- this.setTitle(Utils.i18n('TITLES/LOADING'));
-
- this.folders(_.bind(function (bValue) {
-
+ var sCustomLoginLink = Utils.pString(Settings.settingsGet('CustomLoginLink'));
+ if (!sCustomLoginLink)
+ {
kn.hideLoading();
- if (bValue)
- {
- if (window.$LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
+ kn.startScreens([
+ __webpack_require__(/*! Screen:RainLoop:Login */ 64)
+ ]);
+
+ Plugins.runHook('rl-start-login-screens');
+ Events.pub('rl.bootstart-login-screens');
+ }
+ else
+ {
+ kn.routeOff();
+ kn.setHash(LinkBuilder.root(), true);
+ kn.routeOff();
+
+ _.defer(function () {
+ window.location.href = sCustomLoginLink;
+ });
+ }
+ };
+
+ RainLoopApp.prototype.bootstart = function ()
+ {
+ AbstractApp.prototype.bootstart.call(this);
+
+ Data.populateDataOnStart();
+
+ var
+ self = this,
+ sJsHash = Settings.settingsGet('JsHash'),
+ iContactsSyncInterval = Utils.pInt(Settings.settingsGet('ContactsSyncInterval')),
+ bGoogle = Settings.settingsGet('AllowGoogleSocial'),
+ bFacebook = Settings.settingsGet('AllowFacebookSocial'),
+ bTwitter = Settings.settingsGet('AllowTwitterSocial')
+ ;
+
+ 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();
+ }
+
+ Globals.leftPanelDisabled.subscribe(function (bValue) {
+ Events.pub('left-panel.' + (bValue ? 'off' : 'on'));
+ });
+
+ if (!!Settings.settingsGet('Auth'))
+ {
+ this.setTitle(Utils.i18n('TITLES/LOADING'));
+
+ this.folders(_.bind(function (bValue) {
+
+ if (bValue)
{
- window.$LAB.script(window.openpgp ? '' : LinkBuilder.openPgpJs()).wait(function () {
- if (window.openpgp)
+ __webpack_require__.e/*nsure*/(0, function () {
+
+ kn.hideLoading();
+
+ if (window.$LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
{
- Data.openpgpKeyring = new window.openpgp.Keyring();
- Data.capaOpenPGP(true);
+ window.$LAB.script(window.openpgp ? '' : LinkBuilder.openPgpJs()).wait(function () {
+ if (window.openpgp)
+ {
+ Data.openpgpKeyring = new window.openpgp.Keyring();
+ Data.capaOpenPGP(true);
- Events.pub('openpgp.init');
+ Events.pub('openpgp.init');
- self.reloadOpenPgpKeys();
+ self.reloadOpenPgpKeys();
+ }
+ });
+ }
+ else
+ {
+ Data.capaOpenPGP(false);
+ }
+
+ kn.startScreens([
+ __webpack_require__(/*! Screen:RainLoop:MailBox */ 65),
+ __webpack_require__(/*! Screen:RainLoop:Settings */ 66),
+ __webpack_require__(/*! Screen:RainLoop:About */ 61)
+ ]);
+
+ if (bGoogle || bFacebook || bTwitter)
+ {
+ self.socialUsers(true);
+ }
+
+ Events.sub('interval.2m', function () {
+ self.folderInformation('INBOX');
+ });
+
+ Events.sub('interval.2m', function () {
+ var sF = Data.currentFolderFullNameRaw();
+ if ('INBOX' !== sF)
+ {
+ self.folderInformation(sF);
+ }
+ });
+
+ Events.sub('interval.3m', function () {
+ self.folderInformationMultiply();
+ });
+
+ Events.sub('interval.5m', function () {
+ self.quota();
+ });
+
+ Events.sub('interval.10m', function () {
+ self.folders();
+ });
+
+ iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
+ iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
+
+ window.setInterval(function () {
+ self.contactsSync();
+ }, iContactsSyncInterval * 60000 + 5000);
+
+ _.delay(function () {
+ self.contactsSync();
+ }, 5000);
+
+ _.delay(function () {
+ self.folderInformationMultiply(true);
+ }, 500);
+
+ Plugins.runHook('rl-start-user-screens');
+ Events.pub('rl.bootstart-user-screens');
+
+ if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
+ {
+ _.delay(function () {
+ try {
+ window.navigator.registerProtocolHandler('mailto',
+ window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
+ '' + (Settings.settingsGet('Title') || 'RainLoop'));
+ } catch(e) {}
+
+ if (Settings.settingsGet('MailToEmail'))
+ {
+ Utils.mailToHelper(Settings.settingsGet('MailToEmail'), __webpack_require__(/*! View:Popup:Compose */ 21));
+ }
+ }, 500);
+ }
+
+ if (!Globals.bMobileDevice)
+ {
+ _.defer(function () {
+ self.initLayoutResizer('#rl-left', '#rl-right', Enums.ClientSideKeyName.FolderListSize);
+ });
}
});
}
else
{
- Data.capaOpenPGP(false);
+ kn.hideLoading();
+
+ self.bootstartLoginScreen();
}
- kn.startScreens([
- require('Screen:RainLoop:MailBox'),
- require('Screen:RainLoop:Settings'),
- require('Screen:RainLoop:About')
- ]);
-
- if (bGoogle || bFacebook || bTwitter)
+ if (window.SimplePace)
{
- self.socialUsers(true);
+ window.SimplePace.set(100);
}
- Events.sub('interval.2m', function () {
- self.folderInformation('INBOX');
- });
-
- Events.sub('interval.2m', function () {
- var sF = Data.currentFolderFullNameRaw();
- if ('INBOX' !== sF)
- {
- self.folderInformation(sF);
- }
- });
-
- Events.sub('interval.3m', function () {
- self.folderInformationMultiply();
- });
-
- Events.sub('interval.5m', function () {
- self.quota();
- });
-
- Events.sub('interval.10m', function () {
- self.folders();
- });
-
- iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20;
- iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320;
-
- window.setInterval(function () {
- self.contactsSync();
- }, iContactsSyncInterval * 60000 + 5000);
-
- _.delay(function () {
- self.contactsSync();
- }, 5000);
-
- _.delay(function () {
- self.folderInformationMultiply(true);
- }, 500);
-
- Plugins.runHook('rl-start-user-screens');
- Events.pub('rl.bootstart-user-screens');
-
- if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
- {
- _.delay(function () {
- try {
- window.navigator.registerProtocolHandler('mailto',
- window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
- '' + (Settings.settingsGet('Title') || 'RainLoop'));
- } catch(e) {}
-
- if (Settings.settingsGet('MailToEmail'))
- {
- Utils.mailToHelper(Settings.settingsGet('MailToEmail'), require('View:Popup:Compose'));
- }
- }, 500);
- }
-
- if (!Globals.bMobileDevice)
- {
- _.defer(function () {
- self.initLayoutResizer('#rl-left', '#rl-right', Enums.ClientSideKeyName.FolderListSize);
- });
- }
- }
- else
- {
- self.bootstartLoginScreen();
- }
+ }, this));
+ }
+ else
+ {
+ this.bootstartLoginScreen();
if (window.SimplePace)
{
window.SimplePace.set(100);
}
-
- }, this));
- }
- else
- {
- this.bootstartLoginScreen();
-
- if (window.SimplePace)
- {
- window.SimplePace.set(100);
}
- }
- if (bGoogle)
- {
- window['rl_' + sJsHash + '_google_service'] = function () {
- Data.googleActions(true);
- self.socialUsers();
- };
- }
+ if (bGoogle)
+ {
+ window['rl_' + sJsHash + '_google_service'] = function () {
+ Data.googleActions(true);
+ self.socialUsers();
+ };
+ }
- if (bFacebook)
- {
- window['rl_' + sJsHash + '_facebook_service'] = function () {
- Data.facebookActions(true);
- self.socialUsers();
- };
- }
+ if (bFacebook)
+ {
+ window['rl_' + sJsHash + '_facebook_service'] = function () {
+ Data.facebookActions(true);
+ self.socialUsers();
+ };
+ }
- if (bTwitter)
- {
- window['rl_' + sJsHash + '_twitter_service'] = function () {
- Data.twitterActions(true);
- self.socialUsers();
- };
- }
+ if (bTwitter)
+ {
+ window['rl_' + sJsHash + '_twitter_service'] = function () {
+ Data.twitterActions(true);
+ self.socialUsers();
+ };
+ }
- Events.sub('interval.1m', function () {
- Globals.momentTrigger(!Globals.momentTrigger());
- });
-
- Plugins.runHook('rl-start-screens');
- Events.pub('rl.bootstart-end');
- };
-
- module.exports = new RainLoopApp();
-
-}(module, require));
-},{"$":20,"App:Abstract":2,"App:Knoin":27,"Consts":6,"Enums":7,"Events":8,"Globals":9,"LinkBuilder":11,"Model:Account":31,"Model:Email":37,"Model:Folder":40,"Model:Identity":41,"Model:Message":42,"Model:OpenPgpKey":43,"Plugins":12,"Screen:RainLoop:About":44,"Screen:RainLoop:Login":46,"Screen:RainLoop:MailBox":47,"Screen:RainLoop:Settings":48,"Settings:RainLoop:Accounts":49,"Settings:RainLoop:ChangePassword":50,"Settings:RainLoop:Contacts":51,"Settings:RainLoop:Filters":52,"Settings:RainLoop:Folders":53,"Settings:RainLoop:General":54,"Settings:RainLoop:Identities":55,"Settings:RainLoop:Identity":56,"Settings:RainLoop:OpenPGP":57,"Settings:RainLoop:Security":58,"Settings:RainLoop:Social":59,"Settings:RainLoop:Themes":60,"Storage:LocalStorage":65,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:Popup:Ask":80,"View:Popup:Compose":82,"View:Popup:FolderSystem":87,"_":25,"moment":23,"window":26}],4:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- module.exports = function (App) {
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
-
- Globals = require('Globals'),
- Plugins = require('Plugins'),
- Utils = require('Utils'),
- Enums = require('Enums'),
-
- EmailModel = require('Model:Email')
- ;
-
- Globals.__APP = App;
-
- App.setupSettings();
-
- Plugins.__boot = App;
- Plugins.__remote = App.remote();
- Plugins.__data = App.data();
-
- Globals.$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
-
- Globals.$win.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
-
- Globals.$win.unload(function () {
- Globals.bUnload = true;
- });
-
- Globals.$html.on('click.dropdown.data-api', function () {
- Utils.detectDropdownVisibility();
- });
-
- // export
- window['rl'] = window['rl'] || {};
- window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins);
- window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins);
- window['rl']['remoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
- window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
- window['rl']['createCommand'] = Utils.createCommand;
-
- window['rl']['EmailModel'] = EmailModel;
- window['rl']['Enums'] = Enums;
-
- window['__APP_BOOT'] = function (fCall) {
-
- // boot
- $(function () {
-
- if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
- {
- $('#rl-templates').html(window['rainloopTEMPLATES'][0]);
-
- _.delay(function () {
-
- App.bootstart();
- Globals.$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
-
- }, 10);
- }
- else
- {
- fCall(false);
- }
-
- window['__APP_BOOT'] = null;
+ Events.sub('interval.1m', function () {
+ Globals.momentTrigger(!Globals.momentTrigger());
});
+
+ Plugins.runHook('rl-start-screens');
+ Events.pub('rl.bootstart-end');
};
- };
+ module.exports = new RainLoopApp();
-}(module, require));
-},{"$":20,"Enums":7,"Globals":9,"Model:Email":37,"Plugins":12,"Utils":14,"_":25,"window":26}],5:[function(require,module,exports){
-// Base64 encode / decode
-// http://www.webtoolkit.info/
+ }());
-(function (module) {
+/***/ },
- 'use strict';
+/***/ 8:
+/*!*************************************!*\
+ !*** ./dev/Storages/DataStorage.js ***!
+ \*************************************/
+/***/ function(module, exports, __webpack_require__) {
- /*jslint bitwise: true*/
- var Base64 = {
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
- // private property
- _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
+ (function () {
- // 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, require));
-},{}],6:[function(require,module,exports){
-
-(function (module) {
-
- 'use strict';
-
- var Consts = {};
-
- Consts.Values = {};
- Consts.DataImages = {};
- Consts.Defaults = {};
-
- /**
- * @const
- * @type {number}
- */
- Consts.Defaults.MessagesPerPage = 20;
-
- /**
- * @const
- * @type {number}
- */
- Consts.Defaults.ContactsPerPage = 50;
-
- /**
- * @const
- * @type {Array}
- */
- Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
-
- /**
- * @const
- * @type {number}
- */
- Consts.Defaults.DefaultAjaxTimeout = 30000;
-
- /**
- * @const
- * @type {number}
- */
- 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}
- */
- Consts.Values.UnuseOptionValue = '__UNUSE__';
-
- /**
- * @const
- * @type {string}
- */
- Consts.Values.ClientSideStorageIndexName = 'rlcsc';
-
- /**
- * @const
- * @type {number}
- */
- Consts.Values.ImapDefaulPort = 143;
-
- /**
- * @const
- * @type {number}
- */
- Consts.Values.ImapDefaulSecurePort = 993;
-
- /**
- * @const
- * @type {number}
- */
- Consts.Values.SmtpDefaulPort = 25;
-
- /**
- * @const
- * @type {number}
- */
- Consts.Values.SmtpDefaulSecurePort = 465;
-
- /**
- * @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));
-},{}],7:[function(require,module,exports){
-
-(function (module) {
-
- 'use strict';
-
- var Enums = {};
-
- /**
- * @enum {string}
- */
- Enums.StorageResultType = {
- 'Success': 'success',
- 'Abort': 'abort',
- 'Error': 'error',
- 'Unload': 'unload'
- };
-
- /**
- * @enum {number}
- */
- Enums.State = {
- 'Empty': 10,
- 'Login': 20,
- 'Auth': 30
- };
-
- /**
- * @enum {number}
- */
- Enums.StateType = {
- 'Webmail': 0,
- 'Admin': 1
- };
-
- /**
- * @enum {string}
- */
- Enums.Capa = {
- 'Prem': 'PREM',
- 'TwoFactor': 'TWO_FACTOR',
- 'OpenPGP': 'OPEN_PGP',
- 'Prefetch': 'PREFETCH',
- 'Gravatar': 'GRAVATAR',
- 'Themes': 'THEMES',
- 'Filters': 'FILTERS',
- 'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
- 'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
- };
-
- /**
- * @enum {string}
- */
- Enums.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'
- };
-
- /**
- * @enum {number}
- */
- Enums.FolderType = {
- 'Inbox': 10,
- 'SentItems': 11,
- 'Draft': 12,
- 'Trash': 13,
- 'Spam': 14,
- 'Archive': 15,
- 'NotSpam': 80,
- 'User': 99
- };
-
- /**
- * @enum {string}
- */
- Enums.LoginSignMeTypeAsString = {
- 'DefaultOff': 'defaultoff',
- 'DefaultOn': 'defaulton',
- 'Unused': 'unused'
- };
-
- /**
- * @enum {number}
- */
- Enums.LoginSignMeType = {
- 'DefaultOff': 0,
- 'DefaultOn': 1,
- 'Unused': 2
- };
-
- /**
- * @enum {string}
- */
- Enums.ComposeType = {
- 'Empty': 'empty',
- 'Reply': 'reply',
- 'ReplyAll': 'replyall',
- 'Forward': 'forward',
- 'ForwardAsAttachment': 'forward-as-attachment',
- 'Draft': 'draft',
- 'EditAsNew': 'editasnew'
- };
-
- /**
- * @enum {number}
- */
- Enums.UploadErrorCode = {
- 'Normal': 0,
- 'FileIsTooBig': 1,
- 'FilePartiallyUploaded': 2,
- 'FileNoUploaded': 3,
- 'MissingTempFolder': 4,
- 'FileOnSaveingError': 5,
- 'FileType': 98,
- 'Unknown': 99
- };
-
- /**
- * @enum {number}
- */
- Enums.SetSystemFoldersNotification = {
- 'None': 0,
- 'Sent': 1,
- 'Draft': 2,
- 'Spam': 3,
- 'Trash': 4,
- 'Archive': 5
- };
-
- /**
- * @enum {number}
- */
- Enums.ClientSideKeyName = {
- 'FoldersLashHash': 0,
- 'MessagesInboxLastHash': 1,
- 'MailBoxListSize': 2,
- 'ExpandedFolders': 3,
- 'FolderListSize': 4
- };
-
- /**
- * @enum {number}
- */
- Enums.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
- };
-
- /**
- * @enum {number}
- */
- Enums.MessageSetAction = {
- 'SetSeen': 0,
- 'UnsetSeen': 1,
- 'SetFlag': 2,
- 'UnsetFlag': 3
- };
-
- /**
- * @enum {number}
- */
- Enums.MessageSelectAction = {
- 'All': 0,
- 'None': 1,
- 'Invert': 2,
- 'Unseen': 3,
- 'Seen': 4,
- 'Flagged': 5,
- 'Unflagged': 6
- };
-
- /**
- * @enum {number}
- */
- Enums.DesktopNotifications = {
- 'Allowed': 0,
- 'NotAllowed': 1,
- 'Denied': 2,
- 'NotSupported': 9
- };
-
- /**
- * @enum {number}
- */
- Enums.MessagePriority = {
- 'Low': 5,
- 'Normal': 3,
- 'High': 1
- };
-
- /**
- * @enum {string}
- */
- Enums.EditorDefaultType = {
- 'Html': 'Html',
- 'Plain': 'Plain'
- };
-
- /**
- * @enum {string}
- */
- Enums.CustomThemeType = {
- 'Light': 'Light',
- 'Dark': 'Dark'
- };
-
- /**
- * @enum {number}
- */
- Enums.ServerSecure = {
- 'None': 0,
- 'SSL': 1,
- 'TLS': 2
- };
-
- /**
- * @enum {number}
- */
- Enums.SearchDateType = {
- 'All': -1,
- 'Days3': 3,
- 'Days7': 7,
- 'Month': 30
- };
-
- /**
- * @enum {number}
- */
- Enums.SaveSettingsStep = {
- 'Animate': -2,
- 'Idle': -1,
- 'TrueResult': 1,
- 'FalseResult': 0
- };
-
- /**
- * @enum {string}
- */
- Enums.InterfaceAnimation = {
- 'None': 'None',
- 'Normal': 'Normal',
- 'Full': 'Full'
- };
-
- /**
- * @enum {number}
- */
- Enums.Layout = {
- 'NoPreview': 0,
- 'SidePreview': 1,
- 'BottomPreview': 2
- };
-
- /**
- * @enum {string}
- */
- Enums.FilterConditionField = {
- 'From': 'From',
- 'To': 'To',
- 'Recipient': 'Recipient',
- 'Subject': 'Subject'
- };
-
- /**
- * @enum {string}
- */
- Enums.FilterConditionType = {
- 'Contains': 'Contains',
- 'NotContains': 'NotContains',
- 'EqualTo': 'EqualTo',
- 'NotEqualTo': 'NotEqualTo'
- };
-
- /**
- * @enum {string}
- */
- Enums.FiltersAction = {
- 'None': 'None',
- 'Move': 'Move',
- 'Discard': 'Discard',
- 'Forward': 'Forward'
- };
-
- /**
- * @enum {string}
- */
- Enums.FilterRulesType = {
- 'And': 'And',
- 'Or': 'Or'
- };
-
- /**
- * @enum {number}
- */
- Enums.SignedVerifyStatus = {
- 'UnknownPublicKeys': -4,
- 'UnknownPrivateKey': -3,
- 'Unverified': -2,
- 'Error': -1,
- 'None': 0,
- 'Success': 1
- };
-
- /**
- * @enum {number}
- */
- Enums.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
- };
-
- /**
- * @enum {number}
- */
- Enums.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
- };
-
- module.exports = Enums;
-
-}(module, require));
-},{}],8:[function(require,module,exports){
-
-(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":12,"Utils":14,"_":25}],9:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- Globals = {},
-
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- key = require('key'),
-
- Enums = require('Enums')
- ;
-
- Globals.$win = $(window);
- Globals.$doc = $(window.document);
- Globals.$html = $('html');
- Globals.$div = $('');
-
- /**
- * @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 && Globals.$html.hasClass('csstransitions');
-
- /**
- * @type {boolean}
- */
- Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
-
- /**
- * @type {string}
- */
- Globals.sAnimationType = '';
-
- /**
- * @type {*}
- */
- Globals.__APP = 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',
- 'ja': 'ja',
- 'ja-jp': 'ja',
- 'ko': 'ko',
- 'ko-kr': 'ko',
- 'lv': 'lv',
- 'nl': 'nl',
- 'no': 'no',
- 'pl': 'pl',
- 'pt': 'pt',
- 'pt-pt': 'pt',
- 'pt-br': 'pt-br',
- 'ro': 'ro',
- 'ru': 'ru',
- 'sk': 'sk',
- 'tr': 'tr',
- 'ua': 'ru',
- '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));
-},{"$":20,"Enums":7,"_":25,"key":21,"ko":22,"window":26}],10:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
-
- Globals = require('Globals'),
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- * @param {Object} oElement
- * @param {Function=} fOnBlur
- * @param {Function=} fOnReady
- * @param {Function=} fOnModeChange
- */
- function HtmlEditor(oElement, fOnBlur, fOnReady, fOnModeChange)
- {
- this.editor = null;
- this.iBlurTimer = 0;
- this.fOnBlur = fOnBlur || null;
- this.fOnReady = fOnReady || null;
- this.fOnModeChange = fOnModeChange || null;
-
- this.$element = $(oElement);
-
- this.resize = _.throttle(_.bind(this.resize, this), 100);
-
- this.init();
- }
-
- HtmlEditor.prototype.blurTrigger = function ()
- {
- if (this.fOnBlur)
- {
- var self = this;
- window.clearTimeout(this.iBlurTimer);
- this.iBlurTimer = window.setTimeout(function () {
- self.fOnBlur();
- }, 200);
- }
- };
-
- HtmlEditor.prototype.focusTrigger = function ()
- {
- if (this.fOnBlur)
- {
- window.clearTimeout(this.iBlurTimer);
- }
- };
-
- /**
- * @return {boolean}
- */
- HtmlEditor.prototype.isHtml = function ()
- {
- return this.editor ? 'wysiwyg' === this.editor.mode : false;
- };
-
- /**
- * @return {boolean}
- */
- HtmlEditor.prototype.checkDirty = function ()
- {
- return this.editor ? this.editor.checkDirty() : false;
- };
-
- HtmlEditor.prototype.resetDirty = function ()
- {
- if (this.editor)
- {
- this.editor.resetDirty();
- }
- };
-
- /**
- * @return {string}
- */
- HtmlEditor.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 '';
- };
-
- HtmlEditor.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();
- }
- };
-
- HtmlEditor.prototype.setHtml = function (sHtml, bFocus)
- {
- if (this.editor)
- {
- this.modeToggle(true);
- this.editor.setData(sHtml);
-
- if (bFocus)
- {
- this.focus();
- }
- }
- };
-
- HtmlEditor.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();
- }
- }
- };
-
- HtmlEditor.prototype.init = function ()
- {
- if (this.$element && this.$element[0])
- {
- var
- self = this,
- fInit = function () {
-
- var
- oConfig = Globals.oHtmlEditorDefaultConfig,
- sLanguage = Settings.settingsGet('Language'),
- bSource = !!Settings.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;
- }
- }
- };
-
- HtmlEditor.prototype.focus = function ()
- {
- if (this.editor)
- {
- this.editor.focus();
- }
- };
-
- HtmlEditor.prototype.blur = function ()
- {
- if (this.editor)
- {
- this.editor.focusManager.blur(true);
- }
- };
-
- HtmlEditor.prototype.resize = function ()
- {
- if (this.editor && this.__resizable)
- {
- try
- {
- this.editor.resize(this.$element.width(), this.$element.innerHeight());
- }
- catch (e) {}
- }
- };
-
- HtmlEditor.prototype.clear = function (bFocus)
- {
- this.setHtml('', bFocus);
- };
-
-
- module.exports = HtmlEditor;
-
-}(module, require));
-},{"Globals":9,"Storage:Settings":69,"_":25,"window":26}],11:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function LinkBuilder()
- {
- var Settings = require('Storage:Settings');
-
- this.sBase = '#/';
- this.sServer = './?';
- this.sVersion = Settings.settingsGet('Version');
- this.sSpecSuffix = Settings.settingsGet('AuthAccountHash') || '0';
- this.sStaticPrefix = Settings.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 {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;
- };
-
- /**
- * @return {string}
- */
- LinkBuilder.prototype.about = function ()
- {
- return this.sBase + 'about';
- };
-
- /**
- * @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));
-},{"Storage:Settings":69,"Utils":14,"window":26}],12:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function Plugins()
- {
- this.__boot = null;
- this.__data = null;
- this.__remote = null;
-
- this.oSettings = require('Storage:Settings');
-
- this.oViewModelsHooks = {};
- this.oSimpleHooks = {};
- }
-
- Plugins.prototype.__boot = null;
- Plugins.prototype.__data = null;
- Plugins.prototype.__remote = null;
-
- /**
- * @type {Object}
- */
- Plugins.prototype.oViewModelsHooks = {};
-
- /**
- * @type {Object}
- */
- Plugins.prototype.oSimpleHooks = {};
-
- /**
- * @param {string} sName
- * @param {Function} fCallback
- */
- Plugins.prototype.addHook = function (sName, fCallback)
- {
- if (Utils.isFunc(fCallback))
- {
- if (!Utils.isArray(this.oSimpleHooks[sName]))
- {
- this.oSimpleHooks[sName] = [];
- }
-
- this.oSimpleHooks[sName].push(fCallback);
- }
- };
-
- /**
- * @param {string} sName
- * @param {Array=} aArguments
- */
- Plugins.prototype.runHook = function (sName, aArguments)
- {
- if (Utils.isArray(this.oSimpleHooks[sName]))
- {
- aArguments = aArguments || [];
-
- _.each(this.oSimpleHooks[sName], function (fCallback) {
- fCallback.apply(null, aArguments);
- });
- }
- };
-
- /**
- * @param {string} sName
- * @return {?}
- */
- Plugins.prototype.mainSettingsGet = function (sName)
- {
- return this.oSettings.settingsGet(sName);
- };
-
- /**
- * @param {Function} fCallback
- * @param {string} sAction
- * @param {Object=} oParameters
- * @param {?number=} iTimeout
- * @param {string=} sGetAdd = ''
- * @param {Array=} aAbortActions = []
- */
- Plugins.prototype.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
- {
- if (this.__remote)
- {
- this.__remote.defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
- }
- };
-
- /**
- * @param {string} sPluginSection
- * @param {string} sName
- * @return {?}
- */
- Plugins.prototype.settingsGet = function (sPluginSection, sName)
- {
- var oPlugin = this.oSettings.settingsGet('Plugins');
- oPlugin = oPlugin && !Utils.isUnd(oPlugin[sPluginSection]) ? oPlugin[sPluginSection] : null;
- return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
- };
-
- module.exports = new Plugins();
-
-}(module, require));
-},{"Storage:Settings":69,"Utils":14,"_":25}],13:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- key = require('key'),
-
- Enums = require('Enums'),
- Utils = require('Utils')
- ;
-
- /**
- * @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);
+ 'use strict';
var
- aCache = [],
- aCheckedCache = [],
- mFocused = null,
- mSelected = null
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+ moment = __webpack_require__(/*! moment */ 25),
+
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Cache = __webpack_require__(/*! Storage:RainLoop:Cache */ 20),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+
+ MessageModel = __webpack_require__(/*! Model:Message */ 38),
+
+ LocalStorage = __webpack_require__(/*! Storage:LocalStorage */ 30),
+ AbstractData = __webpack_require__(/*! Storage:Abstract:Data */ 39)
;
- this.list.subscribe(function (aItems) {
+ /**
+ * @constructor
+ * @extends AbstractData
+ */
+ function DataStorage()
+ {
+ AbstractData.call(this);
- var self = this;
- if (Utils.isArray(aItems))
- {
- _.each(aItems, function (oItem) {
- if (oItem)
+ 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(!!Settings.settingsGet('ContactsSyncIsAllowed'));
+ this.enableContactsSync = ko.observable(!!Settings.settingsGet('EnableContactsSync'));
+ this.contactsSyncUrl = ko.observable(Settings.settingsGet('ContactsSyncUrl'));
+ this.contactsSyncUser = ko.observable(Settings.settingsGet('ContactsSyncUser'));
+ this.contactsSyncPass = ko.observable(Settings.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)
{
- var sUid = self.getItemUid(oItem);
+ oPrev.selected(false);
+ }
+ }, function (oNext) {
+ if (oNext)
+ {
+ oNext.selected(true);
+ }
+ }
+ ]});
- aCache.push(sUid);
- if (oItem.checked())
+ 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.__APP)
{
- aCheckedCache.push(sUid);
+ Globals.__APP.historyBack();
}
- if (null === mFocused && oItem.focused())
+ }
+ }
+ 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())
{
- mFocused = sUid;
- }
- if (null === mSelected && oItem.selected())
- {
- mSelected = sUid;
+ aList = _.union(aList, oMessage.threads());
}
}
});
- }
- }, this, 'beforeChange');
+ return aList;
+ }, this);
- this.list.subscribe(function (aItems) {
+ // 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(DataStorage.prototype, AbstractData.prototype);
+
+ DataStorage.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);
+ }
+ }
+ }
+ };
+
+ DataStorage.prototype.populateDataOnStart = function()
+ {
+ AbstractData.prototype.populateDataOnStart.call(this);
+
+ this.accountEmail(Settings.settingsGet('Email'));
+ this.accountIncLogin(Settings.settingsGet('IncLogin'));
+ this.accountOutLogin(Settings.settingsGet('OutLogin'));
+ this.projectHash(Settings.settingsGet('ProjectHash'));
+
+ this.defaultIdentityID(Settings.settingsGet('DefaultIdentityID'));
+
+ this.displayName(Settings.settingsGet('DisplayName'));
+ this.replyTo(Settings.settingsGet('ReplyTo'));
+ this.signature(Settings.settingsGet('Signature'));
+ this.signatureToAll(!!Settings.settingsGet('SignatureToAll'));
+ this.enableTwoFactor(!!Settings.settingsGet('EnableTwoFactor'));
+
+ this.lastFoldersHash = LocalStorage.get(Enums.ClientSideKeyName.FoldersLashHash) || '';
+
+ this.remoteSuggestions = !!Settings.settingsGet('RemoteSuggestions');
+
+ this.devEmail = Settings.settingsGet('DevEmail');
+ this.devPassword = Settings.settingsGet('DevPassword');
+ };
+
+ DataStorage.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
+ NotificationClass = Utils.notificationClass(),
+ 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);
+ }
+ };
+
+ DataStorage.prototype.hideMessageBodies = function ()
+ {
+ var oMessagesBodiesDom = this.messagesBodiesDom();
+ if (oMessagesBodiesDom)
+ {
+ oMessagesBodiesDom.find('.b-text-part').hide();
+ }
+ };
+
+ /**
+ * @param {boolean=} bBoot = false
+ * @returns {Array}
+ */
+ DataStorage.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
+ */
+ DataStorage.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,
- oTemp = null,
- bGetNext = false,
- aUids = [],
- mNextFocused = mFocused,
- bChecked = false,
- bSelected = false,
+ 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, '');
+ }
+ };
+
+ /**
+ * @private
+ * @param {Object} oMessageTextBody
+ */
+ DataStorage.prototype.initBlockquoteSwitcher = function (oMessageTextBody)
+ {
+ if (oMessageTextBody)
+ {
+ var $oList = $('blockquote:not(.rl-bq-switcher)', oMessageTextBody).filter(function () {
+ return 0 === $(this).parent().closest('blockquote', oMessageTextBody).length;
+ });
+
+ if ($oList && 0 < $oList.length)
+ {
+ $oList.each(function () {
+ var $self = $(this), iH = $self.height();
+ if (0 === iH || 100 < iH)
+ {
+ $self.addClass('rl-bq-switcher hidden-bq');
+ $('')
+ .insertBefore($self)
+ .click(function () {
+ $self.toggleClass('hidden-bq');
+ Utils.windowResize();
+ })
+ .after('
')
+ .before('
')
+ ;
+ }
+ });
+ }
+ }
+ };
+
+ DataStorage.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);
+ }
+
+ Globals.$div.empty();
+ if (bPgpSigned && oMessage.isPgpSigned())
+ {
+ sResultHtml =
+ Globals.$div.append(
+ $('').text(oMessage.plainRaw)
+ ).html()
+ ;
+ }
+ else if (bPgpEncrypted && oMessage.isPgpEncrypted())
+ {
+ sResultHtml =
+ Globals.$div.append(
+ $('').text(oMessage.plainRaw)
+ ).html()
+ ;
+ }
+
+ Globals.$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)
+ {
+ this.initBlockquoteSwitcher(oBody);
+ }
+ }
+
+ Cache.initMessageFlagsFromCache(oMessage);
+ if (oMessage.unseen())
+ {
+ if (Globals.__APP)
+ {
+ Globals.__APP.setMessageSeen(oMessage);
+ }
+ }
+
+ Utils.windowResize();
+ }
+ };
+
+ /**
+ * @param {Array} aList
+ * @returns {string}
+ */
+ DataStorage.prototype.calculateMessageListHash = function (aList)
+ {
+ return _.map(aList, function (oMessage) {
+ return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
+ }).join('|');
+ };
+
+ DataStorage.prototype.findPublicKeyByHex = function (sHash)
+ {
+ return _.find(this.openpgpkeysPublic(), function (oItem) {
+ return oItem && sHash === oItem.id;
+ });
+ };
+
+ DataStorage.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 {?}
+ */
+ DataStorage.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 {?}
+ */
+ DataStorage.prototype.findSelfPrivateKey = function (sPassword)
+ {
+ return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
+ };
+
+ module.exports = new DataStorage();
+
+ }());
+
+
+/***/ },
+
+/***/ 13:
+/*!***************************************!*\
+ !*** ./dev/Storages/RemoteStorage.js ***!
+ \***************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Base64 = __webpack_require__(/*! Common/Base64 */ 49),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Cache = __webpack_require__(/*! Storage:RainLoop:Cache */ 20),
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+
+ AbstractRemoteStorage = __webpack_require__(/*! Storage:Abstract:Remote */ 40)
+ ;
+
+ /**
+ * @constructor
+ * @extends AbstractRemoteStorage
+ */
+ function RemoteStorage()
+ {
+ AbstractRemoteStorage.call(this);
+
+ this.oRequests = {};
+ }
+
+ _.extend(RemoteStorage.prototype, AbstractRemoteStorage.prototype);
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.folders = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'Folders', {
+ 'SentFolder': Settings.settingsGet('SentFolder'),
+ 'DraftFolder': Settings.settingsGet('DraftFolder'),
+ 'SpamFolder': Settings.settingsGet('SpamFolder'),
+ 'TrashFolder': Settings.settingsGet('TrashFolder'),
+ 'ArchiveFolder': Settings.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.getTwoFactor = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'GetTwoFactorInfo');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.createTwoFactor = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'CreateTwoFactorSecret');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.clearTwoFactor = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sCode
+ */
+ RemoteStorage.prototype.testTwoFactor = function (fCallback, sCode)
+ {
+ this.defaultRequest(fCallback, 'TestTwoFactorInfo', {
+ 'Code': sCode
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {boolean} bEnable
+ */
+ RemoteStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
+ {
+ this.defaultRequest(fCallback, 'EnableTwoFactor', {
+ 'Enable': bEnable ? '1' : '0'
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.clearTwoFactorInfo = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
+ {
+ this.defaultRequest(fCallback, 'AccountAdd', {
+ 'Email': sEmail,
+ 'Login': sLogin,
+ 'Password': sPassword
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sEmailToDelete
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
+ {
+ this.defaultRequest(fCallback, 'IdentityDelete', {
+ 'IdToDelete': sIdToDelete
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
+ {
+ sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
+
+ var
+ sFolderHash = 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,
+ Data.projectHash(),
+ sFolderHash,
+ 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '',
+ Data.threading() && Data.useThreads() ? '1' : '0',
+ Data.threading() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : ''
+ ].join(String.fromCharCode(0))), bSilent ? [] : ['MessageList']);
+ }
+ else
+ {
+ this.defaultRequest(fCallback, 'MessageList', {
+ 'Folder': sFolderFullNameRaw,
+ 'Offset': iOffset,
+ 'Limit': iLimit,
+ 'Search': sSearch,
+ 'UidNext': 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '',
+ 'UseThreads': Data.threading() && Data.useThreads() ? '1' : '0',
+ 'ExpandedThreadUid': Data.threading() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : ''
+ }, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, '', bSilent ? [] : ['MessageList']);
+ }
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Array} aDownloads
+ */
+ RemoteStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
+ {
+ this.defaultRequest(fCallback, 'MessageUploadAttachments', {
+ 'Attachments': aDownloads
+ }, 999000);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sFolderFullNameRaw
+ * @param {number} iUid
+ * @return {boolean}
+ */
+ RemoteStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
+ {
+ sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
+ iUid = Utils.pInt(iUid);
+
+ if (Cache.getFolderFromCacheList(sFolderFullNameRaw) && 0 < iUid)
+ {
+ this.defaultRequest(fCallback, 'Message', {}, null,
+ 'Message/' + Base64.urlsafe_encode([
+ sFolderFullNameRaw,
+ iUid,
+ Data.projectHash(),
+ Data.threading() && Data.useThreads() ? '1' : '0'
+ ].join(String.fromCharCode(0))), ['Message']);
+
+ return true;
+ }
+
+ return false;
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Array} aExternals
+ */
+ RemoteStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
+ {
+ this.defaultRequest(fCallback, 'ComposeUploadExternals', {
+ 'Externals': aExternals
+ }, 999000);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sUrl
+ * @param {string} sAccessToken
+ */
+ RemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
+ {
+ this.defaultRequest(fCallback, 'ComposeUploadDrive', {
+ 'AccessToken': sAccessToken,
+ 'Url': sUrl
+ }, 999000);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sFolder
+ * @param {Array=} aList = []
+ */
+ RemoteStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
+ {
+ var
+ bRequest = true,
+ aUids = []
+ ;
+
+ if (Utils.isArray(aList) && 0 < aList.length)
+ {
+ bRequest = false;
+ _.each(aList, function (oMessageListItem) {
+ if (!Cache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, oMessageListItem.uid))
+ {
+ aUids.push(oMessageListItem.uid);
+ }
+
+ if (0 < oMessageListItem.threads().length)
+ {
+ _.each(oMessageListItem.threads(), function (sUid) {
+ if (!Cache.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 ? Cache.getFolderUidNext(sFolder) : ''
+ });
+ }
+ else if (Data.useThreads())
+ {
+ if (Globals.__APP)
+ {
+ Globals.__APP.reloadFlagsCurrentMessageListAndMessageFromCache();
+ }
+ }
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Array} aFolders
+ */
+ RemoteStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
+ {
+ this.defaultRequest(fCallback, 'FolderInformationMultiply', {
+ 'Folders': aFolders
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.logout = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'Logout');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sFolderFullNameRaw
+ * @param {Array} aUids
+ * @param {boolean} bSetFlagged
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.saveSystemFolders = function (fCallback, oData)
+ {
+ this.defaultRequest(fCallback, 'SystemFoldersUpdate', oData);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {Object} oData
+ */
+ RemoteStorage.prototype.saveSettings = function (fCallback, oData)
+ {
+ this.defaultRequest(fCallback, 'SettingsUpdate', oData);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sPrevPassword
+ * @param {string} sNewPassword
+ */
+ RemoteStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
+ {
+ this.defaultRequest(fCallback, 'ChangePassword', {
+ 'PrevPassword': sPrevPassword,
+ 'NewPassword': sNewPassword
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sNewFolderName
+ * @param {string} sParentName
+ */
+ RemoteStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
+ {
+ this.defaultRequest(fCallback, 'FolderCreate', {
+ 'Folder': sNewFolderName,
+ 'Parent': sParentName
+ }, null, '', ['Folders']);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sFolderFullNameRaw
+ */
+ RemoteStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
+ {
+ this.defaultRequest(fCallback, 'FolderDelete', {
+ 'Folder': sFolderFullNameRaw
+ }, null, '', ['Folders']);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sPrevFolderFullNameRaw
+ * @param {string} sNewFolderName
+ */
+ RemoteStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
+ {
+ this.defaultRequest(fCallback, 'FolderRename', {
+ 'Folder': sPrevFolderFullNameRaw,
+ 'NewFolderName': sNewFolderName
+ }, null, '', ['Folders']);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sFolderFullNameRaw
+ */
+ RemoteStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
+ {
+ this.defaultRequest(fCallback, 'FolderClear', {
+ 'Folder': sFolderFullNameRaw
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sFolderFullNameRaw
+ * @param {boolean} bSubscribe
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
+ {
+ this.defaultRequest(fCallback, 'MessageDelete', {
+ 'Folder': sFolder,
+ 'Uids': aUids.join(',')
+ }, null, '', ['MessageList']);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.appDelayStart = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'AppDelayStart');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.quota = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'Quota');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {number} iOffset
+ * @param {number} iLimit
+ * @param {string} sSearch
+ */
+ RemoteStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
+ {
+ this.defaultRequest(fCallback, 'Contacts', {
+ 'Offset': iOffset,
+ 'Limit': iLimit,
+ 'Search': sSearch
+ }, null, '', ['Contacts']);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.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
+ */
+ RemoteStorage.prototype.contactsDelete = function (fCallback, aUids)
+ {
+ this.defaultRequest(fCallback, 'ContactsDelete', {
+ 'Uids': aUids.join(',')
+ });
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sQuery
+ * @param {number} iPage
+ */
+ RemoteStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
+ {
+ this.defaultRequest(fCallback, 'Suggestions', {
+ 'Query': sQuery,
+ 'Page': iPage
+ }, null, '', ['Suggestions']);
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.facebookUser = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialFacebookUserInformation');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.facebookDisconnect = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialFacebookDisconnect');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.twitterUser = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialTwitterUserInformation');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.twitterDisconnect = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialTwitterDisconnect');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.googleUser = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialGoogleUserInformation');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.googleDisconnect = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialGoogleDisconnect');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ */
+ RemoteStorage.prototype.socialUsers = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'SocialUsers');
+ };
+
+ module.exports = new RemoteStorage();
+
+ }());
+
+/***/ },
+
+/***/ 20:
+/*!**************************************!*\
+ !*** ./dev/Storages/CacheStorage.js ***!
+ \**************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10)
+ ;
+
+ /**
+ * @constructor
+ */
+ function CacheStorage()
+ {
+ this.oFoldersCache = {};
+ this.oFoldersNamesCache = {};
+ this.oFolderHashCache = {};
+ this.oFolderUidNextCache = {};
+ this.oMessageListHashCache = {};
+ this.oMessageFlagsCache = {};
+ this.oNewMessage = {};
+ this.oRequestedMessage = {};
+
+ this.bCapaGravatar = Settings.capa(Enums.Capa.Gravatar);
+ }
+
+ /**
+ * @type {boolean}
+ */
+ CacheStorage.prototype.bCapaGravatar = false;
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oFoldersCache = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oFoldersNamesCache = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oFolderHashCache = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oFolderUidNextCache = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oMessageListHashCache = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oMessageFlagsCache = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oBodies = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oNewMessage = {};
+
+ /**
+ * @type {Object}
+ */
+ CacheStorage.prototype.oRequestedMessage = {};
+
+ CacheStorage.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}
+ */
+ CacheStorage.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}
+ */
+ CacheStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
+ {
+ return sFolderFullNameRaw + '#' + sUid;
+ };
+
+ /**
+ * @param {string} sFolder
+ * @param {string} sUid
+ */
+ CacheStorage.prototype.addRequestedMessage = function (sFolder, sUid)
+ {
+ this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
+ };
+
+ /**
+ * @param {string} sFolder
+ * @param {string} sUid
+ * @return {boolean}
+ */
+ CacheStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
+ {
+ return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUid
+ */
+ CacheStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
+ {
+ this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUid
+ */
+ CacheStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
+ {
+ if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
+ {
+ this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = null;
+ return true;
+ }
+
+ return false;
+ };
+
+ CacheStorage.prototype.clearNewMessageCache = function ()
+ {
+ this.oNewMessage = {};
+ };
+
+ /**
+ * @param {string} sFolderHash
+ * @return {string}
+ */
+ CacheStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
+ {
+ return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
+ };
+
+ /**
+ * @param {string} sFolderHash
+ * @param {string} sFolderFullNameRaw
+ */
+ CacheStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
+ {
+ this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @return {string}
+ */
+ CacheStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
+ {
+ return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sFolderHash
+ */
+ CacheStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
+ {
+ this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @return {string}
+ */
+ CacheStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
+ {
+ return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {string} sUidNext
+ */
+ CacheStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
+ {
+ this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @return {?FolderModel}
+ */
+ CacheStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
+ {
+ return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ * @param {?FolderModel} oFolder
+ */
+ CacheStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
+ {
+ this.oFoldersCache[sFolderFullNameRaw] = oFolder;
+ };
+
+ /**
+ * @param {string} sFolderFullNameRaw
+ */
+ CacheStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
+ {
+ this.setFolderToCacheList(sFolderFullNameRaw, null);
+ };
+
+ /**
+ * @param {string} sFolderFullName
+ * @param {string} sUid
+ * @return {?Array}
+ */
+ CacheStorage.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
+ */
+ CacheStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
+ {
+ if (!this.oMessageFlagsCache[sFolderFullName])
+ {
+ this.oMessageFlagsCache[sFolderFullName] = {};
+ }
+
+ this.oMessageFlagsCache[sFolderFullName][sUid] = aFlagsCache;
+ };
+
+ /**
+ * @param {string} sFolderFullName
+ */
+ CacheStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
+ {
+ this.oMessageFlagsCache[sFolderFullName] = {};
+ };
+
+ /**
+ * @param {(MessageModel|null)} oMessage
+ */
+ CacheStorage.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
+ */
+ CacheStorage.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
+ */
+ CacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
+ {
+ if (Utils.isArray(aFlags) && 0 < aFlags.length)
+ {
+ this.setMessageFlagsToCache(sFolder, sUid, aFlags);
+ }
+ };
+
+ module.exports = new CacheStorage();
+
+ }());
+
+/***/ },
+
+/***/ 27:
+/*!**************************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsFolderSystemViewModel.js ***!
+ \**************************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ Remote = __webpack_require__(/*! Storage:RainLoop:Remote */ 13),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @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 Utils.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
+ ['', this.sChooseOnText],
+ [Consts.Values.UnuseOptionValue, this.sUnuseText]
+ ]);
+ }, this);
+
+ var
+ self = this,
+ fSaveSystemFolders = null,
+ fCallback = null
+ ;
+
+ this.sentFolder = Data.sentFolder;
+ this.draftFolder = Data.draftFolder;
+ this.spamFolder = Data.spamFolder;
+ this.trashFolder = Data.trashFolder;
+ this.archiveFolder = Data.archiveFolder;
+
+ fSaveSystemFolders = _.debounce(function () {
+
+ Settings.settingsSet('SentFolder', self.sentFolder());
+ Settings.settingsSet('DraftFolder', self.draftFolder());
+ Settings.settingsSet('SpamFolder', self.spamFolder());
+ Settings.settingsSet('TrashFolder', self.trashFolder());
+ Settings.settingsSet('ArchiveFolder', self.archiveFolder());
+
+ Remote.saveSystemFolders(Utils.emptyFunction, {
+ 'SentFolder': self.sentFolder(),
+ 'DraftFolder': self.draftFolder(),
+ 'SpamFolder': self.spamFolder(),
+ 'TrashFolder': self.trashFolder(),
+ 'ArchiveFolder': self.archiveFolder(),
+ 'NullFolder': 'NullFolder'
+ });
+
+ }, 1000);
+
+ fCallback = function () {
+
+ Settings.settingsSet('SentFolder', self.sentFolder());
+ Settings.settingsSet('DraftFolder', self.draftFolder());
+ Settings.settingsSet('SpamFolder', self.spamFolder());
+ Settings.settingsSet('TrashFolder', self.trashFolder());
+ Settings.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;
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel(['View:Popup:FolderSystem', 'PopupsFolderSystemViewModel'], PopupsFolderSystemViewModel);
+ _.extend(PopupsFolderSystemViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ 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);
+ };
+
+ module.exports = PopupsFolderSystemViewModel;
+
+ }());
+
+/***/ },
+
+/***/ 30:
+/*!**************************************!*\
+ !*** ./dev/Storages/LocalStorage.js ***!
+ \**************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ /**
+ * @constructor
+ */
+ function LocalStorage()
+ {
+ var
+ NextStorageDriver = __webpack_require__(/*! _ */ 2).find([
+ __webpack_require__(/*! Storage:LocalStorage:LocalStorage */ 91),
+ __webpack_require__(/*! Storage:LocalStorage:Cookie */ 90)
+ ], function (NextStorageDriver) {
+ return NextStorageDriver && NextStorageDriver.supported();
+ })
+ ;
+
+ this.oDriver = null;
+
+ if (NextStorageDriver)
+ {
+ this.oDriver = new NextStorageDriver();
+ }
+ }
+
+ /**
+ * @type {LocalStorageDriver|CookieDriver|null}
+ */
+ 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();
+
+ }());
+
+/***/ },
+
+/***/ 33:
+/*!***********************!*\
+ !*** external "JSON" ***!
+ \***********************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = JSON;
+
+/***/ },
+
+/***/ 38:
+/*!************************************!*\
+ !*** ./dev/Models/MessageModel.js ***!
+ \************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+ moment = __webpack_require__(/*! moment */ 25),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ EmailModel = __webpack_require__(/*! Model:Email */ 23),
+ AttachmentModel = __webpack_require__(/*! Model:Attachment */ 52)
+ ;
+
+ /**
+ * @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
;
- this.selectedItemUseCallback = false;
-
- this.focusedItem(null);
- this.selectedItem(null);
-
- if (Utils.isArray(aItems))
+ if (Utils.isNonEmptyArray(aEmail))
{
- 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)
+ for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
{
- 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());
- }
+ aResult.push(aEmail[iIndex].toLine(bFriendlyView, bWrapWithLink));
}
}
- 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;
- };
-
- module.exports = Selector;
-
-}(module, require));
-},{"$":20,"Enums":7,"Utils":14,"_":25,"key":21,"ko":22}],14:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- Utils = {},
-
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals')
- ;
-
- Utils.trim = $.trim;
- Utils.inArray = $.inArray;
- Utils.isArray = _.isArray;
- Utils.isFunc = _.isFunction;
- Utils.isUnd = _.isUndefined;
- Utils.isNull = _.isNull;
- Utils.emptyFunction = function () {};
-
- /**
- * @param {*} oValue
- * @return {boolean}
- */
- Utils.isNormal = function (oValue)
- {
- return !Utils.isUnd(oValue) && !Utils.isNull(oValue);
- };
-
- Utils.windowResize = _.debounce(function (iTimeout) {
- if (Utils.isUnd(iTimeout))
- {
- Globals.$win.resize();
- }
- else
- {
- window.setTimeout(function () {
- Globals.$win.resize();
- }, iTimeout);
- }
- }, 50);
-
- /**
- * @param {(string|number)} mValue
- * @param {boolean=} bIncludeZero
- * @return {boolean}
- */
- Utils.isPosNumeric = function (mValue, bIncludeZero)
- {
- return Utils.isNormal(mValue) ?
- ((Utils.isUnd(bIncludeZero) ? true : !!bIncludeZero) ?
- (/^[0-9]*$/).test(mValue.toString()) :
- (/^[1-9]+[0-9]*$/).test(mValue.toString())) :
- false;
- };
-
- /**
- * @param {*} iValue
- * @param {number=} iDefault = 0
- * @return {number}
- */
- Utils.pInt = function (iValue, iDefault)
- {
- var iResult = Utils.isNormal(iValue) && '' !== iValue ? window.parseInt(iValue, 10) : (iDefault || 0);
- return window.isNaN(iResult) ? (iDefault || 0) : iResult;
- };
-
- /**
- * @param {*} mValue
- * @return {string}
- */
- Utils.pString = function (mValue)
- {
- return Utils.isNormal(mValue) ? '' + mValue : '';
- };
-
- /**
- * @param {*} aValue
- * @return {boolean}
- */
- Utils.isNonEmptyArray = function (aValue)
- {
- return Utils.isArray(aValue) && 0 < aValue.length;
- };
-
- /**
- * @return {*|null}
- */
- Utils.notificationClass = function ()
- {
- return window.Notification && window.Notification.requestPermission ? window.Notification : null;
- };
-
- /**
- * @param {string} sQueryString
- * @return {Object}
- */
- Utils.simpleQueryParser = function (sQueryString)
- {
- var
- oParams = {},
- aQueries = [],
- aTemp = [],
- iIndex = 0,
- iLen = 0
- ;
-
- aQueries = sQueryString.split('&');
- for (iIndex = 0, iLen = aQueries.length; iIndex < iLen; iIndex++)
- {
- aTemp = aQueries[iIndex].split('=');
- oParams[window.decodeURIComponent(aTemp[0])] = window.decodeURIComponent(aTemp[1]);
- }
-
- return oParams;
- };
-
- /**
- * @param {string} sMailToUrl
- * @param {Function} PopupComposeVoreModel
- * @returns {boolean}
- */
- Utils.mailToHelper = function (sMailToUrl, PopupComposeVoreModel)
- {
- if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase())
- {
- sMailToUrl = sMailToUrl.toString().substr(7);
-
- var
- oParams = {},
- oEmailModel = null,
- sEmail = sMailToUrl.replace(/\?.+$/, ''),
- sQueryString = sMailToUrl.replace(/^[^\?]*\?/, ''),
- EmailModel = require('Model:Email')
- ;
-
- oEmailModel = new EmailModel();
- oEmailModel.parse(window.decodeURIComponent(sEmail));
-
- if (oEmailModel && oEmailModel.email)
- {
- oParams = Utils.simpleQueryParser(sQueryString);
-
- require('App:Knoin').showScreenPopup(PopupComposeVoreModel, [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;
- };
-
- /**
- * @param {string} sValue
- * @param {string} sHash
- * @param {string} sKey
- * @param {string} sLongKey
- * @return {string|boolean}
- */
- Utils.rsaEncode = function (sValue, sHash, sKey, sLongKey)
- {
- if (window.crypto && window.crypto.getRandomValues && window.RSAKey && sHash && sKey && sLongKey)
- {
- var oRsa = new window.RSAKey();
- oRsa.setPublic(sLongKey, sKey);
-
- sValue = oRsa.encrypt(Utils.fakeMd5() + ':' + sValue + ':' + Utils.fakeMd5());
- if (false !== sValue)
- {
- return 'rsa:' + sHash + ':' + sValue;
- }
- }
-
- return false;
- };
-
- Utils.rsaEncode.supported = !!(window.crypto && window.crypto.getRandomValues && window.RSAKey);
-
- /**
- * @param {string} sPath
- * @param {*=} oObject
- * @param {Object=} oObjectToExportTo
- */
- Utils.exportPath = function (sPath, oObject, oObjectToExportTo)
- {
- var
- sPart = null,
- aParts = sPath.split('.'),
- oCur = oObjectToExportTo || window
- ;
-
- for (; aParts.length && (sPart = aParts.shift());)
- {
- if (!aParts.length && !Utils.isUnd(oObject))
- {
- oCur[sPart] = oObject;
- }
- else if (oCur[sPart])
- {
- oCur = oCur[sPart];
- }
- else
- {
- oCur = oCur[sPart] = {};
- }
- }
- };
-
- /**
- * @param {Object} oObject
- * @param {string} sName
- * @param {*} mValue
- */
- Utils.pImport = function (oObject, sName, mValue)
- {
- oObject[sName] = mValue;
- };
-
- /**
- * @param {Object} oObject
- * @param {string} sName
- * @param {*} mDefault
- * @return {*}
- */
- Utils.pExport = function (oObject, sName, mDefault)
- {
- return Utils.isUnd(oObject[sName]) ? mDefault : oObject[sName];
- };
-
- /**
- * @param {string} sText
- * @return {string}
- */
- Utils.encodeHtml = function (sText)
- {
- return Utils.isNormal(sText) ? sText.toString()
- .replace(/&/g, '&').replace(//g, '>')
- .replace(/"/g, '"').replace(/'/g, ''') : '';
- };
-
- /**
- * @param {string} sText
- * @param {number=} iLen
- * @return {string}
- */
- Utils.splitPlainText = function (sText, iLen)
- {
- var
- sPrefix = '',
- sSubText = '',
- sResult = sText,
- iSpacePos = 0,
- iNewLinePos = 0
- ;
-
- iLen = Utils.isUnd(iLen) ? 100 : iLen;
-
- while (sResult.length > iLen)
- {
- sSubText = sResult.substring(0, iLen);
- iSpacePos = sSubText.lastIndexOf(' ');
- iNewLinePos = sSubText.lastIndexOf('\n');
-
- if (-1 !== iNewLinePos)
- {
- iSpacePos = iNewLinePos;
- }
-
- if (-1 === iSpacePos)
- {
- iSpacePos = iLen;
- }
-
- sPrefix += sSubText.substring(0, iSpacePos) + '\n';
- sResult = sResult.substring(iSpacePos + 1);
- }
-
- return sPrefix + sResult;
- };
-
- Utils.timeOutAction = (function () {
-
- var
- oTimeOuts = {}
- ;
-
- return function (sAction, fFunction, iTimeOut)
- {
- if (Utils.isUnd(oTimeOuts[sAction]))
- {
- oTimeOuts[sAction] = 0;
- }
-
- window.clearTimeout(oTimeOuts[sAction]);
- oTimeOuts[sAction] = window.setTimeout(fFunction, iTimeOut);
- };
- }());
-
- Utils.timeOutActionSecond = (function () {
-
- var
- oTimeOuts = {}
- ;
-
- return function (sAction, fFunction, iTimeOut)
- {
- if (!oTimeOuts[sAction])
- {
- oTimeOuts[sAction] = window.setTimeout(function () {
- fFunction();
- oTimeOuts[sAction] = 0;
- }, iTimeOut);
- }
- };
- }());
-
- Utils.audio = (function () {
-
- var
- oAudio = false
- ;
-
- return function (sMp3File, sOggFile) {
-
- if (false === oAudio)
- {
- if (Globals.bIsiOSDevice)
- {
- oAudio = null;
- }
- else
- {
- var
- bCanPlayMp3 = false,
- bCanPlayOgg = false,
- oAudioLocal = window.Audio ? new window.Audio() : null
- ;
-
- if (oAudioLocal && oAudioLocal.canPlayType && oAudioLocal.play)
- {
- bCanPlayMp3 = '' !== oAudioLocal.canPlayType('audio/mpeg; codecs="mp3"');
- if (!bCanPlayMp3)
- {
- bCanPlayOgg = '' !== oAudioLocal.canPlayType('audio/ogg; codecs="vorbis"');
- }
-
- if (bCanPlayMp3 || bCanPlayOgg)
- {
- oAudio = oAudioLocal;
- oAudio.preload = 'none';
- oAudio.loop = false;
- oAudio.autoplay = false;
- oAudio.muted = false;
- oAudio.src = bCanPlayMp3 ? sMp3File : sOggFile;
- }
- else
- {
- oAudio = null;
- }
- }
- else
- {
- oAudio = null;
- }
- }
- }
-
- return oAudio;
- };
- }());
-
- /**
- * @param {(Object|null|undefined)} oObject
- * @param {string} sProp
- * @return {boolean}
- */
- Utils.hos = function (oObject, sProp)
- {
- return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false;
- };
-
- /**
- * @param {string} sKey
- * @param {Object=} oValueList
- * @param {string=} sDefaulValue
- * @return {string}
- */
- Utils.i18n = function (sKey, oValueList, sDefaulValue)
- {
- var
- sValueName = '',
- sResult = Utils.isUnd(Globals.oI18N[sKey]) ? (Utils.isUnd(sDefaulValue) ? sKey : sDefaulValue) : Globals.oI18N[sKey]
- ;
-
- if (!Utils.isUnd(oValueList) && !Utils.isNull(oValueList))
- {
- for (sValueName in oValueList)
- {
- if (Utils.hos(oValueList, sValueName))
- {
- sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]);
- }
- }
- }
-
- return sResult;
- };
-
- /**
- * @param {Object} oElement
- */
- Utils.i18nToNode = function (oElement)
- {
- _.defer(function () {
- $('.i18n', oElement).each(function () {
- var
- jqThis = $(this),
- sKey = ''
- ;
-
- sKey = jqThis.data('i18n-text');
- if (sKey)
- {
- jqThis.text(Utils.i18n(sKey));
- }
- else
- {
- sKey = jqThis.data('i18n-html');
- if (sKey)
- {
- jqThis.html(Utils.i18n(sKey));
- }
-
- sKey = jqThis.data('i18n-placeholder');
- if (sKey)
- {
- jqThis.attr('placeholder', Utils.i18n(sKey));
- }
-
- sKey = jqThis.data('i18n-title');
- if (sKey)
- {
- jqThis.attr('title', Utils.i18n(sKey));
- }
- }
- });
- });
- };
-
- Utils.i18nReload = function ()
- {
- if (window['rainloopI18N'])
- {
- Globals.oI18N = window['rainloopI18N'] || {};
-
- Utils.i18nToNode(Globals.$doc);
-
- Globals.langChangeTrigger(!Globals.langChangeTrigger());
- }
-
- window['rainloopI18N'] = null;
- };
-
- /**
- * @param {Function} fCallback
- * @param {Object} oScope
- * @param {Function=} fLangCallback
- */
- Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
- {
- if (fCallback)
- {
- fCallback.call(oScope);
- }
-
- if (fLangCallback)
- {
- Globals.langChangeTrigger.subscribe(function () {
- if (fCallback)
- {
- fCallback.call(oScope);
- }
-
- fLangCallback.call(oScope);
- });
- }
- else if (fCallback)
- {
- Globals.langChangeTrigger.subscribe(fCallback, oScope);
- }
- };
-
- /**
- * @return {boolean}
- */
- Utils.inFocus = function ()
- {
- if (window.document.activeElement)
- {
- if (Utils.isUnd(window.document.activeElement.__inFocusCache))
- {
- window.document.activeElement.__inFocusCache = $(window.document.activeElement).is('input,textarea,iframe,.cke_editable');
- }
-
- return !!window.document.activeElement.__inFocusCache;
- }
-
- return false;
- };
-
- Utils.removeInFocus = function ()
- {
- if (window.document && window.document.activeElement && window.document.activeElement.blur)
- {
- var oA = $(window.document.activeElement);
- if (oA.is('input,textarea'))
- {
- window.document.activeElement.blur();
- }
- }
- };
-
- Utils.removeSelection = function ()
- {
- if (window && window.getSelection)
- {
- var oSel = window.getSelection();
- if (oSel && oSel.removeAllRanges)
- {
- oSel.removeAllRanges();
- }
- }
- else if (window.document && window.document.selection && window.document.selection.empty)
- {
- window.document.selection.empty();
- }
- };
-
- /**
- * @param {string} sPrefix
- * @param {string} sSubject
- * @return {string}
- */
- Utils.replySubjectAdd = function (sPrefix, sSubject)
- {
- sPrefix = Utils.trim(sPrefix.toUpperCase());
- sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' '));
-
- var
- bDrop = false,
- aSubject = [],
- bRe = 'RE' === sPrefix,
- bFwd = 'FWD' === sPrefix,
- bPrefixIsRe = !bFwd
- ;
-
- if ('' !== sSubject)
- {
- _.each(sSubject.split(':'), function (sPart) {
- var sTrimmedPart = Utils.trim(sPart);
- if (!bDrop && (/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart)))
- {
- if (!bRe)
- {
- bRe = !!(/^RE/i.test(sTrimmedPart));
- }
-
- if (!bFwd)
- {
- bFwd = !!(/^FWD/i.test(sTrimmedPart));
- }
- }
- else
- {
- aSubject.push(sPart);
- bDrop = true;
- }
- });
- }
-
- if (bPrefixIsRe)
- {
- bRe = false;
- }
- else
- {
- bFwd = false;
- }
-
- return Utils.trim(
- (bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
- (bRe ? 'Re: ' : '') +
- (bFwd ? 'Fwd: ' : '') +
- Utils.trim(aSubject.join(':'))
- );
- };
-
- /**
- * @param {number} iNum
- * @param {number} iDec
- * @return {number}
- */
- Utils.roundNumber = function (iNum, iDec)
- {
- return window.Math.round(iNum * window.Math.pow(10, iDec)) / window.Math.pow(10, iDec);
- };
-
- /**
- * @param {(number|string)} iSizeInBytes
- * @return {string}
- */
- Utils.friendlySize = function (iSizeInBytes)
- {
- iSizeInBytes = Utils.pInt(iSizeInBytes);
-
- if (iSizeInBytes >= 1073741824)
- {
- return Utils.roundNumber(iSizeInBytes / 1073741824, 1) + 'GB';
- }
- else if (iSizeInBytes >= 1048576)
- {
- return Utils.roundNumber(iSizeInBytes / 1048576, 1) + 'MB';
- }
- else if (iSizeInBytes >= 1024)
- {
- return Utils.roundNumber(iSizeInBytes / 1024, 0) + 'KB';
- }
-
- return iSizeInBytes + 'B';
- };
-
- /**
- * @param {string} sDesc
- */
- Utils.log = function (sDesc)
- {
- if (window.console && window.console.log)
- {
- window.console.log(sDesc);
- }
- };
-
- /**
- * @param {number} iCode
- * @param {*=} mMessage = ''
- * @return {string}
- */
- Utils.getNotification = function (iCode, mMessage)
- {
- iCode = Utils.pInt(iCode);
- if (Enums.Notification.ClientViewError === iCode && mMessage)
- {
- return mMessage;
- }
-
- return Utils.isUnd(Globals.oNotificationI18N[iCode]) ? '' : Globals.oNotificationI18N[iCode];
- };
-
- Utils.initNotificationLanguage = function ()
- {
- var oN = Globals.oNotificationI18N || {};
- oN[Enums.Notification.InvalidToken] = Utils.i18n('NOTIFICATIONS/INVALID_TOKEN');
- oN[Enums.Notification.AuthError] = Utils.i18n('NOTIFICATIONS/AUTH_ERROR');
- oN[Enums.Notification.AccessError] = Utils.i18n('NOTIFICATIONS/ACCESS_ERROR');
- oN[Enums.Notification.ConnectionError] = Utils.i18n('NOTIFICATIONS/CONNECTION_ERROR');
- oN[Enums.Notification.CaptchaError] = Utils.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
- oN[Enums.Notification.SocialFacebookLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
- oN[Enums.Notification.SocialTwitterLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
- oN[Enums.Notification.SocialGoogleLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
- oN[Enums.Notification.DomainNotAllowed] = Utils.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
- oN[Enums.Notification.AccountNotAllowed] = Utils.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
-
- oN[Enums.Notification.AccountTwoFactorAuthRequired] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
- oN[Enums.Notification.AccountTwoFactorAuthError] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
-
- oN[Enums.Notification.CouldNotSaveNewPassword] = Utils.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
- oN[Enums.Notification.CurrentPasswordIncorrect] = Utils.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
- oN[Enums.Notification.NewPasswordShort] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
- oN[Enums.Notification.NewPasswordWeak] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
- oN[Enums.Notification.NewPasswordForbidden] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
-
- oN[Enums.Notification.ContactsSyncError] = Utils.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
-
- oN[Enums.Notification.CantGetMessageList] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
- oN[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
- oN[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
- oN[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
- oN[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
-
- oN[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
- oN[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
- oN[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
-
- oN[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
- oN[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
- oN[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
- oN[Enums.Notification.CantDeleteNonEmptyFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
- oN[Enums.Notification.CantSubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
- oN[Enums.Notification.CantUnsubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
-
- oN[Enums.Notification.CantSaveSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
- oN[Enums.Notification.CantSavePluginSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
-
- oN[Enums.Notification.DomainAlreadyExists] = Utils.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
-
- oN[Enums.Notification.CantInstallPackage] = Utils.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
- oN[Enums.Notification.CantDeletePackage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
- oN[Enums.Notification.InvalidPluginPackage] = Utils.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
- oN[Enums.Notification.UnsupportedPluginPackage] = Utils.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
-
- oN[Enums.Notification.LicensingServerIsUnavailable] = Utils.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
- oN[Enums.Notification.LicensingExpired] = Utils.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
- oN[Enums.Notification.LicensingBanned] = Utils.i18n('NOTIFICATIONS/LICENSING_BANNED');
-
- oN[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
-
- oN[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
-
- oN[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
- oN[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
- oN[Enums.Notification.UnknownNotification] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
- oN[Enums.Notification.UnknownError] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
- };
-
- /**
- * @param {*} mCode
- * @return {string}
- */
- Utils.getUploadErrorDescByCode = function (mCode)
- {
- var sResult = '';
- switch (Utils.pInt(mCode)) {
- case Enums.UploadErrorCode.FileIsTooBig:
- sResult = Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
- break;
- case Enums.UploadErrorCode.FilePartiallyUploaded:
- sResult = Utils.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED');
- break;
- case Enums.UploadErrorCode.FileNoUploaded:
- sResult = Utils.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED');
- break;
- case Enums.UploadErrorCode.MissingTempFolder:
- sResult = Utils.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER');
- break;
- case Enums.UploadErrorCode.FileOnSaveingError:
- sResult = Utils.i18n('UPLOAD/ERROR_ON_SAVING_FILE');
- break;
- case Enums.UploadErrorCode.FileType:
- sResult = Utils.i18n('UPLOAD/ERROR_FILE_TYPE');
- break;
- default:
- sResult = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
- break;
- }
-
- return sResult;
- };
-
- /**
- * @param {?} oObject
- * @param {string} sMethodName
- * @param {Array=} aParameters
- * @param {number=} nDelay
- */
- Utils.delegateRun = function (oObject, sMethodName, aParameters, nDelay)
- {
- if (oObject && oObject[sMethodName])
- {
- nDelay = Utils.pInt(nDelay);
- if (0 >= nDelay)
- {
- oObject[sMethodName].apply(oObject, Utils.isArray(aParameters) ? aParameters : []);
- }
- else
- {
- _.delay(function () {
- oObject[sMethodName].apply(oObject, Utils.isArray(aParameters) ? aParameters : []);
- }, nDelay);
- }
- }
- };
-
- /**
- * @param {?} oEvent
- */
- Utils.killCtrlAandS = function (oEvent)
- {
- oEvent = oEvent || window.event;
- if (oEvent && oEvent.ctrlKey && !oEvent.shiftKey && !oEvent.altKey)
- {
- var
- oSender = oEvent.target || oEvent.srcElement,
- iKey = oEvent.keyCode || oEvent.which
- ;
-
- if (iKey === Enums.EventKeyCode.S)
- {
- oEvent.preventDefault();
- return;
- }
-
- if (oSender && oSender.tagName && oSender.tagName.match(/INPUT|TEXTAREA/i))
- {
- return;
- }
-
- if (iKey === Enums.EventKeyCode.A)
- {
- if (window.getSelection)
- {
- window.getSelection().removeAllRanges();
- }
- else if (window.document.selection && window.document.selection.clear)
- {
- window.document.selection.clear();
- }
-
- oEvent.preventDefault();
- }
- }
- };
-
- /**
- * @param {(Object|null|undefined)} oContext
- * @param {Function} fExecute
- * @param {(Function|boolean|null)=} fCanExecute
- * @return {Function}
- */
- Utils.createCommand = function (oContext, fExecute, fCanExecute)
- {
- var
- fResult = fExecute ? function () {
-
- if (fResult && fResult.canExecute && fResult.canExecute())
- {
- fExecute.apply(oContext, Array.prototype.slice.call(arguments));
- }
-
- return false;
-
- } : function () {}
- ;
-
- fResult.enabled = ko.observable(true);
-
- fCanExecute = Utils.isUnd(fCanExecute) ? true : fCanExecute;
- if (Utils.isFunc(fCanExecute))
- {
- fResult.canExecute = ko.computed(function () {
- return fResult.enabled() && fCanExecute.call(oContext);
- });
- }
- else
- {
- fResult.canExecute = ko.computed(function () {
- return fResult.enabled() && !!fCanExecute;
- });
- }
-
- return fResult;
- };
-
- /**
- * @param {Object} oData
- */
- Utils.initDataConstructorBySettings = function (oData)
- {
- oData.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html);
- oData.showImages = ko.observable(false);
- oData.interfaceAnimation = ko.observable(Enums.InterfaceAnimation.Full);
- oData.contactsAutosave = ko.observable(false);
-
- Globals.sAnimationType = Enums.InterfaceAnimation.Full;
-
- oData.capaThemes = ko.observable(false);
- oData.allowLanguagesOnSettings = ko.observable(true);
- oData.allowLanguagesOnLogin = ko.observable(true);
-
- oData.useLocalProxyForExternalImages = ko.observable(false);
-
- oData.desktopNotifications = ko.observable(false);
- oData.useThreads = ko.observable(true);
- oData.replySameFolder = ko.observable(true);
- oData.useCheckboxesInList = ko.observable(true);
-
- oData.layout = ko.observable(Enums.Layout.SidePreview);
- oData.usePreviewPane = ko.computed(function () {
- return Enums.Layout.NoPreview !== oData.layout();
- });
-
- oData.interfaceAnimation.subscribe(function (sValue) {
- if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)
- {
- Globals.$html.removeClass('rl-anim rl-anim-full').addClass('no-rl-anim');
-
- Globals.sAnimationType = Enums.InterfaceAnimation.None;
- }
- else
- {
- switch (sValue)
- {
- case Enums.InterfaceAnimation.Full:
- Globals.$html.removeClass('no-rl-anim').addClass('rl-anim rl-anim-full');
- Globals.sAnimationType = sValue;
- break;
- case Enums.InterfaceAnimation.Normal:
- Globals.$html.removeClass('no-rl-anim rl-anim-full').addClass('rl-anim');
- Globals.sAnimationType = sValue;
- break;
- }
- }
- });
-
- oData.interfaceAnimation.valueHasMutated();
-
- oData.desktopNotificationsPermisions = ko.computed(function () {
-
- oData.desktopNotifications();
-
- var
- NotificationClass = Utils.notificationClass(),
- iResult = Enums.DesktopNotifications.NotSupported
- ;
-
- if (NotificationClass && NotificationClass.permission)
- {
- switch (NotificationClass.permission.toLowerCase())
- {
- case 'granted':
- iResult = Enums.DesktopNotifications.Allowed;
- break;
- case 'denied':
- iResult = Enums.DesktopNotifications.Denied;
- break;
- case 'default':
- iResult = Enums.DesktopNotifications.NotAllowed;
- break;
- }
- }
- else if (window.webkitNotifications && window.webkitNotifications.checkPermission)
- {
- iResult = window.webkitNotifications.checkPermission();
- }
-
- return iResult;
- });
-
- oData.useDesktopNotifications = ko.computed({
- 'read': function () {
- return oData.desktopNotifications() &&
- Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions();
- },
- 'write': function (bValue) {
- if (bValue)
- {
- var
- NotificationClass = Utils.notificationClass(),
- iPermission = oData.desktopNotificationsPermisions()
- ;
-
- if (NotificationClass && Enums.DesktopNotifications.Allowed === iPermission)
- {
- oData.desktopNotifications(true);
- }
- else if (NotificationClass && Enums.DesktopNotifications.NotAllowed === iPermission)
- {
- NotificationClass.requestPermission(function () {
- oData.desktopNotifications.valueHasMutated();
- if (Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions())
- {
- if (oData.desktopNotifications())
- {
- oData.desktopNotifications.valueHasMutated();
- }
- else
- {
- oData.desktopNotifications(true);
- }
- }
- else
- {
- if (oData.desktopNotifications())
- {
- oData.desktopNotifications(false);
- }
- else
- {
- oData.desktopNotifications.valueHasMutated();
- }
- }
- });
- }
- else
- {
- oData.desktopNotifications(false);
- }
- }
- else
- {
- oData.desktopNotifications(false);
- }
- }
- });
-
- oData.language = ko.observable('');
- oData.languages = ko.observableArray([]);
-
- oData.mainLanguage = ko.computed({
- 'read': oData.language,
- 'write': function (sValue) {
- if (sValue !== oData.language())
- {
- if (-1 < Utils.inArray(sValue, oData.languages()))
- {
- oData.language(sValue);
- }
- else if (0 < oData.languages().length)
- {
- oData.language(oData.languages()[0]);
- }
- }
- else
- {
- oData.language.valueHasMutated();
- }
- }
- });
-
- oData.theme = ko.observable('');
- oData.themes = ko.observableArray([]);
-
- oData.mainTheme = ko.computed({
- 'read': oData.theme,
- 'write': function (sValue) {
- if (sValue !== oData.theme())
- {
- var aThemes = oData.themes();
- if (-1 < Utils.inArray(sValue, aThemes))
- {
- oData.theme(sValue);
- }
- else if (0 < aThemes.length)
- {
- oData.theme(aThemes[0]);
- }
- }
- else
- {
- oData.theme.valueHasMutated();
- }
- }
- });
-
- oData.capaAdditionalAccounts = ko.observable(false);
- oData.capaAdditionalIdentities = ko.observable(false);
- oData.capaGravatar = ko.observable(false);
- oData.determineUserLanguage = ko.observable(false);
- oData.determineUserDomain = ko.observable(false);
-
- oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
-
- oData.mainMessagesPerPage = oData.messagesPerPage;
- oData.mainMessagesPerPage = ko.computed({
- 'read': oData.messagesPerPage,
- 'write': function (iValue) {
- if (-1 < Utils.inArray(Utils.pInt(iValue), Consts.Defaults.MessagesPerPageArray))
- {
- if (iValue !== oData.messagesPerPage())
- {
- oData.messagesPerPage(iValue);
- }
- }
- else
- {
- oData.messagesPerPage.valueHasMutated();
- }
- }
- });
-
- oData.facebookSupported = ko.observable(false);
- oData.facebookEnable = ko.observable(false);
- oData.facebookAppID = ko.observable('');
- oData.facebookAppSecret = ko.observable('');
-
- oData.twitterEnable = ko.observable(false);
- oData.twitterConsumerKey = ko.observable('');
- oData.twitterConsumerSecret = ko.observable('');
-
- oData.googleEnable = ko.observable(false);
- oData.googleClientID = ko.observable('');
- oData.googleClientSecret = ko.observable('');
- oData.googleApiKey = ko.observable('');
-
- oData.dropboxEnable = ko.observable(false);
- oData.dropboxApiKey = ko.observable('');
-
- oData.contactsIsAllowed = ko.observable(false);
- };
-
- /**
- * @param {{moment:Function}} oObject
- */
- Utils.createMomentDate = function (oObject)
- {
- if (Utils.isUnd(oObject.moment))
- {
- oObject.moment = ko.observable(moment());
- }
-
- return ko.computed(function () {
- Globals.momentTrigger();
- var oMoment = this.moment();
- return 1970 === oMoment.year() ? '' : oMoment.fromNow();
- }, oObject);
- };
-
- /**
- * @param {{moment:Function, momentDate:Function}} oObject
- */
- Utils.createMomentShortDate = function (oObject)
- {
- return ko.computed(function () {
-
- var
- sResult = '',
- oMomentNow = moment(),
- oMoment = this.moment(),
- sMomentDate = this.momentDate()
- ;
-
- if (1970 === oMoment.year())
- {
- sResult = '';
- }
- else if (4 >= oMomentNow.diff(oMoment, 'hours'))
- {
- sResult = sMomentDate;
- }
- else if (oMomentNow.format('L') === oMoment.format('L'))
- {
- sResult = Utils.i18n('MESSAGE_LIST/TODAY_AT', {
- 'TIME': oMoment.format('LT')
- });
- }
- else if (oMomentNow.clone().subtract('days', 1).format('L') === oMoment.format('L'))
- {
- sResult = Utils.i18n('MESSAGE_LIST/YESTERDAY_AT', {
- 'TIME': oMoment.format('LT')
- });
- }
- else if (oMomentNow.year() === oMoment.year())
- {
- sResult = oMoment.format('D MMM.');
- }
- else
- {
- sResult = oMoment.format('LL');
- }
-
- return sResult;
-
- }, oObject);
- };
-
- /**
- * @param {string} sTheme
- * @return {string}
- */
- Utils.convertThemeName = function (sTheme)
- {
- if ('@custom' === sTheme.substr(-7))
- {
- sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
- }
-
- return Utils.trim(sTheme.replace(/[^a-zA-Z0-9]+/g, ' ').replace(/([A-Z])/g, ' $1').replace(/[\s]+/g, ' '));
- };
-
- /**
- * @param {string} sName
- * @return {string}
- */
- Utils.quoteName = function (sName)
- {
- return sName.replace(/["]/g, '\\"');
- };
-
- /**
- * @return {number}
- */
- Utils.microtime = function ()
- {
- return (new Date()).getTime();
- };
-
- /**
- *
- * @param {string} sLanguage
- * @param {boolean=} bEng = false
- * @return {string}
- */
- Utils.convertLangName = function (sLanguage, bEng)
- {
- return Utils.i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' +
- sLanguage.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, sLanguage);
- };
-
- /**
- * @param {number=} iLen
- * @return {string}
- */
- Utils.fakeMd5 = function(iLen)
- {
- var
- sResult = '',
- sLine = '0123456789abcdefghijklmnopqrstuvwxyz'
- ;
-
- iLen = Utils.isUnd(iLen) ? 32 : Utils.pInt(iLen);
-
- while (sResult.length < iLen)
- {
- sResult += sLine.substr(window.Math.round(window.Math.random() * sLine.length), 1);
- }
-
- return sResult;
- };
-
- /**
- * @param {string} sPlain
- * @return {string}
- */
- Utils.convertPlainTextToHtml = function (sPlain)
- {
- return sPlain.toString()
- .replace(/&/g, '&').replace(/>/g, '>').replace(/');
- };
-
- Utils.draggeblePlace = function ()
- {
- return $(' ').appendTo('#rl-hidden');
- };
-
- Utils.defautOptionsAfterRender = function (oDomOption, oItem)
- {
- if (oItem && !Utils.isUnd(oItem.disabled) && oDomOption)
- {
- $(oDomOption)
- .toggleClass('disabled', oItem.disabled)
- .prop('disabled', oItem.disabled)
- ;
- }
- };
-
- /**
- * @param {Object} oViewModel
- * @param {string} sTemplateID
- * @param {string} sTitle
- * @param {Function=} fCallback
- */
- Utils.windowPopupKnockout = function (oViewModel, sTemplateID, sTitle, fCallback)
- {
- var
- oScript = null,
- oWin = window.open(''),
- sFunc = '__OpenerApplyBindingsUid' + Utils.fakeMd5() + '__',
- oTemplate = $('#' + sTemplateID)
- ;
-
- window[sFunc] = function () {
-
- if (oWin && oWin.document.body && oTemplate && oTemplate[0])
- {
- var oBody = $(oWin.document.body);
-
- $('#rl-content', oBody).html(oTemplate.html());
- $('html', oWin.document).addClass('external ' + $('html').attr('class'));
-
- Utils.i18nToNode(oBody);
-
- if (oViewModel && $('#rl-content', oBody)[0])
- {
- ko.applyBindings(oViewModel, $('#rl-content', oBody)[0]);
- }
-
- window[sFunc] = null;
-
- fCallback(oWin);
- }
+ return aResult.join(', ');
};
- oWin.document.open();
- oWin.document.write('' +
-'' +
-'' +
-'' +
-'' +
-'' +
-'' + Utils.encodeHtml(sTitle) + ' ' +
-'');
- oWin.document.close();
-
- oScript = oWin.document.createElement('script');
- oScript.type = 'text/javascript';
- oScript.innerHTML = 'if(window&&window.opener&&window.opener[\'' + sFunc + '\']){window.opener[\'' + sFunc + '\']();window.opener[\'' + sFunc + '\']=null}';
- oWin.document.getElementsByTagName('head')[0].appendChild(oScript);
- };
-
- /**
- * @param {Function} fCallback
- * @param {?} koTrigger
- * @param {?} oContext = null
- * @param {number=} iTimer = 1000
- * @return {Function}
- */
- Utils.settingsSaveHelperFunction = function (fCallback, koTrigger, oContext, iTimer)
- {
- oContext = oContext || null;
- iTimer = Utils.isUnd(iTimer) ? 1000 : Utils.pInt(iTimer);
-
- return function (sType, mData, bCached, sRequestAction, oRequestParameters) {
- koTrigger.call(oContext, mData && mData['Result'] ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult);
- if (fCallback)
- {
- fCallback.call(oContext, sType, mData, bCached, sRequestAction, oRequestParameters);
- }
- _.delay(function () {
- koTrigger.call(oContext, Enums.SaveSettingsStep.Idle);
- }, iTimer);
- };
- };
-
- Utils.settingsSaveHelperSimpleFunction = function (koTrigger, oContext)
- {
- return Utils.settingsSaveHelperFunction(null, koTrigger, oContext, 1000);
- };
-
- /**
- * @param {string} sHtml
- * @return {string}
- */
- Utils.htmlToPlain = function (sHtml)
- {
- var
- iPos = 0,
- iP1 = 0,
- iP2 = 0,
- iP3 = 0,
- iLimit = 0,
-
- sText = '',
-
- splitPlainText = function (sText)
- {
- var
- iLen = 100,
- sPrefix = '',
- sSubText = '',
- sResult = sText,
- iSpacePos = 0,
- iNewLinePos = 0
- ;
-
- while (sResult.length > iLen)
- {
- sSubText = sResult.substring(0, iLen);
- iSpacePos = sSubText.lastIndexOf(' ');
- iNewLinePos = sSubText.lastIndexOf('\n');
-
- if (-1 !== iNewLinePos)
- {
- iSpacePos = iNewLinePos;
- }
-
- if (-1 === iSpacePos)
- {
- iSpacePos = iLen;
- }
-
- sPrefix += sSubText.substring(0, iSpacePos) + '\n';
- sResult = sResult.substring(iSpacePos + 1);
- }
-
- return sPrefix + sResult;
- },
-
- convertBlockquote = function (sText) {
- sText = splitPlainText($.trim(sText));
- sText = '> ' + sText.replace(/\n/gm, '\n> ');
- return sText.replace(/(^|\n)([> ]+)/gm, function () {
- return (arguments && 2 < arguments.length) ? arguments[1] + $.trim(arguments[2].replace(/[\s]/g, '')) + ' ' : '';
- });
- },
-
- convertDivs = function () {
- if (arguments && 1 < arguments.length)
- {
- var sText = $.trim(arguments[1]);
- if (0 < sText.length)
- {
- sText = sText.replace(/]*>([\s\S\r\n]*)<\/div>/gmi, convertDivs);
- sText = '\n' + $.trim(sText) + '\n';
- }
-
- return sText;
- }
-
- return '';
- },
-
- convertPre = function () {
- return (arguments && 1 < arguments.length) ? arguments[1].toString().replace(/[\n]/gm, '
') : '';
- },
-
- fixAttibuteValue = function () {
- return (arguments && 1 < arguments.length) ?
- '' + arguments[1] + arguments[2].replace(//g, '>') : '';
- },
-
- convertLinks = function () {
- return (arguments && 1 < arguments.length) ? $.trim(arguments[1]) : '';
- }
- ;
-
- sText = sHtml
- .replace(/]*>([\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 = Globals.$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)
+ /**
+ * @static
+ * @param {Array} aEmail
+ * @return {string}
+ */
+ MessageModel.emailsToLineClear = function (aEmail)
{
- 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 = Globals.$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;
- };
-
- /**
- * @param {string} sUrl
- * @param {number} iValue
- * @param {Function} fCallback
- */
- Utils.resizeAndCrop = function (sUrl, iValue, fCallback)
- {
- var oTempImg = new window.Image();
- oTempImg.onload = function() {
-
var
- aDiff = [0, 0],
- oCanvas = window.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;
- };
-
- /**
- * @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() {
-
- var
- iPrev = 0,
- iNext = 0,
- iLimit = 2,
aResult = [],
- iCurrentPage = koCurrentPage(),
- iPageCount = koPageCount(),
-
- /**
- * @param {number} iIndex
- * @param {boolean=} bPush = true
- * @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);
- }
- }
+ iIndex = 0,
+ iLen = 0
;
- if (1 < iPageCount || (0 < iPageCount && iPageCount < iCurrentPage))
- // if (0 < iPageCount && 0 < iCurrentPage)
+ if (Utils.isNonEmptyArray(aEmail))
{
- if (iPageCount < iCurrentPage)
+ for (iIndex = 0, iLen = aEmail.length; iIndex < iLen; iIndex++)
{
- fAdd(iPageCount);
- iPrev = iPageCount;
- iNext = iPageCount;
- }
- else
- {
- if (3 >= iCurrentPage || iPageCount - 2 <= iCurrentPage)
+ if (aEmail[iIndex] && aEmail[iIndex].email && '' !== aEmail[iIndex].name)
{
- 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;
+ aResult.push(aEmail[iIndex].email);
}
}
+ }
- if (3 === iPrev)
- {
- fAdd(2, false);
- }
- else if (3 < iPrev)
- {
- fAdd(window.Math.round((iPrev - 1) / 2), false, '...');
- }
+ return aResult.join(', ');
+ };
- if (iPageCount - 2 === iNext)
- {
- fAdd(iPageCount - 1, true);
- }
- else if (iPageCount - 2 > iNext)
- {
- fAdd(window.Math.round((iPageCount + iNext) / 2), true, '...');
- }
+ /**
+ * @static
+ * @param {?Array} aJsonEmails
+ * @return {Array.}
+ */
+ MessageModel.initEmailsFromJson = function (aJsonEmails)
+ {
+ var
+ iIndex = 0,
+ iLen = 0,
+ oEmailModel = null,
+ aResult = []
+ ;
- // first and last
- if (1 < iPrev)
+ if (Utils.isNonEmptyArray(aJsonEmails))
+ {
+ for (iIndex = 0, iLen = aJsonEmails.length; iIndex < iLen; iIndex++)
{
- fAdd(1, false);
- }
-
- if (iPageCount > iNext)
- {
- fAdd(iPageCount, true);
+ oEmailModel = EmailModel.newInstanceFromJson(aJsonEmails[iIndex]);
+ if (oEmailModel)
+ {
+ aResult.push(oEmailModel);
+ }
}
}
return aResult;
};
- };
- Utils.selectElement = function (element)
- {
- var sel, range;
- if (window.getSelection)
+ /**
+ * @static
+ * @param {Array.} aMessageEmails
+ * @param {Object} oLocalUnic
+ * @param {Array} aLocalEmails
+ */
+ MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
{
- sel = window.getSelection();
- sel.removeAllRanges();
- range = window.document.createRange();
- range.selectNodeContents(element);
- sel.addRange(range);
- }
- else if (window.document.selection)
- {
- range = window.document.body.createTextRange();
- range.moveToElementText(element);
- range.select();
- }
- };
-
- Utils.detectDropdownVisibility = _.debounce(function () {
- Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) {
- return oItem.hasClass('open');
- }));
- }, 50);
-
- /**
- * @param {boolean=} bDelay = false
- */
- Utils.triggerAutocompleteInputChange = function (bDelay) {
-
- var fFunc = function () {
- $('.checkAutocomplete').trigger('change');
- };
-
- if (Utils.isUnd(bDelay) ? false : !!bDelay)
- {
- _.delay(fFunc, 100);
- }
- else
- {
- fFunc();
- }
- };
-
- module.exports = Utils;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"Consts":6,"Enums":7,"Globals":9,"Model:Email":37,"_":25,"ko":22,"window":26}],15:[function(require,module,exports){
-module.exports = JSON;
-},{}],16:[function(require,module,exports){
-module.exports = Jua;
-},{}],17:[function(require,module,exports){
-module.exports = crossroads;
-},{}],18:[function(require,module,exports){
-module.exports = hasher;
-},{}],19:[function(require,module,exports){
-module.exports = ifvisible;
-},{}],20:[function(require,module,exports){
-module.exports = $;
-},{}],21:[function(require,module,exports){
-module.exports = key;
-},{}],22:[function(require,module,exports){
-
-(function (module, ko) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$')
- ;
-
- ko.bindingHandlers.tooltip = {
- 'init': function (oElement, fValueAccessor) {
-
- var
- Globals = require('Globals'),
- Utils = require('Utils')
- ;
-
- 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
- Globals = require('Globals'),
- $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),
- Globals = require('Globals')
- ;
-
- $oEl.tooltip({
- 'container': 'body',
- 'trigger': 'hover manual',
- 'title': function () {
- return $oEl.data('tooltip3-data') || '';
- }
- });
-
- $(window.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) {
- var Globals = require('Globals');
- Globals.aBootstrapDropdowns.push($(oElement));
- }
- };
-
- ko.bindingHandlers.openDropdownTrigger = {
- 'update': function (oElement, fValueAccessor) {
- if (ko.utils.unwrapObservable(fValueAccessor()))
- {
- 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
- {
- $(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()));
- }
- }
- };
-
- 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) {
-
- 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'),
- Globals = require('Globals'),
- 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 = Globals.$win.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('Model:Email'),
-
- $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('Model:ContactTag'),
-
- $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
- Utils = require('Utils'),
- 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
- 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 ()
- {
- 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();
- }
-
- return this;
- };
-
- module.exports = ko;
-
-}(module, ko));
-
-},{"$":20,"Globals":9,"Model:ContactTag":36,"Model:Email":37,"Utils":14,"_":25,"window":26}],23:[function(require,module,exports){
-module.exports = moment;
-},{}],24:[function(require,module,exports){
-module.exports = ssm;
-},{}],25:[function(require,module,exports){
-module.exports = _;
-},{}],26:[function(require,module,exports){
-module.exports = window;
-},{}],27:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- hasher = require('hasher'),
- crossroads = require('crossroads'),
-
- Globals = require('Globals'),
- Plugins = require('Plugins'),
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function Knoin()
- {
- this.oScreens = {};
- this.sDefaultScreenName = '';
- this.oCurrentScreen = null;
- }
-
- Knoin.prototype.oScreens = {};
- Knoin.prototype.sDefaultScreenName = '';
- Knoin.prototype.oCurrentScreen = null;
-
- Knoin.prototype.hideLoading = function ()
- {
- $('#rl-loading').hide();
- };
-
- /**
- * @param {Object} thisObject
- */
- Knoin.prototype.constructorEnd = function (thisObject)
- {
- if (Utils.isFunc(thisObject['__constructor_end']))
- {
- thisObject['__constructor_end'].call(thisObject);
- }
- };
-
- /**
- * @param {string|Array} mName
- * @param {Function} ViewModelClass
- */
- Knoin.prototype.extendAsViewModel = function (mName, ViewModelClass)
- {
- if (ViewModelClass)
- {
- if (Utils.isArray(mName))
- {
- ViewModelClass.__names = mName;
- }
- else
- {
- ViewModelClass.__names = [mName];
- }
-
- ViewModelClass.__name = ViewModelClass.__names[0];
- }
- };
-
- /**
- * @param {Function} SettingsViewModelClass
- * @param {string} sLabelName
- * @param {string} sTemplate
- * @param {string} sRoute
- * @param {boolean=} bDefault
- */
- Knoin.prototype.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabelName, sRoute, bDefault)
- {
- SettingsViewModelClass.__rlSettingsData = {
- 'Label': sLabelName,
- 'Template': sTemplate,
- 'Route': sRoute,
- 'IsDefault': !!bDefault
- };
-
- Globals.aViewModels['settings'].push(SettingsViewModelClass);
- };
-
- /**
- * @param {Function} SettingsViewModelClass
- */
- Knoin.prototype.removeSettingsViewModel = function (SettingsViewModelClass)
- {
- Globals.aViewModels['settings-removed'].push(SettingsViewModelClass);
- };
-
- /**
- * @param {Function} SettingsViewModelClass
- */
- Knoin.prototype.disableSettingsViewModel = function (SettingsViewModelClass)
- {
- Globals.aViewModels['settings-disabled'].push(SettingsViewModelClass);
- };
-
- Knoin.prototype.routeOff = function ()
- {
- hasher.changed.active = false;
- };
-
- Knoin.prototype.routeOn = function ()
- {
- hasher.changed.active = true;
- };
-
- /**
- * @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
- kn = this,
- oViewModel = new ViewModelClass(oScreen),
- sPosition = oViewModel.viewModelPosition(),
- oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
- oViewModelDom = null
- ;
-
- ViewModelClass.__builded = true;
- ViewModelClass.__vm = oViewModel;
-
- oViewModel.viewModelName = ViewModelClass.__name;
- oViewModel.viewModelNames = ViewModelClass.__names;
-
- 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();
-
- 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();
-
- _.each(this.viewModelNames, function (sName) {
- Plugins.runHook('view-model-on-hide', [sName, self]);
- });
-
- Globals.popupVisibilityNames.remove(this.viewModelName);
- oViewModel.viewModelDom.css('z-index', 2000);
-
- Globals.tooltipTrigger(!Globals.tooltipTrigger());
-
- _.delay(function () {
- self.viewModelDom.hide();
- }, 300);
- }
-
- }, oViewModel);
- }
-
- _.each(ViewModelClass.__names, function (sName) {
- Plugins.runHook('view-model-pre-build', [sName, 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();
- }
-
- _.each(ViewModelClass.__names, function (sName) {
- Plugins.runHook('view-model-post-build', [sName, oViewModel, oViewModelDom]);
- });
- }
- else
- {
- Utils.log('Cannot find view model position: ' + sPosition);
- }
- }
-
- return ViewModelClass ? ViewModelClass.__vm : null;
- };
-
- /**
- * @param {Function} ViewModelClassToHide
- */
- Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
- {
- if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
- {
- ViewModelClassToHide.__vm.modalVisibility(false);
- }
- };
-
- /**
- * @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 || []);
-
- _.each(ViewModelClassToShow.__names, function (sName) {
- Plugins.runHook('view-model-on-show', [sName, 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);
-
- _.each(ViewModelClass.__names, function (sName) {
- Plugins.runHook('view-model-on-show', [sName, ViewModelClass.__vm]);
- });
- }
-
- }, self);
- }
- }
- // --
-
- oCross = oScreen.__cross ? oScreen.__cross() : null;
- 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 () {
- Globals.$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);
- }
- };
-
- module.exports = new Knoin();
-
-}(module, require));
-},{"$":20,"Globals":9,"Plugins":12,"Utils":14,"_":25,"crossroads":17,"hasher":18,"ko":22}],28:[function(require,module,exports){
-
-(function (module) {
-
- 'use strict';
-
- /**
- * @constructor
- */
- function KnoinAbstractBoot()
- {
-
- }
-
- KnoinAbstractBoot.prototype.bootstart = function ()
- {
-
- };
-
- module.exports = KnoinAbstractBoot;
-
-}(module, require));
-},{}],29:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- 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":14,"_":25,"crossroads":17}],30:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals')
- ;
-
- /**
- * @constructor
- * @param {string=} sPosition = ''
- * @param {string=} sTemplate = ''
- */
- 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.viewModelVisibility = ko.observable(false);
- this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
-
- this.viewModelName = '';
- this.viewModelNames = [];
- this.viewModelDom = null;
- }
-
- /**
- * @type {boolean}
- */
- KnoinAbstractViewModel.prototype.bDisabeCloseOnEsc = false;
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sPosition = '';
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sTemplate = '';
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sDefaultKeyScope = Enums.KeyState.None;
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.sCurrentKeyScope = Enums.KeyState.None;
-
- /**
- * @type {string}
- */
- KnoinAbstractViewModel.prototype.viewModelName = '';
-
- /**
- * @type {Array}
- */
- KnoinAbstractViewModel.prototype.viewModelNames = [];
-
- /**
- * @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;
-
- Globals.$win.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));
-},{"Enums":7,"Globals":9,"Utils":14,"ko":22}],31:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- *
- * @param {string} sEmail
- * @param {boolean=} bCanBeDelete = true
- */
- function AccountModel(sEmail, bCanBeDelete)
- {
- this.email = sEmail;
-
- this.deleteAccess = ko.observable(false);
- this.canBeDalete = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
- }
-
- /**
- * @type {string}
- */
- AccountModel.prototype.email = '';
-
- /**
- * @return {string}
- */
- AccountModel.prototype.changeAccountLink = function ()
- {
- return require('LinkBuilder').change(this.email);
- };
-
- module.exports = AccountModel;
-
-}(module, require));
-},{"LinkBuilder":11,"Utils":14,"ko":22}],32:[function(require,module,exports){
-
-(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":9,"LinkBuilder":11,"Utils":14,"window":26}],33:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @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;
- };
-
- module.exports = ComposeAttachmentModel;
-
-}(module, require));
-},{"Utils":14,"ko":22}],34:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder')
- ;
-
- /**
- * @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 LinkBuilder.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(' ');
- };
-
- module.exports = ContactModel;
-
-}(module, require));
-},{"Enums":7,"LinkBuilder":11,"Utils":14,"_":25,"ko":22}],35:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- * @param {number=} iType = Enums.ContactPropertyType.Unknown
- * @param {string=} sTypeStr = ''
- * @param {string=} sValue = ''
- * @param {boolean=} bFocused = false
- * @param {string=} sPlaceholder = ''
- */
- 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);
- }
-
- module.exports = ContactPropertyModel;
-
-}(module, require));
-},{"Enums":7,"Utils":14,"ko":22}],36:[function(require,module,exports){
-
-(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":14,"ko":22}],37:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- Utils = require('Utils')
- ;
-
- /**
- * @param {string=} sEmail
- * @param {string=} sName
- *
- * @constructor
- */
- function EmailModel(sEmail, sName)
- {
- this.email = sEmail || '';
- this.name = sName || '';
-
- 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 = '';
-
- EmailModel.prototype.clear = function ()
- {
- this.email = '';
- this.name = '';
- };
-
- /**
- * @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 = '';
- }
- };
-
- /**
- * @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(/\\\\(.)/g, '$1');
- $sComment = $sComment.replace(/\\\\(.)/g, '$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;
- };
-
- module.exports = EmailModel;
-
-}(module, require));
-},{"Utils":14}],38:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums')
- ;
-
- /**
- * @param {*} oKoList
- * @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);
- };
-
- module.exports = FilterConditionModel;
-
-}(module, require));
-},{"Enums":7,"ko":22}],39:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- FilterConditionModel = require('Model:FilterCondition')
- ;
-
- /**
- * @constructor
- */
- function FilterModel()
- {
- this.isNew = 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;
- };
-
- module.exports = FilterModel;
-
-}(module, require));
-},{"Enums":7,"Model:FilterCondition":38,"Utils":14,"ko":22}],40:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Events = require('Events')
- ;
-
- /**
- * @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.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 (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 () {
-// Globals.$win.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);
-
- // subscribe
- this.name.subscribe(function (sValue) {
- this.nameForEdit(sValue);
- }, this);
-
- this.edited.subscribe(function (bValue) {
- if (bValue)
- {
- this.nameForEdit(this.name());
- }
- }, this);
-
- this.messageCountUnread.subscribe(function (iUnread) {
- if (Enums.FolderType.Inbox === this.type())
- {
- Events.pub('mailbox.inbox-unread-count', [iUnread]);
- }
- }, 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(' / ');
- };
-
- module.exports = FolderModel;
-
-}(module, require));
-},{"Enums":7,"Events":8,"Globals":9,"Utils":14,"_":25,"ko":22}],41:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @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() + '>';
- };
-
- module.exports = IdentityModel;
-
-}(module, require));
-},{"Utils":14,"ko":22}],42:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- moment = require('moment'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals'),
- LinkBuilder = require('LinkBuilder'),
-
- EmailModel = require('Model:Email'),
- AttachmentModel = require('Model:Attachment')
- ;
-
- /**
- * @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 (aMessageEmails && 0 < aMessageEmails.length)
{
- if (Utils.isUnd(oLocalUnic[aMessageEmails[iIndex].email]))
+ var
+ iIndex = 0,
+ iLen = aMessageEmails.length
+ ;
+
+ for (; iIndex < iLen; iIndex++)
{
- 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);
- };
-
- /**
- * @return {string}
- */
- MessageModel.prototype.friendlySize = function ()
- {
- return Utils.friendlySize(this.size());
- };
-
- MessageModel.prototype.computeSenderEmail = function ()
- {
- var
- Data = require('Storage:RainLoop:Data'),
- 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('Storage:RainLoop:Data'),
- 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))
+ if (Utils.isUnd(oLocalUnic[aMessageEmails[iIndex].email]))
{
- oAttachmentModel.isLinked = true;
+ oLocalUnic[aMessageEmails[iIndex].email] = true;
+ aLocalEmails.push(aMessageEmails[iIndex]);
}
-
- aResult.push(oAttachmentModel);
}
}
- }
+ };
- return aResult;
- };
+ 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);
- /**
- * @param {AjaxJsonMessage} oJsonMessage
- * @return {boolean}
- */
- MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
- {
- var bResult = false;
+ this.proxy = 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);
+ this.fromEmailString('');
+ this.fromClearEmailString('');
+ this.toEmailsString('');
+ this.toClearEmailsString('');
+ this.senderEmailsString('');
+ this.senderClearEmailsString('');
- bResult = true;
- }
+ this.emails = [];
- return bResult;
- };
+ this.from = [];
+ this.to = [];
+ this.cc = [];
+ this.bcc = [];
+ this.replyTo = [];
+ this.deliveredTo = [];
- /**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
- MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
- {
- return MessageModel.emailsToLine(this.from, bFriendlyView, bWrapWithLink);
- };
+ this.newForAnimation(false);
- /**
- * @param {boolean} bFriendlyView
- * @param {boolean=} bWrapWithLink = false
- * @return {string}
- */
- MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
- {
- return MessageModel.emailsToLine(this.to, bFriendlyView, bWrapWithLink);
- };
+ this.deleted(false);
+ this.unseen(false);
+ this.flagged(false);
+ this.answered(false);
+ this.forwarded(false);
+ this.isReadReceipt(false);
- /**
- * @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(),
- 'popupIsHtml': this.isHtml(),
- '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.selected(false);
+ this.checked(false);
+ this.hasAttachments(false);
+ this.attachmentsMainType('');
+ this.body = null;
+ this.isHtml(false);
this.hasImages(false);
- this.body.data('rl-has-images', false);
+ this.attachments([]);
- sAttr = this.proxy ? 'data-x-additional-src' : 'data-x-src';
- $('[' + sAttr + ']', this.body).each(function () {
- if (bLazy && $(this).is('img'))
+ 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);
+ };
+
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.friendlySize = function ()
+ {
+ return Utils.friendlySize(this.size());
+ };
+
+ MessageModel.prototype.computeSenderEmail = function ()
+ {
+ var
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ 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)
- .addClass('lazy')
- .attr('data-original', $(this).attr(sAttr))
- .removeAttr(sAttr)
- ;
+ this.subjectPrefix(oJsonMessage.SubjectParts[0]);
+ this.subjectSuffix(oJsonMessage.SubjectParts[1]);
}
else
{
- $(this).attr('src', $(this).attr(sAttr)).removeAttr(sAttr);
+ 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 = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ 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(),
+ 'popupIsHtml': this.isHtml(),
+ '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);
+ }
}
});
+ };
- 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);
- });
+ MessageModel.prototype.printMessage = function ()
+ {
+ this.viewPopupMessage(true);
+ };
- if (bLazy)
+ /**
+ * @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'))
{
- $('img.lazy', this.body).addClass('lazy-inited').lazyload({
- 'threshold' : 400,
- 'effect' : 'fadeIn',
- 'skip_invisible' : false,
- 'container': $('.RL-MailMessageView .messageView .messageItem .content')[0]
+ 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);
+ }
});
- Globals.$win.resize();
+ 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]
+ });
+
+ Globals.$win.resize();
+ }
+
+ Utils.windowResize(500);
}
+ };
- 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('Storage:RainLoop:Data');
- 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('Storage:RainLoop:Data');
- if (this.body && Data.capaOpenPGP())
+ MessageModel.prototype.showInternalImages = function (bLazy)
{
- 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('Storage:RainLoop:Data');
- 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('Storage:RainLoop:Data'),
- 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
+ if (this.body && !this.body.data('rl-init-internal-images'))
{
- mPgpMessage = window.openpgp.cleartext.readArmored(this.plainRaw);
- if (mPgpMessage && mPgpMessage.getText)
- {
- this.pgpSignedVerifyStatus(
- aPublicKeys.length ? Enums.SignedVerifyStatus.Unverified : Enums.SignedVerifyStatus.UnknownPublicKeys);
+ this.body.data('rl-init-internal-images', true);
- aRes = mPgpMessage.verify(aPublicKeys);
- if (aRes && 0 < aRes.length)
+ 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)
{
- oValidKey = _.find(aRes, function (oItem) {
- return oItem && oItem.keyid && oItem.valid;
- });
-
- if (oValidKey)
+ if (bLazy && $(this).is('img'))
{
- oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
- if (oValidSysKey)
- {
- sPlain = mPgpMessage.getText();
-
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
- this.pgpSignedVerifyUser(oValidSysKey.user);
-
- sPlain =
- Globals.$div.empty().append(
- $('').text(sPlain)
- ).html()
- ;
-
- Globals.$div.empty();
-
- this.replacePlaneTextBody(sPlain);
- }
+ $(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 = __webpack_require__(/*! Storage:RainLoop:Data */ 8);
+ 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());
}
}
- catch (oExc) {}
+ };
- this.storePgpVerifyDataToDom();
- }
- };
+ MessageModel.prototype.storePgpVerifyDataToDom = function ()
+ {
+ var Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8);
+ 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.decryptPgpEncryptedMessage = function (sPassword)
- {
- if (this.isPgpEncrypted())
- {
- var
- aRes = [],
- mPgpMessage = null,
- mPgpMessageDecrypted = null,
- Data = require('Storage:RainLoop:Data'),
- 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 = ''
- ;
+ MessageModel.prototype.fetchDataToDom = function ()
+ {
+ if (this.body)
+ {
+ this.isHtml(!!this.body.data('rl-is-html'));
+ this.hasImages(!!this.body.data('rl-has-images'));
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
- this.pgpSignedVerifyUser('');
+ this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
- if (!oPrivateKey)
+ var Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8);
+ 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())
{
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.UnknownPrivateKey);
- }
+ var
+ aRes = [],
+ mPgpMessage = null,
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
+ aPublicKeys = Data.findPublicKeysByEmail(sFrom),
+ oValidKey = null,
+ oValidSysKey = null,
+ sPlain = ''
+ ;
- try
- {
- mPgpMessage = window.openpgp.message.readArmored(this.plainRaw);
- if (mPgpMessage && oPrivateKey && mPgpMessage.decrypt)
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
+ this.pgpSignedVerifyUser('');
+
+ try
{
- this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Unverified);
-
- mPgpMessageDecrypted = mPgpMessage.decrypt(oPrivateKey);
- if (mPgpMessageDecrypted)
+ mPgpMessage = window.openpgp.cleartext.readArmored(this.plainRaw);
+ if (mPgpMessage && mPgpMessage.getText)
{
- aRes = mPgpMessageDecrypted.verify(aPublicKey);
+ this.pgpSignedVerifyStatus(
+ aPublicKeys.length ? Enums.SignedVerifyStatus.Unverified : Enums.SignedVerifyStatus.UnknownPublicKeys);
+
+ aRes = mPgpMessage.verify(aPublicKeys);
if (aRes && 0 < aRes.length)
{
oValidKey = _.find(aRes, function (oItem) {
@@ -10778,12082 +5142,1725 @@ module.exports = window;
oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
if (oValidSysKey)
{
+ sPlain = mPgpMessage.getText();
+
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
this.pgpSignedVerifyUser(oValidSysKey.user);
+
+ sPlain =
+ Globals.$div.empty().append(
+ $('').text(sPlain)
+ ).html()
+ ;
+
+ Globals.$div.empty();
+
+ this.replacePlaneTextBody(sPlain);
}
}
}
-
- sPlain = mPgpMessageDecrypted.getText();
-
- sPlain =
- Globals.$div.empty().append(
- $('').text(sPlain)
- ).html()
- ;
-
- Globals.$div.empty();
-
- this.replacePlaneTextBody(sPlain);
}
}
+ catch (oExc) {}
+
+ this.storePgpVerifyDataToDom();
}
- 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));
-},{"$":20,"Enums":7,"Globals":9,"LinkBuilder":11,"Model:Attachment":32,"Model:Email":37,"Storage:RainLoop:Data":64,"Utils":14,"_":25,"ko":22,"moment":23,"window":26}],43:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko')
- ;
-
- /**
- * @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;
-
- module.exports = OpenPgpKeyModel;
-
-}(module, require));
-},{"ko":22}],44:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- KnoinAbstractScreen = require('Knoin:AbstractScreen')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractScreen
- */
- function AboutScreen()
- {
- KnoinAbstractScreen.call(this, 'about', [
- require('View:RainLoop:About')
- ]);
- }
-
- _.extend(AboutScreen.prototype, KnoinAbstractScreen.prototype);
-
- AboutScreen.prototype.onShow = function ()
- {
- require('App:RainLoop').setTitle('RainLoop');
- };
-
- module.exports = AboutScreen;
-
-}(module, require));
-},{"App:RainLoop":3,"Knoin:AbstractScreen":29,"View:RainLoop:About":70,"_":25}],45:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
-
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- kn = require('App:Knoin'),
- KnoinAbstractScreen = require('Knoin:AbstractScreen')
- ;
-
- /**
- * @constructor
- * @param {Array} aViewModels
- * @extends KnoinAbstractScreen
- */
- function AbstractSettingsScreen(aViewModels)
- {
- KnoinAbstractScreen.call(this, 'settings', aViewModels);
-
- this.menu = ko.observableArray([]);
-
- this.oCurrentSubScreen = null;
- this.oViewModelPlace = null;
- }
-
- _.extend(AbstractSettingsScreen.prototype, KnoinAbstractScreen.prototype);
-
- AbstractSettingsScreen.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)
+ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
{
- if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
- }))
- {
- RoutedSettingsViewModel = null;
- }
+ if (this.isPgpEncrypted())
+ {
+ var
+ aRes = [],
+ mPgpMessage = null,
+ mPgpMessageDecrypted = null,
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ 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 = ''
+ ;
- if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
- return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
- }))
- {
- RoutedSettingsViewModel = null;
- }
- }
+ this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error);
+ this.pgpSignedVerifyUser('');
- if (RoutedSettingsViewModel)
+ 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 =
+ Globals.$div.empty().append(
+ $('').text(sPlain)
+ ).html()
+ ;
+
+ Globals.$div.empty();
+
+ this.replacePlaneTextBody(sPlain);
+ }
+ }
+ }
+ catch (oExc) {}
+
+ this.storePgpVerifyDataToDom();
+ }
+ };
+
+ MessageModel.prototype.replacePlaneTextBody = function (sPlain)
{
- if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
- {
- oSettingsScreen = RoutedSettingsViewModel.__vm;
- }
- else
- {
- oViewModelPlace = this.oViewModelPlace;
- if (oViewModelPlace && 1 === oViewModelPlace.length)
- {
- oSettingsScreen = new RoutedSettingsViewModel();
+ if (this.body)
+ {
+ this.body.html(sPlain).addClass('b-text-part plain');
+ }
+ };
- 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
+ /**
+ * @return {string}
+ */
+ MessageModel.prototype.flagHash = function ()
{
- kn.setHash(LinkBuilder.settings(), false, true);
- }
- };
+ return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
+ this.isReadReceipt()].join('');
+ };
- AbstractSettingsScreen.prototype.onHide = function ()
- {
- if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
- {
- Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
- this.oCurrentSubScreen.viewModelDom.hide();
- }
- };
+ module.exports = MessageModel;
- AbstractSettingsScreen.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');
- };
+/***/ },
- AbstractSettingsScreen.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];
- }
- }
- ;
+/***/ 49:
+/*!******************************!*\
+ !*** ./dev/Common/Base64.js ***!
+ \******************************/
+/***/ function(module, exports, __webpack_require__) {
- return [
- ['{subname}/', oRules],
- ['{subname}', oRules],
- ['', oRules]
- ];
- };
+ // Base64 encode / decode
+ // http://www.webtoolkit.info/
- module.exports = AbstractSettingsScreen;
+ (function () {
-}(module, require));
-},{"$":20,"App:Knoin":27,"Globals":9,"Knoin:AbstractScreen":29,"LinkBuilder":11,"Utils":14,"_":25,"ko":22}],46:[function(require,module,exports){
+ 'use strict';
-(function (module, require) {
+ /*jslint bitwise: true*/
+ var Base64 = {
- 'use strict';
+ // private property
+ _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
- var
- _ = require('_'),
+ // public method for urlsafe encoding
+ urlsafe_encode : function (input) {
+ return Base64.encode(input).replace(/[+]/g, '-').replace(/[\/]/g, '_').replace(/[=]/g, '.');
+ },
- KnoinAbstractScreen = require('Knoin:AbstractScreen')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractScreen
- */
- function LoginScreen()
- {
- KnoinAbstractScreen.call(this, 'login', [
- require('View:RainLoop:Login')
- ]);
- }
-
- _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
-
- LoginScreen.prototype.onShow = function ()
- {
- require('App:RainLoop').setTitle('');
- };
-
- module.exports = LoginScreen;
-
-}(module, require));
-},{"App:RainLoop":3,"Knoin:AbstractScreen":29,"View:RainLoop:Login":72,"_":25}],47:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Events = require('Events'),
-
- KnoinAbstractScreen = require('Knoin:AbstractScreen'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Cache = require('Storage:RainLoop:Cache'),
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractScreen
- */
- function MailBoxScreen()
- {
- KnoinAbstractScreen.call(this, 'mailbox', [
- require('View:RainLoop:MailBoxSystemDropDown'),
- require('View:RainLoop:MailBoxFolderList'),
- require('View:RainLoop:MailBoxMessageList'),
- require('View:RainLoop:MailBoxMessageView')
- ]);
-
- this.oLastRoute = {};
- }
-
- _.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
-
- /**
- * @type {Object}
- */
- MailBoxScreen.prototype.oLastRoute = {};
-
- MailBoxScreen.prototype.setNewTitle = function ()
- {
- var
- sEmail = Data.accountEmail(),
- nFoldersInboxUnreadCount = Data.foldersInboxUnreadCount()
- ;
-
- require('App:RainLoop').setTitle(('' === sEmail ? '' :
- (0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
- };
-
- MailBoxScreen.prototype.onShow = function ()
- {
- this.setNewTitle();
- Globals.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 === Data.layout() && !Data.message())
- {
- require('App:RainLoop').historyBack();
- }
- }
- else
- {
- var
- sFolderFullNameRaw = Cache.getFolderFullNameRaw(sFolderHash),
- oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw)
- ;
-
- if (oFolder)
- {
- Data
- .currentFolder(oFolder)
- .messageListPage(iPage)
- .messageListSearch(sSearch)
+ // public method for encoding
+ encode : function (input) {
+ var
+ output = '',
+ chr1, chr2, chr3, enc1, enc2, enc3, enc4,
+ i = 0
;
- if (Enums.Layout.NoPreview === Data.layout() && Data.message())
+ input = Base64._utf8_encode(input);
+
+ while (i < input.length)
{
- Data.message(null);
- }
+ chr1 = input.charCodeAt(i++);
+ chr2 = input.charCodeAt(i++);
+ chr3 = input.charCodeAt(i++);
- require('App:RainLoop').reloadMessageList();
- }
- }
- };
+ enc1 = chr1 >> 2;
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+ enc4 = chr3 & 63;
- MailBoxScreen.prototype.onStart = function ()
- {
- var
- fResizeFunction = function () {
- Utils.windowResize();
- }
- ;
-
- if (Settings.capa(Enums.Capa.AdditionalAccounts) || Settings.capa(Enums.Capa.AdditionalIdentities))
- {
- require('App:RainLoop').accountsAndIdentities();
- }
-
- _.delay(function () {
- if ('INBOX' !== Data.currentFolderFullNameRaw())
- {
- require('App:RainLoop').folderInformation('INBOX');
- }
- }, 1000);
-
- _.delay(function () {
- require('App:RainLoop').quota();
- }, 5000);
-
- _.delay(function () {
- Remote.appDelayStart(Utils.emptyFunction);
- }, 35000);
-
- Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === Data.layout());
-
- Data.folderList.subscribe(fResizeFunction);
- Data.messageList.subscribe(fResizeFunction);
- Data.message.subscribe(fResizeFunction);
-
- Data.layout.subscribe(function (nValue) {
- Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
- });
-
- Events.sub('mailbox.inbox-unread-count', function (nCount) {
- Data.foldersInboxUnreadCount(nCount);
- });
-
- Data.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}]
- ];
- };
-
- module.exports = MailBoxScreen;
-
-}(module, require));
-},{"App:RainLoop":3,"Enums":7,"Events":8,"Globals":9,"Knoin:AbstractScreen":29,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:RainLoop:MailBoxFolderList":73,"View:RainLoop:MailBoxMessageList":74,"View:RainLoop:MailBoxMessageView":75,"View:RainLoop:MailBoxSystemDropDown":76,"_":25}],48:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- Globals = require('Globals'),
-
- AbstractSettingsScreen = require('Screen:AbstractSettings')
- ;
-
- /**
- * @constructor
- * @extends AbstractSettingsScreen
- */
- function SettingsScreen()
- {
- AbstractSettingsScreen.call(this, [
- require('View:RainLoop:SettingsSystemDropDown'),
- require('View:RainLoop:SettingsMenu'),
- require('View:RainLoop:SettingsPane')
- ]);
-
- Utils.initOnStartOrLangChange(function () {
- this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
- }, this, function () {
- this.setSettingsTitle();
- });
- }
-
- _.extend(SettingsScreen.prototype, AbstractSettingsScreen.prototype);
-
- SettingsScreen.prototype.onShow = function ()
- {
- this.setSettingsTitle();
- Globals.keyScope(Enums.KeyState.Settings);
- };
-
- SettingsScreen.prototype.setSettingsTitle = function ()
- {
- require('App:RainLoop').setTitle(this.sSettingsTitle);
- };
-
- module.exports = SettingsScreen;
-
-}(module, require));
-},{"App:RainLoop":3,"Enums":7,"Globals":9,"Screen:AbstractSettings":45,"Utils":14,"View:RainLoop:SettingsMenu":94,"View:RainLoop:SettingsPane":95,"View:RainLoop:SettingsSystemDropDown":96,"_":25}],49:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @constructor
- */
- function SettingsAccounts()
- {
- this.accounts = Data.accounts;
-
- this.processText = ko.computed(function () {
- return Data.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);
- }
- }
- ]});
- }
-
- SettingsAccounts.prototype.addNewAccount = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:AddAccount'));
- };
-
- /**
- * @param {AccountModel} oAccountToRemove
- */
- SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
- {
- if (oAccountToRemove && oAccountToRemove.deleteAccess())
- {
- this.accountForDeletion(null);
-
- var
- kn = require('App:Knoin'),
- fRemoveAccount = function (oAccount) {
- return oAccountToRemove === oAccount;
- }
- ;
-
- if (oAccountToRemove)
- {
- this.accounts.remove(fRemoveAccount);
-
- Remote.accountDelete(function (sResult, oData) {
-
- if (Enums.StorageResultType.Success === sResult && oData &&
- oData.Result && oData.Reload)
+ if (isNaN(chr2))
{
- kn.routeOff();
- kn.setHash(LinkBuilder.root(), true);
- kn.routeOff();
+ enc3 = enc4 = 64;
+ }
+ else if (isNaN(chr3))
+ {
+ enc4 = 64;
+ }
- _.defer(function () {
- window.location.reload();
- });
+ 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
{
- require('App:RainLoop').accountsAndIdentities();
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
}
+ }
- }, oAccountToRemove.email);
+ 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 = SettingsAccounts;
+ module.exports = Base64;
+ /*jslint bitwise: false*/
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"LinkBuilder":11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"View:Popup:AddAccount":77,"_":25,"ko":22,"window":26}],50:[function(require,module,exports){
+ }());
-(function (module, require) {
+/***/ },
- 'use strict';
+/***/ 51:
+/*!************************************!*\
+ !*** ./dev/Models/AccountModel.js ***!
+ \************************************/
+/***/ function(module, exports, __webpack_require__) {
- var
- _ = require('_'),
- ko = require('ko'),
+
+ (function () {
- Enums = require('Enums'),
- Utils = require('Utils'),
+ 'use strict';
- Remote = require('Storage:RainLoop:Remote')
- ;
+ var
+ ko = __webpack_require__(/*! ko */ 3),
- /**
- * @constructor
- */
- function SettingsChangePassword()
- {
- this.changeProcess = ko.observable(false);
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
- 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('');
-
- Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
- }
-
- }, function () {
- return !this.changeProcess() && '' !== this.currentPassword() &&
- '' !== this.newPassword() && '' !== this.newPassword2();
- });
-
- this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
- }
-
- SettingsChangePassword.prototype.onHide = function ()
- {
- this.changeProcess(false);
- this.currentPassword('');
- this.newPassword('');
- this.newPassword2('');
- this.errorDescription('');
- this.passwordMismatch(false);
- this.currentPassword.error(false);
- };
-
- SettingsChangePassword.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)
+ /**
+ * @constructor
+ *
+ * @param {string} sEmail
+ * @param {boolean=} bCanBeDelete = true
+ */
+ function AccountModel(sEmail, bCanBeDelete)
{
- this.currentPassword('');
- this.newPassword('');
- this.newPassword2('');
+ this.email = sEmail;
- this.passwordUpdateSuccess(true);
- this.currentPassword.error(false);
+ this.deleteAccess = ko.observable(false);
+ this.canBeDalete = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
}
- else
+
+ /**
+ * @type {string}
+ */
+ AccountModel.prototype.email = '';
+
+ /**
+ * @return {string}
+ */
+ AccountModel.prototype.changeAccountLink = function ()
{
- if (oData && Enums.Notification.CurrentPasswordIncorrect === oData.ErrorCode)
+ return __webpack_require__(/*! Common/LinkBuilder */ 11).change(this.email);
+ };
+
+ module.exports = AccountModel;
+
+ }());
+
+/***/ },
+
+/***/ 52:
+/*!***************************************!*\
+ !*** ./dev/Models/AttachmentModel.js ***!
+ \***************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11)
+ ;
+
+ /**
+ * @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.currentPassword.error(true);
+ 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;
}
- this.passwordUpdateError(true);
- this.errorDescription(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
- Utils.getNotification(Enums.Notification.CouldNotSaveNewPassword));
- }
- };
+ return bResult;
+ };
- module.exports = SettingsChangePassword;
-
-}(module, require));
-},{"Enums":7,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],51:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Utils = require('Utils'),
-
- Remote = require('Storage:RainLoop:Remote'),
- Data = require('Storage:RainLoop:Data')
- ;
-
- /**
- * @constructor
- */
- function SettingsContacts()
- {
- this.contactsAutosave = Data.contactsAutosave;
-
- this.allowContactsSync = Data.allowContactsSync;
- this.enableContactsSync = Data.enableContactsSync;
- this.contactsSyncUrl = Data.contactsSyncUrl;
- this.contactsSyncUser = Data.contactsSyncUser;
- this.contactsSyncPass = Data.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 () {
- Remote.saveContactsSyncData(null,
- this.enableContactsSync(),
- this.contactsSyncUrl(),
- this.contactsSyncUser(),
- this.contactsSyncPass()
+ /**
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.isImage = function ()
+ {
+ return -1 < Utils.inArray(this.mimeType.toLowerCase(),
+ ['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
);
- }, this);
- }
+ };
- SettingsContacts.prototype.onBuild = function ()
- {
- Data.contactsAutosave.subscribe(function (bValue) {
- Remote.saveSettings(Utils.emptyFunction, {
- 'ContactsAutosave': bValue ? '1' : '0'
- });
- });
- };
+ /**
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.isText = function ()
+ {
+ return 'text/' === this.mimeType.substr(0, 5) &&
+ -1 === Utils.inArray(this.mimeType, ['text/html']);
+ };
- module.exports = SettingsContacts;
+ /**
+ * @return {boolean}
+ */
+ AttachmentModel.prototype.isPdf = function ()
+ {
+ return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
+ };
-}(module, require));
-},{"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"ko":22}],52:[function(require,module,exports){
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.linkDownload = function ()
+ {
+ return LinkBuilder.attachmentDownload(this.download);
+ };
-(function (module, require) {
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.linkPreview = function ()
+ {
+ return LinkBuilder.attachmentPreview(this.download);
+ };
- 'use strict';
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.linkPreviewAsPlain = function ()
+ {
+ return LinkBuilder.attachmentPreviewAsPlain(this.download);
+ };
- var
- ko = require('ko'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function SettingsFilters()
- {
- this.filters = ko.observableArray([]);
- this.filters.loading = ko.observable(false);
-
- this.filters.subscribe(function () {
- Utils.windowResize();
- });
- }
-
- SettingsFilters.prototype.deleteFilter = function (oFilter)
- {
- this.filters.remove(oFilter);
- };
-
- SettingsFilters.prototype.addFilter = function ()
- {
- var
- FilterModel = require('Model:Filter')
- ;
-
- require('App:Knoin').showScreenPopup(
- require('View:Popup:Filter'), [new FilterModel()]);
- };
-
- module.exports = SettingsFilters;
-
-}(module, require));
-},{"App:Knoin":27,"Model:Filter":39,"Utils":14,"View:Popup:Filter":84,"ko":22}],53:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Cache = require('Storage:RainLoop:Cache'),
- Remote = require('Storage:RainLoop:Remote'),
- LocalStorage = require('Storage:LocalStorage')
- ;
-
- /**
- * @constructor
- */
- function SettingsFolders()
- {
- this.foldersListError = Data.foldersListError;
- this.folderList = Data.folderList;
-
- this.processText = ko.computed(function () {
-
- var
- bLoading = Data.foldersLoading(),
- bCreating = Data.foldersCreating(),
- bDeleting = Data.foldersDeleting(),
- bRenaming = Data.foldersRenaming()
- ;
-
- if (bCreating)
+ /**
+ * @return {string}
+ */
+ AttachmentModel.prototype.generateTransferDownloadUrl = function ()
+ {
+ var sLink = this.linkDownload();
+ if ('http' !== sLink.substr(0, 4))
{
- return Utils.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
+ sLink = window.location.protocol + '//' + window.location.host + window.location.pathname + sLink;
}
- else if (bDeleting)
+
+ 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)
{
- 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');
+ oLocalEvent.dataTransfer.setData('DownloadURL', this.generateTransferDownloadUrl());
}
- 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 = !!Settings.settingsGet('UseImapSubscribe');
- }
-
- SettingsFolders.prototype.folderEditOnEnter = function (oFolder)
- {
- var
- sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : ''
- ;
-
- if ('' !== sEditName && oFolder.name() !== sEditName)
- {
- LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
-
- Data.foldersRenaming(true);
- Remote.folderRename(function (sResult, oData) {
-
- Data.foldersRenaming(false);
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- Data.foldersListError(
- oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
- }
-
- require('App:RainLoop').folders();
-
- }, oFolder.fullNameRaw, sEditName);
-
- Cache.removeFolderFromCacheList(oFolder.fullNameRaw);
-
- oFolder.name(sEditName);
- }
-
- oFolder.edited(false);
- };
-
- SettingsFolders.prototype.folderEditOnEsc = function (oFolder)
- {
- if (oFolder)
- {
- oFolder.edited(false);
- }
- };
-
- SettingsFolders.prototype.onShow = function ()
- {
- Data.foldersListError('');
- };
-
- SettingsFolders.prototype.createFolder = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:FolderCreate'));
- };
-
- SettingsFolders.prototype.systemFolder = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:FolderSystem'));
- };
-
- 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)
- {
- LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
-
- Data.folderList.remove(fRemoveFolder);
-
- Data.foldersDeleting(true);
- Remote.folderDelete(function (sResult, oData) {
-
- Data.foldersDeleting(false);
- if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
- {
- Data.foldersListError(
- oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
- }
-
- require('App:RainLoop').folders();
-
- }, oFolderToRemove.fullNameRaw);
-
- Cache.removeFolderFromCacheList(oFolderToRemove.fullNameRaw);
- }
- }
- else if (0 < oFolderToRemove.privateMessageCountAll())
- {
- Data.foldersListError(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
- }
- };
-
- SettingsFolders.prototype.subscribeFolder = function (oFolder)
- {
- LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
- Remote.folderSetSubscribe(Utils.emptyFunction, oFolder.fullNameRaw, true);
-
- oFolder.subScribed(true);
- };
-
- SettingsFolders.prototype.unSubscribeFolder = function (oFolder)
- {
- LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
- Remote.folderSetSubscribe(Utils.emptyFunction, oFolder.fullNameRaw, false);
-
- oFolder.subScribed(false);
- };
-
- module.exports = SettingsFolders;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Storage:LocalStorage":65,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:Popup:FolderCreate":86,"View:Popup:FolderSystem":87,"ko":22}],54:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @constructor
- */
- function SettingsGeneral()
- {
- this.mainLanguage = Data.mainLanguage;
- this.mainMessagesPerPage = Data.mainMessagesPerPage;
- this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
- this.editorDefaultType = Data.editorDefaultType;
- this.showImages = Data.showImages;
- this.interfaceAnimation = Data.interfaceAnimation;
- this.useDesktopNotifications = Data.useDesktopNotifications;
- this.threading = Data.threading;
- this.useThreads = Data.useThreads;
- this.replySameFolder = Data.replySameFolder;
- this.layout = Data.layout;
- this.usePreviewPane = Data.usePreviewPane;
- this.useCheckboxesInList = Data.useCheckboxesInList;
- this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
-
- this.isDesktopNotificationsSupported = ko.computed(function () {
- return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions();
- });
-
- this.isDesktopNotificationsDenied = ko.computed(function () {
- return Enums.DesktopNotifications.NotSupported === Data.desktopNotificationsPermisions() ||
- Enums.DesktopNotifications.Denied === Data.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;
- }
-
- 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
- f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self)
- ;
-
- Data.language.subscribe(function (sValue) {
-
- self.languageTrigger(Enums.SaveSettingsStep.Animate);
-
- $.ajax({
- 'url': LinkBuilder.langLink(sValue),
- 'dataType': 'script',
- 'cache': true
- }).done(function() {
- Utils.i18nReload();
- self.languageTrigger(Enums.SaveSettingsStep.TrueResult);
- }).fail(function() {
- self.languageTrigger(Enums.SaveSettingsStep.FalseResult);
- }).always(function() {
- _.delay(function () {
- self.languageTrigger(Enums.SaveSettingsStep.Idle);
- }, 1000);
- });
-
- Remote.saveSettings(Utils.emptyFunction, {
- 'Language': sValue
- });
- });
-
- Data.editorDefaultType.subscribe(function (sValue) {
- Remote.saveSettings(Utils.emptyFunction, {
- 'EditorDefaultType': sValue
- });
- });
-
- Data.messagesPerPage.subscribe(function (iValue) {
- Remote.saveSettings(f1, {
- 'MPP': iValue
- });
- });
-
- Data.showImages.subscribe(function (bValue) {
- Remote.saveSettings(Utils.emptyFunction, {
- 'ShowImages': bValue ? '1' : '0'
- });
- });
-
- Data.interfaceAnimation.subscribe(function (sValue) {
- Remote.saveSettings(Utils.emptyFunction, {
- 'InterfaceAnimation': sValue
- });
- });
-
- Data.useDesktopNotifications.subscribe(function (bValue) {
- Utils.timeOutAction('SaveDesktopNotifications', function () {
- Remote.saveSettings(Utils.emptyFunction, {
- 'DesktopNotifications': bValue ? '1' : '0'
- });
- }, 3000);
- });
-
- Data.replySameFolder.subscribe(function (bValue) {
- Utils.timeOutAction('SaveReplySameFolder', function () {
- Remote.saveSettings(Utils.emptyFunction, {
- 'ReplySameFolder': bValue ? '1' : '0'
- });
- }, 3000);
- });
-
- Data.useThreads.subscribe(function (bValue) {
-
- Data.messageList([]);
-
- Remote.saveSettings(Utils.emptyFunction, {
- 'UseThreads': bValue ? '1' : '0'
- });
- });
-
- Data.layout.subscribe(function (nValue) {
-
- Data.messageList([]);
-
- Remote.saveSettings(Utils.emptyFunction, {
- 'Layout': nValue
- });
- });
-
- Data.useCheckboxesInList.subscribe(function (bValue) {
- Remote.saveSettings(Utils.emptyFunction, {
- 'UseCheckboxesInList': bValue ? '1' : '0'
- });
- });
-
- }, 50);
- };
-
- SettingsGeneral.prototype.onShow = function ()
- {
- Data.desktopNotifications.valueHasMutated();
- };
-
- SettingsGeneral.prototype.selectLanguage = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:Languages'));
- };
-
- module.exports = SettingsGeneral;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"Consts":6,"Enums":7,"Globals":9,"LinkBuilder":11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"View:Popup:Languages":90,"_":25,"ko":22}],55:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- HtmlEditor = require('HtmlEditor'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @constructor
- */
- function SettingsIdentities()
- {
- this.editor = null;
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- this.accountEmail = Data.accountEmail;
- this.displayName = Data.displayName;
- this.signature = Data.signature;
- this.signatureToAll = Data.signatureToAll;
- this.replyTo = Data.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 = Data.identities;
- this.defaultIdentityID = Data.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 Data.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);
- }
- }
- ]});
- }
-
- /**
- *
- * @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 ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:Identity'));
- };
-
- SettingsIdentities.prototype.editIdentity = function (oIdentity)
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:Identity'), [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);
-
- Remote.identityDelete(function () {
- require('App:RainLoop').accountsAndIdentities();
- }, oIdentityToRemove.id);
- }
- }
- };
-
- SettingsIdentities.prototype.onFocus = function ()
- {
- if (!this.editor && this.signatureDom())
- {
- var
- self = this,
- sSignature = Data.signature()
- ;
-
- this.editor = new HtmlEditor(self.signatureDom(), function () {
- 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
- f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self),
- f4 = Utils.settingsSaveHelperSimpleFunction(self.defaultIdentityIDTrigger, self)
- ;
-
- Data.defaultIdentityID.subscribe(function (sValue) {
- Remote.saveSettings(f4, {
- 'DefaultIdentityID': sValue
- });
- });
-
- Data.displayName.subscribe(function (sValue) {
- Remote.saveSettings(f1, {
- 'DisplayName': sValue
- });
- });
-
- Data.replyTo.subscribe(function (sValue) {
- Remote.saveSettings(f2, {
- 'ReplyTo': sValue
- });
- });
-
- Data.signature.subscribe(function (sValue) {
- Remote.saveSettings(f3, {
- 'Signature': sValue
- });
- });
-
- Data.signatureToAll.subscribe(function (bValue) {
- Remote.saveSettings(null, {
- 'SignatureToAll': bValue ? '1' : '0'
- });
- });
-
- }, 50);
- };
-
- module.exports = SettingsIdentities;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"HtmlEditor":10,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"View:Popup:Identity":88,"_":25,"ko":22}],56:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- HtmlEditor = require('HtmlEditor'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @constructor
- */
- function SettingsIdentity()
- {
- this.editor = null;
-
- this.displayName = Data.displayName;
- this.signature = Data.signature;
- this.signatureToAll = Data.signatureToAll;
- this.replyTo = Data.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);
- }
-
- SettingsIdentity.prototype.onFocus = function ()
- {
- if (!this.editor && this.signatureDom())
- {
- var
- self = this,
- sSignature = Data.signature()
- ;
-
- this.editor = new HtmlEditor(self.signatureDom(), function () {
- 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
- f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
- f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
- f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
- ;
-
- Data.displayName.subscribe(function (sValue) {
- Remote.saveSettings(f1, {
- 'DisplayName': sValue
- });
- });
-
- Data.replyTo.subscribe(function (sValue) {
- Remote.saveSettings(f2, {
- 'ReplyTo': sValue
- });
- });
-
- Data.signature.subscribe(function (sValue) {
- Remote.saveSettings(f3, {
- 'Signature': sValue
- });
- });
-
- Data.signatureToAll.subscribe(function (bValue) {
- Remote.saveSettings(null, {
- 'SignatureToAll': bValue ? '1' : '0'
- });
- });
-
- }, 50);
- };
-
- module.exports = SettingsIdentity;
-
-}(module, require));
-},{"Enums":7,"HtmlEditor":10,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],57:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- kn = require('App:Knoin'),
-
- Data = require('Storage:RainLoop:Data')
- ;
-
- /**
- * @constructor
- */
- function SettingsOpenPGP()
- {
- this.openpgpkeys = Data.openpgpkeys;
- this.openpgpkeysPublic = Data.openpgpkeysPublic;
- this.openpgpkeysPrivate = 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);
- }
- }
- ]});
- }
-
- SettingsOpenPGP.prototype.addOpenPgpKey = function ()
- {
- kn.showScreenPopup(require('View:Popup:AddOpenPgpKey'));
- };
-
- SettingsOpenPGP.prototype.generateOpenPgpKey = function ()
- {
- kn.showScreenPopup(require('View:Popup:NewOpenPgpKey'));
- };
-
- SettingsOpenPGP.prototype.viewOpenPgpKey = function (oOpenPgpKey)
- {
- if (oOpenPgpKey)
- {
- kn.showScreenPopup(require('View:Popup:ViewOpenPgpKey'), [oOpenPgpKey]);
- }
- };
-
- /**
- * @param {OpenPgpKeyModel} oOpenPgpKeyToRemove
- */
- SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
- {
- if (oOpenPgpKeyToRemove && oOpenPgpKeyToRemove.deleteAccess())
- {
- this.openPgpKeyForDeletion(null);
-
- if (oOpenPgpKeyToRemove && Data.openpgpKeyring)
- {
- this.openpgpkeys.remove(function (oOpenPgpKey) {
- return oOpenPgpKeyToRemove === oOpenPgpKey;
- });
-
- Data.openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
- .removeForId(oOpenPgpKeyToRemove.guid);
-
- Data.openpgpKeyring.store();
-
- require('App:RainLoop').reloadOpenPgpKeys();
- }
- }
- };
-
- module.exports = SettingsOpenPGP;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Storage:RainLoop:Data":64,"View:Popup:AddOpenPgpKey":78,"View:Popup:NewOpenPgpKey":91,"View:Popup:ViewOpenPgpKey":93,"ko":22}],58:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- ko = require('ko'),
-
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
-
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @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);
- }
-
- SettingsSecurity.prototype.showSecret = function ()
- {
- this.secreting(true);
- Remote.showTwoFactorSecret(this.onSecretResult);
- };
-
- SettingsSecurity.prototype.hideSecret = function ()
- {
- this.viewSecret('');
- this.viewBackupCodes('');
- this.viewUrl('');
- };
-
- SettingsSecurity.prototype.createTwoFactor = function ()
- {
- this.processing(true);
- Remote.createTwoFactor(this.onResult);
- };
-
- SettingsSecurity.prototype.enableTwoFactor = function ()
- {
- this.processing(true);
- Remote.enableTwoFactor(this.onResult, this.viewEnable());
- };
-
- SettingsSecurity.prototype.testTwoFactor = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:TwoFactorTest'));
- };
-
- SettingsSecurity.prototype.clearTwoFactor = function ()
- {
- this.viewSecret('');
- this.viewBackupCodes('');
- this.viewUrl('');
-
- this.clearing(true);
- 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)
- {
- 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);
- Remote.getTwoFactor(this.onResult);
- };
-
- module.exports = SettingsSecurity;
-
-}(module, require));
-},{"App:Knoin":27,"Enums":7,"Globals":9,"Storage:RainLoop:Remote":68,"Utils":14,"View:Popup:TwoFactorTest":92,"ko":22}],59:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- /**
- * @constructor
- */
- function SettingsSocial()
- {
- var
- Utils = require('Utils'),
- Data = require('Storage:RainLoop:Data')
- ;
-
- this.googleEnable = Data.googleEnable;
-
- this.googleActions = Data.googleActions;
- this.googleLoggined = Data.googleLoggined;
- this.googleUserName = Data.googleUserName;
-
- this.facebookEnable = Data.facebookEnable;
-
- this.facebookActions = Data.facebookActions;
- this.facebookLoggined = Data.facebookLoggined;
- this.facebookUserName = Data.facebookUserName;
-
- this.twitterEnable = Data.twitterEnable;
-
- this.twitterActions = Data.twitterActions;
- this.twitterLoggined = Data.twitterLoggined;
- this.twitterUserName = Data.twitterUserName;
-
- this.connectGoogle = Utils.createCommand(this, function () {
- if (!this.googleLoggined())
- {
- require('App:RainLoop').googleConnect();
- }
- }, function () {
- return !this.googleLoggined() && !this.googleActions();
- });
-
- this.disconnectGoogle = Utils.createCommand(this, function () {
- require('App:RainLoop').googleDisconnect();
- });
-
- this.connectFacebook = Utils.createCommand(this, function () {
- if (!this.facebookLoggined())
- {
- require('App:RainLoop').facebookConnect();
- }
- }, function () {
- return !this.facebookLoggined() && !this.facebookActions();
- });
-
- this.disconnectFacebook = Utils.createCommand(this, function () {
- require('App:RainLoop').facebookDisconnect();
- });
-
- this.connectTwitter = Utils.createCommand(this, function () {
- if (!this.twitterLoggined())
- {
- require('App:RainLoop').twitterConnect();
- }
- }, function () {
- return !this.twitterLoggined() && !this.twitterActions();
- });
-
- this.disconnectTwitter = Utils.createCommand(this, function () {
- require('App:RainLoop').twitterDisconnect();
- });
- }
-
- module.exports = SettingsSocial;
-
-}(module, require));
-},{"App:RainLoop":3,"Storage:RainLoop:Data":64,"Utils":14}],60:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote')
- ;
-
- /**
- * @constructor
- */
- function SettingsThemes()
- {
- var self = this;
-
- this.mainTheme = Data.mainTheme;
- this.themesObjects = ko.observableArray([]);
-
- this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
-
- this.oLastAjax = null;
- this.iTimer = 0;
-
- 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;
- });
- }
-
- Remote.saveSettings(null, {
- 'Theme': sValue
- });
-
- }, this);
- }
-
- SettingsThemes.prototype.onBuild = function ()
- {
- var sCurrentTheme = Data.theme();
- this.themesObjects(_.map(Data.themes(), function (sTheme) {
- return {
- 'name': sTheme,
- 'nameDisplay': Utils.convertThemeName(sTheme),
- 'selected': ko.observable(sTheme === sCurrentTheme),
- 'themePreviewSrc': LinkBuilder.themePreviewLink(sTheme)
- };
- }));
- };
-
- module.exports = SettingsThemes;
-
-}(module, require));
-},{"$":20,"Enums":7,"LinkBuilder":11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22,"window":26}],61:[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'),
-
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- */
- function AbstractData()
- {
- Utils.initDataConstructorBySettings(this);
- }
-
- AbstractData.prototype.populateDataOnStart = function()
- {
- var
- mLayout = Utils.pInt(Settings.settingsGet('Layout')),
- aLanguages = Settings.settingsGet('Languages'),
- aThemes = Settings.settingsGet('Themes')
- ;
-
- if (Utils.isArray(aLanguages))
- {
- this.languages(aLanguages);
- }
-
- if (Utils.isArray(aThemes))
- {
- this.themes(aThemes);
- }
-
- this.mainLanguage(Settings.settingsGet('Language'));
- this.mainTheme(Settings.settingsGet('Theme'));
-
- this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
- this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
- this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
- this.determineUserLanguage(!!Settings.settingsGet('DetermineUserLanguage'));
- this.determineUserDomain(!!Settings.settingsGet('DetermineUserDomain'));
-
- this.capaThemes(Settings.capa(Enums.Capa.Themes));
- this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
- this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
- this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
-
- this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
- this.showImages(!!Settings.settingsGet('ShowImages'));
- this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
- this.interfaceAnimation(Settings.settingsGet('InterfaceAnimation'));
-
- this.mainMessagesPerPage(Settings.settingsGet('MPP'));
-
- this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
- this.useThreads(!!Settings.settingsGet('UseThreads'));
- this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
- this.useCheckboxesInList(!!Settings.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(!!Settings.settingsGet('SupportedFacebookSocial'));
- this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
- this.facebookAppID(Settings.settingsGet('FacebookAppID'));
- this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
-
- this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
- this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
- this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
-
- this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
- this.googleClientID(Settings.settingsGet('GoogleClientID'));
- this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
- this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
-
- this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
- this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
-
- this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
- };
-
- module.exports = AbstractData;
-
-}(module, require));
-},{"Enums":7,"Storage:Settings":69,"Utils":14}],62:[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('$'),
-
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Plugins = require('Plugins'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- */
- function AbstractRemoteStorage()
- {
- this.oRequests = {};
- }
-
- AbstractRemoteStorage.prototype.oRequests = {};
-
- /**
- * @param {?Function} fCallback
- * @param {string} sRequestAction
- * @param {string} sType
- * @param {?AjaxJsonDefaultResponse} oData
- * @param {boolean} bCached
- * @param {*=} oRequestParameters
- */
- AbstractRemoteStorage.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.__APP)
- {
- Globals.__APP.loginAndLogoutReload(true);
- }
- }
-
- if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
- {
- if (window.__rlah_clear)
- {
- window.__rlah_clear();
- }
-
- if (Globals.__APP)
- {
- Globals.__APP.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}
- */
- AbstractRemoteStorage.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'] = Settings.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 = []
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.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
- */
- AbstractRemoteStorage.prototype.getPublicKey = function (fCallback)
- {
- this.defaultRequest(fCallback, 'GetPublicKey');
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sVersion
- */
- AbstractRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
- {
- this.defaultRequest(fCallback, 'Version', {
- 'Version': sVersion
- });
- };
-
- module.exports = AbstractRemoteStorage;
-
-}(module, require));
-},{"$":20,"Consts":6,"Enums":7,"Globals":9,"LinkBuilder":11,"Plugins":12,"Storage:Settings":69,"Utils":14,"_":25,"window":26}],63:[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'),
-
- Settings = require('Storage:Settings')
- ;
-
- /**
- * @constructor
- */
- function CacheStorage()
- {
- this.oFoldersCache = {};
- this.oFoldersNamesCache = {};
- this.oFolderHashCache = {};
- this.oFolderUidNextCache = {};
- this.oMessageListHashCache = {};
- this.oMessageFlagsCache = {};
- this.oNewMessage = {};
- this.oRequestedMessage = {};
-
- this.bCapaGravatar = Settings.capa(Enums.Capa.Gravatar);
- }
-
- /**
- * @type {boolean}
- */
- CacheStorage.prototype.bCapaGravatar = false;
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oFoldersCache = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oFoldersNamesCache = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oFolderHashCache = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oFolderUidNextCache = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oMessageListHashCache = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oMessageFlagsCache = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oBodies = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oNewMessage = {};
-
- /**
- * @type {Object}
- */
- CacheStorage.prototype.oRequestedMessage = {};
-
- CacheStorage.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}
- */
- CacheStorage.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}
- */
- CacheStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
- {
- return sFolderFullNameRaw + '#' + sUid;
- };
-
- /**
- * @param {string} sFolder
- * @param {string} sUid
- */
- CacheStorage.prototype.addRequestedMessage = function (sFolder, sUid)
- {
- this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
- };
-
- /**
- * @param {string} sFolder
- * @param {string} sUid
- * @return {boolean}
- */
- CacheStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
- {
- return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUid
- */
- CacheStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
- {
- this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUid
- */
- CacheStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
- {
- if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
- {
- this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = null;
return true;
- }
+ };
- return false;
- };
-
- CacheStorage.prototype.clearNewMessageCache = function ()
- {
- this.oNewMessage = {};
- };
-
- /**
- * @param {string} sFolderHash
- * @return {string}
- */
- CacheStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
- {
- return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
- };
-
- /**
- * @param {string} sFolderHash
- * @param {string} sFolderFullNameRaw
- */
- CacheStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
- {
- this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @return {string}
- */
- CacheStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
- {
- return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @param {string} sFolderHash
- */
- CacheStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
- {
- this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @return {string}
- */
- CacheStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
- {
- return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @param {string} sUidNext
- */
- CacheStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
- {
- this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @return {?FolderModel}
- */
- CacheStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
- {
- return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @param {?FolderModel} oFolder
- */
- CacheStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
- {
- this.oFoldersCache[sFolderFullNameRaw] = oFolder;
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- */
- CacheStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
- {
- this.setFolderToCacheList(sFolderFullNameRaw, null);
- };
-
- /**
- * @param {string} sFolderFullName
- * @param {string} sUid
- * @return {?Array}
- */
- CacheStorage.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
- */
- CacheStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
- {
- if (!this.oMessageFlagsCache[sFolderFullName])
- {
- this.oMessageFlagsCache[sFolderFullName] = {};
- }
-
- this.oMessageFlagsCache[sFolderFullName][sUid] = aFlagsCache;
- };
-
- /**
- * @param {string} sFolderFullName
- */
- CacheStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
- {
- this.oMessageFlagsCache[sFolderFullName] = {};
- };
-
- /**
- * @param {(MessageModel|null)} oMessage
- */
- CacheStorage.prototype.initMessageFlagsFromCache = function (oMessage)
- {
- if (oMessage)
+ AttachmentModel.prototype.iconClass = function ()
{
var
- self = this,
- aFlags = this.getMessageFlagsFromCache(oMessage.folderFullNameRaw, oMessage.uid),
- mUnseenSubUid = null,
- mFlaggedSubUid = null
+ aParts = this.mimeType.toLocaleString().split('/'),
+ sClass = 'icon-file'
;
- if (aFlags && 0 < aFlags.length)
+ if (aParts && aParts[1])
{
- oMessage.unseen(!!aFlags[0]);
- oMessage.flagged(!!aFlags[1]);
- oMessage.answered(!!aFlags[2]);
- oMessage.forwarded(!!aFlags[3]);
- oMessage.isReadReceipt(!!aFlags[4]);
+ 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';
+ }
}
- 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];
- });
+ return sClass;
+ };
- mFlaggedSubUid = _.find(oMessage.threads(), function (iSubUid) {
- var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
- return aFlags && 0 < aFlags.length && !!aFlags[1];
- });
+ module.exports = AttachmentModel;
- oMessage.hasUnseenSubMessage(mUnseenSubUid && 0 < Utils.pInt(mUnseenSubUid));
- oMessage.hasFlaggedSubMessage(mFlaggedSubUid && 0 < Utils.pInt(mFlaggedSubUid));
- }
- }
- };
+ }());
- /**
- * @param {(MessageModel|null)} oMessage
- */
- CacheStorage.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
- */
- CacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
- {
- if (Utils.isArray(aFlags) && 0 < aFlags.length)
- {
- this.setMessageFlagsToCache(sFolder, sUid, aFlags);
- }
- };
+/***/ },
- module.exports = new CacheStorage();
+/***/ 58:
+/*!***********************************!*\
+ !*** ./dev/Models/FolderModel.js ***!
+ \***********************************/
+/***/ function(module, exports, __webpack_require__) {
-}(module, require));
-},{"Enums":7,"LinkBuilder":11,"Storage:Settings":69,"Utils":14,"_":25}],64:[function(require,module,exports){
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- moment = require('moment'),
-
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings'),
- Cache = require('Storage:RainLoop:Cache'),
-
- kn = require('App:Knoin'),
-
- MessageModel = require('Model:Message'),
-
- LocalStorage = require('Storage:LocalStorage'),
- AbstractData = require('Storage:Abstract:Data')
- ;
-
- /**
- * @constructor
- * @extends AbstractData
- */
- function DataStorage()
- {
- AbstractData.call(this);
+ 'use strict';
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);
- }
- };
- }
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Events = __webpack_require__(/*! Common/Events */ 22)
;
- 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(!!Settings.settingsGet('ContactsSyncIsAllowed'));
- this.enableContactsSync = ko.observable(!!Settings.settingsGet('EnableContactsSync'));
- this.contactsSyncUrl = ko.observable(Settings.settingsGet('ContactsSyncUrl'));
- this.contactsSyncUser = ko.observable(Settings.settingsGet('ContactsSyncUser'));
- this.contactsSyncPass = ko.observable(Settings.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.__APP)
- {
- Globals.__APP.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(DataStorage.prototype, AbstractData.prototype);
-
- DataStorage.prototype.purgeMessageBodyCache = function()
- {
- var
- iCount = 0,
- oMessagesBodiesDom = null,
- iEnd = Globals.iMessageBodyCacheCount - Consts.Values.MessageBodyCacheLimit
- ;
-
- if (0 < iEnd)
+ /**
+ * @constructor
+ */
+ function FolderModel()
{
- 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++;
- }
+ 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.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 (0 < iCount)
{
- _.delay(function () {
- oMessagesBodiesDom.find('.rl-cache-purge').remove();
- }, 300);
- }
- }
- }
- };
-
- DataStorage.prototype.populateDataOnStart = function()
- {
- AbstractData.prototype.populateDataOnStart.call(this);
-
- this.accountEmail(Settings.settingsGet('Email'));
- this.accountIncLogin(Settings.settingsGet('IncLogin'));
- this.accountOutLogin(Settings.settingsGet('OutLogin'));
- this.projectHash(Settings.settingsGet('ProjectHash'));
-
- this.defaultIdentityID(Settings.settingsGet('DefaultIdentityID'));
-
- this.displayName(Settings.settingsGet('DisplayName'));
- this.replyTo(Settings.settingsGet('ReplyTo'));
- this.signature(Settings.settingsGet('Signature'));
- this.signatureToAll(!!Settings.settingsGet('SignatureToAll'));
- this.enableTwoFactor(!!Settings.settingsGet('EnableTwoFactor'));
-
- this.lastFoldersHash = LocalStorage.get(Enums.ClientSideKeyName.FoldersLashHash) || '';
-
- this.remoteSuggestions = !!Settings.settingsGet('RemoteSuggestions');
-
- this.devEmail = Settings.settingsGet('DevEmail');
- this.devPassword = Settings.settingsGet('DevPassword');
- };
-
- DataStorage.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)
+ if (Enums.FolderType.Draft === iType)
{
- var
- NotificationClass = Utils.notificationClass(),
- 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);
- }
- }
+ 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 () {
+ // Globals.$win.trigger('folder-list-folder-visibility-change');
+ // }, 100);
+ // });
+
+ this.localName = ko.computed(function () {
+
+ Globals.langChangeTrigger();
+
+ var
+ iType = this.type(),
+ sName = this.name()
;
- _.each(aNewMessages, function (oItem) {
- Cache.addNewMessageCache(sFolder, oItem.Uid);
- });
-
- if (3 < iLen)
+ if (this.isSystemFolder())
{
- fNotificationHelper(
- LinkBuilder.notificationMailIcon(),
- this.accountEmail(),
- Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
- 'COUNT': iLen
- })
- );
- }
- else
- {
- for (; iIndex < iLen; iIndex++)
+ switch (iType)
{
- fNotificationHelper(
- LinkBuilder.notificationMailIcon(),
- MessageModel.emailsToLine(MessageModel.initEmailsFromJson(aNewMessages[iIndex].From), false),
- aNewMessages[iIndex].Subject
- );
+ 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;
}
}
- }
- Cache.setFolderUidNext(sFolder, sUidNext);
- }
- };
+ return sName;
- DataStorage.prototype.hideMessageBodies = function ()
- {
- var oMessagesBodiesDom = this.messagesBodiesDom();
- if (oMessagesBodiesDom)
- {
- oMessagesBodiesDom.find('.b-text-part').hide();
- }
- };
+ }, this);
- /**
- * @param {boolean=} bBoot = false
- * @returns {Array}
- */
- DataStorage.prototype.getNextFolderNames = function (bBoot)
- {
- bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
+ this.manageFolderSystemName = ko.computed(function () {
- 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()))
+ Globals.langChangeTrigger();
+
+ var
+ sSuffix = '',
+ iType = this.type(),
+ sName = this.name()
+ ;
+
+ if (this.isSystemFolder())
+ {
+ switch (iType)
{
- aTimeouts.push([oFolder.interval, oFolder.fullNameRaw]);
+ 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 (oFolder && 0 < oFolder.subFolders().length)
- {
- fSearchFunction(oFolder.subFolders());
- }
- });
- }
- ;
+ if ('' !== sSuffix && '(' + sName + ')' === sSuffix || '(inbox)' === sSuffix.toLowerCase())
+ {
+ sSuffix = '';
+ }
- fSearchFunction(this.folderList());
+ return sSuffix;
- aTimeouts.sort(function(a, b) {
- if (a[0] < b[0])
- {
- return -1;
- }
- else if (a[0] > b[0])
- {
- return 1;
- }
+ }, this);
- 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
- */
- DataStorage.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, '');
- }
- };
-
- /**
- * @private
- * @param {Object} oMessageTextBody
- */
- DataStorage.prototype.initBlockquoteSwitcher = function (oMessageTextBody)
- {
- if (oMessageTextBody)
- {
- var $oList = $('blockquote:not(.rl-bq-switcher)', oMessageTextBody).filter(function () {
- return 0 === $(this).parent().closest('blockquote', oMessageTextBody).length;
+ this.collapsed = ko.computed({
+ 'read': function () {
+ return !this.hidden() && this.collapsedPrivate();
+ },
+ 'write': function (mValue) {
+ this.collapsedPrivate(mValue);
+ },
+ 'owner': this
});
- if ($oList && 0 < $oList.length)
- {
- $oList.each(function () {
- var $self = $(this), iH = $self.height();
- if (0 === iH || 100 < iH)
- {
- $self.addClass('rl-bq-switcher hidden-bq');
- $('')
- .insertBefore($self)
- .click(function () {
- $self.toggleClass('hidden-bq');
- Utils.windowResize();
- })
- .after('
')
- .before('
')
- ;
- }
+ 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);
+
+ // subscribe
+ this.name.subscribe(function (sValue) {
+ this.nameForEdit(sValue);
+ }, this);
+
+ this.edited.subscribe(function (bValue) {
+ if (bValue)
+ {
+ this.nameForEdit(this.name());
+ }
+ }, this);
+
+ this.messageCountUnread.subscribe(function (iUnread) {
+ if (Enums.FolderType.Inbox === this.type())
+ {
+ Events.pub('mailbox.inbox-unread-count', [iUnread]);
+ }
+ }, 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(' / ');
+ };
+
+ module.exports = FolderModel;
+
+ }());
+
+/***/ },
+
+/***/ 59:
+/*!*************************************!*\
+ !*** ./dev/Models/IdentityModel.js ***!
+ \*************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
- DataStorage.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()
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
;
- if (oData && oMessage && oData.Result && 'Object/Message' === oData.Result['@Object'] &&
- oMessage.folderFullNameRaw === oData.Result.Folder && oMessage.uid === oData.Result.Uid)
+ /**
+ * @param {string} sId
+ * @param {string} sEmail
+ * @param {boolean=} bCanBeDelete = true
+ * @constructor
+ */
+ function IdentityModel(sId, sEmail, bCanBeDelete)
{
- this.messageError('');
+ this.id = sId;
+ this.email = ko.observable(sEmail);
+ this.name = ko.observable('');
+ this.replyTo = ko.observable('');
+ this.bcc = ko.observable('');
- 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);
- }
-
- Globals.$div.empty();
- if (bPgpSigned && oMessage.isPgpSigned())
- {
- sResultHtml =
- Globals.$div.append(
- $('').text(oMessage.plainRaw)
- ).html()
- ;
- }
- else if (bPgpEncrypted && oMessage.isPgpEncrypted())
- {
- sResultHtml =
- Globals.$div.append(
- $('').text(oMessage.plainRaw)
- ).html()
- ;
- }
-
- Globals.$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)
- {
- this.initBlockquoteSwitcher(oBody);
- }
- }
-
- Cache.initMessageFlagsFromCache(oMessage);
- if (oMessage.unseen())
- {
- if (Globals.__APP)
- {
- Globals.__APP.setMessageSeen(oMessage);
- }
- }
-
- Utils.windowResize();
+ this.deleteAccess = ko.observable(false);
+ this.canBeDalete = ko.observable(bCanBeDelete);
}
- };
- /**
- * @param {Array} aList
- * @returns {string}
- */
- DataStorage.prototype.calculateMessageListHash = function (aList)
- {
- return _.map(aList, function (oMessage) {
- return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
- }).join('|');
- };
+ IdentityModel.prototype.formattedName = function ()
+ {
+ var sName = this.name();
+ return '' === sName ? this.email() : sName + ' <' + this.email() + '>';
+ };
- DataStorage.prototype.findPublicKeyByHex = function (sHash)
- {
- return _.find(this.openpgpkeysPublic(), function (oItem) {
- return oItem && sHash === oItem.id;
- });
- };
+ IdentityModel.prototype.formattedNameForCompose = function ()
+ {
+ var sName = this.name();
+ return '' === sName ? this.email() : sName + ' (' + this.email() + ')';
+ };
- DataStorage.prototype.findPublicKeysByEmail = function (sEmail)
- {
- return _.compact(_.map(this.openpgpkeysPublic(), function (oItem) {
+ IdentityModel.prototype.formattedNameForEmail = function ()
+ {
+ var sName = this.name();
+ return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
+ };
- 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) {}
- }
+ module.exports = IdentityModel;
- return null;
+ }());
- }));
- };
+/***/ },
+
+/***/ 60:
+/*!***************************************!*\
+ !*** ./dev/Models/OpenPgpKeyModel.js ***!
+ \***************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
- /**
- * @param {string} sEmail
- * @param {string=} sPassword
- * @returns {?}
- */
- DataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
- {
var
- oPrivateKey = null,
- oKey = _.find(this.openpgpkeysPrivate(), function (oItem) {
- return oItem && sEmail === oItem.email;
- })
+ ko = __webpack_require__(/*! ko */ 3)
;
- if (oKey)
+ /**
+ * @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;
+
+ module.exports = OpenPgpKeyModel;
+
+ }());
+
+/***/ },
+
+/***/ 64:
+/*!************************************!*\
+ !*** ./dev/Screens/LoginScreen.js ***!
+ \************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ KnoinAbstractScreen = __webpack_require__(/*! Knoin:AbstractScreen */ 24)
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractScreen
+ */
+ function LoginScreen()
+ {
+ KnoinAbstractScreen.call(this, 'login', [
+ __webpack_require__(/*! View:RainLoop:Login */ 96)
+ ]);
+ }
+
+ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
+
+ LoginScreen.prototype.onShow = function ()
+ {
+ __webpack_require__(/*! App:RainLoop */ 4).setTitle('');
+ };
+
+ module.exports = LoginScreen;
+
+ }());
+
+/***/ },
+
+/***/ 90:
+/*!****************************************************!*\
+ !*** ./dev/Storages/LocalStorages/CookieDriver.js ***!
+ \****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ var
+ $ = __webpack_require__(/*! $ */ 14),
+ JSON = __webpack_require__(/*! JSON */ 33),
+
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function CookieDriver()
+ {
+ }
+
+ /**
+ * @static
+ * @return {boolean}
+ */
+ CookieDriver.supported = function ()
+ {
+ return !!(window.navigator && window.navigator.cookieEnabled);
+ };
+
+ /**
+ * @param {string} sKey
+ * @param {*} mData
+ * @return {boolean}
+ */
+ CookieDriver.prototype.set = function (sKey, mData)
+ {
+ var
+ mStorageValue = $.cookie(Consts.Values.ClientSideStorageIndexName),
+ bResult = false,
+ mResult = null
+ ;
+
try
{
- oPrivateKey = window.openpgp.key.readArmored(oKey.armor);
- if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
+ mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
+ }
+ catch (oException) {}
+
+ if (!mResult)
+ {
+ mResult = {};
+ }
+
+ mResult[sKey] = mData;
+
+ try
+ {
+ $.cookie(Consts.Values.ClientSideStorageIndexName, JSON.stringify(mResult), {
+ 'expires': 30
+ });
+
+ bResult = true;
+ }
+ catch (oException) {}
+
+ return bResult;
+ };
+
+ /**
+ * @param {string} sKey
+ * @return {*}
+ */
+ CookieDriver.prototype.get = function (sKey)
+ {
+ var
+ mStorageValue = $.cookie(Consts.Values.ClientSideStorageIndexName),
+ mResult = null
+ ;
+
+ try
+ {
+ mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
+ if (mResult && !Utils.isUnd(mResult[sKey]))
{
- oPrivateKey = oPrivateKey.keys[0];
- oPrivateKey.decrypt(Utils.pString(sPassword));
+ mResult = mResult[sKey];
}
else
{
- oPrivateKey = null;
+ mResult = null;
}
}
- catch (e)
- {
- oPrivateKey = null;
- }
- }
+ catch (oException) {}
- return oPrivateKey;
- };
+ return mResult;
+ };
- /**
- * @param {string=} sPassword
- * @returns {?}
- */
- DataStorage.prototype.findSelfPrivateKey = function (sPassword)
- {
- return this.findPrivateKeyByEmail(this.accountEmail(), sPassword);
- };
+ module.exports = CookieDriver;
- module.exports = new DataStorage();
+ }());
-}(module, require));
+/***/ },
-},{"$":20,"App:Knoin":27,"Consts":6,"Enums":7,"Globals":9,"LinkBuilder":11,"Model:Message":42,"Storage:Abstract:Data":61,"Storage:LocalStorage":65,"Storage:RainLoop:Cache":63,"Storage:Settings":69,"Utils":14,"_":25,"ko":22,"moment":23,"window":26}],65:[function(require,module,exports){
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+/***/ 91:
+/*!**********************************************************!*\
+ !*** ./dev/Storages/LocalStorages/LocalStorageDriver.js ***!
+ \**********************************************************/
+/***/ function(module, exports, __webpack_require__) {
-(function (module, require) {
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
- 'use strict';
+ (function () {
- /**
- * @constructor
- */
- function LocalStorage()
- {
- var
- NextStorageDriver = require('_').find([
- require('Storage:LocalStorage:LocalStorage'),
- require('Storage:LocalStorage:Cookie')
- ], function (NextStorageDriver) {
- return NextStorageDriver && NextStorageDriver.supported();
- })
- ;
-
- this.oDriver = null;
-
- if (NextStorageDriver)
- {
- this.oDriver = new NextStorageDriver();
- }
- }
-
- /**
- * @type {LocalStorageDriver|CookieDriver|null}
- */
- 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));
-},{"Storage:LocalStorage:Cookie":66,"Storage:LocalStorage:LocalStorage":67,"_":25}],66:[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()
- {
- }
-
- /**
- * @static
- * @return {boolean}
- */
- CookieDriver.supported = function ()
- {
- return !!(window.navigator && window.navigator.cookieEnabled);
- };
-
- /**
- * @param {string} sKey
- * @param {*} mData
- * @return {boolean}
- */
- CookieDriver.prototype.set = function (sKey, mData)
- {
- var
- mStorageValue = $.cookie(Consts.Values.ClientSideStorageIndexName),
- bResult = false,
- mResult = null
- ;
-
- try
- {
- mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
- }
- catch (oException) {}
-
- if (!mResult)
- {
- mResult = {};
- }
-
- mResult[sKey] = mData;
-
- try
- {
- $.cookie(Consts.Values.ClientSideStorageIndexName, JSON.stringify(mResult), {
- 'expires': 30
- });
-
- bResult = true;
- }
- catch (oException) {}
-
- return bResult;
- };
-
- /**
- * @param {string} sKey
- * @return {*}
- */
- CookieDriver.prototype.get = function (sKey)
- {
- var
- mStorageValue = $.cookie(Consts.Values.ClientSideStorageIndexName),
- mResult = null
- ;
-
- try
- {
- mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
- if (mResult && !Utils.isUnd(mResult[sKey]))
- {
- mResult = mResult[sKey];
- }
- else
- {
- mResult = null;
- }
- }
- catch (oException) {}
-
- return mResult;
- };
-
- module.exports = CookieDriver;
-
-}(module, require));
-},{"$":20,"Consts":6,"JSON":15,"Utils":14}],67:[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'),
- JSON = require('JSON'),
-
- Consts = require('Consts'),
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function LocalStorageDriver()
- {
- }
-
- /**
- * @static
- * @return {boolean}
- */
- LocalStorageDriver.supported = function ()
- {
- return !!window.localStorage;
- };
-
- /**
- * @param {string} sKey
- * @param {*} mData
- * @return {boolean}
- */
- LocalStorageDriver.prototype.set = function (sKey, mData)
- {
- var
- mStorageValue = window.localStorage[Consts.Values.ClientSideStorageIndexName] || null,
- bResult = false,
- mResult = null
- ;
-
- try
- {
- mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
- }
- catch (oException) {}
-
- if (!mResult)
- {
- mResult = {};
- }
-
- mResult[sKey] = mData;
-
- try
- {
- window.localStorage[Consts.Values.ClientSideStorageIndexName] = JSON.stringify(mResult);
-
- bResult = true;
- }
- catch (oException) {}
-
- return bResult;
- };
-
- /**
- * @param {string} sKey
- * @return {*}
- */
- LocalStorageDriver.prototype.get = function (sKey)
- {
- var
- mStorageValue = window.localStorage[Consts.Values.ClientSideStorageIndexName] || null,
- mResult = null
- ;
-
- try
- {
- mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
- if (mResult && !Utils.isUnd(mResult[sKey]))
- {
- mResult = mResult[sKey];
- }
- else
- {
- mResult = null;
- }
- }
- catch (oException) {}
-
- return mResult;
- };
-
- module.exports = LocalStorageDriver;
-
-}(module, require));
-},{"Consts":6,"JSON":15,"Utils":14,"window":26}],68:[function(require,module,exports){
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- Utils = require('Utils'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Base64 = require('Base64'),
-
- Settings = require('Storage:Settings'),
- Cache = require('Storage:RainLoop:Cache'),
- Data = require('Storage:RainLoop:Data'),
-
- AbstractRemoteStorage = require('Storage:Abstract:Remote')
- ;
-
- /**
- * @constructor
- * @extends AbstractRemoteStorage
- */
- function RemoteStorage()
- {
- AbstractRemoteStorage.call(this);
-
- this.oRequests = {};
- }
-
- _.extend(RemoteStorage.prototype, AbstractRemoteStorage.prototype);
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.folders = function (fCallback)
- {
- this.defaultRequest(fCallback, 'Folders', {
- 'SentFolder': Settings.settingsGet('SentFolder'),
- 'DraftFolder': Settings.settingsGet('DraftFolder'),
- 'SpamFolder': Settings.settingsGet('SpamFolder'),
- 'TrashFolder': Settings.settingsGet('TrashFolder'),
- 'ArchiveFolder': Settings.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
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.getTwoFactor = function (fCallback)
- {
- this.defaultRequest(fCallback, 'GetTwoFactorInfo');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.createTwoFactor = function (fCallback)
- {
- this.defaultRequest(fCallback, 'CreateTwoFactorSecret');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.clearTwoFactor = function (fCallback)
- {
- this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.showTwoFactorSecret = function (fCallback)
- {
- this.defaultRequest(fCallback, 'ShowTwoFactorSecret');
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sCode
- */
- RemoteStorage.prototype.testTwoFactor = function (fCallback, sCode)
- {
- this.defaultRequest(fCallback, 'TestTwoFactorInfo', {
- 'Code': sCode
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {boolean} bEnable
- */
- RemoteStorage.prototype.enableTwoFactor = function (fCallback, bEnable)
- {
- this.defaultRequest(fCallback, 'EnableTwoFactor', {
- 'Enable': bEnable ? '1' : '0'
- });
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.clearTwoFactorInfo = function (fCallback)
- {
- this.defaultRequest(fCallback, 'ClearTwoFactorInfo');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.accountAdd = function (fCallback, sEmail, sLogin, sPassword)
- {
- this.defaultRequest(fCallback, 'AccountAdd', {
- 'Email': sEmail,
- 'Login': sLogin,
- 'Password': sPassword
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sEmailToDelete
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.identityDelete = function (fCallback, sIdToDelete)
- {
- this.defaultRequest(fCallback, 'IdentityDelete', {
- 'IdToDelete': sIdToDelete
- });
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent)
- {
- sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
+ 'use strict';
var
- sFolderHash = Cache.getFolderHash(sFolderFullNameRaw)
+ window = __webpack_require__(/*! window */ 12),
+ JSON = __webpack_require__(/*! JSON */ 33),
+
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
;
- 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:')))
+ /**
+ * @constructor
+ */
+ function LocalStorageDriver()
{
- this.defaultRequest(fCallback, 'MessageList', {},
- '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout,
- 'MessageList/' + Base64.urlsafe_encode([
- sFolderFullNameRaw,
- iOffset,
- iLimit,
- sSearch,
- Data.projectHash(),
- sFolderHash,
- 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '',
- Data.threading() && Data.useThreads() ? '1' : '0',
- Data.threading() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : ''
- ].join(String.fromCharCode(0))), bSilent ? [] : ['MessageList']);
- }
- else
- {
- this.defaultRequest(fCallback, 'MessageList', {
- 'Folder': sFolderFullNameRaw,
- 'Offset': iOffset,
- 'Limit': iLimit,
- 'Search': sSearch,
- 'UidNext': 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '',
- 'UseThreads': Data.threading() && Data.useThreads() ? '1' : '0',
- 'ExpandedThreadUid': Data.threading() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : ''
- }, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, '', bSilent ? [] : ['MessageList']);
- }
- };
-
- /**
- * @param {?Function} fCallback
- * @param {Array} aDownloads
- */
- RemoteStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads)
- {
- this.defaultRequest(fCallback, 'MessageUploadAttachments', {
- 'Attachments': aDownloads
- }, 999000);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {number} iUid
- * @return {boolean}
- */
- RemoteStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid)
- {
- sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
- iUid = Utils.pInt(iUid);
-
- if (Cache.getFolderFromCacheList(sFolderFullNameRaw) && 0 < iUid)
- {
- this.defaultRequest(fCallback, 'Message', {}, null,
- 'Message/' + Base64.urlsafe_encode([
- sFolderFullNameRaw,
- iUid,
- Data.projectHash(),
- Data.threading() && Data.useThreads() ? '1' : '0'
- ].join(String.fromCharCode(0))), ['Message']);
-
- return true;
}
- return false;
- };
-
- /**
- * @param {?Function} fCallback
- * @param {Array} aExternals
- */
- RemoteStorage.prototype.composeUploadExternals = function (fCallback, aExternals)
- {
- this.defaultRequest(fCallback, 'ComposeUploadExternals', {
- 'Externals': aExternals
- }, 999000);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sUrl
- * @param {string} sAccessToken
- */
- RemoteStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken)
- {
- this.defaultRequest(fCallback, 'ComposeUploadDrive', {
- 'AccessToken': sAccessToken,
- 'Url': sUrl
- }, 999000);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sFolder
- * @param {Array=} aList = []
- */
- RemoteStorage.prototype.folderInformation = function (fCallback, sFolder, aList)
- {
- var
- bRequest = true,
- aUids = []
- ;
-
- if (Utils.isArray(aList) && 0 < aList.length)
+ /**
+ * @static
+ * @return {boolean}
+ */
+ LocalStorageDriver.supported = function ()
{
- bRequest = false;
- _.each(aList, function (oMessageListItem) {
- if (!Cache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, oMessageListItem.uid))
- {
- aUids.push(oMessageListItem.uid);
- }
+ return !!window.localStorage;
+ };
- if (0 < oMessageListItem.threads().length)
- {
- _.each(oMessageListItem.threads(), function (sUid) {
- if (!Cache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, sUid))
- {
- aUids.push(sUid);
- }
- });
- }
- });
-
- if (0 < aUids.length)
- {
- bRequest = true;
- }
- }
-
- if (bRequest)
+ /**
+ * @param {string} sKey
+ * @param {*} mData
+ * @return {boolean}
+ */
+ LocalStorageDriver.prototype.set = function (sKey, mData)
{
- this.defaultRequest(fCallback, 'FolderInformation', {
- 'Folder': sFolder,
- 'FlagsUids': Utils.isArray(aUids) ? aUids.join(',') : '',
- 'UidNext': 'INBOX' === sFolder ? Cache.getFolderUidNext(sFolder) : ''
- });
- }
- else if (Data.useThreads())
- {
- if (Globals.__APP)
- {
- Globals.__APP.reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- }
- };
-
- /**
- * @param {?Function} fCallback
- * @param {Array} aFolders
- */
- RemoteStorage.prototype.folderInformationMultiply = function (fCallback, aFolders)
- {
- this.defaultRequest(fCallback, 'FolderInformationMultiply', {
- 'Folders': aFolders
- });
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.logout = function (fCallback)
- {
- this.defaultRequest(fCallback, 'Logout');
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {Array} aUids
- * @param {boolean} bSetFlagged
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.saveSystemFolders = function (fCallback, oData)
- {
- this.defaultRequest(fCallback, 'SystemFoldersUpdate', oData);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {Object} oData
- */
- RemoteStorage.prototype.saveSettings = function (fCallback, oData)
- {
- this.defaultRequest(fCallback, 'SettingsUpdate', oData);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sPrevPassword
- * @param {string} sNewPassword
- */
- RemoteStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword)
- {
- this.defaultRequest(fCallback, 'ChangePassword', {
- 'PrevPassword': sPrevPassword,
- 'NewPassword': sNewPassword
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sNewFolderName
- * @param {string} sParentName
- */
- RemoteStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName)
- {
- this.defaultRequest(fCallback, 'FolderCreate', {
- 'Folder': sNewFolderName,
- 'Parent': sParentName
- }, null, '', ['Folders']);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- */
- RemoteStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw)
- {
- this.defaultRequest(fCallback, 'FolderDelete', {
- 'Folder': sFolderFullNameRaw
- }, null, '', ['Folders']);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sPrevFolderFullNameRaw
- * @param {string} sNewFolderName
- */
- RemoteStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName)
- {
- this.defaultRequest(fCallback, 'FolderRename', {
- 'Folder': sPrevFolderFullNameRaw,
- 'NewFolderName': sNewFolderName
- }, null, '', ['Folders']);
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- */
- RemoteStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw)
- {
- this.defaultRequest(fCallback, 'FolderClear', {
- 'Folder': sFolderFullNameRaw
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sFolderFullNameRaw
- * @param {boolean} bSubscribe
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids)
- {
- this.defaultRequest(fCallback, 'MessageDelete', {
- 'Folder': sFolder,
- 'Uids': aUids.join(',')
- }, null, '', ['MessageList']);
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.appDelayStart = function (fCallback)
- {
- this.defaultRequest(fCallback, 'AppDelayStart');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.quota = function (fCallback)
- {
- this.defaultRequest(fCallback, 'Quota');
- };
-
- /**
- * @param {?Function} fCallback
- * @param {number} iOffset
- * @param {number} iLimit
- * @param {string} sSearch
- */
- RemoteStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch)
- {
- this.defaultRequest(fCallback, 'Contacts', {
- 'Offset': iOffset,
- 'Limit': iLimit,
- 'Search': sSearch
- }, null, '', ['Contacts']);
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.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
- */
- RemoteStorage.prototype.contactsDelete = function (fCallback, aUids)
- {
- this.defaultRequest(fCallback, 'ContactsDelete', {
- 'Uids': aUids.join(',')
- });
- };
-
- /**
- * @param {?Function} fCallback
- * @param {string} sQuery
- * @param {number} iPage
- */
- RemoteStorage.prototype.suggestions = function (fCallback, sQuery, iPage)
- {
- this.defaultRequest(fCallback, 'Suggestions', {
- 'Query': sQuery,
- 'Page': iPage
- }, null, '', ['Suggestions']);
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.facebookUser = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialFacebookUserInformation');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.facebookDisconnect = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialFacebookDisconnect');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.twitterUser = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialTwitterUserInformation');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.twitterDisconnect = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialTwitterDisconnect');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.googleUser = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialGoogleUserInformation');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.googleDisconnect = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialGoogleDisconnect');
- };
-
- /**
- * @param {?Function} fCallback
- */
- RemoteStorage.prototype.socialUsers = function (fCallback)
- {
- this.defaultRequest(fCallback, 'SocialUsers');
- };
-
- module.exports = new RemoteStorage();
-
-}(module, require));
-},{"Base64":5,"Consts":6,"Globals":9,"Storage:Abstract:Remote":62,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:Settings":69,"Utils":14,"_":25}],69:[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'),
-
- Utils = require('Utils')
- ;
-
- /**
- * @constructor
- */
- function SettingsStorage()
- {
- this.oSettings = window['rainloopAppData'] || {};
- this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
- }
-
- SettingsStorage.prototype.oSettings = null;
-
- /**
- * @param {string} sName
- * @return {?}
- */
- SettingsStorage.prototype.settingsGet = function (sName)
- {
- return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
- };
-
- /**
- * @param {string} sName
- * @param {?} mValue
- */
- SettingsStorage.prototype.settingsSet = function (sName, mValue)
- {
- this.oSettings[sName] = mValue;
- };
-
- /**
- * @param {string} sName
- * @return {boolean}
- */
- SettingsStorage.prototype.capa = function (sName)
- {
- var mCapa = this.settingsGet('Capa');
- return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
- };
-
-
- module.exports = new SettingsStorage();
-
-}(module, require));
-},{"Utils":14,"window":26}],70:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- kn = require('App:Knoin'),
- Settings = require('Storage:Settings'),
-
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AboutViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Center', 'About');
-
- this.version = ko.observable(Settings.settingsGet('Version'));
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:About', 'AboutViewModel'], AboutViewModel);
- _.extend(AboutViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- module.exports = AboutViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Knoin:AbstractViewModel":30,"Storage:Settings":69,"_":25,"ko":22}],71:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- ko = require('ko'),
- key = require('key'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function AbstractSystemDropDownViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Right', 'SystemDropDown');
-
- this.accounts = Data.accounts;
- this.accountEmail = Data.accountEmail;
- this.accountsLoading = Data.accountsLoading;
-
- this.accountMenuDropdownTrigger = ko.observable(false);
-
- this.capaAdditionalAccounts = Settings.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 Data.accountEmail();
- };
-
- AbstractSystemDropDownViewModel.prototype.settingsClick = function ()
- {
- require('App:Knoin').setHash(LinkBuilder.settings());
- };
-
- AbstractSystemDropDownViewModel.prototype.settingsHelp = function ()
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:KeyboardShortcutsHelp'));
- };
-
- AbstractSystemDropDownViewModel.prototype.addAccountClick = function ()
- {
- if (this.capaAdditionalAccounts)
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:AddAccount'));
- }
- };
-
- AbstractSystemDropDownViewModel.prototype.logoutClick = function ()
- {
- Remote.logout(function () {
- if (window.__rlah_clear)
- {
- window.__rlah_clear();
- }
-
- require('App:RainLoop').loginAndLogoutReload(true,
- Settings.settingsGet('ParentEmail') && 0 < Settings.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())
- {
- require('App:Knoin').showScreenPopup(require('View:Popup:KeyboardShortcutsHelp'));
- return false;
- }
- });
- };
-
- module.exports = AbstractSystemDropDownViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:Popup:AddAccount":77,"View:Popup:KeyboardShortcutsHelp":89,"_":25,"key":21,"ko":22,"window":26}],72:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function LoginViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Center', 'Login');
-
- 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(Settings.settingsGet('LoginLogo'));
- this.loginDescription = Utils.trim(Settings.settingsGet('LoginDescription'));
- this.logoCss = Utils.trim(Settings.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 = Data.allowLanguagesOnLogin;
-
- this.langRequest = ko.observable(false);
- this.mainLanguage = Data.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(),
+ mStorageValue = window.localStorage[Consts.Values.ClientSideStorageIndexName] || null,
+ bResult = false,
+ mResult = null
+ ;
- fLoginRequest = _.bind(function (sPassword) {
+ try
+ {
+ mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
+ }
+ catch (oException) {}
- Remote.login(_.bind(function (sResult, oData) {
+ if (!mResult)
+ {
+ mResult = {};
+ }
- if (Enums.StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
- {
- if (oData.Result)
+ mResult[sKey] = mData;
+
+ try
+ {
+ window.localStorage[Consts.Values.ClientSideStorageIndexName] = JSON.stringify(mResult);
+
+ bResult = true;
+ }
+ catch (oException) {}
+
+ return bResult;
+ };
+
+ /**
+ * @param {string} sKey
+ * @return {*}
+ */
+ LocalStorageDriver.prototype.get = function (sKey)
+ {
+ var
+ mStorageValue = window.localStorage[Consts.Values.ClientSideStorageIndexName] || null,
+ mResult = null
+ ;
+
+ try
+ {
+ mResult = null === mStorageValue ? null : JSON.parse(mStorageValue);
+ if (mResult && !Utils.isUnd(mResult[sKey]))
+ {
+ mResult = mResult[sKey];
+ }
+ else
+ {
+ mResult = null;
+ }
+ }
+ catch (oException) {}
+
+ return mResult;
+ };
+
+ module.exports = LocalStorageDriver;
+
+ }());
+
+/***/ },
+
+/***/ 96:
+/*!******************************************!*\
+ !*** ./dev/ViewModels/LoginViewModel.js ***!
+ \******************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+ Data = __webpack_require__(/*! Storage:RainLoop:Data */ 8),
+ Remote = __webpack_require__(/*! Storage:RainLoop:Remote */ 13),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function LoginViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Center', 'Login');
+
+ 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(Settings.settingsGet('LoginLogo'));
+ this.loginDescription = Utils.trim(Settings.settingsGet('LoginDescription'));
+ this.logoCss = Utils.trim(Settings.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 = Data.allowLanguagesOnLogin;
+
+ this.langRequest = ko.observable(false);
+ this.mainLanguage = Data.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) {
+
+ Remote.login(_.bind(function (sResult, oData) {
+
+ if (Enums.StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
{
- if (oData.TwoFactorAuth)
+ if (oData.Result)
{
- this.additionalCode('');
- this.additionalCode.visibility(true);
- this.additionalCode.focused(true);
+ if (oData.TwoFactorAuth)
+ {
+ this.additionalCode('');
+ this.additionalCode.visibility(true);
+ this.additionalCode.focused(true);
+ this.submitRequest(false);
+ }
+ else
+ {
+ __webpack_require__(/*! App:RainLoop */ 4).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
{
- require('App:RainLoop').loginAndLogoutReload();
- }
- }
- else if (oData.ErrorCode)
- {
- this.submitRequest(false);
- this.submitError(Utils.getNotification(oData.ErrorCode));
-
- if ('' === this.submitError())
- {
- this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
+ 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 (!!Settings.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported)
+ {
+ 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;
}
}
- else
+
+ if (!bRequest)
{
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 (!!Settings.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported)
- {
- 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(LinkBuilder.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(LinkBuilder.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(LinkBuilder.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);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:Login', 'LoginViewModel'], LoginViewModel);
- _.extend(LoginViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- LoginViewModel.prototype.onShow = function ()
- {
- kn.routeOff();
-
- _.delay(_.bind(function () {
- if ('' !== this.email() && '' !== this.password())
- {
- this.submitFocus(true);
- }
- else
- {
- this.emailFocus(true);
- }
-
- if (Settings.settingsGet('UserLanguage'))
- {
- $.cookie('rllang', Data.language(), {'expires': 30});
- }
-
- }, this), 100);
- };
-
- LoginViewModel.prototype.onHide = function ()
- {
- this.submitFocus(false);
- this.emailFocus(false);
- };
-
- LoginViewModel.prototype.onBuild = function ()
- {
- var
- self = this,
- sJsHash = Settings.settingsGet('JsHash'),
- fSocial = function (iErrorCode) {
- iErrorCode = Utils.pInt(iErrorCode);
- if (0 === iErrorCode)
- {
- self.submitRequest(true);
- require('App:RainLoop').loginAndLogoutReload();
+ }, this));
}
else
{
- self.submitError(Utils.getNotification(iErrorCode));
- }
- }
- ;
-
- this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
- this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
- this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial'));
-
- switch ((Settings.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(Data.devEmail);
- this.password(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 () {
- Data.language.subscribe(function (sValue) {
- self.langRequest(true);
- $.ajax({
- 'url': LinkBuilder.langLink(sValue),
- 'dataType': 'script',
- 'cache': true
- }).done(function() {
- self.bSendLanguage = true;
- Utils.i18nReload();
- $.cookie('rllang', 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(require('View:Popup:Languages'));
- };
-
- module.exports = LoginViewModel;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:Popup:Languages":90,"_":25,"ko":22,"window":26}],73:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- key = require('key'),
-
- Utils = require('Utils'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- LinkBuilder = require('LinkBuilder'),
-
- Settings = require('Storage:Settings'),
- Cache = require('Storage:RainLoop:Cache'),
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function MailBoxFolderListViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Left', 'MailFolderList');
-
- this.oContentVisible = null;
- this.oContentScrollable = null;
-
- this.messageList = Data.messageList;
- this.folderList = Data.folderList;
- this.folderListSystem = Data.folderListSystem;
- this.foldersChanging = Data.foldersChanging;
-
- this.leftPanelDisabled = Globals.leftPanelDisabled;
-
- this.iDropOverTimer = 0;
-
- this.allowContacts = !!Settings.settingsGet('ContactsIsAllowed');
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:MailBoxFolderList', 'MailBoxFolderListViewModel'], MailBoxFolderListViewModel);
- _.extend(MailBoxFolderListViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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();
- require('App:RainLoop').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
- oFolder = ko.dataFor(this)
- ;
-
- if (oFolder)
- {
- if (Enums.Layout.NoPreview === Data.layout())
- {
- Data.message(null);
- }
-
- if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
- {
- Cache.setFolderHash(oFolder.fullNameRaw, '');
- }
-
- kn.setHash(LinkBuilder.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');
+ fLoginRequest(sPassword);
}
- 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();
- require('App:RainLoop').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);
- require('App:RainLoop').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 = Globals.$html.hasClass('rl-ctrl-key-pressed'),
- aUids = oUi.helper.data('rl-uids')
- ;
-
- if (Utils.isNormal(sFromFolderFullNameRaw) && '' !== sFromFolderFullNameRaw && Utils.isArray(aUids))
- {
- require('App:RainLoop').moveMessagesToFolder(sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
- }
- }
- };
-
- MailBoxFolderListViewModel.prototype.composeClick = function ()
- {
- kn.showScreenPopup(require('View:Popup:Compose'));
- };
-
- MailBoxFolderListViewModel.prototype.createFolder = function ()
- {
- kn.showScreenPopup(require('View:Popup:FolderCreate'));
- };
-
- MailBoxFolderListViewModel.prototype.configureFolders = function ()
- {
- kn.setHash(LinkBuilder.settings('folders'));
- };
-
- MailBoxFolderListViewModel.prototype.contactsClick = function ()
- {
- if (this.allowContacts)
- {
- kn.showScreenPopup(require('View:Popup:Contacts'));
- }
- };
-
- module.exports = MailBoxFolderListViewModel;
-
-}(module, require));
-
-},{"$":20,"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Globals":9,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:Settings":69,"Utils":14,"View:Popup:Compose":82,"View:Popup:Contacts":83,"View:Popup:FolderCreate":86,"_":25,"key":21,"ko":22,"window":26}],74:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- key = require('key'),
- Jua = require('Jua'),
- ifvisible = require('ifvisible'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- LinkBuilder = require('LinkBuilder'),
- Events = require('Events'),
- Selector = require('Selector'),
-
- Settings = require('Storage:Settings'),
- Cache = require('Storage:RainLoop:Cache'),
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function MailBoxMessageListViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Right', 'MailMessageList');
-
- this.sLastUid = null;
- this.bPrefetch = false;
- this.emptySubjectValue = '';
-
- this.hideDangerousActions = !!Settings.settingsGet('HideDangerousActions');
-
- this.popupVisibility = Globals.popupVisibility;
-
- this.message = Data.message;
- this.messageList = Data.messageList;
- this.folderList = Data.folderList;
- this.currentMessage = Data.currentMessage;
- this.isMessageSelected = Data.isMessageSelected;
- this.messageListSearch = Data.messageListSearch;
- this.messageListError = Data.messageListError;
- this.folderMenuForMove = Data.folderMenuForMove;
-
- this.useCheckboxesInList = Data.useCheckboxesInList;
-
- this.mainMessageListSearch = Data.mainMessageListSearch;
- this.messageListEndFolder = Data.messageListEndFolder;
-
- this.messageListChecked = Data.messageListChecked;
- this.messageListCheckedOrSelected = Data.messageListCheckedOrSelected;
- this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
- this.messageListCompleteLoadingThrottle = Data.messageListCompleteLoadingThrottle;
-
- Utils.initOnStartOrLangChange(function () {
- this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
- }, this);
-
- this.userQuota = Data.userQuota;
- this.userUsageSize = Data.userUsageSize;
- this.userUsageProc = Data.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 !== Data.layout() ?
- 'MailMessageListItem' : 'MailMessageListItemNoPreviewPane';
- });
-
- this.messageListSearchDesc = ko.computed(function () {
- var sValue = Data.messageListEndSearch();
- return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
- });
-
- this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(Data.messageListPage, Data.messageListPageCount));
-
- this.checkAll = ko.computed({
- 'read': function () {
- return 0 < Data.messageListChecked().length;
- },
-
- 'write': function (bValue) {
- bValue = !!bValue;
- _.each(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 = Data.messageList().length,
- iC = 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 Data.spamFolder() === this.messageListEndFolder() &&
- '' !== Data.spamFolder();
- }, this);
-
- this.isSpamDisabled = ko.computed(function () {
- return Consts.Values.UnuseOptionValue === Data.spamFolder();
- }, this);
-
- this.isTrashFolder = ko.computed(function () {
- return Data.trashFolder() === this.messageListEndFolder() &&
- '' !== Data.trashFolder();
- }, this);
-
- this.isDraftFolder = ko.computed(function () {
- return Data.draftFolder() === this.messageListEndFolder() &&
- '' !== Data.draftFolder();
- }, this);
-
- this.isSentFolder = ko.computed(function () {
- return Data.sentFolder() === this.messageListEndFolder() &&
- '' !== Data.sentFolder();
- }, this);
-
- this.isArchiveFolder = ko.computed(function () {
- return Data.archiveFolder() === this.messageListEndFolder() &&
- '' !== Data.archiveFolder();
- }, this);
-
- this.isArchiveDisabled = ko.computed(function () {
- return Consts.Values.UnuseOptionValue === Data.archiveFolder();
- }, this);
-
- this.canBeMoved = this.hasCheckedOrSelectedLines;
-
- this.clearCommand = Utils.createCommand(this, function () {
- kn.showScreenPopup(require('View:Popup:FolderClear'), [Data.currentFolder()]);
- });
-
- this.multyForwardCommand = Utils.createCommand(this, function () {
- kn.showScreenPopup(require('View:Popup:Compose'), [
- Enums.ComposeType.ForwardAsAttachment, Data.messageListCheckedOrSelected()]);
- }, this.canBeMoved);
-
- this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Trash,
- Data.currentFolderFullNameRaw(),
- Data.messageListCheckedOrSelectedUidsWithSubMails(), false);
- }, this.canBeMoved);
-
- this.deleteCommand = Utils.createCommand(this, function () {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Trash,
- Data.currentFolderFullNameRaw(),
- Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.archiveCommand = Utils.createCommand(this, function () {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Archive,
- Data.currentFolderFullNameRaw(),
- Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.spamCommand = Utils.createCommand(this, function () {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Spam,
- Data.currentFolderFullNameRaw(),
- Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.notSpamCommand = Utils.createCommand(this, function () {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.NotSpam,
- Data.currentFolderFullNameRaw(),
- Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
- }, this.canBeMoved);
-
- this.moveCommand = Utils.createCommand(this, Utils.emptyFunction, this.canBeMoved);
-
- this.reloadCommand = Utils.createCommand(this, function () {
- if (!Data.messageListCompleteLoadingThrottle())
- {
- require('App:RainLoop').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)
- {
- Data.message(Data.staticMessageList.populateByMessageListItem(oMessage));
- this.populateMessageBody(Data.message());
-
- if (Enums.Layout.NoPreview === Data.layout())
- {
- kn.setHash(LinkBuilder.messagePreview(), true);
- Data.message.focused(true);
- }
- }
- else
- {
- Data.message(null);
- }
- }, this));
-
- this.selector.on('onItemGetUid', function (oMessage) {
- return oMessage ? oMessage.generateUid() : '';
- });
-
- Data.messageListEndHash.subscribe(function () {
- this.selector.scrollToTop();
- }, this);
-
- Data.layout.subscribe(function (mValue) {
- this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
- }, this);
-
- Data.layout.valueHasMutated();
-
- Events
- .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)
- ;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:MailBoxMessageList', 'MailBoxMessageListViewModel'], MailBoxMessageListViewModel);
- _.extend(MailBoxMessageListViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- /**
- * @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
- * @param {boolean} bCopy
- * @return {boolean}
- */
- MailBoxMessageListViewModel.prototype.moveSelectedMessagesToFolder = function (sToFolderFullNameRaw, bCopy)
- {
- if (this.canBeMoved())
- {
- require('App:RainLoop').moveMessagesToFolder(
- Data.currentFolderFullNameRaw(),
- Data.messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy);
- }
-
- return false;
- };
-
- MailBoxMessageListViewModel.prototype.dragAndDronHelper = function (oMessageListItem)
- {
- if (oMessageListItem)
- {
- oMessageListItem.checked(true);
- }
-
- var
- oEl = Utils.draggeblePlace(),
- aUids = Data.messageListCheckedOrSelectedUidsWithSubMails()
- ;
-
- oEl.data('rl-folder', Data.currentFolderFullNameRaw());
- oEl.data('rl-uids', aUids);
- oEl.find('.text').text('' + aUids.length);
-
- _.defer(function () {
- var aUids = 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)
- {
- Data.hideMessageBodies();
- Data.messageLoading(false);
-
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- Data.setMessage(oData, bCached);
- }
- else if (Enums.StorageResultType.Unload === sResult)
- {
- Data.message(null);
- Data.messageError('');
- }
- else if (Enums.StorageResultType.Abort !== sResult)
- {
- Data.message(null);
- Data.messageError((oData && oData.ErrorCode ?
- Utils.getNotification(oData.ErrorCode) :
- Utils.getNotification(Enums.Notification.UnknownError)));
- }
- };
-
- MailBoxMessageListViewModel.prototype.populateMessageBody = function (oMessage)
- {
- if (oMessage)
- {
- if (Remote.message(this.onMessageResponse, oMessage.folderFullNameRaw, oMessage.uid))
- {
- 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,
- iAlreadyUnread = 0
- ;
-
- if (Utils.isUnd(aMessages))
- {
- aMessages = 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);
- Cache.storeMessageFlagsToCache(oMessage);
- });
-
- oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
- }
-
- Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aUids, true);
- break;
- case Enums.MessageSetAction.UnsetSeen:
- _.each(aMessages, function (oMessage) {
- if (oMessage.unseen())
- {
- iAlreadyUnread++;
- }
-
- oMessage.unseen(true);
- Cache.storeMessageFlagsToCache(oMessage);
- });
-
- oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread + aUids.length);
- }
- Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aUids, false);
- break;
- case Enums.MessageSetAction.SetFlag:
- _.each(aMessages, function (oMessage) {
- oMessage.flagged(true);
- Cache.storeMessageFlagsToCache(oMessage);
- });
- Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aUids, true);
- break;
- case Enums.MessageSetAction.UnsetFlag:
- _.each(aMessages, function (oMessage) {
- oMessage.flagged(false);
- Cache.storeMessageFlagsToCache(oMessage);
- });
- Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aUids, false);
- break;
- }
-
- require('App:RainLoop').reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- };
-
- /**
- * @param {string} sFolderFullNameRaw
- * @param {number} iSetAction
- */
- MailBoxMessageListViewModel.prototype.setActionForAll = function (sFolderFullNameRaw, iSetAction)
- {
- var
- oFolder = null,
- aMessages = Data.messageList()
- ;
-
- if ('' !== sFolderFullNameRaw)
- {
- oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
-
- if (oFolder)
- {
- switch (iSetAction) {
- case Enums.MessageSetAction.SetSeen:
- oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- _.each(aMessages, function (oMessage) {
- oMessage.unseen(false);
- });
-
- oFolder.messageCountUnread(0);
- Cache.clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
- }
-
- Remote.messageSetSeenToAll(Utils.emptyFunction, sFolderFullNameRaw, true);
- break;
- case Enums.MessageSetAction.UnsetSeen:
- oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);
- if (oFolder)
- {
- _.each(aMessages, function (oMessage) {
- oMessage.unseen(true);
- });
-
- oFolder.messageCountUnread(oFolder.messageCountAll());
- Cache.clearMessageFlagsFromCacheByFolder(sFolderFullNameRaw);
- }
- Remote.messageSetSeenToAll(Utils.emptyFunction, sFolderFullNameRaw, false);
- break;
- }
-
- require('App:RainLoop').reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- }
- };
-
- MailBoxMessageListViewModel.prototype.listSetSeen = function ()
- {
- this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen, Data.messageListCheckedOrSelected());
- };
-
- MailBoxMessageListViewModel.prototype.listSetAllSeen = function ()
- {
- this.setActionForAll(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen);
- };
-
- MailBoxMessageListViewModel.prototype.listUnsetSeen = function ()
- {
- this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetSeen, Data.messageListCheckedOrSelected());
- };
-
- MailBoxMessageListViewModel.prototype.listSetFlags = function ()
- {
- this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetFlag, Data.messageListCheckedOrSelected());
- };
-
- MailBoxMessageListViewModel.prototype.listUnsetFlags = function ()
- {
- this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, 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;
-
- 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())
- {
- Data.messageListThreadFolder(oMessage.folderFullNameRaw);
-
- aList = 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);
- }
-
- Data.messageListThreadUids(_.uniq(aList));
-
- oMessage.lastInCollapsedThreadLoading(true);
- oMessage.lastInCollapsedThread(!oMessage.lastInCollapsedThread());
-
- require('App:RainLoop').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(LinkBuilder.mailBox(
- Data.currentFolderFullNameHash(),
- oPage.value,
- Data.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 && Settings.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 < 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(require('View:Popup:Compose'));
- 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,
- oMessage = _.find(this.messageList(), function (oMessage) {
- return oMessage &&
- !Cache.hasRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
- })
- ;
-
- if (oMessage)
- {
- this.bPrefetch = true;
-
- Cache.addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
-
- 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(require('View:Popup:Compose'));
- };
-
- MailBoxMessageListViewModel.prototype.advancedSearchClick = function ()
- {
- kn.showScreenPopup(require('View:Popup:AdvancedSearch'));
- };
-
- 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 (!Settings.settingsGet('AllowAppendMessage') || !this.dragOverArea())
- {
- 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()
- })
- ;
-
- 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'])
- {
- Data.messageListLoading(true);
- return true;
- }
-
- return false;
- }, this))
- .on('onComplete', _.bind(function () {
- require('App:RainLoop').reloadMessageList(true, true);
- }, this))
- ;
-
- return !!oJua;
- };
-
- module.exports = MailBoxMessageListViewModel;
-
-}(module, require));
-
-},{"$":20,"App:Knoin":27,"App:RainLoop":3,"Consts":6,"Enums":7,"Events":8,"Globals":9,"Jua":16,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Selector":13,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:Popup:AdvancedSearch":79,"View:Popup:Compose":82,"View:Popup:FolderClear":85,"_":25,"ifvisible":19,"key":21,"ko":22}],75:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- key = require('key'),
-
- Consts = require('Consts'),
- Enums = require('Enums'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Events = require('Events'),
-
- Cache = require('Storage:RainLoop:Cache'),
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function MailBoxMessageViewViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Right', 'MailMessageView');
-
- var
- self = this,
- sLastEmail = '',
- createCommandHelper = function (sType) {
- return Utils.createCommand(self, function () {
- this.replyOrforward(sType);
- }, self.canBeRepliedOrForwarded);
- }
- ;
-
- this.oMessageScrollerDom = null;
-
- this.message = Data.message;
- this.currentMessage = Data.currentMessage;
- this.messageListChecked = Data.messageListChecked;
- this.hasCheckedMessages = Data.hasCheckedMessages;
- this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
- this.messageLoading = Data.messageLoading;
- this.messageLoadingThrottle = Data.messageLoadingThrottle;
- this.messagesBodiesDom = Data.messagesBodiesDom;
- this.useThreads = Data.useThreads;
- this.replySameFolder = Data.replySameFolder;
- this.layout = Data.layout;
- this.usePreviewPane = Data.usePreviewPane;
- this.isMessageSelected = Data.isMessageSelected;
- this.messageActiveDom = Data.messageActiveDom;
- this.messageError = Data.messageError;
-
- this.fullScreenMode = Data.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 () {
- Data.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())
- {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Trash,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Trash,
- Data.currentFolderFullNameRaw(),
- [this.message().uid], false);
- }
- }, this.messageVisibility);
-
- this.archiveCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Archive,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- this.spamCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- require('App:RainLoop').deleteMessagesFromFolder(Enums.FolderType.Spam,
- this.message().folderFullNameRaw,
- [this.message().uid], true);
- }
- }, this.messageVisibility);
-
- this.notSpamCommand = Utils.createCommand(this, function () {
- if (this.message())
- {
- require('App:RainLoop').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.viewSize = 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.viewSize(oMessage.friendlySize());
- this.viewMoment(oMessage.momentDate());
- this.viewLineAsCcc(oMessage.lineAsCcc());
- this.viewViewLink(oMessage.viewLink());
- this.viewDownloadLink(oMessage.downloadLink());
-
- sLastEmail = oMessage.fromAsSingleEmail();
- 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)
- {
- Globals.$html.addClass('rl-message-fullscreen');
- }
- else
- {
- Globals.$html.removeClass('rl-message-fullscreen');
- }
-
- Utils.windowResize();
- });
-
- this.messageLoadingThrottle.subscribe(function (bV) {
- if (bV)
- {
- Utils.windowResize();
- }
- });
-
- this.goUpCommand = Utils.createCommand(this, function () {
- Events.pub('mailbox.message-list.selector.go-up');
- });
-
- this.goDownCommand = Utils.createCommand(this, function () {
- Events.pub('mailbox.message-list.selector.go-down');
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:MailBoxMessageView', 'MailBoxMessageViewViewModel'], MailBoxMessageViewViewModel);
- _.extend(MailBoxMessageViewViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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.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(require('View:Popup:Compose'), [sType, Data.message()]);
- };
-
- MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
- {
- var self = this;
- 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() {
- Globals.useKeyboardShortcuts(false);
- },
- 'close': function() {
- Globals.useKeyboardShortcuts(true);
- }
- },
- 'mainClass': 'mfp-fade',
- 'removalDelay': 400
- });
-
- oDom
- .on('click', 'a', function (oEvent) {
- // setup maito protocol
- return !(!!oEvent && 3 !== oEvent['which'] && Utils.mailToHelper($(this).attr('href'), require('View:Popup:Compose')));
- })
- .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)
- {
- require('App:RainLoop').download(oAttachment.linkDownload());
- }
- })
- ;
-
- this.message.focused.subscribe(function (bValue) {
- if (bValue && !Utils.inFocus()) {
- this.messageDomFocused(true);
- } else {
- this.messageDomFocused(false);
- this.scrollMessageToTop();
- this.scrollMessageToLeft();
- }
- }, this);
-
- this.messageDomFocused.subscribe(function (bValue) {
- if (!bValue && Enums.KeyState.MessageView === Globals.keyScope())
- {
- this.message.focused(false);
- }
- }, this);
-
- Globals.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 === Data.layout())
- {
- this.message(null);
- }
- else
- {
- this.message.focused(false);
- }
-
- return false;
- }
- };
-
- MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
- {
- var
- self = this
- ;
-
- // 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 !== Data.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 (Data.message())
- {
- self.replyCommand();
- return false;
- }
- });
-
- // replaAll
- key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- if (Data.message())
- {
- self.replyAllCommand();
- return false;
- }
- });
-
- // forward
- key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
- if (Data.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 (Data.message() && Data.message().body)
- {
- Data.message().body.find('.rlBlockquoteSwitcher').click();
- 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 (event, handler) {
- if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== Data.layout())
- {
- if (event && handler && 'left' === handler.shortcut)
- {
- if (self.oMessageScrollerDom && 0 < self.oMessageScrollerDom.scrollLeft())
- {
- return true;
- }
-
- self.message.focused(false);
- }
- else
- {
- self.message.focused(false);
- }
- }
- else if (self.message() && Enums.Layout.NoPreview === Data.layout() && event && handler && 'left' === handler.shortcut)
- {
return true;
- }
- return false;
- });
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
- {
- return Data.message() && Data.draftFolder() === Data.message().folderFullNameRaw;
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
- {
- return Data.message() && Data.sentFolder() === Data.message().folderFullNameRaw;
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
- {
- return Data.message() && Data.spamFolder() === Data.message().folderFullNameRaw;
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
- {
- return Data.message() && Data.spamFolder() === Consts.Values.UnuseOptionValue;
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
- {
- return Data.message() && Data.archiveFolder() === Data.message().folderFullNameRaw;
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
- {
- return Data.message() && Data.archiveFolder() === Consts.Values.UnuseOptionValue;
- };
-
- /**
- * @return {boolean}
- */
- MailBoxMessageViewViewModel.prototype.isDraftOrSentFolder = function ()
- {
- return this.isDraftFolder() || this.isSentFolder();
- };
-
- MailBoxMessageViewViewModel.prototype.composeClick = function ()
- {
- kn.showScreenPopup(require('View:Popup:Compose'));
- };
-
- MailBoxMessageViewViewModel.prototype.editMessage = function ()
- {
- if (Data.message())
- {
- kn.showScreenPopup(require('View:Popup:Compose'), [Enums.ComposeType.Draft, Data.message()]);
- }
- };
-
- MailBoxMessageViewViewModel.prototype.scrollMessageToTop = function ()
- {
- if (this.oMessageScrollerDom)
- {
- this.oMessageScrollerDom.scrollTop(0);
- Utils.windowResize();
- }
- };
-
- MailBoxMessageViewViewModel.prototype.scrollMessageToLeft = function ()
- {
- if (this.oMessageScrollerDom)
- {
- this.oMessageScrollerDom.scrollLeft(0);
- Utils.windowResize();
- }
- };
-
- /**
- * @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())
- {
- 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': Data.accountEmail()}));
-
- oMessage.isReadReceipt(true);
-
- Cache.storeMessageFlagsToCache(oMessage);
-
- require('App:RainLoop').reloadFlagsCurrentMessageListAndMessageFromCache();
- }
- };
-
- module.exports = MailBoxMessageViewViewModel;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"App:RainLoop":3,"Consts":6,"Enums":7,"Events":8,"Globals":9,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"View:Popup:Compose":82,"_":25,"key":21,"ko":22}],76:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- kn = require('App:Knoin'),
- AbstractSystemDropDownViewModel = require('View:RainLoop:AbstractSystemDropDown')
- ;
-
- /**
- * @constructor
- * @extends AbstractSystemDropDownViewModel
- */
- function MailBoxSystemDropDownViewModel()
- {
- AbstractSystemDropDownViewModel.call(this);
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:MailBoxSystemDropDown', 'MailBoxSystemDropDownViewModel'], MailBoxSystemDropDownViewModel);
- _.extend(MailBoxSystemDropDownViewModel.prototype, AbstractSystemDropDownViewModel.prototype);
-
- module.exports = MailBoxSystemDropDownViewModel;
-
-}(module, require));
-
-},{"App:Knoin":27,"View:RainLoop:AbstractSystemDropDown":71,"_":25}],77:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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);
-
- Remote.accountAdd(_.bind(function (sResult, oData) {
-
- this.submitRequest(false);
- if (Enums.StorageResultType.Success === sResult && oData && 'AccountAdd' === oData.Action)
- {
- if (oData.Result)
- {
- require('App:RainLoop').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();
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:AddAccount', 'PopupsAddAccountViewModel'], PopupsAddAccountViewModel);
- _.extend(PopupsAddAccountViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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);
- };
-
- module.exports = PopupsAddAccountViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],78:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Utils = require('Utils'),
-
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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 = 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();
-
- require('App:RainLoop').reloadOpenPgpKeys();
- Utils.delegateRun(this, 'cancelCommand');
-
- return true;
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:AddOpenPgpKey', 'PopupsAddOpenPgpKeyViewModel'], PopupsAddOpenPgpKeyViewModel);
- _.extend(PopupsAddOpenPgpKeyViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsAddOpenPgpKeyViewModel.prototype.clearPopup = function ()
- {
- this.key('');
- this.key.error(false);
- };
-
- PopupsAddOpenPgpKeyViewModel.prototype.onShow = function ()
- {
- this.clearPopup();
- };
-
- PopupsAddOpenPgpKeyViewModel.prototype.onFocus = function ()
- {
- this.key.focus(true);
- };
-
- module.exports = PopupsAddOpenPgpKeyViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Utils":14,"_":25,"ko":22}],79:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
- moment = require('moment'),
-
- Utils = require('Utils'),
-
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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)
- {
- Data.mainMessageListSearch(sSearch);
- }
-
- this.cancelCommand();
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:AdvancedSearch', 'PopupsAdvancedSearchViewModel'], PopupsAdvancedSearchViewModel);
- _.extend(PopupsAdvancedSearchViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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);
- };
-
- module.exports = PopupsAdvancedSearchViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Utils":14,"_":25,"ko":22,"moment":23}],80:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
- key = require('key'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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(['View:Popup:Ask', 'PopupsAskViewModel'], PopupsAskViewModel);
- _.extend(PopupsAskViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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));
-},{"App:Knoin":27,"Enums":7,"Knoin:AbstractViewModel":30,"Utils":14,"_":25,"key":21,"ko":22}],81:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- ko = require('ko'),
- key = require('key'),
-
- Utils = require('Utils'),
- Enums = require('Enums'),
-
- Data = require('Storage:RainLoop:Data'),
-
- EmailModel = require('Model:Email'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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,
- 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 = Data.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 = Data.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;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:ComposeOpenPgp', 'PopupsComposeOpenPgpViewModel'], PopupsComposeOpenPgpViewModel);
- _.extend(PopupsComposeOpenPgpViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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);
- };
-
- module.exports = PopupsComposeOpenPgpViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Enums":7,"Knoin:AbstractViewModel":30,"Model:Email":37,"Storage:RainLoop:Data":64,"Utils":14,"_":25,"key":21,"ko":22,"window":26}],82:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- moment = require('moment'),
- JSON = require('JSON'),
- Jua = require('Jua'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
- Globals = require('Globals'),
- Events = require('Events'),
- LinkBuilder = require('LinkBuilder'),
- HtmlEditor = require('HtmlEditor'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Cache = require('Storage:RainLoop:Cache'),
- Remote = require('Storage:RainLoop:Remote'),
-
- ComposeAttachmentModel = require('Model:ComposeAttachment'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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 = Settings.capa(Enums.Capa.AdditionalIdentities);
-
- var
- self = this,
- fCcAndBccCheckHelper = function (aValue) {
- if (false === self.showCcAndBcc() && 0 < aValue.length)
- {
- self.showCcAndBcc(true);
- }
- }
- ;
-
- this.capaOpenPGP = Data.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 = Data.identities;
- this.defaultIdentityID = Data.defaultIdentityID;
- this.currentIdentityID = ko.observable('');
-
- this.currentIdentityString = ko.observable('');
- this.currentIdentityResultEmail = ko.observable('');
-
- this.identitiesOptions = ko.computed(function () {
-
- var aList = [{
- 'optValue': Data.accountEmail(),
- 'optText': this.formattedFrom(false)
- }];
-
- _.each(Data.identities(), function (oItem) {
- aList.push({
- 'optValue': oItem.id,
- 'optText': oItem.formattedNameForCompose()
- });
+ }, function () {
+ return !this.submitRequest();
});
- return aList;
+ this.facebookLoginEnabled = ko.observable(false);
- }, this);
+ this.facebookCommand = Utils.createCommand(this, function () {
- ko.computed(function () {
+ window.open(LinkBuilder.socialFacebook(), 'Facebook',
+ 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
+ return true;
- var
- sResult = '',
- sResultEmail = '',
- oItem = null,
- aList = this.identities(),
- sID = this.currentIdentityID()
- ;
-
- if (this.bCapaAdditionalIdentities && sID && sID !== 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 () {
-
- require('App:RainLoop').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 = Data.sentFolder(),
- aFlagsCache = []
- ;
-
- if (0 < this.attachmentsInProcess().length)
- {
- this.attachmentsInProcessError(true);
- }
- else if (0 === sTo.length)
- {
- this.emptyToError(true);
- }
- else
- {
- if (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(require('View:Popup:FolderSystem'), [Enums.SetSystemFoldersNotification.Sent]);
- }
- else
- {
- this.sendError(false);
- this.sending(true);
-
- if (Utils.isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length)
- {
- aFlagsCache = Cache.getMessageFlagsFromCache(this.aDraftInfo[2], this.aDraftInfo[1]);
- if (aFlagsCache)
- {
- if ('forward' === this.aDraftInfo[0])
- {
- aFlagsCache[3] = true;
- }
- else
- {
- aFlagsCache[2] = true;
- }
-
- Cache.setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], aFlagsCache);
- require('App:RainLoop').reloadFlagsCurrentMessageListAndMessageFromCache();
- Cache.setFolderHash(this.aDraftInfo[2], '');
- }
- }
-
- sSentFolder = Consts.Values.UnuseOptionValue === sSentFolder ? '' : sSentFolder;
-
- Cache.setFolderHash(this.draftFolder(), '');
- Cache.setFolderHash(sSentFolder, '');
-
- 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 (Data.draftFolderNotEnabled())
- {
- kn.showScreenPopup(require('View:Popup:FolderSystem'), [Enums.SetSystemFoldersNotification.Draft]);
- }
- else
- {
- this.savedError(false);
- this.saving(true);
-
- this.bSkipNext = true;
-
- Cache.setFolderHash(Data.draftFolder(), '');
-
- Remote.saveMessage(
- this.saveMessageResponse,
- this.draftFolder(),
- this.draftUid(),
- 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);
-
- Events.sub('interval.1m', function () {
- if (this.modalVisibility() && !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(!!Settings.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 &&
- !!Settings.settingsGet('GoogleClientID') && !!Settings.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);
-
- this.emailsSource = _.bind(this.emailsSource, this);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Compose', 'PopupsComposeViewModel'], PopupsComposeViewModel);
- _.extend(PopupsComposeViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsComposeViewModel.prototype.emailsSource = function (oData, fResponse)
- {
- require('App:RainLoop').getAutocomplete(oData.term, function (aData) {
- fResponse(_.map(aData, function (oEmailItem) {
- return oEmailItem.toLine(false);
- }));
- });
- };
-
- PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
- {
- if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
- {
- var self = this;
- kn.showScreenPopup(require('View:Popup:ComposeOpenPgp'), [
- 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 = Data.draftFolder()
- ;
-
- if ('' !== sDraftFolder)
- {
- Cache.setFolderHash(sDraftFolder, '');
- if (Data.currentFolderFullNameRaw() === sDraftFolder)
- {
- require('App:RainLoop').reloadMessageList(true);
- }
- else
- {
- require('App:RainLoop').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'];
+ }, function () {
+ return !this.submitRequest() && this.facebookLoginEnabled();
});
- }
- oIDs[Data.accountEmail()] = Data.accountEmail();
+ this.googleLoginEnabled = ko.observable(false);
- 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;
- }
- }
+ this.googleCommand = Utils.createCommand(this, function () {
- if ('' === sResult)
- {
- sResult = this.defaultIdentityID();
- }
+ window.open(LinkBuilder.socialGoogle(), 'Google',
+ 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
+ return true;
- if ('' === sResult)
- {
- sResult = Data.accountEmail();
- }
+ }, function () {
+ return !this.submitRequest() && this.googleLoginEnabled();
+ });
- return sResult;
- };
+ this.twitterLoginEnabled = ko.observable(false);
- PopupsComposeViewModel.prototype.selectIdentity = function (oIdentity)
- {
- if (oIdentity)
- {
- this.currentIdentityID(oIdentity.optValue);
- }
- };
+ this.twitterCommand = Utils.createCommand(this, function () {
- /**
- *
- * @param {boolean=} bHeaderResult = false
- * @returns {string}
- */
- PopupsComposeViewModel.prototype.formattedFrom = function (bHeaderResult)
- {
- var
- sDisplayName = Data.displayName(),
- sEmail = Data.accountEmail()
- ;
+ window.open(LinkBuilder.socialTwitter(), 'Twitter',
+ 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
- return '' === sDisplayName ? sEmail :
- ((Utils.isUnd(bHeaderResult) ? false : !!bHeaderResult) ?
- '"' + Utils.quoteName(sDisplayName) + '" <' + sEmail + '>' :
- sDisplayName + ' (' + sEmail + ')')
- ;
- };
+ return true;
- PopupsComposeViewModel.prototype.sendMessageResponse = function (sResult, oData)
- {
- var
- bResult = false,
- sMessage = ''
- ;
+ }, function () {
+ return !this.submitRequest() && this.twitterLoginEnabled();
+ });
- 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 = Data.message();
- if (oMessage && this.draftFolder() === oMessage.folderFullNameRaw && this.draftUid() === oMessage.uid)
- {
- Data.message(null);
- }
- }
-
- this.draftFolder(oData.Result.NewFolder);
- this.draftUid(oData.Result.NewUid);
-
- if (this.modalVisibility())
- {
- this.savedTime(window.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)
- {
- 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]/g, '');
-
- sFrom = Utils.pString(sFrom);
- if ('' !== sFrom)
- {
- sSignature = sSignature.replace(/{{FROM}}/g, sFrom);
- }
-
- sSignature = sSignature.replace(/[\s]{1,2}{{FROM}}/g, '{{FROM}}');
-
- sSignature = sSignature.replace(/{{FROM}}/g, '');
- sSignature = sSignature.replace(/{{DATE}}/g, moment().format('llll'));
-
- if (sData && Enums.ComposeType.Empty === sComposeType &&
- -1 < sSignature.indexOf('{{DATA}}'))
- {
- bData = true;
- sSignature = sSignature.replace('{{DATA}}', sData);
- }
-
- sSignature = sSignature.replace(/{{DATA}}/g, '');
-
- 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 HtmlEditor(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,
- sText = '',
- sReplyTitle = '',
- aResplyAllParts = [],
- oExcludeEmail = {},
- mEmail = Data.accountEmail(),
- sSignature = Data.signature(),
- bSignatureToAll = Data.signatureToAll(),
- aDownloads = [],
- aDraftInfo = null,
- oMessage = null,
- sComposeType = sType || Enums.ComposeType.Empty,
- fEmailArrayToStringLineHelper = function (aList, bFriendly) {
+ this.socialLoginEnabled = ko.computed(function () {
var
- iIndex = 0,
- iLen = aList.length,
- aResult = []
+ bF = this.facebookLoginEnabled(),
+ bG = this.googleLoginEnabled(),
+ bT = this.twitterLoginEnabled()
;
- for (; iIndex < iLen; iIndex++)
+ return bF || bG || bT;
+ }, this);
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel(['View:RainLoop:Login', 'LoginViewModel'], LoginViewModel);
+ _.extend(LoginViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ LoginViewModel.prototype.onShow = function ()
+ {
+ kn.routeOff();
+
+ _.delay(_.bind(function () {
+ if ('' !== this.email() && '' !== this.password())
{
- 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();
- if (oText)
- {
- oText.find('blockquote.rl-bq-switcher').each(function () {
- $(this).removeClass('rl-bq-switcher hidden-bq');
- });
- oText.find('.rlBlockquoteSwitcher').each(function () {
- $(this).remove();
- });
- }
-
- oText.find('[data-html-editor-font-wrapper]').removeAttr('data-html-editor-font-wrapper');
- sText = 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 !== Data.editorDefaultType())
- {
- oEditor.modeToggle(false);
- }
- });
- }
- else if (Utils.isNonEmptyArray(oMessageOrArray))
- {
- _.each(oMessageOrArray, function (oMessage) {
- self.addMessageAsAttachment(oMessage);
- });
- }
-
- aDownloads = this.getAttachmentsDownloadsForUpload();
- if (Utils.isNonEmptyArray(aDownloads))
- {
- 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);
- }
- }
- }
- }
+ this.submitFocus(true);
}
else
{
- self.setMessageAttachmentFailedDowbloadText();
+ this.emailFocus(true);
}
- }, 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,
- PopupsAskViewModel = require('View:Popup:Ask')
- ;
-
- if (!kn.isPopupVisible(PopupsAskViewModel))
- {
- kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
- if (self.modalVisibility())
+ if (Settings.settingsGet('UserLanguage'))
{
- 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;
- });
-
- Globals.$win.on('resize', function () {
- self.triggerForResize();
- });
-
- if (this.dropboxEnabled())
- {
- oScript = window.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', Settings.settingsGet('DropboxApiKey'));
-
- window.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(Settings.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': Settings.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': Settings.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(Settings.settingsGet('AttachmentLimit')),
- oJua = new Jua({
- 'action': LinkBuilder.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(' - ' + window.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(Settings.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;
- }
-
- 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(Settings.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;
- }
-
- 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();
- };
-
- module.exports = PopupsComposeViewModel;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"App:RainLoop":3,"Consts":6,"Enums":7,"Events":8,"Globals":9,"HtmlEditor":10,"JSON":15,"Jua":16,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Model:ComposeAttachment":33,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"View:Popup:Ask":80,"View:Popup:ComposeOpenPgp":81,"View:Popup:FolderSystem":87,"_":25,"ko":22,"moment":23,"window":26}],83:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- $ = require('$'),
- ko = require('ko'),
- key = require('key'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Globals = require('Globals'),
- Utils = require('Utils'),
- Selector = require('Selector'),
- LinkBuilder = require('LinkBuilder'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- EmailModel = require('Model:Email'),
- ContactModel = require('Model:Contact'),
- ContactTagModel = require('Model:ContactTag'),
- ContactPropertyModel = require('Model:ContactProperty'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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 = Data.allowContactsSync;
- this.enableContactsSync = Data.enableContactsSync;
- this.allowExport = !Globals.bMobileDevice;
-
- this.search = ko.observable('');
- this.contactsCount = ko.observable(0);
- this.contacts = Data.contacts;
- this.contactTags = Data.contactTags;
-
- this.currentContact = ko.observable(null);
-
- this.importUploaderButton = ko.observable(null);
-
- this.contactsPage = ko.observable(1);
- this.contactsPageCount = ko.computed(function () {
- var iPage = window.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 = 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(require('View:Popup:Contacts'));
- kn.showScreenPopup(require('View:Popup:Compose'), [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()]);
- }
- });
-
- 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;
+ $.cookie('rllang', Data.language(), {'expires': 30});
}
- _.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;
- require('App:RainLoop').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;
-
- this.contactTagsSource = _.bind(this.contactTagsSource, this);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Contacts', 'PopupsContactsViewModel'], PopupsContactsViewModel);
- _.extend(PopupsContactsViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsContactsViewModel.prototype.contactTagsSource = function (oData, fResponse)
- {
- require('App:RainLoop').getContactTagsAutocomplete(oData.term, function (aData) {
- fResponse(_.map(aData, function (oTagItem) {
- return oTagItem.toLine(false);
- }));
- });
- };
-
- 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.exportVcf = function ()
- {
- require('App:RainLoop').download(LinkBuilder.exportContactsVcf());
- };
-
- PopupsContactsViewModel.prototype.exportCsv = function ()
- {
- require('App:RainLoop').download(LinkBuilder.exportContactsCsv());
- };
-
- PopupsContactsViewModel.prototype.initUploader = function ()
- {
- if (this.importUploaderButton())
- {
- var
- oJua = new Jua({
- 'action': LinkBuilder.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)
- {
- 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);
- 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([]);
- };
-
- module.exports = PopupsContactsViewModel;
-
-}(module, require));
-},{"$":20,"App:Knoin":27,"App:RainLoop":3,"Consts":6,"Enums":7,"Globals":9,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Model:Contact":34,"Model:ContactProperty":35,"Model:ContactTag":36,"Model:Email":37,"Selector":13,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"View:Popup:Compose":82,"View:Popup:Contacts":83,"_":25,"key":21,"ko":22,"window":26}],84:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Consts = require('Consts'),
- Utils = require('Utils'),
-
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsFilterViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsFilter');
-
- this.filter = ko.observable(null);
-
- this.selectedFolderValue = ko.observable(Consts.Values.UnuseOptionValue);
- this.folderSelectList = Data.folderMenuForMove;
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Filter', 'PopupsFilterViewModel'], PopupsFilterViewModel);
- _.extend(PopupsFilterViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsFilterViewModel.prototype.clearPopup = function ()
- {
- // TODO
- };
-
- PopupsFilterViewModel.prototype.onShow = function (oFilter)
- {
- this.clearPopup();
-
- this.filter(oFilter);
- };
-
- module.exports = PopupsFilterViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Consts":6,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Utils":14,"_":25,"ko":22}],85:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Data = require('Storage:RainLoop:Data'),
- Cache = require('Storage:RainLoop:Cache'),
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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)
- {
- Data.message(null);
- Data.messageList([]);
-
- this.clearingProcess(true);
-
- oFolderToClear.messageCountAll(0);
- oFolderToClear.messageCountUnread(0);
-
- Cache.setFolderHash(oFolderToClear.fullNameRaw, '');
-
- Remote.folderClear(function (sResult, oData) {
-
- self.clearingProcess(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- require('App:RainLoop').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;
-
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:FolderClear', 'PopupsFolderClearViewModel'], PopupsFolderClearViewModel);
- _.extend(PopupsFolderClearViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsFolderClearViewModel.prototype.clearPopup = function ()
- {
- this.clearingProcess(false);
- this.selectedFolder(null);
- };
-
- PopupsFolderClearViewModel.prototype.onShow = function (oFolder)
- {
- this.clearPopup();
- if (oFolder)
- {
- this.selectedFolder(oFolder);
- }
- };
-
- module.exports = PopupsFolderClearViewModel;
-
-}(module, require));
-
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],86:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
-
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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
- aTop = [],
- fDisableCallback = null,
- fVisibleCallback = null,
- aList = Data.folderList(),
- fRenameCallback = function (oItem) {
- return oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '';
- }
- ;
-
- aTop.push(['', this.sNoParentText]);
-
- if ('' !== Data.namespace)
- {
- fDisableCallback = function (oItem)
- {
- return Data.namespace !== oItem.fullNameRaw.substr(0, Data.namespace.length);
- };
- }
-
- return Utils.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
-
- }, this);
-
- // commands
- this.createFolder = Utils.createCommand(this, function () {
-
- var
- sParentFolderName = this.selectedParentValue()
- ;
-
- if ('' === sParentFolderName && 1 < Data.namespace.length)
- {
- sParentFolderName = Data.namespace.substr(0, Data.namespace.length - 1);
- }
-
- Data.foldersCreating(true);
- Remote.folderCreate(function (sResult, oData) {
-
- Data.foldersCreating(false);
- if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
- {
- require('App:RainLoop').folders();
- }
- else
- {
- 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;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:FolderCreate', 'PopupsFolderCreateViewModel'], PopupsFolderCreateViewModel);
- _.extend(PopupsFolderCreateViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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);
- };
-
- module.exports = PopupsFolderCreateViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Consts":6,"Enums":7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],87:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Consts = require('Consts'),
- Utils = require('Utils'),
-
- Settings = require('Storage:Settings'),
- Data = require('Storage:RainLoop:Data'),
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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 Utils.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
- ['', this.sChooseOnText],
- [Consts.Values.UnuseOptionValue, this.sUnuseText]
- ]);
- }, this);
-
- var
- self = this,
- fSaveSystemFolders = null,
- fCallback = null
- ;
-
- this.sentFolder = Data.sentFolder;
- this.draftFolder = Data.draftFolder;
- this.spamFolder = Data.spamFolder;
- this.trashFolder = Data.trashFolder;
- this.archiveFolder = Data.archiveFolder;
-
- fSaveSystemFolders = _.debounce(function () {
-
- Settings.settingsSet('SentFolder', self.sentFolder());
- Settings.settingsSet('DraftFolder', self.draftFolder());
- Settings.settingsSet('SpamFolder', self.spamFolder());
- Settings.settingsSet('TrashFolder', self.trashFolder());
- Settings.settingsSet('ArchiveFolder', self.archiveFolder());
-
- Remote.saveSystemFolders(Utils.emptyFunction, {
- 'SentFolder': self.sentFolder(),
- 'DraftFolder': self.draftFolder(),
- 'SpamFolder': self.spamFolder(),
- 'TrashFolder': self.trashFolder(),
- 'ArchiveFolder': self.archiveFolder(),
- 'NullFolder': 'NullFolder'
- });
-
- }, 1000);
-
- fCallback = function () {
-
- Settings.settingsSet('SentFolder', self.sentFolder());
- Settings.settingsSet('DraftFolder', self.draftFolder());
- Settings.settingsSet('SpamFolder', self.spamFolder());
- Settings.settingsSet('TrashFolder', self.trashFolder());
- Settings.settingsSet('ArchiveFolder', self.archiveFolder());
-
- fSaveSystemFolders();
+ }, this), 100);
};
- this.sentFolder.subscribe(fCallback);
- this.draftFolder.subscribe(fCallback);
- this.spamFolder.subscribe(fCallback);
- this.trashFolder.subscribe(fCallback);
- this.archiveFolder.subscribe(fCallback);
-
- this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:FolderSystem', 'PopupsFolderSystemViewModel'], PopupsFolderSystemViewModel);
- _.extend(PopupsFolderSystemViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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)
+ LoginViewModel.prototype.onHide = function ()
{
- 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.submitFocus(false);
+ this.emailFocus(false);
+ };
- this.notification(sNotification);
- };
-
- module.exports = PopupsFolderSystemViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Consts":6,"Enums":7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,"Utils":14,"_":25,"ko":22}],88:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Remote = require('Storage:RainLoop:Remote'),
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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);
-
- Remote.identityUpdate(_.bind(function (sResult, oData) {
-
- this.submitRequest(false);
- if (Enums.StorageResultType.Success === sResult && oData)
- {
- if (oData.Result)
- {
- require('App:RainLoop').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);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Identity', 'PopupsIdentityViewModel'], PopupsIdentityViewModel);
- _.extend(PopupsIdentityViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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)
+ LoginViewModel.prototype.onBuild = function ()
{
- 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 === Data.accountEmail());
- }
- };
-
- PopupsIdentityViewModel.prototype.onFocus = function ()
- {
- if (!this.owner())
- {
- this.email.focused(true);
- }
- };
-
- module.exports = PopupsIdentityViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Enums":7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],89:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- key = require('key'),
-
- Enums = require('Enums'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsKeyboardShortcutsHelpViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsKeyboardShortcutsHelp');
-
- this.sDefaultKeyScope = Enums.KeyState.PopupKeyboardShortcutsHelp;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:KeyboardShortcutsHelp', 'PopupsKeyboardShortcutsHelpViewModel'], PopupsKeyboardShortcutsHelpViewModel);
- _.extend(PopupsKeyboardShortcutsHelpViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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));
- };
-
- module.exports = PopupsKeyboardShortcutsHelpViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Enums":7,"Knoin:AbstractViewModel":30,"_":25,"key":21}],90:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Utils = require('Utils'),
- Globals = require('Globals'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsLanguagesViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
-
- this.Data = Globals.__APP.data(); // TODO
-
- this.exp = ko.observable(false);
-
- this.languages = ko.computed(function () {
- return _.map(this.Data.languages(), function (sLanguage) {
- return {
- 'key': sLanguage,
- 'selected': ko.observable(false),
- 'fullName': Utils.convertLangName(sLanguage)
- };
- });
- }, this);
-
- this.Data.mainLanguage.subscribe(function () {
- this.resetMainLanguage();
- }, this);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:Languages', 'PopupsLanguagesViewModel'], PopupsLanguagesViewModel);
- _.extend(PopupsLanguagesViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
- {
- return Utils.convertLangName(sLanguage, true);
- };
-
- PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
- {
- var sCurrent = this.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)
- {
- this.Data.mainLanguage(sLang);
- this.cancelCommand();
- };
-
- module.exports = PopupsLanguagesViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Globals":9,"Knoin:AbstractViewModel":30,"Utils":14,"_":25,"ko":22}],91:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- window = require('window'),
- _ = require('_'),
- ko = require('ko'),
-
- Utils = require('Utils'),
-
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsNewOpenPgpKeyViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsNewOpenPgpKey');
-
- 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 = Data.openpgpKeyring
+ sJsHash = Settings.settingsGet('JsHash'),
+ fSocial = function (iErrorCode) {
+ iErrorCode = Utils.pInt(iErrorCode);
+ if (0 === iErrorCode)
+ {
+ self.submitRequest(true);
+ __webpack_require__(/*! App:RainLoop */ 4).loginAndLogoutReload();
+ }
+ else
+ {
+ self.submitError(Utils.getNotification(iErrorCode));
+ }
+ }
;
- this.email.error('' === Utils.trim(this.email()));
- if (!oOpenpgpKeyring || this.email.error())
+ this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
+ this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
+ this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial'));
+
+ switch ((Settings.settingsGet('SignMe') || 'unused').toLowerCase())
{
- return false;
+ 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;
}
- sUserID = this.email();
- if ('' !== this.name())
+ this.email(Data.devEmail);
+ this.password(Data.devPassword);
+
+ if (this.googleLoginEnabled())
{
- sUserID = this.name() + ' <' + sUserID + '>';
+ window['rl_' + sJsHash + '_google_login_service'] = fSocial;
}
- this.submitRequest(true);
+ if (this.facebookLoginEnabled())
+ {
+ window['rl_' + sJsHash + '_facebook_login_service'] = fSocial;
+ }
+
+ if (this.twitterLoginEnabled())
+ {
+ window['rl_' + sJsHash + '_twitter_login_service'] = fSocial;
+ }
_.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())
+ Data.language.subscribe(function (sValue) {
+ self.langRequest(true);
+ $.ajax({
+ 'url': LinkBuilder.langLink(sValue),
+ 'dataType': 'script',
+ 'cache': true
+ }).done(function() {
+ self.bSendLanguage = true;
+ Utils.i18nReload();
+ $.cookie('rllang', Data.language(), {'expires': 30});
+ }).always(function() {
+ self.langRequest(false);
+ });
});
+ }, 50);
- if (mKeyPair && mKeyPair.privateKeyArmored)
- {
- oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored);
- oOpenpgpKeyring.publicKeys.importKey(mKeyPair.publicKeyArmored);
- oOpenpgpKeyring.store();
+ Utils.triggerAutocompleteInputChange(true);
+ };
- require('App:RainLoop').reloadOpenPgpKeys();
- Utils.delegateRun(self, 'cancelCommand');
- }
-
- self.submitRequest(false);
- }, 100);
-
- return true;
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:NewOpenPgpKey', 'PopupsNewOpenPgpKeyViewModel'], PopupsNewOpenPgpKeyViewModel);
- _.extend(PopupsNewOpenPgpKeyViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsNewOpenPgpKeyViewModel.prototype.clearPopup = function ()
- {
- this.name('');
- this.password('');
-
- this.email('');
- this.email.error(false);
- this.keyBitLength(2048);
- };
-
- PopupsNewOpenPgpKeyViewModel.prototype.onShow = function ()
- {
- this.clearPopup();
- };
-
- PopupsNewOpenPgpKeyViewModel.prototype.onFocus = function ()
- {
- this.email.focus(true);
- };
-
- module.exports = PopupsNewOpenPgpKeyViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"App:RainLoop":3,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,"Utils":14,"_":25,"ko":22,"window":26}],92:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Enums = require('Enums'),
- Utils = require('Utils'),
-
- Remote = require('Storage:RainLoop:Remote'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @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);
- 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();
- });
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:TwoFactorTest', 'PopupsTwoFactorTestViewModel'], PopupsTwoFactorTestViewModel);
- _.extend(PopupsTwoFactorTestViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- 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);
- };
-
- module.exports = PopupsTwoFactorTestViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Enums":7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Remote":68,"Utils":14,"_":25,"ko":22}],93:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- ko = require('ko'),
-
- Utils = require('Utils'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function PopupsViewOpenPgpKeyViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Popups', 'PopupsViewOpenPgpKey');
-
- this.key = ko.observable('');
- this.keyDom = ko.observable(null);
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:Popup:ViewOpenPgpKey', 'PopupsViewOpenPgpKeyViewModel'], PopupsViewOpenPgpKeyViewModel);
- _.extend(PopupsViewOpenPgpKeyViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- PopupsViewOpenPgpKeyViewModel.prototype.clearPopup = function ()
- {
- this.key('');
- };
-
- PopupsViewOpenPgpKeyViewModel.prototype.selectKey = function ()
- {
- var oEl = this.keyDom();
- if (oEl)
+ LoginViewModel.prototype.submitForm = function ()
{
- Utils.selectElement(oEl);
- }
- };
+ this.submitCommand();
+ };
- PopupsViewOpenPgpKeyViewModel.prototype.onShow = function (oOpenPgpKey)
- {
- this.clearPopup();
-
- if (oOpenPgpKey)
+ LoginViewModel.prototype.selectLanguage = function ()
{
- this.key(oOpenPgpKey.armor);
- }
- };
+ kn.showScreenPopup(__webpack_require__(/*! View:Popup:Languages */ 32));
+ };
- module.exports = PopupsViewOpenPgpKeyViewModel;
+ module.exports = LoginViewModel;
-}(module, require));
-},{"App:Knoin":27,"Knoin:AbstractViewModel":30,"Utils":14,"_":25,"ko":22}],94:[function(require,module,exports){
+ }());
-(function (module, require) {
+/***/ }
- 'use strict';
-
- var
- _ = require('_'),
-
- Globals = require('Globals'),
- LinkBuilder = require('LinkBuilder'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @param {?} oScreen
- *
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function SettingsMenuViewModel(oScreen)
- {
- KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
-
- this.leftPanelDisabled = Globals.leftPanelDisabled;
-
- this.menu = oScreen.menu;
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:SettingsMenu', 'SettingsMenuViewModel'], SettingsMenuViewModel);
- _.extend(SettingsMenuViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- SettingsMenuViewModel.prototype.link = function (sRoute)
- {
- return LinkBuilder.settings(sRoute);
- };
-
- SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
- {
- kn.setHash(LinkBuilder.inbox());
- };
-
- module.exports = SettingsMenuViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Globals":9,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"_":25}],95:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
- key = require('key'),
-
- Enums = require('Enums'),
- LinkBuilder = require('LinkBuilder'),
-
- Data = require('Storage:RainLoop:Data'),
-
- kn = require('App:Knoin'),
- KnoinAbstractViewModel = require('Knoin:AbstractViewModel')
- ;
-
- /**
- * @constructor
- * @extends KnoinAbstractViewModel
- */
- function SettingsPaneViewModel()
- {
- KnoinAbstractViewModel.call(this, 'Right', 'SettingsPane');
-
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:SettingsPane', 'SettingsPaneViewModel'], SettingsPaneViewModel);
- _.extend(SettingsPaneViewModel.prototype, KnoinAbstractViewModel.prototype);
-
- SettingsPaneViewModel.prototype.onBuild = function ()
- {
- var self = this;
- key('esc', Enums.KeyState.Settings, function () {
- self.backToMailBoxClick();
- });
- };
-
- SettingsPaneViewModel.prototype.onShow = function ()
- {
- Data.message(null);
- };
-
- SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
- {
- kn.setHash(LinkBuilder.inbox());
- };
-
- module.exports = SettingsPaneViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"Enums":7,"Knoin:AbstractViewModel":30,"LinkBuilder":11,"Storage:RainLoop:Data":64,"_":25,"key":21}],96:[function(require,module,exports){
-
-(function (module, require) {
-
- 'use strict';
-
- var
- _ = require('_'),
-
- kn = require('App:Knoin'),
- AbstractSystemDropDownViewModel = require('View:RainLoop:AbstractSystemDropDown')
- ;
-
- /**
- * @constructor
- * @extends AbstractSystemDropDownViewModel
- */
- function SettingsSystemDropDownViewModel()
- {
- AbstractSystemDropDownViewModel.call(this);
- kn.constructorEnd(this);
- }
-
- kn.extendAsViewModel(['View:RainLoop:SettingsSystemDropDown', 'SettingsSystemDropDownViewModel'], SettingsSystemDropDownViewModel);
- _.extend(SettingsSystemDropDownViewModel.prototype, AbstractSystemDropDownViewModel.prototype);
-
- module.exports = SettingsSystemDropDownViewModel;
-
-}(module, require));
-},{"App:Knoin":27,"View:RainLoop:AbstractSystemDropDown":71,"_":25}]},{},[1]);
+});
\ 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 00ff25597..000000000
--- a/rainloop/v/0.0.0/static/js/app.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
-!function e(t,s,i){function o(a,r){if(!s[a]){if(!t[a]){var l="function"==typeof require&&require;if(!r&&l)return l(a,!0);if(n)return n(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=s[a]={exports:{}};t[a][0].call(u.exports,function(e){var s=t[a][1][e];return o(s?s:e)},u,u.exports,e,t,s,i)}return s[a].exports}for(var n="function"==typeof require&&require,a=0;a').appendTo("body"),a.$win.on("error",function(t){t&&t.originalEvent&&t.originalEvent.message&&-1===r.inArray(t.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&e.jsError(r.emptyFunction,t.originalEvent.message,t.originalEvent.filename,t.originalEvent.lineno,i.location&&i.location.toString?i.location.toString():"",a.$html.attr("class"),r.microtime()-a.now)}),a.$doc.on("keydown",function(e){e&&e.ctrlKey&&a.$html.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&a.$html.removeClass("rl-ctrl-key-pressed")})}var i=t("window"),o=t("_"),n=t("$"),a=t("Globals"),r=t("Utils"),l=t("LinkBuilder"),c=t("Events"),u=t("Storage:Settings"),d=t("Knoin:AbstractBoot");o.extend(s.prototype,d.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=i.navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(s=i.document.createElement("a"),s.href=e,i.document.createEvent&&(t=i.document.createEvent("MouseEvents"),t&&t.initEvent&&s.dispatchEvent))?(t.initEvent("click",!0,!0),s.dispatchEvent(t),!0):(a.bMobileDevice?(i.open(e,"_self"),i.focus()):this.iframe.attr("src",e),!0)},s.prototype.setTitle=function(e){e=(r.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&&(y.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=S&&(S++,m.newForAnimation(!0)),m.deleted(!1),t?y.initMessageFlagsFromCache(m):y.storeMessageFlagsToCache(m),m.lastInCollapsedThread(s&&-1i;i++)n=t[i],n&&(r=n.FullNameRaw,a=y.getFolderFromCacheList(r),a||(a=w.newInstanceFromJson(n),a&&(y.setFolderToCacheList(r,a),y.setFolderFullNameRaw(a.fullNameHash,r))),a&&(a.collapsed(!s.isFolderExpanded(a.fullNameHash)),n.Extended&&(n.Extended.Hash&&y.setFolderHash(a.fullNameRaw,n.Extended.Hash),d.isNormal(n.Extended.MessageCount)&&a.messageCountAll(n.Extended.MessageCount),d.isNormal(n.Extended.MessageUnseenCount)&&a.messageCountUnread(n.Extended.MessageUnseenCount)),l=n.SubFolders,l&&"Collection/FolderCollection"===l["@Object"]&&l["@Collection"]&&d.isArray(l["@Collection"])&&a.subFolders(this.folderResponseParseRec(e,l["@Collection"])),c.push(a)));return c},s.prototype.setFolders=function(e){var t=[],s=!1,i=function(e){return""===e||c.Values.UnuseOptionValue===e||null!==y.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&&S.saveSystemFolders(d.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder(),ArchiveFolder:b.archiveFolder(),NullFolder:"NullFolder"}),m.set(r.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},s.prototype.isFolderExpanded=function(e){var t=m.get(r.ClientSideKeyName.ExpandedFolders);return d.isArray(t)&&-1!==o.indexOf(t,e)},s.prototype.setExpandedFolder=function(e,t){var s=m.get(r.ClientSideKeyName.ExpandedFolders);d.isArray(s)||(s=[]),t?(s.push(e),s=o.uniq(s)):s=o.without(s,e),m.set(r.ClientSideKeyName.ExpandedFolders,s)},s.prototype.initLayoutResizer=function(e,t,s){var i=60,o=155,a=n(e),r=n(t),l=m.get(s)||null,c=function(e){e&&(a.css({width:""+e+"px"}),r.css({left:""+e+"px"}))},u=function(e){if(e)a.resizable("disable"),c(i);else{a.resizable("enable");var t=d.pInt(m.get(s))||o;c(t>o?t:o)}},p=function(e,t){t&&t.size&&t.size.width&&(m.set(s,t.size.width),r.css({left:""+t.size.width+"px"}))};null!==l&&c(l>o?l:o),a.resizable({helper:"ui-resizable-helper",minWidth:o,maxWidth:350,handles:"e",stop:p}),h.sub("left-panel.off",function(){u(!0)}),h.sub("left-panel.on",function(){u(!1)})},s.prototype.bootstartLoginScreen=function(){var e=d.pString(f.settingsGet("CustomLoginLink"));e?(g.routeOff(),g.setHash(p.root(),!0),g.routeOff(),o.defer(function(){i.location.href=e})):(g.hideLoading(),g.startScreens([t("Screen:RainLoop:Login")]),u.runHook("rl-start-login-screens"),h.pub("rl.bootstart-login-screens"))},s.prototype.bootstart=function(){R.prototype.bootstart.call(this),b.populateDataOnStart();var e=this,s=f.settingsGet("JsHash"),a=d.pInt(f.settingsGet("ContactsSyncInterval")),c=f.settingsGet("AllowGoogleSocial"),m=f.settingsGet("AllowFacebookSocial"),y=f.settingsGet("AllowTwitterSocial");d.initOnStartOrLangChange(function(){n.extend(!0,n.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(o.bind(function(s){g.hideLoading(),s?(i.$LAB&&i.crypto&&i.crypto.getRandomValues&&f.capa(r.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([t("Screen:RainLoop:MailBox"),t("Screen:RainLoop:Settings"),t("Screen:RainLoop:About")]),(c||m||y)&&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()}),a=a>=5?a:20,a=320>=a?a:320,i.setInterval(function(){e.contactsSync()},6e4*a+5e3),o.delay(function(){e.contactsSync()},5e3),o.delay(function(){e.folderInformationMultiply(!0)},500),u.runHook("rl-start-user-screens"),h.pub("rl.bootstart-user-screens"),f.settingsGet("AccountSignMe")&&i.navigator.registerProtocolHandler&&o.delay(function(){try{i.navigator.registerProtocolHandler("mailto",i.location.protocol+"//"+i.location.host+i.location.pathname+"?mailto&to=%s",""+(f.settingsGet("Title")||"RainLoop"))}catch(e){}f.settingsGet("MailToEmail")&&d.mailToHelper(f.settingsGet("MailToEmail"),t("View:Popup:Compose"))},500),l.bMobileDevice||o.defer(function(){e.initLayoutResizer("#rl-left","#rl-right",r.ClientSideKeyName.FolderListSize)})):e.bootstartLoginScreen(),i.SimplePace&&i.SimplePace.set(100)},this))):(this.bootstartLoginScreen(),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()}),y&&(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)},{$:20,"App:Abstract":2,"App:Knoin":27,Consts:6,Enums:7,Events:8,Globals:9,LinkBuilder:11,"Model:Account":31,"Model:Email":37,"Model:Folder":40,"Model:Identity":41,"Model:Message":42,"Model:OpenPgpKey":43,Plugins:12,"Screen:RainLoop:About":44,"Screen:RainLoop:Login":46,"Screen:RainLoop:MailBox":47,"Screen:RainLoop:Settings":48,"Settings:RainLoop:Accounts":49,"Settings:RainLoop:ChangePassword":50,"Settings:RainLoop:Contacts":51,"Settings:RainLoop:Filters":52,"Settings:RainLoop:Folders":53,"Settings:RainLoop:General":54,"Settings:RainLoop:Identities":55,"Settings:RainLoop:Identity":56,"Settings:RainLoop:OpenPGP":57,"Settings:RainLoop:Security":58,"Settings:RainLoop:Social":59,"Settings:RainLoop:Themes":60,"Storage:LocalStorage":65,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,Utils:14,"View:Popup:Ask":80,"View:Popup:Compose":82,"View:Popup:FolderSystem":87,_:25,moment:23,window:26}],4:[function(e,t){!function(e,t){"use strict";e.exports=function(e){var s=t("window"),i=t("_"),o=t("$"),n=t("Globals"),a=t("Plugins"),r=t("Utils"),l=t("Enums"),c=t("Model:Email");n.__APP=e,e.setupSettings(),a.__boot=e,a.__remote=e.remote(),a.__data=e.data(),n.$html.addClass(n.bMobileDevice?"mobile":"no-mobile"),n.$win.keydown(r.killCtrlAandS).keyup(r.killCtrlAandS),n.$win.unload(function(){n.bUnload=!0}),n.$html.on("click.dropdown.data-api",function(){r.detectDropdownVisibility()}),s.rl=s.rl||{},s.rl.addHook=i.bind(a.addHook,a),s.rl.settingsGet=i.bind(a.mainSettingsGet,a),s.rl.remoteRequest=i.bind(a.remoteRequest,a),s.rl.pluginSettingsGet=i.bind(a.settingsGet,a),s.rl.createCommand=r.createCommand,s.rl.EmailModel=c,s.rl.Enums=l,s.__APP_BOOT=function(t){o(function(){s.rainloopTEMPLATES&&s.rainloopTEMPLATES[0]?(o("#rl-templates").html(s.rainloopTEMPLATES[0]),i.delay(function(){e.bootstart(),n.$html.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},10)):t(!1),s.__APP_BOOT=null})}}}(t,e)},{$:20,Enums:7,Globals:9,"Model:Email":37,Plugins:12,Utils:14,_:25,window:26}],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,a,r,l,c="",u=0;for(e=t._utf8_encode(e);u>2,a=(3&s)<<4|i>>4,r=(15&i)<<2|o>>6,l=63&o,isNaN(i)?r=l=64:isNaN(o)&&(l=64),c=c+this._keyStr.charAt(n)+this._keyStr.charAt(a)+this._keyStr.charAt(r)+this._keyStr.charAt(l);return c},decode:function(e){var s,i,o,n,a,r,l,c="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u>4,i=(15&a)<<4|r>>2,o=(3&r)<<6|l,c+=String.fromCharCode(s),64!==r&&(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.ClientSideStorageIndexName="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.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,_:25}],9:[function(e,t){!function(e,t){"use strict";var s={},i=t("window"),o=t("_"),n=t("$"),a=t("ko"),r=t("key"),l=t("Enums");s.$win=n(i),s.$doc=n(i.document),s.$html=n("html"),s.$div=n(""),s.now=(new i.Date).getTime(),s.momentTrigger=a.observable(!0),s.dropdownVisibility=a.observable(!1).extend({rateLimit:0}),s.tooltipTrigger=a.observable(!1).extend({rateLimit:0}),s.langChangeTrigger=a.observable(!0),s.useKeyboardShortcuts=a.observable(!0),s.iAjaxErrorCount=0,s.iTokenErrorCount=0,s.iMessageBodyCacheCount=0,s.bUnload=!1,s.sUserAgent=(i.navigator.userAgent||"").toLowerCase(),s.bIsiOSDevice=-1'+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=a.settingsGet("Language"),o=!!a.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)},{Globals:9,"Storage:Settings":69,_:25,window:26}],11:[function(e,t){!function(e,t){"use strict";function s(){var e=t("Storage:Settings");this.sBase="#/",this.sServer="./?",this.sVersion=e.settingsGet("Version"),this.sSpecSuffix=e.settingsGet("AuthAccountHash")||"0",this.sStaticPrefix=e.settingsGet("StaticPrefix")||"rainloop/v/"+this.sVersion+"/static/"}var i=t("window"),o=t("Utils");s.prototype.root=function(){return this.sBase},s.prototype.attachmentDownload=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},s.prototype.attachmentPreview=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+e},s.prototype.attachmentPreviewAsPlain=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},s.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},s.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},s.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},s.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},s.prototype.change=function(e){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+i.encodeURIComponent(e)+"/"},s.prototype.ajax=function(e){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+e},s.prototype.messageViewLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+e},s.prototype.messageDownloadLink=function(e){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+e},s.prototype.avatarLink=function(e){return this.sServer+"/Raw/0/Avatar/"+i.encodeURIComponent(e)+"/"},s.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},s.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},s.prototype.settings=function(e){var t=this.sBase+"settings";return o.isUnd(e)||""===e||(t+="/"+e),t},s.prototype.about=function(){return this.sBase+"about"},s.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},s.prototype.mailBox=function(e,t,s){t=o.isNormal(t)?o.pInt(t):1,s=o.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},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)},{"Storage:Settings":69,Utils:14,window:26}],12:[function(e,t){!function(e,t){"use strict";function s(){this.__boot=null,this.__data=null,this.__remote=null,this.oSettings=t("Storage:Settings"),this.oViewModelsHooks={},this.oSimpleHooks={}}var i=t("_"),o=t("Utils");s.prototype.__boot=null,s.prototype.__data=null,s.prototype.__remote=null,s.prototype.oViewModelsHooks={},s.prototype.oSimpleHooks={},s.prototype.addHook=function(e,t){o.isFunc(t)&&(o.isArray(this.oSimpleHooks[e])||(this.oSimpleHooks[e]=[]),this.oSimpleHooks[e].push(t))},s.prototype.runHook=function(e,t){o.isArray(this.oSimpleHooks[e])&&(t=t||[],i.each(this.oSimpleHooks[e],function(e){e.apply(null,t)}))},s.prototype.mainSettingsGet=function(e){return this.oSettings.settingsGet(e)},s.prototype.remoteRequest=function(e,t,s,i,o,n){this.__remote&&this.__remote.defaultRequest(e,t,s,i,o,n)},s.prototype.settingsGet=function(e,t){var s=this.oSettings.settingsGet("Plugins");return s=s&&!o.isUnd(s[e])?s[e]:null,s?o.isUnd(s[t])?null:s[t]:null},e.exports=new s}(t,e)},{"Storage:Settings":69,Utils:14,_:25}],13:[function(e,t){!function(e,t){"use strict";function s(e,t,s,o,a,r){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,a.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,a=!1,l=!1,c=null,u=this.list(),d=u?u.length:0,p=this.focusedItem();if(d>0)if(p){if(p)if(r.EventKeyCode.Down===e||r.EventKeyCode.Up===e||r.EventKeyCode.Insert===e||r.EventKeyCode.Space===e)i.each(u,function(t){if(!l)switch(e){case r.EventKeyCode.Up:p===t?l=!0:c=t;break;case r.EventKeyCode.Down:case r.EventKeyCode.Insert:a?(c=t,l=!0):p===t&&(a=!0)}});else if(r.EventKeyCode.Home===e||r.EventKeyCode.End===e)r.EventKeyCode.Home===e?c=u[0]:r.EventKeyCode.End===e&&(c=u[u.length-1]);else if(r.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(r.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 r.EventKeyCode.Down===e||r.EventKeyCode.Insert===e||r.EventKeyCode.Space===e||r.EventKeyCode.Home===e||r.EventKeyCode.PageUp===e?c=u[0]:(r.EventKeyCode.Up===e||r.EventKeyCode.End===e||r.EventKeyCode.PageDown===e)&&(c=u[u.length-1]);c?(this.focusedItem(c),p&&(t?(r.EventKeyCode.Up===e||r.EventKeyCode.Down===e)&&p.checked(!p.checked()):(r.EventKeyCode.Insert===e||r.EventKeyCode.Space===e)&&p.checked(!p.checked())),!this.bAutoSelect&&!s||this.isListChecked()||r.EventKeyCode.Space===e||this.selectedItem(c),this.scrollToFocused()):p&&(!t||r.EventKeyCode.Up!==e&&r.EventKeyCode.Down!==e?(r.EventKeyCode.Insert===e||r.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),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},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)},{$:20,Enums:7,Utils:14,_:25,key:21,ko:22}],14:[function(e,t){!function(e,t){"use strict";var s={},i=t("window"),o=t("_"),n=t("$"),a=t("ko"),r=t("Enums"),l=t("Consts"),c=t("Globals");s.trim=n.trim,s.inArray=n.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)?c.$win.resize():i.setTimeout(function(){c.$win.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?i.parseInt(e,10):t||0;return i.isNaN(o)?t||0:o},s.pString=function(e){return s.isNormal(e)?""+e:""},s.isNonEmptyArray=function(e){return s.isArray(e)&&0n;n++)o=s[n].split("="),t[i.decodeURIComponent(o[0])]=i.decodeURIComponent(o[1]);return t},s.mailToHelper=function(e,o){if(e&&"mailto:"===e.toString().substr(0,7).toLowerCase()){e=e.toString().substr(7);var n={},a=null,l=e.replace(/\?.+$/,""),c=e.replace(/^[^\?]*\?/,""),u=t("Model:Email");return a=new u,a.parse(i.decodeURIComponent(l)),a&&a.email&&(n=s.simpleQueryParser(c),t("App:Knoin").showScreenPopup(o,[r.ComposeType.Empty,null,[a],s.isUnd(n.subject)?null:s.pString(n.subject),s.isUnd(n.body)?null:s.plainToHtml(s.pString(n.body))])),!0}return!1},s.rsaEncode=function(e,t,o,n){if(i.crypto&&i.crypto.getRandomValues&&i.RSAKey&&t&&o&&n){var a=new i.RSAKey;if(a.setPublic(n,o),e=a.encrypt(s.fakeMd5()+":"+e+":"+s.fakeMd5()),!1!==e)return"rsa:"+t+":"+e}return!1},s.rsaEncode.supported=!!(i.crypto&&i.crypto.getRandomValues&&i.RSAKey),s.exportPath=function(e,t,o){for(var n=null,a=e.split("."),r=o||i;a.length&&(n=a.shift());)a.length||s.isUnd(t)?r=r[n]?r[n]:r[n]={}:r[n]=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,a=0,r=0;for(t=s.isUnd(t)?100:t;n.length>t;)o=n.substring(0,t),a=o.lastIndexOf(" "),r=o.lastIndexOf("\n"),-1!==r&&(a=r),-1===a&&(a=t),i+=o.substring(0,a)+"\n",n=n.substring(a+1);return i+n},s.timeOutAction=function(){var e={};return function(t,o,n){s.isUnd(e[t])&&(e[t]=0),i.clearTimeout(e[t]),e[t]=i.setTimeout(o,n)}}(),s.timeOutActionSecond=function(){var e={};return function(t,s,o){e[t]||(e[t]=i.setTimeout(function(){s(),e[t]=0},o))}}(),s.audio=function(){var e=!1;return function(t,s){if(!1===e)if(c.bIsiOSDevice)e=null;else{var o=!1,n=!1,a=i.Audio?new i.Audio:null;a&&a.canPlayType&&a.play?(o=""!==a.canPlayType('audio/mpeg; codecs="mp3"'),o||(n=""!==a.canPlayType('audio/ogg; codecs="vorbis"')),o||n?(e=a,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&&i.Object&&i.Object.hasOwnProperty?i.Object.hasOwnProperty.call(e,t):!1},s.i18n=function(e,t,i){var o="",n=s.isUnd(c.oI18N[e])?s.isUnd(i)?e:i:c.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(){n(".i18n",e).each(function(){var e=n(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(){i.rainloopI18N&&(c.oI18N=i.rainloopI18N||{},s.i18nToNode(c.$doc),c.langChangeTrigger(!c.langChangeTrigger())),i.rainloopI18N=null},s.initOnStartOrLangChange=function(e,t,s){e&&e.call(t),s?c.langChangeTrigger.subscribe(function(){e&&e.call(t),s.call(t)}):e&&c.langChangeTrigger.subscribe(e,t)},s.inFocus=function(){return i.document.activeElement?(s.isUnd(i.document.activeElement.__inFocusCache)&&(i.document.activeElement.__inFocusCache=n(i.document.activeElement).is("input,textarea,iframe,.cke_editable")),!!i.document.activeElement.__inFocusCache):!1},s.removeInFocus=function(){if(i.document&&i.document.activeElement&&i.document.activeElement.blur){var e=n(i.document.activeElement);e.is("input,textarea")&&i.document.activeElement.blur()}},s.removeSelection=function(){if(i&&i.getSelection){var e=i.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}else i.document&&i.document.selection&&i.document.selection.empty&&i.document.selection.empty()},s.replySubjectAdd=function(e,t){e=s.trim(e.toUpperCase()),t=s.trim(t.replace(/[\s]+/g," "));var i=!1,n=[],a="RE"===e,r="FWD"===e,l=!r;return""!==t&&o.each(t.split(":"),function(e){var t=s.trim(e);i||!/^(RE|FWD)$/i.test(t)&&!/^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(t)?(n.push(e),i=!0):(a||(a=!!/^RE/i.test(t)),r||(r=!!/^FWD/i.test(t)))}),l?a=!1:r=!1,s.trim((l?"Re: ":"Fwd: ")+(a?"Re: ":"")+(r?"Fwd: ":"")+s.trim(n.join(":")))},s.roundNumber=function(e,t){return i.Math.round(e*i.Math.pow(10,t))/i.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){i.console&&i.console.log&&i.console.log(e)},s.getNotification=function(e,t){return e=s.pInt(e),r.Notification.ClientViewError===e&&t?t:s.isUnd(c.oNotificationI18N[e])?"":c.oNotificationI18N[e]},s.initNotificationLanguage=function(){var e=c.oNotificationI18N||{};e[r.Notification.InvalidToken]=s.i18n("NOTIFICATIONS/INVALID_TOKEN"),e[r.Notification.AuthError]=s.i18n("NOTIFICATIONS/AUTH_ERROR"),e[r.Notification.AccessError]=s.i18n("NOTIFICATIONS/ACCESS_ERROR"),e[r.Notification.ConnectionError]=s.i18n("NOTIFICATIONS/CONNECTION_ERROR"),e[r.Notification.CaptchaError]=s.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),e[r.Notification.SocialFacebookLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),e[r.Notification.SocialTwitterLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),e[r.Notification.SocialGoogleLoginAccessDisable]=s.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),e[r.Notification.DomainNotAllowed]=s.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),e[r.Notification.AccountNotAllowed]=s.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),e[r.Notification.AccountTwoFactorAuthRequired]=s.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),e[r.Notification.AccountTwoFactorAuthError]=s.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),e[r.Notification.CouldNotSaveNewPassword]=s.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),e[r.Notification.CurrentPasswordIncorrect]=s.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),e[r.Notification.NewPasswordShort]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),e[r.Notification.NewPasswordWeak]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),e[r.Notification.NewPasswordForbidden]=s.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),e[r.Notification.ContactsSyncError]=s.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),e[r.Notification.CantGetMessageList]=s.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),e[r.Notification.CantGetMessage]=s.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),e[r.Notification.CantDeleteMessage]=s.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),e[r.Notification.CantMoveMessage]=s.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[r.Notification.CantCopyMessage]=s.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[r.Notification.CantSaveMessage]=s.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),e[r.Notification.CantSendMessage]=s.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),e[r.Notification.InvalidRecipients]=s.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),e[r.Notification.CantCreateFolder]=s.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),e[r.Notification.CantRenameFolder]=s.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),e[r.Notification.CantDeleteFolder]=s.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),e[r.Notification.CantDeleteNonEmptyFolder]=s.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),e[r.Notification.CantSubscribeFolder]=s.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),e[r.Notification.CantUnsubscribeFolder]=s.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),e[r.Notification.CantSaveSettings]=s.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),e[r.Notification.CantSavePluginSettings]=s.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),e[r.Notification.DomainAlreadyExists]=s.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),e[r.Notification.CantInstallPackage]=s.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),e[r.Notification.CantDeletePackage]=s.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),e[r.Notification.InvalidPluginPackage]=s.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),e[r.Notification.UnsupportedPluginPackage]=s.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),e[r.Notification.LicensingServerIsUnavailable]=s.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),e[r.Notification.LicensingExpired]=s.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),e[r.Notification.LicensingBanned]=s.i18n("NOTIFICATIONS/LICENSING_BANNED"),e[r.Notification.DemoSendMessageError]=s.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),e[r.Notification.AccountAlreadyExists]=s.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),e[r.Notification.MailServerError]=s.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),e[r.Notification.InvalidInputArgument]=s.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),e[r.Notification.UnknownNotification]=s.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),e[r.Notification.UnknownError]=s.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},s.getUploadErrorDescByCode=function(e){var t="";switch(s.pInt(e)){case r.UploadErrorCode.FileIsTooBig:t=s.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case r.UploadErrorCode.FilePartiallyUploaded:t=s.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case r.UploadErrorCode.FileNoUploaded:t=s.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case r.UploadErrorCode.MissingTempFolder:t=s.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case r.UploadErrorCode.FileOnSaveingError:t=s.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case r.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||i.event,e&&e.ctrlKey&&!e.shiftKey&&!e.altKey){var t=e.target||e.srcElement,s=e.keyCode||e.which;if(s===r.EventKeyCode.S)return void e.preventDefault();if(t&&t.tagName&&t.tagName.match(/INPUT|TEXTAREA/i))return;s===r.EventKeyCode.A&&(i.getSelection?i.getSelection().removeAllRanges():i.document.selection&&i.document.selection.clear&&i.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=a.observable(!0),i=s.isUnd(i)?!0:i,o.canExecute=a.computed(s.isFunc(i)?function(){return o.enabled()&&i.call(e)}:function(){return o.enabled()&&!!i}),o},s.initDataConstructorBySettings=function(e){e.editorDefaultType=a.observable(r.EditorDefaultType.Html),e.showImages=a.observable(!1),e.interfaceAnimation=a.observable(r.InterfaceAnimation.Full),e.contactsAutosave=a.observable(!1),c.sAnimationType=r.InterfaceAnimation.Full,e.capaThemes=a.observable(!1),e.allowLanguagesOnSettings=a.observable(!0),e.allowLanguagesOnLogin=a.observable(!0),e.useLocalProxyForExternalImages=a.observable(!1),e.desktopNotifications=a.observable(!1),e.useThreads=a.observable(!0),e.replySameFolder=a.observable(!0),e.useCheckboxesInList=a.observable(!0),e.layout=a.observable(r.Layout.SidePreview),e.usePreviewPane=a.computed(function(){return r.Layout.NoPreview!==e.layout()}),e.interfaceAnimation.subscribe(function(e){if(c.bMobileDevice||e===r.InterfaceAnimation.None)c.$html.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),c.sAnimationType=r.InterfaceAnimation.None;else switch(e){case r.InterfaceAnimation.Full:c.$html.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),c.sAnimationType=e;break;case r.InterfaceAnimation.Normal:c.$html.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),c.sAnimationType=e}}),e.interfaceAnimation.valueHasMutated(),e.desktopNotificationsPermisions=a.computed(function(){e.desktopNotifications();var t=s.notificationClass(),o=r.DesktopNotifications.NotSupported;if(t&&t.permission)switch(t.permission.toLowerCase()){case"granted":o=r.DesktopNotifications.Allowed;break;case"denied":o=r.DesktopNotifications.Denied;break;case"default":o=r.DesktopNotifications.NotAllowed}else i.webkitNotifications&&i.webkitNotifications.checkPermission&&(o=i.webkitNotifications.checkPermission());return o}),e.useDesktopNotifications=a.computed({read:function(){return e.desktopNotifications()&&r.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()},write:function(t){if(t){var i=s.notificationClass(),o=e.desktopNotificationsPermisions();i&&r.DesktopNotifications.Allowed===o?e.desktopNotifications(!0):i&&r.DesktopNotifications.NotAllowed===o?i.requestPermission(function(){e.desktopNotifications.valueHasMutated(),r.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=a.observable(""),e.languages=a.observableArray([]),e.mainLanguage=a.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.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=s.trim(e.substring(0,e.length-7))),s.trim(e.replace(/[^a-zA-Z0-9]+/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]+/g,"_"),null,e)},s.fakeMd5=function(e){var t="",o="0123456789abcdefghijklmnopqrstuvwxyz";for(e=s.isUnd(e)?32:s.pInt(e);t.length /g,">").replace(/")},s.draggeblePlace=function(){return n(' ').appendTo("#rl-hidden")},s.defautOptionsAfterRender=function(e,t){t&&!s.isUnd(t.disabled)&&e&&n(e).toggleClass("disabled",t.disabled).prop("disabled",t.disabled)},s.windowPopupKnockout=function(e,t,o,r){var l=null,c=i.open(""),u="__OpenerApplyBindingsUid"+s.fakeMd5()+"__",d=n("#"+t);i[u]=function(){if(c&&c.document.body&&d&&d[0]){var t=n(c.document.body);n("#rl-content",t).html(d.html()),n("html",c.document).addClass("external "+n("html").attr("class")),s.i18nToNode(t),e&&n("#rl-content",t)[0]&&a.applyBindings(e,n("#rl-content",t)[0]),i[u]=null,r(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,a,l,c,u){t.call(i,a&&a.Result?r.SaveSettingsStep.TrueResult:r.SaveSettingsStep.FalseResult),e&&e.call(i,s,a,l,c,u),o.delay(function(){t.call(i,r.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,o=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},u=function(e){return e=l(n.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"+n.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.$div.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--,s=r.indexOf("__bq__start__",t),s>-1);)i=r.indexOf("__bq__start__",s+5),o=r.indexOf("__bq__end__",s+5),(-1===i||i>o)&&o>s?(r=r.substring(0,s)+u(r.substring(s+13,o))+r.substring(o+11),t=0):t=i>-1&&o>i?i-1:0;return r=r.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,a=[],r="",l=0,c=e.split("\n");do{for(o=!1,a=[],l=0;l"===r.substr(0,1),n&&!i?(o=!0,i=!0,a.push("~~~blockquote~~~"),a.push(r.substr(1))):!n&&i?(i=!1,a.push("~~~/blockquote~~~"),a.push(r)):a.push(n&&i?r.substr(1):r);i&&(i=!1,a.push("~~~/blockquote~~~")),c=a}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},i.rainloop_Utils_htmlToPlain=s.htmlToPlain,i.rainloop_Utils_plainToHtml=s.plainToHtml,s.linkify=function(e){return n.fn&&n.fn.linkify&&(e=c.$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},s.resizeAndCrop=function(e,t,s){var o=new i.Image;o.onload=function(){var e=[0,0],o=i.document.createElement("canvas"),n=o.getContext("2d");o.width=t,o.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),s(o.toDataURL("image/jpeg"))},o.src=e},s.folderListOptionsBuilder=function(e,t,o,n,a,l,c,u,d,p){var h=null,g=!1,m=0,f=0,b="Â Â Â ",y=[];for(d=s.isNormal(d)?d:0m;m++)y.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],(c?c.call(null,h):!0)&&(g&&0m;m++)h=t[m],(h.subScribed()||!h.existen)&&(c?c.call(null,h):!0)&&(r.FolderType.User===h.type()||!d||01||c>0&&l>c){for(l>c?(u(c),o=c,n=c):((3>=l||l>=c-2)&&(a+=2),u(l),o=l,n=l);a>0;)if(o-=1,n+=1,o>0&&(u(o,!1),a--),c>=n)u(n,!0),a--;else if(0>=o)break;3===o?u(2,!1):o>3&&u(i.Math.round((o-1)/2),!1,"..."),c-2===n?u(c-1,!0):c-2>n&&u(i.Math.round((c+n)/2),!0,"..."),o>1&&u(1,!1),c>n&&u(c,!0)}return r}},s.selectElement=function(e){var t,s;i.getSelection?(t=i.getSelection(),t.removeAllRanges(),s=i.document.createRange(),s.selectNodeContents(e),t.addRange(s)):i.document.selection&&(s=i.document.body.createTextRange(),s.moveToElementText(e),s.select())},s.detectDropdownVisibility=o.debounce(function(){c.dropdownVisibility(!!o.find(c.aBootstrapDropdowns,function(e){return e.hasClass("open")}))},50),s.triggerAutocompleteInputChange=function(e){var t=function(){n(".checkAutocomplete").trigger("change")};(s.isUnd(e)?1:!e)?t():o.delay(t,100)},e.exports=s}(t,e)},{$:20,"App:Knoin":27,Consts:6,Enums:7,Globals:9,"Model:Email":37,_:25,ko:22,window:26}],15:[function(e,t){t.exports=JSON},{}],16:[function(e,t){t.exports=Jua},{}],17:[function(e,t){t.exports=crossroads},{}],18:[function(e,t){t.exports=hasher},{}],19:[function(e,t){t.exports=ifvisible},{}],20:[function(e,t){t.exports=$},{}],21:[function(e,t){t.exports=key},{}],22:[function(e,t){!function(t,s){"use strict";var i=e("window"),o=e("_"),n=e("$");s.bindingHandlers.tooltip={init:function(t,i){var o=e("Globals"),a=e("Utils");if(!o.bMobileDevice){var r=n(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")||o.dropdownVisibility()?"":''+a.i18n(s.utils.unwrapObservable(i()))+""}}).click(function(){r.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){r.tooltip("hide")})}}},s.bindingHandlers.tooltip2={init:function(t,s){var i=e("Globals"),o=n(t),a=o.data("tooltip-class")||"",r=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:r,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),o=e("Globals");s.tooltip({container:"body",trigger:"hover manual",title:function(){return s.data("tooltip3-data")||""}}),n(i.document).click(function(){s.tooltip("hide")}),o.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),a=e("Utils");o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),a.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"),a=e("Utils");n(t).toggleClass("fade",!o.bMobileDevice).modal({keyboard:!1,show:s.utils.unwrapObservable(i())}).on("shown",function(){a.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=e("Globals"),r=s.utils.unwrapObservable(i()),l=o.pInt(r[1]),c=0,u=n(t).offset().top;u>0&&(u+=o.pInt(r[2]),c=a.$win.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,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){n(p).each(function(){var t=null,s=null,o=n(this),a=o.offset(),r=a.top+o.height();i.clearInterval(o.data("timerScroll")),o.data("timerScroll",!1),e.pageX>=a.left&&e.pageX<=a.left+o.width()&&(e.pageY>=r-c&&e.pageY<=r&&(t=function(){o.scrollTop(o.scrollTop()+u),l.windowResize()},o.data("timerScroll",i.setInterval(t,10)),t()),e.pageY>=a.top&&e.pageY<=a.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 a=s(),r=i(),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)}),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 a=e("Utils"),r=e("Model:Email"),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=a.trim(e),s=null;return""!==t?(s=new r,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),a=i(),r=a.emailsTagsFilter||null,l=s.utils.unwrapObservable(t());o.data("EmailsTagsValue")!==l&&(o.val(l),o.data("EmailsTagsValue",l),o.inputosaurus("refresh")),r&&s.utils.unwrapObservable(r)&&o.inputosaurus("focus")}},s.bindingHandlers.contactTags={init:function(t,s,i){var a=e("Utils"),r=e("Model:ContactTag"),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=a.trim(e),s=null;return""!==t?(s=new r,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),a=i(),r=a.contactTagsFilter||null,l=s.utils.unwrapObservable(t());o.data("ContactTagsValue")!==l&&(o.val(l),o.data("ContactTagsValue",l),o.inputosaurus("refresh")),r&&s.utils.unwrapObservable(r)&&o.inputosaurus("focus")}},s.bindingHandlers.command={init:function(e,t,i,o){var a=n(e),r=t();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(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)},{$:20,Globals:9,"Model:ContactTag":36,"Model:Email":37,Utils:14,_:25,window:26}],23:[function(e,t){t.exports=moment},{}],24:[function(e,t){t.exports=ssm},{}],25:[function(e,t){t.exports=_},{}],26:[function(e,t){t.exports=window},{}],27:[function(e,t){!function(e,t){"use strict";function s(){this.oScreens={},this.sDefaultScreenName="",this.oCurrentScreen=null}var i=t("_"),o=t("$"),n=t("ko"),a=t("hasher"),r=t("crossroads"),l=t("Globals"),c=t("Plugins"),u=t("Utils");s.prototype.oScreens={},s.prototype.sDefaultScreenName="",s.prototype.oCurrentScreen=null,s.prototype.hideLoading=function(){o("#rl-loading").hide()},s.prototype.constructorEnd=function(e){u.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},s.prototype.extendAsViewModel=function(e,t){t&&(t.__names=u.isArray(e)?e:[e],t.__name=t.__names[0])},s.prototype.addSettingsViewModel=function(e,t,s,i,o){e.__rlSettingsData={Label:s,Template:t,Route:i,IsDefault:!!o},l.aViewModels.settings.push(e)},s.prototype.removeSettingsViewModel=function(e){l.aViewModels["settings-removed"].push(e)},s.prototype.disableSettingsViewModel=function(e){l.aViewModels["settings-disabled"].push(e)},s.prototype.routeOff=function(){a.changed.active=!1},s.prototype.routeOn=function(){a.changed.active=!0},s.prototype.screen=function(e){return""===e||u.isUnd(this.oScreens[e])?null:this.oScreens[e]},s.prototype.buildViewModel=function(e,t){if(e&&!e.__builded){var s=this,a=new e(t),r=a.viewModelPosition(),d=o("#rl-content #rl-"+r.toLowerCase()),p=null;e.__builded=!0,e.__vm=a,a.viewModelName=e.__name,a.viewModelNames=e.__names,d&&1===d.length?(p=o("").addClass("rl-view-model").addClass("RL-"+a.viewModelTemplate()).hide(),p.appendTo(d),a.viewModelDom=p,e.__dom=p,"Popups"===r&&(a.cancelCommand=a.closeCommand=u.createCommand(a,function(){s.hideScreenPopup(e)}),a.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),l.popupVisibilityNames.push(this.viewModelName),a.viewModelDom.css("z-index",3e3+l.popupVisibilityNames().length+10),u.delegateRun(this,"onFocus",[],500)):(u.delegateRun(this,"onHide"),this.restoreKeyScope(),i.each(this.viewModelNames,function(e){c.runHook("view-model-on-hide",[e,t])}),l.popupVisibilityNames.remove(this.viewModelName),a.viewModelDom.css("z-index",2e3),l.tooltipTrigger(!l.tooltipTrigger()),i.delay(function(){t.viewModelDom.hide()},300))},a)),i.each(e.__names,function(e){c.runHook("view-model-pre-build",[e,a,p])}),n.applyBindingAccessorsToNode(p[0],{i18nInit:!0,template:function(){return{name:a.viewModelTemplate()}}},a),u.delegateRun(a,"onBuild",[p]),a&&"Popups"===r&&a.registerPopupKeyDown(),i.each(e.__names,function(e){c.runHook("view-model-post-build",[e,a,p])})):u.log("Cannot find view model position: "+r)}return e?e.__vm:null},s.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&e.__vm.modalVisibility(!1)},s.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),u.delegateRun(e.__vm,"onShow",t||[]),i.each(e.__names,function(s){c.runHook("view-model-on-show",[s,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;""===u.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,u.isNonEmptyArray(o.viewModels())&&i.each(o.viewModels(),function(e){this.buildViewModel(e,o)},this),u.delegateRun(o,"onBuild")),i.defer(function(){s.oCurrentScreen&&(u.delegateRun(s.oCurrentScreen,"onHide"),u.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),u.delegateRun(e.__vm,"onHide"))})),s.oCurrentScreen=o,s.oCurrentScreen&&(u.delegateRun(s.oCurrentScreen,"onShow"),c.runHook("screen-on-show",[s.oCurrentScreen.screenName(),s.oCurrentScreen]),u.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),u.delegateRun(e.__vm,"onShow"),u.delegateRun(e.__vm,"onFocus",[],200),i.each(e.__names,function(t){c.runHook("view-model-on-show",[t,e.__vm])}))},s)),n=o.__cross?o.__cross():null,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(),c.runHook("screen-pre-start",[e.screenName(),e]),u.delegateRun(e,"onStart"),c.runHook("screen-post-start",[e.screenName(),e]))},this);var t=r.create();t.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this)),a.initialized.add(t.parse,t),a.changed.add(t.parse,t),a.init(),o("#rl-content").css({visibility:"visible"}),i.delay(function(){l.$html.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=u.isUnd(s)?!1:!!s,(u.isUnd(t)?1:!t)?(a.changed.active=!0,a[s?"replaceHash":"setHash"](e),a.setHash(e)):(a.changed.active=!1,a[s?"replaceHash":"setHash"](e),a.changed.active=!0)},e.exports=new s}(t,e)},{$:20,Globals:9,Plugins:12,Utils:14,_:25,crossroads:17,hasher:18,ko:22}],28:[function(e,t){!function(e){"use strict";function t(){}t.prototype.bootstart=function(){},e.exports=t}(t,e)},{}],29:[function(e,t){!function(e,t){"use strict";function s(e,t){this.sScreenName=e,this.aViewModels=n.isArray(t)?t:[]}var i=t("_"),o=t("crossroads"),n=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;n.isNonEmptyArray(e)&&(s=i.bind(this.onRoute||n.emptyFunction,this),t=o.create(),i.each(e,function(e){t.addRoute(e[0],s).rules=e[1]}),this.oCross=t)},e.exports=s}(t,e)},{Utils:14,_:25,crossroads:17}],30:[function(e,t){!function(e,t){"use strict";function s(e,t){this.bDisabeCloseOnEsc=!1,this.sPosition=n.pString(e),this.sTemplate=n.pString(t),this.sDefaultKeyScope=o.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelVisibility=i.observable(!1),this.modalVisibility=i.observable(!1).extend({rateLimit:0}),this.viewModelName="",this.viewModelNames=[],this.viewModelDom=null}var i=t("ko"),o=t("Enums"),n=t("Utils"),a=t("Globals");s.prototype.bDisabeCloseOnEsc=!1,s.prototype.sPosition="",s.prototype.sTemplate="",s.prototype.sDefaultKeyScope=o.KeyState.None,s.prototype.sCurrentKeyScope=o.KeyState.None,s.prototype.viewModelName="",s.prototype.viewModelNames=[],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=a.keyScope(),a.keyScope(this.sDefaultKeyScope)},s.prototype.restoreKeyScope=function(){a.keyScope(this.sCurrentKeyScope)},s.prototype.registerPopupKeyDown=function(){var e=this;a.$win.on("keydown",function(t){if(t&&e.modalVisibility&&e.modalVisibility()){if(!this.bDisabeCloseOnEsc&&o.EventKeyCode.Esc===t.keyCode)return n.delegateRun(e,"cancelCommand"),!1;if(o.EventKeyCode.Backspace===t.keyCode&&!n.inFocus())return!1}return!0})},e.exports=s}(t,e)},{Enums:7,Globals:9,Utils:14,ko:22}],31:[function(e,t){!function(e,t){"use strict";function s(e,t){this.email=e,this.deleteAccess=i.observable(!1),this.canBeDalete=i.observable(o.isUnd(t)?!0:!!t)}var i=t("ko"),o=t("Utils");s.prototype.email="",s.prototype.changeAccountLink=function(){return t("LinkBuilder").change(this.email)},e.exports=s}(t,e)},{LinkBuilder:11,Utils:14,ko:22}],32:[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"),a=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=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 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)},o="",n="",a="",r=!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"(":r||l||c||(c=!0,d=h);break;case")":c&&(p=h,a=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===a.length&&(o=e.replace(n,"")),n=i.trim(n).replace(/^[<]+/,"").replace(/[>]+$/,""),o=i.trim(o).replace(/^["']+/,"").replace(/["']+$/,""),a=i.trim(a).replace(/^[(]+/,"").replace(/[)]+$/,""),o=o.replace(/\\\\(.)/g,"$1"),a=a.replace(/\\\\(.)/g,"$1"),this.name=o,this.email=n,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 00){if(n.FolderType.Draft===s)return""+e;if(t>0&&n.FolderType.Trash!==s&&n.FolderType.Archive!==s&&n.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.localName=o.computed(function(){a.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case n.FolderType.Inbox:t=r.i18n("FOLDER_LIST/INBOX_NAME");break;case n.FolderType.SentItems:t=r.i18n("FOLDER_LIST/SENT_NAME");break;case n.FolderType.Draft:t=r.i18n("FOLDER_LIST/DRAFTS_NAME");break;case n.FolderType.Spam:t=r.i18n("FOLDER_LIST/SPAM_NAME");break;case n.FolderType.Trash:t=r.i18n("FOLDER_LIST/TRASH_NAME");break;case n.FolderType.Archive:t=r.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 n.FolderType.Inbox:e="("+r.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case n.FolderType.SentItems:e="("+r.i18n("FOLDER_LIST/SENT_NAME")+")";break;case n.FolderType.Draft:e="("+r.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case n.FolderType.Spam:e="("+r.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case n.FolderType.Trash:e="("+r.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case n.FolderType.Archive:e="("+r.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:22}],42:[function(e,t){!function(e,t){"use strict";function s(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject=a.observable(""),this.subjectPrefix=a.observable(""),this.subjectSuffix=a.observable(""),this.size=a.observable(0),this.dateTimeStampInUTC=a.observable(0),this.priority=a.observable(l.MessagePriority.Normal),this.proxy=!1,this.fromEmailString=a.observable(""),this.fromClearEmailString=a.observable(""),this.toEmailsString=a.observable(""),this.toClearEmailsString=a.observable(""),this.senderEmailsString=a.observable(""),this.senderClearEmailsString=a.observable(""),this.emails=[],this.from=[],this.to=[],this.cc=[],this.bcc=[],this.replyTo=[],this.deliveredTo=[],this.newForAnimation=a.observable(!1),this.deleted=a.observable(!1),this.unseen=a.observable(!1),this.flagged=a.observable(!1),this.answered=a.observable(!1),this.forwarded=a.observable(!1),this.isReadReceipt=a.observable(!1),this.focused=a.observable(!1),this.selected=a.observable(!1),this.checked=a.observable(!1),this.hasAttachments=a.observable(!1),this.attachmentsMainType=a.observable(""),this.moment=a.observable(r(r.unix(0))),this.attachmentIconClass=a.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=a.computed(function(){return s.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this),this.momentDate=c.createMomentDate(this),this.momentShortDate=c.createMomentShortDate(this),this.dateTimeStampInUTC.subscribe(function(e){var t=r().unix();this.moment(r.unix(e>t?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(l.SignedVerifyStatus.None),this.pgpSignedVerifyUser=a.observable(""),this.priority=a.observable(l.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 i=t("window"),o=t("_"),n=t("$"),a=t("ko"),r=t("moment"),l=t("Enums"),c=t("Utils"),u=t("Globals"),d=t("LinkBuilder"),p=t("Model:Email"),h=t("Model:Attachment");s.newInstanceFromJson=function(e){var t=new s;return t.initByJson(e)?t:null},s.calculateFullFromatDateValue=function(e){return e>0?r.unix(e).format("LLL"):""},s.emailsToLine=function(e,t,s){var i=[],o=0,n=0;if(c.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(c.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(c.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=p.newInstanceFromJson(e[t]),i&&o.push(i);return o},s.replyHelper=function(e,t,s){if(e&&0i;i++)c.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(l.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(l.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(l.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.friendlySize=function(){return c.friendlySize(this.size())},s.prototype.computeSenderEmail=function(){var e=t("Storage:RainLoop:Data"),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(c.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),c.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(c.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(c.pInt(e.ParentThread)),this.threads(c.isArray(e.Threads)?e.Threads:[]),this.threadsLen(c.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),t=!0),t},s.prototype.initUpdateByMessageJson=function(e){var s=t("Storage:RainLoop:Data"),i=!1,o=l.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(o=c.pInt(e.Priority),this.priority(-1t;t++)i=h.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0 +$/,""),t=o.find(s,function(t){return e===t.cidWithOutTags})),t||null},s.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return c.isNonEmptyArray(s)&&(t=o.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 c.isArray(this.from)&&this.from[0]?this.from[0].email:""},s.prototype.viewLink=function(){return d.messageViewLink(this.requestHash)},s.prototype.downloadLink=function(){return d.messageDownloadLink(this.requestHash)},s.prototype.replyEmails=function(e){var t=[],i=c.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=c.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=o.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0=0&&i&&!o&&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(l.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=c.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=c.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]}),u.$win.resize()),c.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=c.isUnd(e)?!1:e;var t=this;n("[data-x-src-cid]",this.body).each(function(){var s=t.findAttachmentByCid(n(this).attr("data-x-src-cid"));s&&s.download&&(e&&n(this).is("img")?n(this).addClass("lazy").attr("data-original",s.linkPreview()):n(this).attr("src",s.linkPreview()))}),n("[data-x-src-location]",this.body).each(function(){var s=t.findAttachmentByContentLocation(n(this).attr("data-x-src-location"));s||(s=t.findAttachmentByCid(n(this).attr("data-x-src-location"))),s&&s.download&&(e&&n(this).is("img")?n(this).addClass("lazy").attr("data-original",s.linkPreview()):n(this).attr("src",s.linkPreview()))}),n("[data-x-style-cid]",this.body).each(function(){var e="",s="",i=t.findAttachmentByCid(n(this).attr("data-x-style-cid"));i&&i.linkPreview&&(s=n(this).attr("data-x-style-cid-name"),""!==s&&(e=c.trim(n(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",n(this).attr("style",e+s+": url('"+i.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]),c.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("Storage:RainLoop:Data");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("Storage:RainLoop:Data");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=c.pString(this.body.data("rl-plain-raw"));var e=t("Storage:RainLoop:Data");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(l.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""))}},s.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var e=[],s=null,a=t("Storage:RainLoop:Data"),r=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",c=a.findPublicKeysByEmail(r),d=null,p=null,h="";this.pgpSignedVerifyStatus(l.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{s=i.openpgp.cleartext.readArmored(this.plainRaw),s&&s.getText&&(this.pgpSignedVerifyStatus(c.length?l.SignedVerifyStatus.Unverified:l.SignedVerifyStatus.UnknownPublicKeys),e=s.verify(c),e&&0').text(h)).html(),u.$div.empty(),this.replacePlaneTextBody(h)))))}catch(g){}this.storePgpVerifyDataToDom()}},s.prototype.decryptPgpEncryptedMessage=function(e){if(this.isPgpEncrypted()){var s=[],a=null,r=null,c=t("Storage:RainLoop:Data"),d=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",p=c.findPublicKeysByEmail(d),h=c.findSelfPrivateKey(e),g=null,m=null,f="";this.pgpSignedVerifyStatus(l.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),h||this.pgpSignedVerifyStatus(l.SignedVerifyStatus.UnknownPrivateKey);try{a=i.openpgp.message.readArmored(this.plainRaw),a&&h&&a.decrypt&&(this.pgpSignedVerifyStatus(l.SignedVerifyStatus.Unverified),r=a.decrypt(h),r&&(s=r.verify(p),s&&0').text(f)).html(),u.$div.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)},{$:20,Enums:7,Globals:9,LinkBuilder:11,"Model:Attachment":32,"Model:Email":37,"Storage:RainLoop:Data":64,Utils:14,_:25,ko:22,moment:23,window:26}],43:[function(e,t){!function(e,t){"use strict";function s(e,t,s,o,n,a,r){this.index=e,this.id=s,this.guid=t,this.user=o,this.email=n,this.armor=r,this.isPrivate=!!a,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:22}],44:[function(e,t){!function(e,t){"use strict";function s(){o.call(this,"about",[t("View:RainLoop:About")])}var i=t("_"),o=t("Knoin:AbstractScreen");i.extend(s.prototype,o.prototype),s.prototype.onShow=function(){t("App:RainLoop").setTitle("RainLoop")},e.exports=s}(t,e)},{"App:RainLoop":3,"Knoin:AbstractScreen":29,"View:RainLoop:About":70,_:25}],45:[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"),a=t("Globals"),r=t("Utils"),l=t("LinkBuilder"),c=t("App:Knoin"),u=t("Knoin:AbstractScreen");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(a.aViewModels.settings,function(t){return t&&t.__rlSettingsData&&e===t.__rlSettingsData.Route}),u&&(i.find(a.aViewModels["settings-removed"],function(e){return e&&e===u})&&(u=null),u&&i.find(a.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?(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),r.delegateRun(s,"onBuild",[p])):r.log("Cannot find sub settings view model position: SettingsSubScreen")),s&&i.defer(function(){t.oCurrentSubScreen&&(r.delegateRun(t.oCurrentSubScreen,"onHide"),t.oCurrentSubScreen.viewModelDom.hide()),t.oCurrentSubScreen=s,t.oCurrentSubScreen&&(t.oCurrentSubScreen.viewModelDom.show(),r.delegateRun(t.oCurrentSubScreen,"onShow"),r.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)),r.windowResize()})):c.setHash(l.settings(),!1,!0)},s.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(r.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},s.prototype.onBuild=function(){i.each(a.aViewModels.settings,function(e){e&&e.__rlSettingsData&&!i.find(a.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(a.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(a.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=r.isUnd(s.subname)?t:r.pString(s.subname),[s.subname]}};return[["{subname}/",s],["{subname}",s],["",s]]},e.exports=s}(t,e)},{$:20,"App:Knoin":27,Globals:9,"Knoin:AbstractScreen":29,LinkBuilder:11,Utils:14,_:25,ko:22}],46:[function(e,t){!function(e,t){"use strict";function s(){o.call(this,"login",[t("View:RainLoop:Login")])}var i=t("_"),o=t("Knoin:AbstractScreen");i.extend(s.prototype,o.prototype),s.prototype.onShow=function(){t("App:RainLoop").setTitle("")},e.exports=s}(t,e)},{"App:RainLoop":3,"Knoin:AbstractScreen":29,"View:RainLoop:Login":72,_:25}],47:[function(e,t){!function(e,t){"use strict";function s(){l.call(this,"mailbox",[t("View:RainLoop:MailBoxSystemDropDown"),t("View:RainLoop:MailBoxFolderList"),t("View:RainLoop:MailBoxMessageList"),t("View:RainLoop:MailBoxMessageView")]),this.oLastRoute={}}var i=t("_"),o=t("Enums"),n=t("Globals"),a=t("Utils"),r=t("Events"),l=t("Knoin:AbstractScreen"),c=t("Storage:Settings"),u=t("Storage:RainLoop:Data"),d=t("Storage:RainLoop:Cache"),p=t("Storage:RainLoop:Remote");i.extend(s.prototype,l.prototype),s.prototype.oLastRoute={},s.prototype.setNewTitle=function(){var e=u.accountEmail(),s=u.foldersInboxUnreadCount();t("App:RainLoop").setTitle((""===e?"":(s>0?"("+s+") ":" ")+e+" - ")+a.i18n("TITLES/MAILBOX"))},s.prototype.onShow=function(){this.setNewTitle(),n.keyScope(o.KeyState.MessageList)},s.prototype.onRoute=function(e,s,i,n){if(a.isUnd(n)?1:!n){var r=d.getFolderFullNameRaw(e),l=d.getFolderFromCacheList(r);l&&(u.currentFolder(l).messageListPage(s).messageListSearch(i),o.Layout.NoPreview===u.layout()&&u.message()&&u.message(null),t("App:RainLoop").reloadMessageList())}else o.Layout.NoPreview!==u.layout()||u.message()||t("App:RainLoop").historyBack()},s.prototype.onStart=function(){var e=function(){a.windowResize()};(c.capa(o.Capa.AdditionalAccounts)||c.capa(o.Capa.AdditionalIdentities))&&t("App:RainLoop").accountsAndIdentities(),i.delay(function(){"INBOX"!==u.currentFolderFullNameRaw()&&t("App:RainLoop").folderInformation("INBOX")},1e3),i.delay(function(){t("App:RainLoop").quota()},5e3),i.delay(function(){p.appDelayStart(a.emptyFunction)},35e3),n.$html.toggleClass("rl-no-preview-pane",o.Layout.NoPreview===u.layout()),u.folderList.subscribe(e),u.messageList.subscribe(e),u.message.subscribe(e),u.layout.subscribe(function(e){n.$html.toggleClass("rl-no-preview-pane",o.Layout.NoPreview===e)}),r.sub("mailbox.inbox-unread-count",function(e){u.foldersInboxUnreadCount(e)}),u.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)},{"App:RainLoop":3,Enums:7,Events:8,Globals:9,"Knoin:AbstractScreen":29,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,Utils:14,"View:RainLoop:MailBoxFolderList":73,"View:RainLoop:MailBoxMessageList":74,"View:RainLoop:MailBoxMessageView":75,"View:RainLoop:MailBoxSystemDropDown":76,_:25}],48:[function(e,t){!function(e,t){"use strict";function s(){r.call(this,[t("View:RainLoop:SettingsSystemDropDown"),t("View:RainLoop:SettingsMenu"),t("View:RainLoop:SettingsPane")]),n.initOnStartOrLangChange(function(){this.sSettingsTitle=n.i18n("TITLES/SETTINGS")},this,function(){this.setSettingsTitle()})}var i=t("_"),o=t("Enums"),n=t("Utils"),a=t("Globals"),r=t("Screen:AbstractSettings");i.extend(s.prototype,r.prototype),s.prototype.onShow=function(){this.setSettingsTitle(),a.keyScope(o.KeyState.Settings)},s.prototype.setSettingsTitle=function(){t("App:RainLoop").setTitle(this.sSettingsTitle)},e.exports=s}(t,e)},{"App:RainLoop":3,Enums:7,Globals:9,"Screen:AbstractSettings":45,Utils:14,"View:RainLoop:SettingsMenu":94,"View:RainLoop:SettingsPane":95,"View:RainLoop:SettingsSystemDropDown":96,_:25}],49:[function(e,t){!function(e,t){"use strict";function s(){this.accounts=c.accounts,this.processText=n.computed(function(){return c.accountsLoading()?r.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"),a=t("Enums"),r=t("Utils"),l=t("LinkBuilder"),c=t("Storage:RainLoop:Data"),u=t("Storage:RainLoop:Remote");s.prototype.addNewAccount=function(){t("App:Knoin").showScreenPopup(t("View:Popup:AddAccount"))},s.prototype.deleteAccount=function(e){if(e&&e.deleteAccess()){this.accountForDeletion(null);var s=t("App:Knoin"),n=function(t){return e===t};e&&(this.accounts.remove(n),u.accountDelete(function(e,n){a.StorageResultType.Success===e&&n&&n.Result&&n.Reload?(s.routeOff(),s.setHash(l.root(),!0),s.routeOff(),o.defer(function(){i.location.reload()})):t("App:RainLoop").accountsAndIdentities()},e.email))}},e.exports=s}(t,e)},{"App:Knoin":27,"App:RainLoop":3,Enums:7,LinkBuilder:11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,"View:Popup:AddAccount":77,_:25,ko:22,window:26}],50:[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=a.createCommand(this,function(){this.newPassword()!==this.newPassword2()?(this.passwordMismatch(!0),this.errorDescription(a.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(""),r.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"),a=t("Utils"),r=t("Storage:RainLoop:Remote");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(a.getNotification(t&&t.ErrorCode?t.ErrorCode:n.Notification.CouldNotSaveNewPassword)))},e.exports=s}(t,e)},{Enums:7,"Storage:RainLoop:Remote":68,Utils:14,_:25,ko:22}],51:[function(e,t){!function(e,t){"use strict";function s(){this.contactsAutosave=a.contactsAutosave,this.allowContactsSync=a.allowContactsSync,this.enableContactsSync=a.enableContactsSync,this.contactsSyncUrl=a.contactsSyncUrl,this.contactsSyncUser=a.contactsSyncUser,this.contactsSyncPass=a.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("Storage:RainLoop:Remote"),a=t("Storage:RainLoop:Data");s.prototype.onBuild=function(){a.contactsAutosave.subscribe(function(e){n.saveSettings(o.emptyFunction,{ContactsAutosave:e?"1":"0"})})},e.exports=s}(t,e)},{"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,ko:22}],52:[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("Model:Filter");t("App:Knoin").showScreenPopup(t("View:Popup:Filter"),[new e])},e.exports=s}(t,e)},{"App:Knoin":27,"Model:Filter":39,Utils:14,"View:Popup:Filter":84,ko:22}],53:[function(e,t){!function(e,t){"use strict";function s(){this.foldersListError=r.foldersListError,this.folderList=r.folderList,this.processText=i.computed(function(){var e=r.foldersLoading(),t=r.foldersCreating(),s=r.foldersDeleting(),i=r.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"),a=t("Storage:Settings"),r=t("Storage:RainLoop:Data"),l=t("Storage:RainLoop:Cache"),c=t("Storage:RainLoop:Remote"),u=t("Storage:LocalStorage");s.prototype.folderEditOnEnter=function(e){var s=e?n.trim(e.nameForEdit()):"";""!==s&&e.name()!==s&&(u.set(o.ClientSideKeyName.FoldersLashHash,""),r.foldersRenaming(!0),c.folderRename(function(e,s){r.foldersRenaming(!1),o.StorageResultType.Success===e&&s&&s.Result||r.foldersListError(s&&s.ErrorCode?n.getNotification(s.ErrorCode):n.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),t("App:RainLoop").folders()},e.fullNameRaw,s),l.removeFolderFromCacheList(e.fullNameRaw),e.name(s)),e.edited(!1)},s.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},s.prototype.onShow=function(){r.foldersListError("")},s.prototype.createFolder=function(){t("App:Knoin").showScreenPopup(t("View:Popup:FolderCreate"))},s.prototype.systemFolder=function(){t("App:Knoin").showScreenPopup(t("View:Popup:FolderSystem"))},s.prototype.deleteFolder=function(e){if(e&&e.canBeDeleted()&&e.deleteAccess()&&0===e.privateMessageCountAll()){this.folderForDeletion(null);var s=function(t){return e===t?!0:(t.subFolders.remove(s),!1)};e&&(u.set(o.ClientSideKeyName.FoldersLashHash,""),r.folderList.remove(s),r.foldersDeleting(!0),c.folderDelete(function(e,s){r.foldersDeleting(!1),o.StorageResultType.Success===e&&s&&s.Result||r.foldersListError(s&&s.ErrorCode?n.getNotification(s.ErrorCode):n.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),t("App:RainLoop").folders()},e.fullNameRaw),l.removeFolderFromCacheList(e.fullNameRaw))}else 0"},s.prototype.addNewIdentity=function(){t("App:Knoin").showScreenPopup(t("View:Popup:Identity"))},s.prototype.editIdentity=function(e){t("App:Knoin").showScreenPopup(t("View:Popup:Identity"),[e])},s.prototype.deleteIdentity=function(e){if(e&&e.deleteAccess()){this.identityForDeletion(null);var s=function(t){return e===t};e&&(this.identities.remove(s),c.identityDelete(function(){t("App:RainLoop").accountsAndIdentities()},e.id))}},s.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=l.signature();this.editor=new r(e.signatureDom(),function(){l.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)}),i.delay(function(){var e=a.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),s=a.settingsSaveHelperSimpleFunction(t.replyTrigger,t),i=a.settingsSaveHelperSimpleFunction(t.signatureTrigger,t),o=a.settingsSaveHelperSimpleFunction(t.defaultIdentityIDTrigger,t);l.defaultIdentityID.subscribe(function(e){c.saveSettings(o,{DefaultIdentityID:e})}),l.displayName.subscribe(function(t){c.saveSettings(e,{DisplayName:t})}),l.replyTo.subscribe(function(e){c.saveSettings(s,{ReplyTo:e})}),l.signature.subscribe(function(e){c.saveSettings(i,{Signature:e})}),l.signatureToAll.subscribe(function(e){c.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},e.exports=s}(t,e)},{"App:Knoin":27,"App:RainLoop":3,Enums:7,HtmlEditor:10,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,"View:Popup:Identity":88,_:25,ko:22}],56:[function(e,t){!function(e,t){"use strict";function s(){this.editor=null,this.displayName=l.displayName,this.signature=l.signature,this.signatureToAll=l.signatureToAll,this.replyTo=l.replyTo,this.signatureDom=o.observable(null),this.displayNameTrigger=o.observable(n.SaveSettingsStep.Idle),this.replyTrigger=o.observable(n.SaveSettingsStep.Idle),this.signatureTrigger=o.observable(n.SaveSettingsStep.Idle)}var i=t("_"),o=t("ko"),n=t("Enums"),a=t("Utils"),r=t("HtmlEditor"),l=t("Storage:RainLoop:Data"),c=t("Storage:RainLoop:Remote");s.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=l.signature();this.editor=new r(e.signatureDom(),function(){l.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;i.delay(function(){var t=a.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),s=a.settingsSaveHelperSimpleFunction(e.replyTrigger,e),i=a.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);l.displayName.subscribe(function(e){c.saveSettings(t,{DisplayName:e})}),l.replyTo.subscribe(function(e){c.saveSettings(s,{ReplyTo:e})}),l.signature.subscribe(function(e){c.saveSettings(i,{Signature:e})}),l.signatureToAll.subscribe(function(e){c.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},e.exports=s}(t,e)},{Enums:7,HtmlEditor:10,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,_:25,ko:22}],57:[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("App:Knoin"),n=t("Storage:RainLoop:Data");s.prototype.addOpenPgpKey=function(){o.showScreenPopup(t("View:Popup:AddOpenPgpKey"))},s.prototype.generateOpenPgpKey=function(){o.showScreenPopup(t("View:Popup:NewOpenPgpKey"))},s.prototype.viewOpenPgpKey=function(e){e&&o.showScreenPopup(t("View:Popup:ViewOpenPgpKey"),[e])},s.prototype.deleteOpenPgpKey=function(e){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(),t("App:RainLoop").reloadOpenPgpKeys()))},e.exports=s}(t,e)},{"App:Knoin":27,"App:RainLoop":3,"Storage:RainLoop:Data":64,"View:Popup:AddOpenPgpKey":78,"View:Popup:NewOpenPgpKey":91,"View:Popup:ViewOpenPgpKey":93,ko:22}],58:[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(),a.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"),a=t("Utils"),r=t("Storage:RainLoop:Remote");s.prototype.showSecret=function(){this.secreting(!0),r.showTwoFactorSecret(this.onSecretResult)},s.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},s.prototype.createTwoFactor=function(){this.processing(!0),r.createTwoFactor(this.onResult)},s.prototype.enableTwoFactor=function(){this.processing(!0),r.enableTwoFactor(this.onResult,this.viewEnable())},s.prototype.testTwoFactor=function(){t("App:Knoin").showScreenPopup(t("View:Popup:TwoFactorTest"))},s.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),r.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(a.pString(t.Result.User)),this.viewEnable(!!t.Result.Enable),this.twoFactorStatus(!!t.Result.IsSet),this.viewSecret(a.pString(t.Result.Secret)),this.viewBackupCodes(a.pString(t.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(a.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&&r.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(a.pString(t.Result.Secret)),this.viewUrl(a.pString(t.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},s.prototype.onBuild=function(){this.processing(!0),r.getTwoFactor(this.onResult)},e.exports=s}(t,e)},{"App:Knoin":27,Enums:7,Globals:9,"Storage:RainLoop:Remote":68,Utils:14,"View:Popup:TwoFactorTest":92,ko:22}],59:[function(e,t){!function(e,t){"use strict";function s(){var e=t("Utils"),s=t("Storage:RainLoop:Data");this.googleEnable=s.googleEnable,this.googleActions=s.googleActions,this.googleLoggined=s.googleLoggined,this.googleUserName=s.googleUserName,this.facebookEnable=s.facebookEnable,this.facebookActions=s.facebookActions,this.facebookLoggined=s.facebookLoggined,this.facebookUserName=s.facebookUserName,this.twitterEnable=s.twitterEnable,this.twitterActions=s.twitterActions,this.twitterLoggined=s.twitterLoggined,this.twitterUserName=s.twitterUserName,this.connectGoogle=e.createCommand(this,function(){this.googleLoggined()||t("App:RainLoop").googleConnect()
-},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=e.createCommand(this,function(){t("App:RainLoop").googleDisconnect()}),this.connectFacebook=e.createCommand(this,function(){this.facebookLoggined()||t("App:RainLoop").facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=e.createCommand(this,function(){t("App:RainLoop").facebookDisconnect()}),this.connectTwitter=e.createCommand(this,function(){this.twitterLoggined()||t("App:RainLoop").twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=e.createCommand(this,function(){t("App:RainLoop").twitterDisconnect()})}e.exports=s}(t,e)},{"App:RainLoop":3,"Storage:RainLoop:Data":64,Utils:14}],60:[function(e,t){!function(e,t){"use strict";function s(){var e=this;this.mainTheme=u.mainTheme,this.themesObjects=a.observableArray([]),this.themeTrigger=a.observable(r.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,u.theme.subscribe(function(t){o.each(this.themesObjects(),function(e){e.selected(t===e.name)});var s=n("#rlThemeLink"),a=n("#rlThemeStyle"),c=s.attr("href");c||(c=a.attr("data-href")),c&&(c=c.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+t+"/-/"),c=c.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/0/User/"),"Json/"!==c.substring(c.length-5,c.length)&&(c+="Json/"),i.clearTimeout(e.iTimer),e.themeTrigger(r.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=n.ajax({url:c,dataType:"json"}).done(function(t){t&&l.isArray(t)&&2===t.length&&(!s||!s[0]||a&&a[0]||(a=n(''),s.after(a),s.remove()),a&&a[0]&&(a.attr("data-href",c).attr("data-theme",t[0]),a&&a[0]&&a[0].styleSheet&&!l.isUnd(a[0].styleSheet.cssText)?a[0].styleSheet.cssText=t[1]:a.text(t[1])),e.themeTrigger(r.SaveSettingsStep.TrueResult))}).always(function(){e.iTimer=i.setTimeout(function(){e.themeTrigger(r.SaveSettingsStep.Idle)},1e3),e.oLastAjax=null})),d.saveSettings(null,{Theme:t})},this)}var i=t("window"),o=t("_"),n=t("$"),a=t("ko"),r=t("Enums"),l=t("Utils"),c=t("LinkBuilder"),u=t("Storage:RainLoop:Data"),d=t("Storage:RainLoop:Remote");s.prototype.onBuild=function(){var e=u.theme();this.themesObjects(o.map(u.themes(),function(t){return{name:t,nameDisplay:l.convertThemeName(t),selected:a.observable(t===e),themePreviewSrc:c.themePreviewLink(t)}}))},e.exports=s}(t,e)},{$:20,Enums:7,LinkBuilder:11,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,_:25,ko:22,window:26}],61:[function(e,t){!function(e,t){"use strict";function s(){o.initDataConstructorBySettings(this)}var i=t("Enums"),o=t("Utils"),n=t("Storage:Settings");s.prototype.populateDataOnStart=function(){var e=o.pInt(n.settingsGet("Layout")),t=n.settingsGet("Languages"),s=n.settingsGet("Themes");o.isArray(t)&&this.languages(t),o.isArray(s)&&this.themes(s),this.mainLanguage(n.settingsGet("Language")),this.mainTheme(n.settingsGet("Theme")),this.capaAdditionalAccounts(n.capa(i.Capa.AdditionalAccounts)),this.capaAdditionalIdentities(n.capa(i.Capa.AdditionalIdentities)),this.capaGravatar(n.capa(i.Capa.Gravatar)),this.determineUserLanguage(!!n.settingsGet("DetermineUserLanguage")),this.determineUserDomain(!!n.settingsGet("DetermineUserDomain")),this.capaThemes(n.capa(i.Capa.Themes)),this.allowLanguagesOnLogin(!!n.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!n.settingsGet("AllowLanguagesOnSettings")),this.useLocalProxyForExternalImages(!!n.settingsGet("UseLocalProxyForExternalImages")),this.editorDefaultType(n.settingsGet("EditorDefaultType")),this.showImages(!!n.settingsGet("ShowImages")),this.contactsAutosave(!!n.settingsGet("ContactsAutosave")),this.interfaceAnimation(n.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(n.settingsGet("MPP")),this.desktopNotifications(!!n.settingsGet("DesktopNotifications")),this.useThreads(!!n.settingsGet("UseThreads")),this.replySameFolder(!!n.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!n.settingsGet("UseCheckboxesInList")),this.layout(i.Layout.SidePreview),-1(new i.Date).getTime()-g),f&&l.oRequests[f]&&(l.oRequests[f].__aborted&&(o="abort"),l.oRequests[f]=null),l.defaultResponse(e,f,o,s,n,t)}),f&&0=e?1:e},this),this.mainMessageListSearch=a.computed({read:this.messageListSearch,write:function(e){m.setHash(p.mailBox(this.currentFolderFullNameHash(),1,d.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 f,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?c.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),c.Layout.NoPreview===this.layout()&&-10?i.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(c.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=o.throttle(this.purgeMessageBodyCache,3e4)}var i=t("window"),o=t("_"),n=t("$"),a=t("ko"),r=t("moment"),l=t("Consts"),c=t("Enums"),u=t("Globals"),d=t("Utils"),p=t("LinkBuilder"),h=t("Storage:Settings"),g=t("Storage:RainLoop:Cache"),m=t("App:Knoin"),f=t("Model:Message"),b=t("Storage:LocalStorage"),y=t("Storage:Abstract:Data");o.extend(s.prototype,y.prototype),s.prototype.purgeMessageBodyCache=function(){var e=0,t=null,s=u.iMessageBodyCacheCount-l.Values.MessageBodyCacheLimit;s>0&&(t=this.messagesBodiesDom(),t&&(t.find(".rl-cache-class").each(function(){var t=n(this);s>t.data("rl-cache-count")&&(t.addClass("rl-cache-purge"),e++)}),e>0&&o.delay(function(){t.find(".rl-cache-purge").remove()},300)))},s.prototype.populateDataOnStart=function(){y.prototype.populateDataOnStart.call(this),this.accountEmail(h.settingsGet("Email")),this.accountIncLogin(h.settingsGet("IncLogin")),this.accountOutLogin(h.settingsGet("OutLogin")),this.projectHash(h.settingsGet("ProjectHash")),this.defaultIdentityID(h.settingsGet("DefaultIdentityID")),this.displayName(h.settingsGet("DisplayName")),this.replyTo(h.settingsGet("ReplyTo")),this.signature(h.settingsGet("Signature")),this.signatureToAll(!!h.settingsGet("SignatureToAll")),this.enableTwoFactor(!!h.settingsGet("EnableTwoFactor")),this.lastFoldersHash=b.get(c.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!h.settingsGet("RemoteSuggestions"),this.devEmail=h.settingsGet("DevEmail"),this.devPassword=h.settingsGet("DevPassword")},s.prototype.initUidNextAndNewMessages=function(e,t,s){if("INBOX"===e&&d.isNormal(t)&&""!==t){if(d.isArray(s)&&03)l(p.notificationMailIcon(),this.accountEmail(),d.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:r}));else for(;r>a;a++)l(p.notificationMailIcon(),f.emailsToLine(f.initEmailsFromJson(s[a].From),!1),s[a].Subject)}g.setFolderUidNext(e,t)}},s.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},s.prototype.getNextFolderNames=function(e){e=d.isUnd(e)?!1:!!e;var t=[],s=10,i=r().unix(),n=i-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 o=g.getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),o.uniq(t)},s.prototype.removeMessagesFromList=function(e,t,s,i){s=d.isNormal(s)?s:"",i=d.isUnd(i)?!1:!!i,t=o.map(t,function(e){return d.pInt(e)});var n=this,a=0,r=this.messageList(),l=g.getFolderFromCacheList(e),c=""===s?null:g.getFolderFromCacheList(s||""),u=this.currentFolderFullNameRaw(),p=this.message(),h=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)),0100)&&(e.addClass("rl-bq-switcher hidden-bq"),n('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),d.windowResize()}).after("
").before("
"))})}},s.prototype.setMessage=function(e,t){var s=!1,i=!1,o=!1,a=null,r=null,l="",p="",h=!1,m=!1,f=this.messagesBodiesDom(),b=this.message();e&&b&&e.Result&&"Object/Message"===e.Result["@Object"]&&b.folderFullNameRaw===e.Result.Folder&&b.uid===e.Result.Uid&&(this.messageError(""),b.initUpdateByMessageJson(e.Result),g.addRequestedMessage(b.folderFullNameRaw,b.uid),t||b.initFlagsByJson(e.Result),f=f&&f[0]?f:null,f&&(l="rl-mgs-"+b.hash.replace(/[^a-zA-Z0-9]/g,""),r=f.find("#"+l),r&&r[0]?(b.body=r,b.body&&(b.body.data("rl-cache-count",++u.iMessageBodyCacheCount),b.fetchDataToDom())):(i=!!e.Result.HasExternals,o=!!e.Result.HasInternals,a=n('').hide().addClass("rl-cache-class"),a.data("rl-cache-count",++u.iMessageBodyCacheCount),d.isNormal(e.Result.Html)&&""!==e.Result.Html?(s=!0,p=e.Result.Html.toString()):d.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(s=!1,p=d.plainToHtml(e.Result.Plain.toString(),!1),(b.isPgpSigned()||b.isPgpEncrypted())&&this.capaOpenPGP()&&(b.plainRaw=d.pString(e.Result.Plain),m=/---BEGIN PGP MESSAGE---/.test(b.plainRaw),m||(h=/-----BEGIN PGP SIGNED MESSAGE-----/.test(b.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(b.plainRaw)),u.$div.empty(),h&&b.isPgpSigned()?p=u.$div.append(n('').text(b.plainRaw)).html():m&&b.isPgpEncrypted()&&(p=u.$div.append(n('').text(b.plainRaw)).html()),u.$div.empty(),b.isPgpSigned(h),b.isPgpEncrypted(m))):s=!1,a.html(d.linkify(p)).addClass("b-text-part "+(s?"html":"plain")),b.isHtml(!!s),b.hasImages(!!i),b.pgpSignedVerifyStatus(c.SignedVerifyStatus.None),b.pgpSignedVerifyUser(""),b.body=a,b.body&&f.append(b.body),b.storeDataToDom(),o&&b.showInternalImages(!0),b.hasImages()&&this.showImages()&&b.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(b.body),this.hideMessageBodies(),b.body.show(),a&&this.initBlockquoteSwitcher(a)),g.initMessageFlagsFromCache(b),b.unseen()&&u.__APP&&u.__APP.setMessageSeen(b),d.windowResize())},s.prototype.calculateMessageListHash=function(e){return o.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},s.prototype.findPublicKeyByHex=function(e){return o.find(this.openpgpkeysPublic(),function(t){return t&&e===t.id})},s.prototype.findPublicKeysByEmail=function(e){return o.compact(o.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,n=o.find(this.openpgpkeysPrivate(),function(t){return t&&e===t.email});if(n)try{s=i.openpgp.key.readArmored(n.armor),s&&!s.err&&s.keys&&s.keys[0]?(s=s.keys[0],s.decrypt(d.pString(t))):s=null}catch(a){s=null}return s},s.prototype.findSelfPrivateKey=function(e){return this.findPrivateKeyByEmail(this.accountEmail(),e)},e.exports=new s}(t,e)},{$:20,"App:Knoin":27,Consts:6,Enums:7,Globals:9,LinkBuilder:11,"Model:Message":42,"Storage:Abstract:Data":61,"Storage:LocalStorage":65,"Storage:RainLoop:Cache":63,"Storage:Settings":69,Utils:14,_:25,ko:22,moment:23,window:26}],65:[function(e,t){!function(e,t){"use strict";function s(){var e=t("_").find([t("Storage:LocalStorage:LocalStorage"),t("Storage:LocalStorage:Cookie")],function(e){return e&&e.supported()});this.oDriver=null,e&&(this.oDriver=new e)}s.prototype.oDriver=null,s.prototype.set=function(e,t){return this.oDriver?this.oDriver.set("p"+e,t):!1},s.prototype.get=function(e){return this.oDriver?this.oDriver.get("p"+e):null},e.exports=new s}(t,e)},{"Storage:LocalStorage:Cookie":66,"Storage:LocalStorage:LocalStorage":67,_:25}],66:[function(e,t){!function(e,t){"use strict";function s(){}var i=t("$"),o=t("JSON"),n=t("Consts"),a=t("Utils");s.supported=function(){return!(!window.navigator||!window.navigator.cookieEnabled)},s.prototype.set=function(e,t){var s=i.cookie(n.Values.ClientSideStorageIndexName),a=!1,r=null;try{r=null===s?null:o.parse(s)}catch(l){}r||(r={}),r[e]=t;try{i.cookie(n.Values.ClientSideStorageIndexName,o.stringify(r),{expires:30}),a=!0}catch(l){}return a},s.prototype.get=function(e){var t=i.cookie(n.Values.ClientSideStorageIndexName),s=null;try{s=null===t?null:o.parse(t),s=s&&!a.isUnd(s[e])?s[e]:null}catch(r){}return s},e.exports=s}(t,e)},{$:20,Consts:6,JSON:15,Utils:14}],67:[function(e,t){!function(e,t){"use strict";function s(){}var i=t("window"),o=t("JSON"),n=t("Consts"),a=t("Utils");s.supported=function(){return!!i.localStorage},s.prototype.set=function(e,t){var s=i.localStorage[n.Values.ClientSideStorageIndexName]||null,a=!1,r=null;try{r=null===s?null:o.parse(s)}catch(l){}r||(r={}),r[e]=t;try{i.localStorage[n.Values.ClientSideStorageIndexName]=o.stringify(r),a=!0}catch(l){}return a},s.prototype.get=function(e){var t=i.localStorage[n.Values.ClientSideStorageIndexName]||null,s=null;try{s=null===t?null:o.parse(t),s=s&&!a.isUnd(s[e])?s[e]:null}catch(r){}return s},e.exports=s}(t,e)},{Consts:6,JSON:15,Utils:14,window:26}],68:[function(e,t){!function(e,t){"use strict";function s(){d.call(this),this.oRequests={}}var i=t("_"),o=t("Utils"),n=t("Consts"),a=t("Globals"),r=t("Base64"),l=t("Storage:Settings"),c=t("Storage:RainLoop:Cache"),u=t("Storage:RainLoop:Data"),d=t("Storage:Abstract:Remote");i.extend(s.prototype,d.prototype),s.prototype.folders=function(e){this.defaultRequest(e,"Folders",{SentFolder:l.settingsGet("SentFolder"),DraftFolder:l.settingsGet("DraftFolder"),SpamFolder:l.settingsGet("SpamFolder"),TrashFolder:l.settingsGet("TrashFolder"),ArchiveFolder:l.settingsGet("ArchiveFolder")},null,"",["Folders"])},s.prototype.login=function(e,t,s,i,o,n,a,r){this.defaultRequest(e,"Login",{Email:t,Login:s,Password:i,Language:n||"",AdditionalCode:a||"",AdditionalCodeSignMe:r?"1":"0",SignMe:o?"1":"0"})},s.prototype.getTwoFactor=function(e){this.defaultRequest(e,"GetTwoFactorInfo")},s.prototype.createTwoFactor=function(e){this.defaultRequest(e,"CreateTwoFactorSecret")},s.prototype.clearTwoFactor=function(e){this.defaultRequest(e,"ClearTwoFactorInfo")},s.prototype.showTwoFactorSecret=function(e){this.defaultRequest(e,"ShowTwoFactorSecret")},s.prototype.testTwoFactor=function(e,t){this.defaultRequest(e,"TestTwoFactorInfo",{Code:t})},s.prototype.enableTwoFactor=function(e,t){this.defaultRequest(e,"EnableTwoFactor",{Enable:t?"1":"0"})},s.prototype.clearTwoFactorInfo=function(e){this.defaultRequest(e,"ClearTwoFactorInfo")
-},s.prototype.contactsSync=function(e){this.defaultRequest(e,"ContactsSync",null,n.Defaults.ContactsSyncAjaxTimeout)},s.prototype.saveContactsSyncData=function(e,t,s,i,o){this.defaultRequest(e,"SaveContactsSyncData",{Enable:t?"1":"0",Url:s,User:i,Password:o})},s.prototype.accountAdd=function(e,t,s,i){this.defaultRequest(e,"AccountAdd",{Email:t,Login:s,Password:i})},s.prototype.accountDelete=function(e,t){this.defaultRequest(e,"AccountDelete",{EmailToDelete:t})},s.prototype.identityUpdate=function(e,t,s,i,o,n){this.defaultRequest(e,"IdentityUpdate",{Id:t,Email:s,Name:i,ReplyTo:o,Bcc:n})},s.prototype.identityDelete=function(e,t){this.defaultRequest(e,"IdentityDelete",{IdToDelete:t})},s.prototype.accountsAndIdentities=function(e){this.defaultRequest(e,"AccountsAndIdentities")},s.prototype.messageList=function(e,t,s,i,a,l){t=o.pString(t);var d=c.getFolderHash(t);l=o.isUnd(l)?!1:!!l,s=o.isUnd(s)?0:o.pInt(s),i=o.isUnd(s)?20:o.pInt(i),a=o.pString(a),""===d||""!==a&&-1!==a.indexOf("is:")?this.defaultRequest(e,"MessageList",{Folder:t,Offset:s,Limit:i,Search:a,UidNext:"INBOX"===t?c.getFolderUidNext(t):"",UseThreads:u.threading()&&u.useThreads()?"1":"0",ExpandedThreadUid:u.threading()&&t===u.messageListThreadFolder()?u.messageListThreadUids().join(","):""},""===a?n.Defaults.DefaultAjaxTimeout:n.Defaults.SearchAjaxTimeout,"",l?[]:["MessageList"]):this.defaultRequest(e,"MessageList",{},""===a?n.Defaults.DefaultAjaxTimeout:n.Defaults.SearchAjaxTimeout,"MessageList/"+r.urlsafe_encode([t,s,i,a,u.projectHash(),d,"INBOX"===t?c.getFolderUidNext(t):"",u.threading()&&u.useThreads()?"1":"0",u.threading()&&t===u.messageListThreadFolder()?u.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),l?[]:["MessageList"])},s.prototype.messageUploadAttachments=function(e,t){this.defaultRequest(e,"MessageUploadAttachments",{Attachments:t},999e3)},s.prototype.message=function(e,t,s){return t=o.pString(t),s=o.pInt(s),c.getFolderFromCacheList(t)&&s>0?(this.defaultRequest(e,"Message",{},null,"Message/"+r.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,r=[];o.isArray(s)&&0-1&&r.eq(o).removeClass("focused"),38===a&&o>0?o--:40===a&&oi)?(this.oContentScrollable.scrollTop(s.top<0?this.oContentScrollable.scrollTop()+s.top-e:this.oContentScrollable.scrollTop()+s.top-i+o+e),!0):!1},s.prototype.messagesDrop=function(e,s){if(e&&s&&s.helper){var i=s.helper.data("rl-folder"),o=u.$html.hasClass("rl-ctrl-key-pressed"),n=s.helper.data("rl-uids");l.isNormal(i)&&""!==i&&l.isArray(n)&&t("App:RainLoop").moveMessagesToFolder(i,n,e.fullNameRaw,o)}},s.prototype.composeClick=function(){m.showScreenPopup(t("View:Popup:Compose"))},s.prototype.createFolder=function(){m.showScreenPopup(t("View:Popup:FolderCreate"))},s.prototype.configureFolders=function(){m.setHash(d.settings("folders"))},s.prototype.contactsClick=function(){this.allowContacts&&m.showScreenPopup(t("View:Popup:Contacts"))},e.exports=s}(t,e)},{$:20,"App:Knoin":27,"App:RainLoop":3,Enums:7,Globals:9,"Knoin:AbstractViewModel":30,LinkBuilder:11,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:Settings":69,Utils:14,"View:Popup:Compose":82,"View:Popup:Contacts":83,"View:Popup:FolderCreate":86,_:25,key:21,ko:22,window:26}],74:[function(e,t){!function(e,t){"use strict";function s(){w.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="",this.hideDangerousActions=!!f.settingsGet("HideDangerousActions"),this.popupVisibility=d.popupVisibility,this.message=y.message,this.messageList=y.messageList,this.folderList=y.folderList,this.currentMessage=y.currentMessage,this.isMessageSelected=y.isMessageSelected,this.messageListSearch=y.messageListSearch,this.messageListError=y.messageListError,this.folderMenuForMove=y.folderMenuForMove,this.useCheckboxesInList=y.useCheckboxesInList,this.mainMessageListSearch=y.mainMessageListSearch,this.messageListEndFolder=y.messageListEndFolder,this.messageListChecked=y.messageListChecked,this.messageListCheckedOrSelected=y.messageListCheckedOrSelected,this.messageListCheckedOrSelectedUidsWithSubMails=y.messageListCheckedOrSelectedUidsWithSubMails,this.messageListCompleteLoadingThrottle=y.messageListCompleteLoadingThrottle,p.initOnStartOrLangChange(function(){this.emptySubjectValue=p.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=y.userQuota,this.userUsageSize=y.userUsageSize,this.userUsageProc=y.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!==y.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=n.computed(function(){var e=y.messageListEndSearch();return""===e?"":p.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:e})}),this.messageListPagenator=n.computed(p.computedPagenatorHelper(y.messageListPage,y.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){return this.canBeMoved()&&t("App:RainLoop").moveMessagesToFolder(y.currentFolderFullNameRaw(),y.messageListCheckedOrSelectedUidsWithSubMails(),e,s),!1},s.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=p.draggeblePlace(),s=y.messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",y.currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),i.defer(function(){var e=y.messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},s.prototype.onMessageResponse=function(e,t,s){y.hideMessageBodies(),y.messageLoading(!1),c.StorageResultType.Success===e&&t&&t.Result?y.setMessage(t,s):c.StorageResultType.Unload===e?(y.message(null),y.messageError("")):c.StorageResultType.Abort!==e&&(y.message(null),y.messageError(p.getNotification(t&&t.ErrorCode?t.ErrorCode:c.Notification.UnknownError)))},s.prototype.populateMessageBody=function(e){e&&(S.message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?y.messageLoading(!0):p.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},s.prototype.setAction=function(e,s,o){var n=[],a=null,r=0;if(p.isUnd(o)&&(o=y.messageListChecked()),n=i.map(o,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){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),t("App:RainLoop").reloadFlagsCurrentMessageListAndMessageFromCache())},e.exports=s}(t,e)},{$:20,"App:Knoin":27,"App:RainLoop":3,Consts:6,Enums:7,Events:8,Globals:9,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,"View:Popup:Compose":82,_:25,key:21,ko:22}],76:[function(e,t){!function(e,t){"use strict";function s(){n.call(this),o.constructorEnd(this)}var i=t("_"),o=t("App:Knoin"),n=t("View:RainLoop:AbstractSystemDropDown");o.extendAsViewModel(["View:RainLoop:MailBoxSystemDropDown","MailBoxSystemDropDownViewModel"],s),i.extend(s.prototype,n.prototype),e.exports=s}(t,e)},{"App:Knoin":27,"View:RainLoop:AbstractSystemDropDown":71,_:25}],77:[function(e,t){!function(e,t){"use strict";function s(){c.call(this,"Popups","PopupsAddAccount"),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=a.createCommand(this,function(){return this.emailError(""===a.trim(this.email())),this.passwordError(""===a.trim(this.password())),this.emailError()||this.passwordError()?!1:(this.submitRequest(!0),r.accountAdd(i.bind(function(e,s){this.submitRequest(!1),n.StorageResultType.Success===e&&s&&"AccountAdd"===s.Action?s.Result?(t("App:RainLoop").accountsAndIdentities(),this.cancelCommand()):s.ErrorCode&&this.submitError(a.getNotification(s.ErrorCode)):this.submitError(a.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"),a=t("Utils"),r=t("Storage:RainLoop:Remote"),l=t("App:Knoin"),c=t("Knoin:AbstractViewModel");l.extendAsViewModel(["View:Popup:AddAccount","PopupsAddAccountViewModel"],s),i.extend(s.prototype,c.prototype),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)},{"App:Knoin":27,"App:RainLoop":3,Enums:7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Remote":68,Utils:14,_:25,ko:22}],78:[function(e,t){!function(e,t){"use strict";function s(){l.call(this,"Popups","PopupsAddOpenPgpKey"),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=n.createCommand(this,function(){var e=30,s=null,i=n.trim(this.key()),o=/[\-]{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,r=a.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),!r||this.key.error())return!1;for(;;){if(s=o.exec(i),!s||0>e)break;s[0]&&s[1]&&s[2]&&s[1]===s[2]&&("PRIVATE"===s[1]?r.privateKeys.importKey(s[0]):"PUBLIC"===s[1]&&r.publicKeys.importKey(s[0])),e--}return r.store(),t("App:RainLoop").reloadOpenPgpKeys(),n.delegateRun(this,"cancelCommand"),!0}),r.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("Utils"),a=t("Storage:RainLoop:Data"),r=t("App:Knoin"),l=t("Knoin:AbstractViewModel");r.extendAsViewModel(["View:Popup:AddOpenPgpKey","PopupsAddOpenPgpKeyViewModel"],s),i.extend(s.prototype,l.prototype),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)},{"App:Knoin":27,"App:RainLoop":3,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,Utils:14,_:25,ko:22}],79:[function(e,t){!function(e,t){"use strict";function s(){c.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=a.createCommand(this,function(){var e=this.buildSearchString();""!==e&&r.mainMessageListSearch(e),this.cancelCommand()}),l.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("moment"),a=t("Utils"),r=t("Storage:RainLoop:Data"),l=t("App:Knoin"),c=t("Knoin:AbstractViewModel");l.extendAsViewModel(["View:Popup:AdvancedSearch","PopupsAdvancedSearchViewModel"],s),i.extend(s.prototype,c.prototype),s.prototype.buildSearchStringValue=function(e){return-1"},s.prototype.sendMessageResponse=function(e,t){var s=!1,o="";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),i.alert(p.trim(p.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(o=p.getNotification(t&&t.ErrorCode?t.ErrorCode:u.Notification.CantSendMessage,t&&t.ErrorMessage?t.ErrorMessage:""),this.sendError(!0),i.alert(o||p.getNotification(u.Notification.CantSendMessage)))),this.reloadDraftFolder()},s.prototype.saveMessageResponse=function(e,t){var s=!1,o=null;this.saving(!1),u.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()?o.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,i,a){C.routeOff();var r=this,l="",c="",d="",h="",g="",m=null,f="",b="",S=[],w={},A=y.accountEmail(),F=y.signature(),T=y.signatureToAll(),R=[],L=null,E=null,N=e||u.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&&p.isNormal(t)&&(E=p.isArray(t)&&1===t.length?t[0]:p.isArray(t)?null:t),null!==A&&(w[A]=!0),this.currentIdentityID(this.findIdentityIdByMessage(N,E)),this.reset(),p.isNonEmptyArray(s)&&this.to(P(s)),""!==N&&E){switch(h=E.fullFormatDateValue(),g=E.subject(),L=E.aDraftInfo,m=n(E.body).clone(),m&&(m.find("blockquote.rl-bq-switcher").each(function(){n(this).removeClass("rl-bq-switcher hidden-bq")}),m.find(".rlBlockquoteSwitcher").each(function(){n(this).remove()})),m.find("[data-html-editor-font-wrapper]").removeAttr("data-html-editor-font-wrapper"),f=m.html(),N){case u.ComposeType.Empty:break;case u.ComposeType.Reply:this.to(P(E.replyEmails(w))),this.subject(p.replySubjectAdd("Re",g)),this.prepearMessageAttachments(E,N),this.aDraftInfo=["reply",E.uid,E.folderFullNameRaw],this.sInReplyTo=E.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+E.sReferences);break;case u.ComposeType.ReplyAll:S=E.replyAllEmails(w),this.to(P(S[0])),this.cc(P(S[1])),this.subject(p.replySubjectAdd("Re",g)),this.prepearMessageAttachments(E,N),this.aDraftInfo=["reply",E.uid,E.folderFullNameRaw],this.sInReplyTo=E.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+E.references());break;case u.ComposeType.Forward:this.subject(p.replySubjectAdd("Fwd",g)),this.prepearMessageAttachments(E,N),this.aDraftInfo=["forward",E.uid,E.folderFullNameRaw],this.sInReplyTo=E.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+E.sReferences);break;case u.ComposeType.ForwardAsAttachment:this.subject(p.replySubjectAdd("Fwd",g)),this.prepearMessageAttachments(E,N),this.aDraftInfo=["forward",E.uid,E.folderFullNameRaw],this.sInReplyTo=E.sMessageId,this.sReferences=p.trim(this.sInReplyTo+" "+E.sReferences);break;case u.ComposeType.Draft:this.to(P(E.to)),this.cc(P(E.cc)),this.bcc(P(E.bcc)),this.bFromDraft=!0,this.draftFolder(E.folderFullNameRaw),this.draftUid(E.uid),this.subject(g),this.prepearMessageAttachments(E,N),this.aDraftInfo=p.isNonEmptyArray(L)&&3===L.length?L:null,this.sInReplyTo=E.sInReplyTo,this.sReferences=E.sReferences;break;case u.ComposeType.EditAsNew:this.to(P(E.to)),this.cc(P(E.cc)),this.bcc(P(E.bcc)),this.subject(g),this.prepearMessageAttachments(E,N),this.aDraftInfo=p.isNonEmptyArray(L)&&3===L.length?L:null,this.sInReplyTo=E.sInReplyTo,this.sReferences=E.sReferences}switch(N){case u.ComposeType.Reply:case u.ComposeType.ReplyAll:l=E.fromToLine(!1,!0),b=p.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:h,EMAIL:l}),f="
"+b+":"+f+"
";break;case u.ComposeType.Forward:l=E.fromToLine(!1,!0),c=E.toToLine(!1,!0),d=E.ccToLine(!1,!0),f="
"+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(g)+"
"+f;break;case u.ComposeType.ForwardAsAttachment:f=""}T&&""!==F&&u.ComposeType.EditAsNew!==N&&u.ComposeType.Draft!==N&&(f=this.convertSignature(F,P(E.from,!0),f,N)),this.editor(function(e){e.setHtml(f,!1),E.isHtml()||e.modeToggle(!1)})}else u.ComposeType.Empty===N?(this.subject(p.isNormal(i)?""+i:""),f=p.isNormal(a)?""+a:"",T&&""!==F&&(f=this.convertSignature(F,"",p.convertPlainTextToHtml(f),N)),this.editor(function(e){e.setHtml(f,!1),u.EditorDefaultType.Html!==y.editorDefaultType()&&e.modeToggle(!1)})):p.isNonEmptyArray(t)&&o.each(t,function(e){r.addMessageAsAttachment(e)});R=this.getAttachmentsDownloadsForUpload(),p.isNonEmptyArray(R)&&v.messageUploadAttachments(function(e,t){if(u.StorageResultType.Success===e&&t&&t.Result){var s=null,i="";if(!r.viewModelVisibility())for(i in t.Result)t.Result.hasOwnProperty(i)&&(s=r.getAttachmentById(t.Result[i]),s&&s.tempName(i))}else r.setMessageAttachmentFailedDowbloadText()},R),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,s=t("View:Popup:Ask");C.isPopupVisible(s)||C.showScreenPopup(s,[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}),h.$win.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",n(t).attr("id","dropboxjs").attr("data-app-key",b.settingsGet("DropboxApiKey")),i.document.body.appendChild(t)),this.driveEnabled()&&n.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=l.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(b.settingsGet("GoogleClientID")).setOAuthToken(e.access_token).setCallback(o.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:b.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:b.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=p.pInt(b.settingsGet("AttachmentLimit")),s=new c({action:m.upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",o.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",o.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",o.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",o.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",o.bind(function(t,s,o){var n=null;p.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",o.bind(function(e,i){this.dragAndDropOver(!1);var o=this,n=p.isUnd(i.FileName)?"":i.FileName.toString(),a=p.isNormal(i.Size)?p.pInt(i.Size):null,r=new w(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(p.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",o.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",o.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=p.getUploadErrorDescByCode(n):a||(o=p.i18n("UPLOAD/ERROR_UNKNOWN")),r&&(""!==o&&00&&o>0&&n>o?(s.uploading(!1),s.error(p.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(v.composeUploadExternals(function(e,t){var i=!1;s.uploading(!1),u.StorageResultType.Success===e&&t&&t.Result&&t.Result[s.id]&&(i=!0,s.tempName(t.Result[s.id])),i||s.error(p.getUploadErrorDescByCode(u.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=p.pInt(b.settingsGet("AttachmentLimit")),n=null,a=e.fileSize?p.pInt(e.fileSize):0;return n=new w(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(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,i=p.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(u.ComposeType.ForwardAsAttachment===t)this.addMessageAsAttachment(e);else for(;n>o;o++){switch(r=i[o],l=!1,t){case u.ComposeType.Reply:case u.ComposeType.ReplyAll:l=r.isLinked;break;case u.ComposeType.Forward:case u.ComposeType.Draft:case u.ComposeType.EditAsNew:l=!0}l&&(a=new w(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))}}},s.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},s.prototype.setMessageAttachmentFailedDowbloadText=function(){o.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 o.map(o.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)},{$:20,"App:Knoin":27,"App:RainLoop":3,Consts:6,Enums:7,Events:8,Globals:9,HtmlEditor:10,JSON:15,Jua:16,"Knoin:AbstractViewModel":30,LinkBuilder:11,"Model:ComposeAttachment":33,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,"Storage:Settings":69,Utils:14,"View:Popup:Ask":80,"View:Popup:ComposeOpenPgp":81,"View:Popup:FolderSystem":87,_:25,ko:22,moment:23,window:26}],83:[function(e,t){!function(e,t){"use strict";function s(){w.call(this,"Popups","PopupsContacts");var e=this,s=function(t){t&&0=e?1:e},this),this.contactsPagenator=a.computed(d.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=a.observable(!0),this.viewClearSearch=a.observable(!1),this.viewID=a.observable(""),this.viewReadOnly=a.observable(!1),this.viewProperties=a.observableArray([]),this.viewTags=a.observable(""),this.viewTags.visibility=a.observable(!1),this.viewTags.focusTrigger=a.observable(!1),this.viewTags.focusTrigger.subscribe(function(e){e||""!==this.viewTags()?e&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=a.observable(l.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(e){return-1=i&&(this.bDropPageAfterDelete=!0),o.delay(function(){o.each(n,function(e){t.remove(e)})},500))},s.prototype.deleteSelectedContacts=function(){00?i:0),d.isNonEmptyArray(s.Result.Tags)&&(a=o.map(s.Result.Tags,function(e){var t=new y;return t.parse(e)?t:null}),a=o.compact(a))),t.contactsCount(i),t.contacts(n),t.contacts.loading(!1),t.contactTags(a),t.viewClearSearch(""!==t.search())},s,c.Defaults.ContactsPerPage,this.search())},s.prototype.onBuild=function(e){this.oContentVisible=n(".b-list-content",e),this.oContentScrollable=n(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,l.KeyState.ContactList);var t=this;r("delete",l.KeyState.ContactList,function(){return t.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=a.dataFor(this);e&&(t.contactsPage(d.pInt(e.value)),t.reloadContactList())}),this.initUploader()},s.prototype.onShow=function(){v.routeOff(),this.reloadContactList(!0)},s.prototype.onHide=function(){v.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},e.exports=s}(t,e)},{$:20,"App:Knoin":27,"App:RainLoop":3,Consts:6,Enums:7,Globals:9,"Knoin:AbstractViewModel":30,LinkBuilder:11,"Model:Contact":34,"Model:ContactProperty":35,"Model:ContactTag":36,"Model:Email":37,Selector:13,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,"View:Popup:Compose":82,"View:Popup:Contacts":83,_:25,key:21,ko:22,window:26}],84:[function(e,t){!function(e,t){"use strict";function s(){c.call(this,"Popups","PopupsFilter"),this.filter=o.observable(null),this.selectedFolderValue=o.observable(n.Values.UnuseOptionValue),this.folderSelectList=r.folderMenuForMove,this.defautOptionsAfterRender=a.defautOptionsAfterRender,l.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("Consts"),a=t("Utils"),r=t("Storage:RainLoop:Data"),l=t("App:Knoin"),c=t("Knoin:AbstractViewModel");l.extendAsViewModel(["View:Popup:Filter","PopupsFilterViewModel"],s),i.extend(s.prototype,c.prototype),s.prototype.clearPopup=function(){},s.prototype.onShow=function(e){this.clearPopup(),this.filter(e)},e.exports=s}(t,e)},{"App:Knoin":27,Consts:6,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,Utils:14,_:25,ko:22}],85:[function(e,t){!function(e,t){"use strict";function s(){d.call(this,"Popups","PopupsFolderClear"),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 a.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=a.createCommand(this,function(){var e=this,s=this.selectedFolder();s&&(r.message(null),r.messageList([]),this.clearingProcess(!0),s.messageCountAll(0),s.messageCountUnread(0),l.setFolderHash(s.fullNameRaw,""),c.folderClear(function(s,i){e.clearingProcess(!1),n.StorageResultType.Success===s&&i&&i.Result?(t("App:RainLoop").reloadMessageList(!0),e.cancelCommand()):e.clearingError(i&&i.ErrorCode?a.getNotification(i.ErrorCode):a.getNotification(n.Notification.MailServerError))},s.fullNameRaw))},function(){var e=this.selectedFolder(),t=this.clearingProcess();return!t&&null!==e}),u.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("Enums"),a=t("Utils"),r=t("Storage:RainLoop:Data"),l=t("Storage:RainLoop:Cache"),c=t("Storage:RainLoop:Remote"),u=t("App:Knoin"),d=t("Knoin:AbstractViewModel");u.extendAsViewModel(["View:Popup:FolderClear","PopupsFolderClearViewModel"],s),i.extend(s.prototype,d.prototype),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)},{"App:Knoin":27,"App:RainLoop":3,Enums:7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Cache":63,"Storage:RainLoop:Data":64,"Storage:RainLoop:Remote":68,Utils:14,_:25,ko:22}],86:[function(e,t){!function(e,t){"use strict";function s(){d.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(a.Values.UnuseOptionValue),this.parentFolderSelectList=o.computed(function(){var e=[],t=null,s=null,i=l.folderList(),o=function(e){return e?e.isSystemFolder()?e.name()+" "+e.manageFolderSystemName():e.name():""};return e.push(["",this.sNoParentText]),""!==l.namespace&&(t=function(e){return l.namespace!==e.fullNameRaw.substr(0,l.namespace.length)}),r.folderListOptionsBuilder([],i,[],e,null,t,s,o)},this),this.createFolder=r.createCommand(this,function(){var e=this.selectedParentValue();""===e&&1 li"),o=s&&("tab"===s.shortcut||"right"===s.shortcut),n=i.index(i.filter(".active"));return!o&&n>0?n--:o&&n"),this.submitRequest(!0),o.delay(function(){n=i.openpgp.generateKeyPair({userId:s,numBits:a.pInt(e.keyBitLength()),passphrase:a.trim(e.password())}),n&&n.privateKeyArmored&&(l.privateKeys.importKey(n.privateKeyArmored),l.publicKeys.importKey(n.publicKeyArmored),l.store(),t("App:RainLoop").reloadOpenPgpKeys(),a.delegateRun(e,"cancelCommand")),e.submitRequest(!1)},100),!0)}),l.constructorEnd(this)}var i=t("window"),o=t("_"),n=t("ko"),a=t("Utils"),r=t("Storage:RainLoop:Data"),l=t("App:Knoin"),c=t("Knoin:AbstractViewModel");l.extendAsViewModel(["View:Popup:NewOpenPgpKey","PopupsNewOpenPgpKeyViewModel"],s),o.extend(s.prototype,c.prototype),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)},{"App:Knoin":27,"App:RainLoop":3,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Data":64,Utils:14,_:25,ko:22,window:26}],92:[function(e,t){!function(e,t){"use strict";function s(){c.call(this,"Popups","PopupsTwoFactorTest");var e=this;this.code=o.observable(""),this.code.focused=o.observable(!1),this.code.status=o.observable(null),this.testing=o.observable(!1),this.testCode=a.createCommand(this,function(){this.testing(!0),r.testTwoFactor(function(t,s){e.testing(!1),e.code.status(n.StorageResultType.Success===t&&s&&s.Result?!0:!1)},this.code())},function(){return""!==this.code()&&!this.testing()}),l.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("Enums"),a=t("Utils"),r=t("Storage:RainLoop:Remote"),l=t("App:Knoin"),c=t("Knoin:AbstractViewModel");l.extendAsViewModel(["View:Popup:TwoFactorTest","PopupsTwoFactorTestViewModel"],s),i.extend(s.prototype,c.prototype),s.prototype.clearPopup=function(){this.code(""),this.code.focused(!1),this.code.status(null),this.testing(!1)},s.prototype.onShow=function(){this.clearPopup()},s.prototype.onFocus=function(){this.code.focused(!0)},e.exports=s}(t,e)},{"App:Knoin":27,Enums:7,"Knoin:AbstractViewModel":30,"Storage:RainLoop:Remote":68,Utils:14,_:25,ko:22}],93:[function(e,t){!function(e,t){"use strict";function s(){r.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=o.observable(""),this.keyDom=o.observable(null),a.constructorEnd(this)}var i=t("_"),o=t("ko"),n=t("Utils"),a=t("App:Knoin"),r=t("Knoin:AbstractViewModel");a.extendAsViewModel(["View:Popup:ViewOpenPgpKey","PopupsViewOpenPgpKeyViewModel"],s),i.extend(s.prototype,r.prototype),s.prototype.clearPopup=function(){this.key("")},s.prototype.selectKey=function(){var e=this.keyDom();e&&n.selectElement(e)},s.prototype.onShow=function(e){this.clearPopup(),e&&this.key(e.armor)},e.exports=s}(t,e)},{"App:Knoin":27,"Knoin:AbstractViewModel":30,Utils:14,_:25,ko:22}],94:[function(e,t){!function(e,t){"use strict";function s(e){r.call(this,"Left","SettingsMenu"),this.leftPanelDisabled=o.leftPanelDisabled,this.menu=e.menu,a.constructorEnd(this)}var i=t("_"),o=t("Globals"),n=t("LinkBuilder"),a=t("App:Knoin"),r=t("Knoin:AbstractViewModel");a.extendAsViewModel(["View:RainLoop:SettingsMenu","SettingsMenuViewModel"],s),i.extend(s.prototype,r.prototype),s.prototype.link=function(e){return n.settings(e)},s.prototype.backToMailBoxClick=function(){a.setHash(n.inbox())},e.exports=s}(t,e)},{"App:Knoin":27,Globals:9,"Knoin:AbstractViewModel":30,LinkBuilder:11,_:25}],95:[function(e,t){!function(e,t){"use strict";function s(){c.call(this,"Right","SettingsPane"),l.constructorEnd(this)}var i=t("_"),o=t("key"),n=t("Enums"),a=t("LinkBuilder"),r=t("Storage:RainLoop:Data"),l=t("App:Knoin"),c=t("Knoin:AbstractViewModel");l.extendAsViewModel(["View:RainLoop:SettingsPane","SettingsPaneViewModel"],s),i.extend(s.prototype,c.prototype),s.prototype.onBuild=function(){var e=this;o("esc",n.KeyState.Settings,function(){e.backToMailBoxClick()})},s.prototype.onShow=function(){r.message(null)},s.prototype.backToMailBoxClick=function(){l.setHash(a.inbox())},e.exports=s}(t,e)},{"App:Knoin":27,Enums:7,"Knoin:AbstractViewModel":30,LinkBuilder:11,"Storage:RainLoop:Data":64,_:25,key:21}],96:[function(e,t){!function(e,t){"use strict";function s(){n.call(this),o.constructorEnd(this)}var i=t("_"),o=t("App:Knoin"),n=t("View:RainLoop:AbstractSystemDropDown");o.extendAsViewModel(["View:RainLoop:SettingsSystemDropDown","SettingsSystemDropDownViewModel"],s),i.extend(s.prototype,n.prototype),e.exports=s}(t,e)},{"App:Knoin":27,"View:RainLoop:AbstractSystemDropDown":71,_:25}]},{},[1]);
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/common.js b/rainloop/v/0.0.0/static/js/common.js
new file mode 100644
index 000000000..adec44ef0
--- /dev/null
+++ b/rainloop/v/0.0.0/static/js/common.js
@@ -0,0 +1,6696 @@
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+/******/ (function(modules) { // webpackBootstrap
+/******/ // install a JSONP callback for chunk loading
+/******/ var parentJsonpFunction = window["webpackJsonp"];
+/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) {
+/******/ // add "moreModules" to the modules object,
+/******/ // then flag all "chunkIds" as loaded and fire callback
+/******/ var moduleId, chunkId, i = 0, callbacks = [];
+/******/ for(;i < chunkIds.length; i++) {
+/******/ chunkId = chunkIds[i];
+/******/ if(installedChunks[chunkId])
+/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]);
+/******/ installedChunks[chunkId] = 0;
+/******/ }
+/******/ for(moduleId in moreModules) {
+/******/ modules[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);
+/******/ while(callbacks.length)
+/******/ callbacks.shift().call(null, __webpack_require__);
+/******/ if(moreModules[0]) {
+/******/ installedModules[0] = 0;
+/******/ __webpack_require__(0);
+/******/ }
+/******/ };
+/******/
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // object to store loaded and loading chunks
+/******/ // "0" means "already loaded"
+/******/ // Array means "loading", array contains callbacks
+/******/ var installedChunks = {
+/******/ 1:0
+/******/ };
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+/******/
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/ // This file contains only the entry chunk.
+/******/ // The chunk loading function for additional chunks
+/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) {
+/******/ // "0" is the signal for "already loaded"
+/******/ if(installedChunks[chunkId] === 0)
+/******/ return callback.call(null, __webpack_require__);
+/******/
+/******/ // an array means "currently loading".
+/******/ if(installedChunks[chunkId] !== undefined) {
+/******/ installedChunks[chunkId].push(callback);
+/******/ } else {
+/******/ // start chunk loading
+/******/ installedChunks[chunkId] = [callback];
+/******/ var head = document.getElementsByTagName('head')[0];
+/******/ var script = document.createElement('script');
+/******/ script.type = 'text/javascript';
+/******/ script.charset = 'utf-8';
+/******/ script.src = __webpack_require__.p + "" + {"0":"701a517c70faed82fff3","2":"16ff7c35c340aa129a8c","3":"9970c7a3777d831f5c93"}[chunkId] + ".chunk.js";
+/******/ head.appendChild(script);
+/******/ }
+/******/ };
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "rainloop/v/0.0.0/static/js/";
+/******/ })
+/************************************************************************/
+/******/ ({
+
+/***/ 1:
+/*!*****************************!*\
+ !*** ./dev/Common/Utils.js ***!
+ \*****************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ Utils = {},
+
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Globals = __webpack_require__(/*! Common/Globals */ 7)
+ ;
+
+ Utils.trim = $.trim;
+ Utils.inArray = $.inArray;
+ Utils.isArray = _.isArray;
+ Utils.isFunc = _.isFunction;
+ Utils.isUnd = _.isUndefined;
+ Utils.isNull = _.isNull;
+ Utils.emptyFunction = function () {};
+
+ /**
+ * @param {*} oValue
+ * @return {boolean}
+ */
+ Utils.isNormal = function (oValue)
+ {
+ return !Utils.isUnd(oValue) && !Utils.isNull(oValue);
+ };
+
+ Utils.windowResize = _.debounce(function (iTimeout) {
+ if (Utils.isUnd(iTimeout))
+ {
+ Globals.$win.resize();
+ }
+ else
+ {
+ window.setTimeout(function () {
+ Globals.$win.resize();
+ }, iTimeout);
+ }
+ }, 50);
+
+ /**
+ * @param {(string|number)} mValue
+ * @param {boolean=} bIncludeZero
+ * @return {boolean}
+ */
+ Utils.isPosNumeric = function (mValue, bIncludeZero)
+ {
+ return Utils.isNormal(mValue) ?
+ ((Utils.isUnd(bIncludeZero) ? true : !!bIncludeZero) ?
+ (/^[0-9]*$/).test(mValue.toString()) :
+ (/^[1-9]+[0-9]*$/).test(mValue.toString())) :
+ false;
+ };
+
+ /**
+ * @param {*} iValue
+ * @param {number=} iDefault = 0
+ * @return {number}
+ */
+ Utils.pInt = function (iValue, iDefault)
+ {
+ var iResult = Utils.isNormal(iValue) && '' !== iValue ? window.parseInt(iValue, 10) : (iDefault || 0);
+ return window.isNaN(iResult) ? (iDefault || 0) : iResult;
+ };
+
+ /**
+ * @param {*} mValue
+ * @return {string}
+ */
+ Utils.pString = function (mValue)
+ {
+ return Utils.isNormal(mValue) ? '' + mValue : '';
+ };
+
+ /**
+ * @param {string} sComponent
+ * @return {string}
+ */
+ Utils.encodeURIComponent = function (sComponent)
+ {
+ return window.encodeURIComponent(sComponent);
+ };
+
+ /**
+ * @param {*} aValue
+ * @return {boolean}
+ */
+ Utils.isNonEmptyArray = function (aValue)
+ {
+ return Utils.isArray(aValue) && 0 < aValue.length;
+ };
+
+ /**
+ * @return {*|null}
+ */
+ Utils.notificationClass = function ()
+ {
+ return window.Notification && window.Notification.requestPermission ? window.Notification : null;
+ };
+
+ /**
+ * @param {string} sQueryString
+ * @return {Object}
+ */
+ Utils.simpleQueryParser = function (sQueryString)
+ {
+ var
+ oParams = {},
+ aQueries = [],
+ aTemp = [],
+ iIndex = 0,
+ iLen = 0
+ ;
+
+ aQueries = sQueryString.split('&');
+ for (iIndex = 0, iLen = aQueries.length; iIndex < iLen; iIndex++)
+ {
+ aTemp = aQueries[iIndex].split('=');
+ oParams[window.decodeURIComponent(aTemp[0])] = window.decodeURIComponent(aTemp[1]);
+ }
+
+ return oParams;
+ };
+
+ /**
+ * @param {string} sMailToUrl
+ * @param {Function} PopupComposeVoreModel
+ * @returns {boolean}
+ */
+ Utils.mailToHelper = function (sMailToUrl, PopupComposeVoreModel)
+ {
+ if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase())
+ {
+ sMailToUrl = sMailToUrl.toString().substr(7);
+
+ var
+ oParams = {},
+ oEmailModel = null,
+ sEmail = sMailToUrl.replace(/\?.+$/, ''),
+ sQueryString = sMailToUrl.replace(/^[^\?]*\?/, ''),
+ EmailModel = __webpack_require__(/*! Model:Email */ 23)
+ ;
+
+ oEmailModel = new EmailModel();
+ oEmailModel.parse(window.decodeURIComponent(sEmail));
+
+ if (oEmailModel && oEmailModel.email)
+ {
+ oParams = Utils.simpleQueryParser(sQueryString);
+
+ __webpack_require__(/*! App:Knoin */ 5).showScreenPopup(PopupComposeVoreModel, [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;
+ };
+
+ /**
+ * @param {string} sValue
+ * @param {string} sHash
+ * @param {string} sKey
+ * @param {string} sLongKey
+ * @return {string|boolean}
+ */
+ Utils.rsaEncode = function (sValue, sHash, sKey, sLongKey)
+ {
+ if (window.crypto && window.crypto.getRandomValues && window.RSAKey && sHash && sKey && sLongKey)
+ {
+ var oRsa = new window.RSAKey();
+ oRsa.setPublic(sLongKey, sKey);
+
+ sValue = oRsa.encrypt(Utils.fakeMd5() + ':' + sValue + ':' + Utils.fakeMd5());
+ if (false !== sValue)
+ {
+ return 'rsa:' + sHash + ':' + sValue;
+ }
+ }
+
+ return false;
+ };
+
+ Utils.rsaEncode.supported = !!(window.crypto && window.crypto.getRandomValues && window.RSAKey);
+
+ /**
+ * @param {string} sPath
+ * @param {*=} oObject
+ * @param {Object=} oObjectToExportTo
+ */
+ Utils.exportPath = function (sPath, oObject, oObjectToExportTo)
+ {
+ var
+ sPart = null,
+ aParts = sPath.split('.'),
+ oCur = oObjectToExportTo || window
+ ;
+
+ for (; aParts.length && (sPart = aParts.shift());)
+ {
+ if (!aParts.length && !Utils.isUnd(oObject))
+ {
+ oCur[sPart] = oObject;
+ }
+ else if (oCur[sPart])
+ {
+ oCur = oCur[sPart];
+ }
+ else
+ {
+ oCur = oCur[sPart] = {};
+ }
+ }
+ };
+
+ /**
+ * @param {Object} oObject
+ * @param {string} sName
+ * @param {*} mValue
+ */
+ Utils.pImport = function (oObject, sName, mValue)
+ {
+ oObject[sName] = mValue;
+ };
+
+ /**
+ * @param {Object} oObject
+ * @param {string} sName
+ * @param {*} mDefault
+ * @return {*}
+ */
+ Utils.pExport = function (oObject, sName, mDefault)
+ {
+ return Utils.isUnd(oObject[sName]) ? mDefault : oObject[sName];
+ };
+
+ /**
+ * @param {string} sText
+ * @return {string}
+ */
+ Utils.encodeHtml = function (sText)
+ {
+ return Utils.isNormal(sText) ? sText.toString()
+ .replace(/&/g, '&').replace(//g, '>')
+ .replace(/"/g, '"').replace(/'/g, ''') : '';
+ };
+
+ /**
+ * @param {string} sText
+ * @param {number=} iLen
+ * @return {string}
+ */
+ Utils.splitPlainText = function (sText, iLen)
+ {
+ var
+ sPrefix = '',
+ sSubText = '',
+ sResult = sText,
+ iSpacePos = 0,
+ iNewLinePos = 0
+ ;
+
+ iLen = Utils.isUnd(iLen) ? 100 : iLen;
+
+ while (sResult.length > iLen)
+ {
+ sSubText = sResult.substring(0, iLen);
+ iSpacePos = sSubText.lastIndexOf(' ');
+ iNewLinePos = sSubText.lastIndexOf('\n');
+
+ if (-1 !== iNewLinePos)
+ {
+ iSpacePos = iNewLinePos;
+ }
+
+ if (-1 === iSpacePos)
+ {
+ iSpacePos = iLen;
+ }
+
+ sPrefix += sSubText.substring(0, iSpacePos) + '\n';
+ sResult = sResult.substring(iSpacePos + 1);
+ }
+
+ return sPrefix + sResult;
+ };
+
+ Utils.timeOutAction = (function () {
+
+ var
+ oTimeOuts = {}
+ ;
+
+ return function (sAction, fFunction, iTimeOut)
+ {
+ if (Utils.isUnd(oTimeOuts[sAction]))
+ {
+ oTimeOuts[sAction] = 0;
+ }
+
+ window.clearTimeout(oTimeOuts[sAction]);
+ oTimeOuts[sAction] = window.setTimeout(fFunction, iTimeOut);
+ };
+ }());
+
+ Utils.timeOutActionSecond = (function () {
+
+ var
+ oTimeOuts = {}
+ ;
+
+ return function (sAction, fFunction, iTimeOut)
+ {
+ if (!oTimeOuts[sAction])
+ {
+ oTimeOuts[sAction] = window.setTimeout(function () {
+ fFunction();
+ oTimeOuts[sAction] = 0;
+ }, iTimeOut);
+ }
+ };
+ }());
+
+ Utils.audio = (function () {
+
+ var
+ oAudio = false
+ ;
+
+ return function (sMp3File, sOggFile) {
+
+ if (false === oAudio)
+ {
+ if (Globals.bIsiOSDevice)
+ {
+ oAudio = null;
+ }
+ else
+ {
+ var
+ bCanPlayMp3 = false,
+ bCanPlayOgg = false,
+ oAudioLocal = window.Audio ? new window.Audio() : null
+ ;
+
+ if (oAudioLocal && oAudioLocal.canPlayType && oAudioLocal.play)
+ {
+ bCanPlayMp3 = '' !== oAudioLocal.canPlayType('audio/mpeg; codecs="mp3"');
+ if (!bCanPlayMp3)
+ {
+ bCanPlayOgg = '' !== oAudioLocal.canPlayType('audio/ogg; codecs="vorbis"');
+ }
+
+ if (bCanPlayMp3 || bCanPlayOgg)
+ {
+ oAudio = oAudioLocal;
+ oAudio.preload = 'none';
+ oAudio.loop = false;
+ oAudio.autoplay = false;
+ oAudio.muted = false;
+ oAudio.src = bCanPlayMp3 ? sMp3File : sOggFile;
+ }
+ else
+ {
+ oAudio = null;
+ }
+ }
+ else
+ {
+ oAudio = null;
+ }
+ }
+ }
+
+ return oAudio;
+ };
+ }());
+
+ /**
+ * @param {(Object|null|undefined)} oObject
+ * @param {string} sProp
+ * @return {boolean}
+ */
+ Utils.hos = function (oObject, sProp)
+ {
+ return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false;
+ };
+
+ /**
+ * @param {string} sKey
+ * @param {Object=} oValueList
+ * @param {string=} sDefaulValue
+ * @return {string}
+ */
+ Utils.i18n = function (sKey, oValueList, sDefaulValue)
+ {
+ var
+ sValueName = '',
+ sResult = Utils.isUnd(Globals.oI18N[sKey]) ? (Utils.isUnd(sDefaulValue) ? sKey : sDefaulValue) : Globals.oI18N[sKey]
+ ;
+
+ if (!Utils.isUnd(oValueList) && !Utils.isNull(oValueList))
+ {
+ for (sValueName in oValueList)
+ {
+ if (Utils.hos(oValueList, sValueName))
+ {
+ sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]);
+ }
+ }
+ }
+
+ return sResult;
+ };
+
+ /**
+ * @param {Object} oElement
+ */
+ Utils.i18nToNode = function (oElement)
+ {
+ _.defer(function () {
+ $('.i18n', oElement).each(function () {
+ var
+ jqThis = $(this),
+ sKey = ''
+ ;
+
+ sKey = jqThis.data('i18n-text');
+ if (sKey)
+ {
+ jqThis.text(Utils.i18n(sKey));
+ }
+ else
+ {
+ sKey = jqThis.data('i18n-html');
+ if (sKey)
+ {
+ jqThis.html(Utils.i18n(sKey));
+ }
+
+ sKey = jqThis.data('i18n-placeholder');
+ if (sKey)
+ {
+ jqThis.attr('placeholder', Utils.i18n(sKey));
+ }
+
+ sKey = jqThis.data('i18n-title');
+ if (sKey)
+ {
+ jqThis.attr('title', Utils.i18n(sKey));
+ }
+ }
+ });
+ });
+ };
+
+ Utils.i18nReload = function ()
+ {
+ if (window['rainloopI18N'])
+ {
+ Globals.oI18N = window['rainloopI18N'] || {};
+
+ Utils.i18nToNode(Globals.$doc);
+
+ Globals.langChangeTrigger(!Globals.langChangeTrigger());
+ }
+
+ window['rainloopI18N'] = null;
+ };
+
+ /**
+ * @param {Function} fCallback
+ * @param {Object} oScope
+ * @param {Function=} fLangCallback
+ */
+ Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
+ {
+ if (fCallback)
+ {
+ fCallback.call(oScope);
+ }
+
+ if (fLangCallback)
+ {
+ Globals.langChangeTrigger.subscribe(function () {
+ if (fCallback)
+ {
+ fCallback.call(oScope);
+ }
+
+ fLangCallback.call(oScope);
+ });
+ }
+ else if (fCallback)
+ {
+ Globals.langChangeTrigger.subscribe(fCallback, oScope);
+ }
+ };
+
+ /**
+ * @return {boolean}
+ */
+ Utils.inFocus = function ()
+ {
+ if (window.document.activeElement)
+ {
+ if (Utils.isUnd(window.document.activeElement.__inFocusCache))
+ {
+ window.document.activeElement.__inFocusCache = $(window.document.activeElement).is('input,textarea,iframe,.cke_editable');
+ }
+
+ return !!window.document.activeElement.__inFocusCache;
+ }
+
+ return false;
+ };
+
+ Utils.removeInFocus = function ()
+ {
+ if (window.document && window.document.activeElement && window.document.activeElement.blur)
+ {
+ var oA = $(window.document.activeElement);
+ if (oA.is('input,textarea'))
+ {
+ window.document.activeElement.blur();
+ }
+ }
+ };
+
+ Utils.removeSelection = function ()
+ {
+ if (window && window.getSelection)
+ {
+ var oSel = window.getSelection();
+ if (oSel && oSel.removeAllRanges)
+ {
+ oSel.removeAllRanges();
+ }
+ }
+ else if (window.document && window.document.selection && window.document.selection.empty)
+ {
+ window.document.selection.empty();
+ }
+ };
+
+ /**
+ * @param {string} sPrefix
+ * @param {string} sSubject
+ * @return {string}
+ */
+ Utils.replySubjectAdd = function (sPrefix, sSubject)
+ {
+ sPrefix = Utils.trim(sPrefix.toUpperCase());
+ sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' '));
+
+ var
+ bDrop = false,
+ aSubject = [],
+ bRe = 'RE' === sPrefix,
+ bFwd = 'FWD' === sPrefix,
+ bPrefixIsRe = !bFwd
+ ;
+
+ if ('' !== sSubject)
+ {
+ _.each(sSubject.split(':'), function (sPart) {
+ var sTrimmedPart = Utils.trim(sPart);
+ if (!bDrop && (/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart)))
+ {
+ if (!bRe)
+ {
+ bRe = !!(/^RE/i.test(sTrimmedPart));
+ }
+
+ if (!bFwd)
+ {
+ bFwd = !!(/^FWD/i.test(sTrimmedPart));
+ }
+ }
+ else
+ {
+ aSubject.push(sPart);
+ bDrop = true;
+ }
+ });
+ }
+
+ if (bPrefixIsRe)
+ {
+ bRe = false;
+ }
+ else
+ {
+ bFwd = false;
+ }
+
+ return Utils.trim(
+ (bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
+ (bRe ? 'Re: ' : '') +
+ (bFwd ? 'Fwd: ' : '') +
+ Utils.trim(aSubject.join(':'))
+ );
+ };
+
+ /**
+ * @param {number} iNum
+ * @param {number} iDec
+ * @return {number}
+ */
+ Utils.roundNumber = function (iNum, iDec)
+ {
+ return window.Math.round(iNum * window.Math.pow(10, iDec)) / window.Math.pow(10, iDec);
+ };
+
+ /**
+ * @param {(number|string)} iSizeInBytes
+ * @return {string}
+ */
+ Utils.friendlySize = function (iSizeInBytes)
+ {
+ iSizeInBytes = Utils.pInt(iSizeInBytes);
+
+ if (iSizeInBytes >= 1073741824)
+ {
+ return Utils.roundNumber(iSizeInBytes / 1073741824, 1) + 'GB';
+ }
+ else if (iSizeInBytes >= 1048576)
+ {
+ return Utils.roundNumber(iSizeInBytes / 1048576, 1) + 'MB';
+ }
+ else if (iSizeInBytes >= 1024)
+ {
+ return Utils.roundNumber(iSizeInBytes / 1024, 0) + 'KB';
+ }
+
+ return iSizeInBytes + 'B';
+ };
+
+ /**
+ * @param {string} sDesc
+ */
+ Utils.log = function (sDesc)
+ {
+ if (window.console && window.console.log)
+ {
+ window.console.log(sDesc);
+ }
+ };
+
+ /**
+ * @param {number} iCode
+ * @param {*=} mMessage = ''
+ * @return {string}
+ */
+ Utils.getNotification = function (iCode, mMessage)
+ {
+ iCode = Utils.pInt(iCode);
+ if (Enums.Notification.ClientViewError === iCode && mMessage)
+ {
+ return mMessage;
+ }
+
+ return Utils.isUnd(Globals.oNotificationI18N[iCode]) ? '' : Globals.oNotificationI18N[iCode];
+ };
+
+ Utils.initNotificationLanguage = function ()
+ {
+ var oN = Globals.oNotificationI18N || {};
+ oN[Enums.Notification.InvalidToken] = Utils.i18n('NOTIFICATIONS/INVALID_TOKEN');
+ oN[Enums.Notification.AuthError] = Utils.i18n('NOTIFICATIONS/AUTH_ERROR');
+ oN[Enums.Notification.AccessError] = Utils.i18n('NOTIFICATIONS/ACCESS_ERROR');
+ oN[Enums.Notification.ConnectionError] = Utils.i18n('NOTIFICATIONS/CONNECTION_ERROR');
+ oN[Enums.Notification.CaptchaError] = Utils.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
+ oN[Enums.Notification.SocialFacebookLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
+ oN[Enums.Notification.SocialTwitterLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
+ oN[Enums.Notification.SocialGoogleLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
+ oN[Enums.Notification.DomainNotAllowed] = Utils.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
+ oN[Enums.Notification.AccountNotAllowed] = Utils.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
+
+ oN[Enums.Notification.AccountTwoFactorAuthRequired] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
+ oN[Enums.Notification.AccountTwoFactorAuthError] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
+
+ oN[Enums.Notification.CouldNotSaveNewPassword] = Utils.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
+ oN[Enums.Notification.CurrentPasswordIncorrect] = Utils.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
+ oN[Enums.Notification.NewPasswordShort] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
+ oN[Enums.Notification.NewPasswordWeak] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
+ oN[Enums.Notification.NewPasswordForbidden] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
+
+ oN[Enums.Notification.ContactsSyncError] = Utils.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
+
+ oN[Enums.Notification.CantGetMessageList] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
+ oN[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
+ oN[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
+ oN[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
+ oN[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
+
+ oN[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
+ oN[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
+ oN[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
+
+ oN[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
+ oN[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
+ oN[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
+ oN[Enums.Notification.CantDeleteNonEmptyFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
+ oN[Enums.Notification.CantSubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
+ oN[Enums.Notification.CantUnsubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
+
+ oN[Enums.Notification.CantSaveSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
+ oN[Enums.Notification.CantSavePluginSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
+
+ oN[Enums.Notification.DomainAlreadyExists] = Utils.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
+
+ oN[Enums.Notification.CantInstallPackage] = Utils.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
+ oN[Enums.Notification.CantDeletePackage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
+ oN[Enums.Notification.InvalidPluginPackage] = Utils.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
+ oN[Enums.Notification.UnsupportedPluginPackage] = Utils.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
+
+ oN[Enums.Notification.LicensingServerIsUnavailable] = Utils.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
+ oN[Enums.Notification.LicensingExpired] = Utils.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
+ oN[Enums.Notification.LicensingBanned] = Utils.i18n('NOTIFICATIONS/LICENSING_BANNED');
+
+ oN[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
+
+ oN[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
+
+ oN[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
+ oN[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
+ oN[Enums.Notification.UnknownNotification] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
+ oN[Enums.Notification.UnknownError] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
+ };
+
+ /**
+ * @param {*} mCode
+ * @return {string}
+ */
+ Utils.getUploadErrorDescByCode = function (mCode)
+ {
+ var sResult = '';
+ switch (Utils.pInt(mCode)) {
+ case Enums.UploadErrorCode.FileIsTooBig:
+ sResult = Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
+ break;
+ case Enums.UploadErrorCode.FilePartiallyUploaded:
+ sResult = Utils.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED');
+ break;
+ case Enums.UploadErrorCode.FileNoUploaded:
+ sResult = Utils.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED');
+ break;
+ case Enums.UploadErrorCode.MissingTempFolder:
+ sResult = Utils.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER');
+ break;
+ case Enums.UploadErrorCode.FileOnSaveingError:
+ sResult = Utils.i18n('UPLOAD/ERROR_ON_SAVING_FILE');
+ break;
+ case Enums.UploadErrorCode.FileType:
+ sResult = Utils.i18n('UPLOAD/ERROR_FILE_TYPE');
+ break;
+ default:
+ sResult = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
+ break;
+ }
+
+ return sResult;
+ };
+
+ /**
+ * @param {?} oObject
+ * @param {string} sMethodName
+ * @param {Array=} aParameters
+ * @param {number=} nDelay
+ */
+ Utils.delegateRun = function (oObject, sMethodName, aParameters, nDelay)
+ {
+ if (oObject && oObject[sMethodName])
+ {
+ nDelay = Utils.pInt(nDelay);
+ if (0 >= nDelay)
+ {
+ oObject[sMethodName].apply(oObject, Utils.isArray(aParameters) ? aParameters : []);
+ }
+ else
+ {
+ _.delay(function () {
+ oObject[sMethodName].apply(oObject, Utils.isArray(aParameters) ? aParameters : []);
+ }, nDelay);
+ }
+ }
+ };
+
+ /**
+ * @param {?} oEvent
+ */
+ Utils.killCtrlAandS = function (oEvent)
+ {
+ oEvent = oEvent || window.event;
+ if (oEvent && oEvent.ctrlKey && !oEvent.shiftKey && !oEvent.altKey)
+ {
+ var
+ oSender = oEvent.target || oEvent.srcElement,
+ iKey = oEvent.keyCode || oEvent.which
+ ;
+
+ if (iKey === Enums.EventKeyCode.S)
+ {
+ oEvent.preventDefault();
+ return;
+ }
+
+ if (oSender && oSender.tagName && oSender.tagName.match(/INPUT|TEXTAREA/i))
+ {
+ return;
+ }
+
+ if (iKey === Enums.EventKeyCode.A)
+ {
+ if (window.getSelection)
+ {
+ window.getSelection().removeAllRanges();
+ }
+ else if (window.document.selection && window.document.selection.clear)
+ {
+ window.document.selection.clear();
+ }
+
+ oEvent.preventDefault();
+ }
+ }
+ };
+
+ /**
+ * @param {(Object|null|undefined)} oContext
+ * @param {Function} fExecute
+ * @param {(Function|boolean|null)=} fCanExecute
+ * @return {Function}
+ */
+ Utils.createCommand = function (oContext, fExecute, fCanExecute)
+ {
+ var
+ fResult = fExecute ? function () {
+
+ if (fResult && fResult.canExecute && fResult.canExecute())
+ {
+ fExecute.apply(oContext, Array.prototype.slice.call(arguments));
+ }
+
+ return false;
+
+ } : function () {}
+ ;
+
+ fResult.enabled = ko.observable(true);
+
+ fCanExecute = Utils.isUnd(fCanExecute) ? true : fCanExecute;
+ if (Utils.isFunc(fCanExecute))
+ {
+ fResult.canExecute = ko.computed(function () {
+ return fResult.enabled() && fCanExecute.call(oContext);
+ });
+ }
+ else
+ {
+ fResult.canExecute = ko.computed(function () {
+ return fResult.enabled() && !!fCanExecute;
+ });
+ }
+
+ return fResult;
+ };
+
+ /**
+ * @param {Object} oData
+ */
+ Utils.initDataConstructorBySettings = function (oData)
+ {
+ oData.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html);
+ oData.showImages = ko.observable(false);
+ oData.interfaceAnimation = ko.observable(Enums.InterfaceAnimation.Full);
+ oData.contactsAutosave = ko.observable(false);
+
+ Globals.sAnimationType = Enums.InterfaceAnimation.Full;
+
+ oData.capaThemes = ko.observable(false);
+ oData.allowLanguagesOnSettings = ko.observable(true);
+ oData.allowLanguagesOnLogin = ko.observable(true);
+
+ oData.useLocalProxyForExternalImages = ko.observable(false);
+
+ oData.desktopNotifications = ko.observable(false);
+ oData.useThreads = ko.observable(true);
+ oData.replySameFolder = ko.observable(true);
+ oData.useCheckboxesInList = ko.observable(true);
+
+ oData.layout = ko.observable(Enums.Layout.SidePreview);
+ oData.usePreviewPane = ko.computed(function () {
+ return Enums.Layout.NoPreview !== oData.layout();
+ });
+
+ oData.interfaceAnimation.subscribe(function (sValue) {
+ if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)
+ {
+ Globals.$html.removeClass('rl-anim rl-anim-full').addClass('no-rl-anim');
+
+ Globals.sAnimationType = Enums.InterfaceAnimation.None;
+ }
+ else
+ {
+ switch (sValue)
+ {
+ case Enums.InterfaceAnimation.Full:
+ Globals.$html.removeClass('no-rl-anim').addClass('rl-anim rl-anim-full');
+ Globals.sAnimationType = sValue;
+ break;
+ case Enums.InterfaceAnimation.Normal:
+ Globals.$html.removeClass('no-rl-anim rl-anim-full').addClass('rl-anim');
+ Globals.sAnimationType = sValue;
+ break;
+ }
+ }
+ });
+
+ oData.interfaceAnimation.valueHasMutated();
+
+ oData.desktopNotificationsPermisions = ko.computed(function () {
+
+ oData.desktopNotifications();
+
+ var
+ NotificationClass = Utils.notificationClass(),
+ iResult = Enums.DesktopNotifications.NotSupported
+ ;
+
+ if (NotificationClass && NotificationClass.permission)
+ {
+ switch (NotificationClass.permission.toLowerCase())
+ {
+ case 'granted':
+ iResult = Enums.DesktopNotifications.Allowed;
+ break;
+ case 'denied':
+ iResult = Enums.DesktopNotifications.Denied;
+ break;
+ case 'default':
+ iResult = Enums.DesktopNotifications.NotAllowed;
+ break;
+ }
+ }
+ else if (window.webkitNotifications && window.webkitNotifications.checkPermission)
+ {
+ iResult = window.webkitNotifications.checkPermission();
+ }
+
+ return iResult;
+ });
+
+ oData.useDesktopNotifications = ko.computed({
+ 'read': function () {
+ return oData.desktopNotifications() &&
+ Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions();
+ },
+ 'write': function (bValue) {
+ if (bValue)
+ {
+ var
+ NotificationClass = Utils.notificationClass(),
+ iPermission = oData.desktopNotificationsPermisions()
+ ;
+
+ if (NotificationClass && Enums.DesktopNotifications.Allowed === iPermission)
+ {
+ oData.desktopNotifications(true);
+ }
+ else if (NotificationClass && Enums.DesktopNotifications.NotAllowed === iPermission)
+ {
+ NotificationClass.requestPermission(function () {
+ oData.desktopNotifications.valueHasMutated();
+ if (Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions())
+ {
+ if (oData.desktopNotifications())
+ {
+ oData.desktopNotifications.valueHasMutated();
+ }
+ else
+ {
+ oData.desktopNotifications(true);
+ }
+ }
+ else
+ {
+ if (oData.desktopNotifications())
+ {
+ oData.desktopNotifications(false);
+ }
+ else
+ {
+ oData.desktopNotifications.valueHasMutated();
+ }
+ }
+ });
+ }
+ else
+ {
+ oData.desktopNotifications(false);
+ }
+ }
+ else
+ {
+ oData.desktopNotifications(false);
+ }
+ }
+ });
+
+ oData.language = ko.observable('');
+ oData.languages = ko.observableArray([]);
+
+ oData.mainLanguage = ko.computed({
+ 'read': oData.language,
+ 'write': function (sValue) {
+ if (sValue !== oData.language())
+ {
+ if (-1 < Utils.inArray(sValue, oData.languages()))
+ {
+ oData.language(sValue);
+ }
+ else if (0 < oData.languages().length)
+ {
+ oData.language(oData.languages()[0]);
+ }
+ }
+ else
+ {
+ oData.language.valueHasMutated();
+ }
+ }
+ });
+
+ oData.theme = ko.observable('');
+ oData.themes = ko.observableArray([]);
+
+ oData.mainTheme = ko.computed({
+ 'read': oData.theme,
+ 'write': function (sValue) {
+ if (sValue !== oData.theme())
+ {
+ var aThemes = oData.themes();
+ if (-1 < Utils.inArray(sValue, aThemes))
+ {
+ oData.theme(sValue);
+ }
+ else if (0 < aThemes.length)
+ {
+ oData.theme(aThemes[0]);
+ }
+ }
+ else
+ {
+ oData.theme.valueHasMutated();
+ }
+ }
+ });
+
+ oData.capaAdditionalAccounts = ko.observable(false);
+ oData.capaAdditionalIdentities = ko.observable(false);
+ oData.capaGravatar = ko.observable(false);
+ oData.determineUserLanguage = ko.observable(false);
+ oData.determineUserDomain = ko.observable(false);
+
+ oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
+
+ oData.mainMessagesPerPage = oData.messagesPerPage;
+ oData.mainMessagesPerPage = ko.computed({
+ 'read': oData.messagesPerPage,
+ 'write': function (iValue) {
+ if (-1 < Utils.inArray(Utils.pInt(iValue), Consts.Defaults.MessagesPerPageArray))
+ {
+ if (iValue !== oData.messagesPerPage())
+ {
+ oData.messagesPerPage(iValue);
+ }
+ }
+ else
+ {
+ oData.messagesPerPage.valueHasMutated();
+ }
+ }
+ });
+
+ oData.facebookSupported = ko.observable(false);
+ oData.facebookEnable = ko.observable(false);
+ oData.facebookAppID = ko.observable('');
+ oData.facebookAppSecret = ko.observable('');
+
+ oData.twitterEnable = ko.observable(false);
+ oData.twitterConsumerKey = ko.observable('');
+ oData.twitterConsumerSecret = ko.observable('');
+
+ oData.googleEnable = ko.observable(false);
+ oData.googleClientID = ko.observable('');
+ oData.googleClientSecret = ko.observable('');
+ oData.googleApiKey = ko.observable('');
+
+ oData.dropboxEnable = ko.observable(false);
+ oData.dropboxApiKey = ko.observable('');
+
+ oData.contactsIsAllowed = ko.observable(false);
+ };
+
+ /**
+ * @param {{moment:Function}} oObject
+ */
+ Utils.createMomentDate = function (oObject)
+ {
+ if (Utils.isUnd(oObject.moment))
+ {
+ oObject.moment = ko.observable(moment());
+ }
+
+ return ko.computed(function () {
+ Globals.momentTrigger();
+ var oMoment = this.moment();
+ return 1970 === oMoment.year() ? '' : oMoment.fromNow();
+ }, oObject);
+ };
+
+ /**
+ * @param {{moment:Function, momentDate:Function}} oObject
+ */
+ Utils.createMomentShortDate = function (oObject)
+ {
+ return ko.computed(function () {
+
+ var
+ sResult = '',
+ oMomentNow = moment(),
+ oMoment = this.moment(),
+ sMomentDate = this.momentDate()
+ ;
+
+ if (1970 === oMoment.year())
+ {
+ sResult = '';
+ }
+ else if (4 >= oMomentNow.diff(oMoment, 'hours'))
+ {
+ sResult = sMomentDate;
+ }
+ else if (oMomentNow.format('L') === oMoment.format('L'))
+ {
+ sResult = Utils.i18n('MESSAGE_LIST/TODAY_AT', {
+ 'TIME': oMoment.format('LT')
+ });
+ }
+ else if (oMomentNow.clone().subtract('days', 1).format('L') === oMoment.format('L'))
+ {
+ sResult = Utils.i18n('MESSAGE_LIST/YESTERDAY_AT', {
+ 'TIME': oMoment.format('LT')
+ });
+ }
+ else if (oMomentNow.year() === oMoment.year())
+ {
+ sResult = oMoment.format('D MMM.');
+ }
+ else
+ {
+ sResult = oMoment.format('LL');
+ }
+
+ return sResult;
+
+ }, oObject);
+ };
+
+ /**
+ * @param {string} sTheme
+ * @return {string}
+ */
+ Utils.convertThemeName = function (sTheme)
+ {
+ if ('@custom' === sTheme.substr(-7))
+ {
+ sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
+ }
+
+ return Utils.trim(sTheme.replace(/[^a-zA-Z0-9]+/g, ' ').replace(/([A-Z])/g, ' $1').replace(/[\s]+/g, ' '));
+ };
+
+ /**
+ * @param {string} sName
+ * @return {string}
+ */
+ Utils.quoteName = function (sName)
+ {
+ return sName.replace(/["]/g, '\\"');
+ };
+
+ /**
+ * @return {number}
+ */
+ Utils.microtime = function ()
+ {
+ return (new Date()).getTime();
+ };
+
+ /**
+ *
+ * @param {string} sLanguage
+ * @param {boolean=} bEng = false
+ * @return {string}
+ */
+ Utils.convertLangName = function (sLanguage, bEng)
+ {
+ return Utils.i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' +
+ sLanguage.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, sLanguage);
+ };
+
+ /**
+ * @param {number=} iLen
+ * @return {string}
+ */
+ Utils.fakeMd5 = function(iLen)
+ {
+ var
+ sResult = '',
+ sLine = '0123456789abcdefghijklmnopqrstuvwxyz'
+ ;
+
+ iLen = Utils.isUnd(iLen) ? 32 : Utils.pInt(iLen);
+
+ while (sResult.length < iLen)
+ {
+ sResult += sLine.substr(window.Math.round(window.Math.random() * sLine.length), 1);
+ }
+
+ return sResult;
+ };
+
+ /**
+ * @param {string} sPlain
+ * @return {string}
+ */
+ Utils.convertPlainTextToHtml = function (sPlain)
+ {
+ return sPlain.toString()
+ .replace(/&/g, '&').replace(/>/g, '>').replace(/');
+ };
+
+ Utils.draggeblePlace = function ()
+ {
+ return $(' ').appendTo('#rl-hidden');
+ };
+
+ Utils.defautOptionsAfterRender = function (oDomOption, oItem)
+ {
+ if (oItem && !Utils.isUnd(oItem.disabled) && oDomOption)
+ {
+ $(oDomOption)
+ .toggleClass('disabled', oItem.disabled)
+ .prop('disabled', oItem.disabled)
+ ;
+ }
+ };
+
+ /**
+ * @param {Object} oViewModel
+ * @param {string} sTemplateID
+ * @param {string} sTitle
+ * @param {Function=} fCallback
+ */
+ Utils.windowPopupKnockout = function (oViewModel, sTemplateID, sTitle, fCallback)
+ {
+ var
+ oScript = null,
+ oWin = window.open(''),
+ sFunc = '__OpenerApplyBindingsUid' + Utils.fakeMd5() + '__',
+ oTemplate = $('#' + sTemplateID)
+ ;
+
+ window[sFunc] = function () {
+
+ if (oWin && oWin.document.body && oTemplate && oTemplate[0])
+ {
+ var oBody = $(oWin.document.body);
+
+ $('#rl-content', oBody).html(oTemplate.html());
+ $('html', oWin.document).addClass('external ' + $('html').attr('class'));
+
+ Utils.i18nToNode(oBody);
+
+ if (oViewModel && $('#rl-content', oBody)[0])
+ {
+ ko.applyBindings(oViewModel, $('#rl-content', oBody)[0]);
+ }
+
+ window[sFunc] = null;
+
+ fCallback(oWin);
+ }
+ };
+
+ oWin.document.open();
+ oWin.document.write('' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' +
+ '' + Utils.encodeHtml(sTitle) + ' ' +
+ '');
+ oWin.document.close();
+
+ oScript = oWin.document.createElement('script');
+ oScript.type = 'text/javascript';
+ oScript.innerHTML = 'if(window&&window.opener&&window.opener[\'' + sFunc + '\']){window.opener[\'' + sFunc + '\']();window.opener[\'' + sFunc + '\']=null}';
+ oWin.document.getElementsByTagName('head')[0].appendChild(oScript);
+ };
+
+ /**
+ * @param {Function} fCallback
+ * @param {?} koTrigger
+ * @param {?} oContext = null
+ * @param {number=} iTimer = 1000
+ * @return {Function}
+ */
+ Utils.settingsSaveHelperFunction = function (fCallback, koTrigger, oContext, iTimer)
+ {
+ oContext = oContext || null;
+ iTimer = Utils.isUnd(iTimer) ? 1000 : Utils.pInt(iTimer);
+
+ return function (sType, mData, bCached, sRequestAction, oRequestParameters) {
+ koTrigger.call(oContext, mData && mData['Result'] ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult);
+ if (fCallback)
+ {
+ fCallback.call(oContext, sType, mData, bCached, sRequestAction, oRequestParameters);
+ }
+ _.delay(function () {
+ koTrigger.call(oContext, Enums.SaveSettingsStep.Idle);
+ }, iTimer);
+ };
+ };
+
+ Utils.settingsSaveHelperSimpleFunction = function (koTrigger, oContext)
+ {
+ return Utils.settingsSaveHelperFunction(null, koTrigger, oContext, 1000);
+ };
+
+ /**
+ * @param {string} sHtml
+ * @return {string}
+ */
+ Utils.htmlToPlain = function (sHtml)
+ {
+ var
+ iPos = 0,
+ iP1 = 0,
+ iP2 = 0,
+ iP3 = 0,
+ iLimit = 0,
+
+ sText = '',
+
+ splitPlainText = function (sText)
+ {
+ var
+ iLen = 100,
+ sPrefix = '',
+ sSubText = '',
+ sResult = sText,
+ iSpacePos = 0,
+ iNewLinePos = 0
+ ;
+
+ while (sResult.length > iLen)
+ {
+ sSubText = sResult.substring(0, iLen);
+ iSpacePos = sSubText.lastIndexOf(' ');
+ iNewLinePos = sSubText.lastIndexOf('\n');
+
+ if (-1 !== iNewLinePos)
+ {
+ iSpacePos = iNewLinePos;
+ }
+
+ if (-1 === iSpacePos)
+ {
+ iSpacePos = iLen;
+ }
+
+ sPrefix += sSubText.substring(0, iSpacePos) + '\n';
+ sResult = sResult.substring(iSpacePos + 1);
+ }
+
+ return sPrefix + sResult;
+ },
+
+ convertBlockquote = function (sText) {
+ sText = splitPlainText($.trim(sText));
+ sText = '> ' + sText.replace(/\n/gm, '\n> ');
+ return sText.replace(/(^|\n)([> ]+)/gm, function () {
+ return (arguments && 2 < arguments.length) ? arguments[1] + $.trim(arguments[2].replace(/[\s]/g, '')) + ' ' : '';
+ });
+ },
+
+ convertDivs = function () {
+ if (arguments && 1 < arguments.length)
+ {
+ var sText = $.trim(arguments[1]);
+ if (0 < sText.length)
+ {
+ sText = sText.replace(/]*>([\s\S\r\n]*)<\/div>/gmi, convertDivs);
+ sText = '\n' + $.trim(sText) + '\n';
+ }
+
+ return sText;
+ }
+
+ return '';
+ },
+
+ convertPre = function () {
+ return (arguments && 1 < arguments.length) ? arguments[1].toString().replace(/[\n]/gm, '
') : '';
+ },
+
+ fixAttibuteValue = function () {
+ return (arguments && 1 < arguments.length) ?
+ '' + arguments[1] + arguments[2].replace(//g, '>') : '';
+ },
+
+ convertLinks = function () {
+ return (arguments && 1 < arguments.length) ? $.trim(arguments[1]) : '';
+ }
+ ;
+
+ sText = sHtml
+ .replace(/]*>([\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 = Globals.$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 = Globals.$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;
+ };
+
+ /**
+ * @param {string} sUrl
+ * @param {number} iValue
+ * @param {Function} fCallback
+ */
+ Utils.resizeAndCrop = function (sUrl, iValue, fCallback)
+ {
+ var oTempImg = new window.Image();
+ oTempImg.onload = function() {
+
+ var
+ aDiff = [0, 0],
+ oCanvas = window.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;
+ };
+
+ /**
+ * @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() {
+
+ var
+ iPrev = 0,
+ iNext = 0,
+ iLimit = 2,
+ aResult = [],
+ iCurrentPage = koCurrentPage(),
+ iPageCount = koPageCount(),
+
+ /**
+ * @param {number} iIndex
+ * @param {boolean=} bPush = true
+ * @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(window.Math.round((iPrev - 1) / 2), false, '...');
+ }
+
+ if (iPageCount - 2 === iNext)
+ {
+ fAdd(iPageCount - 1, true);
+ }
+ else if (iPageCount - 2 > iNext)
+ {
+ fAdd(window.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)
+ {
+ var sel, range;
+ if (window.getSelection)
+ {
+ sel = window.getSelection();
+ sel.removeAllRanges();
+ range = window.document.createRange();
+ range.selectNodeContents(element);
+ sel.addRange(range);
+ }
+ else if (window.document.selection)
+ {
+ range = window.document.body.createTextRange();
+ range.moveToElementText(element);
+ range.select();
+ }
+ };
+
+ Utils.detectDropdownVisibility = _.debounce(function () {
+ Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) {
+ return oItem.hasClass('open');
+ }));
+ }, 50);
+
+ /**
+ * @param {boolean=} bDelay = false
+ */
+ Utils.triggerAutocompleteInputChange = function (bDelay) {
+
+ var fFunc = function () {
+ $('.checkAutocomplete').trigger('change');
+ };
+
+ if (Utils.isUnd(bDelay) ? false : !!bDelay)
+ {
+ _.delay(fFunc, 100);
+ }
+ else
+ {
+ fFunc();
+ }
+ };
+
+ module.exports = Utils;
+
+ }());
+
+/***/ },
+
+/***/ 2:
+/*!********************!*\
+ !*** external "_" ***!
+ \********************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = _;
+
+/***/ },
+
+/***/ 3:
+/*!****************************!*\
+ !*** ./dev/External/ko.js ***!
+ \****************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function (module, ko) {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14)
+ ;
+
+ ko.bindingHandlers.tooltip = {
+ 'init': function (oElement, fValueAccessor) {
+
+ var
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ 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
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ $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),
+ Globals = __webpack_require__(/*! Common/Globals */ 7)
+ ;
+
+ $oEl.tooltip({
+ 'container': 'body',
+ 'trigger': 'hover manual',
+ 'title': function () {
+ return $oEl.data('tooltip3-data') || '';
+ }
+ });
+
+ $(window.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) {
+ var Globals = __webpack_require__(/*! Common/Globals */ 7);
+ Globals.aBootstrapDropdowns.push($(oElement));
+ }
+ };
+
+ ko.bindingHandlers.openDropdownTrigger = {
+ 'update': function (oElement, fValueAccessor) {
+ if (ko.utils.unwrapObservable(fValueAccessor()))
+ {
+ var
+ $el = $(oElement),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ 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 = __webpack_require__(/*! Common/Utils */ 1);
+ 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) {
+ var Utils = __webpack_require__(/*! Common/Utils */ 1);
+ 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) {
+
+ var
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ $(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 = __webpack_require__(/*! Common/Utils */ 1);
+ Utils.i18nToNode(oElement);
+ }
+ };
+
+ ko.bindingHandlers.i18nUpdate = {
+ 'update': function (oElement, fValueAccessor) {
+ var Utils = __webpack_require__(/*! Common/Utils */ 1);
+ 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 = __webpack_require__(/*! Common/Utils */ 1),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ 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 = Globals.$win.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 = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+ 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 = __webpack_require__(/*! Common/Globals */ 7);
+ 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 = __webpack_require__(/*! Common/Globals */ 7);
+ 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 = __webpack_require__(/*! Common/Utils */ 1),
+ EmailModel = __webpack_require__(/*! Model:Email */ 23),
+
+ $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 = __webpack_require__(/*! Common/Utils */ 1),
+ ContactTagModel = __webpack_require__(/*! Model:ContactTag */ 37),
+
+ $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
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ 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
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ 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)
+ {
+ var Utils = __webpack_require__(/*! Common/Utils */ 1);
+
+ 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 = __webpack_require__(/*! Common/Utils */ 1);
+
+ 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 = __webpack_require__(/*! Common/Utils */ 1);
+
+ 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 = __webpack_require__(/*! Common/Utils */ 1);
+
+ this.hasFuncError = ko.observable(false);
+
+ if (Utils.isFunc(fFunc))
+ {
+ this.subscribe(function (sValue) {
+ this.hasFuncError(!fFunc(sValue));
+ }, this);
+
+ this.valueHasMutated();
+ }
+
+ return this;
+ };
+
+ module.exports = ko;
+
+ }(module, ko));
+
+
+/***/ },
+
+/***/ 5:
+/*!****************************!*\
+ !*** ./dev/Knoin/Knoin.js ***!
+ \****************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+ hasher = __webpack_require__(/*! hasher */ 115),
+ crossroads = __webpack_require__(/*! crossroads */ 48),
+
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Plugins = __webpack_require__(/*! Common/Plugins */ 26),
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function Knoin()
+ {
+ this.oScreens = {};
+ this.sDefaultScreenName = '';
+ this.oCurrentScreen = null;
+ }
+
+ Knoin.prototype.oScreens = {};
+ Knoin.prototype.sDefaultScreenName = '';
+ Knoin.prototype.oCurrentScreen = null;
+
+ Knoin.prototype.hideLoading = function ()
+ {
+ $('#rl-loading').hide();
+ };
+
+ /**
+ * @param {Object} thisObject
+ */
+ Knoin.prototype.constructorEnd = function (thisObject)
+ {
+ if (Utils.isFunc(thisObject['__constructor_end']))
+ {
+ thisObject['__constructor_end'].call(thisObject);
+ }
+ };
+
+ /**
+ * @param {string|Array} mName
+ * @param {Function} ViewModelClass
+ */
+ Knoin.prototype.extendAsViewModel = function (mName, ViewModelClass)
+ {
+ if (ViewModelClass)
+ {
+ if (Utils.isArray(mName))
+ {
+ ViewModelClass.__names = mName;
+ }
+ else
+ {
+ ViewModelClass.__names = [mName];
+ }
+
+ ViewModelClass.__name = ViewModelClass.__names[0];
+ }
+ };
+
+ /**
+ * @param {Function} SettingsViewModelClass
+ * @param {string} sLabelName
+ * @param {string} sTemplate
+ * @param {string} sRoute
+ * @param {boolean=} bDefault
+ */
+ Knoin.prototype.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabelName, sRoute, bDefault)
+ {
+ SettingsViewModelClass.__rlSettingsData = {
+ 'Label': sLabelName,
+ 'Template': sTemplate,
+ 'Route': sRoute,
+ 'IsDefault': !!bDefault
+ };
+
+ Globals.aViewModels['settings'].push(SettingsViewModelClass);
+ };
+
+ /**
+ * @param {Function} SettingsViewModelClass
+ */
+ Knoin.prototype.removeSettingsViewModel = function (SettingsViewModelClass)
+ {
+ Globals.aViewModels['settings-removed'].push(SettingsViewModelClass);
+ };
+
+ /**
+ * @param {Function} SettingsViewModelClass
+ */
+ Knoin.prototype.disableSettingsViewModel = function (SettingsViewModelClass)
+ {
+ Globals.aViewModels['settings-disabled'].push(SettingsViewModelClass);
+ };
+
+ Knoin.prototype.routeOff = function ()
+ {
+ hasher.changed.active = false;
+ };
+
+ Knoin.prototype.routeOn = function ()
+ {
+ hasher.changed.active = true;
+ };
+
+ /**
+ * @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
+ kn = this,
+ oViewModel = new ViewModelClass(oScreen),
+ sPosition = oViewModel.viewModelPosition(),
+ oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
+ oViewModelDom = null
+ ;
+
+ ViewModelClass.__builded = true;
+ ViewModelClass.__vm = oViewModel;
+
+ oViewModel.viewModelName = ViewModelClass.__name;
+ oViewModel.viewModelNames = ViewModelClass.__names;
+
+ 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();
+
+ 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();
+
+ _.each(this.viewModelNames, function (sName) {
+ Plugins.runHook('view-model-on-hide', [sName, self]);
+ });
+
+ Globals.popupVisibilityNames.remove(this.viewModelName);
+ oViewModel.viewModelDom.css('z-index', 2000);
+
+ Globals.tooltipTrigger(!Globals.tooltipTrigger());
+
+ _.delay(function () {
+ self.viewModelDom.hide();
+ }, 300);
+ }
+
+ }, oViewModel);
+ }
+
+ _.each(ViewModelClass.__names, function (sName) {
+ Plugins.runHook('view-model-pre-build', [sName, 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();
+ }
+
+ _.each(ViewModelClass.__names, function (sName) {
+ Plugins.runHook('view-model-post-build', [sName, oViewModel, oViewModelDom]);
+ });
+ }
+ else
+ {
+ Utils.log('Cannot find view model position: ' + sPosition);
+ }
+ }
+
+ return ViewModelClass ? ViewModelClass.__vm : null;
+ };
+
+ /**
+ * @param {Function} ViewModelClassToHide
+ */
+ Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
+ {
+ if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
+ {
+ ViewModelClassToHide.__vm.modalVisibility(false);
+ }
+ };
+
+ /**
+ * @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 || []);
+
+ _.each(ViewModelClassToShow.__names, function (sName) {
+ Plugins.runHook('view-model-on-show', [sName, 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);
+
+ _.each(ViewModelClass.__names, function (sName) {
+ Plugins.runHook('view-model-on-show', [sName, ViewModelClass.__vm]);
+ });
+ }
+
+ }, self);
+ }
+ }
+ // --
+
+ oCross = oScreen.__cross ? oScreen.__cross() : null;
+ 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 () {
+ Globals.$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);
+ }
+ };
+
+ module.exports = new Knoin();
+
+ }());
+
+/***/ },
+
+/***/ 6:
+/*!*****************************!*\
+ !*** ./dev/Common/Enums.js ***!
+ \*****************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var Enums = {};
+
+ /**
+ * @enum {string}
+ */
+ Enums.StorageResultType = {
+ 'Success': 'success',
+ 'Abort': 'abort',
+ 'Error': 'error',
+ 'Unload': 'unload'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.State = {
+ 'Empty': 10,
+ 'Login': 20,
+ 'Auth': 30
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.StateType = {
+ 'Webmail': 0,
+ 'Admin': 1
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.Capa = {
+ 'Prem': 'PREM',
+ 'TwoFactor': 'TWO_FACTOR',
+ 'OpenPGP': 'OPEN_PGP',
+ 'Prefetch': 'PREFETCH',
+ 'Gravatar': 'GRAVATAR',
+ 'Themes': 'THEMES',
+ 'Filters': 'FILTERS',
+ 'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
+ 'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.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'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.FolderType = {
+ 'Inbox': 10,
+ 'SentItems': 11,
+ 'Draft': 12,
+ 'Trash': 13,
+ 'Spam': 14,
+ 'Archive': 15,
+ 'NotSpam': 80,
+ 'User': 99
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.LoginSignMeTypeAsString = {
+ 'DefaultOff': 'defaultoff',
+ 'DefaultOn': 'defaulton',
+ 'Unused': 'unused'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.LoginSignMeType = {
+ 'DefaultOff': 0,
+ 'DefaultOn': 1,
+ 'Unused': 2
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.ComposeType = {
+ 'Empty': 'empty',
+ 'Reply': 'reply',
+ 'ReplyAll': 'replyall',
+ 'Forward': 'forward',
+ 'ForwardAsAttachment': 'forward-as-attachment',
+ 'Draft': 'draft',
+ 'EditAsNew': 'editasnew'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.UploadErrorCode = {
+ 'Normal': 0,
+ 'FileIsTooBig': 1,
+ 'FilePartiallyUploaded': 2,
+ 'FileNoUploaded': 3,
+ 'MissingTempFolder': 4,
+ 'FileOnSaveingError': 5,
+ 'FileType': 98,
+ 'Unknown': 99
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.SetSystemFoldersNotification = {
+ 'None': 0,
+ 'Sent': 1,
+ 'Draft': 2,
+ 'Spam': 3,
+ 'Trash': 4,
+ 'Archive': 5
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.ClientSideKeyName = {
+ 'FoldersLashHash': 0,
+ 'MessagesInboxLastHash': 1,
+ 'MailBoxListSize': 2,
+ 'ExpandedFolders': 3,
+ 'FolderListSize': 4
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.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
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.MessageSetAction = {
+ 'SetSeen': 0,
+ 'UnsetSeen': 1,
+ 'SetFlag': 2,
+ 'UnsetFlag': 3
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.MessageSelectAction = {
+ 'All': 0,
+ 'None': 1,
+ 'Invert': 2,
+ 'Unseen': 3,
+ 'Seen': 4,
+ 'Flagged': 5,
+ 'Unflagged': 6
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.DesktopNotifications = {
+ 'Allowed': 0,
+ 'NotAllowed': 1,
+ 'Denied': 2,
+ 'NotSupported': 9
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.MessagePriority = {
+ 'Low': 5,
+ 'Normal': 3,
+ 'High': 1
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.EditorDefaultType = {
+ 'Html': 'Html',
+ 'Plain': 'Plain'
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.CustomThemeType = {
+ 'Light': 'Light',
+ 'Dark': 'Dark'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.ServerSecure = {
+ 'None': 0,
+ 'SSL': 1,
+ 'TLS': 2
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.SearchDateType = {
+ 'All': -1,
+ 'Days3': 3,
+ 'Days7': 7,
+ 'Month': 30
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.SaveSettingsStep = {
+ 'Animate': -2,
+ 'Idle': -1,
+ 'TrueResult': 1,
+ 'FalseResult': 0
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.InterfaceAnimation = {
+ 'None': 'None',
+ 'Normal': 'Normal',
+ 'Full': 'Full'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.Layout = {
+ 'NoPreview': 0,
+ 'SidePreview': 1,
+ 'BottomPreview': 2
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.FilterConditionField = {
+ 'From': 'From',
+ 'To': 'To',
+ 'Recipient': 'Recipient',
+ 'Subject': 'Subject'
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.FilterConditionType = {
+ 'Contains': 'Contains',
+ 'NotContains': 'NotContains',
+ 'EqualTo': 'EqualTo',
+ 'NotEqualTo': 'NotEqualTo'
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.FiltersAction = {
+ 'None': 'None',
+ 'Move': 'Move',
+ 'Discard': 'Discard',
+ 'Forward': 'Forward'
+ };
+
+ /**
+ * @enum {string}
+ */
+ Enums.FilterRulesType = {
+ 'And': 'And',
+ 'Or': 'Or'
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.SignedVerifyStatus = {
+ 'UnknownPublicKeys': -4,
+ 'UnknownPrivateKey': -3,
+ 'Unverified': -2,
+ 'Error': -1,
+ 'None': 0,
+ 'Success': 1
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.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
+ };
+
+ /**
+ * @enum {number}
+ */
+ Enums.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
+ };
+
+ module.exports = Enums;
+
+ }());
+
+/***/ },
+
+/***/ 7:
+/*!*******************************!*\
+ !*** ./dev/Common/Globals.js ***!
+ \*******************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ Globals = {},
+
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+ ko = __webpack_require__(/*! ko */ 3),
+ key = __webpack_require__(/*! key */ 19),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6)
+ ;
+
+ Globals.$win = $(window);
+ Globals.$doc = $(window.document);
+ Globals.$html = $('html');
+ Globals.$div = $('');
+
+ /**
+ * @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 && Globals.$html.hasClass('csstransitions');
+
+ /**
+ * @type {boolean}
+ */
+ Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
+
+ /**
+ * @type {string}
+ */
+ Globals.sAnimationType = '';
+
+ /**
+ * @type {*}
+ */
+ Globals.__APP = 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',
+ 'ja': 'ja',
+ 'ja-jp': 'ja',
+ 'ko': 'ko',
+ 'ko-kr': 'ko',
+ 'lv': 'lv',
+ 'nl': 'nl',
+ 'no': 'no',
+ 'pl': 'pl',
+ 'pt': 'pt',
+ 'pt-pt': 'pt',
+ 'pt-br': 'pt-br',
+ 'ro': 'ro',
+ 'ru': 'ru',
+ 'sk': 'sk',
+ 'tr': 'tr',
+ 'ua': 'ru',
+ '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;
+
+ }());
+
+/***/ },
+
+/***/ 9:
+/*!*********************************************!*\
+ !*** ./dev/Knoin/KnoinAbstractViewModel.js ***!
+ \*********************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Globals = __webpack_require__(/*! Common/Globals */ 7)
+ ;
+
+ /**
+ * @constructor
+ * @param {string=} sPosition = ''
+ * @param {string=} sTemplate = ''
+ */
+ 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.viewModelVisibility = ko.observable(false);
+ this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
+
+ this.viewModelName = '';
+ this.viewModelNames = [];
+ this.viewModelDom = null;
+ }
+
+ /**
+ * @type {boolean}
+ */
+ KnoinAbstractViewModel.prototype.bDisabeCloseOnEsc = false;
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.sPosition = '';
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.sTemplate = '';
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.sDefaultKeyScope = Enums.KeyState.None;
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.sCurrentKeyScope = Enums.KeyState.None;
+
+ /**
+ * @type {string}
+ */
+ KnoinAbstractViewModel.prototype.viewModelName = '';
+
+ /**
+ * @type {Array}
+ */
+ KnoinAbstractViewModel.prototype.viewModelNames = [];
+
+ /**
+ * @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;
+
+ Globals.$win.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;
+
+ }());
+
+/***/ },
+
+/***/ 10:
+/*!*****************************************!*\
+ !*** ./dev/Storages/SettingsStorage.js ***!
+ \*****************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function SettingsStorage()
+ {
+ this.oSettings = window['rainloopAppData'] || {};
+ this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
+ }
+
+ SettingsStorage.prototype.oSettings = null;
+
+ /**
+ * @param {string} sName
+ * @return {?}
+ */
+ SettingsStorage.prototype.settingsGet = function (sName)
+ {
+ return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
+ };
+
+ /**
+ * @param {string} sName
+ * @param {?} mValue
+ */
+ SettingsStorage.prototype.settingsSet = function (sName, mValue)
+ {
+ this.oSettings[sName] = mValue;
+ };
+
+ /**
+ * @param {string} sName
+ * @return {boolean}
+ */
+ SettingsStorage.prototype.capa = function (sName)
+ {
+ var mCapa = this.settingsGet('Capa');
+ return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
+ };
+
+
+ module.exports = new SettingsStorage();
+
+ }());
+
+/***/ },
+
+/***/ 11:
+/*!***********************************!*\
+ !*** ./dev/Common/LinkBuilder.js ***!
+ \***********************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function LinkBuilder()
+ {
+ var Settings = __webpack_require__(/*! Storage:Settings */ 10);
+
+ this.sBase = '#/';
+ this.sServer = './?';
+ this.sVersion = Settings.settingsGet('Version');
+ this.sSpecSuffix = Settings.settingsGet('AuthAccountHash') || '0';
+ this.sStaticPrefix = Settings.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 + '/' + Utils.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/' + Utils.encodeURIComponent(sEmail) + '/';
+ };
+
+ /**
+ * @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;
+ };
+
+ /**
+ * @return {string}
+ */
+ LinkBuilder.prototype.about = function ()
+ {
+ return this.sBase + 'about';
+ };
+
+ /**
+ * @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/min/openpgp.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();
+
+ }());
+
+/***/ },
+
+/***/ 12:
+/*!*************************!*\
+ !*** external "window" ***!
+ \*************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = window;
+
+/***/ },
+
+/***/ 14:
+/*!*************************!*\
+ !*** external "jQuery" ***!
+ \*************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = jQuery;
+
+/***/ },
+
+/***/ 17:
+/*!******************************!*\
+ !*** ./dev/Common/Consts.js ***!
+ \******************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var Consts = {};
+
+ Consts.Values = {};
+ Consts.DataImages = {};
+ Consts.Defaults = {};
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Defaults.MessagesPerPage = 20;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Defaults.ContactsPerPage = 50;
+
+ /**
+ * @const
+ * @type {Array}
+ */
+ Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Defaults.DefaultAjaxTimeout = 30000;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ 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}
+ */
+ Consts.Values.UnuseOptionValue = '__UNUSE__';
+
+ /**
+ * @const
+ * @type {string}
+ */
+ Consts.Values.ClientSideStorageIndexName = 'rlcsc';
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.ImapDefaulPort = 143;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.ImapDefaulSecurePort = 993;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.SmtpDefaulPort = 25;
+
+ /**
+ * @const
+ * @type {number}
+ */
+ Consts.Values.SmtpDefaulSecurePort = 465;
+
+ /**
+ * @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));
+
+/***/ },
+
+/***/ 19:
+/*!**********************!*\
+ !*** external "key" ***!
+ \**********************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = key;
+
+/***/ },
+
+/***/ 22:
+/*!******************************!*\
+ !*** ./dev/Common/Events.js ***!
+ \******************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Plugins = __webpack_require__(/*! Common/Plugins */ 26)
+ ;
+
+ /**
+ * @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();
+
+ }());
+
+/***/ },
+
+/***/ 23:
+/*!**********************************!*\
+ !*** ./dev/Models/EmailModel.js ***!
+ \**********************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @param {string=} sEmail
+ * @param {string=} sName
+ *
+ * @constructor
+ */
+ function EmailModel(sEmail, sName)
+ {
+ this.email = sEmail || '';
+ this.name = sName || '';
+
+ 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 = '';
+
+ EmailModel.prototype.clear = function ()
+ {
+ this.email = '';
+ this.name = '';
+ };
+
+ /**
+ * @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 = '';
+ }
+ };
+
+ /**
+ * @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(/\\\\(.)/g, '$1');
+ $sComment = $sComment.replace(/\\\\(.)/g, '$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;
+ };
+
+ module.exports = EmailModel;
+
+ }());
+
+/***/ },
+
+/***/ 24:
+/*!******************************************!*\
+ !*** ./dev/Knoin/KnoinAbstractScreen.js ***!
+ \******************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ crossroads = __webpack_require__(/*! crossroads */ 48),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @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;
+
+ }());
+
+/***/ },
+
+/***/ 25:
+/*!*************************!*\
+ !*** external "moment" ***!
+ \*************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = moment;
+
+/***/ },
+
+/***/ 26:
+/*!*******************************!*\
+ !*** ./dev/Common/Plugins.js ***!
+ \*******************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @constructor
+ */
+ function Plugins()
+ {
+ this.__boot = null;
+ this.__data = null;
+ this.__remote = null;
+
+ this.oSettings = __webpack_require__(/*! Storage:Settings */ 10);
+
+ this.oViewModelsHooks = {};
+ this.oSimpleHooks = {};
+ }
+
+ Plugins.prototype.__boot = null;
+ Plugins.prototype.__data = null;
+ Plugins.prototype.__remote = null;
+
+ /**
+ * @type {Object}
+ */
+ Plugins.prototype.oViewModelsHooks = {};
+
+ /**
+ * @type {Object}
+ */
+ Plugins.prototype.oSimpleHooks = {};
+
+ /**
+ * @param {string} sName
+ * @param {Function} fCallback
+ */
+ Plugins.prototype.addHook = function (sName, fCallback)
+ {
+ if (Utils.isFunc(fCallback))
+ {
+ if (!Utils.isArray(this.oSimpleHooks[sName]))
+ {
+ this.oSimpleHooks[sName] = [];
+ }
+
+ this.oSimpleHooks[sName].push(fCallback);
+ }
+ };
+
+ /**
+ * @param {string} sName
+ * @param {Array=} aArguments
+ */
+ Plugins.prototype.runHook = function (sName, aArguments)
+ {
+ if (Utils.isArray(this.oSimpleHooks[sName]))
+ {
+ aArguments = aArguments || [];
+
+ _.each(this.oSimpleHooks[sName], function (fCallback) {
+ fCallback.apply(null, aArguments);
+ });
+ }
+ };
+
+ /**
+ * @param {string} sName
+ * @return {?}
+ */
+ Plugins.prototype.mainSettingsGet = function (sName)
+ {
+ return this.oSettings.settingsGet(sName);
+ };
+
+ /**
+ * @param {Function} fCallback
+ * @param {string} sAction
+ * @param {Object=} oParameters
+ * @param {?number=} iTimeout
+ * @param {string=} sGetAdd = ''
+ * @param {Array=} aAbortActions = []
+ */
+ Plugins.prototype.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
+ {
+ if (this.__remote)
+ {
+ this.__remote.defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
+ }
+ };
+
+ /**
+ * @param {string} sPluginSection
+ * @param {string} sName
+ * @return {?}
+ */
+ Plugins.prototype.settingsGet = function (sPluginSection, sName)
+ {
+ var oPlugin = this.oSettings.settingsGet('Plugins');
+ oPlugin = oPlugin && !Utils.isUnd(oPlugin[sPluginSection]) ? oPlugin[sPluginSection] : null;
+ return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
+ };
+
+ module.exports = new Plugins();
+
+ }());
+
+/***/ },
+
+/***/ 31:
+/*!*****************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsAskViewModel.js ***!
+ \*****************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+ key = __webpack_require__(/*! key */ 19),
+
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @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(['View:Popup:Ask', 'PopupsAskViewModel'], PopupsAskViewModel);
+ _.extend(PopupsAskViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ 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;
+
+ }());
+
+/***/ },
+
+/***/ 32:
+/*!***********************************************************!*\
+ !*** ./dev/ViewModels/Popups/PopupsLanguagesViewModel.js ***!
+ \***********************************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ _ = __webpack_require__(/*! _ */ 2),
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+
+ kn = __webpack_require__(/*! App:Knoin */ 5),
+ KnoinAbstractViewModel = __webpack_require__(/*! Knoin:AbstractViewModel */ 9)
+ ;
+
+ /**
+ * @constructor
+ * @extends KnoinAbstractViewModel
+ */
+ function PopupsLanguagesViewModel()
+ {
+ KnoinAbstractViewModel.call(this, 'Popups', 'PopupsLanguages');
+
+ this.Data = Globals.__APP.data(); // TODO
+
+ this.exp = ko.observable(false);
+
+ this.languages = ko.computed(function () {
+ return _.map(this.Data.languages(), function (sLanguage) {
+ return {
+ 'key': sLanguage,
+ 'selected': ko.observable(false),
+ 'fullName': Utils.convertLangName(sLanguage)
+ };
+ });
+ }, this);
+
+ this.Data.mainLanguage.subscribe(function () {
+ this.resetMainLanguage();
+ }, this);
+
+ kn.constructorEnd(this);
+ }
+
+ kn.extendAsViewModel(['View:Popup:Languages', 'PopupsLanguagesViewModel'], PopupsLanguagesViewModel);
+ _.extend(PopupsLanguagesViewModel.prototype, KnoinAbstractViewModel.prototype);
+
+ PopupsLanguagesViewModel.prototype.languageEnName = function (sLanguage)
+ {
+ return Utils.convertLangName(sLanguage, true);
+ };
+
+ PopupsLanguagesViewModel.prototype.resetMainLanguage = function ()
+ {
+ var sCurrent = this.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)
+ {
+ this.Data.mainLanguage(sLang);
+ this.cancelCommand();
+ };
+
+ module.exports = PopupsLanguagesViewModel;
+
+ }());
+
+/***/ },
+
+/***/ 34:
+/*!*********************************!*\
+ !*** ./dev/Apps/AbstractApp.js ***!
+ \*********************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+ Events = __webpack_require__(/*! Common/Events */ 22),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10),
+
+ KnoinAbstractBoot = __webpack_require__(/*! Knoin:AbstractBoot */ 50)
+ ;
+
+ /**
+ * @constructor
+ * @param {RemoteStorage|AdminRemoteStorage} Remote
+ * @extends KnoinAbstractBoot
+ */
+ function AbstractApp(Remote)
+ {
+ KnoinAbstractBoot.call(this);
+
+ this.isLocalAutocomplete = true;
+
+ this.iframe = $('').appendTo('body');
+
+ Globals.$win.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() : '',
+ Globals.$html.attr('class'),
+ Utils.microtime() - Globals.now
+ );
+ }
+ });
+
+ Globals.$doc.on('keydown', function (oEvent) {
+ if (oEvent && oEvent.ctrlKey)
+ {
+ Globals.$html.addClass('rl-ctrl-key-pressed');
+ }
+ }).on('keyup', function (oEvent) {
+ if (oEvent && !oEvent.ctrlKey)
+ {
+ Globals.$html.removeClass('rl-ctrl-key-pressed');
+ }
+ });
+ }
+
+ _.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
+
+ AbstractApp.prototype.remote = function ()
+ {
+ return null;
+ };
+
+ AbstractApp.prototype.data = function ()
+ {
+ return null;
+ };
+
+ /**
+ * @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} sTitle
+ */
+ AbstractApp.prototype.setTitle = function (sTitle)
+ {
+ sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
+ Settings.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 = __webpack_require__(/*! App:Knoin */ 5),
+ sCustomLogoutLink = Utils.pString(Settings.settingsGet('CustomLogoutLink')),
+ bInIframe = !!Settings.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 = __webpack_require__(/*! ssm */ 117);
+
+ Utils.initOnStartOrLangChange(function () {
+ Utils.initNotificationLanguage();
+ }, null);
+
+ _.delay(function () {
+ Utils.windowResize();
+ }, 1000);
+
+ ssm.addState({
+ 'id': 'mobile',
+ 'maxWidth': 767,
+ 'onEnter': function() {
+ Globals.$html.addClass('ssm-state-mobile');
+ Events.pub('ssm.mobile-enter');
+ },
+ 'onLeave': function() {
+ Globals.$html.removeClass('ssm-state-mobile');
+ Events.pub('ssm.mobile-leave');
+ }
+ });
+
+ ssm.addState({
+ 'id': 'tablet',
+ 'minWidth': 768,
+ 'maxWidth': 999,
+ 'onEnter': function() {
+ Globals.$html.addClass('ssm-state-tablet');
+ },
+ 'onLeave': function() {
+ Globals.$html.removeClass('ssm-state-tablet');
+ }
+ });
+
+ ssm.addState({
+ 'id': 'desktop',
+ 'minWidth': 1000,
+ 'maxWidth': 1400,
+ 'onEnter': function() {
+ Globals.$html.addClass('ssm-state-desktop');
+ },
+ 'onLeave': function() {
+ Globals.$html.removeClass('ssm-state-desktop');
+ }
+ });
+
+ ssm.addState({
+ 'id': 'desktop-large',
+ 'minWidth': 1400,
+ 'onEnter': function() {
+ Globals.$html.addClass('ssm-state-desktop-large');
+ },
+ 'onLeave': function() {
+ Globals.$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) {
+ Globals.$html.toggleClass('rl-left-panel-disabled', bValue);
+ });
+
+ ssm.ready();
+ };
+
+ module.exports = AbstractApp;
+
+ }());
+
+/***/ },
+
+/***/ 35:
+/*!*********************!*\
+ !*** ./dev/Boot.js ***!
+ \*********************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ module.exports = function (App) {
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Plugins = __webpack_require__(/*! Common/Plugins */ 26),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+
+ EmailModel = __webpack_require__(/*! Model:Email */ 23)
+ ;
+
+ Globals.__APP = App;
+
+ Plugins.__boot = App;
+ Plugins.__remote = App.remote();
+ Plugins.__data = App.data();
+
+ Globals.$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
+
+ Globals.$win.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
+
+ Globals.$win.unload(function () {
+ Globals.bUnload = true;
+ });
+
+ Globals.$html.on('click.dropdown.data-api', function () {
+ Utils.detectDropdownVisibility();
+ });
+
+ // export
+ window['rl'] = window['rl'] || {};
+ window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins);
+ window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins);
+ window['rl']['remoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
+ window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
+ window['rl']['createCommand'] = Utils.createCommand;
+
+ window['rl']['EmailModel'] = EmailModel;
+ window['rl']['Enums'] = Enums;
+
+ window['__APP_BOOT'] = function (fCall) {
+
+ // boot
+ $(function () {
+
+ if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
+ {
+ $('#rl-templates').html(window['rainloopTEMPLATES'][0]);
+
+ _.delay(function () {
+
+ App.bootstart();
+ Globals.$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
+
+ }, 10);
+ }
+ else
+ {
+ fCall(false);
+ }
+
+ window['__APP_BOOT'] = null;
+ });
+ };
+
+ };
+
+ }());
+
+/***/ },
+
+/***/ 37:
+/*!***************************************!*\
+ !*** ./dev/Models/ContactTagModel.js ***!
+ \***************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ var
+ ko = __webpack_require__(/*! ko */ 3),
+
+ Utils = __webpack_require__(/*! Common/Utils */ 1)
+ ;
+
+ /**
+ * @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;
+
+ }());
+
+/***/ },
+
+/***/ 39:
+/*!**************************************!*\
+ !*** ./dev/Storages/AbstractData.js ***!
+ \**************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ var
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AbstractData()
+ {
+ Utils.initDataConstructorBySettings(this);
+ }
+
+ AbstractData.prototype.populateDataOnStart = function()
+ {
+ var
+ mLayout = Utils.pInt(Settings.settingsGet('Layout')),
+ aLanguages = Settings.settingsGet('Languages'),
+ aThemes = Settings.settingsGet('Themes')
+ ;
+
+ if (Utils.isArray(aLanguages))
+ {
+ this.languages(aLanguages);
+ }
+
+ if (Utils.isArray(aThemes))
+ {
+ this.themes(aThemes);
+ }
+
+ this.mainLanguage(Settings.settingsGet('Language'));
+ this.mainTheme(Settings.settingsGet('Theme'));
+
+ this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
+ this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
+ this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
+ this.determineUserLanguage(!!Settings.settingsGet('DetermineUserLanguage'));
+ this.determineUserDomain(!!Settings.settingsGet('DetermineUserDomain'));
+
+ this.capaThemes(Settings.capa(Enums.Capa.Themes));
+ this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
+ this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
+ this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
+
+ this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
+ this.showImages(!!Settings.settingsGet('ShowImages'));
+ this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
+ this.interfaceAnimation(Settings.settingsGet('InterfaceAnimation'));
+
+ this.mainMessagesPerPage(Settings.settingsGet('MPP'));
+
+ this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
+ this.useThreads(!!Settings.settingsGet('UseThreads'));
+ this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
+ this.useCheckboxesInList(!!Settings.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(!!Settings.settingsGet('SupportedFacebookSocial'));
+ this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
+ this.facebookAppID(Settings.settingsGet('FacebookAppID'));
+ this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
+
+ this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
+ this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
+ this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
+
+ this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
+ this.googleClientID(Settings.settingsGet('GoogleClientID'));
+ this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
+ this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
+
+ this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
+ this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
+
+ this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
+ };
+
+ module.exports = AbstractData;
+
+ }());
+
+/***/ },
+
+/***/ 40:
+/*!***********************************************!*\
+ !*** ./dev/Storages/AbstractRemoteStorage.js ***!
+ \***********************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ /* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+
+ (function () {
+
+ 'use strict';
+
+ var
+ window = __webpack_require__(/*! window */ 12),
+ _ = __webpack_require__(/*! _ */ 2),
+ $ = __webpack_require__(/*! $ */ 14),
+
+ Consts = __webpack_require__(/*! Common/Consts */ 17),
+ Enums = __webpack_require__(/*! Common/Enums */ 6),
+ Globals = __webpack_require__(/*! Common/Globals */ 7),
+ Utils = __webpack_require__(/*! Common/Utils */ 1),
+ Plugins = __webpack_require__(/*! Common/Plugins */ 26),
+ LinkBuilder = __webpack_require__(/*! Common/LinkBuilder */ 11),
+
+ Settings = __webpack_require__(/*! Storage:Settings */ 10)
+ ;
+
+ /**
+ * @constructor
+ */
+ function AbstractRemoteStorage()
+ {
+ this.oRequests = {};
+ }
+
+ AbstractRemoteStorage.prototype.oRequests = {};
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sRequestAction
+ * @param {string} sType
+ * @param {?AjaxJsonDefaultResponse} oData
+ * @param {boolean} bCached
+ * @param {*=} oRequestParameters
+ */
+ AbstractRemoteStorage.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.__APP)
+ {
+ Globals.__APP.loginAndLogoutReload(true);
+ }
+ }
+
+ if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
+ {
+ if (window.__rlah_clear)
+ {
+ window.__rlah_clear();
+ }
+
+ if (Globals.__APP)
+ {
+ Globals.__APP.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}
+ */
+ AbstractRemoteStorage.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'] = Settings.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 = []
+ */
+ AbstractRemoteStorage.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
+ */
+ AbstractRemoteStorage.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
+ */
+ AbstractRemoteStorage.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
+ */
+ AbstractRemoteStorage.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
+ */
+ AbstractRemoteStorage.prototype.getPublicKey = function (fCallback)
+ {
+ this.defaultRequest(fCallback, 'GetPublicKey');
+ };
+
+ /**
+ * @param {?Function} fCallback
+ * @param {string} sVersion
+ */
+ AbstractRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
+ {
+ this.defaultRequest(fCallback, 'Version', {
+ 'Version': sVersion
+ });
+ };
+
+ module.exports = AbstractRemoteStorage;
+
+ }());
+
+/***/ },
+
+/***/ 48:
+/*!*****************************!*\
+ !*** external "crossroads" ***!
+ \*****************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = crossroads;
+
+/***/ },
+
+/***/ 50:
+/*!****************************************!*\
+ !*** ./dev/Knoin/KnoinAbstractBoot.js ***!
+ \****************************************/
+/***/ function(module, exports, __webpack_require__) {
+
+
+ (function () {
+
+ 'use strict';
+
+ /**
+ * @constructor
+ */
+ function KnoinAbstractBoot()
+ {
+
+ }
+
+ KnoinAbstractBoot.prototype.bootstart = function ()
+ {
+
+ };
+
+ module.exports = KnoinAbstractBoot;
+
+ }());
+
+/***/ },
+
+/***/ 115:
+/*!*************************!*\
+ !*** external "hasher" ***!
+ \*************************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = hasher;
+
+/***/ },
+
+/***/ 117:
+/*!**********************!*\
+ !*** external "ssm" ***!
+ \**********************/
+/***/ function(module, exports, __webpack_require__) {
+
+ module.exports = ssm;
+
+/***/ }
+
+/******/ })
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/min/701a517c70faed82fff3.chunk.js b/rainloop/v/0.0.0/static/js/min/701a517c70faed82fff3.chunk.js
new file mode 100644
index 000000000..fa199b5be
--- /dev/null
+++ b/rainloop/v/0.0.0/static/js/min/701a517c70faed82fff3.chunk.js
@@ -0,0 +1,6 @@
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+webpackJsonp([0],Array(21).concat([function(e,t,s){!function(){"use strict";function t(){T.call(this,"Popups","PopupsCompose"),this.oEditor=null,this.aDraftInfo=null,this.sInReplyTo="",this.bFromDraft=!1,this.bSkipNext=!1,this.sReferences="",this.bCapaAdditionalIdentities=y.capa(u.Capa.AdditionalIdentities);var e=this,n=function(t){!1===e.showCcAndBcc()&&0"},t.prototype.sendMessageResponse=function(e,t){var s=!1,o="";this.sending(!1),u.StorageResultType.Success===e&&t&&t.Result&&(s=!0,this.modalVisibility()&&d.delegateRun(this,"closeCommand")),this.modalVisibility()&&!s&&(t&&u.Notification.CantSaveMessage===t.ErrorCode?(this.sendSuccessButSaveError(!0),i.alert(d.trim(d.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(o=d.getNotification(t&&t.ErrorCode?t.ErrorCode:u.Notification.CantSendMessage,t&&t.ErrorMessage?t.ErrorMessage:""),this.sendError(!0),i.alert(o||d.getNotification(u.Notification.CantSendMessage)))),this.reloadDraftFolder()},t.prototype.saveMessageResponse=function(e,t){var s=!1,o=null;this.saving(!1),u.StorageResultType.Success===e&&t&&t.Result&&t.Result.NewFolder&&t.Result.NewUid&&(this.bFromDraft&&(o=b.message(),o&&this.draftFolder()===o.folderFullNameRaw&&this.draftUid()===o.uid&&b.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},t.prototype.editor=function(e){if(e){var t=this;!this.oEditor&&this.composeEditorArea()?o.delay(function(){t.oEditor=new g(t.composeEditorArea(),null,function(){e(t.oEditor)},function(e){t.isHtml(!!e)})},300):this.oEditor&&e(this.oEditor)}},t.prototype.onShow=function(e,t,s,i,r){C.routeOff();var a=this,c="",l="",h="",p="",m="",f=null,g="",y="",S=[],w={},T=b.accountEmail(),E=b.signature(),F=b.signatureToAll(),P=[],A=null,L=null,R=e||u.ComposeType.Empty,M=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&&d.isNormal(t)&&(L=d.isArray(t)&&1===t.length?t[0]:d.isArray(t)?null:t),null!==T&&(w[T]=!0),this.currentIdentityID(this.findIdentityIdByMessage(R,L)),this.reset(),d.isNonEmptyArray(s)&&this.to(M(s)),""!==R&&L){switch(p=L.fullFormatDateValue(),m=L.subject(),A=L.aDraftInfo,f=n(L.body).clone(),f&&(f.find("blockquote.rl-bq-switcher").each(function(){n(this).removeClass("rl-bq-switcher hidden-bq")}),f.find(".rlBlockquoteSwitcher").each(function(){n(this).remove()})),f.find("[data-html-editor-font-wrapper]").removeAttr("data-html-editor-font-wrapper"),g=f.html(),R){case u.ComposeType.Empty:break;case u.ComposeType.Reply:this.to(M(L.replyEmails(w))),this.subject(d.replySubjectAdd("Re",m)),this.prepearMessageAttachments(L,R),this.aDraftInfo=["reply",L.uid,L.folderFullNameRaw],this.sInReplyTo=L.sMessageId,this.sReferences=d.trim(this.sInReplyTo+" "+L.sReferences);break;case u.ComposeType.ReplyAll:S=L.replyAllEmails(w),this.to(M(S[0])),this.cc(M(S[1])),this.subject(d.replySubjectAdd("Re",m)),this.prepearMessageAttachments(L,R),this.aDraftInfo=["reply",L.uid,L.folderFullNameRaw],this.sInReplyTo=L.sMessageId,this.sReferences=d.trim(this.sInReplyTo+" "+L.references());break;case u.ComposeType.Forward:this.subject(d.replySubjectAdd("Fwd",m)),this.prepearMessageAttachments(L,R),this.aDraftInfo=["forward",L.uid,L.folderFullNameRaw],this.sInReplyTo=L.sMessageId,this.sReferences=d.trim(this.sInReplyTo+" "+L.sReferences);break;case u.ComposeType.ForwardAsAttachment:this.subject(d.replySubjectAdd("Fwd",m)),this.prepearMessageAttachments(L,R),this.aDraftInfo=["forward",L.uid,L.folderFullNameRaw],this.sInReplyTo=L.sMessageId,this.sReferences=d.trim(this.sInReplyTo+" "+L.sReferences);break;case u.ComposeType.Draft:this.to(M(L.to)),this.cc(M(L.cc)),this.bcc(M(L.bcc)),this.bFromDraft=!0,this.draftFolder(L.folderFullNameRaw),this.draftUid(L.uid),this.subject(m),this.prepearMessageAttachments(L,R),this.aDraftInfo=d.isNonEmptyArray(A)&&3===A.length?A:null,this.sInReplyTo=L.sInReplyTo,this.sReferences=L.sReferences;break;case u.ComposeType.EditAsNew:this.to(M(L.to)),this.cc(M(L.cc)),this.bcc(M(L.bcc)),this.subject(m),this.prepearMessageAttachments(L,R),this.aDraftInfo=d.isNonEmptyArray(A)&&3===A.length?A:null,this.sInReplyTo=L.sInReplyTo,this.sReferences=L.sReferences}switch(R){case u.ComposeType.Reply:case u.ComposeType.ReplyAll:c=L.fromToLine(!1,!0),y=d.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:p,EMAIL:c}),g="
"+y+":"+g+"
";break;case u.ComposeType.Forward:c=L.fromToLine(!1,!0),l=L.toToLine(!1,!0),h=L.ccToLine(!1,!0),g="
"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+c+"
"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+l+(0 "+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+h:"")+"
"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+d.encodeHtml(p)+"
"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+d.encodeHtml(m)+"
"+g;break;case u.ComposeType.ForwardAsAttachment:g=""}F&&""!==E&&u.ComposeType.EditAsNew!==R&&u.ComposeType.Draft!==R&&(g=this.convertSignature(E,M(L.from,!0),g,R)),this.editor(function(e){e.setHtml(g,!1),L.isHtml()||e.modeToggle(!1)})}else u.ComposeType.Empty===R?(this.subject(d.isNormal(i)?""+i:""),g=d.isNormal(r)?""+r:"",F&&""!==E&&(g=this.convertSignature(E,"",d.convertPlainTextToHtml(g),R)),this.editor(function(e){e.setHtml(g,!1),u.EditorDefaultType.Html!==b.editorDefaultType()&&e.modeToggle(!1)})):d.isNonEmptyArray(t)&&o.each(t,function(e){a.addMessageAsAttachment(e)});P=this.getAttachmentsDownloadsForUpload(),d.isNonEmptyArray(P)&&v.messageUploadAttachments(function(e,t){if(u.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()},P),this.triggerForResize()},t.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},t.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},t.prototype.tryToClosePopup=function(){var e=this,t=s(31);C.isPopupVisible(t)||C.showScreenPopup(t,[d.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){e.modalVisibility()&&d.delegateRun(e,"closeCommand")}])},t.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}),p.$win.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",n(t).attr("id","dropboxjs").attr("data-app-key",y.settingsGet("DropboxApiKey")),i.document.body.appendChild(t)),this.driveEnabled()&&n.getScript("https://apis.google.com/js/api.js",function(){i.gapi&&e.driveVisible(!0)})},t.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()}},t.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(y.settingsGet("GoogleClientID")).setOAuthToken(e.access_token).setCallback(o.bind(t.driveCallback,t,e.access_token)).enableFeature(i.google.picker.Feature.NAV_HIDDEN).build();s.setVisible(!0)}}})}},t.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:y.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:y.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)}})})}})}},t.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},t.prototype.initUploader=function(){if(this.composeUploaderButton()){var e={},t=d.pInt(y.settingsGet("AttachmentLimit")),s=new l({action:f.upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});s?(s.on("onDragEnter",o.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",o.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",o.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",o.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",o.bind(function(t,s,o){var n=null;d.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",o.bind(function(e,i){this.dragAndDropOver(!1);var o=this,n=d.isUnd(i.FileName)?"":i.FileName.toString(),r=d.isNormal(i.Size)?d.pInt(i.Size):null,a=new w(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(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",o.bind(function(t){var s=null;d.isUnd(e[t])?(s=this.getAttachmentById(t),s&&(e[t]=s)):s=e[t],s&&(s.waiting(!1),s.uploading(!0))},this)).on("onComplete",o.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=d.getUploadErrorDescByCode(n):r||(o=d.i18n("UPLOAD/ERROR_UNKNOWN")),a&&(""!==o&&00&&o>0&&n>o?(s.uploading(!1),s.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(v.composeUploadExternals(function(e,t){var i=!1;s.uploading(!1),u.StorageResultType.Success===e&&t&&t.Result&&t.Result[s.id]&&(i=!0,s.tempName(t.Result[s.id])),i||s.error(d.getUploadErrorDescByCode(u.UploadErrorCode.FileNoUploaded))},[e.link]),!0)},t.prototype.addDriveAttachment=function(e,t){var s=this,i=function(e){return function(){s.attachments.remove(function(t){return t&&t.id===e})}},o=d.pInt(y.settingsGet("AttachmentLimit")),n=null,r=e.fileSize?d.pInt(e.fileSize):0;return n=new w(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(d.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(d.pInt(t.Result[n.id][1]))),s||n.error(d.getUploadErrorDescByCode(u.UploadErrorCode.FileNoUploaded))},e.downloadUrl,t),!0)},t.prototype.prepearMessageAttachments=function(e,t){if(e){var s=this,i=d.isNonEmptyArray(e.attachments())?e.attachments():[],o=0,n=i.length,r=null,a=null,c=!1,l=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>o;o++){switch(a=i[o],c=!1,t){case u.ComposeType.Reply:case u.ComposeType.ReplyAll:c=a.isLinked;break;case u.ComposeType.Forward:case u.ComposeType.Draft:case u.ComposeType.EditAsNew:c=!0}c&&(r=new w(a.download,a.fileName,a.estimatedSize,a.isInline,a.isLinked,a.cid,a.contentLocation),r.fromMessage=!0,r.cancel=l(a.download),r.waiting(!1).uploading(!0),this.attachments.push(r))}}},t.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(e){return e&&e.isLinked})},t.prototype.setMessageAttachmentFailedDowbloadText=function(){o.each(this.attachments(),function(e){e&&e.fromMessage&&e.waiting(!1).uploading(!1).error(d.getUploadErrorDescByCode(u.UploadErrorCode.FileNoUploaded))},this)},t.prototype.isEmptyForm=function(e){e=d.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())},t.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)},t.prototype.getAttachmentsDownloadsForUpload=function(){return o.map(o.filter(this.attachments(),function(e){return e&&""===e.tempName()}),function(e){return e.id})},t.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},e.exports=t}()},,,,,,,function(e,t,s){!function(){"use strict";function t(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=s(12),o=s(2),n=s(7),r=s(10);t.prototype.blurTrigger=function(){if(this.fOnBlur){var e=this;i.clearTimeout(this.iBlurTimer),this.iBlurTimer=i.setTimeout(function(){e.fOnBlur()},200)}},t.prototype.focusTrigger=function(){this.fOnBlur&&i.clearTimeout(this.iBlurTimer)},t.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},t.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},t.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},t.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():""},t.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())},t.prototype.setHtml=function(e,t){this.editor&&(this.modeToggle(!0),this.editor.setData(e),t&&this.focus())},t.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()}},t.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}},t.prototype.focus=function(){this.editor&&this.editor.focus()},t.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},t.prototype.resize=function(){if(this.editor&&this.__resizable)try{this.editor.resize(this.$element.width(),this.$element.innerHeight())}catch(e){}},t.prototype.clear=function(e){this.setHtml("",e)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(e){u.call(this,"settings",e),this.menu=n.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null,this.setupSettings()}var i=s(2),o=s(14),n=s(3),r=s(7),a=s(1),c=s(11),l=s(5),u=s(24);i.extend(t.prototype,u.prototype),t.prototype.setupSettings=function(e){e&&e()},t.prototype.onRoute=function(e){var t=this,s=null,u=null,h=null,d=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:(h=this.oViewModelPlace,h&&1===h.length?(s=new u,d=o("").addClass("rl-settings-view-model").hide(),d.appendTo(h),s.viewModelDom=d,s.__rlSettingsData=u.__rlSettingsData,u.__dom=d,u.__builded=!0,u.__vm=s,n.applyBindingAccessorsToNode(d[0],{i18nInit:!0,template:function(){return{name:u.__rlSettingsData.Template}}},s),a.delegateRun(s,"onBuild",[d])):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()})):l.setHash(c.settings(),!1,!0)},t.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(a.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},t.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")},t.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]]},e.exports=t}()},,,,,,,function(e,t,s){!function(){"use strict";function t(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}})}},t.prototype.autoSelect=function(e){this.bAutoSelect=!!e},t.prototype.getItemUid=function(e){var t="",s=this.oCallbacks.onItemGetUid||null;return s&&e&&(t=s(e)),t.toString()},t.prototype.newSelectPosition=function(e,t,s){var o=0,n=10,r=!1,c=!1,l=null,u=this.list(),h=u?u.length:0,d=this.focusedItem();if(h>0)if(d){if(d)if(a.EventKeyCode.Down===e||a.EventKeyCode.Up===e||a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)i.each(u,function(t){if(!c)switch(e){case a.EventKeyCode.Up:d===t?c=!0:l=t;break;case a.EventKeyCode.Down:case a.EventKeyCode.Insert:r?(l=t,c=!0):d===t&&(r=!0)}});else if(a.EventKeyCode.Home===e||a.EventKeyCode.End===e)a.EventKeyCode.Home===e?l=u[0]:a.EventKeyCode.End===e&&(l=u[u.length-1]);else if(a.EventKeyCode.PageDown===e){for(;h>o;o++)if(d===u[o]){o+=n,o=o>h-1?h-1:o,l=u[o];break}}else if(a.EventKeyCode.PageUp===e)for(o=h;o>=0;o--)if(d===u[o]){o-=n,o=0>o?0:o,l=u[o];break}}else a.EventKeyCode.Down===e||a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e||a.EventKeyCode.Home===e||a.EventKeyCode.PageUp===e?l=u[0]:(a.EventKeyCode.Up===e||a.EventKeyCode.End===e||a.EventKeyCode.PageDown===e)&&(l=u[u.length-1]);l?(this.focusedItem(l),d&&(t?(a.EventKeyCode.Up===e||a.EventKeyCode.Down===e)&&d.checked(!d.checked()):(a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)&&d.checked(!d.checked())),!this.bAutoSelect&&!s||this.isListChecked()||a.EventKeyCode.Space===e||this.selectedItem(l),this.scrollToFocused()):d&&(!t||a.EventKeyCode.Up!==e&&a.EventKeyCode.Down!==e?(a.EventKeyCode.Insert===e||a.EventKeyCode.Space===e)&&d.checked(!d.checked()):d.checked(!d.checked()),this.focusedItem(d))},t.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},t.prototype.scrollToTop=function(e){return this.oContentVisible&&this.oContentScrollable?(e?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},t.prototype.eventClickFunction=function(e,t){var s=this.getItemUid(e),i=0,o=0,n=null,r="",a=!1,c=!1,l=[],u=!1;if(t&&t.shiftKey&&""!==s&&""!==this.sLastUid&&s!==this.sLastUid)for(l=this.list(),u=e.checked(),i=0,o=l.length;o>i;i++)n=l[i],r=this.getItemUid(n),a=!1,(r===this.sLastUid||r===s)&&(a=!0),a&&(c=!c),(c||a)&&n.checked(u);this.sLastUid=""===s?"":s},t.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())}},t.prototype.on=function(e,t){this.oCallbacks[e]=t},e.exports=t}()},,,,,function(e,t,s){!function(){"use strict";function t(){p.call(this,"Right","SystemDropDown"),this.accounts=h.accounts,this.accountEmail=h.accountEmail,this.accountsLoading=h.accountsLoading,this.accountMenuDropdownTrigger=n.observable(!1),this.capaAdditionalAccounts=u.capa(a.Capa.AdditionalAccounts),this.loading=n.computed(function(){return this.accountsLoading()},this),this.accountClick=o.bind(this.accountClick,this)}var i=s(12),o=s(2),n=s(3),r=s(19),a=s(6),c=s(1),l=s(11),u=s(10),h=s(8),d=s(13),p=s(9);o.extend(t.prototype,p.prototype),t.prototype.accountClick=function(e,t){if(e&&t&&!c.isUnd(t.which)&&1===t.which){var s=this;this.accountsLoading(!0),o.delay(function(){s.accountsLoading(!1)},1e3)}return!0},t.prototype.emailTitle=function(){return h.accountEmail()},t.prototype.settingsClick=function(){s(5).setHash(l.settings())},t.prototype.settingsHelp=function(){s(5).showScreenPopup(s(46))},t.prototype.addAccountClick=function(){this.capaAdditionalAccounts&&s(5).showScreenPopup(s(42))},t.prototype.logoutClick=function(){d.logout(function(){i.__rlah_clear&&i.__rlah_clear(),s(4).loginAndLogoutReload(!0,u.settingsGet("ParentEmail")&&0=e?1:e},this),this.contactsPagenator=r.computed(h.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(c.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(e){return-1=i&&(this.bDropPageAfterDelete=!0),o.delay(function(){o.each(n,function(e){t.remove(e)})},500))},t.prototype.deleteSelectedContacts=function(){00?i:0),h.isNonEmptyArray(s.Result.Tags)&&(r=o.map(s.Result.Tags,function(e){var t=new b;return t.parse(e)?t:null}),r=o.compact(r))),t.contactsCount(i),t.contacts(n),t.contacts.loading(!1),t.contactTags(r),t.viewClearSearch(""!==t.search())},s,l.Defaults.ContactsPerPage,this.search())},t.prototype.onBuild=function(e){this.oContentVisible=n(".b-list-content",e),this.oContentScrollable=n(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,c.KeyState.ContactList);var t=this;a("delete",c.KeyState.ContactList,function(){return t.deleteCommand(),!1}),e.on("click",".e-pagenator .e-page",function(){var e=r.dataFor(this);e&&(t.contactsPage(h.pInt(e.value)),t.reloadContactList())}),this.initUploader()},t.prototype.onShow=function(){v.routeOff(),this.reloadContactList(!0)},t.prototype.onHide=function(){v.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){h.call(this,"Popups","PopupsFolderCreate"),a.initOnStartOrLangChange(function(){this.sNoParentText=a.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=o.observable(""),this.folderName.focused=o.observable(!1),this.selectedParentValue=o.observable(r.Values.UnuseOptionValue),this.parentFolderSelectList=o.computed(function(){var e=[],t=null,s=null,i=c.folderList(),o=function(e){return e?e.isSystemFolder()?e.name()+" "+e.manageFolderSystemName():e.name():""};return e.push(["",this.sNoParentText]),""!==c.namespace&&(t=function(e){return c.namespace!==e.fullNameRaw.substr(0,c.namespace.length)}),a.folderListOptionsBuilder([],i,[],e,null,t,s,o)},this),this.createFolder=a.createCommand(this,function(){var e=this.selectedParentValue();""===e&&1 li"),o=s&&("tab"===s.shortcut||"right"===s.shortcut),n=i.index(i.filter(".active"));return!o&&n>0?n--:o&&n0?"("+t+") ":" ")+e+" - ")+r.i18n("TITLES/MAILBOX"))},t.prototype.onShow=function(){this.setNewTitle(),n.keyScope(o.KeyState.MessageList)},t.prototype.onRoute=function(e,t,i,n){if(r.isUnd(n)?1:!n){var a=h.getFolderFullNameRaw(e),c=h.getFolderFromCacheList(a);
+c&&(u.currentFolder(c).messageListPage(t).messageListSearch(i),o.Layout.NoPreview===u.layout()&&u.message()&&u.message(null),s(4).reloadMessageList())}else o.Layout.NoPreview!==u.layout()||u.message()||s(4).historyBack()},t.prototype.onStart=function(){var e=function(){r.windowResize()};(l.capa(o.Capa.AdditionalAccounts)||l.capa(o.Capa.AdditionalIdentities))&&s(4).accountsAndIdentities(),i.delay(function(){"INBOX"!==u.currentFolderFullNameRaw()&&s(4).folderInformation("INBOX")},1e3),i.delay(function(){s(4).quota()},5e3),i.delay(function(){d.appDelayStart(r.emptyFunction)},35e3),n.$html.toggleClass("rl-no-preview-pane",o.Layout.NoPreview===u.layout()),u.folderList.subscribe(e),u.messageList.subscribe(e),u.message.subscribe(e),u.layout.subscribe(function(e){n.$html.toggleClass("rl-no-preview-pane",o.Layout.NoPreview===e)}),a.sub("mailbox.inbox-unread-count",function(e){u.foldersInboxUnreadCount(e)}),u.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},t.prototype.routes=function(){var e=function(){return["Inbox",1,"",!0]},t=function(e,t){return t[0]=r.pString(t[0]),t[1]=r.pInt(t[1]),t[1]=0>=t[1]?1:t[1],t[2]=r.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]=r.pString(t[0]),t[1]=r.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=t}()},function(e,t,s){!function(){"use strict";function t(){l.call(this,[s(114),s(112),s(113)]),n.initOnStartOrLangChange(function(){this.sSettingsTitle=n.i18n("TITLES/SETTINGS")},this,function(){this.setSettingsTitle()})}var i=s(2),o=s(6),n=s(1),r=s(7),a=s(10),c=s(5),l=s(29);i.extend(t.prototype,l.prototype),t.prototype.setupSettings=function(e){c.addSettingsViewModel(s(83),"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),a.settingsGet("ContactsIsAllowed")&&c.addSettingsViewModel(s(80),"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),a.capa(o.Capa.AdditionalAccounts)&&c.addSettingsViewModel(s(78),"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),a.capa(o.Capa.AdditionalIdentities)?c.addSettingsViewModel(s(84),"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"):c.addSettingsViewModel(s(85),"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),a.capa(o.Capa.Filters)&&c.addSettingsViewModel(s(81),"SettingsFilters","SETTINGS_LABELS/LABEL_FILTERS_NAME","filters"),a.capa(o.Capa.TwoFactor)&&c.addSettingsViewModel(s(87),"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),(a.settingsGet("AllowGoogleSocial")||a.settingsGet("AllowFacebookSocial")||a.settingsGet("AllowTwitterSocial"))&&c.addSettingsViewModel(s(88),"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),a.settingsGet("ChangePasswordIsAllowed")&&c.addSettingsViewModel(s(79),"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),c.addSettingsViewModel(s(82),"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),a.capa(o.Capa.Themes)&&c.addSettingsViewModel(s(89),"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes"),a.capa(o.Capa.OpenPGP)&&c.addSettingsViewModel(s(86),"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),e&&e()},t.prototype.onShow=function(){this.setSettingsTitle(),r.keyScope(o.KeyState.Settings)},t.prototype.setSettingsTitle=function(){s(4).setTitle(this.sSettingsTitle)},e.exports=t}()},,,,,,,,,,,,function(e,t,s){!function(){"use strict";function t(){this.accounts=l.accounts,this.processText=n.computed(function(){return l.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=s(12),o=s(2),n=s(3),r=s(6),a=s(1),c=s(11),l=s(8),u=s(13);t.prototype.addNewAccount=function(){s(5).showScreenPopup(s(42))},t.prototype.deleteAccount=function(e){if(e&&e.deleteAccess()){this.accountForDeletion(null);var t=s(5),n=function(t){return e===t};e&&(this.accounts.remove(n),u.accountDelete(function(e,n){r.StorageResultType.Success===e&&n&&n.Result&&n.Reload?(t.routeOff(),t.setHash(c.root(),!0),t.routeOff(),o.defer(function(){i.location.reload()})):s(4).accountsAndIdentities()},e.email))}},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){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=s(2),o=s(3),n=s(6),r=s(1),a=s(13);t.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},t.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=t}()},function(e,t,s){!function(){"use strict";function t(){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=s(3),o=s(1),n=s(13),r=s(8);t.prototype.onBuild=function(){r.contactsAutosave.subscribe(function(e){n.saveSettings(o.emptyFunction,{ContactsAutosave:e?"1":"0"})})},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){this.filters=i.observableArray([]),this.filters.loading=i.observable(!1),this.filters.subscribe(function(){o.windowResize()})}var i=s(3),o=s(1);t.prototype.deleteFilter=function(e){this.filters.remove(e)},t.prototype.addFilter=function(){var e=s(57);s(5).showScreenPopup(s(106),[new e])},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){this.foldersListError=a.foldersListError,this.folderList=a.folderList,this.processText=i.computed(function(){var e=a.foldersLoading(),t=a.foldersCreating(),s=a.foldersDeleting(),i=a.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=!!r.settingsGet("UseImapSubscribe")}var i=s(3),o=s(6),n=s(1),r=s(10),a=s(8),c=s(20),l=s(13),u=s(30);t.prototype.folderEditOnEnter=function(e){var t=e?n.trim(e.nameForEdit()):"";""!==t&&e.name()!==t&&(u.set(o.ClientSideKeyName.FoldersLashHash,""),a.foldersRenaming(!0),l.folderRename(function(e,t){a.foldersRenaming(!1),o.StorageResultType.Success===e&&t&&t.Result||a.foldersListError(t&&t.ErrorCode?n.getNotification(t.ErrorCode):n.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),s(4).folders()},e.fullNameRaw,t),c.removeFolderFromCacheList(e.fullNameRaw),e.name(t)),e.edited(!1)},t.prototype.folderEditOnEsc=function(e){e&&e.edited(!1)},t.prototype.onShow=function(){a.foldersListError("")},t.prototype.createFolder=function(){s(5).showScreenPopup(s(44))},t.prototype.systemFolder=function(){s(5).showScreenPopup(s(27))},t.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&&(u.set(o.ClientSideKeyName.FoldersLashHash,""),a.folderList.remove(t),a.foldersDeleting(!0),l.folderDelete(function(e,t){a.foldersDeleting(!1),o.StorageResultType.Success===e&&t&&t.Result||a.foldersListError(t&&t.ErrorCode?n.getNotification(t.ErrorCode):n.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),s(4).folders()},e.fullNameRaw),c.removeFolderFromCacheList(e.fullNameRaw))}else 0"},t.prototype.addNewIdentity=function(){s(5).showScreenPopup(s(45))},t.prototype.editIdentity=function(e){s(5).showScreenPopup(s(45),[e])},t.prototype.deleteIdentity=function(e){if(e&&e.deleteAccess()){this.identityForDeletion(null);var t=function(t){return e===t};e&&(this.identities.remove(t),l.identityDelete(function(){s(4).accountsAndIdentities()},e.id))}},t.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=c.signature();this.editor=new a(e.signatureDom(),function(){c.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)})}},t.prototype.onBuild=function(e){var t=this;e.on("click",".identity-item .e-action",function(){var e=o.dataFor(this);e&&t.editIdentity(e)}),i.delay(function(){var e=r.settingsSaveHelperSimpleFunction(t.displayNameTrigger,t),s=r.settingsSaveHelperSimpleFunction(t.replyTrigger,t),i=r.settingsSaveHelperSimpleFunction(t.signatureTrigger,t),o=r.settingsSaveHelperSimpleFunction(t.defaultIdentityIDTrigger,t);c.defaultIdentityID.subscribe(function(e){l.saveSettings(o,{DefaultIdentityID:e})}),c.displayName.subscribe(function(t){l.saveSettings(e,{DisplayName:t})}),c.replyTo.subscribe(function(e){l.saveSettings(s,{ReplyTo:e})}),c.signature.subscribe(function(e){l.saveSettings(i,{Signature:e})}),c.signatureToAll.subscribe(function(e){l.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){this.editor=null,this.displayName=c.displayName,this.signature=c.signature,this.signatureToAll=c.signatureToAll,this.replyTo=c.replyTo,this.signatureDom=o.observable(null),this.displayNameTrigger=o.observable(n.SaveSettingsStep.Idle),this.replyTrigger=o.observable(n.SaveSettingsStep.Idle),this.signatureTrigger=o.observable(n.SaveSettingsStep.Idle)}var i=s(2),o=s(3),n=s(6),r=s(1),a=s(28),c=s(8),l=s(13);t.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var e=this,t=c.signature();this.editor=new a(e.signatureDom(),function(){c.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)})}},t.prototype.onBuild=function(){var e=this;i.delay(function(){var t=r.settingsSaveHelperSimpleFunction(e.displayNameTrigger,e),s=r.settingsSaveHelperSimpleFunction(e.replyTrigger,e),i=r.settingsSaveHelperSimpleFunction(e.signatureTrigger,e);c.displayName.subscribe(function(e){l.saveSettings(t,{DisplayName:e})}),c.replyTo.subscribe(function(e){l.saveSettings(s,{ReplyTo:e})}),c.signature.subscribe(function(e){l.saveSettings(i,{Signature:e})}),c.signatureToAll.subscribe(function(e){l.saveSettings(null,{SignatureToAll:e?"1":"0"})})},50)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){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=s(3),o=s(5),n=s(8);t.prototype.addOpenPgpKey=function(){o.showScreenPopup(s(102))},t.prototype.generateOpenPgpKey=function(){o.showScreenPopup(s(108))},t.prototype.viewOpenPgpKey=function(e){e&&o.showScreenPopup(s(111),[e])},t.prototype.deleteOpenPgpKey=function(e){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(),s(4).reloadOpenPgpKeys()))},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){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=s(3),o=s(6),n=s(7),r=s(1),a=s(13);t.prototype.showSecret=function(){this.secreting(!0),a.showTwoFactorSecret(this.onSecretResult)},t.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},t.prototype.createTwoFactor=function(){this.processing(!0),a.createTwoFactor(this.onResult)},t.prototype.enableTwoFactor=function(){this.processing(!0),a.enableTwoFactor(this.onResult,this.viewEnable())},t.prototype.testTwoFactor=function(){s(5).showScreenPopup(s(110))},t.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),a.clearTwoFactor(this.onResult)},t.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},t.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)}},t.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(""))},t.prototype.onBuild=function(){this.processing(!0),a.getTwoFactor(this.onResult)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){var e=s(1),t=s(8);this.googleEnable=t.googleEnable,this.googleActions=t.googleActions,this.googleLoggined=t.googleLoggined,this.googleUserName=t.googleUserName,this.facebookEnable=t.facebookEnable,this.facebookActions=t.facebookActions,this.facebookLoggined=t.facebookLoggined,this.facebookUserName=t.facebookUserName,this.twitterEnable=t.twitterEnable,this.twitterActions=t.twitterActions,this.twitterLoggined=t.twitterLoggined,this.twitterUserName=t.twitterUserName,this.connectGoogle=e.createCommand(this,function(){this.googleLoggined()||s(4).googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()}),this.disconnectGoogle=e.createCommand(this,function(){s(4).googleDisconnect()}),this.connectFacebook=e.createCommand(this,function(){this.facebookLoggined()||s(4).facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()}),this.disconnectFacebook=e.createCommand(this,function(){s(4).facebookDisconnect()}),this.connectTwitter=e.createCommand(this,function(){this.twitterLoggined()||s(4).twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()}),this.disconnectTwitter=e.createCommand(this,function(){s(4).twitterDisconnect()})}e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){var e=this;this.mainTheme=u.mainTheme,this.themesObjects=r.observableArray([]),this.themeTrigger=r.observable(a.SaveSettingsStep.Idle).extend({throttle:100}),this.oLastAjax=null,this.iTimer=0,u.theme.subscribe(function(t){o.each(this.themesObjects(),function(e){e.selected(t===e.name)});var s=n("#rlThemeLink"),r=n("#rlThemeStyle"),l=s.attr("href");l||(l=r.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(a.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=n.ajax({url:l,dataType:"json"}).done(function(t){t&&c.isArray(t)&&2===t.length&&(!s||!s[0]||r&&r[0]||(r=n(''),s.after(r),s.remove()),r&&r[0]&&(r.attr("data-href",l).attr("data-theme",t[0]),r&&r[0]&&r[0].styleSheet&&!c.isUnd(r[0].styleSheet.cssText)?r[0].styleSheet.cssText=t[1]:r.text(t[1])),e.themeTrigger(a.SaveSettingsStep.TrueResult))}).always(function(){e.iTimer=i.setTimeout(function(){e.themeTrigger(a.SaveSettingsStep.Idle)},1e3),e.oLastAjax=null})),h.saveSettings(null,{Theme:t})},this)}var i=s(12),o=s(2),n=s(14),r=s(3),a=s(6),c=s(1),l=s(11),u=s(8),h=s(13);t.prototype.onBuild=function(){var e=u.theme();this.themesObjects(o.map(u.themes(),function(t){return{name:t,nameDisplay:c.convertThemeName(t),selected:r.observable(t===e),themePreviewSrc:l.themePreviewLink(t)}}))},e.exports=t}()},,,function(e,t,s){!function(){"use strict";function t(){a.call(this,"Center","About"),this.version=o.observable(r.settingsGet("Version")),n.constructorEnd(this)}var i=s(2),o=s(3),n=s(5),r=s(10),a=s(9);n.extendAsViewModel(["View:RainLoop:About","AboutViewModel"],t),i.extend(t.prototype,a.prototype),e.exports=t}()},,,,,function(e,t,s){!function(){"use strict";function t(){g.call(this,"Left","MailFolderList"),this.oContentVisible=null,this.oContentScrollable=null,this.messageList=m.messageList,this.folderList=m.folderList,this.folderListSystem=m.folderListSystem,this.foldersChanging=m.foldersChanging,this.leftPanelDisabled=u.leftPanelDisabled,this.iDropOverTimer=0,this.allowContacts=!!d.settingsGet("ContactsIsAllowed"),f.constructorEnd(this)}var i=s(12),o=s(2),n=s(14),r=s(3),a=s(19),c=s(1),l=s(6),u=s(7),h=s(11),d=s(10),p=s(20),m=s(8),f=s(5),g=s(9);f.extendAsViewModel(["View:RainLoop:MailBoxFolderList","MailBoxFolderListViewModel"],t),o.extend(t.prototype,g.prototype),t.prototype.onBuild=function(e){this.oContentVisible=n(".b-content",e),this.oContentScrollable=n(".content",this.oContentVisible);var t=this;e.on("click",".b-folders .e-item .e-link .e-collapsed-sign",function(e){var t=r.dataFor(this),i=!1;t&&e&&(i=t.collapsed(),s(4).setExpandedFolder(t.fullNameHash,i),t.collapsed(!i),e.preventDefault(),e.stopPropagation())}).on("click",".b-folders .e-item .e-link.selectable",function(e){e.preventDefault();var t=r.dataFor(this);t&&(l.Layout.NoPreview===m.layout()&&m.message(null),t.fullNameRaw===m.currentFolderFullNameRaw()&&p.setFolderHash(t.fullNameRaw,""),f.setHash(h.mailBox(t.fullNameHash)))}),a("up, down",l.KeyState.FolderList,function(s,i){var o=-1,r=i&&"up"===i.shortcut?38:40,a=n(".b-folders .e-item .e-link:not(.hidden):visible",e);return s&&a.length&&(o=a.index(a.filter(".focused")),o>-1&&a.eq(o).removeClass("focused"),38===r&&o>0?o--:40===r&&oi)?(this.oContentScrollable.scrollTop(s.top<0?this.oContentScrollable.scrollTop()+s.top-e:this.oContentScrollable.scrollTop()+s.top-i+o+e),!0):!1},t.prototype.messagesDrop=function(e,t){if(e&&t&&t.helper){var i=t.helper.data("rl-folder"),o=u.$html.hasClass("rl-ctrl-key-pressed"),n=t.helper.data("rl-uids");c.isNormal(i)&&""!==i&&c.isArray(n)&&s(4).moveMessagesToFolder(i,n,e.fullNameRaw,o)}},t.prototype.composeClick=function(){f.showScreenPopup(s(21))},t.prototype.createFolder=function(){f.showScreenPopup(s(44))},t.prototype.configureFolders=function(){f.setHash(h.settings("folders"))},t.prototype.contactsClick=function(){this.allowContacts&&f.showScreenPopup(s(43))},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){w.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="",this.hideDangerousActions=!!g.settingsGet("HideDangerousActions"),this.popupVisibility=h.popupVisibility,this.message=b.message,this.messageList=b.messageList,this.folderList=b.folderList,this.currentMessage=b.currentMessage,this.isMessageSelected=b.isMessageSelected,this.messageListSearch=b.messageListSearch,this.messageListError=b.messageListError,this.folderMenuForMove=b.folderMenuForMove,this.useCheckboxesInList=b.useCheckboxesInList,this.mainMessageListSearch=b.mainMessageListSearch,this.messageListEndFolder=b.messageListEndFolder,this.messageListChecked=b.messageListChecked,this.messageListCheckedOrSelected=b.messageListCheckedOrSelected,this.messageListCheckedOrSelectedUidsWithSubMails=b.messageListCheckedOrSelectedUidsWithSubMails,this.messageListCompleteLoadingThrottle=b.messageListCompleteLoadingThrottle,d.initOnStartOrLangChange(function(){this.emptySubjectValue=d.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=b.userQuota,this.userUsageSize=b.userUsageSize,this.userUsageProc=b.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 l.Layout.NoPreview!==b.layout()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=n.computed(function(){var e=b.messageListEndSearch();return""===e?"":d.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:e})}),this.messageListPagenator=n.computed(d.computedPagenatorHelper(b.messageListPage,b.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+")+")":""},t.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},t.prototype.moveSelectedMessagesToFolder=function(e,t){return this.canBeMoved()&&s(4).moveMessagesToFolder(b.currentFolderFullNameRaw(),b.messageListCheckedOrSelectedUidsWithSubMails(),e,t),!1},t.prototype.dragAndDronHelper=function(e){e&&e.checked(!0);var t=d.draggeblePlace(),s=b.messageListCheckedOrSelectedUidsWithSubMails();return t.data("rl-folder",b.currentFolderFullNameRaw()),t.data("rl-uids",s),t.find(".text").text(""+s.length),i.defer(function(){var e=b.messageListCheckedOrSelectedUidsWithSubMails();t.data("rl-uids",e),t.find(".text").text(""+e.length)}),t},t.prototype.onMessageResponse=function(e,t,s){b.hideMessageBodies(),b.messageLoading(!1),l.StorageResultType.Success===e&&t&&t.Result?b.setMessage(t,s):l.StorageResultType.Unload===e?(b.message(null),b.messageError("")):l.StorageResultType.Abort!==e&&(b.message(null),b.messageError(d.getNotification(t&&t.ErrorCode?t.ErrorCode:l.Notification.UnknownError)))},t.prototype.populateMessageBody=function(e){e&&(S.message(this.onMessageResponse,e.folderFullNameRaw,e.uid)?b.messageLoading(!0):d.log("Error: Unknown message request: "+e.folderFullNameRaw+" ~ "+e.uid+" [e-101]"))},t.prototype.setAction=function(e,t,o){var n=[],r=null,a=0;if(d.isUnd(o)&&(o=b.messageListChecked()),n=i.map(o,function(e){return e.uid}),""!==e&&00?100>e?e:"99+":""},t.prototype.verifyPgpSignedClearMessage=function(e){e&&e.verifyPgpSignedClearMessage()},t.prototype.decryptPgpEncryptedMessage=function(e){e&&e.decryptPgpEncryptedMessage(this.viewPgpPassword())},t.prototype.readReceipt=function(e){e&&""!==e.readReceipt()&&(m.sendReadReceiptMessage(u.emptyFunction,e.folderFullNameRaw,e.uid,e.readReceipt(),u.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:e.subject()}),u.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":p.accountEmail()})),e.isReadReceipt(!0),d.storeMessageFlagsToCache(e),s(4).reloadFlagsCurrentMessageListAndMessageFromCache())},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){n.call(this),o.constructorEnd(this)}var i=s(2),o=s(5),n=s(41);o.extendAsViewModel(["View:RainLoop:MailBoxSystemDropDown","MailBoxSystemDropDownViewModel"],t),i.extend(t.prototype,n.prototype),e.exports=t}()},,function(e,t,s){!function(){"use strict";function t(){c.call(this,"Popups","PopupsAddOpenPgpKey"),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=n.createCommand(this,function(){var e=30,t=null,i=n.trim(this.key()),o=/[\-]{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=r.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(t=o.exec(i),!t||0>e)break;t[0]&&t[1]&&t[2]&&t[1]===t[2]&&("PRIVATE"===t[1]?a.privateKeys.importKey(t[0]):"PUBLIC"===t[1]&&a.publicKeys.importKey(t[0])),e--}return a.store(),s(4).reloadOpenPgpKeys(),n.delegateRun(this,"cancelCommand"),!0}),a.constructorEnd(this)}var i=s(2),o=s(3),n=s(1),r=s(8),a=s(5),c=s(9);a.extendAsViewModel(["View:Popup:AddOpenPgpKey","PopupsAddOpenPgpKeyViewModel"],t),i.extend(t.prototype,c.prototype),t.prototype.clearPopup=function(){this.key(""),this.key.error(!1)},t.prototype.onShow=function(){this.clearPopup()},t.prototype.onFocus=function(){this.key.focus(!0)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){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=r.createCommand(this,function(){var e=this.buildSearchString();""!==e&&a.mainMessageListSearch(e),this.cancelCommand()}),c.constructorEnd(this)}var i=s(2),o=s(3),n=s(25),r=s(1),a=s(8),c=s(5),l=s(9);c.extendAsViewModel(["View:Popup:AdvancedSearch","PopupsAdvancedSearchViewModel"],t),i.extend(t.prototype,l.prototype),t.prototype.buildSearchStringValue=function(e){return-1"),this.submitRequest(!0),o.delay(function(){n=i.openpgp.generateKeyPair({userId:t,numBits:r.pInt(e.keyBitLength()),passphrase:r.trim(e.password())}),n&&n.privateKeyArmored&&(c.privateKeys.importKey(n.privateKeyArmored),c.publicKeys.importKey(n.publicKeyArmored),c.store(),s(4).reloadOpenPgpKeys(),r.delegateRun(e,"cancelCommand")),e.submitRequest(!1)},100),!0)}),c.constructorEnd(this)}var i=s(12),o=s(2),n=s(3),r=s(1),a=s(8),c=s(5),l=s(9);c.extendAsViewModel(["View:Popup:NewOpenPgpKey","PopupsNewOpenPgpKeyViewModel"],t),o.extend(t.prototype,l.prototype),t.prototype.clearPopup=function(){this.name(""),this.password(""),this.email(""),this.email.error(!1),this.keyBitLength(2048)},t.prototype.onShow=function(){this.clearPopup()},t.prototype.onFocus=function(){this.email.focus(!0)},e.exports=t}()},,function(e,t,s){!function(){"use strict";function t(){l.call(this,"Popups","PopupsTwoFactorTest");var e=this;this.code=o.observable(""),this.code.focused=o.observable(!1),this.code.status=o.observable(null),this.testing=o.observable(!1),this.testCode=r.createCommand(this,function(){this.testing(!0),a.testTwoFactor(function(t,s){e.testing(!1),e.code.status(n.StorageResultType.Success===t&&s&&s.Result?!0:!1)},this.code())},function(){return""!==this.code()&&!this.testing()}),c.constructorEnd(this)}var i=s(2),o=s(3),n=s(6),r=s(1),a=s(13),c=s(5),l=s(9);c.extendAsViewModel(["View:Popup:TwoFactorTest","PopupsTwoFactorTestViewModel"],t),i.extend(t.prototype,l.prototype),t.prototype.clearPopup=function(){this.code(""),this.code.focused(!1),this.code.status(null),this.testing(!1)},t.prototype.onShow=function(){this.clearPopup()},t.prototype.onFocus=function(){this.code.focused(!0)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){a.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=o.observable(""),this.keyDom=o.observable(null),r.constructorEnd(this)}var i=s(2),o=s(3),n=s(1),r=s(5),a=s(9);r.extendAsViewModel(["View:Popup:ViewOpenPgpKey","PopupsViewOpenPgpKeyViewModel"],t),i.extend(t.prototype,a.prototype),t.prototype.clearPopup=function(){this.key("")},t.prototype.selectKey=function(){var e=this.keyDom();e&&n.selectElement(e)},t.prototype.onShow=function(e){this.clearPopup(),e&&this.key(e.armor)},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(e){a.call(this,"Left","SettingsMenu"),this.leftPanelDisabled=o.leftPanelDisabled,this.menu=e.menu,r.constructorEnd(this)}var i=s(2),o=s(7),n=s(11),r=s(5),a=s(9);r.extendAsViewModel(["View:RainLoop:SettingsMenu","SettingsMenuViewModel"],t),i.extend(t.prototype,a.prototype),t.prototype.link=function(e){return n.settings(e)},t.prototype.backToMailBoxClick=function(){r.setHash(n.inbox())},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){l.call(this,"Right","SettingsPane"),c.constructorEnd(this)}var i=s(2),o=s(19),n=s(6),r=s(11),a=s(8),c=s(5),l=s(9);c.extendAsViewModel(["View:RainLoop:SettingsPane","SettingsPaneViewModel"],t),i.extend(t.prototype,l.prototype),t.prototype.onBuild=function(){var e=this;o("esc",n.KeyState.Settings,function(){e.backToMailBoxClick()})},t.prototype.onShow=function(){a.message(null)},t.prototype.backToMailBoxClick=function(){c.setHash(r.inbox())},e.exports=t}()},function(e,t,s){!function(){"use strict";function t(){n.call(this),o.constructorEnd(this)}var i=s(2),o=s(5),n=s(41);o.extendAsViewModel(["View:RainLoop:SettingsSystemDropDown","SettingsSystemDropDownViewModel"],t),i.extend(t.prototype,n.prototype),e.exports=t}()},,function(e){e.exports=ifvisible}]));
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/min/admin.js b/rainloop/v/0.0.0/static/js/min/admin.js
new file mode 100644
index 000000000..0deb00ab4
--- /dev/null
+++ b/rainloop/v/0.0.0/static/js/min/admin.js
@@ -0,0 +1,3 @@
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+webpackJsonp([2],{0:function(t,e,i){var s;!function(){"use strict";i(35)(i(16))}(s)},15:function(t,e,i){!function(){"use strict";function e(){n.call(this),this.oRequests={}}var s=i(2),n=i(40);s.extend(e.prototype,n.prototype),e.prototype.adminLogin=function(t,e,i){this.defaultRequest(t,"AdminLogin",{Login:e,Password:i})},e.prototype.adminLogout=function(t){this.defaultRequest(t,"AdminLogout")},e.prototype.saveAdminConfig=function(t,e){this.defaultRequest(t,"AdminSettingsUpdate",e)},e.prototype.domainList=function(t){this.defaultRequest(t,"AdminDomainList")},e.prototype.pluginList=function(t){this.defaultRequest(t,"AdminPluginList")},e.prototype.packagesList=function(t){this.defaultRequest(t,"AdminPackagesList")},e.prototype.coreData=function(t){this.defaultRequest(t,"AdminCoreData")},e.prototype.updateCoreData=function(t){this.defaultRequest(t,"AdminUpdateCoreData",{},9e4)},e.prototype.packageInstall=function(t,e){this.defaultRequest(t,"AdminPackageInstall",{Id:e.id,Type:e.type,File:e.file},6e4)},e.prototype.packageDelete=function(t,e){this.defaultRequest(t,"AdminPackageDelete",{Id:e.id})},e.prototype.domain=function(t,e){this.defaultRequest(t,"AdminDomainLoad",{Name:e})},e.prototype.plugin=function(t,e){this.defaultRequest(t,"AdminPluginLoad",{Name:e})},e.prototype.domainDelete=function(t,e){this.defaultRequest(t,"AdminDomainDelete",{Name:e})},e.prototype.domainDisable=function(t,e,i){return this.defaultRequest(t,"AdminDomainDisable",{Name:e,Disabled:i?"1":"0"})},e.prototype.pluginSettingsUpdate=function(t,e){return this.defaultRequest(t,"AdminPluginSettingsUpdate",e)},e.prototype.licensing=function(t,e){return this.defaultRequest(t,"AdminLicensing",{Force:e?"1":"0"})},e.prototype.licensingActivate=function(t,e,i){return this.defaultRequest(t,"AdminLicensingActivate",{Domain:e,Key:i})},e.prototype.pluginDisable=function(t,e,i){return this.defaultRequest(t,"AdminPluginDisable",{Name:e,Disabled:i?"1":"0"})},e.prototype.createOrUpdateDomain=function(t,e,i,s,n,o,a,r,c,u,l,p,d){this.defaultRequest(t,"AdminDomainSave",{Create:e?"1":"0",Name:i,IncHost:s,IncPort:n,IncSecure:o,IncShortLogin:a?"1":"0",OutHost:r,OutPort:c,OutSecure:u,OutShortLogin:l?"1":"0",OutAuth:p?"1":"0",WhiteList:d})},e.prototype.testConnectionForDomain=function(t,e,i,s,n,o,a,r,c){this.defaultRequest(t,"AdminDomainTest",{Name:e,IncHost:i,IncPort:s,IncSecure:n,OutHost:o,OutPort:a,OutSecure:r,OutAuth:c?"1":"0"})},e.prototype.testContacts=function(t,e){this.defaultRequest(t,"AdminContactsTest",e)},e.prototype.saveNewAdminPassword=function(t,e){this.defaultRequest(t,"AdminPasswordUpdate",e)},e.prototype.adminPing=function(t){this.defaultRequest(t,"AdminPing")},t.exports=new e}()},16:function(t,e,i){!function(){"use strict";function e(){m.call(this,p)}var s=i(12),n=i(2),o=i(3),a=i(6),r=i(1),c=i(11),u=i(10),l=i(18),p=i(15),d=i(63),g=i(62),h=i(5),m=i(34);n.extend(e.prototype,m.prototype),e.prototype.remote=function(){return p},e.prototype.data=function(){return l},e.prototype.reloadDomainList=function(){l.domainsLoading(!0),p.domainList(function(t,e){if(l.domainsLoading(!1),a.StorageResultType.Success===t&&e&&e.Result){var i=n.map(e.Result,function(t,e){return{name:e,disabled:o.observable(!t),deleteAccess:o.observable(!1)}},this);l.domains(i)}})},e.prototype.reloadPluginList=function(){l.pluginsLoading(!0),p.pluginList(function(t,e){if(l.pluginsLoading(!1),a.StorageResultType.Success===t&&e&&e.Result){var i=n.map(e.Result,function(t){return{name:t.Name,disabled:o.observable(!t.Enabled),configured:o.observable(!!t.Configured)}},this);l.plugins(i)}})},e.prototype.reloadPackagesList=function(){l.packagesLoading(!0),l.packagesReal(!0),p.packagesList(function(t,e){if(l.packagesLoading(!1),a.StorageResultType.Success===t&&e&&e.Result){l.packagesReal(!!e.Result.Real),l.packagesMainUpdatable(!!e.Result.MainUpdatable);var i=[],s={};n.each(l.packages(),function(t){t&&t.loading()&&(s[t.file]=t)}),r.isArray(e.Result.List)&&(i=n.compact(n.map(e.Result.List,function(t){return t?(t.loading=o.observable(!r.isUnd(s[t.file])),"core"!==t.type||t.canBeInstalled?t:null):null}))),l.packages(i)}else l.packagesReal(!1)})},e.prototype.updateCoreData=function(){l.coreUpdating(!0),p.updateCoreData(function(t,e){l.coreUpdating(!1),l.coreRemoteVersion(""),l.coreRemoteRelease(""),l.coreVersionCompare(-2),a.StorageResultType.Success===t&&e&&e.Result?(l.coreReal(!0),s.location.reload()):l.coreReal(!1)})},e.prototype.reloadCoreData=function(){l.coreChecking(!0),l.coreReal(!0),p.coreData(function(t,e){l.coreChecking(!1),a.StorageResultType.Success===t&&e&&e.Result?(l.coreReal(!!e.Result.Real),l.coreUpdatable(!!e.Result.Updatable),l.coreAccess(!!e.Result.Access),l.coreRemoteVersion(e.Result.RemoteVersion||""),l.coreRemoteRelease(e.Result.RemoteRelease||""),l.coreVersionCompare(r.pInt(e.Result.VersionCompare))):(l.coreReal(!1),l.coreRemoteVersion(""),l.coreRemoteRelease(""),l.coreVersionCompare(-2))})},e.prototype.reloadLicensing=function(t){t=r.isUnd(t)?!1:!!t,l.licensingProcess(!0),l.licenseError(""),p.licensing(function(t,e){l.licensingProcess(!1),a.StorageResultType.Success===t&&e&&e.Result&&r.isNormal(e.Result.Expired)?(l.licenseValid(!0),l.licenseExpired(r.pInt(e.Result.Expired)),l.licenseError(""),l.licensing(!0)):e&&e.ErrorCode&&-1 ").addClass("rl-settings-view-model").hide(),d.appendTo(p),i.viewModelDom=d,i.__rlSettingsData=l.__rlSettingsData,l.__dom=d,l.__builded=!0,l.__vm=i,o.applyBindingAccessorsToNode(d[0],{i18nInit:!0,template:function(){return{name:l.__rlSettingsData.Template}}},i),r.delegateRun(i,"onBuild",[d])):r.log("Cannot find sub settings view model position: SettingsSubScreen")),i&&s.defer(function(){e.oCurrentSubScreen&&(r.delegateRun(e.oCurrentSubScreen,"onHide"),e.oCurrentSubScreen.viewModelDom.hide()),e.oCurrentSubScreen=i,e.oCurrentSubScreen&&(e.oCurrentSubScreen.viewModelDom.show(),r.delegateRun(e.oCurrentSubScreen,"onShow"),r.delegateRun(e.oCurrentSubScreen,"onFocus",[],200),s.each(e.menu(),function(t){t.selected(i&&i.__rlSettingsData&&t.route===i.__rlSettingsData.Route)}),n("#rl-content .b-settings .b-content .content").scrollTop(0)),r.windowResize()})):u.setHash(c.settings(),!1,!0)},e.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(r.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},e.prototype.onBuild=function(){s.each(a.aViewModels.settings,function(t){t&&t.__rlSettingsData&&!s.find(a.aViewModels["settings-removed"],function(e){return e&&e===t})&&this.menu.push({route:t.__rlSettingsData.Route,label:t.__rlSettingsData.Label,selected:o.observable(!1),disabled:!!s.find(a.aViewModels["settings-disabled"],function(e){return e&&e===t})})},this),this.oViewModelPlace=n("#rl-content #rl-settings-subscreen")},e.prototype.routes=function(){var t=s.find(a.aViewModels.settings,function(t){return t&&t.__rlSettingsData&&t.__rlSettingsData.IsDefault}),e=t?t.__rlSettingsData.Route:"general",i={subname:/^(.*)$/,normalize_:function(t,i){return i.subname=r.isUnd(i.subname)?e:r.pString(i.subname),[i.subname]}};return[["{subname}/",i],["{subname}",i],["",i]]},t.exports=e}()},62:function(t,e,i){!function(){"use strict";function e(){n.call(this,"login",[i(93)])}var s=i(2),n=i(24);s.extend(e.prototype,n.prototype),e.prototype.onShow=function(){i(16).setTitle("")},t.exports=e}()},63:function(t,e,i){!function(){"use strict";function e(){o.call(this,[i(94),i(95)])}var s=i(2),n=i(5),o=i(29);s.extend(e.prototype,o.prototype),e.prototype.setupSettings=function(t){n.addSettingsViewModel(i(71),"AdminSettingsGeneral","General","general",!0),n.addSettingsViewModel(i(73),"AdminSettingsLogin","Login","login"),n.addSettingsViewModel(i(68),"AdminSettingsBranding","Branding","branding"),n.addSettingsViewModel(i(69),"AdminSettingsContacts","Contacts","contacts"),n.addSettingsViewModel(i(70),"AdminSettingsDomains","Domains","domains"),n.addSettingsViewModel(i(76),"AdminSettingsSecurity","Security","security"),n.addSettingsViewModel(i(77),"AdminSettingsSocial","Social","social"),n.addSettingsViewModel(i(75),"AdminSettingsPlugins","Plugins","plugins"),n.addSettingsViewModel(i(74),"AdminSettingsPackages","Packages","packages"),n.addSettingsViewModel(i(72),"AdminSettingsLicensing","Licensing","licensing"),n.addSettingsViewModel(i(67),"AdminSettingsAbout","About","about"),t&&t()},e.prototype.onShow=function(){i(16).setTitle("")},t.exports=e}()},67:function(t,e,i){!function(){"use strict";function e(){var t=i(10),e=i(18);this.version=s.observable(t.settingsGet("Version")),this.access=s.observable(!!t.settingsGet("CoreAccess")),this.errorDesc=s.observable(""),this.coreReal=e.coreReal,this.coreUpdatable=e.coreUpdatable,this.coreAccess=e.coreAccess,this.coreChecking=e.coreChecking,this.coreUpdating=e.coreUpdating,this.coreRemoteVersion=e.coreRemoteVersion,this.coreRemoteRelease=e.coreRemoteRelease,this.coreVersionCompare=e.coreVersionCompare,this.statusType=s.computed(function(){var t="",e=this.coreVersionCompare(),i=this.coreChecking(),s=this.coreUpdating(),n=this.coreReal();return i?t="checking":s?t="updating":n&&0===e?t="up-to-date":n&&-1===e?t="available":n||(t="error",this.errorDesc("Cannot access the repository at the moment.")),t},this)}var s=i(3);e.prototype.onBuild=function(){this.access()&&i(16).reloadCoreData()},e.prototype.updateCoreData=function(){this.coreUpdating()||i(16).updateCoreData()},t.exports=e}()},68:function(t,e,i){!function(){"use strict";function e(){var t=i(6),e=i(10);this.title=n.observable(e.settingsGet("Title")),this.title.trigger=n.observable(t.SaveSettingsStep.Idle),this.loadingDesc=n.observable(e.settingsGet("LoadingDescription")),this.loadingDesc.trigger=n.observable(t.SaveSettingsStep.Idle),this.loginLogo=n.observable(e.settingsGet("LoginLogo")),this.loginLogo.trigger=n.observable(t.SaveSettingsStep.Idle),this.loginDescription=n.observable(e.settingsGet("LoginDescription")),this.loginDescription.trigger=n.observable(t.SaveSettingsStep.Idle),this.loginCss=n.observable(e.settingsGet("LoginCss")),this.loginCss.trigger=n.observable(t.SaveSettingsStep.Idle)}var s=i(2),n=i(3),o=i(1);e.prototype.onBuild=function(){var t=this,e=i(15);s.delay(function(){var i=o.settingsSaveHelperSimpleFunction(t.title.trigger,t),s=o.settingsSaveHelperSimpleFunction(t.loadingDesc.trigger,t),n=o.settingsSaveHelperSimpleFunction(t.loginLogo.trigger,t),a=o.settingsSaveHelperSimpleFunction(t.loginDescription.trigger,t),r=o.settingsSaveHelperSimpleFunction(t.loginCss.trigger,t);t.title.subscribe(function(t){e.saveAdminConfig(i,{Title:o.trim(t)})}),t.loadingDesc.subscribe(function(t){e.saveAdminConfig(s,{LoadingDescription:o.trim(t)})}),t.loginLogo.subscribe(function(t){e.saveAdminConfig(n,{LoginLogo:o.trim(t)})}),t.loginDescription.subscribe(function(t){e.saveAdminConfig(a,{LoginDescription:o.trim(t)})}),t.loginCss.subscribe(function(t){e.saveAdminConfig(r,{LoginCss:o.trim(t)})})},50)},t.exports=e}()},69:function(t,e,i){!function(){"use strict";function e(){var t=i(15);this.defautOptionsAfterRender=a.defautOptionsAfterRender,this.enableContacts=n.observable(!!r.settingsGet("ContactsEnable")),this.contactsSharing=n.observable(!!r.settingsGet("ContactsSharing")),this.contactsSync=n.observable(!!r.settingsGet("ContactsSync"));var e=["sqlite","mysql","pgsql"],c=[],u=function(t){switch(t){case"sqlite":t="SQLite";break;case"mysql":t="MySQL";break;case"pgsql":t="PostgreSQL"}return t};r.settingsGet("SQLiteIsSupported")&&c.push("sqlite"),r.settingsGet("MySqlIsSupported")&&c.push("mysql"),r.settingsGet("PostgreSqlIsSupported")&&c.push("pgsql"),this.contactsSupported=0o;o++)g=e.Result["@Collection"][o],g&&"Object/Message"===g["@Object"]&&(m=p[o],m&&m.initByJson(g)||(m=C.newInstanceFromJson(g)),m&&(b.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=F&&(F++,m.newForAnimation(!0)),m.deleted(!1),t?b.initMessageFlagsFromCache(m):b.storeMessageFlagsToCache(m),m.lastInCollapsedThread(s&&-1i;i++)a=t[i],a&&(n=a.FullNameRaw,r=b.getFolderFromCacheList(n),r||(r=v.newInstanceFromJson(a),r&&(b.setFolderToCacheList(n,r),b.setFolderFullNameRaw(r.fullNameHash,n))),r&&(r.collapsed(!s.isFolderExpanded(r.fullNameHash)),a.Extended&&(a.Extended.Hash&&b.setFolderHash(r.fullNameRaw,a.Extended.Hash),u.isNormal(a.Extended.MessageCount)&&r.messageCountAll(a.Extended.MessageCount),u.isNormal(a.Extended.MessageUnseenCount)&&r.messageCountUnread(a.Extended.MessageUnseenCount)),l=a.SubFolders,l&&"Collection/FolderCollection"===l["@Object"]&&l["@Collection"]&&u.isArray(l["@Collection"])&&r.subFolders(this.folderResponseParseRec(e,l["@Collection"])),h.push(r)));return h},t.prototype.setFolders=function(e){var t=[],s=!1,i=function(e){return""===e||h.Values.UnuseOptionValue===e||null!==b.getFolderFromCacheList(e)?e:""};e&&e.Result&&"Collection/FolderCollection"===e.Result["@Object"]&&e.Result["@Collection"]&&u.isArray(e.Result["@Collection"])&&(u.isUnd(e.Result.Namespace)||(y.namespace=e.Result.Namespace),y.threading(!!f.settingsGet("UseImapThread")&&e.Result.IsThreadsSupported&&!0),t=this.folderResponseParseRec(y.namespace,e.Result["@Collection"]),y.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),y.sentFolder(i(f.settingsGet("SentFolder"))),y.draftFolder(i(f.settingsGet("DraftFolder"))),y.spamFolder(i(f.settingsGet("SpamFolder"))),y.trashFolder(i(f.settingsGet("TrashFolder"))),y.archiveFolder(i(f.settingsGet("ArchiveFolder"))),s&&F.saveSystemFolders(u.emptyFunction,{SentFolder:y.sentFolder(),DraftFolder:y.draftFolder(),SpamFolder:y.spamFolder(),TrashFolder:y.trashFolder(),ArchiveFolder:y.archiveFolder(),NullFolder:"NullFolder"}),m.set(n.ClientSideKeyName.FoldersLashHash,e.Result.FoldersHash))},t.prototype.isFolderExpanded=function(e){var t=m.get(n.ClientSideKeyName.ExpandedFolders);return u.isArray(t)&&-1!==o.indexOf(t,e)},t.prototype.setExpandedFolder=function(e,t){var s=m.get(n.ClientSideKeyName.ExpandedFolders);u.isArray(s)||(s=[]),t?(s.push(e),s=o.uniq(s)):s=o.without(s,e),m.set(n.ClientSideKeyName.ExpandedFolders,s)},t.prototype.initLayoutResizer=function(e,t,s){var i=60,o=155,r=a(e),n=a(t),l=m.get(s)||null,h=function(e){e&&(r.css({width:""+e+"px"}),n.css({left:""+e+"px"}))},d=function(e){if(e)r.resizable("disable"),h(i);else{r.resizable("enable");var t=u.pInt(m.get(s))||o;h(t>o?t:o)}},c=function(e,t){t&&t.size&&t.size.width&&(m.set(s,t.size.width),n.css({left:""+t.size.width+"px"}))};null!==l&&h(l>o?l:o),r.resizable({helper:"ui-resizable-helper",minWidth:o,maxWidth:350,handles:"e",stop:c}),p.sub("left-panel.off",function(){d(!0)}),p.sub("left-panel.on",function(){d(!1)})},t.prototype.bootstartLoginScreen=function(){var e=u.pString(f.settingsGet("CustomLoginLink"));e?(g.routeOff(),g.setHash(c.root(),!0),g.routeOff(),o.defer(function(){i.location.href=e})):(g.hideLoading(),g.startScreens([s(64)]),d.runHook("rl-start-login-screens"),p.pub("rl.bootstart-login-screens"))},t.prototype.bootstart=function(){w.prototype.bootstart.call(this),y.populateDataOnStart();var e=this,t=f.settingsGet("JsHash"),r=u.pInt(f.settingsGet("ContactsSyncInterval")),h=f.settingsGet("AllowGoogleSocial"),m=f.settingsGet("AllowFacebookSocial"),b=f.settingsGet("AllowTwitterSocial");u.initOnStartOrLangChange(function(){a.extend(!0,a.magnificPopup.defaults,{tClose:u.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:u.i18n("MAGNIFIC_POPUP/LOADING"),gallery:{tPrev:u.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:u.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:u.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:u.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:u.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this),i.SimplePace&&(i.SimplePace.set(70),i.SimplePace.sleep()),l.leftPanelDisabled.subscribe(function(e){p.pub("left-panel."+(e?"off":"on"))}),f.settingsGet("Auth")?(this.setTitle(u.i18n("TITLES/LOADING")),this.folders(o.bind(function(t){t?s.e(0,function(){g.hideLoading(),i.$LAB&&i.crypto&&i.crypto.getRandomValues&&f.capa(n.Capa.OpenPGP)?i.$LAB.script(i.openpgp?"":c.openPgpJs()).wait(function(){i.openpgp&&(y.openpgpKeyring=new i.openpgp.Keyring,y.capaOpenPGP(!0),p.pub("openpgp.init"),e.reloadOpenPgpKeys())}):y.capaOpenPGP(!1),g.startScreens([s(65),s(66),s(61)]),(h||m||b)&&e.socialUsers(!0),p.sub("interval.2m",function(){e.folderInformation("INBOX")}),p.sub("interval.2m",function(){var t=y.currentFolderFullNameRaw();"INBOX"!==t&&e.folderInformation(t)}),p.sub("interval.3m",function(){e.folderInformationMultiply()}),p.sub("interval.5m",function(){e.quota()}),p.sub("interval.10m",function(){e.folders()}),r=r>=5?r:20,r=320>=r?r:320,i.setInterval(function(){e.contactsSync()},6e4*r+5e3),o.delay(function(){e.contactsSync()},5e3),o.delay(function(){e.folderInformationMultiply(!0)},500),d.runHook("rl-start-user-screens"),p.pub("rl.bootstart-user-screens"),f.settingsGet("AccountSignMe")&&i.navigator.registerProtocolHandler&&o.delay(function(){try{i.navigator.registerProtocolHandler("mailto",i.location.protocol+"//"+i.location.host+i.location.pathname+"?mailto&to=%s",""+(f.settingsGet("Title")||"RainLoop"))}catch(e){}f.settingsGet("MailToEmail")&&u.mailToHelper(f.settingsGet("MailToEmail"),s(21))},500),l.bMobileDevice||o.defer(function(){e.initLayoutResizer("#rl-left","#rl-right",n.ClientSideKeyName.FolderListSize)})}):(g.hideLoading(),e.bootstartLoginScreen()),i.SimplePace&&i.SimplePace.set(100)},this))):(this.bootstartLoginScreen(),i.SimplePace&&i.SimplePace.set(100)),h&&(i["rl_"+t+"_google_service"]=function(){y.googleActions(!0),e.socialUsers()}),m&&(i["rl_"+t+"_facebook_service"]=function(){y.facebookActions(!0),e.socialUsers()}),b&&(i["rl_"+t+"_twitter_service"]=function(){y.twitterActions(!0),e.socialUsers()}),p.sub("interval.1m",function(){l.momentTrigger(!l.momentTrigger())}),d.runHook("rl-start-screens"),p.pub("rl.bootstart-end")},e.exports=new t}()},8:function(e,t,s){!function(){"use strict";function t(){b.call(this);var e=function(e){return function(){var t=g.getFolderFromCacheList(e());t&&t.type(h.FolderType.User)}},t=function(e){return function(t){var s=g.getFolderFromCacheList(t);s&&s.type(e)}};this.devEmail="",this.devPassword="",this.accountEmail=r.observable(""),this.accountIncLogin=r.observable(""),this.accountOutLogin=r.observable(""),this.projectHash=r.observable(""),this.threading=r.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=r.observable(""),this.draftFolder=r.observable(""),this.spamFolder=r.observable(""),this.trashFolder=r.observable(""),this.archiveFolder=r.observable(""),this.sentFolder.subscribe(e(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(e(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(e(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(e(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(e(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(t(h.FolderType.SentItems),this),this.draftFolder.subscribe(t(h.FolderType.Draft),this),this.spamFolder.subscribe(t(h.FolderType.Spam),this),this.trashFolder.subscribe(t(h.FolderType.Trash),this),this.archiveFolder.subscribe(t(h.FolderType.Archive),this),this.draftFolderNotEnabled=r.computed(function(){return""===this.draftFolder()||l.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=r.observable(""),this.signature=r.observable(""),this.signatureToAll=r.observable(!1),this.replyTo=r.observable(""),this.enableTwoFactor=r.observable(!1),this.accounts=r.observableArray([]),this.accountsLoading=r.observable(!1).extend({throttle:100}),this.defaultIdentityID=r.observable(""),this.identities=r.observableArray([]),this.identitiesLoading=r.observable(!1).extend({throttle:100}),this.contactTags=r.observableArray([]),this.contacts=r.observableArray([]),this.contacts.loading=r.observable(!1).extend({throttle:200}),this.contacts.importing=r.observable(!1).extend({throttle:200}),this.contacts.syncing=r.observable(!1).extend({throttle:200}),this.contacts.exportingVcf=r.observable(!1).extend({throttle:200}),this.contacts.exportingCsv=r.observable(!1).extend({throttle:200}),this.allowContactsSync=r.observable(!1),this.enableContactsSync=r.observable(!1),this.contactsSyncUrl=r.observable(""),this.contactsSyncUser=r.observable(""),this.contactsSyncPass=r.observable(""),this.allowContactsSync=r.observable(!!p.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=r.observable(!!p.settingsGet("EnableContactsSync")),this.contactsSyncUrl=r.observable(p.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=r.observable(p.settingsGet("ContactsSyncUser")),this.contactsSyncPass=r.observable(p.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=r.observableArray([]),this.folderList.focused=r.observable(!1),this.foldersListError=r.observable(""),this.foldersLoading=r.observable(!1),this.foldersCreating=r.observable(!1),this.foldersDeleting=r.observable(!1),this.foldersRenaming=r.observable(!1),this.foldersChanging=r.computed(function(){var e=this.foldersLoading(),t=this.foldersCreating(),s=this.foldersDeleting(),i=this.foldersRenaming();return e||t||s||i},this),this.foldersInboxUnreadCount=r.observable(0),this.currentFolder=r.observable(null).extend({toggleSubscribe:[null,function(e){e&&e.selected(!1)},function(e){e&&e.selected(!0)}]}),this.currentFolderFullNameRaw=r.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=r.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=r.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=r.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=r.computed(function(){var e=["INBOX"],t=this.folderList(),s=this.sentFolder(),i=this.draftFolder(),o=this.spamFolder(),a=this.trashFolder(),r=this.archiveFolder();return u.isArray(t)&&0=e?1:e},this),this.mainMessageListSearch=r.computed({read:this.messageListSearch,write:function(e){m.setHash(c.mailBox(this.currentFolderFullNameHash(),1,u.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(o.debounce(function(e){o.each(e,function(e){e.newForAnimation()&&e.newForAnimation(!1)})},500)),this.staticMessageList=new f,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?h.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.messageFullScreenMode(!1),this.hideMessageBodies(),h.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(h.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=o.throttle(this.purgeMessageBodyCache,3e4)}var i=s(12),o=s(2),a=s(14),r=s(3),n=s(25),l=s(17),h=s(6),d=s(7),u=s(1),c=s(11),p=s(10),g=s(20),m=s(5),f=s(38),y=s(30),b=s(39);o.extend(t.prototype,b.prototype),t.prototype.purgeMessageBodyCache=function(){var e=0,t=null,s=d.iMessageBodyCacheCount-l.Values.MessageBodyCacheLimit;s>0&&(t=this.messagesBodiesDom(),t&&(t.find(".rl-cache-class").each(function(){var t=a(this);s>t.data("rl-cache-count")&&(t.addClass("rl-cache-purge"),e++)}),e>0&&o.delay(function(){t.find(".rl-cache-purge").remove()},300)))},t.prototype.populateDataOnStart=function(){b.prototype.populateDataOnStart.call(this),this.accountEmail(p.settingsGet("Email")),this.accountIncLogin(p.settingsGet("IncLogin")),this.accountOutLogin(p.settingsGet("OutLogin")),this.projectHash(p.settingsGet("ProjectHash")),this.defaultIdentityID(p.settingsGet("DefaultIdentityID")),this.displayName(p.settingsGet("DisplayName")),this.replyTo(p.settingsGet("ReplyTo")),this.signature(p.settingsGet("Signature")),this.signatureToAll(!!p.settingsGet("SignatureToAll")),this.enableTwoFactor(!!p.settingsGet("EnableTwoFactor")),this.lastFoldersHash=y.get(h.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!p.settingsGet("RemoteSuggestions"),this.devEmail=p.settingsGet("DevEmail"),this.devPassword=p.settingsGet("DevPassword")},t.prototype.initUidNextAndNewMessages=function(e,t,s){if("INBOX"===e&&u.isNormal(t)&&""!==t){if(u.isArray(s)&&03)l(c.notificationMailIcon(),this.accountEmail(),u.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:n}));else for(;n>r;r++)l(c.notificationMailIcon(),f.emailsToLine(f.initEmailsFromJson(s[r].From),!1),s[r].Subject)}g.setFolderUidNext(e,t)}},t.prototype.hideMessageBodies=function(){var e=this.messagesBodiesDom();e&&e.find(".b-text-part").hide()},t.prototype.getNextFolderNames=function(e){e=u.isUnd(e)?!1:!!e;var t=[],s=10,i=n().unix(),a=i-300,r=[],l=function(t){o.each(t,function(t){t&&"INBOX"!==t.fullNameRaw&&t.selectable&&t.existen&&a>t.interval&&(!e||t.subScribed())&&r.push([t.interval,t.fullNameRaw]),t&&0t[0]?1:0}),o.find(r,function(e){var o=g.getFolderFromCacheList(e[1]);return o&&(o.interval=i,t.push(e[1])),s<=t.length}),o.uniq(t)},t.prototype.removeMessagesFromList=function(e,t,s,i){s=u.isNormal(s)?s:"",i=u.isUnd(i)?!1:!!i,t=o.map(t,function(e){return u.pInt(e)});var a=this,r=0,n=this.messageList(),l=g.getFolderFromCacheList(e),h=""===s?null:g.getFolderFromCacheList(s||""),d=this.currentFolderFullNameRaw(),c=this.message(),p=d===e?o.filter(n,function(e){return e&&-10&&l.messageCountUnread(0<=l.messageCountUnread()-r?l.messageCountUnread()-r:0)),h&&(h.messageCountAll(h.messageCountAll()+t.length),r>0&&h.messageCountUnread(h.messageCountUnread()+r),h.actionBlink(!0)),0100)&&(e.addClass("rl-bq-switcher hidden-bq"),a('').insertBefore(e).click(function(){e.toggleClass("hidden-bq"),u.windowResize()}).after("
").before("
"))})}},t.prototype.setMessage=function(e,t){var s=!1,i=!1,o=!1,r=null,n=null,l="",c="",p=!1,m=!1,f=this.messagesBodiesDom(),y=this.message();e&&y&&e.Result&&"Object/Message"===e.Result["@Object"]&&y.folderFullNameRaw===e.Result.Folder&&y.uid===e.Result.Uid&&(this.messageError(""),y.initUpdateByMessageJson(e.Result),g.addRequestedMessage(y.folderFullNameRaw,y.uid),t||y.initFlagsByJson(e.Result),f=f&&f[0]?f:null,f&&(l="rl-mgs-"+y.hash.replace(/[^a-zA-Z0-9]/g,""),n=f.find("#"+l),n&&n[0]?(y.body=n,y.body&&(y.body.data("rl-cache-count",++d.iMessageBodyCacheCount),y.fetchDataToDom())):(i=!!e.Result.HasExternals,o=!!e.Result.HasInternals,r=a('').hide().addClass("rl-cache-class"),r.data("rl-cache-count",++d.iMessageBodyCacheCount),u.isNormal(e.Result.Html)&&""!==e.Result.Html?(s=!0,c=e.Result.Html.toString()):u.isNormal(e.Result.Plain)&&""!==e.Result.Plain?(s=!1,c=u.plainToHtml(e.Result.Plain.toString(),!1),(y.isPgpSigned()||y.isPgpEncrypted())&&this.capaOpenPGP()&&(y.plainRaw=u.pString(e.Result.Plain),m=/---BEGIN PGP MESSAGE---/.test(y.plainRaw),m||(p=/-----BEGIN PGP SIGNED MESSAGE-----/.test(y.plainRaw)&&/-----BEGIN PGP SIGNATURE-----/.test(y.plainRaw)),d.$div.empty(),p&&y.isPgpSigned()?c=d.$div.append(a('').text(y.plainRaw)).html():m&&y.isPgpEncrypted()&&(c=d.$div.append(a('').text(y.plainRaw)).html()),d.$div.empty(),y.isPgpSigned(p),y.isPgpEncrypted(m))):s=!1,r.html(u.linkify(c)).addClass("b-text-part "+(s?"html":"plain")),y.isHtml(!!s),y.hasImages(!!i),y.pgpSignedVerifyStatus(h.SignedVerifyStatus.None),y.pgpSignedVerifyUser(""),y.body=r,y.body&&f.append(y.body),y.storeDataToDom(),o&&y.showInternalImages(!0),y.hasImages()&&this.showImages()&&y.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(y.body),this.hideMessageBodies(),y.body.show(),r&&this.initBlockquoteSwitcher(r)),g.initMessageFlagsFromCache(y),y.unseen()&&d.__APP&&d.__APP.setMessageSeen(y),u.windowResize())},t.prototype.calculateMessageListHash=function(e){return o.map(e,function(e){return""+e.hash+"_"+e.threadsLen()+"_"+e.flagHash()}).join("|")},t.prototype.findPublicKeyByHex=function(e){return o.find(this.openpgpkeysPublic(),function(t){return t&&e===t.id})},t.prototype.findPublicKeysByEmail=function(e){return o.compact(o.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}))},t.prototype.findPrivateKeyByEmail=function(e,t){var s=null,a=o.find(this.openpgpkeysPrivate(),function(t){return t&&e===t.email});if(a)try{s=i.openpgp.key.readArmored(a.armor),s&&!s.err&&s.keys&&s.keys[0]?(s=s.keys[0],s.decrypt(u.pString(t))):s=null}catch(r){s=null}return s},t.prototype.findSelfPrivateKey=function(e){return this.findPrivateKeyByEmail(this.accountEmail(),e)},e.exports=new t}()},13:function(e,t,s){!function(){"use strict";function t(){u.call(this),this.oRequests={}}var i=s(2),o=s(1),a=s(17),r=s(7),n=s(49),l=s(10),h=s(20),d=s(8),u=s(40);i.extend(t.prototype,u.prototype),t.prototype.folders=function(e){this.defaultRequest(e,"Folders",{SentFolder:l.settingsGet("SentFolder"),DraftFolder:l.settingsGet("DraftFolder"),SpamFolder:l.settingsGet("SpamFolder"),TrashFolder:l.settingsGet("TrashFolder"),ArchiveFolder:l.settingsGet("ArchiveFolder")},null,"",["Folders"])},t.prototype.login=function(e,t,s,i,o,a,r,n){this.defaultRequest(e,"Login",{Email:t,Login:s,Password:i,Language:a||"",AdditionalCode:r||"",AdditionalCodeSignMe:n?"1":"0",SignMe:o?"1":"0"})},t.prototype.getTwoFactor=function(e){this.defaultRequest(e,"GetTwoFactorInfo")},t.prototype.createTwoFactor=function(e){this.defaultRequest(e,"CreateTwoFactorSecret")},t.prototype.clearTwoFactor=function(e){this.defaultRequest(e,"ClearTwoFactorInfo")},t.prototype.showTwoFactorSecret=function(e){this.defaultRequest(e,"ShowTwoFactorSecret")},t.prototype.testTwoFactor=function(e,t){this.defaultRequest(e,"TestTwoFactorInfo",{Code:t})},t.prototype.enableTwoFactor=function(e,t){this.defaultRequest(e,"EnableTwoFactor",{Enable:t?"1":"0"})},t.prototype.clearTwoFactorInfo=function(e){this.defaultRequest(e,"ClearTwoFactorInfo")},t.prototype.contactsSync=function(e){this.defaultRequest(e,"ContactsSync",null,a.Defaults.ContactsSyncAjaxTimeout)},t.prototype.saveContactsSyncData=function(e,t,s,i,o){this.defaultRequest(e,"SaveContactsSyncData",{Enable:t?"1":"0",Url:s,User:i,Password:o})},t.prototype.accountAdd=function(e,t,s,i){this.defaultRequest(e,"AccountAdd",{Email:t,Login:s,Password:i})},t.prototype.accountDelete=function(e,t){this.defaultRequest(e,"AccountDelete",{EmailToDelete:t})},t.prototype.identityUpdate=function(e,t,s,i,o,a){this.defaultRequest(e,"IdentityUpdate",{Id:t,Email:s,Name:i,ReplyTo:o,Bcc:a})},t.prototype.identityDelete=function(e,t){this.defaultRequest(e,"IdentityDelete",{IdToDelete:t})},t.prototype.accountsAndIdentities=function(e){this.defaultRequest(e,"AccountsAndIdentities")},t.prototype.messageList=function(e,t,s,i,r,l){t=o.pString(t);var u=h.getFolderHash(t);l=o.isUnd(l)?!1:!!l,s=o.isUnd(s)?0:o.pInt(s),i=o.isUnd(s)?20:o.pInt(i),r=o.pString(r),""===u||""!==r&&-1!==r.indexOf("is:")?this.defaultRequest(e,"MessageList",{Folder:t,Offset:s,Limit:i,Search:r,UidNext:"INBOX"===t?h.getFolderUidNext(t):"",UseThreads:d.threading()&&d.useThreads()?"1":"0",ExpandedThreadUid:d.threading()&&t===d.messageListThreadFolder()?d.messageListThreadUids().join(","):""},""===r?a.Defaults.DefaultAjaxTimeout:a.Defaults.SearchAjaxTimeout,"",l?[]:["MessageList"]):this.defaultRequest(e,"MessageList",{},""===r?a.Defaults.DefaultAjaxTimeout:a.Defaults.SearchAjaxTimeout,"MessageList/"+n.urlsafe_encode([t,s,i,r,d.projectHash(),u,"INBOX"===t?h.getFolderUidNext(t):"",d.threading()&&d.useThreads()?"1":"0",d.threading()&&t===d.messageListThreadFolder()?d.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),l?[]:["MessageList"])},t.prototype.messageUploadAttachments=function(e,t){this.defaultRequest(e,"MessageUploadAttachments",{Attachments:t},999e3)},t.prototype.message=function(e,t,s){return t=o.pString(t),s=o.pInt(s),h.getFolderFromCacheList(t)&&s>0?(this.defaultRequest(e,"Message",{},null,"Message/"+n.urlsafe_encode([t,s,d.projectHash(),d.threading()&&d.useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},t.prototype.composeUploadExternals=function(e,t){this.defaultRequest(e,"ComposeUploadExternals",{Externals:t},999e3)},t.prototype.composeUploadDrive=function(e,t,s){this.defaultRequest(e,"ComposeUploadDrive",{AccessToken:s,Url:t},999e3)},t.prototype.folderInformation=function(e,t,s){var a=!0,n=[];o.isArray(s)&&0t?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(l.SignedVerifyStatus.None),this.pgpSignedVerifyUser=r.observable(""),this.priority=r.observable(l.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=s(12),o=s(2),a=s(14),r=s(3),n=s(25),l=s(6),h=s(1),d=s(7),u=s(11),c=s(23),p=s(52);t.newInstanceFromJson=function(e){var s=new t;return s.initByJson(e)?s:null},t.calculateFullFromatDateValue=function(e){return e>0?n.unix(e).format("LLL"):""},t.emailsToLine=function(e,t,s){var i=[],o=0,a=0;if(h.isNonEmptyArray(e))for(o=0,a=e.length;a>o;o++)i.push(e[o].toLine(t,s));return i.join(", ")},t.emailsToLineClear=function(e){var t=[],s=0,i=0;if(h.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(", ")},t.initEmailsFromJson=function(e){var t=0,s=0,i=null,o=[];if(h.isNonEmptyArray(e))for(t=0,s=e.length;s>t;t++)i=c.newInstanceFromJson(e[t]),i&&o.push(i);return o},t.replyHelper=function(e,t,s){if(e&&0i;i++)h.isUnd(t[e[i].email])&&(t[e[i].email]=!0,s.push(e[i]))},t.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(l.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(l.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(l.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)},t.prototype.friendlySize=function(){return h.friendlySize(this.size())},t.prototype.computeSenderEmail=function(){var e=s(8),t=e.sentFolder(),i=e.draftFolder();this.senderEmailsString(this.folderFullNameRaw===t||this.folderFullNameRaw===i?this.toEmailsString():this.fromEmailString()),this.senderClearEmailsString(this.folderFullNameRaw===t||this.folderFullNameRaw===i?this.toClearEmailsString():this.fromClearEmailString())},t.prototype.initByJson=function(e){var s=!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(h.pInt(e.Size)),this.from=t.initEmailsFromJson(e.From),this.to=t.initEmailsFromJson(e.To),this.cc=t.initEmailsFromJson(e.Cc),this.bcc=t.initEmailsFromJson(e.Bcc),this.replyTo=t.initEmailsFromJson(e.ReplyTo),this.deliveredTo=t.initEmailsFromJson(e.DeliveredTo),this.subject(e.Subject),h.isArray(e.SubjectParts)?(this.subjectPrefix(e.SubjectParts[0]),this.subjectSuffix(e.SubjectParts[1])):(this.subjectPrefix(""),this.subjectSuffix(this.subject())),this.dateTimeStampInUTC(h.pInt(e.DateTimeStampInUTC)),this.hasAttachments(!!e.HasAttachments),this.attachmentsMainType(e.AttachmentsMainType),this.fromEmailString(t.emailsToLine(this.from,!0)),this.fromClearEmailString(t.emailsToLineClear(this.from)),this.toEmailsString(t.emailsToLine(this.to,!0)),this.toClearEmailsString(t.emailsToLineClear(this.to)),this.parentUid(h.pInt(e.ParentThread)),this.threads(h.isArray(e.Threads)?e.Threads:[]),this.threadsLen(h.pInt(e.ThreadsLen)),this.initFlagsByJson(e),this.computeSenderEmail(),s=!0),s},t.prototype.initUpdateByMessageJson=function(e){var t=s(8),i=!1,o=l.MessagePriority.Normal;return e&&"Object/Message"===e["@Object"]&&(o=h.pInt(e.Priority),this.priority(-1t;t++)i=p.newInstanceFromJson(e["@Collection"][t]),i&&(""!==i.cidWithOutTags&&0 +$/,""),t=o.find(s,function(t){return e===t.cidWithOutTags})),t||null},t.prototype.findAttachmentByContentLocation=function(e){var t=null,s=this.attachments();return h.isNonEmptyArray(s)&&(t=o.find(s,function(t){return e===t.contentLocation})),t||null},t.prototype.messageId=function(){return this.sMessageId},t.prototype.inReplyTo=function(){return this.sInReplyTo},t.prototype.references=function(){return this.sReferences},t.prototype.fromAsSingleEmail=function(){return h.isArray(this.from)&&this.from[0]?this.from[0].email:""},t.prototype.viewLink=function(){return u.messageViewLink(this.requestHash)},t.prototype.downloadLink=function(){return u.messageDownloadLink(this.requestHash)},t.prototype.replyEmails=function(e){var s=[],i=h.isUnd(e)?{}:e;return t.replyHelper(this.replyTo,i,s),0===s.length&&t.replyHelper(this.from,i,s),s},t.prototype.replyAllEmails=function(e){var s=[],i=[],o=h.isUnd(e)?{}:e;return t.replyHelper(this.replyTo,o,s),0===s.length&&t.replyHelper(this.from,o,s),t.replyHelper(this.to,o,s),t.replyHelper(this.cc,o,i),[s,i]},t.prototype.textBodyToString=function(){return this.body?this.body.html():""},t.prototype.attachmentsToStringLine=function(){var e=o.map(this.attachments(),function(e){return e.fileName+" ("+e.friendlySize+")"});return e&&0=0&&i&&!o&&s.attr("src",i)}),e&&i.setTimeout(function(){t.print()},100))})},t.prototype.printMessage=function(){this.viewPopupMessage(!0)},t.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},t.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(l.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},t.prototype.showExternalImages=function(e){if(this.body&&this.body.data("rl-has-images")){var t="";e=h.isUnd(e)?!1:e,this.hasImages(!1),this.body.data("rl-has-images",!1),t=this.proxy?"data-x-additional-src":"data-x-src",a("["+t+"]",this.body).each(function(){e&&a(this).is("img")?a(this).addClass("lazy").attr("data-original",a(this).attr(t)).removeAttr(t):a(this).attr("src",a(this).attr(t)).removeAttr(t)}),t=this.proxy?"data-x-additional-style-url":"data-x-style-url",a("["+t+"]",this.body).each(function(){var e=h.trim(a(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",a(this).attr("style",e+a(this).attr(t)).removeAttr(t)}),e&&(a("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:a(".RL-MailMessageView .messageView .messageItem .content")[0]}),d.$win.resize()),h.windowResize(500)
+}},t.prototype.showInternalImages=function(e){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),e=h.isUnd(e)?!1:e;var t=this;a("[data-x-src-cid]",this.body).each(function(){var s=t.findAttachmentByCid(a(this).attr("data-x-src-cid"));s&&s.download&&(e&&a(this).is("img")?a(this).addClass("lazy").attr("data-original",s.linkPreview()):a(this).attr("src",s.linkPreview()))}),a("[data-x-src-location]",this.body).each(function(){var s=t.findAttachmentByContentLocation(a(this).attr("data-x-src-location"));s||(s=t.findAttachmentByCid(a(this).attr("data-x-src-location"))),s&&s.download&&(e&&a(this).is("img")?a(this).addClass("lazy").attr("data-original",s.linkPreview()):a(this).attr("src",s.linkPreview()))}),a("[data-x-style-cid]",this.body).each(function(){var e="",s="",i=t.findAttachmentByCid(a(this).attr("data-x-style-cid"));i&&i.linkPreview&&(s=a(this).attr("data-x-style-cid-name"),""!==s&&(e=h.trim(a(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",a(this).attr("style",e+s+": url('"+i.linkPreview()+"')")))}),e&&!function(e,t){o.delay(function(){e.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:t})},300)}(a("img.lazy",t.body),a(".RL-MailMessageView .messageView .messageItem .content")[0]),h.windowResize(500)}},t.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=s(8);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()))}},t.prototype.storePgpVerifyDataToDom=function(){var e=s(8);this.body&&e.capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},t.prototype.fetchDataToDom=function(){if(this.body){this.isHtml(!!this.body.data("rl-is-html")),this.hasImages(!!this.body.data("rl-has-images")),this.plainRaw=h.pString(this.body.data("rl-plain-raw"));var e=s(8);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(l.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""))}},t.prototype.verifyPgpSignedClearMessage=function(){if(this.isPgpSigned()){var e=[],t=null,r=s(8),n=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",h=r.findPublicKeysByEmail(n),u=null,c=null,p="";this.pgpSignedVerifyStatus(l.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{t=i.openpgp.cleartext.readArmored(this.plainRaw),t&&t.getText&&(this.pgpSignedVerifyStatus(h.length?l.SignedVerifyStatus.Unverified:l.SignedVerifyStatus.UnknownPublicKeys),e=t.verify(h),e&&0 ').text(p)).html(),d.$div.empty(),this.replacePlaneTextBody(p)))))}catch(g){}this.storePgpVerifyDataToDom()}},t.prototype.decryptPgpEncryptedMessage=function(e){if(this.isPgpEncrypted()){var t=[],r=null,n=null,h=s(8),u=this.from&&this.from[0]&&this.from[0].email?this.from[0].email:"",c=h.findPublicKeysByEmail(u),p=h.findSelfPrivateKey(e),g=null,m=null,f="";this.pgpSignedVerifyStatus(l.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),p||this.pgpSignedVerifyStatus(l.SignedVerifyStatus.UnknownPrivateKey);try{r=i.openpgp.message.readArmored(this.plainRaw),r&&p&&r.decrypt&&(this.pgpSignedVerifyStatus(l.SignedVerifyStatus.Unverified),n=r.decrypt(p),n&&(t=n.verify(c),t&&0').text(f)).html(),d.$div.empty(),this.replacePlaneTextBody(f)))}catch(y){}this.storePgpVerifyDataToDom()}},t.prototype.replacePlaneTextBody=function(e){this.body&&this.body.html(e).addClass("b-text-part plain")},t.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},e.exports=t}()},49:function(e){!function(){"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,a,r,n,l,h="",d=0;for(e=t._utf8_encode(e);d>2,r=(3&s)<<4|i>>4,n=(15&i)<<2|o>>6,l=63&o,isNaN(i)?n=l=64:isNaN(o)&&(l=64),h=h+this._keyStr.charAt(a)+this._keyStr.charAt(r)+this._keyStr.charAt(n)+this._keyStr.charAt(l);return h},decode:function(e){var s,i,o,a,r,n,l,h="",d=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");d>4,i=(15&r)<<4|n>>2,o=(3&n)<<6|l,h+=String.fromCharCode(s),64!==n&&(h+=String.fromCharCode(i)),64!==l&&(h+=String.fromCharCode(o));return t._utf8_decode(h)},_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,a=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),a=e.charCodeAt(s+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a),s+=3);return t}};e.exports=t}()},51:function(e,t,s){!function(){"use strict";function t(e,t){this.email=e,this.deleteAccess=i.observable(!1),this.canBeDalete=i.observable(o.isUnd(t)?!0:!!t)}var i=s(3),o=s(1);t.prototype.email="",t.prototype.changeAccountLink=function(){return s(11).change(this.email)},e.exports=t}()},52:function(e,t,s){!function(){"use strict";function t(){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=s(12),o=s(7),a=s(1),r=s(11);t.newInstanceFromJson=function(e){var s=new t;return s.initByJson(e)?s:null},t.prototype.mimeType="",t.prototype.fileName="",t.prototype.estimatedSize=0,t.prototype.friendlySize="",t.prototype.isInline=!1,t.prototype.isLinked=!1,t.prototype.cid="",t.prototype.cidWithOutTags="",t.prototype.contentLocation="",t.prototype.download="",t.prototype.folder="",t.prototype.uid="",t.prototype.mimeIndex="",t.prototype.initByJson=function(e){var t=!1;return e&&"Object/Attachment"===e["@Object"]&&(this.mimeType=(e.MimeType||"").toLowerCase(),this.fileName=e.FileName,this.estimatedSize=a.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=a.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,""),t=!0),t},t.prototype.isImage=function(){return-10){if(a.FolderType.Draft===s)return""+e;if(t>0&&a.FolderType.Trash!==s&&a.FolderType.Archive!==s&&a.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.localName=o.computed(function(){r.langChangeTrigger();var e=this.type(),t=this.name();if(this.isSystemFolder())switch(e){case a.FolderType.Inbox:t=n.i18n("FOLDER_LIST/INBOX_NAME");break;case a.FolderType.SentItems:t=n.i18n("FOLDER_LIST/SENT_NAME");break;case a.FolderType.Draft:t=n.i18n("FOLDER_LIST/DRAFTS_NAME");break;case a.FolderType.Spam:t=n.i18n("FOLDER_LIST/SPAM_NAME");break;case a.FolderType.Trash:t=n.i18n("FOLDER_LIST/TRASH_NAME");break;case a.FolderType.Archive:t=n.i18n("FOLDER_LIST/ARCHIVE_NAME")}return t},this),this.manageFolderSystemName=o.computed(function(){r.langChangeTrigger();var e="",t=this.type(),s=this.name();if(this.isSystemFolder())switch(t){case a.FolderType.Inbox:e="("+n.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case a.FolderType.SentItems:e="("+n.i18n("FOLDER_LIST/SENT_NAME")+")";break;case a.FolderType.Draft:e="("+n.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case a.FolderType.Spam:e="("+n.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case a.FolderType.Trash:e="("+n.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case a.FolderType.Archive:e="("+n.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"},t.prototype.formattedNameForCompose=function(){var e=this.name();return""===e?this.email():e+" ("+this.email()+")"},t.prototype.formattedNameForEmail=function(){var e=this.name();return""===e?this.email():'"'+o.quoteName(e)+'" <'+this.email()+">"},e.exports=t}()},60:function(e,t,s){!function(){"use strict";function t(e,t,s,o,a,r,n){this.index=e,this.id=s,this.guid=t,this.user=o,this.email=a,this.armor=n,this.isPrivate=!!r,this.deleteAccess=i.observable(!1)}var i=s(3);t.prototype.index=0,t.prototype.id="",t.prototype.guid="",t.prototype.user="",t.prototype.email="",t.prototype.armor="",t.prototype.isPrivate=!1,e.exports=t}()},64:function(e,t,s){!function(){"use strict";function t(){o.call(this,"login",[s(96)])}var i=s(2),o=s(24);i.extend(t.prototype,o.prototype),t.prototype.onShow=function(){s(4).setTitle("")},e.exports=t}()},90:function(e,t,s){!function(){"use strict";function t(){}var i=s(14),o=s(33),a=s(17),r=s(1);t.supported=function(){return!(!window.navigator||!window.navigator.cookieEnabled)},t.prototype.set=function(e,t){var s=i.cookie(a.Values.ClientSideStorageIndexName),r=!1,n=null;try{n=null===s?null:o.parse(s)}catch(l){}n||(n={}),n[e]=t;try{i.cookie(a.Values.ClientSideStorageIndexName,o.stringify(n),{expires:30}),r=!0}catch(l){}return r},t.prototype.get=function(e){var t=i.cookie(a.Values.ClientSideStorageIndexName),s=null;try{s=null===t?null:o.parse(t),s=s&&!r.isUnd(s[e])?s[e]:null}catch(n){}return s},e.exports=t}()},91:function(e,t,s){!function(){"use strict";function t(){}var i=s(12),o=s(33),a=s(17),r=s(1);t.supported=function(){return!!i.localStorage},t.prototype.set=function(e,t){var s=i.localStorage[a.Values.ClientSideStorageIndexName]||null,r=!1,n=null;try{n=null===s?null:o.parse(s)}catch(l){}n||(n={}),n[e]=t;try{i.localStorage[a.Values.ClientSideStorageIndexName]=o.stringify(n),r=!0}catch(l){}return r},t.prototype.get=function(e){var t=i.localStorage[a.Values.ClientSideStorageIndexName]||null,s=null;try{s=null===t?null:o.parse(t),s=s&&!r.isUnd(s[e])?s[e]:null}catch(n){}return s},e.exports=t}()},96:function(e,t,s){!function(){"use strict";function t(){g.call(this,"Center","Login"),this.email=r.observable(""),this.password=r.observable(""),this.signMe=r.observable(!1),this.additionalCode=r.observable(""),this.additionalCode.error=r.observable(!1),this.additionalCode.focused=r.observable(!1),this.additionalCode.visibility=r.observable(!1),this.additionalCodeSignMe=r.observable(!1),this.logoImg=l.trim(d.settingsGet("LoginLogo")),this.loginDescription=l.trim(d.settingsGet("LoginDescription")),this.logoCss=l.trim(d.settingsGet("LoginCss")),this.emailError=r.observable(!1),this.passwordError=r.observable(!1),this.emailFocus=r.observable(!1),this.submitFocus=r.observable(!1),this.email.subscribe(function(){this.emailError(!1),this.additionalCode(""),this.additionalCode.visibility(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.additionalCode.subscribe(function(){this.additionalCode.error(!1)},this),this.additionalCode.visibility.subscribe(function(){this.additionalCode.error(!1)},this),this.submitRequest=r.observable(!1),this.submitError=r.observable(""),this.allowLanguagesOnLogin=u.allowLanguagesOnLogin,this.langRequest=r.observable(!1),this.mainLanguage=u.mainLanguage,this.bSendLanguage=!1,this.mainLanguageFullName=r.computed(function(){return l.convertLangName(this.mainLanguage())},this),this.signMeType=r.observable(n.LoginSignMeType.Unused),this.signMeType.subscribe(function(e){this.signMe(n.LoginSignMeType.DefaultOn===e)},this),this.signMeVisibility=r.computed(function(){return n.LoginSignMeType.Unused!==this.signMeType()},this),this.submitCommand=l.createCommand(this,function(){if(l.triggerAutocompleteInputChange(),this.emailError(""===l.trim(this.email())),this.passwordError(""===l.trim(this.password())),this.additionalCode.visibility()&&this.additionalCode.error(""===l.trim(this.additionalCode())),this.emailError()||this.passwordError()||this.additionalCode.error())return!1;this.submitRequest(!0);var e=this.password(),t=o.bind(function(e){c.login(o.bind(function(e,t){n.StorageResultType.Success===e&&t&&"Login"===t.Action?t.Result?t.TwoFactorAuth?(this.additionalCode(""),this.additionalCode.visibility(!0),this.additionalCode.focused(!0),this.submitRequest(!1)):s(4).loginAndLogoutReload():t.ErrorCode?(this.submitRequest(!1),this.submitError(l.getNotification(t.ErrorCode)),""===this.submitError()&&this.submitError(l.getNotification(n.Notification.UnknownError))):this.submitRequest(!1):(this.submitRequest(!1),this.submitError(l.getNotification(n.Notification.UnknownError)))},this),this.email(),"",e,!!this.signMe(),this.bSendLanguage?this.mainLanguage():"",this.additionalCode.visibility()?this.additionalCode():"",this.additionalCode.visibility()?!!this.additionalCodeSignMe():!1)},this);return d.settingsGet("UseRsaEncryption")&&l.rsaEncode.supported?c.getPublicKey(o.bind(function(s,i){var o=!1;if(n.StorageResultType.Success===s&&i&&i.Result&&l.isArray(i.Result)&&i.Result[0]&&i.Result[1]&&i.Result[2]){var a=l.rsaEncode(e,i.Result[0],i.Result[1],i.Result[2]);a&&(t(a),o=!0)}o||(this.submitRequest(!1),this.submitError(l.getNotification(n.Notification.UnknownError)))},this)):t(e),!0},function(){return!this.submitRequest()}),this.facebookLoginEnabled=r.observable(!1),this.facebookCommand=l.createCommand(this,function(){return i.open(h.socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes"),!0},function(){return!this.submitRequest()&&this.facebookLoginEnabled()}),this.googleLoginEnabled=r.observable(!1),this.googleCommand=l.createCommand(this,function(){return i.open(h.socialGoogle(),"Google","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes"),!0},function(){return!this.submitRequest()&&this.googleLoginEnabled()}),this.twitterLoginEnabled=r.observable(!1),this.twitterCommand=l.createCommand(this,function(){return i.open(h.socialTwitter(),"Twitter","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes"),!0},function(){return!this.submitRequest()&&this.twitterLoginEnabled()}),this.socialLoginEnabled=r.computed(function(){var e=this.facebookLoginEnabled(),t=this.googleLoginEnabled(),s=this.twitterLoginEnabled();return e||t||s},this),p.constructorEnd(this)}var i=s(12),o=s(2),a=s(14),r=s(3),n=s(6),l=s(1),h=s(11),d=s(10),u=s(8),c=s(13),p=s(5),g=s(9);p.extendAsViewModel(["View:RainLoop:Login","LoginViewModel"],t),o.extend(t.prototype,g.prototype),t.prototype.onShow=function(){p.routeOff(),o.delay(o.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0),d.settingsGet("UserLanguage")&&a.cookie("rllang",u.language(),{expires:30})},this),100)},t.prototype.onHide=function(){this.submitFocus(!1),this.emailFocus(!1)},t.prototype.onBuild=function(){var e=this,t=d.settingsGet("JsHash"),r=function(t){t=l.pInt(t),0===t?(e.submitRequest(!0),s(4).loginAndLogoutReload()):e.submitError(l.getNotification(t))};switch(this.facebookLoginEnabled(!!d.settingsGet("AllowFacebookSocial")),this.twitterLoginEnabled(!!d.settingsGet("AllowTwitterSocial")),this.googleLoginEnabled(!!d.settingsGet("AllowGoogleSocial")),(d.settingsGet("SignMe")||"unused").toLowerCase()){case n.LoginSignMeTypeAsString.DefaultOff:this.signMeType(n.LoginSignMeType.DefaultOff);break;case n.LoginSignMeTypeAsString.DefaultOn:this.signMeType(n.LoginSignMeType.DefaultOn);break;default:case n.LoginSignMeTypeAsString.Unused:this.signMeType(n.LoginSignMeType.Unused)}this.email(u.devEmail),this.password(u.devPassword),this.googleLoginEnabled()&&(i["rl_"+t+"_google_login_service"]=r),this.facebookLoginEnabled()&&(i["rl_"+t+"_facebook_login_service"]=r),this.twitterLoginEnabled()&&(i["rl_"+t+"_twitter_login_service"]=r),o.delay(function(){u.language.subscribe(function(t){e.langRequest(!0),a.ajax({url:h.langLink(t),dataType:"script",cache:!0}).done(function(){e.bSendLanguage=!0,l.i18nReload(),a.cookie("rllang",u.language(),{expires:30})}).always(function(){e.langRequest(!1)})})},50),l.triggerAutocompleteInputChange(!0)},t.prototype.submitForm=function(){this.submitCommand()},t.prototype.selectLanguage=function(){p.showScreenPopup(s(32))},e.exports=t}()}});
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/boot.js b/rainloop/v/0.0.0/static/js/min/boot.js
similarity index 99%
rename from rainloop/v/0.0.0/static/js/boot.js
rename to rainloop/v/0.0.0/static/js/min/boot.js
index c68906534..f3d04ffd7 100644
--- a/rainloop/v/0.0.0/static/js/boot.js
+++ b/rainloop/v/0.0.0/static/js/min/boot.js
@@ -1,8 +1,8 @@
-/*! See http://www.JSON.org/js.html */
-var JSON;JSON||(JSON={}),function(){function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c0){for(var a=0;a=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
+(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b0){for(var a=0;a=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
/*! RainLoop Simple Pace v1.0 (c) 2013 RainLoop Team; Licensed under MIT */
-!function(e){function s(){var s=this;s.el=null,s.done=!1,s.progress=0,s.addInterval=0,s.addSpeed=3,s.stopProgress=100,s.interval=e.setInterval(function(){var t=s.build();t&&e.clearInterval(s.interval)},100)}if(s.prototype.startAddInterval=function(){var s=this;s.stopAddInterval(),s.addInterval=e.setInterval(function(){0s.progress&&s.add(s.addSpeed)},500)},s.prototype.stopAddInterval=function(){e.clearInterval(this.addInterval),this.addInterval=0},s.prototype.build=function(){if(null===this.el){var e=document.querySelector("body");e&&(this.el=document.createElement("div"),this.el.className="simple-pace simple-pace-active",this.el.innerHTML='',e.firstChild?e.insertBefore(this.el,e.firstChild):e.appendChild(this.el))}return this.el},s.prototype.reset=function(){return this.progress=0,this.render()},s.prototype.update=function(s){var t=e.parseInt(s,10);return t>this.progress&&(this.progress=t,this.progress=100this.progress?0:this.progress),this.render()},s.prototype.add=function(s){return this.progress+=e.parseInt(s,10),this.progress=100this.progress?0:this.progress,this.render()},s.prototype.setSpeed=function(e,s){this.addSpeed=e,this.stopProgress=s||100},s.prototype.render=function(){var s=this.build();s&&s.children&&s.children[0]&&s.children[0].setAttribute("style","width:"+this.progress+"%"),100!==this.progress||this.done?100>this.progress&&this.done?(this.done=!1,this.startAddInterval(),s.className=s.className.replace("simple-pace-inactive",""),s.className+=" simple-pace-inactive"):100>this.progress&&!this.done&&0===this.addInterval&&this.startAddInterval():(this.done=!0,this.stopAddInterval(),e.setTimeout(function(){s.className=s.className.replace("simple-pace-active",""),s.className+=" simple-pace-inactive"},500))},!e.SimplePace){var t=new s;e.SimplePace={sleep:function(){t.setSpeed(2,95)},set:function(e){t.update(e)},add:function(e){t.add(e)}}}}(window);
+!function(e){function s(){var s=this;s.el=null,s.done=!1,s.progress=0,s.addInterval=0,s.addSpeed=3,s.stopProgress=100,s.interval=e.setInterval(function(){var t=s.build();t&&e.clearInterval(s.interval)},100)}if(s.prototype.startAddInterval=function(){var s=this;s.stopAddInterval(),s.addInterval=e.setInterval(function(){0s.progress&&s.add(s.addSpeed)},500)},s.prototype.stopAddInterval=function(){e.clearInterval(this.addInterval),this.addInterval=0},s.prototype.build=function(){if(null===this.el){var e=document.querySelector("body");e&&(this.el=document.createElement("div"),this.el.className="simple-pace simple-pace-active",this.el.innerHTML='',e.firstChild?e.insertBefore(this.el,e.firstChild):e.appendChild(this.el))}return this.el},s.prototype.reset=function(){return this.progress=0,this.render()},s.prototype.update=function(s){var t=e.parseInt(s,10);return t>this.progress&&(this.progress=t,this.progress=100this.progress?0:this.progress),this.render()},s.prototype.add=function(s){return this.progress+=e.parseInt(s,10),this.progress=100this.progress?0:this.progress,this.render()},s.prototype.setSpeed=function(e,s){this.addSpeed=e,this.stopProgress=s||100},s.prototype.render=function(){var s=this.build();s&&s.children&&s.children[0]&&s.children[0].setAttribute("style","width:"+this.progress+"%"),100!==this.progress||this.done?100>this.progress&&this.done?(this.done=!1,this.startAddInterval(),s.className=s.className.replace("simple-pace-inactive",""),s.className+=" simple-pace-inactive"):100>this.progress&&!this.done&&0===this.addInterval&&this.startAddInterval():(this.done=!0,this.stopAddInterval(),e.setTimeout(function(){s.className=s.className.replace("simple-pace-active",""),s.className+=" simple-pace-inactive"},500))},!e.SimplePace){var t=new s;e.SimplePace={sleep:function(){t.setSpeed(2,95)},set:function(e){t.update(e)},add:function(e){t.add(e)}}}}(window);
/*! RainLoop Index Helper v1.2 (c) 2014 RainLoop Team; Licensed under MIT */
!function(t,n,e){function s(){}s.prototype.s=t.sessionStorage,s.prototype.t=t.top||t,s.prototype.getHash=function(){var t=null;if(this.s)t=this.s.getItem("__rlA")||null;else if(this.t){var n=this.t.name&&e&&"{"===this.t.name.toString().substr(0,1)?e.parse(this.t.name.toString()):null;t=n?n.__rlA||null:null}return t},s.prototype.setHash=function(){var n=t.rainloopAppData,s=null;this.s?this.s.setItem("__rlA",n&&n.AuthAccountHash?n.AuthAccountHash:""):this.t&&e&&(s={},s.__rlA=n&&n.AuthAccountHash?n.AuthAccountHash:"",this.t.name=e.stringify(s))},s.prototype.clearHash=function(){this.s?this.s.setItem("__rlA",""):this.t&&(this.t.name="")},t._rlhh=new s,t.__rlah=function(){return t._rlhh?t._rlhh.getHash():null},t.__rlah_set=function(){t._rlhh&&t._rlhh.setHash()},t.__rlah_clear=function(){t._rlhh&&t._rlhh.clearHash()},t.__includeScr=function(t){n.write(unescape('%3Cscript data-cfasync="false" type="text/javascript" src="'+t+'"%3E%3C/script%3E'))},t.__showError=function(){var e=n.getElementById("rl-loading"),s=n.getElementById("rl-loading-error");e&&(e.style.display="none"),s&&(s.style.display="block"),t.SimplePace&&t.SimplePace.set(100)},t.__simplePace=function(n){t.SimplePace&&t.SimplePace.add(n)},t.__runBoot=function(n){t.__APP_BOOT&&!n?t.__APP_BOOT(function(t){t||__showError()}):__showError()}}(window,window.document,window.JSON);
\ No newline at end of file
diff --git a/rainloop/v/0.0.0/static/js/min/common.js b/rainloop/v/0.0.0/static/js/min/common.js
new file mode 100644
index 000000000..d37c1d8fa
--- /dev/null
+++ b/rainloop/v/0.0.0/static/js/min/common.js
@@ -0,0 +1,4 @@
+/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
+!function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(a,s){for(var r,l,c=0,u=[];ca;a++)o=n[a].split("="),t[i.decodeURIComponent(o[0])]=i.decodeURIComponent(o[1]);return t},t.mailToHelper=function(e,o){if(e&&"mailto:"===e.toString().substr(0,7).toLowerCase()){e=e.toString().substr(7);var a={},s=null,l=e.replace(/\?.+$/,""),c=e.replace(/^[^\?]*\?/,""),u=n(23);return s=new u,s.parse(i.decodeURIComponent(l)),s&&s.email&&(a=t.simpleQueryParser(c),n(5).showScreenPopup(o,[r.ComposeType.Empty,null,[s],t.isUnd(a.subject)?null:t.pString(a.subject),t.isUnd(a.body)?null:t.plainToHtml(t.pString(a.body))])),!0}return!1},t.rsaEncode=function(e,n,o,a){if(i.crypto&&i.crypto.getRandomValues&&i.RSAKey&&n&&o&&a){var s=new i.RSAKey;if(s.setPublic(a,o),e=s.encrypt(t.fakeMd5()+":"+e+":"+t.fakeMd5()),!1!==e)return"rsa:"+n+":"+e}return!1},t.rsaEncode.supported=!!(i.crypto&&i.crypto.getRandomValues&&i.RSAKey),t.exportPath=function(e,n,o){for(var a=null,s=e.split("."),r=o||i;s.length&&(a=s.shift());)s.length||t.isUnd(n)?r=r[a]?r[a]:r[a]={}:r[a]=n},t.pImport=function(e,t,n){e[t]=n},t.pExport=function(e,n,i){return t.isUnd(e[n])?i:e[n]},t.encodeHtml=function(e){return t.isNormal(e)?e.toString().replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):""},t.splitPlainText=function(e,n){var i="",o="",a=e,s=0,r=0;for(n=t.isUnd(n)?100:n;a.length>n;)o=a.substring(0,n),s=o.lastIndexOf(" "),r=o.lastIndexOf("\n"),-1!==r&&(s=r),-1===s&&(s=n),i+=o.substring(0,s)+"\n",a=a.substring(s+1);return i+a},t.timeOutAction=function(){var e={};return function(n,o,a){t.isUnd(e[n])&&(e[n]=0),i.clearTimeout(e[n]),e[n]=i.setTimeout(o,a)}}(),t.timeOutActionSecond=function(){var e={};return function(t,n,o){e[t]||(e[t]=i.setTimeout(function(){n(),e[t]=0},o))}}(),t.audio=function(){var e=!1;return function(t,n){if(!1===e)if(c.bIsiOSDevice)e=null;else{var o=!1,a=!1,s=i.Audio?new i.Audio:null;s&&s.canPlayType&&s.play?(o=""!==s.canPlayType('audio/mpeg; codecs="mp3"'),o||(a=""!==s.canPlayType('audio/ogg; codecs="vorbis"')),o||a?(e=s,e.preload="none",e.loop=!1,e.autoplay=!1,e.muted=!1,e.src=o?t:n):e=null):e=null}return e}}(),t.hos=function(e,t){return e&&i.Object&&i.Object.hasOwnProperty?i.Object.hasOwnProperty.call(e,t):!1},t.i18n=function(e,n,i){var o="",a=t.isUnd(c.oI18N[e])?t.isUnd(i)?e:i:c.oI18N[e];if(!t.isUnd(n)&&!t.isNull(n))for(o in n)t.hos(n,o)&&(a=a.replace("%"+o+"%",n[o]));return a},t.i18nToNode=function(e){o.defer(function(){a(".i18n",e).each(function(){var e=a(this),n="";n=e.data("i18n-text"),n?e.text(t.i18n(n)):(n=e.data("i18n-html"),n&&e.html(t.i18n(n)),n=e.data("i18n-placeholder"),n&&e.attr("placeholder",t.i18n(n)),n=e.data("i18n-title"),n&&e.attr("title",t.i18n(n)))})})},t.i18nReload=function(){i.rainloopI18N&&(c.oI18N=i.rainloopI18N||{},t.i18nToNode(c.$doc),c.langChangeTrigger(!c.langChangeTrigger())),i.rainloopI18N=null},t.initOnStartOrLangChange=function(e,t,n){e&&e.call(t),n?c.langChangeTrigger.subscribe(function(){e&&e.call(t),n.call(t)}):e&&c.langChangeTrigger.subscribe(e,t)},t.inFocus=function(){return i.document.activeElement?(t.isUnd(i.document.activeElement.__inFocusCache)&&(i.document.activeElement.__inFocusCache=a(i.document.activeElement).is("input,textarea,iframe,.cke_editable")),!!i.document.activeElement.__inFocusCache):!1},t.removeInFocus=function(){if(i.document&&i.document.activeElement&&i.document.activeElement.blur){var e=a(i.document.activeElement);e.is("input,textarea")&&i.document.activeElement.blur()}},t.removeSelection=function(){if(i&&i.getSelection){var e=i.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}else i.document&&i.document.selection&&i.document.selection.empty&&i.document.selection.empty()},t.replySubjectAdd=function(e,n){e=t.trim(e.toUpperCase()),n=t.trim(n.replace(/[\s]+/g," "));var i=!1,a=[],s="RE"===e,r="FWD"===e,l=!r;return""!==n&&o.each(n.split(":"),function(e){var n=t.trim(e);i||!/^(RE|FWD)$/i.test(n)&&!/^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(n)?(a.push(e),i=!0):(s||(s=!!/^RE/i.test(n)),r||(r=!!/^FWD/i.test(n)))}),l?s=!1:r=!1,t.trim((l?"Re: ":"Fwd: ")+(s?"Re: ":"")+(r?"Fwd: ":"")+t.trim(a.join(":")))},t.roundNumber=function(e,t){return i.Math.round(e*i.Math.pow(10,t))/i.Math.pow(10,t)},t.friendlySize=function(e){return e=t.pInt(e),e>=1073741824?t.roundNumber(e/1073741824,1)+"GB":e>=1048576?t.roundNumber(e/1048576,1)+"MB":e>=1024?t.roundNumber(e/1024,0)+"KB":e+"B"},t.log=function(e){i.console&&i.console.log&&i.console.log(e)},t.getNotification=function(e,n){return e=t.pInt(e),r.Notification.ClientViewError===e&&n?n:t.isUnd(c.oNotificationI18N[e])?"":c.oNotificationI18N[e]},t.initNotificationLanguage=function(){var e=c.oNotificationI18N||{};e[r.Notification.InvalidToken]=t.i18n("NOTIFICATIONS/INVALID_TOKEN"),e[r.Notification.AuthError]=t.i18n("NOTIFICATIONS/AUTH_ERROR"),e[r.Notification.AccessError]=t.i18n("NOTIFICATIONS/ACCESS_ERROR"),e[r.Notification.ConnectionError]=t.i18n("NOTIFICATIONS/CONNECTION_ERROR"),e[r.Notification.CaptchaError]=t.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),e[r.Notification.SocialFacebookLoginAccessDisable]=t.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),e[r.Notification.SocialTwitterLoginAccessDisable]=t.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),e[r.Notification.SocialGoogleLoginAccessDisable]=t.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),e[r.Notification.DomainNotAllowed]=t.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),e[r.Notification.AccountNotAllowed]=t.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),e[r.Notification.AccountTwoFactorAuthRequired]=t.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),e[r.Notification.AccountTwoFactorAuthError]=t.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),e[r.Notification.CouldNotSaveNewPassword]=t.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),e[r.Notification.CurrentPasswordIncorrect]=t.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),e[r.Notification.NewPasswordShort]=t.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),e[r.Notification.NewPasswordWeak]=t.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),e[r.Notification.NewPasswordForbidden]=t.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),e[r.Notification.ContactsSyncError]=t.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),e[r.Notification.CantGetMessageList]=t.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),e[r.Notification.CantGetMessage]=t.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),e[r.Notification.CantDeleteMessage]=t.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),e[r.Notification.CantMoveMessage]=t.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[r.Notification.CantCopyMessage]=t.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),e[r.Notification.CantSaveMessage]=t.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),e[r.Notification.CantSendMessage]=t.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),e[r.Notification.InvalidRecipients]=t.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),e[r.Notification.CantCreateFolder]=t.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),e[r.Notification.CantRenameFolder]=t.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),e[r.Notification.CantDeleteFolder]=t.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),e[r.Notification.CantDeleteNonEmptyFolder]=t.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),e[r.Notification.CantSubscribeFolder]=t.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),e[r.Notification.CantUnsubscribeFolder]=t.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),e[r.Notification.CantSaveSettings]=t.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),e[r.Notification.CantSavePluginSettings]=t.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),e[r.Notification.DomainAlreadyExists]=t.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),e[r.Notification.CantInstallPackage]=t.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),e[r.Notification.CantDeletePackage]=t.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),e[r.Notification.InvalidPluginPackage]=t.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),e[r.Notification.UnsupportedPluginPackage]=t.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),e[r.Notification.LicensingServerIsUnavailable]=t.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),e[r.Notification.LicensingExpired]=t.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),e[r.Notification.LicensingBanned]=t.i18n("NOTIFICATIONS/LICENSING_BANNED"),e[r.Notification.DemoSendMessageError]=t.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),e[r.Notification.AccountAlreadyExists]=t.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),e[r.Notification.MailServerError]=t.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),e[r.Notification.InvalidInputArgument]=t.i18n("NOTIFICATIONS/INVALID_INPUT_ARGUMENT"),e[r.Notification.UnknownNotification]=t.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),e[r.Notification.UnknownError]=t.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},t.getUploadErrorDescByCode=function(e){var n="";switch(t.pInt(e)){case r.UploadErrorCode.FileIsTooBig:n=t.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case r.UploadErrorCode.FilePartiallyUploaded:n=t.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case r.UploadErrorCode.FileNoUploaded:n=t.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case r.UploadErrorCode.MissingTempFolder:n=t.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case r.UploadErrorCode.FileOnSaveingError:n=t.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case r.UploadErrorCode.FileType:n=t.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:n=t.i18n("UPLOAD/ERROR_UNKNOWN")}return n},t.delegateRun=function(e,n,i,a){e&&e[n]&&(a=t.pInt(a),0>=a?e[n].apply(e,t.isArray(i)?i:[]):o.delay(function(){e[n].apply(e,t.isArray(i)?i:[])},a))},t.killCtrlAandS=function(e){if(e=e||i.event,e&&e.ctrlKey&&!e.shiftKey&&!e.altKey){var t=e.target||e.srcElement,n=e.keyCode||e.which;if(n===r.EventKeyCode.S)return void e.preventDefault();if(t&&t.tagName&&t.tagName.match(/INPUT|TEXTAREA/i))return;n===r.EventKeyCode.A&&(i.getSelection?i.getSelection().removeAllRanges():i.document.selection&&i.document.selection.clear&&i.document.selection.clear(),e.preventDefault())}},t.createCommand=function(e,n,i){var o=n?function(){return o&&o.canExecute&&o.canExecute()&&n.apply(e,Array.prototype.slice.call(arguments)),!1}:function(){};return o.enabled=s.observable(!0),i=t.isUnd(i)?!0:i,o.canExecute=s.computed(t.isFunc(i)?function(){return o.enabled()&&i.call(e)}:function(){return o.enabled()&&!!i}),o},t.initDataConstructorBySettings=function(e){e.editorDefaultType=s.observable(r.EditorDefaultType.Html),e.showImages=s.observable(!1),e.interfaceAnimation=s.observable(r.InterfaceAnimation.Full),e.contactsAutosave=s.observable(!1),c.sAnimationType=r.InterfaceAnimation.Full,e.capaThemes=s.observable(!1),e.allowLanguagesOnSettings=s.observable(!0),e.allowLanguagesOnLogin=s.observable(!0),e.useLocalProxyForExternalImages=s.observable(!1),e.desktopNotifications=s.observable(!1),e.useThreads=s.observable(!0),e.replySameFolder=s.observable(!0),e.useCheckboxesInList=s.observable(!0),e.layout=s.observable(r.Layout.SidePreview),e.usePreviewPane=s.computed(function(){return r.Layout.NoPreview!==e.layout()}),e.interfaceAnimation.subscribe(function(e){if(c.bMobileDevice||e===r.InterfaceAnimation.None)c.$html.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),c.sAnimationType=r.InterfaceAnimation.None;else switch(e){case r.InterfaceAnimation.Full:c.$html.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),c.sAnimationType=e;break;case r.InterfaceAnimation.Normal:c.$html.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),c.sAnimationType=e}}),e.interfaceAnimation.valueHasMutated(),e.desktopNotificationsPermisions=s.computed(function(){e.desktopNotifications();var n=t.notificationClass(),o=r.DesktopNotifications.NotSupported;if(n&&n.permission)switch(n.permission.toLowerCase()){case"granted":o=r.DesktopNotifications.Allowed;break;case"denied":o=r.DesktopNotifications.Denied;break;case"default":o=r.DesktopNotifications.NotAllowed}else i.webkitNotifications&&i.webkitNotifications.checkPermission&&(o=i.webkitNotifications.checkPermission());return o}),e.useDesktopNotifications=s.computed({read:function(){return e.desktopNotifications()&&r.DesktopNotifications.Allowed===e.desktopNotificationsPermisions()},write:function(n){if(n){var i=t.notificationClass(),o=e.desktopNotificationsPermisions();i&&r.DesktopNotifications.Allowed===o?e.desktopNotifications(!0):i&&r.DesktopNotifications.NotAllowed===o?i.requestPermission(function(){e.desktopNotifications.valueHasMutated(),r.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=s.observable(""),e.languages=s.observableArray([]),e.mainLanguage=s.computed({read:e.language,write:function(n){n!==e.language()?-1=n.diff(i,"hours")?o:n.format("L")===i.format("L")?t.i18n("MESSAGE_LIST/TODAY_AT",{TIME:i.format("LT")}):n.clone().subtract("days",1).format("L")===i.format("L")?t.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:i.format("LT")}):i.format(n.year()===i.year()?"D MMM.":"LL")},e)},t.convertThemeName=function(e){return"@custom"===e.substr(-7)&&(e=t.trim(e.substring(0,e.length-7))),t.trim(e.replace(/[^a-zA-Z0-9]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},t.quoteName=function(e){return e.replace(/["]/g,'\\"')},t.microtime=function(){return(new Date).getTime()},t.convertLangName=function(e,n){return t.i18n("LANGS_NAMES"+(!0===n?"_EN":"")+"/LANG_"+e.toUpperCase().replace(/[^a-zA-Z0-9]+/g,"_"),null,e)},t.fakeMd5=function(e){var n="",o="0123456789abcdefghijklmnopqrstuvwxyz";for(e=t.isUnd(e)?32:t.pInt(e);n.length /g,">").replace(/")},t.draggeblePlace=function(){return a(' ').appendTo("#rl-hidden")},t.defautOptionsAfterRender=function(e,n){n&&!t.isUnd(n.disabled)&&e&&a(e).toggleClass("disabled",n.disabled).prop("disabled",n.disabled)},t.windowPopupKnockout=function(e,n,o,r){var l=null,c=i.open(""),u="__OpenerApplyBindingsUid"+t.fakeMd5()+"__",p=a("#"+n);i[u]=function(){if(c&&c.document.body&&p&&p[0]){var n=a(c.document.body);a("#rl-content",n).html(p.html()),a("html",c.document).addClass("external "+a("html").attr("class")),t.i18nToNode(n),e&&a("#rl-content",n)[0]&&s.applyBindings(e,a("#rl-content",n)[0]),i[u]=null,r(c)}},c.document.open(),c.document.write(''+t.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)},t.settingsSaveHelperFunction=function(e,n,i,a){return i=i||null,a=t.isUnd(a)?1e3:t.pInt(a),function(t,s,l,c,u){n.call(i,s&&s.Result?r.SaveSettingsStep.TrueResult:r.SaveSettingsStep.FalseResult),e&&e.call(i,t,s,l,c,u),o.delay(function(){n.call(i,r.SaveSettingsStep.Idle)},a)}},t.settingsSaveHelperSimpleFunction=function(e,n){return t.settingsSaveHelperFunction(null,e,n,1e3)},t.htmlToPlain=function(e){var t=0,n=0,i=0,o=0,s=0,r="",l=function(e){for(var t=100,n="",i="",o=e,a=0,s=0;o.length>t;)i=o.substring(0,t),a=i.lastIndexOf(" "),s=i.lastIndexOf("\n"),-1!==s&&(a=s),-1===a&&(a=t),n+=i.substring(0,a)+"\n",o=o.substring(a+1);return n+o},u=function(e){return e=l(a.trim(e)),e="> "+e.replace(/\n/gm,"\n> "),e.replace(/(^|\n)([> ]+)/gm,function(){return arguments&&2]*>([\s\S\r\n]*)<\/div>/gim,p),e="\n"+a.trim(e)+"\n"),e}return""},d=function(){return arguments&&1 "):""},m=function(){return arguments&&1 /g,">"):""},f=function(){return arguments&&1]*>([\s\S\r\n]*)<\/pre>/gim,d).replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,m).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,p).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S\r\n]*?)<\/a>/gim,f).replace(/<\/div>/gi,"\n").replace(/ /gi," ").replace(/"/gi,'"').replace(/<[^>]*>/gm,""),r=c.$div.html(r).text(),r=r.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&"),t=0,s=100;s>0&&(s--,n=r.indexOf("__bq__start__",t),n>-1);)i=r.indexOf("__bq__start__",n+5),o=r.indexOf("__bq__end__",n+5),(-1===i||i>o)&&o>n?(r=r.substring(0,n)+u(r.substring(n+13,o))+r.substring(o+11),t=0):t=i>-1&&o>i?i-1:0;return r=r.replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},t.plainToHtml=function(e,n){e=e.toString().replace(/\r/g,"");var i=!1,o=!0,a=!0,s=[],r="",l=0,c=e.split("\n");do{for(o=!1,s=[],l=0;l"===r.substr(0,1),a&&!i?(o=!0,i=!0,s.push("~~~blockquote~~~"),s.push(r.substr(1))):!a&&i?(i=!1,s.push("~~~/blockquote~~~"),s.push(r)):s.push(a&&i?r.substr(1):r);i&&(i=!1,s.push("~~~/blockquote~~~")),c=s}while(o);return e=c.join("\n"),e=e.replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/[\s]*~~~\/blockquote~~~/g,"
").replace(/[\-_~]{10,}/g,"
").replace(/\n/g,"
"),n?t.linkify(e):e},i.rainloop_Utils_htmlToPlain=t.htmlToPlain,i.rainloop_Utils_plainToHtml=t.plainToHtml,t.linkify=function(e){return a.fn&&a.fn.linkify&&(e=c.$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},t.resizeAndCrop=function(e,t,n){var o=new i.Image;o.onload=function(){var e=[0,0],o=i.document.createElement("canvas"),a=o.getContext("2d");o.width=t,o.height=t,e=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],a.fillStyle="#fff",a.fillRect(0,0,t,t),a.drawImage(this,e[0]/2,e[1]/2,this.width-e[0],this.height-e[1],0,0,t,t),n(o.toDataURL("image/jpeg"))},o.src=e},t.folderListOptionsBuilder=function(e,n,o,a,s,l,c,u,p,d){var m=null,f=!1,g=0,h=0,b="Â Â Â ",S=[];for(p=t.isNormal(p)?p:0g;g++)S.push({id:a[g][0],name:a[g][1],system:!1,seporator:!1,disabled:!1});for(f=!0,g=0,h=e.length;h>g;g++)m=e[g],(c?c.call(null,m):!0)&&(f&&0g;g++)m=n[g],(m.subScribed()||!m.existen)&&(c?c.call(null,m):!0)&&(r.FolderType.User===m.type()||!p||01||c>0&&l>c){for(l>c?(u(c),o=c,a=c):((3>=l||l>=c-2)&&(s+=2),u(l),o=l,a=l);s>0;)if(o-=1,a+=1,o>0&&(u(o,!1),s--),c>=a)u(a,!0),s--;else if(0>=o)break;3===o?u(2,!1):o>3&&u(i.Math.round((o-1)/2),!1,"..."),c-2===a?u(c-1,!0):c-2>a&&u(i.Math.round((c+a)/2),!0,"..."),o>1&&u(1,!1),c>a&&u(c,!0)}return r}},t.selectElement=function(e){var t,n;i.getSelection?(t=i.getSelection(),t.removeAllRanges(),n=i.document.createRange(),n.selectNodeContents(e),t.addRange(n)):i.document.selection&&(n=i.document.body.createTextRange(),n.moveToElementText(e),n.select())},t.detectDropdownVisibility=o.debounce(function(){c.dropdownVisibility(!!o.find(c.aBootstrapDropdowns,function(e){return e.hasClass("open")}))},50),t.triggerAutocompleteInputChange=function(e){var n=function(){a(".checkAutocomplete").trigger("change")};(t.isUnd(e)?1:!e)?n():o.delay(n,100)},e.exports=t}()},2:function(e){e.exports=_},3:function(e,t,n){!function(e,t){"use strict";var i=n(12),o=n(2),a=n(14);t.bindingHandlers.tooltip={init:function(e,i){var o=n(7),s=n(1);if(!o.bMobileDevice){var r=a(e),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")||o.dropdownVisibility()?"":''+s.i18n(t.utils.unwrapObservable(i()))+""}}).click(function(){r.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){r.tooltip("hide")})}}},t.bindingHandlers.tooltip2={init:function(e,t){var i=n(7),o=a(e),s=o.data("tooltip-class")||"",r=o.data("tooltip-placement")||"top";o.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:r,title:function(){return o.is(".disabled")||i.dropdownVisibility()?"":''+t()()+""}}).click(function(){o.tooltip("hide")}),i.tooltipTrigger.subscribe(function(){o.tooltip("hide")})}},t.bindingHandlers.tooltip3={init:function(e){var t=a(e),o=n(7);t.tooltip({container:"body",trigger:"hover manual",title:function(){return t.data("tooltip3-data")||""}}),a(i.document).click(function(){t.tooltip("hide")}),o.tooltipTrigger.subscribe(function(){t.tooltip("hide")})},update:function(e,n){var i=t.utils.unwrapObservable(n());""===i?a(e).data("tooltip3-data","").tooltip("hide"):a(e).data("tooltip3-data",i).tooltip("show")}},t.bindingHandlers.registrateBootstrapDropdown={init:function(e){var t=n(7);t.aBootstrapDropdowns.push(a(e))}},t.bindingHandlers.openDropdownTrigger={update:function(e,i){if(t.utils.unwrapObservable(i())){var o=a(e),s=n(1);o.hasClass("open")||(o.find(".dropdown-toggle").dropdown("toggle"),s.detectDropdownVisibility()),i()(!1)}}},t.bindingHandlers.dropdownCloser={init:function(e){a(e).closest(".dropdown").on("click",".e-item",function(){a(e).dropdown("toggle")})}},t.bindingHandlers.popover={init:function(e,n){a(e).popover(t.utils.unwrapObservable(n()))}},t.bindingHandlers.csstext={init:function(e,i){var o=n(1);e&&e.styleSheet&&!o.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=t.utils.unwrapObservable(i()):a(e).text(t.utils.unwrapObservable(i()))},update:function(e,i){var o=n(1);e&&e.styleSheet&&!o.isUnd(e.styleSheet.cssText)?e.styleSheet.cssText=t.utils.unwrapObservable(i()):a(e).text(t.utils.unwrapObservable(i()))}},t.bindingHandlers.resizecrop={init:function(e){a(e).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(e,t){t()(),a(e).resizecrop({width:"100",height:"100"})}},t.bindingHandlers.onEnter={init:function(e,t,n,o){a(e).on("keypress",function(n){n&&13===i.parseInt(n.keyCode,10)&&(a(e).trigger("change"),t().call(o))})}},t.bindingHandlers.onEsc={init:function(e,t,n,o){a(e).on("keypress",function(n){n&&27===i.parseInt(n.keyCode,10)&&(a(e).trigger("change"),t().call(o))})}},t.bindingHandlers.clickOnTrue={update:function(e,n){t.utils.unwrapObservable(n())&&a(e).click()}},t.bindingHandlers.modal={init:function(e,i){var o=n(7),s=n(1);a(e).toggleClass("fade",!o.bMobileDevice).modal({keyboard:!1,show:t.utils.unwrapObservable(i())}).on("shown",function(){s.windowResize()}).find(".close").click(function(){i()(!1)})},update:function(e,n){a(e).modal(t.utils.unwrapObservable(n())?"show":"hide")}},t.bindingHandlers.i18nInit={init:function(e){var t=n(1);t.i18nToNode(e)}},t.bindingHandlers.i18nUpdate={update:function(e,i){var o=n(1);t.utils.unwrapObservable(i()),o.i18nToNode(e)}},t.bindingHandlers.link={update:function(e,n){a(e).attr("href",t.utils.unwrapObservable(n()))}},t.bindingHandlers.title={update:function(e,n){a(e).attr("title",t.utils.unwrapObservable(n()))}},t.bindingHandlers.textF={init:function(e,n){a(e).text(t.utils.unwrapObservable(n()))}},t.bindingHandlers.initDom={init:function(e,t){t()(e)}},t.bindingHandlers.initResizeTrigger={init:function(e,n){var i=t.utils.unwrapObservable(n());a(e).css({height:i[1],"min-height":i[1]})},update:function(e,i){var o=n(1),s=n(7),r=t.utils.unwrapObservable(i()),l=o.pInt(r[1]),c=0,u=a(e).offset().top;u>0&&(u+=o.pInt(r[2]),c=s.$win.height()-u,c>l&&(l=c),a(e).css({height:l,"min-height":l}))}},t.bindingHandlers.appendDom={update:function(e,n){a(e).hide().empty().append(t.utils.unwrapObservable(n())).show()}},t.bindingHandlers.draggable={init:function(e,o,s){var r=n(7),l=n(1);if(!r.bMobileDevice){var c=100,u=3,p=s(),d=p&&p.droppableSelector?p.droppableSelector:"",m={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};d&&(m.drag=function(e){a(d).each(function(){var t=null,n=null,o=a(this),s=o.offset(),r=s.top+o.height();i.clearInterval(o.data("timerScroll")),o.data("timerScroll",!1),e.pageX>=s.left&&e.pageX<=s.left+o.width()&&(e.pageY>=r-c&&e.pageY<=r&&(t=function(){o.scrollTop(o.scrollTop()+u),l.windowResize()},o.data("timerScroll",i.setInterval(t,10)),t()),e.pageY>=s.top&&e.pageY<=s.top+c&&(n=function(){o.scrollTop(o.scrollTop()-u),l.windowResize()},o.data("timerScroll",i.setInterval(n,10)),n()))})},m.stop=function(){a(d).each(function(){i.clearInterval(a(this).data("timerScroll")),a(this).data("timerScroll",!1)})}),m.helper=function(e){return o()(e&&e.target?t.dataFor(e.target):null)},a(e).draggable(m).on("mousedown",function(){l.removeInFocus()})}}},t.bindingHandlers.droppable={init:function(e,t,i){var o=n(7);if(!o.bMobileDevice){var s=t(),r=i(),l=r&&r.droppableOver?r.droppableOver:null,c=r&&r.droppableOut?r.droppableOut:null,u={tolerance:"pointer",hoverClass:"droppableHover"};s&&(u.drop=function(e,t){s(e,t)},l&&(u.over=function(e,t){l(e,t)}),c&&(u.out=function(e,t){c(e,t)}),a(e).droppable(u))}}},t.bindingHandlers.nano={init:function(e){var t=n(7);t.bDisableNanoScroll||a(e).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},t.bindingHandlers.saveTrigger={init:function(e){var t=a(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,n){var i=t.utils.unwrapObservable(n()),o=a(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")}}},t.bindingHandlers.emailsTags={init:function(e,t,i){var s=n(1),r=n(23),l=a(e),c=t(),u=i(),p=u.autoCompleteSource||null,d=function(e){c&&c.focusTrigger&&c.focusTrigger(e)
+};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:d,inputDelimiters:[",",";"],autoCompleteSource:p,parseHook:function(e){return o.map(e,function(e){var t=s.trim(e),n=null;return""!==t?(n=new r,n.mailsoParse(t),n.clearDuplicateName(),[n.toLine(!1),n]):[t,null]})},change:o.bind(function(e){l.data("EmailsTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,n,i){var o=a(e),s=i(),r=s.emailsTagsFilter||null,l=t.utils.unwrapObservable(n());o.data("EmailsTagsValue")!==l&&(o.val(l),o.data("EmailsTagsValue",l),o.inputosaurus("refresh")),r&&t.utils.unwrapObservable(r)&&o.inputosaurus("focus")}},t.bindingHandlers.contactTags={init:function(e,t,i){var s=n(1),r=n(37),l=a(e),c=t(),u=i(),p=u.autoCompleteSource||null,d=function(e){c&&c.focusTrigger&&c.focusTrigger(e)};l.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:d,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:p,parseHook:function(e){return o.map(e,function(e){var t=s.trim(e),n=null;return""!==t?(n=new r,n.name(t),[n.toLine(!1),n]):[t,null]})},change:o.bind(function(e){l.data("ContactTagsValue",e.target.value),c(e.target.value)},this)})},update:function(e,n,i){var o=a(e),s=i(),r=s.contactTagsFilter||null,l=t.utils.unwrapObservable(n());o.data("ContactTagsValue")!==l&&(o.val(l),o.data("ContactTagsValue",l),o.inputosaurus("refresh")),r&&t.utils.unwrapObservable(r)&&o.inputosaurus("focus")}},t.bindingHandlers.command={init:function(e,n,i,o){var s=a(e),r=n();if(!r||!r.enabled||!r.canExecute)throw new Error("You are not using command function");s.addClass("command"),t.bindingHandlers[s.is("form")?"submit":"click"].init.apply(o,arguments)},update:function(e,t){var n=!0,i=a(e),o=t();n=o.enabled(),i.toggleClass("command-not-enabled",!n),n&&(n=o.canExecute(),i.toggleClass("command-can-not-be-execute",!n)),i.toggleClass("command-disabled disable disabled",!n).toggleClass("no-disabled",!!n),(i.is("input")||i.is("button"))&&i.prop("disabled",!n)}},t.extenders.trimmer=function(e){var i=n(1),o=t.computed({read:e,write:function(t){e(i.trim(t.toString()))},owner:this});return o(e()),o},t.extenders.posInterer=function(e,i){var o=n(1),a=t.computed({read:e,write:function(t){var n=o.pInt(t.toString(),i);0>=n&&(n=i),n===e()&&""+n!=""+t&&e(n+1),e(n)}});return a(e()),a},t.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.reverse=function(){e(t)},e.commitedValue=function(){return t},e},t.extenders.toggleSubscribe=function(e,t){return e.subscribe(t[1],t[0],"beforeChange"),e.subscribe(t[2],t[0]),e},t.extenders.falseTimeout=function(e,t){var o=n(1);return e.iTimeout=0,e.subscribe(function(n){n&&(i.clearTimeout(e.iTimeout),e.iTimeout=i.setTimeout(function(){e(!1),e.iTimeout=0},o.pInt(t)))}),e},t.observable.fn.validateNone=function(){return this.hasError=t.observable(!1),this},t.observable.fn.validateEmail=function(){var e=n(1);return this.hasError=t.observable(!1),this.subscribe(function(t){t=e.trim(t),this.hasError(""!==t&&!/^[^@\s]+@[^@\s]+$/.test(t))},this),this.valueHasMutated(),this},t.observable.fn.validateSimpleEmail=function(){var e=n(1);return this.hasError=t.observable(!1),this.subscribe(function(t){t=e.trim(t),this.hasError(""!==t&&!/^.+@.+$/.test(t))},this),this.valueHasMutated(),this},t.observable.fn.validateFunc=function(e){var i=n(1);return this.hasFuncError=t.observable(!1),i.isFunc(e)&&(this.subscribe(function(t){this.hasFuncError(!e(t))},this),this.valueHasMutated()),this},e.exports=t}(e,ko)},5:function(e,t,n){!function(){"use strict";function t(){this.oScreens={},this.sDefaultScreenName="",this.oCurrentScreen=null}var i=n(2),o=n(14),a=n(3),s=n(115),r=n(48),l=n(7),c=n(26),u=n(1);t.prototype.oScreens={},t.prototype.sDefaultScreenName="",t.prototype.oCurrentScreen=null,t.prototype.hideLoading=function(){o("#rl-loading").hide()},t.prototype.constructorEnd=function(e){u.isFunc(e.__constructor_end)&&e.__constructor_end.call(e)},t.prototype.extendAsViewModel=function(e,t){t&&(t.__names=u.isArray(e)?e:[e],t.__name=t.__names[0])},t.prototype.addSettingsViewModel=function(e,t,n,i,o){e.__rlSettingsData={Label:n,Template:t,Route:i,IsDefault:!!o},l.aViewModels.settings.push(e)},t.prototype.removeSettingsViewModel=function(e){l.aViewModels["settings-removed"].push(e)},t.prototype.disableSettingsViewModel=function(e){l.aViewModels["settings-disabled"].push(e)},t.prototype.routeOff=function(){s.changed.active=!1},t.prototype.routeOn=function(){s.changed.active=!0},t.prototype.screen=function(e){return""===e||u.isUnd(this.oScreens[e])?null:this.oScreens[e]},t.prototype.buildViewModel=function(e,t){if(e&&!e.__builded){var n=this,s=new e(t),r=s.viewModelPosition(),p=o("#rl-content #rl-"+r.toLowerCase()),d=null;e.__builded=!0,e.__vm=s,s.viewModelName=e.__name,s.viewModelNames=e.__names,p&&1===p.length?(d=o("").addClass("rl-view-model").addClass("RL-"+s.viewModelTemplate()).hide(),d.appendTo(p),s.viewModelDom=d,e.__dom=d,"Popups"===r&&(s.cancelCommand=s.closeCommand=u.createCommand(s,function(){n.hideScreenPopup(e)}),s.modalVisibility.subscribe(function(e){var t=this;e?(this.viewModelDom.show(),this.storeAndSetKeyScope(),l.popupVisibilityNames.push(this.viewModelName),s.viewModelDom.css("z-index",3e3+l.popupVisibilityNames().length+10),u.delegateRun(this,"onFocus",[],500)):(u.delegateRun(this,"onHide"),this.restoreKeyScope(),i.each(this.viewModelNames,function(e){c.runHook("view-model-on-hide",[e,t])}),l.popupVisibilityNames.remove(this.viewModelName),s.viewModelDom.css("z-index",2e3),l.tooltipTrigger(!l.tooltipTrigger()),i.delay(function(){t.viewModelDom.hide()},300))},s)),i.each(e.__names,function(e){c.runHook("view-model-pre-build",[e,s,d])}),a.applyBindingAccessorsToNode(d[0],{i18nInit:!0,template:function(){return{name:s.viewModelTemplate()}}},s),u.delegateRun(s,"onBuild",[d]),s&&"Popups"===r&&s.registerPopupKeyDown(),i.each(e.__names,function(e){c.runHook("view-model-post-build",[e,s,d])})):u.log("Cannot find view model position: "+r)}return e?e.__vm:null},t.prototype.hideScreenPopup=function(e){e&&e.__vm&&e.__dom&&e.__vm.modalVisibility(!1)},t.prototype.showScreenPopup=function(e,t){e&&(this.buildViewModel(e),e.__vm&&e.__dom&&(e.__vm.modalVisibility(!0),u.delegateRun(e.__vm,"onShow",t||[]),i.each(e.__names,function(n){c.runHook("view-model-on-show",[n,e.__vm,t||[]])})))},t.prototype.isPopupVisible=function(e){return e&&e.__vm?e.__vm.modalVisibility():!1},t.prototype.screenOnRoute=function(e,t){var n=this,o=null,a=null;""===u.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,u.isNonEmptyArray(o.viewModels())&&i.each(o.viewModels(),function(e){this.buildViewModel(e,o)},this),u.delegateRun(o,"onBuild")),i.defer(function(){n.oCurrentScreen&&(u.delegateRun(n.oCurrentScreen,"onHide"),u.isNonEmptyArray(n.oCurrentScreen.viewModels())&&i.each(n.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.hide(),e.__vm.viewModelVisibility(!1),u.delegateRun(e.__vm,"onHide"))})),n.oCurrentScreen=o,n.oCurrentScreen&&(u.delegateRun(n.oCurrentScreen,"onShow"),c.runHook("screen-on-show",[n.oCurrentScreen.screenName(),n.oCurrentScreen]),u.isNonEmptyArray(n.oCurrentScreen.viewModels())&&i.each(n.oCurrentScreen.viewModels(),function(e){e.__vm&&e.__dom&&"Popups"!==e.__vm.viewModelPosition()&&(e.__dom.show(),e.__vm.viewModelVisibility(!0),u.delegateRun(e.__vm,"onShow"),u.delegateRun(e.__vm,"onFocus",[],200),i.each(e.__names,function(t){c.runHook("view-model-on-show",[t,e.__vm])}))},n)),a=o.__cross?o.__cross():null,a&&a.parse(t)})))},t.prototype.startScreens=function(e){o("#rl-content").css({visibility:"hidden"}),i.each(e,function(e){var t=new e,n=t?t.screenName():"";t&&""!==n&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=n),this.oScreens[n]=t)},this),i.each(this.oScreens,function(e){e&&!e.__started&&e.__start&&(e.__started=!0,e.__start(),c.runHook("screen-pre-start",[e.screenName(),e]),u.delegateRun(e,"onStart"),c.runHook("screen-post-start",[e.screenName(),e]))},this);var t=r.create();t.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this)),s.initialized.add(t.parse,t),s.changed.add(t.parse,t),s.init(),o("#rl-content").css({visibility:"visible"}),i.delay(function(){l.$html.removeClass("rl-started-trigger").addClass("rl-started")},50)},t.prototype.setHash=function(e,t,n){e="#"===e.substr(0,1)?e.substr(1):e,e="/"===e.substr(0,1)?e.substr(1):e,n=u.isUnd(n)?!1:!!n,(u.isUnd(t)?1:!t)?(s.changed.active=!0,s[n?"replaceHash":"setHash"](e),s.setHash(e)):(s.changed.active=!1,s[n?"replaceHash":"setHash"](e),s.changed.active=!0)},e.exports=new t}()},6:function(e){!function(){"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.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}()},7:function(e,t,n){!function(){"use strict";var t={},i=n(12),o=n(2),a=n(14),s=n(3),r=n(19),l=n(6);t.$win=a(i),t.$doc=a(i.document),t.$html=a("html"),t.$div=a(""),t.now=(new i.Date).getTime(),t.momentTrigger=s.observable(!0),t.dropdownVisibility=s.observable(!1).extend({rateLimit:0}),t.tooltipTrigger=s.observable(!1).extend({rateLimit:0}),t.langChangeTrigger=s.observable(!0),t.useKeyboardShortcuts=s.observable(!0),t.iAjaxErrorCount=0,t.iTokenErrorCount=0,t.iMessageBodyCacheCount=0,t.bUnload=!1,t.sUserAgent=(i.navigator.userAgent||"").toLowerCase(),t.bIsiOSDevice=-11&&(o=o.replace(/[\/]+$/,""),o+="/p"+t),""!==n&&(o=o.replace(/[\/]+$/,""),o+="/"+encodeURI(n)),o},t.prototype.phpInfo=function(){return this.sServer+"Info"},t.prototype.langLink=function(e){return this.sServer+"/Lang/0/"+encodeURI(e)+"/"+this.sVersion+"/"},t.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},t.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},t.prototype.emptyContactPic=function(){return this.sStaticPrefix+"css/images/empty-contact.png"},t.prototype.sound=function(e){return this.sStaticPrefix+"sounds/"+e},t.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"},t.prototype.notificationMailIcon=function(){return this.sStaticPrefix+"css/images/icom-message-notification.png"},t.prototype.openPgpJs=function(){return this.sStaticPrefix+"js/min/openpgp.js"},t.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},t.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},t.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},e.exports=new t}()},12:function(e){e.exports=window},14:function(e){e.exports=jQuery},17:function(e){!function(){"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.ClientSideStorageIndexName="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}(e)},19:function(e){e.exports=key},22:function(e,t,n){!function(){"use strict";function t(){this.oSubs={}}var i=n(2),o=n(1),a=n(26);t.prototype.oSubs={},t.prototype.sub=function(e,t,n){return o.isUnd(this.oSubs[e])&&(this.oSubs[e]=[]),this.oSubs[e].push([t,n]),this},t.prototype.pub=function(e,t){return a.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 t}()},23:function(e,t,n){!function(){"use strict";function t(e,t){this.email=e||"",this.name=t||"",this.clearDuplicateName()}var i=n(1);t.newInstanceFromJson=function(e){var n=new t;return n.initByJson(e)?n:null},t.prototype.name="",t.prototype.email="",t.prototype.clear=function(){this.email="",this.name=""},t.prototype.validate=function(){return""!==this.name||""!==this.email},t.prototype.hash=function(e){return"#"+(e?"":this.name)+"#"+this.email+"#"},t.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},t.prototype.search=function(e){return-1<(this.name+" "+this.email).toLowerCase().indexOf(e.toLowerCase())},t.prototype.parse=function(e){this.clear(),e=i.trim(e);var t=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,n=t.exec(e);n?(this.name=n[1]||"",this.email=n[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(e)&&(this.name="",this.email=e)},t.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},t.prototype.toLine=function(e,t,n){var o="";return""!==this.email&&(t=i.isUnd(t)?!1:!!t,n=i.isUnd(n)?!1:!!n,e&&""!==this.name?o=t?'")+'" target="_blank" tabindex="-1">'+i.encodeHtml(this.name)+"":n?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+">",n&&(o=i.encodeHtml(o))):t&&(o=''+i.encodeHtml(this.email)+""))),o},t.prototype.mailsoParse=function(e){if(e=i.trim(e),""===e)return!1;for(var t=function(e,t,n){e+="";var i=e.length;return 0>t&&(t+=i),i="undefined"==typeof n?i:0>n?n+i:n+t,t>=e.length||0>t||t>i?!1:e.slice(t,i)},n=function(e,t,n,i){return 0>n&&(n+=e.length),i=void 0!==i?i:e.length,0>i&&(i=i+e.length-n),e.slice(0,n)+t.substr(0,i)+t.slice(i)+e.slice(n+i)},o="",a="",s="",r=!1,l=!1,c=!1,u=null,p=0,d=0,m=0;m0&&0===o.length&&(o=t(e,0,m)),l=!0,p=m);break;case">":l&&(d=m,a=t(e,p+1,d-p-1),e=n(e,"",p,d-p+1),d=0,m=0,p=0,l=!1);break;case"(":r||l||c||(c=!0,p=m);break;case")":c&&(d=m,s=t(e,p+1,d-p-1),e=n(e,"",p,d-p+1),d=0,m=0,p=0,c=!1);break;case"\\":m++}m++}return 0===a.length&&(u=e.match(/[^@\s]+@\S+/i),u&&u[0]?a=u[0]:o=e),a.length>0&&0===o.length&&0===s.length&&(o=e.replace(a,"")),a=i.trim(a).replace(/^[<]+/,"").replace(/[>]+$/,""),o=i.trim(o).replace(/^["']+/,"").replace(/["']+$/,""),s=i.trim(s).replace(/^[(]+/,"").replace(/[)]+$/,""),o=o.replace(/\\\\(.)/g,"$1"),s=s.replace(/\\\\(.)/g,"$1"),this.name=o,this.email=a,this.clearDuplicateName(),!0},t.prototype.inputoTagLine=function(){return 0').appendTo("body"),s.$win.on("error",function(t){t&&t.originalEvent&&t.originalEvent.message&&-1===r.inArray(t.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&e.jsError(r.emptyFunction,t.originalEvent.message,t.originalEvent.filename,t.originalEvent.lineno,i.location&&i.location.toString?i.location.toString():"",s.$html.attr("class"),r.microtime()-s.now)}),s.$doc.on("keydown",function(e){e&&e.ctrlKey&&s.$html.addClass("rl-ctrl-key-pressed")}).on("keyup",function(e){e&&!e.ctrlKey&&s.$html.removeClass("rl-ctrl-key-pressed")})}var i=n(12),o=n(2),a=n(14),s=n(7),r=n(1),l=n(11),c=n(22),u=n(10),p=n(50);o.extend(t.prototype,p.prototype),t.prototype.remote=function(){return null},t.prototype.data=function(){return null},t.prototype.download=function(e){var t=null,n=null,o=i.navigator.userAgent.toLowerCase();return o&&(o.indexOf("chrome")>-1||o.indexOf("chrome")>-1)&&(n=i.document.createElement("a"),n.href=e,i.document.createEvent&&(t=i.document.createEvent("MouseEvents"),t&&t.initEvent&&n.dispatchEvent))?(t.initEvent("click",!0,!0),n.dispatchEvent(t),!0):(s.bMobileDevice?(i.open(e,"_self"),i.focus()):this.iframe.attr("src",e),!0)},t.prototype.setTitle=function(e){e=(r.isNormal(e)&&0(new i.Date).getTime()-f),h&&l.oRequests[h]&&(l.oRequests[h].__aborted&&(o="abort"),l.oRequests[h]=null),l.defaultResponse(e,h,o,n,a,t)}),h&&0',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=E(e[d],"function"),E(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),A={}.hasOwnProperty,B;!E(A,"undefined")&&!E(A.call,"undefined")?B=function(a,b){return A.call(a,b)}:B=function(a,b){return b in a&&E(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return I("flexWrap")},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!I("indexedDB",a)},s.hashchange=function(){return z("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return C("background-color:rgba(150,255,150,.5)"),F(j.backgroundColor,"rgba")},s.hsla=function(){return C("background-color:hsla(120,40%,100%,.5)"),F(j.backgroundColor,"rgba")||F(j.backgroundColor,"hsla")},s.multiplebgs=function(){return C("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return I("backgroundSize")},s.borderimage=function(){return I("borderImage")},s.borderradius=function(){return I("borderRadius")},s.boxshadow=function(){return I("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return D("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return I("animationName")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return C((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),F(j.backgroundImage,"gradient")},s.cssreflections=function(){return I("boxReflect")},s.csstransforms=function(){return!!I("transform")},s.csstransforms3d=function(){var a=!!I("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return I("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect};for(var K in s)B(s,K)&&(x=K.toLowerCase(),e[x]=s[K](),v.push((e[x]?"":"no-")+x));return e.input||J(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)B(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},C(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.hasEvent=z,e.testProp=function(a){return G([a])},e.testAllProps=I,e.testStyles=y,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),Modernizr.addTest("fullscreen",function(){for(var a=0;a',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=E(e[d],"function"),E(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),A={}.hasOwnProperty,B;!E(A,"undefined")&&!E(A.call,"undefined")?B=function(a,b){return A.call(a,b)}:B=function(a,b){return b in a&&E(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return I("flexWrap")},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!I("indexedDB",a)},s.hashchange=function(){return z("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return C("background-color:rgba(150,255,150,.5)"),F(j.backgroundColor,"rgba")},s.hsla=function(){return C("background-color:hsla(120,40%,100%,.5)"),F(j.backgroundColor,"rgba")||F(j.backgroundColor,"hsla")},s.multiplebgs=function(){return C("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return I("backgroundSize")},s.borderimage=function(){return I("borderImage")},s.borderradius=function(){return I("borderRadius")},s.boxshadow=function(){return I("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return D("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return I("animationName")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return C((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),F(j.backgroundImage,"gradient")},s.cssreflections=function(){return I("boxReflect")},s.csstransforms=function(){return!!I("transform")},s.csstransforms3d=function(){var a=!!I("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return I("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect};for(var K in s)B(s,K)&&(x=K.toLowerCase(),e[x]=s[K](),v.push((e[x]?"":"no-")+x));return e.input||J(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)B(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},C(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.hasEvent=z,e.testProp=function(a){return G([a])},e.testAllProps=I,e.testStyles=y,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),Modernizr.addTest("fullscreen",function(){for(var a=0;au;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this);
+(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this);
/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h ]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/\s*$/g,rb={option:[1,""],legend:[1,""],area:[1,""],param:[1,""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X",""]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1>$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"