]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S]*?)<\/a>/gim,f).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),(a?ob.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,"") +!function(a,b,c,d,e,f,g,h){"use strict";function i(){this.sBase="#/",this.sCdnStaticDomain=Ab.settingsGet("CdnStaticDomain"),this.sVersion=Ab.settingsGet("Version"),this.sSpecSuffix=Ab.settingsGet("AuthAccountHash")||"0",this.sServer=(Ab.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function j(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,ob.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"),j.htmlInitEditor.apply(this),j.htmlInitToolbar.apply(this),j.htmlAttachEditorEvents.apply(this),this.bOnlyPlain&&this.toolbar.hide()}function k(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();ob.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),ob.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1b?b:a))},this),this.body=null,this.isRtl=c.observable(!1),this.isHtml=c.observable(!1),this.hasImages=c.observable(!1),this.attachments=c.observableArray([]),this.priority=c.observable(mb.MessagePriority.Normal),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=c.observable(0),this.threads=c.observableArray([]),this.threadsLen=c.observable(0),this.hasUnseenSubMessage=c.observable(!1),this.hasFlaggedSubMessage=c.observable(!1),this.lastInCollapsedThread=c.observable(!1),this.lastInCollapsedThreadLoading=c.observable(!1),this.threadsLenResult=c.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&a>0?a+1:""},this)}function y(){this.name=c.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.selectable=!1,this.existen=!0,this.isNamespaceFolder=!1,this.isGmailFolder=!1,this.isUnpaddigFolder=!1,this.type=c.observable(mb.FolderType.User),this.selected=c.observable(!1),this.edited=c.observable(!1),this.collapsed=c.observable(!0),this.subScribed=c.observable(!0),this.subFolders=c.observableArray([]),this.deleteAccess=c.observable(!1),this.actionBlink=c.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=c.observable(""),this.name.subscribe(function(a){this.nameForEdit(a)},this),this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this),this.canBeEdited=c.computed(function(){return mb.FolderType.User===this.type()},this),this.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function z(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function A(a,b,d){this.id=a,this.email=c.observable(b),this.name=c.observable(""),this.replyTo=c.observable(""),this.bcc=c.observable(""),this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(d)}function B(){p.call(this,"Popups","PopupsFolderClear"),this.selectedFolder=c.observable(null),this.clearingProcess=c.observable(!1),this.clearingError=c.observable(""),this.folderFullNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this),this.folderNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.localName():""},this),this.dangerDescHtml=c.computed(function(){return ob.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=ob.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Ab.data().message(null),Ab.data().messageList([]),this.clearingProcess(!0),Ab.cache().setFolderHash(b.fullNameRaw,""),Ab.remote().folderClear(function(b,c){a.clearingProcess(!1),mb.StorageResultType.Success===b&&c&&c.Result?(Ab.reloadMessageList(!0),a.cancelCommand()):c&&c.ErrorCode?a.clearingError(ob.getNotification(c.ErrorCode)):a.clearingError(ob.getNotification(mb.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),r.constructorEnd(this)}function C(){p.call(this,"Popups","PopupsFolderCreate"),ob.initOnStartOrLangChange(function(){this.sNoParentText=ob.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.focusTrigger=c.observable(!1),this.selectedParentValue=c.observable(lb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Ab.data(),b=[],c=null,d=null,e=a.folderList(),f=function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""};return b.push(["",this.sNoParentText]),""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)}),Ab.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=ob.createCommand(this,function(){var a=Ab.data(),b=this.selectedParentValue();""===b&&1 =a?1:a},this),this.contactsPagenator=c.computed(ob.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewProperties=c.observableArray([]),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1 0&&b>0&&a>b},this),this.hasMessages=c.computed(function(){return 0 '),e.after(f),e.remove()),f&&f[0]&&f.attr("data-href",g).attr("data-theme",a[0]).text(a[1]),d.themeTrigger(mb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(mb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Ab.remote().saveSettings(null,{Theme:c})},this)}function _(){ob.initDataConstructorBySettings(this)}function ab(){_.call(this);var a=function(a){return function(){var b=Ab.cache().getFolderFromCacheList(a());b&&b.type(mb.FolderType.User)}},d=function(a){return function(b){var c=Ab.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.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(d(mb.FolderType.SentItems),this),this.draftFolder.subscribe(d(mb.FolderType.Draft),this),this.spamFolder.subscribe(d(mb.FolderType.Spam),this),this.trashFolder.subscribe(d(mb.FolderType.Trash),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||lb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.replyTo=c.observable(""),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.namespace="",this.folderList=c.observableArray([]),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder();return ob.isArray(b)&&0 =a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){tb.setHash(Ab.link().mailBox(this.currentFolderFullNameHash(),1,ob.trim(a.toString())))},owner:this}),this.messageListError=c.observable(""),this.messageListLoading=c.observable(!1),this.messageListIsNotCompleted=c.observable(!1),this.messageListCompleteLoadingThrottle=c.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=c.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(h.debounce(function(a){h.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500)),this.staticMessageList=new x,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this),this.messageFullScreenMode=c.observable(!1),this.messageError=c.observable(""),this.messagesBodiesDom=c.observable(null),this.messagesBodiesDom.subscribe(function(a){!a||a instanceof jQuery||this.messagesBodiesDom(b(a))},this),this.messageActiveDom=c.observable(null),this.isMessageSelected=c.computed(function(){return null!==this.message()},this),this.currentMessage=c.observable(null),this.message.subscribe(function(a){null===a&&(this.currentMessage(null),this.hideMessageBodies())},this),this.messageListChecked=c.computed(function(){return h.filter(this.messageList(),function(a){return a.checked()})},this),this.messageListCheckedOrSelected=c.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return h.union(a,b?[b]:[])},this),this.messageListCheckedUids=c.computed(function(){var a=[];return h.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),0 0?Math.ceil(b/a*100):0},this),this.useKeyboardShortcuts=c.observable(!0),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(mb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function bb(){this.oRequests={}}function cb(){bb.call(this),this.oRequests={}}function db(){this.oEmailsPicsHashes={},this.oServices={}}function eb(){db.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function fb(a){q.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function gb(){q.call(this,"login",[K])}function hb(){q.call(this,"mailbox",[M,O,P,Q]),this.oLastRoute={}}function ib(){fb.call(this,[N,R,S]),ob.initOnStartOrLangChange(function(){this.sSettingsTitle=ob.i18n("TITLES/SETTINGS")},this,function(){Ab.setTitle(this.sSettingsTitle)})}function jb(){o.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibility=c.observable(!1),this.iframe=b('').appendTo("body"),xb.on("error",function(a){Ab&&a&&a.originalEvent&&a.originalEvent.message&&-1===ob.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Ab.remote().jsError(ob.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",wb.attr("class"),ob.microtime()-rb.now)})}function kb(){jb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.quotaDebounce=h.debounce(this.quota,3e4),b.wakeUp(function(){Ab.remote().jsVersion(function(b,c){mb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Ab.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Ab.settingsGet("Version"))},{},36e5)}var lb={},mb={},nb={},ob={},pb={},qb={},rb={},sb={settings:[],"settings-removed":[],"settings-disabled":[]},tb=null,ub=a.rainloopAppData||{},vb=a.rainloopI18N||{},wb=b("html"),xb=b(a),yb=b(a.document),zb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Ab=null;rb.now=(new Date).getTime(),rb.minuteTick=c.observable(!0),rb.fiveMinuteTick=c.observable(!0),rb.langChangeTick=c.observable(!0),rb.iAjaxErrorCount=0,rb.iTokenErrorCount=0,rb.iMessageBodyCacheCount=0,rb.bUnload=!1,rb.sUserAgent=(navigator.userAgent||"").toLowerCase(),rb.bIsiOSDevice=-1 /g,">").replace(/"/g,""").replace(/'/g,"'"):""},ob.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=ob.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},ob.timeOutAction=function(){var b={};return function(c,d,e){ob.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),ob.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),ob.audio=function(){var b=!1;return function(c,d){if(!1===b)if(rb.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}}(),ob.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},ob.i18n=function(a,b,c){var d="",e=ob.isUnd(vb[a])?ob.isUnd(c)?a:c:vb[a];if(!ob.isUnd(b)&&!ob.isNull(b))for(d in b)ob.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},ob.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(ob.i18n(c)):(c=a.data("i18n-html"),c&&a.html(ob.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",ob.i18n(c)))})})},ob.i18nToDoc=function(){a.rainloopI18N&&(vb=a.rainloopI18N||{},ob.i18nToNode(yb),rb.langChangeTick(!rb.langChangeTick())),a.rainloopI18N={}},ob.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?rb.langChangeTick.subscribe(function(){a&&a.call(b),c.call(b)}):a&&rb.langChangeTick.subscribe(a,b)},ob.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)},ob.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},ob.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()},ob.replySubjectAdd=function(b,c,d){var e=null,f=ob.trim(c);return null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||ob.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||ob.isUnd(e[1])||ob.isUnd(e[2])||ob.isUnd(e[3])?f=b+": "+c:(f=e[1]+(ob.pInt(e[2])+1)+e[3],f=e[1]+(ob.pInt(e[2])+1)+e[3]):f=b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),(ob.isUnd(d)?!0:d)?ob.fixLongSubject(f):f},ob.fixLongSubject=function(a){var b=0,c=null;a=ob.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||ob.isUnd(c[0]))&&(c=null),c&&(b=0,b+=ob.isUnd(c[2])?1:0+ob.pInt(c[2]),b+=ob.isUnd(c[4])?1:0+ob.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]+/," ")},ob.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},ob.friendlySize=function(a){return a=ob.pInt(a),a>=1073741824?ob.roundNumber(a/1073741824,1)+"GB":a>=1048576?ob.roundNumber(a/1048576,1)+"MB":a>=1024?ob.roundNumber(a/1024,0)+"KB":a+"B"},ob.log=function(b){a.console&&a.console.log&&a.console.log(b)},ob.getNotification=function(a){return a=ob.pInt(a),ob.isUnd(nb[a])?"":nb[a] +},ob.initNotificationLanguage=function(){nb[mb.Notification.InvalidToken]=ob.i18n("NOTIFICATIONS/INVALID_TOKEN"),nb[mb.Notification.AuthError]=ob.i18n("NOTIFICATIONS/AUTH_ERROR"),nb[mb.Notification.AccessError]=ob.i18n("NOTIFICATIONS/ACCESS_ERROR"),nb[mb.Notification.ConnectionError]=ob.i18n("NOTIFICATIONS/CONNECTION_ERROR"),nb[mb.Notification.CaptchaError]=ob.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),nb[mb.Notification.SocialFacebookLoginAccessDisable]=ob.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),nb[mb.Notification.SocialTwitterLoginAccessDisable]=ob.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),nb[mb.Notification.SocialGoogleLoginAccessDisable]=ob.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),nb[mb.Notification.DomainNotAllowed]=ob.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),nb[mb.Notification.AccountNotAllowed]=ob.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),nb[mb.Notification.CantGetMessageList]=ob.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),nb[mb.Notification.CantGetMessage]=ob.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),nb[mb.Notification.CantDeleteMessage]=ob.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),nb[mb.Notification.CantMoveMessage]=ob.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),nb[mb.Notification.CantCopyMessage]=ob.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),nb[mb.Notification.CantSaveMessage]=ob.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),nb[mb.Notification.CantSendMessage]=ob.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),nb[mb.Notification.InvalidRecipients]=ob.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),nb[mb.Notification.CantCreateFolder]=ob.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),nb[mb.Notification.CantRenameFolder]=ob.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),nb[mb.Notification.CantDeleteFolder]=ob.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),nb[mb.Notification.CantDeleteNonEmptyFolder]=ob.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),nb[mb.Notification.CantSubscribeFolder]=ob.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),nb[mb.Notification.CantUnsubscribeFolder]=ob.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),nb[mb.Notification.CantSaveSettings]=ob.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),nb[mb.Notification.CantSavePluginSettings]=ob.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),nb[mb.Notification.DomainAlreadyExists]=ob.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),nb[mb.Notification.CantInstallPackage]=ob.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),nb[mb.Notification.CantDeletePackage]=ob.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),nb[mb.Notification.InvalidPluginPackage]=ob.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),nb[mb.Notification.UnsupportedPluginPackage]=ob.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),nb[mb.Notification.LicensingServerIsUnavailable]=ob.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),nb[mb.Notification.LicensingExpired]=ob.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),nb[mb.Notification.LicensingBanned]=ob.i18n("NOTIFICATIONS/LICENSING_BANNED"),nb[mb.Notification.DemoSendMessageError]=ob.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),nb[mb.Notification.AccountAlreadyExists]=ob.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),nb[mb.Notification.MailServerError]=ob.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),nb[mb.Notification.UnknownNotification]=ob.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),nb[mb.Notification.UnknownError]=ob.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},ob.getUploadErrorDescByCode=function(a){var b="";switch(ob.pInt(a)){case mb.UploadErrorCode.FileIsTooBig:b=ob.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case mb.UploadErrorCode.FilePartiallyUploaded:b=ob.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case mb.UploadErrorCode.FileNoUploaded:b=ob.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case mb.UploadErrorCode.MissingTempFolder:b=ob.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case mb.UploadErrorCode.FileOnSaveingError:b=ob.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case mb.UploadErrorCode.FileType:b=ob.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=ob.i18n("UPLOAD/ERROR_UNKNOWN")}return b},ob.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===mb.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===mb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},ob.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=ob.isUnd(d)?!0:d,e.canExecute=ob.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},ob.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(mb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(mb.InterfaceAnimation.Full),rb.sAnimationType=mb.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.usePreviewPane=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.interfaceAnimation.subscribe(function(a){if(rb.bMobileDevice||a===mb.InterfaceAnimation.None)wb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),rb.sAnimationType=mb.InterfaceAnimation.None;else switch(a){case mb.InterfaceAnimation.Full:wb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),rb.sAnimationType=a;break;case mb.InterfaceAnimation.Normal:wb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),rb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=mb.DesktopNotifications.NotSupported;if(zb&&zb.permission)switch(zb.permission.toLowerCase()){case"granted":c=mb.DesktopNotifications.Allowed;break;case"denied":c=mb.DesktopNotifications.Denied;break;case"default":c=mb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&mb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();mb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):mb.DesktopNotifications.NotAllowed===c?zb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),mb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1 =b.diff(c,"hours")?d:b.format("L")===c.format("L")?ob.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?ob.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},ob.isFolderExpanded=function(a){var b=Ab.local().get(mb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},ob.setExpandedFolder=function(a,b){var c=Ab.local().get(mb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Ab.local().set(mb.ClientSideKeyName.ExpandedFolders,c)},ob.initLayoutResizer=function(a,c,d,e,f,g,i,j){e=e||300,f=f||500,g=g||f-e/2,i=i||300;var k=0,l=b(a),m=b(c),n=b(d),o=Ab.local().get(j)||g,p=function(a,b,c){if(b||c){var d=n.width(),e=b?b.size.width/d*100:null;null===e&&c&&(e=l.width()/d*100),null!==e&&(l.css({width:"",height:"",right:""+(100-e)+"%"}),m.css({width:"",height:"",left:""+e+"%"}))}},q=function(b,c){if(c&&c.element&&c.element[0].id&&"#"+c.element[0].id==""+a){var d=n.width();k=d-i,k=f>k?k:f,l.resizable("option","maxWidth",k),c.size&&c.size.width&&Ab.local().set(j,c.size.width),p(null,null,!0)}};o&&l.width(o),k=n.width()-i,k=f>k?k:f,l.resizable({minWidth:e,maxWidth:k,handles:"e",resize:p,stop:p}),p(null,null,!0),xb.resize(h.throttle(q,400))},ob.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0 100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),ob.windowResize()}).after("
").before("
"))})}},ob.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},ob.extendAsViewModel=function(a,b,c){b&&(c||(c=p),b.__name=a,pb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},ob.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},sb.settings.push(a)},ob.removeSettingsViewModel=function(a){sb["settings-removed"].push(a)},ob.disableSettingsViewModel=function(a){sb["settings-disabled"].push(a)},ob.convertThemeName=function(a){return ob.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},ob.quoteName=function(a){return a.replace(/["]/g,'\\"')},ob.microtime=function(){return(new Date).getTime()},ob.convertLangName=function(a,b){return ob.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},ob.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=ob.isUnd(a)?32:ob.pInt(a);b.length/g,">").replace(/")},ob.draggeblePlace=function(){return b('').appendTo("#rl-hidden")},ob.defautOptionsAfterRender=function(a,b){b&&!ob.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},ob.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+ob.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),ob.i18nToNode(d),r.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+ob.encodeHtml(e)+' '),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},ob.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=ob.isUnd(d)?1e3:ob.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?mb.SaveSettingsStep.TrueResult:mb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,mb.SaveSettingsStep.Idle)},d)}},ob.settingsSaveHelperSimpleFunction=function(a,b){return ob.settingsSaveHelperFunction(null,a,b,1e3)},ob.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},ob.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:ob.isUnd(c)?a.toString():c.toString(),custom:ob.isUnd(c)?!1:!0,title:ob.isUnd(c)?"":a.toString(),value:a.toString()};(ob.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},qb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return qb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=qb._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return qb._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!rb.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+ob.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.modal={init:function(a,d){b(a).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)})},update:function(a,d){var e=c.utils.unwrapObservable(d());b(a).modal(e?"show":"hide"),h.delay(function(){b(a).toggleClass("popup-active",e)},1)}},c.bindingHandlers.i18nInit={init:function(a){ob.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),ob.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=ob.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=ob.pInt(e[2]),g=xb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!rb.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),ob.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),ob.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null,!!a.shiftKey)},b(d).draggable(k).on("mousedown",function(){ob.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!rb.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){rb.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger1={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text]")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a),g="custom"===f.data("save-trigger-type"),h=g?"":"-input";switch(e.toString()){case"1":f.find(".sst-animated"+h+",.sst-error"+h).hide().removeClass("sst-visible"+h).end().find(".sst-success"+h).show().addClass("sst-visible"+h);break;case"0":f.find(".sst-animated"+h+",.sst-success"+h).hide().removeClass("sst-visible"+h).end().find(".sst-error"+h).show().addClass("sst-visible"+h);break;case"-2":f.find(".sst-error"+h+",.sst-success"+h).hide().removeClass("sst-visible"+h).end().find(".sst-animated"+h).show().addClass("sst-visible"+h);break;default:f.find(".sst-animated"+h).hide().end().find(".sst-error"+h+",.sst-success"+h).removeClass("sst-visible"+h)}}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c();d.inputosaurus({parseOnBlur:!0,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Ab.getAutocomplete(a.term,function(a){b(h.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return h.map(a,function(a){var b=ob.trim(a),c=null;return""!==b?(c=new s,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(){d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(ob.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},ob.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=ob.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=ob.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),ob.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},i.prototype.root=function(){return this.sBase},i.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},i.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},i.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},i.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},i.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},i.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},i.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},i.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},i.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},i.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},i.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},i.prototype.settings=function(a){var b=this.sBase+"settings";return ob.isUnd(a)||""===a||(b+="/"+a),b},i.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},i.prototype.mailBox=function(a,b,c){b=ob.isNormal(b)?ob.pInt(b):1,c=ob.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},i.prototype.phpInfo=function(){return this.sServer+"Info"},i.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},i.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},i.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},i.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},i.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},i.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},i.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},i.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},pb.oViewModelsHooks={},pb.oSimpleHooks={},pb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},pb.addHook=function(a,b){ob.isFunc(b)&&(ob.isArray(pb.oSimpleHooks[a])||(pb.oSimpleHooks[a]=[]),pb.oSimpleHooks[a].push(b))},pb.runHook=function(a,b){ob.isArray(pb.oSimpleHooks[a])&&(b=b||[],h.each(pb.oSimpleHooks[a],function(a){a.apply(null,b)}))},pb.mainSettingsGet=function(a){return Ab?Ab.settingsGet(a):null},pb.remoteRequest=function(a,b,c,d,e,f){Ab&&Ab.remote().defaultRequest(a,b,c,d,e,f)},pb.settingsGet=function(a,b){var c=pb.mainSettingsGet("Plugins");return c=c&&ob.isUnd(c[a])?null:c[a],c?ob.isUnd(c[b])?null:c[b]:null},j.prototype.initLanguage=function(a,b,c){this.oOptions.LangSwitcherConferm=a,this.oOptions.LangSwitcherTextLabel=b,this.oOptions.LangSwitcherHtmlLabel=c},j.prototype.execCom=function(b,c,d){a.document&&(a.document.execCommand(b,c||!1,d||null),this.updateTextArea())},j.prototype.getEditorSelection=function(){var b=null;return a.getSelection?b=a.getSelection():a.document.getSelection?b=a.document.getSelection():a.document.selection&&(b=a.document.selection),b},j.prototype.getEditorRange=function(){var a=this.getEditorSelection();return a&&0!==a.rangeCount?a.getRangeAt?a.getRangeAt(0):a.createRange():null},j.prototype.ec=function(a,b,c){this.execCom(a,b,c)},j.prototype.heading=function(a){this.ec("formatblock",!1,this.bIe?"Heading "+a:"h"+a)},j.prototype.insertImage=function(a){this.isHtml()&&!this.bOnlyPlain&&(this.htmlarea.focus(),this.ec("insertImage",!1,a))},j.prototype.focus=function(){this.isHtml()&&!this.bOnlyPlain?this.htmlarea.focus():this.textarea.focus()},j.prototype.setcolor=function(a,b){var c=null,d="";this.bIe&&!document.addEventListener?(c=this.getEditorRange(),c&&c.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b)):(d=this.bIe?"forecolor"===a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(d,!1,b))},j.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")},j.prototype.toHtmlString=function(){return this.editor.innerHTML},j.prototype.toString=function(){return this.editor.innerText},j.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())},j.prototype.updateHtmlArea=function(){this.editor.innerHTML=this.textarea.val()},j.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))},j.prototype.clear=function(){this.textarea.val(""),this.editor.innerHTML="",this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()},j.prototype.getTextForRequest=function(){return this.isHtml()?(this.updateTextArea(),this.textarea.val()):this.textarea.val()},j.prototype.getTextFromHtml=function(a){var b="",c="> ",d=function(){if(arguments&&1 \n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1 ]*>([\s\S]*)<\/div>/gim,e),a="\n"+ob.trim(a)+"\n"),a}return""},f=function(){if(arguments&&1 /gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/
]*>/gim,"\n_______________________________\n\n").replace(/]*>/gim,"").replace(/
]*>([\s\S]*)<\/div>/gim,e).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>([\s\S]*?)<\/a>/gim,f).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),(a?ob.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,"") },j.prototype.getHtmlFromText=function(){return ob.convertPlainTextToHtml(this.textarea.val())},j.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()},j.prototype.switchToPlain=function(c){c=ob.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!==ob.trim(d).length?e(a.confirm(this.oOptions.LangSwitcherConferm)):e(!0)},j.prototype.switcherLinkText=function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel},j.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)},j.prototype.addButton=function(c,d){var e=this;b("").addClass("editorToolbarButtom").append(b('').addClass(c)).attr("title",d).click(function(d){ob.isUnd(j.htmlFunctions[c])?a.alert(c):j.htmlFunctions[c].apply(e,[b(this),d])}).appendTo(this.toolbar)},j.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("").addClass("editorSwitcher").text(b.switcherLinkText(!0)).click(function(){b.switchToggle()}).appendTo(b.toolbar)}(b,this))},j.htmlInitEditor=function(){this.editor=this.htmlarea[0],this.editor.innerHTML=this.textarea.val()},j.htmlAttachEditorEvents=function(){var b=this,c=function(a){return a&&a.type&&0===a.type.indexOf("image/")},d=function(d){if(d=(d&&d.originalEvent?d.originalEvent:d)||a.event){d.stopPropagation(),d.preventDefault();var e=null,f=null,g=d.files||(d.dataTransfer?d.dataTransfer.files:null);g&&1===g.length&&c(g[0])&&(f=g[0],e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}b.htmlarea.removeClass("editorDragOver")},e=function(){b.htmlarea.removeClass("editorDragOver")},f=function(a){a.stopPropagation(),a.preventDefault(),b.htmlarea.addClass("editorDragOver")},g=function(d){var e=d&&d.clipboardData?d.clipboardData:d&&d.originalEvent&&d.originalEvent.clipboardData?d.originalEvent.clipboardData:null;e&&e.items&&h.each(e.items,function(d){if(c(d)&&d.getAsFile){var e=null,f=d.getAsFile();f&&(e=new a.FileReader,e.onload=function(a){return function(c){b.insertImage(c.target.result,a.name)}}(f),e.readAsDataURL(f))}})};this.bOnlyPlain||a.File&&a.FileReader&&a.FileList&&(this.htmlarea.bind("dragover",f),this.htmlarea.bind("dragleave",e),this.htmlarea.bind("drop",d),this.htmlarea.bind("paste",g))},j.htmlColorPickerColors=function(){var a=[],b=[],c=0,d=0,e=0,f=0,g="";for(c=0;256>c;c+=85)g=c.toString(16),a.push(1===g.length?"0"+g:g);for(f=a.length,c=0;f>c;c++)for(d=0;f>d;d++)for(e=0;f>e;e++)b.push("#"+a[c]+a[d]+a[e]);return b}(),j.htmlFontPicker=function(){var c=b(a.document),d=!1,e=b(''),f=e.find(".editorFpFonts"),g=function(){};return b.each(["Arial","Arial Black","Courier New","Tahoma","Times New Roman","Verdana"],function(a,c){f.append(b(''+c+"").click(function(){g(c)})),f.append("
")}),e.hide(),function(f,h,i){d||(e.appendTo(i),d=!0),g=h,c.unbind("click.fpNamespace"),a.setTimeout(function(){c.one("click.fpNamespace",function(){e.hide()})},500);var j=b(f).position();e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.htmlColorPicker=function(){var c=b(a.document),d=!1,e=b(''),f=e.find(".editorCpColors"),g=function(){};return b.each(j.htmlColorPickerColors,function(a,b){f.append('')}),e.hide(),b(".editorCpColor",f).click(function(a){var c=1,d="#000000",e=b(a.target).css("background-color"),f=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==f){for(delete f[0];3>=c;++c)f[c]=ob.pInt(f[c]).toString(16),1===f[c].length&&(f[c]="0"+f[c]);d="#"+f.join("")}else d=e;g(d)}),function(f,h,i){d||(e.appendTo(i),d=!0);var j=b(f).position();g=h,c.unbind("click.cpNamespace"),a.setTimeout(function(){c.one("click.cpNamespace",function(){e.hide()})},100),e.css("top",5+j.top+b(f).height()+"px").css("left",j.left+"px").show()}}(),j.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){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){j.htmlColorPicker(a,h.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){j.htmlFontPicker(a,h.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}},k.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},k.prototype.goDown=function(){this.newSelectPosition(mb.EventKeyCode.Down,!1)},k.prototype.goUp=function(){this.newSelectPosition(mb.EventKeyCode.Up,!1)},k.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),b(a.document).on("keydown",function(a){var b=!0;return a&&f.bUseKeyboard&&!ob.inFocus()&&(-10)if(m){if(m)if(mb.EventKeyCode.Down===b||mb.EventKeyCode.Up===b||mb.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case mb.EventKeyCode.Up:m===a?i=!0:j=a;break;case mb.EventKeyCode.Down:case mb.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(mb.EventKeyCode.Home===b||mb.EventKeyCode.End===b)mb.EventKeyCode.Home===b?j=k[0]:mb.EventKeyCode.End===b&&(j=k[k.length-1]);else if(mb.EventKeyCode.PageDown===b){for(;l>e;e++)if(m===k[e]){e+=f,e=e>l-1?l-1:e,j=k[e];break}}else if(mb.EventKeyCode.PageUp===b)for(e=l;e>=0;e--)if(m===k[e]){e-=f,e=0>e?0:e,j=k[e];break}}else mb.EventKeyCode.Down===b||mb.EventKeyCode.Insert===b||mb.EventKeyCode.Home===b||mb.EventKeyCode.PageUp===b?j=k[0]:(mb.EventKeyCode.Up===b||mb.EventKeyCode.End===b||mb.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(mb.EventKeyCode.Up===b||mb.EventKeyCode.Down===b)&&m.checked(!m.checked()):mb.EventKeyCode.Insert===b&&m.checked(!m.checked())),this.throttleSelection=!0,this.selectedItem(j),this.throttleSelection=!0,0!==this.iSelectTimer?(a.clearTimeout(this.iSelectTimer),this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0,d.actionClick(j)},1e3)):(this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0},200),this.actionClick(j)),this.scrollToSelected()):m&&(!c||mb.EventKeyCode.Up!==b&&mb.EventKeyCode.Down!==b?mb.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},k.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemSelectedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(d.top<0?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-a):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},k.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},k.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)}},k.prototype.on=function(a,b){this.oCallbacks[a]=b},l.supported=function(){return!0},l.prototype.set=function(a,c){var d=b.cookie(lb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(lb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},l.prototype.get=function(a){var c=b.cookie(lb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!ob.isUnd(d[a])?d[a]:null}catch(e){}return d},m.supported=function(){return!!a.localStorage},m.prototype.set=function(b,c){var d=a.localStorage[lb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[lb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},m.prototype.get=function(b){var c=a.localStorage[lb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!ob.isUnd(d[b])?d[b]:null}catch(e){}return d},n.prototype.oDriver=null,n.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},n.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},o.prototype.bootstart=function(){},p.prototype.sPosition="",p.prototype.sTemplate="",p.prototype.viewModelName="",p.prototype.viewModelDom=null,p.prototype.viewModelTemplate=function(){return this.sTemplate},p.prototype.viewModelPosition=function(){return this.sPosition},p.prototype.cancelCommand=p.prototype.closeCommand=function(){},q.prototype.oCross=null,q.prototype.sScreenName="",q.prototype.aViewModels=[],q.prototype.viewModels=function(){return this.aViewModels},q.prototype.screenName=function(){return this.sScreenName},q.prototype.routes=function(){return null},q.prototype.__cross=function(){return this.oCross},q.prototype.__start=function(){var a=this.routes(),b=null,c=null;ob.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||ob.emptyFunction,this),b=d.create(),h.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},r.constructorEnd=function(a){ob.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},r.prototype.sDefaultScreenName="",r.prototype.oScreens={},r.prototype.oBoot=null,r.prototype.oCurrentScreen=null,r.prototype.showLoading=function(){b("#rl-loading").show()},r.prototype.hideLoading=function(){b("#rl-loading").hide()},r.prototype.routeOff=function(){e.changed.active=!1},r.prototype.routeOn=function(){e.changed.active=!0},r.prototype.setBoot=function(a){return ob.isNormal(a)&&(this.oBoot=a),this},r.prototype.screen=function(a){return""===a||ob.isUnd(this.oScreens[a])?null:this.oScreens[a]},r.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,ob.isArray(c)?c:[])},r.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Ab.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=ob.createCommand(e,function(){tb.hideScreenPopup(a)})),pb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),this.delegateRun(e,"onBuild",[h]),pb.runHook("view-model-post-build",[a.__name,e,h])):ob.log("Cannot find view model position: "+f)}return a?a.__vm:null},r.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},r.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1))},r.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),pb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},r.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===ob.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,ob.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onHide"),ob.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),c.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onShow"),pb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),ob.isNonEmptyArray(c.oCurrentScreen.viewModels())&&h.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),c.delegateRun(a.__vm,"onShow"),pb.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},r.prototype.startScreens=function(a){h.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),h.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),pb.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),pb.runHook("screen-post-start",[a.screenName(),a]))},this);var b=d.create();b.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,h.bind(this.screenOnRoute,this)),e.initialized.add(b.parse,b),e.changed.add(b.parse,b),e.init()},r.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=ob.isUnd(c)?!1:!!c,(ob.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},r.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},tb=new r,s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null},s.prototype.name="",s.prototype.email="",s.prototype.privateType=null,s.prototype.clear=function(){this.email="",this.name="",this.privateType=null},s.prototype.validate=function(){return""!==this.name||""!==this.email},s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},s.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=mb.EmailType.Facebook),null===this.privateType&&(this.privateType=mb.EmailType.Default)),this.privateType},s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},s.prototype.parse=function(a){this.clear(),a=ob.trim(a);var b=/(?:"([^"]+)")? ?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},s.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=ob.trim(a.Name),this.email=ob.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},s.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=ob.isUnd(b)?!1:!!b,c=ob.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+ob.encodeHtml(this.name)+"":c?ob.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=ob.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+ob.encodeHtml(d)+""+ob.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=ob.encodeHtml(d))):b&&(d=''+ob.encodeHtml(this.email)+""))),d},s.prototype.select2Result=function(){var a="",b=Ab.cache().getUserPic(this.email);return a+=""!==b?'").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Ab.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),tb.delegateRun(e,"onBuild",[i])):ob.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(tb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),tb.delegateRun(d.oCurrentSubScreen,"onShow"),h.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),ob.windowResize()})):tb.setHash(Ab.link().settings(),!1,!0)},fb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(tb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},fb.prototype.onBuild=function(){h.each(sb.settings,function(a){a&&a.__rlSettingsData&&!h.find(sb["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!h.find(sb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},fb.prototype.routes=function(){var a=h.find(sb.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=ob.isUnd(c.subname)?b:ob.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(gb.prototype,q.prototype),gb.prototype.onShow=function(){Ab.setTitle(ob.i18n("TITLES/LOGIN"))},h.extend(hb.prototype,q.prototype),hb.prototype.oLastRoute={},hb.prototype.setNewTitle=function(){var a=Ab.data().accountEmail(),b=Ab.data().foldersInboxUnreadCount();Ab.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+ob.i18n("TITLES/MAILBOX"))},hb.prototype.onShow=function(){this.setNewTitle()},hb.prototype.onRoute=function(a,b,c){var d=Ab.data(),e=Ab.cache().getFolderFullNameRaw(a),f=Ab.cache().getFolderFromCacheList(e);f&&(d.currentFolder(f).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),Ab.reloadMessageList())},hb.prototype.onStart=function(){var b=Ab.data(),c=function(){ob.windowResize()};(Ab.settingsGet("AllowAdditionalAccounts")||Ab.settingsGet("AllowIdentities"))&&Ab.accountsAndIdentities(),h.delay(function(){Ab.quota()},5e3),h.delay(function(){"INBOX"!==b.currentFolderFullNameRaw()&&Ab.folderInformation("INBOX")},1e3),h.delay(function(){var a=Ab.data().spamFolder();a!==b.currentFolderFullNameRaw()&&""!==a&&Ab.folderInformation(a)},1500),h.delay(function(){var a=Ab.data().draftFolder();a!==b.currentFolderFullNameRaw()&&""!==a&&Ab.folderInformation(a)},2e3),h.delay(function(){Ab.remote().appDelayStart(ob.emptyFunction)},35e3),a.setInterval(function(){Ab.folderInformation("INBOX")},12e4),a.setInterval(function(){Ab.quota()},3e5),wb.toggleClass("rl-no-preview-pane",!b.usePreviewPane()),b.folderList.subscribe(c),b.messageList.subscribe(c),b.message.subscribe(c),b.usePreviewPane.subscribe(function(a){wb.toggleClass("rl-no-preview-pane",!a)}),b.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},hb.prototype.onBuild=function(){rb.bMobileDevice||h.defer(function(){ob.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",350,800,350,350,mb.ClientSideKeyName.MailBoxListSize)})},hb.prototype.routes=function(){var a=function(a,b){return b[0]=ob.pString(b[0]),b[1]=ob.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=ob.pString(b[2]),""===a&&(b[0]="Inbox",b[1]=1),[decodeURI(b[0]),b[1],decodeURI(b[2])]},b=function(a,b){return b[0]=ob.pString(b[0]),b[1]=ob.pString(b[1]),""===a&&(b[0]="Inbox"),[decodeURI(b[0]),1,decodeURI(b[1])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:b}],[/^([^\/]*)$/,{normalize_:a}]]},h.extend(ib.prototype,fb.prototype),ib.prototype.onShow=function(){Ab.setTitle(this.sSettingsTitle)},h.extend(jb.prototype,o.prototype),jb.prototype.oSettings=null,jb.prototype.oPlugins=null,jb.prototype.oLocal=null,jb.prototype.oLink=null,jb.prototype.oSubs={},jb.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(rb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},jb.prototype.link=function(){return null===this.oLink&&(this.oLink=new i),this.oLink},jb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new n),this.oLocal},jb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=ob.isNormal(ub)?ub:{}),ob.isUnd(this.oSettings[a])?null:this.oSettings[a]},jb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=ob.isNormal(ub)?ub:{}),this.oSettings[a]=b},jb.prototype.setTitle=function(b){b=(0':'
',mb.EmailType.Facebook===this.type()?(a+=""+(0
'):a+=""+(0 ('+this.name+")":this.email),a+""},s.prototype.select2Selection=function(a){var c="";if(mb.EmailType.Facebook===this.type()){if(c=0 ").text(c).appendTo(a),a.append(''),null}else c=0 b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m 0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=ob.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=ob.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=ob.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},s.prototype.inputoTagLine=function(){return 0 +$/,""),b=!0),b},v.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},x.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(ob.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=s.newInstanceFromJson(a[b]),d&&e.push(d);return e},x.replyHelper=function(a,b,c){if(a&&0 d;d++)ob.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},x.prototype.initByJson=function(a){var b=!1;return a&&"Object/Message"===a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(ob.pInt(a.Size)),this.from=x.initEmailsFromJson(a.From),this.to=x.initEmailsFromJson(a.To),this.cc=x.initEmailsFromJson(a.Cc),this.bcc=x.initEmailsFromJson(a.Bcc),this.replyTo=x.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(ob.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(x.emailsToLine(this.from,!0)),this.toEmailsString(x.emailsToLine(this.to,!0)),this.parentUid(ob.pInt(a.ParentThread)),this.threads(ob.isArray(a.Threads)?a.Threads:[]),this.threadsLen(ob.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},x.prototype.computeSenderEmail=function(){var a=Ab.data().sentFolder(),b=Ab.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},x.prototype.initUpdateByMessageJson=function(a){var b=!1,c=mb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=ob.pInt(a.Priority),this.priority(-1 b;b++)d=v.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},x.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return ob.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},x.prototype.messageId=function(){return this.sMessageId},x.prototype.inReplyTo=function(){return this.sInReplyTo},x.prototype.references=function(){return this.sReferences},x.prototype.fromAsSingleEmail=function(){return ob.isArray(this.from)&&this.from[0]?this.from[0].email:""},x.prototype.viewLink=function(){return Ab.link().messageViewLink(this.requestHash)},x.prototype.downloadLink=function(){return Ab.link().messageDownloadLink(this.requestHash)},x.prototype.replyEmails=function(a){var b=[],c=ob.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,c,b),0===b.length&&x.replyHelper(this.from,c,b),b},x.prototype.replyAllEmails=function(a){var b=[],c=[],d=ob.isUnd(a)?{}:a;return x.replyHelper(this.replyTo,d,b),0===b.length&&x.replyHelper(this.from,d,b),x.replyHelper(this.to,d,b),x.replyHelper(this.cc,d,c),[b,c]},x.prototype.textBodyToString=function(){return this.body?this.body.html():""},x.prototype.attachmentsToStringLine=function(){var a=h.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0 =0&&e&&!f&&d.attr("src",e)}),c&&a.setTimeout(function(){d.print()},100))})},x.prototype.printMessage=function(){this.viewPopupMessage(!0)},x.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},x.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.selected(a.selected()),this.checked(a.checked()),this.hasAttachments(a.hasAttachments()),this.attachmentsMainType(a.attachmentsMainType()),this.moment(a.moment()),this.body=null,this.priority(mb.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 -},x.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=ob.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=ob.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({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b(".RL-MailMessageView .messageView .messageItem .content")[0]}),xb.resize()),ob.windowResize(500))},x.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){a=ob.isUnd(a)?!1:a;var c=this;this.body.data("rl-init-internal-images",!0),b("[data-x-src-cid]",this.body).each(function(){var d=c.findAttachmentByCid(b(this).attr("data-x-src-cid"));d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-src-location]",this.body).each(function(){var d=c.findAttachmentByContentLocation(b(this).attr("data-x-src-location"));d||(d=c.findAttachmentByCid(b(this).attr("data-x-src-location"))),d&&d.download&&(a&&b(this).is("img")?b(this).addClass("lazy").attr("data-original",d.linkPreview()):b(this).attr("src",d.linkPreview()))}),b("[data-x-style-cid]",this.body).each(function(){var a="",d="",e=c.findAttachmentByCid(b(this).attr("data-x-style-cid"));e&&e.linkPreview&&(d=b(this).attr("data-x-style-cid-name"),""!==d&&(a=ob.trim(b(this).attr("style")),a=""===a?"":";"===a.substr(-1)?a+" ":a+"; ",b(this).attr("style",a+d+": url('"+e.linkPreview()+"')")))}),a&&!function(a,b){h.delay(function(){a.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:b})},300)}(b("img.lazy",c.body),b(".RL-MailMessageView .messageView .messageItem .content")[0]),ob.windowResize(500)}},y.newInstanceFromJson=function(a){var b=new y;return b.initByJson(a)?b.initComputed():null},y.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.visible=c.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this),this.isSystemFolder=c.computed(function(){return mb.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){ob.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){ob.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this}),this.printableUnreadCount=c.computed(function(){var a=this.messageCountAll(),b=this.messageCountUnread(),c=this.type();return mb.FolderType.Inbox===c&&Ab.data().foldersInboxUnreadCount(b),b>0&&(mb.FolderType.Inbox===c||mb.FolderType.Spam===c)?""+b:a>0&&mb.FolderType.Draft===c?""+a:""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder();return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){ob.timeOutAction("folder-list-folder-visibility-change",function(){xb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){rb.langChangeTick();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case mb.FolderType.Inbox:b=ob.i18n("FOLDER_LIST/INBOX_NAME");break;case mb.FolderType.SentItems:b=ob.i18n("FOLDER_LIST/SENT_NAME");break;case mb.FolderType.Draft:b=ob.i18n("FOLDER_LIST/DRAFTS_NAME");break;case mb.FolderType.Spam:b=ob.i18n("FOLDER_LIST/SPAM_NAME");break;case mb.FolderType.Trash:b=ob.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){rb.langChangeTick();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case mb.FolderType.Inbox:a="("+ob.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case mb.FolderType.SentItems:a="("+ob.i18n("FOLDER_LIST/SENT_NAME")+")";break;case mb.FolderType.Draft:a="("+ob.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case mb.FolderType.Spam:a="("+ob.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case mb.FolderType.Trash:a="("+ob.i18n("FOLDER_LIST/TRASH_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this},y.prototype.fullName="",y.prototype.fullNameRaw="",y.prototype.fullNameHash="",y.prototype.delimiter="",y.prototype.namespace="",y.prototype.deep=0,y.prototype.isNamespaceFolder=!1,y.prototype.isGmailFolder=!1,y.prototype.isUnpaddigFolder=!1,y.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"},y.prototype.initByJson=function(a){var b=!1;return 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?mb.FolderType.Inbox:mb.FolderType.User),b=!0),b},y.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},z.prototype.email="",z.prototype.changeAccountLink=function(){return Ab.link().change(this.email)},A.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},A.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},A.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+ob.quoteName(a)+'" <'+this.email()+">"},ob.extendAsViewModel("PopupsFolderClearViewModel",B),B.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},B.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},ob.extendAsViewModel("PopupsFolderCreateViewModel",C),C.prototype.sNoParentText="",C.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(ob.trim(a))},C.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.focusTrigger(!1)},C.prototype.onShow=function(){this.clearPopup(),this.focusTrigger(!0)},ob.extendAsViewModel("PopupsFolderSystemViewModel",D),D.prototype.sChooseOnText="",D.prototype.sUnuseText="",D.prototype.onShow=function(a){var b="";switch(a=ob.isUnd(a)?mb.SetSystemFoldersNotification.None:a){case mb.SetSystemFoldersNotification.Sent:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case mb.SetSystemFoldersNotification.Draft:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case mb.SetSystemFoldersNotification.Spam:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case mb.SetSystemFoldersNotification.Trash:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},ob.extendAsViewModel("PopupsComposeViewModel",E),E.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};switch(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Ab.data().accountEmail()]=Ab.data().accountEmail(),a){case mb.ComposeType.Empty:d=Ab.data().accountEmail();break;case mb.ComposeType.Reply:case mb.ComposeType.ReplyAll:case mb.ComposeType.Forward:case mb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case mb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}return d},E.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},E.prototype.formattedFrom=function(a){var b=Ab.data().displayName(),c=Ab.data().accountEmail();return""===b?c:(ob.isUnd(a)?1:!a)?b+" ("+c+")":'"'+ob.quoteName(b)+'" <'+c+">"},E.prototype.sendMessageResponse=function(b,c){var d=!1;this.sending(!1),mb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&tb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&mb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(ob.trim(ob.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),a.alert(ob.getNotification(c&&c.ErrorCode?c.ErrorCode:mb.Notification.CantSendMessage))))},E.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),mb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Ab.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Ab.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0 b;b++)d.push(a[b].toLine(!1));return d.join(", ")};if(c=c||null,c&&ob.isNormal(c)&&(t=ob.isArray(c)&&1===c.length?c[0]:ob.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(v,t))),this.reset(),ob.isNonEmptyArray(d)&&this.to(w(d)),""!==v&&t){switch(j=t.fullFormatDateValue(),k=t.subject(),s=t.aDraftInfo,l=b(t.body).clone(),ob.removeBlockquoteSwitcher(l),m=l.html(),v){case mb.ComposeType.Empty:break;case mb.ComposeType.Reply:this.to(w(t.replyEmails(p))),this.subject(ob.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.sReferences),u=!0;break;case mb.ComposeType.ReplyAll:o=t.replyAllEmails(p),this.to(w(o[0])),this.cc(w(o[1])),this.subject(ob.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.references()),u=!0;break;case mb.ComposeType.Forward:this.subject(ob.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.sReferences);break;case mb.ComposeType.ForwardAsAttachment:this.subject(ob.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.sReferences);break;case mb.ComposeType.Draft:this.to(w(t.to)),this.cc(w(t.cc)),this.bcc(w(t.bcc)),this.bFromDraft=!0,this.draftFolder(t.folderFullNameRaw),this.draftUid(t.uid),this.subject(k),this.prepearMessageAttachments(t,v),this.aDraftInfo=ob.isNonEmptyArray(s)&&3===s.length?s:null,this.sInReplyTo=t.sInReplyTo,this.sReferences=t.sReferences}if(this.oEditor){switch(v){case mb.ComposeType.Reply:case mb.ComposeType.ReplyAll:f=t.fromToLine(!1,!0),n=ob.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case mb.ComposeType.Forward:f=t.fromToLine(!1,!0),g=t.toToLine(!1,!0),i=t.ccToLine(!1,!0),m="
"+m+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+ob.encodeHtml(j)+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+ob.encodeHtml(k)+"
"+m;break;case mb.ComposeType.ForwardAsAttachment:m=""}this.oEditor.setRawText(m,t.isHtml())}}else this.oEditor&&mb.ComposeType.Empty===v?this.oEditor.setRawText("
"+ob.convertPlainTextToHtml(Ab.data().signature()),mb.EditorDefaultType.Html===Ab.data().editorDefaultType()):ob.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload(),ob.isNonEmptyArray(r)&&Ab.remote().messageUploadAttachments(function(a,b){if(mb.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},r),u&&this.oEditor&&this.oEditor.focus(),this.triggerForResize()},E.prototype.onBuild=function(){this.initEditor(),this.initUploader();var a=this,c=null;xb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Ab.data().useKeyboardShortcuts()&&(b.ctrlKey&&mb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&mb.EventKeyCode.Enter===b.keyCode&&(a.sendCommand(),c=!1)),c}),xb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(c=document.createElement("script"),c.type="text/javascript",c.src="https://www.dropbox.com/static/api/1/dropins.js",b(c).attr("id","dropboxjs").attr("data-app-key",Ab.settingsGet("DropboxApiKey")),document.body.appendChild(c))},E.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;d>c;c++)if(b[c]&&a===b[c].id)return b[c];return null},E.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new j(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}}),this.oEditor.initLanguage(ob.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),ob.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),ob.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}},E.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=ob.pInt(Ab.settingsGet("AttachmentLimit")),c=new g({action:Ab.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;ob.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=ob.isUnd(d.FileName)?"":d.FileName.toString(),g=ob.isNormal(d.Size)?ob.pInt(d.Size):null,h=new w(a,f,g);return h.cancel=function(a){return function(){e.attachments.remove(function(b){return b&&b.id===a}),c&&c.cancel(a)}}(a),this.attachments.push(h),g>0&&b>0&&g>b?(h.error(ob.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;ob.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=ob.getUploadErrorDescByCode(f):g||(e=ob.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(ob.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Ab.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),mb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(ob.getUploadErrorDescByCode(mb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},E.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=ob.isNonEmptyArray(a.attachments())?a.attachments():[],e=0,f=d.length,g=null,h=null,i=!1,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(mb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case mb.ComposeType.Reply:case mb.ComposeType.ReplyAll:i=h.isLinked;break;case mb.ComposeType.Forward:case mb.ComposeType.Draft:i=!0}i=!0,i&&(g=new w(h.download,h.fileName,h.estimatedSize,h.isInline,h.isLinked,h.cid,h.contentLocation),g.fromMessage=!0,g.cancel=j(h.download),g.waiting(!1).uploading(!0),this.attachments.push(g))}}},E.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},E.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(ob.getUploadErrorDescByCode(mb.UploadErrorCode.FileNoUploaded))},this)},E.prototype.isEmptyForm=function(a){a=ob.isUnd(a)?!0:!!a;var b=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&&b&&""===this.oEditor.getTextForRequest()},E.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),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.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear()},E.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},E.prototype.triggerForResize=function(){this.resizer(!this.resizer())},ob.extendAsViewModel("PopupsContactsViewModel",F),F.prototype.addNewEmail=function(){var a=new u(mb.ContactPropertyType.EmailPersonal,"");a.focused(!0),this.viewProperties.push(a)},F.prototype.addNewPhone=function(){var a=new u(mb.ContactPropertyType.PhonePersonal,"");a.focused(!0),this.viewProperties.push(a)},F.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0 =d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},F.prototype.deleteSelectedContacts=function(){0 0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,lb.Defaults.ContactsPerPage,this.search())},F.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Ab.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(ob.pInt(a.value)),d.reloadContactList())})},F.prototype.onShow=function(){tb.routeOff(),this.reloadContactList(!0)},F.prototype.onHide=function(){tb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},ob.extendAsViewModel("PopupsAdvancedSearchViewModel",G),G.prototype.buildSearchStringValue=function(a){return-1 0&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),0 0&&(mb.FolderType.Inbox===c||mb.FolderType.Spam===c)?""+b:a>0&&mb.FolderType.Draft===c?""+a:""},this),this.canBeDeleted=c.computed(function(){var a=this.isSystemFolder();return!a&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this),this.canBeSubScribed=c.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this),this.visible.subscribe(function(){ob.timeOutAction("folder-list-folder-visibility-change",function(){xb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){rb.langChangeTick();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case mb.FolderType.Inbox:b=ob.i18n("FOLDER_LIST/INBOX_NAME");break;case mb.FolderType.SentItems:b=ob.i18n("FOLDER_LIST/SENT_NAME");break;case mb.FolderType.Draft:b=ob.i18n("FOLDER_LIST/DRAFTS_NAME");break;case mb.FolderType.Spam:b=ob.i18n("FOLDER_LIST/SPAM_NAME");break;case mb.FolderType.Trash:b=ob.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){rb.langChangeTick();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case mb.FolderType.Inbox:a="("+ob.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case mb.FolderType.SentItems:a="("+ob.i18n("FOLDER_LIST/SENT_NAME")+")";break;case mb.FolderType.Draft:a="("+ob.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case mb.FolderType.Spam:a="("+ob.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case mb.FolderType.Trash:a="("+ob.i18n("FOLDER_LIST/TRASH_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this},y.prototype.fullName="",y.prototype.fullNameRaw="",y.prototype.fullNameHash="",y.prototype.delimiter="",y.prototype.namespace="",y.prototype.deep=0,y.prototype.isNamespaceFolder=!1,y.prototype.isGmailFolder=!1,y.prototype.isUnpaddigFolder=!1,y.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"},y.prototype.initByJson=function(a){var b=!1;return 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?mb.FolderType.Inbox:mb.FolderType.User),b=!0),b},y.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")},z.prototype.email="",z.prototype.changeAccountLink=function(){return Ab.link().change(this.email)},A.prototype.formattedName=function(){var a=this.name();return""===a?this.email():a+" <"+this.email()+">"},A.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},A.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+ob.quoteName(a)+'" <'+this.email()+">"},ob.extendAsViewModel("PopupsFolderClearViewModel",B),B.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},B.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},ob.extendAsViewModel("PopupsFolderCreateViewModel",C),C.prototype.sNoParentText="",C.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(ob.trim(a))},C.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.focusTrigger(!1)},C.prototype.onShow=function(){this.clearPopup(),this.focusTrigger(!0)},ob.extendAsViewModel("PopupsFolderSystemViewModel",D),D.prototype.sChooseOnText="",D.prototype.sUnuseText="",D.prototype.onShow=function(a){var b="";switch(a=ob.isUnd(a)?mb.SetSystemFoldersNotification.None:a){case mb.SetSystemFoldersNotification.Sent:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case mb.SetSystemFoldersNotification.Draft:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case mb.SetSystemFoldersNotification.Spam:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case mb.SetSystemFoldersNotification.Trash:b=ob.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},ob.extendAsViewModel("PopupsComposeViewModel",E),E.prototype.findIdentityIdByMessage=function(a,b){var c={},d="",e=function(a){return a&&a.email&&c[a.email]?(d=c[a.email],!0):!1};switch(this.bAllowIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Ab.data().accountEmail()]=Ab.data().accountEmail(),a){case mb.ComposeType.Empty:d=Ab.data().accountEmail();break;case mb.ComposeType.Reply:case mb.ComposeType.ReplyAll:case mb.ComposeType.Forward:case mb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case mb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}return d},E.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},E.prototype.formattedFrom=function(a){var b=Ab.data().displayName(),c=Ab.data().accountEmail();return""===b?c:(ob.isUnd(a)?1:!a)?b+" ("+c+")":'"'+ob.quoteName(b)+'" <'+c+">"},E.prototype.sendMessageResponse=function(b,c){var d=!1;this.sending(!1),mb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&tb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&mb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(ob.trim(ob.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),a.alert(ob.getNotification(c&&c.ErrorCode?c.ErrorCode:mb.Notification.CantSendMessage))))},E.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),mb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Ab.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Ab.data().message(null)),this.draftFolder(c.Result.NewFolder),this.draftUid(c.Result.NewUid),this.modalVisibility()&&(this.savedTime(Math.round((new a.Date).getTime()/1e3)),this.savedOrSendingText(0 b;b++)d.push(a[b].toLine(!1));return d.join(", ")};if(c=c||null,c&&ob.isNormal(c)&&(t=ob.isArray(c)&&1===c.length?c[0]:ob.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(v,t))),this.reset(),ob.isNonEmptyArray(d)&&this.to(w(d)),""!==v&&t){switch(j=t.fullFormatDateValue(),k=t.subject(),s=t.aDraftInfo,l=b(t.body).clone(),ob.removeBlockquoteSwitcher(l),m=l.html(),v){case mb.ComposeType.Empty:break;case mb.ComposeType.Reply:this.to(w(t.replyEmails(p))),this.subject(ob.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.sReferences),u=!0;break;case mb.ComposeType.ReplyAll:o=t.replyAllEmails(p),this.to(w(o[0])),this.cc(w(o[1])),this.subject(ob.replySubjectAdd("Re",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["reply",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.references()),u=!0;break;case mb.ComposeType.Forward:this.subject(ob.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.sReferences);break;case mb.ComposeType.ForwardAsAttachment:this.subject(ob.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(t,v),this.aDraftInfo=["forward",t.uid,t.folderFullNameRaw],this.sInReplyTo=t.sMessageId,this.sReferences=ob.trim(this.sInReplyTo+" "+t.sReferences);break;case mb.ComposeType.Draft:this.to(w(t.to)),this.cc(w(t.cc)),this.bcc(w(t.bcc)),this.bFromDraft=!0,this.draftFolder(t.folderFullNameRaw),this.draftUid(t.uid),this.subject(k),this.prepearMessageAttachments(t,v),this.aDraftInfo=ob.isNonEmptyArray(s)&&3===s.length?s:null,this.sInReplyTo=t.sInReplyTo,this.sReferences=t.sReferences}if(this.oEditor){switch(v){case mb.ComposeType.Reply:case mb.ComposeType.ReplyAll:f=t.fromToLine(!1,!0),n=ob.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case mb.ComposeType.Forward:f=t.fromToLine(!1,!0),g=t.toToLine(!1,!0),i=t.ccToLine(!1,!0),m="
"+m+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+ob.encodeHtml(j)+"
"+ob.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+ob.encodeHtml(k)+"
"+m;break;case mb.ComposeType.ForwardAsAttachment:m=""}this.oEditor.setRawText(m,t.isHtml())}}else this.oEditor&&mb.ComposeType.Empty===v?this.oEditor.setRawText("
"+ob.convertPlainTextToHtml(Ab.data().signature()),mb.EditorDefaultType.Html===Ab.data().editorDefaultType()):ob.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});""===this.to()&&this.to.focusTrigger(!this.to.focusTrigger()),r=this.getAttachmentsDownloadsForUpload(),ob.isNonEmptyArray(r)&&Ab.remote().messageUploadAttachments(function(a,b){if(mb.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!e.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=e.getAttachmentById(b.Result[d]),c&&c.tempName(d))}else e.setMessageAttachmentFailedDowbloadText()},r),u&&this.oEditor&&this.oEditor.focus(),this.triggerForResize()},E.prototype.onBuild=function(){this.initEditor(),this.initUploader();var a=this,c=null;xb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Ab.data().useKeyboardShortcuts()&&(b.ctrlKey&&mb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&mb.EventKeyCode.Enter===b.keyCode&&(a.sendCommand(),c=!1)),c}),xb.on("resize",function(){a.triggerForResize()}),this.dropboxEnabled()&&(c=document.createElement("script"),c.type="text/javascript",c.src="https://www.dropbox.com/static/api/1/dropins.js",b(c).attr("id","dropboxjs").attr("data-app-key",Ab.settingsGet("DropboxApiKey")),document.body.appendChild(c))},E.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;d>c;c++)if(b[c]&&a===b[c].id)return b[c];return null},E.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=this;this.oEditor=new j(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}}),this.oEditor.initLanguage(ob.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),ob.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),ob.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}},E.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=ob.pInt(Ab.settingsGet("AttachmentLimit")),c=new g({action:Ab.link().upload(),name:"uploader",queueSize:2,multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace()});c?(c.on("onDragEnter",h.bind(function(){this.dragAndDropOver(!0)},this)).on("onDragLeave",h.bind(function(){this.dragAndDropOver(!1)},this)).on("onBodyDragEnter",h.bind(function(){this.dragAndDropVisible(!0)},this)).on("onBodyDragLeave",h.bind(function(){this.dragAndDropVisible(!1)},this)).on("onProgress",h.bind(function(b,c,d){var e=null;ob.isUnd(a[b])?(e=this.getAttachmentById(b),e&&(a[b]=e)):e=a[b],e&&e.progress(" - "+Math.floor(c/d*100)+"%")},this)).on("onSelect",h.bind(function(a,d){this.dragAndDropOver(!1);var e=this,f=ob.isUnd(d.FileName)?"":d.FileName.toString(),g=ob.isNormal(d.Size)?ob.pInt(d.Size):null,h=new w(a,f,g);return h.cancel=function(a){return function(){e.attachments.remove(function(b){return b&&b.id===a}),c&&c.cancel(a)}}(a),this.attachments.push(h),g>0&&b>0&&g>b?(h.error(ob.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;ob.isUnd(a[b])?(c=this.getAttachmentById(b),c&&(a[b]=c)):c=a[b],c&&(c.waiting(!1),c.uploading(!0))},this)).on("onComplete",h.bind(function(b,c,d){var e="",f=null,g=null,h=this.getAttachmentById(b);g=c&&d&&d.Result&&d.Result.Attachment?d.Result.Attachment:null,f=d&&d.Result&&d.Result.ErrorCode?d.Result.ErrorCode:null,null!==f?e=ob.getUploadErrorDescByCode(f):g||(e=ob.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(ob.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Ab.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),mb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(ob.getUploadErrorDescByCode(mb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},E.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=ob.isNonEmptyArray(a.attachments())?a.attachments():[],e=0,f=d.length,g=null,h=null,i=!1,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(mb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case mb.ComposeType.Reply:case mb.ComposeType.ReplyAll:i=h.isLinked;break;case mb.ComposeType.Forward:case mb.ComposeType.Draft:i=!0}i=!0,i&&(g=new w(h.download,h.fileName,h.estimatedSize,h.isInline,h.isLinked,h.cid,h.contentLocation),g.fromMessage=!0,g.cancel=j(h.download),g.waiting(!1).uploading(!0),this.attachments.push(g))}}},E.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},E.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(ob.getUploadErrorDescByCode(mb.UploadErrorCode.FileNoUploaded))},this)},E.prototype.isEmptyForm=function(a){a=ob.isUnd(a)?!0:!!a;var b=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&&b&&""===this.oEditor.getTextForRequest()},E.prototype.reset=function(){this.to(""),this.cc(""),this.bcc(""),this.replyTo(""),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.sending(!1),this.saving(!1),this.oEditor&&this.oEditor.clear()},E.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},E.prototype.triggerForResize=function(){this.resizer(!this.resizer())},ob.extendAsViewModel("PopupsContactsViewModel",F),F.prototype.addNewEmail=function(){var a=new u(mb.ContactPropertyType.EmailPersonal,"");a.focused(!0),this.viewProperties.push(a)},F.prototype.addNewPhone=function(){var a=new u(mb.ContactPropertyType.PhonePersonal,"");a.focused(!0),this.viewProperties.push(a)},F.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contacts().length,e=this.contactsCheckedOrSelected();0 =d&&(this.bDropPageAfterDelete=!0),h.delay(function(){h.each(e,function(a){b.remove(a)})},500))},F.prototype.deleteSelectedContacts=function(){0 0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,lb.Defaults.ContactsPerPage,this.search())},F.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Ab.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(ob.pInt(a.value)),d.reloadContactList())})},F.prototype.onShow=function(){tb.routeOff(),this.reloadContactList(!0)},F.prototype.onHide=function(){tb.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},ob.extendAsViewModel("PopupsAdvancedSearchViewModel",G),G.prototype.buildSearchStringValue=function(a){return-1 0&&g.messageCountUnread(0<=g.messageCountUnread()-e?g.messageCountUnread()-e:0)),i&&(i.messageCountAll(i.messageCountAll()+b.length),e>0&&i.messageCountUnread(i.messageCountUnread()+e)),0 0&&(mb.EventKeyCode.Backspace===c||mb.EventKeyCode.Esc===c)&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!ob.inFocus()&&e.message()&&(d.fullScreenMode(!1),e.usePreviewPane()||e.message(null),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Ab.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},Q.prototype.isDraftFolder=function(){return Ab.data().message()&&Ab.data().draftFolder()===Ab.data().message().folderFullNameRaw},Q.prototype.isSentFolder=function(){return Ab.data().message()&&Ab.data().sentFolder()===Ab.data().message().folderFullNameRaw},Q.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},Q.prototype.composeClick=function(){tb.showScreenPopup(E)},Q.prototype.editMessage=function(){Ab.data().message()&&tb.showScreenPopup(E,[mb.ComposeType.Draft,Ab.data().message()])},Q.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},Q.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},ob.extendAsViewModel("SettingsMenuViewModel",R),R.prototype.link=function(a){return Ab.link().settings(a)},R.prototype.backToMailBoxClick=function(){tb.setHash(Ab.link().inbox())},ob.extendAsViewModel("SettingsPaneViewModel",S),S.prototype.onShow=function(){Ab.data().message(null)},S.prototype.backToMailBoxClick=function(){tb.setHash(Ab.link().inbox())},ob.addSettingsViewModel(T,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),T.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Ab.data(),d=ob.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(mb.SaveSettingsStep.Animate),b.ajax({url:Ab.link().langLink(c),dataType:"script",cache:!0}).done(function(){ob.i18nToDoc(),a.languageTrigger(mb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(mb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(mb.SaveSettingsStep.Idle)},1e3)}),Ab.remote().saveSettings(ob.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Ab.remote().saveSettings(ob.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Ab.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Ab.remote().saveSettings(ob.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Ab.remote().saveSettings(ob.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){ob.timeOutAction("SaveDesktopNotifications",function(){Ab.remote().saveSettings(ob.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){ob.timeOutAction("SaveReplySameFolder",function(){Ab.remote().saveSettings(ob.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Ab.remote().saveSettings(ob.emptyFunction,{UseThreads:a?"1":"0"})}),c.usePreviewPane.subscribe(function(a){c.messageList([]),Ab.remote().saveSettings(ob.emptyFunction,{UsePreviewPane:a?"1":"0"})}),c.useCheckboxesInList.subscribe(function(a){Ab.remote().saveSettings(ob.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},T.prototype.onShow=function(){Ab.data().desktopNotifications.valueHasMutated()},T.prototype.selectLanguage=function(){tb.showScreenPopup(J)},ob.addSettingsViewModel(U,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),U.prototype.addNewAccount=function(){tb.showScreenPopup(H)},U.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);var b=function(b){return a===b};a&&(this.accounts.remove(b),Ab.remote().accountDelete(function(){Ab.accountsAndIdentities()},a.email))}},ob.addSettingsViewModel(V,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),V.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Ab.data(),c=ob.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=ob.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=ob.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Ab.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Ab.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Ab.remote().saveSettings(e,{Signature:a})})},50)},ob.addSettingsViewModel(W,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),W.prototype.addNewIdentity=function(){tb.showScreenPopup(I)},W.prototype.editIdentity=function(a){tb.showScreenPopup(I,[a])},W.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Ab.remote().identityDelete(function(){Ab.accountsAndIdentities()},a.id))}},W.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=Ab.data(),c=ob.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=ob.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=ob.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Ab.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Ab.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Ab.remote().saveSettings(e,{Signature:a})})},50)},ob.addSettingsViewModel(X,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),ob.addSettingsViewModel(Y,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),Y.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},Y.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),mb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},ob.addSettingsViewModel(Z,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),Z.prototype.folderEditOnEnter=function(a){var b=a?ob.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Ab.local().set(mb.ClientSideKeyName.FoldersLashHash,""),Ab.data().foldersRenaming(!0),Ab.remote().folderRename(function(a,b){Ab.data().foldersRenaming(!1),mb.StorageResultType.Success===a&&b&&b.Result||Ab.data().foldersListError(b&&b.ErrorCode?ob.getNotification(b.ErrorCode):ob.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Ab.folders(!1)},a.fullNameRaw,b),Ab.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},Z.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},Z.prototype.onShow=function(){Ab.data().foldersListError("")},Z.prototype.createFolder=function(){tb.showScreenPopup(C)},Z.prototype.systemFolder=function(){tb.showScreenPopup(D)},Z.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(Ab.local().set(mb.ClientSideKeyName.FoldersLashHash,""),Ab.data().folderList.remove(b),Ab.data().foldersDeleting(!0),Ab.remote().folderDelete(function(a,b){Ab.data().foldersDeleting(!1),mb.StorageResultType.Success===a&&b&&b.Result||Ab.data().foldersListError(b&&b.ErrorCode?ob.getNotification(b.ErrorCode):ob.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Ab.folders(!1)},a.fullNameRaw),Ab.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 1048576?(a.alert(ob.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(){this.customThemeUploaderProgress(!0)},this)).on("onComplete",h.bind(function(b,c,d){c&&d&&d.Result?this.customThemeImg(d.Result):a.alert(d&&d.ErrorCode?ob.getUploadErrorDescByCode(d.ErrorCode):ob.getUploadErrorDescByCode(mb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},_.prototype.populateDataOnStart=function(){var a=Ab.settingsGet("Languages"),b=Ab.settingsGet("Themes");ob.isArray(a)&&this.languages(a),ob.isArray(b)&&this.themes(b),this.mainLanguage(Ab.settingsGet("Language")),this.mainTheme(Ab.settingsGet("Theme")),this.allowCustomTheme(!!Ab.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Ab.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Ab.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Ab.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Ab.settingsGet("AllowThemes")),this.allowCustomLogin(!!Ab.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Ab.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Ab.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Ab.settingsGet("EditorDefaultType")),this.showImages(!!Ab.settingsGet("ShowImages")),this.interfaceAnimation(Ab.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Ab.settingsGet("MPP")),this.desktopNotifications(!!Ab.settingsGet("DesktopNotifications")),this.useThreads(!!Ab.settingsGet("UseThreads")),this.replySameFolder(!!Ab.settingsGet("ReplySameFolder")),this.usePreviewPane(!!Ab.settingsGet("UsePreviewPane")),this.useCheckboxesInList(!!Ab.settingsGet("UseCheckboxesInList")),this.facebookEnable(!!Ab.settingsGet("AllowFacebookSocial")),this.facebookAppID(Ab.settingsGet("FacebookAppID")),this.facebookAppSecret(Ab.settingsGet("FacebookAppSecret")),this.twitterEnable(!!Ab.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(Ab.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(Ab.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!Ab.settingsGet("AllowGoogleSocial")),this.googleClientID(Ab.settingsGet("GoogleClientID")),this.googleClientSecret(Ab.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!Ab.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(Ab.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!Ab.settingsGet("ContactsIsAllowed"))},h.extend(ab.prototype,_.prototype),ab.prototype.purgeMessageBodyCache=function(){var a=0,c=null,d=rb.iMessageBodyCacheCount-lb.Values.MessageBodyCacheLimit;d>0&&(c=this.messagesBodiesDom(),c&&(c.find(".rl-cache-class").each(function(){var c=b(this);d>c.data("rl-cache-count")&&(c.addClass("rl-cache-purge"),a++)}),a>0&&h.delay(function(){c.find(".rl-cache-purge").remove()},300)))},ab.prototype.populateDataOnStart=function(){_.prototype.populateDataOnStart.call(this),this.accountEmail(Ab.settingsGet("Email")),this.accountIncLogin(Ab.settingsGet("IncLogin")),this.accountOutLogin(Ab.settingsGet("OutLogin")),this.projectHash(Ab.settingsGet("ProjectHash")),this.displayName(Ab.settingsGet("DisplayName")),this.replyTo(Ab.settingsGet("ReplyTo")),this.signature(Ab.settingsGet("Signature")),this.lastFoldersHash=Ab.local().get(mb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Ab.settingsGet("RemoteSuggestions"),this.devEmail=Ab.settingsGet("DevEmail"),this.devLogin=Ab.settingsGet("DevLogin"),this.devPassword=Ab.settingsGet("DevPassword")},ab.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&ob.isNormal(c)&&""!==c){if(ob.isArray(d)&&0 3)i(Ab.link().notificationMailIcon(),Ab.data().accountEmail(),ob.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Ab.link().notificationMailIcon(),x.emailsToLine(x.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Ab.cache().setFolderUidNext(b,c)}},ab.prototype.folderResponseParseRec=function(a,b,c){var d=0,e=0,f=null,g=null,h="",i=[],j=[];for(c=!!c,d=0,e=b.length;e>d;d++)f=b[d],f&&(h=f.FullNameRaw,g=Ab.cache().getFolderFromCacheList(h),g||(g=y.newInstanceFromJson(f),g&&(Ab.cache().setFolderToCacheList(h,g),Ab.cache().setFolderFullNameRaw(g.fullNameHash,h),g.isGmailFolder=lb.Values.GmailFolderName.toLowerCase()===h.toLowerCase(),""!==a&&a===g.fullNameRaw+g.delimiter&&(g.isNamespaceFolder=!0),(g.isNamespaceFolder||g.isGmailFolder)&&(g.isUnpaddigFolder=!0))),g&&(g.collapsed(!ob.isFolderExpanded(g.fullNameHash)),!c&&f.Extended&&(f.Extended.Hash&&Ab.cache().setFolderHash(g.fullNameRaw,f.Extended.Hash),ob.isNormal(f.Extended.MessageCount)&&g.messageCountAll(f.Extended.MessageCount),ob.isNormal(f.Extended.MessageUnseenCount)&&g.messageCountUnread(f.Extended.MessageUnseenCount)),i=f.SubFolders,i&&"Collection/FolderCollection"===i["@Object"]&&i["@Collection"]&&ob.isArray(i["@Collection"])&&g.subFolders(this.folderResponseParseRec(a,i["@Collection"],c)),j.push(g)));return j},ab.prototype.setFolders=function(a,b){var c=[],d=!1,e=Ab.data(),f=e.folderList(),g=0===f.length,h=function(a){return""===a||lb.Values.UnuseOptionValue===a||null!==Ab.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&ob.isArray(a.Result["@Collection"])&&(ob.isUnd(a.Result.Namespace)||(e.namespace=a.Result.Namespace),this.threading(!!Ab.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),c=this.folderResponseParseRec(e.namespace,a.Result["@Collection"],!!b),e.folderList(c),a.Result.SystemFolders&&""==""+Ab.settingsGet("SentFolder")+Ab.settingsGet("DraftFolder")+Ab.settingsGet("SpamFolder")+Ab.settingsGet("TrashFolder")&&(Ab.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Ab.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Ab.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Ab.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),d=!0),e.sentFolder(h(Ab.settingsGet("SentFolder"))),e.draftFolder(h(Ab.settingsGet("DraftFolder"))),e.spamFolder(h(Ab.settingsGet("SpamFolder"))),e.trashFolder(h(Ab.settingsGet("TrashFolder"))),d&&Ab.remote().saveSystemFolders(ob.emptyFunction,{SentFolder:e.sentFolder(),DraftFolder:e.draftFolder(),SpamFolder:e.spamFolder(),TrashFolder:e.trashFolder()}),b||Ab.local().set(mb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash),g&&b&&Ab.folders(!1))},ab.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},ab.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),Ab.cache().addRequestedMessage(k.folderFullNameRaw,k.uid),c||k.initFlagsByJson(a.Result),j=j&&j[0]?j:null,j&&(i="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),h=j.find("#"+i),h&&h[0]?(h.data("rl-cache-count",++rb.iMessageBodyCacheCount),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h):(e=!!a.Result.HasExternals,f=!!a.Result.HasInternals,g=b('').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++rb.iMessageBodyCacheCount),ob.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):ob.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,g.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,a.Result.Rtl&&(g.data("rl-is-rtl",!0),g.addClass("rtl-text-part")),j.append(g),g.data("rl-is-html",d),g.data("rl-has-images",e),k.isRtl(!!g.data("rl-is-rtl")),k.isHtml(!!g.data("rl-is-html")),k.hasImages(!!g.data("rl-has-images")),k.body=g,f&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),g&&ob.initBlockquoteSwitcher(g)),Ab.cache().initMessageFlagsFromCache(k),k.unseen()&&Ab.setMessageSeen(k),ob.windowResize())},ab.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&ob.isArray(a.Result["@Collection"])){var c=Ab.data(),d=Ab.cache(),e=null,f=0,g=0,h=0,i=0,j=[],k=c.staticMessageList,l=null,m=null,n=null,o=0,p=!1;for(h=ob.pInt(a.Result.MessageResultCount),i=ob.pInt(a.Result.Offset),ob.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),n=Ab.cache().getFolderFromCacheList(ob.isNormal(a.Result.Folder)?a.Result.Folder:""),n&&!b&&(Ab.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),ob.isNormal(a.Result.MessageCount)&&n.messageCountAll(a.Result.MessageCount),ob.isNormal(a.Result.MessageUnseenCount)&&(ob.pInt(n.messageCountUnread())!==ob.pInt(a.Result.MessageUnseenCount)&&(p=!0),n.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(n.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),p&&n&&Ab.cache().clearMessageFlagsFromCacheByFolder(n.fullNameRaw),f=0,g=a.Result["@Collection"].length;g>f;f++)l=a.Result["@Collection"][f],l&&"Object/Message"===l["@Object"]&&(m=k[f],m&&m.initByJson(l)||(m=x.newInstanceFromJson(l)),m&&(d.hasNewMessageAndRemoveFromCache(m.folderFullNameRaw,m.uid)&&5>=o&&(o++,m.newForAnimation(!0)),m.deleted(!1),b?Ab.cache().initMessageFlagsFromCache(m):Ab.cache().storeMessageFlagsToCache(m),m.lastInCollapsedThread(e&&-1 (new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0 0?(this.defaultRequest(a,"Message",{},null,"Message/"+qb.urlsafe_encode([b,c,Ab.data().projectHash(),Ab.data().threading()&&Ab.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},cb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},cb.prototype.folderInformation=function(a,b,c){var d=!0,e=Ab.cache(),f=[];ob.isArray(c)&&0 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 l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(mb.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0 n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}}); +/*! jquery.finger - v0.1.0-alpha - 2013-07-01 +* https://github.com/ngryman/jquery.finger +* Copyright (c) 2013 Nicolas Gryman; Licensed MIT */ +(function(t){function e(t,e){return(r?e.originalEvent.touches[0]:e)["page"+t.toUpperCase()]}function a(a){var r={},v=a.timeStamp||+new Date,m=t.data(this,u);i!=v&&(i=v,r.move={x:e("x",a),y:e("y",a)},r.start=t.extend({time:v,target:a.target},r.move),r.timeout=setTimeout(t.proxy(function(){t.event.trigger(t.Event("press",r.move),null,a.target),t.event.remove(this,d+"."+u,o),t.event.remove(this,s+"."+u,n)},this),t.Finger.pressDuration),t.event.add(this,d+"."+u,o,r),t.event.add(this,s+"."+u,n,r),(l.preventDefault||m.options.preventDefault)&&a.preventDefault())}function o(a){var o=a.data,i=o.start,r=o.move;return r.x=e("x",a),r.y=e("y",a),r.dx=r.x-i.x,r.dy=r.y-i.y,r.adx=Math.abs(r.dx),r.ady=Math.abs(r.dy),o.motion=r.adx>l.motionThreshold||r.ady>l.motionThreshold,o.motion?(clearTimeout(o.timeout),r.orientation||(r.adx>o.move.ady?(r.orientation="horizontal",r.direction=r.dx>0?1:-1):(r.orientation="vertical",r.direction=r.dy>0?1:-1)),a.target!==i.target?(a.target=i.target,n.call(this,t.Event(s+"."+u,a)),void 0):(t.event.trigger(t.Event("drag",r),null,a.target),void 0)):void 0}function n(e){var a,i=e.data,r=e.timeStamp||+new Date,v=t.data(this,u),m=r-i.start.time;clearTimeout(i.timeout),e.target===i.start.target&&(i.motion?(a=l.flickDuration>m?"flick":"drag",i.move.end=!0):(a=l.pressDuration>m&&!v.prev||v.prev&&r-v.prev>l.doubleTapInterval?"tap":"doubletap",v.prev=r),t.event.trigger(t.Event(a,i.move),null,e.target),t.event.remove(this,d+"."+u,o),t.event.remove(this,s+"."+u,n))}var i,r="ontouchstart"in window,v=r?"touchstart":"mousedown",s=r?"touchend touchcancel":"mouseup mouseleave",d=r?"touchmove":"mousemove",u="finger",l=t.Finger={pressDuration:300,doubleTapInterval:300,flickDuration:150,motionThreshold:5},m={add:function(e){t.data(this,u)||(t.event.add(this,v+"."+u,a),t.data(this,u,{options:e.data||{}}))},teardown:function(){t.data(this,u)&&(t.event.remove(this,v+"."+u,a),t.data(this,u,null))}};t.event.special.tap=m,t.event.special.press=m,t.event.special.doubletap=m,t.event.special.drag=m,t.event.special.flick=m})(jQuery); + /*! jquery.mousewheel v3.1.4 (c) 2013 Brandon Aaron (http://brandon.aaron.sh) | MIT */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var e,f=b||window.event,g=[].slice.call(arguments,1),h=0,i=0,j=0,k=0,l=0;return b=a.event.fix(f),b.type="mousewheel",f.wheelDelta&&(h=f.wheelDelta),f.detail&&(h=-1*f.detail),j=h,void 0!==f.axis&&f.axis===f.HORIZONTAL_AXIS&&(j=0,i=-1*h),f.deltaY&&(j=-1*f.deltaY,h=j),f.deltaX&&(i=f.deltaX,h=-1*i),void 0!==f.wheelDeltaY&&(j=f.wheelDeltaY),void 0!==f.wheelDeltaX&&(i=-1*f.wheelDeltaX),k=Math.abs(h),(!c||c>k)&&(c=k),l=Math.max(Math.abs(j),Math.abs(i)),(!d||d>l)&&(d=l),e=h>0?"floor":"ceil",h=Math[e](h/c),i=Math[e](i/d),j=Math[e](j/d),g.unshift(b,h,i,j),(a.event.dispatch||a.event.handle).apply(this,g)}var c,d,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],f="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(a.event.fixHooks)for(var g=e.length;g;)a.event.fixHooks[e[--g]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=f.length;a;)this.addEventListener(f[--a],b,!1);else this.onmousewheel=b},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],b,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); @@ -40,7 +45,7 @@ u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute( !function(a){var b=1e3,c=new Array;a.wakeUp=function(a,d,e){if(e&&"number"==typeof e||(e=b),"function"!=typeof a)return null;var f=(new Date).getTime(),g=setInterval(function(){var b=(new Date).getTime();if(b>f+e+1e3){var c=b-f;f=b,d?a(c,d):a(c)}else f=b},e);return c.push(g),g},a.ignoreBell=function(b){b&&(c.splice(a.inArray(b,c),1),clearInterval(b))},a.dreamOn=function(){a.each(c,function(a,b){clearInterval(b)}),c=new Array}}(jQuery,document); /*! Inputosaurus Text v0.1.6 (c) 2013 Dan Kielp ; modified by RainLoop Team | MIT */ -!function(a){var b={version:"0.1.6",eventprefix:"inputosaurus",options:{inputDelimiters:[",",";"],outputDelimiter:",",allowDuplicates:!1,parseOnBlur:!1,wrapperElement:null,width:null,autoCompleteSource:"",activateFinalResult:!1,parseHook:null,placeholder:null},_create:function(){var b=this,c={},d=b.options,e=d.placeholder||this.element.attr("placeholder")||null;this._chosenValues=[],c.ul=a(' '),c.fakeSpan=a(''),c.input=a(''),c.inputCont=a(''),c.origInputCont=a(''),c.lastEdit="",e&&(d.placeholder=e,c.input.attr("placeholder",d.placeholder),d.width&&c.input.css("min-width",d.width-50)),d.wrapperElement&&d.wrapperElement.append(c.ul),this.element.replaceWith(d.wrapperElement||c.ul),c.origInputCont.append(this.element).hide(),c.inputCont.append(c.input),c.ul.append(c.inputCont),c.ul.append(c.origInputCont),c.ul.append(c.fakeSpan),d.width&&c.ul.css("width",d.width),this.elements=c,b._attachEvents(),a.trim(this.element.val())&&(c.input.val(this.element.val()),this.parseInput()),this._instAutocomplete()},_instAutocomplete:function(){if(this.options.autoCompleteSource){var b=this;this.elements.input.autocomplete({position:{of:this.elements.ul},source:this.options.autoCompleteSource,minLength:1,select:function(a,c){a.preventDefault(),b.elements.input.val(c.item.value),b.parseInput()},open:function(){var c,d=a(this).data("ui-autocomplete").menu;d.element.width(b.elements.ul.outerWidth()),b.options.activateFinalResult&&(c=d.element.find("li"),1===c.size()&&d[d.activate?"activate":"focus"](a.Event("click"),c))},focus:function(){return!1}})}},_autoCompleteMenuPosition:function(){var a;this.options.autoCompleteSource&&(a=this.elements.input.data("ui-autocomplete"),a&&a.menu.element.position({of:this.elements.ul,my:"left top",at:"left bottom",collision:"none"}))},parseInput:function(b){var c,d=b&&b.data.widget||this,e=!1,f=[];c=d.elements.input.val(),c&&(e=d._containsDelimiter(c)),e!==!1?f=c.split(e):b&&(b.which!==a.ui.keyCode.ENTER||a(".ui-menu-item .ui-state-focus").size()||a("#ui-active-menuitem").size())?"blur"!==b.type||a("#ui-active-menuitem").size()||f.push(c):(f.push(c),b&&b.preventDefault()),a.isFunction(d.options.parseHook)&&(f=d.options.parseHook(f)),f.length&&(d._setChosen(f),d.elements.input.val(""),d._resizeInput()),d._resetPlaceholder()},_inputFocus:function(a){var b=a.data.widget||this;b.elements.input.value||b.options.autoCompleteSource.length&&b.elements.input.autocomplete("search","")},_inputKeypress:function(b){var c=b.data.widget||this;switch("keyup"===b.type&&c._trigger("keyup",b,c),b.which){case a.ui.keyCode.BACKSPACE:"keydown"===b.type&&c._inputBackspace(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._inputBackspace(b);break;default:c.parseInput(b),c._resizeInput(b)}c.options.autoCompleteSource&&setTimeout(function(){c._autoCompleteMenuPosition.call(c)},200)},_resizeInput:function(a){var b=a&&a.data.widget||this;b.elements.fakeSpan.text(b.elements.input.val());var c=25+b.elements.fakeSpan.width();c=c>50?c:50,c=500>c?c:500,b.elements.input.width(c)},_resetPlaceholder:function(){var a=this.options.placeholder,b=this.elements.input,c=this.options.width||"inherit";a&&0===this.element.val().length?b.attr("placeholder",a).css("min-width",c-50):b.attr("placeholder","").css("min-width","inherit")},_inputBackspace:function(b){var c=b&&b.data.widget||this,d=c.elements.ul.find("li:not(.inputosaurus-required):last");b.stopPropagation(),(!a(b.currentTarget).val()||"selectionStart"in b.currentTarget&&0===b.currentTarget.selectionStart&&0===b.currentTarget.selectionEnd)&&d.size()&&(b.preventDefault(),d.find("a").focus())},_editTag:function(b){var c=b&&b.data.widget||this,d="",e=a(b.currentTarget).closest("li"),f=e.data("inputosaurus");if(!f)return!0;b.preventDefault();var g=null,h=!1;a.each(c._chosenValues,function(a,b){b.key===f?(d=b.value,h=!0):h&&!g&&(g=b)}),g&&(c.elements.lastEdit=g.value),e.after(c.elements.inputCont),c.elements.input.val(d),window.setTimeout(function(){c.elements.input.select()},100),c._removeTag(b),c._resizeInput(b)},_tagKeypress:function(b){var c=b.data.widget;switch(b.which){case a.ui.keyCode.DELETE:case a.ui.keyCode.BACKSPACE:b&&b.preventDefault(),b&&b.stopPropagation(),a(b.currentTarget).trigger("click");break;case 69:case a.ui.keyCode.ENTER:c._editTag(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._prevTag(b);break;case a.ui.keyCode.RIGHT:"keydown"===b.type&&c._nextTag(b);break;case a.ui.keyCode.DOWN:"keydown"===b.type&&c._focus(b)}},_prevTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.prev();e.is("li")?e.find("a").focus():c._focus()},_nextTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.next();e.is("li:not(.inputosaurus-input)")?e.find("a").focus():c._focus()},_containsDelimiter:function(b){var c=!1;return a.each(this.options.inputDelimiters,function(a,d){-1!==b.indexOf(d)&&(c=d)}),c},_setChosen:function(b){var c=this;return a.isArray(b)?(a.each(b,function(b,d){var e="",f=!1,g=-1,h={key:"",obj:null,value:""};e=a.trim(d[0]),a.each(c._chosenValues,function(a,b){b.value===c.elements.lastEdit&&(g=a),b.value===e&&(f=!0)}),""===e||f&&!c.options.allowDuplicates||(h.key="mi_"+Math.random().toString(16).slice(2,10),h.value=e,h.obj=d[1],g>-1?c._chosenValues.splice(g,0,h):c._chosenValues.push(h),c.elements.lastEdit="",c._renderTags())}),1===b.length&&""===b[0]&&""!==c.elements.lastEdit&&(c.elements.lastEdit="",c._renderTags()),c._setValue(c._buildValue()),void 0):!1},_buildValue:function(){var b=this,c="";return a.each(this._chosenValues,function(a,d){c+=c.length?b.options.outputDelimiter+d.value:d.value}),c},_setValue:function(a){var b=this.element.val();b!==a&&(this.element.val(a),this._trigger("change"))},_createTag:function(b,c,d){return void 0!==b&&d?a('
✖'+d.toLine(!0,!1,!0)+" "):void 0},_renderTags:function(){var b=this;this.elements.ul.find("li:not(.inputosaurus-required)").remove(),a.each(this._chosenValues,function(a,c){var d=b._createTag(c.value,c.key,c.obj);b.elements.ul.find("li.inputosaurus-input").before(d)})},_removeTag:function(b){var c=a(b.currentTarget).closest("li").data("inputosaurus"),d=!1,e=b&&b.data.widget||this;a.each(e._chosenValues,function(a,b){c===b.key&&(d=a)}),d!==!1&&e._chosenValues.splice(d,1),e._setValue(e._buildValue()),a(b.currentTarget).closest("li").remove(),window.setTimeout(function(){e.elements.input.focus()},100)},focus:function(){this.elements.input.focus()},_focus:function(b){var c=b&&b.data.widget||this,d=b&&b.target?a(b.target).closest("li"):null;d&&d.is("li")&&d.find("a").focus(),b&&a(b.target).closest("li").data("inputosaurus")||c.elements.input.focus()},_tagFocus:function(b){a(b.currentTarget).parent()["focusout"===b.type?"removeClass":"addClass"]("inputosaurus-selected")},refresh:function(){var b=this.options.outputDelimiter,c=this.element.val(),d=[];d.push(c),b&&(d=c.split(b)),d.length&&(this._chosenValues=[],a.isFunction(this.options.parseHook)&&(d=this.options.parseHook(d)),this._setChosen(d),this._renderTags(),this.elements.input.val(""),this._resizeInput())},_attachEvents:function(){var a=this;this.elements.input.on("keyup.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("keydown.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("change.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("focus.inputosaurus",{widget:a},this._inputFocus),this.options.parseOnBlur&&this.elements.input.on("blur.inputosaurus",{widget:a},this.parseInput),this.elements.ul.on("click.inputosaurus",{widget:a},this._focus),this.elements.ul.on("click.inputosaurus","a",{widget:a},this._removeTag),this.elements.ul.on("dblclick.inputosaurus","li",{widget:a},this._editTag),this.elements.ul.on("focus.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("blur.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("keydown.inputosaurus","a",{widget:a},this._tagKeypress)},_destroy:function(){this.elements.input.unbind(".inputosaurus"),this.elements.ul.replaceWith(this.element)}};a.widget("ui.inputosaurus",b)}(jQuery); +!function(a){var b={version:"0.1.6",eventprefix:"inputosaurus",options:{inputDelimiters:[",",";"],outputDelimiter:",",allowDuplicates:!1,parseOnBlur:!1,wrapperElement:null,width:null,autoCompleteSource:"",activateFinalResult:!1,parseHook:null,placeholder:null},_create:function(){var b=this,c={},d=b.options,e=d.placeholder||this.element.attr("placeholder")||null;this._chosenValues=[],c.ul=a(''),c.fakeSpan=a(''),c.input=a(''),c.inputCont=a(''),c.origInputCont=a(''),c.lastEdit="",e&&(d.placeholder=e,c.input.attr("placeholder",d.placeholder),d.width&&c.input.css("min-width",d.width-50)),d.wrapperElement&&d.wrapperElement.append(c.ul),this.element.replaceWith(d.wrapperElement||c.ul),c.origInputCont.append(this.element).hide(),c.inputCont.append(c.input),c.ul.append(c.inputCont),c.ul.append(c.origInputCont),c.ul.append(c.fakeSpan),d.width&&c.ul.css("width",d.width),this.elements=c,b._attachEvents(),a.trim(this.element.val())&&(c.input.val(this.element.val()),this.parseInput()),this._instAutocomplete()},_instAutocomplete:function(){if(this.options.autoCompleteSource){var b=this;this.elements.input.autocomplete({position:{of:this.elements.ul},source:this.options.autoCompleteSource,minLength:1,select:function(a,c){a.preventDefault(),b.elements.input.val(c.item.value),b.parseInput()},open:function(){var c,d=a(this).data("ui-autocomplete").menu;d.element.width(b.elements.ul.outerWidth()),b.options.activateFinalResult&&(c=d.element.find("li"),1===c.size()&&d[d.activate?"activate":"focus"](a.Event("click"),c))},focus:function(){return!1}})}},_autoCompleteMenuPosition:function(){var a;this.options.autoCompleteSource&&(a=this.elements.input.data("ui-autocomplete"),a&&a.menu.element.position({of:this.elements.ul,my:"left top",at:"left bottom",collision:"none"}))},parseInput:function(b){var c,d=b&&b.data.widget||this,e=!1,f=[];c=d.elements.input.val(),c&&(e=d._containsDelimiter(c)),e!==!1?f=c.split(e):b&&(b.which!==a.ui.keyCode.ENTER||a(".ui-menu-item .ui-state-focus").size()||a("#ui-active-menuitem").size())?"blur"!==b.type||a("#ui-active-menuitem").size()||f.push(c):(f.push(c),b&&b.preventDefault()),a.isFunction(d.options.parseHook)&&(f=d.options.parseHook(f)),f.length&&(d._setChosen(f),d.elements.input.val(""),d._resizeInput()),d._resetPlaceholder()},_inputFocus:function(a){var b=a.data.widget||this;b.elements.input.value||b.options.autoCompleteSource.length&&b.elements.input.autocomplete("search","")},_inputKeypress:function(b){var c=b.data.widget||this;switch("keyup"===b.type&&c._trigger("keyup",b,c),b.which){case a.ui.keyCode.BACKSPACE:"keydown"===b.type&&c._inputBackspace(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._inputBackspace(b);break;default:c.parseInput(b),c._resizeInput(b)}c.options.autoCompleteSource&&setTimeout(function(){c._autoCompleteMenuPosition.call(c)},200)},_resizeInput:function(a){var b=a&&a.data.widget||this;b.elements.fakeSpan.text(b.elements.input.val());var c=25+b.elements.fakeSpan.width();c=c>50?c:50,c=500>c?c:500,b.elements.input.width(c)},_resetPlaceholder:function(){var a=this.options.placeholder,b=this.elements.input,c=this.options.width||"inherit";a&&0===this.element.val().length?b.attr("placeholder",a).css("min-width",c-50):b.attr("placeholder","").css("min-width","inherit")},_inputBackspace:function(b){var c=b&&b.data.widget||this,d=c.elements.ul.find("li:not(.inputosaurus-required):last");b.stopPropagation(),(!a(b.currentTarget).val()||"selectionStart"in b.currentTarget&&0===b.currentTarget.selectionStart&&0===b.currentTarget.selectionEnd)&&d.size()&&(b.preventDefault(),d.find("a").focus())},_editTag:function(b){var c=b&&b.data.widget||this,d="",e=a(b.currentTarget).closest("li"),f=e.data("inputosaurus");if(!f)return!0;b.preventDefault();var g=null,h=!1;a.each(c._chosenValues,function(a,b){b.key===f?(d=b.value,h=!0):h&&!g&&(g=b)}),g&&(c.elements.lastEdit=g.value),e.after(c.elements.inputCont),c.elements.input.val(d),window.setTimeout(function(){c.elements.input.select()},100),c._removeTag(b),c._resizeInput(b)},_tagKeypress:function(b){var c=b.data.widget;switch(b.which){case a.ui.keyCode.DELETE:case a.ui.keyCode.BACKSPACE:b&&b.preventDefault(),b&&b.stopPropagation(),a(b.currentTarget).trigger("click");break;case 69:case a.ui.keyCode.ENTER:c._editTag(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._prevTag(b);break;case a.ui.keyCode.RIGHT:"keydown"===b.type&&c._nextTag(b);break;case a.ui.keyCode.DOWN:"keydown"===b.type&&c._focus(b)}},_prevTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.prev();e.is("li")?e.find("a").focus():c._focus()},_nextTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.next();e.is("li:not(.inputosaurus-input)")?e.find("a").focus():c._focus()},_containsDelimiter:function(b){var c=!1;return a.each(this.options.inputDelimiters,function(a,d){-1!==b.indexOf(d)&&(c=d)}),c},_setChosen:function(b){var c=this;return a.isArray(b)?(a.each(b,function(b,d){var e="",f=!1,g=-1,h={key:"",obj:null,value:""};e=a.trim(d[0]),a.each(c._chosenValues,function(a,b){b.value===c.elements.lastEdit&&(g=a),b.value===e&&(f=!0)}),""===e||f&&!c.options.allowDuplicates||(h.key="mi_"+Math.random().toString(16).slice(2,10),h.value=e,h.obj=d[1],g>-1?c._chosenValues.splice(g,0,h):c._chosenValues.push(h),c.elements.lastEdit="",c._renderTags())}),1===b.length&&""===b[0]&&""!==c.elements.lastEdit&&(c.elements.lastEdit="",c._renderTags()),c._setValue(c._buildValue()),void 0):!1},_buildValue:function(){var b=this,c="";return a.each(this._chosenValues,function(a,d){c+=c.length?b.options.outputDelimiter+d.value:d.value}),c},_setValue:function(a){var b=this.element.val();b!==a&&(this.element.val(a),this._trigger("change"))},_createTag:function(b,c,d){return void 0!==b&&d?a('
✖'+d.toLine(!0,!1,!0)+" "):void 0},_renderTags:function(){var b=this;this.elements.ul.find("li:not(.inputosaurus-required)").remove(),a.each(this._chosenValues,function(a,c){var d=b._createTag(c.value,c.key,c.obj);b.elements.ul.find("li.inputosaurus-input").before(d)})},_removeTag:function(b){var c=a(b.currentTarget).closest("li").data("inputosaurus"),d=!1,e=b&&b.data.widget||this;a.each(e._chosenValues,function(a,b){c===b.key&&(d=a)}),d!==!1&&e._chosenValues.splice(d,1),e._setValue(e._buildValue()),a(b.currentTarget).closest("li").remove(),window.setTimeout(function(){e.elements.input.focus()},100)},focus:function(){this.elements.input.focus()},_focus:function(b){var c=b&&b.data.widget||this,d=b&&b.target?a(b.target).closest("li"):null;d&&d.is("li")&&d.find("a").focus(),b&&a(b.target).closest("li").data("inputosaurus")||c.elements.input.focus()},_tagFocus:function(b){a(b.currentTarget).parent()["focusout"===b.type?"removeClass":"addClass"]("inputosaurus-selected")},refresh:function(){var b=this.options.outputDelimiter,c=this.element.val(),d=[];d.push(c),b&&(d=c.split(b)),d.length&&(this._chosenValues=[],a.isFunction(this.options.parseHook)&&(d=this.options.parseHook(d)),this._setChosen(d),this._renderTags(),this.elements.input.val(""),this._resizeInput())},_attachEvents:function(){var a=this;this.elements.input.on("keyup.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("keydown.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("change.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("focus.inputosaurus",{widget:a},this._inputFocus),this.options.parseOnBlur&&this.elements.input.on("blur.inputosaurus",{widget:a},this.parseInput),this.elements.ul.on("click.inputosaurus",{widget:a},this._focus),this.elements.ul.on("click.inputosaurus","a",{widget:a},this._removeTag),this.elements.ul.on("dblclick.inputosaurus","li",{widget:a},this._editTag),this.elements.ul.on("doubletap.inputosaurus","li",{widget:a},this._editTag),this.elements.ul.on("focus.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("blur.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("keydown.inputosaurus","a",{widget:a},this._tagKeypress)},_destroy:function(){this.elements.input.unbind(".inputosaurus"),this.elements.ul.replaceWith(this.element)}};a.widget("ui.inputosaurus",b)}(jQuery); //! moment.js //! version : 2.3.1 diff --git a/vendors/inputosaurus/inputosaurus.js b/vendors/inputosaurus/inputosaurus.js index 3d9b29d08..819850753 100644 --- a/vendors/inputosaurus/inputosaurus.js +++ b/vendors/inputosaurus/inputosaurus.js @@ -13,6 +13,7 @@ * @author Dan Kielp* @created October 3,2012 * + * @modified by RainLoop Team */ @@ -72,7 +73,7 @@ // Create the elements els.ul = $(' '); els.fakeSpan = $(''); - els.input = $(''); + els.input = $(''); els.inputCont = $(''); els.origInputCont = $(''); els.lastEdit = ''; @@ -562,6 +563,7 @@ this.elements.ul.on('click.inputosaurus', {widget : widget}, this._focus); this.elements.ul.on('click.inputosaurus', 'a', {widget : widget}, this._removeTag); this.elements.ul.on('dblclick.inputosaurus', 'li', {widget : widget}, this._editTag); + this.elements.ul.on('doubletap.inputosaurus', 'li', {widget : widget}, this._editTag); this.elements.ul.on('focus.inputosaurus', 'a', {widget : widget}, this._tagFocus); this.elements.ul.on('blur.inputosaurus', 'a', {widget : widget}, this._tagFocus); this.elements.ul.on('keydown.inputosaurus', 'a', {widget : widget}, this._tagKeypress); diff --git a/vendors/inputosaurus/inputosaurus.min.js b/vendors/inputosaurus/inputosaurus.min.js index 6925b3a26..575e78f71 100644 --- a/vendors/inputosaurus/inputosaurus.min.js +++ b/vendors/inputosaurus/inputosaurus.min.js @@ -1,2 +1,2 @@ /*! Inputosaurus Text v0.1.6 (c) 2013 Dan Kielp
; modified by RainLoop Team | MIT */ -!function(a){var b={version:"0.1.6",eventprefix:"inputosaurus",options:{inputDelimiters:[",",";"],outputDelimiter:",",allowDuplicates:!1,parseOnBlur:!1,wrapperElement:null,width:null,autoCompleteSource:"",activateFinalResult:!1,parseHook:null,placeholder:null},_create:function(){var b=this,c={},d=b.options,e=d.placeholder||this.element.attr("placeholder")||null;this._chosenValues=[],c.ul=a(' '),c.fakeSpan=a(''),c.input=a(''),c.inputCont=a(''),c.origInputCont=a(''),c.lastEdit="",e&&(d.placeholder=e,c.input.attr("placeholder",d.placeholder),d.width&&c.input.css("min-width",d.width-50)),d.wrapperElement&&d.wrapperElement.append(c.ul),this.element.replaceWith(d.wrapperElement||c.ul),c.origInputCont.append(this.element).hide(),c.inputCont.append(c.input),c.ul.append(c.inputCont),c.ul.append(c.origInputCont),c.ul.append(c.fakeSpan),d.width&&c.ul.css("width",d.width),this.elements=c,b._attachEvents(),a.trim(this.element.val())&&(c.input.val(this.element.val()),this.parseInput()),this._instAutocomplete()},_instAutocomplete:function(){if(this.options.autoCompleteSource){var b=this;this.elements.input.autocomplete({position:{of:this.elements.ul},source:this.options.autoCompleteSource,minLength:1,select:function(a,c){a.preventDefault(),b.elements.input.val(c.item.value),b.parseInput()},open:function(){var c,d=a(this).data("ui-autocomplete").menu;d.element.width(b.elements.ul.outerWidth()),b.options.activateFinalResult&&(c=d.element.find("li"),1===c.size()&&d[d.activate?"activate":"focus"](a.Event("click"),c))},focus:function(){return!1}})}},_autoCompleteMenuPosition:function(){var a;this.options.autoCompleteSource&&(a=this.elements.input.data("ui-autocomplete"),a&&a.menu.element.position({of:this.elements.ul,my:"left top",at:"left bottom",collision:"none"}))},parseInput:function(b){var c,d=b&&b.data.widget||this,e=!1,f=[];c=d.elements.input.val(),c&&(e=d._containsDelimiter(c)),e!==!1?f=c.split(e):b&&(b.which!==a.ui.keyCode.ENTER||a(".ui-menu-item .ui-state-focus").size()||a("#ui-active-menuitem").size())?"blur"!==b.type||a("#ui-active-menuitem").size()||f.push(c):(f.push(c),b&&b.preventDefault()),a.isFunction(d.options.parseHook)&&(f=d.options.parseHook(f)),f.length&&(d._setChosen(f),d.elements.input.val(""),d._resizeInput()),d._resetPlaceholder()},_inputFocus:function(a){var b=a.data.widget||this;b.elements.input.value||b.options.autoCompleteSource.length&&b.elements.input.autocomplete("search","")},_inputKeypress:function(b){var c=b.data.widget||this;switch("keyup"===b.type&&c._trigger("keyup",b,c),b.which){case a.ui.keyCode.BACKSPACE:"keydown"===b.type&&c._inputBackspace(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._inputBackspace(b);break;default:c.parseInput(b),c._resizeInput(b)}c.options.autoCompleteSource&&setTimeout(function(){c._autoCompleteMenuPosition.call(c)},200)},_resizeInput:function(a){var b=a&&a.data.widget||this;b.elements.fakeSpan.text(b.elements.input.val());var c=25+b.elements.fakeSpan.width();c=c>50?c:50,c=500>c?c:500,b.elements.input.width(c)},_resetPlaceholder:function(){var a=this.options.placeholder,b=this.elements.input,c=this.options.width||"inherit";a&&0===this.element.val().length?b.attr("placeholder",a).css("min-width",c-50):b.attr("placeholder","").css("min-width","inherit")},_inputBackspace:function(b){var c=b&&b.data.widget||this,d=c.elements.ul.find("li:not(.inputosaurus-required):last");b.stopPropagation(),(!a(b.currentTarget).val()||"selectionStart"in b.currentTarget&&0===b.currentTarget.selectionStart&&0===b.currentTarget.selectionEnd)&&d.size()&&(b.preventDefault(),d.find("a").focus())},_editTag:function(b){var c=b&&b.data.widget||this,d="",e=a(b.currentTarget).closest("li"),f=e.data("inputosaurus");if(!f)return!0;b.preventDefault();var g=null,h=!1;a.each(c._chosenValues,function(a,b){b.key===f?(d=b.value,h=!0):h&&!g&&(g=b)}),g&&(c.elements.lastEdit=g.value),e.after(c.elements.inputCont),c.elements.input.val(d),window.setTimeout(function(){c.elements.input.select()},100),c._removeTag(b),c._resizeInput(b)},_tagKeypress:function(b){var c=b.data.widget;switch(b.which){case a.ui.keyCode.DELETE:case a.ui.keyCode.BACKSPACE:b&&b.preventDefault(),b&&b.stopPropagation(),a(b.currentTarget).trigger("click");break;case 69:case a.ui.keyCode.ENTER:c._editTag(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._prevTag(b);break;case a.ui.keyCode.RIGHT:"keydown"===b.type&&c._nextTag(b);break;case a.ui.keyCode.DOWN:"keydown"===b.type&&c._focus(b)}},_prevTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.prev();e.is("li")?e.find("a").focus():c._focus()},_nextTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.next();e.is("li:not(.inputosaurus-input)")?e.find("a").focus():c._focus()},_containsDelimiter:function(b){var c=!1;return a.each(this.options.inputDelimiters,function(a,d){-1!==b.indexOf(d)&&(c=d)}),c},_setChosen:function(b){var c=this;return a.isArray(b)?(a.each(b,function(b,d){var e="",f=!1,g=-1,h={key:"",obj:null,value:""};e=a.trim(d[0]),a.each(c._chosenValues,function(a,b){b.value===c.elements.lastEdit&&(g=a),b.value===e&&(f=!0)}),""===e||f&&!c.options.allowDuplicates||(h.key="mi_"+Math.random().toString(16).slice(2,10),h.value=e,h.obj=d[1],g>-1?c._chosenValues.splice(g,0,h):c._chosenValues.push(h),c.elements.lastEdit="",c._renderTags())}),1===b.length&&""===b[0]&&""!==c.elements.lastEdit&&(c.elements.lastEdit="",c._renderTags()),c._setValue(c._buildValue()),void 0):!1},_buildValue:function(){var b=this,c="";return a.each(this._chosenValues,function(a,d){c+=c.length?b.options.outputDelimiter+d.value:d.value}),c},_setValue:function(a){var b=this.element.val();b!==a&&(this.element.val(a),this._trigger("change"))},_createTag:function(b,c,d){return void 0!==b&&d?a('
✖'+d.toLine(!0,!1,!0)+" "):void 0},_renderTags:function(){var b=this;this.elements.ul.find("li:not(.inputosaurus-required)").remove(),a.each(this._chosenValues,function(a,c){var d=b._createTag(c.value,c.key,c.obj);b.elements.ul.find("li.inputosaurus-input").before(d)})},_removeTag:function(b){var c=a(b.currentTarget).closest("li").data("inputosaurus"),d=!1,e=b&&b.data.widget||this;a.each(e._chosenValues,function(a,b){c===b.key&&(d=a)}),d!==!1&&e._chosenValues.splice(d,1),e._setValue(e._buildValue()),a(b.currentTarget).closest("li").remove(),window.setTimeout(function(){e.elements.input.focus()},100)},focus:function(){this.elements.input.focus()},_focus:function(b){var c=b&&b.data.widget||this,d=b&&b.target?a(b.target).closest("li"):null;d&&d.is("li")&&d.find("a").focus(),b&&a(b.target).closest("li").data("inputosaurus")||c.elements.input.focus()},_tagFocus:function(b){a(b.currentTarget).parent()["focusout"===b.type?"removeClass":"addClass"]("inputosaurus-selected")},refresh:function(){var b=this.options.outputDelimiter,c=this.element.val(),d=[];d.push(c),b&&(d=c.split(b)),d.length&&(this._chosenValues=[],a.isFunction(this.options.parseHook)&&(d=this.options.parseHook(d)),this._setChosen(d),this._renderTags(),this.elements.input.val(""),this._resizeInput())},_attachEvents:function(){var a=this;this.elements.input.on("keyup.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("keydown.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("change.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("focus.inputosaurus",{widget:a},this._inputFocus),this.options.parseOnBlur&&this.elements.input.on("blur.inputosaurus",{widget:a},this.parseInput),this.elements.ul.on("click.inputosaurus",{widget:a},this._focus),this.elements.ul.on("click.inputosaurus","a",{widget:a},this._removeTag),this.elements.ul.on("dblclick.inputosaurus","li",{widget:a},this._editTag),this.elements.ul.on("focus.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("blur.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("keydown.inputosaurus","a",{widget:a},this._tagKeypress)},_destroy:function(){this.elements.input.unbind(".inputosaurus"),this.elements.ul.replaceWith(this.element)}};a.widget("ui.inputosaurus",b)}(jQuery); \ No newline at end of file +!function(a){var b={version:"0.1.6",eventprefix:"inputosaurus",options:{inputDelimiters:[",",";"],outputDelimiter:",",allowDuplicates:!1,parseOnBlur:!1,wrapperElement:null,width:null,autoCompleteSource:"",activateFinalResult:!1,parseHook:null,placeholder:null},_create:function(){var b=this,c={},d=b.options,e=d.placeholder||this.element.attr("placeholder")||null;this._chosenValues=[],c.ul=a(''),c.fakeSpan=a(''),c.input=a(''),c.inputCont=a(''),c.origInputCont=a(''),c.lastEdit="",e&&(d.placeholder=e,c.input.attr("placeholder",d.placeholder),d.width&&c.input.css("min-width",d.width-50)),d.wrapperElement&&d.wrapperElement.append(c.ul),this.element.replaceWith(d.wrapperElement||c.ul),c.origInputCont.append(this.element).hide(),c.inputCont.append(c.input),c.ul.append(c.inputCont),c.ul.append(c.origInputCont),c.ul.append(c.fakeSpan),d.width&&c.ul.css("width",d.width),this.elements=c,b._attachEvents(),a.trim(this.element.val())&&(c.input.val(this.element.val()),this.parseInput()),this._instAutocomplete()},_instAutocomplete:function(){if(this.options.autoCompleteSource){var b=this;this.elements.input.autocomplete({position:{of:this.elements.ul},source:this.options.autoCompleteSource,minLength:1,select:function(a,c){a.preventDefault(),b.elements.input.val(c.item.value),b.parseInput()},open:function(){var c,d=a(this).data("ui-autocomplete").menu;d.element.width(b.elements.ul.outerWidth()),b.options.activateFinalResult&&(c=d.element.find("li"),1===c.size()&&d[d.activate?"activate":"focus"](a.Event("click"),c))},focus:function(){return!1}})}},_autoCompleteMenuPosition:function(){var a;this.options.autoCompleteSource&&(a=this.elements.input.data("ui-autocomplete"),a&&a.menu.element.position({of:this.elements.ul,my:"left top",at:"left bottom",collision:"none"}))},parseInput:function(b){var c,d=b&&b.data.widget||this,e=!1,f=[];c=d.elements.input.val(),c&&(e=d._containsDelimiter(c)),e!==!1?f=c.split(e):b&&(b.which!==a.ui.keyCode.ENTER||a(".ui-menu-item .ui-state-focus").size()||a("#ui-active-menuitem").size())?"blur"!==b.type||a("#ui-active-menuitem").size()||f.push(c):(f.push(c),b&&b.preventDefault()),a.isFunction(d.options.parseHook)&&(f=d.options.parseHook(f)),f.length&&(d._setChosen(f),d.elements.input.val(""),d._resizeInput()),d._resetPlaceholder()},_inputFocus:function(a){var b=a.data.widget||this;b.elements.input.value||b.options.autoCompleteSource.length&&b.elements.input.autocomplete("search","")},_inputKeypress:function(b){var c=b.data.widget||this;switch("keyup"===b.type&&c._trigger("keyup",b,c),b.which){case a.ui.keyCode.BACKSPACE:"keydown"===b.type&&c._inputBackspace(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._inputBackspace(b);break;default:c.parseInput(b),c._resizeInput(b)}c.options.autoCompleteSource&&setTimeout(function(){c._autoCompleteMenuPosition.call(c)},200)},_resizeInput:function(a){var b=a&&a.data.widget||this;b.elements.fakeSpan.text(b.elements.input.val());var c=25+b.elements.fakeSpan.width();c=c>50?c:50,c=500>c?c:500,b.elements.input.width(c)},_resetPlaceholder:function(){var a=this.options.placeholder,b=this.elements.input,c=this.options.width||"inherit";a&&0===this.element.val().length?b.attr("placeholder",a).css("min-width",c-50):b.attr("placeholder","").css("min-width","inherit")},_inputBackspace:function(b){var c=b&&b.data.widget||this,d=c.elements.ul.find("li:not(.inputosaurus-required):last");b.stopPropagation(),(!a(b.currentTarget).val()||"selectionStart"in b.currentTarget&&0===b.currentTarget.selectionStart&&0===b.currentTarget.selectionEnd)&&d.size()&&(b.preventDefault(),d.find("a").focus())},_editTag:function(b){var c=b&&b.data.widget||this,d="",e=a(b.currentTarget).closest("li"),f=e.data("inputosaurus");if(!f)return!0;b.preventDefault();var g=null,h=!1;a.each(c._chosenValues,function(a,b){b.key===f?(d=b.value,h=!0):h&&!g&&(g=b)}),g&&(c.elements.lastEdit=g.value),e.after(c.elements.inputCont),c.elements.input.val(d),window.setTimeout(function(){c.elements.input.select()},100),c._removeTag(b),c._resizeInput(b)},_tagKeypress:function(b){var c=b.data.widget;switch(b.which){case a.ui.keyCode.DELETE:case a.ui.keyCode.BACKSPACE:b&&b.preventDefault(),b&&b.stopPropagation(),a(b.currentTarget).trigger("click");break;case 69:case a.ui.keyCode.ENTER:c._editTag(b);break;case a.ui.keyCode.LEFT:"keydown"===b.type&&c._prevTag(b);break;case a.ui.keyCode.RIGHT:"keydown"===b.type&&c._nextTag(b);break;case a.ui.keyCode.DOWN:"keydown"===b.type&&c._focus(b)}},_prevTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.prev();e.is("li")?e.find("a").focus():c._focus()},_nextTag:function(b){var c=b&&b.data.widget||this,d=a(b.currentTarget).closest("li"),e=d.next();e.is("li:not(.inputosaurus-input)")?e.find("a").focus():c._focus()},_containsDelimiter:function(b){var c=!1;return a.each(this.options.inputDelimiters,function(a,d){-1!==b.indexOf(d)&&(c=d)}),c},_setChosen:function(b){var c=this;return a.isArray(b)?(a.each(b,function(b,d){var e="",f=!1,g=-1,h={key:"",obj:null,value:""};e=a.trim(d[0]),a.each(c._chosenValues,function(a,b){b.value===c.elements.lastEdit&&(g=a),b.value===e&&(f=!0)}),""===e||f&&!c.options.allowDuplicates||(h.key="mi_"+Math.random().toString(16).slice(2,10),h.value=e,h.obj=d[1],g>-1?c._chosenValues.splice(g,0,h):c._chosenValues.push(h),c.elements.lastEdit="",c._renderTags())}),1===b.length&&""===b[0]&&""!==c.elements.lastEdit&&(c.elements.lastEdit="",c._renderTags()),c._setValue(c._buildValue()),void 0):!1},_buildValue:function(){var b=this,c="";return a.each(this._chosenValues,function(a,d){c+=c.length?b.options.outputDelimiter+d.value:d.value}),c},_setValue:function(a){var b=this.element.val();b!==a&&(this.element.val(a),this._trigger("change"))},_createTag:function(b,c,d){return void 0!==b&&d?a('
✖'+d.toLine(!0,!1,!0)+" "):void 0},_renderTags:function(){var b=this;this.elements.ul.find("li:not(.inputosaurus-required)").remove(),a.each(this._chosenValues,function(a,c){var d=b._createTag(c.value,c.key,c.obj);b.elements.ul.find("li.inputosaurus-input").before(d)})},_removeTag:function(b){var c=a(b.currentTarget).closest("li").data("inputosaurus"),d=!1,e=b&&b.data.widget||this;a.each(e._chosenValues,function(a,b){c===b.key&&(d=a)}),d!==!1&&e._chosenValues.splice(d,1),e._setValue(e._buildValue()),a(b.currentTarget).closest("li").remove(),window.setTimeout(function(){e.elements.input.focus()},100)},focus:function(){this.elements.input.focus()},_focus:function(b){var c=b&&b.data.widget||this,d=b&&b.target?a(b.target).closest("li"):null;d&&d.is("li")&&d.find("a").focus(),b&&a(b.target).closest("li").data("inputosaurus")||c.elements.input.focus()},_tagFocus:function(b){a(b.currentTarget).parent()["focusout"===b.type?"removeClass":"addClass"]("inputosaurus-selected")},refresh:function(){var b=this.options.outputDelimiter,c=this.element.val(),d=[];d.push(c),b&&(d=c.split(b)),d.length&&(this._chosenValues=[],a.isFunction(this.options.parseHook)&&(d=this.options.parseHook(d)),this._setChosen(d),this._renderTags(),this.elements.input.val(""),this._resizeInput())},_attachEvents:function(){var a=this;this.elements.input.on("keyup.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("keydown.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("change.inputosaurus",{widget:a},this._inputKeypress),this.elements.input.on("focus.inputosaurus",{widget:a},this._inputFocus),this.options.parseOnBlur&&this.elements.input.on("blur.inputosaurus",{widget:a},this.parseInput),this.elements.ul.on("click.inputosaurus",{widget:a},this._focus),this.elements.ul.on("click.inputosaurus","a",{widget:a},this._removeTag),this.elements.ul.on("dblclick.inputosaurus","li",{widget:a},this._editTag),this.elements.ul.on("doubletap.inputosaurus","li",{widget:a},this._editTag),this.elements.ul.on("focus.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("blur.inputosaurus","a",{widget:a},this._tagFocus),this.elements.ul.on("keydown.inputosaurus","a",{widget:a},this._tagKeypress)},_destroy:function(){this.elements.input.unbind(".inputosaurus"),this.elements.ul.replaceWith(this.element)}};a.widget("ui.inputosaurus",b)}(jQuery); \ No newline at end of file diff --git a/vendors/jquery-finger/CONTRIBUTING.md b/vendors/jquery-finger/CONTRIBUTING.md new file mode 100644 index 000000000..94af4724d --- /dev/null +++ b/vendors/jquery-finger/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing + +## Important notes +Please don't edit files in the `dist` subdirectory as they are generated via grunt. You'll find source code in the `src` subdirectory! + +### Code style +Regarding code style like indentation and whitespace, **follow the conventions you see used in the source already.** + +### PhantomJS +While grunt can run the included unit tests via [PhantomJS](http://phantomjs.org/), this shouldn't be considered a substitute for the real thing. Please be sure to test the `test/*.html` unit test file(s) in _actual_ browsers. + +See the [Why does grunt complain that PhantomJS isn't installed?](https://github.com/gruntjs/grunt/blob/master/docs/faq.md#why-does-grunt-complain-that-phantomjs-isnt-installed) guide in the [Grunt FAQ](https://github.com/gruntjs/grunt/blob/master/docs/faq.md) for help with installing or troubleshooting PhantomJS. + +## Modifying the code +First, ensure that you have the latest [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) installed. + +Test that grunt is installed globally by running `grunt --version` at the command-line. If grunt isn't installed globally, run `npm install -g grunt` to install the latest version. _You may need to run `sudo npm install -g grunt`._ + +_Note that in Windows, you may have to run `grunt.cmd` instead of `grunt`._ + +1. Fork and clone the repo. +1. Run `npm install` to install all dependencies (including grunt). +1. Run `grunt` to grunt this project. + +Assuming that you don't see any red, you're ready to go. Just be sure to run `grunt` after making any changes, to ensure that nothing is broken. + +## Submitting pull requests + +1. Create a new branch, please don't work in your `master` branch directly. +1. Add failing tests for the change you want to make. Run `grunt` to see the tests fail. +1. Fix stuff. +1. Run `grunt` to see if the tests pass. Repeat steps 2-4 until done. +1. Open `test/*.html` unit test file(s) in actual browser to ensure tests pass everywhere. +1. Update the documentation to reflect any changes. +1. Push to your fork and submit a pull request. diff --git a/vendors/jquery-finger/LICENSE-MIT b/vendors/jquery-finger/LICENSE-MIT new file mode 100644 index 000000000..a0f33ef42 --- /dev/null +++ b/vendors/jquery-finger/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2013 "ngryman" Nicolas Gryman + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendors/jquery-finger/README.md b/vendors/jquery-finger/README.md new file mode 100644 index 000000000..9aa429a7b --- /dev/null +++ b/vendors/jquery-finger/README.md @@ -0,0 +1,225 @@ +# jQuery Finger 0.1.0-alpha + +jQuery tap & gestures, fingers in the nose. + +**jQuery Finger** unifies click and touch events by removing the **300ms delay** on touch devices. It also provide a common +set of events to handle basic gestures such as **drag** and **flick**.
+Very small (< 0.5kb gzipped), it is focused on **performance** and **KISS**, is well tested and also supports jQuery **delegated events**. + +[](https://travis-ci.org/ngryman/jquery.finger) +[](https://gemnasium.com/ngryman/jquery.finger) +[](http://githalytics.com/ngryman/jquery.finger) + +## Getting Started + +Download the [production version][min] *(470 bytes gzipped)* or the [development version][max] *(4163 bytes)*.
+You can also install it via [Jam] or [Bower]. + +[min]: https://raw.github.com/ngryman/jquery.finger/master/dist/jquery.finger.min.js +[max]: https://raw.github.com/ngryman/jquery.finger/master/dist/jquery.finger.js +[Jam]: http://jamjs.org +[Bower]: http://twitter.github.io/bower + +In your web page: + +```html + + + +``` + +## Documentation + +### Gestures + +**jQuery Finger** focuses on one finger events: + + | tap | doubletap | press | drag | flick | +----------|-----|-----------|-------|------|-------| +Available | ✔ | ✔ | ✔ | ✔ | ✔ | + +### Thresholds + +You can tweak how **jQuery Finger** handles events by modifying thresholds found in the `$.Finger` object. + +#### `pressDuration` + +This is the time the user will have to hold in order to fire a `press` event. +If this time is not reached, a `tap` event will be fired instead. +This defaults to `300`ms. + +#### `doubleTapInterval` + +This is the maximum time between two `tap` events to fire a `doubletap` event. +If this time is reached, two distinct `tap` events will be fired instead. +This defaults to `300`ms. + +#### `flickDuration` + +This is the maximum time the user will have to swipe in order to fire a `flick` event. +If this time is reached, a `drag` event will be fired instead. +This defaults to `150`ms. + +#### `motionThreshold` + +This is the number of pixel the user will have to move in order to fire motion events (drag or flick). +If this time is not reached, no motion will be handled and `tap`, `doubletap` or `press` event will be fired. +This defaults to `5`px. + +### Additional event parameters + +**jQuery Finger** enhances the default event object when there is motion (drag & flick). It gives information about +the pointer position and motion: + - **x**: the `x` page coordinate. + - **y**: the `y` page coordinate. + - **dx**: this `x` *delta* (amount of pixels moved) since the last event. + - **dy**: this `y` delta since the last event. + - **adx**: this `x` absolute delta since the last event. + - **ady**: this `y` absolute delta since the last event. + - **orientation**: + - `horizontal`: motion was detected as an horizontal one. This can be tweaked with `$.Finger.motionThreshold`. + - `vertical`: motion was detected as a vertical one. This can be tweaked with `$.Finger.motionThreshold`. + - **direction**: + - `1`: motion has a positive direction, either left to right for horizontal, or top to bottom for vertical. + - `-1`: motion has a negative direction, either right to left for horizontal, or bottom to top for vertical. + +### Prevent default + +You can prevent default browser behavior when binding events with **jQuery Finger**.
+By specifying it, be aware that you will prevent **every native behavior** such as *following links*, *scrolling*, +*selecting text* and more ([details]). + +There are two way of preventing default behavior. + +[details]: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-prevent-default-touch-and-mouse-events-in-the-BlackBerry/ta-p/1223685 + +#### Globally + +You can tell to prevent default behavior for every event binded with **jQuery Finger** like this: +```javascript +$.Finger.preventDefault = true; +``` + +#### Specifically + +You can tell to prevent default behavior just for a particular event like this: +```javascript +$('body').on('tap', '.touchme', { preventDefault: true }, function() { + // ... +}); +``` + +## Examples + +### Remove the 300ms delay on every links of your page + +```javascript +$('body').on('tap', 'a', { preventDefault: true }, function() { + window.location = $(this).attr('href'); +}); +``` + +### Delegated events for dynamically loaded elements (AJAX): + +```javascript +$('body').on('tap', '.toggle', function() { + $(this).toggleClass('is-selected'); +}); +``` + +### Swipe to reveal + +```javascript +$('#menu').on('flick', function(e) { + if ('horizontal' == e.orientation) { + if (1 == e.direction) { + $(this).addClass('is-opened'); + } + else { + $(this).removeClass('is-opened'); + } + } +}); +``` + +## Notes + + - **jQuery Finger** uses [VirtualPointer] in its test suite to simulate mouse and touch events. + - On Chrome 25+, `preventDefault` does not work as expected because `ontouchstart` is defined. To make it work, you + have to manually prevent the default behavior in the `mousedown` or `click` event. + +[VirtualPointer]: https://github.com/ngryman/virtual-pointer + +## Instacode + ++
+ +## Release History + +``` +v0.1.0-alpha + - ie8 legacy support. + - fixed prevent default event parameter. + +v0.0.11 + - `press` event is now fired by `timeout` instead of `touchend`. + +v0.0.10 + - fixed events fired multiple times (#1). + - added `preventDefault` support. + - internal refactoring for size and performance. + +v0.0.9 + - fixed incorrect event type. + - added to jam. + - added to bower. + +v0.0.8 + - fixed bugs on delegated events. + - better cross-browser support (still needs some work/tests). + - internal refactoring for consistency and performance. + +v0.0.7 + - various cross browsers fixes. + +v0.0.6 + - updated description. + +v0.0.5 + - updated jquery manifest and published on http://plugins.jquery.com. + +v0.0.4 + - added `drag` and `flick` gestures. + - enhanced `event` object. + - internal refactoring for consistency. + +v0.0.3 + - migration to **grunt** 0.4. + - migration to **mocha** / **chaijs** for tests. + +v0.0.2 + - added `doubletap` and `press` gestures. + - internal refactoring for consistency and performance. + +v0.0.1 + - `tap` gesture first implementation. +``` + +## Author + +| [](http://twitter.com/ngryman "Follow @ngryman on Twitter") | +|---| +| [Nicolas Gryman](http://ngryman.sh) | diff --git a/vendors/jquery-finger/bower.json b/vendors/jquery-finger/bower.json new file mode 100644 index 000000000..15becf909 --- /dev/null +++ b/vendors/jquery-finger/bower.json @@ -0,0 +1,21 @@ +{ + "name": "jquery.finger", + "version": "0.1.0-alpha", + "main": "dist/jquery.finger.js", + "ignore": [ + ".gitignore", + ".jshintrc", + ".travis.yml", + "Gruntfile.js", + "LICENSE-MIT", + "package.json", + "*.md", + "examples", + "libs", + "src", + "test" + ], + "dependencies": { + "jquery": "~1.7.0" + } +} \ No newline at end of file diff --git a/vendors/jquery-finger/finger.jquery.json b/vendors/jquery-finger/finger.jquery.json new file mode 100644 index 000000000..6eb30a9b4 --- /dev/null +++ b/vendors/jquery-finger/finger.jquery.json @@ -0,0 +1,43 @@ +{ + "name": "finger", + "title": "jQuery Finger", + "version": "0.1.0-alpha", + "description": "jQuery Finger unifies click and touch events by removing the 300ms delay on touch devices. It also provide a common set of events to handle basic gestures such as drag and pinch. Small (< 1kb gzipped), it is focused on performance, is well tested and ... also supports jQuery delegated events.", + "homepage": "https://github.com/ngryman/jquery.finger", + "bugs": "https://github.com/ngryman/jquery.finger/issues", + "author": { + "name": "Nicolas Gryman", + "email": "ngryman@gmail.com", + "url": "http://ngryman.sh" + }, + "repository": { + "type": "git", + "url": "git://github.com/ngryman/jquery.finger.git" + }, + "bugs": { + "url": "https://github.com/ngryman/jquery.finger/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/ngryman/jquery.finger/blob/master/LICENSE-MIT" + } + ], + "dependencies": { + "jquery": "~1.7.0" + }, + "keywords": [ + "tap", + "doubletap", + "swipe", + "flick", + "drag", + "move", + "gestures", + "touch", + "tappable", + "event", + "mobile", + "tablet" + ] +} \ No newline at end of file diff --git a/vendors/jquery-finger/jquery.finger.js b/vendors/jquery-finger/jquery.finger.js new file mode 100644 index 000000000..1ba470e3a --- /dev/null +++ b/vendors/jquery-finger/jquery.finger.js @@ -0,0 +1,147 @@ +/*! jquery.finger - v0.1.0-alpha - 2013-07-01 +* https://github.com/ngryman/jquery.finger +* Copyright (c) 2013 Nicolas Gryman; Licensed MIT */ + +(function($) { + + var hasTouch = 'ontouchstart' in window, + startEvent = hasTouch ? 'touchstart' : 'mousedown', + stopEvent = hasTouch ? 'touchend touchcancel' : 'mouseup mouseleave', + moveEvent = hasTouch ? 'touchmove' : 'mousemove', + + namespace = 'finger', + safeguard, + + Finger = $.Finger = { + pressDuration: 300, + doubleTapInterval: 300, + flickDuration: 150, + motionThreshold: 5 + }; + + function page(coord, e) { + return (hasTouch ? e.originalEvent.touches[0] : e)['page' + coord.toUpperCase()]; + } + + function startHandler(event) { + var data = {}, + timeStamp = event.timeStamp || +new Date(), + f = $.data(this, namespace); + + if (safeguard == timeStamp) return; + safeguard = timeStamp; + + data.move = { x: page('x', event), y: page('y', event) }; + data.start = $.extend({ time: timeStamp, target: event.target }, data.move); + data.timeout = setTimeout($.proxy(function() { + $.event.trigger($.Event('press', data.move), null, event.target); + + $.event.remove(this, moveEvent + '.' + namespace, moveHandler); + $.event.remove(this, stopEvent + '.' + namespace, stopHandler); + }, this), $.Finger.pressDuration); + + $.event.add(this, moveEvent + '.' + namespace, moveHandler, data); + $.event.add(this, stopEvent + '.' + namespace, stopHandler, data); + + if (Finger.preventDefault || f.options.preventDefault) event.preventDefault(); + } + + function moveHandler(event) { + var data = event.data, + start = data.start, + move = data.move; + + // motion data + move.x = page('x', event); + move.y = page('y', event); + move.dx = move.x - start.x; + move.dy = move.y - start.y; + move.adx = Math.abs(move.dx); + move.ady = Math.abs(move.dy); + + // security + data.motion = move.adx > Finger.motionThreshold || move.ady > Finger.motionThreshold; + if (!data.motion) return; + + // moves cancel press events + clearTimeout(data.timeout); + + // orientation + if (!move.orientation) { + if (move.adx > data.move.ady) { + move.orientation = 'horizontal'; + move.direction = move.dx > 0 ? +1 : -1; + } + else { + move.orientation = 'vertical'; + move.direction = move.dy > 0 ? +1 : -1; + } + } + + // for delegated events, the target may change over time + // this ensures we notify the right target and simulates the mouseleave behavior + if (event.target !== start.target) { + event.target = start.target; + stopHandler.call(this, $.Event(stopEvent + '.' + namespace, event)); + return; + } + + // fire drag event + $.event.trigger($.Event('drag', move), null, event.target); + } + + function stopHandler(event) { + var data = event.data, + timeStamp = event.timeStamp || +new Date(), + f = $.data(this, namespace), + dt = timeStamp - data.start.time, + evtName; + + // always clears press timeout + clearTimeout(data.timeout); + + // ensures start target and end target are the same + if (event.target !== data.start.target) return; + + // tap-like events + if (!data.motion) { + evtName = dt < Finger.pressDuration && + !f.prev || f.prev && timeStamp - f.prev > Finger.doubleTapInterval ? 'tap' : 'doubletap'; + f.prev = timeStamp; + } + // motion events + else { + evtName = dt < Finger.flickDuration ? 'flick' : 'drag'; + data.move.end = true; + } + + $.event.trigger($.Event(evtName, data.move), null, event.target); + + $.event.remove(this, moveEvent + '.' + namespace, moveHandler); + $.event.remove(this, stopEvent + '.' + namespace, stopHandler); + } + + var fingerCustom = { + add: function(handleObj) { + if (!$.data(this, namespace)) { + $.event.add(this, startEvent + '.' + namespace, startHandler); + $.data(this, namespace, { options: handleObj.data || {} }); + } + }, + + teardown: function() { + if ($.data(this, namespace)) { + $.event.remove(this, startEvent + '.' + namespace, startHandler); + $.data(this, namespace, null); + } + } + }; + + // registers custom events + $.event.special.tap = fingerCustom; + $.event.special.press = fingerCustom; + $.event.special.doubletap = fingerCustom; + $.event.special.drag = fingerCustom; + $.event.special.flick = fingerCustom; + +})(jQuery); diff --git a/vendors/jquery-finger/jquery.finger.min.js b/vendors/jquery-finger/jquery.finger.min.js new file mode 100644 index 000000000..cc07c9d10 --- /dev/null +++ b/vendors/jquery-finger/jquery.finger.min.js @@ -0,0 +1,4 @@ +/*! jquery.finger - v0.1.0-alpha - 2013-07-01 +* https://github.com/ngryman/jquery.finger +* Copyright (c) 2013 Nicolas Gryman; Licensed MIT */ +(function(t){function e(t,e){return(r?e.originalEvent.touches[0]:e)["page"+t.toUpperCase()]}function a(a){var r={},v=a.timeStamp||+new Date,m=t.data(this,u);i!=v&&(i=v,r.move={x:e("x",a),y:e("y",a)},r.start=t.extend({time:v,target:a.target},r.move),r.timeout=setTimeout(t.proxy(function(){t.event.trigger(t.Event("press",r.move),null,a.target),t.event.remove(this,d+"."+u,o),t.event.remove(this,s+"."+u,n)},this),t.Finger.pressDuration),t.event.add(this,d+"."+u,o,r),t.event.add(this,s+"."+u,n,r),(l.preventDefault||m.options.preventDefault)&&a.preventDefault())}function o(a){var o=a.data,i=o.start,r=o.move;return r.x=e("x",a),r.y=e("y",a),r.dx=r.x-i.x,r.dy=r.y-i.y,r.adx=Math.abs(r.dx),r.ady=Math.abs(r.dy),o.motion=r.adx>l.motionThreshold||r.ady>l.motionThreshold,o.motion?(clearTimeout(o.timeout),r.orientation||(r.adx>o.move.ady?(r.orientation="horizontal",r.direction=r.dx>0?1:-1):(r.orientation="vertical",r.direction=r.dy>0?1:-1)),a.target!==i.target?(a.target=i.target,n.call(this,t.Event(s+"."+u,a)),void 0):(t.event.trigger(t.Event("drag",r),null,a.target),void 0)):void 0}function n(e){var a,i=e.data,r=e.timeStamp||+new Date,v=t.data(this,u),m=r-i.start.time;clearTimeout(i.timeout),e.target===i.start.target&&(i.motion?(a=l.flickDuration>m?"flick":"drag",i.move.end=!0):(a=l.pressDuration>m&&!v.prev||v.prev&&r-v.prev>l.doubleTapInterval?"tap":"doubletap",v.prev=r),t.event.trigger(t.Event(a,i.move),null,e.target),t.event.remove(this,d+"."+u,o),t.event.remove(this,s+"."+u,n))}var i,r="ontouchstart"in window,v=r?"touchstart":"mousedown",s=r?"touchend touchcancel":"mouseup mouseleave",d=r?"touchmove":"mousemove",u="finger",l=t.Finger={pressDuration:300,doubleTapInterval:300,flickDuration:150,motionThreshold:5},m={add:function(e){t.data(this,u)||(t.event.add(this,v+"."+u,a),t.data(this,u,{options:e.data||{}}))},teardown:function(){t.data(this,u)&&(t.event.remove(this,v+"."+u,a),t.data(this,u,null))}};t.event.special.tap=m,t.event.special.press=m,t.event.special.doubletap=m,t.event.special.drag=m,t.event.special.flick=m})(jQuery); \ No newline at end of file diff --git a/vendors/jquery-finger/package.json b/vendors/jquery-finger/package.json new file mode 100644 index 000000000..9a1c800b1 --- /dev/null +++ b/vendors/jquery-finger/package.json @@ -0,0 +1,64 @@ +{ + "name": "jquery.finger", + "version": "0.1.0-alpha", + "description": "jQuery Finger unifies click and touch events by removing the 300ms delay on touch devices. It also provide a common set of events to handle basic gestures such as drag and pinch. Small (< 1kb gzipped), it is focused on performance, is well tested and ... also supports jQuery delegated events.", + "homepage": "https://github.com/ngryman/jquery.finger", + "keywords": [ + "jquery", + "tap", + "doubletap", + "swipe", + "flick", + "drag", + "move", + "gestures", + "touch", + "tappable", + "event", + "mobile", + "tablet" + ], + "categories": [ + "UI", + "DOM", + "Shims", + "Utilities" + ], + "jam": { + "main": "dist/jquery.finger.js", + "include": [ + "dist/jquery.finger.js" + ], + "dependencies": { + "jquery": "~1.7.0" + } + }, + "author": { + "name": "Nicolas Gryman", + "email": "ngryman@gmail.com" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/ngryman/jquery.finger.git" + }, + "bugs": { + "url": "https://github.com/ngryman/jquery.finger/issues", + "email": "ngryman@gmail.com" + }, + "engines": { + "node": ">= 0.10" + }, + "scripts": { + "test": "grunt mocha" + }, + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-jshint": "~0.5.0", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-uglify": "~0.2.0", + "grunt-contrib-watch": "~0.4.0", + "grunt-contrib-connect": "~0.3.0", + "grunt-mocha": "~0.3.0" + } +}+