mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
154 lines
No EOL
77 KiB
JavaScript
154 lines
No EOL
77 KiB
JavaScript
(function(g,j,d,qa,z,i){function m(){this.sBase="#/";this.sCdnStaticDomain=e.settingsGet("CdnStaticDomain");this.sVersion=e.settingsGet("Version");this.sSpecSuffix=e.settingsGet("AuthAccountHash")||"0";this.sServer=(e.settingsGet("IndexFile")||"./")+"?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function O(){}function P(){}function Q(){var a=i.find([P,O],function(a){return a.supported()});
|
|
a&&(this.oDriver=new a)}function ra(){}function t(a,b){this.sPosition=c.pString(a);this.sTemplate=c.pString(b);this.viewModelName="";this.viewModelVisibility=d.observable(!1);"Popups"===this.sPosition&&(this.modalVisibility=d.observable(!1));this.viewModelDom=null}function w(a,b){this.sScreenName=a;this.aViewModels=c.isArray(b)?b:[]}function p(){this.sDefaultScreenName="";this.oScreens={};this.oCurrentScreen=this.oBoot=null;this.popupVisibility=d.observable(!1);this.popupVisibility.subscribe(function(a){e&&
|
|
e.popupVisibility(a)})}function s(a,b){this.email=a||"";this.name=b||"";this.privateType=null;this.clearDuplicateName()}function C(){t.call(this,"Popups","PopupsDomain");this.edit=d.observable(!1);this.saving=d.observable(!1);this.savingError=d.observable("");this.whiteListPage=d.observable(!1);this.testing=d.observable(!1);this.testingDone=d.observable(!1);this.testingImapError=d.observable(!1);this.testingSmtpError=d.observable(!1);this.imapServerFocus=d.observable(!1);this.smtpServerFocus=d.observable(!1);
|
|
this.name=d.observable("");this.imapServer=d.observable("");this.imapPort=d.observable(l.Values.ImapDefaulPort);this.imapSecure=d.observable(f.ServerSecure.None);this.smtpServer=d.observable("");this.smtpPort=d.observable(l.Values.SmtpDefaulPort);this.smtpSecure=d.observable(f.ServerSecure.None);this.smtpAuth=d.observable(!0);this.whiteList=d.observable("");this.imapServerFocus.subscribe(function(a){a&&(""!==this.name()&&""===this.imapServer())&&this.imapServer(this.name())},this);this.smtpServerFocus.subscribe(function(a){a&&
|
|
(""!==this.imapServer()&&""===this.smtpServer())&&this.smtpServer(this.imapServer())},this);this.headerText=d.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this);this.domainIsComputed=d.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this);this.canBeTested=d.computed(function(){return!this.testing()&&this.domainIsComputed()},this);this.canBeSaved=
|
|
d.computed(function(){return!this.saving()&&this.domainIsComputed()},this);this.createOrAddCommand=c.createCommand(this,function(){this.saving(!0);e.remote().createOrUpdateDomain(i.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth(),this.whiteList())},this.canBeSaved);this.testConnectionCommand=c.createCommand(this,function(){this.whiteListPage(!1);this.testingDone(!1);
|
|
this.testingImapError(!1);this.testingSmtpError(!1);this.testing(!0);e.remote().testConnectionForDomain(i.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested);this.whiteListCommand=c.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())})}function R(){t.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=i.bind(this.onPluginSettingsUpdateResponse,
|
|
this);this.saveError=d.observable("");this.name=d.observable("");this.readme=d.observable("");this.configures=d.observableArray([]);this.hasReadme=d.computed(function(){return""!==this.readme()},this);this.hasConfiguration=d.computed(function(){return 0<this.configures().length},this);this.readmePopoverConf={placement:"top",trigger:"hover",title:"About",content:function(){return a.readme()}};this.saveCommand=c.createCommand(this,function(){var a={};a.Name=this.name();i.each(this.configures(),function(h){var c=
|
|
h.value();if(!1===c||!0===c)c=c?"1":"0";a["_"+h.Name]=c},this);this.saveError("");e.remote().pluginSettingsUpdate(this.onPluginSettingsUpdateResponse,a)},this.hasConfiguration)}function S(){t.call(this,"Popups","PopupsActivate");var a=this;this.domain=d.observable("");this.key=d.observable("");this.key.focus=d.observable(!1);this.activationSuccessed=d.observable(!1);this.licenseTrigger=e.data().licenseTrigger;this.activateProcess=d.observable(!1);this.activateText=d.observable("");this.activateText.isError=
|
|
d.observable(!1);this.key.subscribe(function(){this.activateText("");this.activateText.isError(!1)},this);this.activationSuccessed.subscribe(function(a){a&&this.licenseTrigger(!this.licenseTrigger())},this);this.activateCommand=c.createCommand(this,function(){this.activateProcess(!0);this.validateSubscriptionKey()?e.remote().licensingActivate(function(b,h){a.activateProcess(!1);f.StorageResultType.Success===b&&h.Result?!0===h.Result?(a.activationSuccessed(!0),a.activateText("Subscription Key Activated Successfully"),
|
|
a.activateText.isError(!1)):(a.activateText(h.Result),a.activateText.isError(!0),a.key.focus(!0)):(h.ErrorCode?a.activateText(c.getNotification(h.ErrorCode)):a.activateText(c.getNotification(f.Notification.UnknownError)),a.activateText.isError(!0),a.key.focus(!0))},this.domain(),this.key()):(this.activateProcess(!1),this.activateText("Invalid Subscription Key"),this.activateText.isError(!0),this.key.focus(!0))},function(){return!this.activateProcess()&&""!==this.domain()&&""!==this.key()&&!this.activationSuccessed()})}
|
|
function T(){t.call(this,"Popups","PopupsLanguages");this.exp=d.observable(!1);this.languages=d.computed(function(){var a=e.data().mainLanguage();return i.map(e.data().languages(),function(b){return{key:b,selected:b===a,fullName:c.convertLangName(b)}})})}function U(){t.call(this,"Right","AdminLogin");this.login=d.observable("");this.password=d.observable("");this.loginError=d.observable(!1);this.passwordError=d.observable(!1);this.loginFocus=d.observable(!1);this.login.subscribe(function(){this.loginError(!1)},
|
|
this);this.password.subscribe(function(){this.passwordError(!1)},this);this.submitRequest=d.observable(!1);this.submitError=d.observable("");this.submitCommand=c.createCommand(this,function(){this.loginError(""===c.trim(this.login()));this.passwordError(""===c.trim(this.password()));if(this.loginError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().adminLogin(i.bind(function(a,b){f.StorageResultType.Success===a&&b&&"AdminLogin"===b.Action?b.Result?e.loginAndLogoutReload():b.ErrorCode&&
|
|
(this.submitRequest(!1),this.submitError(c.getNotification(b.ErrorCode))):(this.submitRequest(!1),this.submitError(c.getNotification(f.Notification.UnknownError)))},this),this.login(),this.password());return!0},function(){return!this.submitRequest()})}function da(a){t.call(this,"Left","AdminMenu");this.menu=a.menu}function ea(){t.call(this,"Right","AdminPane");this.adminDomain=d.observable(e.settingsGet("AdminDomain"));this.version=d.observable(e.settingsGet("Version"))}function sa(){var a=e.data();
|
|
this.mainLanguage=a.mainLanguage;this.mainTheme=a.mainTheme;this.language=a.language;this.theme=a.theme;this.allowThemes=a.allowThemes;this.allowCustomTheme=a.allowCustomTheme;this.allowCustomLogin=a.allowCustomLogin;this.allowLanguagesOnLogin=a.allowLanguagesOnLogin;this.allowLanguagesOnSettings=a.allowLanguagesOnSettings;this.allowAdditionalAccounts=a.allowAdditionalAccounts;this.determineUserLanguage=a.determineUserLanguage;this.title=d.observable(e.settingsGet("Title"));this.themesOptions=d.computed(function(){return i.map(a.themes(),
|
|
function(a){return{optValue:a,optText:c.convertThemeName(a)}})});this.languagesOptions=d.computed(function(){return i.map(a.languages(),function(a){return{optValue:a,optText:c.convertLangName(a)}})});this.contactsSupported=e.settingsGet("ContactsIsSupported");this.contactsIsAllowed=e.settingsGet("ContactsIsAllowed");this.titleTrigger=d.observable(f.SaveSettingsStep.Idle);this.languageTrigger=d.observable(f.SaveSettingsStep.Idle);this.themeTrigger=d.observable(f.SaveSettingsStep.Idle)}function D(){var a=
|
|
e.data();this.domains=a.domains;this.domainsLoading=a.domainsLoading;this.iDomainForDeletionTimeout=0;this.visibility=d.computed(function(){return a.domainsLoading()?"visible":"hidden"},this);this.domainForDeletion=d.observable(null).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&(a.deleteAccess(!0),this.startDomainForDeletionTimeout())}]})}function L(){this.licensing=e.data().licensing;this.licensingProcess=e.data().licensingProcess;this.licenseValid=e.data().licenseValid;
|
|
this.licenseExpired=e.data().licenseExpired;this.licenseError=e.data().licenseError;this.licenseTrigger=e.data().licenseTrigger;this.adminDomain=d.observable("");this.subscriptionEnabled=d.observable(!!e.settingsGet("SubscriptionEnabled"));this.licenseTrigger.subscribe(function(){this.subscriptionEnabled()&&e.reloadLicensing(!0)},this)}function M(){this.csrfProtection=d.observable(!!e.settingsGet("UseTokenProtection"));this.usageStatistics=d.observable(!!e.settingsGet("UsageStatistics"));this.adminLogin=
|
|
d.observable(e.settingsGet("AdminLogin"));this.adminPassword=d.observable("");this.adminPasswordNew=d.observable("");this.adminPasswordUpdateError=d.observable(!1);this.adminPasswordUpdateSuccess=d.observable(!1);this.adminPassword.subscribe(function(){this.adminPasswordUpdateError(!1);this.adminPasswordUpdateSuccess(!1)},this);this.adminPasswordNew.subscribe(function(){this.adminPasswordUpdateError(!1);this.adminPasswordUpdateSuccess(!1)},this);this.onNewAdminPasswordResponse=i.bind(this.onNewAdminPasswordResponse,
|
|
this);this.saveNewAdminPasswordCommand=c.createCommand(this,function(){this.adminPasswordUpdateError(!1);this.adminPasswordUpdateSuccess(!1);e.remote().saveNewAdminPassword(this.onNewAdminPasswordResponse,{Password:this.adminPassword(),NewPassword:this.adminPasswordNew()})},function(){return""!==this.adminPassword()&&""!==this.adminPasswordNew()})}function ta(){var a=e.data();this.googleEnable=a.googleEnable;this.googleClientID=a.googleClientID;this.googleClientSecret=a.googleClientSecret;this.googleTrigger1=
|
|
d.observable(f.SaveSettingsStep.Idle);this.googleTrigger2=d.observable(f.SaveSettingsStep.Idle);this.facebookEnable=a.facebookEnable;this.facebookAppID=a.facebookAppID;this.facebookAppSecret=a.facebookAppSecret;this.facebookTrigger1=d.observable(f.SaveSettingsStep.Idle);this.facebookTrigger2=d.observable(f.SaveSettingsStep.Idle);this.twitterEnable=a.twitterEnable;this.twitterConsumerKey=a.twitterConsumerKey;this.twitterConsumerSecret=a.twitterConsumerSecret;this.twitterTrigger1=d.observable(f.SaveSettingsStep.Idle);
|
|
this.twitterTrigger2=d.observable(f.SaveSettingsStep.Idle);this.dropboxEnable=a.dropboxEnable;this.dropboxApiKey=a.dropboxApiKey;this.dropboxTrigger1=d.observable(f.SaveSettingsStep.Idle)}function F(){var a=e.data();this.enabledPlugins=d.observable(!!e.settingsGet("EnabledPlugins"));this.pluginsError=d.observable("");this.plugins=a.plugins;this.pluginsLoading=a.pluginsLoading;this.visibility=d.computed(function(){return a.pluginsLoading()?"visible":"hidden"},this);this.onPluginLoadRequest=i.bind(this.onPluginLoadRequest,
|
|
this);this.onPluginDisableRequest=i.bind(this.onPluginDisableRequest,this)}function K(){var a=e.data();this.packagesError=d.observable("");this.packages=a.packages;this.packagesLoading=a.packagesLoading;this.packagesReal=a.packagesReal;this.packagesMainUpdatable=a.packagesMainUpdatable;this.packagesCurrent=d.computed(function(){return i.filter(this.packages(),function(a){return a&&""!==a.installed&&!a.compare})},this);this.packagesAvailableForUpdate=d.computed(function(){return i.filter(this.packages(),
|
|
function(a){return a&&""!==a.installed&&!!a.compare})},this);this.packagesAvailableForInstallation=d.computed(function(){return i.filter(this.packages(),function(a){return a&&""===a.installed})},this);this.visibility=d.computed(function(){return a.packagesLoading()?"visible":"hidden"},this)}function fa(){c.initDataConstructorBySettings(this)}function ga(){c.initDataConstructorBySettings(this);this.domainsLoading=d.observable(!1).extend({throttle:100});this.domains=d.observableArray([]);this.pluginsLoading=
|
|
d.observable(!1).extend({throttle:100});this.plugins=d.observableArray([]);this.packagesReal=d.observable(!0);this.packagesMainUpdatable=d.observable(!0);this.packagesLoading=d.observable(!1).extend({throttle:100});this.packages=d.observableArray([]);this.licensing=d.observable(!1);this.licensingProcess=d.observable(!1);this.licenseValid=d.observable(!1);this.licenseExpired=d.observable(0);this.licenseError=d.observable("");this.licenseTrigger=d.observable(!1)}function G(){this.oRequests={}}function o(){this.oRequests=
|
|
{};this.oRequests={}}function E(){this.oEmailsPicsHashes={};this.oServices={}}function ua(){E.call(this)}function H(a){w.call(this,"settings",a);this.menu=d.observableArray([]);this.oViewModelPlace=this.oCurrentSubScreen=null}function ha(){w.call(this,"login",[U])}function ia(){H.call(this,[da,ea])}function u(){this.oLocal=this.oLink=this.oPlugins=this.oSettings=null;this.isLocalAutocomplete=!0;this.popupVisibility=d.observable(!1);this.iframe=j('<iframe style="display:none" src="javascript:;" />').appendTo("body");
|
|
I.on("error",function(a){e&&(a&&a.originalEvent&&a.originalEvent.message&&-1===c.inArray(a.originalEvent.message,["Uncaught Error: Error calling method on NPObject."]))&&e.remote().jsError(c.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",V.attr("class"))})}function v(){u.call(this);this.oCache=this.oRemote=this.oData=null}var l={},f={},k={},c={},n={},W,X,ja,J,ka,B,la=d.observable(!0),Y=d.observable(!0),q=null,
|
|
Z=g.rainloopAppData||{},ma=g.rainloopI18N||{},V=j("html"),I=j(g),va=j(g.document),aa=[],na=[],oa=[],ba=g.Notification&&g.Notification.requestPermission?g.Notification:null,e=null;X=W=0;ja=!1;J=(navigator.userAgent||"").toLowerCase();ka=-1<J.indexOf("iphone")||-1<J.indexOf("ipod")||-1<J.indexOf("ipad");J=-1<J.indexOf("android");B=ka||J;l.Defaults={};l.Values={};l.DataImages={};l.Defaults.MessagesPerPage=20;l.Defaults.MessagesPerPageArray=[10,20,30,50,100];l.Defaults.DefaultAjaxTimeout=2E4;l.Defaults.SearchAjaxTimeout=
|
|
12E4;l.Defaults.SendMessageAjaxTimeout=2E5;l.Defaults.SaveMessageAjaxTimeout=2E5;l.Values.UnuseOptionValue="__UNUSE__";l.Values.GmailFolderName="[Gmail]";l.Values.ClientSideCookieIndexName="rlcsc";l.Values.ImapDefaulPort=143;l.Values.ImapDefaulSecurePort=993;l.Values.SmtpDefaulPort=25;l.Values.SmtpDefaulSecurePort=465;l.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=";l.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=";
|
|
f.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"};f.State={Empty:10,Login:20,Auth:30};f.StateType={Webmail:0,Admin:1};f.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,User:99};f.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"};f.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2};f.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft"};
|
|
f.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99};f.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4};f.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4};f.EventKeyCode={Backspace:8,Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Insert:45,Delete:46,A:65,S:83};f.MessageSetAction={SetSeen:0,
|
|
UnsetSeen:1,SetFlag:2,UnsetFlag:3};f.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6};f.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9};f.MessagePriority={Low:5,Normal:3,High:1};f.EditorDefaultType={Html:"Html",Plain:"Plain"};f.CustomThemeType={Light:"Light",Dark:"Dark"};f.ServerSecure={None:0,SSL:1,TLS:2};f.SearchDateType={All:-1,Days3:3,Days7:7,Month:30};f.EmailType={Defailt:0,Facebook:1,Google:2};f.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,
|
|
FalseResult:0};f.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,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,UnknownNotification:999,UnknownError:999};c.trim=j.trim;c.inArray=j.inArray;c.isArray=i.isArray;c.isFunc=i.isFunction;c.isUnd=i.isUndefined;c.isNull=i.isNull;
|
|
c.emptyFunction=function(){};c.isNormal=function(a){return!c.isUnd(a)&&!c.isNull(a)};c.windowResize=i.debounce(function(a){c.isUnd(a)?I.resize():g.setTimeout(function(){I.resize()},a)},50);c.isPosNumeric=function(a,b){return c.isNormal(a)?c.isUnd(b)||b?/^[0-9]*$/.test(a.toString()):/^[1-9]+[0-9]*$/.test(a.toString()):!1};c.pInt=function(a){return c.isNormal(a)&&""!==a?g.parseInt(a,10):0};c.pString=function(a){return c.isNormal(a)?a+"":""};c.isNonEmptyArray=function(a){return c.isArray(a)&&0<a.length};
|
|
c.exportPath=function(a,b,h){for(var A=null,a=a.split("."),h=h||g;a.length&&(A=a.shift());)!a.length&&!c.isUnd(b)?h[A]=b:h=h[A]?h[A]:h[A]={}};c.pImport=function(a,b,c){a[b]=c};c.pExport=function(a,b,h){return c.isUnd(a[b])?h:a[b]};c.encodeHtml=function(a){return c.isNormal(a)?a.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""};c.splitPlainText=function(a,b){for(var h="",A="",d=a,e=0,f=0,b=c.isUnd(b)?100:b;d.length>b;)A=d.substring(0,
|
|
b),e=A.lastIndexOf(" "),f=A.lastIndexOf("\n"),-1!==f&&(e=f),-1===e&&(e=b),h+=A.substring(0,e)+"\n",d=d.substring(e+1);return h+d};var ca={};c.timeOutAction=function(a,b,h){c.isUnd(ca[a])&&(ca[a]=0);g.clearTimeout(ca[a]);ca[a]=g.setTimeout(b,h)};var pa={};c.timeOutActionSecond=function(a,b,c){pa[a]||(pa[a]=g.setTimeout(function(){b();pa[a]=0},c))};var y=!1;c.audio=function(a,b){if(!1===y)if(ka)y=null;else{var c=!1,d=!1,e=g.Audio?new g.Audio:null;e&&e.canPlayType&&e.play?((c=""!==e.canPlayType('audio/mpeg; codecs="mp3"'))||
|
|
(d=""!==e.canPlayType('audio/ogg; codecs="vorbis"')),c||d?(y=e,y.preload="none",y.loop=!1,y.autoplay=!1,y.muted=!1,y.src=c?a:b):y=null):y=null}return y};c.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};c.i18n=function(a,b,h){var d="",a=c.isUnd(ma[a])?c.isUnd(h)?a:h:ma[a];if(!c.isUnd(b)&&!c.isNull(b))for(d in b)c.hos(b,d)&&(a=a.replace("%"+d+"%",b[d]));return a};c.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),h="";(h=a.data("i18n-text"))?
|
|
a.text(c.i18n(h)):((h=a.data("i18n-html"))&&a.html(c.i18n(h)),(h=a.data("i18n-placeholder"))&&a.attr("placeholder",c.i18n(h)))})})};c.i18nToDoc=function(){g.rainloopI18N&&(ma=g.rainloopI18N||{},c.i18nToNode(va),Y(!Y()));g.rainloopI18N={}};c.initOnStartOrLangChange=function(a,b,c){a&&a.call(b);c?Y.subscribe(function(){a&&a.call(b);c.call(b)}):a&&Y.subscribe(a,b)};c.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===
|
|
a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)};c.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=j(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}};c.removeSelection=function(){if(g&&g.getSelection){var a=g.getSelection();a&&a.removeAllRanges&&a.removeAllRanges()}else document&&(document.selection&&document.selection.empty)&&document.selection.empty()};c.replySubjectAdd=function(a,b){var h=null,
|
|
d=c.trim(b);null!==(h=(new g.RegExp("^"+a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!c.isUnd(h[1])?d=a+"[2]: "+h[1]:null!==(h=(new g.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi")).exec(b))&&!c.isUnd(h[1])&&!c.isUnd(h[2])&&!c.isUnd(h[3])?(c.pInt(h[2]),d=h[1]+(c.pInt(h[2])+1)+h[3]):d=a+": "+b;return d};c.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};c.friendlySize=function(a){a=c.pInt(a);return 1073741824<=a?c.roundNumber(a/1073741824,1)+"GB":1048576<=
|
|
a?c.roundNumber(a/1048576,1)+"MB":1024<=a?c.roundNumber(a/1024,0)+"KB":a+"B"};c.log=function(a){g.console&&g.console.log&&g.console.log(a)};c.getNotification=function(a){a=c.pInt(a);return c.isUnd(k[a])?"":k[a]};c.initNotificationLanguage=function(){k[f.Notification.InvalidToken]=c.i18n("NOTIFICATIONS/INVALID_TOKEN");k[f.Notification.AuthError]=c.i18n("NOTIFICATIONS/AUTH_ERROR");k[f.Notification.AccessError]=c.i18n("NOTIFICATIONS/ACCESS_ERROR");k[f.Notification.ConnectionError]=c.i18n("NOTIFICATIONS/CONNECTION_ERROR");
|
|
k[f.Notification.CaptchaError]=c.i18n("NOTIFICATIONS/CAPTCHA_ERROR");k[f.Notification.SocialFacebookLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");k[f.Notification.SocialTwitterLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");k[f.Notification.SocialGoogleLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");k[f.Notification.DomainNotAllowed]=c.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");k[f.Notification.AccountNotAllowed]=
|
|
c.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED");k[f.Notification.CantGetMessageList]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST");k[f.Notification.CantGetMessage]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");k[f.Notification.CantDeleteMessage]=c.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");k[f.Notification.CantMoveMessage]=c.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");k[f.Notification.CantSaveMessage]=c.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");k[f.Notification.CantSendMessage]=c.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");
|
|
k[f.Notification.InvalidRecipients]=c.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");k[f.Notification.CantCreateFolder]=c.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER");k[f.Notification.CantRenameFolder]=c.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");k[f.Notification.CantDeleteFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");k[f.Notification.CantDeleteNonEmptyFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");k[f.Notification.CantSubscribeFolder]=c.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");k[f.Notification.CantUnsubscribeFolder]=
|
|
c.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");k[f.Notification.CantSaveSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS");k[f.Notification.CantSavePluginSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");k[f.Notification.DomainAlreadyExists]=c.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");k[f.Notification.CantInstallPackage]=c.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");k[f.Notification.CantDeletePackage]=c.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");k[f.Notification.InvalidPluginPackage]=
|
|
c.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");k[f.Notification.UnsupportedPluginPackage]=c.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE");k[f.Notification.LicensingServerIsUnavailable]=c.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");k[f.Notification.LicensingExpired]=c.i18n("NOTIFICATIONS/LICENSING_EXPIRED");k[f.Notification.LicensingBanned]=c.i18n("NOTIFICATIONS/LICENSING_BANNED");k[f.Notification.DemoSendMessageError]=c.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");k[f.Notification.AccountAlreadyExists]=
|
|
c.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");k[f.Notification.MailServerError]=c.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR");k[f.Notification.UnknownNotification]=c.i18n("NOTIFICATIONS/UNKNOWN_ERROR");k[f.Notification.UnknownError]=c.i18n("NOTIFICATIONS/UNKNOWN_ERROR")};c.getUploadErrorDescByCode=function(a){var b="";switch(c.pInt(a)){case f.UploadErrorCode.FileIsTooBig:b=c.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case f.UploadErrorCode.FilePartiallyUploaded:b=c.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");
|
|
break;case f.UploadErrorCode.FileNoUploaded:b=c.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case f.UploadErrorCode.MissingTempFolder:b=c.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case f.UploadErrorCode.FileOnSaveingError:b=c.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case f.UploadErrorCode.FileType:b=c.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=c.i18n("UPLOAD/ERROR_UNKNOWN")}return b};c.killCtrlAandS=function(a){if(a=a||g.event){var b=a.target||a.srcElement,c=a.keyCode||a.which;if(a.ctrlKey&&
|
|
c===f.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&c===f.EventKeyCode.A)g.getSelection?g.getSelection().removeAllRanges():g.document.selection&&g.document.selection.clear&&g.document.selection.clear(),a.preventDefault()}};c.createCommand=function(a,b,h){var e=b?function(){e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};e.enabled=d.observable(!0);h=c.isUnd(h)?!0:h;e.canExecute=c.isFunc(h)?
|
|
d.computed(function(){return e.enabled()&&h.call(a)}):d.computed(function(){return e.enabled()&&!!h});return e};c.initDataConstructorBySettings=function(a){a.ignoreFolderSubscribe=d.observable(!1);a.editorDefaultType=d.observable(f.EditorDefaultType.Html);a.showImages=d.observable(!1);a.showAnimation=d.observable(!1);a.allowThemes=d.observable(!0);a.allowCustomLogin=d.observable(!1);a.allowLanguagesOnSettings=d.observable(!0);a.allowLanguagesOnLogin=d.observable(!0);a.desktopNotifications=d.observable(!1);
|
|
a.useThreads=d.observable(!0);a.replySameFolder=d.observable(!0);a.usePreviewPane=d.observable(!0);a.useCheckboxesInList=d.observable(!0);a.showAnimation.subscribe(function(a){B?V.removeClass("rl-anim").addClass("no-rl-anim"):V.toggleClass("rl-anim",a).toggleClass("no-rl-anim",!a)});a.showAnimation.valueHasMutated();a.desktopNotificationsPermisions=d.computed(function(){a.desktopNotifications();var b=f.DesktopNotifications.NotSupported;if(ba&&ba.permission)switch(ba.permission.toLowerCase()){case "granted":b=
|
|
f.DesktopNotifications.Allowed;break;case "denied":b=f.DesktopNotifications.Denied;break;case "default":b=f.DesktopNotifications.NotAllowed}else g.webkitNotifications&&g.webkitNotifications.checkPermission&&(b=g.webkitNotifications.checkPermission());return b});a.useDesktopNotifications=d.computed({read:function(){return a.desktopNotifications()&&f.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()},write:function(b){b?(b=a.desktopNotificationsPermisions(),f.DesktopNotifications.Allowed===
|
|
b?a.desktopNotifications(!0):f.DesktopNotifications.NotAllowed===b?ba.requestPermission(function(){a.desktopNotifications.valueHasMutated();f.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()?a.desktopNotifications()?a.desktopNotifications.valueHasMutated():a.desktopNotifications(!0):a.desktopNotifications()?a.desktopNotifications(!1):a.desktopNotifications.valueHasMutated()}):a.desktopNotifications(!1)):a.desktopNotifications(!1)}});a.language=d.observable("");a.languages=d.observableArray([]);
|
|
a.mainLanguage=d.computed({read:a.language,write:function(b){b!==a.language()?-1<c.inArray(b,a.languages())?a.language(b):0<a.languages().length&&a.language(a.languages()[0]):a.language.valueHasMutated()}});a.theme=d.observable("");a.themes=d.observableArray([]);a.mainTheme=d.computed({read:a.theme,write:function(b){if(b!==a.theme()){var h=a.themes();-1<c.inArray(b,h)?a.theme(b):0<h.length&&a.theme(h[0])}else a.theme.valueHasMutated()}});a.allowCustomTheme=d.observable(!0);a.allowAdditionalAccounts=
|
|
d.observable(!0);a.determineUserLanguage=d.observable(!1);a.messagesPerPage=d.observable(l.Defaults.MessagesPerPage);a.mainMessagesPerPage=a.messagesPerPage;a.mainMessagesPerPage=d.computed({read:a.messagesPerPage,write:function(b){-1<c.inArray(c.pInt(b),l.Defaults.MessagesPerPageArray)?b!==a.messagesPerPage()&&a.messagesPerPage(b):a.messagesPerPage.valueHasMutated()}});a.facebookEnable=d.observable(!1);a.facebookAppID=d.observable("");a.facebookAppSecret=d.observable("");a.twitterEnable=d.observable(!1);
|
|
a.twitterConsumerKey=d.observable("");a.twitterConsumerSecret=d.observable("");a.googleEnable=d.observable(!1);a.googleClientID=d.observable("");a.googleClientSecret=d.observable("");a.dropboxEnable=d.observable(!1);a.dropboxApiKey=d.observable("");a.contactsIsSupported=d.observable(!1);a.contactsIsAllowed=d.observable(!1)};c.createMomentDate=function(a){return d.computed(function(){la();return this.moment().fromNow()},a)};c.createMomentShortDate=function(a){return d.computed(function(){var a="",
|
|
a=moment(),h=this.moment(),d=this.momentDate();return a=4>=a.diff(h,"hours")?d:a.format("L")===h.format("L")?c.i18n("MESSAGE_LIST/TODAY_AT",{TIME:h.format("LT")}):a.clone().subtract("days",1).format("L")===h.format("L")?c.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:h.format("LT")}):a.year()===h.year()?h.format("D MMM."):h.format("LL")},a)};c.isFolderExpanded=function(a){var b=e.local().get(f.ClientSideKeyName.ExpandedFolders);return i.isArray(b)&&-1!==i.indexOf(b,a)};c.setExpandedFolder=function(a,b){var c=
|
|
e.local().get(f.ClientSideKeyName.ExpandedFolders);i.isArray(c)||(c=[]);b?(c.push(a),c=i.uniq(c)):c=i.without(c,a);e.local().set(f.ClientSideKeyName.ExpandedFolders,c)};c.initLayoutResizer=function(a,b,c,d,f,N,g,k){var d=d||300,f=f||500,N=N||f-d/2,g=g||300,x=0,r=j(a),l=j(b),n=j(c),b=e.local().get(k)||N,m=function(a,b,c){if(b||c)a=n.width(),b=b?100*(b.size.width/a):null,null===b&&c&&(b=100*(r.width()/a)),null!==b&&(r.css({width:"",height:"",right:""+(100-b)+"%"}),l.css({width:"",height:"",left:""+
|
|
b+"%"}))};b&&r.width(b);x=n.width()-g;x=f>x?x:f;r.resizable({minWidth:d,maxWidth:x,handles:"e",resize:m,stop:m});m(null,null,!0);I.resize(i.throttle(function(b,c){c&&(c.element&&c.element[0].id&&"#"+c.element[0].id===""+a)&&(x=n.width()-g,x=f>x?x:f,r.resizable("option","maxWidth",x),c.size&&c.size.width&&e.local().set(k,c.size.width),m(null,null,!0))},400))};c.initBlockquoteSwitcher=function(a){if(a){var b=j("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===j(this).parent().closest("blockquote",
|
|
a).length});b&&0<b.length&&b.each(function(){var a=j(this),b=a.height();if(0===b||100<b)a.addClass("rl-bq-switcher hidden-bq"),j('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>').insertBefore(a).click(function(){a.toggleClass("hidden-bq");c.windowResize()}).after("<br />").before("<br />")})}};c.removeBlockquoteSwitcher=function(a){a&&(j(a).find("blockquote.rl-bq-switcher").each(function(){j(this).removeClass("rl-bq-switcher hidden-bq")}),j(a).find(".rlBlockquoteSwitcher").each(function(){j(this).remove()}))};
|
|
c.extendAsViewModel=function(a,b){b&&(b.__name=a,n.regViewModelHook(a,b),i.extend(b.prototype,t.prototype))};c.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e};aa.push(a)};c.removeSettingsViewModel=function(a){na.push(a)};c.disableSettingsViewModel=function(a){oa.push(a)};c.convertThemeName=function(a){return c.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};c.convertLangName=function(a){return c.i18n("LANGS_NAMES/LANG_"+
|
|
a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)};c.fakeMd5=function(a){for(var b="",a=c.isUnd(a)?32:c.pInt(a);b.length<a;)b+="0123456789abcdefghijklmnopqrstuvwxyz".substr(g.Math.round(36*g.Math.random()),1);return b};c.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")};c.draggeblePlace=function(){return j('<div class="draggablePlace"><span class="text"></span> <i class="icon-envelope icon-white"></i></div>').appendTo("#rl-hidden")};
|
|
c.defautOptionsAfterRender=function(a,b){b&&!c.isUnd(b.disable)&&d.applyBindingsToNode(a,{disable:b.disable},b)};c.windowPopupKnockout=function(a,b,h,d){var e=null,f=g.open(""),i="__OpenerApplyBindingsUid"+c.fakeMd5()+"__",k=j("#"+b);g[i]=function(){if(f&&f.document.body&&k&&k[0]){var b=j(f.document.body);j("#rl-content",b).html(k.html());j("html",f.document).addClass("external "+j("html").attr("class"));c.i18nToNode(b);p.prototype.applyExternal(a,j("#rl-content",b)[0]);g[i]=null;d(f)}};f.document.open();
|
|
f.document.write('<html><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="robots" content="noindex, nofollow, noodp" /><title>'+c.encodeHtml(h)+'</title></head><body><div id="rl-content"></div></body></html>');f.document.close();e=f.document.createElement("script");e.type="text/javascript";e.innerHTML="if(window&&window.opener&&window.opener['"+
|
|
i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}";f.document.getElementsByTagName("head")[0].appendChild(e)};c.settingsSaveHelperFunction=function(a,b,h,d){h=h||null;d=c.isUnd(d)?1E3:c.pInt(d);return function(c,e,g,j,x){b.call(h,e&&e.Result?f.SaveSettingsStep.TrueResult:f.SaveSettingsStep.FalseResult);a&&a.call(h,c,e,g,j,x);i.delay(function(){b.call(h,f.SaveSettingsStep.Idle)},d)}};c.settingsSaveHelperSimpleFunction=function(a,b){return c.settingsSaveHelperFunction(null,a,b,1E3)};c.resizeAndCrop=
|
|
function(a,b,c){var d=new Image;d.onload=function(){var a=[0,0],d=document.createElement("canvas"),e=d.getContext("2d");d.width=b;d.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];e.fillStyle="#fff";e.fillRect(0,0,b,b);e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,b,b);c(d.toDataURL("image/jpeg"))};d.src=a};d.bindingHandlers.tooltip={init:function(a,b){if(!B){var h=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},
|
|
html:!0,trigger:"hover",title:function(){return'<span class="tooltip-class '+h+'">'+c.i18n(d.utils.unwrapObservable(b()))+"</span>"}})}}};d.bindingHandlers.tooltip2={init:function(a,b){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,title:function(){return'<span class="tooltip-class '+c+'">'+b()()+"</span>"}})}};d.bindingHandlers.popover={init:function(a,b){j(a).popover(d.utils.unwrapObservable(b()))}};d.bindingHandlers.resizecrop={init:function(a){j(a).addClass("resizecrop").resizecrop({width:"100",
|
|
height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,b){b()();j(a).resizecrop({width:"100",height:"100"})}};d.bindingHandlers.onEnter={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&13===g.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};d.bindingHandlers.onEsc={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&27===g.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};d.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,
|
|
show:d.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=d.utils.unwrapObservable(b());j(a).modal(c?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",c)},1)}};d.bindingHandlers.i18nInit={init:function(a){c.i18nToNode(a)}};d.bindingHandlers.i18nUpdate={update:function(a,b){d.utils.unwrapObservable(b());c.i18nToNode(a)}};d.bindingHandlers.link={update:function(a,b){j(a).attr("href",d.utils.unwrapObservable(b()))}};d.bindingHandlers.title={update:function(a,
|
|
b){j(a).attr("title",d.utils.unwrapObservable(b()))}};d.bindingHandlers.textF={init:function(a,b){j(a).text(d.utils.unwrapObservable(b()))}};d.bindingHandlers.initDom={init:function(a,b){b()(a)}};d.bindingHandlers.initResizeTrigger={init:function(a,b){var c=d.utils.unwrapObservable(b());j(a).css({height:c[1],"min-height":c[1]})},update:function(a,b){var h=d.utils.unwrapObservable(b()),e=c.pInt(h[1]),f=0,f=j(a).offset().top;0<f&&(f+=c.pInt(h[2]),f=I.height()-f,e<f&&(e=f),j(a).css({height:e,"min-height":e}))}};
|
|
d.bindingHandlers.appendDom={update:function(a,b){j(a).hide().empty().append(d.utils.unwrapObservable(b())).show()}};d.bindingHandlers.draggable={init:function(a,b,h){if(!B){var e=(h=h())&&h.droppableSelector?h.droppableSelector:"",h={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};e&&(h.drag=function(a){j(e).each(function(){var b=null,h=null,d=j(this),h=d.offset(),b=h.top+d.height();g.clearInterval(d.data("timerScroll"));d.data("timerScroll",!1);if(a.pageX>=
|
|
h.left&&a.pageX<=h.left+d.width()&&(a.pageY>=b-100&&a.pageY<=b&&(b=function(){d.scrollTop(d.scrollTop()+3);c.windowResize()},d.data("timerScroll",g.setInterval(b,10)),b()),a.pageY>=h.top&&a.pageY<=h.top+100))h=function(){d.scrollTop(d.scrollTop()-3);c.windowResize()},d.data("timerScroll",g.setInterval(h,10)),h()})},h.stop=function(){j(e).each(function(){g.clearInterval(j(this).data("timerScroll"));j(this).data("timerScroll",!1)})});h.helper=function(a){return b()(a&&a.target?d.dataFor(a.target):null)};
|
|
j(a).draggable(h).on("mousedown",function(){c.removeInFocus()})}}};d.bindingHandlers.droppable={init:function(a,b,c){if(!B){var d=b(),e=(b=c())&&b.droppableOver?b.droppableOver:null,f=b&&b.droppableOut?b.droppableOut:null,b={tolerance:"pointer",hoverClass:"droppableHover"};d&&(b.drop=function(a,b){d(a,b)},e&&(b.over=function(a,b){e(a,b)}),f&&(b.out=function(a,b){f(a,b)}),j(a).droppable(b))}}};d.bindingHandlers.nano={init:function(a){B||j(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}};
|
|
d.bindingHandlers.saveTrigger={init:function(a){j(a).append(' <i class="icon-spinner-2 animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger")},update:function(a,b){var c=d.utils.unwrapObservable(b()),e=j(a);switch(c.toString()){case "1":e.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case "0":e.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");
|
|
break;case "-2":e.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:e.find(".animated").hide().end().find(".error,.success").removeClass("visible")}}};d.bindingHandlers.select2={init:function(a,b){var h=0,f=null,wa=new g.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),N=new g.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),k=function(){return""},l=function(a){e.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,results:i.map(b,
|
|
function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};j(a).addClass("ko-select2").select2({query:function(a){a&&(0===h?(l(a),h=g.setTimeout(c.emptyFunction,100)):(g.clearInterval(h),h=g.setTimeout(function(){l(a)},100)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;if(null!==c)return c},formatResult:function(a,b,c,h){b=a&&a.c?a.c.select2Result(b):"";return""===b?h(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&wa.test(a)?{id:a,text:a}:null},
|
|
formatNoMatches:k,formatSearching:function(){return c.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:k,formatSelectionTooBig:k,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,openOnEnter:!1});d.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),h=0,d=a.length,e=null,g=[];h<d;h++)if((e=a[h])&&e.id)e.c||(e.c=new s,(f=N.exec(c.trim(e.id)))&&!c.isUnd(f[2])?(e.c.name=
|
|
f[1],e.c.email=f[2]):e.c.email=e.id),g.push(e.c);b()(g)})},update:function(a,b){for(var c=d.utils.unwrapObservable(b()),e=0,f=c.length,g=null,i="",k=[];e<f;e++)g=c[e],i=g.toLine(!1),k.push({id:i,text:i,c:g});j(a).select2("data",k)}};d.bindingHandlers.command={init:function(a,b,c,e){var f=j(a),g=b();if(!g||!g.enabled||!g.canExecute)throw Error("You are not using command function");f.addClass("command");d.bindingHandlers[f.is("form")?"submit":"click"].init.apply(e,arguments)},update:function(a,b){var c=
|
|
!0,d=j(a),e=b(),c=e.enabled();d.toggleClass("command-not-enabled",!c);c&&(c=e.canExecute(),d.toggleClass("command-can-not-be-execute",!c));d.toggleClass("command-disabled disable disabled",!c);(d.is("input")||d.is("button"))&&d.prop("disabled",!c)}};d.extenders.trimmer=function(a){var b=d.computed({read:a,write:function(b){a(c.trim(b.toString()))},owner:this});b(a());return b};d.extenders.reversible=function(a){var b=a();a.commit=function(){b=a()};a.reverse=function(){a(b)};a.commitedValue=function(){return b};
|
|
return a};d.extenders.toggleSubscribe=function(a,b){a.subscribe(b[1],b[0],"beforeChange");a.subscribe(b[2],b[0]);return a};d.extenders.falseTimeout=function(a,b){a.iTimeout=0;a.subscribe(function(h){h&&(g.clearTimeout(a.iTimeout),a.iTimeout=g.setTimeout(function(){a(!1);a.iTimeout=0},c.pInt(b)))});return a};d.observable.fn.validateEmail=function(){this.hasError=d.observable(!1);this.subscribe(function(a){a=c.trim(a);this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this);this.valueHasMutated();
|
|
return this};d.observable.fn.validateFunc=function(a){this.hasFuncError=d.observable(!1);c.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated());return this};m.prototype.root=function(){return this.sBase};m.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};m.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a};m.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+
|
|
"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};m.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"};m.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"};m.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"};m.prototype.change=function(a){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+g.encodeURIComponent(a)+"/"};m.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+
|
|
a};m.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};m.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};m.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"};m.prototype.settings=function(a){var b=this.sBase+"settings";!c.isUnd(a)&&""!==a&&(b+="/"+a);return b};m.prototype.admin=function(a){var b=this.sBase;switch(a){case "AdminDomains":b+="domains";break;case "AdminSecurity":b+="security";
|
|
break;case "AdminLicensing":b+="licensing"}return b};m.prototype.mailBox=function(a,b,h){var b=c.isNormal(b)?c.pInt(b):1,h=c.pString(h),d=this.sBase+"mailbox/";""!==a&&(d+=encodeURI(a));1<b&&(d=d.replace(/[\/]+$/,""),d+="/p"+b);""!==h&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(h));return d};m.prototype.phpInfo=function(){return this.sServer+"Info"};m.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"};m.prototype.getUserPicUrlFromHash=function(a){return this.sServer+
|
|
"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"};m.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"};m.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a};m.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+
|
|
"/images/preview.png"};m.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"};m.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};m.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};m.prototype.socialFacebook=function(){return this.sServer+
|
|
"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};n.oViewModelsHooks={};n.oSimpleHooks={};n.regViewModelHook=function(a,b){b&&(b.__hookName=a)};n.addHook=function(a,b){c.isFunc(b)&&(c.isArray(n.oSimpleHooks[a])||(n.oSimpleHooks[a]=[]),n.oSimpleHooks[a].push(b))};n.runHook=function(a,b){c.isArray(n.oSimpleHooks[a])&&(b=b||[],i.each(n.oSimpleHooks[a],function(a){a.apply(null,b)}))};n.mainSettingsGet=function(a){return e?e.settingsGet(a):null};n.remoteRequest=function(a,b,c,d,f,g){e&&
|
|
e.remote().defaultRequest(a,b,c,d,f,g)};n.settingsGet=function(a,b){var d=n.mainSettingsGet("Plugins");return(d=d&&c.isUnd(d[a])?null:d[a])?c.isUnd(d[b])?null:d[b]:null};O.supported=function(){return!0};O.prototype.set=function(a,b){var c=j.cookie(l.Values.ClientSideCookieIndexName),d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,j.cookie(l.Values.ClientSideCookieIndexName,JSON.stringify(e),{expires:30}),d=!0}catch(f){}return d};O.prototype.get=function(a){var b=j.cookie(l.Values.ClientSideCookieIndexName),
|
|
d=null;try{d=(d=null===b?null:JSON.parse(b))&&!c.isUnd(d[a])?d[a]:null}catch(e){}return d};P.supported=function(){return!!g.localStorage};P.prototype.set=function(a,b){var c=g.localStorage[l.Values.ClientSideCookieIndexName]||null,d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,g.localStorage[l.Values.ClientSideCookieIndexName]=JSON.stringify(e),d=!0}catch(f){}return d};P.prototype.get=function(a){var b=g.localStorage[l.Values.ClientSideCookieIndexName]||null,d=null;try{d=(d=null===
|
|
b?null:JSON.parse(b))&&!c.isUnd(d[a])?d[a]:null}catch(e){}return d};Q.prototype.oDriver=null;Q.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};Q.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null};ra.prototype.bootstart=function(){};t.prototype.sPosition="";t.prototype.sTemplate="";t.prototype.viewModelName="";t.prototype.viewModelDom=null;t.prototype.viewModelTemplate=function(){return this.sTemplate};t.prototype.viewModelPosition=function(){return this.sPosition};
|
|
t.prototype.cancelCommand=t.prototype.closeCommand=function(){};w.prototype.oCross=null;w.prototype.sScreenName="";w.prototype.aViewModels=[];w.prototype.viewModels=function(){return this.aViewModels};w.prototype.screenName=function(){return this.sScreenName};w.prototype.routes=function(){return null};w.prototype.__cross=function(){return this.oCross};w.prototype.__start=function(){var a=this.routes(),b=null,d=null;c.isNonEmptyArray(a)&&(d=i.bind(this.onRoute||c.emptyFunction,this),b=qa.create(),
|
|
i.each(a,function(a){b.addRoute(a[0],d).rules=a[1]}),this.oCross=b)};p.prototype.sDefaultScreenName="";p.prototype.oScreens={};p.prototype.oBoot=null;p.prototype.oCurrentScreen=null;p.prototype.showLoading=function(){j("#rl-loading").show()};p.prototype.hideLoading=function(){j("#rl-loading").hide()};p.prototype.routeOff=function(){z.changed.active=!1};p.prototype.routeOn=function(){z.changed.active=!0};p.prototype.setBoot=function(a){c.isNormal(a)&&(this.oBoot=a);return this};p.prototype.screen=
|
|
function(a){return""!==a&&!c.isUnd(this.oScreens[a])?this.oScreens[a]:null};p.prototype.delegateRun=function(a,b,d){a&&a[b]&&a[b].apply(a,c.isArray(d)?d:[])};p.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var h=new a(b),f=h.viewModelPosition(),g=j("#rl-content #rl-"+f.toLowerCase()),i=null;a.__builded=!0;a.__vm=h;h.data=e.data();h.viewModelName=a.__name;g&&1===g.length?(i=j("<div>").addClass("rl-view-model").addClass("RL-"+h.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+
|
|
h.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),h.viewModelDom=i,a.__dom=i,"Popups"===f&&(h.cancelCommand=h.closeCommand=c.createCommand(h,function(){q.hideScreenPopup(a)})),n.runHook("view-model-pre-build",[a.__name,h,i]),d.applyBindings(h,i[0]),this.delegateRun(h,"onBuild",[i]),n.runHook("view-model-post-build",[a.__name,h,i])):c.log("Cannot find view model position: "+f)}return a?a.__vm:null};p.prototype.applyExternal=function(a,b){a&&b&&d.applyBindings(a,b)};p.prototype.hideScreenPopup=
|
|
function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),i.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};p.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),n.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};p.prototype.screenOnRoute=function(a,b){var d=
|
|
this,e=null,f=null;""===c.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){e=this.screen(a);if(!e&&(e=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;e&&e.__started&&(e.__builded||(e.__builded=!0,c.isNonEmptyArray(e.viewModels())&&i.each(e.viewModels(),function(a){this.buildViewModel(a,e)},this),this.delegateRun(e,"onBuild")),i.defer(function(){if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onHide");c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),
|
|
function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);d.delegateRun(a.__vm,"onHide")}})}d.oCurrentScreen=e;if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onShow");n.runHook("screen-on-show",[d.oCurrentScreen.screenName(),d.oCurrentScreen]);c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);
|
|
d.delegateRun(a.__vm,"onShow");n.runHook("view-model-on-show",[a.__name,a.__vm])}},d)}(f=e.__cross())&&f.parse(b)}))}};p.prototype.startScreens=function(a){i.each(a,function(a){var c=(a=new a)?a.screenName():"";a&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),n.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),n.runHook("screen-post-start",
|
|
[a.screenName(),a]))},this);a=qa.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));z.initialized.add(a.parse,a);z.changed.add(a.parse,a);z.init()};p.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):a;a="/"===a.substr(0,1)?a.substr(1):a;(c.isUnd(b)?0:b)?(z.changed.active=!1,z.setHash(a),z.changed.active=!0):(z.changed.active=!0,z.setHash(a))};p.prototype.bootstart=function(){this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart();return this};q=new p;
|
|
s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null};s.prototype.name="";s.prototype.email="";s.prototype.privateType=null;s.prototype.validate=function(){return""!==this.name||""!==this.email};s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"};s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};s.prototype.type=function(){if(null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=
|
|
f.EmailType.Facebook),null===this.privateType))this.privateType=f.EmailType.Default;return this.privateType};s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};s.prototype.parse=function(a){var a=c.trim(a),b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};s.prototype.initByJson=function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&
|
|
(this.name=c.trim(a.Name),this.email=c.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};s.prototype.toLine=function(a,b){var d="";""!==this.email&&(b=c.isUnd(b)?!1:!!b,a&&""!==this.name?d=b?'<a href="mailto:'+c.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.name)+"</a>":this.name:(d=this.email,""!==this.name?d=b?c.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+c.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+
|
|
c.encodeHtml(d)+"</a>"+c.encodeHtml(">"):'"'+this.name+'" <'+d+">":b&&(d='<a href="mailto:'+c.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.email)+"</a>")));return d};s.prototype.select2Result=function(){var a="",b=e.cache().getUserPic(this.email),a=""!==b?a+('<img class="select2-user-pic pull-left" src="'+c.encodeHtml(b)+'" />'):a+('<img class="select2-user-pic pull-left" src="'+e.link().emptyContactPic()+'" />');f.EmailType.Facebook===this.type()?(a+=""+(0<this.name.length?
|
|
this.name:this.email),a+='<i class="icon-facebook pull-right select2-icon-result" />'):a+=""+(0<this.name.length?this.email+' <span class="select2-subname">('+this.name+")</span>":this.email);return a+""};s.prototype.select2Selection=function(a){var b="";if(f.EmailType.Facebook===this.type()){if(b=0<this.name.length?this.name:this.email,""!==b)return j("<pan>").text(b).appendTo(a),a.append('<i class="icon-facebook select2-icon"></i>'),null}else b=0<this.name.length?this.name+" ("+this.email+")":this.email;
|
|
return b};c.extendAsViewModel("PopupsDomainViewModel",C);C.prototype.onTestConnectionResponse=function(a,b){this.testing(!1);f.StorageResultType.Success===a&&b.Result?(this.testingDone(!0),this.testingImapError(!1===b.Result.Imap),this.testingSmtpError(!1===b.Result.Smtp)):(this.testingImapError(!0),this.testingSmtpError(!0))};C.prototype.onDomainCreateOrSaveResponse=function(a,b){this.saving(!1);f.StorageResultType.Success===a&&b?b.Result?(e.reloadDomainList(),this.closeCommand()):f.Notification.DomainAlreadyExists===
|
|
b.ErrorCode&&this.savingError("Domain already exists"):this.savingError("Unknown error")};C.prototype.onHide=function(){this.whiteListPage(!1)};C.prototype.onShow=function(a){this.saving(!1);this.whiteListPage(!1);this.testing(!1);this.testingDone(!1);this.testingImapError(!1);this.testingSmtpError(!1);this.clearForm();a&&(this.edit(!0),this.name(c.trim(a.Name)),this.imapServer(c.trim(a.IncHost)),this.imapPort(c.pInt(a.IncPort)),this.imapSecure(c.trim(a.IncSecure)),this.smtpServer(c.trim(a.OutHost)),
|
|
this.smtpPort(c.pInt(a.OutPort)),this.smtpSecure(c.trim(a.OutSecure)),this.smtpAuth(!!a.OutAuth),this.whiteList(c.trim(a.WhiteList)))};C.prototype.clearForm=function(){this.edit(!1);this.whiteListPage(!1);this.savingError("");this.name("");this.imapServer("");this.imapPort(l.Values.ImapDefaulPort);this.imapSecure(f.ServerSecure.None);this.smtpServer("");this.smtpPort(l.Values.SmtpDefaulPort);this.smtpSecure(f.ServerSecure.None);this.smtpAuth(!0);this.whiteList("")};c.extendAsViewModel("PopupsPluginViewModel",
|
|
R);R.prototype.onPluginSettingsUpdateResponse=function(a,b){f.StorageResultType.Success===a&&b&&b.Result?this.cancelCommand():(this.saveError(""),b&&b.ErrorCode?this.saveError(c.getNotification(b.ErrorCode)):this.saveError(c.getNotification(f.Notification.CantSavePluginSettings)))};R.prototype.onShow=function(a){this.name();this.readme();this.configures([]);a&&(this.name(a.Name),this.readme(a.Readme),a=a.Config,c.isNonEmptyArray(a)&&this.configures(i.map(a,function(a){return{value:d.observable(a[0]),
|
|
Name:a[1],Type:a[2],Label:a[3],Default:a[4],Desc:a[5]}})))};c.extendAsViewModel("PopupsActivateViewModel",S);S.prototype.onShow=function(){this.domain(e.settingsGet("AdminDomain"));this.activateProcess()||(this.key(""),this.activateText(""),this.activateText.isError(!1),this.activationSuccessed(!1),this.key.focus(!0))};S.prototype.validateSubscriptionKey=function(){var a=this.key();return""===a||!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(c.trim(a))};c.extendAsViewModel("PopupsLanguagesViewModel",T);T.prototype.onShow=
|
|
function(){this.exp(!0)};T.prototype.onHide=function(){this.exp(!1)};T.prototype.changeLanguage=function(a){e.data().mainLanguage(a);this.cancelCommand()};c.extendAsViewModel("AdminLoginViewModel",U);U.prototype.onShow=function(){q.routeOff();i.delay(i.bind(function(){this.loginFocus(!0)},this),100)};U.prototype.onHide=function(){this.loginFocus(!1)};c.extendAsViewModel("AdminMenuViewModel",da);da.prototype.link=function(a){return"#/"+a};c.extendAsViewModel("AdminPaneViewModel",ea);ea.prototype.logoutClick=
|
|
function(){e.remote().adminLogout(function(){e.loginAndLogoutReload()})};c.addSettingsViewModel(sa,"AdminGeneral","General","general",!0);sa.prototype.onBuild=function(){var a=this;i.delay(function(){var b=c.settingsSaveHelperSimpleFunction(a.titleTrigger,a),d=c.settingsSaveHelperSimpleFunction(a.languageTrigger,a),f=c.settingsSaveHelperSimpleFunction(a.themeTrigger,a);a.title.subscribe(function(a){e.remote().saveAdminConfig(b,{Title:c.trim(a)})});a.language.subscribe(function(a){e.remote().saveAdminConfig(d,
|
|
{Language:c.trim(a)})});a.theme.subscribe(function(a){e.remote().saveAdminConfig(f,{Theme:c.trim(a)})});a.allowCustomTheme.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowCustomTheme:a?"1":"0"})});a.allowAdditionalAccounts.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowAdditionalAccounts:a?"1":"0"})});a.determineUserLanguage.subscribe(function(a){e.remote().saveAdminConfig(null,{DetermineUserLanguage:a?"1":"0"})});a.allowThemes.subscribe(function(a){e.remote().saveAdminConfig(null,
|
|
{AllowThemes:a?"1":"0"})});a.allowCustomLogin.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowCustomLogin:a?"1":"0"})});a.allowLanguagesOnLogin.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowLanguagesOnLogin:a?"1":"0"})});a.allowLanguagesOnSettings.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowLanguagesOnSettings:a?"1":"0"})})},50)};c.addSettingsViewModel(D,"AdminDomains","Domains","domains");D.prototype.startDomainForDeletionTimeout=function(){var a=this;g.clearInterval(this.iDomainForDeletionTimeout);
|
|
this.iDomainForDeletionTimeout=g.setTimeout(function(){a.domainForDeletion(null)},3E3)};D.prototype.createDomain=function(){q.showScreenPopup(C)};D.prototype.deleteDomain=function(a){this.domains.remove(a);e.remote().domainDelete(i.bind(this.onDomainListChangeRequest,this),a.name)};D.prototype.disableDomain=function(a){a.disabled(!a.disabled());e.remote().domainDisable(i.bind(this.onDomainListChangeRequest,this),a.name,a.disabled())};D.prototype.onBuild=function(a){var b=this;a.on("click",".b-admin-domains-list-table .e-item .e-action",
|
|
function(){var a=d.dataFor(this);a&&e.remote().domain(i.bind(b.onDomainLoadRequest,b),a.name)});e.reloadDomainList()};D.prototype.onDomainLoadRequest=function(a,b){f.StorageResultType.Success===a&&(b&&b.Result)&&q.showScreenPopup(C,[b.Result])};D.prototype.onDomainListChangeRequest=function(){e.reloadDomainList()};c.addSettingsViewModel(L,"AdminLicensing","Licensing","licensing");L.prototype.onBuild=function(){this.subscriptionEnabled()&&e.reloadLicensing(!1)};L.prototype.onShow=function(){this.adminDomain(e.settingsGet("AdminDomain"))};
|
|
L.prototype.showActivationForm=function(){q.showScreenPopup(S)};L.prototype.licenseExpiredMomentValue=function(){var a=moment.unix(this.licenseExpired());return a.format("LL")+" ("+a.from(moment())+")"};c.addSettingsViewModel(M,"AdminSecurity","Security","security");M.prototype.onNewAdminPasswordResponse=function(a,b){f.StorageResultType.Success===a&&b&&b.Result?(this.adminPassword(""),this.adminPasswordNew(""),this.adminPasswordUpdateSuccess(!0)):this.adminPasswordUpdateError(!0)};M.prototype.onBuild=
|
|
function(){this.csrfProtection.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{TokenProtection:a?"1":"0"})});this.usageStatistics.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{UsageStatistics:a?"1":"0"})})};M.prototype.onHide=function(){this.adminPassword("");this.adminPasswordNew("")};M.prototype.phpInfoLink=function(){return e.link().phpInfo()};c.addSettingsViewModel(ta,"AdminSocial","Social","social");ta.prototype.onBuild=function(){var a=this;i.delay(function(){var b=
|
|
c.settingsSaveHelperSimpleFunction(a.facebookTrigger1,a),d=c.settingsSaveHelperSimpleFunction(a.facebookTrigger2,a),f=c.settingsSaveHelperSimpleFunction(a.twitterTrigger1,a),g=c.settingsSaveHelperSimpleFunction(a.twitterTrigger2,a),i=c.settingsSaveHelperSimpleFunction(a.googleTrigger1,a),j=c.settingsSaveHelperSimpleFunction(a.googleTrigger2,a),k=c.settingsSaveHelperSimpleFunction(a.dropboxTrigger1,a);a.facebookEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{FacebookEnable:a?
|
|
"1":"0"})});a.facebookAppID.subscribe(function(a){e.remote().saveAdminConfig(b,{FacebookAppID:c.trim(a)})});a.facebookAppSecret.subscribe(function(a){e.remote().saveAdminConfig(d,{FacebookAppSecret:c.trim(a)})});a.twitterEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{TwitterEnable:a?"1":"0"})});a.twitterConsumerKey.subscribe(function(a){e.remote().saveAdminConfig(f,{TwitterConsumerKey:c.trim(a)})});a.twitterConsumerSecret.subscribe(function(a){e.remote().saveAdminConfig(g,
|
|
{TwitterConsumerSecret:c.trim(a)})});a.googleEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{GoogleEnable:a?"1":"0"})});a.googleClientID.subscribe(function(a){e.remote().saveAdminConfig(i,{GoogleClientID:c.trim(a)})});a.googleClientSecret.subscribe(function(a){e.remote().saveAdminConfig(j,{GoogleClientSecret:c.trim(a)})});a.dropboxEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{DropboxEnable:a?"1":"0"})});a.dropboxApiKey.subscribe(function(a){e.remote().saveAdminConfig(k,
|
|
{DropboxApiKey:c.trim(a)})})},50)};c.addSettingsViewModel(F,"AdminPlugins","Plugins","plugins");F.prototype.disablePlugin=function(a){a.disabled(!a.disabled());e.remote().pluginDisable(this.onPluginDisableRequest,a.name,a.disabled())};F.prototype.configurePlugin=function(a){e.remote().plugin(this.onPluginLoadRequest,a.name)};F.prototype.onBuild=function(){this.enabledPlugins.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{EnabledPlugins:a?"1":"0"})})};F.prototype.onShow=function(){this.pluginsError("");
|
|
e.reloadPluginList()};F.prototype.onPluginLoadRequest=function(a,b){f.StorageResultType.Success===a&&(b&&b.Result)&&q.showScreenPopup(R,[b.Result])};F.prototype.onPluginDisableRequest=function(a,b){f.StorageResultType.Success===a&&b&&!b.Result&&b.ErrorCode&&(f.Notification.UnsupportedPluginPackage===b.ErrorCode&&b.ErrorMessage&&""!==b.ErrorMessage?this.pluginsError(b.ErrorMessage):this.pluginsError(c.getNotification(b.ErrorCode)));e.reloadPluginList()};c.addSettingsViewModel(K,"AdminPackages","Packages",
|
|
"packages");K.prototype.onShow=function(){this.packagesError("")};K.prototype.onBuild=function(){e.reloadPackagesList()};K.prototype.requestHelper=function(a,b){var d=this;return function(j,k){if(f.StorageResultType.Success!==j||!k||!k.Result)k&&k.ErrorCode?d.packagesError(c.getNotification(k.ErrorCode)):d.packagesError(c.getNotification(b?f.Notification.CantInstallPackage:f.Notification.CantDeletePackage));i.each(e.data().packages(),function(b){b&&(a&&b.loading()&&a.file===b.file)&&(a.loading(!1),
|
|
b.loading(!1))});f.StorageResultType.Success===j&&k&&k.Result&&k.Result.Reload?g.location.reload():e.reloadPackagesList()}};K.prototype.deletePackage=function(a){a&&(a.loading(!0),e.remote().packageDelete(this.requestHelper(a,!1),a))};K.prototype.installPackage=function(a){a&&(a.loading(!0),e.remote().packageInstall(this.requestHelper(a,!0),a))};fa.prototype.populateDataOnStart=function(){var a=e.settingsGet("Languages"),b=e.settingsGet("Themes");c.isArray(a)&&this.languages(a);c.isArray(b)&&this.themes(b);
|
|
this.mainLanguage(e.settingsGet("Language"));this.mainTheme(e.settingsGet("Theme"));this.allowCustomTheme(!!e.settingsGet("AllowCustomTheme"));this.allowAdditionalAccounts(!!e.settingsGet("AllowAdditionalAccounts"));this.determineUserLanguage(!!e.settingsGet("DetermineUserLanguage"));this.allowThemes(!!e.settingsGet("AllowThemes"));this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"));this.allowLanguagesOnLogin(!!e.settingsGet("AllowLanguagesOnLogin"));this.allowLanguagesOnSettings(!!e.settingsGet("AllowLanguagesOnSettings"));
|
|
this.ignoreFolderSubscribe(!!e.settingsGet("IgnoreFolderSubscribe"));this.editorDefaultType(e.settingsGet("EditorDefaultType"));this.showImages(!!e.settingsGet("ShowImages"));this.showAnimation(!!e.settingsGet("ShowAnimation"));this.mainMessagesPerPage(e.settingsGet("MPP"));this.desktopNotifications(!!e.settingsGet("DesktopNotifications"));this.useThreads(!!e.settingsGet("UseThreads"));this.replySameFolder(!!e.settingsGet("ReplySameFolder"));this.usePreviewPane(!!e.settingsGet("UsePreviewPane"));
|
|
this.useCheckboxesInList(!!e.settingsGet("UseCheckboxesInList"));this.facebookEnable(!!e.settingsGet("AllowFacebookSocial"));this.facebookAppID(e.settingsGet("FacebookAppID"));this.facebookAppSecret(e.settingsGet("FacebookAppSecret"));this.twitterEnable(!!e.settingsGet("AllowTwitterSocial"));this.twitterConsumerKey(e.settingsGet("TwitterConsumerKey"));this.twitterConsumerSecret(e.settingsGet("TwitterConsumerSecret"));this.googleEnable(!!e.settingsGet("AllowGoogleSocial"));this.googleClientID(e.settingsGet("GoogleClientID"));
|
|
this.googleClientSecret(e.settingsGet("GoogleClientSecret"));this.dropboxEnable(!!e.settingsGet("AllowDropboxSocial"));this.dropboxApiKey(e.settingsGet("DropboxApiKey"));this.contactsIsSupported(!!e.settingsGet("ContactsIsSupported"));this.contactsIsAllowed(!!e.settingsGet("ContactsIsAllowed"))};i.extend(ga.prototype,fa.prototype);ga.prototype.populateDataOnStart=function(){fa.prototype.populateDataOnStart.call(this)};G.prototype.oRequests={};G.prototype.defaultResponse=function(a,b,d,j,k,l){var m=
|
|
function(){f.StorageResultType.Success!==d&&ja&&(d=f.StorageResultType.Unload);if(f.StorageResultType.Success===d&&j&&!j.Result){if(j&&-1<c.inArray(j.ErrorCode,[f.Notification.AuthError,f.Notification.AccessError,f.Notification.ConnectionError,f.Notification.DomainNotAllowed,f.Notification.AccountNotAllowed,f.Notification.MailServerError,f.Notification.UnknownNotification,f.Notification.UnknownError])&&W++,j&&f.Notification.InvalidToken===j.ErrorCode&&X++,10<X&&e.loginAndLogoutReload(!0),j.Logout||
|
|
7<W)g.__rlah_clear&&g.__rlah_clear(),e.loginAndLogoutReload(!0)}else f.StorageResultType.Success===d&&(j&&j.Result)&&(X=W=0);a&&(n.runHook("ajax-default-response",[b,f.StorageResultType.Success===d?j:null,d,k,l]),a(d,f.StorageResultType.Success===d?j:null,k,b,l))};switch(d){case "success":d=f.StorageResultType.Success;break;case "abort":d=f.StorageResultType.Abort;break;default:d=f.StorageResultType.Error}f.StorageResultType.Error===d?i.delay(m,300):m()};G.prototype.ajaxRequest=function(a,b,d,f,k){var l=
|
|
this,m=""===f,n=(new g.Date).getTime(),o=null,r="",b=b||{},d=c.isNormal(d)?d:2E4,f=c.isUnd(f)?"":c.pString(f),k=c.isArray(k)?k:[];(r=b.Action||"")&&0<k.length&&i.each(k,function(a){l.oRequests[a]&&(l.oRequests[a].__aborted=!0,l.oRequests[a].abort&&l.oRequests[a].abort(),l.oRequests[a]=null)});m&&(b.XToken=e.settingsGet("Token"));o=j.ajax({type:m?"POST":"GET",url:e.link().ajax(f),async:!0,dataType:"json",data:m?b:{},headers:{},timeout:d,global:!0});o.always(function(d,e){var f=!1;d&&d.Time&&(f=c.pInt(d.Time)>
|
|
(new g.Date).getTime()-n);r&&l.oRequests[r]&&(l.oRequests[r].__aborted&&(e="abort"),l.oRequests[r]=null);l.defaultResponse(a,r,e,d,f,b)});r&&(0<k.length&&-1<c.inArray(r,k))&&(this.oRequests[r]&&(this.oRequests[r].__aborted=!0,this.oRequests[r].abort&&this.oRequests[r].abort(),this.oRequests[r]=null),this.oRequests[r]=o);return o};G.prototype.defaultRequest=function(a,b,d,e,f,g){d=d||{};d.Action=b;f=c.pString(f);n.runHook("ajax-default-request",[b,d,f]);this.ajaxRequest(a,d,c.isUnd(e)?l.Defaults.DefaultAjaxTimeout:
|
|
c.pInt(e),f,g)};G.prototype.noop=function(a){this.defaultRequest(a,"Noop")};G.prototype.jsError=function(a,b,c,d,e,f){this.defaultRequest(a,"JsError",{Message:b,FileName:c,LineNo:d,Location:e,HtmlCapa:f})};i.extend(o.prototype,G.prototype);o.prototype.adminLogin=function(a,b,c){this.defaultRequest(a,"AdminLogin",{Login:b,Password:c})};o.prototype.adminLogout=function(a){this.defaultRequest(a,"AdminLogout")};o.prototype.saveAdminConfig=function(a,b){this.defaultRequest(a,"AdminSettingsUpdate",b)};
|
|
o.prototype.domainList=function(a){this.defaultRequest(a,"AdminDomainList")};o.prototype.pluginList=function(a){this.defaultRequest(a,"AdminPluginList")};o.prototype.packagesList=function(a){this.defaultRequest(a,"AdminPackagesList")};o.prototype.packageInstall=function(a,b){this.defaultRequest(a,"AdminPackageInstall",{Id:b.id,Type:b.type,File:b.file})};o.prototype.packageDelete=function(a,b){this.defaultRequest(a,"AdminPackageDelete",{Id:b.id})};o.prototype.domain=function(a,b){this.defaultRequest(a,
|
|
"AdminDomainLoad",{Name:b})};o.prototype.plugin=function(a,b){this.defaultRequest(a,"AdminPluginLoad",{Name:b})};o.prototype.domainDelete=function(a,b){this.defaultRequest(a,"AdminDomainDelete",{Name:b})};o.prototype.domainDisable=function(a,b,c){return this.defaultRequest(a,"AdminDomainDisable",{Name:b,Disabled:c?"1":"0"})};o.prototype.pluginSettingsUpdate=function(a,b){return this.defaultRequest(a,"AdminPluginSettingsUpdate",b)};o.prototype.licensing=function(a,b){return this.defaultRequest(a,"AdminLicensing",
|
|
{Force:b?"1":"0"})};o.prototype.licensingActivate=function(a,b,c){return this.defaultRequest(a,"AdminLicensingActivate",{Domain:b,Key:c})};o.prototype.pluginDisable=function(a,b,c){return this.defaultRequest(a,"AdminPluginDisable",{Name:b,Disabled:c?"1":"0"})};o.prototype.createOrUpdateDomain=function(a,b,c,d,e,f,g,i,j,k,l){this.defaultRequest(a,"AdminDomainSave",{Create:b?"1":"0",Name:c,IncHost:d,IncPort:e,IncSecure:f,OutHost:g,OutPort:i,OutSecure:j,OutAuth:k?"1":"0",WhiteList:l})};o.prototype.testConnectionForDomain=
|
|
function(a,b,c,d,e,f,g,i){this.defaultRequest(a,"AdminDomainTest",{IncHost:b,IncPort:c,IncSecure:d,OutHost:e,OutPort:f,OutSecure:g,OutAuth:i?"1":"0"})};o.prototype.saveNewAdminPassword=function(a,b){this.defaultRequest(a,"AdminPasswordUpdate",b)};o.prototype.adminPing=function(a){this.defaultRequest(a,"AdminPing")};E.prototype.oEmailsPicsHashes={};E.prototype.oServices={};E.prototype.clear=function(){this.oServices={};this.oEmailsPicsHashes={}};E.prototype.getUserPic=function(a){var b="",b="",b=a.toLowerCase(),
|
|
d=c.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];""===d?(b=b.substr(a.indexOf("@")+1),b=""!==b&&this.oServices[b]?this.oServices[b]:""):b=e.link().getUserPicUrlFromHash(d);return b};E.prototype.setServicesData=function(a){this.oServices=a};E.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a};i.extend(ua.prototype,E.prototype);i.extend(H.prototype,w.prototype);H.prototype.onRoute=function(a){var b=this,f=null,g=null,k=null,l=null;if(g=i.find(aa,function(b){return b&&
|
|
b.__rlSettingsData&&a===b.__rlSettingsData.Route}))i.find(na,function(a){return a&&a===g})&&(g=null),g&&i.find(oa,function(a){return a&&a===g})&&(g=null);g&&(g.__builded&&g.__vm?f=g.__vm:(k=this.oViewModelPlace)&&1===k.length?(f=new g,l=j("<div></div>").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),l.appendTo(k),f.data=e.data(),f.viewModelDom=l,f.viewModelDom.addClass("rl-animation-margin"),f.__rlSettingsData=g.__rlSettingsData,
|
|
g.__dom=l,g.__builded=!0,g.__vm=f,d.applyBindings(f,l[0]),q.delegateRun(f,"onBuild",[l])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),f&&i.defer(function(){if(b.oCurrentSubScreen){q.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide();b.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin")}b.oCurrentSubScreen=f;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();q.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),
|
|
function(a){a.selected(f&&f.__rlSettingsData&&a.route===f.__rlSettingsData.Route)});j("#rl-content .b-settings .b-content .content").scrollTop(0);b.oCurrentSubScreen.viewModelDom.removeClass("rl-animation-margin")}c.windowResize()}))};H.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(q.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide(),this.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin"))};H.prototype.onBuild=
|
|
function(){i.each(aa,function(a){a&&(a.__rlSettingsData&&!i.find(na,function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:d.observable(!1),disabled:!!i.find(oa,function(b){return b&&b===a})})},this);this.oViewModelPlace=j("#rl-content #rl-settings-subscreen")};H.prototype.routes=function(){var a=i.find(aa,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,
|
|
normalize_:function(a,d){d.subname=c.isUnd(d.subname)?b:c.pString(d.subname);return[d.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(ha.prototype,w.prototype);ha.prototype.onShow=function(){e.setTitle("")};i.extend(ia.prototype,H.prototype);ia.prototype.onShow=function(){e.setTitle("")};i.extend(u.prototype,ra.prototype);u.prototype.oSettings=null;u.prototype.oLink=null;u.prototype.download=function(a){B?g.open(a):this.iframe.attr("src",a)};u.prototype.link=function(){null===
|
|
this.oLink&&(this.oLink=new m);return this.oLink};u.prototype.local=function(){null===this.oLocal&&(this.oLocal=new Q);return this.oLocal};u.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=c.isNormal(Z)?Z:{});return c.isUnd(this.oSettings[a])?null:this.oSettings[a]};u.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=c.isNormal(Z)?Z:{});this.oSettings[a]=b};u.prototype.setTitle=function(a){a=(0<a.length?a+" - ":"")+this.settingsGet("Title")||"";a!==
|
|
g.document.title&&(g.document.title=a)};u.prototype.loginAndLogoutReload=function(a,b){var d=c.pString(this.settingsGet("CustomLogoutLink")),f=!!this.settingsGet("InIframe"),a=c.isUnd(a)?!1:!!a,b=c.isUnd(b)?!1:!!b;a&&(b&&g.close)&&g.close();a&&""!==d&&g.location.href!==d?i.defer(function(){f&&g.parent?g.parent.location.href=d:g.location.href=d}):(q.routeOff(),q.setHash(e.link().root(),!0),q.routeOff(),i.defer(function(){f&&g.parent?g.parent.location.reload():g.location.reload()}))};u.prototype.getAutocomplete=
|
|
function(a,b,c){c([],a)};u.prototype.bootstart=function(){c.initOnStartOrLangChange(function(){c.initNotificationLanguage()},null);i.delay(function(){c.windowResize()},1E3)};i.extend(v.prototype,u.prototype);v.prototype.oData=null;v.prototype.oRemote=null;v.prototype.oCache=null;v.prototype.data=function(){null===this.oData&&(this.oData=new ga);return this.oData};v.prototype.remote=function(){null===this.oRemote&&(this.oRemote=new o);return this.oRemote};v.prototype.cache=function(){null===this.oCache&&
|
|
(this.oCache=new ua);return this.oCache};v.prototype.reloadDomainList=function(){e.data().domainsLoading(!0);e.remote().domainList(function(a,b){e.data().domainsLoading(!1);if(f.StorageResultType.Success===a&&b&&b.Result){var c=i.map(b.Result,function(a,b){return{name:b,disabled:d.observable(!a),deleteAccess:d.observable(!1)}},this);e.data().domains(c)}})};v.prototype.reloadPluginList=function(){e.data().pluginsLoading(!0);e.remote().pluginList(function(a,b){e.data().pluginsLoading(!1);if(f.StorageResultType.Success===
|
|
a&&b&&b.Result){var c=i.map(b.Result,function(a){return{name:a.Name,disabled:d.observable(!a.Enabled),configured:d.observable(!!a.Configured)}},this);e.data().plugins(c)}})};v.prototype.reloadPackagesList=function(){e.data().packagesLoading(!0);e.data().packagesReal(!0);e.remote().packagesList(function(a,b){e.data().packagesLoading(!1);if(f.StorageResultType.Success===a&&b&&b.Result){e.data().packagesReal(!!b.Result.Real);e.data().packagesMainUpdatable(!!b.Result.MainUpdatable);var g=[],j={};i.each(e.data().packages(),
|
|
function(a){a&&a.loading()&&(j[a.file]=a)});c.isArray(b.Result.List)&&(g=i.map(b.Result.List,function(a){a.loading=d.observable(!c.isUnd(j[a.file]));return a},this));e.data().packages(g)}else e.data().packagesReal(!1)})};v.prototype.reloadLicensing=function(a){a=c.isUnd(a)?!1:!!a;e.data().licensingProcess(!0);e.data().licenseError("");e.remote().licensing(function(a,d){e.data().licensingProcess(!1);f.StorageResultType.Success===a&&d&&d.Result&&c.isNormal(d.Result.Expired)?(e.data().licenseValid(!0),
|
|
e.data().licenseExpired(c.pInt(d.Result.Expired)),e.data().licenseError(""),e.data().licensing(!0)):d&&d.ErrorCode&&-1<c.inArray(c.pInt(d.ErrorCode),[f.Notification.LicensingServerIsUnavailable,f.Notification.LicensingExpired])?(e.data().licenseError(c.getNotification(c.pInt(d.ErrorCode))),e.data().licensing(!0)):f.StorageResultType.Abort===a?(e.data().licenseError(c.getNotification(f.Notification.LicensingServerIsUnavailable)),e.data().licensing(!0)):e.data().licensing(!1)},a)};v.prototype.bootstart=
|
|
function(){u.prototype.bootstart.call(this);e.data().populateDataOnStart();q.hideLoading();this.settingsGet("AllowAdminPanel")?this.settingsGet("Auth")?(q.startScreens([ia]),B||i.defer(function(){c.initLayoutResizer("#rl-top-resizer-left","#rl-top-resizer-right","#rl-center",120,300,200,600,f.ClientSideKeyName.FolderListSize)})):q.startScreens([ha]):(q.routeOff(),q.setHash(e.link().root(),!0),q.routeOff(),i.defer(function(){g.location.href="/"}));g.SimplePace&&g.SimplePace.set(100)};e=new v;V.addClass(B?
|
|
"mobile":"no-mobile");I.keydown(c.killCtrlAandS).keyup(c.killCtrlAandS);I.unload(function(){ja=!0});g.rl=g.rl||{};g.rl.addHook=n.addHook;g.rl.settingsGet=n.mainSettingsGet;g.rl.remoteRequest=n.remoteRequest;g.rl.pluginSettingsGet=n.settingsGet;g.rl.addSettingsViewModel=c.addSettingsViewModel;g.rl.createCommand=c.createCommand;g.rl.EmailModel=s;g.rl.Enums=f;g.__RLBOOT=function(a){j(function(){g.rainloopTEMPLATES&&g.rainloopTEMPLATES[0]?(j("#rl-templates").html(g.rainloopTEMPLATES[0]),g.setInterval(function(){la(!la())},
|
|
6E4),i.delay(function(){g.rainloopAppData={};g.rainloopI18N={};g.rainloopTEMPLATES={};q.setBoot(e).bootstart()},50)):a(!1);g.__RLBOOT=null})};g.SimplePace&&g.SimplePace.add(10)})(window,jQuery,ko,crossroads,hasher,_); |