2013-11-17 06:02:13 +08:00
|
|
|
|
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
2014-01-26 22:23:37 +08:00
|
|
|
|
!function(a,b,c,d,e,f,g,h,i){"use strict";function j(){this.sBase="#/",this.sCdnStaticDomain=Db.settingsGet("CdnStaticDomain"),this.sVersion=Db.settingsGet("Version"),this.sSpecSuffix=Db.settingsGet("AuthAccountHash")||"0",this.sServer=(Db.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function k(a,c,d,e){var f={DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"};this.bIe=!!/msie/.test(navigator.userAgent.toLowerCase()),e=b.extend(f,rb.isUnd(e)?{}:e),this.oOptions=e,this.bOnlyPlain=!!this.oOptions.DisableHtml,this.fOnSwitch=this.oOptions.onSwitch,this.textarea=b(a).empty().addClass("editorTextArea"),this.htmlarea=b(c).empty().addClass("editorHtmlArea").prop("contentEditable","true"),this.toolbar=b(d).empty().addClass("editorToolbar"),k.htmlInitEditor.apply(this),k.htmlInitToolbar.apply(this),k.htmlAttachEditorEvents.apply(this),this.bOnlyPlain&&this.toolbar.hide()}function l(a,b,c,d,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.oContentVisible=null,this.oContentScrollable=null,this.sItemSelector=c,this.sItemSelectedSelector=d,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=[],i=null;this.list.subscribe(function(){var a=this,b=this.list();rb.isArray(b)&&h.each(b,function(b){b.checked()&&g.push(a.getItemUid(b)),null===i&&b.selected()&&(i=a.getItemUid(b))})},this,"beforeChange"),this.list.subscribe(function(a){if(this.useItemSelectCallback=!1,this.selectedItem(null),rb.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1<rb.inArray(b.getItemUid(a),g)&&(a.checked(!0),c--),null!==i&&i===b.getItemUid(a)&&(a.selected(!0),i=null,b.selectedItem(a))})}this.useItemSelectCallback=!0,g=[],i=null},this),this.list.setSelectedByUid=function(a){f.selectByUid(a,!1)},this.selectItemCallbacksThrottle=h.debounce(this.selectItemCallbacks,300)}function m(){}function n(){}function o(){var a=[n,m],b=h.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function p(){}function q(a,b){this.sPosition=rb.pString(a),this.sTemplate=rb.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function r(a,b){this.sScreenName=a,this.aViewModels=rb.isArray(b)?b:[]}function s(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null,this.popupVisibility=c.observable(!1),this.popupVisibility.subscribe(function(a){Db&&Db.popupVisibility(a)})}function t(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function u(){this.idContact=0,this.idContactStr="",this.display="",this.properties=[],this.readOnly=!1,this.scopeType=pb.ContactScopeType.Default,this.checked=c.observable(!1),this.selected=c.observable(!1),this.deleted=c.observable(!1),this.shared=c.observable(!1)}function v(a,b,d,e){this.type=c.observable(rb.isUnd(a)?pb.ContactPropertyType.Unknown:a),this.focused=c.observable(rb.isUnd(d)?!1:!!d),this.value=c.observable(rb.pString(b)),this.placeholder=c.observable(e||""),this.placeholderValue=c.computed(function(){var a=this.placeholder();return a?rb.i18n(a):""},this)}function w(){this.mimeType="",this.fileName="",this.estimatedSize=0,this.friendlySize="",this.isInline=!1,this.isLinked=!1,this.cid="",this.cidWithOutTags="",this.contentLocation="",this.download="",this.folder="",this.uid="",this.mimeIndex=""}function x(a,b,d,e,f,g,h){this.id=a,t
|
|
|
|
|
this.accounts=a.accounts,this.accountEmail=a.accountEmail,this.accountsLoading=a.accountsLoading,this.allowAddAccount=Db.settingsGet("AllowAdditionalAccounts"),this.loading=c.computed(function(){return this.accountsLoading()},this),this.accountClick=h.bind(this.accountClick,this)}function O(){N.call(this),s.constructorEnd(this)}function P(){N.call(this),s.constructorEnd(this)}function Q(){q.call(this,"Left","MailFolderList"),this.folderList=Db.data().folderList,this.folderListSystem=Db.data().folderListSystem,this.iDropOverTimer=0,this.allowContacts=!!Db.settingsGet("ContactsIsAllowed"),s.constructorEnd(this)}function R(){q.call(this,"Right","MailMessageList"),this.sLastUid=null,this.bPrefetch=!1,this.emptySubjectValue="";var a=Db.data();this.popupVisibility=Db.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,rb.initOnStartOrLangChange(function(){this.emptySubjectValue=rb.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},this),this.userQuota=a.userQuota,this.userUsageSize=a.userUsageSize,this.userUsageProc=a.userUsageProc,this.dragOver=c.observable(!1).extend({throttle:1}),this.dragOverEnter=c.observable(!1).extend({throttle:1}),this.dragOverArea=c.observable(null),this.dragOverBodyArea=c.observable(null),this.messageListItemTemplate=c.computed(function(){return a.usePreviewPane()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"}),this.messageListSearchDesc=c.computed(function(){var b=a.messageListEndSearch();return""===b?"":rb.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})}),this.messageListPagenator=c.computed(rb.computedPagenatorHelper(a.messageListPage,a.messageListPageCount)),this.checkAll=c.computed({read:function(){return 0<Db.data().messageListCheckedOrSelected().length},write:function(a){a=!!a,h.each(Db.data().messageList(),function(b){b.checked(a)}),a||Db.data().message(null)}}),this.inputMessageListSearchFocus=c.observable(!1),this.sLastSearchValue="",this.inputProxyMessageListSearch=c.computed({read:this.mainMessageListSearch,write:function(a){this.sLastSearchValue=a},owner:this}),this.isIncompleteChecked=c.computed(function(){var a=Db.data().messageList().length,b=Db.data().messageListCheckedOrSelected().length;return a>0&&b>0&&a>b},this),this.hasMessages=c.computed(function(){return 0<this.messageList().length},this),this.hasCheckedLines=c.computed(function(){return 0<this.messageListChecked().length},this),this.hasCheckedOrSelectedLines=c.computed(function(){return 0<this.messageListCheckedOrSelected().length},this),this.isSpamFolder=c.computed(function(){return Db.data().spamFolder()===this.messageListEndFolder()},this),this.isSpamDisabled=c.computed(function(){return ob.Values.UnuseOptionValue===Db.data().spamFolder()},this),this.isTrashFolder=c.computed(function(){return Db.data().trashFolder()===this.messageListEndFolder()},this),this.canBeMoved=this.hasCheckedOrSelectedLines,this.clearCommand=rb.createCommand(this,function(){wb.showScreenPopup(C,[Db.data().currentFolder()])}),this.multyForwardCommand=rb.createCommand(this,function(){wb.showScreenPopup(F,[pb.ComposeType.ForwardAsAttachment,Db.data().messageListCheckedOrSelected()])},this.canBeMoved),this.deleteWithoutMoveCommand=rb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(pb.FolderType.Trash,!1)},this.canBeMoved),this.deleteCommand=rb.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(pb.FolderType.Trash,!0)},this.canBeMoved),this.spamCommand=rb.createCommand(this,functi
|
|
|
|
|
},e))}}(),rb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(ub.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),rb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},rb.i18n=function(a,b,c){var d="",e=rb.isUnd(yb[a])?rb.isUnd(c)?a:c:yb[a];if(!rb.isUnd(b)&&!rb.isNull(b))for(d in b)rb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},rb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(rb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(rb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",rb.i18n(c)))})})},rb.i18nToDoc=function(){a.rainloopI18N&&(yb=a.rainloopI18N||{},rb.i18nToNode(Bb),ub.langChangeTrigger(!ub.langChangeTrigger())),a.rainloopI18N={}},rb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?ub.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&ub.langChangeTrigger.subscribe(a,b)},rb.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)},rb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},rb.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},rb.replySubjectAdd=function(b,c,d){var e=null,f=rb.trim(c);return null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||rb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||rb.isUnd(e[1])||rb.isUnd(e[2])||rb.isUnd(e[3])?f=b+": "+c:(f=e[1]+(rb.pInt(e[2])+1)+e[3],f=e[1]+(rb.pInt(e[2])+1)+e[3]):f=b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),(rb.isUnd(d)?!0:d)?rb.fixLongSubject(f):f},rb.fixLongSubject=function(a){var b=0,c=null;a=rb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||rb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=rb.isUnd(c[2])?1:0+rb.pInt(c[2]),b+=rb.isUnd(c[4])?1:0+rb.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},rb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},rb.friendlySize=function(a){return a=rb.pInt(a),a>=1073741824?rb.roundNumber(a/1073741824,1)+"GB":a>=1048576?rb.roundNumber(a/1048576,1)+"MB":a>=1024?rb.roundNumber(a/1024,0)+"KB":a+"B"},rb.log=function(b){a.console&&a.console.log&&a.console.log(b)},rb.getNotification=function(a,b){return a=rb.pInt(a),pb.Notification.ClientViewError===a&&b?b:rb.isUnd(qb[a])?"":qb[a]},rb.initNotificationLanguage=function(){qb[pb.Notification.InvalidToken]=rb.i18n("NOTIFICATIONS/INVALID_TOKEN"),qb[pb.Notification.AuthError]=rb.i18n("NOTIFICATIONS/AUTH_ERROR"),qb[pb.Notification.AccessError]=rb.i18n("NOTIFICATIONS/ACCESS_ERROR"),qb[pb.Notification.ConnectionError]=rb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),qb[pb.Notification.CaptchaError]=rb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),qb[pb.Notification.SocialFacebookLoginAccessDisable]=rb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),qb[pb.Notification.SocialTwitterLoginAccessDisable]=rb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),qb[pb.Notification.SocialGoogleLoginAccessDisable]=rb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),qb[pb.Notification.DomainNotAllowed]=rb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),qb[pb.Notification.AccountNotAllowed]=rb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),qb[pb.Notification.CantGetMessageList]=rb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),qb[pb.Notification.CantGetMessage]=r
|
|
|
|
|
},k.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))},k.prototype.clear=function(){this.textarea.val(""),this.editor.innerHTML="",this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()},k.prototype.getTextForRequest=function(){return this.isHtml()?(this.updateTextArea(),this.textarea.val()):this.textarea.val()},k.prototype.getTextFromHtml=function(a){var b="",c="> ",d=function(){if(arguments&&1<arguments.length){var a=rb.trim(arguments[1]).replace(/__bq__start__([\s\S\n\r]*)__bq__end__/gm,d);return a="\n"+c+rb.trim(a).replace(/\n/gm,"\n"+c)+"\n>\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+rb.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},e=function(){if(arguments&&1<arguments.length){var a=rb.trim(arguments[1]);return 0<a.length&&(a=a.replace(/<div[^>]*>([\s\S]*)<\/div>/gim,e),a="\n"+rb.trim(a)+"\n"),a}return""},f=function(){if(arguments&&1<arguments.length){var a=rb.trim(arguments[1]);return a}return""};return a=rb.isUnd(a)?!0:!!a,b=this.toHtmlString().replace(/[\s]+/gm," ").replace(/<br\s?\/?>/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<hr[^>]*>/gim,"\n_______________________________\n\n").replace(/<img [^>]*>/gim,"").replace(/<div[^>]*>([\s\S]*)<\/div>/gim,e).replace(/<blockquote[^>]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/<a [^>]*>([\s\S]*?)<\/a>/gim,f).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),(a?rb.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,d).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},k.prototype.getHtmlFromText=function(){return rb.convertPlainTextToHtml(this.textarea.val())},k.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()},k.prototype.switchToPlain=function(c){c=rb.isUnd(c)?!0:c;var d=this.getTextFromHtml(),e=h.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),b(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(d),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);c&&0!==rb.trim(d).length?e(a.confirm(this.oOptions.LangSwitcherConferm)):e(!0)},k.prototype.switcherLinkText=function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel},k.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar"),b(".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)},k.prototype.addButton=function(c,d){var e=this;b("<div />").addClass("editorToolbarButtom").append(b('<a tabindex="-1" href="javascript:void(0);"></a>').addClass(c)).attr("title",d).click(function(d){rb.isUnd(k.htmlFunctions[c])?a.alert(c):k.htmlFunctions[c].apply(e,[b(this),d])}).appendTo(this.toolbar)},k.htmlInitToolbar=function(){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"),function(a,b){a("<span />").addClass("editorSwitcher").text(b.switcherLinkText(!0)).click(function(){b.switchToggle()}).a
|
|
|
|
|
},y.prototype.hasVisibleAttachments=function(){return!!h.find(this.attachments(),function(a){return!a.isLinked})},y.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();return rb.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},y.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return rb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},y.prototype.messageId=function(){return this.sMessageId},y.prototype.inReplyTo=function(){return this.sInReplyTo},y.prototype.references=function(){return this.sReferences},y.prototype.fromAsSingleEmail=function(){return rb.isArray(this.from)&&this.from[0]?this.from[0].email:""},y.prototype.viewLink=function(){return Db.link().messageViewLink(this.requestHash)},y.prototype.downloadLink=function(){return Db.link().messageDownloadLink(this.requestHash)},y.prototype.replyEmails=function(a){var b=[],c=rb.isUnd(a)?{}:a;return y.replyHelper(this.replyTo,c,b),0===b.length&&y.replyHelper(this.from,c,b),b},y.prototype.replyAllEmails=function(a){var b=[],c=[],d=rb.isUnd(a)?{}:a;return y.replyHelper(this.replyTo,d,b),0===b.length&&y.replyHelper(this.from,d,b),y.replyHelper(this.to,d,b),y.replyHelper(this.cc,d,c),[b,c]},y.prototype.textBodyToString=function(){return this.body?this.body.html():""},y.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""},y.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()}},y.prototype.viewPopupMessage=function(c){rb.windowPopupKnockout(this.getDataForWindowPopup(),"PopupsWindowSimpleMessage",this.subject(),function(d){d&&d.document&&d.document.body&&(b("img.lazy",d.document.body).each(function(a,c){var d=b(c),e=d.data("original"),f=d.attr("src");a>=0&&e&&!f&&d.attr("src",e)}),c&&a.setTimeout(function(){d.print()},100))})},y.prototype.printMessage=function(){this.viewPopupMessage(!0)},y.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},y.prototype.populateByMessageListItem=function(a){return 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.isReadReceipt(a.isReadReceipt()),this.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(pb.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid(a.parentUid()),this.threads(a.threads()),this.threadsLen(a.threadsLen()),this.computeSenderEmail(),this},y.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=rb.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),b("[data-x-src]",this.body).each(function(){a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",b(this).attr("data-x-src")).removeAttr("data-x-src"):b(this).attr("src",b(this).attr("data-x-src")).removeAttr("data-x-src")}),b("[data-x-style-url]",this.body).each(function(){var a=rb.trim(b(this).attr("style"));a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+b(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(b("img.lazy",this.body).addClass("lazy-inited").lazyload({threshol
|
|
|
|
|
},I.prototype.onFocus=function(){this.emailFocus(!0)},I.prototype.onBuild=function(){this.allowCustomLogin(!!Db.settingsGet("AllowCustomLogin"));var a=this;Ab.on("keydown",function(b){var c=!0;return b&&pb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(rb.delegateRun(a,"cancelCommand"),c=!1),c})},rb.extendAsViewModel("PopupsIdentityViewModel",J),J.prototype.clearPopup=function(){this.id="",this.edit(!1),this.owner(!1),this.name(""),this.email(""),this.replyTo(""),this.bcc(""),this.email.hasError(!1),this.replyTo.hasError(!1),this.bcc.hasError(!1),this.submitRequest(!1),this.submitError("")},J.prototype.onShow=function(a){this.clearPopup(),a&&(this.edit(!0),this.id=a.id,this.name(a.name()),this.email(a.email()),this.replyTo(a.replyTo()),this.bcc(a.bcc()),this.owner(this.id===Db.data().accountEmail()))},J.prototype.onFocus=function(){this.owner()||this.email.focused(!0)},J.prototype.onBuild=function(){var a=this;Ab.on("keydown",function(b){var c=!0;return b&&pb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(rb.delegateRun(a,"cancelCommand"),c=!1),c})},rb.extendAsViewModel("PopupsLanguagesViewModel",K),K.prototype.languageEnName=function(a){return rb.convertLangName(a,!0)},K.prototype.resetMainLanguage=function(){var a=Db.data().mainLanguage();h.each(this.languages(),function(b){b.selected(b.key===a)})},K.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},K.prototype.onHide=function(){this.exp(!1)},K.prototype.onBuild=function(){var a=this;Ab.on("keydown",function(b){var c=!0;return b&&pb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()&&(rb.delegateRun(a,"cancelCommand"),c=!1),c})},K.prototype.changeLanguage=function(a){Db.data().mainLanguage(a),this.cancelCommand()},rb.extendAsViewModel("PopupsAskViewModel",L),L.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(rb.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(rb.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},L.prototype.yesClick=function(){rb.isFunc(this.fYesAction)&&this.fYesAction.call(null),this.cancelCommand()},L.prototype.noClick=function(){rb.isFunc(this.fNoAction)&&this.fNoAction.call(null),this.cancelCommand()},L.prototype.onShow=function(a,b,c,d,e){this.clearPopup(),this.fYesAction=b||null,this.fNoAction=c||null,this.askDesc(a||""),d&&this.yesButton(d),d&&this.yesButton(e)},L.prototype.onFocus=function(){this.yesFocus(!0)},L.prototype.onHide=function(){},L.prototype.onBuild=function(){var a=this;Ab.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&(pb.EventKeyCode.Tab===b.keyCode||pb.EventKeyCode.Right===b.keyCode||pb.EventKeyCode.Left===b.keyCode)&&(a.yesFocus()?a.noFocus(!0):a.yesFocus(!0),c=!1),c})},rb.extendAsViewModel("LoginViewModel",M),M.prototype.onShow=function(){wb.routeOff(),h.delay(h.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):this.emailFocus(!0),Db.settingsGet("UserLanguage")&&b.cookie("rllang",Db.data().language(),{expires:30})},this),100)},M.prototype.onHide=function(){this.submitFocus(!1),this.emailFocus(!1)},M.prototype.onBuild=function(){var c=this,d=Db.settingsGet("JsHash"),e=function(a){a=rb.pInt(a),0===a?(c.submitRequest(!0),Db.loginAndLogoutReload()):c.submitError(rb.getNotification(a))};switch(this.facebookLoginEnabled(!!Db.settingsGet("AllowFacebookSocial")),this.twitterLoginEnabled(!!Db.settingsGet("AllowTwitterSocial")),this.googleLoginEnabled(!!Db.settingsGet("AllowGoogleSocial")),(Db.settingsGet("SignMe")||"unused").toLowerCase()){case pb.LoginSignMeTypeAsString.DefaultOff:this.signMeType(pb.LoginSignMeType.DefaultOff);break;case pb.LoginSignMeTypeAsString.DefaultOn:this.signMeType(pb.LoginSignMeType.DefaultOn);break;default:case pb.LoginSignMeTypeAsString.Unused:this.signMeType(pb.LoginSignMeType.Unused)}this.email(Db.data().devEmail),this.login(Db.data().devLogin),this.password(Db.data().devPassword),this.googleLoginEnabled()&&(a["rl_"+d+"_google_login_service"]=e),this.facebookLoginEnabled()&&(a["rl_"+d+"_facebook_login_service"]=e),this.twitterLoginEnabled()&&(a["rl_"+d+"_twitter_login
|
|
|
|
|
},db.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&rb.isNormal(c)&&""!==c){if(rb.isArray(d)&&0<d.length){var e=Db.cache(),f=0,g=d.length,i=function(b,c,d){var e=null;Cb&&Db.data().useDesktopNotifications()&&(e=new Cb(c,{body:d,icon:b}),e&&(e.show&&e.show(),a.setTimeout(function(a){return function(){a.cancel?a.cancel():a.close&&a.close()}}(e),7e3)))};if(h.each(d,function(a){e.addNewMessageCache(b,a.Uid)}),g>3)i(Db.link().notificationMailIcon(),Db.data().accountEmail(),rb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Db.link().notificationMailIcon(),y.emailsToLine(y.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Db.cache().setFolderUidNext(b,c)}},db.prototype.folderResponseParseRec=function(a,b){var c=0,d=0,e=null,f=null,g="",h=[],i=[];for(c=0,d=b.length;d>c;c++)e=b[c],e&&(g=e.FullNameRaw,f=Db.cache().getFolderFromCacheList(g),f||(f=z.newInstanceFromJson(e),f&&(Db.cache().setFolderToCacheList(g,f),Db.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=ob.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!rb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Db.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),rb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),rb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&rb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},db.prototype.setFolders=function(a){var b=[],c=!1,d=Db.data(),e=function(a){return""===a||ob.Values.UnuseOptionValue===a||null!==Db.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&rb.isArray(a.Result["@Collection"])&&(rb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Db.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Db.settingsGet("SentFolder")+Db.settingsGet("DraftFolder")+Db.settingsGet("SpamFolder")+Db.settingsGet("TrashFolder")+Db.settingsGet("NullFolder")&&(Db.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Db.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Db.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Db.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Db.settingsGet("SentFolder"))),d.draftFolder(e(Db.settingsGet("DraftFolder"))),d.spamFolder(e(Db.settingsGet("SpamFolder"))),d.trashFolder(e(Db.settingsGet("TrashFolder"))),c&&Db.remote().saveSystemFolders(rb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Db.local().set(pb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},db.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},db.prototype.getNextFolderNames=function(a){a=rb.isUnd(a)?!1:!!a;var b=[],c=10,d=f().unix(),e=d-300,g=[],i=function(b){h.each(b,function(b){b&&"INBOX"!==b.fullNameRaw&&b.selectable&&b.existen&&e>b.interval&&(!a||b.subScribed())&&g.push([b.interval,b.fullNameRaw]),b&&0<b.subFolders().length&&i(b.subFolders())})};return i(this.folderList()),g.sort(function(a,b){return a[0]<b[0]?-1:a[0]>b[0]?1:0}),h.find(g,function(a){var e=Db.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},db.prototype.setMessage=function(a,c){var d=!1,e=!1,f=!1,g=null,h=null,i="",j=this.messagesBodiesDom(),k=this.message();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),Db.cache().addRequeste
|
|
|
|
|
g&&Db.reloadFlagsCurrentMessageListAndMessageFromCache()}Db.data().initUidNextAndNewMessages(e.fullNameRaw,b.Result.UidNext,b.Result.NewMessages),b.Result.Hash!==d||""===d?e.fullNameRaw===Db.data().currentFolderFullNameRaw()?Db.reloadMessageList():"INBOX"===e.fullNameRaw&&Db.recacheInboxMessageList():j&&e.fullNameRaw===Db.data().currentFolderFullNameRaw()&&(i=Db.data().messageList(),rb.isNonEmptyArray(i)&&Db.folderInformation(e.fullNameRaw,i))}}},a,b)},nb.prototype.folderInformationMultiply=function(a){a=rb.isUnd(a)?!1:!!a;var b=f().unix(),c=Db.data().getNextFolderNames(a);rb.isNonEmptyArray(c)&&this.remote().folderInformationMultiply(function(c,d){pb.StorageResultType.Success===c&&d&&d.Result&&d.Result.List&&rb.isNonEmptyArray(d.Result.List)&&(h.each(d.Result.List,function(a){var c=[],d=Db.cache().getFolderHash(a.Folder),e=Db.cache().getFolderFromCacheList(a.Folder),f=!1;e&&(e.interval=b,a.Hash&&Db.cache().setFolderHash(a.Folder,a.Hash),rb.isNormal(a.MessageCount)&&e.messageCountAll(a.MessageCount),rb.isNormal(a.MessageUnseenCount)&&(rb.pInt(e.messageCountUnread())!==rb.pInt(a.MessageUnseenCount)&&(f=!0),e.messageCountUnread(a.MessageUnseenCount)),f&&Db.cache().clearMessageFlagsFromCacheByFolder(e.fullNameRaw),a.Hash!==d||""===d?e.fullNameRaw===Db.data().currentFolderFullNameRaw()&&Db.reloadMessageList():f&&e.fullNameRaw===Db.data().currentFolderFullNameRaw()&&(c=Db.data().messageList(),rb.isNonEmptyArray(c)&&Db.folderInformation(e.fullNameRaw,c)))}),a&&Db.folderInformationMultiply(!0))},c)},nb.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);var b=Db.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0),Db.cache().storeMessageFlagsToCache(a),Db.reloadFlagsCurrentMessageListAndMessageFromCache()}Db.remote().messageSetSeen(rb.emptyFunction,a.folderFullNameRaw,[a.uid],!0)},nb.prototype.googleConnect=function(){a.open(Db.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")},nb.prototype.twitterConnect=function(){a.open(Db.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")},nb.prototype.facebookConnect=function(){a.open(Db.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")},nb.prototype.socialUsers=function(a){var b=Db.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0)),Db.remote().socialUsers(function(a,c){pb.StorageResultType.Success===a&&c&&c.Result?(b.googleUserName(c.Result.Google||""),b.facebookUserName(c.Result.Facebook||""),b.twitterUserName(c.Result.Twitter||"")):(b.googleUserName(""),b.facebookUserName(""),b.twitterUserName("")),b.googleLoggined(""!==b.googleUserName()),b.facebookLoggined(""!==b.facebookUserName()),b.twitterLoggined(""!==b.twitterUserName()),b.googleActions(!1),b.facebookActions(!1),b.twitterActions(!1)})},nb.prototype.googleDisconnect=function(){Db.data().googleActions(!0),Db.remote().googleDisconnect(function(){Db.socialUsers()})},nb.prototype.facebookDisconnect=function(){Db.data().facebookActions(!0),Db.remote().facebookDisconnect(function(){Db.socialUsers()})},nb.prototype.twitterDisconnect=function(){Db.data().twitterActions(!0),Db.remote().twitterDisconnect(function(){Db.socialUsers()})},nb.prototype.folderListOptionsBuilder=function(b,c,d,e,f,g,h,i,j,k){var l=0,m=0,n=null,o=" ",p=[];for(j=rb.isNormal(j)?j:0<b.length,k=rb.isUnd(k)?!1:!!k,f=rb.isNormal(f)?f:0,g=rb.isNormal(g)?g:null,h=rb.isNormal(h)?h:null,i=rb.isNormal(i)?i:null,rb.isArray(d)||(d=[]),rb.isArray(e)||(e=[]),l=0,m=e.length;m>l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1<rb.inArray(n.fullNameRaw,d)||(g?g.call(null,n):!1)});for(l=0,m=c.length;m>l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(pb.FolderType.User=
|