/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "rainloop/v/0.0.0/static/js/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /*!********************!*\ !*** ./dev/app.js ***! \********************/ /***/ function(module, exports, __webpack_require__) { __webpack_require__(/*! bootstrap */ 69)(__webpack_require__(/*! App/User */ 6)); /***/ }, /* 1 */ /*!*****************************!*\ !*** ./dev/Common/Utils.js ***! \*****************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var oEncryptObject = null, Utils = {}, window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), ko = __webpack_require__(/*! ko */ 3), Autolinker = __webpack_require__(/*! Autolinker */ 71), JSEncrypt = __webpack_require__(/*! JSEncrypt */ 72), Mime = __webpack_require__(/*! Common/Mime */ 48), Enums = __webpack_require__(/*! Common/Enums */ 4), Globals = __webpack_require__(/*! Common/Globals */ 8) ; Utils.trim = $.trim; Utils.inArray = $.inArray; Utils.isArray = _.isArray; Utils.isFunc = _.isFunction; Utils.isUnd = _.isUndefined; Utils.isNull = _.isNull; Utils.emptyFunction = function () {}; /** * @param {*} oValue * @return {boolean} */ Utils.isNormal = function (oValue) { return !Utils.isUnd(oValue) && !Utils.isNull(oValue); }; Utils.windowResize = _.debounce(function (iTimeout) { if (Utils.isUnd(iTimeout)) { Globals.$win.resize(); } else { window.setTimeout(function () { Globals.$win.resize(); }, iTimeout); } }, 50); Utils.windowResizeCallback = function () { Utils.windowResize(); }; /** * @param {(string|number)} mValue * @param {boolean=} bIncludeZero * @return {boolean} */ Utils.isPosNumeric = function (mValue, bIncludeZero) { return Utils.isNormal(mValue) ? ((Utils.isUnd(bIncludeZero) ? true : !!bIncludeZero) ? (/^[0-9]*$/).test(mValue.toString()) : (/^[1-9]+[0-9]*$/).test(mValue.toString())) : false; }; /** * @param {*} iValue * @param {number=} iDefault = 0 * @return {number} */ Utils.pInt = function (iValue, iDefault) { var iResult = Utils.isNormal(iValue) && '' !== iValue ? window.parseInt(iValue, 10) : (iDefault || 0); return window.isNaN(iResult) ? (iDefault || 0) : iResult; }; /** * @param {*} mValue * @return {string} */ Utils.pString = function (mValue) { return Utils.isNormal(mValue) ? '' + mValue : ''; }; /** * @param {string} sComponent * @return {string} */ Utils.encodeURIComponent = function (sComponent) { return window.encodeURIComponent(sComponent); }; /** * @param {*} aValue * @return {boolean} */ Utils.isNonEmptyArray = function (aValue) { return Utils.isArray(aValue) && 0 < aValue.length; }; /** * @param {string} sQueryString * @return {Object} */ Utils.simpleQueryParser = function (sQueryString) { var oParams = {}, aQueries = [], aTemp = [], iIndex = 0, iLen = 0 ; aQueries = sQueryString.split('&'); for (iIndex = 0, iLen = aQueries.length; iIndex < iLen; iIndex++) { aTemp = aQueries[iIndex].split('='); oParams[window.decodeURIComponent(aTemp[0])] = window.decodeURIComponent(aTemp[1]); } return oParams; }; /** * @param {string} sMailToUrl * @param {Function} PopupComposeVoreModel * @returns {boolean} */ Utils.mailToHelper = function (sMailToUrl, PopupComposeVoreModel) { if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase()) { sMailToUrl = sMailToUrl.toString().substr(7); var oParams = {}, oToEmailModel = null, oCcEmailModel = null, oBccEmailModel = null, sEmail = sMailToUrl.replace(/\?.+$/, ''), sQueryString = sMailToUrl.replace(/^[^\?]*\?/, ''), EmailModel = __webpack_require__(/*! Model/Email */ 25) ; oToEmailModel = new EmailModel(); oToEmailModel.parse(window.decodeURIComponent(sEmail)); oParams = Utils.simpleQueryParser(sQueryString); if (!Utils.isUnd(oParams.cc)) { oCcEmailModel = new EmailModel(); oCcEmailModel.parse(window.decodeURIComponent(oParams.cc)); } if (!Utils.isUnd(oParams.bcc)) { oBccEmailModel = new EmailModel(); oBccEmailModel.parse(window.decodeURIComponent(oParams.bcc)); } __webpack_require__(/*! Knoin/Knoin */ 5).showScreenPopup(PopupComposeVoreModel, [Enums.ComposeType.Empty, null, oToEmailModel && oToEmailModel.email ? [oToEmailModel] : null, oCcEmailModel && oCcEmailModel.email ? [oCcEmailModel] : null, oBccEmailModel && oBccEmailModel.email ? [oBccEmailModel] : null, Utils.isUnd(oParams.subject) ? null : Utils.pString(oParams.subject), Utils.isUnd(oParams.body) ? null : Utils.plainToHtml(Utils.pString(oParams.body)) ]); return true; } return false; }; /** * @param {string} sPublicKey * @return {JSEncrypt} */ Utils.rsaObject = function (sPublicKey) { if (JSEncrypt && sPublicKey && (null === oEncryptObject || (oEncryptObject && oEncryptObject.__sPublicKey !== sPublicKey)) && window.crypto && window.crypto.getRandomValues) { oEncryptObject = new JSEncrypt(); oEncryptObject.setPublicKey(sPublicKey); oEncryptObject.__sPublicKey = sPublicKey; } else { oEncryptObject = false; } return oEncryptObject; }; /** * @param {string} sValue * @param {string} sPublicKey * @return {string} */ Utils.rsaEncode = function (sValue, sPublicKey) { if (window.crypto && window.crypto.getRandomValues && sPublicKey) { var sResultValue = false, oEncrypt = Utils.rsaObject(sPublicKey) ; if (oEncrypt) { sResultValue = oEncrypt.encrypt(Utils.fakeMd5() + ':' + sValue + ':' + Utils.fakeMd5()); if (false !== sResultValue && Utils.isNormal(sResultValue)) { return 'rsa:xxx:' + sResultValue; } } } return sValue; }; Utils.rsaEncode.supported = !!(window.crypto && window.crypto.getRandomValues && false && JSEncrypt); /** * @param {string} sText * @return {string} */ Utils.encodeHtml = function (sText) { return Utils.isNormal(sText) ? sText.toString() .replace(/&/g, '&').replace(//g, '>') .replace(/"/g, '"').replace(/'/g, ''') : ''; }; /** * @param {string} sText * @param {number=} iLen * @return {string} */ Utils.splitPlainText = function (sText, iLen) { var sPrefix = '', sSubText = '', sResult = sText, iSpacePos = 0, iNewLinePos = 0 ; iLen = Utils.isUnd(iLen) ? 100 : iLen; while (sResult.length > iLen) { sSubText = sResult.substring(0, iLen); iSpacePos = sSubText.lastIndexOf(' '); iNewLinePos = sSubText.lastIndexOf('\n'); if (-1 !== iNewLinePos) { iSpacePos = iNewLinePos; } if (-1 === iSpacePos) { iSpacePos = iLen; } sPrefix += sSubText.substring(0, iSpacePos) + '\n'; sResult = sResult.substring(iSpacePos + 1); } return sPrefix + sResult; }; Utils.timeOutAction = (function () { var oTimeOuts = {} ; return function (sAction, fFunction, iTimeOut) { if (Utils.isUnd(oTimeOuts[sAction])) { oTimeOuts[sAction] = 0; } window.clearTimeout(oTimeOuts[sAction]); oTimeOuts[sAction] = window.setTimeout(fFunction, iTimeOut); }; }()); Utils.timeOutActionSecond = (function () { var oTimeOuts = {} ; return function (sAction, fFunction, iTimeOut) { if (!oTimeOuts[sAction]) { oTimeOuts[sAction] = window.setTimeout(function () { fFunction(); oTimeOuts[sAction] = 0; }, iTimeOut); } }; }()); Utils.audio = (function () { var oAudio = false ; return function (sMp3File, sOggFile) { if (false === oAudio) { if (Globals.bIsiOSDevice) { oAudio = null; } else { var bCanPlayMp3 = false, bCanPlayOgg = false, oAudioLocal = window.Audio ? new window.Audio() : null ; if (oAudioLocal && oAudioLocal.canPlayType && oAudioLocal.play) { bCanPlayMp3 = '' !== oAudioLocal.canPlayType('audio/mpeg; codecs="mp3"'); if (!bCanPlayMp3) { bCanPlayOgg = '' !== oAudioLocal.canPlayType('audio/ogg; codecs="vorbis"'); } if (bCanPlayMp3 || bCanPlayOgg) { oAudio = oAudioLocal; oAudio.preload = 'none'; oAudio.loop = false; oAudio.autoplay = false; oAudio.muted = false; oAudio.src = bCanPlayMp3 ? sMp3File : sOggFile; } else { oAudio = null; } } else { oAudio = null; } } } return oAudio; }; }()); /** * @param {(Object|null|undefined)} oObject * @param {string} sProp * @return {boolean} */ Utils.hos = function (oObject, sProp) { return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false; }; /** * @return {boolean} */ Utils.inFocus = function () { if (window.document.activeElement) { if (Utils.isUnd(window.document.activeElement.__inFocusCache)) { window.document.activeElement.__inFocusCache = $(window.document.activeElement).is('input,textarea,iframe,.cke_editable'); } return !!window.document.activeElement.__inFocusCache; } return false; }; Utils.removeInFocus = function () { if (window.document && window.document.activeElement && window.document.activeElement.blur) { var oA = $(window.document.activeElement); if (oA.is('input,textarea')) { window.document.activeElement.blur(); } } }; Utils.removeSelection = function () { if (window && window.getSelection) { var oSel = window.getSelection(); if (oSel && oSel.removeAllRanges) { oSel.removeAllRanges(); } } else if (window.document && window.document.selection && window.document.selection.empty) { window.document.selection.empty(); } }; /** * @param {string} sPrefix * @param {string} sSubject * @return {string} */ Utils.replySubjectAdd = function (sPrefix, sSubject) { sPrefix = Utils.trim(sPrefix.toUpperCase()); sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' ')); var bDrop = false, aSubject = [], bRe = 'RE' === sPrefix, bFwd = 'FWD' === sPrefix, bPrefixIsRe = !bFwd ; if ('' !== sSubject) { _.each(sSubject.split(':'), function (sPart) { var sTrimmedPart = Utils.trim(sPart); if (!bDrop && (/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart))) { if (!bRe) { bRe = !!(/^RE/i.test(sTrimmedPart)); } if (!bFwd) { bFwd = !!(/^FWD/i.test(sTrimmedPart)); } } else { aSubject.push(sPart); bDrop = true; } }); } if (bPrefixIsRe) { bRe = false; } else { bFwd = false; } return Utils.trim( (bPrefixIsRe ? 'Re: ' : 'Fwd: ') + (bRe ? 'Re: ' : '') + (bFwd ? 'Fwd: ' : '') + Utils.trim(aSubject.join(':')) ); }; /** * @param {number} iNum * @param {number} iDec * @return {number} */ Utils.roundNumber = function (iNum, iDec) { return window.Math.round(iNum * window.Math.pow(10, iDec)) / window.Math.pow(10, iDec); }; /** * @param {(number|string)} iSizeInBytes * @return {string} */ Utils.friendlySize = function (iSizeInBytes) { iSizeInBytes = Utils.pInt(iSizeInBytes); if (iSizeInBytes >= 1073741824) { return Utils.roundNumber(iSizeInBytes / 1073741824, 1) + 'GB'; } else if (iSizeInBytes >= 1048576) { return Utils.roundNumber(iSizeInBytes / 1048576, 1) + 'MB'; } else if (iSizeInBytes >= 1024) { return Utils.roundNumber(iSizeInBytes / 1024, 0) + 'KB'; } return iSizeInBytes + 'B'; }; /** * @param {string} sDesc */ Utils.log = function (sDesc) { if (window.console && window.console.log) { window.console.log(sDesc); } }; /** * @param {?} oObject * @param {string} sMethodName * @param {Array=} aParameters * @param {number=} nDelay */ Utils.delegateRun = function (oObject, sMethodName, aParameters, nDelay) { if (oObject && oObject[sMethodName]) { nDelay = Utils.pInt(nDelay); if (0 >= nDelay) { oObject[sMethodName].apply(oObject, Utils.isArray(aParameters) ? aParameters : []); } else { _.delay(function () { oObject[sMethodName].apply(oObject, Utils.isArray(aParameters) ? aParameters : []); }, nDelay); } } }; /** * @param {?} oEvent */ Utils.killCtrlAandS = function (oEvent) { oEvent = oEvent || window.event; if (oEvent && oEvent.ctrlKey && !oEvent.shiftKey && !oEvent.altKey) { var oSender = oEvent.target || oEvent.srcElement, iKey = oEvent.keyCode || oEvent.which ; if (iKey === Enums.EventKeyCode.S) { oEvent.preventDefault(); return; } if (oSender && oSender.tagName && oSender.tagName.match(/INPUT|TEXTAREA/i)) { return; } if (iKey === Enums.EventKeyCode.A) { if (window.getSelection) { window.getSelection().removeAllRanges(); } else if (window.document.selection && window.document.selection.clear) { window.document.selection.clear(); } oEvent.preventDefault(); } } }; /** * @param {(Object|null|undefined)} oContext * @param {Function} fExecute * @param {(Function|boolean|null)=} fCanExecute * @return {Function} */ Utils.createCommand = function (oContext, fExecute, fCanExecute) { var fNonEmpty = function () { if (fResult && fResult.canExecute && fResult.canExecute()) { fExecute.apply(oContext, Array.prototype.slice.call(arguments)); } return false; }, fResult = fExecute ? fNonEmpty : Utils.emptyFunction ; fResult.enabled = ko.observable(true); fCanExecute = Utils.isUnd(fCanExecute) ? true : fCanExecute; if (Utils.isFunc(fCanExecute)) { fResult.canExecute = ko.computed(function () { return fResult.enabled() && fCanExecute.call(oContext); }); } else { fResult.canExecute = ko.computed(function () { return fResult.enabled() && !!fCanExecute; }); } return fResult; }; /** * @param {{moment:Function}} oObject */ Utils.createMomentDate = function (oObject) { if (Utils.isUnd(oObject.moment)) { oObject.moment = ko.observable(moment()); } return ko.computed(function () { Globals.momentTrigger(); var oMoment = this.moment(); return 1970 === oMoment.year() ? '' : oMoment.fromNow(); }, oObject); }; /** * @param {{moment:Function, momentDate:Function}} oObject */ Utils.createMomentShortDate = function (oObject) { return ko.computed(function () { var sResult = '', oMomentNow = moment(), oMoment = this.moment(), sMomentDate = this.momentDate() ; if (1970 === oMoment.year()) { sResult = ''; } else if (4 >= oMomentNow.diff(oMoment, 'hours')) { sResult = sMomentDate; } else if (oMomentNow.format('L') === oMoment.format('L')) { sResult = __webpack_require__(/*! Common/Translator */ 7).i18n('MESSAGE_LIST/TODAY_AT', { 'TIME': oMoment.format('LT') }); } else if (oMomentNow.clone().subtract('days', 1).format('L') === oMoment.format('L')) { sResult = __webpack_require__(/*! Common/Translator */ 7).i18n('MESSAGE_LIST/YESTERDAY_AT', { 'TIME': oMoment.format('LT') }); } else if (oMomentNow.year() === oMoment.year()) { sResult = oMoment.format('D MMM.'); } else { sResult = oMoment.format('LL'); } return sResult; }, oObject); }; /** * @param {string} sTheme * @return {string} */ Utils.convertThemeName = function (sTheme) { if ('@custom' === sTheme.substr(-7)) { sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7)); } return Utils.trim(sTheme.replace(/[^a-zA-Z0-9]+/g, ' ').replace(/([A-Z])/g, ' $1').replace(/[\s]+/g, ' ')); }; /** * @param {string} sName * @return {string} */ Utils.quoteName = function (sName) { return sName.replace(/["]/g, '\\"'); }; /** * @return {number} */ Utils.microtime = function () { return (new Date()).getTime(); }; /** * @return {number} */ Utils.timestamp = function () { return window.Math.round(Utils.microtime() / 1000); }; /** * * @param {string} sLanguage * @param {boolean=} bEng = false * @return {string} */ Utils.convertLangName = function (sLanguage, bEng) { return __webpack_require__(/*! Common/Translator */ 7).i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' + sLanguage.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, sLanguage); }; /** * @param {number=} iLen * @return {string} */ Utils.fakeMd5 = function(iLen) { var sResult = '', sLine = '0123456789abcdefghijklmnopqrstuvwxyz' ; iLen = Utils.isUnd(iLen) ? 32 : Utils.pInt(iLen); while (sResult.length < iLen) { sResult += sLine.substr(window.Math.round(window.Math.random() * sLine.length), 1); } return sResult; }; Utils.draggablePlace = function () { return $('
' + ' ' + '
').appendTo('#rl-hidden'); }; Utils.defautOptionsAfterRender = function (oDomOption, oItem) { if (oItem && !Utils.isUnd(oItem.disabled) && oDomOption) { $(oDomOption) .toggleClass('disabled', oItem.disabled) .prop('disabled', oItem.disabled) ; } }; /** * @param {Object} oViewModel * @param {string} sTemplateID * @param {string} sTitle * @param {Function=} fCallback */ Utils.windowPopupKnockout = function (oViewModel, sTemplateID, sTitle, fCallback) { var oScript = null, oWin = window.open(''), sFunc = '__OpenerApplyBindingsUid' + Utils.fakeMd5() + '__', oTemplate = $('#' + sTemplateID) ; window[sFunc] = function () { if (oWin && oWin.document.body && oTemplate && oTemplate[0]) { var oBody = $(oWin.document.body); $('#rl-content', oBody).html(oTemplate.html()); $('html', oWin.document).addClass('external ' + $('html').attr('class')); __webpack_require__(/*! Common/Translator */ 7).i18nToNode(oBody); if (oViewModel && $('#rl-content', oBody)[0]) { ko.applyBindings(oViewModel, $('#rl-content', oBody)[0]); } window[sFunc] = null; fCallback(oWin); } }; oWin.document.open(); oWin.document.write('' + '' + '' + '' + '' + '' + '' + Utils.encodeHtml(sTitle) + '' + '
'); oWin.document.close(); oScript = oWin.document.createElement('script'); oScript.type = 'text/javascript'; oScript.innerHTML = 'if(window&&window.opener&&window.opener[\'' + sFunc + '\']){window.opener[\'' + sFunc + '\']();window.opener[\'' + sFunc + '\']=null}'; oWin.document.getElementsByTagName('head')[0].appendChild(oScript); }; /** * @param {Function} fCallback * @param {?} koTrigger * @param {?} oContext = null * @param {number=} iTimer = 1000 * @return {Function} */ Utils.settingsSaveHelperFunction = function (fCallback, koTrigger, oContext, iTimer) { oContext = oContext || null; iTimer = Utils.isUnd(iTimer) ? 1000 : Utils.pInt(iTimer); return function (sType, mData, bCached, sRequestAction, oRequestParameters) { koTrigger.call(oContext, mData && mData['Result'] ? Enums.SaveSettingsStep.TrueResult : Enums.SaveSettingsStep.FalseResult); if (fCallback) { fCallback.call(oContext, sType, mData, bCached, sRequestAction, oRequestParameters); } _.delay(function () { koTrigger.call(oContext, Enums.SaveSettingsStep.Idle); }, iTimer); }; }; Utils.settingsSaveHelperSimpleFunction = function (koTrigger, oContext) { return Utils.settingsSaveHelperFunction(null, koTrigger, oContext, 1000); }; Utils.settingsSaveHelperSubscribeFunction = function (oRemote, sSettingName, sType, fTriggerFunction) { return function (mValue) { if (oRemote) { switch (sType) { default: mValue = Utils.pString(mValue); break; case 'bool': case 'boolean': mValue = mValue ? '1' : '0'; break; case 'int': case 'integer': case 'number': mValue = Utils.pInt(mValue); break; case 'trim': mValue = Utils.trim(mValue); break; } var oData = {}; oData[sSettingName] = mValue; if (oRemote.saveAdminConfig) { oRemote.saveAdminConfig(fTriggerFunction || null, oData); } else if (oRemote.saveSettings) { oRemote.saveSettings(fTriggerFunction || null, oData); } } }; }; /** * @param {string} sHtml * @return {string} */ Utils.htmlToPlain = function (sHtml) { var iPos = 0, iP1 = 0, iP2 = 0, iP3 = 0, iLimit = 0, sText = '', splitPlainText = function (sText) { var iLen = 100, sPrefix = '', sSubText = '', sResult = sText, iSpacePos = 0, iNewLinePos = 0 ; while (sResult.length > iLen) { sSubText = sResult.substring(0, iLen); iSpacePos = sSubText.lastIndexOf(' '); iNewLinePos = sSubText.lastIndexOf('\n'); if (-1 !== iNewLinePos) { iSpacePos = iNewLinePos; } if (-1 === iSpacePos) { iSpacePos = iLen; } sPrefix += sSubText.substring(0, iSpacePos) + '\n'; sResult = sResult.substring(iSpacePos + 1); } return sPrefix + sResult; }, convertBlockquote = function (sText) { sText = splitPlainText($.trim(sText)); sText = '> ' + sText.replace(/\n/gm, '\n> '); return sText.replace(/(^|\n)([> ]+)/gm, function () { return (arguments && 2 < arguments.length) ? arguments[1] + $.trim(arguments[2].replace(/[\s]/g, '')) + ' ' : ''; }); }, convertDivs = function () { if (arguments && 1 < arguments.length) { var sText = $.trim(arguments[1]); if (0 < sText.length) { sText = sText.replace(/]*>([\s\S\r\n]*)<\/div>/gmi, convertDivs); sText = '\n' + $.trim(sText) + '\n'; } return sText; } return ''; }, convertPre = function () { return (arguments && 1 < arguments.length) ? arguments[1].toString().replace(/[\n]/gm, '
') : ''; }, fixAttibuteValue = function () { return (arguments && 1 < arguments.length) ? '' + arguments[1] + arguments[2].replace(//g, '>') : ''; }, convertLinks = function () { return (arguments && 1 < arguments.length) ? $.trim(arguments[1]) : ''; } ; sText = sHtml .replace(/]*>([\s\S\r\n]*)<\/pre>/gmi, convertPre) .replace(/[\s]+/gm, ' ') .replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gmi, fixAttibuteValue) .replace(/]*>/gmi, '\n') .replace(/<\/h[\d]>/gi, '\n') .replace(/<\/p>/gi, '\n\n') .replace(/<\/li>/gi, '\n') .replace(/<\/td>/gi, '\n') .replace(/<\/tr>/gi, '\n') .replace(/]*>/gmi, '\n_______________________________\n\n') .replace(/]*>([\s\S\r\n]*)<\/div>/gmi, convertDivs) .replace(/]*>/gmi, '\n__bq__start__\n') .replace(/<\/blockquote>/gmi, '\n__bq__end__\n') .replace(/]*>([\s\S\r\n]*?)<\/a>/gmi, convertLinks) .replace(/<\/div>/gi, '\n') .replace(/ /gi, ' ') .replace(/"/gi, '"') .replace(/<[^>]*>/gm, '') ; sText = Globals.$div.html(sText).text(); sText = sText .replace(/\n[ \t]+/gm, '\n') .replace(/[\n]{3,}/gm, '\n\n') .replace(/>/gi, '>') .replace(/</gi, '<') .replace(/&/gi, '&') ; iPos = 0; iLimit = 100; while (0 < iLimit) { iLimit--; iP1 = sText.indexOf('__bq__start__', iPos); if (-1 < iP1) { iP2 = sText.indexOf('__bq__start__', iP1 + 5); iP3 = sText.indexOf('__bq__end__', iP1 + 5); if ((-1 === iP2 || iP3 < iP2) && iP1 < iP3) { sText = sText.substring(0, iP1) + convertBlockquote(sText.substring(iP1 + 13, iP3)) + sText.substring(iP3 + 11); iPos = 0; } else if (-1 < iP2 && iP2 < iP3) { iPos = iP2 - 1; } else { iPos = 0; } } else { break; } } sText = sText .replace(/__bq__start__/gm, '') .replace(/__bq__end__/gm, '') ; return sText; }; /** * @param {string} sPlain * @param {boolean} bFindEmailAndLinks = false * @return {string} */ Utils.plainToHtml = function (sPlain, bFindEmailAndLinks) { sPlain = sPlain.toString().replace(/\r/g, ''); bFindEmailAndLinks = Utils.isUnd(bFindEmailAndLinks) ? false : !!bFindEmailAndLinks; var bIn = false, bDo = true, bStart = true, aNextText = [], sLine = '', iIndex = 0, aText = sPlain.split("\n") ; do { bDo = false; aNextText = []; for (iIndex = 0; iIndex < aText.length; iIndex++) { sLine = aText[iIndex]; bStart = '>' === sLine.substr(0, 1); if (bStart && !bIn) { bDo = true; bIn = true; aNextText.push('~~~blockquote~~~'); aNextText.push(sLine.substr(1)); } else if (!bStart && bIn) { if ('' !== sLine) { bIn = false; aNextText.push('~~~/blockquote~~~'); aNextText.push(sLine); } else { aNextText.push(sLine); } } else if (bStart && bIn) { aNextText.push(sLine.substr(1)); } else { aNextText.push(sLine); } } if (bIn) { bIn = false; aNextText.push('~~~/blockquote~~~'); } aText = aNextText; } while (bDo); sPlain = aText.join("\n"); sPlain = sPlain // .replace(/~~~\/blockquote~~~\n~~~blockquote~~~/g, '\n') .replace(/&/g, '&') .replace(/>/g, '>').replace(/') .replace(/[\s]*~~~\/blockquote~~~/g, '') .replace(/\n/g, '
') ; return bFindEmailAndLinks ? Utils.findEmailAndLinks(sPlain) : sPlain; }; window.rainloop_Utils_htmlToPlain = Utils.htmlToPlain; window.rainloop_Utils_plainToHtml = Utils.plainToHtml; /** * @param {string} sHtml * @return {string} */ Utils.findEmailAndLinks = function (sHtml) { sHtml = Autolinker.link(sHtml, { 'newWindow': true, 'stripPrefix': false, 'urls': true, 'email': true, 'twitter': false, 'replaceFn': function (autolinker, match) { return !(autolinker && match && 'url' === match.getType() && match.matchedText && 0 !== match.matchedText.indexOf('http')); } }); return sHtml; }; /** * @param {string} sUrl * @param {number} iValue * @param {Function} fCallback */ Utils.resizeAndCrop = function (sUrl, iValue, fCallback) { var oTempImg = new window.Image(); oTempImg.onload = function() { var aDiff = [0, 0], oCanvas = window.document.createElement('canvas'), oCtx = oCanvas.getContext('2d') ; oCanvas.width = iValue; oCanvas.height = iValue; if (this.width > this.height) { aDiff = [this.width - this.height, 0]; } else { aDiff = [0, this.height - this.width]; } oCtx.fillStyle = '#fff'; oCtx.fillRect(0, 0, iValue, iValue); oCtx.drawImage(this, aDiff[0] / 2, aDiff[1] / 2, this.width - aDiff[0], this.height - aDiff[1], 0, 0, iValue, iValue); fCallback(oCanvas.toDataURL('image/jpeg')); }; oTempImg.src = sUrl; }; /** * @param {Array} aSystem * @param {Array} aList * @param {Array=} aDisabled * @param {Array=} aHeaderLines * @param {?number=} iUnDeep * @param {Function=} fDisableCallback * @param {Function=} fVisibleCallback * @param {Function=} fRenameCallback * @param {boolean=} bSystem * @param {boolean=} bBuildUnvisible * @return {Array} */ Utils.folderListOptionsBuilder = function (aSystem, aList, aDisabled, aHeaderLines, iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible) { var /** * @type {?FolderModel} */ oItem = null, bSep = false, iIndex = 0, iLen = 0, sDeepPrefix = '\u00A0\u00A0\u00A0', aResult = [] ; bBuildUnvisible = Utils.isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible; bSystem = !Utils.isNormal(bSystem) ? 0 < aSystem.length : bSystem; iUnDeep = !Utils.isNormal(iUnDeep) ? 0 : iUnDeep; fDisableCallback = Utils.isNormal(fDisableCallback) ? fDisableCallback : null; fVisibleCallback = Utils.isNormal(fVisibleCallback) ? fVisibleCallback : null; fRenameCallback = Utils.isNormal(fRenameCallback) ? fRenameCallback : null; if (!Utils.isArray(aDisabled)) { aDisabled = []; } if (!Utils.isArray(aHeaderLines)) { aHeaderLines = []; } for (iIndex = 0, iLen = aHeaderLines.length; iIndex < iLen; iIndex++) { aResult.push({ 'id': aHeaderLines[iIndex][0], 'name': aHeaderLines[iIndex][1], 'system': false, 'seporator': false, 'disabled': false }); } bSep = true; for (iIndex = 0, iLen = aSystem.length; iIndex < iLen; iIndex++) { oItem = aSystem[iIndex]; if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true) { if (bSep && 0 < aResult.length) { aResult.push({ 'id': '---', 'name': '---', 'system': false, 'seporator': true, 'disabled': true }); } bSep = false; aResult.push({ 'id': oItem.fullNameRaw, 'name': fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name(), 'system': true, 'seporator': false, 'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) || (fDisableCallback ? fDisableCallback.call(null, oItem) : false) }); } } bSep = true; for (iIndex = 0, iLen = aList.length; iIndex < iLen; iIndex++) { oItem = aList[iIndex]; // if (oItem.subScribed() || !oItem.existen || bBuildUnvisible) if ((oItem.subScribed() || !oItem.existen || bBuildUnvisible) && (oItem.selectable || oItem.hasSubScribedSubfolders())) { if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true) { if (Enums.FolderType.User === oItem.type() || !bSystem || oItem.hasSubScribedSubfolders()) { if (bSep && 0 < aResult.length) { aResult.push({ 'id': '---', 'name': '---', 'system': false, 'seporator': true, 'disabled': true }); } bSep = false; aResult.push({ 'id': oItem.fullNameRaw, 'name': (new window.Array(oItem.deep + 1 - iUnDeep)).join(sDeepPrefix) + (fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name()), 'system': false, 'seporator': false, 'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) || (fDisableCallback ? fDisableCallback.call(null, oItem) : false) }); } } } if (oItem.subScribed() && 0 < oItem.subFolders().length) { aResult = aResult.concat(Utils.folderListOptionsBuilder([], oItem.subFolders(), aDisabled, [], iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)); } } return aResult; }; Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount) { return function() { var iPrev = 0, iNext = 0, iLimit = 2, aResult = [], iCurrentPage = koCurrentPage(), iPageCount = koPageCount(), /** * @param {number} iIndex * @param {boolean=} bPush = true * @param {string=} sCustomName = '' */ fAdd = function (iIndex, bPush, sCustomName) { var oData = { 'current': iIndex === iCurrentPage, 'name': Utils.isUnd(sCustomName) ? iIndex.toString() : sCustomName.toString(), 'custom': Utils.isUnd(sCustomName) ? false : true, 'title': Utils.isUnd(sCustomName) ? '' : iIndex.toString(), 'value': iIndex.toString() }; if (Utils.isUnd(bPush) ? true : !!bPush) { aResult.push(oData); } else { aResult.unshift(oData); } } ; if (1 < iPageCount || (0 < iPageCount && iPageCount < iCurrentPage)) // if (0 < iPageCount && 0 < iCurrentPage) { if (iPageCount < iCurrentPage) { fAdd(iPageCount); iPrev = iPageCount; iNext = iPageCount; } else { if (3 >= iCurrentPage || iPageCount - 2 <= iCurrentPage) { iLimit += 2; } fAdd(iCurrentPage); iPrev = iCurrentPage; iNext = iCurrentPage; } while (0 < iLimit) { iPrev -= 1; iNext += 1; if (0 < iPrev) { fAdd(iPrev, false); iLimit--; } if (iPageCount >= iNext) { fAdd(iNext, true); iLimit--; } else if (0 >= iPrev) { break; } } if (3 === iPrev) { fAdd(2, false); } else if (3 < iPrev) { fAdd(window.Math.round((iPrev - 1) / 2), false, '...'); } if (iPageCount - 2 === iNext) { fAdd(iPageCount - 1, true); } else if (iPageCount - 2 > iNext) { fAdd(window.Math.round((iPageCount + iNext) / 2), true, '...'); } // first and last if (1 < iPrev) { fAdd(1, false); } if (iPageCount > iNext) { fAdd(iPageCount, true); } } return aResult; }; }; Utils.selectElement = function (element) { var sel, range; if (window.getSelection) { sel = window.getSelection(); sel.removeAllRanges(); range = window.document.createRange(); range.selectNodeContents(element); sel.addRange(range); } else if (window.document.selection) { range = window.document.body.createTextRange(); range.moveToElementText(element); range.select(); } }; Utils.detectDropdownVisibility = _.debounce(function () { Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) { return oItem.hasClass('open'); })); }, 50); /** * @param {boolean=} bDelay = false */ Utils.triggerAutocompleteInputChange = function (bDelay) { var fFunc = function () { $('.checkAutocomplete').trigger('change'); }; if (Utils.isUnd(bDelay) ? false : !!bDelay) { _.delay(fFunc, 100); } else { fFunc(); } }; /** * @param {Object} oParams */ Utils.setHeadViewport = function (oParams) { var aContent = []; _.each(oParams, function (sKey, sValue) { aContent.push('' + sKey + '=' + sValue); }); $('#rl-head-viewport').attr('content', aContent.join(', ')); }; /** * @param {string} sFileName * @return {string} */ Utils.getFileExtension = function (sFileName) { sFileName = Utils.trim(sFileName).toLowerCase(); var sResult = sFileName.split('.').pop(); return (sResult === sFileName) ? '' : sResult; }; /** * @param {string} sFileName * @return {string} */ Utils.mimeContentType = function (sFileName) { var sExt = '', sResult = 'application/octet-stream' ; sFileName = Utils.trim(sFileName).toLowerCase(); if ('winmail.dat' === sFileName) { return 'application/ms-tnef'; } sExt = Utils.getFileExtension(sFileName); if (sExt && 0 < sExt.length && !Utils.isUnd(Mime[sExt])) { sResult = Mime[sExt]; } return sResult; }; /** * @param {mixed} mPropOrValue * @param {mixed} mValue */ Utils.disposeOne = function (mPropOrValue, mValue) { var mDisposable = mValue || mPropOrValue; if (mDisposable && typeof mDisposable.dispose === 'function') { mDisposable.dispose(); } }; /** * @param {Object} oObject */ Utils.disposeObject = function (oObject) { if (oObject) { if (Utils.isArray(oObject.disposables)) { _.each(oObject.disposables, Utils.disposeOne); } ko.utils.objectForEach(oObject, Utils.disposeOne); } }; /** * @param {Object|Array} mObjectOrObjects */ Utils.delegateRunOnDestroy = function (mObjectOrObjects) { if (mObjectOrObjects) { if (Utils.isArray(mObjectOrObjects)) { _.each(mObjectOrObjects, function (oItem) { Utils.delegateRunOnDestroy(oItem); }); } else if (mObjectOrObjects && mObjectOrObjects.onDestroy) { mObjectOrObjects.onDestroy(); } } }; Utils.__themeTimer = 0; Utils.__themeAjax = null; Utils.changeTheme = function (sValue, sHash, themeTrigger, Links) { var oThemeLink = $('#rlThemeLink'), oThemeStyle = $('#rlThemeStyle'), sUrl = oThemeLink.attr('href') ; if (!sUrl) { sUrl = oThemeStyle.attr('data-href'); } if (sUrl) { sUrl = sUrl.toString().replace(/\/-\/[^\/]+\/\-\//, '/-/' + sValue + '/-/'); sUrl = sUrl.toString().replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/'); sUrl = sUrl.toString().replace(/\/Hash\/[^\/]+\//, '/Hash/-/'); if ('Json/' !== sUrl.substring(sUrl.length - 5, sUrl.length)) { sUrl += 'Json/'; } window.clearTimeout(Utils.__themeTimer); themeTrigger(Enums.SaveSettingsStep.Animate); if (Utils.__themeAjax && Utils.__themeAjax.abort) { Utils.__themeAjax.abort(); } Utils.__themeAjax = $.ajax({ 'url': sUrl, 'dataType': 'json' }).done(function(aData) { if (aData && Utils.isArray(aData) && 2 === aData.length) { if (oThemeLink && oThemeLink[0] && (!oThemeStyle || !oThemeStyle[0])) { oThemeStyle = $(''); oThemeLink.after(oThemeStyle); oThemeLink.remove(); } if (oThemeStyle && oThemeStyle[0]) { oThemeStyle.attr('data-href', sUrl).attr('data-theme', aData[0]); if (oThemeStyle[0].styleSheet && !Utils.isUnd(oThemeStyle[0].styleSheet.cssText)) { oThemeStyle[0].styleSheet.cssText = aData[1]; } else { oThemeStyle.text(aData[1]); } } if (Links) { var $oBg = $('#rl-bg'); if (!sHash) { if ($oBg.data('backstretch')) { $oBg.backstretch('destroy').attr('style', ''); } } else { $oBg.backstretch(Links.publicLink(sHash), { 'fade': Globals.bAnimationSupported ? 1000 : 0, 'centeredX': true, 'centeredY': true }); } } themeTrigger(Enums.SaveSettingsStep.TrueResult); } }).always(function() { Utils.__themeTimer = window.setTimeout(function () { themeTrigger(Enums.SaveSettingsStep.Idle); }, 1000); Utils.__themeAjax = null; }); } }; module.exports = Utils; }()); /***/ }, /* 2 */ /*!***************************!*\ !*** external "window._" ***! \***************************/ /***/ function(module, exports, __webpack_require__) { module.exports = window._; /***/ }, /* 3 */ /*!****************************!*\ !*** ./dev/External/ko.js ***! \****************************/ /***/ function(module, exports, __webpack_require__) { (function (ko) { 'use strict'; var window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), fDisposalTooltipHelper = function (oElement, $oEl, oSubscription) { ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { if (oSubscription && oSubscription.dispose) { oSubscription.dispose(); } if ($oEl) { $oEl.off('click.koTooltip'); if ($oEl.tooltip) { $oEl.tooltip('destroy'); } } $oEl = null; }); } ; ko.bindingHandlers.tooltip = { 'init': function (oElement, fValueAccessor) { var $oEl = null, bi18n = true, sClass = '', sPlacement = '', oSubscription = null, Globals = __webpack_require__(/*! Common/Globals */ 8), Translator = __webpack_require__(/*! Common/Translator */ 7) ; if (!Globals.bMobileDevice) { $oEl = $(oElement); sClass = $oEl.data('tooltip-class') || ''; bi18n = 'on' === ($oEl.data('tooltip-i18n') || 'on'); sPlacement = $oEl.data('tooltip-placement') || 'top'; $oEl.tooltip({ 'delay': { 'show': 500, 'hide': 100 }, 'html': true, 'container': 'body', 'placement': sPlacement, 'trigger': 'hover', 'title': function () { var sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()(); return '' === sValue || $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : '' + (bi18n ? Translator.i18n(sValue) : sValue) + ''; } }).on('click.koTooltip', function () { $oEl.tooltip('hide'); }); oSubscription = Globals.tooltipTrigger.subscribe(function () { $oEl.tooltip('hide'); }); fDisposalTooltipHelper(oElement, $oEl, oSubscription); } } }; ko.bindingHandlers.tooltipForTest = { 'init': function (oElement) { var $oEl = $(oElement), oSubscription = null, Globals = __webpack_require__(/*! Common/Globals */ 8) ; $oEl.tooltip({ 'container': 'body', 'trigger': 'hover manual', 'title': function () { return $oEl.data('tooltip3-data') || ''; } }); $(window.document).on('click', function () { $oEl.tooltip('hide'); }); oSubscription = Globals.tooltipTrigger.subscribe(function () { $oEl.tooltip('hide'); }); fDisposalTooltipHelper(oElement, $oEl, oSubscription); }, 'update': function (oElement, fValueAccessor) { var sValue = ko.unwrap(fValueAccessor()); if ('' === sValue) { $(oElement).data('tooltip3-data', '').tooltip('hide'); } else { $(oElement).data('tooltip3-data', sValue); _.delay(function () { if ($(oElement).is(':visible')) { $(oElement).tooltip('show'); } }, 100); } } }; ko.bindingHandlers.registrateBootstrapDropdown = { 'init': function (oElement) { var Globals = __webpack_require__(/*! Common/Globals */ 8); if (Globals && Globals.aBootstrapDropdowns) { Globals.aBootstrapDropdowns.push($(oElement)); // ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { // // TODO // }); } } }; ko.bindingHandlers.openDropdownTrigger = { 'update': function (oElement, fValueAccessor) { if (ko.unwrap(fValueAccessor())) { var $oEl = $(oElement), Utils = __webpack_require__(/*! Common/Utils */ 1) ; if (!$oEl.hasClass('open')) { $oEl.find('.dropdown-toggle').dropdown('toggle'); Utils.detectDropdownVisibility(); } fValueAccessor()(false); } } }; ko.bindingHandlers.dropdownCloser = { 'init': function (oElement) { $(oElement).closest('.dropdown').on('click', '.e-item', function () { $(oElement).dropdown('toggle'); }); } }; ko.bindingHandlers.popover = { 'init': function (oElement, fValueAccessor) { $(oElement).popover(ko.unwrap(fValueAccessor())); ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { $(oElement).popover('destroy'); }); } }; ko.bindingHandlers.csstext = { 'init': function (oElement, fValueAccessor) { var Utils = __webpack_require__(/*! Common/Utils */ 1); if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText)) { oElement.styleSheet.cssText = ko.unwrap(fValueAccessor()); } else { $(oElement).text(ko.unwrap(fValueAccessor())); } }, 'update': function (oElement, fValueAccessor) { var Utils = __webpack_require__(/*! Common/Utils */ 1); if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText)) { oElement.styleSheet.cssText = ko.unwrap(fValueAccessor()); } else { $(oElement).text(ko.unwrap(fValueAccessor())); } } }; ko.bindingHandlers.resizecrop = { 'init': function (oElement) { $(oElement).addClass('resizecrop').resizecrop({ 'width': '100', 'height': '100', 'wrapperCSS': { 'border-radius': '10px' } }); }, 'update': function (oElement, fValueAccessor) { fValueAccessor()(); $(oElement).resizecrop({ 'width': '100', 'height': '100' }); } }; ko.bindingHandlers.onEnter = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { $(oElement).on('keypress.koOnEnter', function (oEvent) { if (oEvent && 13 === window.parseInt(oEvent.keyCode, 10)) { $(oElement).trigger('change'); fValueAccessor().call(oViewModel); } }); ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { $(oElement).off('keypress.koOnEnter'); }); } }; ko.bindingHandlers.onEsc = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { $(oElement).on('keypress.koOnEsc', function (oEvent) { if (oEvent && 27 === window.parseInt(oEvent.keyCode, 10)) { $(oElement).trigger('change'); fValueAccessor().call(oViewModel); } }); ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { $(oElement).off('keypress.koOnEsc'); }); } }; ko.bindingHandlers.clickOnTrue = { 'update': function (oElement, fValueAccessor) { if (ko.unwrap(fValueAccessor())) { $(oElement).click(); } } }; ko.bindingHandlers.modal = { 'init': function (oElement, fValueAccessor) { var Globals = __webpack_require__(/*! Common/Globals */ 8), Utils = __webpack_require__(/*! Common/Utils */ 1) ; $(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({ 'keyboard': false, 'show': ko.unwrap(fValueAccessor()) }) .on('shown.koModal', Utils.windowResizeCallback) .find('.close').on('click.koModal', function () { fValueAccessor()(false); }); ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { $(oElement) .off('shown.koModal') .find('.close') .off('click.koModal') ; }); }, 'update': function (oElement, fValueAccessor) { $(oElement).modal(ko.unwrap(fValueAccessor()) ? 'show' : 'hide'); } }; ko.bindingHandlers.i18nInit = { 'init': function (oElement) { __webpack_require__(/*! Common/Translator */ 7).i18nToNode(oElement); } }; ko.bindingHandlers.i18nUpdate = { 'update': function (oElement, fValueAccessor) { ko.unwrap(fValueAccessor()); __webpack_require__(/*! Common/Translator */ 7).i18nToNode(oElement); } }; ko.bindingHandlers.link = { 'update': function (oElement, fValueAccessor) { $(oElement).attr('href', ko.unwrap(fValueAccessor())); } }; ko.bindingHandlers.title = { 'update': function (oElement, fValueAccessor) { $(oElement).attr('title', ko.unwrap(fValueAccessor())); } }; ko.bindingHandlers.textF = { 'init': function (oElement, fValueAccessor) { $(oElement).text(ko.unwrap(fValueAccessor())); } }; ko.bindingHandlers.initDom = { 'init': function (oElement, fValueAccessor) { fValueAccessor()(oElement); } }; ko.bindingHandlers.initFixedTrigger = { 'init': function (oElement, fValueAccessor) { var aValues = ko.unwrap(fValueAccessor()), $oContainer = null, $oElement = $(oElement), oOffset = null, iTop = aValues[1] || 0 ; $oContainer = $(aValues[0] || null); $oContainer = $oContainer[0] ? $oContainer : null; if ($oContainer) { $(window).resize(function () { oOffset = $oContainer.offset(); if (oOffset && oOffset.top) { $oElement.css('top', oOffset.top + iTop); } }); } } }; ko.bindingHandlers.initResizeTrigger = { 'init': function (oElement, fValueAccessor) { var aValues = ko.unwrap(fValueAccessor()); $(oElement).css({ 'height': aValues[1], 'min-height': aValues[1] }); }, 'update': function (oElement, fValueAccessor) { var Utils = __webpack_require__(/*! Common/Utils */ 1), Globals = __webpack_require__(/*! Common/Globals */ 8), aValues = ko.unwrap(fValueAccessor()), iValue = Utils.pInt(aValues[1]), iSize = 0, iOffset = $(oElement).offset().top ; if (0 < iOffset) { iOffset += Utils.pInt(aValues[2]); iSize = Globals.$win.height() - iOffset; if (iValue < iSize) { iValue = iSize; } $(oElement).css({ 'height': iValue, 'min-height': iValue }); } } }; ko.bindingHandlers.appendDom = { 'update': function (oElement, fValueAccessor) { $(oElement).hide().empty().append(ko.unwrap(fValueAccessor())).show(); } }; ko.bindingHandlers.draggable = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) { var Globals = __webpack_require__(/*! Common/Globals */ 8), Utils = __webpack_require__(/*! Common/Utils */ 1) ; if (!Globals.bMobileDevice) { var iTriggerZone = 100, iScrollSpeed = 3, fAllValueFunc = fAllBindingsAccessor(), sDroppableSelector = fAllValueFunc && fAllValueFunc['droppableSelector'] ? fAllValueFunc['droppableSelector'] : '', oConf = { 'distance': 20, 'handle': '.dragHandle', 'cursorAt': {'top': 22, 'left': 3}, 'refreshPositions': true, 'scroll': true } ; if (sDroppableSelector) { oConf['drag'] = function (oEvent) { $(sDroppableSelector).each(function () { var moveUp = null, moveDown = null, $this = $(this), oOffset = $this.offset(), bottomPos = oOffset.top + $this.height() ; window.clearInterval($this.data('timerScroll')); $this.data('timerScroll', false); if (oEvent.pageX >= oOffset.left && oEvent.pageX <= oOffset.left + $this.width()) { if (oEvent.pageY >= bottomPos - iTriggerZone && oEvent.pageY <= bottomPos) { moveUp = function() { $this.scrollTop($this.scrollTop() + iScrollSpeed); Utils.windowResize(); }; $this.data('timerScroll', window.setInterval(moveUp, 10)); moveUp(); } if (oEvent.pageY >= oOffset.top && oEvent.pageY <= oOffset.top + iTriggerZone) { moveDown = function() { $this.scrollTop($this.scrollTop() - iScrollSpeed); Utils.windowResize(); }; $this.data('timerScroll', window.setInterval(moveDown, 10)); moveDown(); } } }); }; oConf['stop'] = function() { $(sDroppableSelector).each(function () { window.clearInterval($(this).data('timerScroll')); $(this).data('timerScroll', false); }); }; } oConf['helper'] = function (oEvent) { return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null); }; $(oElement).draggable(oConf).on('mousedown.koDraggable', function () { Utils.removeInFocus(); }); ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { $(oElement) .off('mousedown.koDraggable') .draggable('destroy') ; }); } } }; ko.bindingHandlers.droppable = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) { var Globals = __webpack_require__(/*! Common/Globals */ 8); if (!Globals.bMobileDevice) { var fValueFunc = fValueAccessor(), fAllValueFunc = fAllBindingsAccessor(), fOverCallback = fAllValueFunc && fAllValueFunc['droppableOver'] ? fAllValueFunc['droppableOver'] : null, fOutCallback = fAllValueFunc && fAllValueFunc['droppableOut'] ? fAllValueFunc['droppableOut'] : null, oConf = { 'tolerance': 'pointer', 'hoverClass': 'droppableHover' } ; if (fValueFunc) { oConf['drop'] = function (oEvent, oUi) { fValueFunc(oEvent, oUi); }; if (fOverCallback) { oConf['over'] = function (oEvent, oUi) { fOverCallback(oEvent, oUi); }; } if (fOutCallback) { oConf['out'] = function (oEvent, oUi) { fOutCallback(oEvent, oUi); }; } $(oElement).droppable(oConf); ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () { $(oElement).droppable('destroy'); }); } } } }; ko.bindingHandlers.nano = { 'init': function (oElement) { var Globals = __webpack_require__(/*! Common/Globals */ 8); if (!Globals.bDisableNanoScroll) { $(oElement) .addClass('nano') .nanoScroller({ 'iOSNativeScrolling': false, 'preventPageScrolling': true }) ; } } }; ko.bindingHandlers.saveTrigger = { 'init': function (oElement) { var $oEl = $(oElement); $oEl.data('save-trigger-type', $oEl.is('input[type=text],input[type=email],input[type=password],select,textarea') ? 'input' : 'custom'); if ('custom' === $oEl.data('save-trigger-type')) { $oEl.append( '  ' ).addClass('settings-saved-trigger'); } else { $oEl.addClass('settings-saved-trigger-input'); } }, 'update': function (oElement, fValueAccessor) { var mValue = ko.unwrap(fValueAccessor()), $oEl = $(oElement) ; if ('custom' === $oEl.data('save-trigger-type')) { switch (mValue.toString()) { case '1': $oEl .find('.animated,.error').hide().removeClass('visible') .end() .find('.success').show().addClass('visible') ; break; case '0': $oEl .find('.animated,.success').hide().removeClass('visible') .end() .find('.error').show().addClass('visible') ; break; case '-2': $oEl .find('.error,.success').hide().removeClass('visible') .end() .find('.animated').show().addClass('visible') ; break; default: $oEl .find('.animated').hide() .end() .find('.error,.success').removeClass('visible') ; break; } } else { switch (mValue.toString()) { case '1': $oEl.addClass('success').removeClass('error'); break; case '0': $oEl.addClass('error').removeClass('success'); break; case '-2': // $oEl; break; default: $oEl.removeClass('error success'); break; } } } }; ko.bindingHandlers.emailsTags = { 'init': function(oElement, fValueAccessor, fAllBindingsAccessor) { var Utils = __webpack_require__(/*! Common/Utils */ 1), EmailModel = __webpack_require__(/*! Model/Email */ 25), $oEl = $(oElement), fValue = fValueAccessor(), fAllBindings = fAllBindingsAccessor(), fAutoCompleteSource = fAllBindings['autoCompleteSource'] || null, fFocusCallback = function (bValue) { if (fValue && fValue.focusTrigger) { fValue.focusTrigger(bValue); } } ; $oEl.inputosaurus({ 'parseOnBlur': true, 'allowDragAndDrop': true, 'focusCallback': fFocusCallback, 'inputDelimiters': [',', ';'], 'autoCompleteSource': fAutoCompleteSource, 'parseHook': function (aInput) { return _.map(aInput, function (sInputValue) { var sValue = Utils.trim(sInputValue), oEmail = null ; if ('' !== sValue) { oEmail = new EmailModel(); oEmail.mailsoParse(sValue); return [oEmail.toLine(false), oEmail]; } return [sValue, null]; }); }, 'change': _.bind(function (oEvent) { $oEl.data('EmailsTagsValue', oEvent.target.value); fValue(oEvent.target.value); }, this) }); }, 'update': function (oElement, fValueAccessor, fAllBindingsAccessor) { var $oEl = $(oElement), fAllValueFunc = fAllBindingsAccessor(), fEmailsTagsFilter = fAllValueFunc['emailsTagsFilter'] || null, sValue = ko.unwrap(fValueAccessor()) ; if ($oEl.data('EmailsTagsValue') !== sValue) { $oEl.val(sValue); $oEl.data('EmailsTagsValue', sValue); $oEl.inputosaurus('refresh'); } if (fEmailsTagsFilter && ko.unwrap(fEmailsTagsFilter)) { $oEl.inputosaurus('focus'); } } }; ko.bindingHandlers.command = { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { var jqElement = $(oElement), oCommand = fValueAccessor() ; if (!oCommand || !oCommand.enabled || !oCommand.canExecute) { throw new Error('You are not using command function'); } jqElement.addClass('command'); ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments); }, 'update': function (oElement, fValueAccessor) { var bResult = true, jqElement = $(oElement), oCommand = fValueAccessor() ; bResult = oCommand.enabled(); jqElement.toggleClass('command-not-enabled', !bResult); if (bResult) { bResult = oCommand.canExecute(); jqElement.toggleClass('command-can-not-be-execute', !bResult); } jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult); if (jqElement.is('input') || jqElement.is('button')) { jqElement.prop('disabled', !bResult); } } }; // extenders ko.extenders.trimmer = function (oTarget) { var Utils = __webpack_require__(/*! Common/Utils */ 1), oResult = ko.computed({ 'read': oTarget, 'write': function (sNewValue) { oTarget(Utils.trim(sNewValue.toString())); }, 'owner': this }) ; oResult(oTarget()); return oResult; }; ko.extenders.posInterer = function (oTarget, iDefault) { var Utils = __webpack_require__(/*! Common/Utils */ 1), oResult = ko.computed({ 'read': oTarget, 'write': function (sNewValue) { var iNew = Utils.pInt(sNewValue.toString(), iDefault); if (0 >= iNew) { iNew = iDefault; } if (iNew === oTarget() && '' + iNew !== '' + sNewValue) { oTarget(iNew + 1); } oTarget(iNew); } }) ; oResult(oTarget()); return oResult; }; ko.extenders.limitedList = function (oTarget, mList) { var Utils = __webpack_require__(/*! Common/Utils */ 1), oResult = ko.computed({ 'read': oTarget, 'write': function (sNewValue) { var sCurrentValue = ko.unwrap(oTarget), aList = ko.unwrap(mList) ; if (Utils.isNonEmptyArray(aList)) { if (-1 < Utils.inArray(sNewValue, aList)) { oTarget(sNewValue); } else if (-1 < Utils.inArray(sCurrentValue, aList)) { oTarget(sCurrentValue + ' '); oTarget(sCurrentValue); } else { oTarget(aList[0] + ' '); oTarget(aList[0]); } } else { oTarget(''); } } }).extend({'notify': 'always'}) ; oResult(oTarget()); if (!oResult.valueHasMutated) { oResult.valueHasMutated = function () { oTarget.valueHasMutated(); }; } return oResult; }; ko.extenders.reversible = function (oTarget) { var mValue = oTarget(); oTarget.commit = function () { mValue = oTarget(); }; oTarget.reverse = function () { oTarget(mValue); }; oTarget.commitedValue = function () { return mValue; }; return oTarget; }; ko.extenders.toggleSubscribe = function (oTarget, oOptions) { oTarget.subscribe(oOptions[1], oOptions[0], 'beforeChange'); oTarget.subscribe(oOptions[2], oOptions[0]); return oTarget; }; ko.extenders.toggleSubscribeProperty = function (oTarget, oOptions) { var sProp = oOptions[1]; if (sProp) { oTarget.subscribe(function (oPrev) { if (oPrev && oPrev[sProp]) { oPrev[sProp](false); } }, oOptions[0], 'beforeChange'); oTarget.subscribe(function (oNext) { if (oNext && oNext[sProp]) { oNext[sProp](true); } }, oOptions[0]); } return oTarget; }; ko.extenders.falseTimeout = function (oTarget, iOption) { var Utils = __webpack_require__(/*! Common/Utils */ 1); oTarget.iTimeout = 0; oTarget.subscribe(function (bValue) { if (bValue) { window.clearTimeout(oTarget.iTimeout); oTarget.iTimeout = window.setTimeout(function () { oTarget(false); oTarget.iTimeout = 0; }, Utils.pInt(iOption)); } }); return oTarget; }; // functions ko.observable.fn.validateNone = function () { this.hasError = ko.observable(false); return this; }; ko.observable.fn.validateEmail = function () { var Utils = __webpack_require__(/*! Common/Utils */ 1); this.hasError = ko.observable(false); this.subscribe(function (sValue) { sValue = Utils.trim(sValue); this.hasError('' !== sValue && !(/^[^@\s]+@[^@\s]+$/.test(sValue))); }, this); this.valueHasMutated(); return this; }; ko.observable.fn.validateSimpleEmail = function () { var Utils = __webpack_require__(/*! Common/Utils */ 1); this.hasError = ko.observable(false); this.subscribe(function (sValue) { sValue = Utils.trim(sValue); this.hasError('' !== sValue && !(/^.+@.+$/.test(sValue))); }, this); this.valueHasMutated(); return this; }; ko.observable.fn.validateFunc = function (fFunc) { var Utils = __webpack_require__(/*! Common/Utils */ 1); this.hasFuncError = ko.observable(false); if (Utils.isFunc(fFunc)) { this.subscribe(function (sValue) { this.hasFuncError(!fFunc(sValue)); }, this); this.valueHasMutated(); } return this; }; module.exports = ko; }(ko)); /***/ }, /* 4 */ /*!*****************************!*\ !*** ./dev/Common/Enums.js ***! \*****************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var Enums = {}; /** * @enum {string} */ Enums.StorageResultType = { 'Success': 'success', 'Abort': 'abort', 'Error': 'error', 'Unload': 'unload' }; /** * @enum {number} */ Enums.State = { 'Empty': 10, 'Login': 20, 'Auth': 30 }; /** * @enum {number} */ Enums.StateType = { 'Webmail': 0, 'Admin': 1 }; /** * @enum {string} */ Enums.Capa = { 'TwoFactor': 'TWO_FACTOR', 'OpenPGP': 'OPEN_PGP', 'Prefetch': 'PREFETCH', 'Gravatar': 'GRAVATAR', 'Themes': 'THEMES', 'UserBackground': 'USER_BACKGROUND', 'Sieve': 'SIEVE', 'AttachmentThumbnails': 'ATTACHMENT_THUMBNAILS', 'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS', 'AdditionalIdentities': 'ADDITIONAL_IDENTITIES' }; /** * @enum {string} */ Enums.KeyState = { 'All': 'all', 'None': 'none', 'ContactList': 'contact-list', 'MessageList': 'message-list', 'FolderList': 'folder-list', 'MessageView': 'message-view', 'Compose': 'compose', 'Settings': 'settings', 'Menu': 'menu', 'PopupComposeOpenPGP': 'compose-open-pgp', 'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help', 'PopupAsk': 'popup-ask' }; /** * @enum {number} */ Enums.FolderType = { 'Inbox': 10, 'SentItems': 11, 'Draft': 12, 'Trash': 13, 'Spam': 14, 'Archive': 15, 'NotSpam': 80, 'User': 99 }; /** * @enum {string} */ Enums.LoginSignMeTypeAsString = { 'DefaultOff': 'defaultoff', 'DefaultOn': 'defaulton', 'Unused': 'unused' }; /** * @enum {number} */ Enums.LoginSignMeType = { 'DefaultOff': 0, 'DefaultOn': 1, 'Unused': 2 }; /** * @enum {string} */ Enums.ComposeType = { 'Empty': 'empty', 'Reply': 'reply', 'ReplyAll': 'replyall', 'Forward': 'forward', 'ForwardAsAttachment': 'forward-as-attachment', 'Draft': 'draft', 'EditAsNew': 'editasnew' }; /** * @enum {number} */ Enums.UploadErrorCode = { 'Normal': 0, 'FileIsTooBig': 1, 'FilePartiallyUploaded': 2, 'FileNoUploaded': 3, 'MissingTempFolder': 4, 'FileOnSaveingError': 5, 'FileType': 98, 'Unknown': 99 }; /** * @enum {number} */ Enums.SetSystemFoldersNotification = { 'None': 0, 'Sent': 1, 'Draft': 2, 'Spam': 3, 'Trash': 4, 'Archive': 5 }; /** * @enum {number} */ Enums.ClientSideKeyName = { 'FoldersLashHash': 0, 'MessagesInboxLastHash': 1, 'MailBoxListSize': 2, 'ExpandedFolders': 3, 'FolderListSize': 4, 'MessageListSize': 5, 'LastReplyAction': 6 }; /** * @enum {number} */ Enums.EventKeyCode = { 'Backspace': 8, 'Tab': 9, 'Enter': 13, 'Esc': 27, 'PageUp': 33, 'PageDown': 34, 'Left': 37, 'Right': 39, 'Up': 38, 'Down': 40, 'End': 35, 'Home': 36, 'Space': 32, 'Insert': 45, 'Delete': 46, 'A': 65, 'S': 83 }; /** * @enum {number} */ Enums.MessageSetAction = { 'SetSeen': 0, 'UnsetSeen': 1, 'SetFlag': 2, 'UnsetFlag': 3 }; /** * @enum {number} */ Enums.MessageSelectAction = { 'All': 0, 'None': 1, 'Invert': 2, 'Unseen': 3, 'Seen': 4, 'Flagged': 5, 'Unflagged': 6 }; /** * @enum {number} */ Enums.DesktopNotification = { 'Allowed': 0, 'NotAllowed': 1, 'Denied': 2, 'NotSupported': 9 }; /** * @enum {number} */ Enums.MessagePriority = { 'Low': 5, 'Normal': 3, 'High': 1 }; /** * @enum {string} */ Enums.EditorDefaultType = { 'Html': 'Html', 'Plain': 'Plain', 'HtmlForced': 'HtmlForced', 'PlainForced': 'PlainForced' }; /** * @enum {number} */ Enums.ServerSecure = { 'None': 0, 'SSL': 1, 'TLS': 2 }; /** * @enum {number} */ Enums.SearchDateType = { 'All': -1, 'Days3': 3, 'Days7': 7, 'Month': 30 }; /** * @enum {number} */ Enums.SaveSettingsStep = { 'Animate': -2, 'Idle': -1, 'TrueResult': 1, 'FalseResult': 0 }; /** * @enum {number} */ Enums.Layout = { 'NoPreview': 0, 'SidePreview': 1, 'BottomPreview': 2 }; /** * @enum {string} */ Enums.FilterConditionField = { 'From': 'From', 'Recipient': 'Recipient', 'Subject': 'Subject' }; /** * @enum {string} */ Enums.FilterConditionType = { 'Contains': 'Contains', 'NotContains': 'NotContains', 'EqualTo': 'EqualTo', 'NotEqualTo': 'NotEqualTo' }; /** * @enum {string} */ Enums.FiltersAction = { 'None': 'None', 'MoveTo': 'MoveTo', 'Discard': 'Discard', 'Vacation': 'Vacation', 'Reject': 'Reject', 'Forward': 'Forward' }; /** * @enum {string} */ Enums.FilterRulesType = { 'All': 'All', 'Any': 'Any' }; /** * @enum {number} */ Enums.SignedVerifyStatus = { 'UnknownPublicKeys': -4, 'UnknownPrivateKey': -3, 'Unverified': -2, 'Error': -1, 'None': 0, 'Success': 1 }; /** * @enum {number} */ Enums.ContactPropertyType = { 'Unknown': 0, 'FullName': 10, 'FirstName': 15, 'LastName': 16, 'MiddleName': 16, 'Nick': 18, 'NamePrefix': 20, 'NameSuffix': 21, 'Email': 30, 'Phone': 31, 'Web': 32, 'Birthday': 40, 'Facebook': 90, 'Skype': 91, 'GitHub': 92, 'Note': 110, 'Custom': 250 }; /** * @enum {number} */ Enums.Notification = { 'InvalidToken': 101, 'AuthError': 102, 'AccessError': 103, 'ConnectionError': 104, 'CaptchaError': 105, 'SocialFacebookLoginAccessDisable': 106, 'SocialTwitterLoginAccessDisable': 107, 'SocialGoogleLoginAccessDisable': 108, 'DomainNotAllowed': 109, 'AccountNotAllowed': 110, 'AccountTwoFactorAuthRequired': 120, 'AccountTwoFactorAuthError': 121, 'CouldNotSaveNewPassword': 130, 'CurrentPasswordIncorrect': 131, 'NewPasswordShort': 132, 'NewPasswordWeak': 133, 'NewPasswordForbidden': 134, 'ContactsSyncError': 140, 'CantGetMessageList': 201, 'CantGetMessage': 202, 'CantDeleteMessage': 203, 'CantMoveMessage': 204, 'CantCopyMessage': 205, 'CantSaveMessage': 301, 'CantSendMessage': 302, 'InvalidRecipients': 303, 'CantSaveFilters': 351, 'CantGetFilters': 352, 'FiltersAreNotCorrect': 355, 'CantCreateFolder': 400, 'CantRenameFolder': 401, 'CantDeleteFolder': 402, 'CantSubscribeFolder': 403, 'CantUnsubscribeFolder': 404, 'CantDeleteNonEmptyFolder': 405, 'CantSaveSettings': 501, 'CantSavePluginSettings': 502, 'DomainAlreadyExists': 601, 'CantInstallPackage': 701, 'CantDeletePackage': 702, 'InvalidPluginPackage': 703, 'UnsupportedPluginPackage': 704, 'LicensingServerIsUnavailable': 710, 'LicensingExpired': 711, 'LicensingBanned': 712, 'DemoSendMessageError': 750, 'DemoAccountError': 751, 'AccountAlreadyExists': 801, 'AccountDoesNotExist': 802, 'MailServerError': 901, 'ClientViewError': 902, 'InvalidInputArgument': 903, 'UnknownNotification': 999, 'UnknownError': 999 }; module.exports = Enums; }()); /***/ }, /* 5 */ /*!****************************!*\ !*** ./dev/Knoin/Knoin.js ***! \****************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), ko = __webpack_require__(/*! ko */ 3), hasher = __webpack_require__(/*! hasher */ 76), crossroads = __webpack_require__(/*! crossroads */ 41), Globals = __webpack_require__(/*! Common/Globals */ 8), Plugins = __webpack_require__(/*! Common/Plugins */ 23), Utils = __webpack_require__(/*! Common/Utils */ 1) ; /** * @constructor */ function Knoin() { this.oScreens = {}; this.sDefaultScreenName = ''; this.oCurrentScreen = null; } Knoin.prototype.oScreens = {}; Knoin.prototype.sDefaultScreenName = ''; Knoin.prototype.oCurrentScreen = null; Knoin.prototype.hideLoading = function () { $('#rl-loading').hide(); }; /** * @param {Object} thisObject */ Knoin.prototype.constructorEnd = function (thisObject) { if (Utils.isFunc(thisObject['__constructor_end'])) { thisObject['__constructor_end'].call(thisObject); } }; /** * @param {string|Array} mName * @param {Function} ViewModelClass */ Knoin.prototype.extendAsViewModel = function (mName, ViewModelClass) { if (ViewModelClass) { if (Utils.isArray(mName)) { ViewModelClass.__names = mName; } else { ViewModelClass.__names = [mName]; } ViewModelClass.__name = ViewModelClass.__names[0]; } }; /** * @param {Function} SettingsViewModelClass * @param {string} sLabelName * @param {string} sTemplate * @param {string} sRoute * @param {boolean=} bDefault */ Knoin.prototype.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabelName, sRoute, bDefault) { SettingsViewModelClass.__rlSettingsData = { 'Label': sLabelName, 'Template': sTemplate, 'Route': sRoute, 'IsDefault': !!bDefault }; Globals.aViewModels['settings'].push(SettingsViewModelClass); }; /** * @param {Function} SettingsViewModelClass */ Knoin.prototype.removeSettingsViewModel = function (SettingsViewModelClass) { Globals.aViewModels['settings-removed'].push(SettingsViewModelClass); }; /** * @param {Function} SettingsViewModelClass */ Knoin.prototype.disableSettingsViewModel = function (SettingsViewModelClass) { Globals.aViewModels['settings-disabled'].push(SettingsViewModelClass); }; Knoin.prototype.routeOff = function () { hasher.changed.active = false; }; Knoin.prototype.routeOn = function () { hasher.changed.active = true; }; /** * @param {string} sScreenName * @return {?Object} */ Knoin.prototype.screen = function (sScreenName) { return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null; }; /** * @param {Function} ViewModelClass * @param {Object=} oScreen */ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen) { if (ViewModelClass && !ViewModelClass.__builded) { var kn = this, oViewModel = new ViewModelClass(oScreen), sPosition = oViewModel.viewModelPosition(), oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()), oViewModelDom = null ; ViewModelClass.__builded = true; ViewModelClass.__vm = oViewModel; oViewModel.onShowTrigger = ko.observable(false); oViewModel.onHideTrigger = ko.observable(false); oViewModel.viewModelName = ViewModelClass.__name; oViewModel.viewModelNames = ViewModelClass.__names; if (oViewModelPlace && 1 === oViewModelPlace.length) { oViewModelDom = $('
').addClass('rl-view-model').addClass('RL-' + oViewModel.viewModelTemplate()).hide(); oViewModelDom.appendTo(oViewModelPlace); oViewModel.viewModelDom = oViewModelDom; ViewModelClass.__dom = oViewModelDom; if ('Popups' === sPosition) { oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () { kn.hideScreenPopup(ViewModelClass); }); oViewModel.modalVisibility.subscribe(function (bValue) { var self = this; if (bValue) { this.viewModelDom.show(); this.storeAndSetKeyScope(); Globals.popupVisibilityNames.push(this.viewModelName); oViewModel.viewModelDom.css('z-index', 3000 + Globals.popupVisibilityNames().length + 10); Utils.delegateRun(this, 'onFocus', [], 500); } else { Utils.delegateRun(this, 'onHide'); if (this.onHideTrigger) { this.onHideTrigger(!this.onHideTrigger()); } this.restoreKeyScope(); _.each(this.viewModelNames, function (sName) { Plugins.runHook('view-model-on-hide', [sName, self]); }); Globals.popupVisibilityNames.remove(this.viewModelName); oViewModel.viewModelDom.css('z-index', 2000); Globals.tooltipTrigger(!Globals.tooltipTrigger()); _.delay(function () { self.viewModelDom.hide(); }, 300); } }, oViewModel); } _.each(ViewModelClass.__names, function (sName) { Plugins.runHook('view-model-pre-build', [sName, oViewModel, oViewModelDom]); }); ko.applyBindingAccessorsToNode(oViewModelDom[0], { 'i18nInit': true, 'template': function () { return {'name': oViewModel.viewModelTemplate()};} }, oViewModel); Utils.delegateRun(oViewModel, 'onBuild', [oViewModelDom]); if (oViewModel && 'Popups' === sPosition) { oViewModel.registerPopupKeyDown(); } _.each(ViewModelClass.__names, function (sName) { Plugins.runHook('view-model-post-build', [sName, oViewModel, oViewModelDom]); }); } else { Utils.log('Cannot find view model position: ' + sPosition); } } return ViewModelClass ? ViewModelClass.__vm : null; }; /** * @param {Function} ViewModelClassToHide */ Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide) { if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) { ViewModelClassToHide.__vm.modalVisibility(false); } }; /** * @param {Function} ViewModelClassToShow * @param {Array=} aParameters */ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters) { if (ViewModelClassToShow) { this.buildViewModel(ViewModelClassToShow); if (ViewModelClassToShow.__vm && ViewModelClassToShow.__dom) { ViewModelClassToShow.__vm.modalVisibility(true); Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []); if (ViewModelClassToShow.__vm.onShowTrigger) { ViewModelClassToShow.__vm.onShowTrigger(!ViewModelClassToShow.__vm.onShowTrigger()); } _.each(ViewModelClassToShow.__names, function (sName) { Plugins.runHook('view-model-on-show', [sName, ViewModelClassToShow.__vm, aParameters || []]); }); } } }; /** * @param {Function} ViewModelClassToShow * @return {boolean} */ Knoin.prototype.isPopupVisible = function (ViewModelClassToShow) { return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false; }; /** * @param {string} sScreenName * @param {string} sSubPart */ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart) { var self = this, oScreen = null, oCross = null ; if ('' === Utils.pString(sScreenName)) { sScreenName = this.sDefaultScreenName; } if ('' !== sScreenName) { oScreen = this.screen(sScreenName); if (!oScreen) { oScreen = this.screen(this.sDefaultScreenName); if (oScreen) { sSubPart = sScreenName + '/' + sSubPart; sScreenName = this.sDefaultScreenName; } } if (oScreen && oScreen.__started) { if (!oScreen.__builded) { oScreen.__builded = true; if (Utils.isNonEmptyArray(oScreen.viewModels())) { _.each(oScreen.viewModels(), function (ViewModelClass) { this.buildViewModel(ViewModelClass, oScreen); }, this); } Utils.delegateRun(oScreen, 'onBuild'); } _.defer(function () { // hide screen if (self.oCurrentScreen) { Utils.delegateRun(self.oCurrentScreen, 'onHide'); if (self.oCurrentScreen.onHideTrigger) { self.oCurrentScreen.onHideTrigger(!self.oCurrentScreen.onHideTrigger()); } if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels())) { _.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) { if (ViewModelClass.__vm && ViewModelClass.__dom && 'Popups' !== ViewModelClass.__vm.viewModelPosition()) { ViewModelClass.__dom.hide(); ViewModelClass.__vm.viewModelVisibility(false); Utils.delegateRun(ViewModelClass.__vm, 'onHide'); if (ViewModelClass.__vm.onHideTrigger) { ViewModelClass.__vm.onHideTrigger(!ViewModelClass.__vm.onHideTrigger()); } } }); } } // -- self.oCurrentScreen = oScreen; // show screen if (self.oCurrentScreen) { Utils.delegateRun(self.oCurrentScreen, 'onShow'); if (self.oCurrentScreen.onShowTrigger) { self.oCurrentScreen.onShowTrigger(!self.oCurrentScreen.onShowTrigger()); } Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]); if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels())) { _.each(self.oCurrentScreen.viewModels(), function (ViewModelClass) { if (ViewModelClass.__vm && ViewModelClass.__dom && 'Popups' !== ViewModelClass.__vm.viewModelPosition()) { ViewModelClass.__dom.show(); ViewModelClass.__vm.viewModelVisibility(true); Utils.delegateRun(ViewModelClass.__vm, 'onShow'); if (ViewModelClass.__vm.onShowTrigger) { ViewModelClass.__vm.onShowTrigger(!ViewModelClass.__vm.onShowTrigger()); } Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200); _.each(ViewModelClass.__names, function (sName) { Plugins.runHook('view-model-on-show', [sName, ViewModelClass.__vm]); }); } }, self); } } // -- oCross = oScreen.__cross ? oScreen.__cross() : null; if (oCross) { oCross.parse(sSubPart); } }); } } }; /** * @param {Array} aScreensClasses */ Knoin.prototype.startScreens = function (aScreensClasses) { $('#rl-content').css({ 'visibility': 'hidden' }); _.each(aScreensClasses, function (CScreen) { var oScreen = new CScreen(), sScreenName = oScreen ? oScreen.screenName() : '' ; if (oScreen && '' !== sScreenName) { if ('' === this.sDefaultScreenName) { this.sDefaultScreenName = sScreenName; } this.oScreens[sScreenName] = oScreen; } }, this); _.each(this.oScreens, function (oScreen) { if (oScreen && !oScreen.__started && oScreen.__start) { oScreen.__started = true; oScreen.__start(); Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]); Utils.delegateRun(oScreen, 'onStart'); Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]); } }, this); var oCross = crossroads.create(); oCross.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/, _.bind(this.screenOnRoute, this)); hasher.initialized.add(oCross.parse, oCross); hasher.changed.add(oCross.parse, oCross); hasher.init(); $('#rl-content').css({ 'visibility': 'visible' }); _.delay(function () { Globals.$html.removeClass('rl-started-trigger').addClass('rl-started'); }, 50); _.delay(function () { Globals.$html.addClass('rl-started-delay'); }, 200); }; /** * @param {string} sHash * @param {boolean=} bSilence = false * @param {boolean=} bReplace = false */ Knoin.prototype.setHash = function (sHash, bSilence, bReplace) { sHash = '#' === sHash.substr(0, 1) ? sHash.substr(1) : sHash; sHash = '/' === sHash.substr(0, 1) ? sHash.substr(1) : sHash; bReplace = Utils.isUnd(bReplace) ? false : !!bReplace; if (Utils.isUnd(bSilence) ? false : !!bSilence) { hasher.changed.active = false; hasher[bReplace ? 'replaceHash' : 'setHash'](sHash); hasher.changed.active = true; } else { hasher.changed.active = true; hasher[bReplace ? 'replaceHash' : 'setHash'](sHash); hasher.setHash(sHash); } }; module.exports = new Knoin(); }()); /***/ }, /* 6 */ /*!*************************!*\ !*** ./dev/App/User.js ***! \*************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), moment = __webpack_require__(/*! moment */ 36), SimplePace = __webpack_require__(/*! SimplePace */ 75), Enums = __webpack_require__(/*! Common/Enums */ 4), Globals = __webpack_require__(/*! Common/Globals */ 8), Consts = __webpack_require__(/*! Common/Consts */ 16), Plugins = __webpack_require__(/*! Common/Plugins */ 23), Utils = __webpack_require__(/*! Common/Utils */ 1), Links = __webpack_require__(/*! Common/Links */ 12), Events = __webpack_require__(/*! Common/Events */ 28), Translator = __webpack_require__(/*! Common/Translator */ 7), kn = __webpack_require__(/*! Knoin/Knoin */ 5), SocialStore = __webpack_require__(/*! Stores/Social */ 35), AppStore = __webpack_require__(/*! Stores/User/App */ 30), SettingsStore = __webpack_require__(/*! Stores/User/Settings */ 26), AccountStore = __webpack_require__(/*! Stores/User/Account */ 22), IdentityStore = __webpack_require__(/*! Stores/User/Identity */ 43), FolderStore = __webpack_require__(/*! Stores/User/Folder */ 32), PgpStore = __webpack_require__(/*! Stores/User/Pgp */ 20), Local = __webpack_require__(/*! Storage/Client */ 60), Settings = __webpack_require__(/*! Storage/Settings */ 9), Data = __webpack_require__(/*! Storage/User/Data */ 15), Cache = __webpack_require__(/*! Storage/User/Cache */ 19), Remote = __webpack_require__(/*! Storage/User/Remote */ 14), EmailModel = __webpack_require__(/*! Model/Email */ 25), FolderModel = __webpack_require__(/*! Model/Folder */ 100), MessageModel = __webpack_require__(/*! Model/Message */ 81), AccountModel = __webpack_require__(/*! Model/Account */ 95), IdentityModel = __webpack_require__(/*! Model/Identity */ 101), OpenPgpKeyModel = __webpack_require__(/*! Model/OpenPgpKey */ 102), AbstractApp = __webpack_require__(/*! App/Abstract */ 46) ; /** * @constructor * @extends AbstractApp */ function AppUser() { AbstractApp.call(this, Remote); this.oMoveCache = {}; this.quotaDebounce = _.debounce(this.quota, 1000 * 30); this.moveOrDeleteResponseHelper = _.bind(this.moveOrDeleteResponseHelper, this); this.messagesMoveTrigger = _.debounce(this.messagesMoveTrigger, 500); window.setInterval(function () { Events.pub('interval.30s'); }, 30000); window.setInterval(function () { Events.pub('interval.1m'); }, 60000); window.setInterval(function () { Events.pub('interval.2m'); }, 60000 * 2); window.setInterval(function () { Events.pub('interval.3m'); }, 60000 * 3); window.setInterval(function () { Events.pub('interval.5m'); }, 60000 * 5); window.setInterval(function () { Events.pub('interval.10m'); }, 60000 * 10); window.setInterval(function () { Events.pub('interval.15m'); }, 60000 * 15); window.setInterval(function () { Events.pub('interval.20m'); }, 60000 * 15); window.setTimeout(function () { window.setInterval(function () { Events.pub('interval.5m-after5m'); }, 60000 * 5); }, 60000 * 5); window.setTimeout(function () { window.setInterval(function () { Events.pub('interval.10m-after5m'); }, 60000 * 10); }, 60000 * 5); $.wakeUp(function () { Remote.jsVersion(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult && oData && !oData.Result) { if (window.parent && !!Settings.settingsGet('InIframe')) { window.parent.location.reload(); } else { window.location.reload(); } } }, Settings.settingsGet('Version')); }, {}, 60 * 60 * 1000); if (Settings.settingsGet('UserBackgroundHash')) { _.delay(function () { $('#rl-bg').attr('style', 'background-image: none !important;') .backstretch(Links.publicLink(Settings.settingsGet('UserBackgroundHash')), { 'fade': Globals.bAnimationSupported ? 1000 : 0 }).removeAttr('style'); }, 2000); } this.socialUsers = _.bind(this.socialUsers, this); } _.extend(AppUser.prototype, AbstractApp.prototype); AppUser.prototype.remote = function () { return Remote; }; AppUser.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function () { _.each(Data.messageList(), function (oMessage) { Cache.initMessageFlagsFromCache(oMessage); }); Cache.initMessageFlagsFromCache(Data.message()); }; /** * @param {boolean=} bDropPagePosition = false * @param {boolean=} bDropCurrenFolderCache = false */ AppUser.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache) { var self = this, iOffset = (Data.messageListPage() - 1) * SettingsStore.messagesPerPage() ; if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache) { Cache.setFolderHash(Data.currentFolderFullNameRaw(), ''); } if (Utils.isUnd(bDropPagePosition) ? false : !!bDropPagePosition) { Data.messageListPage(1); iOffset = 0; } Data.messageListLoading(true); Remote.messageList(function (sResult, oData, bCached) { if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { Data.messageListError(''); Data.messageListLoading(false); self.setMessageList(oData, bCached); } else if (Enums.StorageResultType.Unload === sResult) { Data.messageListError(''); Data.messageListLoading(false); } else if (Enums.StorageResultType.Abort !== sResult) { Data.messageList([]); Data.messageListLoading(false); Data.messageListError(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST') ); } }, Data.currentFolderFullNameRaw(), iOffset, SettingsStore.messagesPerPage(), Data.messageListSearch()); }; AppUser.prototype.recacheInboxMessageList = function () { Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, SettingsStore.messagesPerPage(), '', true); }; AppUser.prototype.reloadMessageListHelper = function (bEmptyList) { this.reloadMessageList(bEmptyList); }; /** * @param {Function} fResultFunc * @returns {boolean} */ AppUser.prototype.contactsSync = function (fResultFunc) { var oContacts = Data.contacts; if (oContacts.importing() || oContacts.syncing() || !Data.enableContactsSync() || !Data.allowContactsSync()) { return false; } oContacts.syncing(true); Remote.contactsSync(function (sResult, oData) { oContacts.syncing(false); if (fResultFunc) { fResultFunc(sResult, oData); } }); return true; }; AppUser.prototype.messagesMoveTrigger = function () { var self = this, sSpamFolder = FolderStore.spamFolder() ; _.each(this.oMoveCache, function (oItem) { var bSpam = sSpamFolder === oItem['To'], bHam = !bSpam && sSpamFolder === oItem['From'] && Cache.getFolderInboxName() === oItem['To'] ; Remote.messagesMove(self.moveOrDeleteResponseHelper, oItem['From'], oItem['To'], oItem['Uid'], bSpam ? 'SPAM' : (bHam ? 'HAM' : '')); }); this.oMoveCache = {}; }; AppUser.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove) { var sH = '$$' + sFromFolderFullNameRaw + '$$' + sToFolderFullNameRaw + '$$'; if (!this.oMoveCache[sH]) { this.oMoveCache[sH] = { 'From': sFromFolderFullNameRaw, 'To': sToFolderFullNameRaw, 'Uid': [] }; } this.oMoveCache[sH]['Uid'] = _.union(this.oMoveCache[sH]['Uid'], aUidForMove); this.messagesMoveTrigger(); }; AppUser.prototype.messagesCopyHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy) { Remote.messagesCopy( this.moveOrDeleteResponseHelper, sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy ); }; AppUser.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove) { Remote.messagesDelete( this.moveOrDeleteResponseHelper, sFromFolderFullNameRaw, aUidForRemove ); }; AppUser.prototype.moveOrDeleteResponseHelper = function (sResult, oData) { if (Enums.StorageResultType.Success === sResult && Data.currentFolder()) { if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length) { Cache.setFolderHash(oData.Result[0], oData.Result[1]); } else { Cache.setFolderHash(Data.currentFolderFullNameRaw(), ''); if (oData && -1 < Utils.inArray(oData.ErrorCode, [Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage])) { window.alert(Translator.getNotification(oData.ErrorCode)); } } this.reloadMessageListHelper(0 === Data.messageList().length); this.quotaDebounce(); } }; /** * @param {string} sFromFolderFullNameRaw * @param {Array} aUidForRemove */ AppUser.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove) { this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove); Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove); }; /** * @param {number} iDeleteType * @param {string} sFromFolderFullNameRaw * @param {Array} aUidForRemove * @param {boolean=} bUseFolder = true */ AppUser.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFolderFullNameRaw, aUidForRemove, bUseFolder) { var self = this, oMoveFolder = null, nSetSystemFoldersNotification = null ; switch (iDeleteType) { case Enums.FolderType.Spam: oMoveFolder = Cache.getFolderFromCacheList(FolderStore.spamFolder()); nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam; break; case Enums.FolderType.NotSpam: oMoveFolder = Cache.getFolderFromCacheList(Cache.getFolderInboxName()); break; case Enums.FolderType.Trash: oMoveFolder = Cache.getFolderFromCacheList(FolderStore.trashFolder()); nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash; break; case Enums.FolderType.Archive: oMoveFolder = Cache.getFolderFromCacheList(FolderStore.archiveFolder()); nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive; break; } bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder; if (bUseFolder) { if ((Enums.FolderType.Spam === iDeleteType && Consts.Values.UnuseOptionValue === FolderStore.spamFolder()) || (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === FolderStore.trashFolder()) || (Enums.FolderType.Archive === iDeleteType && Consts.Values.UnuseOptionValue === FolderStore.archiveFolder())) { bUseFolder = false; } } if (!oMoveFolder && bUseFolder) { kn.showScreenPopup(__webpack_require__(/*! View/Popup/FolderSystem */ 44), [nSetSystemFoldersNotification]); } else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType && (sFromFolderFullNameRaw === FolderStore.spamFolder() || sFromFolderFullNameRaw === FolderStore.trashFolder()))) { kn.showScreenPopup(__webpack_require__(/*! View/Popup/Ask */ 40), [Translator.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () { self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove); Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove); }]); } else if (oMoveFolder) { this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove); Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw); } }; /** * @param {string} sFromFolderFullNameRaw * @param {Array} aUidForMove * @param {string} sToFolderFullNameRaw * @param {boolean=} bCopy = false */ AppUser.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) { if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForMove) && 0 < aUidForMove.length) { var oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw), oToFolder = Cache.getFolderFromCacheList(sToFolderFullNameRaw) ; if (oFromFolder && oToFolder) { if (Utils.isUnd(bCopy) ? false : !!bCopy) { this.messagesCopyHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove); } else { this.messagesMoveHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove); } Data.removeMessagesFromList(oFromFolder.fullNameRaw, aUidForMove, oToFolder.fullNameRaw, bCopy); return true; } } return false; }; /** * @param {Function=} fCallback */ AppUser.prototype.folders = function (fCallback) { Data.foldersLoading(true); Remote.folders(_.bind(function (sResult, oData) { var bResult = false; Data.foldersLoading(false); if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { bResult = true; this.setFolders(oData); } if (fCallback) { fCallback(bResult); } }, this)); }; AppUser.prototype.reloadOpenPgpKeys = function () { if (PgpStore.capaOpenPGP()) { var aKeys = [], oEmail = new EmailModel(), oOpenpgpKeyring = PgpStore.openpgpKeyring, oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : [] ; _.each(oOpenpgpKeys, function (oItem, iIndex) { if (oItem && oItem.primaryKey) { var oPrimaryUser = oItem.getPrimaryUser(), sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid : (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '') ; oEmail.clear(); oEmail.mailsoParse(sUser); if (oEmail.validate()) { aKeys.push(new OpenPgpKeyModel( iIndex, oItem.primaryKey.getFingerprint(), oItem.primaryKey.getKeyId().toHex().toLowerCase(), sUser, oEmail.email, oItem.isPrivate(), oItem.armor()) ); } } }); Utils.delegateRunOnDestroy(PgpStore.openpgpkeys()); PgpStore.openpgpkeys(aKeys); } }; AppUser.prototype.accountsCounts = function () { return false; // AccountStore.accounts.loading(true); // // Remote.accountsCounts(function (sResult, oData) { // // AccountStore.accounts.loading(false); // // if (Enums.StorageResultType.Success === sResult && oData.Result && oData.Result['Counts']) // { // var // sEmail = AccountStore.email(), // aAcounts = AccountStore.accounts() // ; // // _.each(oData.Result['Counts'], function (oItem) { // // var oAccount = _.find(aAcounts, function (oAccount) { // return oAccount && oItem[0] === oAccount.email && sEmail !== oAccount.email; // }); // // if (oAccount) // { // oAccount.count(Utils.pInt(oItem[1])); // } // }); // } // }); }; AppUser.prototype.accountsAndIdentities = function (bBoot) { var self = this; AccountStore.accounts.loading(true); IdentityStore.identities.loading(true); Remote.accountsAndIdentities(function (sResult, oData) { AccountStore.accounts.loading(false); IdentityStore.identities.loading(false); if (Enums.StorageResultType.Success === sResult && oData.Result) { var aCounts = {}, sParentEmail = Settings.settingsGet('ParentEmail'), sAccountEmail = AccountStore.email() ; sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail; if (Utils.isArray(oData.Result['Accounts'])) { _.each(AccountStore.accounts(), function (oAccount) { aCounts[oAccount.email] = oAccount.count(); }); Utils.delegateRunOnDestroy(AccountStore.accounts()); AccountStore.accounts(_.map(oData.Result['Accounts'], function (sValue) { return new AccountModel(sValue, sValue !== sParentEmail, aCounts[sValue] || 0); })); } if (Utils.isUnd(bBoot) ? false : !!bBoot) { _.delay(function () { self.accountsCounts(); }, 1000 * 5); Events.sub('interval.10m-after5m', function () { self.accountsCounts(); }); } if (Utils.isArray(oData.Result['Identities'])) { Utils.delegateRunOnDestroy(IdentityStore.identities()); IdentityStore.identities(_.map(oData.Result['Identities'], function (oIdentityData) { var sId = Utils.pString(oIdentityData['Id']), sEmail = Utils.pString(oIdentityData['Email']), oIdentity = new IdentityModel(sId, sEmail, sId !== sAccountEmail) ; oIdentity.name(Utils.pString(oIdentityData['Name'])); oIdentity.replyTo(Utils.pString(oIdentityData['ReplyTo'])); oIdentity.bcc(Utils.pString(oIdentityData['Bcc'])); return oIdentity; })); } } }); }; AppUser.prototype.quota = function () { Remote.quota(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult && oData && oData.Result && Utils.isArray(oData.Result) && 1 < oData.Result.length && Utils.isPosNumeric(oData.Result[0], true) && Utils.isPosNumeric(oData.Result[1], true)) { __webpack_require__(/*! Stores/User/Quota */ 84).populateData( Utils.pInt(oData.Result[1]), Utils.pInt(oData.Result[0])); } }); }; /** * @param {string} sFolder * @param {Array=} aList = [] */ AppUser.prototype.folderInformation = function (sFolder, aList) { if ('' !== Utils.trim(sFolder)) { var self = this; Remote.folderInformation(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult) { if (oData && oData.Result && oData.Result.Hash && oData.Result.Folder) { var iUtc = moment().unix(), sHash = Cache.getFolderHash(oData.Result.Folder), oFolder = Cache.getFolderFromCacheList(oData.Result.Folder), bCheck = false, sUid = '', aList = [], bUnreadCountChange = false, oFlags = null ; if (oFolder) { oFolder.interval = iUtc; if (oData.Result.Hash) { Cache.setFolderHash(oData.Result.Folder, oData.Result.Hash); } if (Utils.isNormal(oData.Result.MessageCount)) { oFolder.messageCountAll(oData.Result.MessageCount); } if (Utils.isNormal(oData.Result.MessageUnseenCount)) { if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount)) { bUnreadCountChange = true; } oFolder.messageCountUnread(oData.Result.MessageUnseenCount); } if (bUnreadCountChange) { Cache.clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw); } if (oData.Result.Flags) { for (sUid in oData.Result.Flags) { if (oData.Result.Flags.hasOwnProperty(sUid)) { bCheck = true; oFlags = oData.Result.Flags[sUid]; Cache.storeMessageFlagsToCacheByFolderAndUid(oFolder.fullNameRaw, sUid.toString(), [ !oFlags['IsSeen'], !!oFlags['IsFlagged'], !!oFlags['IsAnswered'], !!oFlags['IsForwarded'], !!oFlags['IsReadReceipt'] ]); } } if (bCheck) { self.reloadFlagsCurrentMessageListAndMessageFromCache(); } } Data.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages); if (oData.Result.Hash !== sHash || '' === sHash) { if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw()) { self.reloadMessageList(); } else if (Cache.getFolderInboxName() === oFolder.fullNameRaw) { self.recacheInboxMessageList(); } } else if (bUnreadCountChange) { if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw()) { aList = Data.messageList(); if (Utils.isNonEmptyArray(aList)) { self.folderInformation(oFolder.fullNameRaw, aList); } } } } } } }, sFolder, aList); } }; /** * @param {boolean=} bBoot = false */ AppUser.prototype.folderInformationMultiply = function (bBoot) { bBoot = Utils.isUnd(bBoot) ? false : !!bBoot; var self = this, iUtc = moment().unix(), aFolders = Data.getNextFolderNames(bBoot) ; if (Utils.isNonEmptyArray(aFolders)) { Remote.folderInformationMultiply(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult) { if (oData && oData.Result && oData.Result.List && Utils.isNonEmptyArray(oData.Result.List)) { _.each(oData.Result.List, function (oItem) { var aList = [], sHash = Cache.getFolderHash(oItem.Folder), oFolder = Cache.getFolderFromCacheList(oItem.Folder), bUnreadCountChange = false ; if (oFolder) { oFolder.interval = iUtc; if (oItem.Hash) { Cache.setFolderHash(oItem.Folder, oItem.Hash); } if (Utils.isNormal(oItem.MessageCount)) { oFolder.messageCountAll(oItem.MessageCount); } if (Utils.isNormal(oItem.MessageUnseenCount)) { if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oItem.MessageUnseenCount)) { bUnreadCountChange = true; } oFolder.messageCountUnread(oItem.MessageUnseenCount); } if (bUnreadCountChange) { Cache.clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw); } if (oItem.Hash !== sHash || '' === sHash) { if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw()) { self.reloadMessageList(); } } else if (bUnreadCountChange) { if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw()) { aList = Data.messageList(); if (Utils.isNonEmptyArray(aList)) { self.folderInformation(oFolder.fullNameRaw, aList); } } } } }); if (bBoot) { _.delay(function () { self.folderInformationMultiply(true); }, 2000); } } } }, aFolders); } }; AppUser.prototype.setMessageSeen = function (oMessage) { if (oMessage.unseen()) { oMessage.unseen(false); var oFolder = Cache.getFolderFromCacheList(oMessage.folderFullNameRaw); if (oFolder) { oFolder.messageCountUnread(0 <= oFolder.messageCountUnread() - 1 ? oFolder.messageCountUnread() - 1 : 0); } Cache.storeMessageFlagsToCache(oMessage); this.reloadFlagsCurrentMessageListAndMessageFromCache(); } Remote.messageSetSeen(Utils.emptyFunction, oMessage.folderFullNameRaw, [oMessage.uid], true); }; AppUser.prototype.googleConnect = function () { window.open(Links.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes'); }; AppUser.prototype.twitterConnect = function () { window.open(Links.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes'); }; AppUser.prototype.facebookConnect = function () { window.open(Links.socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); }; /** * @param {boolean=} bFireAllActions */ AppUser.prototype.socialUsers = function (bFireAllActions) { if (true === bFireAllActions) { SocialStore.google.loading(true); SocialStore.facebook.loading(true); SocialStore.twitter.loading(true); } Remote.socialUsers(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { SocialStore.google.userName(oData.Result['Google'] || ''); SocialStore.facebook.userName(oData.Result['Facebook'] || ''); SocialStore.twitter.userName(oData.Result['Twitter'] || ''); } else { SocialStore.google.userName(''); SocialStore.facebook.userName(''); SocialStore.twitter.userName(''); } SocialStore.google.loading(false); SocialStore.facebook.loading(false); SocialStore.twitter.loading(false); }); }; AppUser.prototype.googleDisconnect = function () { SocialStore.google.loading(true); Remote.googleDisconnect(this.socialUsers); }; AppUser.prototype.facebookDisconnect = function () { SocialStore.facebook.loading(true); Remote.facebookDisconnect(this.socialUsers); }; AppUser.prototype.twitterDisconnect = function () { SocialStore.twitter.loading(true); Remote.twitterDisconnect(this.socialUsers); }; /** * @param {string} sQuery * @param {Function} fCallback */ AppUser.prototype.getAutocomplete = function (sQuery, fCallback) { var aData = [] ; Remote.suggestions(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult && oData && Utils.isArray(oData.Result)) { aData = _.map(oData.Result, function (aItem) { return aItem && aItem[0] ? new EmailModel(aItem[0], aItem[1]) : null; }); fCallback(_.compact(aData)); } else if (Enums.StorageResultType.Abort !== sResult) { fCallback([]); } }, sQuery); }; AppUser.prototype.setMessageList = function (oData, bCached) { if (oData && oData.Result && 'Collection/MessageCollection' === oData.Result['@Object'] && oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection'])) { var mLastCollapsedThreadUids = null, iIndex = 0, iLen = 0, iCount = 0, iOffset = 0, aList = [], iUtc = moment().unix(), aStaticList = Data.staticMessageList, oJsonMessage = null, oMessage = null, oFolder = null, iNewCount = 0, bUnreadCountChange = false ; iCount = Utils.pInt(oData.Result.MessageResultCount); iOffset = Utils.pInt(oData.Result.Offset); if (Utils.isNonEmptyArray(oData.Result.LastCollapsedThreadUids)) { mLastCollapsedThreadUids = oData.Result.LastCollapsedThreadUids; } oFolder = Cache.getFolderFromCacheList( Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); if (oFolder && !bCached) { oFolder.interval = iUtc; Cache.setFolderHash(oData.Result.Folder, oData.Result.FolderHash); if (Utils.isNormal(oData.Result.MessageCount)) { oFolder.messageCountAll(oData.Result.MessageCount); } if (Utils.isNormal(oData.Result.MessageUnseenCount)) { if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount)) { bUnreadCountChange = true; } oFolder.messageCountUnread(oData.Result.MessageUnseenCount); } Data.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages); } if (bUnreadCountChange && oFolder) { Cache.clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw); } for (iIndex = 0, iLen = oData.Result['@Collection'].length; iIndex < iLen; iIndex++) { oJsonMessage = oData.Result['@Collection'][iIndex]; if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object']) { oMessage = aStaticList[iIndex]; if (!oMessage || !oMessage.initByJson(oJsonMessage)) { oMessage = MessageModel.newInstanceFromJson(oJsonMessage); } if (oMessage) { if (Cache.hasNewMessageAndRemoveFromCache(oMessage.folderFullNameRaw, oMessage.uid) && 5 >= iNewCount) { iNewCount++; oMessage.newForAnimation(true); } oMessage.deleted(false); if (bCached) { Cache.initMessageFlagsFromCache(oMessage); } else { Cache.storeMessageFlagsToCache(oMessage); } oMessage.lastInCollapsedThread(mLastCollapsedThreadUids && -1 < Utils.inArray(Utils.pInt(oMessage.uid), mLastCollapsedThreadUids) ? true : false); aList.push(oMessage); } } } Data.messageListCount(iCount); Data.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); Data.messageListPage(window.Math.ceil((iOffset / SettingsStore.messagesPerPage()) + 1)); Data.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : ''); Data.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : ''); Data.messageListEndPage(Data.messageListPage()); Data.messageList(aList); Data.messageListIsNotCompleted(false); if (aStaticList.length < aList.length) { Data.staticMessageList = aList; } Cache.clearNewMessageCache(); if (oFolder && (bCached || bUnreadCountChange || SettingsStore.useThreads())) { this.folderInformation(oFolder.fullNameRaw, aList); } } else { Data.messageListCount(0); Data.messageList([]); Data.messageListError(Translator.getNotification( oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList )); } }; /** * @param {string} sNamespace * @param {Array} aFolders * @return {Array} */ AppUser.prototype.folderResponseParseRec = function (sNamespace, aFolders) { var self = this, iIndex = 0, iLen = 0, oFolder = null, oCacheFolder = null, sFolderFullNameRaw = '', aSubFolders = [], aList = [] ; for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++) { oFolder = aFolders[iIndex]; if (oFolder) { sFolderFullNameRaw = oFolder.FullNameRaw; oCacheFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw); if (!oCacheFolder) { oCacheFolder = FolderModel.newInstanceFromJson(oFolder); if (oCacheFolder) { Cache.setFolderToCacheList(sFolderFullNameRaw, oCacheFolder); Cache.setFolderFullNameRaw(oCacheFolder.fullNameHash, sFolderFullNameRaw, oCacheFolder); } } if (oCacheFolder) { oCacheFolder.collapsed(!self.isFolderExpanded(oCacheFolder.fullNameHash)); if (oFolder.Extended) { if (oFolder.Extended.Hash) { Cache.setFolderHash(oCacheFolder.fullNameRaw, oFolder.Extended.Hash); } if (Utils.isNormal(oFolder.Extended.MessageCount)) { oCacheFolder.messageCountAll(oFolder.Extended.MessageCount); } if (Utils.isNormal(oFolder.Extended.MessageUnseenCount)) { oCacheFolder.messageCountUnread(oFolder.Extended.MessageUnseenCount); } } aSubFolders = oFolder['SubFolders']; if (aSubFolders && 'Collection/FolderCollection' === aSubFolders['@Object'] && aSubFolders['@Collection'] && Utils.isArray(aSubFolders['@Collection'])) { oCacheFolder.subFolders( this.folderResponseParseRec(sNamespace, aSubFolders['@Collection'])); } aList.push(oCacheFolder); } } } return aList; }; /** * @param {*} oData */ AppUser.prototype.setFolders = function (oData) { var aList = [], bUpdate = false, fNormalizeFolder = function (sFolderFullNameRaw) { return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw || null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : ''; } ; if (oData && oData.Result && 'Collection/FolderCollection' === oData.Result['@Object'] && oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection'])) { if (!Utils.isUnd(oData.Result.Namespace)) { Data.namespace = oData.Result.Namespace; } AppStore.threadsAllowed(!!Settings.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true); aList = this.folderResponseParseRec(Data.namespace, oData.Result['@Collection']); Data.folderList(aList); if (oData.Result['SystemFolders'] && '' === '' + Settings.settingsGet('SentFolder') + Settings.settingsGet('DraftFolder') + Settings.settingsGet('SpamFolder') + Settings.settingsGet('TrashFolder') + Settings.settingsGet('ArchiveFolder') + Settings.settingsGet('NullFolder')) { // TODO Magic Numbers Settings.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null); Settings.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null); Settings.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null); Settings.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null); Settings.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null); bUpdate = true; } FolderStore.sentFolder(fNormalizeFolder(Settings.settingsGet('SentFolder'))); FolderStore.draftFolder(fNormalizeFolder(Settings.settingsGet('DraftFolder'))); FolderStore.spamFolder(fNormalizeFolder(Settings.settingsGet('SpamFolder'))); FolderStore.trashFolder(fNormalizeFolder(Settings.settingsGet('TrashFolder'))); FolderStore.archiveFolder(fNormalizeFolder(Settings.settingsGet('ArchiveFolder'))); if (bUpdate) { Remote.saveSystemFolders(Utils.emptyFunction, { 'SentFolder': FolderStore.sentFolder(), 'DraftFolder': FolderStore.draftFolder(), 'SpamFolder': FolderStore.spamFolder(), 'TrashFolder': FolderStore.trashFolder(), 'ArchiveFolder': FolderStore.archiveFolder(), 'NullFolder': 'NullFolder' }); } Local.set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash); } }; /** * @param {string} sFullNameHash * @return {boolean} */ AppUser.prototype.isFolderExpanded = function (sFullNameHash) { var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders); return Utils.isArray(aExpandedList) && -1 !== _.indexOf(aExpandedList, sFullNameHash); }; /** * @param {string} sFullNameHash * @param {boolean} bExpanded */ AppUser.prototype.setExpandedFolder = function (sFullNameHash, bExpanded) { var aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders); if (!Utils.isArray(aExpandedList)) { aExpandedList = []; } if (bExpanded) { aExpandedList.push(sFullNameHash); aExpandedList = _.uniq(aExpandedList); } else { aExpandedList = _.without(aExpandedList, sFullNameHash); } Local.set(Enums.ClientSideKeyName.ExpandedFolders, aExpandedList); }; AppUser.prototype.initHorizontalLayoutResizer = function (sClientSideKeyName) { var iMinHeight = 200, iMaxHeight = 500, oTop = null, oBottom = null, fResizeFunction = function (oEvent, oObject) { if (oObject && oObject.size && oObject.size.height) { Local.set(sClientSideKeyName, oObject.size.height); fSetHeight(oObject.size.height); Utils.windowResize(); } }, oOptions = { 'helper': 'ui-resizable-helper-h', 'minHeight': iMinHeight, 'maxHeight': iMaxHeight, 'handles': 's', 'stop': fResizeFunction }, fSetHeight = function (iHeight) { if (iHeight) { if (oTop) { oTop.attr('style', 'height:' + iHeight + 'px'); } if (oBottom) { oBottom.attr('style', 'top:' + (55 /* top toolbar */ + iHeight) + 'px'); } } }, fDisable = function (bDisable) { if (bDisable) { if (oTop && oTop.hasClass('ui-resizable')) { oTop .resizable('destroy') .removeAttr('style') ; } if (oBottom) { oBottom.removeAttr('style'); } } else if (Globals.$html.hasClass('rl-bottom-preview-pane')) { oTop = $('.b-message-list-wrapper'); oBottom = $('.b-message-view-wrapper'); if (!oTop.hasClass('ui-resizable')) { oTop.resizable(oOptions); } var iHeight = Utils.pInt(Local.get(sClientSideKeyName)) || 300; fSetHeight(iHeight > iMinHeight ? iHeight : iMinHeight); } } ; fDisable(false); Events.sub('layout', function (sLayout) { fDisable(Enums.Layout.BottomPreview !== sLayout); }); }; AppUser.prototype.initVerticalLayoutResizer = function (sClientSideKeyName) { var iDisabledWidth = 60, iMinWidth = 155, oLeft = $('#rl-left'), oRight = $('#rl-right'), mLeftWidth = Local.get(sClientSideKeyName) || null, fSetWidth = function (iWidth) { if (iWidth) { oLeft.css({ 'width': '' + iWidth + 'px' }); oRight.css({ 'left': '' + iWidth + 'px' }); } }, fDisable = function (bDisable) { if (bDisable) { oLeft.resizable('disable'); fSetWidth(iDisabledWidth); } else { oLeft.resizable('enable'); var iWidth = Utils.pInt(Local.get(sClientSideKeyName)) || iMinWidth; fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth); } }, fResizeFunction = function (oEvent, oObject) { if (oObject && oObject.size && oObject.size.width) { Local.set(sClientSideKeyName, oObject.size.width); oRight.css({ 'left': '' + oObject.size.width + 'px' }); } } ; if (null !== mLeftWidth) { fSetWidth(mLeftWidth > iMinWidth ? mLeftWidth : iMinWidth); } oLeft.resizable({ 'helper': 'ui-resizable-helper-w', 'minWidth': iMinWidth, 'maxWidth': 350, 'handles': 'e', 'stop': fResizeFunction }); Events.sub('left-panel.off', function () { fDisable(true); }); Events.sub('left-panel.on', function () { fDisable(false); }); }; AppUser.prototype.bootstartLoginScreen = function () { Globals.$html.removeClass('rl-user-auth').addClass('rl-user-no-auth'); var sCustomLoginLink = Utils.pString(Settings.settingsGet('CustomLoginLink')); if (!sCustomLoginLink) { kn.hideLoading(); kn.startScreens([ __webpack_require__(/*! Screen/User/Login */ 106) ]); Plugins.runHook('rl-start-login-screens'); Events.pub('rl.bootstart-login-screens'); } else { kn.routeOff(); kn.setHash(Links.root(), true); kn.routeOff(); _.defer(function () { window.location.href = sCustomLoginLink; }); } }; AppUser.prototype.bootstart = function () { AbstractApp.prototype.bootstart.call(this); __webpack_require__(/*! Stores/User/App */ 30).populate(); __webpack_require__(/*! Stores/User/Settings */ 26).populate(); __webpack_require__(/*! Stores/User/Notification */ 66).populate(); __webpack_require__(/*! Stores/User/Identity */ 43).populate(); __webpack_require__(/*! Stores/User/Account */ 22).populate(); var self = this, $LAB = __webpack_require__(/*! $LAB */ 152), sJsHash = Settings.settingsGet('JsHash'), iContactsSyncInterval = Utils.pInt(Settings.settingsGet('ContactsSyncInterval')), bGoogle = Settings.settingsGet('AllowGoogleSocial'), bFacebook = Settings.settingsGet('AllowFacebookSocial'), bTwitter = Settings.settingsGet('AllowTwitterSocial') ; if (SimplePace) { SimplePace.set(70); SimplePace.sleep(); } Globals.leftPanelDisabled.subscribe(function (bValue) { Events.pub('left-panel.' + (bValue ? 'off' : 'on')); }); if (!!Settings.settingsGet('Auth')) { Globals.$html.addClass('rl-user-auth'); this.setTitle(Translator.i18n('TITLES/LOADING')); //require.ensure([], function() { // require code splitting self.folders(_.bind(function (bValue) { kn.hideLoading(); if (bValue) { if ($LAB && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP)) { var fOpenpgpCallback = function (openpgp) { PgpStore.openpgp = openpgp; PgpStore.openpgpKeyring = new openpgp.Keyring(); PgpStore.capaOpenPGP(true); Events.pub('openpgp.init'); self.reloadOpenPgpKeys(); }; if (window.openpgp) { fOpenpgpCallback(window.openpgp); } else { $LAB.script(Links.openPgpJs()).wait(function () { if (window.openpgp) { fOpenpgpCallback(window.openpgp); } }); } } else { PgpStore.capaOpenPGP(false); } kn.startScreens([ __webpack_require__(/*! Screen/User/MailBox */ 107), __webpack_require__(/*! Screen/User/Settings */ 108), __webpack_require__(/*! Screen/User/About */ 105) ]); if (bGoogle || bFacebook || bTwitter) { self.socialUsers(true); } Events.sub('interval.2m', function () { self.folderInformation(Cache.getFolderInboxName()); }); Events.sub('interval.3m', function () { var sF = Data.currentFolderFullNameRaw(); if (Cache.getFolderInboxName() !== sF) { self.folderInformation(sF); } }); Events.sub('interval.5m-after5m', function () { self.folderInformationMultiply(); }); Events.sub('interval.15m', function () { self.quota(); }); Events.sub('interval.20m', function () { self.folders(); }); iContactsSyncInterval = 5 <= iContactsSyncInterval ? iContactsSyncInterval : 20; iContactsSyncInterval = 320 >= iContactsSyncInterval ? iContactsSyncInterval : 320; _.delay(function () { self.contactsSync(); }, 10000); _.delay(function () { self.folderInformationMultiply(true); }, 2000); window.setInterval(function () { self.contactsSync(); }, iContactsSyncInterval * 60000 + 5000); if (Settings.capa(Enums.Capa.AdditionalAccounts) || Settings.capa(Enums.Capa.AdditionalIdentities)) { self.accountsAndIdentities(true); } _.delay(function () { var sF = Data.currentFolderFullNameRaw(); if (Cache.getFolderInboxName() !== sF) { self.folderInformation(sF); } }, 1000); _.delay(function () { self.quota(); }, 5000); _.delay(function () { Remote.appDelayStart(Utils.emptyFunction); }, 35000); Plugins.runHook('rl-start-user-screens'); Events.pub('rl.bootstart-user-screens'); if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler) { _.delay(function () { try { window.navigator.registerProtocolHandler('mailto', window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s', '' + (Settings.settingsGet('Title') || 'RainLoop')); } catch(e) {} if (Settings.settingsGet('MailToEmail')) { Utils.mailToHelper(Settings.settingsGet('MailToEmail'), __webpack_require__(/*! View/Popup/Compose */ 27)); } }, 500); } if (!Globals.bMobileDevice) { _.defer(function () { self.initVerticalLayoutResizer(Enums.ClientSideKeyName.FolderListSize); }); } } else { this.bootstartLoginScreen(); } if (SimplePace) { SimplePace.set(100); } }, self)); //}); // require code splitting } else { this.bootstartLoginScreen(); if (SimplePace) { SimplePace.set(100); } } if (bGoogle) { window['rl_' + sJsHash + '_google_service'] = function () { SocialStore.google.loading(true); self.socialUsers(); }; } if (bFacebook) { window['rl_' + sJsHash + '_facebook_service'] = function () { SocialStore.facebook.loading(true); self.socialUsers(); }; } if (bTwitter) { window['rl_' + sJsHash + '_twitter_service'] = function () { SocialStore.twitter.loading(true); self.socialUsers(); }; } Events.sub('interval.1m', function () { Globals.momentTrigger(!Globals.momentTrigger()); }); Plugins.runHook('rl-start-screens'); Events.pub('rl.bootstart-end'); }; module.exports = new AppUser(); }()); /***/ }, /* 7 */ /*!**********************************!*\ !*** ./dev/Common/Translator.js ***! \**********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), $ = __webpack_require__(/*! $ */ 13), _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), Enums = __webpack_require__(/*! Common/Enums */ 4), Globals = __webpack_require__(/*! Common/Globals */ 8) ; /** * @constructor */ function Translator() { this.data = window['rainloopI18N'] || {}; this.notificationI18N = {}; this.trigger = ko.observable(false); this.i18n = _.bind(this.i18n, this); } Translator.prototype.data = {}; Translator.prototype.notificationI18N = {}; /** * @param {string} sKey * @param {Object=} oValueList * @param {string=} sDefaulValue * @return {string} */ Translator.prototype.i18n = function (sKey, oValueList, sDefaulValue) { var sValueName = '', sResult = _.isUndefined(this.data[sKey]) ? (_.isUndefined(sDefaulValue) ? sKey : sDefaulValue) : this.data[sKey] ; if (!_.isUndefined(oValueList) && !_.isNull(oValueList)) { for (sValueName in oValueList) { if (_.has(oValueList, sValueName)) { sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]); } } } return sResult; }; /** * @param {Object} oElement * @param {boolean=} bAnimate = false */ Translator.prototype.i18nToNode = function (oElement, bAnimate) { var self = this; _.defer(function () { $('.i18n', oElement).each(function () { var jqThis = $(this), sKey = '' ; sKey = jqThis.data('i18n-text'); if (sKey) { jqThis.text(self.i18n(sKey)); } else { sKey = jqThis.data('i18n-html'); if (sKey) { jqThis.html(self.i18n(sKey)); } sKey = jqThis.data('i18n-placeholder'); if (sKey) { jqThis.attr('placeholder', self.i18n(sKey)); } sKey = jqThis.data('i18n-title'); if (sKey) { jqThis.attr('title', self.i18n(sKey)); } } }); if (bAnimate && Globals.bAnimationSupported) { $('.i18n-animation.i18n', oElement).letterfx({ 'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore' }); } }); }; Translator.prototype.reloadData = function () { if (window['rainloopI18N']) { this.data = window['rainloopI18N'] || {}; this.i18nToNode($(window.document), true); this.trigger(!this.trigger()); } window['rainloopI18N'] = null; }; Translator.prototype.initNotificationLanguage = function () { var oN = this.notificationI18N || {}; oN[Enums.Notification.InvalidToken] = this.i18n('NOTIFICATIONS/INVALID_TOKEN'); oN[Enums.Notification.AuthError] = this.i18n('NOTIFICATIONS/AUTH_ERROR'); oN[Enums.Notification.AccessError] = this.i18n('NOTIFICATIONS/ACCESS_ERROR'); oN[Enums.Notification.ConnectionError] = this.i18n('NOTIFICATIONS/CONNECTION_ERROR'); oN[Enums.Notification.CaptchaError] = this.i18n('NOTIFICATIONS/CAPTCHA_ERROR'); oN[Enums.Notification.SocialFacebookLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE'); oN[Enums.Notification.SocialTwitterLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE'); oN[Enums.Notification.SocialGoogleLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE'); oN[Enums.Notification.DomainNotAllowed] = this.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED'); oN[Enums.Notification.AccountNotAllowed] = this.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED'); oN[Enums.Notification.AccountTwoFactorAuthRequired] = this.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED'); oN[Enums.Notification.AccountTwoFactorAuthError] = this.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR'); oN[Enums.Notification.CouldNotSaveNewPassword] = this.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD'); oN[Enums.Notification.CurrentPasswordIncorrect] = this.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT'); oN[Enums.Notification.NewPasswordShort] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT'); oN[Enums.Notification.NewPasswordWeak] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK'); oN[Enums.Notification.NewPasswordForbidden] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT'); oN[Enums.Notification.ContactsSyncError] = this.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR'); oN[Enums.Notification.CantGetMessageList] = this.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST'); oN[Enums.Notification.CantGetMessage] = this.i18n('NOTIFICATIONS/CANT_GET_MESSAGE'); oN[Enums.Notification.CantDeleteMessage] = this.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE'); oN[Enums.Notification.CantMoveMessage] = this.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE'); oN[Enums.Notification.CantCopyMessage] = this.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE'); oN[Enums.Notification.CantSaveMessage] = this.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE'); oN[Enums.Notification.CantSendMessage] = this.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE'); oN[Enums.Notification.InvalidRecipients] = this.i18n('NOTIFICATIONS/INVALID_RECIPIENTS'); oN[Enums.Notification.CantSaveFilters] = this.i18n('NOTIFICATIONS/CANT_SAVE_FILTERS'); oN[Enums.Notification.CantGetFilters] = this.i18n('NOTIFICATIONS/CANT_GET_FILTERS'); oN[Enums.Notification.FiltersAreNotCorrect] = this.i18n('NOTIFICATIONS/FILTERS_ARE_NOT_CORRECT'); oN[Enums.Notification.CantCreateFolder] = this.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER'); oN[Enums.Notification.CantRenameFolder] = this.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'); oN[Enums.Notification.CantDeleteFolder] = this.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'); oN[Enums.Notification.CantDeleteNonEmptyFolder] = this.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER'); oN[Enums.Notification.CantSubscribeFolder] = this.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER'); oN[Enums.Notification.CantUnsubscribeFolder] = this.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER'); oN[Enums.Notification.CantSaveSettings] = this.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS'); oN[Enums.Notification.CantSavePluginSettings] = this.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS'); oN[Enums.Notification.DomainAlreadyExists] = this.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS'); oN[Enums.Notification.CantInstallPackage] = this.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE'); oN[Enums.Notification.CantDeletePackage] = this.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE'); oN[Enums.Notification.InvalidPluginPackage] = this.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE'); oN[Enums.Notification.UnsupportedPluginPackage] = this.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE'); oN[Enums.Notification.LicensingServerIsUnavailable] = this.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE'); oN[Enums.Notification.LicensingExpired] = this.i18n('NOTIFICATIONS/LICENSING_EXPIRED'); oN[Enums.Notification.LicensingBanned] = this.i18n('NOTIFICATIONS/LICENSING_BANNED'); oN[Enums.Notification.DemoSendMessageError] = this.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR'); oN[Enums.Notification.DemoAccountError] = this.i18n('NOTIFICATIONS/DEMO_ACCOUNT_ERROR'); oN[Enums.Notification.AccountAlreadyExists] = this.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS'); oN[Enums.Notification.AccountDoesNotExist] = this.i18n('NOTIFICATIONS/ACCOUNT_DOES_NOT_EXIST'); oN[Enums.Notification.MailServerError] = this.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR'); oN[Enums.Notification.InvalidInputArgument] = this.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT'); oN[Enums.Notification.UnknownNotification] = this.i18n('NOTIFICATIONS/UNKNOWN_ERROR'); oN[Enums.Notification.UnknownError] = this.i18n('NOTIFICATIONS/UNKNOWN_ERROR'); }; /** * @param {Function} fCallback * @param {Object} oScope * @param {Function=} fLangCallback */ Translator.prototype.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback) { if (fCallback) { fCallback.call(oScope); } if (fLangCallback) { this.trigger.subscribe(function () { if (fCallback) { fCallback.call(oScope); } fLangCallback.call(oScope); }); } else if (fCallback) { this.trigger.subscribe(fCallback, oScope); } }; /** * @param {number} iCode * @param {*=} mMessage = '' * @return {string} */ Translator.prototype.getNotification = function (iCode, mMessage) { iCode = window.parseInt(iCode, 10) || 0; if (Enums.Notification.ClientViewError === iCode && mMessage) { return mMessage; } return _.isUndefined(this.notificationI18N[iCode]) ? '' : this.notificationI18N[iCode]; }; /** * @param {*} mCode * @return {string} */ Translator.prototype.getUploadErrorDescByCode = function (mCode) { var sResult = ''; switch (window.parseInt(mCode, 10) || 0) { case Enums.UploadErrorCode.FileIsTooBig: sResult = this.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'); break; case Enums.UploadErrorCode.FilePartiallyUploaded: sResult = this.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED'); break; case Enums.UploadErrorCode.FileNoUploaded: sResult = this.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED'); break; case Enums.UploadErrorCode.MissingTempFolder: sResult = this.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER'); break; case Enums.UploadErrorCode.FileOnSaveingError: sResult = this.i18n('UPLOAD/ERROR_ON_SAVING_FILE'); break; case Enums.UploadErrorCode.FileType: sResult = this.i18n('UPLOAD/ERROR_FILE_TYPE'); break; default: sResult = this.i18n('UPLOAD/ERROR_UNKNOWN'); break; } return sResult; }; /** * @param {string} sLanguage * @param {Function=} fDone * @param {Function=} fFail */ Translator.prototype.reload = function (sLanguage, fDone, fFail) { var self = this, $html = $('html'), fEmptyFunction = function () {}, iStart = (new Date()).getTime() ; $html.addClass('rl-changing-language'); $.ajax({ 'url': __webpack_require__(/*! Common/Links */ 12).langLink(sLanguage), 'dataType': 'script', 'cache': true }) .fail(fFail || fEmptyFunction) .done(function () { _.delay(function () { self.reloadData(); (fDone || fEmptyFunction)(); $html.removeClass('rl-changing-language'); }, 500 < (new Date()).getTime() - iStart ? 1 : 500); }) ; }; module.exports = new Translator(); }()); /***/ }, /* 8 */ /*!*******************************!*\ !*** ./dev/Common/Globals.js ***! \*******************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var Globals = {}, window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), ko = __webpack_require__(/*! ko */ 3), key = __webpack_require__(/*! key */ 21), Enums = __webpack_require__(/*! Common/Enums */ 4) ; Globals.$win = $(window); Globals.$doc = $(window.document); Globals.$html = $('html'); Globals.$div = $('
'); /** * @type {?} */ Globals.now = (new window.Date()).getTime(); /** * @type {?} */ Globals.momentTrigger = ko.observable(true); /** * @type {?} */ Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0}); /** * @type {?} */ Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0}); /** * @type {boolean} */ Globals.useKeyboardShortcuts = ko.observable(true); /** * @type {number} */ Globals.iAjaxErrorCount = 0; /** * @type {number} */ Globals.iTokenErrorCount = 0; /** * @type {number} */ Globals.iMessageBodyCacheCount = 0; /** * @type {boolean} */ Globals.bUnload = false; /** * @type {string} */ Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase(); /** * @type {boolean} */ Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad'); /** * @type {boolean} */ Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android'); /** * @type {boolean} */ Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice; /** * @type {boolean} */ Globals.bDisableNanoScroll = Globals.bMobileDevice; /** * @type {boolean} */ Globals.bAllowPdfPreview = !Globals.bMobileDevice; /** * @type {boolean} */ Globals.bAnimationSupported = !Globals.bMobileDevice && Globals.$html.hasClass('csstransitions') && Globals.$html.hasClass('cssanimations'); /** * @type {boolean} */ Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest; /** * @type {*} */ Globals.__APP__ = null; /** * @type {Object} */ Globals.oHtmlEditorDefaultConfig = { 'title': false, 'stylesSet': false, 'customConfig': '', 'contentsCss': '', 'toolbarGroups': [ {name: 'spec'}, {name: 'styles'}, {name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi']}, {name: 'colors'}, {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']}, {name: 'links'}, {name: 'insert'}, {name: 'document', groups: ['mode', 'document', 'doctools']}, {name: 'others'} ], 'removePlugins': 'liststyle,table,quicktable,tableresize,tabletools,contextmenu', //blockquote 'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source', 'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced', 'extraPlugins': 'plain', // signature 'allowedContent': true, 'font_defaultLabel': 'Arial', 'fontSize_defaultLabel': '13', 'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px' }; /** * @type {Object} */ Globals.oHtmlEditorLangsMap = { 'bg': 'bg', 'de': 'de', 'es': 'es', 'fr': 'fr', 'hu': 'hu', 'is': 'is', 'it': 'it', 'ja': 'ja', 'ja-jp': 'ja', 'ko': 'ko', 'ko-kr': 'ko', 'lt': 'lt', 'lv': 'lv', 'nl': 'nl', 'no': 'no', 'pl': 'pl', 'pt': 'pt', 'pt-pt': 'pt', 'pt-br': 'pt-br', 'ro': 'ro', 'ru': 'ru', 'sk': 'sk', 'sv': 'sv', 'tr': 'tr', 'ua': 'ru', 'zh': 'zh', 'zh-tw': 'zh', 'zh-cn': 'zh-cn' }; if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes) { Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) { return oType && 'application/pdf' === oType.type; }); } Globals.aBootstrapDropdowns = []; Globals.aViewModels = { 'settings': [], 'settings-removed': [], 'settings-disabled': [] }; Globals.leftPanelDisabled = ko.observable(false); // popups Globals.popupVisibilityNames = ko.observableArray([]); Globals.popupVisibility = ko.computed(function () { return 0 < Globals.popupVisibilityNames().length; }, this); // keys Globals.keyScopeReal = ko.observable(Enums.KeyState.All); Globals.keyScopeFake = ko.observable(Enums.KeyState.All); Globals.keyScope = ko.computed({ 'owner': this, 'read': function () { return Globals.keyScopeFake(); }, 'write': function (sValue) { if (Enums.KeyState.Menu !== sValue) { if (Enums.KeyState.Compose === sValue) { // disableKeyFilter key.filter = function () { return Globals.useKeyboardShortcuts(); }; } else { // restoreKeyFilter key.filter = function (event) { if (Globals.useKeyboardShortcuts()) { var oElement = event.target || event.srcElement, sTagName = oElement ? oElement.tagName : '' ; sTagName = sTagName.toUpperCase(); return !(sTagName === 'INPUT' || sTagName === 'SELECT' || sTagName === 'TEXTAREA' || (oElement && sTagName === 'DIV' && 'editorHtmlArea' === oElement.className && oElement.contentEditable) ); } return false; }; } Globals.keyScopeFake(sValue); if (Globals.dropdownVisibility()) { sValue = Enums.KeyState.Menu; } } Globals.keyScopeReal(sValue); } }); Globals.keyScopeReal.subscribe(function (sValue) { // window.console.log(sValue); key.setScope(sValue); }); Globals.dropdownVisibility.subscribe(function (bValue) { if (bValue) { Globals.tooltipTrigger(!Globals.tooltipTrigger()); Globals.keyScope(Enums.KeyState.Menu); } else if (Enums.KeyState.Menu === key.getScope()) { Globals.keyScope(Globals.keyScopeFake()); } }); module.exports = Globals; }()); /***/ }, /* 9 */ /*!*********************************!*\ !*** ./dev/Storage/Settings.js ***! \*********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), Utils = __webpack_require__(/*! Common/Utils */ 1) ; /** * @constructor */ function SettingsStorage() { this.oSettings = window['rainloopAppData'] || {}; this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {}; } SettingsStorage.prototype.oSettings = null; /** * @param {string} sName * @return {?} */ SettingsStorage.prototype.settingsGet = function (sName) { return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName]; }; /** * @param {string} sName * @param {?} mValue */ SettingsStorage.prototype.settingsSet = function (sName, mValue) { this.oSettings[sName] = mValue; }; /** * @param {string} sName * @return {boolean} */ SettingsStorage.prototype.capa = function (sName) { var mCapa = this.settingsGet('Capa'); return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa); }; module.exports = new SettingsStorage(); }()); /***/ }, /* 10 */ /*!*************************!*\ !*** external "window" ***! \*************************/ /***/ function(module, exports, __webpack_require__) { module.exports = window; /***/ }, /* 11 */ /*!***********************************!*\ !*** ./dev/Knoin/AbstractView.js ***! \***********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Enums = __webpack_require__(/*! Common/Enums */ 4), Utils = __webpack_require__(/*! Common/Utils */ 1), Globals = __webpack_require__(/*! Common/Globals */ 8) ; /** * @constructor * @param {string=} sPosition = '' * @param {string=} sTemplate = '' */ function AbstractView(sPosition, sTemplate) { this.bDisabeCloseOnEsc = false; this.sPosition = Utils.pString(sPosition); this.sTemplate = Utils.pString(sTemplate); this.sDefaultKeyScope = Enums.KeyState.None; this.sCurrentKeyScope = this.sDefaultKeyScope; this.viewModelVisibility = ko.observable(false); this.modalVisibility = ko.observable(false).extend({'rateLimit': 0}); this.viewModelName = ''; this.viewModelNames = []; this.viewModelDom = null; } /** * @type {boolean} */ AbstractView.prototype.bDisabeCloseOnEsc = false; /** * @type {string} */ AbstractView.prototype.sPosition = ''; /** * @type {string} */ AbstractView.prototype.sTemplate = ''; /** * @type {string} */ AbstractView.prototype.sDefaultKeyScope = Enums.KeyState.None; /** * @type {string} */ AbstractView.prototype.sCurrentKeyScope = Enums.KeyState.None; /** * @type {string} */ AbstractView.prototype.viewModelName = ''; /** * @type {Array} */ AbstractView.prototype.viewModelNames = []; /** * @type {?} */ AbstractView.prototype.viewModelDom = null; /** * @return {string} */ AbstractView.prototype.viewModelTemplate = function () { return this.sTemplate; }; /** * @return {string} */ AbstractView.prototype.viewModelPosition = function () { return this.sPosition; }; AbstractView.prototype.cancelCommand = function () {}; AbstractView.prototype.closeCommand = function () {}; AbstractView.prototype.storeAndSetKeyScope = function () { this.sCurrentKeyScope = Globals.keyScope(); Globals.keyScope(this.sDefaultKeyScope); }; AbstractView.prototype.restoreKeyScope = function () { Globals.keyScope(this.sCurrentKeyScope); }; AbstractView.prototype.registerPopupKeyDown = function () { var self = this; Globals.$win.on('keydown', function (oEvent) { if (oEvent && self.modalVisibility && self.modalVisibility()) { if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode) { Utils.delegateRun(self, 'cancelCommand'); return false; } else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus()) { return false; } } return true; }); }; module.exports = AbstractView; }()); /***/ }, /* 12 */ /*!*****************************!*\ !*** ./dev/Common/Links.js ***! \*****************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), Utils = __webpack_require__(/*! Common/Utils */ 1) ; /** * @constructor */ function Links() { var Settings = __webpack_require__(/*! Storage/Settings */ 9); this.sBase = '#/'; this.sServer = './?'; this.sSubQuery = '&s=/'; this.sSubSubQuery = '&ss=/'; this.sVersion = Settings.settingsGet('Version'); this.sSpecSuffix = Settings.settingsGet('AuthAccountHash') || '0'; this.sStaticPrefix = Settings.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/'; } /** * @return {string} */ Links.prototype.root = function () { return this.sBase; }; /** * @return {string} */ Links.prototype.rootAdmin = function () { return this.sServer + '/Admin/'; }; /** * @param {string} sDownload * @return {string} */ Links.prototype.attachmentDownload = function (sDownload) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/Download/' + this.sSubSubQuery + sDownload; }; /** * @param {string} sDownload * @return {string} */ Links.prototype.attachmentPreview = function (sDownload) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/View/' + this.sSubSubQuery + sDownload; }; /** * @param {string} sDownload * @return {string} */ Links.prototype.attachmentThumbnailPreview = function (sDownload) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewThumbnail/' + this.sSubSubQuery + sDownload; }; /** * @param {string} sDownload * @return {string} */ Links.prototype.attachmentPreviewAsPlain = function (sDownload) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewAsPlain/' + this.sSubSubQuery + sDownload; }; /** * @param {string} sDownload * @return {string} */ Links.prototype.attachmentFramed = function (sDownload) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/FramedView/' + this.sSubSubQuery + sDownload; }; /** * @return {string} */ Links.prototype.upload = function () { return this.sServer + '/Upload/' + this.sSubQuery + this.sSpecSuffix + '/'; }; /** * @return {string} */ Links.prototype.uploadContacts = function () { return this.sServer + '/UploadContacts/' + this.sSubQuery + this.sSpecSuffix + '/'; }; /** * @return {string} */ Links.prototype.uploadBackground = function () { return this.sServer + '/UploadBackground/' + this.sSubQuery + this.sSpecSuffix + '/'; }; /** * @return {string} */ Links.prototype.append = function () { return this.sServer + '/Append/' + this.sSubQuery + this.sSpecSuffix + '/'; }; /** * @param {string} sEmail * @return {string} */ Links.prototype.change = function (sEmail) { return this.sServer + '/Change/' + this.sSubQuery + this.sSpecSuffix + '/' + Utils.encodeURIComponent(sEmail) + '/'; }; /** * @param {string=} sAdd * @return {string} */ Links.prototype.ajax = function (sAdd) { return this.sServer + '/Ajax/' + this.sSubQuery + this.sSpecSuffix + '/' + sAdd; }; /** * @param {string} sRequestHash * @return {string} */ Links.prototype.messageViewLink = function (sRequestHash) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ViewAsPlain/' + this.sSubSubQuery + sRequestHash; }; /** * @param {string} sRequestHash * @return {string} */ Links.prototype.messageDownloadLink = function (sRequestHash) { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/Download/' + this.sSubSubQuery + sRequestHash; }; /** * @param {string} sEmail * @return {string} */ Links.prototype.avatarLink = function (sEmail) { return this.sServer + '/Raw/0/Avatar/' + Utils.encodeURIComponent(sEmail) + '/'; }; /** * @param {string} sHash * @return {string} */ Links.prototype.publicLink = function (sHash) { return this.sServer + '/Raw/0/Public/' + sHash + '/'; }; /** * @param {string} sInboxFolderName = 'INBOX' * @return {string} */ Links.prototype.inbox = function (sInboxFolderName) { sInboxFolderName = Utils.isUnd(sInboxFolderName) ? 'INBOX' : sInboxFolderName; return this.sBase + 'mailbox/' + sInboxFolderName; }; /** * @return {string} */ Links.prototype.messagePreview = function () { return this.sBase + 'mailbox/message-preview'; }; /** * @param {string=} sScreenName * @return {string} */ Links.prototype.settings = function (sScreenName) { var sResult = this.sBase + 'settings'; if (!Utils.isUnd(sScreenName) && '' !== sScreenName) { sResult += '/' + sScreenName; } return sResult; }; /** * @return {string} */ Links.prototype.about = function () { return this.sBase + 'about'; }; /** * @param {string} sScreenName * @return {string} */ Links.prototype.admin = function (sScreenName) { var sResult = this.sBase; switch (sScreenName) { case 'AdminDomains': sResult += 'domains'; break; case 'AdminSecurity': sResult += 'security'; break; case 'AdminLicensing': sResult += 'licensing'; break; } return sResult; }; /** * @param {string} sFolder * @param {number=} iPage = 1 * @param {string=} sSearch = '' * @return {string} */ Links.prototype.mailBox = function (sFolder, iPage, sSearch) { iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1; sSearch = Utils.pString(sSearch); var sResult = this.sBase + 'mailbox/'; if ('' !== sFolder) { sResult += encodeURI(sFolder); } if (1 < iPage) { sResult = sResult.replace(/[\/]+$/, ''); sResult += '/p' + iPage; } if ('' !== sSearch) { sResult = sResult.replace(/[\/]+$/, ''); sResult += '/' + encodeURI(sSearch); } return sResult; }; /** * @return {string} */ Links.prototype.phpInfo = function () { return this.sServer + 'Info'; }; /** * @param {string} sLang * @return {string} */ Links.prototype.langLink = function (sLang) { return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/'; }; /** * @return {string} */ Links.prototype.exportContactsVcf = function () { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ContactsVcf/'; }; /** * @return {string} */ Links.prototype.exportContactsCsv = function () { return this.sServer + '/Raw/' + this.sSubQuery + this.sSpecSuffix + '/ContactsCsv/'; }; /** * @return {string} */ Links.prototype.emptyContactPic = function () { return this.sStaticPrefix + 'css/images/empty-contact.png'; }; /** * @param {string} sFileName * @return {string} */ Links.prototype.sound = function (sFileName) { return this.sStaticPrefix + 'sounds/' + sFileName; }; /** * @param {string} sTheme * @return {string} */ Links.prototype.themePreviewLink = function (sTheme) { var sPrefix = 'rainloop/v/' + this.sVersion + '/'; if ('@custom' === sTheme.substr(-7)) { sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7)); sPrefix = ''; } return sPrefix + 'themes/' + window.encodeURI(sTheme) + '/images/preview.png'; }; /** * @return {string} */ Links.prototype.notificationMailIcon = function () { return this.sStaticPrefix + 'css/images/icom-message-notification.png'; }; /** * @return {string} */ Links.prototype.openPgpJs = function () { return this.sStaticPrefix + 'js/min/openpgp.js'; }; /** * @return {string} */ Links.prototype.socialGoogle = function () { return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : ''); }; /** * @return {string} */ Links.prototype.socialTwitter = function () { return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : ''); }; /** * @return {string} */ Links.prototype.socialFacebook = function () { return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSubQuery + this.sSpecSuffix + '/' : ''); }; module.exports = new Links(); }()); /***/ }, /* 13 */ /*!********************************!*\ !*** external "window.jQuery" ***! \********************************/ /***/ function(module, exports, __webpack_require__) { module.exports = window.jQuery; /***/ }, /* 14 */ /*!************************************!*\ !*** ./dev/Storage/User/Remote.js ***! \************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), Utils = __webpack_require__(/*! Common/Utils */ 1), Consts = __webpack_require__(/*! Common/Consts */ 16), Base64 = __webpack_require__(/*! Common/Base64 */ 92), AppStore = __webpack_require__(/*! Stores/User/App */ 30), SettingsStore = __webpack_require__(/*! Stores/User/Settings */ 26), Settings = __webpack_require__(/*! Storage/Settings */ 9), Cache = __webpack_require__(/*! Storage/User/Cache */ 19), Data = __webpack_require__(/*! Storage/User/Data */ 15), AbstractRemoteStorage = __webpack_require__(/*! Storage/AbstractRemote */ 59) ; /** * @constructor * @extends AbstractRemoteStorage */ function RemoteUserStorage() { AbstractRemoteStorage.call(this); this.oRequests = {}; } _.extend(RemoteUserStorage.prototype, AbstractRemoteStorage.prototype); /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.folders = function (fCallback) { this.defaultRequest(fCallback, 'Folders', { 'SentFolder': Settings.settingsGet('SentFolder'), 'DraftFolder': Settings.settingsGet('DraftFolder'), 'SpamFolder': Settings.settingsGet('SpamFolder'), 'TrashFolder': Settings.settingsGet('TrashFolder'), 'ArchiveFolder': Settings.settingsGet('ArchiveFolder') }, null, '', ['Folders']); }; /** * @param {?Function} fCallback * @param {string} sEmail * @param {string} sLogin * @param {string} sPassword * @param {boolean} bSignMe * @param {string=} sLanguage * @param {string=} sAdditionalCode * @param {boolean=} bAdditionalCodeSignMe */ RemoteUserStorage.prototype.login = function (fCallback, sEmail, sLogin, sPassword, bSignMe, sLanguage, sAdditionalCode, bAdditionalCodeSignMe) { this.defaultRequest(fCallback, 'Login', { 'Email': sEmail, 'Login': sLogin, 'Password': sPassword, 'Language': sLanguage || '', 'AdditionalCode': sAdditionalCode || '', 'AdditionalCodeSignMe': bAdditionalCodeSignMe ? '1' : '0', 'SignMe': bSignMe ? '1' : '0' }); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.getTwoFactor = function (fCallback) { this.defaultRequest(fCallback, 'GetTwoFactorInfo'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.createTwoFactor = function (fCallback) { this.defaultRequest(fCallback, 'CreateTwoFactorSecret'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.clearTwoFactor = function (fCallback) { this.defaultRequest(fCallback, 'ClearTwoFactorInfo'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.showTwoFactorSecret = function (fCallback) { this.defaultRequest(fCallback, 'ShowTwoFactorSecret'); }; /** * @param {?Function} fCallback * @param {string} sCode */ RemoteUserStorage.prototype.testTwoFactor = function (fCallback, sCode) { this.defaultRequest(fCallback, 'TestTwoFactorInfo', { 'Code': sCode }); }; /** * @param {?Function} fCallback * @param {boolean} bEnable */ RemoteUserStorage.prototype.enableTwoFactor = function (fCallback, bEnable) { this.defaultRequest(fCallback, 'EnableTwoFactor', { 'Enable': bEnable ? '1' : '0' }); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.clearTwoFactorInfo = function (fCallback) { this.defaultRequest(fCallback, 'ClearTwoFactorInfo'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.contactsSync = function (fCallback) { this.defaultRequest(fCallback, 'ContactsSync', null, Consts.Defaults.ContactsSyncAjaxTimeout); }; /** * @param {?Function} fCallback * @param {boolean} bEnable * @param {string} sUrl * @param {string} sUser * @param {string} sPassword */ RemoteUserStorage.prototype.saveContactsSyncData = function (fCallback, bEnable, sUrl, sUser, sPassword) { this.defaultRequest(fCallback, 'SaveContactsSyncData', { 'Enable': bEnable ? '1' : '0', 'Url': sUrl, 'User': sUser, 'Password': sPassword }); }; /** * @param {?Function} fCallback * @param {string} sEmail * @param {string} sPassword * @param {boolean=} bNew */ RemoteUserStorage.prototype.accountSetup = function (fCallback, sEmail, sPassword, bNew) { bNew = Utils.isUnd(bNew) ? true : !!bNew; this.defaultRequest(fCallback, 'AccountSetup', { 'Email': sEmail, 'Password': sPassword, 'New': bNew ? '1' : '0' }); }; /** * @param {?Function} fCallback * @param {string} sEmailToDelete */ RemoteUserStorage.prototype.accountDelete = function (fCallback, sEmailToDelete) { this.defaultRequest(fCallback, 'AccountDelete', { 'EmailToDelete': sEmailToDelete }); }; /** * @param {?Function} fCallback * @param {Array} aAccounts */ RemoteUserStorage.prototype.accountSortOrder = function (fCallback, aAccounts) { this.defaultRequest(fCallback, 'AccountSortOrder', { 'Accounts': aAccounts }); }; /** * @param {?Function} fCallback * @param {string} sId * @param {string} sEmail * @param {string} sName * @param {string} sReplyTo * @param {string} sBcc */ RemoteUserStorage.prototype.identityUpdate = function (fCallback, sId, sEmail, sName, sReplyTo, sBcc) { this.defaultRequest(fCallback, 'IdentityUpdate', { 'Id': sId, 'Email': sEmail, 'Name': sName, 'ReplyTo': sReplyTo, 'Bcc': sBcc }); }; /** * @param {?Function} fCallback * @param {string} sIdToDelete */ RemoteUserStorage.prototype.identityDelete = function (fCallback, sIdToDelete) { this.defaultRequest(fCallback, 'IdentityDelete', { 'IdToDelete': sIdToDelete }); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.accountsAndIdentities = function (fCallback) { this.defaultRequest(fCallback, 'AccountsAndIdentities'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.accountsCounts = function (fCallback) { this.defaultRequest(fCallback, 'AccountsCounts'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.filtersSave = function (fCallback, aFilters, sRaw, bRawIsActive) { this.defaultRequest(fCallback, 'FiltersSave', { 'Raw': sRaw, 'RawIsActive': bRawIsActive ? '1' : '0', 'Filters': _.map(aFilters, function (oItem) { return oItem.toJson(); }) }); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.filtersGet = function (fCallback) { this.defaultRequest(fCallback, 'Filters', {}); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw * @param {number=} iOffset = 0 * @param {number=} iLimit = 20 * @param {string=} sSearch = '' * @param {boolean=} bSilent = false */ RemoteUserStorage.prototype.messageList = function (fCallback, sFolderFullNameRaw, iOffset, iLimit, sSearch, bSilent) { sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw); var sFolderHash = Cache.getFolderHash(sFolderFullNameRaw) ; bSilent = Utils.isUnd(bSilent) ? false : !!bSilent; iOffset = Utils.isUnd(iOffset) ? 0 : Utils.pInt(iOffset); iLimit = Utils.isUnd(iOffset) ? 20 : Utils.pInt(iLimit); sSearch = Utils.pString(sSearch); if ('' !== sFolderHash && ('' === sSearch || -1 === sSearch.indexOf('is:'))) { return this.defaultRequest(fCallback, 'MessageList', {}, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, 'MessageList/' + Base64.urlsafe_encode([ sFolderFullNameRaw, iOffset, iLimit, sSearch, AppStore.projectHash(), sFolderHash, Cache.getFolderInboxName() === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '', AppStore.threadsAllowed() && SettingsStore.useThreads() ? '1' : '0', AppStore.threadsAllowed() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : '' ].join(String.fromCharCode(0))), bSilent ? [] : ['MessageList']); } else { return this.defaultRequest(fCallback, 'MessageList', { 'Folder': sFolderFullNameRaw, 'Offset': iOffset, 'Limit': iLimit, 'Search': sSearch, 'UidNext': Cache.getFolderInboxName() === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '', 'UseThreads': AppStore.threadsAllowed() && SettingsStore.useThreads() ? '1' : '0', 'ExpandedThreadUid': AppStore.threadsAllowed() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : '' }, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, '', bSilent ? [] : ['MessageList']); } }; /** * @param {?Function} fCallback * @param {Array} aDownloads */ RemoteUserStorage.prototype.messageUploadAttachments = function (fCallback, aDownloads) { this.defaultRequest(fCallback, 'MessageUploadAttachments', { 'Attachments': aDownloads }, 999000); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw * @param {number} iUid * @return {boolean} */ RemoteUserStorage.prototype.message = function (fCallback, sFolderFullNameRaw, iUid) { sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw); iUid = Utils.pInt(iUid); if (Cache.getFolderFromCacheList(sFolderFullNameRaw) && 0 < iUid) { this.defaultRequest(fCallback, 'Message', {}, null, 'Message/' + Base64.urlsafe_encode([ sFolderFullNameRaw, iUid, AppStore.projectHash(), AppStore.threadsAllowed() && SettingsStore.useThreads() ? '1' : '0' ].join(String.fromCharCode(0))), ['Message']); return true; } return false; }; /** * @param {?Function} fCallback * @param {Array} aExternals */ RemoteUserStorage.prototype.composeUploadExternals = function (fCallback, aExternals) { this.defaultRequest(fCallback, 'ComposeUploadExternals', { 'Externals': aExternals }, 999000); }; /** * @param {?Function} fCallback * @param {string} sUrl * @param {string} sAccessToken */ RemoteUserStorage.prototype.composeUploadDrive = function (fCallback, sUrl, sAccessToken) { this.defaultRequest(fCallback, 'ComposeUploadDrive', { 'AccessToken': sAccessToken, 'Url': sUrl }, 999000); }; /** * @param {?Function} fCallback * @param {string} sFolder * @param {Array=} aList = [] */ RemoteUserStorage.prototype.folderInformation = function (fCallback, sFolder, aList) { var bRequest = true, aUids = [] ; if (Utils.isArray(aList) && 0 < aList.length) { bRequest = false; _.each(aList, function (oMessageListItem) { if (!Cache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, oMessageListItem.uid)) { aUids.push(oMessageListItem.uid); } if (0 < oMessageListItem.threads().length) { _.each(oMessageListItem.threads(), function (sUid) { if (!Cache.getMessageFlagsFromCache(oMessageListItem.folderFullNameRaw, sUid)) { aUids.push(sUid); } }); } }); if (0 < aUids.length) { bRequest = true; } } if (bRequest) { this.defaultRequest(fCallback, 'FolderInformation', { 'Folder': sFolder, 'FlagsUids': Utils.isArray(aUids) ? aUids.join(',') : '', 'UidNext': Cache.getFolderInboxName() === sFolder ? Cache.getFolderUidNext(sFolder) : '' }); } else if (SettingsStore.useThreads()) { __webpack_require__(/*! App/User */ 6).reloadFlagsCurrentMessageListAndMessageFromCache(); } }; /** * @param {?Function} fCallback * @param {Array} aFolders */ RemoteUserStorage.prototype.folderInformationMultiply = function (fCallback, aFolders) { this.defaultRequest(fCallback, 'FolderInformationMultiply', { 'Folders': aFolders }); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.logout = function (fCallback) { this.defaultRequest(fCallback, 'Logout'); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw * @param {Array} aUids * @param {boolean} bSetFlagged */ RemoteUserStorage.prototype.messageSetFlagged = function (fCallback, sFolderFullNameRaw, aUids, bSetFlagged) { this.defaultRequest(fCallback, 'MessageSetFlagged', { 'Folder': sFolderFullNameRaw, 'Uids': aUids.join(','), 'SetAction': bSetFlagged ? '1' : '0' }); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw * @param {Array} aUids * @param {boolean} bSetSeen */ RemoteUserStorage.prototype.messageSetSeen = function (fCallback, sFolderFullNameRaw, aUids, bSetSeen) { this.defaultRequest(fCallback, 'MessageSetSeen', { 'Folder': sFolderFullNameRaw, 'Uids': aUids.join(','), 'SetAction': bSetSeen ? '1' : '0' }); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw * @param {boolean} bSetSeen */ RemoteUserStorage.prototype.messageSetSeenToAll = function (fCallback, sFolderFullNameRaw, bSetSeen) { this.defaultRequest(fCallback, 'MessageSetSeenToAll', { 'Folder': sFolderFullNameRaw, 'SetAction': bSetSeen ? '1' : '0' }); }; /** * @param {?Function} fCallback * @param {string} sMessageFolder * @param {string} sMessageUid * @param {string} sDraftFolder * @param {string} sFrom * @param {string} sTo * @param {string} sCc * @param {string} sBcc * @param {string} sSubject * @param {boolean} bTextIsHtml * @param {string} sText * @param {Array} aAttachments * @param {(Array|null)} aDraftInfo * @param {string} sInReplyTo * @param {string} sReferences * @param {boolean} bMarkAsImportant */ RemoteUserStorage.prototype.saveMessage = function (fCallback, sMessageFolder, sMessageUid, sDraftFolder, sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bMarkAsImportant) { this.defaultRequest(fCallback, 'SaveMessage', { 'MessageFolder': sMessageFolder, 'MessageUid': sMessageUid, 'DraftFolder': sDraftFolder, 'From': sFrom, 'To': sTo, 'Cc': sCc, 'Bcc': sBcc, 'Subject': sSubject, 'TextIsHtml': bTextIsHtml ? '1' : '0', 'Text': sText, 'DraftInfo': aDraftInfo, 'InReplyTo': sInReplyTo, 'References': sReferences, 'MarkAsImportant': bMarkAsImportant ? '1' : '0', 'Attachments': aAttachments }, Consts.Defaults.SaveMessageAjaxTimeout); }; /** * @param {?Function} fCallback * @param {string} sMessageFolder * @param {string} sMessageUid * @param {string} sReadReceipt * @param {string} sSubject * @param {string} sText */ RemoteUserStorage.prototype.sendReadReceiptMessage = function (fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText) { this.defaultRequest(fCallback, 'SendReadReceiptMessage', { 'MessageFolder': sMessageFolder, 'MessageUid': sMessageUid, 'ReadReceipt': sReadReceipt, 'Subject': sSubject, 'Text': sText }); }; /** * @param {?Function} fCallback * @param {string} sMessageFolder * @param {string} sMessageUid * @param {string} sSentFolder * @param {string} sFrom * @param {string} sTo * @param {string} sCc * @param {string} sBcc * @param {string} sSubject * @param {boolean} bTextIsHtml * @param {string} sText * @param {Array} aAttachments * @param {(Array|null)} aDraftInfo * @param {string} sInReplyTo * @param {string} sReferences * @param {boolean} bRequestReadReceipt * @param {boolean} bMarkAsImportant */ RemoteUserStorage.prototype.sendMessage = function (fCallback, sMessageFolder, sMessageUid, sSentFolder, sFrom, sTo, sCc, sBcc, sSubject, bTextIsHtml, sText, aAttachments, aDraftInfo, sInReplyTo, sReferences, bRequestReadReceipt, bMarkAsImportant) { this.defaultRequest(fCallback, 'SendMessage', { 'MessageFolder': sMessageFolder, 'MessageUid': sMessageUid, 'SentFolder': sSentFolder, 'From': sFrom, 'To': sTo, 'Cc': sCc, 'Bcc': sBcc, 'Subject': sSubject, 'TextIsHtml': bTextIsHtml ? '1' : '0', 'Text': sText, 'DraftInfo': aDraftInfo, 'InReplyTo': sInReplyTo, 'References': sReferences, 'ReadReceiptRequest': bRequestReadReceipt ? '1' : '0', 'MarkAsImportant': bMarkAsImportant ? '1' : '0', 'Attachments': aAttachments }, Consts.Defaults.SendMessageAjaxTimeout); }; /** * @param {?Function} fCallback * @param {Object} oData */ RemoteUserStorage.prototype.saveSystemFolders = function (fCallback, oData) { this.defaultRequest(fCallback, 'SystemFoldersUpdate', oData); }; /** * @param {?Function} fCallback * @param {Object} oData */ RemoteUserStorage.prototype.saveSettings = function (fCallback, oData) { this.defaultRequest(fCallback, 'SettingsUpdate', oData); }; /** * @param {?Function} fCallback * @param {string} sPrevPassword * @param {string} sNewPassword */ RemoteUserStorage.prototype.changePassword = function (fCallback, sPrevPassword, sNewPassword) { this.defaultRequest(fCallback, 'ChangePassword', { 'PrevPassword': sPrevPassword, 'NewPassword': sNewPassword }); }; /** * @param {?Function} fCallback * @param {string} sNewFolderName * @param {string} sParentName */ RemoteUserStorage.prototype.folderCreate = function (fCallback, sNewFolderName, sParentName) { this.defaultRequest(fCallback, 'FolderCreate', { 'Folder': sNewFolderName, 'Parent': sParentName }, null, '', ['Folders']); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw */ RemoteUserStorage.prototype.folderDelete = function (fCallback, sFolderFullNameRaw) { this.defaultRequest(fCallback, 'FolderDelete', { 'Folder': sFolderFullNameRaw }, null, '', ['Folders']); }; /** * @param {?Function} fCallback * @param {string} sPrevFolderFullNameRaw * @param {string} sNewFolderName */ RemoteUserStorage.prototype.folderRename = function (fCallback, sPrevFolderFullNameRaw, sNewFolderName) { this.defaultRequest(fCallback, 'FolderRename', { 'Folder': sPrevFolderFullNameRaw, 'NewFolderName': sNewFolderName }, null, '', ['Folders']); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw */ RemoteUserStorage.prototype.folderClear = function (fCallback, sFolderFullNameRaw) { this.defaultRequest(fCallback, 'FolderClear', { 'Folder': sFolderFullNameRaw }); }; /** * @param {?Function} fCallback * @param {string} sFolderFullNameRaw * @param {boolean} bSubscribe */ RemoteUserStorage.prototype.folderSetSubscribe = function (fCallback, sFolderFullNameRaw, bSubscribe) { this.defaultRequest(fCallback, 'FolderSubscribe', { 'Folder': sFolderFullNameRaw, 'Subscribe': bSubscribe ? '1' : '0' }); }; /** * @param {?Function} fCallback * @param {string} sFolder * @param {string} sToFolder * @param {Array} aUids * @param {string=} sLearning */ RemoteUserStorage.prototype.messagesMove = function (fCallback, sFolder, sToFolder, aUids, sLearning) { this.defaultRequest(fCallback, 'MessageMove', { 'FromFolder': sFolder, 'ToFolder': sToFolder, 'Uids': aUids.join(','), 'Learning': sLearning || '' }, null, '', ['MessageList']); }; /** * @param {?Function} fCallback * @param {string} sFolder * @param {string} sToFolder * @param {Array} aUids */ RemoteUserStorage.prototype.messagesCopy = function (fCallback, sFolder, sToFolder, aUids) { this.defaultRequest(fCallback, 'MessageCopy', { 'FromFolder': sFolder, 'ToFolder': sToFolder, 'Uids': aUids.join(',') }); }; /** * @param {?Function} fCallback * @param {string} sFolder * @param {Array} aUids */ RemoteUserStorage.prototype.messagesDelete = function (fCallback, sFolder, aUids) { this.defaultRequest(fCallback, 'MessageDelete', { 'Folder': sFolder, 'Uids': aUids.join(',') }, null, '', ['MessageList']); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.appDelayStart = function (fCallback) { this.defaultRequest(fCallback, 'AppDelayStart'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.quota = function (fCallback) { this.defaultRequest(fCallback, 'Quota'); }; /** * @param {?Function} fCallback * @param {number} iOffset * @param {number} iLimit * @param {string} sSearch */ RemoteUserStorage.prototype.contacts = function (fCallback, iOffset, iLimit, sSearch) { this.defaultRequest(fCallback, 'Contacts', { 'Offset': iOffset, 'Limit': iLimit, 'Search': sSearch }, null, '', ['Contacts']); }; /** * @param {?Function} fCallback * @param {string} sRequestUid * @param {string} sUid * @param {Array} aProperties */ RemoteUserStorage.prototype.contactSave = function (fCallback, sRequestUid, sUid, aProperties) { this.defaultRequest(fCallback, 'ContactSave', { 'RequestUid': sRequestUid, 'Uid': Utils.trim(sUid), 'Properties': aProperties }); }; /** * @param {?Function} fCallback * @param {Array} aUids */ RemoteUserStorage.prototype.contactsDelete = function (fCallback, aUids) { this.defaultRequest(fCallback, 'ContactsDelete', { 'Uids': aUids.join(',') }); }; /** * @param {?Function} fCallback * @param {string} sQuery * @param {number} iPage */ RemoteUserStorage.prototype.suggestions = function (fCallback, sQuery, iPage) { this.defaultRequest(fCallback, 'Suggestions', { 'Query': sQuery, 'Page': iPage }, null, '', ['Suggestions']); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.clearUserBackground = function (fCallback) { this.defaultRequest(fCallback, 'ClearUserBackground'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.facebookUser = function (fCallback) { this.defaultRequest(fCallback, 'SocialFacebookUserInformation'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.facebookDisconnect = function (fCallback) { this.defaultRequest(fCallback, 'SocialFacebookDisconnect'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.twitterUser = function (fCallback) { this.defaultRequest(fCallback, 'SocialTwitterUserInformation'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.twitterDisconnect = function (fCallback) { this.defaultRequest(fCallback, 'SocialTwitterDisconnect'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.googleUser = function (fCallback) { this.defaultRequest(fCallback, 'SocialGoogleUserInformation'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.googleDisconnect = function (fCallback) { this.defaultRequest(fCallback, 'SocialGoogleDisconnect'); }; /** * @param {?Function} fCallback */ RemoteUserStorage.prototype.socialUsers = function (fCallback) { this.defaultRequest(fCallback, 'SocialUsers'); }; module.exports = new RemoteUserStorage(); }()); /***/ }, /* 15 */ /*!**********************************!*\ !*** ./dev/Storage/User/Data.js ***! \**********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), ko = __webpack_require__(/*! ko */ 3), moment = __webpack_require__(/*! moment */ 36), Consts = __webpack_require__(/*! Common/Consts */ 16), Enums = __webpack_require__(/*! Common/Enums */ 4), Globals = __webpack_require__(/*! Common/Globals */ 8), Utils = __webpack_require__(/*! Common/Utils */ 1), Links = __webpack_require__(/*! Common/Links */ 12), Translator = __webpack_require__(/*! Common/Translator */ 7), SettingsStore = __webpack_require__(/*! Stores/User/Settings */ 26), Settings = __webpack_require__(/*! Storage/Settings */ 9), Cache = __webpack_require__(/*! Storage/User/Cache */ 19), kn = __webpack_require__(/*! Knoin/Knoin */ 5), MessageModel = __webpack_require__(/*! Model/Message */ 81) ; /** * @constructor */ function DataUserStorage() { // contacts this.contacts = ko.observableArray([]); this.contacts.loading = ko.observable(false).extend({'throttle': 200}); this.contacts.importing = ko.observable(false).extend({'throttle': 200}); this.contacts.syncing = ko.observable(false).extend({'throttle': 200}); this.contacts.exportingVcf = ko.observable(false).extend({'throttle': 200}); this.contacts.exportingCsv = ko.observable(false).extend({'throttle': 200}); this.allowContactsSync = ko.observable(false); this.enableContactsSync = ko.observable(false); this.contactsSyncUrl = ko.observable(''); this.contactsSyncUser = ko.observable(''); this.contactsSyncPass = ko.observable(''); this.allowContactsSync = ko.observable(!!Settings.settingsGet('ContactsSyncIsAllowed')); this.enableContactsSync = ko.observable(!!Settings.settingsGet('EnableContactsSync')); this.contactsSyncUrl = ko.observable(Settings.settingsGet('ContactsSyncUrl')); this.contactsSyncUser = ko.observable(Settings.settingsGet('ContactsSyncUser')); this.contactsSyncPass = ko.observable(Settings.settingsGet('ContactsSyncPassword')); // folders this.namespace = ''; this.folderList = ko.observableArray([]); this.folderList.focused = ko.observable(false); this.folderList.optimized = ko.observable(false); this.folderList.error = ko.observable(''); this.foldersLoading = ko.observable(false); this.foldersCreating = ko.observable(false); this.foldersDeleting = ko.observable(false); this.foldersRenaming = ko.observable(false); this.foldersChanging = ko.computed(function () { var bLoading = this.foldersLoading(), bCreating = this.foldersCreating(), bDeleting = this.foldersDeleting(), bRenaming = this.foldersRenaming() ; return bLoading || bCreating || bDeleting || bRenaming; }, this); this.foldersInboxUnreadCount = ko.observable(0); this.currentFolder = ko.observable(null).extend({'toggleSubscribe': [null, function (oPrev) { if (oPrev) { oPrev.selected(false); } }, function (oNext) { if (oNext) { oNext.selected(true); } } ]}); this.currentFolderFullNameRaw = ko.computed(function () { return this.currentFolder() ? this.currentFolder().fullNameRaw : ''; }, this); this.currentFolderFullName = ko.computed(function () { return this.currentFolder() ? this.currentFolder().fullName : ''; }, this); this.currentFolderFullNameHash = ko.computed(function () { return this.currentFolder() ? this.currentFolder().fullNameHash : ''; }, this); this.currentFolderName = ko.computed(function () { return this.currentFolder() ? this.currentFolder().name() : ''; }, this); this.folderListSystemNames = ko.computed(function () { var FolderStore = __webpack_require__(/*! Stores/User/Folder */ 32), aList = [Cache.getFolderInboxName()], aFolders = this.folderList(), sSentFolder = FolderStore.sentFolder(), sDraftFolder = FolderStore.draftFolder(), sSpamFolder = FolderStore.spamFolder(), sTrashFolder = FolderStore.trashFolder(), sArchiveFolder = FolderStore.archiveFolder() ; if (Utils.isArray(aFolders) && 0 < aFolders.length) { if ('' !== sSentFolder && Consts.Values.UnuseOptionValue !== sSentFolder) { aList.push(sSentFolder); } if ('' !== sDraftFolder && Consts.Values.UnuseOptionValue !== sDraftFolder) { aList.push(sDraftFolder); } if ('' !== sSpamFolder && Consts.Values.UnuseOptionValue !== sSpamFolder) { aList.push(sSpamFolder); } if ('' !== sTrashFolder && Consts.Values.UnuseOptionValue !== sTrashFolder) { aList.push(sTrashFolder); } if ('' !== sArchiveFolder && Consts.Values.UnuseOptionValue !== sArchiveFolder) { aList.push(sArchiveFolder); } } return aList; }, this); this.folderListSystem = ko.computed(function () { return _.compact(_.map(this.folderListSystemNames(), function (sName) { return Cache.getFolderFromCacheList(sName); })); }, this); this.folderMenuForMove = ko.computed(function () { return Utils.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), [ this.currentFolderFullNameRaw() ], null, null, null, null, function (oItem) { return oItem ? oItem.localName() : ''; }); }, this); this.folderMenuForFilters = ko.computed(function () { return Utils.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), ['INBOX'], [['', '']], null, null, null, function (oItem) { return oItem ? oItem.localName() : ''; } ); }, this); // message list this.staticMessageList = []; this.messageList = ko.observableArray([]).extend({'rateLimit': 0}); this.messageListCount = ko.observable(0); this.messageListSearch = ko.observable(''); this.messageListPage = ko.observable(1); this.messageListThreadFolder = ko.observable(''); this.messageListThreadUids = ko.observableArray([]); this.messageListThreadFolder.subscribe(function () { this.messageListThreadUids([]); }, this); this.messageListEndFolder = ko.observable(''); this.messageListEndSearch = ko.observable(''); this.messageListEndPage = ko.observable(1); this.messageListEndHash = ko.computed(function () { return this.messageListEndFolder() + '|' + this.messageListEndSearch() + '|' + this.messageListEndPage(); }, this); this.messageListPageCount = ko.computed(function () { var iPage = window.Math.ceil(this.messageListCount() / SettingsStore.messagesPerPage()); return 0 >= iPage ? 1 : iPage; }, this); this.mainMessageListSearch = ko.computed({ 'read': this.messageListSearch, 'write': function (sValue) { kn.setHash(Links.mailBox( this.currentFolderFullNameHash(), 1, Utils.trim(sValue.toString()) )); }, 'owner': this }); this.messageListError = ko.observable(''); this.messageListLoading = ko.observable(false); this.messageListIsNotCompleted = ko.observable(false); this.messageListCompleteLoadingThrottle = ko.observable(false).extend({'throttle': 200}); this.messageListCompleteLoading = ko.computed(function () { var bOne = this.messageListLoading(), bTwo = this.messageListIsNotCompleted() ; return bOne || bTwo; }, this); this.messageListCompleteLoading.subscribe(function (bValue) { this.messageListCompleteLoadingThrottle(bValue); }, this); this.messageList.subscribe(_.debounce(function (aList) { _.each(aList, function (oItem) { if (oItem.newForAnimation()) { oItem.newForAnimation(false); } }); }, 500)); // message preview this.staticMessageList = new MessageModel(); this.message = ko.observable(null); this.messageLoading = ko.observable(false); this.messageLoadingThrottle = ko.observable(false).extend({'throttle': 50}); this.message.focused = ko.observable(false); this.message.subscribe(function (oMessage) { if (!oMessage) { this.message.focused(false); this.messageFullScreenMode(false); this.hideMessageBodies(); if (Enums.Layout.NoPreview === SettingsStore.layout() && -1 < window.location.hash.indexOf('message-preview')) { __webpack_require__(/*! App/User */ 6).historyBack(); } } else if (Enums.Layout.NoPreview === SettingsStore.layout()) { this.message.focused(true); } }, this); this.message.focused.subscribe(function (bValue) { if (bValue) { this.folderList.focused(false); Globals.keyScope(Enums.KeyState.MessageView); } else if (Enums.KeyState.MessageView === Globals.keyScope()) { if (Enums.Layout.NoPreview === SettingsStore.layout() && this.message()) { Globals.keyScope(Enums.KeyState.MessageView); } else { Globals.keyScope(Enums.KeyState.MessageList); } } }, this); this.folderList.focused.subscribe(function (bValue) { if (bValue) { Globals.keyScope(Enums.KeyState.FolderList); } else if (Enums.KeyState.FolderList === Globals.keyScope()) { Globals.keyScope(Enums.KeyState.MessageList); } }); this.messageLoading.subscribe(function (bValue) { this.messageLoadingThrottle(bValue); }, this); this.messageFullScreenMode = ko.observable(false); this.messageError = ko.observable(''); this.messagesBodiesDom = ko.observable(null); this.messagesBodiesDom.subscribe(function (oDom) { if (oDom && !(oDom instanceof $)) { this.messagesBodiesDom($(oDom)); } }, this); this.messageActiveDom = ko.observable(null); this.isMessageSelected = ko.computed(function () { return null !== this.message(); }, this); this.currentMessage = ko.observable(null); this.messageListChecked = ko.computed(function () { return _.filter(this.messageList(), function (oItem) { return oItem.checked(); }); }, this).extend({'rateLimit': 0}); this.hasCheckedMessages = ko.computed(function () { return 0 < this.messageListChecked().length; }, this).extend({'rateLimit': 0}); this.messageListCheckedOrSelected = ko.computed(function () { var aChecked = this.messageListChecked(), oSelectedMessage = this.currentMessage() ; return _.union(aChecked, oSelectedMessage ? [oSelectedMessage] : []); }, this); this.messageListCheckedOrSelectedUidsWithSubMails = ko.computed(function () { var aList = []; _.each(this.messageListCheckedOrSelected(), function (oMessage) { if (oMessage) { aList.push(oMessage.uid); if (0 < oMessage.threadsLen() && 0 === oMessage.parentUid() && oMessage.lastInCollapsedThread()) { aList = _.union(aList, oMessage.threads()); } } }); return aList; }, this); // other this.composeInEdit = ko.observable(false); this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30); } DataUserStorage.prototype.purgeMessageBodyCache = function() { var iCount = 0, oMessagesBodiesDom = null, iEnd = Globals.iMessageBodyCacheCount - Consts.Values.MessageBodyCacheLimit ; if (0 < iEnd) { oMessagesBodiesDom = this.messagesBodiesDom(); if (oMessagesBodiesDom) { oMessagesBodiesDom.find('.rl-cache-class').each(function () { var oItem = $(this); if (iEnd > oItem.data('rl-cache-count')) { oItem.addClass('rl-cache-purge'); iCount++; } }); if (0 < iCount) { _.delay(function () { oMessagesBodiesDom.find('.rl-cache-purge').remove(); }, 300); } } } }; DataUserStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages) { if (Cache.getFolderInboxName() === sFolder && Utils.isNormal(sUidNext) && sUidNext !== '') { if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length) { var iIndex = 0, iLen = aNewMessages.length, NotificationStore = __webpack_require__(/*! Stores/User/Notification */ 66) ; _.each(aNewMessages, function (oItem) { Cache.addNewMessageCache(sFolder, oItem.Uid); }); NotificationStore.playSoundNotification(); if (3 < iLen) { NotificationStore.displayDesktopNotification( Links.notificationMailIcon(), __webpack_require__(/*! Stores/User/Account */ 22).email(), Translator.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', { 'COUNT': iLen }) ); } else { for (; iIndex < iLen; iIndex++) { NotificationStore.displayDesktopNotification( Links.notificationMailIcon(), MessageModel.emailsToLine(MessageModel.initEmailsFromJson(aNewMessages[iIndex].From), false), aNewMessages[iIndex].Subject ); } } } Cache.setFolderUidNext(sFolder, sUidNext); } }; DataUserStorage.prototype.hideMessageBodies = function () { var oMessagesBodiesDom = this.messagesBodiesDom(); if (oMessagesBodiesDom) { oMessagesBodiesDom.find('.b-text-part').hide(); } }; /** * @param {boolean=} bBoot = false * @returns {Array} */ DataUserStorage.prototype.getNextFolderNames = function (bBoot) { bBoot = Utils.isUnd(bBoot) ? false : !!bBoot; var aResult = [], iLimit = 5, iUtc = moment().unix(), iTimeout = iUtc - 60 * 5, aTimeouts = [], sInboxFolderName = Cache.getFolderInboxName(), fSearchFunction = function (aList) { _.each(aList, function (oFolder) { if (oFolder && sInboxFolderName !== oFolder.fullNameRaw && oFolder.selectable && oFolder.existen && iTimeout > oFolder.interval && (!bBoot || oFolder.subScribed())) { aTimeouts.push([oFolder.interval, oFolder.fullNameRaw]); } if (oFolder && 0 < oFolder.subFolders().length) { fSearchFunction(oFolder.subFolders()); } }); } ; fSearchFunction(this.folderList()); aTimeouts.sort(function(a, b) { if (a[0] < b[0]) { return -1; } else if (a[0] > b[0]) { return 1; } return 0; }); _.find(aTimeouts, function (aItem) { var oFolder = Cache.getFolderFromCacheList(aItem[1]); if (oFolder) { oFolder.interval = iUtc; aResult.push(aItem[1]); } return iLimit <= aResult.length; }); return _.uniq(aResult); }; /** * @param {string} sFromFolderFullNameRaw * @param {Array} aUidForRemove * @param {string=} sToFolderFullNameRaw = '' * @param {bCopy=} bCopy = false */ DataUserStorage.prototype.removeMessagesFromList = function ( sFromFolderFullNameRaw, aUidForRemove, sToFolderFullNameRaw, bCopy) { sToFolderFullNameRaw = Utils.isNormal(sToFolderFullNameRaw) ? sToFolderFullNameRaw : ''; bCopy = Utils.isUnd(bCopy) ? false : !!bCopy; aUidForRemove = _.map(aUidForRemove, function (mValue) { return Utils.pInt(mValue); }); var self = this, iUnseenCount = 0, aMessageList = this.messageList(), oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw), oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''), sCurrentFolderFullNameRaw = this.currentFolderFullNameRaw(), oCurrentMessage = this.message(), aMessages = sCurrentFolderFullNameRaw === sFromFolderFullNameRaw ? _.filter(aMessageList, function (oMessage) { return oMessage && -1 < Utils.inArray(Utils.pInt(oMessage.uid), aUidForRemove); }) : [] ; _.each(aMessages, function (oMessage) { if (oMessage && oMessage.unseen()) { iUnseenCount++; } }); if (oFromFolder && !bCopy) { oFromFolder.messageCountAll(0 <= oFromFolder.messageCountAll() - aUidForRemove.length ? oFromFolder.messageCountAll() - aUidForRemove.length : 0); if (0 < iUnseenCount) { oFromFolder.messageCountUnread(0 <= oFromFolder.messageCountUnread() - iUnseenCount ? oFromFolder.messageCountUnread() - iUnseenCount : 0); } } if (oToFolder) { oToFolder.messageCountAll(oToFolder.messageCountAll() + aUidForRemove.length); if (0 < iUnseenCount) { oToFolder.messageCountUnread(oToFolder.messageCountUnread() + iUnseenCount); } oToFolder.actionBlink(true); } if (0 < aMessages.length) { if (bCopy) { _.each(aMessages, function (oMessage) { oMessage.checked(false); }); } else { this.messageListIsNotCompleted(true); _.each(aMessages, function (oMessage) { if (oCurrentMessage && oCurrentMessage.hash === oMessage.hash) { oCurrentMessage = null; self.message(null); } oMessage.deleted(true); }); _.delay(function () { _.each(aMessages, function (oMessage) { self.messageList.remove(oMessage); }); }, 400); } } if ('' !== sFromFolderFullNameRaw) { Cache.setFolderHash(sFromFolderFullNameRaw, ''); } if ('' !== sToFolderFullNameRaw) { Cache.setFolderHash(sToFolderFullNameRaw, ''); } }; /** * @param {Object} oMessageTextBody */ DataUserStorage.prototype.initBlockquoteSwitcher = function (oMessageTextBody) { if (oMessageTextBody) { var $oList = $('blockquote:not(.rl-bq-switcher)', oMessageTextBody).filter(function () { return 0 === $(this).parent().closest('blockquote', oMessageTextBody).length; }); if ($oList && 0 < $oList.length) { _.delay(function () { $oList.each(function () { var $self = $(this), iH = $self.height(); if (0 === iH || 150 < iH) { $self.addClass('rl-bq-switcher hidden-bq'); $('') .insertBefore($self) .click(function () { $self.toggleClass('hidden-bq'); Utils.windowResize(); }) .after('
') .before('
') ; } }); }, 100); } } }; DataUserStorage.prototype.setMessage = function (oData, bCached) { var bIsHtml = false, bHasExternals = false, bHasInternals = false, oBody = null, oTextBody = null, sId = '', sResultHtml = '', bPgpSigned = false, bPgpEncrypted = false, oMessagesBodiesDom = this.messagesBodiesDom(), oMessage = this.message() ; if (oData && oMessage && oData.Result && 'Object/Message' === oData.Result['@Object'] && oMessage.folderFullNameRaw === oData.Result.Folder && oMessage.uid === oData.Result.Uid) { this.messageError(''); oMessage.initUpdateByMessageJson(oData.Result); Cache.addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid); if (!bCached) { oMessage.initFlagsByJson(oData.Result); } oMessagesBodiesDom = oMessagesBodiesDom && oMessagesBodiesDom[0] ? oMessagesBodiesDom : null; if (oMessagesBodiesDom) { sId = 'rl-mgs-' + oMessage.hash.replace(/[^a-zA-Z0-9]/g, ''); oTextBody = oMessagesBodiesDom.find('#' + sId); if (!oTextBody || !oTextBody[0]) { bHasExternals = !!oData.Result.HasExternals; bHasInternals = !!oData.Result.HasInternals; oBody = $('
').hide().addClass('rl-cache-class'); oBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount); if (Utils.isNormal(oData.Result.Html) && '' !== oData.Result.Html) { bIsHtml = true; sResultHtml = oData.Result.Html.toString(); } else if (Utils.isNormal(oData.Result.Plain) && '' !== oData.Result.Plain) { bIsHtml = false; sResultHtml = Utils.plainToHtml(oData.Result.Plain.toString(), false); if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && __webpack_require__(/*! Stores/User/Pgp */ 20).capaOpenPGP()) { oMessage.plainRaw = Utils.pString(oData.Result.Plain); bPgpEncrypted = /---BEGIN PGP MESSAGE---/.test(oMessage.plainRaw); if (!bPgpEncrypted) { bPgpSigned = /-----BEGIN PGP SIGNED MESSAGE-----/.test(oMessage.plainRaw) && /-----BEGIN PGP SIGNATURE-----/.test(oMessage.plainRaw); } Globals.$div.empty(); if (bPgpSigned && oMessage.isPgpSigned()) { sResultHtml = Globals.$div.append( $('
').text(oMessage.plainRaw)
										).html()
									;
								}
								else if (bPgpEncrypted && oMessage.isPgpEncrypted())
								{
									sResultHtml =
										Globals.$div.append(
											$('
').text(oMessage.plainRaw)
										).html()
									;
								}

								Globals.$div.empty();

								oMessage.isPgpSigned(bPgpSigned);
								oMessage.isPgpEncrypted(bPgpEncrypted);
							}
						}
						else
						{
							bIsHtml = false;
						}

						oBody
							.html(Utils.findEmailAndLinks(sResultHtml))
							.addClass('b-text-part ' + (bIsHtml ? 'html' : 'plain'))
						;

						oMessage.isHtml(!!bIsHtml);
						oMessage.hasImages(!!bHasExternals);
						oMessage.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.None);
						oMessage.pgpSignedVerifyUser('');

						oMessage.body = oBody;
						if (oMessage.body)
						{
							oMessagesBodiesDom.append(oMessage.body);
						}

						oMessage.storeDataToDom();

						if (bHasInternals)
						{
							oMessage.showInternalImages(true);
						}

						if (oMessage.hasImages() && SettingsStore.showImages())
						{
							oMessage.showExternalImages(true);
						}

						this.purgeMessageBodyCacheThrottle();
					}
					else
					{
						oMessage.body = oTextBody;
						if (oMessage.body)
						{
							oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
							oMessage.fetchDataToDom();
						}
					}

					this.messageActiveDom(oMessage.body);

					this.hideMessageBodies();
					oMessage.body.show();

					if (oBody)
					{
						this.initBlockquoteSwitcher(oBody);
					}
				}

				Cache.initMessageFlagsFromCache(oMessage);
				if (oMessage.unseen())
				{
					__webpack_require__(/*! App/User */ 6).setMessageSeen(oMessage);
				}

				Utils.windowResize();
			}
		};

		/**
		 * @param {Array} aList
		 * @returns {string}
		 */
		DataUserStorage.prototype.calculateMessageListHash = function (aList)
		{
			return _.map(aList, function (oMessage) {
				return '' + oMessage.hash + '_' + oMessage.threadsLen() + '_' + oMessage.flagHash();
			}).join('|');
		};

		DataUserStorage.prototype.findPublicKeyByHex = function (sHash)
		{
			return _.find(__webpack_require__(/*! Stores/User/Pgp */ 20).openpgpkeysPublic(), function (oItem) {
				return oItem && sHash === oItem.id;
			});
		};

		DataUserStorage.prototype.findPublicKeysByEmail = function (sEmail)
		{
			var self = this;
			return _.compact(_.map(__webpack_require__(/*! Stores/User/Pgp */ 20).openpgpkeysPublic(), function (oItem) {

				var oKey = null;
				if (oItem && sEmail === oItem.email)
				{
					try
					{
						oKey = self.openpgp.key.readArmored(oItem.armor);
						if (oKey && !oKey.err && oKey.keys && oKey.keys[0])
						{
							return oKey.keys[0];
						}
					}
					catch (e) {}
				}

				return null;

			}));
		};

		/**
		 * @param {string} sEmail
		 * @param {string=} sPassword
		 * @returns {?}
		 */
		DataUserStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword)
		{
			var
				self = this,
				oPrivateKey = null,
				oKey = _.find(__webpack_require__(/*! Stores/User/Pgp */ 20).openpgpkeysPrivate(), function (oItem) {
					return oItem && sEmail === oItem.email;
				})
			;

			if (oKey)
			{
				try
				{
					oPrivateKey = self.openpgp.key.readArmored(oKey.armor);
					if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0])
					{
						oPrivateKey = oPrivateKey.keys[0];
						oPrivateKey.decrypt(Utils.pString(sPassword));
					}
					else
					{
						oPrivateKey = null;
					}
				}
				catch (e)
				{
					oPrivateKey = null;
				}
			}

			return oPrivateKey;
		};

		/**
		 * @param {string=} sPassword
		 * @returns {?}
		 */
		DataUserStorage.prototype.findSelfPrivateKey = function (sPassword)
		{
			return this.findPrivateKeyByEmail(__webpack_require__(/*! Stores/User/Account */ 22).email(), sPassword);
		};

		module.exports = new DataUserStorage();

	}());


/***/ },
/* 16 */
/*!******************************!*\
  !*** ./dev/Common/Consts.js ***!
  \******************************/
/***/ function(module, exports, __webpack_require__) {

	/* WEBPACK VAR INJECTION */(function(module) {
	(function () {

		'use strict';

		var Consts = {};

		Consts.Values = {};
		Consts.DataImages = {};
		Consts.Defaults = {};

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.MessagesPerPage = 20;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.ContactsPerPage = 50;

		/**
		 * @const
		 * @type {Array}
		 */
		Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.DefaultAjaxTimeout = 30000;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.SearchAjaxTimeout = 300000;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.SendMessageAjaxTimeout = 300000;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.SaveMessageAjaxTimeout = 200000;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Defaults.ContactsSyncAjaxTimeout = 200000;

		/**
		 * @const
		 * @type {string}
		 */
		Consts.Values.UnuseOptionValue = '__UNUSE__';

		/**
		 * @const
		 * @type {string}
		 */
		Consts.Values.ClientSideStorageIndexName = 'rlcsc';

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.ImapDefaulPort = 143;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.ImapDefaulSecurePort = 993;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.SieveDefaulPort = 4190;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.SmtpDefaulPort = 25;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.SmtpDefaulSecurePort = 465;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.MessageBodyCacheLimit = 15;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.AjaxErrorLimit = 7;

		/**
		 * @const
		 * @type {number}
		 */
		Consts.Values.TokenErrorLimit = 10;

		/**
		 * @const
		 * @type {string}
		 */
		Consts.Values.RainLoopTrialKey = 'RAINLOOP-TRIAL-KEY';

		/**
		 * @const
		 * @type {string}
		 */
	//	Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=';
		Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAYAAABXuSs3AAAHHklEQVRoQ7VZW08bVxCeXRuwIbTGXIwNtBBaqjwgVUiR8lDlbza9qe1DpVZ9aNQ/0KpPeaJK07SpcuEeCEmUAObm21bfrL9lONjexSYrWfbunj37zXdmvpkz9oIgCKTD0Wg0xPd94TDP83Q0zvWa50vzklSrdanVanqf4/D84GBGr+F+Op3S8fqoJxLOdnZgTvsO/nYhenHA+UC7CWF1uXwkb9++ldPTUwVerVbVqFQqpR8YPjQ0JCMjI5LNDijoRgP3PQVu5+5Eor2XGLg7IV4GkIdHJ/LmzRs5ODiIwNbrdR0O0GCcq4Xz4eFhmZyclP7+tDQaIik/BG5XKQn4SwG3zJTLZXn9+rUclI8UHD5YVoDDN8bSzXhONwL48fFxGR4eilzFZT1uFRIB5yT8BqCdnR3Z3d0VP9Un6XRawYJpggVrZBv38ME4XKtUKnLt2jUplUoy1PR/l3U7T6sVSAQcgMAkj8PDQ9ne3pajoyMRL7zeKsYZWHgWYDGmv78/mmdwcFA+mJlSgziHDWrERrsjEXDXegTi1tZW+DLxI2bxIrqFNYTXyDyCFweMAHCwb8e4RnTNuOsqe3t7sra21pTD0Kct666E8XlcZyzw9/RUUXK5nK5oUinUQI6TQ3cynO/v78vq6qrKXCNwlTiJJpyNGc3nZHp6uqV2dwrQWOCtZBDAV1ZWwsQk7f0wiQn5kffbAu/0/KWBYzIC1+XukfGx0RGZmppKlC2tIV0Bh4aDcZW7HhkfH8urLLZL7T2pihvlkMNnz56FiadHxicL41IsFpN41bkxsYxbRdFo9jwB8KdPn14J8KnSpBQKhQs63nPmbCVRcBUAR2Lq1VVmpksyMTFxAXjcEsQybiegESionjx5osCZOeNe1O4+EhCAX7bQSgQcxRHTMgAgcz5+/Dis/hL4uHU3/B4YGNASGHIKxuEql0k+l05AeIAF1vPnz5VxFFmdDlaJrMtZITJeSsXCOTlMunKxjLtMYOKNjQ158eJFuAuKkUOb5sEwgff19SkJUBVkThZUbnXZrtCKBQ6gbnWIkjZpyne3ejAWoGnA7Icz6irvBLgbOMicCM6TkxPx/LAkbXfgWcsazuE2kFRsKD5Z+CiqDumKncpZvieWcS6dDVD8xiYCNflpJdwcdwJOf9airLmVQ7DPzMxIYWLsXGXoVqLt5k0M3K3JUVPDZdbWNzsCp48TPFdvdnZWUz32nDha7bJ63kgAJPzSdRks9/Kf9xMJAQ1gq2NpaUmy2Yz4zar4nQC3xb99AQwCcGzLAAwuhG8YiWvcOKts+r4GOe5nMhm5efOm9lUA3E3vSZJRrKvE0fnPv//Jy5cvo5cTHIPQbSjhOoqq69evS19f6lxDKK4+sVhigZPtKJqbrQeqxd5+WR4+fKgqgT0k2XX3nhiPgETWXFhYkFzuPZ2yVq1GTSOXpE47/VjgNnD4m4GG7/LhsTx69EiwD4Vr2MwIIxgbAH18fKx1yfz8vEogNvGtWnCuhLZa9UTAreVWFsHy/b/+Vrbdl7E5REMQD2jDoUbByty+/ZnU64GkU2HzyJLhktU1cLv8nARgkYS2d3ajAgwG8qU2oLmDZ92CMaOjo7K4uCiZgbDWaRWgnZhPxLhrMUCvr69riwKZk1LHF7XqrWAO9hJxH6ozNzcnCx/PqztZg9mf6SQMscCtm2C5ke4BGMlHWTUp36036AJajDVrFMzBrhhWslQsSrFYiOqVpMriNYIgqFRq2j3FAb/zffT6zuxFXxsNzs3NTXn16lW4gYiW96w1FyedF+83xG/2FNGCRpU4NjamMsn+OZ9xE5RXqdaDdPpib6RWCzuwKF9RxqI2AVNQBwQYJoK0wdBejnqtEikP3pfP51XjUTESl12FqJEKxsEorARYDD44ONTeID7YpsEnrRvQfWAI2e8WfDaTUSIwJ0iBCmFOtOUAHvVMPp/TPwvYFVYFIuP8l+DBgwdaa2Miqwa0GgYwfeMltovbDfh6c1vIgMYcliSsKv4IWFr6VDHxvldvBAH+1sA+cnl5WYOPmmr9ir+1l9I0Cgz0yjhXjfJJ0JROnmezWbl165ayr/5fqwcBNr7IfhjMqKcvESSM4eRcCasQ3bDNObmKPLdGUGpZsN24cUNLBm9zazu4d++e6qpNBFaTuUS26U5dpuR1CxyA7J9ddrMRqlz4pwLLYawymPd++/2PADt2ugcGwq9gCCdhQ96C6xWwa6j1ceuq+I0EhW0i8MAIVJfeL3d/DVD8EKi12P6/2S2jV/EccVB54O/ejz/9HGCpoBBMta5rXMXLu53D1XAwjhXwvvv+h4BAXVe4bOu3O3ChxF08LiZFG3fel199G9CH3fLyqv24NcB44MRhpdK788U3CpyKwsCw590xmfSpzsBt0Fqc3ud3vtZigxWcVZCklVpSiN0w3q5E/h9TGMIUuA3+EQAAAABJRU5ErkJggg==';

		/**
		 * @const
		 * @type {string}
		 */
		Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';

		module.exports = Consts;

	}(module));
	/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! (webpack)/buildin/module.js */ 70)(module)))

/***/ },
/* 17 */,
/* 18 */,
/* 19 */
/*!***********************************!*\
  !*** ./dev/Storage/User/Cache.js ***!
  \***********************************/
/***/ function(module, exports, __webpack_require__) {

	
	(function () {

		'use strict';

		var
			_ = __webpack_require__(/*! _ */ 2),

			Enums = __webpack_require__(/*! Common/Enums */ 4),
			Utils = __webpack_require__(/*! Common/Utils */ 1),
			Links = __webpack_require__(/*! Common/Links */ 12),

			Settings = __webpack_require__(/*! Storage/Settings */ 9)
		;

		/**
		 * @constructor
		 */
		function CacheUserStorage()
		{
			this.oFoldersCache = {};
			this.oFoldersNamesCache = {};
			this.oFolderHashCache = {};
			this.oFolderUidNextCache = {};
			this.oMessageListHashCache = {};
			this.oMessageFlagsCache = {};
			this.oNewMessage = {};
			this.oRequestedMessage = {};

			this.bCapaGravatar = Settings.capa(Enums.Capa.Gravatar);
		}

		/**
		 * @type {boolean}
		 */
		CacheUserStorage.prototype.bCapaGravatar = false;

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oFoldersCache = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oFoldersNamesCache = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oFolderHashCache = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oFolderUidNextCache = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oMessageListHashCache = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oMessageFlagsCache = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oBodies = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oNewMessage = {};

		/**
		 * @type {Object}
		 */
		CacheUserStorage.prototype.oRequestedMessage = {};

		CacheUserStorage.prototype.clear = function ()
		{
			this.oFoldersCache = {};
			this.oFoldersNamesCache = {};
			this.oFolderHashCache = {};
			this.oFolderUidNextCache = {};
			this.oMessageListHashCache = {};
			this.oMessageFlagsCache = {};
			this.oBodies = {};
		};


		/**
		 * @param {string} sEmail
		 * @param {Function} fCallback
		 * @return {string}
		 */
		CacheUserStorage.prototype.getUserPic = function (sEmail, fCallback)
		{
			sEmail = Utils.trim(sEmail);
			fCallback(this.bCapaGravatar && '' !== sEmail ? Links.avatarLink(sEmail) : '', sEmail);
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @param {string} sUid
		 * @return {string}
		 */
		CacheUserStorage.prototype.getMessageKey = function (sFolderFullNameRaw, sUid)
		{
			return sFolderFullNameRaw + '#' + sUid;
		};

		/**
		 * @param {string} sFolder
		 * @param {string} sUid
		 */
		CacheUserStorage.prototype.addRequestedMessage = function (sFolder, sUid)
		{
			this.oRequestedMessage[this.getMessageKey(sFolder, sUid)] = true;
		};

		/**
		 * @param {string} sFolder
		 * @param {string} sUid
		 * @return {boolean}
		 */
		CacheUserStorage.prototype.hasRequestedMessage = function (sFolder, sUid)
		{
			return true === this.oRequestedMessage[this.getMessageKey(sFolder, sUid)];
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @param {string} sUid
		 */
		CacheUserStorage.prototype.addNewMessageCache = function (sFolderFullNameRaw, sUid)
		{
			this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = true;
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @param {string} sUid
		 */
		CacheUserStorage.prototype.hasNewMessageAndRemoveFromCache = function (sFolderFullNameRaw, sUid)
		{
			if (this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)])
			{
				this.oNewMessage[this.getMessageKey(sFolderFullNameRaw, sUid)] = null;
				return true;
			}

			return false;
		};

		CacheUserStorage.prototype.clearNewMessageCache = function ()
		{
			this.oNewMessage = {};
		};

		/**
		 * @type {string}
		 */
		CacheUserStorage.prototype.sInboxFolderName = '';

		/**
		 * @return {string}
		 */
		CacheUserStorage.prototype.getFolderInboxName = function ()
		{
			return '' === this.sInboxFolderName ? 'INBOX' : this.sInboxFolderName;
		};

		/**
		 * @param {string} sFolderHash
		 * @return {string}
		 */
		CacheUserStorage.prototype.getFolderFullNameRaw = function (sFolderHash)
		{
			return '' !== sFolderHash && this.oFoldersNamesCache[sFolderHash] ? this.oFoldersNamesCache[sFolderHash] : '';
		};

		/**
		 * @param {string} sFolderHash
		 * @param {string} sFolderFullNameRaw
		 */
		CacheUserStorage.prototype.setFolderFullNameRaw = function (sFolderHash, sFolderFullNameRaw)
		{
			this.oFoldersNamesCache[sFolderHash] = sFolderFullNameRaw;
			if ('INBOX' === sFolderFullNameRaw || '' === this.sInboxFolderName)
			{
				this.sInboxFolderName = sFolderFullNameRaw;
			}
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @return {string}
		 */
		CacheUserStorage.prototype.getFolderHash = function (sFolderFullNameRaw)
		{
			return '' !== sFolderFullNameRaw && this.oFolderHashCache[sFolderFullNameRaw] ? this.oFolderHashCache[sFolderFullNameRaw] : '';
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @param {string} sFolderHash
		 */
		CacheUserStorage.prototype.setFolderHash = function (sFolderFullNameRaw, sFolderHash)
		{
			this.oFolderHashCache[sFolderFullNameRaw] = sFolderHash;
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @return {string}
		 */
		CacheUserStorage.prototype.getFolderUidNext = function (sFolderFullNameRaw)
		{
			return '' !== sFolderFullNameRaw && this.oFolderUidNextCache[sFolderFullNameRaw] ? this.oFolderUidNextCache[sFolderFullNameRaw] : '';
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @param {string} sUidNext
		 */
		CacheUserStorage.prototype.setFolderUidNext = function (sFolderFullNameRaw, sUidNext)
		{
			this.oFolderUidNextCache[sFolderFullNameRaw] = sUidNext;
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @return {?FolderModel}
		 */
		CacheUserStorage.prototype.getFolderFromCacheList = function (sFolderFullNameRaw)
		{
			return '' !== sFolderFullNameRaw && this.oFoldersCache[sFolderFullNameRaw] ? this.oFoldersCache[sFolderFullNameRaw] : null;
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 * @param {?FolderModel} oFolder
		 */
		CacheUserStorage.prototype.setFolderToCacheList = function (sFolderFullNameRaw, oFolder)
		{
			this.oFoldersCache[sFolderFullNameRaw] = oFolder;
		};

		/**
		 * @param {string} sFolderFullNameRaw
		 */
		CacheUserStorage.prototype.removeFolderFromCacheList = function (sFolderFullNameRaw)
		{
			this.setFolderToCacheList(sFolderFullNameRaw, null);
		};

		/**
		 * @param {string} sFolderFullName
		 * @param {string} sUid
		 * @return {?Array}
		 */
		CacheUserStorage.prototype.getMessageFlagsFromCache = function (sFolderFullName, sUid)
		{
			return this.oMessageFlagsCache[sFolderFullName] && this.oMessageFlagsCache[sFolderFullName][sUid] ?
				this.oMessageFlagsCache[sFolderFullName][sUid] : null;
		};

		/**
		 * @param {string} sFolderFullName
		 * @param {string} sUid
		 * @param {Array} aFlagsCache
		 */
		CacheUserStorage.prototype.setMessageFlagsToCache = function (sFolderFullName, sUid, aFlagsCache)
		{
			if (!this.oMessageFlagsCache[sFolderFullName])
			{
				this.oMessageFlagsCache[sFolderFullName] = {};
			}

			this.oMessageFlagsCache[sFolderFullName][sUid] = aFlagsCache;
		};

		/**
		 * @param {string} sFolderFullName
		 */
		CacheUserStorage.prototype.clearMessageFlagsFromCacheByFolder = function (sFolderFullName)
		{
			this.oMessageFlagsCache[sFolderFullName] = {};
		};

		/**
		 * @param {(MessageModel|null)} oMessage
		 */
		CacheUserStorage.prototype.initMessageFlagsFromCache = function (oMessage)
		{
			if (oMessage)
			{
				var
					self = this,
					aFlags = this.getMessageFlagsFromCache(oMessage.folderFullNameRaw, oMessage.uid),
					mUnseenSubUid = null,
					mFlaggedSubUid = null
				;

				if (aFlags && 0 < aFlags.length)
				{
					oMessage.unseen(!!aFlags[0]);
					oMessage.flagged(!!aFlags[1]);
					oMessage.answered(!!aFlags[2]);
					oMessage.forwarded(!!aFlags[3]);
					oMessage.isReadReceipt(!!aFlags[4]);
				}

				if (0 < oMessage.threads().length)
				{
					mUnseenSubUid = _.find(oMessage.threads(), function (iSubUid) {
						var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
						return aFlags && 0 < aFlags.length && !!aFlags[0];
					});

					mFlaggedSubUid = _.find(oMessage.threads(), function (iSubUid) {
						var aFlags = self.getMessageFlagsFromCache(oMessage.folderFullNameRaw, iSubUid);
						return aFlags && 0 < aFlags.length && !!aFlags[1];
					});

					oMessage.hasUnseenSubMessage(mUnseenSubUid && 0 < Utils.pInt(mUnseenSubUid));
					oMessage.hasFlaggedSubMessage(mFlaggedSubUid && 0 < Utils.pInt(mFlaggedSubUid));
				}
			}
		};

		/**
		 * @param {(MessageModel|null)} oMessage
		 */
		CacheUserStorage.prototype.storeMessageFlagsToCache = function (oMessage)
		{
			if (oMessage)
			{
				this.setMessageFlagsToCache(
					oMessage.folderFullNameRaw,
					oMessage.uid,
					[oMessage.unseen(), oMessage.flagged(), oMessage.answered(), oMessage.forwarded(), oMessage.isReadReceipt()]
				);
			}
		};
		/**
		 * @param {string} sFolder
		 * @param {string} sUid
		 * @param {Array} aFlags
		 */
		CacheUserStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function (sFolder, sUid, aFlags)
		{
			if (Utils.isArray(aFlags) && 0 < aFlags.length)
			{
				this.setMessageFlagsToCache(sFolder, sUid, aFlags);
			}
		};

		module.exports = new CacheUserStorage();

	}());

/***/ },
/* 20 */
/*!********************************!*\
  !*** ./dev/Stores/User/Pgp.js ***!
  \********************************/
/***/ function(module, exports, __webpack_require__) {

	(function () {

		'use strict';

		var
			ko = __webpack_require__(/*! ko */ 3)
		;

		/**
		 * @constructor
		 */
		function PgpUserStore()
		{
			this.capaOpenPGP = ko.observable(false);
			
			this.openpgp = null;

			this.openpgpkeys = ko.observableArray([]);
			this.openpgpKeyring = null;

			this.openpgpkeysPublic = this.openpgpkeys.filter(function (oItem) {
				return !!(oItem && !oItem.isPrivate);
			});

			this.openpgpkeysPrivate = this.openpgpkeys.filter(function (oItem) {
				return !!(oItem && oItem.isPrivate);
			});
		}

	//	PgpUserStore.prototype.sign = function (sText, oPrivateKey)
	//	{
	//		try
	//		{
	//			return this.openpgp.signClearMessage([oPrivateKey], sText);
	//		}
	//		catch (oExc) {}
	//
	//		return sText;
	//	};
	//
	//	PgpUserStore.prototype.encrypt = function (sText, aPublicKeys)
	//	{
	//		try
	//		{
	//			return this.openpgp.encryptMessage(aPublicKeys, sText);
	//		}
	//		catch (oExc) {}
	//
	//		return sText;
	//	};
	//
	//	PgpUserStore.prototype.signAndEncrypt = function (sText, aPublicKeys, oPrivateKey)
	//	{
	//		try
	//		{
	//			return this.openpgp.signAndEncryptMessage(aPublicKeys, oPrivateKey, sText);
	//		}
	//		catch (oExc) {}
	//
	//		return sText;
	//	};
	//
	//	/**/
	//
	//	PgpUserStore.prototype.verify = function (sText, aPublicKeys)
	//	{
	//		var
	//			mPgpMessage = null
	//		;
	//
	//		try
	//		{
	//			mPgpMessage = this.openpgp.cleartext.readArmored(sText);
	//			if (mPgpMessage && mPgpMessage.getText)
	//			{
	//				mPgpMessage.verify(aPublicKeys);
	//			}
	//		}
	//		catch (oExc) {}
	//
	//		return false;
	//	};
	//
	//	PgpUserStore.prototype.decryptAndVerify = function (sEnctyptedText, aPublicKeys, oPivateKey)
	//	{
	//		var
	//			mPgpMessageDecrypted = null,
	//			mPgpMessage = null
	//		;
	//
	//		try
	//		{
	//			mPgpMessage = this.openpgp.message.readArmored(sEnctyptedText);
	//			if (mPgpMessage && oPivateKey && mPgpMessage.decrypt)
	//			{
	//				mPgpMessageDecrypted = mPgpMessage.decrypt(oPivateKey);
	//				if (mPgpMessageDecrypted)
	//				{
	//					mPgpMessageDecrypted.verify(aPublicKeys);
	//				}
	//			}
	//		}
	//		catch (oExc) {}
	//
	//		return false;
	//	};

		/**
		 * @return {boolean}
		 */
		PgpUserStore.prototype.isSupported = function ()
		{
			return !!this.openpgp;
		};

		module.exports = new PgpUserStore();

	}());



/***/ },
/* 21 */
/*!*****************************!*\
  !*** external "window.key" ***!
  \*****************************/
/***/ function(module, exports, __webpack_require__) {

	module.exports = window.key;

/***/ },
/* 22 */
/*!************************************!*\
  !*** ./dev/Stores/User/Account.js ***!
  \************************************/
/***/ function(module, exports, __webpack_require__) {

	
	(function () {

		'use strict';

		var
			_ = __webpack_require__(/*! _ */ 2),
			ko = __webpack_require__(/*! ko */ 3),

			Settings = __webpack_require__(/*! Storage/Settings */ 9),

			Remote = __webpack_require__(/*! Storage/User/Remote */ 14)
		;

		/**
		 * @constructor
		 */
		function AccountUserStore()
		{
			this.email = ko.observable('');
	//		this.incLogin = ko.observable('');
	//		this.outLogin = ko.observable('');

			this.displayName = ko.observable('');
			this.replyTo = ko.observable('');
			this.signature = ko.observable('');

			this.accounts = ko.observableArray([]);
			this.accounts.loading = ko.observable(false).extend({'throttle': 100});

			this.accountsEmailNames = ko.observableArray([]).extend({'throttle': 1000});
			this.accountsEmailNames.skipFirst = true;

			this.accounts.subscribe(function (aList) {
				this.accountsEmailNames(_.compact(_.map(aList, function (oItem) {
					return oItem ? oItem.email : null;
				})));
			}, this);

			this.accountsEmailNames.subscribe(function (aList) {
				if (this.accountsEmailNames.skipFirst)
				{
					this.accountsEmailNames.skipFirst = false;
				}
				else if (aList && 1 < aList.length)
				{
					Remote.accountSortOrder(null, aList);
				}
			}, this);

			this.accountsUnreadCount = ko.computed(function () {

				var iResult = 0;

	//			_.each(this.accounts(), function (oItem) {
	//				if (oItem)
	//				{
	//					iResult += oItem.count();
	//				}
	//			});

				return iResult;

			}, this);
		}

		AccountUserStore.prototype.populate = function ()
		{
			this.email(Settings.settingsGet('Email'));
	//		this.incLogin(Settings.settingsGet('IncLogin'));
	//		this.outLogin(Settings.settingsGet('OutLogin'));

			this.displayName(Settings.settingsGet('DisplayName'));
			this.replyTo(Settings.settingsGet('ReplyTo'));
			this.signature(Settings.settingsGet('Signature'));
		};

		module.exports = new AccountUserStore();

	}());


/***/ },
/* 23 */
/*!*******************************!*\
  !*** ./dev/Common/Plugins.js ***!
  \*******************************/
/***/ function(module, exports, __webpack_require__) {

	
	(function () {

		'use strict';

		var
			_ = __webpack_require__(/*! _ */ 2),

			Globals = __webpack_require__(/*! Common/Globals */ 8),
			Utils = __webpack_require__(/*! Common/Utils */ 1)
		;

		/**
		 * @constructor
		 */
		function Plugins()
		{
			this.oSettings = __webpack_require__(/*! Storage/Settings */ 9);
			this.oViewModelsHooks = {};
			this.oSimpleHooks = {};
		}

		/**
		 * @type {Object}
		 */
		Plugins.prototype.oSettings = {};

		/**
		 * @type {Object}
		 */
		Plugins.prototype.oViewModelsHooks = {};

		/**
		 * @type {Object}
		 */
		Plugins.prototype.oSimpleHooks = {};

		/**
		 * @param {string} sName
		 * @param {Function} fCallback
		 */
		Plugins.prototype.addHook = function (sName, fCallback)
		{
			if (Utils.isFunc(fCallback))
			{
				if (!Utils.isArray(this.oSimpleHooks[sName]))
				{
					this.oSimpleHooks[sName] = [];
				}

				this.oSimpleHooks[sName].push(fCallback);
			}
		};

		/**
		 * @param {string} sName
		 * @param {Array=} aArguments
		 */
		Plugins.prototype.runHook = function (sName, aArguments)
		{
			if (Utils.isArray(this.oSimpleHooks[sName]))
			{
				aArguments = aArguments || [];

				_.each(this.oSimpleHooks[sName], function (fCallback) {
					fCallback.apply(null, aArguments);
				});
			}
		};

		/**
		 * @param {string} sName
		 * @return {?}
		 */
		Plugins.prototype.mainSettingsGet = function (sName)
		{
			return this.oSettings.settingsGet(sName);
		};

		/**
		 * @param {Function} fCallback
		 * @param {string} sAction
		 * @param {Object=} oParameters
		 * @param {?number=} iTimeout
		 * @param {string=} sGetAdd = ''
		 * @param {Array=} aAbortActions = []
		 */
		Plugins.prototype.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
		{
			if (Globals.__APP__)
			{
				Globals.__APP__.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
			}
		};

		/**
		 * @param {string} sPluginSection
		 * @param {string} sName
		 * @return {?}
		 */
		Plugins.prototype.settingsGet = function (sPluginSection, sName)
		{
			var oPlugin = this.oSettings.settingsGet('Plugins');
			oPlugin = oPlugin && !Utils.isUnd(oPlugin[sPluginSection]) ? oPlugin[sPluginSection] : null;
			return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
		};

		module.exports = new Plugins();

	}());

/***/ },
/* 24 */
/*!************************************!*\
  !*** ./dev/Knoin/AbstractModel.js ***!
  \************************************/
/***/ function(module, exports, __webpack_require__) {

	
	(function () {

		'use strict';

		var
			_ = __webpack_require__(/*! _ */ 2),

			Utils = __webpack_require__(/*! Common/Utils */ 1)
		;

		/**
		 * @constructor
		 *
		 * @param {string} sModelName
		 */
		function AbstractModel(sModelName)
		{
			this.sModelName = sModelName || '';
			this.disposables = [];
		}

		/**
		 * @param {Array|Object} mInputValue
		 */
		AbstractModel.prototype.regDisposables = function (mInputValue)
		{
			if (Utils.isArray(mInputValue))
			{
				_.each(mInputValue, function (mValue) {
					this.disposables.push(mValue);
				}, this);
			}
			else if (mInputValue)
			{
				this.disposables.push(mInputValue);
			}

		};

		AbstractModel.prototype.onDestroy = function ()
		{
			Utils.disposeObject(this);
	//		window.console.log('onDestroy: ' + this.sModelName);
		};

		module.exports = AbstractModel;

	}());



/***/ },
/* 25 */
/*!****************************!*\
  !*** ./dev/Model/Email.js ***!
  \****************************/
/***/ function(module, exports, __webpack_require__) {

	
	(function () {

		'use strict';

		var
			Utils = __webpack_require__(/*! Common/Utils */ 1)
		;

		/**
		 * @param {string=} sEmail
		 * @param {string=} sName
		 * @param {string=} sDkimStatus
		 * @param {string=} sDkimValue
		 *
		 * @constructor
		 */
		function EmailModel(sEmail, sName, sDkimStatus, sDkimValue)
		{
			this.email = sEmail || '';
			this.name = sName || '';
			this.dkimStatus = sDkimStatus || 'none';
			this.dkimValue = sDkimValue || '';

			this.clearDuplicateName();
		}

		/**
		 * @static
		 * @param {AjaxJsonEmail} oJsonEmail
		 * @return {?EmailModel}
		 */
		EmailModel.newInstanceFromJson = function (oJsonEmail)
		{
			var oEmailModel = new EmailModel();
			return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
		};

		/**
		 * @type {string}
		 */
		EmailModel.prototype.name = '';

		/**
		 * @type {string}
		 */
		EmailModel.prototype.email = '';

		/**
		 * @type {string}
		 */
		EmailModel.prototype.dkimStatus = 'none';

		/**
		 * @type {string}
		 */
		EmailModel.prototype.dkimValue = '';

		EmailModel.prototype.clear = function ()
		{
			this.email = '';
			this.name = '';

			this.dkimStatus = 'none';
			this.dkimValue = '';
		};

		/**
		 * @returns {boolean}
		 */
		EmailModel.prototype.validate = function ()
		{
			return '' !== this.name || '' !== this.email;
		};

		/**
		 * @param {boolean} bWithoutName = false
		 * @return {string}
		 */
		EmailModel.prototype.hash = function (bWithoutName)
		{
			return '#' + (bWithoutName ? '' : this.name) + '#' + this.email + '#';
		};

		EmailModel.prototype.clearDuplicateName = function ()
		{
			if (this.name === this.email)
			{
				this.name = '';
			}
		};

		/**
		 * @param {string} sQuery
		 * @return {boolean}
		 */
		EmailModel.prototype.search = function (sQuery)
		{
			return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(sQuery.toLowerCase());
		};

		/**
		 * @param {string} sString
		 */
		EmailModel.prototype.parse = function (sString)
		{
			this.clear();

			sString = Utils.trim(sString);

			var
				mRegex = /(?:"([^"]+)")? ?[<]?(.*?@[^>,]+)>?,? ?/g,
				mMatch = mRegex.exec(sString)
			;

			if (mMatch)
			{
				this.name = mMatch[1] || '';
				this.email = mMatch[2] || '';

				this.clearDuplicateName();
			}
			else if ((/^[^@]+@[^@]+$/).test(sString))
			{
				this.name = '';
				this.email = sString;
			}
		};

		/**
		 * @param {AjaxJsonEmail} oJsonEmail
		 * @return {boolean}
		 */
		EmailModel.prototype.initByJson = function (oJsonEmail)
		{
			var bResult = false;
			if (oJsonEmail && 'Object/Email' === oJsonEmail['@Object'])
			{
				this.name = Utils.trim(oJsonEmail.Name);
				this.email = Utils.trim(oJsonEmail.Email);
				this.dkimStatus = Utils.trim(oJsonEmail.DkimStatus || '');
				this.dkimValue = Utils.trim(oJsonEmail.DkimValue || '');

				bResult = '' !== this.email;
				this.clearDuplicateName();
			}

			return bResult;
		};

		/**
		 * @param {boolean} bFriendlyView
		 * @param {boolean=} bWrapWithLink = false
		 * @param {boolean=} bEncodeHtml = false
		 * @return {string}
		 */
		EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
		{
			var sResult = '';
			if ('' !== this.email)
			{
				bWrapWithLink = Utils.isUnd(bWrapWithLink) ? false : !!bWrapWithLink;
				bEncodeHtml = Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml;

				if (bFriendlyView && '' !== this.name)
				{
					sResult = bWrapWithLink ? '
') + '" target="_blank" tabindex="-1">' + Utils.encodeHtml(this.name) + '' : (bEncodeHtml ? Utils.encodeHtml(this.name) : this.name); } else { sResult = this.email; if ('' !== this.name) { if (bWrapWithLink) { sResult = Utils.encodeHtml('"' + this.name + '" <') + '') + '" target="_blank" tabindex="-1">' + Utils.encodeHtml(sResult) + '' + Utils.encodeHtml('>'); } else { sResult = '"' + this.name + '" <' + sResult + '>'; if (bEncodeHtml) { sResult = Utils.encodeHtml(sResult); } } } else if (bWrapWithLink) { sResult = '' + Utils.encodeHtml(this.email) + ''; } } } return sResult; }; /** * @param {string} $sEmailAddress * @return {boolean} */ EmailModel.prototype.mailsoParse = function ($sEmailAddress) { $sEmailAddress = Utils.trim($sEmailAddress); if ('' === $sEmailAddress) { return false; } var substr = function (str, start, len) { str += ''; var end = str.length; if (start < 0) { start += end; } end = typeof len === 'undefined' ? end : (len < 0 ? len + end : len + start); return start >= str.length || start < 0 || start > end ? false : str.slice(start, end); }, substr_replace = function (str, replace, start, length) { if (start < 0) { start = start + str.length; } length = length !== undefined ? length : str.length; if (length < 0) { length = length + str.length - start; } return str.slice(0, start) + replace.substr(0, length) + replace.slice(length) + str.slice(start + length); }, $sName = '', $sEmail = '', $sComment = '', $bInName = false, $bInAddress = false, $bInComment = false, $aRegs = null, $iStartIndex = 0, $iEndIndex = 0, $iCurrentIndex = 0 ; while ($iCurrentIndex < $sEmailAddress.length) { switch ($sEmailAddress.substr($iCurrentIndex, 1)) { case '"': if ((!$bInName) && (!$bInAddress) && (!$bInComment)) { $bInName = true; $iStartIndex = $iCurrentIndex; } else if ((!$bInAddress) && (!$bInComment)) { $iEndIndex = $iCurrentIndex; $sName = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1); $sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1); $iEndIndex = 0; $iCurrentIndex = 0; $iStartIndex = 0; $bInName = false; } break; case '<': if ((!$bInName) && (!$bInAddress) && (!$bInComment)) { if ($iCurrentIndex > 0 && $sName.length === 0) { $sName = substr($sEmailAddress, 0, $iCurrentIndex); } $bInAddress = true; $iStartIndex = $iCurrentIndex; } break; case '>': if ($bInAddress) { $iEndIndex = $iCurrentIndex; $sEmail = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1); $sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1); $iEndIndex = 0; $iCurrentIndex = 0; $iStartIndex = 0; $bInAddress = false; } break; case '(': if ((!$bInName) && (!$bInAddress) && (!$bInComment)) { $bInComment = true; $iStartIndex = $iCurrentIndex; } break; case ')': if ($bInComment) { $iEndIndex = $iCurrentIndex; $sComment = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1); $sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1); $iEndIndex = 0; $iCurrentIndex = 0; $iStartIndex = 0; $bInComment = false; } break; case '\\': $iCurrentIndex++; break; } $iCurrentIndex++; } if ($sEmail.length === 0) { $aRegs = $sEmailAddress.match(/[^@\s]+@\S+/i); if ($aRegs && $aRegs[0]) { $sEmail = $aRegs[0]; } else { $sName = $sEmailAddress; } } if ($sEmail.length > 0 && $sName.length === 0 && $sComment.length === 0) { $sName = $sEmailAddress.replace($sEmail, ''); } $sEmail = Utils.trim($sEmail).replace(/^[<]+/, '').replace(/[>]+$/, ''); $sName = Utils.trim($sName).replace(/^["']+/, '').replace(/["']+$/, ''); $sComment = Utils.trim($sComment).replace(/^[(]+/, '').replace(/[)]+$/, ''); // Remove backslash $sName = $sName.replace(/\\\\(.)/g, '$1'); $sComment = $sComment.replace(/\\\\(.)/g, '$1'); this.name = $sName; this.email = $sEmail; this.clearDuplicateName(); return true; }; module.exports = EmailModel; }()); /***/ }, /* 26 */ /*!*************************************!*\ !*** ./dev/Stores/User/Settings.js ***! \*************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Consts = __webpack_require__(/*! Common/Consts */ 16), Enums = __webpack_require__(/*! Common/Enums */ 4), Globals = __webpack_require__(/*! Common/Globals */ 8), Utils = __webpack_require__(/*! Common/Utils */ 1), Events = __webpack_require__(/*! Common/Events */ 28), Settings = __webpack_require__(/*! Storage/Settings */ 9) ; /** * @constructor */ function SettingsUserStore() { this.layout = ko.observable(Enums.Layout.SidePreview) .extend({'limitedList': [ Enums.Layout.SidePreview, Enums.Layout.BottomPreview, Enums.Layout.NoPreview ]}); this.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html) .extend({'limitedList': [ Enums.EditorDefaultType.Html, Enums.EditorDefaultType.Plain, Enums.EditorDefaultType.HtmlForced, Enums.EditorDefaultType.PlainForced ]}); this.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage) .extend({'limitedList': Consts.Defaults.MessagesPerPageArray}); this.showImages = ko.observable(false); this.useCheckboxesInList = ko.observable(true); this.useThreads = ko.observable(false); this.replySameFolder = ko.observable(false); this.computedProperies(); this.subscribes(); } SettingsUserStore.prototype.computedProperies = function () { this.usePreviewPane = ko.computed(function () { return Enums.Layout.NoPreview !== this.layout(); }, this); }; SettingsUserStore.prototype.subscribes = function () { this.layout.subscribe(function (nValue) { Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue); Globals.$html.toggleClass('rl-side-preview-pane', Enums.Layout.SidePreview === nValue); Globals.$html.toggleClass('rl-bottom-preview-pane', Enums.Layout.BottomPreview === nValue); Events.pub('layout', [nValue]); }); }; SettingsUserStore.prototype.populate = function () { this.layout(Utils.pInt(Settings.settingsGet('Layout'))); this.editorDefaultType(Settings.settingsGet('EditorDefaultType')); this.messagesPerPage(Settings.settingsGet('MPP')); this.showImages(!!Settings.settingsGet('ShowImages')); this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList')); this.useThreads(!!Settings.settingsGet('UseThreads')); this.replySameFolder(!!Settings.settingsGet('ReplySameFolder')); }; module.exports = new SettingsUserStore(); }()); /***/ }, /* 27 */ /*!***********************************!*\ !*** ./dev/View/Popup/Compose.js ***! \***********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), ko = __webpack_require__(/*! ko */ 3), moment = __webpack_require__(/*! moment */ 36), JSON = __webpack_require__(/*! JSON */ 73), Jua = __webpack_require__(/*! Jua */ 74), Enums = __webpack_require__(/*! Common/Enums */ 4), Consts = __webpack_require__(/*! Common/Consts */ 16), Utils = __webpack_require__(/*! Common/Utils */ 1), Globals = __webpack_require__(/*! Common/Globals */ 8), Events = __webpack_require__(/*! Common/Events */ 28), Links = __webpack_require__(/*! Common/Links */ 12), HtmlEditor = __webpack_require__(/*! Common/HtmlEditor */ 47), Translator = __webpack_require__(/*! Common/Translator */ 7), AppStore = __webpack_require__(/*! Stores/User/App */ 30), SettingsStore = __webpack_require__(/*! Stores/User/Settings */ 26), IdentityStore = __webpack_require__(/*! Stores/User/Identity */ 43), AccountStore = __webpack_require__(/*! Stores/User/Account */ 22), FolderStore = __webpack_require__(/*! Stores/User/Folder */ 32), PgpStore = __webpack_require__(/*! Stores/User/Pgp */ 20), SocialStore = __webpack_require__(/*! Stores/Social */ 35), Settings = __webpack_require__(/*! Storage/Settings */ 9), Data = __webpack_require__(/*! Storage/User/Data */ 15), Cache = __webpack_require__(/*! Storage/User/Cache */ 19), Remote = __webpack_require__(/*! Storage/User/Remote */ 14), ComposeAttachmentModel = __webpack_require__(/*! Model/ComposeAttachment */ 96), kn = __webpack_require__(/*! Knoin/Knoin */ 5), AbstractView = __webpack_require__(/*! Knoin/AbstractView */ 11) ; /** * @constructor * @extends AbstractView */ function ComposePopupView() { AbstractView.call(this, 'Popups', 'PopupsCompose'); var self = this; this.oEditor = null; this.aDraftInfo = null; this.sInReplyTo = ''; this.bFromDraft = false; this.sReferences = ''; this.triggerForResize = _.bind(this.triggerForResize, this); this.bCapaAdditionalIdentities = Settings.capa(Enums.Capa.AdditionalIdentities); this.allowContacts = !!AppStore.contactsIsAllowed(); this.bSkipNextHide = false; this.composeInEdit = Data.composeInEdit; this.editorDefaultType = SettingsStore.editorDefaultType; this.capaOpenPGP = PgpStore.capaOpenPGP; this.resizer = ko.observable(false).extend({'throttle': 50}); this.identitiesDropdownTrigger = ko.observable(false); this.to = ko.observable(''); this.to.focusTrigger = ko.observable(false); this.cc = ko.observable(''); this.bcc = ko.observable(''); this.replyTo = ko.observable(''); this.subject = ko.observable(''); this.isHtml = ko.observable(false); this.requestReadReceipt = ko.observable(false); this.markAsImportant = ko.observable(false); this.sendError = ko.observable(false); this.sendSuccessButSaveError = ko.observable(false); this.savedError = ko.observable(false); this.savedTime = ko.observable(0); this.savedOrSendingText = ko.observable(''); this.emptyToError = ko.observable(false); this.attachmentsInProcessError = ko.observable(false); this.attachmentsInErrorError = ko.observable(false); this.showCc = ko.observable(false); this.showBcc = ko.observable(false); this.cc.subscribe(function (aValue) { if (false === self.showCc() && 0 < aValue.length) { self.showCc(true); } }, this); this.bcc.subscribe(function (aValue) { if (false === self.showBcc() && 0 < aValue.length) { self.showBcc(true); } }, this); this.draftFolder = ko.observable(''); this.draftUid = ko.observable(''); this.sending = ko.observable(false); this.saving = ko.observable(false); this.attachments = ko.observableArray([]); this.attachmentsInProcess = this.attachments.filter(function (oItem) { return oItem && !oItem.complete(); }); this.attachmentsInReady = this.attachments.filter(function (oItem) { return oItem && oItem.complete(); }); this.attachmentsInError = this.attachments.filter(function (oItem) { return oItem && '' !== oItem.error(); }); this.attachmentsCount = ko.computed(function () { return this.attachments().length; }, this); this.attachmentsInErrorCount = ko.computed(function () { return this.attachmentsInError().length; }, this); this.attachmentsInProcessCount = ko.computed(function () { return this.attachmentsInProcess().length; }, this); this.isDraftFolderMessage = ko.computed(function () { return '' !== this.draftFolder() && '' !== this.draftUid(); }, this); this.attachmentsPlace = ko.observable(false); this.attachments.subscribe(Utils.windowResizeCallback); this.attachmentsPlace.subscribe(Utils.windowResizeCallback); this.attachmentsInErrorCount.subscribe(function (iN) { if (0 === iN) { this.attachmentsInErrorError(false); } }, this); this.composeUploaderButton = ko.observable(null); this.composeUploaderDropPlace = ko.observable(null); this.dragAndDropEnabled = ko.observable(false); this.dragAndDropOver = ko.observable(false).extend({'throttle': 1}); this.dragAndDropVisible = ko.observable(false).extend({'throttle': 1}); this.attacheMultipleAllowed = ko.observable(false); this.addAttachmentEnabled = ko.observable(false); this.composeEditorArea = ko.observable(null); this.identities = IdentityStore.identities; this.defaultIdentityID = IdentityStore.defaultIdentityID; this.currentIdentityID = ko.observable(''); this.currentIdentityString = ko.observable(''); this.currentIdentityResultEmail = ko.observable(''); this.identitiesOptions = ko.computed(function () { var aList = [{ 'optValue': AccountStore.email(), 'optText': this.formattedFrom(false) }]; _.each(IdentityStore.identities(), function (oItem) { aList.push({ 'optValue': oItem.id, 'optText': oItem.formattedNameForCompose() }); }); return aList; }, this); ko.computed(function () { var sResult = '', sResultEmail = '', oItem = null, aList = IdentityStore.identities(), sID = this.currentIdentityID() ; if (this.bCapaAdditionalIdentities && sID && sID !== AccountStore.email()) { oItem = _.find(aList, function (oItem) { return oItem && sID === oItem['id']; }); sResult = oItem ? oItem.formattedNameForCompose() : ''; sResultEmail = oItem ? oItem.formattedNameForEmail() : ''; if ('' === sResult && aList[0]) { this.currentIdentityID(aList[0]['id']); return ''; } } if ('' === sResult) { sResult = this.formattedFrom(false); sResultEmail = this.formattedFrom(true); } this.currentIdentityString(sResult); this.currentIdentityResultEmail(sResultEmail); return sResult; }, this); this.to.subscribe(function (sValue) { if (this.emptyToError() && 0 < sValue.length) { this.emptyToError(false); } }, this); this.attachmentsInProcess.subscribe(function (aValue) { if (this.attachmentsInProcessError() && Utils.isArray(aValue) && 0 === aValue.length) { this.attachmentsInProcessError(false); } }, this); this.editorResizeThrottle = _.throttle(_.bind(this.editorResize, this), 100); this.resizer.subscribe(function () { this.editorResizeThrottle(); }, this); this.canBeSendedOrSaved = ko.computed(function () { return !this.sending() && !this.saving(); }, this); this.deleteCommand = Utils.createCommand(this, function () { __webpack_require__(/*! App/User */ 6).deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]); kn.hideScreenPopup(ComposePopupView); }, function () { return this.isDraftFolderMessage(); }); this.sendMessageResponse = _.bind(this.sendMessageResponse, this); this.saveMessageResponse = _.bind(this.saveMessageResponse, this); this.sendCommand = Utils.createCommand(this, function () { var sTo = Utils.trim(this.to()), sSentFolder = FolderStore.sentFolder(), aFlagsCache = [] ; if (0 < this.attachmentsInProcess().length) { this.attachmentsInProcessError(true); this.attachmentsPlace(true); } else if (0 < this.attachmentsInError().length) { this.attachmentsInErrorError(true); this.attachmentsPlace(true); } else if (0 === sTo.length) { this.emptyToError(true); } else { if (SettingsStore.replySameFolder()) { if (Utils.isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length && Utils.isNormal(this.aDraftInfo[2]) && 0 < this.aDraftInfo[2].length) { sSentFolder = this.aDraftInfo[2]; } } if ('' === sSentFolder) { kn.showScreenPopup(__webpack_require__(/*! View/Popup/FolderSystem */ 44), [Enums.SetSystemFoldersNotification.Sent]); } else { this.sendError(false); this.sending(true); if (Utils.isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length) { aFlagsCache = Cache.getMessageFlagsFromCache(this.aDraftInfo[2], this.aDraftInfo[1]); if (aFlagsCache) { if ('forward' === this.aDraftInfo[0]) { aFlagsCache[3] = true; } else { aFlagsCache[2] = true; } Cache.setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], aFlagsCache); __webpack_require__(/*! App/User */ 6).reloadFlagsCurrentMessageListAndMessageFromCache(); Cache.setFolderHash(this.aDraftInfo[2], ''); } } sSentFolder = Consts.Values.UnuseOptionValue === sSentFolder ? '' : sSentFolder; Cache.setFolderHash(this.draftFolder(), ''); Cache.setFolderHash(sSentFolder, ''); Remote.sendMessage( this.sendMessageResponse, this.draftFolder(), this.draftUid(), sSentFolder, this.currentIdentityResultEmail(), sTo, this.cc(), this.bcc(), this.subject(), this.oEditor ? this.oEditor.isHtml() : false, this.oEditor ? this.oEditor.getData(true) : '', this.prepearAttachmentsForSendOrSave(), this.aDraftInfo, this.sInReplyTo, this.sReferences, this.requestReadReceipt(), this.markAsImportant() ); } } }, this.canBeSendedOrSaved); this.saveCommand = Utils.createCommand(this, function () { if (FolderStore.draftFolderNotEnabled()) { kn.showScreenPopup(__webpack_require__(/*! View/Popup/FolderSystem */ 44), [Enums.SetSystemFoldersNotification.Draft]); } else { this.savedError(false); this.saving(true); this.autosaveStart(); Cache.setFolderHash(FolderStore.draftFolder(), ''); Remote.saveMessage( this.saveMessageResponse, this.draftFolder(), this.draftUid(), FolderStore.draftFolder(), this.currentIdentityResultEmail(), this.to(), this.cc(), this.bcc(), this.subject(), this.oEditor ? this.oEditor.isHtml() : false, this.oEditor ? this.oEditor.getData(true) : '', this.prepearAttachmentsForSendOrSave(), this.aDraftInfo, this.sInReplyTo, this.sReferences, this.markAsImportant() ); } }, this.canBeSendedOrSaved); this.skipCommand = Utils.createCommand(this, function () { this.bSkipNextHide = true; if (this.modalVisibility() && !this.saving() && !this.sending() && !FolderStore.draftFolderNotEnabled()) { this.saveCommand(); } this.tryToClosePopup(); }, this.canBeSendedOrSaved); this.contactsCommand = Utils.createCommand(this, function () { if (this.allowContacts) { this.skipCommand(); _.delay(function () { kn.showScreenPopup(__webpack_require__(/*! View/Popup/Contacts */ 68), [true]); }, 200); } }, function () { return this.allowContacts; }); Events.sub('interval.2m', function () { if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) && !this.saving() && !this.sending() && !this.savedError()) { this.saveCommand(); } }, this); this.showCc.subscribe(this.triggerForResize); this.showBcc.subscribe(this.triggerForResize); this.dropboxEnabled = SocialStore.dropbox.enabled; this.dropboxApiKey = SocialStore.dropbox.apiKey; this.dropboxCommand = Utils.createCommand(this, function () { if (window.Dropbox) { window.Dropbox.choose({ //'iframe': true, 'success': function(aFiles) { if (aFiles && aFiles[0] && aFiles[0]['link']) { self.addDropboxAttachment(aFiles[0]); } }, 'linkType': "direct", 'multiselect': false }); } return true; }, function () { return this.dropboxEnabled(); }); this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported && !!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialDrive') && !!Settings.settingsGet('GoogleClientID') && !!Settings.settingsGet('GoogleApiKey')); this.driveVisible = ko.observable(false); this.driveCommand = Utils.createCommand(this, function () { this.driveOpenPopup(); return true; }, function () { return this.driveEnabled(); }); this.driveCallback = _.bind(this.driveCallback, this); this.bDisabeCloseOnEsc = true; this.sDefaultKeyScope = Enums.KeyState.Compose; this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200); this.emailsSource = _.bind(this.emailsSource, this); this.autosaveFunction = _.bind(this.autosaveFunction, this); this.iTimer = 0; kn.constructorEnd(this); } kn.extendAsViewModel(['View/Popup/Compose', 'PopupsComposeViewModel'], ComposePopupView); _.extend(ComposePopupView.prototype, AbstractView.prototype); ComposePopupView.prototype.autosaveFunction = function () { if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) && !this.saving() && !this.sending() && !this.savedError()) { this.saveCommand(); } this.autosaveStart(); }; ComposePopupView.prototype.autosaveStart = function () { window.clearTimeout(this.iTimer); this.iTimer = window.setTimeout(this.autosaveFunction, 1000 * 60 * 1); }; ComposePopupView.prototype.autosaveStop = function () { window.clearTimeout(this.iTimer); }; ComposePopupView.prototype.emailsSource = function (oData, fResponse) { __webpack_require__(/*! App/User */ 6).getAutocomplete(oData.term, function (aData) { fResponse(_.map(aData, function (oEmailItem) { return oEmailItem.toLine(false); })); }); }; ComposePopupView.prototype.openOpenPgpPopup = function () { if (PgpStore.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) { var self = this; kn.showScreenPopup(__webpack_require__(/*! View/Popup/ComposeOpenPgp */ 137), [ function (sResult) { self.editor(function (oEditor) { oEditor.setPlain(sResult); }); }, this.oEditor.getData(), this.currentIdentityResultEmail(), this.to(), this.cc(), this.bcc() ]); } }; ComposePopupView.prototype.reloadDraftFolder = function () { var sDraftFolder = FolderStore.draftFolder() ; if ('' !== sDraftFolder) { Cache.setFolderHash(sDraftFolder, ''); if (Data.currentFolderFullNameRaw() === sDraftFolder) { __webpack_require__(/*! App/User */ 6).reloadMessageList(true); } else { __webpack_require__(/*! App/User */ 6).folderInformation(sDraftFolder); } } }; ComposePopupView.prototype.findIdentityIdByMessage = function (sComposeType, oMessage) { var oIDs = {}, sResult = '', sEmail = '', fFindHelper = function (oItem) { if (oItem && oItem.email && oIDs[oItem.email]) { sEmail = oItem.email; sResult = oIDs[oItem.email]; return true; } return false; } ; if (this.bCapaAdditionalIdentities) { _.each(IdentityStore.identities(), function (oItem) { oIDs[oItem.email()] = oItem['id']; }); } oIDs[AccountStore.email()] = AccountStore.email(); if (oMessage) { switch (sComposeType) { case Enums.ComposeType.Empty: break; case Enums.ComposeType.Reply: case Enums.ComposeType.ReplyAll: case Enums.ComposeType.Forward: case Enums.ComposeType.ForwardAsAttachment: _.find(_.union(oMessage.to, oMessage.cc, oMessage.bcc, oMessage.deliveredTo), fFindHelper); break; case Enums.ComposeType.Draft: _.find(_.union(oMessage.from, oMessage.replyTo), fFindHelper); break; } } if ('' === sResult) { sResult = IdentityStore.defaultIdentityID(); } if ('' === sResult) { sResult = AccountStore.email(); sEmail = sResult; } return [sResult, sEmail]; }; ComposePopupView.prototype.selectIdentity = function (oIdentity) { if (oIdentity) { this.currentIdentityID(oIdentity.optValue); } }; /** * * @param {boolean=} bHeaderResult = false * @returns {string} */ ComposePopupView.prototype.formattedFrom = function (bHeaderResult) { var sDisplayName = AccountStore.displayName(), sEmail = AccountStore.email() ; return '' === sDisplayName ? sEmail : ((Utils.isUnd(bHeaderResult) ? false : !!bHeaderResult) ? '"' + Utils.quoteName(sDisplayName) + '" <' + sEmail + '>' : sDisplayName + ' (' + sEmail + ')') ; }; ComposePopupView.prototype.sendMessageResponse = function (sResult, oData) { var bResult = false, sMessage = '' ; this.sending(false); if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { bResult = true; if (this.modalVisibility()) { Utils.delegateRun(this, 'closeCommand'); } } if (this.modalVisibility() && !bResult) { if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode) { this.sendSuccessButSaveError(true); window.alert(Utils.trim(Translator.i18n('COMPOSE/SAVED_ERROR_ON_SEND'))); } else { sMessage = Translator.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage, oData && oData.ErrorMessage ? oData.ErrorMessage : ''); this.sendError(true); window.alert(sMessage || Translator.getNotification(Enums.Notification.CantSendMessage)); } } this.reloadDraftFolder(); }; ComposePopupView.prototype.saveMessageResponse = function (sResult, oData) { var bResult = false, oMessage = null ; this.saving(false); if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { if (oData.Result.NewFolder && oData.Result.NewUid) { bResult = true; if (this.bFromDraft) { oMessage = Data.message(); if (oMessage && this.draftFolder() === oMessage.folderFullNameRaw && this.draftUid() === oMessage.uid) { Data.message(null); } } this.draftFolder(oData.Result.NewFolder); this.draftUid(oData.Result.NewUid); this.savedTime(window.Math.round((new window.Date()).getTime() / 1000)); this.savedOrSendingText( 0 < this.savedTime() ? Translator.i18n('COMPOSE/SAVED_TIME', { 'TIME': moment.unix(this.savedTime() - 1).format('LT') }) : '' ); if (this.bFromDraft) { Cache.setFolderHash(this.draftFolder(), ''); } } } if (!bResult) { this.savedError(true); this.savedOrSendingText(Translator.getNotification(Enums.Notification.CantSaveMessage)); } this.reloadDraftFolder(); }; ComposePopupView.prototype.onHide = function () { this.autosaveStop(); if (!this.bSkipNextHide) { this.composeInEdit(false); this.reset(); } this.bSkipNextHide = false; kn.routeOn(); }; /** * @param {string} sInputText * @param {string} sSignature * @param {string=} sFrom * @param {string=} sComposeType * @return {string} */ ComposePopupView.prototype.convertSignature = function (sInputText, sSignature, sFrom, sComposeType) { var bHtml = false, bData = false; if ('' !== sSignature) { if (':HTML:' === sSignature.substr(0, 6)) { bHtml = true; sSignature = sSignature.substr(6); } sSignature = sSignature.replace(/[\r]/g, ''); sFrom = Utils.pString(sFrom); if ('' !== sFrom) { sSignature = sSignature.replace(/{{FROM-FULL}}/g, sFrom); if (-1 === sFrom.indexOf(' ') && 0 < sFrom.indexOf('@')) { sFrom = sFrom.replace(/@(.+)$/, ''); } sSignature = sSignature.replace(/{{FROM}}/g, sFrom); } sSignature = sSignature.replace(/[\s]{1,2}{{FROM}}/g, '{{FROM}}'); sSignature = sSignature.replace(/[\s]{1,2}{{FROM-FULL}}/g, '{{FROM-FULL}}'); sSignature = sSignature.replace(/{{FROM}}/g, ''); sSignature = sSignature.replace(/{{FROM-FULL}}/g, ''); if (-1 < sSignature.indexOf('{{DATE}}')) { sSignature = sSignature.replace(/{{DATE}}/g, moment().format('llll')); } // Enums.ComposeType.Empty === sComposeType if (-1 < sSignature.indexOf('{{BODY}}')) { if (sInputText) { bData = true; sSignature = bHtml ? sSignature : Utils.plainToHtml(sSignature, true); sSignature = sSignature.replace('{{BODY}}', sInputText); } else { sSignature = sSignature.replace(/[\n]?{{BODY}}[\n]?/g, '{{BODY}}'); sSignature = sSignature.replace(/{{BODY}}/g, ''); sSignature = bHtml ? sSignature : Utils.plainToHtml(sSignature, true); } } else { sSignature = bHtml ? sSignature : Utils.plainToHtml(sSignature, true); } } if (!bData) { if (sSignature) { switch (sComposeType) { case Enums.ComposeType.Empty: sInputText = sInputText + '
' + sSignature; break; default: sInputText = sSignature + '
' + sInputText; break; } } } else { sInputText = sSignature; } return sInputText; }; ComposePopupView.prototype.editor = function (fOnInit) { if (fOnInit) { var self = this; if (!this.oEditor && this.composeEditorArea()) { _.delay(function () { self.oEditor = new HtmlEditor(self.composeEditorArea(), null, function () { fOnInit(self.oEditor); }, function (bHtml) { self.isHtml(!!bHtml); }); }, 300); } else if (this.oEditor) { fOnInit(this.oEditor); } } }; /** * @param {string=} sType = Enums.ComposeType.Empty * @param {?MessageModel|Array=} oMessageOrArray = null * @param {Array=} aToEmails = null * @param {Array=} aCcEmails = null * @param {Array=} aBccEmails = null * @param {string=} sCustomSubject = null * @param {string=} sCustomPlainText = null */ ComposePopupView.prototype.onShow = function (sType, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) { kn.routeOff(); this.autosaveStart(); if (this.composeInEdit()) { sType = sType || Enums.ComposeType.Empty; var self = this; if (Enums.ComposeType.Empty !== sType) { kn.showScreenPopup(__webpack_require__(/*! View/Popup/Ask */ 40), [Translator.i18n('COMPOSE/DISCARD_UNSAVED_DATA'), function () { self.initOnShow(sType, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText); }, null, null, null, false]); } else { this.addEmailsTo(this.to, aToEmails); this.addEmailsTo(this.cc, aCcEmails); this.addEmailsTo(this.bcc, aBccEmails); if (Utils.isNormal(sCustomSubject) && '' !== sCustomSubject && '' === this.subject()) { this.subject(sCustomSubject); } } } else { this.initOnShow(sType, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText); } }; /** * @param {Function} fKoValue * @param {Array} aEmails */ ComposePopupView.prototype.addEmailsTo = function (fKoValue, aEmails) { var sValue = Utils.trim(fKoValue()), aValue = [] ; if (Utils.isNonEmptyArray(aEmails)) { aValue = _.uniq(_.compact(_.map(aEmails, function (oItem) { return oItem ? oItem.toLine(false) : null; }))); fKoValue(sValue + ('' === sValue ? '' : ', ') + Utils.trim(aValue.join(', '))); } }; /** * @param {string=} sType = Enums.ComposeType.Empty * @param {?MessageModel|Array=} oMessageOrArray = null * @param {Array=} aToEmails = null * @param {Array=} aCcEmails = null * @param {Array=} aBccEmails = null * @param {string=} sCustomSubject = null * @param {string=} sCustomPlainText = null */ ComposePopupView.prototype.initOnShow = function (sType, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) { this.composeInEdit(true); var self = this, sFrom = '', sTo = '', sCc = '', sDate = '', sSubject = '', oText = null, sText = '', sReplyTitle = '', aResplyAllParts = [], oExcludeEmail = {}, oIdResult = null, mEmail = AccountStore.email(), sSignature = AccountStore.signature(), aDownloads = [], aDraftInfo = null, oMessage = null, sComposeType = sType || Enums.ComposeType.Empty, fEmailArrayToStringLineHelper = function (aList, bFriendly) { var iIndex = 0, iLen = aList.length, aResult = [] ; for (; iIndex < iLen; iIndex++) { aResult.push(aList[iIndex].toLine(!!bFriendly)); } return aResult.join(', '); } ; oMessageOrArray = oMessageOrArray || null; if (oMessageOrArray && Utils.isNormal(oMessageOrArray)) { oMessage = Utils.isArray(oMessageOrArray) && 1 === oMessageOrArray.length ? oMessageOrArray[0] : (!Utils.isArray(oMessageOrArray) ? oMessageOrArray : null); } if (null !== mEmail) { oExcludeEmail[mEmail] = true; } oIdResult = this.findIdentityIdByMessage(sComposeType, oMessage); if (oIdResult && oIdResult[0]) { oExcludeEmail[oIdResult[1]] = true; this.currentIdentityID(oIdResult[0]); } this.reset(); if (Utils.isNonEmptyArray(aToEmails)) { this.to(fEmailArrayToStringLineHelper(aToEmails)); } if (Utils.isNonEmptyArray(aCcEmails)) { this.cc(fEmailArrayToStringLineHelper(aCcEmails)); } if (Utils.isNonEmptyArray(aBccEmails)) { this.bcc(fEmailArrayToStringLineHelper(aBccEmails)); } if ('' !== sComposeType && oMessage) { sDate = oMessage.fullFormatDateValue(); sSubject = oMessage.subject(); aDraftInfo = oMessage.aDraftInfo; oText = $(oMessage.body).clone(); if (oText) { oText.find('blockquote.rl-bq-switcher').each(function () { $(this).removeClass('rl-bq-switcher hidden-bq'); }); oText.find('.rlBlockquoteSwitcher').each(function () { $(this).remove(); }); } oText.find('[data-html-editor-font-wrapper]').removeAttr('data-html-editor-font-wrapper'); sText = oText.html(); switch (sComposeType) { case Enums.ComposeType.Empty: break; case Enums.ComposeType.Reply: this.to(fEmailArrayToStringLineHelper(oMessage.replyEmails(oExcludeEmail))); this.subject(Utils.replySubjectAdd('Re', sSubject)); this.prepearMessageAttachments(oMessage, sComposeType); this.aDraftInfo = ['reply', oMessage.uid, oMessage.folderFullNameRaw]; this.sInReplyTo = oMessage.sMessageId; this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences); break; case Enums.ComposeType.ReplyAll: aResplyAllParts = oMessage.replyAllEmails(oExcludeEmail); this.to(fEmailArrayToStringLineHelper(aResplyAllParts[0])); this.cc(fEmailArrayToStringLineHelper(aResplyAllParts[1])); this.subject(Utils.replySubjectAdd('Re', sSubject)); this.prepearMessageAttachments(oMessage, sComposeType); this.aDraftInfo = ['reply', oMessage.uid, oMessage.folderFullNameRaw]; this.sInReplyTo = oMessage.sMessageId; this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.references()); break; case Enums.ComposeType.Forward: this.subject(Utils.replySubjectAdd('Fwd', sSubject)); this.prepearMessageAttachments(oMessage, sComposeType); this.aDraftInfo = ['forward', oMessage.uid, oMessage.folderFullNameRaw]; this.sInReplyTo = oMessage.sMessageId; this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences); break; case Enums.ComposeType.ForwardAsAttachment: this.subject(Utils.replySubjectAdd('Fwd', sSubject)); this.prepearMessageAttachments(oMessage, sComposeType); this.aDraftInfo = ['forward', oMessage.uid, oMessage.folderFullNameRaw]; this.sInReplyTo = oMessage.sMessageId; this.sReferences = Utils.trim(this.sInReplyTo + ' ' + oMessage.sReferences); break; case Enums.ComposeType.Draft: this.to(fEmailArrayToStringLineHelper(oMessage.to)); this.cc(fEmailArrayToStringLineHelper(oMessage.cc)); this.bcc(fEmailArrayToStringLineHelper(oMessage.bcc)); this.bFromDraft = true; this.draftFolder(oMessage.folderFullNameRaw); this.draftUid(oMessage.uid); this.subject(sSubject); this.prepearMessageAttachments(oMessage, sComposeType); this.aDraftInfo = Utils.isNonEmptyArray(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null; this.sInReplyTo = oMessage.sInReplyTo; this.sReferences = oMessage.sReferences; break; case Enums.ComposeType.EditAsNew: this.to(fEmailArrayToStringLineHelper(oMessage.to)); this.cc(fEmailArrayToStringLineHelper(oMessage.cc)); this.bcc(fEmailArrayToStringLineHelper(oMessage.bcc)); this.subject(sSubject); this.prepearMessageAttachments(oMessage, sComposeType); this.aDraftInfo = Utils.isNonEmptyArray(aDraftInfo) && 3 === aDraftInfo.length ? aDraftInfo : null; this.sInReplyTo = oMessage.sInReplyTo; this.sReferences = oMessage.sReferences; break; } switch (sComposeType) { case Enums.ComposeType.Reply: case Enums.ComposeType.ReplyAll: sFrom = oMessage.fromToLine(false, true); sReplyTitle = Translator.i18n('COMPOSE/REPLY_MESSAGE_TITLE', { 'DATETIME': sDate, 'EMAIL': sFrom }); sText = '

' + sReplyTitle + ':' + '

' + sText + '

'; break; case Enums.ComposeType.Forward: sFrom = oMessage.fromToLine(false, true); sTo = oMessage.toToLine(false, true); sCc = oMessage.ccToLine(false, true); sText = '


' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') + '
' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom + '
' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo + (0 < sCc.length ? '
' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') + '
' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) + '
' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) + '

' + sText; break; case Enums.ComposeType.ForwardAsAttachment: sText = ''; break; } if ('' !== sSignature && Enums.ComposeType.EditAsNew !== sComposeType && Enums.ComposeType.Draft !== sComposeType) { sText = this.convertSignature(sText, sSignature, fEmailArrayToStringLineHelper(oMessage.from, true), sComposeType); } this.editor(function (oEditor) { oEditor.setHtml(sText, false); if (Enums.EditorDefaultType.PlainForced === self.editorDefaultType() || (!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType())) { oEditor.modeToggle(false); } }); } else if (Enums.ComposeType.Empty === sComposeType) { this.subject(Utils.isNormal(sCustomSubject) ? '' + sCustomSubject : ''); sText = Utils.isNormal(sCustomPlainText) ? '' + sCustomPlainText : ''; if ('' !== sSignature) { sText = this.convertSignature(Utils.plainToHtml(sText, true), sSignature, '', sComposeType); } this.editor(function (oEditor) { oEditor.setHtml(sText, false); if (Enums.EditorDefaultType.Html !== self.editorDefaultType() && Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType()) { oEditor.modeToggle(false); } }); } else if (Utils.isNonEmptyArray(oMessageOrArray)) { _.each(oMessageOrArray, function (oMessage) { self.addMessageAsAttachment(oMessage); }); } aDownloads = this.getAttachmentsDownloadsForUpload(); if (Utils.isNonEmptyArray(aDownloads)) { Remote.messageUploadAttachments(function (sResult, oData) { if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { var oAttachment = null, sTempName = '' ; if (!self.viewModelVisibility()) { for (sTempName in oData.Result) { if (oData.Result.hasOwnProperty(sTempName)) { oAttachment = self.getAttachmentById(oData.Result[sTempName]); if (oAttachment) { oAttachment.tempName(sTempName); oAttachment.waiting(false).uploading(false).complete(true); } } } } } else { self.setMessageAttachmentFailedDownloadText(); } }, aDownloads); } this.triggerForResize(); }; ComposePopupView.prototype.onFocus = function () { if ('' === this.to()) { this.to.focusTrigger(!this.to.focusTrigger()); } else if (this.oEditor) { this.oEditor.focus(); } this.triggerForResize(); }; ComposePopupView.prototype.editorResize = function () { if (this.oEditor) { this.oEditor.resize(); } }; ComposePopupView.prototype.tryToClosePopup = function () { var self = this, PopupsAskViewModel = __webpack_require__(/*! View/Popup/Ask */ 40) ; if (!kn.isPopupVisible(PopupsAskViewModel) && this.modalVisibility()) { if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) { Utils.delegateRun(self, 'closeCommand'); } else { kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () { if (self.modalVisibility()) { Utils.delegateRun(self, 'closeCommand'); } }]); } } }; ComposePopupView.prototype.onBuild = function () { this.initUploader(); var self = this, oScript = null ; key('ctrl+q, command+q', Enums.KeyState.Compose, function () { self.identitiesDropdownTrigger(true); return false; }); key('ctrl+s, command+s', Enums.KeyState.Compose, function () { self.saveCommand(); return false; }); if (!!Settings.settingsGet('AllowСtrlEnterOnCompose')) { key('ctrl+enter, command+enter', Enums.KeyState.Compose, function () { self.sendCommand(); return false; }); } key('esc', Enums.KeyState.Compose, function () { if (self.modalVisibility()) { self.tryToClosePopup(); } return false; }); Globals.$win.on('resize', self.triggerForResize); if (this.dropboxEnabled()) { oScript = window.document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js'; $(oScript).attr('id', 'dropboxjs').attr('data-app-key', self.dropboxApiKey()); window.document.body.appendChild(oScript); } if (this.driveEnabled()) { $.getScript('https://apis.google.com/js/api.js', function () { if (window.gapi) { self.driveVisible(true); } }); } }; ComposePopupView.prototype.driveCallback = function (sAccessToken, oData) { if (oData && window.XMLHttpRequest && window.google && oData[window.google.picker.Response.ACTION] === window.google.picker.Action.PICKED && oData[window.google.picker.Response.DOCUMENTS] && oData[window.google.picker.Response.DOCUMENTS][0] && oData[window.google.picker.Response.DOCUMENTS][0]['id']) { var self = this, oRequest = new window.XMLHttpRequest() ; oRequest.open('GET', 'https://www.googleapis.com/drive/v2/files/' + oData[window.google.picker.Response.DOCUMENTS][0]['id']); oRequest.setRequestHeader('Authorization', 'Bearer ' + sAccessToken); oRequest.addEventListener('load', function() { if (oRequest && oRequest.responseText) { var oItem = JSON.parse(oRequest.responseText), fExport = function (oItem, sMimeType, sExt) { if (oItem && oItem['exportLinks']) { if (oItem['exportLinks'][sMimeType]) { oItem['downloadUrl'] = oItem['exportLinks'][sMimeType]; oItem['title'] = oItem['title'] + '.' + sExt; oItem['mimeType'] = sMimeType; } else if (oItem['exportLinks']['application/pdf']) { oItem['downloadUrl'] = oItem['exportLinks']['application/pdf']; oItem['title'] = oItem['title'] + '.pdf'; oItem['mimeType'] = 'application/pdf'; } } }; if (oItem && !oItem['downloadUrl'] && oItem['mimeType'] && oItem['exportLinks']) { switch (oItem['mimeType'].toString().toLowerCase()) { case 'application/vnd.google-apps.document': fExport(oItem, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx'); break; case 'application/vnd.google-apps.spreadsheet': fExport(oItem, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlsx'); break; case 'application/vnd.google-apps.drawing': fExport(oItem, 'image/png', 'png'); break; case 'application/vnd.google-apps.presentation': fExport(oItem, 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'pptx'); break; default: fExport(oItem, 'application/pdf', 'pdf'); break; } } if (oItem && oItem['downloadUrl']) { self.addDriveAttachment(oItem, sAccessToken); } } }); oRequest.send(); } }; ComposePopupView.prototype.driveCreatePiker = function (oOauthToken) { if (window.gapi && oOauthToken && oOauthToken.access_token) { var self = this; window.gapi.load('picker', {'callback': function () { if (window.google && window.google.picker) { var drivePicker = new window.google.picker.PickerBuilder() // .addView(window.google.picker.ViewId.FOLDERS) .addView(window.google.picker.ViewId.DOCS) .setAppId(Settings.settingsGet('GoogleClientID')) .setOAuthToken(oOauthToken.access_token) .setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token)) .enableFeature(window.google.picker.Feature.NAV_HIDDEN) // .setOrigin(window.location.protocol + '//' + window.location.host) .build() ; drivePicker.setVisible(true); } }}); } }; ComposePopupView.prototype.driveOpenPopup = function () { if (window.gapi) { var self = this; window.gapi.load('auth', {'callback': function () { var oAuthToken = window.gapi.auth.getToken(), fResult = function (oAuthResult) { if (oAuthResult && !oAuthResult.error) { var oAuthToken = window.gapi.auth.getToken(); if (oAuthToken) { self.driveCreatePiker(oAuthToken); } return true; } return false; } ; if (!oAuthToken) { window.gapi.auth.authorize({ 'client_id': Settings.settingsGet('GoogleClientID'), 'scope': 'https://www.googleapis.com/auth/drive.readonly', 'immediate': true }, function (oAuthResult) { if (!fResult(oAuthResult)) { window.gapi.auth.authorize({ 'client_id': Settings.settingsGet('GoogleClientID'), 'scope': 'https://www.googleapis.com/auth/drive.readonly', 'immediate': false }, fResult); } }); } else { self.driveCreatePiker(oAuthToken); } }}); } }; /** * @param {string} sId * @return {?Object} */ ComposePopupView.prototype.getAttachmentById = function (sId) { var aAttachments = this.attachments(), iIndex = 0, iLen = aAttachments.length ; for (; iIndex < iLen; iIndex++) { if (aAttachments[iIndex] && sId === aAttachments[iIndex].id) { return aAttachments[iIndex]; } } return null; }; ComposePopupView.prototype.cancelAttachmentHelper = function (sId, oJua) { var self = this; return function () { var oItem = _.find(self.attachments(), function (oItem) { return oItem && oItem.id === sId; }); if (oItem) { self.attachments.remove(oItem); Utils.delegateRunOnDestroy(oItem); if (oJua) { oJua.cancel(sId); } } }; }; ComposePopupView.prototype.initUploader = function () { if (this.composeUploaderButton()) { var oUploadCache = {}, iAttachmentSizeLimit = Utils.pInt(Settings.settingsGet('AttachmentLimit')), oJua = new Jua({ 'action': Links.upload(), 'name': 'uploader', 'queueSize': 2, 'multipleSizeLimit': 50, 'disableFolderDragAndDrop': false, 'clickElement': this.composeUploaderButton(), 'dragAndDropElement': this.composeUploaderDropPlace() }) ; if (oJua) { oJua // .on('onLimitReached', function (iLimit) { // alert(iLimit); // }) .on('onDragEnter', _.bind(function () { this.dragAndDropOver(true); }, this)) .on('onDragLeave', _.bind(function () { this.dragAndDropOver(false); }, this)) .on('onBodyDragEnter', _.bind(function () { this.dragAndDropVisible(true); }, this)) .on('onBodyDragLeave', _.bind(function () { this.dragAndDropVisible(false); }, this)) .on('onProgress', _.bind(function (sId, iLoaded, iTotal) { var oItem = null; if (Utils.isUnd(oUploadCache[sId])) { oItem = this.getAttachmentById(sId); if (oItem) { oUploadCache[sId] = oItem; } } else { oItem = oUploadCache[sId]; } if (oItem) { oItem.progress(window.Math.floor(iLoaded / iTotal * 100)); } }, this)) .on('onSelect', _.bind(function (sId, oData) { this.dragAndDropOver(false); var that = this, sFileName = Utils.isUnd(oData.FileName) ? '' : oData.FileName.toString(), mSize = Utils.isNormal(oData.Size) ? Utils.pInt(oData.Size) : null, oAttachment = new ComposeAttachmentModel(sId, sFileName, mSize) ; oAttachment.cancel = that.cancelAttachmentHelper(sId, oJua); this.attachments.push(oAttachment); this.attachmentsPlace(true); if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize) { oAttachment .waiting(false).uploading(true).complete(true) .error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG')); return false; } return true; }, this)) .on('onStart', _.bind(function (sId) { var oItem = null ; if (Utils.isUnd(oUploadCache[sId])) { oItem = this.getAttachmentById(sId); if (oItem) { oUploadCache[sId] = oItem; } } else { oItem = oUploadCache[sId]; } if (oItem) { oItem.waiting(false).uploading(true).complete(false); } }, this)) .on('onComplete', _.bind(function (sId, bResult, oData) { var sError = '', mErrorCode = null, oAttachmentJson = null, oAttachment = this.getAttachmentById(sId) ; oAttachmentJson = bResult && oData && oData.Result && oData.Result.Attachment ? oData.Result.Attachment : null; mErrorCode = oData && oData.Result && oData.Result.ErrorCode ? oData.Result.ErrorCode : null; if (null !== mErrorCode) { sError = Translator.getUploadErrorDescByCode(mErrorCode); } else if (!oAttachmentJson) { sError = Translator.i18n('UPLOAD/ERROR_UNKNOWN'); } if (oAttachment) { if ('' !== sError && 0 < sError.length) { oAttachment .waiting(false) .uploading(false) .complete(true) .error(sError) ; } else if (oAttachmentJson) { oAttachment .waiting(false) .uploading(false) .complete(true) ; oAttachment.initByUploadJson(oAttachmentJson); } if (Utils.isUnd(oUploadCache[sId])) { delete (oUploadCache[sId]); } } }, this)) ; this .addAttachmentEnabled(true) .dragAndDropEnabled(oJua.isDragAndDropSupported()) ; } else { this .addAttachmentEnabled(false) .dragAndDropEnabled(false) ; } } }; /** * @return {Object} */ ComposePopupView.prototype.prepearAttachmentsForSendOrSave = function () { var oResult = {}; _.each(this.attachmentsInReady(), function (oItem) { if (oItem && '' !== oItem.tempName() && oItem.enabled()) { oResult[oItem.tempName()] = [ oItem.fileName(), oItem.isInline ? '1' : '0', oItem.CID, oItem.contentLocation ]; } }); return oResult; }; /** * @param {MessageModel} oMessage */ ComposePopupView.prototype.addMessageAsAttachment = function (oMessage) { if (oMessage) { var oAttachment = null, sTemp = oMessage.subject() ; sTemp = '.eml' === sTemp.substr(-4).toLowerCase() ? sTemp : sTemp + '.eml'; oAttachment = new ComposeAttachmentModel( oMessage.requestHash, sTemp, oMessage.size() ); oAttachment.fromMessage = true; oAttachment.cancel = this.cancelAttachmentHelper(oMessage.requestHash); oAttachment.waiting(false).uploading(true).complete(true); this.attachments.push(oAttachment); } }; /** * @param {Object} oDropboxFile * @return {boolean} */ ComposePopupView.prototype.addDropboxAttachment = function (oDropboxFile) { var oAttachment = null, iAttachmentSizeLimit = Utils.pInt(Settings.settingsGet('AttachmentLimit')), mSize = oDropboxFile['bytes'] ; oAttachment = new ComposeAttachmentModel( oDropboxFile['link'], oDropboxFile['name'], mSize ); oAttachment.fromMessage = false; oAttachment.cancel = this.cancelAttachmentHelper(oDropboxFile['link']); oAttachment.waiting(false).uploading(true).complete(false); this.attachments.push(oAttachment); this.attachmentsPlace(true); if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize) { oAttachment.uploading(false).complete(true); oAttachment.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG')); return false; } Remote.composeUploadExternals(function (sResult, oData) { var bResult = false; oAttachment.uploading(false).complete(true); if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { if (oData.Result[oAttachment.id]) { bResult = true; oAttachment.tempName(oData.Result[oAttachment.id]); } } if (!bResult) { oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded)); } }, [oDropboxFile['link']]); return true; }; /** * @param {Object} oDriveFile * @param {string} sAccessToken * @return {boolean} */ ComposePopupView.prototype.addDriveAttachment = function (oDriveFile, sAccessToken) { var iAttachmentSizeLimit = Utils.pInt(Settings.settingsGet('AttachmentLimit')), oAttachment = null, mSize = oDriveFile['fileSize'] ? Utils.pInt(oDriveFile['fileSize']) : 0 ; oAttachment = new ComposeAttachmentModel( oDriveFile['downloadUrl'], oDriveFile['title'], mSize ); oAttachment.fromMessage = false; oAttachment.cancel = this.cancelAttachmentHelper(oDriveFile['downloadUrl']); oAttachment.waiting(false).uploading(true).complete(false); this.attachments.push(oAttachment); this.attachmentsPlace(true); if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize) { oAttachment.uploading(false).complete(true); oAttachment.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG')); return false; } Remote.composeUploadDrive(function (sResult, oData) { var bResult = false; oAttachment.uploading(false).complete(true); if (Enums.StorageResultType.Success === sResult && oData && oData.Result) { if (oData.Result[oAttachment.id]) { bResult = true; oAttachment.tempName(oData.Result[oAttachment.id][0]); oAttachment.size(Utils.pInt(oData.Result[oAttachment.id][1])); } } if (!bResult) { oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded)); } }, oDriveFile['downloadUrl'], sAccessToken); return true; }; /** * @param {MessageModel} oMessage * @param {string} sType */ ComposePopupView.prototype.prepearMessageAttachments = function (oMessage, sType) { if (oMessage) { var aAttachments = Utils.isNonEmptyArray(oMessage.attachments()) ? oMessage.attachments() : [], iIndex = 0, iLen = aAttachments.length, oAttachment = null, oItem = null, bAdd = false ; if (Enums.ComposeType.ForwardAsAttachment === sType) { this.addMessageAsAttachment(oMessage); } else { for (; iIndex < iLen; iIndex++) { oItem = aAttachments[iIndex]; bAdd = false; switch (sType) { case Enums.ComposeType.Reply: case Enums.ComposeType.ReplyAll: bAdd = oItem.isLinked; break; case Enums.ComposeType.Forward: case Enums.ComposeType.Draft: case Enums.ComposeType.EditAsNew: bAdd = true; break; } if (bAdd) { oAttachment = new ComposeAttachmentModel( oItem.download, oItem.fileName, oItem.estimatedSize, oItem.isInline, oItem.isLinked, oItem.cid, oItem.contentLocation ); oAttachment.fromMessage = true; oAttachment.cancel = this.cancelAttachmentHelper(oItem.download); oAttachment.waiting(false).uploading(true).complete(false); this.attachments.push(oAttachment); } } } } }; ComposePopupView.prototype.removeLinkedAttachments = function () { var oItem = _.find(this.attachments(), function (oItem) { return oItem && oItem.isLinked; }); if (oItem) { this.attachments.remove(oItem); Utils.delegateRunOnDestroy(oItem); } }; ComposePopupView.prototype.setMessageAttachmentFailedDownloadText = function () { _.each(this.attachments(), function(oAttachment) { if (oAttachment && oAttachment.fromMessage) { oAttachment .waiting(false) .uploading(false) .complete(true) .error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded)) ; } }, this); }; /** * @param {boolean=} bIncludeAttachmentInProgress = true * @return {boolean} */ ComposePopupView.prototype.isEmptyForm = function (bIncludeAttachmentInProgress) { bIncludeAttachmentInProgress = Utils.isUnd(bIncludeAttachmentInProgress) ? true : !!bIncludeAttachmentInProgress; var bWithoutAttach = bIncludeAttachmentInProgress ? 0 === this.attachments().length : 0 === this.attachmentsInReady().length; return 0 === this.to().length && 0 === this.cc().length && 0 === this.bcc().length && 0 === this.subject().length && bWithoutAttach && (!this.oEditor || '' === this.oEditor.getData()) ; }; ComposePopupView.prototype.reset = function () { this.to(''); this.cc(''); this.bcc(''); this.replyTo(''); this.subject(''); this.requestReadReceipt(false); this.markAsImportant(false); this.attachmentsPlace(false); this.aDraftInfo = null; this.sInReplyTo = ''; this.bFromDraft = false; this.sReferences = ''; this.sendError(false); this.sendSuccessButSaveError(false); this.savedError(false); this.savedTime(0); this.savedOrSendingText(''); this.emptyToError(false); this.attachmentsInProcessError(false); this.showCc(false); this.showBcc(false); Utils.delegateRunOnDestroy(this.attachments()); this.attachments([]); this.dragAndDropOver(false); this.dragAndDropVisible(false); this.draftFolder(''); this.draftUid(''); this.sending(false); this.saving(false); if (this.oEditor) { this.oEditor.clear(false); } }; /** * @return {Array} */ ComposePopupView.prototype.getAttachmentsDownloadsForUpload = function () { return _.map(_.filter(this.attachments(), function (oItem) { return oItem && '' === oItem.tempName(); }), function (oItem) { return oItem.id; }); }; ComposePopupView.prototype.triggerForResize = function () { this.resizer(!this.resizer()); this.editorResizeThrottle(); }; module.exports = ComposePopupView; }()); /***/ }, /* 28 */ /*!******************************!*\ !*** ./dev/Common/Events.js ***! \******************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), Utils = __webpack_require__(/*! Common/Utils */ 1), Plugins = __webpack_require__(/*! Common/Plugins */ 23) ; /** * @constructor */ function Events() { this.oSubs = {}; } Events.prototype.oSubs = {}; /** * @param {string} sName * @param {Function} fFunc * @param {Object=} oContext * @return {Events} */ Events.prototype.sub = function (sName, fFunc, oContext) { if (Utils.isUnd(this.oSubs[sName])) { this.oSubs[sName] = []; } this.oSubs[sName].push([fFunc, oContext]); return this; }; /** * @param {string} sName * @param {Array=} aArgs * @return {Events} */ Events.prototype.pub = function (sName, aArgs) { Plugins.runHook('rl-pub', [sName, aArgs]); if (!Utils.isUnd(this.oSubs[sName])) { _.each(this.oSubs[sName], function (aItem) { if (aItem[0]) { aItem[0].apply(aItem[1] || null, aArgs || []); } }); } return this; }; module.exports = new Events(); }()); /***/ }, /* 29 */ /*!***********************************!*\ !*** ./dev/Component/Abstract.js ***! \***********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), Utils = __webpack_require__(/*! Common/Utils */ 1) ; /** * @constructor */ function AbstractComponent() { this.disposable = []; } /** * @type {Array} */ AbstractComponent.prototype.disposable = []; AbstractComponent.prototype.dispose = function () { _.each(this.disposable, function (fFuncToDispose) { if (fFuncToDispose && fFuncToDispose.dispose) { fFuncToDispose.dispose(); } }); }; /** * @param {*} ClassObject * @param {string} sTemplateID * @return {Object} */ AbstractComponent.componentExportHelper = function (ClassObject, sTemplateID) { return { viewModel: { createViewModel: function(oParams, oCmponentInfo) { oParams = oParams || {}; oParams.element = null; if (oCmponentInfo.element) { oParams.element = $(oCmponentInfo.element); __webpack_require__(/*! Common/Translator */ 7).i18nToNode(oParams.element); if (!Utils.isUnd(oParams.inline) && ko.unwrap(oParams.inline)) { oParams.element.css('display', 'inline-block'); } } return new ClassObject(oParams); } }, template: { element: sTemplateID } }; }; module.exports = AbstractComponent; }()); /***/ }, /* 30 */ /*!********************************!*\ !*** ./dev/Stores/User/App.js ***! \********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Settings = __webpack_require__(/*! Storage/Settings */ 9), AppStore = __webpack_require__(/*! Stores/App */ 65) ; /** * @constructor */ function AppUserStore() { AppStore.call(this); this.projectHash = ko.observable(''); this.threadsAllowed = ko.observable(false); this.contactsAutosave = ko.observable(false); this.useLocalProxyForExternalImages = ko.observable(false); this.contactsIsAllowed = ko.observable(false); this.devEmail = ''; this.devPassword = ''; } AppUserStore.prototype.populate = function() { AppStore.prototype.populate.call(this); this.projectHash(Settings.settingsGet('ProjectHash')); this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages')); this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed')); this.devEmail = Settings.settingsGet('DevEmail'); this.devPassword = Settings.settingsGet('DevPassword'); }; module.exports = new AppUserStore(); }()); /***/ }, /* 31 */ /*!********************************!*\ !*** ./dev/Stores/Language.js ***! \********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Utils = __webpack_require__(/*! Common/Utils */ 1), Settings = __webpack_require__(/*! Storage/Settings */ 9) ; /** * @constructor */ function LanguageStore() { this.languages = ko.observableArray([]); this.language = ko.observable('') .extend({'limitedList': this.languages}); } LanguageStore.prototype.populate = function () { var aLanguages = Settings.settingsGet('Languages'); this.languages(Utils.isArray(aLanguages) ? aLanguages : []); this.language(Settings.settingsGet('Language')); }; module.exports = new LanguageStore(); }()); /***/ }, /* 32 */ /*!***********************************!*\ !*** ./dev/Stores/User/Folder.js ***! \***********************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Enums = __webpack_require__(/*! Common/Enums */ 4), Consts = __webpack_require__(/*! Common/Consts */ 16), Cache = __webpack_require__(/*! Storage/User/Cache */ 19) ; /** * @constructor */ function FolderUserStore() { this.sentFolder = ko.observable(''); this.draftFolder = ko.observable(''); this.spamFolder = ko.observable(''); this.trashFolder = ko.observable(''); this.archiveFolder = ko.observable(''); this.computed(); this.subscribe(); } FolderUserStore.prototype.computed = function () { this.draftFolderNotEnabled = ko.computed(function () { return '' === this.draftFolder() || Consts.Values.UnuseOptionValue === this.draftFolder(); }, this); }; FolderUserStore.prototype.subscribe = function () { var fRemoveSystemFolderType = function (observable) { return function () { var oFolder = Cache.getFolderFromCacheList(observable()); if (oFolder) { oFolder.type(Enums.FolderType.User); } }; }, fSetSystemFolderType = function (iType) { return function (sValue) { var oFolder = Cache.getFolderFromCacheList(sValue); if (oFolder) { oFolder.type(iType); } }; } ; this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange'); this.draftFolder.subscribe(fRemoveSystemFolderType(this.draftFolder), this, 'beforeChange'); this.spamFolder.subscribe(fRemoveSystemFolderType(this.spamFolder), this, 'beforeChange'); this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange'); this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange'); this.sentFolder.subscribe(fSetSystemFolderType(Enums.FolderType.SentItems), this); this.draftFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Draft), this); this.spamFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Spam), this); this.trashFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Trash), this); this.archiveFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Archive), this); }; module.exports = new FolderUserStore(); }()); /***/ }, /* 33 */ /*!****************************************!*\ !*** ./dev/Component/AbstractInput.js ***! \****************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), Enums = __webpack_require__(/*! Common/Enums */ 4), Utils = __webpack_require__(/*! Common/Utils */ 1), AbstractComponent = __webpack_require__(/*! Component/Abstract */ 29) ; /** * @constructor * * @param {Object} oParams * * @extends AbstractComponent */ function AbstractInput(oParams) { AbstractComponent.call(this); this.value = oParams.value || ''; this.size = oParams.size || 0; this.label = oParams.label || ''; this.preLabel = oParams.preLabel || ''; this.enable = Utils.isUnd(oParams.enable) ? true : oParams.enable; this.trigger = oParams.trigger && oParams.trigger.subscribe ? oParams.trigger : null; this.placeholder = oParams.placeholder || ''; this.labeled = !Utils.isUnd(oParams.label); this.preLabeled = !Utils.isUnd(oParams.preLabel); this.triggered = !Utils.isUnd(oParams.trigger) && !!this.trigger; this.classForTrigger = ko.observable(''); this.className = ko.computed(function () { var iSize = ko.unwrap(this.size), sSuffixValue = this.trigger ? ' ' + Utils.trim('settings-saved-trigger-input ' + this.classForTrigger()) : '' ; return (0 < iSize ? 'span' + iSize : '') + sSuffixValue; }, this); if (!Utils.isUnd(oParams.width) && oParams.element) { oParams.element.find('input,select,textarea').css('width', oParams.width); } this.disposable.push(this.className); if (this.trigger) { this.setTriggerState(this.trigger()); this.disposable.push( this.trigger.subscribe(this.setTriggerState, this) ); } } AbstractInput.prototype.setTriggerState = function (nValue) { switch (Utils.pInt(nValue)) { case Enums.SaveSettingsStep.TrueResult: this.classForTrigger('success'); break; case Enums.SaveSettingsStep.FalseResult: this.classForTrigger('error'); break; default: this.classForTrigger(''); break; } }; _.extend(AbstractInput.prototype, AbstractComponent.prototype); AbstractInput.componentExportHelper = AbstractComponent.componentExportHelper; module.exports = AbstractInput; }()); /***/ }, /* 34 */ /*!*************************************!*\ !*** ./dev/Knoin/AbstractScreen.js ***! \*************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), crossroads = __webpack_require__(/*! crossroads */ 41), Utils = __webpack_require__(/*! Common/Utils */ 1) ; /** * @param {string} sScreenName * @param {?=} aViewModels = [] * @constructor */ function AbstractScreen(sScreenName, aViewModels) { this.sScreenName = sScreenName; this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : []; } /** * @type {Array} */ AbstractScreen.prototype.oCross = null; /** * @type {string} */ AbstractScreen.prototype.sScreenName = ''; /** * @type {Array} */ AbstractScreen.prototype.aViewModels = []; /** * @return {Array} */ AbstractScreen.prototype.viewModels = function () { return this.aViewModels; }; /** * @return {string} */ AbstractScreen.prototype.screenName = function () { return this.sScreenName; }; AbstractScreen.prototype.routes = function () { return null; }; /** * @return {?Object} */ AbstractScreen.prototype.__cross = function () { return this.oCross; }; AbstractScreen.prototype.__start = function () { var aRoutes = this.routes(), oRoute = null, fMatcher = null ; if (Utils.isNonEmptyArray(aRoutes)) { fMatcher = _.bind(this.onRoute || Utils.emptyFunction, this); oRoute = crossroads.create(); _.each(aRoutes, function (aItem) { oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1]; }); this.oCross = oRoute; } }; module.exports = AbstractScreen; }()); /***/ }, /* 35 */ /*!******************************!*\ !*** ./dev/Stores/Social.js ***! \******************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3) ; /** * @constructor */ function SocialStore() { this.google = {}; this.twitter = {}; this.facebook = {}; this.dropbox = {}; // Google this.google.enabled = ko.observable(false); this.google.clientID = ko.observable(''); this.google.clientSecret = ko.observable(''); this.google.apiKey = ko.observable(''); this.google.loading = ko.observable(false); this.google.userName = ko.observable(''); this.google.loggined = ko.computed(function () { return '' !== this.google.userName(); }, this); this.google.capa = {}; this.google.capa.auth = ko.observable(false); this.google.capa.drive = ko.observable(false); this.google.capa.preview = ko.observable(false); this.google.require = {}; this.google.require.clientSettings = ko.computed(function () { return this.google.enabled() && (this.google.capa.auth() || this.google.capa.drive()); }, this); this.google.require.apiKeySettings = ko.computed(function () { return this.google.enabled() && this.google.capa.drive(); }, this); // Facebook this.facebook.enabled = ko.observable(false); this.facebook.appID = ko.observable(''); this.facebook.appSecret = ko.observable(''); this.facebook.loading = ko.observable(false); this.facebook.userName = ko.observable(''); this.facebook.supported = ko.observable(false); this.facebook.loggined = ko.computed(function () { return '' !== this.facebook.userName(); }, this); // Twitter this.twitter.enabled = ko.observable(false); this.twitter.consumerKey = ko.observable(''); this.twitter.consumerSecret = ko.observable(''); this.twitter.loading = ko.observable(false); this.twitter.userName = ko.observable(''); this.twitter.loggined = ko.computed(function () { return '' !== this.twitter.userName(); }, this); // Dropbox this.dropbox.enabled = ko.observable(false); this.dropbox.apiKey = ko.observable(''); } SocialStore.prototype.google = {}; SocialStore.prototype.twitter = {}; SocialStore.prototype.facebook = {}; SocialStore.prototype.dropbox = {}; SocialStore.prototype.populate = function () { var Settings = __webpack_require__(/*! Storage/Settings */ 9); this.google.enabled(!!Settings.settingsGet('AllowGoogleSocial')); this.google.clientID(Settings.settingsGet('GoogleClientID')); this.google.clientSecret(Settings.settingsGet('GoogleClientSecret')); this.google.apiKey(Settings.settingsGet('GoogleApiKey')); this.google.capa.auth(!!Settings.settingsGet('AllowGoogleSocialAuth')); this.google.capa.drive(!!Settings.settingsGet('AllowGoogleSocialDrive')); this.google.capa.preview(!!Settings.settingsGet('AllowGoogleSocialPreview')); this.facebook.enabled(!!Settings.settingsGet('AllowFacebookSocial')); this.facebook.appID(Settings.settingsGet('FacebookAppID')); this.facebook.appSecret(Settings.settingsGet('FacebookAppSecret')); this.facebook.supported(!!Settings.settingsGet('SupportedFacebookSocial')); this.twitter.enabled = ko.observable(!!Settings.settingsGet('AllowTwitterSocial')); this.twitter.consumerKey = ko.observable(Settings.settingsGet('TwitterConsumerKey')); this.twitter.consumerSecret = ko.observable(Settings.settingsGet('TwitterConsumerSecret')); this.dropbox.enabled(!!Settings.settingsGet('AllowDropboxSocial')); this.dropbox.apiKey(Settings.settingsGet('DropboxApiKey')); }; module.exports = new SocialStore(); }()); /***/ }, /* 36 */ /*!********************************!*\ !*** external "window.moment" ***! \********************************/ /***/ function(module, exports, __webpack_require__) { module.exports = window.moment; /***/ }, /* 37 */, /* 38 */ /*!******************************************!*\ !*** ./dev/Component/AbstracCheckbox.js ***! \******************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), Utils = __webpack_require__(/*! Common/Utils */ 1), AbstractComponent = __webpack_require__(/*! Component/Abstract */ 29) ; /** * @constructor * * @param {Object} oParams * * @extends AbstractComponent */ function AbstracCheckbox(oParams) { AbstractComponent.call(this); this.value = oParams.value; if (Utils.isUnd(this.value) || !this.value.subscribe) { this.value = ko.observable(Utils.isUnd(this.value) ? false : !!this.value); } this.enable = oParams.enable; if (Utils.isUnd(this.enable) || !this.enable.subscribe) { this.enable = ko.observable(Utils.isUnd(this.enable) ? true : !!this.enable); } this.disable = oParams.disable; if (Utils.isUnd(this.disable) || !this.disable.subscribe) { this.disable = ko.observable(Utils.isUnd(this.disable) ? false : !!this.disable); } this.label = oParams.label || ''; this.inline = Utils.isUnd(oParams.inline) ? false : oParams.inline; this.readOnly = Utils.isUnd(oParams.readOnly) ? false : !!oParams.readOnly; this.inverted = Utils.isUnd(oParams.inverted) ? false : !!oParams.inverted; this.labeled = !Utils.isUnd(oParams.label); } _.extend(AbstracCheckbox.prototype, AbstractComponent.prototype); AbstracCheckbox.prototype.click = function() { if (!this.readOnly && this.enable() && !this.disable()) { this.value(!this.value()); } }; AbstracCheckbox.componentExportHelper = AbstractComponent.componentExportHelper; module.exports = AbstracCheckbox; }()); /***/ }, /* 39 */ /*!*****************************!*\ !*** ./dev/Stores/Theme.js ***! \*****************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Utils = __webpack_require__(/*! Common/Utils */ 1), Settings = __webpack_require__(/*! Storage/Settings */ 9) ; /** * @constructor */ function ThemeStore() { this.themes = ko.observableArray([]); this.themeBackgroundName = ko.observable(''); this.themeBackgroundHash = ko.observable(''); this.theme = ko.observable('') .extend({'limitedList': this.themes}); } ThemeStore.prototype.populate = function () { var aThemes = Settings.settingsGet('Themes'); this.themes(Utils.isArray(aThemes) ? aThemes : []); this.theme(Settings.settingsGet('Theme')); this.themeBackgroundName(Settings.settingsGet('UserBackgroundName')); this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash')); }; module.exports = new ThemeStore(); }()); /***/ }, /* 40 */ /*!*******************************!*\ !*** ./dev/View/Popup/Ask.js ***! \*******************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), key = __webpack_require__(/*! key */ 21), Enums = __webpack_require__(/*! Common/Enums */ 4), Utils = __webpack_require__(/*! Common/Utils */ 1), Translator = __webpack_require__(/*! Common/Translator */ 7), kn = __webpack_require__(/*! Knoin/Knoin */ 5), AbstractView = __webpack_require__(/*! Knoin/AbstractView */ 11) ; /** * @constructor * @extends AbstractView */ function AskPopupView() { AbstractView.call(this, 'Popups', 'PopupsAsk'); this.askDesc = ko.observable(''); this.yesButton = ko.observable(''); this.noButton = ko.observable(''); this.yesFocus = ko.observable(false); this.noFocus = ko.observable(false); this.fYesAction = null; this.fNoAction = null; this.bFocusYesOnShow = true; this.bDisabeCloseOnEsc = true; this.sDefaultKeyScope = Enums.KeyState.PopupAsk; kn.constructorEnd(this); } kn.extendAsViewModel(['View/Popup/Ask', 'PopupsAskViewModel'], AskPopupView); _.extend(AskPopupView.prototype, AbstractView.prototype); AskPopupView.prototype.clearPopup = function () { this.askDesc(''); this.yesButton(Translator.i18n('POPUPS_ASK/BUTTON_YES')); this.noButton(Translator.i18n('POPUPS_ASK/BUTTON_NO')); this.yesFocus(false); this.noFocus(false); this.fYesAction = null; this.fNoAction = null; }; AskPopupView.prototype.yesClick = function () { this.cancelCommand(); if (Utils.isFunc(this.fYesAction)) { this.fYesAction.call(null); } }; AskPopupView.prototype.noClick = function () { this.cancelCommand(); if (Utils.isFunc(this.fNoAction)) { this.fNoAction.call(null); } }; /** * @param {string} sAskDesc * @param {Function=} fYesFunc * @param {Function=} fNoFunc * @param {string=} sYesButton * @param {string=} sNoButton * @param {boolean=} bFocusYesOnShow */ AskPopupView.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton, bFocusYesOnShow) { this.clearPopup(); this.fYesAction = fYesFunc || null; this.fNoAction = fNoFunc || null; this.askDesc(sAskDesc || ''); if (sYesButton) { this.yesButton(sYesButton); } if (sYesButton) { this.yesButton(sNoButton); } this.bFocusYesOnShow = Utils.isUnd(bFocusYesOnShow) ? true : !!bFocusYesOnShow; }; AskPopupView.prototype.onFocus = function () { if (this.bFocusYesOnShow) { this.yesFocus(true); } }; AskPopupView.prototype.onBuild = function () { key('tab, shift+tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () { if (this.yesFocus()) { this.noFocus(true); } else { this.yesFocus(true); } return false; }, this)); key('esc', Enums.KeyState.PopupAsk, _.bind(function () { this.noClick(); return false; }, this)); }; module.exports = AskPopupView; }()); /***/ }, /* 41 */ /*!************************************!*\ !*** external "window.crossroads" ***! \************************************/ /***/ function(module, exports, __webpack_require__) { module.exports = window.crossroads; /***/ }, /* 42 */, /* 43 */ /*!*************************************!*\ !*** ./dev/Stores/User/Identity.js ***! \*************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var ko = __webpack_require__(/*! ko */ 3), Settings = __webpack_require__(/*! Storage/Settings */ 9) ; /** * @constructor */ function IdentityUserStore() { this.defaultIdentityID = ko.observable(''); this.identities = ko.observableArray([]); this.identities.loading = ko.observable(false).extend({'throttle': 100}); } IdentityUserStore.prototype.populate = function () { this.defaultIdentityID(Settings.settingsGet('DefaultIdentityID')); }; module.exports = new IdentityUserStore(); }()); /***/ }, /* 44 */ /*!****************************************!*\ !*** ./dev/View/Popup/FolderSystem.js ***! \****************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), Enums = __webpack_require__(/*! Common/Enums */ 4), Consts = __webpack_require__(/*! Common/Consts */ 16), Utils = __webpack_require__(/*! Common/Utils */ 1), Translator = __webpack_require__(/*! Common/Translator */ 7), FolderStore = __webpack_require__(/*! Stores/User/Folder */ 32), Settings = __webpack_require__(/*! Storage/Settings */ 9), Data = __webpack_require__(/*! Storage/User/Data */ 15), Remote = __webpack_require__(/*! Storage/User/Remote */ 14), kn = __webpack_require__(/*! Knoin/Knoin */ 5), AbstractView = __webpack_require__(/*! Knoin/AbstractView */ 11) ; /** * @constructor * @extends AbstractView */ function FolderSystemPopupView() { AbstractView.call(this, 'Popups', 'PopupsFolderSystem'); Translator.initOnStartOrLangChange(function () { this.sChooseOnText = Translator.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE'); this.sUnuseText = Translator.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME'); }, this); this.notification = ko.observable(''); this.folderSelectList = ko.computed(function () { return Utils.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [ ['', this.sChooseOnText], [Consts.Values.UnuseOptionValue, this.sUnuseText] ], null, null, null, null, null, true); }, this); var fSaveSystemFolders = null, fCallback = null ; this.sentFolder = FolderStore.sentFolder; this.draftFolder = FolderStore.draftFolder; this.spamFolder = FolderStore.spamFolder; this.trashFolder = FolderStore.trashFolder; this.archiveFolder = FolderStore.archiveFolder; fSaveSystemFolders = _.debounce(function () { Settings.settingsSet('SentFolder', FolderStore.sentFolder()); Settings.settingsSet('DraftFolder', FolderStore.draftFolder()); Settings.settingsSet('SpamFolder', FolderStore.spamFolder()); Settings.settingsSet('TrashFolder', FolderStore.trashFolder()); Settings.settingsSet('ArchiveFolder', FolderStore.archiveFolder()); Remote.saveSystemFolders(Utils.emptyFunction, { 'SentFolder': FolderStore.sentFolder(), 'DraftFolder': FolderStore.draftFolder(), 'SpamFolder': FolderStore.spamFolder(), 'TrashFolder': FolderStore.trashFolder(), 'ArchiveFolder': FolderStore.archiveFolder(), 'NullFolder': 'NullFolder' }); }, 1000); fCallback = function () { Settings.settingsSet('SentFolder', FolderStore.sentFolder()); Settings.settingsSet('DraftFolder', FolderStore.draftFolder()); Settings.settingsSet('SpamFolder', FolderStore.spamFolder()); Settings.settingsSet('TrashFolder', FolderStore.trashFolder()); Settings.settingsSet('ArchiveFolder', FolderStore.archiveFolder()); fSaveSystemFolders(); }; FolderStore.sentFolder.subscribe(fCallback); FolderStore.draftFolder.subscribe(fCallback); FolderStore.spamFolder.subscribe(fCallback); FolderStore.trashFolder.subscribe(fCallback); FolderStore.archiveFolder.subscribe(fCallback); this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; kn.constructorEnd(this); } kn.extendAsViewModel(['View/Popup/FolderSystem', 'PopupsFolderSystemViewModel'], FolderSystemPopupView); _.extend(FolderSystemPopupView.prototype, AbstractView.prototype); FolderSystemPopupView.prototype.sChooseOnText = ''; FolderSystemPopupView.prototype.sUnuseText = ''; /** * @param {number=} iNotificationType = Enums.SetSystemFoldersNotification.None */ FolderSystemPopupView.prototype.onShow = function (iNotificationType) { var sNotification = ''; iNotificationType = Utils.isUnd(iNotificationType) ? Enums.SetSystemFoldersNotification.None : iNotificationType; switch (iNotificationType) { case Enums.SetSystemFoldersNotification.Sent: sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT'); break; case Enums.SetSystemFoldersNotification.Draft: sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS'); break; case Enums.SetSystemFoldersNotification.Spam: sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM'); break; case Enums.SetSystemFoldersNotification.Trash: sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH'); break; case Enums.SetSystemFoldersNotification.Archive: sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE'); break; } this.notification(sNotification); }; module.exports = FolderSystemPopupView; }()); /***/ }, /* 45 */ /*!*************************************!*\ !*** ./dev/View/Popup/Languages.js ***! \*************************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var _ = __webpack_require__(/*! _ */ 2), ko = __webpack_require__(/*! ko */ 3), Utils = __webpack_require__(/*! Common/Utils */ 1), kn = __webpack_require__(/*! Knoin/Knoin */ 5), AbstractView = __webpack_require__(/*! Knoin/AbstractView */ 11) ; /** * @constructor * @extends AbstractView */ function LanguagesPopupView() { AbstractView.call(this, 'Popups', 'PopupsLanguages'); this.LanguageStore = __webpack_require__(/*! Stores/Language */ 31); this.exp = ko.observable(false); this.languages = ko.computed(function () { return _.map(this.LanguageStore.languages(), function (sLanguage) { return { 'key': sLanguage, 'selected': ko.observable(false), 'fullName': Utils.convertLangName(sLanguage) }; }); }, this); this.LanguageStore.language.subscribe(function () { this.resetMainLanguage(); }, this); kn.constructorEnd(this); } kn.extendAsViewModel(['View/Popup/Languages', 'PopupsLanguagesViewModel'], LanguagesPopupView); _.extend(LanguagesPopupView.prototype, AbstractView.prototype); LanguagesPopupView.prototype.languageEnName = function (sLanguage) { var sResult = Utils.convertLangName(sLanguage, true); return 'English' === sResult ? '' : sResult; }; LanguagesPopupView.prototype.resetMainLanguage = function () { var sCurrent = this.LanguageStore.language(); _.each(this.languages(), function (oItem) { oItem['selected'](oItem['key'] === sCurrent); }); }; LanguagesPopupView.prototype.onShow = function () { this.exp(true); this.resetMainLanguage(); }; LanguagesPopupView.prototype.onHide = function () { this.exp(false); }; LanguagesPopupView.prototype.changeLanguage = function (sLang) { this.LanguageStore.language(sLang); this.cancelCommand(); }; module.exports = LanguagesPopupView; }()); /***/ }, /* 46 */ /*!*****************************!*\ !*** ./dev/App/Abstract.js ***! \*****************************/ /***/ function(module, exports, __webpack_require__) { (function () { 'use strict'; var window = __webpack_require__(/*! window */ 10), _ = __webpack_require__(/*! _ */ 2), $ = __webpack_require__(/*! $ */ 13), Globals = __webpack_require__(/*! Common/Globals */ 8), Utils = __webpack_require__(/*! Common/Utils */ 1), Links = __webpack_require__(/*! Common/Links */ 12), Events = __webpack_require__(/*! Common/Events */ 28), Translator = __webpack_require__(/*! Common/Translator */ 7), Settings = __webpack_require__(/*! Storage/Settings */ 9), AbstractBoot = __webpack_require__(/*! Knoin/AbstractBoot */ 57) ; /** * @constructor * @param {RemoteStorage|AdminRemoteStorage} Remote * @extends AbstractBoot */ function AbstractApp(Remote) { AbstractBoot.call(this); this.isLocalAutocomplete = true; this.iframe = $('