|
|
|
|
@@ -1,377 +0,0 @@
|
|
|
|
|
(function(h,j,f,Ya,Q,aa,ta,i){function B(){this.sBase="#/";this.sCdnStaticDomain=e.settingsGet("CdnStaticDomain");this.sVersion=e.settingsGet("Version");this.sSpecSuffix=e.settingsGet("AuthAccountHash")||"0";this.sServer="./?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function t(a,b,c,m){this.oOptions=m=j.extend({DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",
|
|
|
|
|
LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"},d.isUnd(m)?{}:m);this.bOnlyPlain=!!this.oOptions.DisableHtml;this.fOnSwitch=this.oOptions.onSwitch;this.textarea=j(a).empty().addClass("editorTextArea");this.htmlarea=j(b).empty().addClass("editorHtmlArea").prop("contentEditable","true");this.toolbar=j(c).empty().addClass("editorToolbar");t.htmlInitEditor.apply(this);t.htmlInitToolbar.apply(this);t.htmlAttachEditorEvents.apply(this);this.bOnlyPlain&&
|
|
|
|
|
this.toolbar.hide()}function L(a,b,c,m,e){this.list=a;this.selectedItem=b;this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.oContentScrollable=this.oContentVisible=null;this.sItemSelector=c;this.sItemSelectedSelector=m;this.sItemCheckedSelector=e;this.sLastUid="";this.oCallbacks={};this.iSelectTimer=0;this.bUseKeyboard=!0;this.emptyFunction=function(){};this.useItemSelectCallback=!0;this.throttleSelection=!1;this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&
|
|
|
|
|
(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],k=null;this.list.subscribe(function(){var a=this,b=this.list();d.isArray(b)&&i.each(b,function(b){b.checked()&&g.push(a.getItemUid(b));null===k&&b.selected()&&(k=a.getItemUid(b))})},this,"beforeChange");this.list.subscribe(function(a){this.useItemSelectCallback=!1;this.selectedItem(null);if(d.isArray(a)){var b=this,c=g.length;i.each(a,function(a){0<c&&-1<d.inArray(b.getItemUid(a),
|
|
|
|
|
g)&&(a.checked(!0),c--);null!==k&&k===b.getItemUid(a)&&(a.selected(!0),k=null,b.selectedItem(a))})}this.useItemSelectCallback=!0;g=[];k=null},this);this.list.setSelectedByUid=function(a){f.selectByUid(a,!1)};this.selectItemCallbacksThrottle=i.debounce(this.selectItemCallbacks,300)}function ua(){}function va(){}function wa(){var a=i.find([va,ua],function(a){return a.supported()});a&&(this.oDriver=new a)}function Za(){}function C(a,b){this.sPosition=d.pString(a);this.sTemplate=d.pString(b);this.viewModelName=
|
|
|
|
|
"";this.viewModelVisibility=f.observable(!1);"Popups"===this.sPosition&&(this.modalVisibility=f.observable(!1));this.viewModelDom=null}function K(a,b){this.sScreenName=a;this.aViewModels=d.isArray(b)?b:[]}function E(){this.sDefaultScreenName="";this.oScreens={};this.oCurrentScreen=this.oBoot=null;this.popupVisibility=f.observable(!1);this.popupVisibility.subscribe(function(a){e&&e.popupVisibility(a)})}function F(a,b){this.email=a||"";this.name=b||"";this.privateType=null;this.clearDuplicateName()}
|
|
|
|
|
function la(){this.idContact=0;this.name=this.listName=this.imageHash="";this.emails=[];this.checked=f.observable(!1);this.selected=f.observable(!1);this.deleted=f.observable(!1)}function D(){this.fileName=this.mimeType="";this.estimatedSize=0;this.friendlySize="";this.isLinked=this.isInline=!1;this.mimeIndex=this.uid=this.folder=this.download=this.cidWithOutTags=this.cid=""}function N(a,b,c,m,e,r){this.id=a;this.isInline=d.isUnd(m)?!1:!!m;this.isLinked=d.isUnd(e)?!1:!!e;this.CID=d.isUnd(r)?"":r;
|
|
|
|
|
this.fromMessage=!1;this.fileName=f.observable(b);this.size=f.observable(d.isUnd(c)?null:c);this.tempName=f.observable("");this.progress=f.observable("");this.error=f.observable("");this.waiting=f.observable(!0);this.uploading=f.observable(!1);this.enabled=f.observable(!0);this.friendlySize=f.computed(function(){return null===this.size()?"":d.friendlySize(this.size())},this)}function l(){this.requestHash=this.uid=this.folderFullNameRaw="";this.subject=f.observable("");this.size=f.observable(0);this.dateTimeStampInUTC=
|
|
|
|
|
f.observable(0);this.priority=f.observable(g.MessagePriority.Normal);this.fromEmailString=f.observable("");this.toEmailsString=f.observable("");this.senderEmailsString=f.observable("");this.prefetched=!1;this.emails=[];this.from=[];this.to=[];this.cc=[];this.bcc=[];this.replyTo=[];this.newForAnimation=f.observable(!1);this.deleted=f.observable(!1);this.unseen=f.observable(!1);this.flagged=f.observable(!1);this.answered=f.observable(!1);this.forwarded=f.observable(!1);this.selected=f.observable(!1);
|
|
|
|
|
this.checked=f.observable(!1);this.hasAttachments=f.observable(!1);this.moment=f.observable(aa());this.fullFormatDateValue=f.computed(function(){return l.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this);this.fullFormatDateValue=f.computed(function(){return l.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this);this.momentDate=d.createMomentDate(this);this.momentShortDate=d.createMomentShortDate(this);this.dateTimeStampInUTC.subscribe(function(a){var b=aa().unix();this.moment(aa.unix(b<
|
|
|
|
|
a?b:a))},this);this.body=null;this.isHtml=f.observable(!1);this.hasImages=f.observable(!1);this.attachments=f.observableArray([]);this.priority=f.observable(g.MessagePriority.Normal);this.aDraftInfo=[];this.sReferences=this.sInReplyTo=this.sMessageId="";this.parentUid=f.observable(0);this.threads=f.observableArray([]);this.threadsLen=f.observable(0);this.hasUnseenSubMessage=f.observable(!1);this.hasFlaggedSubMessage=f.observable(!1);this.lastInCollapsedThread=f.observable(!1);this.lastInCollapsedThreadLoading=
|
|
|
|
|
f.observable(!1);this.threadsLenResult=f.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&0<a?a+1:""},this)}function G(){this.name=f.observable("");this.namespace=this.delimiter=this.fullNameHash=this.fullNameRaw=this.fullName="";this.deep=0;this.selectable=!1;this.existen=!0;this.isUnpaddigFolder=this.isGmailFolder=this.isNamespaceFolder=!1;this.type=f.observable(g.FolderType.User);this.selected=f.observable(!1);this.edited=f.observable(!1);this.collapsed=f.observable(!0);
|
|
|
|
|
this.subScribed=f.observable(!0);this.subFolders=f.observableArray([]);this.deleteAccess=f.observable(!1);this.actionBlink=f.observable(!1).extend({falseTimeout:1E3});this.nameForEdit=f.observable("");this.name.subscribe(function(a){this.nameForEdit(a)},this);this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this);this.canBeEdited=f.computed(function(){return g.FolderType.User===this.type()},this);this.privateMessageCountAll=f.observable(0);this.privateMessageCountUnread=f.observable(0);
|
|
|
|
|
this.collapsedPrivate=f.observable(!0)}function Na(a,b){this.email=a;this.deleteAccess=f.observable(!1);this.canBeDalete=f.observable(b)}function xa(){C.call(this,"Popups","PopupsFolderClear");this.selectedFolder=f.observable(null);this.clearingProcess=f.observable(!1);this.clearingError=f.observable("");this.folderFullNameForClear=f.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this);this.folderNameForClear=f.computed(function(){var a=this.selectedFolder();return a?
|
|
|
|
|
a.localName():""},this);this.dangerDescHtml=f.computed(function(){return d.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this);this.clearCommand=d.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(e.data().message(null),e.data().messageList([]),this.clearingProcess(!0),e.cache().setFolderHash(b.fullNameRaw,""),e.remote().folderClear(function(b,m){a.clearingProcess(!1);g.StorageResultType.Success===b&&m&&m.Result?(e.reloadMessageList(!0),a.cancelCommand()):
|
|
|
|
|
m&&m.ErrorCode?a.clearingError(d.getNotification(m.ErrorCode)):a.clearingError(d.getNotification(g.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder();return!this.clearingProcess()&&null!==a})}function ca(){C.call(this,"Popups","PopupsFolderCreate");d.initOnStartOrLangChange(function(){this.sNoParentText=d.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this);this.folderName=f.observable("");this.focusTrigger=f.observable(!1);this.selectedParentValue=f.observable(n.Values.UnuseOptionValue);
|
|
|
|
|
this.parentFolderSelectList=f.computed(function(){var a=e.data(),b=[],c=null,m=a.folderList();b.push(["",this.sNoParentText]);""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)});return e.folderListOptionsBuilder([],m,[],b,null,c,null,function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""})},this);this.createFolder=d.createCommand(this,function(){var a=e.data(),b=this.selectedParentValue();""===b&&1<a.namespace.length&&
|
|
|
|
|
(b=a.namespace.substr(0,a.namespace.length-1));a.foldersCreating(!0);e.remote().folderCreate(function(a,b){e.data().foldersCreating(!1);g.StorageResultType.Success===a&&b&&b.Result?e.folders(!1):e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),b);this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())});this.defautOptionsAfterRender=d.defautOptionsAfterRender}function Y(){C.call(this,
|
|
|
|
|
"Popups","PopupsFolderSystem");d.initOnStartOrLangChange(function(){this.sChooseOnText=d.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE");this.sUnuseText=d.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this);this.notification=f.observable("");this.folderSelectList=f.computed(function(){return e.folderListOptionsBuilder([],e.data().folderList(),e.data().folderListSystemNames(),[["",this.sChooseOnText],[n.Values.UnuseOptionValue,this.sUnuseText]])},this);var a=e.data(),b=this,c=null,m=null;this.sentFolder=
|
|
|
|
|
a.sentFolder;this.draftFolder=a.draftFolder;this.spamFolder=a.spamFolder;this.trashFolder=a.trashFolder;c=i.debounce(function(){e.settingsSet("SentFolder",b.sentFolder());e.settingsSet("DraftFolder",b.draftFolder());e.settingsSet("SpamFolder",b.spamFolder());e.settingsSet("TrashFolder",b.trashFolder());e.remote().saveSystemFolders(d.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder()})},1E3);m=function(){e.settingsSet("SentFolder",
|
|
|
|
|
b.sentFolder());e.settingsSet("DraftFolder",b.draftFolder());e.settingsSet("SpamFolder",b.spamFolder());e.settingsSet("TrashFolder",b.trashFolder());c()};this.sentFolder.subscribe(m);this.draftFolder.subscribe(m);this.spamFolder.subscribe(m);this.trashFolder.subscribe(m);this.defautOptionsAfterRender=d.defautOptionsAfterRender}function y(){C.call(this,"Popups","PopupsCompose");this.aDraftInfo=this.oEditor=null;this.sInReplyTo="";this.bFromDraft=!1;this.sReferences="";this.bReloadFolder=!1;var a=this,
|
|
|
|
|
b=function(a){for(var b=0,c=a.length,d=[];b<c;b++)d.push(a[b].toLine(!1));return d.join(", ")},c=function(a){!1===this.showCcAndBcc()&&0<a.length&&this.showCcAndBcc(!0)};this.resizer=f.observable(!1).extend({throttle:50});this.to=f.observableArray([]);this.cc=f.observableArray([]);this.bcc=f.observableArray([]);this.subject=f.observable("");this.sendError=f.observable(!1);this.sendSuccessButSaveError=f.observable(!1);this.savedError=f.observable(!1);this.savedTime=f.observable(0);this.savedOrSendingText=
|
|
|
|
|
f.observable("");this.emptyToError=f.observable(!1);this.showCcAndBcc=f.observable(!1);this.cc.subscribe(c,this);this.bcc.subscribe(c,this);this.draftFolder=f.observable("");this.draftUid=f.observable("");this.draftID=f.observable("");this.sending=f.observable(!1);this.saving=f.observable(!1);this.attachments=f.observableArray([]);this.attachmentsInProcess=f.computed(function(){return i.filter(this.attachments(),function(a){return a&&""===a.tempName()})},this);this.attachmentsInReady=f.computed(function(){return i.filter(this.attachments(),
|
|
|
|
|
function(a){return a&&""!==a.tempName()})},this);this.attachments.subscribe(function(){this.triggerForResize()},this);this.isDraftFolderMessage=f.computed(function(){return""!==this.draftFolder()&&""!==this.draftUid()&&""!==this.draftID()},this);this.composeUploaderButton=f.observable(null);this.composeUploaderDropPlace=f.observable(null);this.dragAndDropEnabled=f.observable(!1);this.dragAndDropOver=f.observable(!1).extend({throttle:1});this.dragAndDropVisible=f.observable(!1).extend({throttle:1});
|
|
|
|
|
this.attacheMultipleAllowed=f.observable(!1);this.addAttachmentEnabled=f.observable(!1);this.composeEditorTextArea=f.observable(null);this.composeEditorHtmlArea=f.observable(null);this.composeEditorToolbar=f.observable(null);this.to.subscribe(function(a){this.emptyToError()&&0<a.length&&this.emptyToError(!1)},this);this.canBeSended=f.computed(function(){return!this.sending()&&!this.saving()&&0===this.attachmentsInProcess().length&&0<this.to().length},this);this.canBeSendedOrSaved=f.computed(function(){return!this.sending()&&
|
|
|
|
|
!this.saving()},this);this.deleteCommand=d.createCommand(this,function(){var a=null,b=this.draftFolder(),c=this.draftUid();this.bFromDraft&&(a=e.data().message())&&(b===a.folderFullNameRaw&&c===a.uid)&&e.data().message(null);e.data().currentFolderFullNameRaw()===this.draftFolder()&&i.each(e.data().messageList(),function(a){a&&(b===a.folderFullNameRaw&&c===a.uid)&&a.deleted(true)});e.data().messageListIsNotCompleted(!0);e.remote().messagesDelete(function(){e.cache().setFolderHash(b,"");e.reloadMessageList()},
|
|
|
|
|
this.draftFolder(),[this.draftUid()]);this.bReloadFolder=!1;o.hideScreenPopup(y)},function(){return this.isDraftFolderMessage()});this.sendMessageResponse=i.bind(this.sendMessageResponse,this);this.saveMessageResponse=i.bind(this.saveMessageResponse,this);this.sendCommand=d.createCommand(this,function(){var a=this.to(),c=e.data().sentFolder(),f=[];if(0===a.length)this.emptyToError(!0);else if(e.data().replySameFolder()&&d.isArray(this.aDraftInfo)&&(3===this.aDraftInfo.length&&d.isNormal(this.aDraftInfo[2])&&
|
|
|
|
|
0<this.aDraftInfo[2].length)&&(c=this.aDraftInfo[2]),""===c)o.showScreenPopup(Y,[g.SetSystemFoldersNotification.Sent]);else{this.sendError(!1);this.sending(!0);this.bReloadFolder=!0;if(d.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(f=e.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1])))"forward"===this.aDraftInfo[0]?f[3]=!0:f[2]=!0,e.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],f),e.reloadFlagsCurrentMessageListAndMessageFromCache();c=n.Values.UnuseOptionValue===
|
|
|
|
|
c?"":c;e.cache().setFolderHash(this.draftFolder(),"");e.cache().setFolderHash(c,"");e.remote().sendMessage(this.sendMessageResponse,this.draftFolder(),this.draftUid(),this.draftID(),c,b(a),b(this.cc()),b(this.bcc()),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences)}},this.canBeSendedOrSaved);this.saveCommand=d.createCommand(this,function(){e.data().draftFolderNotEnabled()?o.showScreenPopup(Y,
|
|
|
|
|
[g.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),this.bReloadFolder=!0,e.cache().setFolderHash(e.data().draftFolder(),""),e.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),this.draftID(),e.data().draftFolder(),b(this.to()),b(this.cc()),b(this.bcc()),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences))},this.canBeSendedOrSaved);ya.subscribe(function(){this.modalVisibility()&&
|
|
|
|
|
(!e.data().draftFolderNotEnabled()&&!this.isEmptyForm(!1)&&!this.saving()&&!this.sending()&&!this.savedError())&&this.saveCommand()},this);d.initOnStartOrLangChange(null,this,function(){this.oEditor&&this.oEditor.initLanguage(d.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),d.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),d.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))});this.showCcAndBcc.subscribe(function(){this.triggerForResize()},this);this.dropboxEnabled=f.observable(e.settingsGet("DropboxApiKey")?!0:!1);this.dropboxCommand=
|
|
|
|
|
d.createCommand(this,function(){Dropbox.choose({success:function(b){b&&(b[0]&&b[0].link)&&a.addDropboxAttachment(b[0])},linkType:"direct",multiselect:!1});return!0},function(){return this.dropboxEnabled()});this.modalVisibility.subscribe(function(a){!a&&this.bReloadFolder&&(this.bReloadFolder=!1,e.reloadMessageList())},this);this.driveEnabled=f.observable(!1);this.driveCommand=d.createCommand(this,function(){return!0},function(){return this.driveEnabled()})}function M(){C.call(this,"Popups","PopupsContacts");
|
|
|
|
|
var a=this;this.imageUploader=f.observable(null);this.imageDom=f.observable(null);this.imageTrigger=f.observable(!1);this.search=f.observable("");this.contacts=f.observableArray([]);this.contacts.loading=f.observable(!1).extend({throttle:200});this.currentContact=f.observable(null);this.emptySelection=f.observable(!0);this.viewClearSearch=f.observable(!1);this.viewID=f.observable("");this.viewName=f.observable("");this.viewName.focused=f.observable(!1);this.viewEmail=f.observable("").validateEmail();
|
|
|
|
|
this.viewEmail.focused=f.observable(!1);this.viewImageUrl=f.observable(e.link().emptyContactPic());this.viewSaving=f.observable(!1);this.useCheckboxesInList=e.data().useCheckboxesInList;this.search.subscribe(function(){this.reloadContactList()},this);this.contacts.subscribe(function(){d.windowResize()},this);this.viewImageUrl.subscribe(function(a){this.imageDom().src=a},this);this.contactsChecked=f.computed(function(){return i.filter(this.contacts(),function(a){return a.checked()})},this);this.contactsCheckedOrSelected=
|
|
|
|
|
f.computed(function(){var a=this.contactsChecked(),c=this.currentContact();return i.union(a,c?[c]:[])},this);this.contactsCheckedOrSelectedUids=f.computed(function(){return i.map(this.contactsCheckedOrSelected(),function(a){return a.idContact})},this);this.newCommand=d.createCommand(this,function(){this.populateViewContact(null)});this.selector=new L(this.contacts,this.currentContact,".e-contact-item .actionHandle",".e-contact-item.selected",".e-contact-item .checkboxItem");this.selector.on("onItemSelect",
|
|
|
|
|
i.bind(function(a){this.populateViewContact(a?a:null)},this));this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""});this.selector.on("onDelete",i.bind(function(){this.deleteCommand()},this));this.newCommand=d.createCommand(this,function(){this.populateViewContact(null);this.currentContact(null)});this.deleteCommand=d.createCommand(this,function(){this.deleteSelectedContacts()},function(){return 0<this.contactsCheckedOrSelected().length});this.newMessageCommand=d.createCommand(this,
|
|
|
|
|
function(){var a=this.contactsCheckedOrSelected(),c=[];d.isNonEmptyArray(a)&&(c=i.map(a,function(a){return a&&a.emails&&(a=new F(a.emails[0]||"",a.name),a.validate())?a:null}),c=i.compact(c));d.isNonEmptyArray(a)&&(o.hideScreenPopup(M),o.showScreenPopup(y,[g.ComposeType.Empty,null,c]))},function(){return 0<this.contactsCheckedOrSelected().length});this.clearCommand=d.createCommand(this,function(){this.search("")});this.saveCommand=d.createCommand(this,function(){var b=d.fakeMd5(),c=this.imageTrigger();
|
|
|
|
|
this.viewSaving(!0);e.remote().contactSave(function(m,f){a.viewSaving(!1);g.StorageResultType.Success===m&&(f&&f.Result&&f.Result.RequestUid===b&&0<d.pInt(f.Result.ResultID))&&(""===a.viewID()&&a.viewID(d.pInt(f.Result.ResultID)),a.reloadContactList(),c&&e.emailsPicsHashes())},b,this.viewID(),this.viewName(),this.viewEmail(),c?this.imageDom().src:"")},function(){var a=this.viewName(),c=this.viewEmail();return!this.viewSaving()&&(""!==a||""!==c)})}function da(){C.call(this,"Popups","PopupsAdvancedSearch");
|
|
|
|
|
this.fromFocus=f.observable(!1);this.from=f.observable("");this.to=f.observable("");this.subject=f.observable("");this.text=f.observable("");this.selectedDateValue=f.observable(-1);this.hasAttachments=f.observable(!1);this.searchCommand=d.createCommand(this,function(){var a=this.buildSearchString();""!==a&&e.data().mainMessageListSearch(a);this.cancelCommand()})}function ea(){C.call(this,"Popups","PopupsAddAccount");this.email=f.observable("");this.login=f.observable("");this.password=f.observable("");
|
|
|
|
|
this.emailError=f.observable(!1);this.loginError=f.observable(!1);this.passwordError=f.observable(!1);this.email.subscribe(function(){this.emailError(!1)},this);this.login.subscribe(function(){this.loginError(!1)},this);this.password.subscribe(function(){this.passwordError(!1)},this);this.allowCustomLogin=f.observable(!1);this.submitRequest=f.observable(!1);this.submitError=f.observable("");this.emailFocus=f.observable(!1);this.loginFocus=f.observable(!1);this.addAccountCommand=d.createCommand(this,
|
|
|
|
|
function(){this.emailError(""===d.trim(this.email()));this.passwordError(""===d.trim(this.password()));if(this.emailError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().accountAdd(i.bind(function(a,b){this.submitRequest(!1);g.StorageResultType.Success===a&&b&&"AccountAdd"===b.Action?b.Result?(e.accounts(),this.cancelCommand()):b.ErrorCode&&this.submitError(d.getNotification(b.ErrorCode)):this.submitError(d.getNotification(g.Notification.UnknownError))},this),this.email(),this.login(),
|
|
|
|
|
this.password());return!0},function(){return!this.submitRequest()});this.loginFocus.subscribe(function(a){a&&(""===this.login()&&""!==this.email())&&this.login(this.email())},this)}function ma(){C.call(this,"Right","Login");this.email=f.observable("");this.login=f.observable("");this.password=f.observable("");this.signMe=f.observable(!1);this.logoMain=f.observable("RainLoop");this.emailError=f.observable(!1);this.loginError=f.observable(!1);this.passwordError=f.observable(!1);this.emailFocus=f.observable(!1);
|
|
|
|
|
this.loginFocus=f.observable(!1);this.submitFocus=f.observable(!1);this.email.subscribe(function(){this.emailError(!1)},this);this.login.subscribe(function(){this.loginError(!1)},this);this.password.subscribe(function(){this.passwordError(!1)},this);this.allowCustomLogin=f.observable(!1);this.submitRequest=f.observable(!1);this.submitError=f.observable("");this.signMeType=f.observable(g.LoginSignMeType.Unused);this.signMeType.subscribe(function(a){this.signMe(g.LoginSignMeType.DefaultOn===a)},this);
|
|
|
|
|
this.signMeVisibility=f.computed(function(){return g.LoginSignMeType.Unused!==this.signMeType()},this);this.submitCommand=d.createCommand(this,function(){this.emailError(""===d.trim(this.email()));this.passwordError(""===d.trim(this.password()));if(this.emailError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().login(i.bind(function(a,b){g.StorageResultType.Success===a&&b&&"Login"===b.Action?b.Result?e.loginAndLogoutReload():b.ErrorCode?(this.submitRequest(!1),this.submitError(d.getNotification(b.ErrorCode))):
|
|
|
|
|
this.submitRequest(!1):(this.submitRequest(!1),this.submitError(d.getNotification(g.Notification.UnknownError)))},this),this.email(),this.login(),this.password(),!!this.signMe());return!0},function(){return!this.submitRequest()});this.facebookLoginEnabled=f.observable(!1);this.facebookCommand=d.createCommand(this,function(){h.open(e.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&
|
|
|
|
|
this.facebookLoginEnabled()});this.googleLoginEnabled=f.observable(!1);this.googleCommand=d.createCommand(this,function(){h.open(e.link().socialGoogle(),"Google","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&this.googleLoginEnabled()});this.twitterLoginEnabled=f.observable(!1);this.twitterCommand=d.createCommand(this,function(){h.open(e.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");
|
|
|
|
|
return!0},function(){return!this.submitRequest()&&this.twitterLoginEnabled()});this.loginFocus.subscribe(function(a){a&&(""===this.login()&&""!==this.email())&&this.login(this.email())},this)}function R(){C.call(this,"Right","SystemDropDown");var a=e.data();this.accounts=a.accounts;this.accountEmail=a.accountEmail;this.accountsLoading=a.accountsLoading;this.allowAddAccount=e.settingsGet("AllowAdditionalAccounts");this.loading=f.computed(function(){return this.accountsLoading()},this);this.accountClick=
|
|
|
|
|
i.bind(this.accountClick,this)}function $a(){R.call(this)}function ab(){R.call(this)}function fa(){C.call(this,"Left","MailFolderList");this.folderList=e.data().folderList;this.folderListSystem=e.data().folderListSystem;this.allowContacts=!!e.settingsGet("ContactsIsSupported")&&!!e.settingsGet("ContactsIsAllowed")}function z(){C.call(this,"Right","MailMessageList");this.sLastUid=null;this.emptySubjectValue="";var a=e.data();this.popupVisibility=e.popupVisibility;this.messageList=a.messageList;this.currentMessage=
|
|
|
|
|
a.currentMessage;this.isMessageSelected=a.isMessageSelected;this.messageListSearch=a.messageListSearch;this.messageListError=a.messageListError;this.folderMenuForMove=a.folderMenuForMove;this.useCheckboxesInList=a.useCheckboxesInList;this.mainMessageListSearch=a.mainMessageListSearch;this.messageListEndFolder=a.messageListEndFolder;this.messageListChecked=a.messageListChecked;this.messageListCheckedOrSelected=a.messageListCheckedOrSelected;this.messageListCheckedOrSelectedUidsWithSubMails=a.messageListCheckedOrSelectedUidsWithSubMails;
|
|
|
|
|
this.messageListCompleteLoadingThrottle=a.messageListCompleteLoadingThrottle;d.initOnStartOrLangChange(function(){this.emptySubjectValue=d.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this);this.userQuota=a.userQuota;this.userUsageSize=a.userUsageSize;this.userUsageProc=a.userUsageProc;this.dragOver=f.observable(!1).extend({throttle:1});this.dragOverEnter=f.observable(!1).extend({throttle:1});this.dragOverArea=f.observable(null);this.dragOverBodyArea=f.observable(null);this.messageListItemTemplate=f.computed(function(){return a.usePreviewPane()?
|
|
|
|
|
"MailMessageListItem":"MailMessageListItemNoPreviewPane"});this.messageListSearchDesc=f.computed(function(){var b=a.messageListEndSearch();return""===b?"":d.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})});this.messageListPagenator=f.computed(function(){var b=0,c=0,m=2,e=[],f=a.messageListPage(),g=a.messageListPageCount(),k=function(a,b,c){a={current:a===f,name:d.isUnd(c)?a.toString():c.toString(),custom:d.isUnd(c)?!1:!0,title:d.isUnd(c)?"":a.toString(),value:a.toString()};d.isUnd(b)||b?e.push(a):
|
|
|
|
|
e.unshift(a)};if(1<g||0<g&&g<f){if(g<f)k(g),c=b=g;else{if(3>=f||g-2<=f)m+=2;k(f);c=b=f}for(;0<m;)if(b-=1,c+=1,0<b&&(k(b,!1),m--),g>=c)k(c,!0),m--;else if(0>=b)break;3===b?k(2,!1):3<b&&k(Math.round((b-1)/2),!1,"...");g-2===c?k(g-1,!0):g-2>c&&k(Math.round((g+c)/2),!0,"...");1<b&&k(1,!1);g>c&&k(g,!0)}return e},this);this.checkAll=f.computed({read:function(){return 0<e.data().messageListCheckedOrSelected().length},write:function(a){a=!!a;i.each(e.data().messageList(),function(c){c.checked(a)});a||e.data().message(null)}});
|
|
|
|
|
this.inputMessageListSearchFocus=f.observable(!1);this.sLastSearchValue="";this.inputProxyMessageListSearch=f.computed({read:this.mainMessageListSearch,write:function(a){this.sLastSearchValue=a},owner:this});this.isIncompleteChecked=f.computed(function(){var a=e.data().messageList().length,c=e.data().messageListCheckedOrSelected().length;return 0<a&&0<c&&a>c},this);this.hasMessages=f.computed(function(){return 0<this.messageList().length},this);this.hasCheckedLines=f.computed(function(){return 0<
|
|
|
|
|
this.messageListChecked().length},this);this.hasCheckedOrSelectedLines=f.computed(function(){return 0<this.messageListCheckedOrSelected().length},this);this.isSpamFolder=f.computed(function(){return e.data().spamFolder()===this.messageListEndFolder()},this);this.isTrashFolder=f.computed(function(){return e.data().trashFolder()===this.messageListEndFolder()},this);this.canBeMoved=this.hasCheckedOrSelectedLines;this.clearCommand=d.createCommand(this,function(){o.showScreenPopup(xa,[e.data().currentFolder()])});
|
|
|
|
|
this.multyForwardCommand=d.createCommand(this,function(){o.showScreenPopup(y,[g.ComposeType.ForwardAsAttachment,e.data().messageListCheckedOrSelected()])},this.canBeMoved);this.deleteWithoutMoveCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Trash,!1)},this.canBeMoved);this.deleteCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Trash,!0)},this.canBeMoved);this.spamCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Spam,
|
|
|
|
|
!0)},this.canBeMoved);this.moveCommand=d.createCommand(this,d.emptyFunction,this.canBeMoved);this.setCommand=d.createCommand(this,d.emptyFunction,this.hasCheckedLines);this.checkCommand=d.createCommand(this,d.emptyFunction,this.hasCheckedLines);this.reloadCommand=d.createCommand(this,function(){e.data().messageListCompleteLoadingThrottle()||e.reloadMessageList(!1,!0)});this.quotaTooltip=i.bind(this.quotaTooltip,this);this.selector=new L(this.messageList,this.currentMessage,".messageListItem .actionHandle",
|
|
|
|
|
".messageListItem.selected",".messageListItem .checkboxMessage");this.selector.on("onItemSelect",i.bind(function(b){b?(a.message(a.staticMessageList.populateByMessageListItem(b)),this.populateMessageBody(a.message())):a.message(null)},this));this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""});this.selector.on("onDelete",i.bind(function(){0<e.data().messageListCheckedOrSelected().length&&this.deleteCommand()},this))}function I(){C.call(this,"Right","MailMessageView");var a="",
|
|
|
|
|
b=e.data(),c=this,m=function(a){return d.createCommand(c,function(){this.replyOrforward(a)},c.canBeRepliedOrForwarded)};this.oMessageScrollerDom=null;this.message=b.message;this.messageLoading=b.messageLoading;this.messageLoadingThrottle=b.messageLoadingThrottle;this.messagesBodiesDom=b.messagesBodiesDom;this.useThreads=b.useThreads;this.replySameFolder=b.replySameFolder;this.usePreviewPane=b.usePreviewPane;this.isMessageSelected=b.isMessageSelected;this.messageActiveDom=b.messageActiveDom;this.messageError=
|
|
|
|
|
b.messageError;this.fullScreenMode=b.messageFullScreenMode;this.showFullInfo=f.observable(!1);this.canBeRepliedOrForwarded=this.messageVisibility=f.computed(function(){return!this.messageLoadingThrottle()&&!!this.message()},this);this.closeMessage=d.createCommand(this,function(){b.message(null)});this.replyCommand=m(g.ComposeType.Reply);this.replyAllCommand=m(g.ComposeType.ReplyAll);this.forwardCommand=m(g.ComposeType.Forward);this.forwardAsAttachmentCommand=m(g.ComposeType.ForwardAsAttachment);this.messageVisibilityCommand=
|
|
|
|
|
d.createCommand(this,d.emptyFunction,this.messageVisibility);this.viewSubject=f.observable("");this.viewFromShort=f.observable("");this.viewToShort=f.observable("");this.viewFrom=f.observable("");this.viewTo=f.observable("");this.viewCc=f.observable("");this.viewBcc=f.observable("");this.viewDate=f.observable("");this.viewMoment=f.observable("");this.viewLineAsCcc=f.observable("");this.viewHasImages=f.observable(!1);this.viewHasVisibleAttachments=f.observable(!1);this.viewAttachments=f.observableArray([]);
|
|
|
|
|
this.viewIsHtml=f.observable(!1);this.viewViewLink=f.observable("");this.viewDownloadLink=f.observable("");this.viewUserPic=f.observable(n.DataImages.UserDotPic);this.viewUserPicVisible=f.observable(!1);this.message.subscribe(function(b){this.messageActiveDom(null);b&&(this.viewSubject(b.subject()),this.viewFromShort(b.fromToLine(!0,!0)),this.viewToShort(b.toToLine(!0,!0)),this.viewFrom(b.fromToLine(!1)),this.viewTo(b.toToLine(!1)),this.viewCc(b.ccToLine(!1)),this.viewBcc(b.bccToLine(!1)),this.viewDate(b.fullFormatDateValue()),
|
|
|
|
|
this.viewMoment(b.momentDate()),this.viewLineAsCcc(b.lineAsCcc()),this.viewHasImages(b.hasImages()),this.viewHasVisibleAttachments(b.hasVisibleAttachments()),this.viewAttachments(b.attachments()),this.viewIsHtml(b.isHtml()),this.viewViewLink(b.viewLink()),this.viewDownloadLink(b.downloadLink()),a=e.cache().getUserPic(b.fromAsSingleEmail()),a!==this.viewUserPic()&&(this.viewUserPicVisible(!1),this.viewUserPic(n.DataImages.UserDotPic),""!==a&&(this.viewUserPicVisible(!0),this.viewUserPic(a))))},this);
|
|
|
|
|
this.fullScreenMode.subscribe(function(a){a?Z.addClass("rl-message-fullscreen"):Z.removeClass("rl-message-fullscreen")});this.messageActiveDom.subscribe(function(){this.scrollMessageToTop();d.windowResize()},this)}function za(a){C.call(this,"Left","SettingsMenu");this.menu=a.menu}function Aa(){C.call(this,"Right","SettingsPane")}function Oa(){var a=e.data();this.mainLanguage=a.mainLanguage;this.mainMessagesPerPage=a.mainMessagesPerPage;this.mainMessagesPerPageArray=n.Defaults.MessagesPerPageArray;
|
|
|
|
|
this.editorDefaultType=a.editorDefaultType;this.showImages=a.showImages;this.showAnimation=a.showAnimation;this.useDesktopNotifications=a.useDesktopNotifications;this.useThreads=a.useThreads;this.replySameFolder=a.replySameFolder;this.usePreviewPane=a.usePreviewPane;this.useCheckboxesInList=a.useCheckboxesInList;this.languagesOptions=f.computed(function(){return i.map(a.languages(),function(a){return{optValue:a,optText:d.convertLangName(a)}})});this.isDesctopNotificationsSupported=f.computed(function(){return g.DesctopNotifications.NotSupported!==
|
|
|
|
|
a.desktopNotificationsPermisions()});this.isDesctopNotificationsDenied=f.computed(function(){return g.DesctopNotifications.NotSupported===a.desktopNotificationsPermisions()||g.DesctopNotifications.Denied===a.desktopNotificationsPermisions()});this.languageTrigger=f.observable(g.SaveSettingsStep.Idle).extend({throttle:100});this.mppTrigger=f.observable(g.SaveSettingsStep.Idle)}function bb(){var a=e.data();this.displayName=a.displayName;this.replyTo=a.replyTo;this.signature=a.signature;this.nameTrigger=
|
|
|
|
|
f.observable(g.SaveSettingsStep.Idle);this.replyTrigger=f.observable(g.SaveSettingsStep.Idle);this.signatureTrigger=f.observable(g.SaveSettingsStep.Idle)}function na(){this.accounts=e.data().accounts;this.processText=f.computed(function(){return e.data().accountsLoading()?d.i18n("SETTINGS_ACCOUNTS/LOADING_PROCESS"):""},this);this.visibility=f.computed(function(){return""===this.processText()?"hidden":"visible"},this);this.accountForDeletion=f.observable(null).extend({falseTimeout:3E3}).extend({toggleSubscribe:[this,
|
|
|
|
|
function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]})}function Pa(){var a=e.data();this.googleEnable=a.googleEnable;this.googleActions=a.googleActions;this.googleLoggined=a.googleLoggined;this.googleUserName=a.googleUserName;this.facebookEnable=a.facebookEnable;this.facebookActions=a.facebookActions;this.facebookLoggined=a.facebookLoggined;this.facebookUserName=a.facebookUserName;this.twitterEnable=a.twitterEnable;this.twitterActions=a.twitterActions;this.twitterLoggined=a.twitterLoggined;
|
|
|
|
|
this.twitterUserName=a.twitterUserName;this.connectGoogle=d.createCommand(this,function(){this.googleLoggined()||e.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()});this.disconnectGoogle=d.createCommand(this,function(){e.googleDisconnect()});this.connectFacebook=d.createCommand(this,function(){this.facebookLoggined()||e.facebookConnect()},function(){return!this.facebookLoggined()&&!this.facebookActions()});this.disconnectFacebook=d.createCommand(this,function(){e.facebookDisconnect()});
|
|
|
|
|
this.connectTwitter=d.createCommand(this,function(){this.twitterLoggined()||e.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()});this.disconnectTwitter=d.createCommand(this,function(){e.twitterDisconnect()})}function oa(){this.changeProcess=f.observable(!1);this.passwordUpdateError=f.observable(!1);this.passwordUpdateSuccess=f.observable(!1);this.currentPassword=f.observable("");this.newPassword=f.observable("");this.currentPassword.subscribe(function(){this.passwordUpdateError(!1);
|
|
|
|
|
this.passwordUpdateSuccess(!1)},this);this.newPassword.subscribe(function(){this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1)},this);this.saveNewPasswordCommand=d.createCommand(this,function(){this.changeProcess(!0);this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1);e.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword())},function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()});this.onChangePasswordResponse=
|
|
|
|
|
i.bind(this.onChangePasswordResponse,this)}function S(){var a=e.data();this.ignoreFolderSubscribe=a.ignoreFolderSubscribe;this.foldersListError=a.foldersListError;this.folderList=a.folderList;this.processText=f.computed(function(){var a=e.data(),c=a.foldersLoading(),m=a.foldersCreating(),f=a.foldersDeleting(),a=a.foldersRenaming();return m?d.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):f?d.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):a?d.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):c?d.i18n("SETTINGS_FOLDERS/LOADING_PROCESS"):
|
|
|
|
|
""},this);this.visibility=f.computed(function(){return""===this.processText()?"hidden":"visible"},this);this.folderForDeletion=f.observable(null).extend({falseTimeout:3E3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]});this.folderForEdit=f.observable(null).extend({toggleSubscribe:[this,function(a){a&&a.edited(!1)},function(a){a&&a.canBeEdited()&&a.edited(!0)}]})}function Ba(){var a=this;this.mainTheme=e.data().mainTheme;this.customThemeType=
|
|
|
|
|
f.observable(e.settingsGet("CustomThemeType"));this.customThemeImg=f.observable(e.settingsGet("CustomThemeImg"));this.themesObjects=f.observableArray([]);this.customThemeUploaderProgress=f.observable(!1);this.customThemeUploaderButton=f.observable(null);this.showCustomThemeConfig=f.computed(function(){return"Custom"===this.mainTheme()},this);this.showCustomThemeConfig.subscribe(function(){d.windowResize()});this.themeTrigger=f.observable(g.SaveSettingsStep.Idle).extend({throttle:100});this.oLastAjax=
|
|
|
|
|
null;this.iTimer=0;e.data().theme.subscribe(function(b){i.each(this.themesObjects(),function(a){a.selected(b===a.name)});var c=j("#rlThemeLink"),m=j("#rlThemeStyle"),f=c.attr("href");f||(f=m.attr("data-href"));f&&(f=f.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+b+"/-/"),f=f.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/"+("Custom"===b&&h.__rlah?h.__rlah()||"0":"0")+"/User/"),"Json/"!==f.substring(f.length-5,f.length)&&(f+="Json/"),h.clearTimeout(a.iTimer),a.themeTrigger(g.SaveSettingsStep.Animate),
|
|
|
|
|
this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=j.ajax({url:f,dataType:"json"}).done(function(b){if(b&&d.isArray(b)&&2===b.length){if(c&&c[0]&&(!m||!m[0]))m=j('<style id="rlThemeStyle"></style>'),c.after(m),c.remove();m&&m[0]&&m.attr("data-href",f).attr("data-theme",b[0]).text(b[1]);a.themeTrigger(g.SaveSettingsStep.TrueResult)}}).always(function(){a.iTimer=h.setTimeout(function(){a.themeTrigger(g.SaveSettingsStep.Idle)},1E3);a.oLastAjax=null}));e.remote().saveSettings(null,
|
|
|
|
|
{Theme:b})},this)}function Qa(){d.initDataConstructorBySettings(this)}function T(){d.initDataConstructorBySettings(this);var a=function(a){return function(){var b=e.cache().getFolderFromCacheList(a());b&&b.type(g.FolderType.User)}},b=function(a){return function(b){(b=e.cache().getFolderFromCacheList(b))&&b.type(a)}};this.devPassword=this.devLogin=this.devEmail="";this.accountEmail=f.observable("");this.accountLogin=f.observable("");this.projectHash=f.observable("");this.threading=!1;this.lastFoldersHash=
|
|
|
|
|
"";this.remoteChangePassword=this.remoteSuggestions=!1;this.sentFolder=f.observable("");this.draftFolder=f.observable("");this.spamFolder=f.observable("");this.trashFolder=f.observable("");this.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange");this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange");this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange");this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange");this.sentFolder.subscribe(b(g.FolderType.SentItems),
|
|
|
|
|
this);this.draftFolder.subscribe(b(g.FolderType.Draft),this);this.spamFolder.subscribe(b(g.FolderType.Spam),this);this.trashFolder.subscribe(b(g.FolderType.Trash),this);this.draftFolderNotEnabled=f.computed(function(){return""===this.draftFolder()||n.Values.UnuseOptionValue===this.draftFolder()},this);this.displayName=f.observable("");this.signature=f.observable("");this.replyTo=f.observable("");this.accounts=f.observableArray([]);this.accountsLoading=f.observable(!1);this.namespace="";this.folderList=
|
|
|
|
|
f.observableArray([]);this.foldersListError=f.observable("");this.foldersLoading=f.observable(!1);this.foldersCreating=f.observable(!1);this.foldersDeleting=f.observable(!1);this.foldersRenaming=f.observable(!1);this.currentFolder=f.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.currentFolderFullNameRaw=f.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this);this.currentFolderFullName=f.computed(function(){return this.currentFolder()?
|
|
|
|
|
this.currentFolder().fullName:""},this);this.currentFolderFullNameHash=f.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this);this.currentFolderName=f.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this);this.folderListSystemNames=f.computed(function(){var a=["INBOX"],b=this.folderList(),e=this.sentFolder(),f=this.draftFolder(),g=this.spamFolder(),k=this.trashFolder();d.isArray(b)&&0<b.length&&(""!==e&&n.Values.UnuseOptionValue!==
|
|
|
|
|
e&&a.push(e),""!==f&&n.Values.UnuseOptionValue!==f&&a.push(f),""!==g&&n.Values.UnuseOptionValue!==g&&a.push(g),""!==k&&n.Values.UnuseOptionValue!==k&&a.push(k));return a},this);this.folderListSystem=f.computed(function(){return i.compact(i.map(this.folderListSystemNames(),function(a){return e.cache().getFolderFromCacheList(a)}))},this);this.folderMenuForMove=f.computed(function(){return e.folderListOptionsBuilder(this.folderListSystem(),this.folderList(),[this.currentFolderFullNameRaw()],null,null,
|
|
|
|
|
null,null,function(a){return a?a.localName():""})},this);this.staticMessageList=[];this.messageList=f.observableArray([]);this.messageListCount=f.observable(0);this.messageListSearch=f.observable("");this.messageListPage=f.observable(1);this.messageListThreadFolder=f.observable("");this.messageListThreadUids=f.observableArray([]);this.messageListThreadFolder.subscribe(function(){this.messageListThreadUids([])},this);this.messageListEndSearch=f.observable("");this.messageListEndFolder=f.observable("");
|
|
|
|
|
this.messageListPageCount=f.computed(function(){var a=Math.ceil(this.messageListCount()/this.messagesPerPage());return 0===a?1:a},this);this.mainMessageListSearch=f.computed({read:this.messageListSearch,write:function(a){o.setHash(e.link().mailBox(this.currentFolderFullNameHash(),1,d.trim(a.toString())))},owner:this});this.messageListError=f.observable("");this.messageListLoading=f.observable(!1);this.messageListIsNotCompleted=f.observable(!1);this.messageListCompleteLoadingThrottle=f.observable(!1).extend({throttle:200});
|
|
|
|
|
this.messageListCompleteLoading=f.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this);this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this);this.messageList.subscribe(i.debounce(function(a){i.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500));this.staticMessageList=new l;this.message=f.observable(null);this.messageLoading=f.observable(!1);this.messageLoadingThrottle=f.observable(!1).extend({throttle:50});
|
|
|
|
|
this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this);this.messageFullScreenMode=f.observable(!1);this.messageError=f.observable("");this.messagesBodiesDom=f.observable(null);this.messagesBodiesDom.subscribe(function(a){a&&!(a instanceof jQuery)&&this.messagesBodiesDom(j(a))},this);this.messageActiveDom=f.observable(null);this.isMessageSelected=f.computed(function(){return null!==this.message()},this);this.currentMessage=f.observable(null);this.message.subscribe(function(a){null===
|
|
|
|
|
a&&this.currentMessage(null)},this);this.messageListChecked=f.computed(function(){return i.filter(this.messageList(),function(a){return a.checked()})},this);this.messageListCheckedOrSelected=f.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return i.union(a,b?[b]:[])},this);this.messageListCheckedUids=f.computed(function(){var a=[];i.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&(0===b.parentUid()&&b.lastInCollapsedThread())&&(a=i.union(a,
|
|
|
|
|
b.threads())))});return a},this);this.messageListCheckedOrSelectedUidsWithSubMails=f.computed(function(){var a=[];i.each(this.messageListCheckedOrSelected(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&(0===b.parentUid()&&b.lastInCollapsedThread())&&(a=i.union(a,b.threads())))});return a},this);this.userQuota=f.observable(0);this.userUsageSize=f.observable(0);this.userUsageProc=f.computed(function(){var a=this.userQuota(),b=this.userUsageSize();return 0<a?Math.ceil(100*(b/a)):0},this);this.useKeyboardShortcuts=
|
|
|
|
|
f.observable(!0);this.googleActions=f.observable(!1);this.googleLoggined=f.observable(!1);this.googleUserName=f.observable("");this.facebookActions=f.observable(!1);this.facebookLoggined=f.observable(!1);this.facebookUserName=f.observable("");this.twitterActions=f.observable(!1);this.twitterLoggined=f.observable(!1);this.twitterUserName=f.observable("");this.customThemeType=f.observable(g.CustomThemeType.Light)}function ba(){this.oRequests={}}function q(){this.oRequests={};this.oRequests={}}function U(){this.oEmailsPicsHashes=
|
|
|
|
|
{};this.oServices={}}function w(){U.call(this);this.oFoldersCache={};this.oFoldersNamesCache={};this.oFolderHashCache={};this.oFolderUidNextCache={};this.oMessageListHashCache={};this.oMessageFlagsCache={};this.oNewMessage={};this.oRequestedMessage={}}function ga(a){K.call(this,"settings",a);this.menu=f.observableArray([]);this.oCurrentSubScreen=null}function Ca(){K.call(this,"login",[ma])}function V(){K.call(this,"mailbox",[$a,fa,z,I]);this.oLastRoute={};var a=e.data();this.mailBoxScreenVisibily=
|
|
|
|
|
f.observable(!1);this.resizeTrigger=f.computed(function(){var b=this.mailBoxScreenVisibily(),c=a.messageFullScreenMode();return a.usePreviewPane()&&!c&&b?!0:!1},this)}function Ra(){ga.call(this,[ab,za,Aa]);d.initOnStartOrLangChange(function(){this.sSettingsTitle=d.i18n("TITLES/SETTINGS")},this,function(){e.setTitle(this.sSettingsTitle)})}function J(){this.oLocal=this.oLink=this.oPlugins=this.oSettings=null;this.isLocalAutocomplete=!0;this.popupVisibility=f.observable(!1);this.iframe=j('<iframe style="display:none" src="javascript:;" />').appendTo("body");
|
|
|
|
|
O.on("error",function(a){e&&(a&&a.originalEvent&&a.originalEvent.message&&-1===d.inArray(a.originalEvent.message,["Uncaught Error: Error calling method on NPObject."]))&&e.remote().jsError(d.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Z.attr("class"))})}function A(){J.call(this);this.oCache=this.oRemote=this.oData=null;this.iSuggestionsLimit=d.pInt(this.settingsGet("SuggestionsLimit"));this.iSuggestionsLimit=
|
|
|
|
|
0===this.iSuggestionsLimit?20:this.iSuggestionsLimit;this.quotaDebounce=i.debounce(this.quota,3E4)}var n={},g={},u={},d={},x={},ha={},Da,Ea,Sa,pa,Ta,cb,ia,ya=f.observable(!0),ja=f.observable(!0),o=null,Fa=h.rainloopAppData||{},Ua=h.rainloopI18N||{},Z=j("html"),O=j(h),Ga=j(h.document),Ha=[],Va=[],Wa=[],ka=h.Notification&&h.Notification.requestPermission?h.Notification:null,e=null;Ea=Da=0;Sa=!1;pa=(navigator.userAgent||"").toLowerCase();Ta=-1<pa.indexOf("iphone")||-1<pa.indexOf("ipod")||-1<pa.indexOf("ipad");
|
|
|
|
|
cb=-1<pa.indexOf("android");ia=Ta||cb;n.Defaults={};n.Values={};n.DataImages={};n.Defaults.MessagesPerPage=20;n.Defaults.MessagesPerPageArray=[10,20,30,50,100];n.Defaults.DefaultAjaxTimeout=2E4;n.Defaults.SearchAjaxTimeout=12E4;n.Defaults.SendMessageAjaxTimeout=2E5;n.Defaults.SaveMessageAjaxTimeout=2E5;n.Values.UnuseOptionValue="__UNUSE__";n.Values.GmailFolderName="[Gmail]";n.Values.ClientSideCookieIndexName="rlcsc";n.Values.ImapDefaulPort=143;n.Values.ImapDefaulSecurePort=993;n.Values.SmtpDefaulPort=
|
|
|
|
|
25;n.Values.SmtpDefaulSecurePort=465;n.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=";n.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=";g.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"};g.State={Empty:10,Login:20,Auth:30};g.StateType={Webmail:0,Admin:1};g.FolderType={Inbox:10,SentItems:11,
|
|
|
|
|
Draft:12,Trash:13,Spam:14,User:99};g.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"};g.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2};g.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft"};g.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99};g.SetSystemFoldersNotification={None:0,
|
|
|
|
|
Sent:1,Draft:2,Spam:3,Trash:4};g.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3};g.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};g.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3};g.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6};g.DesctopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9};g.MessagePriority=
|
|
|
|
|
{Low:5,Normal:3,High:1};g.EditorDefaultType={Html:"Html",Plain:"Plain"};g.CustomThemeType={Light:"Light",Dark:"Dark"};g.ServerSecure={None:0,SSL:1,TLS:2};g.SearchDateType={All:-1,Days3:3,Days7:7,Month:30};g.EmailType={Defailt:0,Facebook:1,Google:2};g.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0};g.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};d.trim=j.trim;d.inArray=j.inArray;d.isArray=i.isArray;d.isFunc=i.isFunction;d.isUnd=i.isUndefined;d.isNull=i.isNull;d.emptyFunction=function(){};d.isNormal=function(a){return!d.isUnd(a)&&!d.isNull(a)};d.windowResize=i.debounce(function(a){d.isUnd(a)?O.resize():h.setTimeout(function(){O.resize()},a)},50);d.isPosNumeric=
|
|
|
|
|
function(a,b){return d.isNormal(a)?d.isUnd(b)||b?/^[0-9]*$/.test(a.toString()):/^[1-9]+[0-9]*$/.test(a.toString()):!1};d.pInt=function(a){return d.isNormal(a)&&""!==a?h.parseInt(a,10):0};d.pString=function(a){return d.isNormal(a)?a+"":""};d.isNonEmptyArray=function(a){return d.isArray(a)&&0<a.length};d.exportPath=function(a,b,c){for(var m=null,a=a.split("."),c=c||h;a.length&&(m=a.shift());)!a.length&&!d.isUnd(b)?c[m]=b:c=c[m]?c[m]:c[m]={}};d.pImport=function(a,b,c){a[b]=c};d.pExport=function(a,b,
|
|
|
|
|
c){return d.isUnd(a[b])?c:a[b]};d.encodeHtml=function(a){return d.isNormal(a)?a.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""};d.splitPlainText=function(a,b){for(var c="",m="",e=a,f=0,g=0,b=d.isUnd(b)?100:b;e.length>b;)m=e.substring(0,b),f=m.lastIndexOf(" "),g=m.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=m.substring(0,f)+"\n",e=e.substring(f+1);return c+e};var Ia={};d.timeOutAction=function(a,b,c){d.isUnd(Ia[a])&&
|
|
|
|
|
(Ia[a]=0);h.clearTimeout(Ia[a]);Ia[a]=h.setTimeout(b,c)};var Xa={};d.timeOutActionSecond=function(a,b,c){Xa[a]||(Xa[a]=h.setTimeout(function(){b();Xa[a]=0},c))};var P=!1;d.audio=function(a,b){if(!1===P)if(Ta)P=null;else{var c=!1,d=!1,e=h.Audio?new h.Audio:null;e&&e.canPlayType&&e.play?((c=""!==e.canPlayType('audio/mpeg; codecs="mp3"'))||(d=""!==e.canPlayType('audio/ogg; codecs="vorbis"')),c||d?(P=e,P.preload="none",P.loop=!1,P.autoplay=!1,P.muted=!1,P.src=c?a:b):P=null):P=null}return P};d.hos=function(a,
|
|
|
|
|
b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};d.i18n=function(a,b,c){var m="",a=d.isUnd(Ua[a])?d.isUnd(c)?a:c:Ua[a];if(!d.isUnd(b)&&!d.isNull(b))for(m in b)d.hos(b,m)&&(a=a.replace("%"+m+"%",b[m]));return a};d.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),c="";(c=a.data("i18n-text"))?a.text(d.i18n(c)):((c=a.data("i18n-html"))&&a.html(d.i18n(c)),(c=a.data("i18n-placeholder"))&&a.attr("placeholder",d.i18n(c)))})})};d.i18nToDoc=function(){h.rainloopI18N&&
|
|
|
|
|
(Ua=h.rainloopI18N||{},d.i18nToNode(Ga),ja(!ja()));h.rainloopI18N={}};d.initOnStartOrLangChange=function(a,b,c){a&&a.call(b);c?ja.subscribe(function(){a&&a.call(b);c.call(b)}):a&&ja.subscribe(a,b)};d.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)};d.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=j(document.activeElement);
|
|
|
|
|
(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}};d.removeSelection=function(){if(h&&h.getSelection){var a=h.getSelection();a&&a.removeAllRanges&&a.removeAllRanges()}else document&&(document.selection&&document.selection.empty)&&document.selection.empty()};d.replySubjectAdd=function(a,b){var c=null,m=d.trim(b);null!==(c=(new h.RegExp("^"+a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!d.isUnd(c[1])?m=a+"[2]: "+c[1]:null!==(c=(new h.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$",
|
|
|
|
|
"gi")).exec(b))&&!d.isUnd(c[1])&&!d.isUnd(c[2])&&!d.isUnd(c[3])?(d.pInt(c[2]),m=c[1]+(d.pInt(c[2])+1)+c[3]):m=a+": "+b;return m};d.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};d.friendlySize=function(a){a=d.pInt(a);return 1073741824<=a?d.roundNumber(a/1073741824,1)+"GB":1048576<=a?d.roundNumber(a/1048576,1)+"MB":1024<=a?d.roundNumber(a/1024,0)+"KB":a+"B"};d.log=function(a){h.console&&h.console.log&&h.console.log(a)};d.getNotification=function(a){a=d.pInt(a);return d.isUnd(u[a])?
|
|
|
|
|
"":u[a]};d.initNotificationLanguage=function(){u[g.Notification.InvalidToken]=d.i18n("NOTIFICATIONS/INVALID_TOKEN");u[g.Notification.AuthError]=d.i18n("NOTIFICATIONS/AUTH_ERROR");u[g.Notification.AccessError]=d.i18n("NOTIFICATIONS/ACCESS_ERROR");u[g.Notification.ConnectionError]=d.i18n("NOTIFICATIONS/CONNECTION_ERROR");u[g.Notification.CaptchaError]=d.i18n("NOTIFICATIONS/CAPTCHA_ERROR");u[g.Notification.SocialFacebookLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");
|
|
|
|
|
u[g.Notification.SocialTwitterLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");u[g.Notification.SocialGoogleLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");u[g.Notification.DomainNotAllowed]=d.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");u[g.Notification.AccountNotAllowed]=d.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED");u[g.Notification.CantGetMessageList]=d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST");u[g.Notification.CantGetMessage]=d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");
|
|
|
|
|
u[g.Notification.CantDeleteMessage]=d.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");u[g.Notification.CantMoveMessage]=d.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");u[g.Notification.CantSaveMessage]=d.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");u[g.Notification.CantSendMessage]=d.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");u[g.Notification.InvalidRecipients]=d.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");u[g.Notification.CantCreateFolder]=d.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER");u[g.Notification.CantRenameFolder]=d.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");
|
|
|
|
|
u[g.Notification.CantDeleteFolder]=d.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");u[g.Notification.CantDeleteNonEmptyFolder]=d.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");u[g.Notification.CantSubscribeFolder]=d.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");u[g.Notification.CantUnsubscribeFolder]=d.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");u[g.Notification.CantSaveSettings]=d.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS");u[g.Notification.CantSavePluginSettings]=d.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");
|
|
|
|
|
u[g.Notification.DomainAlreadyExists]=d.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");u[g.Notification.CantInstallPackage]=d.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");u[g.Notification.CantDeletePackage]=d.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");u[g.Notification.InvalidPluginPackage]=d.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");u[g.Notification.UnsupportedPluginPackage]=d.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE");u[g.Notification.LicensingServerIsUnavailable]=d.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");
|
|
|
|
|
u[g.Notification.LicensingExpired]=d.i18n("NOTIFICATIONS/LICENSING_EXPIRED");u[g.Notification.LicensingBanned]=d.i18n("NOTIFICATIONS/LICENSING_BANNED");u[g.Notification.DemoSendMessageError]=d.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");u[g.Notification.AccountAlreadyExists]=d.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");u[g.Notification.MailServerError]=d.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR");u[g.Notification.UnknownNotification]=d.i18n("NOTIFICATIONS/UNKNOWN_ERROR");u[g.Notification.UnknownError]=
|
|
|
|
|
d.i18n("NOTIFICATIONS/UNKNOWN_ERROR")};d.getUploadErrorDescByCode=function(a){var b="";switch(d.pInt(a)){case g.UploadErrorCode.FileIsTooBig:b=d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case g.UploadErrorCode.FilePartiallyUploaded:b=d.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case g.UploadErrorCode.FileNoUploaded:b=d.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case g.UploadErrorCode.MissingTempFolder:b=d.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case g.UploadErrorCode.FileOnSaveingError:b=
|
|
|
|
|
d.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case g.UploadErrorCode.FileType:b=d.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=d.i18n("UPLOAD/ERROR_UNKNOWN")}return b};d.killCtrlAandS=function(a){if(a=a||h.event){var b=a.target||a.srcElement,c=a.keyCode||a.which;if(a.ctrlKey&&c===g.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&c===g.EventKeyCode.A)h.getSelection?h.getSelection().removeAllRanges():h.document.selection&&h.document.selection.clear&&
|
|
|
|
|
h.document.selection.clear(),a.preventDefault()}};d.createCommand=function(a,b,c){var m=b?function(){m.canExecute&&m.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};m.enabled=f.observable(!0);c=d.isUnd(c)?!0:c;m.canExecute=d.isFunc(c)?f.computed(function(){return m.enabled()&&c.call(a)}):f.computed(function(){return m.enabled()&&!!c});return m};d.initDataConstructorBySettings=function(a){a.ignoreFolderSubscribe=f.observable(!1);a.editorDefaultType=f.observable(g.EditorDefaultType.Html);
|
|
|
|
|
a.showImages=f.observable(!1);a.showAnimation=f.observable(!1);a.desktopNotifications=f.observable(!1);a.useThreads=f.observable(!0);a.replySameFolder=f.observable(!0);a.usePreviewPane=f.observable(!0);a.useCheckboxesInList=f.observable(!0);a.showAnimation.subscribe(function(a){ia?Z.removeClass("rl-anim").addClass("no-rl-anim"):Z.toggleClass("rl-anim",a).toggleClass("no-rl-anim",!a)});a.showAnimation.valueHasMutated();a.desktopNotificationsPermisions=f.computed(function(){a.desktopNotifications();
|
|
|
|
|
var b=g.DesctopNotifications.NotSupported;if(ka&&ka.permission)switch(ka.permission.toLowerCase()){case "granted":b=g.DesctopNotifications.Allowed;break;case "denied":b=g.DesctopNotifications.Denied;break;case "default":b=g.DesctopNotifications.NotAllowed}else h.webkitNotifications&&h.webkitNotifications.checkPermission&&(b=h.webkitNotifications.checkPermission());return b});a.useDesktopNotifications=f.computed({read:function(){return a.desktopNotifications()&&g.DesctopNotifications.Allowed===a.desktopNotificationsPermisions()},
|
|
|
|
|
write:function(b){b?(b=a.desktopNotificationsPermisions(),g.DesctopNotifications.Allowed===b?a.desktopNotifications(!0):g.DesctopNotifications.NotAllowed===b?ka.requestPermission(function(){a.desktopNotifications.valueHasMutated();h.console.log(a.desktopNotificationsPermisions());g.DesctopNotifications.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=f.observable("");a.languages=f.observableArray([]);a.mainLanguage=f.computed({read:a.language,write:function(b){b!==a.language()?-1<d.inArray(b,a.languages())?a.language(b):0<a.languages().length&&a.language(a.languages()[0]):a.language.valueHasMutated()}});a.theme=f.observable("");a.themes=f.observableArray([]);a.mainTheme=f.computed({read:a.theme,write:function(b){if(b!==a.theme()){var c=a.themes();-1<d.inArray(b,c)?a.theme(b):
|
|
|
|
|
0<c.length&&a.theme(c[0])}else a.theme.valueHasMutated()}});a.allowCustomTheme=f.observable(!0);a.allowAdditionalAccounts=f.observable(!0);a.messagesPerPage=f.observable(n.Defaults.MessagesPerPage);a.mainMessagesPerPage=a.messagesPerPage;a.mainMessagesPerPage=f.computed({read:a.messagesPerPage,write:function(b){-1<d.inArray(d.pInt(b),n.Defaults.MessagesPerPageArray)?b!==a.messagesPerPage()&&a.messagesPerPage(b):a.messagesPerPage.valueHasMutated()}});a.facebookEnable=f.observable(!1);a.facebookAppID=
|
|
|
|
|
f.observable("");a.facebookAppSecret=f.observable("");a.twitterEnable=f.observable(!1);a.twitterConsumerKey=f.observable("");a.twitterConsumerSecret=f.observable("");a.googleEnable=f.observable(!1);a.googleClientID=f.observable("");a.googleClientSecret=f.observable("");a.dropboxEnable=f.observable(!1);a.dropboxApiKey=f.observable("");a.contactsIsSupported=f.observable(!1);a.contactsIsAllowed=f.observable(!1)};d.createMomentDate=function(a){return f.computed(function(){ya();return this.moment().fromNow()},
|
|
|
|
|
a)};d.createMomentShortDate=function(a){return f.computed(function(){var a="",a=aa(),c=this.moment(),m=this.momentDate();return a=4>=a.diff(c,"hours")?m:a.format("L")===c.format("L")?d.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):a.clone().subtract("days",1).format("L")===c.format("L")?d.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):a.year()===c.year()?c.format("D MMM."):c.format("LL")},a)};d.isFolderExpanded=function(a){var b=e.local().get(g.ClientSideKeyName.ExpandedFolders);return i.isArray(b)&&
|
|
|
|
|
-1!==i.indexOf(b,a)};d.setExpandedFolder=function(a,b){var c=e.local().get(g.ClientSideKeyName.ExpandedFolders);i.isArray(c)||(c=[]);b?(c.push(a),c=i.uniq(c)):c=i.without(c,a);e.local().set(g.ClientSideKeyName.ExpandedFolders,c)};d.initLayoutResizer=function(a,b,c,d){var f=j(a),r=j(b),v=j(c),a=e.local().get(g.ClientSideKeyName.MailBoxListSize),k=function(a,b,c){if(b||c)a=v.width(),b=b?100*(b.size.width/a):null,null===b&&c&&(b=100*(f.width()/a)),null!==b&&(f.css({width:"",height:"",right:""+(100-b)+
|
|
|
|
|
"%"}),r.css({width:"",height:"",left:""+b+"%"}))};a&&f.width(a);f.resizable({minWidth:350,maxWidth:v.width()-250,handles:"e",resize:k,stop:k});k(null,null,!0);O.resize(i.throttle(function(a,b){if(d&&d()){var c=v.width();f.resizable("option","maxWidth",c-250);b&&(b.size&&b.size.width)&&e.local().set(g.ClientSideKeyName.MailBoxListSize,b.size.width);k(null,null,!0)}},400))};d.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");d.windowResize()}).after("<br />").before("<br />")})}};d.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()}))};
|
|
|
|
|
d.extendAsViewModel=function(a,b){b&&(b.__name=a,x.regViewModelHook(a,b),i.extend(b.prototype,C.prototype))};d.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e};Ha.push(a)};d.removeSettingsViewModel=function(a){Va.push(a)};d.disableSettingsViewModel=function(a){Wa.push(a)};d.convertThemeName=function(a){return d.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};d.convertLangName=function(a){return d.i18n("LANGS_NAMES/LANG_"+
|
|
|
|
|
a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)};d.fakeMd5=function(a){for(var b="",a=d.isUnd(a)?32:d.pInt(a);b.length<a;)b+="0123456789abcdefghijklmnopqrstuvwxyz".substr(h.Math.round(36*h.Math.random()),1);return b};d.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")};d.draggeblePlace=function(){return j('<div class="draggablePlace"><span class="text"></span> <i class="icon-envelope icon-white"></i></div>').appendTo("#rl-hidden")};
|
|
|
|
|
d.defautOptionsAfterRender=function(a,b){b&&!d.isUnd(b.disable)&&f.applyBindingsToNode(a,{disable:b.disable},b)};d.windowPopupKnockout=function(a,b,c,m){var e=null,f=h.open(""),g="__OpenerApplyBindingsUid"+d.fakeMd5()+"__",k=j("#"+b);h[g]=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"));d.i18nToNode(b);E.prototype.applyExternal(a,j("#rl-content",b)[0]);h[g]=null;m(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>'+d.encodeHtml(c)+'</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['"+
|
|
|
|
|
g+"']){window.opener['"+g+"']();window.opener['"+g+"']=null}";f.document.getElementsByTagName("head")[0].appendChild(e)};d.settingsSaveHelperFunction=function(a,b,c,m){c=c||null;m=d.isUnd(m)?1E3:d.pInt(m);return function(d,e,f,k,h){b.call(c,e&&e.Result?g.SaveSettingsStep.TrueResult:g.SaveSettingsStep.FalseResult);a&&a.call(c,d,e,f,k,h);i.delay(function(){b.call(c,g.SaveSettingsStep.Idle)},m)}};d.settingsSaveHelperSimpleFunction=function(a,b){return d.settingsSaveHelperFunction(null,a,b,1E3)};d.resizeAndCrop=
|
|
|
|
|
function(a,b,c){var d=new Image;d.onload=function(){var a=[0,0],d=document.createElement("canvas"),m=d.getContext("2d");d.width=b;d.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];m.fillStyle="#fff";m.fillRect(0,0,b,b);m.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};ha={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return ha.encode(a).replace(/[+]/g,
|
|
|
|
|
"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){for(var b="",c,d,e,f,g,k,i=0,a=ha._utf8_encode(a);i<a.length;)c=a.charCodeAt(i++),d=a.charCodeAt(i++),e=a.charCodeAt(i++),f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,k=e&63,isNaN(d)?g=k=64:isNaN(e)&&(k=64),b=b+this._keyStr.charAt(f)+this._keyStr.charAt(c)+this._keyStr.charAt(g)+this._keyStr.charAt(k);return b},decode:function(a){for(var b="",c,d,e,f,g,k=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)c=this._keyStr.indexOf(a.charAt(k++)),
|
|
|
|
|
d=this._keyStr.indexOf(a.charAt(k++)),f=this._keyStr.indexOf(a.charAt(k++)),g=this._keyStr.indexOf(a.charAt(k++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b+=String.fromCharCode(c),64!==f&&(b+=String.fromCharCode(d)),64!==g&&(b+=String.fromCharCode(e));return ha._utf8_decode(b)},_utf8_encode:function(a){for(var a=a.replace(/\r\n/g,"\n"),b="",c=0,d=a.length,e=0;c<d;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):(127<e&&2048>e?b+=String.fromCharCode(e>>6|192):(b+=String.fromCharCode(e>>12|224),
|
|
|
|
|
b+=String.fromCharCode(e>>6&63|128)),b+=String.fromCharCode(e&63|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):191<d&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((d&31)<<6|e&63),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((d&15)<<12|(e&63)<<6|f&63),c+=3);return b}};f.bindingHandlers.tooltip={init:function(a,b){if(!ia){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,
|
|
|
|
|
hide:100},html:!0,trigger:"hover",title:function(){return'<span class="tooltip-class '+c+'">'+d.i18n(f.utils.unwrapObservable(b()))+"</span>"}})}}};f.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>"}})}};f.bindingHandlers.popover={init:function(a,b){var c=f.utils.unwrapObservable(b());j(a).popover({trigger:c[2]||"click",placement:c[3]||"right",
|
|
|
|
|
title:function(){return d.i18n(c[0]||"")},content:function(){return d.i18n(c[1]||"")}})}};f.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"})}};f.bindingHandlers.onEnter={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&13===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};f.bindingHandlers.onEsc={init:function(a,
|
|
|
|
|
b,c,d){j(a).on("keypress",function(c){c&&27===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};f.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,show:f.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=f.utils.unwrapObservable(b());j(a).modal(c?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",c)},1)}};f.bindingHandlers.i18nInit={init:function(a){d.i18nToNode(a)}};f.bindingHandlers.i18nUpdate={update:function(a,
|
|
|
|
|
b){f.utils.unwrapObservable(b());d.i18nToNode(a)}};f.bindingHandlers.link={update:function(a,b){j(a).attr("href",f.utils.unwrapObservable(b()))}};f.bindingHandlers.title={update:function(a,b){j(a).attr("title",f.utils.unwrapObservable(b()))}};f.bindingHandlers.textF={init:function(a,b){j(a).text(f.utils.unwrapObservable(b()))}};f.bindingHandlers.initDom={init:function(a,b){b()(a)}};f.bindingHandlers.initResizeTrigger={init:function(a,b){var c=f.utils.unwrapObservable(b());j(a).css({height:c[1],"min-height":c[1]})},
|
|
|
|
|
update:function(a,b){var c=f.utils.unwrapObservable(b()),m=d.pInt(c[1]),e=0,e=j(a).offset().top;0<e&&(e+=d.pInt(c[2]),e=O.height()-e,m<e&&(m=e),j(a).css({height:m,"min-height":m}))}};f.bindingHandlers.appendDom={update:function(a,b){j(a).hide().empty().append(f.utils.unwrapObservable(b())).show()}};f.bindingHandlers.draggable={init:function(a,b){j(a).draggable({distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},helper:function(a){return b()(a&&a.target?f.dataFor(a.target):null)}}).on("mousedown",
|
|
|
|
|
function(){d.removeInFocus()})}};f.bindingHandlers.droppable={init:function(a,b){var c=b();!1!==c&&j(a).droppable({tolerance:"pointer",hoverClass:"droppableHover",drop:function(a,b){c(a,b)}})}};f.bindingHandlers.nano={init:function(a){ia||j(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}};f.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=f.utils.unwrapObservable(b()),d=j(a);switch(c.toString()){case "1":d.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case "0":d.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case "-2":d.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:d.find(".animated").hide().end().find(".error,.success").removeClass("visible")}}};
|
|
|
|
|
f.bindingHandlers.select2={init:function(a,b){var c=0,m=null,g=new h.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),r=new h.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),v=function(){return""},k=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===c?(k(a),c=h.setTimeout(d.emptyFunction,200)):(h.clearInterval(c),c=h.setTimeout(function(){k(a)},
|
|
|
|
|
200)))},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,d){b=a&&a.c?a.c.select2Result(b):"";return""===b?d(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&g.test(a)?{id:a,text:a}:null},formatNoMatches:v,formatSearching:function(){return d.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:v,formatSelectionTooBig:v,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,
|
|
|
|
|
openOnEnter:!1});f.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),c=0,e=a.length,f=null,g=[];c<e;c++)if((f=a[c])&&f.id)f.c||(f.c=new F,(m=r.exec(d.trim(f.id)))&&!d.isUnd(m[2])?(f.c.name=m[1],f.c.email=m[2]):f.c.email=f.id),g.push(f.c);b()(g)})},update:function(a,b){for(var c=f.utils.unwrapObservable(b()),d=0,e=c.length,g=null,v="",k=[];d<e;d++)g=c[d],v=g.toLine(!1),k.push({id:v,text:v,c:g});j(a).select2("data",
|
|
|
|
|
k)}};f.bindingHandlers.command={init:function(a,b,c,d){var e=j(a),g=b();if(!g||!g.enabled||!g.canExecute)throw Error("You are not using command function");e.addClass("command");f.bindingHandlers[e.is("form")?"submit":"click"].init.apply(d,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)}};f.extenders.trimmer=function(a){var b=f.computed({read:a,write:function(b){a(d.trim(b.toString()))},owner:this});b(a());return b};f.extenders.reversible=function(a){var b=a();a.commit=function(){b=a()};a.reverse=function(){a(b)};a.commitedValue=function(){return b};return a};f.extenders.toggleSubscribe=function(a,b){a.subscribe(b[1],b[0],"beforeChange");a.subscribe(b[2],b[0]);return a};f.extenders.falseTimeout=function(a,b){a.iTimeout=0;a.subscribe(function(c){c&&(h.clearTimeout(a.iTimeout),
|
|
|
|
|
a.iTimeout=h.setTimeout(function(){a(!1);a.iTimeout=0},d.pInt(b)))});return a};f.observable.fn.validateEmail=function(){this.hasError=f.observable(!1);this.subscribe(function(a){a=d.trim(a);this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this);this.valueHasMutated();return this};f.observable.fn.validateFunc=function(a){this.hasFuncError=f.observable(!1);d.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated());return this};B.prototype.root=function(){return this.sBase};
|
|
|
|
|
B.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};B.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a};B.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};B.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"};B.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"};
|
|
|
|
|
B.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"};B.prototype.change=function(a){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+h.encodeURIComponent(a)+"/"};B.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a};B.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};B.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};B.prototype.inbox=
|
|
|
|
|
function(){return this.sBase+"mailbox/Inbox"};B.prototype.settings=function(a){var b=this.sBase+"settings";!d.isUnd(a)&&""!==a&&(b+="/"+a);return b};B.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};B.prototype.mailBox=function(a,b,c){var b=d.isNormal(b)?d.pInt(b):1,c=d.pString(c),e=this.sBase+"mailbox/";""!==a&&(e+=encodeURI(a));1<b&&(e=e.replace(/[\/]+$/,""),e+="/p"+
|
|
|
|
|
b);""!==c&&(e=e.replace(/[\/]+$/,""),e+="/"+encodeURI(c));return e};B.prototype.phpInfo=function(){return this.sServer+"Info"};B.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"};B.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"};B.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"};
|
|
|
|
|
B.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a};B.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"};B.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"};B.prototype.socialGoogle=
|
|
|
|
|
function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};B.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};B.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};x.oViewModelsHooks={};x.oSimpleHooks={};x.regViewModelHook=function(a,b){b&&(b.__hookName=a)};x.addHook=function(a,b){d.isFunc(b)&&(d.isArray(x.oSimpleHooks[a])||
|
|
|
|
|
(x.oSimpleHooks[a]=[]),x.oSimpleHooks[a].push(b))};x.runHook=function(a,b){d.isArray(x.oSimpleHooks[a])&&(b=b||[],i.each(x.oSimpleHooks[a],function(a){a.apply(null,b)}))};x.mainSettingsGet=function(a){return e?e.settingsGet(a):null};x.remoteRequest=function(a,b,c,d,f,g){e&&e.remote().defaultRequest(a,b,c,d,f,g)};x.settingsGet=function(a,b){var c=x.mainSettingsGet("Plugins");return(c=c&&d.isUnd(c[a])?null:c[a])?d.isUnd(c[b])?null:c[b]:null};t.prototype.initLanguage=function(a,b,c){this.oOptions.LangSwitcherConferm=
|
|
|
|
|
a;this.oOptions.LangSwitcherTextLabel=b;this.oOptions.LangSwitcherHtmlLabel=c};t.prototype.execCom=function(a,b,c){h.document&&(h.document.execCommand(a,b||!1,c||null),this.updateTextArea())};t.prototype.getEditorSelection=function(){var a=null;h.getSelection?a=h.getSelection():h.document.getSelection?a=h.document.getSelection():h.document.selection&&(a=h.document.selection);return a};t.prototype.getEditorRange=function(){var a=this.getEditorSelection();return!a||0===a.rangeCount?null:a.getRangeAt?
|
|
|
|
|
a.getRangeAt(0):a.createRange()};t.prototype.ec=function(a,b,c){this.execCom(a,b,c)};t.prototype.heading=function(a){this.ec("formatblock",!1,j.browser.msie?"Heading "+a:"h"+a)};t.prototype.insertImage=function(a){this.isHtml()&&!this.bOnlyPlain&&(this.htmlarea.focus(),this.ec("insertImage",!1,a))};t.prototype.focus=function(){this.isHtml()&&!this.bOnlyPlain?this.htmlarea.focus():this.textarea.focus()};t.prototype.setcolor=function(a,b){var c=null,c="";j.browser.msie&&9>d.pInt(j.browser.version)?
|
|
|
|
|
(c=this.getEditorRange())&&c.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b):(c=j.browser.msie?"forecolor"===a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(c,!1,b))};t.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")};t.prototype.toHtmlString=function(){return this.editor.innerHTML};t.prototype.toString=function(){return this.editor.innerText};t.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())};t.prototype.updateHtmlArea=
|
|
|
|
|
function(){this.editor.innerHTML=this.textarea.val()};t.prototype.setRawText=function(a,b){b&&!this.bOnlyPlain?(this.isHtml()||(this.textarea.val(""),this.switchToHtml()),this.textarea.val(a.toString()),this.updateHtmlArea()):(this.textarea.val(a.toString()),this.updateHtmlArea(),this.switchToPlain(!1))};t.prototype.clear=function(){this.textarea.val("");this.editor.innerHTML="";this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()};t.prototype.getTextForRequest=function(){this.isHtml()&&
|
|
|
|
|
this.updateTextArea();return this.textarea.val()};t.prototype.getTextFromHtml=function(a){var b="",c=function(){if(arguments&&1<arguments.length){var a=d.trim(arguments[1]).replace(/__bq__start__([\s\S\n\r]*)__bq__end__/gm,c),a="\n> "+d.trim(a).replace(/\n/gm,"\n> ")+"\n>\n";return a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+d.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},e=function(){if(arguments&&1<arguments.length){var a=d.trim(arguments[1]);0<a.length&&
|
|
|
|
|
(a=a.replace(/<div[^>]*>([\s\S]*)<\/div>/gmi,e),a="\n"+d.trim(a)+"\n");return a}return""},a=d.isUnd(a)?!0:!!a,b=this.toHtmlString().replace(/[\s]+/gm," ").replace(/<br\s?\/?>/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(/<hr[^>]*>/gmi,"\n_______________________________\n\n").replace(/<img [^>]*>/gmi,"").replace(/<div[^>]*>([\s\S]*)<\/div>/gmi,e).replace(/<blockquote[^>]*>/gmi,"\n__bq__start__\n").replace(/<\/blockquote>/gmi,
|
|
|
|
|
"\n__bq__end__\n").replace(/<a [^>]*>([\s\S]*?)<\/a>/gmi,function(){return arguments&&1<arguments.length?d.trim(arguments[1]):""}).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,"");return(a?d.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,c).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")};t.prototype.getHtmlFromText=function(){return d.convertPlainTextToHtml(this.textarea.val())};
|
|
|
|
|
t.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()};t.prototype.switchToPlain=function(a){var a=d.isUnd(a)?!0:a,b=this.getTextFromHtml(),c=i.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(b),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);!a||0===d.trim(b).length?c(!0):c(h.confirm(this.oOptions.LangSwitcherConferm))};t.prototype.switcherLinkText=
|
|
|
|
|
function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel};t.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar");j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0));this.textarea.val(this.getHtmlFromText());this.updateHtmlArea();this.textarea.hide();this.htmlarea.show();this.fOnSwitch&&this.fOnSwitch(!0)};t.prototype.addButton=function(a,b){var c=this;j("<div />").addClass("editorToolbarButtom").append(j('<a tabindex="-1" href="javascript:void(0);"></a>').addClass(a)).attr("title",
|
|
|
|
|
b).click(function(b){d.isUnd(t.htmlFunctions[a])?h.alert(a):t.htmlFunctions[a].apply(c,[j(this),b])}).appendTo(this.toolbar)};t.htmlInitToolbar=function(){if(!this.bOnlyPlain){this.addButton("bold","Bold");this.addButton("italic","Italic");this.addButton("underline","Underline");this.addButton("strikethrough","Strikethrough");this.addButton("removeformat","removeformat");this.addButton("justifyleft","justifyleft");this.addButton("justifycenter","justifycenter");this.addButton("justifyright","justifyright");
|
|
|
|
|
this.addButton("horizontalrule","horizontalrule");this.addButton("orderedlist","orderedlist");this.addButton("unorderedlist","unorderedlist");this.addButton("indent","indent");this.addButton("outdent","outdent");this.addButton("forecolor","forecolor");var a=this;j("<span />").addClass("editorSwitcher").text(a.switcherLinkText(!0)).click(function(){a.switchToggle()}).appendTo(a.toolbar)}};t.htmlInitEditor=function(){this.editor=this.htmlarea[0];this.editor.innerHTML=this.textarea.val()};t.htmlAttachEditorEvents=
|
|
|
|
|
function(){var a=this,b=function(b){if(b=(b&&b.originalEvent?b.originalEvent:b)||h.event){b.stopPropagation();b.preventDefault();var c=null,d=null;if((b=b.files||(b.dataTransfer?b.dataTransfer.files:null))&&1===b.length&&b[0]&&b[0].type&&0===b[0].type.indexOf("image/")){var d=b[0],c=new h.FileReader,e=d;c.onload=function(b){a.insertImage(b.target.result,e.name)};c.readAsDataURL(d)}}a.htmlarea.removeClass("editorDragOver")},c=function(){a.htmlarea.removeClass("editorDragOver")},d=function(b){b.stopPropagation();
|
|
|
|
|
b.preventDefault();a.htmlarea.addClass("editorDragOver")},e=function(b){(b=b&&b.clipboardData?b.clipboardData:b&&b.originalEvent&&b.originalEvent.clipboardData?b.originalEvent.clipboardData:null)&&b.items&&i.each(b.items,function(b){if(b&&(b.type&&0===b.type.indexOf("image/"))&&b.getAsFile){var c=null,d=b.getAsFile();d&&(c=new h.FileReader,c.onload=function(b){a.insertImage(b.target.result,d.name)},c.readAsDataURL(d))}})};!this.bOnlyPlain&&(h.File&&h.FileReader&&h.FileList)&&(this.htmlarea.bind("dragover",
|
|
|
|
|
d),this.htmlarea.bind("dragleave",c),this.htmlarea.bind("drop",b),this.htmlarea.bind("paste",e))};for(var mb=t,qa=[],db=[],W=0,Ja=0,Ka=0,La=0,Ma="",W=0;256>W;W+=85)Ma=W.toString(16),qa.push(1===Ma.length?"0"+Ma:Ma);La=qa.length;for(W=0;W<La;W++)for(Ja=0;Ja<La;Ja++)for(Ka=0;Ka<La;Ka++)db.push("#"+qa[W]+""+qa[Ja]+""+qa[Ka]);mb.htmlColorPickerColors=db;var nb=t,eb=j(h.document),fb=!1,ra=j('<div style="position: absolute;" class="editorFontStylePicker"><div class="editorFpFonts"></div></div>'),gb=ra.find(".editorFpFonts"),
|
|
|
|
|
hb=function(){};j.each("Arial;Arial Black;Courier New;Tahoma;Times New Roman;Verdana".split(";"),function(a,b){gb.append(j('<a href="javascript:void(0);" tabindex="-1" class="editorFpFont" style="font-family: '+b+';">'+b+"</a>").click(function(){hb(b)}));gb.append("<br />")});ra.hide();nb.htmlFontPicker=function(a,b,c){fb||(ra.appendTo(c),fb=!0);hb=b;eb.unbind("click.fpNamespace");h.setTimeout(function(){eb.one("click.fpNamespace",function(){ra.hide()})},500);b=j(a).position();ra.css("top",5+b.top+
|
|
|
|
|
j(a).height()+"px").css("left",b.left+"px").show()};var ob=t,ib=j(h.document),jb=!1,sa=j('<div style="position: absolute;" class="editorColorPicker"><div class="editorCpColors"></div></div>'),kb=sa.find(".editorCpColors"),lb=function(){};j.each(t.htmlColorPickerColors,function(a,b){kb.append('<a href="javascript:void(0);" tabindex="-1" class="editorCpColor" style="background-color: '+b+';"></a>')});sa.hide();j(".editorCpColor",kb).click(function(a){var b=1,c="#000000",a=j(a.target).css("background-color"),
|
|
|
|
|
c=a.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==c){for(delete c[0];3>=b;++b)c[b]=d.pInt(c[b]).toString(16),1===c[b].length&&(c[b]="0"+c[b]);c="#"+c.join("")}else c=a;lb(c)});ob.htmlColorPicker=function(a,b,c){jb||(sa.appendTo(c),jb=!0);c=j(a).position();lb=b;ib.unbind("click.cpNamespace");h.setTimeout(function(){ib.one("click.cpNamespace",function(){sa.hide()})},100);sa.css("top",5+c.top+j(a).height()+"px").css("left",c.left+"px").show()};t.htmlFunctions={bold:function(){this.ec("bold")},
|
|
|
|
|
italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},
|
|
|
|
|
unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){t.htmlColorPicker(a,i.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){t.htmlColorPicker(a,i.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){t.htmlFontPicker(a,i.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}};L.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)};L.prototype.init=
|
|
|
|
|
function(a,b){this.oContentVisible=a;this.oContentScrollable=b;if(this.oContentVisible&&this.oContentScrollable){var c=this;j(this.oContentVisible).on("click",this.sItemSelector,function(a){c.actionClick(f.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=f.dataFor(this);b&&(a&&a.shiftKey?c.actionClick(b,a):(c.sLastUid=c.getItemUid(b),b.selected()?(b.checked(!1),c.selectedItem(null)):b.checked(!b.checked())))});j(h.document).on("keydown",function(a){var b=!0;if(a&&c.bUseKeyboard&&
|
|
|
|
|
!d.inFocus())if(-1<d.inArray(a.keyCode,[g.EventKeyCode.Up,g.EventKeyCode.Down,g.EventKeyCode.Insert,g.EventKeyCode.Home,g.EventKeyCode.End,g.EventKeyCode.PageUp,g.EventKeyCode.PageDown]))c.newSelectPosition(a.keyCode,a.shiftKey),b=!1;else if(g.EventKeyCode.Delete===a.keyCode&&!a.ctrlKey&&!a.shiftKey){if(c.oCallbacks.onDelete)c.oCallbacks.onDelete();b=!1}return b})}};L.prototype.selectByUid=function(a,b){this.useItemSelectCallback=b=d.isUnd(b)?!0:!!b;var c=i.find(this.list(),function(b){return a===
|
|
|
|
|
this.getItemUid(b)},this);c&&this.selectedItem(c);this.useItemSelectCallback=!0};L.prototype.useKeyboard=function(a){this.bUseKeyboard=!!a};L.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;c&&a&&(b=c(a));return b.toString()};L.prototype.newSelectPosition=function(a,b){var c=this,d=0,e=!1,f=!1,v=null,k=this.list(),j=k?k.length:0,p=this.selectedItem();if(0<j)if(p){if(p)if(g.EventKeyCode.Down===a||g.EventKeyCode.Up===a||g.EventKeyCode.Insert===a)i.each(k,function(b){if(!f)switch(a){case g.EventKeyCode.Up:p===
|
|
|
|
|
b?f=!0:v=b;break;case g.EventKeyCode.Down:case g.EventKeyCode.Insert:e?(v=b,f=!0):p===b&&(e=!0)}});else if(g.EventKeyCode.Home===a||g.EventKeyCode.End===a)g.EventKeyCode.Home===a?v=k[0]:g.EventKeyCode.End===a&&(v=k[k.length-1]);else if(g.EventKeyCode.PageDown===a)for(;d<j;d++){if(p===k[d]){d+=10;d=j-1<d?j-1:d;v=k[d];break}}else if(g.EventKeyCode.PageUp===a)for(d=j;0<=d;d--)if(p===k[d]){d-=10;d=0>d?0:d;v=k[d];break}}else if(g.EventKeyCode.Down===a||g.EventKeyCode.Insert===a||g.EventKeyCode.Home===
|
|
|
|
|
a||g.EventKeyCode.PageUp===a)v=k[0];else if(g.EventKeyCode.Up===a||g.EventKeyCode.End===a||g.EventKeyCode.PageDown===a)v=k[k.length-1];v?(p&&(b?(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)&&p.checked(!p.checked()):g.EventKeyCode.Insert===a&&p.checked(!p.checked())),this.throttleSelection=!0,this.selectedItem(v),this.throttleSelection=!0,0!==this.iSelectTimer?(h.clearTimeout(this.iSelectTimer),this.iSelectTimer=h.setTimeout(function(){c.iSelectTimer=0;c.actionClick(v)},1E3)):(this.iSelectTimer=
|
|
|
|
|
h.setTimeout(function(){c.iSelectTimer=0},200),this.actionClick(v)),this.scrollToSelected()):p&&(b&&(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)?p.checked(!p.checked()):g.EventKeyCode.Insert===a&&p.checked(!p.checked()))};L.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=j(this.sItemSelectedSelector,this.oContentScrollable),b=a.position(),c=this.oContentVisible.height(),a=a.outerHeight();return b&&(0>b.top||b.top+a>c)?(0>b.top?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+
|
|
|
|
|
b.top-20):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+b.top-c+a+20),!0):!1};L.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",k=!1,i=!1,h=[],j=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid){h=this.list();j=a.checked();d=0;for(e=h.length;d<e;d++){f=h[d];g=this.getItemUid(f);k=!1;if(g===this.sLastUid||g===c)k=!0;k&&(i=!i);(i||k)&&f.checked(j)}}this.sLastUid=""===c?"":c};L.prototype.actionClick=function(a,b){if(a){var c=
|
|
|
|
|
!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked())));c&&(this.selectedItem(a),this.sLastUid=d)}};L.prototype.on=function(a,b){this.oCallbacks[a]=b};ua.supported=function(){return!0};ua.prototype.set=function(a,b){var c=j.cookie(n.Values.ClientSideCookieIndexName),d=null;try{(d=null===c?null:JSON.parse(c))||(d={}),d[a]=b,j.cookie(n.Values.ClientSideCookieIndexName,
|
|
|
|
|
JSON.stringify(d),{expires:30})}catch(e){}return d};ua.prototype.get=function(a){var b=j.cookie(n.Values.ClientSideCookieIndexName),c=null;try{c=(c=null===b?null:JSON.parse(b))&&!d.isUnd(c[a])?c[a]:null}catch(e){}return c};va.supported=function(){return!!h.localStorage};va.prototype.set=function(a,b){var c=h.localStorage[n.Values.ClientSideCookieIndexName]||null,d=null;try{(d=null===c?null:JSON.parse(c))||(d={}),d[a]=b,h.localStorage[n.Values.ClientSideCookieIndexName]=JSON.stringify(d)}catch(e){}return d};
|
|
|
|
|
va.prototype.get=function(a){var b=h.localStorage[n.Values.ClientSideCookieIndexName]||null,c=null;try{c=(c=null===b?null:JSON.parse(b))&&!d.isUnd(c[a])?c[a]:null}catch(e){}return c};wa.prototype.oDriver=null;wa.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};wa.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null};Za.prototype.bootstart=function(){};C.prototype.sPosition="";C.prototype.sTemplate="";C.prototype.viewModelName="";C.prototype.viewModelDom=
|
|
|
|
|
null;C.prototype.viewModelTemplate=function(){return this.sTemplate};C.prototype.viewModelPosition=function(){return this.sPosition};C.prototype.cancelCommand=C.prototype.closeCommand=function(){};K.prototype.oCross=null;K.prototype.sScreenName="";K.prototype.aViewModels=[];K.prototype.viewModels=function(){return this.aViewModels};K.prototype.screenName=function(){return this.sScreenName};K.prototype.routes=function(){return null};K.prototype.__cross=function(){return this.oCross};K.prototype.__start=
|
|
|
|
|
function(){var a=this.routes(),b=null,c=null;d.isNonEmptyArray(a)&&(c=i.bind(this.onRoute||d.emptyFunction,this),b=Ya.create(),i.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)};E.prototype.sDefaultScreenName="";E.prototype.oScreens={};E.prototype.oBoot=null;E.prototype.oCurrentScreen=null;E.prototype.showLoading=function(){j("#rl-loading").show()};E.prototype.hideLoading=function(){j("#rl-loading").hide()};E.prototype.routeOff=function(){Q.changed.active=!1};E.prototype.routeOn=
|
|
|
|
|
function(){Q.changed.active=!0};E.prototype.setBoot=function(a){d.isNormal(a)&&(this.oBoot=a);return this};E.prototype.screen=function(a){return""!==a&&!d.isUnd(this.oScreens[a])?this.oScreens[a]:null};E.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,d.isArray(c)?c:[])};E.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var c=new a(b),m=c.viewModelPosition(),g=j("#rl-content #rl-"+m.toLowerCase()),r=null;a.__builded=!0;a.__vm=c;c.data=e.data();c.viewModelName=a.__name;g&&1===
|
|
|
|
|
g.length?(r=j("<div>").addClass("rl-view-model").addClass("RL-"+c.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+c.viewModelTemplate()+'"}, i18nInit: true'),r.appendTo(g),c.viewModelDom=r,a.__dom=r,"Popups"===m&&(c.cancelCommand=c.closeCommand=d.createCommand(c,function(){o.hideScreenPopup(a)})),x.runHook("view-model-pre-build",[a.__name,c,r]),f.applyBindings(c,r[0]),this.delegateRun(c,"onBuild",[r]),x.runHook("view-model-post-build",[a.__name,c,r])):d.log("Cannot find view model position: "+
|
|
|
|
|
m)}return a?a.__vm:null};E.prototype.applyExternal=function(a,b){a&&b&&f.applyBindings(a,b)};E.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")}))};E.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),
|
|
|
|
|
x.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};E.prototype.screenOnRoute=function(a,b){var c=this,e=null,f=null;""===d.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,d.isNonEmptyArray(e.viewModels())&&i.each(e.viewModels(),function(a){this.buildViewModel(a,e)},this),this.delegateRun(e,"onBuild")),i.defer(function(){if(c.oCurrentScreen){c.delegateRun(c.oCurrentScreen,
|
|
|
|
|
"onHide");d.isNonEmptyArray(c.oCurrentScreen.viewModels())&&i.each(c.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);c.delegateRun(a.__vm,"onHide")}})}c.oCurrentScreen=e;if(c.oCurrentScreen){c.delegateRun(c.oCurrentScreen,"onShow");x.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]);d.isNonEmptyArray(c.oCurrentScreen.viewModels())&&i.each(c.oCurrentScreen.viewModels(),function(a){if(a.__vm&&
|
|
|
|
|
a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);c.delegateRun(a.__vm,"onShow");x.runHook("view-model-on-show",[a.__name,a.__vm])}},c)}(f=e.__cross())&&f.parse(b)}))}};E.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(),x.runHook("screen-pre-start",
|
|
|
|
|
[a.screenName(),a]),this.delegateRun(a,"onStart"),x.runHook("screen-post-start",[a.screenName(),a]))},this);a=Ya.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));Q.initialized.add(a.parse,a);Q.changed.add(a.parse,a);Q.init()};E.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):a;a="/"===a.substr(0,1)?a.substr(1):a;(d.isUnd(b)?0:b)?(Q.changed.active=!1,Q.setHash(a),Q.changed.active=!0):(Q.changed.active=!0,Q.setHash(a))};E.prototype.bootstart=function(){this.oBoot&&
|
|
|
|
|
this.oBoot.bootstart&&this.oBoot.bootstart();return this};o=new E;F.newInstanceFromJson=function(a){var b=new F;return b.initByJson(a)?b:null};F.prototype.name="";F.prototype.email="";F.prototype.privateType=null;F.prototype.validate=function(){return""!==this.name||""!==this.email};F.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"};F.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};F.prototype.type=function(){if(null===this.privateType&&(this.email&&
|
|
|
|
|
"@facebook.com"===this.email.substr(-13)&&(this.privateType=g.EmailType.Facebook),null===this.privateType))this.privateType=g.EmailType.Default;return this.privateType};F.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};F.prototype.parse=function(a){var a=d.trim(a),b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};F.prototype.initByJson=
|
|
|
|
|
function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&(this.name=d.trim(a.Name),this.email=d.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};F.prototype.toLine=function(a,b){var c="";""!==this.email&&(b=d.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'<a href="mailto:'+d.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+d.encodeHtml(this.name)+"</a>":this.name:(c=this.email,""!==this.name?c=b?d.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+d.encodeHtml('"'+
|
|
|
|
|
this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+d.encodeHtml(c)+"</a>"+d.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c='<a href="mailto:'+d.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+d.encodeHtml(this.email)+"</a>")));return c};F.prototype.select2Result=function(){var a="",b=e.cache().getUserPic(this.email),a=""!==b?a+('<img class="select2-user-pic pull-left" src="'+d.encodeHtml(b)+'" />'):a+('<img class="select2-user-pic pull-left" src="'+e.link().emptyContactPic()+
|
|
|
|
|
'" />');g.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+""};F.prototype.select2Selection=function(a){var b="";if(g.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};la.prototype.parse=function(a){var b=!1;a&&"Object/Contact"===a["@Object"]&&(this.idContact=d.pInt(a.IdContact),this.listName=d.pString(a.ListName),this.name=d.pString(a.Name),this.emails=d.isNonEmptyArray(a.Emails)?a.Emails:[],this.imageHash=d.pString(a.ImageHash),b=!0);return b};la.prototype.srcAttr=function(){return""===this.imageHash?e.link().emptyContactPic():e.link().getUserPicUrlFromHash(this.imageHash)};la.prototype.generateUid=
|
|
|
|
|
function(){return""+this.idContact};la.prototype.lineAsCcc=function(){var a=[];this.deleted()&&a.push("deleted");this.selected()&&a.push("selected");this.checked()&&a.push("checked");return a.join(" ")};D.newInstanceFromJson=function(a){var b=new D;return b.initByJson(a)?b:null};D.prototype.mimeType="";D.prototype.fileName="";D.prototype.estimatedSize=0;D.prototype.friendlySize="";D.prototype.isInline=!1;D.prototype.isLinked=!1;D.prototype.cid="";D.prototype.cidWithOutTags="";D.prototype.download=
|
|
|
|
|
"";D.prototype.folder="";D.prototype.uid="";D.prototype.mimeIndex="";D.prototype.initByJson=function(a){var b=!1;a&&"Object/Attachment"===a["@Object"]&&(this.mimeType=a.MimeType,this.fileName=a.FileName,this.estimatedSize=d.pInt(a.EstimatedSize),this.isInline=!!a.IsInline,this.isLinked=!!a.IsLinked,this.cid=a.CID,this.download=a.Download,this.folder=a.Folder,this.uid=a.Uid,this.mimeIndex=a.MimeIndex,this.friendlySize=d.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,
|
|
|
|
|
""),b=!0);return b};D.prototype.isImage=function(){return-1<d.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])};D.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)};D.prototype.linkDownload=function(){return e.link().attachmentDownload(this.download)};D.prototype.linkPreview=function(){return e.link().attachmentPreview(this.download)};D.prototype.linkPreviewAsPlain=function(){return e.link().attachmentPreviewAsPlain(this.download)};D.prototype.generateTransferDownloadUrl=
|
|
|
|
|
function(){var a=this.linkDownload();"http"!==a.substr(0,4)&&(a=h.location.protocol+"//"+h.location.host+h.location.pathname+a);return this.mimeType+":"+this.fileName+":"+a};D.prototype.eventDragStart=function(a,b){var c=b.originalEvent||b;a&&(c&&c.dataTransfer&&c.dataTransfer.setData)&&c.dataTransfer.setData("DownloadURL",this.generateTransferDownloadUrl());return!0};D.prototype.iconClass=function(){var a=this.mimeType.toLocaleString().split("/"),b="icon-file";a&&a[1]&&("image"===a[0]?b="icon-image":
|
|
|
|
|
"text"===a[0]?b="icon-file-xml":"audio"===a[0]?b="icon-music":"video"===a[0]?b="icon-film":-1<d.inArray(a[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".split(" "))?b="icon-file-zip":-1<d.inArray(a[1],["pdf","x-pdf"])?b="icon-file-pdf":-1<d.inArray(a[1],["exe","x-exe","x-winexe","bat"])?b="icon-console":-1<d.inArray(a[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".split(" "))?
|
|
|
|
|
b="icon-file-word":-1<d.inArray(a[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".split(" "))?b="icon-file-excel":-1<d.inArray(a[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".split(" "))&&
|
|
|
|
|
(b="icon-file-powerpoint"));return b};N.prototype.id="";N.prototype.isInline=!1;N.prototype.isLinked=!1;N.prototype.CID="";N.prototype.fromMessage=!1;N.prototype.cancel=d.emptyFunction;N.prototype.initByUploadJson=function(a){var b=!1;a&&(this.fileName(a.Name),this.size(d.isUnd(a.Size)?0:d.pInt(a.Size)),this.tempName(d.isUnd(a.TempName)?"":a.TempName),this.isInline=!1,b=!0);return b};l.newInstanceFromJson=function(a){var b=new l;return b.initByJson(a)?b:null};l.calculateFullFromatDateValue=function(a){return aa.unix(a).format("LLL")};
|
|
|
|
|
l.emailsToLine=function(a,b,c){var e=[],f=0,g=0;if(d.isNonEmptyArray(a)){f=0;for(g=a.length;f<g;f++)e.push(a[f].toLine(b,c))}return e.join(", ")};l.initEmailsFromJson=function(a){var b=0,c=0,e=null,f=[];if(d.isNonEmptyArray(a)){b=0;for(c=a.length;b<c;b++)(e=F.newInstanceFromJson(a[b]))&&f.push(e)}return f};l.replyHelper=function(a,b,c){if(a&&0<a.length)for(var e=0,f=a.length;e<f;e++)d.isUnd(b[a[e].email])&&(b[a[e].email]=!0,c.push(a[e]))};l.prototype.initByJson=function(a){var b=!1;a&&"Object/Message"===
|
|
|
|
|
a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(d.pInt(a.Size)),this.from=l.initEmailsFromJson(a.From),this.to=l.initEmailsFromJson(a.To),this.cc=l.initEmailsFromJson(a.Cc),this.bcc=l.initEmailsFromJson(a.Bcc),this.replyTo=l.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(d.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.fromEmailString(l.emailsToLine(this.from,!0)),this.toEmailsString(l.emailsToLine(this.to,
|
|
|
|
|
!0)),this.parentUid(d.pInt(a.ParentThread)),this.threads(d.isArray(a.Threads)?a.Threads:[]),this.threadsLen(d.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0);return b};l.prototype.computeSenderEmail=function(){var a=e.data().sentFolder(),b=e.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())};l.prototype.initUpdateByMessageJson=function(a){var b=!1,c=g.MessagePriority.Normal;
|
|
|
|
|
a&&"Object/Message"===a["@Object"]&&(c=d.pInt(a.Priority),this.priority(-1<d.inArray(c,[g.MessagePriority.High,g.MessagePriority.Low])?c:g.MessagePriority.Normal),this.aDraftInfo=a.DraftInfo,this.sMessageId=a.MessageId,this.sInReplyTo=a.InReplyTo,this.sReferences=a.References,this.hasAttachments(!!a.HasAttachments),this.foundedCIDs=d.isArray(a.FoundedCIDs)?a.FoundedCIDs:[],this.attachments(this.initAttachmentsFromJson(a.Attachments)),this.computeSenderEmail(),b=!0);return b};l.prototype.initAttachmentsFromJson=
|
|
|
|
|
function(a){var b=0,c=0,e=null,f=[];if(a&&"Collection/AttachmentCollection"===a["@Object"]&&d.isNonEmptyArray(a["@Collection"])){b=0;for(c=a["@Collection"].length;b<c;b++)if(e=D.newInstanceFromJson(a["@Collection"][b]))""!==e.cidWithOutTags&&(0<this.foundedCIDs.length&&0<=d.inArray(e.cidWithOutTags,this.foundedCIDs))&&(e.isLinked=!0),f.push(e)}return f};l.prototype.initFlagsByJson=function(a){var b=!1;a&&"Object/Message"===a["@Object"]&&(this.unseen(!a.IsSeen),this.flagged(!!a.IsFlagged),this.answered(!!a.IsAnswered),
|
|
|
|
|
this.forwarded(!!a.IsForwarded),b=!0);return b};l.prototype.fromToLine=function(a,b){return l.emailsToLine(this.from,a,b)};l.prototype.toToLine=function(a,b){return l.emailsToLine(this.to,a,b)};l.prototype.ccToLine=function(a,b){return l.emailsToLine(this.cc,a,b)};l.prototype.bccToLine=function(a,b){return l.emailsToLine(this.bcc,a,b)};l.prototype.lineAsCcc=function(){var a=[];this.deleted()&&a.push("deleted");this.selected()&&a.push("selected");this.checked()&&a.push("checked");this.flagged()&&a.push("flagged");
|
|
|
|
|
this.unseen()&&a.push("unseen");this.answered()&&a.push("answered");this.forwarded()&&a.push("forwarded");this.hasAttachments()&&a.push("withAttachments");this.newForAnimation()&&a.push("new");""===this.subject()&&a.push("emptySubject");0<this.parentUid()&&a.push("hasParentMessage");0<this.threadsLen()&&a.push("hasChildrenMessage");this.hasUnseenSubMessage()&&a.push("hasUnseenSubMessage");this.hasFlaggedSubMessage()&&a.push("hasFlaggedSubMessage");return a.join(" ")};l.prototype.hasVisibleAttachments=
|
|
|
|
|
function(){return!!i.find(this.attachments(),function(a){return!a.isLinked})};l.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();d.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=i.find(c,function(b){return a===b.cidWithOutTags}));return b||null};l.prototype.messageId=function(){return this.sMessageId};l.prototype.inReplyTo=function(){return this.sInReplyTo};l.prototype.references=function(){return this.sReferences};l.prototype.fromAsSingleEmail=function(){return d.isArray(this.from)&&
|
|
|
|
|
this.from[0]?this.from[0].email:""};l.prototype.viewLink=function(){return e.link().messageViewLink(this.requestHash)};l.prototype.downloadLink=function(){return e.link().messageDownloadLink(this.requestHash)};l.prototype.replyEmails=function(a){var b=[],a=d.isUnd(a)?{}:a;l.replyHelper(this.replyTo,a,b);0===b.length&&l.replyHelper(this.from,a,b);return b};l.prototype.replyAllEmails=function(a){var b=[],c=[],a=d.isUnd(a)?{}:a;l.replyHelper(this.replyTo,a,b);0===b.length&&l.replyHelper(this.from,a,
|
|
|
|
|
b);l.replyHelper(this.to,a,b);l.replyHelper(this.cc,a,c);return[b,c]};l.prototype.textBodyToString=function(){return this.body?this.body.html():""};l.prototype.attachmentsToStringLine=function(){var a=i.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""};l.prototype.getDataForWindowPopup=function(){return{popupFrom:this.fromToLine(!1),popupTo:this.toToLine(!1),popupCc:this.ccToLine(!1),popupBcc:this.bccToLine(!1),popupSubject:this.subject(),
|
|
|
|
|
popupDate:this.fullFormatDateValue(),popupAttachments:this.attachmentsToStringLine(),popupBody:this.textBodyToString()}};l.prototype.viewPopupMessage=function(a){d.windowPopupKnockout(this.getDataForWindowPopup(),"PopupsWindowSimpleMessage",this.subject(),function(b){b&&(b.document&&b.document.body)&&(j("img.lazy",b.document.body).each(function(a,b){var d=j(b),e=d.data("original"),f=d.attr("src");0<=a&&(e&&!f)&&d.attr("src",e)}),a&&h.setTimeout(function(){b.print()},100))})};l.prototype.printMessage=
|
|
|
|
|
function(){this.viewPopupMessage(!0)};l.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid};l.prototype.populateByMessageListItem=function(a){this.folderFullNameRaw=a.folderFullNameRaw;this.uid=a.uid;this.requestHash=a.requestHash;this.subject(a.subject());this.size(a.size());this.dateTimeStampInUTC(a.dateTimeStampInUTC());this.priority(a.priority());this.fromEmailString(a.fromEmailString());this.toEmailsString(a.toEmailsString());this.emails=a.emails;this.from=a.from;this.to=
|
|
|
|
|
a.to;this.cc=a.cc;this.bcc=a.bcc;this.replyTo=a.replyTo;this.unseen(a.unseen());this.flagged(a.flagged());this.answered(a.answered());this.forwarded(a.forwarded());this.selected(a.selected());this.checked(a.checked());this.hasAttachments(a.hasAttachments());this.moment(a.moment());this.body=null;this.priority(g.MessagePriority.Normal);this.aDraftInfo=[];this.sReferences=this.sInReplyTo=this.sMessageId="";this.parentUid(a.parentUid());this.threads(a.threads());this.threadsLen(a.threadsLen());this.computeSenderEmail();
|
|
|
|
|
return this};l.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=d.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),j("[data-x-src]",this.body).each(function(){a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",j(this).attr("data-x-src")).removeAttr("data-x-src"):j(this).attr("src",j(this).attr("data-x-src")).removeAttr("data-x-src")}),j("[data-x-style-url]",this.body).each(function(){var a=d.trim(j(this).attr("style")),a=""===
|
|
|
|
|
a?"":";"===a.substr(-1)?a+" ":a+"; ";j(this).attr("style",a+j(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(j("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:j(".RL-MailMessageView .messageView .messageItem .content")[0]}),O.resize()),d.windowResize(500))};l.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){var a=d.isUnd(a)?!1:a,b=this;this.body.data("rl-init-internal-images",
|
|
|
|
|
!0);j("[data-x-src-cid]",this.body).each(function(){var c=b.findAttachmentByCid(j(this).attr("data-x-src-cid"));c&&c.download&&(a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",c.linkPreview()):j(this).attr("src",c.linkPreview()))});j("[data-x-style-cid]",this.body).each(function(){var a="",c="",e=b.findAttachmentByCid(j(this).attr("data-x-style-cid"));e&&e.linkPreview&&(c=j(this).attr("data-x-style-cid-name"),""!==c&&(a=d.trim(j(this).attr("style")),a=""===a?"":";"===a.substr(-1)?
|
|
|
|
|
a+" ":a+"; ",j(this).attr("style",a+c+": url('"+e.linkPreview()+"')")))});if(a){var c=j("img.lazy",b.body),e=j(".RL-MailMessageView .messageView .messageItem .content")[0];i.delay(function(){c.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:e})},300)}d.windowResize(500)}};G.newInstanceFromJson=function(a){var b=new G;return b.initByJson(a)?b.initComputed():null};G.prototype.initComputed=function(){this.hasSubScribedSubfolders=f.computed(function(){return!!i.find(this.subFolders(),
|
|
|
|
|
function(a){return a.subScribed()})},this);this.visible=f.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this);this.isSystemFolder=f.computed(function(){return g.FolderType.User!==this.type()},this);this.hidden=f.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this);this.selectableForFolderList=f.computed(function(){return!this.isSystemFolder()&&
|
|
|
|
|
this.selectable},this);this.messageCountAll=f.computed({read:this.privateMessageCountAll,write:function(a){d.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this});this.messageCountUnread=f.computed({read:this.privateMessageCountUnread,write:function(a){d.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this});this.printableUnreadCount=f.computed(function(){var a=this.messageCountAll(),
|
|
|
|
|
b=this.messageCountUnread(),c=this.type();return 0<b&&(g.FolderType.Inbox===c||g.FolderType.Spam===c)?""+b:0<a&&g.FolderType.Draft===c?""+a:""},this);this.canBeDeleted=f.computed(function(){return!this.isSystemFolder()&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this);this.canBeSubScribed=f.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this);this.visible.subscribe(function(){d.timeOutAction("folder-list-folder-visibility-change",function(){O.trigger("folder-list-folder-visibility-change")},
|
|
|
|
|
100)});this.localName=f.computed(function(){ja();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case g.FolderType.Inbox:b=d.i18n("FOLDER_LIST/INBOX_NAME");break;case g.FolderType.SentItems:b=d.i18n("FOLDER_LIST/SENT_NAME");break;case g.FolderType.Draft:b=d.i18n("FOLDER_LIST/DRAFTS_NAME");break;case g.FolderType.Spam:b=d.i18n("FOLDER_LIST/SPAM_NAME");break;case g.FolderType.Trash:b=d.i18n("FOLDER_LIST/TRASH_NAME")}return b},this);this.manageFolderSystemName=f.computed(function(){ja();
|
|
|
|
|
var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case g.FolderType.Inbox:a="("+d.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case g.FolderType.SentItems:a="("+d.i18n("FOLDER_LIST/SENT_NAME")+")";break;case g.FolderType.Draft:a="("+d.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case g.FolderType.Spam:a="("+d.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case g.FolderType.Trash:a="("+d.i18n("FOLDER_LIST/TRASH_NAME")+")"}if(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())a="";return a},
|
|
|
|
|
this);this.collapsed=f.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this});return this};G.prototype.fullName="";G.prototype.fullNameRaw="";G.prototype.fullNameHash="";G.prototype.delimiter="";G.prototype.namespace="";G.prototype.deep=0;G.prototype.isNamespaceFolder=!1;G.prototype.isGmailFolder=!1;G.prototype.isUnpaddigFolder=!1;G.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-arrow-right-3 e-collapsed-sign":
|
|
|
|
|
"icon-arrow-down-3 e-collapsed-sign":"icon-none e-collapsed-sign"};G.prototype.initByJson=function(a){var b=!1;a&&"Object/Folder"===a["@Object"]&&(this.name(a.Name),this.delimiter=a.Delimiter,this.fullName=a.FullName,this.fullNameRaw=a.FullNameRaw,this.fullNameHash=a.FullNameHash,this.deep=a.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!a.IsSelectable,this.existen=!!a.IsExisten,this.subScribed(!!a.IsSubscribed),this.type("INBOX"===this.fullNameRaw?g.FolderType.Inbox:g.FolderType.User),
|
|
|
|
|
b=!0);return b};G.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")};Na.prototype.email="";Na.prototype.changeAccountLink=function(){return e.link().change(this.email)};d.extendAsViewModel("PopupsFolderClearViewModel",xa);xa.prototype.clearPopup=function(){this.clearingProcess(!1);this.selectedFolder(null)};xa.prototype.onShow=function(a){this.clearPopup();a&&this.selectedFolder(a)};d.extendAsViewModel("PopupsFolderCreateViewModel",ca);ca.prototype.sNoParentText=
|
|
|
|
|
"";ca.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(d.trim(a))};ca.prototype.clearPopup=function(){this.folderName("");this.selectedParentValue("");this.focusTrigger(!1)};ca.prototype.onShow=function(){this.clearPopup();this.focusTrigger(!0)};d.extendAsViewModel("PopupsFolderSystemViewModel",Y);Y.prototype.sChooseOnText="";Y.prototype.sUnuseText="";Y.prototype.onShow=function(a){var b="",a=d.isUnd(a)?g.SetSystemFoldersNotification.None:a;switch(a){case g.SetSystemFoldersNotification.Sent:b=
|
|
|
|
|
d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case g.SetSystemFoldersNotification.Draft:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case g.SetSystemFoldersNotification.Spam:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case g.SetSystemFoldersNotification.Trash:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)};d.extendAsViewModel("PopupsComposeViewModel",y);y.prototype.formattedFrom=function(){var a=e.data().displayName(),b=e.data().accountEmail();
|
|
|
|
|
return""===a?b:a+" ("+b+")"};y.prototype.sendMessageResponse=function(a,b){var c=!1;this.sending(!1);g.StorageResultType.Success===a&&(b&&b.Result)&&(c=!0,this.modalVisibility()&&o.delegateRun(this,"closeCommand"));this.modalVisibility()&&!c&&(b&&g.Notification.CantSaveMessage===b.ErrorCode?(this.sendSuccessButSaveError(!0),h.alert(d.trim(d.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),h.alert(d.getNotification(b.ErrorCode?b.ErrorCode:g.Notification.CantSendMessage))))};y.prototype.saveMessageResponse=
|
|
|
|
|
function(a,b){var c=!1,f=null;this.saving(!1);if(g.StorageResultType.Success===a&&(b&&b.Result)&&(b.Result.NewFolder&&b.Result.NewUid)&&(this.bFromDraft&&(f=e.data().message())&&(this.draftFolder()===f.folderFullNameRaw&&this.draftUid()===f.uid)&&e.data().message(null),this.draftFolder(b.Result.NewFolder),this.draftUid(b.Result.NewUid),this.draftID(b.Result.NewID),this.modalVisibility()))this.savedTime(h.Math.round((new h.Date).getTime()/1E3)),this.savedOrSendingText(0<this.savedTime()?d.i18n("COMPOSE/SAVED_TIME",
|
|
|
|
|
{TIME:aa.unix(this.savedTime()-1).format("LT")}):""),c=!0,this.bFromDraft&&e.cache().setFolderHash(this.draftFolder(),"");!this.modalVisibility()&&!c&&(this.savedError(!0),this.savedOrSendingText(d.getNotification(g.Notification.CantSaveMessage)))};y.prototype.onHide=function(){o.routeOn()};y.prototype.onShow=function(a,b,c){o.routeOff();var f=this,X="",r="",v="",k="",h="",p=null,k=p="",l=[],X={},k=e.data().accountEmail(),s=[],s=r=null,l=!1,a=a||g.ComposeType.Empty;(b=b||null)&&d.isNormal(b)&&(s=
|
|
|
|
|
d.isArray(b)&&1===b.length?b[0]:!d.isArray(b)?b:null);null!==k&&(X[k]=!0);this.reset();d.isNonEmptyArray(c)&&this.to(c);if(""!==a&&s){k=s.fullFormatDateValue();h=s.subject();r=s.aDraftInfo;p=j(s.body).clone();d.removeBlockquoteSwitcher(p);p=p.html();switch(a){case g.ComposeType.Reply:this.to(s.replyEmails(X));this.subject(d.replySubjectAdd("Re",h));this.prepearMessageAttachments(s,a);this.aDraftInfo=["reply",s.uid,s.folderFullNameRaw];this.sInReplyTo=s.sMessageId;this.sReferences=d.trim(this.sInReplyTo+
|
|
|
|
|
" "+s.sReferences);l=!0;break;case g.ComposeType.ReplyAll:l=s.replyAllEmails(X);this.to(l[0]);this.cc(l[1]);this.subject(d.replySubjectAdd("Re",h));this.prepearMessageAttachments(s,a);this.aDraftInfo=["reply",s.uid,s.folderFullNameRaw];this.sInReplyTo=s.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+s.references());l=!0;break;case g.ComposeType.Forward:this.subject(d.replySubjectAdd("Fwd",h));this.prepearMessageAttachments(s,a);this.aDraftInfo=["forward",s.uid,s.folderFullNameRaw];this.sInReplyTo=
|
|
|
|
|
s.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+s.sReferences);break;case g.ComposeType.ForwardAsAttachment:this.subject(d.replySubjectAdd("Fwd",h));this.prepearMessageAttachments(s,a);this.aDraftInfo=["forward",s.uid,s.folderFullNameRaw];this.sInReplyTo=s.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+s.sReferences);break;case g.ComposeType.Draft:this.to(s.to),this.cc(s.cc),this.bcc(s.bcc),this.bFromDraft=!0,this.draftFolder(s.folderFullNameRaw),this.draftUid(s.uid),this.draftID(s.messageId()),
|
|
|
|
|
this.subject(h),this.prepearMessageAttachments(s,a),this.aDraftInfo=d.isNonEmptyArray(r)&&3===r.length?r:null,this.sInReplyTo=s.sInReplyTo,this.sReferences=s.sReferences}if(this.oEditor){switch(a){case g.ComposeType.Reply:case g.ComposeType.ReplyAll:X=s.fromToLine(!1,!0);k=d.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:k,EMAIL:X});p="<br /><br />"+k+":<blockquote><br />"+p+"</blockquote>";break;case g.ComposeType.Forward:X=s.fromToLine(!1,!0);r=s.toToLine(!1,!0);v=s.ccToLine(!1,!0);p="<br /><br /><br />"+
|
|
|
|
|
d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+X+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+r+(0<v.length?"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+v:"")+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+d.encodeHtml(k)+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+d.encodeHtml(h)+"<br /><br />"+p;break;case g.ComposeType.ForwardAsAttachment:p=""}this.oEditor.setRawText(p,s.isHtml)}}else this.oEditor&&
|
|
|
|
|
g.ComposeType.Empty===a?this.oEditor.setRawText("<br />"+d.convertPlainTextToHtml(e.data().signature()),g.EditorDefaultType.Html===e.data().editorDefaultType()):d.isNonEmptyArray(b)&&i.each(b,function(a){f.addMessageAsAttachment(a)});s=this.getAttachmentsDownloadsForUpload();d.isNonEmptyArray(s)&&e.remote().messageUploadAttachments(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!f.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=f.getAttachmentById(b.Result[d]))&&
|
|
|
|
|
c.tempName(d)}else f.setMessageAttachmentFailedDowbloadText()},s);l&&this.oEditor&&this.oEditor.focus();this.triggerForResize()};y.prototype.onBuild=function(){this.initEditor();this.initUploader();var a=this,b=null;O.on("keydown",function(b){var d=!0;b&&(a.modalVisibility()&&e.data().useKeyboardShortcuts())&&(b.ctrlKey&&g.EventKeyCode.S===b.keyCode)&&(a.saveCommand(),d=!1);return d});O.on("resize",function(){a.triggerForResize()});this.dropboxEnabled()&&(b=document.createElement("script"),b.type=
|
|
|
|
|
"text/javascript",b.src="https://www.dropbox.com/static/api/1/dropins.js",j(b).attr("id","dropboxjs").attr("data-app-key",e.settingsGet("DropboxApiKey")),document.body.appendChild(b))};y.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;c<d;c++)if(b[c]&&a===b[c].id)return b[c];return null};y.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new t(this.composeEditorTextArea(),
|
|
|
|
|
this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}});this.oEditor.initLanguage(d.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),d.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),d.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}};y.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=d.pInt(e.settingsGet("AttachmentLimit")),c=new ta({action:e.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,
|
|
|
|
|
clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace(),onDragEnter:i.bind(function(){this.dragAndDropOver(!0)},this),onDragLeave:i.bind(function(){this.dragAndDropOver(!1)},this),onBodyDragEnter:i.bind(function(){this.dragAndDropVisible(!0)},this),onBodyDragLeave:i.bind(function(){this.dragAndDropVisible(!1)},this),onProgress:i.bind(function(b,c,e){var f=null;d.isUnd(a[b])?(f=this.getAttachmentById(b))&&(a[b]=f):f=a[b];f&&f.progress(" - "+Math.floor(100*(c/e))+
|
|
|
|
|
"%")},this),onSelect:i.bind(function(a,e){this.dragAndDropOver(!1);var f=this,g=d.isUnd(e.FileName)?"":e.FileName.toString(),k=d.isNormal(e.Size)?d.pInt(e.Size):null,g=new N(a,g,k);g.cancel=function(){f.attachments.remove(function(b){return b&&b.id===a});c&&c.cancel(a)};this.attachments.push(g);return 0<k&&0<b&&b<k?(g.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:i.bind(function(b){var c=null;d.isUnd(a[b])?(c=this.getAttachmentById(b))&&(a[b]=c):c=a[b];c&&(c.waiting(!1),c.uploading(!0))},
|
|
|
|
|
this),onComplete:i.bind(function(b,c,e){var f="",g=null,i=null,h=this.getAttachmentById(b),i=c&&e&&e.Result&&e.Result.Attachment?e.Result.Attachment:null,g=e&&e.Result&&e.Result.ErrorCode?e.Result.ErrorCode:null;null!==g?f=d.getUploadErrorDescByCode(g):i||(f=d.i18n("UPLOAD/ERROR_UNKNOWN"));h&&(""!==f&&0<f.length?h.waiting(!1).uploading(!1).error(f):i&&(h.waiting(!1).uploading(!1),h.initByUploadJson(i)),d.isUnd(a[b])&&delete a[b])},this)});c?this.addAttachmentEnabled(!0).dragAndDropEnabled(c.isDragAndDropSupported()):
|
|
|
|
|
this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}};y.prototype.prepearAttachmentsForSendOrSave=function(){var a={};i.each(this.attachmentsInReady(),function(b){b&&(""!==b.tempName()&&b.enabled())&&(a[b.tempName()]=[b.fileName(),b.isInline?"1":"0",b.CID])});return a};y.prototype.addMessageAsAttachment=function(a){if(a){var b=this,c=null,c=a.subject(),c=".eml"===c.substr(-4).toLowerCase()?c:c+".eml",c=new N(a.requestHash,c,a.size());c.fromMessage=!0;var d=a.requestHash;c.cancel=function(){b.attachments.remove(function(a){return a&&
|
|
|
|
|
a.id===d})};c.waiting(!1).uploading(!0);this.attachments.push(c)}};y.prototype.addDropboxAttachment=function(a){var b=this,c=d.pInt(e.settingsGet("AttachmentLimit")),f=null,i=a.bytes,f=new N(a.link,a.name,i);f.fromMessage=!1;var r=a.link;f.cancel=function(){b.attachments.remove(function(a){return a&&a.id===r})};f.waiting(!1).uploading(!0);this.attachments.push(f);if(0<i&&0<c&&c<i)return f.uploading(!1),f.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1;e.remote().composeUploadExternals(function(a,
|
|
|
|
|
b){var c=!1;f.uploading(!1);g.StorageResultType.Success===a&&(b&&b.Result)&&b.Result[f.id]&&(c=!0,f.tempName(b.Result[f.id]));c||f.error(d.getUploadErrorDescByCode(g.UploadErrorCode.FileNoUploaded))},[a.link]);return!0};y.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,e=d.isNonEmptyArray(a.attachments())?a.attachments():[],f=0,i=e.length,h=null,k=null,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(g.ComposeType.ForwardAsAttachment===
|
|
|
|
|
b)this.addMessageAsAttachment(a);else for(;f<i;f++)k=e[f],h=new N(k.download,k.fileName,k.estimatedSize,k.isInline,k.isLinked,k.cid),h.fromMessage=!0,h.cancel=j(k.download),h.waiting(!1).uploading(!0),this.attachments.push(h)}};y.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})};y.prototype.setMessageAttachmentFailedDowbloadText=function(){i.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(d.getUploadErrorDescByCode(g.UploadErrorCode.FileNoUploaded))},
|
|
|
|
|
this)};y.prototype.isEmptyForm=function(a){a=(a=d.isUnd(a)?!0:!!a)?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&&a&&""===this.oEditor.getTextForRequest()};y.prototype.reset=function(){this.to([]);this.cc([]);this.bcc([]);this.subject("");this.aDraftInfo=null;this.sInReplyTo="";this.bFromDraft=!1;this.sReferences="";this.bReloadFolder=!1;this.sendError(!1);this.sendSuccessButSaveError(!1);
|
|
|
|
|
this.savedError(!1);this.savedTime(0);this.savedOrSendingText("");this.emptyToError(!1);this.showCcAndBcc(!1);this.attachments([]);this.dragAndDropOver(!1);this.dragAndDropVisible(!1);this.draftFolder("");this.draftUid("");this.draftID("");this.sending(!1);this.saving(!1);this.oEditor&&this.oEditor.clear()};y.prototype.getAttachmentsDownloadsForUpload=function(){return i.map(i.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})};y.prototype.triggerForResize=
|
|
|
|
|
function(){this.resizer(!this.resizer())};d.extendAsViewModel("PopupsContactsViewModel",M);M.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contactsCheckedOrSelected();0<d.length&&(i.each(d,function(b){c&&c.idContact===b.idContact&&(c=null,a.currentContact(null));b.deleted(!0)}),i.delay(function(){i.each(d,function(a){b.remove(a)})},500))};M.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&
|
|
|
|
|
(e.remote().contactsDelete(i.bind(this.deleteResponse,this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())};M.prototype.deleteResponse=function(a,b){500<(g.StorageResultType.Success===a&&b&&b.Time?d.pInt(b.Time):0)?this.reloadContactList():i.delay(function(a){return function(){a.reloadContactList()}}(this),500)};M.prototype.populateViewContact=function(a){this.imageTrigger(!1);this.emptySelection(!1);a?(this.viewID(a.idContact),this.viewName(a.name),this.viewEmail(a.emails[0]||
|
|
|
|
|
""),this.viewImageUrl(a.srcAttr())):(this.viewID(""),this.viewName(""),this.viewEmail(""),this.viewImageUrl(e.link().emptyContactPic()))};M.prototype.reloadContactList=function(){var a=this;this.contacts.loading(!0);e.remote().contacts(function(b,c){var e=[];g.StorageResultType.Success===b&&(c&&c.Result&&c.Result.List)&&d.isNonEmptyArray(c.Result.List)&&(e=i.map(c.Result.List,function(a){var b=new la;return b.parse(a)?b:null}),e=i.compact(e));a.contacts(e);a.viewClearSearch(""!==a.search());a.contacts.loading(!1);
|
|
|
|
|
""!==a.viewID()&&(!a.currentContact()&&a.contacts.setSelectedByUid)&&a.contacts.setSelectedByUid(""+a.viewID())},this.search())};M.prototype.onBuild=function(a){this.initUploader();this.oContentVisible=j(".b-list-content",a);this.oContentScrollable=j(".content",this.oContentVisible);this.selector.init(this.oContentVisible,this.oContentScrollable);this.viewImageUrl.valueHasMutated();f.computed(function(){var a=this.modalVisibility(),c=e.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&c)},
|
|
|
|
|
this).extend({notify:"always"})};M.prototype.initUploader=function(){var a=this,b=null;h.File&&(h.FileReader&&this.imageUploader())&&(b=new ta({queueSize:1,multipleSizeLimit:1,clickElement:this.imageUploader(),disableDragAndDrop:!0,disableMultiple:!0,onSelect:function(b,e){if(e&&e.File&&e.File.type){var f=null,g=e.File;e.File.type.match(/image.*/)?(f=new h.FileReader,f.onload=function(b){b&&(b.target&&b.target.result)&&d.resizeAndCrop(b.target.result,150,function(b){a.viewImageUrl(b);a.imageTrigger(!0)})},
|
|
|
|
|
f.readAsDataURL(g)):h.alert("this file is not an image.")}return!1}}));return b};M.prototype.onShow=function(){o.routeOff();this.reloadContactList()};M.prototype.onHide=function(){o.routeOn();this.currentContact(null);this.emptySelection(!0);this.search("");i.each(this.contacts(),function(a){a.checked(!1)})};d.extendAsViewModel("PopupsAdvancedSearchViewModel",da);da.prototype.buildSearchStringValue=function(a){-1<a.indexOf(" ")&&(a='"'+a+'"');return a};da.prototype.buildSearchString=function(){var a=
|
|
|
|
|
[],b=d.trim(this.from()),c=d.trim(this.to()),e=d.trim(this.subject()),f=d.trim(this.text());b&&""!==b&&a.push("from:"+this.buildSearchStringValue(b));c&&""!==c&&a.push("to:"+this.buildSearchStringValue(c));e&&""!==e&&a.push("subject:"+this.buildSearchStringValue(e));this.hasAttachments()&&a.push("has:attachments");-1<this.selectedDateValue()&&a.push("date:"+aa().subtract("days",this.selectedDateValue()).format("YYYY.MM.DD")+"/");f&&""!==f&&a.push("text:"+this.buildSearchStringValue(f));return d.trim(a.join(" "))};
|
|
|
|
|
da.prototype.clearPopup=function(){this.from("");this.to("");this.subject("");this.text("");this.selectedDateValue(-1);this.hasAttachments(!1);this.fromFocus(!0)};da.prototype.onShow=function(){this.clearPopup();this.fromFocus(!0)};d.extendAsViewModel("PopupsAddAccountViewModel",ea);ea.prototype.clearPopup=function(){this.email("");this.login("");this.password("");this.emailError(!1);this.loginError(!1);this.passwordError(!1);this.submitRequest(!1);this.submitError("")};ea.prototype.onShow=function(){this.clearPopup();
|
|
|
|
|
this.emailFocus(!0)};ea.prototype.onBuild=function(){this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"))};d.extendAsViewModel("LoginViewModel",ma);ma.prototype.onShow=function(){o.routeOff();i.delay(i.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0)},this),100)};ma.prototype.onHide=function(){this.submitFocus(!1);this.emailFocus(!1)};ma.prototype.onBuild=function(){var a=this,b=e.settingsGet("JsHash"),c=function(b){b=d.pInt(b);0===b?(a.submitRequest(!0),
|
|
|
|
|
e.loginAndLogoutReload()):a.submitError(d.getNotification(b))};this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"));this.facebookLoginEnabled(!!e.settingsGet("AllowFacebookSocial"));this.twitterLoginEnabled(!!e.settingsGet("AllowTwitterSocial"));this.googleLoginEnabled(!!e.settingsGet("AllowGoogleSocial"));switch((e.settingsGet("SignMe")||"unused").toLowerCase()){case g.LoginSignMeTypeAsString.DefaultOff:this.signMeType(g.LoginSignMeType.DefaultOff);break;case g.LoginSignMeTypeAsString.DefaultOn:this.signMeType(g.LoginSignMeType.DefaultOn);
|
|
|
|
|
break;default:case g.LoginSignMeTypeAsString.Unused:this.signMeType(g.LoginSignMeType.Unused)}this.email(e.data().devEmail);this.login(e.data().devLogin);this.password(e.data().devPassword);this.googleLoginEnabled()&&(h["rl_"+b+"_google_login_service"]=c);this.facebookLoginEnabled()&&(h["rl_"+b+"_facebook_login_service"]=c);this.twitterLoginEnabled()&&(h["rl_"+b+"_twitter_login_service"]=c)};i.extend(R.prototype,C.prototype);R.prototype.accountClick=function(a,b){if(a&&b&&!d.isUnd(b.which)&&1===b.which){var c=
|
|
|
|
|
this;this.accountsLoading(!0);i.delay(function(){c.accountsLoading(!1)},1E3)}return!0};R.prototype.emailTitle=function(){return e.data().accountEmail()};R.prototype.settingsClick=function(){o.setHash(e.link().settings())};R.prototype.addAccountClick=function(){this.allowAddAccount&&o.showScreenPopup(ea)};R.prototype.logoutClick=function(){e.remote().logout(function(){h.__rlah_clear&&h.__rlah_clear();e.loginAndLogoutReload(!0,e.settingsGet("ParentEmail")&&0<e.settingsGet("ParentEmail").length)})};
|
|
|
|
|
i.extend($a.prototype,R.prototype);i.extend(ab.prototype,R.prototype);d.extendAsViewModel("MailBoxFolderListViewModel",fa);fa.prototype.onBuild=function(a){a.on("click",".b-folders .e-item .e-link .e-collapsed-sign",function(a){var c=f.dataFor(this),e=!1;c&&a&&(e=c.collapsed(),d.setExpandedFolder(c.fullNameHash,e),c.collapsed(!e),a.preventDefault(),a.stopPropagation())}).on("click",".b-folders .e-item .e-link.selectable",function(a){a.preventDefault();if(a=f.dataFor(this))e.data().usePreviewPane()||
|
|
|
|
|
e.data().message(null),a.fullNameRaw===e.data().currentFolderFullNameRaw()&&e.cache().setFolderHash(a.fullNameRaw,""),o.setHash(e.link().mailBox(a.fullNameHash))})};fa.prototype.messagesDrop=function(a,b){if(a&&b&&b.helper){var c=b.helper.data("rl-folder"),e=b.helper.data("rl-uids");z&&(z.__vm&&d.isNormal(c)&&d.isArray(e))&&z.__vm.moveMessagesToFolder(c,e,a.fullNameRaw)}};fa.prototype.composeClick=function(){o.showScreenPopup(y)};fa.prototype.contactsClick=function(){this.allowContacts&&o.showScreenPopup(M)};
|
|
|
|
|
d.extendAsViewModel("MailBoxMessageListViewModel",z);z.prototype.emptySubjectValue="";z.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue);this.inputMessageListSearchFocus(!1)};z.prototype.cancelSearch=function(){this.mainMessageListSearch("");this.inputMessageListSearchFocus(!1)};z.prototype.removeMessagesFromList=function(a,b,c,f){var c=d.isNormal(c)?c:"",f=d.isUnd(f)?!1:!!f,g=0,r=e.data(),h=e.cache().getFolderFromCacheList(a),k=""===c?null:e.cache().getFolderFromCacheList(c||
|
|
|
|
|
""),j=r.currentFolderFullNameRaw(),p=r.message(),l=j===a?i.filter(r.messageList(),function(a){return a&&-1<d.inArray(a.uid,b)}):[];f||i.each(l,function(a){a&&a.unseen()&&g++});h&&!f&&(h.messageCountAll(0<=h.messageCountAll()-b.length?h.messageCountAll()-b.length:0),0<g&&h.messageCountUnread(0<=h.messageCountUnread()-g?h.messageCountUnread()-g:0));k&&!f&&(k.messageCountAll(k.messageCountAll()+b.length),0<g&&k.messageCountUnread(k.messageCountUnread()+g));0<l.length&&(i.each(l,function(a){if(p&&p.requestHash===
|
|
|
|
|
a.requestHash){p=null;r.message(null)}a.deleted(true)}),i.delay(function(){i.each(l,function(a){r.messageList.remove(a)})},400),f||(e.data().messageListIsNotCompleted(!0),e.cache().setFolderHash(a,""),d.isNormal(c)&&e.cache().setFolderHash(c||"","")))};z.prototype.removeCheckedOrSelectedMessagesFromList=function(a){this.removeMessagesFromList(e.data().currentFolderFullNameRaw(),i.map(e.data().messageListCheckedOrSelected(),function(a){return a.uid}),a)};z.prototype.moveOrDeleteResponse=function(a,
|
|
|
|
|
b){g.StorageResultType.Success===a&&e.data().currentFolder()&&(b&&d.isArray(b.Result)&&2===b.Result.length?e.cache().setFolderHash(b.Result[0],b.Result[1]):(b&&g.Notification.CantMoveMessage===b.ErrorCode&&h.alert(d.getNotification(g.Notification.CantMoveMessage)),e.cache().setFolderHash(e.data().currentFolderFullNameRaw(),"")),e.reloadMessageList(),e.quotaDebounce())};z.prototype.moveMessagesToFolder=function(a,b,c){if(a!==c&&d.isArray(b)&&0<b.length){var f=e.cache().getFolderFromCacheList(a),g=
|
|
|
|
|
e.cache().getFolderFromCacheList(c);if(f&&g)return e.remote().messagesMove(i.bind(this.moveOrDeleteResponse,this),f.fullNameRaw,g.fullNameRaw,b),g.actionBlink(!0),this.removeMessagesFromList(a,b,c),!0}return!1};z.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()?this.moveMessagesToFolder(e.data().currentFolderFullNameRaw(),e.data().messageListCheckedOrSelectedUidsWithSubMails(),a):!1};z.prototype.deleteSelectedMessageFromCurrentFolder=function(a,b){if(this.canBeMoved()){var b=
|
|
|
|
|
d.isUnd(b)?!0:!!b,c=e.cache().getFolderFromCacheList(g.FolderType.Spam===a?e.data().spamFolder():e.data().trashFolder());!c&&b?o.showScreenPopup(Y,[g.FolderType.Spam===a?g.SetSystemFoldersNotification.Spam:g.SetSystemFoldersNotification.Trash]):!b||c&&(n.Values.UnuseOptionValue===c.fullNameRaw||e.data().currentFolderFullNameRaw()===c.fullNameRaw)?(e.remote().messagesDelete(i.bind(this.moveOrDeleteResponse,this),e.data().currentFolderFullNameRaw(),e.data().messageListCheckedOrSelectedUidsWithSubMails()),
|
|
|
|
|
this.removeCheckedOrSelectedMessagesFromList()):c&&(e.remote().messagesMove(i.bind(this.moveOrDeleteResponse,this),e.data().currentFolderFullNameRaw(),c.fullNameRaw,e.data().messageListCheckedOrSelectedUidsWithSubMails()),c.actionBlink(!0),this.removeCheckedOrSelectedMessagesFromList(c.fullNameRaw))}};z.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);a=d.draggeblePlace();a.data("rl-folder",e.data().currentFolderFullNameRaw());a.data("rl-uids",e.data().messageListCheckedOrSelectedUidsWithSubMails());
|
|
|
|
|
a.find(".text").text(e.data().messageListCheckedOrSelectedUidsWithSubMails().length);return a};z.prototype.onMessageResponse=function(a,b,c){var f=e.data();f.messageLoading(!1);g.StorageResultType.Success===a&&b&&b.Result?f.setMessage(b,c):g.StorageResultType.Unload===a?(f.message(null),f.messageError("")):g.StorageResultType.Abort!==a&&(f.message(null),f.messageError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.getNotification(g.Notification.UnknownError)))};z.prototype.populateMessageBody=function(a){a&&
|
|
|
|
|
(e.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?e.data().messageLoading(!0):d.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))};z.prototype.setAction=function(a,b,c){var f=[],h=null,r=e.cache(),j=0;d.isUnd(c)&&(c=e.data().messageListChecked());f=i.map(c,function(a){return a.uid});if(""!==a&&0<f.length){switch(b){case g.MessageSetAction.SetSeen:i.each(c,function(a){a.unseen()&&j++;a.unseen(!1);r.storeMessageFlagsToCache(a)});(h=r.getFolderFromCacheList(a))&&
|
|
|
|
|
h.messageCountUnread(h.messageCountUnread()-j);e.remote().messageSetSeen(d.emptyFunction,a,f,!0);break;case g.MessageSetAction.UnsetSeen:i.each(c,function(a){a.unseen()&&j++;a.unseen(!0);r.storeMessageFlagsToCache(a)});(h=r.getFolderFromCacheList(a))&&h.messageCountUnread(h.messageCountUnread()-j+f.length);e.remote().messageSetSeen(d.emptyFunction,a,f,!1);break;case g.MessageSetAction.SetFlag:i.each(c,function(a){a.flagged(!0);r.storeMessageFlagsToCache(a)});e.remote().messageSetFlagged(d.emptyFunction,
|
|
|
|
|
a,f,!0);break;case g.MessageSetAction.UnsetFlag:i.each(c,function(a){a.flagged(!1);r.storeMessageFlagsToCache(a)}),e.remote().messageSetFlagged(d.emptyFunction,a,f,!1)}e.reloadFlagsCurrentMessageListAndMessageFromCache()}};z.prototype.setActionForAll=function(a,b){var c=null,f=e.data().messageList(),h=e.cache();if(""!==a&&(c=h.getFolderFromCacheList(a))){switch(b){case g.MessageSetAction.SetSeen:if(c=h.getFolderFromCacheList(a))i.each(f,function(a){a.unseen(!1)}),c.messageCountUnread(0),h.clearMessageFlagsFromCacheByFolder(a);
|
|
|
|
|
e.remote().messageSetSeenToAll(d.emptyFunction,a,!0);break;case g.MessageSetAction.UnsetSeen:if(c=h.getFolderFromCacheList(a))i.each(f,function(a){a.unseen(!0)}),c.messageCountUnread(c.messageCountAll()),h.clearMessageFlagsFromCacheByFolder(a);e.remote().messageSetSeenToAll(d.emptyFunction,a,!1)}e.reloadFlagsCurrentMessageListAndMessageFromCache()}};z.prototype.listSetSeen=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetSeen,e.data().messageListCheckedOrSelected())};
|
|
|
|
|
z.prototype.listSetAllSeen=function(){this.setActionForAll(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetSeen)};z.prototype.listUnsetSeen=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.UnsetSeen,e.data().messageListCheckedOrSelected())};z.prototype.listSetFlags=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetFlag,e.data().messageListCheckedOrSelected())};z.prototype.listUnsetFlags=function(){this.setAction(e.data().currentFolderFullNameRaw(),
|
|
|
|
|
g.MessageSetAction.UnsetFlag,e.data().messageListCheckedOrSelected())};z.prototype.onBuild=function(a){var b=this,c=e.data();this.oContentVisible=j(".b-content",a);this.oContentScrollable=j(".content",this.oContentVisible);this.oContentVisible.on("click",".fullThreadHandle",function(){var a=[],b=f.dataFor(this);b&&!b.lastInCollapsedThreadLoading()&&(e.data().messageListThreadFolder(b.folderFullNameRaw),a=e.data().messageListThreadUids(),b.lastInCollapsedThread()?a.push(0<b.parentUid()?b.parentUid():
|
|
|
|
|
b.uid):a=i.without(a,0<b.parentUid()?b.parentUid():b.uid),e.data().messageListThreadUids(i.uniq(a)),b.lastInCollapsedThreadLoading(!0),b.lastInCollapsedThread(!b.lastInCollapsedThread()),e.reloadMessageList());return!1});this.selector.init(this.oContentVisible,this.oContentScrollable);Ga.on("keydown",function(a){var f=!0,h=a?a.keyCode:0;if(a&&b.viewModelVisibility()&&c.useKeyboardShortcuts()&&!e.popupVisibility()&&!c.messageFullScreenMode()&&!d.inFocus()&&(c.usePreviewPane()||!c.message()&&(g.EventKeyCode.Delete===
|
|
|
|
|
h||g.EventKeyCode.A===h))&&a.ctrlKey&&g.EventKeyCode.A===h)b.checkAll(!(b.checkAll()&&!b.isIncompleteChecked())),f=!1;return f});a.on("click",".pagenator .page",function(){var a=f.dataFor(this);a&&o.setHash(e.link().mailBox(c.currentFolderFullNameHash(),a.value,c.messageListSearch()))}).on("click",".messageList .checkboxCkeckAll",function(){b.checkAll(!b.checkAll())}).on("click",".messageList .messageListItem .flagParent",function(){var a=f.dataFor(this),e=c.messageListCheckedOrSelected(),h=[];a&&
|
|
|
|
|
(0<e.length&&(h=i.map(e,function(a){return a.uid})),0<h.length&&-1<d.inArray(a.uid,h)?b.setAction(a.folderFullNameRaw,a.flagged()?g.MessageSetAction.UnsetFlag:g.MessageSetAction.SetFlag,e):b.setAction(a.folderFullNameRaw,a.flagged()?g.MessageSetAction.UnsetFlag:g.MessageSetAction.SetFlag,[a]))});f.computed(function(){var a=e.data(),b=this.viewModelVisibility(),c=e.popupVisibility(),d=a.useKeyboardShortcuts(),a=a.messageFullScreenMode();this.selector.useKeyboard(b&&d&&!a&&!c)},this).extend({notify:"always"});
|
|
|
|
|
this.initUploaderForAppend()};z.prototype.composeClick=function(){o.showScreenPopup(y)};z.prototype.advancedSearchClick=function(){o.showScreenPopup(da)};z.prototype.quotaTooltip=function(){return d.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:d.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:d.friendlySize(this.userQuota())})};z.prototype.initUploaderForAppend=function(){return!e.settingsGet("AllowAppendMessage")||!this.dragOverArea()?!1:!!new ta({action:e.link().append(),name:"AppendFile",
|
|
|
|
|
queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return e.data().currentFolderFullNameRaw()}},dragAndDropElement:this.dragOverArea(),dragAndDropBodyElement:this.dragOverBodyArea(),onDragEnter:i.bind(function(){this.dragOverEnter(true)},this),onDragLeave:i.bind(function(){this.dragOverEnter(false)},this),onBodyDragEnter:i.bind(function(){this.dragOver(true)},this),onBodyDragLeave:i.bind(function(){this.dragOver(false)},this),onSelect:i.bind(function(a,b){if(a&&
|
|
|
|
|
b&&"message/rfc822"===b.Type){e.data().messageListLoading(true);return true}return false}),onComplete:i.bind(function(){e.reloadMessageList(true,true)},this)})};d.extendAsViewModel("MailBoxMessageViewViewModel",I);I.prototype.scrollToTop=function(){var a=j(".messageItem.nano .content",this.viewModelDom);a&&a[0]?a.scrollTop(0):j(".messageItem",this.viewModelDom).scrollTop(0);d.windowResize()};I.prototype.fullScreen=function(){this.fullScreenMode(!0);d.windowResize()};I.prototype.unFullScreen=function(){this.fullScreenMode(!1);
|
|
|
|
|
d.windowResize()};I.prototype.toggleFullScreen=function(){d.removeSelection();this.fullScreenMode(!this.fullScreenMode());d.windowResize()};I.prototype.replyOrforward=function(a){o.showScreenPopup(y,[a,e.data().message()])};I.prototype.onBuild=function(a){var b=this,c=e.data();Ga.on("keydown",function(a){var e=!0,a=a?a.keyCode:0;if(0<a&&(g.EventKeyCode.Backspace===a||g.EventKeyCode.Esc===a)&&b.viewModelVisibility()&&c.useKeyboardShortcuts()&&!d.inFocus()&&c.message())b.fullScreenMode(!1),c.usePreviewPane()||
|
|
|
|
|
c.message(null),e=!1;return e});j(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",preload:[1,1],gallery:{enabled:!0},callbacks:{open:function(){c.useKeyboardShortcuts(!1)},close:function(){c.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:300});a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=f.dataFor(this);a&&a.download&&
|
|
|
|
|
e.download(a.linkDownload())});this.oMessageScrollerDom=(this.oMessageScrollerDom=a.find(".messageItem .content"))&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null};I.prototype.isDraftFolder=function(){return e.data().message()&&e.data().draftFolder()===e.data().message().folderFullNameRaw};I.prototype.isSentFolder=function(){return e.data().message()&&e.data().sentFolder()===e.data().message().folderFullNameRaw};I.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()};
|
|
|
|
|
I.prototype.composeClick=function(){o.showScreenPopup(y)};I.prototype.editMessage=function(){e.data().message()&&o.showScreenPopup(y,[g.ComposeType.Draft,e.data().message()])};I.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)};I.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)};d.extendAsViewModel("SettingsMenuViewModel",za);za.prototype.link=function(a){return e.link().settings(a)};za.prototype.backToMailBoxClick=
|
|
|
|
|
function(){o.setHash(e.link().inbox())};d.extendAsViewModel("SettingsPaneViewModel",Aa);Aa.prototype.onShow=function(){e.data().message(null)};Aa.prototype.backToMailBoxClick=function(){o.setHash(e.link().inbox())};d.addSettingsViewModel(Oa,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0);Oa.prototype.onBuild=function(){var a=this;i.delay(function(){var b=e.data(),c=d.settingsSaveHelperSimpleFunction(a.mppTrigger,a);b.language.subscribe(function(b){a.languageTrigger(g.SaveSettingsStep.Animate);
|
|
|
|
|
j.ajax({url:e.link().langLink(b),dataType:"script",cache:!0}).done(function(){d.i18nToDoc();a.languageTrigger(g.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(g.SaveSettingsStep.FalseResult)}).always(function(){i.delay(function(){a.languageTrigger(g.SaveSettingsStep.Idle)},1E3)});e.remote().saveSettings(d.emptyFunction,{Language:b})});b.editorDefaultType.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{EditorDefaultType:a})});b.messagesPerPage.subscribe(function(a){e.remote().saveSettings(c,
|
|
|
|
|
{MPP:a})});b.showImages.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{ShowImages:a?"1":"0"})});b.showAnimation.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{ShowAnimation:a?"1":"0"})});b.useDesktopNotifications.subscribe(function(a){d.timeOutAction("SaveDesktopNotifications",function(){e.remote().saveSettings(d.emptyFunction,{DesktopNotifications:a?"1":"0"})},3E3)});b.replySameFolder.subscribe(function(a){d.timeOutAction("SaveReplySameFolder",function(){e.remote().saveSettings(d.emptyFunction,
|
|
|
|
|
{ReplySameFolder:a?"1":"0"})},3E3)});b.useThreads.subscribe(function(a){b.messageList([]);e.remote().saveSettings(d.emptyFunction,{UseThreads:a?"1":"0"})});b.usePreviewPane.subscribe(function(a){b.messageList.valueHasMutated();e.remote().saveSettings(d.emptyFunction,{UsePreviewPane:a?"1":"0"})});b.useCheckboxesInList.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)};Oa.prototype.onShow=function(){e.data().desktopNotifications.valueHasMutated()};
|
|
|
|
|
d.addSettingsViewModel(bb,"SettingsPersonal","SETTINGS_LABELS/LABEL_PERSONAL_NAME","personal");bb.prototype.onBuild=function(){var a=this;i.delay(function(){var b=e.data(),c=d.settingsSaveHelperSimpleFunction(a.nameTrigger,a),f=d.settingsSaveHelperSimpleFunction(a.replyTrigger,a),g=d.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){e.remote().saveSettings(c,{DisplayName:a})});b.replyTo.subscribe(function(a){e.remote().saveSettings(f,{ReplyTo:a})});b.signature.subscribe(function(a){e.remote().saveSettings(g,
|
|
|
|
|
{Signature:a})})},50)};d.addSettingsViewModel(na,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts");na.prototype.addNewAccount=function(){o.showScreenPopup(ea)};na.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);var b=function(b){return a===b};a&&(e.data().accounts.remove(b),e.remote().accountDelete(function(){e.accounts()},a.email))}};d.addSettingsViewModel(Pa,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social");d.addSettingsViewModel(oa,
|
|
|
|
|
"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password");oa.prototype.onHide=function(){this.changeProcess(!1);this.currentPassword("");this.newPassword("")};oa.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1);g.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)};d.addSettingsViewModel(S,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders");
|
|
|
|
|
S.prototype.folderEditOnEnter=function(a){var b=a?d.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(e.local().set(g.ClientSideKeyName.FoldersLashHash,""),e.data().foldersRenaming(!0),e.remote().folderRename(function(a,b){e.data().foldersRenaming(!1);if(g.StorageResultType.Success!==a||!b||!b.Result)e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"));e.folders(!1)},a.fullNameRaw,b),e.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b));
|
|
|
|
|
a.edited(!1)};S.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)};S.prototype.onShow=function(){e.data().foldersListError("")};S.prototype.createFolder=function(){o.showScreenPopup(ca)};S.prototype.systemFolder=function(){o.showScreenPopup(Y)};S.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){if(a===c)return!0;c.subFolders.remove(b);return!1};a&&(e.local().set(g.ClientSideKeyName.FoldersLashHash,
|
|
|
|
|
""),e.data().folderList.remove(b),e.data().foldersDeleting(!0),e.remote().folderDelete(function(a,b){e.data().foldersDeleting(!1);if(g.StorageResultType.Success!==a||!b||!b.Result)e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"));e.folders(!1)},a.fullNameRaw),e.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0<a.privateMessageCountAll()&&e.data().foldersListError(d.getNotification(g.Notification.CantDeleteNonEmptyFolder))};S.prototype.subscribeFolder=
|
|
|
|
|
function(a){e.local().set(g.ClientSideKeyName.FoldersLashHash,"");e.remote().folderSetSubscribe(d.emptyFunction,a.fullNameRaw,!0);a.subScribed(!0)};S.prototype.unSubscribeFolder=function(a){e.local().set(g.ClientSideKeyName.FoldersLashHash,"");e.remote().folderSetSubscribe(d.emptyFunction,a.fullNameRaw,!1);a.subScribed(!1)};d.addSettingsViewModel(Ba,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes");Ba.prototype.removeCustomThemeImg=function(){this.customThemeImg("")};Ba.prototype.onBuild=
|
|
|
|
|
function(){var a=this,b=e.data().theme();this.themesObjects(i.map(e.data().themes(),function(a){return{name:a,nameDisplay:d.convertThemeName(a),selected:f.observable(a===b),themePreviewSrc:e.link().themePreviewLink(a)}}));i.delay(function(){a.customThemeType.subscribe(function(a){e.remote().saveSettings(function(){e.data().theme.valueHasMutated()},{CustomThemeType:a})});a.customThemeImg.subscribe(function(a){e.remote().saveSettings(function(){e.data().theme.valueHasMutated()},{CustomThemeImg:a})})},
|
|
|
|
|
50);this.initCustomThemeUploader()};Ba.prototype.initCustomThemeUploader=function(){return this.customThemeUploaderButton()?!!new ta({action:e.link().uploadBackground(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,clickElement:this.customThemeUploaderButton(),onSelect:i.bind(function(a,b){var c=d.isUnd(b.FileName)?"":b.FileName.toString(),c=c.substring(c.length-4,c.length),e=d.isNormal(b.Size)?d.pInt(b.Size):null;return-1===d.inArray(c,["jpeg",".jpg",".png"])?(h.alert(d.i18n("SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR")),
|
|
|
|
|
!1):1048576<e?(h.alert(d.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:i.bind(function(){this.customThemeUploaderProgress(!0)},this),onComplete:i.bind(function(a,b,c){!b||!c||!c.Result?h.alert(c&&c.ErrorCode?d.getUploadErrorDescByCode(c.ErrorCode):d.getUploadErrorDescByCode(g.UploadErrorCode.Unknown)):this.customThemeImg(c.Result);this.customThemeUploaderProgress(!1)},this)}):!1};Qa.prototype.populateDataOnStart=function(){var a=e.settingsGet("Languages"),b=e.settingsGet("Themes");
|
|
|
|
|
d.isArray(a)&&this.languages(a);d.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.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(T.prototype,Qa.prototype);T.prototype.populateDataOnStart=function(){Qa.prototype.populateDataOnStart.call(this);this.accountEmail(e.settingsGet("Email"));this.accountLogin(e.settingsGet("Login"));this.projectHash(e.settingsGet("ProjectHash"));this.displayName(e.settingsGet("DisplayName"));this.replyTo(e.settingsGet("ReplyTo"));this.signature(e.settingsGet("Signature"));this.lastFoldersHash=e.local().get(g.ClientSideKeyName.FoldersLashHash);
|
|
|
|
|
this.remoteSuggestions=!!e.settingsGet("RemoteSuggestions");this.remoteChangePassword=!!e.settingsGet("RemoteChangePassword");this.threading=!!e.settingsGet("UseImapThread");this.devEmail=e.settingsGet("DevEmail");this.devLogin=e.settingsGet("DevLogin");this.devPassword=e.settingsGet("DevPassword")};T.prototype.initUidNextAndNewMessages=function(a,b,c){if("INBOX"===a&&d.isNormal(b)&&""!==b){if(d.isArray(c)&&0<c.length){var f=e.cache(),g=0,r=c.length,j=function(a,b,c){var d=null;if(ka&&e.data().useDesktopNotifications()&&
|
|
|
|
|
(d=new ka(b,{body:c,icon:a})))d.show&&d.show(),h.setTimeout(function(a){return function(){a.cancel?a.cancel():a.close&&a.close()}}(d),7E3)};i.each(c,function(b){f.addNewMessageCache(a,b.Uid)});if(3<r)j(e.link().notificationMailIcon(),e.data().accountEmail(),d.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:r}));else for(;g<r;g++)j(e.link().notificationMailIcon(),l.emailsToLine(l.initEmailsFromJson(c[g].From),!1),c[g].Subject)}e.cache().setFolderUidNext(a,b)}};T.prototype.folderResponseParseRec=
|
|
|
|
|
function(a,b,c){for(var f=0,g=0,h=null,i=null,j="",h=[],l=[],c=!!c,f=0,g=b.length;f<g;f++)if(h=b[f]){j=h.FullNameRaw;i=e.cache().getFolderFromCacheList(j);if(!i&&(i=G.newInstanceFromJson(h)))if(e.cache().setFolderToCacheList(j,i),e.cache().setFolderFullNameRaw(i.fullNameHash,j),i.isGmailFolder=n.Values.GmailFolderName.toLowerCase()===j.toLowerCase(),""!==a&&a===i.fullNameRaw+i.delimiter&&(i.isNamespaceFolder=!0),i.isNamespaceFolder||i.isGmailFolder)i.isUnpaddigFolder=!0;i&&(i.collapsed(!d.isFolderExpanded(i.fullNameHash)),
|
|
|
|
|
!c&&h.Extended&&(h.Extended.Hash&&e.cache().setFolderHash(i.fullNameRaw,h.Extended.Hash),d.isNormal(h.Extended.MessageCount)&&i.messageCountAll(h.Extended.MessageCount),d.isNormal(h.Extended.MessageUnseenCount)&&i.messageCountUnread(h.Extended.MessageUnseenCount)),(h=h.SubFolders)&&("Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&d.isArray(h["@Collection"]))&&i.subFolders(this.folderResponseParseRec(a,h["@Collection"],c)),l.push(i))}return l};T.prototype.setFolders=function(a,b){var c=
|
|
|
|
|
[],f=!1,h=e.data(),i=0===h.folderList().length,j=function(a){return""===a||n.Values.UnuseOptionValue===a||null!==e.cache().getFolderFromCacheList(a)?a:""};a&&(a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&d.isArray(a.Result["@Collection"]))&&(d.isUnd(a.Result.Namespace)||(h.namespace=a.Result.Namespace),c=this.folderResponseParseRec(h.namespace,a.Result["@Collection"],!!b),h.folderList(c),a.Result.SystemFolders&&""===""+e.settingsGet("SentFolder")+e.settingsGet("DraftFolder")+
|
|
|
|
|
e.settingsGet("SpamFolder")+e.settingsGet("TrashFolder")&&(e.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),e.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),e.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),e.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),f=!0),h.sentFolder(j(e.settingsGet("SentFolder"))),h.draftFolder(j(e.settingsGet("DraftFolder"))),h.spamFolder(j(e.settingsGet("SpamFolder"))),h.trashFolder(j(e.settingsGet("TrashFolder"))),f&&e.remote().saveSystemFolders(d.emptyFunction,
|
|
|
|
|
{SentFolder:h.sentFolder(),DraftFolder:h.draftFolder(),SpamFolder:h.spamFolder(),TrashFolder:h.trashFolder()}),b||e.local().set(g.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash),i&&b&&e.folders(!1))};T.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()};T.prototype.setMessage=function(a,b){var c=!1,f=!1,g=!1,h=null,f=null,c="",i=this.messagesBodiesDom(),k=this.message();if(a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===
|
|
|
|
|
a.Result.Folder&&k.uid===a.Result.Uid){this.messageError("");k.initUpdateByMessageJson(a.Result);e.cache().addRequestedMessage(k.folderFullNameRaw,k.uid);b||k.initFlagsByJson(a.Result);if(i=i&&i[0]?i:null)c="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),f=i.find("#"+c),!f||!f[0]?(f=!!a.Result.HasExternals,g=!!a.Result.HasInternals,h=j('<div id="'+c+'" />').hide(),d.isNormal(a.Result.Html)&&""!==a.Result.Html?(c=!0,h.html(a.Result.Html.toString()).addClass("b-text-part html")):d.isNormal(a.Result.Plain)&&
|
|
|
|
|
""!==a.Result.Plain?(c=!1,h.html(a.Result.Plain.toString()).addClass("b-text-part plain")):c=!1,i.append(h),h.data("rl-is-html",c),h.data("rl-has-images",f),k.isHtml(h.data("rl-is-html")),k.hasImages(h.data("rl-has-images")),k.body=h,g&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0)):(k.isHtml(f.data("rl-is-html")),k.hasImages(f.data("rl-has-images")),k.body=f),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),h&&d.initBlockquoteSwitcher(h);
|
|
|
|
|
e.cache().initMessageFlagsFromCache(k);k.unseen()&&e.setMessageSeen(k);d.windowResize()}};T.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&d.isArray(a.Result["@Collection"])){var c=e.data(),f=e.cache(),h=null,i=0,j=0,k=0,o=0,p=[],n=c.staticMessageList,s=null,H=null,q=null,t=0,u=!1,k=d.pInt(a.Result.MessageResultCount),o=d.pInt(a.Result.Offset);d.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(h=a.Result.LastCollapsedThreadUids);
|
|
|
|
|
if((q=e.cache().getFolderFromCacheList(d.isNormal(a.Result.Folder)?a.Result.Folder:""))&&!b)e.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),d.isNormal(a.Result.MessageCount)&&q.messageCountAll(a.Result.MessageCount),d.isNormal(a.Result.MessageUnseenCount)&&(d.pInt(q.messageCountUnread())!==d.pInt(a.Result.MessageUnseenCount)&&(u=!0),q.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(q.fullNameRaw,a.Result.UidNext,a.Result.NewMessages);u&&q&&e.cache().clearMessageFlagsFromCacheByFolder(q.fullNameRaw);
|
|
|
|
|
i=0;for(j=a.Result["@Collection"].length;i<j;i++)if((s=a.Result["@Collection"][i])&&"Object/Message"===s["@Object"]){H=n[i];if(!H||!H.initByJson(s))H=l.newInstanceFromJson(s);H&&(f.hasNewMessageAndRemoveFromCache(H.folderFullNameRaw,H.uid)&&5>=t&&(t++,H.newForAnimation(!0)),H.deleted(!1),b?e.cache().initMessageFlagsFromCache(H):e.cache().storeMessageFlagsToCache(H),H.lastInCollapsedThread(h&&-1<d.inArray(d.pInt(H.uid),h)?!0:!1),p.push(H))}c.messageListCount(k);c.messageListSearch(d.isNormal(a.Result.Search)?
|
|
|
|
|
a.Result.Search:"");c.messageListEndSearch(d.isNormal(a.Result.Search)?a.Result.Search:"");c.messageListEndFolder(d.isNormal(a.Result.Folder)?a.Result.Folder:"");c.messageListPage(Math.ceil(o/c.messagesPerPage()+1));c.messageList(p);c.messageListIsNotCompleted(!1);(H=c.message())&&c.messageList.setSelectedByUid&&c.messageList.setSelectedByUid(H.generateUid());n.length<p.length&&(c.staticMessageList=p);f.clearNewMessageCache();q&&(b||u||e.data().useThreads())&&e.folderInformation(q.fullNameRaw,p)}else e.data().messageListCount(0),
|
|
|
|
|
e.data().messageList([]),e.data().messageListError(d.getNotification(a&&a.ErrorCode?a.ErrorCode:g.Notification.CantGetMessageList))};ba.prototype.oRequests={};ba.prototype.defaultResponse=function(a,b,c,f,j,r){var v=function(){g.StorageResultType.Success!==c&&Sa&&(c=g.StorageResultType.Unload);if(g.StorageResultType.Success===c&&f&&!f.Result){if(f&&-1<d.inArray(f.ErrorCode,[g.Notification.AuthError,g.Notification.AccessError,g.Notification.ConnectionError,g.Notification.DomainNotAllowed,g.Notification.AccountNotAllowed,
|
|
|
|
|
g.Notification.MailServerError,g.Notification.UnknownNotification,g.Notification.UnknownError])&&Da++,f&&g.Notification.InvalidToken===f.ErrorCode&&Ea++,10<Ea&&e.loginAndLogoutReload(!0),f.Logout||7<Da)h.__rlah_clear&&h.__rlah_clear(),e.loginAndLogoutReload(!0)}else g.StorageResultType.Success===c&&(f&&f.Result)&&(Ea=Da=0);a&&(x.runHook("ajax-default-response",[b,g.StorageResultType.Success===c?f:null,c,j,r]),a(c,g.StorageResultType.Success===c?f:null,j,b,r))};switch(c){case "success":c=g.StorageResultType.Success;
|
|
|
|
|
break;case "abort":c=g.StorageResultType.Abort;break;default:c=g.StorageResultType.Error}g.StorageResultType.Error===c?i.delay(v,300):v()};ba.prototype.ajaxRequest=function(a,b,c,f,g){var r=this,v=""===f,k=(new h.Date).getTime(),l=null,p="",b=b||{},c=d.isNormal(c)?c:2E4,f=d.isUnd(f)?"":d.pString(f),g=d.isArray(g)?g:[];(p=b.Action||"")&&0<g.length&&i.each(g,function(a){r.oRequests[a]&&(r.oRequests[a].__aborted=!0,r.oRequests[a].abort&&r.oRequests[a].abort(),r.oRequests[a]=null)});v&&(b.XToken=e.settingsGet("Token"));
|
|
|
|
|
l=j.ajax({type:v?"POST":"GET",url:e.link().ajax(f),async:!0,dataType:"json",data:v?b:{},headers:{},timeout:c,global:!0});l.always(function(c,e){var f=!1;c&&c.Time&&(f=d.pInt(c.Time)>(new h.Date).getTime()-k);p&&r.oRequests[p]&&(r.oRequests[p].__aborted&&(e="abort"),r.oRequests[p]=null);r.defaultResponse(a,p,e,c,f,b)});p&&(0<g.length&&-1<d.inArray(p,g))&&(this.oRequests[p]&&(this.oRequests[p].__aborted=!0,this.oRequests[p].abort&&this.oRequests[p].abort(),this.oRequests[p]=null),this.oRequests[p]=
|
|
|
|
|
l);return l};ba.prototype.defaultRequest=function(a,b,c,e,f,g){c=c||{};c.Action=b;f=d.pString(f);x.runHook("ajax-default-request",[b,c,f]);this.ajaxRequest(a,c,d.isUnd(e)?n.Defaults.DefaultAjaxTimeout:d.pInt(e),f,g)};ba.prototype.noop=function(a){this.defaultRequest(a,"Noop")};ba.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(q.prototype,ba.prototype);q.prototype.folders=function(a,b){var c=e.data().lastFoldersHash;
|
|
|
|
|
(b=d.isUnd(b)?!1:!!b)&&""!==c?this.defaultRequest(a,"Folders",{},null,"Folders/"+e.data().projectHash()+"-"+c,["Folders"]):this.defaultRequest(a,"Folders",{},null,"",["Folders"])};q.prototype.login=function(a,b,c,d,e){this.defaultRequest(a,"Login",{Email:b,Login:c,Password:d,SignMe:e?"1":"0"})};q.prototype.accountAdd=function(a,b,c,d){this.defaultRequest(a,"AccountAdd",{Email:b,Login:c,Password:d})};q.prototype.accountDelete=function(a,b){this.defaultRequest(a,"AccountDelete",{EmailToDelete:b})};
|
|
|
|
|
q.prototype.accounts=function(a){this.defaultRequest(a,"Accounts")};q.prototype.messageList=function(a,b,c,f,g,h){var b=d.pString(b),i=e.data(),j=e.cache().getFolderHash(b),h=d.isUnd(h)?!1:!!h,c=d.isUnd(c)?0:d.pInt(c),f=d.isUnd(c)?20:d.pInt(f),g=d.pString(g);""!==j?this.defaultRequest(a,"MessageList",{},""===g?n.Defaults.DefaultAjaxTimeout:n.Defaults.SearchAjaxTimeout,"MessageList/"+ha.urlsafe_encode([b,c,f,g,i.projectHash(),j,"INBOX"===b?e.cache().getFolderUidNext(b):"",i.threading&&i.useThreads()?
|
|
|
|
|
"1":"0",i.threading&&b===i.messageListThreadFolder()?i.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),h?[]:["MessageList"]):this.defaultRequest(a,"MessageList",{Folder:b,Offset:c,Limit:f,Search:g,UidNext:"INBOX"===b?e.cache().getFolderUidNext(b):"",UseThreads:e.data().threading&&e.data().useThreads()?"1":"0",ExpandedThreadUid:i.threading&&b===i.messageListThreadFolder()?i.messageListThreadUids().join(","):""},""===g?n.Defaults.DefaultAjaxTimeout:n.Defaults.SearchAjaxTimeout,"",
|
|
|
|
|
h?[]:["MessageList"])};q.prototype.messageUploadAttachments=function(a,b){this.defaultRequest(a,"MessageUploadAttachments",{Attachments:b},999E3)};q.prototype.message=function(a,b,c){b=d.pString(b);c=d.pInt(c);return e.cache().getFolderFromCacheList(b)&&0<c?(this.defaultRequest(a,"Message",{},null,"Message/"+ha.urlsafe_encode([b,c,e.data().projectHash(),e.data().threading&&e.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1};q.prototype.composeUploadExternals=function(a,
|
|
|
|
|
b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999E3)};q.prototype.folderInformation=function(a,b,c){var f=!0,g=e.cache(),h=[];d.isArray(c)&&0<c.length&&(f=!1,i.each(c,function(a){g.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid)||h.push(a.uid);0<a.threads().length&&i.each(a.threads(),function(b){g.getMessageFlagsFromCache(a.folderFullNameRaw,b)||h.push(b)})}),0<h.length&&(f=!0));f?this.defaultRequest(a,"FolderInformation",{Folder:b,FlagsUids:d.isArray(h)?h.join(","):"",UidNext:"INBOX"===
|
|
|
|
|
b?e.cache().getFolderUidNext(b):""}):e.data().useThreads()&&e.reloadFlagsCurrentMessageListAndMessageFromCache()};q.prototype.logout=function(a){this.defaultRequest(a,"Logout")};q.prototype.messageSetFlagged=function(a,b,c,d){this.defaultRequest(a,"MessageSetFlagged",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})};q.prototype.messageSetSeen=function(a,b,c,d){this.defaultRequest(a,"MessageSetSeen",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})};q.prototype.messageSetSeenToAll=function(a,b,c){this.defaultRequest(a,
|
|
|
|
|
"MessageSetSeenToAll",{Folder:b,SetAction:c?"1":"0"})};q.prototype.saveMessage=function(a,b,c,d,e,f,g,h,i,j,l,s,q,o,t){this.defaultRequest(a,"SaveMessage",{MessageFolder:b,MessageUid:c,MessageID:d,DraftFolder:e,To:f,Cc:g,Bcc:h,Subject:i,TextIsHtml:j?"1":"0",Text:l,DraftInfo:q,InReplyTo:o,References:t,Attachments:s},n.Defaults.SaveMessageAjaxTimeout)};q.prototype.sendMessage=function(a,b,c,d,e,f,g,h,i,j,l,s,q,o,t){this.defaultRequest(a,"SendMessage",{MessageFolder:b,MessageUid:c,MessageID:d,SentFolder:e,
|
|
|
|
|
To:f,Cc:g,Bcc:h,Subject:i,TextIsHtml:j?"1":"0",Text:l,DraftInfo:q,InReplyTo:o,References:t,Attachments:s},n.Defaults.SendMessageAjaxTimeout)};q.prototype.saveSystemFolders=function(a,b){this.defaultRequest(a,"SystemFoldersUpdate",b)};q.prototype.saveSettings=function(a,b){this.defaultRequest(a,"SettingsUpdate",b)};q.prototype.changePassword=function(a,b,c){this.defaultRequest(a,"ChangePassword",{PrevPassword:b,NewPassword:c})};q.prototype.folderCreate=function(a,b,c){this.defaultRequest(a,"FolderCreate",
|
|
|
|
|
{Folder:b,Parent:c},null,"",["Folders"])};q.prototype.folderDelete=function(a,b){this.defaultRequest(a,"FolderDelete",{Folder:b},null,"",["Folders"])};q.prototype.folderRename=function(a,b,c){this.defaultRequest(a,"FolderRename",{Folder:b,NewFolderName:c},null,"",["Folders"])};q.prototype.folderClear=function(a,b){this.defaultRequest(a,"FolderClear",{Folder:b})};q.prototype.folderSetSubscribe=function(a,b,c){this.defaultRequest(a,"FolderSubscribe",{Folder:b,Subscribe:c?"1":"0"})};q.prototype.messagesMove=
|
|
|
|
|
function(a,b,c,d){this.defaultRequest(a,"MessageMove",{FromFolder:b,ToFolder:c,Uids:d.join(",")},null,"",["MessageList","Message"])};q.prototype.messagesDelete=function(a,b,c){this.defaultRequest(a,"MessageDelete",{Folder:b,Uids:c.join(",")},null,"",["MessageList","Message"])};q.prototype.appDelayStart=function(a){this.defaultRequest(a,"AppDelayStart")};q.prototype.quota=function(a){this.defaultRequest(a,"Quota")};q.prototype.contacts=function(a,b){this.defaultRequest(a,"Contacts",{Search:b},null,
|
|
|
|
|
"",["Contacts"])};q.prototype.contactSave=function(a,b,c,e,f,g){c=d.trim(c);this.defaultRequest(a,"ContactSave",{RequestUid:b,Uid:c,Name:e,Email:f,ImageData:g})};q.prototype.contactsDelete=function(a,b){this.defaultRequest(a,"ContactsDelete",{Uids:b.join(",")})};q.prototype.suggestions=function(a,b,c){this.defaultRequest(a,"Suggestions",{Query:b,Page:c},null,"",["Suggestions"])};q.prototype.servicesPics=function(a){this.defaultRequest(a,"ServicesPics")};q.prototype.emailsPicsHashes=function(a){this.defaultRequest(a,
|
|
|
|
|
"EmailsPicsHashes")};q.prototype.facebookUser=function(a){this.defaultRequest(a,"SocialFacebookUserInformation")};q.prototype.facebookDisconnect=function(a){this.defaultRequest(a,"SocialFacebookDisconnect")};q.prototype.twitterUser=function(a){this.defaultRequest(a,"SocialTwitterUserInformation")};q.prototype.twitterDisconnect=function(a){this.defaultRequest(a,"SocialTwitterDisconnect")};q.prototype.googleUser=function(a){this.defaultRequest(a,"SocialGoogleUserInformation")};q.prototype.googleDisconnect=
|
|
|
|
|
function(a){this.defaultRequest(a,"SocialGoogleDisconnect")};q.prototype.socialUsers=function(a){this.defaultRequest(a,"SocialUsers")};U.prototype.oEmailsPicsHashes={};U.prototype.oServices={};U.prototype.clear=function(){this.oServices={};this.oEmailsPicsHashes={}};U.prototype.getUserPic=function(a){var b="",b="",b=a.toLowerCase(),c=d.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];""===c?(b=b.substr(a.indexOf("@")+1),b=""!==b&&this.oServices[b]?this.oServices[b]:""):b=e.link().getUserPicUrlFromHash(c);
|
|
|
|
|
return b};U.prototype.setServicesData=function(a){this.oServices=a};U.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a};i.extend(w.prototype,U.prototype);w.prototype.oFoldersCache={};w.prototype.oFoldersNamesCache={};w.prototype.oFolderHashCache={};w.prototype.oFolderUidNextCache={};w.prototype.oMessageListHashCache={};w.prototype.oMessageFlagsCache={};w.prototype.oBodies={};w.prototype.oNewMessage={};w.prototype.oRequestedMessage={};w.prototype.clear=function(){U.prototype.clear.call(this);
|
|
|
|
|
this.oFoldersCache={};this.oFoldersNamesCache={};this.oFolderHashCache={};this.oFolderUidNextCache={};this.oMessageListHashCache={};this.oMessageFlagsCache={};this.oBodies={}};w.prototype.getMessageKey=function(a,b){return a+"#"+b};w.prototype.addRequestedMessage=function(a,b){this.oRequestedMessage[this.getMessageKey(a,b)]=!0};w.prototype.hasRequestedMessage=function(a,b){return!0===this.oRequestedMessage[this.getMessageKey(a,b)]};w.prototype.addNewMessageCache=function(a,b){this.oNewMessage[this.getMessageKey(a,
|
|
|
|
|
b)]=!0};w.prototype.hasNewMessageAndRemoveFromCache=function(a,b){return this.oNewMessage[this.getMessageKey(a,b)]?(this.oNewMessage[this.getMessageKey(a,b)]=null,!0):!1};w.prototype.clearNewMessageCache=function(){this.oNewMessage={}};w.prototype.getFolderFullNameRaw=function(a){return""!==a&&this.oFoldersNamesCache[a]?this.oFoldersNamesCache[a]:""};w.prototype.setFolderFullNameRaw=function(a,b){this.oFoldersNamesCache[a]=b};w.prototype.getFolderHash=function(a){return""!==a&&this.oFolderHashCache[a]?
|
|
|
|
|
this.oFolderHashCache[a]:""};w.prototype.setFolderHash=function(a,b){this.oFolderHashCache[a]=b};w.prototype.getFolderUidNext=function(a){return""!==a&&this.oFolderUidNextCache[a]?this.oFolderUidNextCache[a]:""};w.prototype.setFolderUidNext=function(a,b){this.oFolderUidNextCache[a]=b};w.prototype.getFolderFromCacheList=function(a){return""!==a&&this.oFoldersCache[a]?this.oFoldersCache[a]:null};w.prototype.setFolderToCacheList=function(a,b){this.oFoldersCache[a]=b};w.prototype.removeFolderFromCacheList=
|
|
|
|
|
function(a){this.setFolderToCacheList(a,null)};w.prototype.getMessageFlagsFromCache=function(a,b){return this.oMessageFlagsCache[a]&&this.oMessageFlagsCache[a][b]?this.oMessageFlagsCache[a][b]:null};w.prototype.setMessageFlagsToCache=function(a,b,c){this.oMessageFlagsCache[a]||(this.oMessageFlagsCache[a]={});this.oMessageFlagsCache[a][b]=c};w.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}};w.prototype.initMessageFlagsFromCache=function(a){if(a){var b=this,c=
|
|
|
|
|
this.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid),e=null,f=null;c&&4===c.length&&(a.unseen(c[0]),a.flagged(c[1]),a.answered(c[2]),a.forwarded(c[3]));0<a.threads().length&&(e=i.find(a.threads(),function(c){return(c=b.getMessageFlagsFromCache(a.folderFullNameRaw,c))&&4===c.length&&!!c[0]}),f=i.find(a.threads(),function(c){return(c=b.getMessageFlagsFromCache(a.folderFullNameRaw,c))&&4===c.length&&!!c[1]}),a.hasUnseenSubMessage(e&&0<d.pInt(e)),a.hasFlaggedSubMessage(f&&0<d.pInt(f)))}};w.prototype.storeMessageFlagsToCache=
|
|
|
|
|
function(a){a&&this.setMessageFlagsToCache(a.folderFullNameRaw,a.uid,[a.unseen(),a.flagged(),a.answered(),a.forwarded()])};w.prototype.storeMessageFlagsToCacheByFolderAndUid=function(a,b,c){d.isArray(c)&&4===c.length&&this.setMessageFlagsToCache(a,b,c)};i.extend(ga.prototype,K.prototype);ga.prototype.onRoute=function(a){var b=this,c=null,g=null,h=null,r=null;if(g=i.find(Ha,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}))i.find(Va,function(a){return a&&a===g})&&(g=null),g&&
|
|
|
|
|
i.find(Wa,function(a){return a&&a===g})&&(g=null);g&&(g.__builded&&g.__vm?c=g.__vm:(h=j("#rl-content #rl-settings-subscreen"))&&1===h.length?(c=new g,r=j("<div></div>").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),r.appendTo(h),c.data=e.data(),c.viewModelDom=r,c.__rlSettingsData=g.__rlSettingsData,g.__dom=r,g.__builded=!0,g.__vm=c,f.applyBindings(c,r[0]),o.delegateRun(c,"onBuild",[r])):d.log("Cannot find sub settings view model position: SettingsSubScreen"),
|
|
|
|
|
c&&i.defer(function(){if(b.oCurrentSubScreen){o.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide()}b.oCurrentSubScreen=c;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();o.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(c&&c.__rlSettingsData&&a.route===c.__rlSettingsData.Route)})}d.windowResize()}))};ga.prototype.onBuild=function(){i.each(Ha,function(a){a&&(a.__rlSettingsData&&!i.find(Va,function(b){return b&&b===a}))&&
|
|
|
|
|
this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:f.observable(!1),disabled:!!i.find(Wa,function(b){return b&&b===a})})},this)};ga.prototype.routes=function(){var a=i.find(Ha,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,e){e.subname=d.isUnd(e.subname)?b:d.pString(e.subname);return[e.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(Ca.prototype,
|
|
|
|
|
K.prototype);Ca.prototype.onShow=function(){e.setTitle(d.i18n("TITLES/LOGIN"))};i.extend(V.prototype,K.prototype);V.prototype.oLastRoute={};V.prototype.onShow=function(){var a=e.data().accountEmail();e.setTitle((""===a?"":a+" - ")+d.i18n("TITLES/MAILBOX"));this.mailBoxScreenVisibily(!0)};V.prototype.onHide=function(){this.mailBoxScreenVisibily(!1)};V.prototype.onRoute=function(a,b,c){var d=e.data(),a=e.cache().getFolderFullNameRaw(a);if(a=e.cache().getFolderFromCacheList(a))d.currentFolder(a).messageListPage(b).messageListSearch(c),
|
|
|
|
|
!d.usePreviewPane()&&d.message()&&d.message(null),e.reloadMessageList()};V.prototype.onStart=function(){var a=e.data(),b=function(){d.windowResize()};e.settingsGet("AllowAdditionalAccounts")&&e.accounts();i.delay(function(){e.quota()},5E3);i.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&e.folderInformation("INBOX")},1E3);i.delay(function(){var b=e.data().spamFolder();b!==a.currentFolderFullNameRaw()&&e.folderInformation(b)},1500);i.delay(function(){var b=e.data().draftFolder();b!==a.currentFolderFullNameRaw()&&
|
|
|
|
|
e.folderInformation(b)},2E3);i.delay(function(){e.remote().appDelayStart(d.emptyFunction)},35E3);h.setInterval(function(){e.folderInformation("INBOX")},12E4);h.setInterval(function(){e.quota()},3E5);Z.toggleClass("rl-no-preview-pane",!a.usePreviewPane());a.folderList.subscribe(b);a.messageList.subscribe(b);a.message.subscribe(b);a.usePreviewPane.subscribe(function(b){Z.toggleClass("rl-no-preview-pane",!b);a.messageList.valueHasMutated()})};V.prototype.onBuild=function(){i.defer(i.bind(function(){d.initLayoutResizer("#rl-resizer-left",
|
|
|
|
|
"#rl-resizer-right","#rl-right",this.resizeTrigger)},this))};V.prototype.routes=function(){var a=function(a,c){c[0]=d.pString(c[0]);c[1]=d.pInt(c[1]);c[1]=0>=c[1]?1:c[1];c[2]=d.pString(c[2]);""===a&&(c[0]="Inbox",c[1]=1);return[decodeURI(c[0]),c[1],decodeURI(c[2])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:function(a,c){c[0]=d.pString(c[0]);c[1]=d.pString(c[1]);""===a&&(c[0]=
|
|
|
|
|
"Inbox");return[decodeURI(c[0]),1,decodeURI(c[1])]}}],[/^([^\/]*)$/,{normalize_:a}]]};i.extend(Ra.prototype,ga.prototype);Ra.prototype.onShow=function(){e.setTitle(this.sSettingsTitle)};i.extend(J.prototype,Za.prototype);J.prototype.oSettings=null;J.prototype.oLink=null;J.prototype.download=function(a){ia?this.iframe.attr("src",a):h.open(a)};J.prototype.link=function(){null===this.oLink&&(this.oLink=new B);return this.oLink};J.prototype.local=function(){null===this.oLocal&&(this.oLocal=new wa);return this.oLocal};
|
|
|
|
|
J.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=d.isNormal(Fa)?Fa:{});return d.isUnd(this.oSettings[a])?null:this.oSettings[a]};J.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=d.isNormal(Fa)?Fa:{});this.oSettings[a]=b};J.prototype.setTitle=function(a){a=(0<a.length?a+" - ":"")+this.settingsGet("Title")||"";a!==h.document.title&&(h.document.title=a)};J.prototype.loginAndLogoutReload=function(a,b){var c=d.pString(this.settingsGet("CustomLogoutLink")),
|
|
|
|
|
f=!!this.settingsGet("InIframe"),a=d.isUnd(a)?!1:!!a,b=d.isUnd(b)?!1:!!b;a&&(b&&h.close)&&h.close();a&&""!==c&&h.location.href!==c?i.defer(function(){f&&h.parent?h.parent.location.href=c:h.location.href=c}):(o.routeOff(),o.setHash(e.link().root(),!0),o.routeOff(),i.defer(function(){f&&h.parent?h.parent.location.reload():h.location.reload()}))};J.prototype.getAutocomplete=function(a,b,c){c([],a)};J.prototype.bootstart=function(){d.initOnStartOrLangChange(function(){d.initNotificationLanguage()},null);
|
|
|
|
|
i.delay(function(){d.windowResize()},1E3)};i.extend(A.prototype,J.prototype);A.prototype.oData=null;A.prototype.oRemote=null;A.prototype.oCache=null;A.prototype.data=function(){null===this.oData&&(this.oData=new T);return this.oData};A.prototype.remote=function(){null===this.oRemote&&(this.oRemote=new q);return this.oRemote};A.prototype.cache=function(){null===this.oCache&&(this.oCache=new w);return this.oCache};A.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var a=e.cache();
|
|
|
|
|
i.each(e.data().messageList(),function(b){a.initMessageFlagsFromCache(b)});a.initMessageFlagsFromCache(e.data().message())};A.prototype.reloadMessageList=function(a,b){var c=e.data(),f=(c.messageListPage()-1)*c.messagesPerPage();(d.isUnd(b)?0:b)&&e.cache().setFolderHash(c.currentFolderFullNameRaw(),"");if(d.isUnd(a)?0:a)c.messageListPage(1),f=0;c.messageListLoading(!0);e.remote().messageList(function(a,b,e){g.StorageResultType.Success===a&&b&&b.Result?(c.messageListError(""),c.messageListLoading(!1),
|
|
|
|
|
c.setMessageList(b,e)):g.StorageResultType.Unload===a?(c.messageListError(""),c.messageListLoading(!1)):g.StorageResultType.Abort!==a&&(c.messageList([]),c.messageListLoading(!1),c.messageListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},c.currentFolderFullNameRaw(),f,c.messagesPerPage(),c.messageListSearch())};A.prototype.recacheInboxMessageList=function(){e.remote().messageList(d.emptyFunction,"INBOX",0,e.data().messagesPerPage(),"",!0)};A.prototype.folders=
|
|
|
|
|
function(a,b){this.data().foldersLoading(!0);this.remote().folders(i.bind(function(a,d,f){e.data().foldersLoading(!1);g.StorageResultType.Success===a?(this.data().setFolders(d,f),b&&b(!0)):b&&b(!1)},this),a)};A.prototype.accounts=function(){e.data().accountsLoading(!0);e.remote().accounts(function(a,b){e.data().accountsLoading(!1);if(g.StorageResultType.Success===a&&d.isArray(b.Result)){var c=e.settingsGet("ParentEmail"),c=""===c?e.data().accountEmail():c;e.data().accounts(i.map(b.Result,function(a){return new Na(a,
|
|
|
|
|
a!==c)}))}})};A.prototype.quota=function(){this.remote().quota(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result&&d.isArray(b.Result)&&2===b.Result.length&&d.isPosNumeric(b.Result[0],!0)&&d.isPosNumeric(b.Result[1],!0))&&(e.data().userQuota(1024*d.pInt(b.Result[1])),e.data().userUsageSize(1024*d.pInt(b.Result[0])))})};A.prototype.folderInformation=function(a,b){this.remote().folderInformation(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result&&b.Result.Hash&&b.Result.Folder){var f=
|
|
|
|
|
e.cache().getFolderHash(b.Result.Folder),h=e.cache().getFolderFromCacheList(b.Result.Folder),i=!1,j="",l=[],l=!1,p=null;if(h){b.Result.Hash&&e.cache().setFolderHash(b.Result.Folder,b.Result.Hash);d.isNormal(b.Result.MessageCount)&&h.messageCountAll(b.Result.MessageCount);d.isNormal(b.Result.MessageUnseenCount)&&(d.pInt(h.messageCountUnread())!==d.pInt(b.Result.MessageUnseenCount)&&(l=!0),h.messageCountUnread(b.Result.MessageUnseenCount));l&&e.cache().clearMessageFlagsFromCacheByFolder(h.fullNameRaw);
|
|
|
|
|
if(b.Result.Flags){for(j in b.Result.Flags)b.Result.Flags.hasOwnProperty(j)&&(i=!0,p=b.Result.Flags[j],e.cache().storeMessageFlagsToCacheByFolderAndUid(h.fullNameRaw,j.toString(),[!p.IsSeen,!!p.IsFlagged,!!p.IsAnswered,!!p.IsForwarded]));i&&e.reloadFlagsCurrentMessageListAndMessageFromCache()}e.data().initUidNextAndNewMessages(h.fullNameRaw,b.Result.UidNext,b.Result.NewMessages);b.Result.Hash!==f||""===f?h.fullNameRaw===e.data().currentFolderFullNameRaw()?e.reloadMessageList():"INBOX"===h.fullNameRaw&&
|
|
|
|
|
e.recacheInboxMessageList():l&&h.fullNameRaw===e.data().currentFolderFullNameRaw()&&(l=e.data().messageList(),d.isNonEmptyArray(l)&&e.folderInformation(h.fullNameRaw,l))}}},a,b)};A.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);var b=e.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0);e.cache().storeMessageFlagsToCache(a);e.reloadFlagsCurrentMessageListAndMessageFromCache()}e.remote().messageSetSeen(d.emptyFunction,
|
|
|
|
|
a.folderFullNameRaw,[a.uid],!0)};A.prototype.googleConnect=function(){h.open(e.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")};A.prototype.twitterConnect=function(){h.open(e.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")};A.prototype.facebookConnect=function(){h.open(e.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")};
|
|
|
|
|
A.prototype.socialUsers=function(a){var b=e.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0));e.remote().socialUsers(function(a,d){if(g.StorageResultType.Success===a&&d&&d.Result){b.googleUserName(d.Result.Google||"");b.facebookUserName(d.Result.Facebook||"");b.twitterUserName(d.Result.Twitter||"")}else{b.googleUserName("");b.facebookUserName("");b.twitterUserName("")}b.googleLoggined(""!==b.googleUserName());b.facebookLoggined(""!==b.facebookUserName());b.twitterLoggined(""!==
|
|
|
|
|
b.twitterUserName());b.googleActions(false);b.facebookActions(false);b.twitterActions(false)})};A.prototype.googleDisconnect=function(){e.data().googleActions(!0);e.remote().googleDisconnect(function(){e.socialUsers()})};A.prototype.facebookDisconnect=function(){e.data().facebookActions(!0);e.remote().facebookDisconnect(function(){e.socialUsers()})};A.prototype.twitterDisconnect=function(){e.data().twitterActions(!0);e.remote().twitterDisconnect(function(){e.socialUsers()})};A.prototype.folderListOptionsBuilder=
|
|
|
|
|
function(a,b,c,f,i,j,l,k,q,p){var o=0,s=0,n=null,t=[],q=!d.isNormal(q)?0<a.length:q,p=d.isUnd(p)?!1:!!p,i=!d.isNormal(i)?0:i,j=d.isNormal(j)?j:null,l=d.isNormal(l)?l:null,k=d.isNormal(k)?k:null;d.isArray(c)||(c=[]);d.isArray(f)||(f=[]);o=0;for(s=f.length;o<s;o++)t.push({id:f[o][0],name:f[o][1],disable:!1});o=0;for(s=a.length;o<s;o++)if(n=a[o],l?l.call(null,n):1)t.push({id:n.fullNameRaw,system:!0,name:k?k.call(null,n):n.name(),disable:!n.selectable||-1<d.inArray(n.fullNameRaw,c)||(j?j.call(null,n):
|
|
|
|
|
!1)});o=0;for(s=b.length;o<s;o++){n=b[o];if(!n.isGmailFolder&&(n.subScribed()||!n.existen))if(l?l.call(null,n):1)if(g.FolderType.User===n.type()||!q||!n.isNamespaceFolder&&0<n.subFolders().length)t.push({id:n.fullNameRaw,system:!1,name:(new h.Array(n.deep+1-i)).join("\u00a0\u00a0\u00a0\u00a0")+(k?k.call(null,n):n.name()),disable:!n.selectable||-1<d.inArray(n.fullNameRaw,c)||g.FolderType.User!==n.type()||(j?j.call(null,n):!1)});n.isUnpaddigFolder&&i++;n.subScribed()&&0<n.subFolders().length&&(t=t.concat(e.folderListOptionsBuilder([],
|
|
|
|
|
n.subFolders(),c,[],i,j,l,k,q,p)))}return t};A.prototype.getAutocomplete=function(a,b,c){var f=[];e.remote().suggestions(function(a,b){g.StorageResultType.Success===a&&b&&b.Result&&d.isArray(b.Result.List)?(f=i.map(b.Result.List,function(a){return a&&a[0]?new F(a[0],a[1]):null}),c(i.compact(f),!!b.Result.More)):g.StorageResultType.Abort!==a&&c([],!1)},a,b)};A.prototype.emailsPicsHashes=function(){e.remote().emailsPicsHashes(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result)&&e.cache().setEmailsPicsHashesData(b.Result)})};
|
|
|
|
|
A.prototype.bootstart=function(){J.prototype.bootstart.call(this);e.data().populateDataOnStart();var a="",b=this.settingsGet("JsHash"),c=this.settingsGet("AllowGoogleSocial"),f=this.settingsGet("AllowFacebookSocial"),l=this.settingsGet("AllowTwitterSocial");!this.settingsGet("RemoteChangePassword")&&oa&&d.removeSettingsViewModel(oa);!this.settingsGet("AllowAdditionalAccounts")&&na&&d.removeSettingsViewModel(na);!c&&(!f&&!l&&Pa)&&d.removeSettingsViewModel(Pa);d.initOnStartOrLangChange(function(){j.extend(!0,
|
|
|
|
|
j.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);h.SimplePace&&h.SimplePace.set(70);this.settingsGet("Auth")?(this.setTitle(d.i18n("TITLES/LOADING")),this.folders(!0,i.bind(function(a){o.hideLoading();
|
|
|
|
|
if(a){o.startScreens([V,Ra]);Ga.on("mousedown","#rl-center a",function(a){if(a&&3!==a.which){var a=null,b=j(this).attr("href");if(b&&"mailto:"===b.toString().toLowerCase().substr(0,7)){a=new F;a.parse(h.decodeURI(b.toString().substr(7)));if(a&&a.email){o.showScreenPopup(y,[g.ComposeType.Empty,null,[a]]);return false}}}return true});(c||f||l)&&e.socialUsers(true);i.delay(function(){e.emailsPicsHashes();e.remote().servicesPics(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result)&&e.cache().setServicesData(b.Result)})},
|
|
|
|
|
1E3);x.runHook("rl-start-user-screens")}else{o.startScreens([Ca]);x.runHook("rl-start-login-screens")}h.SimplePace&&h.SimplePace.set(100)},this))):(a=d.pString(this.settingsGet("CustomLoginLink")))?(o.routeOff(),o.setHash(e.link().root(),!0),o.routeOff(),i.defer(function(){h.location.href=a})):(o.hideLoading(),o.startScreens([Ca]),x.runHook("rl-start-login-screens"),h.SimplePace&&h.SimplePace.set(100));c&&(h["rl_"+b+"_google_service"]=function(){e.data().googleActions(true);e.socialUsers()});f&&(h["rl_"+
|
|
|
|
|
b+"_facebook_service"]=function(){e.data().facebookActions(true);e.socialUsers()});l&&(h["rl_"+b+"_twitter_service"]=function(){e.data().twitterActions(true);e.socialUsers()});x.runHook("rl-start-screens")};e=new A;j(function(){h.setTimeout(function(){o.setBoot(e).bootstart()},10);h.setInterval(function(){ya(!ya())},6E4);i.delay(function(){h.rainloopAppData={};h.rainloopI18N={}},100)});Z.addClass(ia?"mobile":"no-mobile");O.keydown(d.killCtrlAandS).keyup(d.killCtrlAandS);O.unload(function(){Sa=!0});
|
|
|
|
|
h.rl=h.rl||{};h.rl.addHook=x.addHook;h.rl.settingsGet=x.mainSettingsGet;h.rl.remoteRequest=x.remoteRequest;h.rl.pluginSettingsGet=x.settingsGet;h.rl.addSettingsViewModel=d.addSettingsViewModel;h.rl.createCommand=d.createCommand;h.rl.EmailModel=F;h.rl.Enums=g;h.SimplePace&&h.SimplePace.add(10)})(window,jQuery,ko,crossroads,hasher,moment,Jua,_);
|