eslint (additional rules)

This commit is contained in:
RainLoop Team 2016-06-30 03:02:45 +03:00
parent 77a1d3f3df
commit 8e8a041032
150 changed files with 21911 additions and 23106 deletions

168
.eslintrc
View file

@ -1,168 +0,0 @@
{
"ecmaFeatures": {
"modules": true
},
"env": {
"node": true,
"commonjs": true,
"es6": true,
"browser": true
},
"globals": {
"RL_COMMUNITY" : true,
"ko" : true,
"ssm" : true,
"moment" : true,
"ifvisible" : true,
"crossroads" : true,
"hasher" : true,
"key" : true,
"Jua" : true,
"_" : true,
"$" : true,
"Dropbox" : true
},
"rules": {
"comma-dangle": [2, "never"],
"no-cond-assign": 2,
"no-console": 2,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-keys": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-reserved-keys": 0,
"no-sparse-arrays": 2,
"no-unreachable": 2,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
// Best Practices
"block-scoped-var": 2,
"complexity": 0,
"consistent-return": 2,
"curly": 2,
// "default-case": 2,
"dot-notation": 2,
"eqeqeq": 2,
"guard-for-in": 2,
"no-alert": 2,
"no-caller": 2,
"no-div-regex": 2,
"no-else-return": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-implied-eval": 2,
"no-iterator": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multi-spaces": 2,
"no-multi-str": 0,
"no-native-reassign": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-wrappers": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-process-env": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-sequences": 2,
"no-unused-expressions": 2,
"no-void": 0,
"no-warning-comments": 2,
"no-with": 2,
"radix": 2,
"vars-on-top": 0,
"wrap-iife": 2,
"yoda": 0,
// Strict Mode
"strict": 0,
// Variables
"no-catch-shadow": 2,
"no-delete-var": 2,
"no-label-var": 2,
"no-shadow": 2,
"no-shadow-restricted-names": 2,
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 2,
"no-unused-vars": 2,
"no-use-before-define": 2,
// Stylistic Issues
// "indent": [2, "tab", {
// "SwitchCase": 1,
// "VariableDeclarator": 1
// }],
"camelcase": 0,
"comma-spacing": 2,
"comma-style": 2,
"consistent-this": 0,
"eol-last": 2,
"func-names": 0,
"func-style": 0,
"key-spacing": [2, {
"beforeColon": false,
"afterColon": true
}],
"max-nested-callbacks": 0,
"new-cap": 2,
"new-parens": 2,
"no-array-constructor": 2,
"no-inline-comments": 0,
// "no-lonely-if": 2,
"no-mixed-spaces-and-tabs": 2,
// "no-nested-ternary": 2,
"no-new-object": 2,
"semi-spacing": [2, {
"before": false,
"after": true
}],
"no-spaced-func": 2,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-multiple-empty-lines": 2,
"no-underscore-dangle": 0,
"one-var": 0,
"operator-assignment": [2, "always"],
"padded-blocks": 0,
"quotes": [2, "single"],
"quote-props": 0,
"semi": [2, "always"],
// "sort-vars": [2, {"ignoreCase": true}],
"space-before-blocks": 2,
"object-curly-spacing": [2, "never"],
"array-bracket-spacing": [2, "never"],
"space-in-parens": 2,
"space-infix-ops": 2,
"space-unary-ops": 2,
"spaced-comment": 2,
"wrap-regex": 0,
"max-depth": 0,
"max-len": [2, 200],
"max-params": 0,
"max-statements": 0,
"no-plusplus": 0
}
}

237
.eslintrc.js Normal file
View file

@ -0,0 +1,237 @@
module.exports = {
"extends": "eslint:recommended",
"ecmaFeatures": {
"modules": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"node": true,
"commonjs": true,
"es6": true,
"browser": true
},
"globals": {
"RL_COMMUNITY": true,
"ko": true,
"ssm": true,
"moment": true,
"ifvisible": true,
"crossroads": true,
"hasher": true,
"key": true,
"Jua": true,
"_": true,
"$": true,
"Dropbox": true
},
"rules": {
"strict": 2, // require or disallow strict mode directives
// errors
"comma-dangle": [2, "never"], // disallow or enforce trailing commas
"no-cond-assign": [2, "always"], // disallow assignment in conditional expressions
"no-console": 1, // disallow use of console (off by default in the node environment)
"no-constant-condition": 2, // disallow use of constant expressions in conditions
"no-control-regex": 2, // disallow control characters in regular expressions
"no-debugger": 2, // disallow use of debugger
"no-dupe-args": 2, // disallow duplicate arguments in functions
"no-dupe-keys": 2, // disallow duplicate keys when creating object literals
"no-duplicate-case": 2, // disallow a duplicate case label.
"no-empty": 2, // disallow empty statements
"no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions
"no-ex-assign": 2, // disallow assigning to the exception in a catch block
"no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
"no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
"no-extra-semi": 2, // disallow unnecessary semicolons
"no-func-assign": 2, // disallow overwriting functions written as function declarations
"no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
"no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
"no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
"no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
"no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
"no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
"no-sparse-arrays": 2, // disallow sparse arrays
"no-unexpected-multiline": 2, // disallow confusing multiline expressions
"no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
"use-isnan": 2, // disallow comparisons with the value NaN
"valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
// "valid-jsdoc": [2, { // Ensure JSDoc comments are valid (off by default)
// "requireParamDescription": false,
// "requireReturnDescription": false
// }],
// best practices
"accessor-pairs": 2, // enforce getter and setter pairs in objects
"block-scoped-var": 2, // treat var statements as if they were block scoped (off by default). 0: deep destructuring is not compatible https://github.com/eslint/eslint/issues/1863
// "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
"consistent-return": 2, // require return statements to either always or never specify values
"curly": 2, // specify curly brace conventions for all control statements
"default-case": 2, // require default case in switch statements (off by default)
"dot-location": [2, "property"], // enforce consistent newlines before and after dots
"dot-notation": 2, // encourages use of dot notation whenever possible
"eqeqeq": 2, // require the use of === and !==
"guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
"no-alert": 2, // disallow the use of alert, confirm, and prompt
"no-caller": 2, // disallow use of arguments.caller or arguments.callee
"no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default)
"no-else-return": 2, // disallow else after a return in an if (off by default)
"no-empty-label": 2, // disallow use of labels for anything other then loops and switches
"no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default)
"no-eval": 2, // disallow use of eval()
"no-extend-native": 2, // disallow adding to native types
"no-extra-bind": 2, // disallow unnecessary function binding
"no-fallthrough": 2, // disallow fallthrough of case statements
"no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
"no-implied-eval": 2, // disallow use of eval()-like methods
"no-iterator": 2, // disallow usage of __iterator__ property
"no-labels": 2, // disallow use of labeled statements
"no-lone-blocks": 2, // disallow unnecessary nested blocks
"no-loop-func": 2, // disallow creation of functions within loops
"no-multi-spaces": 2, // disallow use of multiple spaces
"no-multi-str": 2, // disallow use of multiline strings
"no-native-reassign": 2, // disallow reassignments of native objects
"no-new": 2, // disallow use of new operator when not part of the assignment or comparison
"no-new-func": 2, // disallow use of new operator for Function object
"no-new-wrappers": 2, // disallows creating new instances of String,Number, and Boolean
"no-octal": 2, // disallow use of octal literals
"no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
// "no-param-reassign": 2, // disallow reassignment of function parameters (off by default)
"no-process-env": 2, // disallow use of process.env (off by default)
"no-proto": 2, // disallow usage of __proto__ property
"no-redeclare": 2, // disallow declaring the same variable more then once
"no-return-assign": 2, // disallow use of assignment in return statement
"no-script-url": 2, // disallow use of javascript: urls.
"no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
"no-sequences": 2, // disallow use of comma operator
"no-throw-literal": 2, // restrict what can be thrown as an exception (off by default)
"no-unused-expressions": 2, // disallow usage of expressions in statement position
"no-void": 2, // disallow use of void operator (off by default)
"no-warning-comments": 1, // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default)
"no-with": 2, // disallow use of the with statement
"radix": 2, // require use of the second argument for parseInt() (off by default)
// "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default)
"wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default)
"yoda": [2, "always"], // require or disallow Yoda conditions
// variables
"no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
"no-delete-var": 2, // disallow deletion of variables
"no-label-var": 2, // disallow labels that share a name with a variable
"no-shadow": 2, // disallow declaration of variables already declared in the outer scope
"no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
"no-undef-init": 2, // disallow use of undefined when initializing variables
"no-undefined": 2, // disallow use of undefined variable (off by default)
"no-unused-vars": 2, // disallow declaration of variables that are not used in the code
"no-use-before-define": 2, // disallow use of variables before they are defined
// stylistic issues
"array-bracket-spacing": 1, // enforce consistent spacing inside array brackets
"block-spacing": [1, "never"], // enforce consistent spacing inside single-line blocks
// "brace-style": [1, "1tbs"], // enforce consistent brace style for blocks
// "camelcase": 1, // enforce camelcase naming convention
"comma-spacing": 1, // enforce consistent spacing before and after commas
"comma-style": 1, // enforce consistent comma style
"computed-property-spacing": 1, // enforce consistent spacing inside computed property brackets
"consistent-this": [1, "self"], // enforce consistent naming when capturing the current execution context
"eol-last": 1, // enforce at least one newline at the end of files
"id-match": 1, // require identifiers to match a specified regular expression
"indent": [1, "tab", { // enforce consistent indentation
"SwitchCase": 1,
"VariableDeclarator": {
"var": 1,
"let": 1,
"const": 1
}
}],
"key-spacing": 1, // enforce consistent spacing between keys and values in object literal properties
"linebreak-style": [1, "windows"], // enforce consistent linebreak style
"lines-around-comment": 0, // require empty lines around comments
"max-depth": 0, // enforce a maximum depth that blocks can be nested
"max-len": [1, 200], // enforce a maximum line length
"max-lines": 0, // enforce a maximum file length
"max-nested-callbacks": [1, 5], // enforce a maximum depth that callbacks can be nested
"max-params": 0, // enforce a maximum number of parameters in function definitions
"max-statements": 0, // enforce a maximum number of statements allowed in function blocks
"max-statements-per-line": 0, // enforce a maximum number of statements allowed per line
"new-cap": 1, // require constructor function names to begin with a capital letter
"new-parens": 1, // require parentheses when invoking a constructor with no arguments
"newline-after-var": 0, // require or disallow an empty line after var declarations
"newline-before-return": 0, // require an empty line before return statements
"newline-per-chained-call": 0, // require a newline after each call in a method chain
"no-array-constructor": 1, // disallow Array constructors
"no-bitwise": 1, // disallow bitwise operators
"no-continue": 1, // disallow continue statements
"no-inline-comments": 0, // disallow inline comments after code
"no-lonely-if": 0, // disallow if statements as the only statement in else blocks
"no-mixed-operators": 0, // disallow mixes of different operators
"no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
"no-multiple-empty-lines": 2, // disallow multiple empty lines
"no-negated-condition": 0, // disallow negated conditions
"no-nested-ternary": 0, // disallow nested ternary expressions
"no-new-object": 2, // disallow Object constructors
"no-plusplus": [1, { // disallow the unary operators ++ and --
"allowForLoopAfterthoughts": true
}],
"no-restricted-syntax": 1, // disallow specified syntax
"no-spaced-func": 1, // disallow spacing between function identifiers and their applications
"no-ternary": 0, // disallow ternary operators
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
"no-unneeded-ternary": 1, // disallow ternary operators when simpler alternatives exist
"no-whitespace-before-property": 0, // disallow whitespace before properties
"object-curly-newline": 0, // enforce consistent line breaks inside braces
"object-curly-spacing": [1, "never"], // enforce consistent spacing inside braces
"object-property-newline": [0, { // enforce placing object properties on separate lines
"allowMultiplePropertiesPerLine": false
}],
// "one-var": [2, { // enforce variables to be declared either together or separately in functions
// "var": "always",
// "let": "always",
// "const": "never"
// }],
"one-var-declaration-per-line": [0, "always"], // require or disallow newlines around var declarations
"operator-assignment": 1, // require or disallow assignment operator shorthand where possible
"operator-linebreak": [1, "after"], // enforce consistent linebreak style for operators
"padded-blocks": [0, "never"], // require or disallow padding within blocks
"quote-props": [0, "as-needed"], // require quotes around object literal property names
"quotes": [2, "single"], // enforce the consistent use of either backticks, double, or single quotes
"require-jsdoc": 1, // require JSDoc comments
"semi": [1, "always"], // require or disallow semicolons instead of ASI
"semi-spacing": 1, // enforce consistent spacing before and after semicolons
"sort-vars": 0, // require variables within the same declaration block to be sorted
"space-before-blocks": 1, // enforce consistent spacing before blocks
"space-before-function-paren": [1, "never"], // enforce consistent spacing before function definition opening parenthesis
"space-in-parens": 1, // enforce consistent spacing inside parentheses
"space-infix-ops": 1, // require spacing around operators
"space-unary-ops": 1, // enforce consistent spacing before or after unary operators
"spaced-comment": 1, // enforce consistent spacing after the // or /* in a comment
// "unicode-bom": [1, "never"], // require or disallow the Unicode BOM
"wrap-regex": 1, // require parenthesis around regex literals
// es6
"constructor-super": 2, // require super() calls in constructors
"no-class-assign": 2, // disallow reassigning class members
"no-const-assign": 2, // disallow reassigning const variables
"no-dupe-class-members": 2, // disallow duplicate class members
"no-this-before-super": 2, // disallow this/super before calling super() in constructors
"prefer-const": 2 // require const declarations for variables that are never reassigned after declared
}
};

View file

@ -19,6 +19,7 @@ import {AbstractBoot} from 'Knoin/AbstractBoot';
class AbstractApp extends AbstractBoot class AbstractApp extends AbstractBoot
{ {
/** /**
* @constructor
* @param {RemoteStorage|AdminRemoteStorage} Remote * @param {RemoteStorage|AdminRemoteStorage} Remote
*/ */
constructor(Remote) constructor(Remote)
@ -66,8 +67,7 @@ class AbstractApp extends AbstractBoot
var var
iH = $win.height(), iH = $win.height(),
iW = $win.height() iW = $win.height();
;
if ($win.__sizes[0] !== iH || $win.__sizes[1] !== iW) if ($win.__sizes[0] !== iH || $win.__sizes[1] !== iW)
{ {
@ -124,11 +124,11 @@ class AbstractApp extends AbstractBoot
/** /**
* @param {string} link * @param {string} link
* @return {boolean} * @returns {boolean}
*/ */
download(link) { download(link) {
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1)) if (sUserAgent && (-1 < sUserAgent.indexOf('chrome') || -1 < sUserAgent.indexOf('chrome')))
{ {
const oLink = window.document.createElement('a'); const oLink = window.document.createElement('a');
oLink.href = link; oLink.href = link;
@ -160,7 +160,7 @@ class AbstractApp extends AbstractBoot
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
googlePreviewSupported() { googlePreviewSupported() {
if (null === this.googlePreviewSupportedCache) if (null === this.googlePreviewSupportedCache)
@ -220,8 +220,7 @@ class AbstractApp extends AbstractBoot
const const
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
mobile = Settings.appSettingsGet('mobile'), mobile = Settings.appSettingsGet('mobile'),
inIframe = !!Settings.appSettingsGet('inIframe') inIframe = !!Settings.appSettingsGet('inIframe');
;
let customLogoutLink = pString(Settings.appSettingsGet('customLogoutLink')); let customLogoutLink = pString(Settings.appSettingsGet('customLogoutLink'));
@ -282,8 +281,7 @@ class AbstractApp extends AbstractBoot
const const
mobile = Settings.appSettingsGet('mobile'), mobile = Settings.appSettingsGet('mobile'),
ssm = require('ssm'), ssm = require('ssm'),
ko = require('ko') ko = require('ko');
;
ko.components.register('SaveTrigger', require('Component/SaveTrigger')); ko.components.register('SaveTrigger', require('Component/SaveTrigger'));
ko.components.register('Input', require('Component/Input')); ko.components.register('Input', require('Component/Input'));

View file

@ -78,10 +78,8 @@ class AdminApp extends AbstractApp
PackageStore.packagesReal(!!data.Result.Real); PackageStore.packagesReal(!!data.Result.Real);
PackageStore.packagesMainUpdatable(!!data.Result.MainUpdatable); PackageStore.packagesMainUpdatable(!!data.Result.MainUpdatable);
let let list = [];
list = [], const loading = {};
loading = {}
;
_.each(PackageStore.packages(), (item) => { _.each(PackageStore.packages(), (item) => {
if (item && item.loading()) if (item && item.loading())

View file

@ -110,8 +110,7 @@ class AppUser extends AbstractApp
centeredX: true, centeredX: true,
centeredY: true centeredY: true
}) })
.removeAttr('style') .removeAttr('style');
;
}, 1000); }, 1000);
} }
@ -147,8 +146,7 @@ class AppUser extends AbstractApp
reloadMessageList(bDropPagePosition = false, bDropCurrenFolderCache = false) { reloadMessageList(bDropPagePosition = false, bDropCurrenFolderCache = false) {
let let
iOffset = (MessageStore.messageListPage() - 1) * SettingsStore.messagesPerPage() iOffset = (MessageStore.messageListPage() - 1) * SettingsStore.messagesPerPage();
;
if (bDropCurrenFolderCache) if (bDropCurrenFolderCache)
{ {
@ -203,7 +201,7 @@ class AppUser extends AbstractApp
/** /**
* @param {Function} fResultFunc * @param {Function} fResultFunc
* @return {boolean} * @returns {boolean}
*/ */
contactsSync(fResultFunc) { contactsSync(fResultFunc) {
@ -232,16 +230,14 @@ class AppUser extends AbstractApp
const const
sTrashFolder = FolderStore.trashFolder(), sTrashFolder = FolderStore.trashFolder(),
sSpamFolder = FolderStore.spamFolder() sSpamFolder = FolderStore.spamFolder();
;
_.each(this.moveCache, (oItem) => { _.each(this.moveCache, (oItem) => {
var var
bSpam = sSpamFolder === oItem.To, bSpam = sSpamFolder === oItem.To,
bTrash = sTrashFolder === oItem.To, bTrash = sTrashFolder === oItem.To,
bHam = !bSpam && sSpamFolder === oItem.From && Cache.getFolderInboxName() === oItem.To bHam = !bSpam && sSpamFolder === oItem.From && Cache.getFolderInboxName() === oItem.To;
;
Remote.messagesMove(this.moveOrDeleteResponseHelper, oItem.From, oItem.To, oItem.Uid, Remote.messagesMove(this.moveOrDeleteResponseHelper, oItem.From, oItem.To, oItem.Uid,
bSpam ? 'SPAM' : (bHam ? 'HAM' : ''), bSpam || bTrash); bSpam ? 'SPAM' : (bHam ? 'HAM' : ''), bSpam || bTrash);
@ -326,8 +322,7 @@ class AppUser extends AbstractApp
let let
oMoveFolder = null, oMoveFolder = null,
nSetSystemFoldersNotification = null nSetSystemFoldersNotification = null;
;
switch (iDeleteType) switch (iDeleteType)
{ {
@ -346,6 +341,7 @@ class AppUser extends AbstractApp
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.archiveFolder()); oMoveFolder = Cache.getFolderFromCacheList(FolderStore.archiveFolder());
nSetSystemFoldersNotification = SetSystemFoldersNotification.Archive; nSetSystemFoldersNotification = SetSystemFoldersNotification.Archive;
break; break;
// no default
} }
bUseFolder = isUnd(bUseFolder) ? true : !!bUseFolder; bUseFolder = isUnd(bUseFolder) ? true : !!bUseFolder;
@ -390,8 +386,7 @@ class AppUser extends AbstractApp
{ {
const const
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw), oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
oToFolder = Cache.getFolderFromCacheList(sToFolderFullNameRaw) oToFolder = Cache.getFolderFromCacheList(sToFolderFullNameRaw);
;
if (oFromFolder && oToFolder) if (oFromFolder && oToFolder)
{ {
@ -441,8 +436,7 @@ class AppUser extends AbstractApp
}, (errorCode) => { }, (errorCode) => {
FolderStore.folderList.error(getNotification(errorCode, '', errorDefCode)); FolderStore.folderList.error(getNotification(errorCode, '', errorDefCode));
Promises.foldersReloadWithTimeout(FolderStore.foldersLoading); Promises.foldersReloadWithTimeout(FolderStore.foldersLoading);
}) });
;
} }
reloadOpenPgpKeys() { reloadOpenPgpKeys() {
@ -453,8 +447,7 @@ class AppUser extends AbstractApp
aKeys = [], aKeys = [],
oEmail = new EmailModel(), oEmail = new EmailModel(),
oOpenpgpKeyring = PgpStore.openpgpKeyring, oOpenpgpKeyring = PgpStore.openpgpKeyring,
oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : [] oOpenpgpKeys = oOpenpgpKeyring ? oOpenpgpKeyring.getAllKeys() : [];
;
_.each(oOpenpgpKeys, (oItem, iIndex) => { _.each(oOpenpgpKeys, (oItem, iIndex) => {
if (oItem && oItem.primaryKey) if (oItem && oItem.primaryKey)
@ -463,9 +456,8 @@ class AppUser extends AbstractApp
aEmails = [], aEmails = [],
aUsers = [], aUsers = [],
oPrimaryUser = oItem.getPrimaryUser(), oPrimaryUser = oItem.getPrimaryUser(),
sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid sUser = (oPrimaryUser && oPrimaryUser.user) ? oPrimaryUser.user.userId.userid :
: (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '') (oItem.users && oItem.users[0] ? oItem.users[0].userId.userid : '');
;
if (oItem.users) if (oItem.users)
{ {
@ -550,8 +542,7 @@ class AppUser extends AbstractApp
var var
aCounts = {}, aCounts = {},
sParentEmail = Settings.settingsGet('ParentEmail'), sParentEmail = Settings.settingsGet('ParentEmail'),
sAccountEmail = AccountStore.email() sAccountEmail = AccountStore.email();
;
sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail; sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
@ -582,8 +573,7 @@ class AppUser extends AbstractApp
const const
sId = pString(oIdentityData.Id), sId = pString(oIdentityData.Id),
sEmail = pString(oIdentityData.Email), sEmail = pString(oIdentityData.Email),
oIdentity = new IdentityModel(sId, sEmail) oIdentity = new IdentityModel(sId, sEmail);
;
oIdentity.name(pString(oIdentityData.Name)); oIdentity.name(pString(oIdentityData.Name));
oIdentity.replyTo(pString(oIdentityData.ReplyTo)); oIdentity.replyTo(pString(oIdentityData.ReplyTo));
@ -646,8 +636,7 @@ class AppUser extends AbstractApp
let let
uid = '', uid = '',
check = false, check = false,
unreadCountChange = false unreadCountChange = false;
;
const folderFromCache = Cache.getFolderFromCacheList(data.Result.Folder); const folderFromCache = Cache.getFolderFromCacheList(data.Result.Folder);
if (folderFromCache) if (folderFromCache)
@ -739,8 +728,7 @@ class AppUser extends AbstractApp
var var
sHash = Cache.getFolderHash(oItem.Folder), sHash = Cache.getFolderHash(oItem.Folder),
oFolder = Cache.getFolderFromCacheList(oItem.Folder), oFolder = Cache.getFolderFromCacheList(oItem.Folder),
bUnreadCountChange = false bUnreadCountChange = false;
;
if (oFolder) if (oFolder)
{ {
@ -813,8 +801,7 @@ class AppUser extends AbstractApp
var var
oFolder = null, oFolder = null,
aRootUids = [], aRootUids = [],
iAlreadyUnread = 0 iAlreadyUnread = 0;
;
if (isUnd(aMessages)) if (isUnd(aMessages))
{ {
@ -825,7 +812,8 @@ class AppUser extends AbstractApp
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length) if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
{ {
switch (iSetAction) { switch (iSetAction)
{
case MessageSetAction.SetSeen: case MessageSetAction.SetSeen:
_.each(aRootUids, (sSubUid) => { _.each(aRootUids, (sSubUid) => {
@ -877,6 +865,7 @@ class AppUser extends AbstractApp
Remote.messageSetFlagged(noop, sFolderFullNameRaw, aRootUids, false); Remote.messageSetFlagged(noop, sFolderFullNameRaw, aRootUids, false);
break; break;
// no default
} }
this.reloadFlagsCurrentMessageListAndMessageFromCache(); this.reloadFlagsCurrentMessageListAndMessageFromCache();
@ -1019,8 +1008,7 @@ class AppUser extends AbstractApp
}) })
.on('mouseup', () => { .on('mouseup', () => {
$html.removeClass('rl-resizer'); $html.removeClass('rl-resizer');
}) });
;
} }
}, },
@ -1062,8 +1050,7 @@ class AppUser extends AbstractApp
{ {
oTop oTop
.resizable('destroy') .resizable('destroy')
.removeAttr('style') .removeAttr('style');
;
} }
if (oBottom) if (oBottom)
@ -1084,8 +1071,7 @@ class AppUser extends AbstractApp
const iHeight = pInt(Local.get(sClientSideKeyName)) || 300; const iHeight = pInt(Local.get(sClientSideKeyName)) || 300;
fSetHeight(iHeight > iMinHeight ? iHeight : iMinHeight); fSetHeight(iHeight > iMinHeight ? iHeight : iMinHeight);
} }
} };
;
fDisable(false); fDisable(false);
@ -1144,8 +1130,7 @@ class AppUser extends AbstractApp
}) })
.on('mouseup', () => { .on('mouseup', () => {
$html.removeClass('rl-resizer'); $html.removeClass('rl-resizer');
}) });
;
} }
}, },
fResizeResizeFunction = _.debounce(() => { fResizeResizeFunction = _.debounce(() => {
@ -1173,8 +1158,7 @@ class AppUser extends AbstractApp
height: '' height: ''
}); });
} }
} };
;
if (null !== mLeftWidth) if (null !== mLeftWidth)
{ {
@ -1271,8 +1255,7 @@ class AppUser extends AbstractApp
iContactsSyncInterval = pInt(Settings.settingsGet('ContactsSyncInterval')), iContactsSyncInterval = pInt(Settings.settingsGet('ContactsSyncInterval')),
bGoogle = Settings.settingsGet('AllowGoogleSocial'), bGoogle = Settings.settingsGet('AllowGoogleSocial'),
bFacebook = Settings.settingsGet('AllowFacebookSocial'), bFacebook = Settings.settingsGet('AllowFacebookSocial'),
bTwitter = Settings.settingsGet('AllowTwitterSocial') bTwitter = Settings.settingsGet('AllowTwitterSocial');
;
if (progressJs) if (progressJs)
{ {
@ -1423,7 +1406,8 @@ class AppUser extends AbstractApp
window.navigator.registerProtocolHandler('mailto', window.navigator.registerProtocolHandler('mailto',
window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s', window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
'' + (Settings.settingsGet('Title') || 'RainLoop')); '' + (Settings.settingsGet('Title') || 'RainLoop'));
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
if (Settings.settingsGet('MailToEmail')) if (Settings.settingsGet('MailToEmail'))
{ {

View file

@ -17,8 +17,7 @@ const Base64 = {
let let
output = '', output = '',
chr1, chr2, chr3, enc1, enc2, enc3, enc4, chr1, chr2, chr3, enc1, enc2, enc3, enc4,
i = 0 i = 0;
;
input = Base64._utf8_encode(input); input = Base64._utf8_encode(input);
@ -56,8 +55,7 @@ const Base64 = {
let let
output = '', output = '',
chr1, chr2, chr3, enc1, enc2, enc3, enc4, chr1, chr2, chr3, enc1, enc2, enc3, enc4,
i = 0 i = 0;
;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
@ -97,8 +95,7 @@ const Base64 = {
utftext = '', utftext = '',
n = 0, n = 0,
l = string.length, l = string.length,
c = 0 c = 0;
;
for (; n < l; n++) { for (; n < l; n++) {
@ -132,8 +129,7 @@ const Base64 = {
i = 0, i = 0,
c = 0, c = 0,
c2 = 0, c2 = 0,
c3 = 0 c3 = 0;
;
while ( i < utftext.length ) while ( i < utftext.length )
{ {

View file

@ -14,6 +14,11 @@ window.__rlah_set = () => setHash();
window.__rlah_clear = () => clearHash(); window.__rlah_clear = () => clearHash();
window.__rlah_data = () => RL_APP_DATA_STORAGE; window.__rlah_data = () => RL_APP_DATA_STORAGE;
/**
* @param {string} id
* @param {string} name
* @returns {string}
*/
function getComputedStyle(id, name) function getComputedStyle(id, name)
{ {
var element = window.document.getElementById(id); var element = window.document.getElementById(id);
@ -21,16 +26,27 @@ function getComputedStyle(id, name)
(window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(name) : null); (window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(name) : null);
} }
/**
* @param {string} styles
* @returns {void}
*/
function includeStyle(styles) function includeStyle(styles)
{ {
window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E')); window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E'));
} }
/**
* @param {string} src
* @returns {void}
*/
function includeScr(src) function includeScr(src)
{ {
window.document.write(unescape('%3Csc' + 'ript type="text/jav' + 'ascr' + 'ipt" data-cfasync="false" sr' + 'c="' + src + '"%3E%3C/' + 'scr' + 'ipt%3E')); window.document.write(unescape('%3Csc' + 'ript type="text/jav' + 'ascr' + 'ipt" data-cfasync="false" sr' + 'c="' + src + '"%3E%3C/' + 'scr' + 'ipt%3E'));
} }
/**
* @returns {boolean}
*/
function includeLayout() function includeLayout()
{ {
const app = window.document.getElementById('rl-app'); const app = window.document.getElementById('rl-app');
@ -49,18 +65,25 @@ function includeLayout()
return false; return false;
} }
function includeAppScr(data = {}) /**
* @param {mixed} data
* @returns {void}
*/
function includeAppScr({admin = false, mobile = false, mobileDevice = false})
{ {
let src = './?/'; let src = './?/';
src += data.admin ? 'Admin' : ''; src += admin ? 'Admin' : '';
src += 'AppData@'; src += 'AppData@';
src += data.mobile ? 'mobile' : 'no-mobile'; src += mobile ? 'mobile' : 'no-mobile';
src += data.mobileDevice ? '-1' : '-0'; src += mobileDevice ? '-1' : '-0';
src += '/'; src += '/';
includeScr(src + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/'); includeScr(src + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/');
} }
/**
* @returns {object}
*/
function getRainloopBootData() function getRainloopBootData()
{ {
let result = {}; let result = {};
@ -74,13 +97,16 @@ function getRainloopBootData()
return result; return result;
} }
/**
* @param {string} additionalError
* @returns {void}
*/
function showError(additionalError) function showError(additionalError)
{ {
const const
oR = window.document.getElementById('rl-loading'), oR = window.document.getElementById('rl-loading'),
oL = window.document.getElementById('rl-loading-error'), oL = window.document.getElementById('rl-loading-error'),
oLA = window.document.getElementById('rl-loading-error-additional') oLA = window.document.getElementById('rl-loading-error-additional');
;
if (oR) if (oR)
{ {
@ -104,12 +130,15 @@ function showError(additionalError)
} }
} }
/**
* @param {string} description
* @returns {void}
*/
function showDescriptionAndLoading(description) function showDescriptionAndLoading(description)
{ {
const const
oE = window.document.getElementById('rl-loading'), oE = window.document.getElementById('rl-loading'),
oElDesc = window.document.getElementById('rl-loading-desc') oElDesc = window.document.getElementById('rl-loading-desc');
;
if (oElDesc && description) if (oElDesc && description)
{ {
@ -125,6 +154,11 @@ function showDescriptionAndLoading(description)
} }
} }
/**
* @param {boolean} withError
* @param {string} additionalError
* @returns {void}
*/
function runMainBoot(withError, additionalError) function runMainBoot(withError, additionalError)
{ {
if (window.__APP_BOOT && !withError) if (window.__APP_BOOT && !withError)
@ -139,6 +173,9 @@ function runMainBoot(withError, additionalError)
} }
} }
/**
* @returns {void}
*/
function runApp() function runApp()
{ {
const appData = window.__rlah_data(); const appData = window.__rlah_data();
@ -162,16 +199,14 @@ function runApp()
window.$('#rl-bg').attr('style', 'background-image: none !important;') window.$('#rl-bg').attr('style', 'background-image: none !important;')
.backstretch(appData.IncludeBackground.replace('{{USER}}', .backstretch(appData.IncludeBackground.replace('{{USER}}',
(window.__rlah ? (window.__rlah() || '0') : '0')), {fade: 100, centeredX: true, centeredY: true}) (window.__rlah ? (window.__rlah() || '0') : '0')), {fade: 100, centeredX: true, centeredY: true})
.removeAttr('style') .removeAttr('style');
;
} }
} }
}), }),
common = window.Promise.all([ common = window.Promise.all([
window.jassl(appData.TemplatesLink), window.jassl(appData.TemplatesLink),
window.jassl(appData.LangLink) window.jassl(appData.LangLink)
]) ]);
;
window.Promise.all([libs, common]) window.Promise.all([libs, common])
.then(() => { .then(() => {
@ -193,8 +228,7 @@ function runApp()
window.__initEditor(); window.__initEditor();
window.__initEditor = null; window.__initEditor = null;
} }
}) });
;
} }
else else
{ {
@ -202,6 +236,10 @@ function runApp()
} }
} }
/**
* @param {mixed} data
* @returns {void}
*/
window.__initAppData = function(data) { window.__initAppData = function(data) {
RL_APP_DATA_STORAGE = data; RL_APP_DATA_STORAGE = data;
@ -226,6 +264,9 @@ window.__initAppData = function(data) {
runApp(); runApp();
}; };
/**
* @returns {void}
*/
window.__runBoot = function() { window.__runBoot = function() {
if (!window.navigator || !window.navigator.cookieEnabled) if (!window.navigator || !window.navigator.cookieEnabled)

View file

@ -5,18 +5,20 @@ import {trim, pInt, isArray} from 'Common/Utils';
import * as Links from 'Common/Links'; import * as Links from 'Common/Links';
import * as Settings from 'Storage/Settings'; import * as Settings from 'Storage/Settings';
let FOLDERS_CACHE = {}; let FOLDERS_CACHE = {},
let FOLDERS_NAME_CACHE = {}; FOLDERS_NAME_CACHE = {},
let FOLDERS_HASH_CACHE = {}; FOLDERS_HASH_CACHE = {},
let FOLDERS_UID_NEXT_CACHE = {}; FOLDERS_UID_NEXT_CACHE = {},
let MESSAGE_FLAGS_CACHE = {}; MESSAGE_FLAGS_CACHE = {},
NEW_MESSAGE_CACHE = {},
inboxFolderName = '';
let NEW_MESSAGE_CACHE = {}; const REQUESTED_MESSAGE_CACHE = {},
let REQUESTED_MESSAGE_CACHE = {}; capaGravatar = Settings.capa(Capa.Gravatar);
const capaGravatar = Settings.capa(Capa.Gravatar);
let inboxFolderName = '';
/**
* @returns {void}
*/
export function clear() export function clear()
{ {
FOLDERS_CACHE = {}; FOLDERS_CACHE = {};
@ -29,7 +31,7 @@ export function clear()
/** /**
* @param {string} email * @param {string} email
* @param {Function} callback * @param {Function} callback
* @return {string} * @returns {string}
*/ */
export function getUserPic(email, callback) export function getUserPic(email, callback)
{ {
@ -40,7 +42,7 @@ export function getUserPic(email, callback)
/** /**
* @param {string} folderFullNameRaw * @param {string} folderFullNameRaw
* @param {string} uid * @param {string} uid
* @return {string} * @returns {string}
*/ */
export function getMessageKey(folderFullNameRaw, uid) export function getMessageKey(folderFullNameRaw, uid)
{ {
@ -59,7 +61,7 @@ export function addRequestedMessage(folder, uid)
/** /**
* @param {string} folder * @param {string} folder
* @param {string} uid * @param {string} uid
* @return {boolean} * @returns {boolean}
*/ */
export function hasRequestedMessage(folder, uid) export function hasRequestedMessage(folder, uid)
{ {
@ -89,13 +91,16 @@ export function hasNewMessageAndRemoveFromCache(folderFullNameRaw, uid)
return false; return false;
} }
/**
* @returns {void}
*/
export function clearNewMessageCache() export function clearNewMessageCache()
{ {
NEW_MESSAGE_CACHE = {}; NEW_MESSAGE_CACHE = {};
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function getFolderInboxName() export function getFolderInboxName()
{ {
@ -104,7 +109,7 @@ export function getFolderInboxName()
/** /**
* @param {string} folderHash * @param {string} folderHash
* @return {string} * @returns {string}
*/ */
export function getFolderFullNameRaw(folderHash) export function getFolderFullNameRaw(folderHash)
{ {
@ -126,7 +131,7 @@ export function setFolderFullNameRaw(folderHash, folderFullNameRaw)
/** /**
* @param {string} folderFullNameRaw * @param {string} folderFullNameRaw
* @return {string} * @returns {string}
*/ */
export function getFolderHash(folderFullNameRaw) export function getFolderHash(folderFullNameRaw)
{ {
@ -147,7 +152,7 @@ export function setFolderHash(folderFullNameRaw, folderHash)
/** /**
* @param {string} folderFullNameRaw * @param {string} folderFullNameRaw
* @return {string} * @returns {string}
*/ */
export function getFolderUidNext(folderFullNameRaw) export function getFolderUidNext(folderFullNameRaw)
{ {
@ -165,7 +170,7 @@ export function setFolderUidNext(folderFullNameRaw, uidNext)
/** /**
* @param {string} folderFullNameRaw * @param {string} folderFullNameRaw
* @return {?FolderModel} * @returns {?FolderModel}
*/ */
export function getFolderFromCacheList(folderFullNameRaw) export function getFolderFromCacheList(folderFullNameRaw)
{ {
@ -192,7 +197,7 @@ export function removeFolderFromCacheList(folderFullNameRaw)
/** /**
* @param {string} folderFullName * @param {string} folderFullName
* @param {string} uid * @param {string} uid
* @return {?Array} * @returns {?Array}
*/ */
export function getMessageFlagsFromCache(folderFullName, uid) export function getMessageFlagsFromCache(folderFullName, uid)
{ {
@ -233,14 +238,13 @@ export function initMessageFlagsFromCache(message)
{ {
const const
uid = message.uid, uid = message.uid,
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid) flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid);
;
if (flags && 0 < flags.length) if (flags && 0 < flags.length)
{ {
message.flagged(!!flags[1]); message.flagged(!!flags[1]);
if (!message.__simple_message__) if (!message.isSimpleMessage)
{ {
message.unseen(!!flags[0]); message.unseen(!!flags[0]);
message.answered(!!flags[2]); message.answered(!!flags[2]);
@ -334,6 +338,7 @@ export function storeMessageFlagsToCacheBySetAction(folder, uid, setAction)
case MessageSetAction.UnsetFlag: case MessageSetAction.UnsetFlag:
flags[1] = false; flags[1] = false;
break; break;
// no default
} }
setMessageFlagsToCache(folder, uid, flags); setMessageFlagsToCache(folder, uid, flags);

View file

@ -8,14 +8,13 @@ class CookieDriver
/** /**
* @param {string} key * @param {string} key
* @param {*} data * @param {*} data
* @return {boolean} * @returns {boolean}
*/ */
set(key, data) { set(key, data) {
let let
result = false, result = false,
storageResult = null storageResult = null;
;
try try
{ {
@ -41,7 +40,7 @@ class CookieDriver
/** /**
* @param {string} key * @param {string} key
* @return {*} * @returns {*}
*/ */
get(key) { get(key) {
@ -51,8 +50,7 @@ class CookieDriver
{ {
const const
storageValue = $.cookie(CLIENT_SIDE_STORAGE_INDEX_NAME), storageValue = $.cookie(CLIENT_SIDE_STORAGE_INDEX_NAME),
storageResult = null === storageValue ? null : JSON.parse(storageValue) storageResult = null === storageValue ? null : JSON.parse(storageValue);
;
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null; result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
} }
@ -62,7 +60,7 @@ class CookieDriver
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
static supported() { static supported() {
return !!(window.navigator && window.navigator.cookieEnabled); return !!(window.navigator && window.navigator.cookieEnabled);

View file

@ -8,14 +8,13 @@ class LocalStorageDriver
/** /**
* @param {string} key * @param {string} key
* @param {*} data * @param {*} data
* @return {boolean} * @returns {boolean}
*/ */
set(key, data) { set(key, data) {
let let
result = false, result = false,
storageResult = null storageResult = null;
;
try try
{ {
@ -38,7 +37,7 @@ class LocalStorageDriver
/** /**
* @param {string} key * @param {string} key
* @return {*} * @returns {*}
*/ */
get(key) { get(key) {
@ -48,8 +47,7 @@ class LocalStorageDriver
{ {
const const
storageValue = window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] || null, storageValue = window.localStorage[CLIENT_SIDE_STORAGE_INDEX_NAME] || null,
storageResult = null === storageValue ? null : JSON.parse(storageValue) storageResult = null === storageValue ? null : JSON.parse(storageValue);
;
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null; result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
} }
@ -59,7 +57,7 @@ class LocalStorageDriver
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
static supported() { static supported() {
return !!window.localStorage; return !!window.localStorage;

View file

@ -43,41 +43,37 @@ export const sUserAgent = 'navigator' in window && 'userAgent' in window.navigat
/** /**
* @type {boolean} * @type {boolean}
*/ */
export const bIE = sUserAgent.indexOf('msie') > -1; export const bIE = -1 < sUserAgent.indexOf('msie');
/** /**
* @type {boolean} * @type {boolean}
*/ */
export const bChrome = sUserAgent.indexOf('chrome') > -1; export const bChrome = -1 < sUserAgent.indexOf('chrome');
/** /**
* @type {boolean} * @type {boolean}
*/ */
export const bSafari = !bChrome && sUserAgent.indexOf('safari') > -1; export const bSafari = !bChrome && -1 < sUserAgent.indexOf('safari');
/** /**
* @type {boolean} * @type {boolean}
*/ */
export const bMobileDevice = export const bMobileDevice =
/android/i.test(sUserAgent) || (/android/i).test(sUserAgent) ||
/iphone/i.test(sUserAgent) || (/iphone/i).test(sUserAgent) ||
/ipod/i.test(sUserAgent) || (/ipod/i).test(sUserAgent) ||
/ipad/i.test(sUserAgent) || (/ipad/i).test(sUserAgent) ||
/blackberry/i.test(sUserAgent) (/blackberry/i).test(sUserAgent);
;
/** /**
* @type {boolean} * @type {boolean}
*/ */
export let bDisableNanoScroll = bMobileDevice; export const bDisableNanoScroll = bMobileDevice;
/** /**
* @type {boolean} * @type {boolean}
*/ */
export let bAnimationSupported = !bMobileDevice && export const bAnimationSupported = !bMobileDevice && $html.hasClass('csstransitions') && $html.hasClass('cssanimations');
$html.hasClass('csstransitions') &&
$html.hasClass('cssanimations')
;
/** /**
* @type {boolean} * @type {boolean}
@ -167,7 +163,7 @@ if (bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
if (!bAllowPdfPreview) if (!bAllowPdfPreview)
{ {
bAllowPdfPreview = (typeof window.navigator.mimeTypes['application/pdf'] !== 'undefined'); bAllowPdfPreview = 'undefined' !== typeof window.navigator.mimeTypes['application/pdf'];
} }
} }
@ -223,12 +219,11 @@ export const keyScope = ko.computed({
{ {
var var
oElement = event.target || event.srcElement, oElement = event.target || event.srcElement,
sTagName = oElement ? oElement.tagName : '' sTagName = oElement ? oElement.tagName : '';
;
sTagName = sTagName.toUpperCase(); sTagName = sTagName.toUpperCase();
return !(sTagName === 'INPUT' || sTagName === 'SELECT' || sTagName === 'TEXTAREA' || return !('INPUT' === sTagName || 'SELECT' === sTagName || 'TEXTAREA' === sTagName ||
(oElement && sTagName === 'DIV' && ('editorHtmlArea' === oElement.className || 'true' === '' + oElement.contentEditable)) (oElement && 'DIV' === sTagName && ('editorHtmlArea' === oElement.className || 'true' === '' + oElement.contentEditable))
); );
} }

View file

@ -6,6 +6,7 @@ import * as Settings from 'Storage/Settings';
class HtmlEditor class HtmlEditor
{ {
/** /**
* @constructor
* @param {Object} element * @param {Object} element
* @param {Function=} onBlur * @param {Function=} onBlur
* @param {Function=} onReady * @param {Function=} onReady
@ -47,7 +48,7 @@ class HtmlEditor
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
isHtml() { isHtml() {
return this.editor ? 'wysiwyg' === this.editor.mode : false; return this.editor ? 'wysiwyg' === this.editor.mode : false;
@ -70,7 +71,7 @@ class HtmlEditor
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
checkDirty() { checkDirty() {
return this.editor ? this.editor.checkDirty() : false; return this.editor ? this.editor.checkDirty() : false;
@ -85,7 +86,7 @@ class HtmlEditor
/** /**
* @param {string} text * @param {string} text
* @return {string} * @returns {string}
*/ */
clearSignatureSigns(text) { clearSignatureSigns(text) {
return text.replace(/(\u200C|\u0002)/g, ''); return text.replace(/(\u200C|\u0002)/g, '');
@ -94,7 +95,7 @@ class HtmlEditor
/** /**
* @param {boolean=} wrapIsHtml = false * @param {boolean=} wrapIsHtml = false
* @param {boolean=} clearSignatureSigns = false * @param {boolean=} clearSignatureSigns = false
* @return {string} * @returns {string}
*/ */
getData(wrapIsHtml = false, clearSignatureSigns = false) { getData(wrapIsHtml = false, clearSignatureSigns = false) {
@ -113,7 +114,8 @@ class HtmlEditor
'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' + '<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' +
this.editor.getData() + '</div>' : this.editor.getData(); this.editor.getData() + '</div>' : this.editor.getData();
} }
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
if (clearSignatureSigns) if (clearSignatureSigns)
{ {
@ -127,7 +129,7 @@ class HtmlEditor
/** /**
* @param {boolean=} wrapIsHtml = false * @param {boolean=} wrapIsHtml = false
* @param {boolean=} clearSignatureSigns = false * @param {boolean=} clearSignatureSigns = false
* @return {string} * @returns {string}
*/ */
getDataWithHtmlMark(wrapIsHtml = false, clearSignatureSigns = false) { getDataWithHtmlMark(wrapIsHtml = false, clearSignatureSigns = false) {
return (this.isHtml() ? ':HTML:' : '') + this.getData(wrapIsHtml, clearSignatureSigns); return (this.isHtml() ? ':HTML:' : '') + this.getData(wrapIsHtml, clearSignatureSigns);
@ -151,7 +153,8 @@ class HtmlEditor
this.editor.setMode('plain'); this.editor.setMode('plain');
} }
} }
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
if (resize) if (resize)
{ {
@ -180,7 +183,8 @@ class HtmlEditor
try { try {
this.editor.setData(html); this.editor.setData(html);
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
if (focus) if (focus)
{ {
@ -195,7 +199,8 @@ class HtmlEditor
try { try {
this.editor.setData( this.editor.setData(
this.editor.getData().replace(find, replaceHtml)); this.editor.getData().replace(find, replaceHtml));
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
} }
@ -211,7 +216,8 @@ class HtmlEditor
{ {
try { try {
this.editor.setData(plain); this.editor.setData(plain);
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
if (focus) if (focus)
@ -231,8 +237,7 @@ class HtmlEditor
config = oHtmlEditorDefaultConfig, config = oHtmlEditorDefaultConfig,
language = Settings.settingsGet('Language'), language = Settings.settingsGet('Language'),
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'), allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons') biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons');
;
if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited) if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited)
{ {
@ -295,8 +300,7 @@ class HtmlEditor
var var
id = event.data.dataTransfer.id, id = event.data.dataTransfer.id,
imageId = `[img=${id}]`, imageId = `[img=${id}]`,
reader = new window.FileReader() reader = new window.FileReader();
;
reader.onloadend = () => { reader.onloadend = () => {
if (reader.result) if (reader.result)
@ -333,8 +337,7 @@ class HtmlEditor
} }
}); });
} };
;
if (window.CKEDITOR) if (window.CKEDITOR)
{ {
@ -352,7 +355,8 @@ class HtmlEditor
{ {
try { try {
this.editor.focus(); this.editor.focus();
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
} }
@ -361,7 +365,8 @@ class HtmlEditor
{ {
try { try {
return !!this.editor.focusManager.hasFocus; return !!this.editor.focusManager.hasFocus;
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
return false; return false;
@ -372,7 +377,8 @@ class HtmlEditor
{ {
try { try {
this.editor.focusManager.blur(true); this.editor.focusManager.blur(true);
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
} }
@ -381,7 +387,8 @@ class HtmlEditor
{ {
try { try {
this.editor.resize(this.$element.width(), this.$element.innerHeight()); this.editor.resize(this.$element.width(), this.$element.innerHeight());
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
} }
@ -390,7 +397,8 @@ class HtmlEditor
{ {
try { try {
this.editor.setReadOnly(!!value); this.editor.setReadOnly(!!value);
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
} }

View file

@ -3,29 +3,33 @@ import {window} from 'common';
import {pString, pInt, isUnd, isNormal, trim, encodeURIComponent} from 'Common/Utils'; import {pString, pInt, isUnd, isNormal, trim, encodeURIComponent} from 'Common/Utils';
import * as Settings from 'Storage/Settings'; import * as Settings from 'Storage/Settings';
const ROOT = './'; const
const HASH_PREFIX = '#/'; ROOT = './',
const SERVER_PREFIX = './?'; HASH_PREFIX = '#/',
const SUB_QUERY_PREFIX = '&q[]='; SERVER_PREFIX = './?',
SUB_QUERY_PREFIX = '&q[]=',
const VERSION = Settings.appSettingsGet('version'); VERSION = Settings.appSettingsGet('version'),
const WEB_PREFIX = Settings.appSettingsGet('webPath') || ''; WEB_PREFIX = Settings.appSettingsGet('webPath') || '',
const VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/'; VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/',
const STATIC_PREFIX = VERSION_PREFIX + 'static/'; STATIC_PREFIX = VERSION_PREFIX + 'static/',
const ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse'); ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse'),
const ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin'; ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin';
let AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0'; let AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
/**
* @returns {void}
*/
export function populateAuthSuffix() export function populateAuthSuffix()
{ {
AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0'; AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function subQueryPrefix() export function subQueryPrefix()
{ {
@ -34,7 +38,7 @@ export function subQueryPrefix()
/** /**
* @param {string=} startupUrl * @param {string=} startupUrl
* @return {string} * @returns {string}
*/ */
export function root(startupUrl = '') export function root(startupUrl = '')
{ {
@ -42,7 +46,7 @@ export function root(startupUrl = '')
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function rootAdmin() export function rootAdmin()
{ {
@ -51,7 +55,7 @@ export function rootAdmin()
/** /**
* @param {boolean=} mobile = false * @param {boolean=} mobile = false
* @return {string} * @returns {string}
*/ */
export function rootUser(mobile = false) export function rootUser(mobile = false)
{ {
@ -62,7 +66,7 @@ export function rootUser(mobile = false)
* @param {string} type * @param {string} type
* @param {string} download * @param {string} download
* @param {string=} customSpecSuffix * @param {string=} customSpecSuffix
* @return {string} * @returns {string}
*/ */
export function attachmentRaw(type, download, customSpecSuffix) export function attachmentRaw(type, download, customSpecSuffix)
{ {
@ -73,7 +77,7 @@ export function attachmentRaw(type, download, customSpecSuffix)
/** /**
* @param {string} download * @param {string} download
* @param {string=} customSpecSuffix * @param {string=} customSpecSuffix
* @return {string} * @returns {string}
*/ */
export function attachmentDownload(download, customSpecSuffix) export function attachmentDownload(download, customSpecSuffix)
{ {
@ -83,7 +87,7 @@ export function attachmentDownload(download, customSpecSuffix)
/** /**
* @param {string} download * @param {string} download
* @param {string=} customSpecSuffix * @param {string=} customSpecSuffix
* @return {string} * @returns {string}
*/ */
export function attachmentPreview(download, customSpecSuffix) export function attachmentPreview(download, customSpecSuffix)
{ {
@ -93,7 +97,7 @@ export function attachmentPreview(download, customSpecSuffix)
/** /**
* @param {string} download * @param {string} download
* @param {string=} customSpecSuffix * @param {string=} customSpecSuffix
* @return {string} * @returns {string}
*/ */
export function attachmentThumbnailPreview(download, customSpecSuffix) export function attachmentThumbnailPreview(download, customSpecSuffix)
{ {
@ -103,7 +107,7 @@ export function attachmentThumbnailPreview(download, customSpecSuffix)
/** /**
* @param {string} download * @param {string} download
* @param {string=} customSpecSuffix * @param {string=} customSpecSuffix
* @return {string} * @returns {string}
*/ */
export function attachmentPreviewAsPlain(download, customSpecSuffix) export function attachmentPreviewAsPlain(download, customSpecSuffix)
{ {
@ -113,7 +117,7 @@ export function attachmentPreviewAsPlain(download, customSpecSuffix)
/** /**
* @param {string} download * @param {string} download
* @param {string=} customSpecSuffix * @param {string=} customSpecSuffix
* @return {string} * @returns {string}
*/ */
export function attachmentFramed(download, customSpecSuffix) export function attachmentFramed(download, customSpecSuffix)
{ {
@ -122,7 +126,7 @@ export function attachmentFramed(download, customSpecSuffix)
/** /**
* @param {string} type * @param {string} type
* @return {string} * @returns {string}
*/ */
export function serverRequest(type) export function serverRequest(type)
{ {
@ -130,7 +134,7 @@ export function serverRequest(type)
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function upload() export function upload()
{ {
@ -138,7 +142,7 @@ export function upload()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function uploadContacts() export function uploadContacts()
{ {
@ -146,7 +150,7 @@ export function uploadContacts()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function uploadBackground() export function uploadBackground()
{ {
@ -154,7 +158,7 @@ export function uploadBackground()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function append() export function append()
{ {
@ -163,7 +167,7 @@ export function append()
/** /**
* @param {string} email * @param {string} email
* @return {string} * @returns {string}
*/ */
export function change(email) export function change(email)
{ {
@ -172,7 +176,7 @@ export function change(email)
/** /**
* @param {string} add * @param {string} add
* @return {string} * @returns {string}
*/ */
export function ajax(add) export function ajax(add)
{ {
@ -181,7 +185,7 @@ export function ajax(add)
/** /**
* @param {string} requestHash * @param {string} requestHash
* @return {string} * @returns {string}
*/ */
export function messageViewLink(requestHash) export function messageViewLink(requestHash)
{ {
@ -190,7 +194,7 @@ export function messageViewLink(requestHash)
/** /**
* @param {string} requestHash * @param {string} requestHash
* @return {string} * @returns {string}
*/ */
export function messageDownloadLink(requestHash) export function messageDownloadLink(requestHash)
{ {
@ -199,7 +203,7 @@ export function messageDownloadLink(requestHash)
/** /**
* @param {string} email * @param {string} email
* @return {string} * @returns {string}
*/ */
export function avatarLink(email) export function avatarLink(email)
{ {
@ -208,7 +212,7 @@ export function avatarLink(email)
/** /**
* @param {string} hash * @param {string} hash
* @return {string} * @returns {string}
*/ */
export function publicLink(hash) export function publicLink(hash)
{ {
@ -217,7 +221,7 @@ export function publicLink(hash)
/** /**
* @param {string} hash * @param {string} hash
* @return {string} * @returns {string}
*/ */
export function userBackground(hash) export function userBackground(hash)
{ {
@ -225,7 +229,7 @@ export function userBackground(hash)
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function phpInfo() export function phpInfo()
{ {
@ -235,7 +239,7 @@ export function phpInfo()
/** /**
* @param {string} lang * @param {string} lang
* @param {boolean} isAdmin * @param {boolean} isAdmin
* @return {string} * @returns {string}
*/ */
export function langLink(lang, isAdmin) export function langLink(lang, isAdmin)
{ {
@ -243,7 +247,7 @@ export function langLink(lang, isAdmin)
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function exportContactsVcf() export function exportContactsVcf()
{ {
@ -251,7 +255,7 @@ export function exportContactsVcf()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function exportContactsCsv() export function exportContactsCsv()
{ {
@ -260,7 +264,7 @@ export function exportContactsCsv()
/** /**
* @param {boolean} xauth = false * @param {boolean} xauth = false
* @return {string} * @returns {string}
*/ */
export function socialGoogle(xauth = false) export function socialGoogle(xauth = false)
{ {
@ -269,7 +273,7 @@ export function socialGoogle(xauth = false)
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function socialTwitter() export function socialTwitter()
{ {
@ -278,7 +282,7 @@ export function socialTwitter()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function socialFacebook() export function socialFacebook()
{ {
@ -288,7 +292,7 @@ export function socialFacebook()
/** /**
* @param {string} path * @param {string} path
* @return {string} * @returns {string}
*/ */
export function staticPrefix(path) export function staticPrefix(path)
{ {
@ -296,7 +300,7 @@ export function staticPrefix(path)
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function emptyContactPic() export function emptyContactPic()
{ {
@ -305,7 +309,7 @@ export function emptyContactPic()
/** /**
* @param {string} fileName * @param {string} fileName
* @return {string} * @returns {string}
*/ */
export function sound(fileName) export function sound(fileName)
{ {
@ -313,7 +317,7 @@ export function sound(fileName)
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function notificationMailIcon() export function notificationMailIcon()
{ {
@ -321,7 +325,7 @@ export function notificationMailIcon()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function openPgpJs() export function openPgpJs()
{ {
@ -329,7 +333,7 @@ export function openPgpJs()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function openPgpWorkerJs() export function openPgpWorkerJs()
{ {
@ -337,7 +341,7 @@ export function openPgpWorkerJs()
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function openPgpWorkerPath() export function openPgpWorkerPath()
{ {
@ -346,7 +350,7 @@ export function openPgpWorkerPath()
/** /**
* @param {string} theme * @param {string} theme
* @return {string} * @returns {string}
*/ */
export function themePreviewLink(theme) export function themePreviewLink(theme)
{ {
@ -362,7 +366,7 @@ export function themePreviewLink(theme)
/** /**
* @param {string} inboxFolderName = 'INBOX' * @param {string} inboxFolderName = 'INBOX'
* @return {string} * @returns {string}
*/ */
export function inbox(inboxFolderName = 'INBOX') export function inbox(inboxFolderName = 'INBOX')
{ {
@ -371,7 +375,7 @@ export function inbox(inboxFolderName = 'INBOX')
/** /**
* @param {string=} screenName = '' * @param {string=} screenName = ''
* @return {string} * @returns {string}
*/ */
export function settings(screenName = '') export function settings(screenName = '')
{ {
@ -379,7 +383,7 @@ export function settings(screenName = '')
} }
/** /**
* @return {string} * @returns {string}
*/ */
export function about() export function about()
{ {
@ -388,12 +392,13 @@ export function about()
/** /**
* @param {string} screenName * @param {string} screenName
* @return {string} * @returns {string}
*/ */
export function admin(screenName) export function admin(screenName)
{ {
let result = HASH_PREFIX; let result = HASH_PREFIX;
switch (screenName) { switch (screenName)
{
case 'AdminDomains': case 'AdminDomains':
result += 'domains'; result += 'domains';
break; break;
@ -403,6 +408,7 @@ export function admin(screenName)
case 'AdminLicensing': case 'AdminLicensing':
result += 'licensing'; result += 'licensing';
break; break;
// no default
} }
return result; return result;
@ -413,7 +419,7 @@ export function admin(screenName)
* @param {number=} page = 1 * @param {number=} page = 1
* @param {string=} search = '' * @param {string=} search = ''
* @param {string=} threadUid = '' * @param {string=} threadUid = ''
* @return {string} * @returns {string}
*/ */
export function mailBox(folder, page = 1, search = '', threadUid = '') export function mailBox(folder, page = 1, search = '', threadUid = '')
{ {

View file

@ -13,12 +13,18 @@ const updateMomentNowUnix = _.debounce(() => {
_momentNow = moment().unix(); _momentNow = moment().unix();
}, 500, true); }, 500, true);
/**
* @returns {moment}
*/
export function momentNow() export function momentNow()
{ {
updateMomentNow(); updateMomentNow();
return _moment || moment(); return _moment || moment();
} }
/**
* @returns {number}
*/
export function momentNowUnix() export function momentNowUnix()
{ {
updateMomentNowUnix(); updateMomentNowUnix();
@ -27,7 +33,7 @@ export function momentNowUnix()
/** /**
* @param {number} date * @param {number} date
* @return {string} * @returns {string}
*/ */
export function searchSubtractFormatDateHelper(date) export function searchSubtractFormatDateHelper(date)
{ {
@ -36,7 +42,7 @@ export function searchSubtractFormatDateHelper(date)
/** /**
* @param {Object} m * @param {Object} m
* @return {string} * @returns {string}
*/ */
function formatCustomShortDate(m) function formatCustomShortDate(m)
{ {
@ -57,6 +63,7 @@ function formatCustomShortDate(m)
}); });
case now.year() === m.year(): case now.year() === m.year():
return m.format('D MMM.'); return m.format('D MMM.');
// no default
} }
} }
@ -66,15 +73,14 @@ function formatCustomShortDate(m)
/** /**
* @param {number} timeStampInUTC * @param {number} timeStampInUTC
* @param {string} formatStr * @param {string} formatStr
* @return {string} * @returns {string}
*/ */
export function format(timeStampInUTC, formatStr) export function format(timeStampInUTC, formatStr)
{ {
let let
m = null, m = null,
result = '' result = '';
;
const now = momentNowUnix(); const now = momentNowUnix();
@ -112,14 +118,14 @@ export function format(timeStampInUTC, formatStr)
/** /**
* @param {Object} element * @param {Object} element
* @returns {void}
*/ */
export function momentToNode(element) export function momentToNode(element)
{ {
var var
key = '', key = '',
time = 0, time = 0,
$el = $(element) $el = $(element);
;
time = $el.data('moment-time'); time = $el.data('moment-time');
if (time) if (time)
@ -138,6 +144,9 @@ export function momentToNode(element)
} }
} }
/**
* @returns {void}
*/
export function reload() export function reload()
{ {
_.defer(() => { _.defer(() => {

View file

@ -41,7 +41,7 @@ export function runHook(name, args = [])
/** /**
* @param {string} name * @param {string} name
* @return {?} * @returns {?}
*/ */
export function mainSettingsGet(name) export function mainSettingsGet(name)
{ {
@ -98,7 +98,7 @@ export function runSettingsViewModelHooks(admin)
/** /**
* @param {string} pluginSection * @param {string} pluginSection
* @param {string} name * @param {string} name
* @return {?} * @returns {?}
*/ */
export function settingsGet(pluginSection, name) export function settingsGet(pluginSection, name)
{ {

View file

@ -129,8 +129,7 @@ class Selector
aCache = [], aCache = [],
aCheckedCache = [], aCheckedCache = [],
mFocused = null, mFocused = null,
mSelected = null mSelected = null;
;
this.list.subscribe((items) => { this.list.subscribe((items) => {
@ -168,8 +167,7 @@ class Selector
mNextFocused = mFocused, mNextFocused = mFocused,
bChecked = false, bChecked = false,
bSelected = false, bSelected = false,
iLen = 0 iLen = 0;
;
this.selectedItemUseCallback = false; this.selectedItemUseCallback = false;
@ -195,7 +193,7 @@ class Selector
{ {
bChecked = true; bChecked = true;
oItem.checked(true); oItem.checked(true);
iLen--; iLen -= 1;
} }
if (!bChecked && null !== mSelected && mSelected === sUid) if (!bChecked && null !== mSelected && mSelected === sUid)
@ -350,8 +348,7 @@ class Selector
item.checked(!item.checked()); item.checked(!item.checked());
} }
} }
}) });
;
key('enter', keyScope, () => { key('enter', keyScope, () => {
if (this.focusedItem() && !this.focusedItem().selected()) if (this.focusedItem() && !this.focusedItem().selected())
@ -397,6 +394,7 @@ class Selector
case 'pagedown': case 'pagedown':
eventKey = EventKeyCode.PageDown; eventKey = EventKeyCode.PageDown;
break; break;
// no default
} }
if (0 < eventKey) if (0 < eventKey)
@ -410,7 +408,7 @@ class Selector
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
autoSelect() { autoSelect() {
return !!(this.oCallbacks.onAutoSelect || noopTrue)(); return !!(this.oCallbacks.onAutoSelect || noopTrue)();
@ -425,7 +423,7 @@ class Selector
/** /**
* @param {Object} oItem * @param {Object} oItem
* @return {string} * @returns {string}
*/ */
getItemUid(item) { getItemUid(item) {
@ -455,8 +453,7 @@ class Selector
oResult = null, oResult = null,
aList = this.list(), aList = this.list(),
iListLen = aList ? aList.length : 0, iListLen = aList ? aList.length : 0,
oFocused = this.focusedItem() oFocused = this.focusedItem();
;
if (0 < iListLen) if (0 < iListLen)
{ {
@ -482,7 +479,8 @@ class Selector
_.each(aList, (item) => { _.each(aList, (item) => {
if (!bStop) if (!bStop)
{ {
switch (iEventKeyCode) { switch (iEventKeyCode)
{
case EventKeyCode.Up: case EventKeyCode.Up:
if (oFocused === item) if (oFocused === item)
{ {
@ -505,6 +503,7 @@ class Selector
bNext = true; bNext = true;
} }
break; break;
// no default
} }
} }
}); });
@ -540,7 +539,7 @@ class Selector
} }
else if (EventKeyCode.PageUp === iEventKeyCode) else if (EventKeyCode.PageUp === iEventKeyCode)
{ {
for (iIndex = iListLen; iIndex >= 0; iIndex--) for (iIndex = iListLen; 0 <= iIndex; iIndex--)
{ {
if (oFocused === aList[iIndex]) if (oFocused === aList[iIndex])
{ {
@ -597,7 +596,7 @@ class Selector
} }
/** /**
* @return {boolean} * @returns {boolean}
*/ */
scrollToFocused() { scrollToFocused() {
@ -612,17 +611,16 @@ class Selector
$focused = $(this.sItemFocusedSelector, this.oContentScrollable), $focused = $(this.sItemFocusedSelector, this.oContentScrollable),
pos = $focused.position(), pos = $focused.position(),
visibleHeight = this.oContentVisible.height(), visibleHeight = this.oContentVisible.height(),
focusedHeight = $focused.outerHeight() focusedHeight = $focused.outerHeight();
;
if (list && list[0] && list[0].focused()) if (list && list[0] && list[0].focused())
{ {
this.oContentScrollable.scrollTop(0); this.oContentScrollable.scrollTop(0);
return true; return true;
} }
else if (pos && (pos.top < 0 || pos.top + focusedHeight > visibleHeight)) else if (pos && (0 > pos.top || pos.top + focusedHeight > visibleHeight))
{ {
this.oContentScrollable.scrollTop(pos.top < 0 ? this.oContentScrollable.scrollTop(0 > pos.top ?
this.oContentScrollable.scrollTop() + pos.top - offset : this.oContentScrollable.scrollTop() + pos.top - offset :
this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset
); );
@ -635,7 +633,7 @@ class Selector
/** /**
* @param {boolean=} fast = false * @param {boolean=} fast = false
* @return {boolean} * @returns {boolean}
*/ */
scrollToTop(fast = false) { scrollToTop(fast = false) {
@ -666,8 +664,7 @@ class Selector
list = [], list = [],
checked = false, checked = false,
listItem = null, listItem = null,
lineUid = '' lineUid = '';
;
const uid = this.getItemUid(item); const uid = this.getItemUid(item);
if (event && event.shiftKey) if (event && event.shiftKey)

View file

@ -88,14 +88,13 @@ export const trigger = ko.observable(false);
* @param {string} key * @param {string} key
* @param {Object=} valueList * @param {Object=} valueList
* @param {string=} defaulValue * @param {string=} defaulValue
* @return {string} * @returns {string}
*/ */
export function i18n(key, valueList, defaulValue) export function i18n(key, valueList, defaulValue)
{ {
let let
valueName = '', valueName = '',
result = I18N_DATA[key] result = I18N_DATA[key];
;
if (isUnd(result)) if (isUnd(result))
{ {
@ -120,8 +119,7 @@ const i18nToNode = (element) => {
const const
$el = $(element), $el = $(element),
key = $el.data('i18n') key = $el.data('i18n');
;
if (key) if (key)
{ {
@ -138,6 +136,7 @@ const i18nToNode = (element) => {
case '[title': case '[title':
$el.attr('title', i18n(key.substr(7))); $el.attr('title', i18n(key.substr(7)));
break; break;
// no default
} }
} }
else else
@ -187,6 +186,9 @@ const reloadData = () => {
window.rainloopI18N = null; window.rainloopI18N = null;
}; };
/**
* @returns {void}
*/
export function initNotificationLanguage() export function initNotificationLanguage()
{ {
I18N_NOTIFICATION_MAP.forEach((item) => { I18N_NOTIFICATION_MAP.forEach((item) => {
@ -227,7 +229,7 @@ export function initOnStartOrLangChange(callback, scope, langCallback = null)
* @param {number} code * @param {number} code
* @param {*=} message = '' * @param {*=} message = ''
* @param {*=} defCode = null * @param {*=} defCode = null
* @return {string} * @returns {string}
*/ */
export function getNotification(code, message = '', defCode = null) export function getNotification(code, message = '', defCode = null)
{ {
@ -246,7 +248,7 @@ export function getNotification(code, message = '', defCode = null)
/** /**
* @param {object} response * @param {object} response
* @param {number} defCode = Notification.UnknownNotification * @param {number} defCode = Notification.UnknownNotification
* @return {string} * @returns {string}
*/ */
export function getNotificationFromResponse(response, defCode = Notification.UnknownNotification) export function getNotificationFromResponse(response, defCode = Notification.UnknownNotification)
{ {
@ -256,7 +258,7 @@ export function getNotificationFromResponse(response, defCode = Notification.Unk
/** /**
* @param {*} code * @param {*} code
* @return {string} * @returns {string}
*/ */
export function getUploadErrorDescByCode(code) export function getUploadErrorDescByCode(code)
{ {
@ -314,9 +316,8 @@ export function reload(admin, language)
$html $html
.removeClass('rl-changing-language') .removeClass('rl-changing-language')
.removeClass('rl-rtl rl-ltr') .removeClass('rl-rtl rl-ltr')
.addClass(isRtl ? 'rl-rtl' : 'rl-ltr')
// .attr('dir', isRtl ? 'rtl' : 'ltr') // .attr('dir', isRtl ? 'rtl' : 'ltr')
; .addClass(isRtl ? 'rl-rtl' : 'rl-ltr');
resolve(); resolve();

View file

@ -32,12 +32,13 @@ export function silentTryCatch(callback)
{ {
try { try {
callback(); callback();
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
/** /**
* @param {*} value * @param {*} value
* @return {boolean} * @returns {boolean}
*/ */
export function isNormal(value) export function isNormal(value)
{ {
@ -47,7 +48,7 @@ export function isNormal(value)
/** /**
* @param {(string|number)} value * @param {(string|number)} value
* @param {boolean=} includeZero = true * @param {boolean=} includeZero = true
* @return {boolean} * @returns {boolean}
*/ */
export function isPosNumeric(value, includeZero = true) export function isPosNumeric(value, includeZero = true)
{ {
@ -58,7 +59,7 @@ export function isPosNumeric(value, includeZero = true)
/** /**
* @param {*} value * @param {*} value
* @param {number=} defaultValur = 0 * @param {number=} defaultValur = 0
* @return {number} * @returns {number}
*/ */
export function pInt(value, defaultValur = 0) export function pInt(value, defaultValur = 0)
{ {
@ -68,7 +69,7 @@ export function pInt(value, defaultValur = 0)
/** /**
* @param {*} value * @param {*} value
* @return {string} * @returns {string}
*/ */
export function pString(value) export function pString(value)
{ {
@ -77,7 +78,7 @@ export function pString(value)
/** /**
* @param {*} value * @param {*} value
* @return {boolean} * @returns {boolean}
*/ */
export function pBool(value) export function pBool(value)
{ {
@ -86,7 +87,7 @@ export function pBool(value)
/** /**
* @param {*} values * @param {*} values
* @return {boolean} * @returns {boolean}
*/ */
export function isNonEmptyArray(values) export function isNonEmptyArray(values)
{ {
@ -95,7 +96,7 @@ export function isNonEmptyArray(values)
/** /**
* @param {string} component * @param {string} component
* @return {string} * @returns {string}
*/ */
export function encodeURIComponent(component) export function encodeURIComponent(component)
{ {
@ -104,7 +105,7 @@ export function encodeURIComponent(component)
/** /**
* @param {string} component * @param {string} component
* @return {string} * @returns {string}
*/ */
export function decodeURIComponent(component) export function decodeURIComponent(component)
{ {
@ -113,20 +114,17 @@ export function decodeURIComponent(component)
/** /**
* @param {string} queryString * @param {string} queryString
* @return {Object} * @returns {Object}
*/ */
export function simpleQueryParser(queryString) export function simpleQueryParser(queryString)
{ {
let let index = 0, len = 0, temp = null;
params = {},
queries = [],
temp = [],
index = 0,
len = 0
;
queries = queryString.split('&'); const
for (index = 0, len = queries.length; index < len; index++) queries = queryString.split('&'),
params = {};
for (len = queries.length; index < len; index++)
{ {
temp = queries[index].split('='); temp = queries[index].split('=');
params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]); params[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
@ -137,14 +135,13 @@ export function simpleQueryParser(queryString)
/** /**
* @param {number=} len = 32 * @param {number=} len = 32
* @return {string} * @returns {string}
*/ */
export function fakeMd5(len = 32) export function fakeMd5(len = 32)
{ {
const const
line = '0123456789abcdefghijklmnopqrstuvwxyz', line = '0123456789abcdefghijklmnopqrstuvwxyz',
lineLen = line.length lineLen = line.length;
;
len = pInt(len); len = pInt(len);
@ -162,7 +159,7 @@ let encryptObject = null;
/** /**
* @param {constructor} JSEncryptClass * @param {constructor} JSEncryptClass
* @param {string} publicKey * @param {string} publicKey
* @return {JSEncrypt|boolean} * @returns {JSEncrypt|boolean}
*/ */
const rsaObject = (JSEncryptClass, publicKey) => { const rsaObject = (JSEncryptClass, publicKey) => {
@ -184,16 +181,14 @@ const rsaObject = (JSEncryptClass, publicKey) => {
/** /**
* @param {string} value * @param {string} value
* @param {string} publicKey * @param {string} publicKey
* @return {string} * @returns {string}
*/ */
const rsaEncode = (value, publicKey) => { const rsaEncode = (value, publicKey) => {
if (window.crypto && window.crypto.getRandomValues && publicKey) if (window.crypto && window.crypto.getRandomValues && publicKey)
{ {
let let resultValue = false;
resultValue = false, const encrypt = rsaObject(JSEncrypt, publicKey);
encrypt = rsaObject(JSEncrypt, publicKey)
;
if (encrypt) if (encrypt)
{ {
@ -214,7 +209,7 @@ export {rsaEncode};
/** /**
* @param {string} text * @param {string} text
* @return {string} * @returns {string}
*/ */
export function encodeHtml(text) export function encodeHtml(text)
{ {
@ -224,7 +219,7 @@ export function encodeHtml(text)
/** /**
* @param {string} text * @param {string} text
* @param {number=} iLen = 100 * @param {number=} iLen = 100
* @return {string} * @returns {string}
*/ */
export function splitPlainText(text, len = 100) export function splitPlainText(text, len = 100)
{ {
@ -233,8 +228,7 @@ export function splitPlainText(text, len = 100)
subText = '', subText = '',
result = text, result = text,
spacePos = 0, spacePos = 0,
newLinePos = 0 newLinePos = 0;
;
while (result.length > len) while (result.length > len)
{ {
@ -260,7 +254,7 @@ export function splitPlainText(text, len = 100)
} }
const timeOutAction = (function() { const timeOutAction = (function() {
let timeOuts = {}; const timeOuts = {};
return (action, fFunction, timeOut) => { return (action, fFunction, timeOut) => {
timeOuts[action] = isUnd(timeOuts[action]) ? 0 : timeOuts[action]; timeOuts[action] = isUnd(timeOuts[action]) ? 0 : timeOuts[action];
window.clearTimeout(timeOuts[action]); window.clearTimeout(timeOuts[action]);
@ -269,7 +263,7 @@ const timeOutAction = (function () {
}()); }());
const timeOutActionSecond = (function() { const timeOutActionSecond = (function() {
let timeOuts = {}; const timeOuts = {};
return (action, fFunction, timeOut) => { return (action, fFunction, timeOut) => {
if (!timeOuts[action]) if (!timeOuts[action])
{ {
@ -284,7 +278,7 @@ const timeOutActionSecond = (function () {
export {timeOutAction, timeOutActionSecond}; export {timeOutAction, timeOutActionSecond};
/** /**
* @return {boolean} * @returns {boolean}
*/ */
export function inFocus() export function inFocus()
{ {
@ -301,6 +295,10 @@ export function inFocus()
return false; return false;
} }
/**
* @param {boolean} force
* @returns {void}
*/
export function removeInFocus(force) export function removeInFocus(force)
{ {
if (window.document && window.document.activeElement && window.document.activeElement.blur) if (window.document && window.document.activeElement && window.document.activeElement.blur)
@ -315,10 +313,14 @@ export function removeInFocus(force)
{ {
window.document.activeElement.blur(); window.document.activeElement.blur();
} }
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
} }
/**
* @returns {void}
*/
export function removeSelection() export function removeSelection()
{ {
try { try {
@ -334,41 +336,42 @@ export function removeSelection()
{ {
window.document.selection.empty(); window.document.selection.empty();
} }
} catch (e) {/* eslint-disable-line no-empty */} }
catch (e) {/* eslint-disable-line no-empty */}
} }
/** /**
* @param {string} prefix * @param {string} prefix
* @param {string} subject * @param {string} subject
* @return {string} * @returns {string}
*/ */
export function replySubjectAdd(prefix, subject) export function replySubjectAdd(prefix, subject)
{ {
prefix = trim(prefix.toUpperCase()); prefix = trim(prefix.toUpperCase());
subject = trim(subject.replace(/[\s]+/g, ' ')); subject = trim(subject.replace(/[\s]+/g, ' '));
let let drop = false,
drop = false,
parts = [],
re = 'RE' === prefix, re = 'RE' === prefix,
fwd = 'FWD' === prefix, fwd = 'FWD' === prefix;
prefixIsRe = !fwd
; const
parts = [],
prefixIsRe = !fwd;
if ('' !== subject) if ('' !== subject)
{ {
_.each(subject.split(':'), (part) => { _.each(subject.split(':'), (part) => {
const trimmedPart = trim(part); const trimmedPart = trim(part);
if (!drop && (/^(RE|FWD)$/i.test(trimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(trimmedPart))) if (!drop && ((/^(RE|FWD)$/i).test(trimmedPart) || (/^(RE|FWD)[\[\(][\d]+[\]\)]$/i).test(trimmedPart)))
{ {
if (!re) if (!re)
{ {
re = !!(/^RE/i.test(trimmedPart)); re = !!(/^RE/i).test(trimmedPart);
} }
if (!fwd) if (!fwd)
{ {
fwd = !!(/^FWD/i.test(trimmedPart)); fwd = !!(/^FWD/i).test(trimmedPart);
} }
} }
else else
@ -399,7 +402,7 @@ export function replySubjectAdd(prefix, subject)
/** /**
* @param {number} num * @param {number} num
* @param {number} dec * @param {number} dec
* @return {number} * @returns {number}
*/ */
export function roundNumber(num, dec) export function roundNumber(num, dec)
{ {
@ -408,23 +411,21 @@ export function roundNumber(num, dec)
/** /**
* @param {(number|string)} sizeInBytes * @param {(number|string)} sizeInBytes
* @return {string} * @returns {string}
*/ */
export function friendlySize(sizeInBytes) export function friendlySize(sizeInBytes)
{ {
sizeInBytes = pInt(sizeInBytes); sizeInBytes = pInt(sizeInBytes);
if (sizeInBytes >= 1073741824) switch (true)
{ {
case 1073741824 <= sizeInBytes:
return roundNumber(sizeInBytes / 1073741824, 1) + 'GB'; return roundNumber(sizeInBytes / 1073741824, 1) + 'GB';
} case 1048576 <= sizeInBytes:
else if (sizeInBytes >= 1048576)
{
return roundNumber(sizeInBytes / 1048576, 1) + 'MB'; return roundNumber(sizeInBytes / 1048576, 1) + 'MB';
} case 1024 <= sizeInBytes:
else if (sizeInBytes >= 1024)
{
return roundNumber(sizeInBytes / 1024, 0) + 'KB'; return roundNumber(sizeInBytes / 1024, 0) + 'KB';
// no default
} }
return sizeInBytes + 'B'; return sizeInBytes + 'B';
@ -506,21 +507,19 @@ export function kill_CtrlA_CtrlS(event)
* @param {(Object|null|undefined)} context * @param {(Object|null|undefined)} context
* @param {Function} fExecute * @param {Function} fExecute
* @param {(Function|boolean|null)=} fCanExecute = true * @param {(Function|boolean|null)=} fCanExecute = true
* @return {Function} * @returns {Function}
*/ */
export function createCommand(context, fExecute, fCanExecute = true) export function createCommand(context, fExecute, fCanExecute = true)
{ {
let let fResult = null;
fResult = null, const fNonEmpty = (...args) => {
fNonEmpty = (...args) => {
if (fResult && fResult.canExecute && fResult.canExecute()) if (fResult && fResult.canExecute && fResult.canExecute())
{ {
fExecute.apply(context, args); fExecute.apply(context, args);
} }
return false; return false;
} };
;
fResult = fExecute ? fNonEmpty : noop; fResult = fExecute ? fNonEmpty : noop;
fResult.enabled = ko.observable(true); fResult.enabled = ko.observable(true);
@ -543,7 +542,7 @@ export function createCommand(context, fExecute, fCanExecute = true)
/** /**
* @param {string} theme * @param {string} theme
* @return {string} * @returns {string}
*/ */
export const convertThemeName = _.memoize((theme) => { export const convertThemeName = _.memoize((theme) => {
@ -557,7 +556,7 @@ export const convertThemeName = _.memoize((theme) => {
/** /**
* @param {string} name * @param {string} name
* @return {string} * @returns {string}
*/ */
export function quoteName(name) export function quoteName(name)
{ {
@ -565,7 +564,7 @@ export function quoteName(name)
} }
/** /**
* @return {number} * @returns {number}
*/ */
export function microtime() export function microtime()
{ {
@ -573,7 +572,7 @@ export function microtime()
} }
/** /**
* @return {number} * @returns {number}
*/ */
export function timestamp() export function timestamp()
{ {
@ -584,7 +583,7 @@ export function timestamp()
* *
* @param {string} language * @param {string} language
* @param {boolean=} isEng = false * @param {boolean=} isEng = false
* @return {string} * @returns {string}
*/ */
export function convertLangName(language, isEng = false) export function convertLangName(language, isEng = false)
{ {
@ -592,6 +591,9 @@ export function convertLangName(language, isEng = false)
language.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, language); language.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, language);
} }
/**
* @returns {object}
*/
export function draggablePlace() export function draggablePlace()
{ {
return $('<div class="draggablePlace">' + return $('<div class="draggablePlace">' +
@ -602,14 +604,18 @@ export function draggablePlace()
).appendTo('#rl-hidden'); ).appendTo('#rl-hidden');
} }
export function defautOptionsAfterRender(domOption, item) /**
* @param {object} domOption
* @param {object} item
* @returns {void}
*/
export function defautOptionsAfterRender(domItem, item)
{ {
if (item && !isUnd(item.disabled) && domOption) if (item && !isUnd(item.disabled) && domItem)
{ {
$(domOption) $(domItem)
.toggleClass('disabled', item.disabled) .toggleClass('disabled', item.disabled)
.prop('disabled', item.disabled) .prop('disabled', item.disabled);
;
} }
} }
@ -638,8 +644,7 @@ export function previewMessage(title, body, isHtml, print)
win = window.open(''), win = window.open(''),
doc = win.document, doc = win.document,
bodyClone = body.clone(), bodyClone = body.clone(),
bodyClass = isHtml ? 'html' : 'plain' bodyClass = isHtml ? 'html' : 'plain';
;
clearBqSwitcher(bodyClone); clearBqSwitcher(bodyClone);
@ -734,7 +739,7 @@ body.plain blockquote blockquote blockquote {
* @param {?} koTrigger * @param {?} koTrigger
* @param {?} context = null * @param {?} context = null
* @param {number=} timer = 1000 * @param {number=} timer = 1000
* @return {Function} * @returns {Function}
*/ */
export function settingsSaveHelperFunction(fCallback, koTrigger, context = null, timer = 1000) export function settingsSaveHelperFunction(fCallback, koTrigger, context = null, timer = 1000)
{ {
@ -751,11 +756,23 @@ export function settingsSaveHelperFunction(fCallback, koTrigger, context = null,
}; };
} }
/**
* @param {object} koTrigger
* @param {mixed} context
* @returns {mixed}
*/
export function settingsSaveHelperSimpleFunction(koTrigger, context) export function settingsSaveHelperSimpleFunction(koTrigger, context)
{ {
return settingsSaveHelperFunction(null, koTrigger, context, 1000); return settingsSaveHelperFunction(null, koTrigger, context, 1000);
} }
/**
* @param {object} remote
* @param {string} settingName
* @param {string} type
* @param {function} fTriggerFunction
* @returns {function}
*/
export function settingsSaveHelperSubscribeFunction(remote, settingName, type, fTriggerFunction) export function settingsSaveHelperSubscribeFunction(remote, settingName, type, fTriggerFunction)
{ {
return (value) => { return (value) => {
@ -764,9 +781,6 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
{ {
switch (type) switch (type)
{ {
default:
value = pString(value);
break;
case 'bool': case 'bool':
case 'boolean': case 'boolean':
value = value ? '1' : '0'; value = value ? '1' : '0';
@ -779,9 +793,12 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
case 'trim': case 'trim':
value = trim(value); value = trim(value);
break; break;
default:
value = pString(value);
break;
} }
let data = {}; const data = {};
data[settingName] = value; data[settingName] = value;
if (remote.saveAdminConfig) if (remote.saveAdminConfig)
@ -798,7 +815,7 @@ export function settingsSaveHelperSubscribeFunction(remote, settingName, type, f
/** /**
* @param {string} html * @param {string} html
* @return {string} * @returns {string}
*/ */
export function findEmailAndLinks(html) export function findEmailAndLinks(html)
{ {
@ -817,7 +834,7 @@ export function findEmailAndLinks(html)
/** /**
* @param {string} html * @param {string} html
* @return {string} * @returns {string}
*/ */
export function htmlToPlain(html) export function htmlToPlain(html)
{ {
@ -828,8 +845,7 @@ export function htmlToPlain(html)
iP2 = 0, iP2 = 0,
iP3 = 0, iP3 = 0,
text = '' text = '';
;
const const
@ -867,8 +883,7 @@ export function htmlToPlain(html)
convertLinks = (...args) => { convertLinks = (...args) => {
return (args && 1 < args.length) ? trim(args[1]) : ''; return (args && 1 < args.length) ? trim(args[1]) : '';
} };
;
text = html text = html
.replace(/\u0002([\s\S]*)\u0002/gm, '\u200C$1\u200C') .replace(/\u0002([\s\S]*)\u0002/gm, '\u200C$1\u200C')
@ -893,8 +908,7 @@ export function htmlToPlain(html)
.replace(/<\/div>/gi, '\n') .replace(/<\/div>/gi, '\n')
.replace(/&nbsp;/gi, ' ') .replace(/&nbsp;/gi, ' ')
.replace(/&quot;/gi, '"') .replace(/&quot;/gi, '"')
.replace(/<[^>]*>/gm, '') .replace(/<[^>]*>/gm, '');
;
text = $div.html(text).text(); text = $div.html(text).text();
@ -903,8 +917,7 @@ export function htmlToPlain(html)
.replace(/[\n]{3,}/gm, '\n\n') .replace(/[\n]{3,}/gm, '\n\n')
.replace(/&gt;/gi, '>') .replace(/&gt;/gi, '>')
.replace(/&lt;/gi, '<') .replace(/&lt;/gi, '<')
.replace(/&amp;/gi, '&') .replace(/&amp;/gi, '&');
;
text = splitPlainText(trim(text)); text = splitPlainText(trim(text));
@ -913,7 +926,7 @@ export function htmlToPlain(html)
while (0 < limit) while (0 < limit)
{ {
limit--; limit -= 1;
iP1 = text.indexOf('__bq__start__', pos); iP1 = text.indexOf('__bq__start__', pos);
if (-1 < iP1) if (-1 < iP1)
{ {
@ -945,8 +958,7 @@ export function htmlToPlain(html)
text = text text = text
.replace(/__bq__start__/gm, '') .replace(/__bq__start__/gm, '')
.replace(/__bq__end__/gm, '') .replace(/__bq__end__/gm, '');
;
return text; return text;
} }
@ -954,7 +966,7 @@ export function htmlToPlain(html)
/** /**
* @param {string} plain * @param {string} plain
* @param {boolean} findEmailAndLinksInText = false * @param {boolean} findEmailAndLinksInText = false
* @return {string} * @returns {string}
*/ */
export function plainToHtml(plain, findEmailAndLinksInText = false) export function plainToHtml(plain, findEmailAndLinksInText = false)
{ {
@ -971,8 +983,7 @@ export function plainToHtml(plain, findEmailAndLinksInText = false)
aNextText = [], aNextText = [],
sLine = '', sLine = '',
iIndex = 0, iIndex = 0,
aText = plain.split('\n') aText = plain.split('\n');
;
do do
{ {
@ -1031,8 +1042,7 @@ export function plainToHtml(plain, findEmailAndLinksInText = false)
.replace(/~~~blockquote~~~[\s]*/g, '<blockquote>') .replace(/~~~blockquote~~~[\s]*/g, '<blockquote>')
.replace(/[\s]*~~~\/blockquote~~~/g, '</blockquote>') .replace(/[\s]*~~~\/blockquote~~~/g, '</blockquote>')
.replace(/\u200C([\s\S]*)\u200C/g, '\u0002$1\u0002') .replace(/\u200C([\s\S]*)\u200C/g, '\u0002$1\u0002')
.replace(/\n/g, '<br />') .replace(/\n/g, '<br />');
;
return findEmailAndLinksInText ? findEmailAndLinks(plain) : plain; return findEmailAndLinksInText ? findEmailAndLinks(plain) : plain;
} }
@ -1051,7 +1061,7 @@ window.rainloop_Utils_plainToHtml = plainToHtml;
* @param {Function=} fRenameCallback * @param {Function=} fRenameCallback
* @param {boolean=} bSystem * @param {boolean=} bSystem
* @param {boolean=} bBuildUnvisible * @param {boolean=} bBuildUnvisible
* @return {Array} * @returns {Array}
*/ */
export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines, export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines,
iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible) iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
@ -1064,9 +1074,9 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
bSep = false, bSep = false,
iIndex = 0, iIndex = 0,
iLen = 0, iLen = 0,
sDeepPrefix = '\u00A0\u00A0\u00A0', aResult = [];
aResult = []
; const sDeepPrefix = '\u00A0\u00A0\u00A0';
bBuildUnvisible = isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible; bBuildUnvisible = isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible;
bSystem = !isNormal(bSystem) ? 0 < aSystem.length : bSystem; bSystem = !isNormal(bSystem) ? 0 < aSystem.length : bSystem;
@ -1171,6 +1181,10 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
return aResult; return aResult;
} }
/**
* @param {object} element
* @returns {void}
*/
export function selectElement(element) export function selectElement(element)
{ {
let sel, range; let sel, range;
@ -1215,26 +1229,26 @@ export function triggerAutocompleteInputChange(delay = false) {
} }
} }
let configurationScriptTagCache = {}; const configurationScriptTagCache = {};
/** /**
* @param {string} configuration * @param {string} configuration
* @return {object} * @returns {object}
*/ */
export function getConfigurationFromScriptTag(configuration) export function getConfigurationFromScriptTag(configuration)
{ {
let result = {};
if (!configurationScriptTagCache[configuration]) if (!configurationScriptTagCache[configuration])
{ {
configurationScriptTagCache[configuration] = $('script[type="application/json"][data-configuration="' + configuration + '"]'); configurationScriptTagCache[configuration] = $('script[type="application/json"][data-configuration="' + configuration + '"]');
} }
try { try
result = JSON.parse(configurationScriptTagCache[configuration].text()); {
} catch (e) {/* eslint-disable-line no-empty */} return JSON.parse(configurationScriptTagCache[configuration].text());
}
catch (e) {/* eslint-disable-line no-empty */}
return result; return {};
} }
/** /**
@ -1244,7 +1258,7 @@ export function getConfigurationFromScriptTag(configuration)
export function disposeOne(propOrValue, value) export function disposeOne(propOrValue, value)
{ {
const disposable = value || propOrValue; const disposable = value || propOrValue;
if (disposable && typeof disposable.dispose === 'function') if (disposable && 'function' === typeof disposable.dispose)
{ {
disposable.dispose(); disposable.dispose();
} }
@ -1268,6 +1282,7 @@ export function disposeObject(object)
/** /**
* @param {Object|Array} objectOrObjects * @param {Object|Array} objectOrObjects
* @returns {void}
*/ */
export function delegateRunOnDestroy(objectOrObjects) export function delegateRunOnDestroy(objectOrObjects)
{ {
@ -1286,6 +1301,11 @@ export function delegateRunOnDestroy(objectOrObjects)
} }
} }
/**
* @param {object} $styleTag
* @param {string} css
* @returns {boolean}
*/
export function appendStyles($styleTag, css) export function appendStyles($styleTag, css)
{ {
if ($styleTag && $styleTag[0]) if ($styleTag && $styleTag[0])
@ -1307,20 +1327,25 @@ export function appendStyles($styleTag, css)
let let
__themeTimer = 0, __themeTimer = 0,
__themeAjax = null __themeAjax = null;
;
/**
* @param {string} value
* @param {function} themeTrigger
* @returns {void}
*/
export function changeTheme(value, themeTrigger) export function changeTheme(value, themeTrigger)
{ {
let const
themeLink = $('#app-theme-link'), themeLink = $('#app-theme-link'),
themeStyle = $('#app-theme-style'),
url = themeLink.attr('href'),
clearTimer = () => { clearTimer = () => {
__themeTimer = window.setTimeout(() => themeTrigger(SaveSettingsStep.Idle), 1000); __themeTimer = window.setTimeout(() => themeTrigger(SaveSettingsStep.Idle), 1000);
__themeAjax = null; __themeAjax = null;
} };
;
let
themeStyle = $('#app-theme-style'),
url = themeLink.attr('href');
if (!url) if (!url)
{ {
@ -1375,6 +1400,9 @@ export function changeTheme(value, themeTrigger)
} }
} }
/**
* @returns {function}
*/
export function computedPagenatorHelper(koCurrentPage, koPageCount) export function computedPagenatorHelper(koCurrentPage, koPageCount)
{ {
return () => { return () => {
@ -1388,7 +1416,7 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
const data = { const data = {
current: index === currentPage, current: index === currentPage,
name: '' === customName ? index.toString() : customName.toString(), name: '' === customName ? index.toString() : customName.toString(),
custom: '' === customName ? false : true, custom: '' !== customName,
title: '' === customName ? '' : index.toString(), title: '' === customName ? '' : index.toString(),
value: index.toString() value: index.toString()
}; };
@ -1401,14 +1429,12 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
{ {
result.unshift(data); result.unshift(data);
} }
} };
;
let let
prev = 0, prev = 0,
next = 0, next = 0,
limit = 2 limit = 2;
;
if (1 < pageCount || (0 < pageCount && pageCount < currentPage)) if (1 < pageCount || (0 < pageCount && pageCount < currentPage))
{ {
@ -1438,13 +1464,13 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
if (0 < prev) if (0 < prev)
{ {
fAdd(prev, false); fAdd(prev, false);
limit--; limit -= 1;
} }
if (pageCount >= next) if (pageCount >= next)
{ {
fAdd(next, true); fAdd(next, true);
limit--; limit -= 1;
} }
else if (0 >= prev) else if (0 >= prev)
{ {
@ -1488,7 +1514,7 @@ export function computedPagenatorHelper(koCurrentPage, koPageCount)
/** /**
* @param {string} fileName * @param {string} fileName
* @return {string} * @returns {string}
*/ */
export function getFileExtension(fileName) export function getFileExtension(fileName)
{ {
@ -1500,14 +1526,13 @@ export function getFileExtension(fileName)
/** /**
* @param {string} fileName * @param {string} fileName
* @return {string} * @returns {string}
*/ */
export function mimeContentType(fileName) export function mimeContentType(fileName)
{ {
let let
ext = '', ext = '',
result = 'application/octet-stream' result = 'application/octet-stream';
;
fileName = trim(fileName).toLowerCase(); fileName = trim(fileName).toLowerCase();
@ -1536,13 +1561,11 @@ export function resizeAndCrop(url, value, fCallback)
img.onload = function() { img.onload = function() {
let let
diff = [0, 0] diff = [0, 0];
;
const const
canvas = window.document.createElement('canvas'), canvas = window.document.createElement('canvas'),
ctx = canvas.getContext('2d') ctx = canvas.getContext('2d');
;
canvas.width = value; canvas.width = value;
canvas.height = value; canvas.height = value;
@ -1569,7 +1592,7 @@ export function resizeAndCrop(url, value, fCallback)
/** /**
* @param {string} mailToUrl * @param {string} mailToUrl
* @param {Function} PopupComposeVoreModel * @param {Function} PopupComposeVoreModel
* @return {boolean} * @returns {boolean}
*/ */
export function mailToHelper(mailToUrl, PopupComposeVoreModel) export function mailToHelper(mailToUrl, PopupComposeVoreModel)
{ {
@ -1586,22 +1609,22 @@ export function mailToHelper(mailToUrl, PopupComposeVoreModel)
to = [], to = [],
cc = null, cc = null,
bcc = null, bcc = null,
params = {}, params = {};
EmailModel = require('Model/Email'),
const
email = mailToUrl.replace(/\?.+$/, ''), email = mailToUrl.replace(/\?.+$/, ''),
queryString = mailToUrl.replace(/^[^\?]*\?/, ''), query = mailToUrl.replace(/^[^\?]*\?/, ''),
EmailModel = require('Model/Email'),
fParseEmailLine = (line) => { fParseEmailLine = (line) => {
return line ? _.compact(_.map(decodeURIComponent(line).split(/[,]/), (item) => { return line ? _.compact(_.map(decodeURIComponent(line).split(/[,]/), (item) => {
const emailObj = new EmailModel(); const emailObj = new EmailModel();
emailObj.mailsoParse(item); emailObj.mailsoParse(item);
return '' !== emailObj.email ? emailObj : null; return '' !== emailObj.email ? emailObj : null;
})) : null; })) : null;
} };
;
to = fParseEmailLine(email); to = fParseEmailLine(email);
params = simpleQueryParser(query);
params = simpleQueryParser(queryString);
if (!isUnd(params.cc)) if (!isUnd(params.cc))
{ {
@ -1638,16 +1661,19 @@ export const windowResize = _.debounce((timeout) => {
} }
}, 50); }, 50);
/**
* @returns {void}
*/
export function windowResizeCallback() export function windowResizeCallback()
{ {
windowResize(); windowResize();
} }
let substr = window.String.substr; let substr = window.String.substr;
if ('ab'.substr(-1) !== 'b') if ('b' !== 'ab'.substr(-1))
{ {
substr = (str, start, length) => { substr = (str, start, length) => {
start = start < 0 ? str.length + start : start; start = 0 > start ? str.length + start : start;
return str.substr(start, length); return str.substr(start, length);
}; };

View file

@ -6,6 +6,7 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstracCheckbox extends AbstractComponent class AbstracCheckbox extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params = {} * @param {Object} params = {}
*/ */
constructor(params = {}) { constructor(params = {}) {

View file

@ -7,6 +7,7 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstracRadio extends AbstractComponent class AbstracRadio extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -22,7 +22,7 @@ class AbstractComponent
/** /**
* @param {*} ClassObject * @param {*} ClassObject
* @param {string} templateID = '' * @param {string} templateID = ''
* @return {Object} * @returns {Object}
*/ */
const componentExportHelper = (ClassObject, templateID = '') => { const componentExportHelper = (ClassObject, templateID = '') => {
return { return {

View file

@ -7,6 +7,7 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstractInput extends AbstractComponent class AbstractInput extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {
@ -32,10 +33,9 @@ class AbstractInput extends AbstractComponent
var var
size = ko.unwrap(this.size), size = ko.unwrap(this.size),
suffixValue = this.trigger ? suffixValue = this.trigger ?
' ' + trim('settings-saved-trigger-input ' + this.classForTrigger()) : '' ' ' + trim('settings-saved-trigger-input ' + this.classForTrigger()) : '';
;
return (size > 0 ? 'span' + size : '') + suffixValue; return (0 < size ? 'span' + size : '') + suffixValue;
}, this); }, this);

View file

@ -7,6 +7,7 @@ import {AbstracCheckbox} from 'Component/AbstracCheckbox';
class CheckboxMaterialDesignComponent extends AbstracCheckbox class CheckboxMaterialDesignComponent extends AbstracCheckbox
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {
@ -38,7 +39,8 @@ class CheckboxMaterialDesignComponent extends AbstracCheckbox
if (box) { if (box) {
this.animationBoxSetTrue(); this.animationBoxSetTrue();
_.delay(this.animationCheckmarkSetTrue, 200); _.delay(this.animationCheckmarkSetTrue, 200);
} else { }
else {
this.animationCheckmarkSetTrue(); this.animationCheckmarkSetTrue();
_.delay(this.animationBoxSetTrue, 200); _.delay(this.animationBoxSetTrue, 200);
} }

View file

@ -6,6 +6,7 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class SaveTriggerComponent extends AbstractComponent class SaveTriggerComponent extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {
@ -47,30 +48,26 @@ class SaveTriggerComponent extends AbstractComponent
this.element this.element
.find('.animated,.error').hide().removeClass('visible') .find('.animated,.error').hide().removeClass('visible')
.end() .end()
.find('.success').show().addClass('visible') .find('.success').show().addClass('visible');
;
break; break;
case SaveSettingsStep.FalseResult: case SaveSettingsStep.FalseResult:
this.element this.element
.find('.animated,.success').hide().removeClass('visible') .find('.animated,.success').hide().removeClass('visible')
.end() .end()
.find('.error').show().addClass('visible') .find('.error').show().addClass('visible');
;
break; break;
case SaveSettingsStep.Animate: case SaveSettingsStep.Animate:
this.element this.element
.find('.error,.success').hide().removeClass('visible') .find('.error,.success').hide().removeClass('visible')
.end() .end()
.find('.animated').show().addClass('visible') .find('.animated').show().addClass('visible');
;
break; break;
default:
case SaveSettingsStep.Idle: case SaveSettingsStep.Idle:
default:
this.element this.element
.find('.animated').hide() .find('.animated').hide()
.end() .end()
.find('.error,.success').removeClass('visible') .find('.error,.success').removeClass('visible');
;
break; break;
} }
} }

View file

@ -5,6 +5,7 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class ScriptComponent extends AbstractComponent class ScriptComponent extends AbstractComponent
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {
@ -17,8 +18,7 @@ class ScriptComponent extends AbstractComponent
let script = params.element[0].outerHTML; let script = params.element[0].outerHTML;
script = !script ? '' : script script = !script ? '' : script
.replace(/<x-script/i, '<script') .replace(/<x-script/i, '<script')
.replace(/<b><\/b><\/x-script>/i, '</script>') .replace(/<b><\/b><\/x-script>/i, '</script>');
;
if (script) if (script)
{ {

View file

@ -7,6 +7,7 @@ import {AbstractInput} from 'Component/AbstractInput';
class SelectComponent extends AbstractInput class SelectComponent extends AbstractInput
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -1,9 +1,8 @@
import {$} from 'common'; import {$} from 'common';
let let cachedUrl = null;
cachedUrl = null, const getUrl = () => {
getUtl = () => {
if (!cachedUrl) if (!cachedUrl)
{ {
const version = $('#rlAppVersion').attr('content') || '0.0.0'; const version = $('#rlAppVersion').attr('content') || '0.0.0';
@ -11,18 +10,16 @@ let
} }
return cachedUrl; return cachedUrl;
} };
;
module.exports = { module.exports = {
template: '<b></b>', template: '<b></b>',
viewModel: { viewModel: {
createViewModel: (params, componentInfo) => { createViewModel: ({icon = 'null'}, componentInfo) => {
if (componentInfo && componentInfo.element) if (componentInfo && componentInfo.element)
{ {
const icon = params.icon || 'null';
$(componentInfo.element).replaceWith( $(componentInfo.element).replaceWith(
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUtl()}#svg-icon-${icon}"></use></svg>` `<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
); );
} }
} }

View file

@ -6,6 +6,7 @@ import {AbstractInput} from 'Component/AbstractInput';
class TextAreaComponent extends AbstractInput class TextAreaComponent extends AbstractInput
{ {
/** /**
* @constructor
* @param {Object} params * @param {Object} params
*/ */
constructor(params) { constructor(params) {

View file

@ -1,12 +1,7 @@
(function () {
'use strict';
var var
window = require('window'), window = require('window'),
Opentip = window.Opentip Opentip = window.Opentip;
;
Opentip.styles.rainloop = { Opentip.styles.rainloop = {
@ -47,5 +42,3 @@
}; };
module.exports = Opentip; module.exports = Opentip;
}());

123
dev/External/ko.js vendored
View file

@ -1,10 +1,7 @@
(function (ko) {
'use strict';
var var
window = require('window'), window = require('window'),
ko = window.ko,
_ = require('_'), _ = require('_'),
$ = require('$'), $ = require('$'),
JSON = require('JSON'), JSON = require('JSON'),
@ -18,8 +15,7 @@
oElement.__opentip.deactivate(); oElement.__opentip.deactivate();
} }
}); });
} };
;
ko.bindingHandlers.updateWidth = { ko.bindingHandlers.updateWidth = {
init: function(oElement, fValueAccessor) { init: function(oElement, fValueAccessor) {
@ -32,8 +28,7 @@
window.setTimeout(function() { window.setTimeout(function() {
fValue($oEl.width()); fValue($oEl.width());
}, 500); }, 500);
} };
;
$w.on('resize', fInit); $w.on('resize', fInit);
fInit(); fInit();
@ -70,8 +65,7 @@
fUpdateEditorValue(); fUpdateEditorValue();
}, },
HtmlEditor = require('Common/HtmlEditor') HtmlEditor = require('Common/HtmlEditor');
;
if (ko.isObservable(fValue) && HtmlEditor) if (ko.isObservable(fValue) && HtmlEditor)
{ {
@ -107,10 +101,8 @@
fFunc = _.throttle(function() { fFunc = _.throttle(function() {
$oEl $oEl
.toggleClass('scroller-shadow-top', iLimit < oCont.scrollTop) .toggleClass('scroller-shadow-top', iLimit < oCont.scrollTop)
.toggleClass('scroller-shadow-bottom', oCont.scrollTop + iLimit < oCont.scrollHeight - oCont.clientHeight) .toggleClass('scroller-shadow-bottom', oCont.scrollTop + iLimit < oCont.scrollHeight - oCont.clientHeight);
; }, 100);
}, 100)
;
if (oCont) if (oCont)
{ {
@ -149,8 +141,7 @@
$oEl = $(oElement), $oEl = $(oElement),
fValue = fValueAccessor(), fValue = fValueAccessor(),
bMobile = 'on' === ($oEl.data('tooltip-mobile') || 'off'), bMobile = 'on' === ($oEl.data('tooltip-mobile') || 'off'),
Globals = require('Common/Globals') Globals = require('Common/Globals');
;
if (!Globals.bMobileDevice || bMobile) if (!Globals.bMobileDevice || bMobile)
{ {
@ -211,8 +202,7 @@
$oEl = $(oElement), $oEl = $(oElement),
fValue = fValueAccessor(), fValue = fValueAccessor(),
bMobile = 'on' === ($oEl.data('tooltip-mobile') || 'off'), bMobile = 'on' === ($oEl.data('tooltip-mobile') || 'off'),
Globals = require('Common/Globals') Globals = require('Common/Globals');
;
if ((!Globals.bMobileDevice || bMobile) && oElement.__opentip) if ((!Globals.bMobileDevice || bMobile) && oElement.__opentip)
{ {
@ -264,8 +254,7 @@
$oEl = $(oElement), $oEl = $(oElement),
fValue = fValueAccessor(), fValue = fValueAccessor(),
sValue = !ko.isObservable(fValue) && _.isFunction(fValue) ? fValue() : ko.unwrap(fValue), sValue = !ko.isObservable(fValue) && _.isFunction(fValue) ? fValue() : ko.unwrap(fValue),
oOpenTips = oElement.__opentip oOpenTips = oElement.__opentip;
;
if (oOpenTips) if (oOpenTips)
{ {
@ -349,9 +338,9 @@
} }
}; };
ko.bindingHandlers.csstext = { ko.bindingHandlers.csstext = {};
init: function (oElement, fValueAccessor) { ko.bindingHandlers.csstext.init = ko.bindingHandlers.csstext.update = function(oElement, fValueAccessor) {
if (oElement && oElement.styleSheet && (typeof oElement.styleSheet.cssText !== 'undefined')) if (oElement && oElement.styleSheet && 'undefined' !== typeof oElement.styleSheet.cssText)
{ {
oElement.styleSheet.cssText = ko.unwrap(fValueAccessor()); oElement.styleSheet.cssText = ko.unwrap(fValueAccessor());
} }
@ -359,17 +348,6 @@
{ {
$(oElement).text(ko.unwrap(fValueAccessor())); $(oElement).text(ko.unwrap(fValueAccessor()));
} }
},
update: function (oElement, fValueAccessor) {
if (oElement && oElement.styleSheet && (typeof oElement.styleSheet.cssText !== 'undefined'))
{
oElement.styleSheet.cssText = ko.unwrap(fValueAccessor());
}
else
{
$(oElement).text(ko.unwrap(fValueAccessor()));
}
}
}; };
ko.bindingHandlers.resizecrop = { ko.bindingHandlers.resizecrop = {
@ -467,8 +445,7 @@
var var
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({ $(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
'keyboard': false, 'keyboard': false,
@ -483,8 +460,7 @@
$(oElement) $(oElement)
.off('shown.koModal') .off('shown.koModal')
.find('.close') .find('.close')
.off('click.koModal') .off('click.koModal');
;
}); });
}, },
update: function(oElement, fValueAccessor) { update: function(oElement, fValueAccessor) {
@ -568,8 +544,7 @@
$oElement = $(oElement), $oElement = $(oElement),
oOffset = null, oOffset = null,
iTop = aValues[1] || 0 iTop = aValues[1] || 0;
;
$oContainer = $(aValues[0] || null); $oContainer = $(aValues[0] || null);
$oContainer = $oContainer[0] ? $oContainer : null; $oContainer = $oContainer[0] ? $oContainer : null;
@ -603,8 +578,7 @@
aValues = ko.unwrap(fValueAccessor()), aValues = ko.unwrap(fValueAccessor()),
iValue = Utils.pInt(aValues[1]), iValue = Utils.pInt(aValues[1]),
iSize = 0, iSize = 0,
iOffset = $(oElement).offset().top iOffset = $(oElement).offset().top;
;
if (0 < iOffset) if (0 < iOffset)
{ {
@ -635,8 +609,7 @@
var var
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
{ {
@ -651,8 +624,7 @@
cursorAt: {top: 22, left: 3}, cursorAt: {top: 22, left: 3},
refreshPositions: true, refreshPositions: true,
scroll: true scroll: true
} };
;
if (sDroppableSelector) if (sDroppableSelector)
{ {
@ -664,8 +636,7 @@
moveDown = null, moveDown = null,
$this = $(this), $this = $(this),
oOffset = $this.offset(), oOffset = $this.offset(),
bottomPos = oOffset.top + $this.height() bottomPos = oOffset.top + $this.height();
;
window.clearInterval($this.data('timerScroll')); window.clearInterval($this.data('timerScroll'));
$this.data('timerScroll', false); $this.data('timerScroll', false);
@ -716,8 +687,7 @@
ko.utils.domNodeDisposal.addDisposeCallback(oElement, function() { ko.utils.domNodeDisposal.addDisposeCallback(oElement, function() {
$(oElement) $(oElement)
.off('mousedown.koDraggable') .off('mousedown.koDraggable')
.draggable('destroy') .draggable('destroy');
;
}); });
} }
} }
@ -736,8 +706,7 @@
oConf = { oConf = {
tolerance: 'pointer', tolerance: 'pointer',
hoverClass: 'droppableHover' hoverClass: 'droppableHover'
} };
;
if (fValueFunc) if (fValueFunc)
{ {
@ -774,8 +743,7 @@
var var
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
if (!Globals.bDisableNanoScroll && !Settings.appSettingsGet('useNativeScrollbars')) if (!Globals.bDisableNanoScroll && !Settings.appSettingsGet('useNativeScrollbars'))
{ {
@ -784,8 +752,7 @@
.nanoScroller({ .nanoScroller({
'iOSNativeScrolling': false, 'iOSNativeScrolling': false,
'preventPageScrolling': true 'preventPageScrolling': true
}) });
;
} }
} }
}; };
@ -811,8 +778,7 @@
update: function(oElement, fValueAccessor) { update: function(oElement, fValueAccessor) {
var var
mValue = ko.unwrap(fValueAccessor()), mValue = ko.unwrap(fValueAccessor()),
$oEl = $(oElement) $oEl = $(oElement);
;
if ('custom' === $oEl.data('save-trigger-type')) if ('custom' === $oEl.data('save-trigger-type'))
{ {
@ -822,29 +788,25 @@
$oEl $oEl
.find('.animated,.error').hide().removeClass('visible') .find('.animated,.error').hide().removeClass('visible')
.end() .end()
.find('.success').show().addClass('visible') .find('.success').show().addClass('visible');
;
break; break;
case '0': case '0':
$oEl $oEl
.find('.animated,.success').hide().removeClass('visible') .find('.animated,.success').hide().removeClass('visible')
.end() .end()
.find('.error').show().addClass('visible') .find('.error').show().addClass('visible');
;
break; break;
case '-2': case '-2':
$oEl $oEl
.find('.error,.success').hide().removeClass('visible') .find('.error,.success').hide().removeClass('visible')
.end() .end()
.find('.animated').show().addClass('visible') .find('.animated').show().addClass('visible');
;
break; break;
default: default:
$oEl $oEl
.find('.animated').hide() .find('.animated').hide()
.end() .end()
.find('.error,.success').removeClass('visible') .find('.error,.success').removeClass('visible');
;
break; break;
} }
} }
@ -885,8 +847,7 @@
{ {
fValue.focused(!!bValue); fValue.focused(!!bValue);
} }
} };
;
$oEl.inputosaurus({ $oEl.inputosaurus({
'parseOnBlur': true, 'parseOnBlur': true,
@ -907,8 +868,7 @@
var var
sValue = Utils.trim(sInputValue), sValue = Utils.trim(sInputValue),
oEmail = null oEmail = null;
;
if ('' !== sValue) if ('' !== sValue)
{ {
@ -986,8 +946,7 @@
var var
$oEl = $(oElement), $oEl = $(oElement),
fValue = fValueAccessor(), fValue = fValueAccessor(),
sValue = ko.unwrap(fValue) sValue = ko.unwrap(fValue);
;
if ($oEl.data('EmailsTagsValue') !== sValue) if ($oEl.data('EmailsTagsValue') !== sValue)
{ {
@ -1002,8 +961,7 @@
init: function(oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) { init: function(oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
var var
jqElement = $(oElement), jqElement = $(oElement),
oCommand = fValueAccessor() oCommand = fValueAccessor();
;
if (!oCommand || !oCommand.enabled || !oCommand.canExecute) if (!oCommand || !oCommand.enabled || !oCommand.canExecute)
{ {
@ -1020,8 +978,7 @@
var var
bResult = true, bResult = true,
jqElement = $(oElement), jqElement = $(oElement),
oCommand = fValueAccessor() oCommand = fValueAccessor();
;
bResult = oCommand.enabled(); bResult = oCommand.enabled();
jqElement.toggleClass('command-not-enabled', !bResult); jqElement.toggleClass('command-not-enabled', !bResult);
@ -1053,8 +1010,7 @@
oTarget(Utils.trim(sNewValue.toString())); oTarget(Utils.trim(sNewValue.toString()));
}, },
'owner': this 'owner': this
}) });
;
oResult(oTarget()); oResult(oTarget());
return oResult; return oResult;
@ -1080,8 +1036,7 @@
oTarget(iNew); oTarget(iNew);
} }
}) });
;
oResult(oTarget()); oResult(oTarget());
return oResult; return oResult;
@ -1097,8 +1052,7 @@
var var
sCurrentValue = ko.unwrap(oTarget), sCurrentValue = ko.unwrap(oTarget),
aList = ko.unwrap(mList) aList = ko.unwrap(mList);
;
if (Utils.isNonEmptyArray(aList)) if (Utils.isNonEmptyArray(aList))
{ {
@ -1122,8 +1076,7 @@
oTarget(''); oTarget('');
} }
} }
}).extend({'notify': 'always'}) }).extend({'notify': 'always'});
;
oResult(oTarget()); oResult(oTarget());
@ -1322,5 +1275,3 @@
}; };
module.exports = ko; module.exports = ko;
}(ko));

View file

@ -4,25 +4,25 @@ import EmailModel from 'Model/Email';
class MessageHelper class MessageHelper
{ {
/**
* @constructor
*/
constructor() {} constructor() {}
/** /**
* @param {Array.<EmailModel>} emails * @param {Array.<EmailModel>} emails
* @param {boolean=} friendlyView = false * @param {boolean=} friendlyView = false
* @param {boolean=} wrapWithLink = false * @param {boolean=} wrapWithLink = false
* @return {string} * @returns {string}
*/ */
emailArrayToString(emails, friendlyView = false, wrapWithLink = false) { emailArrayToString(emails, friendlyView = false, wrapWithLink = false) {
let let index = 0, len = 0;
result = [], const result = [];
index = 0,
len = 0
;
if (isNonEmptyArray(emails)) if (isNonEmptyArray(emails))
{ {
for (index = 0, len = emails.length; index < len; index++) for (len = emails.length; index < len; index++)
{ {
result.push(emails[index].toLine(friendlyView, wrapWithLink)); result.push(emails[index].toLine(friendlyView, wrapWithLink));
} }
@ -33,19 +33,16 @@ class MessageHelper
/** /**
* @param {Array.<EmailModel>} emails * @param {Array.<EmailModel>} emails
* @return {string} * @returns {string}
*/ */
emailArrayToStringClear(emails) { emailArrayToStringClear(emails) {
let let index = 0, len = 0;
result = [], const result = [];
index = 0,
len = 0
;
if (isNonEmptyArray(emails)) if (isNonEmptyArray(emails))
{ {
for (index = 0, len = emails.length; index < len; index++) for (len = emails.length; index < len; index++)
{ {
if (emails[index] && emails[index].email && '' !== emails[index].name) if (emails[index] && emails[index].email && '' !== emails[index].name)
{ {
@ -59,16 +56,12 @@ class MessageHelper
/** /**
* @param {?Array} json * @param {?Array} json
* @return {Array.<EmailModel>} * @returns {Array.<EmailModel>}
*/ */
emailArrayFromJson(json) { emailArrayFromJson(json) {
let let index = 0, len = 0, email = null;
index = 0, const result = [];
len = 0,
email = null,
result = []
;
if (isNonEmptyArray(json)) if (isNonEmptyArray(json))
{ {

View file

@ -1,13 +1,8 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
/** /**
* @constructor * @constructor
@ -44,5 +39,3 @@
}; };
module.exports = AbstractModel; module.exports = AbstractModel;
}());

View file

@ -1,14 +1,9 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
crossroads = require('crossroads'), crossroads = require('crossroads'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
/** /**
* @param {string} sScreenName * @param {string} sScreenName
@ -37,7 +32,7 @@
AbstractScreen.prototype.aViewModels = []; AbstractScreen.prototype.aViewModels = [];
/** /**
* @return {Array} * @returns {Array}
*/ */
AbstractScreen.prototype.viewModels = function() AbstractScreen.prototype.viewModels = function()
{ {
@ -45,7 +40,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AbstractScreen.prototype.screenName = function() AbstractScreen.prototype.screenName = function()
{ {
@ -58,7 +53,7 @@
}; };
/** /**
* @return {?Object} * @returns {?Object}
*/ */
AbstractScreen.prototype.__cross = function() AbstractScreen.prototype.__cross = function()
{ {
@ -70,8 +65,7 @@
var var
aRoutes = this.routes(), aRoutes = this.routes(),
oRoute = null, oRoute = null,
fMatcher = null fMatcher = null;
;
if (Utils.isNonEmptyArray(aRoutes)) if (Utils.isNonEmptyArray(aRoutes))
{ {
@ -87,5 +81,3 @@
}; };
module.exports = AbstractScreen; module.exports = AbstractScreen;
}());

View file

@ -1,15 +1,10 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Globals = require('Common/Globals') Globals = require('Common/Globals');
;
/** /**
* @constructor * @constructor
@ -74,7 +69,7 @@
AbstractView.prototype.viewModelDom = null; AbstractView.prototype.viewModelDom = null;
/** /**
* @return {string} * @returns {string}
*/ */
AbstractView.prototype.viewModelTemplate = function() AbstractView.prototype.viewModelTemplate = function()
{ {
@ -82,7 +77,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AbstractView.prototype.viewModelPosition = function() AbstractView.prototype.viewModelPosition = function()
{ {
@ -126,5 +121,3 @@
}; };
module.exports = AbstractView; module.exports = AbstractView;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
$ = require('$'), $ = require('$'),
@ -12,8 +8,7 @@
Globals = require('Common/Globals'), Globals = require('Common/Globals'),
Plugins = require('Common/Plugins'), Plugins = require('Common/Plugins'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
/** /**
* @constructor * @constructor
@ -114,7 +109,7 @@
/** /**
* @param {string} sScreenName * @param {string} sScreenName
* @return {?Object} * @returns {?Object}
*/ */
Knoin.prototype.screen = function(sScreenName) Knoin.prototype.screen = function(sScreenName)
{ {
@ -130,12 +125,10 @@
if (ViewModelClass && !ViewModelClass.__builded) if (ViewModelClass && !ViewModelClass.__builded)
{ {
var var
kn = this,
oViewModel = new ViewModelClass(oScreen), oViewModel = new ViewModelClass(oScreen),
sPosition = oViewModel.viewModelPosition(), sPosition = oViewModel.viewModelPosition(),
oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()), oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
oViewModelDom = null oViewModelDom = null;
;
ViewModelClass.__builded = true; ViewModelClass.__builded = true;
ViewModelClass.__vm = oViewModel; ViewModelClass.__vm = oViewModel;
@ -156,9 +149,9 @@
if ('Popups' === sPosition) if ('Popups' === sPosition)
{ {
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () { oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, _.bind(function() {
kn.hideScreenPopup(ViewModelClass); this.hideScreenPopup(ViewModelClass);
}); }, this));
oViewModel.modalVisibility.subscribe(function(bValue) { oViewModel.modalVisibility.subscribe(function(bValue) {
@ -210,8 +203,12 @@
}); });
ko.applyBindingAccessorsToNode(oViewModelDom[0], { ko.applyBindingAccessorsToNode(oViewModelDom[0], {
'translatorInit': true, translatorInit: true,
'template': function () { return {'name': oViewModel.viewModelTemplate()};} template: function() {
return {
name: oViewModel.viewModelTemplate()
};
}
}, oViewModel); }, oViewModel);
Utils.delegateRun(oViewModel, 'onBuild', [oViewModelDom]); Utils.delegateRun(oViewModel, 'onBuild', [oViewModelDom]);
@ -271,7 +268,7 @@
/** /**
* @param {Function} ViewModelClassToShow * @param {Function} ViewModelClassToShow
* @return {boolean} * @returns {boolean}
*/ */
Knoin.prototype.isPopupVisible = function(ViewModelClassToShow) Knoin.prototype.isPopupVisible = function(ViewModelClassToShow)
{ {
@ -288,8 +285,7 @@
self = this, self = this,
oScreen = null, oScreen = null,
bSameScreen = false, bSameScreen = false,
oCross = null oCross = null;
;
if ('' === Utils.pString(sScreenName)) if ('' === Utils.pString(sScreenName))
{ {
@ -422,18 +418,13 @@
*/ */
Knoin.prototype.startScreens = function(aScreensClasses) Knoin.prototype.startScreens = function(aScreensClasses)
{ {
// $('#rl-content').css({
// 'visibility': 'hidden'
// });
_.each(aScreensClasses, function(CScreen) { _.each(aScreensClasses, function(CScreen) {
if (CScreen) if (CScreen)
{ {
var var
oScreen = new CScreen(), oScreen = new CScreen(),
sScreenName = oScreen ? oScreen.screenName() : '' sScreenName = oScreen ? oScreen.screenName() : '';
;
if (oScreen && '' !== sScreenName) if (oScreen && '' !== sScreenName)
{ {
@ -468,10 +459,6 @@
hasher.changed.add(oCross.parse, oCross); hasher.changed.add(oCross.parse, oCross);
hasher.init(); hasher.init();
// $('#rl-content').css({
// 'visibility': 'visible'
// });
_.delay(function() { _.delay(function() {
Globals.$html.removeClass('rl-started-trigger').addClass('rl-started'); Globals.$html.removeClass('rl-started-trigger').addClass('rl-started');
}, 100); }, 100);
@ -508,5 +495,3 @@
}; };
module.exports = new Knoin(); module.exports = new Knoin();
}());

View file

@ -1,16 +1,11 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -40,7 +35,7 @@
AccountModel.prototype.email = ''; AccountModel.prototype.email = '';
/** /**
* @return {string} * @returns {string}
*/ */
AccountModel.prototype.changeAccountLink = function() AccountModel.prototype.changeAccountLink = function()
{ {
@ -48,5 +43,3 @@
}; };
module.exports = AccountModel; module.exports = AccountModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
window = require('window'), window = require('window'),
_ = require('_'), _ = require('_'),
@ -14,8 +10,7 @@
Links = require('Common/Links'), Links = require('Common/Links'),
Audio = require('Common/Audio'), Audio = require('Common/Audio'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -50,7 +45,7 @@
/** /**
* @static * @static
* @param {AjaxJsonAttachment} oJsonAttachment * @param {AjaxJsonAttachment} oJsonAttachment
* @return {?AttachmentModel} * @returns {?AttachmentModel}
*/ */
AttachmentModel.newInstanceFromJson = function(oJsonAttachment) AttachmentModel.newInstanceFromJson = function(oJsonAttachment)
{ {
@ -112,7 +107,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isImage = function() AttachmentModel.prototype.isImage = function()
{ {
@ -120,7 +115,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isMp3 = function() AttachmentModel.prototype.isMp3 = function()
{ {
@ -129,7 +124,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isOgg = function() AttachmentModel.prototype.isOgg = function()
{ {
@ -138,7 +133,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isWav = function() AttachmentModel.prototype.isWav = function()
{ {
@ -147,7 +142,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.hasThumbnail = function() AttachmentModel.prototype.hasThumbnail = function()
{ {
@ -155,7 +150,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isText = function() AttachmentModel.prototype.isText = function()
{ {
@ -163,12 +158,11 @@
Enums.FileType.Eml === this.fileType || Enums.FileType.Eml === this.fileType ||
Enums.FileType.Certificate === this.fileType || Enums.FileType.Certificate === this.fileType ||
Enums.FileType.Html === this.fileType || Enums.FileType.Html === this.fileType ||
Enums.FileType.Code === this.fileType Enums.FileType.Code === this.fileType;
;
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isPdf = function() AttachmentModel.prototype.isPdf = function()
{ {
@ -176,7 +170,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.isFramed = function() AttachmentModel.prototype.isFramed = function()
{ {
@ -185,7 +179,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.hasPreview = function() AttachmentModel.prototype.hasPreview = function()
{ {
@ -194,18 +188,17 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.hasPreplay = function() AttachmentModel.prototype.hasPreplay = function()
{ {
return (Audio.supportedMp3 && this.isMp3()) || return (Audio.supportedMp3 && this.isMp3()) ||
(Audio.supportedOgg && this.isOgg()) || (Audio.supportedOgg && this.isOgg()) ||
(Audio.supportedWav && this.isWav()) (Audio.supportedWav && this.isWav());
;
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkDownload = function() AttachmentModel.prototype.linkDownload = function()
{ {
@ -213,7 +206,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkPreview = function() AttachmentModel.prototype.linkPreview = function()
{ {
@ -221,7 +214,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkThumbnail = function() AttachmentModel.prototype.linkThumbnail = function()
{ {
@ -229,7 +222,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkThumbnailPreviewStyle = function() AttachmentModel.prototype.linkThumbnailPreviewStyle = function()
{ {
@ -238,7 +231,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkFramed = function() AttachmentModel.prototype.linkFramed = function()
{ {
@ -246,7 +239,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkPreviewAsPlain = function() AttachmentModel.prototype.linkPreviewAsPlain = function()
{ {
@ -254,7 +247,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.linkPreviewMain = function() AttachmentModel.prototype.linkPreviewMain = function()
{ {
@ -271,13 +264,14 @@
case this.isFramed(): case this.isFramed():
sResult = this.linkFramed(); sResult = this.linkFramed();
break; break;
// no default
} }
return sResult; return sResult;
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.generateTransferDownloadUrl = function() AttachmentModel.prototype.generateTransferDownloadUrl = function()
{ {
@ -293,7 +287,7 @@
/** /**
* @param {AttachmentModel} oAttachment * @param {AttachmentModel} oAttachment
* @param {*} oEvent * @param {*} oEvent
* @return {boolean} * @returns {boolean}
*/ */
AttachmentModel.prototype.eventDragStart = function(oAttachment, oEvent) AttachmentModel.prototype.eventDragStart = function(oAttachment, oEvent)
{ {
@ -309,7 +303,7 @@
/** /**
* @param {string} sExt * @param {string} sExt
* @param {string} sMimeType * @param {string} sMimeType
* @return {string} * @returns {string}
*/ */
AttachmentModel.staticFileType = _.memoize(function(sExt, sMimeType) AttachmentModel.staticFileType = _.memoize(function(sExt, sMimeType)
{ {
@ -318,8 +312,7 @@
var var
sResult = Enums.FileType.Unknown, sResult = Enums.FileType.Unknown,
aMimeTypeParts = sMimeType.split('/') aMimeTypeParts = sMimeType.split('/');
;
switch (true) switch (true)
{ {
@ -413,6 +406,7 @@
]): ]):
sResult = Enums.FileType.Presentation; sResult = Enums.FileType.Presentation;
break; break;
// no default
} }
return sResult; return sResult;
@ -420,14 +414,13 @@
/** /**
* @param {string} sFileType * @param {string} sFileType
* @return {string} * @returns {string}
*/ */
AttachmentModel.staticIconClass = _.memoize(function(sFileType) AttachmentModel.staticIconClass = _.memoize(function(sFileType)
{ {
var var
sText = '', sText = '',
sClass = 'icon-file' sClass = 'icon-file';
;
switch (sFileType) switch (sFileType)
{ {
@ -466,6 +459,7 @@
sText = 'pdf'; sText = 'pdf';
sClass = 'icon-none'; sClass = 'icon-none';
break; break;
// no default
} }
return [sClass, sText]; return [sClass, sText];
@ -473,14 +467,13 @@
/** /**
* @param {string} sFileType * @param {string} sFileType
* @return {string} * @returns {string}
*/ */
AttachmentModel.staticCombinedIconClass = function(aData) AttachmentModel.staticCombinedIconClass = function(aData)
{ {
var var
sClass = '', sClass = '',
aTypes = [] aTypes = [];
;
if (Utils.isNonEmptyArray(aData)) if (Utils.isNonEmptyArray(aData))
{ {
@ -525,6 +518,7 @@
case Enums.FileType.Presentation: case Enums.FileType.Presentation:
sClass = 'icon-file-chart-graph'; sClass = 'icon-file-chart-graph';
break; break;
// no default
} }
} }
} }
@ -533,7 +527,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.iconClass = function() AttachmentModel.prototype.iconClass = function()
{ {
@ -541,7 +535,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
AttachmentModel.prototype.iconText = function() AttachmentModel.prototype.iconText = function()
{ {
@ -549,5 +543,3 @@
}; };
module.exports = AttachmentModel; module.exports = AttachmentModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -11,8 +7,7 @@
AttachmentModel = require('Model/Attachment'), AttachmentModel = require('Model/Attachment'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -89,7 +84,7 @@
/** /**
* @param {AjaxJsonComposeAttachment} oJsonAttachment * @param {AjaxJsonComposeAttachment} oJsonAttachment
* @return {boolean} * @returns {boolean}
*/ */
ComposeAttachmentModel.prototype.initByUploadJson = function(oJsonAttachment) ComposeAttachmentModel.prototype.initByUploadJson = function(oJsonAttachment)
{ {
@ -108,7 +103,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
ComposeAttachmentModel.prototype.iconClass = function() ComposeAttachmentModel.prototype.iconClass = function()
{ {
@ -117,7 +112,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
ComposeAttachmentModel.prototype.iconText = function() ComposeAttachmentModel.prototype.iconText = function()
{ {
@ -126,5 +121,3 @@
}; };
module.exports = ComposeAttachmentModel; module.exports = ComposeAttachmentModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -11,8 +7,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Links = require('Common/Links'), Links = require('Common/Links'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -35,14 +30,13 @@
_.extend(ContactModel.prototype, AbstractModel.prototype); _.extend(ContactModel.prototype, AbstractModel.prototype);
/** /**
* @return {Array|null} * @returns {Array|null}
*/ */
ContactModel.prototype.getNameAndEmailHelper = function() ContactModel.prototype.getNameAndEmailHelper = function()
{ {
var var
sName = '', sName = '',
sEmail = '' sEmail = '';
;
if (Utils.isNonEmptyArray(this.properties)) if (Utils.isNonEmptyArray(this.properties))
{ {
@ -94,7 +88,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
ContactModel.prototype.srcAttr = function() ContactModel.prototype.srcAttr = function()
{ {
@ -102,7 +96,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
ContactModel.prototype.generateUid = function() ContactModel.prototype.generateUid = function()
{ {
@ -136,5 +130,3 @@
}; };
module.exports = ContactModel; module.exports = ContactModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -11,8 +7,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'), Translator = require('Common/Translator'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -48,5 +43,3 @@
_.extend(ContactPropertyModel.prototype, AbstractModel.prototype); _.extend(ContactPropertyModel.prototype, AbstractModel.prototype);
module.exports = ContactPropertyModel; module.exports = ContactPropertyModel;
}());

View file

@ -1,19 +1,12 @@
(function () { var Utils = require('Common/Utils');
'use strict';
var
Utils = require('Common/Utils')
;
/** /**
* @constructor
* @param {string=} sEmail * @param {string=} sEmail
* @param {string=} sName * @param {string=} sName
* @param {string=} sDkimStatus * @param {string=} sDkimStatus
* @param {string=} sDkimValue * @param {string=} sDkimValue
*
* @constructor
*/ */
function EmailModel(sEmail, sName, sDkimStatus, sDkimValue) function EmailModel(sEmail, sName, sDkimStatus, sDkimValue)
{ {
@ -28,7 +21,7 @@
/** /**
* @static * @static
* @param {AjaxJsonEmail} oJsonEmail * @param {AjaxJsonEmail} oJsonEmail
* @return {?EmailModel} * @returns {?EmailModel}
*/ */
EmailModel.newInstanceFromJson = function(oJsonEmail) EmailModel.newInstanceFromJson = function(oJsonEmail)
{ {
@ -40,7 +33,7 @@
* @static * @static
* @param {string} sLine * @param {string} sLine
* @param {string=} sDelimiter = ';' * @param {string=} sDelimiter = ';'
* @return {Array} * @returns {Array}
*/ */
EmailModel.splitHelper = function(sLine, sDelimiter) EmailModel.splitHelper = function(sLine, sDelimiter)
{ {
@ -53,8 +46,7 @@
iLen = sLine.length, iLen = sLine.length,
bAt = false, bAt = false,
sChar = '', sChar = '',
sResult = '' sResult = '';
;
for (; iIndex < iLen; iIndex++) for (; iIndex < iLen; iIndex++)
{ {
@ -71,6 +63,7 @@
sResult += sDelimiter; sResult += sDelimiter;
} }
break; break;
// no default
} }
sResult += sChar; sResult += sChar;
@ -109,7 +102,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
EmailModel.prototype.validate = function() EmailModel.prototype.validate = function()
{ {
@ -118,7 +111,7 @@
/** /**
* @param {boolean} bWithoutName = false * @param {boolean} bWithoutName = false
* @return {string} * @returns {string}
*/ */
EmailModel.prototype.hash = function(bWithoutName) EmailModel.prototype.hash = function(bWithoutName)
{ {
@ -135,7 +128,7 @@
/** /**
* @param {string} sQuery * @param {string} sQuery
* @return {boolean} * @returns {boolean}
*/ */
EmailModel.prototype.search = function(sQuery) EmailModel.prototype.search = function(sQuery)
{ {
@ -153,8 +146,7 @@
var var
mRegex = /(?:"([^"]+)")? ?[<]?(.*?@[^>,]+)>?,? ?/g, mRegex = /(?:"([^"]+)")? ?[<]?(.*?@[^>,]+)>?,? ?/g,
mMatch = mRegex.exec(sString) mMatch = mRegex.exec(sString);
;
if (mMatch) if (mMatch)
{ {
@ -172,7 +164,7 @@
/** /**
* @param {AjaxJsonEmail} oJsonEmail * @param {AjaxJsonEmail} oJsonEmail
* @return {boolean} * @returns {boolean}
*/ */
EmailModel.prototype.initByJson = function(oJsonEmail) EmailModel.prototype.initByJson = function(oJsonEmail)
{ {
@ -195,7 +187,7 @@
* @param {boolean} bFriendlyView * @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false * @param {boolean=} bWrapWithLink = false
* @param {boolean=} bEncodeHtml = false * @param {boolean=} bEncodeHtml = false
* @return {string} * @returns {string}
*/ */
EmailModel.prototype.toLine = function(bFriendlyView, bWrapWithLink, bEncodeHtml) EmailModel.prototype.toLine = function(bFriendlyView, bWrapWithLink, bEncodeHtml)
{ {
@ -246,7 +238,7 @@
/** /**
* @param {string} $sEmailAddress * @param {string} $sEmailAddress
* @return {boolean} * @returns {boolean}
*/ */
EmailModel.prototype.mailsoParse = function($sEmailAddress) EmailModel.prototype.mailsoParse = function($sEmailAddress)
{ {
@ -261,21 +253,21 @@
str += ''; str += '';
var end = str.length; var end = str.length;
if (start < 0) { if (0 > start) {
start += end; start += end;
} }
end = typeof len === 'undefined' ? end : (len < 0 ? len + end : len + start); end = 'undefined' === typeof len ? end : (0 > len ? len + end : len + start);
return start >= str.length || start < 0 || start > end ? false : str.slice(start, end); return start >= str.length || 0 > start || start > end ? false : str.slice(start, end);
}, },
substr_replace = function (str, replace, start, length) { substrReplace = function(str, replace, start, length) {
if (start < 0) { if (0 > start) {
start += str.length; start += str.length;
} }
length = typeof length !== 'undefined' ? length : str.length; length = 'undefined' === typeof length ? length : str.length;
if (length < 0) { if (0 > length) {
length = length + str.length - start; length = length + str.length - start;
} }
return str.slice(0, start) + replace.substr(0, length) + replace.slice(length) + str.slice(start + length); return str.slice(0, start) + replace.substr(0, length) + replace.slice(length) + str.slice(start + length);
@ -293,8 +285,7 @@
$iStartIndex = 0, $iStartIndex = 0,
$iEndIndex = 0, $iEndIndex = 0,
$iCurrentIndex = 0 $iCurrentIndex = 0;
;
while ($iCurrentIndex < $sEmailAddress.length) while ($iCurrentIndex < $sEmailAddress.length)
{ {
@ -310,7 +301,7 @@
{ {
$iEndIndex = $iCurrentIndex; $iEndIndex = $iCurrentIndex;
$sName = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1); $sName = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
$sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1); $sEmailAddress = substrReplace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
$iEndIndex = 0; $iEndIndex = 0;
$iCurrentIndex = 0; $iCurrentIndex = 0;
$iStartIndex = 0; $iStartIndex = 0;
@ -320,7 +311,7 @@
case '<': case '<':
if ((!$bInName) && (!$bInAddress) && (!$bInComment)) if ((!$bInName) && (!$bInAddress) && (!$bInComment))
{ {
if ($iCurrentIndex > 0 && $sName.length === 0) if (0 < $iCurrentIndex && 0 === $sName.length)
{ {
$sName = substr($sEmailAddress, 0, $iCurrentIndex); $sName = substr($sEmailAddress, 0, $iCurrentIndex);
} }
@ -334,7 +325,7 @@
{ {
$iEndIndex = $iCurrentIndex; $iEndIndex = $iCurrentIndex;
$sEmail = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1); $sEmail = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
$sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1); $sEmailAddress = substrReplace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
$iEndIndex = 0; $iEndIndex = 0;
$iCurrentIndex = 0; $iCurrentIndex = 0;
$iStartIndex = 0; $iStartIndex = 0;
@ -353,7 +344,7 @@
{ {
$iEndIndex = $iCurrentIndex; $iEndIndex = $iCurrentIndex;
$sComment = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1); $sComment = substr($sEmailAddress, $iStartIndex + 1, $iEndIndex - $iStartIndex - 1);
$sEmailAddress = substr_replace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1); $sEmailAddress = substrReplace($sEmailAddress, '', $iStartIndex, $iEndIndex - $iStartIndex + 1);
$iEndIndex = 0; $iEndIndex = 0;
$iCurrentIndex = 0; $iCurrentIndex = 0;
$iStartIndex = 0; $iStartIndex = 0;
@ -361,14 +352,15 @@
} }
break; break;
case '\\': case '\\':
$iCurrentIndex++; $iCurrentIndex += 1;
break; break;
// no default
} }
$iCurrentIndex++; $iCurrentIndex += 1;
} }
if ($sEmail.length === 0) if (0 === $sEmail.length)
{ {
$aRegs = $sEmailAddress.match(/[^@\s]+@\S+/i); $aRegs = $sEmailAddress.match(/[^@\s]+@\S+/i);
if ($aRegs && $aRegs[0]) if ($aRegs && $aRegs[0])
@ -381,7 +373,7 @@
} }
} }
if ($sEmail.length > 0 && $sName.length === 0 && $sComment.length === 0) if (0 < $sEmail.length && 0 === $sName.length && 0 === $sComment.length)
{ {
$sName = $sEmailAddress.replace($sEmail, ''); $sName = $sEmailAddress.replace($sEmail, '');
} }
@ -402,5 +394,3 @@
}; };
module.exports = EmailModel; module.exports = EmailModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -15,8 +11,7 @@
FilterConditionModel = require('Model/FilterCondition'), FilterConditionModel = require('Model/FilterCondition'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -72,8 +67,7 @@
var var
sResult = '', sResult = '',
sActionValue = this.actionValue() sActionValue = this.actionValue();
;
switch (this.actionType()) switch (this.actionType())
{ {
@ -96,6 +90,7 @@
case Enums.FiltersAction.Discard: case Enums.FiltersAction.Discard:
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD'); sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
break; break;
// no default
} }
return sResult ? '(' + sResult + ')' : ''; return sResult ? '(' + sResult + ')' : '';
@ -107,10 +102,6 @@
var sTemplate = ''; var sTemplate = '';
switch (this.actionType()) switch (this.actionType())
{ {
default:
case Enums.FiltersAction.MoveTo:
sTemplate = 'SettingsFiltersActionMoveToFolder';
break;
case Enums.FiltersAction.Forward: case Enums.FiltersAction.Forward:
sTemplate = 'SettingsFiltersActionForward'; sTemplate = 'SettingsFiltersActionForward';
break; break;
@ -126,6 +117,10 @@
case Enums.FiltersAction.Discard: case Enums.FiltersAction.Discard:
sTemplate = 'SettingsFiltersActionDiscard'; sTemplate = 'SettingsFiltersActionDiscard';
break; break;
case Enums.FiltersAction.MoveTo:
default:
sTemplate = 'SettingsFiltersActionMoveToFolder';
break;
} }
return sTemplate; return sTemplate;
@ -321,5 +316,3 @@
}; };
module.exports = FilterModel; module.exports = FilterModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -10,8 +6,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -113,5 +108,3 @@
}; };
module.exports = FilterConditionModel; module.exports = FilterConditionModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -14,8 +10,7 @@
Cache = require('Common/Cache'), Cache = require('Common/Cache'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -61,7 +56,7 @@
/** /**
* @static * @static
* @param {AjaxJsonFolder} oJsonFolder * @param {AjaxJsonFolder} oJsonFolder
* @return {?FolderModel} * @returns {?FolderModel}
*/ */
FolderModel.newInstanceFromJson = function(oJsonFolder) FolderModel.newInstanceFromJson = function(oJsonFolder)
{ {
@ -70,7 +65,7 @@
}; };
/** /**
* @return {FolderModel} * @returns {FolderModel}
*/ */
FolderModel.prototype.initComputed = function() FolderModel.prototype.initComputed = function()
{ {
@ -94,8 +89,7 @@
var var
bSubScribed = this.subScribed(), bSubScribed = this.subScribed(),
bSubFolders = this.hasSubScribedSubfolders() bSubFolders = this.hasSubScribedSubfolders();
;
return (bSubScribed || (bSubFolders && (!this.existen || !this.selectable))); return (bSubScribed || (bSubFolders && (!this.existen || !this.selectable)));
@ -109,8 +103,7 @@
var var
bSystem = this.isSystemFolder(), bSystem = this.isSystemFolder(),
bSubFolders = this.hasSubScribedSubfolders() bSubFolders = this.hasSubScribedSubfolders();
;
return (bSystem && !bSubFolders) || (!this.selectable && !bSubFolders); return (bSystem && !bSubFolders) || (!this.selectable && !bSubFolders);
@ -154,8 +147,7 @@
var var
iCount = this.messageCountAll(), iCount = this.messageCountAll(),
iUnread = this.messageCountUnread(), iUnread = this.messageCountUnread(),
iType = this.type() iType = this.type();
;
if (0 < iCount) if (0 < iCount)
{ {
@ -175,8 +167,7 @@
this.canBeDeleted = ko.computed(function() { this.canBeDeleted = ko.computed(function() {
var var
bSystem = this.isSystemFolder() bSystem = this.isSystemFolder();
;
return !bSystem && 0 === this.subFolders().length && sInboxFolderName !== this.fullNameRaw; return !bSystem && 0 === this.subFolders().length && sInboxFolderName !== this.fullNameRaw;
}, this); }, this);
@ -198,8 +189,7 @@
var var
iType = this.type(), iType = this.type(),
sName = this.name() sName = this.name();
;
if (this.isSystemFolder()) if (this.isSystemFolder())
{ {
@ -223,6 +213,7 @@
case Enums.FolderType.Archive: case Enums.FolderType.Archive:
sName = Translator.i18n('FOLDER_LIST/ARCHIVE_NAME'); sName = Translator.i18n('FOLDER_LIST/ARCHIVE_NAME');
break; break;
// no default
} }
} }
@ -237,8 +228,7 @@
var var
sSuffix = '', sSuffix = '',
iType = this.type(), iType = this.type(),
sName = this.name() sName = this.name();
;
if (this.isSystemFolder()) if (this.isSystemFolder())
{ {
@ -262,6 +252,7 @@
case Enums.FolderType.Archive: case Enums.FolderType.Archive:
sSuffix = '(' + Translator.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')'; sSuffix = '(' + Translator.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')';
break; break;
// no default
} }
} }
@ -325,7 +316,7 @@
FolderModel.prototype.interval = 0; FolderModel.prototype.interval = 0;
/** /**
* @return {string} * @returns {string}
*/ */
FolderModel.prototype.collapsedCss = function() FolderModel.prototype.collapsedCss = function()
{ {
@ -335,14 +326,13 @@
/** /**
* @param {AjaxJsonFolder} oJsonFolder * @param {AjaxJsonFolder} oJsonFolder
* @return {boolean} * @returns {boolean}
*/ */
FolderModel.prototype.initByJson = function(oJsonFolder) FolderModel.prototype.initByJson = function(oJsonFolder)
{ {
var var
bResult = false, bResult = false,
sInboxFolderName = Cache.getFolderInboxName() sInboxFolderName = Cache.getFolderInboxName();
;
if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object']) if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object'])
{ {
@ -367,7 +357,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
FolderModel.prototype.printableFullName = function() FolderModel.prototype.printableFullName = function()
{ {
@ -375,5 +365,3 @@
}; };
module.exports = FolderModel; module.exports = FolderModel;
}());

View file

@ -1,19 +1,14 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor
* @param {string} sId * @param {string} sId
* @param {string} sEmail * @param {string} sEmail
* @constructor
*/ */
function IdentityModel(sId, sEmail) function IdentityModel(sId, sEmail)
{ {
@ -41,12 +36,9 @@
{ {
var var
sName = this.name(), sName = this.name(),
sEmail = this.email() sEmail = this.email();
;
return ('' !== sName) ? sName + ' (' + sEmail + ')' : sEmail; return ('' !== sName) ? sName + ' (' + sEmail + ')' : sEmail;
}; };
module.exports = IdentityModel; module.exports = IdentityModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
$ = require('$'), $ = require('$'),
@ -17,8 +13,7 @@
MessageHelper = require('Helper/Message').default, MessageHelper = require('Helper/Message').default,
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
@ -118,7 +113,7 @@
/** /**
* @static * @static
* @param {AjaxJsonMessage} oJsonMessage * @param {AjaxJsonMessage} oJsonMessage
* @return {?MessageModel} * @returns {?MessageModel}
*/ */
MessageModel.newInstanceFromJson = function(oJsonMessage) MessageModel.newInstanceFromJson = function(oJsonMessage)
{ {
@ -196,7 +191,7 @@
}; };
/** /**
* @return {Array} * @returns {Array}
*/ */
MessageModel.prototype.getRecipientsEmails = function() MessageModel.prototype.getRecipientsEmails = function()
{ {
@ -205,7 +200,7 @@
/** /**
* @param {Array} aProperties * @param {Array} aProperties
* @return {Array} * @returns {Array}
*/ */
MessageModel.prototype.getEmails = function(aProperties) MessageModel.prototype.getEmails = function(aProperties)
{ {
@ -218,7 +213,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.friendlySize = function() MessageModel.prototype.friendlySize = function()
{ {
@ -229,8 +224,7 @@
{ {
var var
sSent = require('Stores/User/Folder').sentFolder(), sSent = require('Stores/User/Folder').sentFolder(),
sDraft = require('Stores/User/Folder').draftFolder() sDraft = require('Stores/User/Folder').draftFolder();
;
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ? this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toEmailsString() : this.fromEmailString()); this.toEmailsString() : this.fromEmailString());
@ -241,14 +235,13 @@
/** /**
* @param {AjaxJsonMessage} oJsonMessage * @param {AjaxJsonMessage} oJsonMessage
* @return {boolean} * @returns {boolean}
*/ */
MessageModel.prototype.initByJson = function(oJsonMessage) MessageModel.prototype.initByJson = function(oJsonMessage)
{ {
var var
bResult = false, bResult = false,
iPriority = Enums.MessagePriority.Normal iPriority = Enums.MessagePriority.Normal;
;
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object']) if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
{ {
@ -307,14 +300,13 @@
/** /**
* @param {AjaxJsonMessage} oJsonMessage * @param {AjaxJsonMessage} oJsonMessage
* @return {boolean} * @returns {boolean}
*/ */
MessageModel.prototype.initUpdateByMessageJson = function(oJsonMessage) MessageModel.prototype.initUpdateByMessageJson = function(oJsonMessage)
{ {
var var
bResult = false, bResult = false,
iPriority = Enums.MessagePriority.Normal iPriority = Enums.MessagePriority.Normal;
;
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object']) if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
{ {
@ -355,7 +347,7 @@
/** /**
* @param {(AjaxJsonAttachment|null)} oJsonAttachments * @param {(AjaxJsonAttachment|null)} oJsonAttachments
* @return {Array} * @returns {Array}
*/ */
MessageModel.prototype.initAttachmentsFromJson = function(oJsonAttachments) MessageModel.prototype.initAttachmentsFromJson = function(oJsonAttachments)
{ {
@ -363,8 +355,7 @@
iIndex = 0, iIndex = 0,
iLen = 0, iLen = 0,
oAttachmentModel = null, oAttachmentModel = null,
aResult = [] aResult = [];
;
if (oJsonAttachments && 'Collection/AttachmentCollection' === oJsonAttachments['@Object'] && if (oJsonAttachments && 'Collection/AttachmentCollection' === oJsonAttachments['@Object'] &&
Utils.isNonEmptyArray(oJsonAttachments['@Collection'])) Utils.isNonEmptyArray(oJsonAttachments['@Collection']))
@ -390,7 +381,7 @@
/** /**
* @param {AjaxJsonMessage} oJsonMessage * @param {AjaxJsonMessage} oJsonMessage
* @return {boolean} * @returns {boolean}
*/ */
MessageModel.prototype.initFlagsByJson = function(oJsonMessage) MessageModel.prototype.initFlagsByJson = function(oJsonMessage)
{ {
@ -414,7 +405,7 @@
/** /**
* @param {boolean} bFriendlyView * @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false * @param {boolean=} bWrapWithLink = false
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.fromToLine = function(bFriendlyView, bWrapWithLink) MessageModel.prototype.fromToLine = function(bFriendlyView, bWrapWithLink)
{ {
@ -422,7 +413,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.fromDkimData = function() MessageModel.prototype.fromDkimData = function()
{ {
@ -439,7 +430,7 @@
/** /**
* @param {boolean} bFriendlyView * @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false * @param {boolean=} bWrapWithLink = false
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.toToLine = function(bFriendlyView, bWrapWithLink) MessageModel.prototype.toToLine = function(bFriendlyView, bWrapWithLink)
{ {
@ -449,7 +440,7 @@
/** /**
* @param {boolean} bFriendlyView * @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false * @param {boolean=} bWrapWithLink = false
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.ccToLine = function(bFriendlyView, bWrapWithLink) MessageModel.prototype.ccToLine = function(bFriendlyView, bWrapWithLink)
{ {
@ -459,7 +450,7 @@
/** /**
* @param {boolean} bFriendlyView * @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false * @param {boolean=} bWrapWithLink = false
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.bccToLine = function(bFriendlyView, bWrapWithLink) MessageModel.prototype.bccToLine = function(bFriendlyView, bWrapWithLink)
{ {
@ -469,7 +460,7 @@
/** /**
* @param {boolean} bFriendlyView * @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false * @param {boolean=} bWrapWithLink = false
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.replyToToLine = function(bFriendlyView, bWrapWithLink) MessageModel.prototype.replyToToLine = function(bFriendlyView, bWrapWithLink)
{ {
@ -551,7 +542,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
MessageModel.prototype.hasVisibleAttachments = function() MessageModel.prototype.hasVisibleAttachments = function()
{ {
@ -562,14 +553,13 @@
/** /**
* @param {string} sCid * @param {string} sCid
* @return {*} * @returns {*}
*/ */
MessageModel.prototype.findAttachmentByCid = function(sCid) MessageModel.prototype.findAttachmentByCid = function(sCid)
{ {
var var
oResult = null, oResult = null,
aAttachments = this.attachments() aAttachments = this.attachments();
;
if (Utils.isNonEmptyArray(aAttachments)) if (Utils.isNonEmptyArray(aAttachments))
{ {
@ -584,14 +574,13 @@
/** /**
* @param {string} sContentLocation * @param {string} sContentLocation
* @return {*} * @returns {*}
*/ */
MessageModel.prototype.findAttachmentByContentLocation = function(sContentLocation) MessageModel.prototype.findAttachmentByContentLocation = function(sContentLocation)
{ {
var var
oResult = null, oResult = null,
aAttachments = this.attachments() aAttachments = this.attachments();
;
if (Utils.isNonEmptyArray(aAttachments)) if (Utils.isNonEmptyArray(aAttachments))
{ {
@ -605,7 +594,7 @@
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.messageId = function() MessageModel.prototype.messageId = function()
{ {
@ -613,7 +602,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.inReplyTo = function() MessageModel.prototype.inReplyTo = function()
{ {
@ -621,7 +610,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.references = function() MessageModel.prototype.references = function()
{ {
@ -629,7 +618,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.fromAsSingleEmail = function() MessageModel.prototype.fromAsSingleEmail = function()
{ {
@ -637,7 +626,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.viewLink = function() MessageModel.prototype.viewLink = function()
{ {
@ -645,7 +634,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.downloadLink = function() MessageModel.prototype.downloadLink = function()
{ {
@ -655,14 +644,13 @@
/** /**
* @param {Object} oExcludeEmails * @param {Object} oExcludeEmails
* @param {boolean=} bLast = false * @param {boolean=} bLast = false
* @return {Array} * @returns {Array}
*/ */
MessageModel.prototype.replyEmails = function(oExcludeEmails, bLast) MessageModel.prototype.replyEmails = function(oExcludeEmails, bLast)
{ {
var var
aResult = [], aResult = [],
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails;
;
MessageHelper.replyHelper(this.replyTo, oUnic, aResult); MessageHelper.replyHelper(this.replyTo, oUnic, aResult);
if (0 === aResult.length) if (0 === aResult.length)
@ -681,7 +669,7 @@
/** /**
* @param {Object} oExcludeEmails * @param {Object} oExcludeEmails
* @param {boolean=} bLast = false * @param {boolean=} bLast = false
* @return {Array.<Array>} * @returns {Array.<Array>}
*/ */
MessageModel.prototype.replyAllEmails = function(oExcludeEmails, bLast) MessageModel.prototype.replyAllEmails = function(oExcludeEmails, bLast)
{ {
@ -689,8 +677,7 @@
aData = [], aData = [],
aToResult = [], aToResult = [],
aCcResult = [], aCcResult = [],
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails;
;
MessageHelper.replyHelper(this.replyTo, oUnic, aToResult); MessageHelper.replyHelper(this.replyTo, oUnic, aToResult);
if (0 === aToResult.length) if (0 === aToResult.length)
@ -711,7 +698,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.textBodyToString = function() MessageModel.prototype.textBodyToString = function()
{ {
@ -719,7 +706,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.attachmentsToStringLine = function() MessageModel.prototype.attachmentsToStringLine = function()
{ {
@ -731,7 +718,7 @@
}; };
/** /**
* @return {Object} * @returns {Object}
*/ */
MessageModel.prototype.getDataForWindowPopup = function() MessageModel.prototype.getDataForWindowPopup = function()
{ {
@ -764,7 +751,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.generateUid = function() MessageModel.prototype.generateUid = function()
{ {
@ -773,7 +760,7 @@
/** /**
* @param {MessageModel} oMessage * @param {MessageModel} oMessage
* @return {MessageModel} * @returns {MessageModel}
*/ */
MessageModel.prototype.populateByMessageListItem = function(oMessage) MessageModel.prototype.populateByMessageListItem = function(oMessage)
{ {
@ -870,8 +857,7 @@
$(this) $(this)
.addClass('lazy') .addClass('lazy')
.attr('data-original', $(this).attr(sAttr)) .attr('data-original', $(this).attr(sAttr))
.removeAttr(sAttr) .removeAttr(sAttr);
;
} }
else else
{ {
@ -958,8 +944,7 @@
var var
sStyle = '', sStyle = '',
sName = '', sName = '',
oAttachment = self.findAttachmentByCid($(this).attr('data-x-style-cid')) oAttachment = self.findAttachmentByCid($(this).attr('data-x-style-cid'));
;
if (oAttachment && oAttachment.linkPreview) if (oAttachment && oAttachment.linkPreview)
{ {
@ -1018,7 +1003,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
MessageModel.prototype.flagHash = function() MessageModel.prototype.flagHash = function()
{ {
@ -1027,5 +1012,3 @@
}; };
module.exports = MessageModel; module.exports = MessageModel;
}());

View file

@ -1,18 +1,11 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
// MessageHelper = require('Helper/Message').default, MessageSimpleModel = require('Model/MessageSimple');
MessageSimpleModel = require('Model/MessageSimple')
;
/** /**
* @constructor * @constructor
@ -45,7 +38,7 @@
/** /**
* @param {AjaxJsonMessage} oJson * @param {AjaxJsonMessage} oJson
* @return {boolean} * @returns {boolean}
*/ */
MessageFullModel.prototype.initByJson = function(oJson) MessageFullModel.prototype.initByJson = function(oJson)
{ {
@ -76,7 +69,7 @@
/** /**
* @static * @static
* @param {AjaxJsonMessage} oJson * @param {AjaxJsonMessage} oJson
* @return {?MessageFullModel} * @returns {?MessageFullModel}
*/ */
MessageFullModel.newInstanceFromJson = function(oJson) MessageFullModel.newInstanceFromJson = function(oJson)
{ {
@ -85,5 +78,3 @@
}; };
module.exports = MessageFullModel; module.exports = MessageFullModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -11,12 +7,11 @@
MessageHelper = require('Helper/Message').default, MessageHelper = require('Helper/Message').default,
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @param {string=} sSuperName
* @constructor * @constructor
* @param {string=} sSuperName
*/ */
function MessageSimpleModel(sSuperName) function MessageSimpleModel(sSuperName)
{ {
@ -28,7 +23,7 @@
_.extend(MessageSimpleModel.prototype, AbstractModel.prototype); _.extend(MessageSimpleModel.prototype, AbstractModel.prototype);
MessageSimpleModel.prototype.__simple_message__ = true; MessageSimpleModel.prototype.isSimpleMessage = true;
MessageSimpleModel.prototype.folder = ''; MessageSimpleModel.prototype.folder = '';
MessageSimpleModel.prototype.folderFullNameRaw = ''; MessageSimpleModel.prototype.folderFullNameRaw = '';
@ -85,7 +80,7 @@
/** /**
* @param {Object} oJson * @param {Object} oJson
* @return {boolean} * @returns {boolean}
*/ */
MessageSimpleModel.prototype.initByJson = function(oJson) MessageSimpleModel.prototype.initByJson = function(oJson)
{ {
@ -151,7 +146,7 @@
}; };
/** /**
* @return {Array} * @returns {Array}
*/ */
MessageSimpleModel.prototype.threads = function() MessageSimpleModel.prototype.threads = function()
{ {
@ -161,7 +156,7 @@
/** /**
* @static * @static
* @param {Object} oJson * @param {Object} oJson
* @return {?MessageSimpleModel} * @returns {?MessageSimpleModel}
*/ */
MessageSimpleModel.newInstanceFromJson = function(oJson) MessageSimpleModel.newInstanceFromJson = function(oJson)
{ {
@ -170,5 +165,3 @@
}; };
module.exports = MessageSimpleModel; module.exports = MessageSimpleModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -11,10 +7,10 @@
PgpStore = require('Stores/User/Pgp'), PgpStore = require('Stores/User/Pgp'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor
* @param {string} iIndex * @param {string} iIndex
* @param {string} sGuID * @param {string} sGuID
* @param {string} sID * @param {string} sID
@ -24,7 +20,6 @@
* @param {boolean} bIsPrivate * @param {boolean} bIsPrivate
* @param {string} sArmor * @param {string} sArmor
* @param {string} sUserID * @param {string} sUserID
* @constructor
*/ */
function OpenPgpKeyModel(iIndex, sGuID, sID, aIDs, aUserIDs, aEmails, bIsPrivate, sArmor, sUserID) function OpenPgpKeyModel(iIndex, sGuID, sID, aIDs, aUserIDs, aEmails, bIsPrivate, sArmor, sUserID)
{ {
@ -87,7 +82,7 @@
if (this[sProperty]) if (this[sProperty])
{ {
var index = this[sProperty].indexOf(sPattern); var index = this[sProperty].indexOf(sPattern);
if (index !== -1) if (-1 !== index)
{ {
this.user = this.users[index]; this.user = this.users[index];
this.email = this.emails[index]; this.email = this.emails[index];
@ -106,6 +101,3 @@
}; };
module.exports = OpenPgpKeyModel; module.exports = OpenPgpKeyModel;
}());

View file

@ -1,20 +1,14 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
AbstractModel = require('Knoin/AbstractModel') AbstractModel = require('Knoin/AbstractModel');
;
/** /**
* @constructor * @constructor
*
* @param {string} sID * @param {string} sID
* @param {string} sName * @param {string} sName
* @param {string} sBody * @param {string} sBody
@ -73,5 +67,3 @@
}; };
module.exports = TemplateModel; module.exports = TemplateModel;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
$ = require('$'), $ = require('$'),
_ = require('_'), _ = require('_'),
@ -17,8 +13,7 @@
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
AbstractBasicPromises = require('Promises/AbstractBasic') AbstractBasicPromises = require('Promises/AbstractBasic');
;
/** /**
* @constructor * @constructor
@ -63,8 +58,7 @@
var var
oH = null, oH = null,
iStart = Utils.microtime() iStart = Utils.microtime();
;
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : Consts.DEFAULT_AJAX_TIMEOUT; iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : Consts.DEFAULT_AJAX_TIMEOUT;
sAdditionalGetString = Utils.isUnd(sAdditionalGetString) ? '' : Utils.pString(sAdditionalGetString); sAdditionalGetString = Utils.isUnd(sAdditionalGetString) ? '' : Utils.pString(sAdditionalGetString);
@ -103,6 +97,7 @@
case 'abort' === sTextStatus && (!oData || !oData.__aborted__): case 'abort' === sTextStatus && (!oData || !oData.__aborted__):
sType = Enums.StorageResultType.Abort; sType = Enums.StorageResultType.Abort;
break; break;
// no default
} }
Plugins.runHook('ajax-default-response', [sAction, Plugins.runHook('ajax-default-response', [sAction,
@ -160,12 +155,12 @@
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
])) ]))
{ {
Globals.data.iAjaxErrorCount++; Globals.data.iAjaxErrorCount += 1;
} }
if (Enums.Notification.InvalidToken === oErrorData.ErrorCode) if (Enums.Notification.InvalidToken === oErrorData.ErrorCode)
{ {
Globals.data.iTokenErrorCount++; Globals.data.iTokenErrorCount += 1;
} }
if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount) if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount)
@ -222,5 +217,3 @@
}; };
module.exports = AbstractAjaxPromises; module.exports = AbstractAjaxPromises;
}());

View file

@ -1,14 +1,9 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
Promise = require('Promise'), Promise = require('Promise'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
/** /**
* @constructor * @constructor
@ -48,5 +43,3 @@
}; };
module.exports = AbstractBasicPromises; module.exports = AbstractBasicPromises;
}());

View file

@ -1,24 +1,10 @@
(function () {
'use strict';
var var
window = require('window'), window = require('window'),
_ = require('_'), _ = require('_'),
// Enums = require('Common/Enums'),
// Utils = require('Common/Utils'),
// Base64 = require('Common/Base64'),
// Cache = require('Common/Cache'),
// Links = require('Common/Links'),
//
// AppStore = require('Stores/User/App'),
// SettingsStore = require('Stores/User/Settings'),
PromisesPopulator = require('Promises/User/Populator'), PromisesPopulator = require('Promises/User/Populator'),
AbstractAjaxPromises = require('Promises/AbstractAjax') AbstractAjaxPromises = require('Promises/AbstractAjax');
;
/** /**
* @constructor * @constructor
@ -41,14 +27,14 @@
}); });
}; };
UserAjaxUserPromises.prototype._folders_timeout_ = 0; UserAjaxUserPromises.prototype.foldersTimeout = 0;
UserAjaxUserPromises.prototype.foldersReloadWithTimeout = function(fTrigger) UserAjaxUserPromises.prototype.foldersReloadWithTimeout = function(fTrigger)
{ {
this.setTrigger(fTrigger, true); this.setTrigger(fTrigger, true);
var self = this; var self = this;
window.clearTimeout(this._folders_timeout_); window.clearTimeout(this.foldersTimeout);
this._folders_timeout_ = window.setTimeout(function () { this.foldersTimeout = window.setTimeout(function() {
self.foldersReload(fTrigger); self.foldersReload(fTrigger);
}, 500); }, 500);
}; };
@ -90,5 +76,3 @@
}; };
module.exports = new UserAjaxUserPromises(); module.exports = new UserAjaxUserPromises();
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
@ -19,8 +15,7 @@
FolderModel = require('Model/Folder'), FolderModel = require('Model/Folder'),
AbstractBasicPromises = require('Promises/AbstractBasic') AbstractBasicPromises = require('Promises/AbstractBasic');
;
/** /**
* @constructor * @constructor
@ -34,7 +29,7 @@
/** /**
* @param {string} sFullNameHash * @param {string} sFullNameHash
* @return {boolean} * @returns {boolean}
*/ */
PromisesUserPopulator.prototype.isFolderExpanded = function(sFullNameHash) PromisesUserPopulator.prototype.isFolderExpanded = function(sFullNameHash)
{ {
@ -44,7 +39,7 @@
/** /**
* @param {string} sFolderFullNameRaw * @param {string} sFolderFullNameRaw
* @return {string} * @returns {string}
*/ */
PromisesUserPopulator.prototype.normalizeFolder = function(sFolderFullNameRaw) PromisesUserPopulator.prototype.normalizeFolder = function(sFolderFullNameRaw)
{ {
@ -55,7 +50,7 @@
/** /**
* @param {string} sNamespace * @param {string} sNamespace
* @param {Array} aFolders * @param {Array} aFolders
* @return {Array} * @returns {Array}
*/ */
PromisesUserPopulator.prototype.folderResponseParseRec = function(sNamespace, aFolders) PromisesUserPopulator.prototype.folderResponseParseRec = function(sNamespace, aFolders)
{ {
@ -67,8 +62,7 @@
oCacheFolder = null, oCacheFolder = null,
sFolderFullNameRaw = '', sFolderFullNameRaw = '',
aSubFolders = [], aSubFolders = [],
aList = [] aList = [];
;
for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++) for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
{ {
@ -142,8 +136,7 @@
{ {
var var
iLimit = Utils.pInt(Settings.appSettingsGet('folderSpecLimit')), iLimit = Utils.pInt(Settings.appSettingsGet('folderSpecLimit')),
iC = Utils.pInt(oData.CountRec) iC = Utils.pInt(oData.CountRec);
;
iLimit = 100 < iLimit ? 100 : (10 > iLimit ? 10 : iLimit); iLimit = 100 < iLimit ? 100 : (10 > iLimit ? 10 : iLimit);
@ -209,5 +202,3 @@
}; };
module.exports = new PromisesUserPopulator(); module.exports = new PromisesUserPopulator();
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
window = require('window'), window = require('window'),
_ = require('_'), _ = require('_'),
@ -15,8 +11,7 @@
Plugins = require('Common/Plugins'), Plugins = require('Common/Plugins'),
Links = require('Common/Links'), Links = require('Common/Links'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -53,12 +48,12 @@
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
])) ]))
{ {
Globals.data.iAjaxErrorCount++; Globals.data.iAjaxErrorCount += 1;
} }
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode) if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
{ {
Globals.data.iTokenErrorCount++; Globals.data.iTokenErrorCount += 1;
} }
if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount) if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount)
@ -100,8 +95,7 @@
oRequestParameters oRequestParameters
); );
} }
} };
;
switch (sType) switch (sType)
{ {
@ -132,7 +126,7 @@
* @param {?number=} iTimeOut = 20000 * @param {?number=} iTimeOut = 20000
* @param {string=} sGetAdd = '' * @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = [] * @param {Array=} aAbortActions = []
* @return {jQuery.jqXHR} * @returns {jQuery.jqXHR}
*/ */
AbstractAjaxRemote.prototype.ajaxRequest = function(fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions) AbstractAjaxRemote.prototype.ajaxRequest = function(fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
{ {
@ -142,8 +136,7 @@
oHeaders = {}, oHeaders = {},
iStart = (new window.Date()).getTime(), iStart = (new window.Date()).getTime(),
oDefAjax = null, oDefAjax = null,
sAction = '' sAction = '';
;
oParameters = oParameters || {}; oParameters = oParameters || {};
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000; iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
@ -307,5 +300,3 @@
}; };
module.exports = AbstractAjaxRemote; module.exports = AbstractAjaxRemote;
}());

View file

@ -1,15 +1,10 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
AbstractAjaxRemote = require('Remote/AbstractAjax') AbstractAjaxRemote = require('Remote/AbstractAjax');
;
/** /**
* @constructor * @constructor
@ -304,5 +299,3 @@
}; };
module.exports = new RemoteAdminStorage(); module.exports = new RemoteAdminStorage();
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
@ -18,8 +14,7 @@
AppStore = require('Stores/User/App'), AppStore = require('Stores/User/App'),
SettingsStore = require('Stores/User/Settings'), SettingsStore = require('Stores/User/Settings'),
AbstractAjaxRemote = require('Remote/AbstractAjax') AbstractAjaxRemote = require('Remote/AbstractAjax');
;
/** /**
* @constructor * @constructor
@ -336,8 +331,7 @@
var var
sFolderHash = Cache.getFolderHash(sFolderFullNameRaw), sFolderHash = Cache.getFolderHash(sFolderFullNameRaw),
bUseThreads = AppStore.threadsAllowed() && SettingsStore.useThreads(), bUseThreads = AppStore.threadsAllowed() && SettingsStore.useThreads(),
sInboxUidNext = Cache.getFolderInboxName() === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '' sInboxUidNext = Cache.getFolderInboxName() === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '';
;
bSilent = Utils.isUnd(bSilent) ? false : !!bSilent; bSilent = Utils.isUnd(bSilent) ? false : !!bSilent;
iOffset = Utils.isUnd(iOffset) ? 0 : Utils.pInt(iOffset); iOffset = Utils.isUnd(iOffset) ? 0 : Utils.pInt(iOffset);
@ -389,7 +383,7 @@
* @param {?Function} fCallback * @param {?Function} fCallback
* @param {string} sFolderFullNameRaw * @param {string} sFolderFullNameRaw
* @param {number} iUid * @param {number} iUid
* @return {boolean} * @returns {boolean}
*/ */
RemoteUserAjax.prototype.message = function(fCallback, sFolderFullNameRaw, iUid) RemoteUserAjax.prototype.message = function(fCallback, sFolderFullNameRaw, iUid)
{ {
@ -445,8 +439,7 @@
{ {
var var
bRequest = true, bRequest = true,
aUids = [] aUids = [];
;
if (Utils.isArray(aList) && 0 < aList.length) if (Utils.isArray(aList) && 0 < aList.length)
{ {
@ -909,5 +902,3 @@
}; };
module.exports = new RemoteUserAjax(); module.exports = new RemoteUserAjax();
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
$ = require('$'), $ = require('$'),
@ -13,8 +9,7 @@
Links = require('Common/Links'), Links = require('Common/Links'),
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
AbstractScreen = require('Knoin/AbstractScreen') AbstractScreen = require('Knoin/AbstractScreen');
;
/** /**
* @constructor * @constructor
@ -53,8 +48,7 @@
oSettingsScreen = null, oSettingsScreen = null,
RoutedSettingsViewModel = null, RoutedSettingsViewModel = null,
oViewModelPlace = null, oViewModelPlace = null,
oViewModelDom = null oViewModelDom = null;
;
RoutedSettingsViewModel = _.find(Globals.aViewModels.settings, function(SettingsViewModel) { RoutedSettingsViewModel = _.find(Globals.aViewModels.settings, function(SettingsViewModel) {
return SettingsViewModel && SettingsViewModel.__rlSettingsData && return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
@ -103,8 +97,12 @@
RoutedSettingsViewModel.__vm = oSettingsScreen; RoutedSettingsViewModel.__vm = oSettingsScreen;
ko.applyBindingAccessorsToNode(oViewModelDom[0], { ko.applyBindingAccessorsToNode(oViewModelDom[0], {
'translatorInit': true, translatorInit: true,
'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; } template: function() {
return {
name: RoutedSettingsViewModel.__rlSettingsData.Template
};
}
}, oSettingsScreen); }, oSettingsScreen);
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]); Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
@ -199,8 +197,7 @@
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname); oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
return [oVals.subname]; return [oVals.subname];
} }
} };
;
return [ return [
['{subname}/', oRules], ['{subname}/', oRules],
@ -210,5 +207,3 @@
}; };
module.exports = AbstractSettingsScreen; module.exports = AbstractSettingsScreen;
}());

View file

@ -1,13 +1,8 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
AbstractScreen = require('Knoin/AbstractScreen') AbstractScreen = require('Knoin/AbstractScreen');
;
/** /**
* @constructor * @constructor
@ -28,5 +23,3 @@
}; };
module.exports = LoginAdminScreen; module.exports = LoginAdminScreen;
}());

View file

@ -1,10 +1,6 @@
/* global RL_COMMUNITY */ /* global RL_COMMUNITY */
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
@ -12,8 +8,7 @@
Plugins = require('Common/Plugins'), Plugins = require('Common/Plugins'),
AbstractSettings = require('Screen/AbstractSettings') AbstractSettings = require('Screen/AbstractSettings');
;
/** /**
* @constructor * @constructor
@ -92,5 +87,3 @@
}; };
module.exports = SettingsAdminScreen; module.exports = SettingsAdminScreen;
}());

View file

@ -1,13 +1,8 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
AbstractScreen = require('Knoin/AbstractScreen') AbstractScreen = require('Knoin/AbstractScreen');
;
/** /**
* @constructor * @constructor
@ -28,5 +23,3 @@
}; };
module.exports = AboutUserScreen; module.exports = AboutUserScreen;
}());

View file

@ -1,13 +1,8 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
AbstractScreen = require('Knoin/AbstractScreen') AbstractScreen = require('Knoin/AbstractScreen');
;
/** /**
* @constructor * @constructor
@ -28,5 +23,3 @@
}; };
module.exports = LoginUserScreen; module.exports = LoginUserScreen;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
@ -22,8 +18,7 @@
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
AbstractScreen = require('Knoin/AbstractScreen') AbstractScreen = require('Knoin/AbstractScreen');
;
/** /**
* @constructor * @constructor
@ -52,8 +47,7 @@
{ {
var var
sEmail = AccountStore.email(), sEmail = AccountStore.email(),
nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount() nFoldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount();
;
if (Settings.appSettingsGet('listPermanentFiltered')) if (Settings.appSettingsGet('listPermanentFiltered'))
{ {
@ -98,8 +92,7 @@
var var
sThreadUid = sFolderHash.replace(/^(.+)~([\d]+)$/, '$2'), sThreadUid = sFolderHash.replace(/^(.+)~([\d]+)$/, '$2'),
oFolder = Cache.getFolderFromCacheList(Cache.getFolderFullNameRaw( oFolder = Cache.getFolderFromCacheList(Cache.getFolderFullNameRaw(
sFolderHash.replace(/~([\d]+)$/, ''))) sFolderHash.replace(/~([\d]+)$/, '')));
;
if (oFolder) if (oFolder)
{ {
@ -158,7 +151,7 @@
}; };
/** /**
* @return {Array} * @returns {Array}
*/ */
MailBoxUserScreen.prototype.routes = function() MailBoxUserScreen.prototype.routes = function()
{ {
@ -188,8 +181,7 @@
} }
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1])]; return [decodeURI(oVals[0]), 1, decodeURI(oVals[1])];
} };
;
return [ return [
[/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}], [/^([a-zA-Z0-9~]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
@ -200,5 +192,3 @@
}; };
module.exports = MailBoxUserScreen; module.exports = MailBoxUserScreen;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
@ -18,8 +14,7 @@
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
AbstractSettingsScreen = require('Screen/AbstractSettings') AbstractSettingsScreen = require('Screen/AbstractSettings');
;
/** /**
* @constructor * @constructor
@ -153,5 +148,3 @@
}; };
module.exports = SettingsUserScreen; module.exports = SettingsUserScreen;
}());

View file

@ -1,10 +1,6 @@
/* global RL_COMMUNITY */ /* global RL_COMMUNITY */
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
@ -12,8 +8,7 @@
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
CoreStore = require('Stores/Admin/Core'), CoreStore = require('Stores/Admin/Core'),
AppStore = require('Stores/Admin/App') AppStore = require('Stores/Admin/App');
;
/** /**
* @constructor * @constructor
@ -51,8 +46,7 @@
iVersionCompare = this.coreVersionCompare(), iVersionCompare = this.coreVersionCompare(),
bChecking = this.coreChecking(), bChecking = this.coreChecking(),
bUpdating = this.coreUpdating(), bUpdating = this.coreUpdating(),
bReal = this.coreReal() bReal = this.coreReal();
;
if (bChecking) if (bChecking)
{ {
@ -98,5 +92,3 @@
}; };
module.exports = AboutAdminSettings; module.exports = AboutAdminSettings;
}());

View file

@ -1,17 +1,12 @@
/* global RL_COMMUNITY */ /* global RL_COMMUNITY */
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator') Translator = require('Common/Translator');
;
/** /**
* @constructor * @constructor
@ -21,8 +16,7 @@
var var
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
AppStore = require('Stores/Admin/App') AppStore = require('Stores/Admin/App');
;
this.capa = AppStore.prem; this.capa = AppStore.prem;
@ -86,16 +80,14 @@
{ {
var var
self = this, self = this,
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
_.delay(function() { _.delay(function() {
var var
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self), f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self), f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self) f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self);
;
self.title.subscribe(function(sValue) { self.title.subscribe(function(sValue) {
Remote.saveAdminConfig(f1, { Remote.saveAdminConfig(f1, {
@ -119,5 +111,3 @@
}; };
module.exports = BrandingAdminSettings; module.exports = BrandingAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -12,8 +8,7 @@
Translator = require('Common/Translator'), Translator = require('Common/Translator'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -21,8 +16,7 @@
function ContactsAdminSettings() function ContactsAdminSettings()
{ {
var var
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable')); this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable'));
@ -44,11 +38,11 @@
case 'pgsql': case 'pgsql':
sName = 'PostgreSQL'; sName = 'PostgreSQL';
break; break;
// no default
} }
return sName; return sName;
} };
;
if (Settings.settingsGet('SQLiteIsSupported')) if (Settings.settingsGet('SQLiteIsSupported'))
{ {
@ -180,8 +174,7 @@
{ {
var var
self = this, self = this,
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
_.delay(function() { _.delay(function() {
@ -189,8 +182,7 @@
f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self), f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self), f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self),
f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self), f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self),
f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self) f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self);
;
self.enableContacts.subscribe(function(bValue) { self.enableContacts.subscribe(function(bValue) {
Remote.saveAdminConfig(null, { Remote.saveAdminConfig(null, {
@ -240,5 +232,3 @@
}; };
module.exports = ContactsAdminSettings; module.exports = ContactsAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -10,8 +6,7 @@
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
DomainStore = require('Stores/Admin/Domain'), DomainStore = require('Stores/Admin/Domain'),
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
/** /**
* @constructor * @constructor
@ -62,8 +57,7 @@
{ {
Remote.domain(self.onDomainLoadRequest, oDomainItem.name); Remote.domain(self.onDomainLoadRequest, oDomainItem.name);
} }
}) });
;
require('App/Admin').default.reloadDomainList(); require('App/Admin').default.reloadDomainList();
}; };
@ -82,5 +76,3 @@
}; };
module.exports = DomainsAdminSettings; module.exports = DomainsAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -17,8 +13,7 @@
AppAdminStore = require('Stores/Admin/App'), AppAdminStore = require('Stores/Admin/App'),
CapaAdminStore = require('Stores/Admin/Capa'), CapaAdminStore = require('Stores/Admin/Capa'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -78,8 +73,7 @@
{ {
var var
self = this, self = this,
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
_.delay(function() { _.delay(function() {
@ -94,8 +88,7 @@
self.languageAdminTrigger(Enums.SaveSettingsStep.Idle); self.languageAdminTrigger(Enums.SaveSettingsStep.Idle);
}, 1000); }, 1000);
}; };
} };
;
self.mainAttachmentLimit.subscribe(function(sValue) { self.mainAttachmentLimit.subscribe(function(sValue) {
Remote.saveAdminConfig(f1, { Remote.saveAdminConfig(f1, {
@ -199,7 +192,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
GeneralAdminSettings.prototype.phpInfoLink = function() GeneralAdminSettings.prototype.phpInfoLink = function()
{ {
@ -207,5 +200,3 @@
}; };
module.exports = GeneralAdminSettings; module.exports = GeneralAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -12,8 +8,7 @@
AppAdminStore = require('Stores/Admin/App'), AppAdminStore = require('Stores/Admin/App'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -35,8 +30,7 @@
{ {
var var
self = this, self = this,
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
_.delay(function() { _.delay(function() {
@ -70,5 +64,3 @@
}; };
module.exports = LoginAdminSettings; module.exports = LoginAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
window = require('window'), window = require('window'),
_ = require('_'), _ = require('_'),
@ -12,8 +8,7 @@
Translator = require('Common/Translator'), Translator = require('Common/Translator'),
PackageStore = require('Stores/Admin/Package'), PackageStore = require('Stores/Admin/Package'),
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
/** /**
* @constructor * @constructor
@ -109,5 +104,3 @@
}; };
module.exports = PackagesAdminSettings; module.exports = PackagesAdminSettings;
}());

View file

@ -1,10 +1,6 @@
/* global RL_COMMUNITY */ /* global RL_COMMUNITY */
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -18,8 +14,7 @@
AppStore = require('Stores/Admin/App'), AppStore = require('Stores/Admin/App'),
PluginStore = require('Stores/Admin/Plugin'), PluginStore = require('Stores/Admin/Plugin'),
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
/** /**
* @constructor * @constructor
@ -70,8 +65,7 @@
{ {
self.disablePlugin(oPlugin); self.disablePlugin(oPlugin);
} }
}) });
;
this.enabledPlugins.subscribe(function(bValue) { this.enabledPlugins.subscribe(function(bValue) {
Remote.saveAdminConfig(Utils.noop, { Remote.saveAdminConfig(Utils.noop, {
@ -115,5 +109,3 @@
}; };
module.exports = PluginsAdminSettings; module.exports = PluginsAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -15,8 +11,7 @@
CapaAdminStore = require('Stores/Admin/Capa'), CapaAdminStore = require('Stores/Admin/Capa'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
/** /**
* @constructor * @constructor
@ -175,7 +170,7 @@
}; };
/** /**
* @return {string} * @returns {string}
*/ */
SecurityAdminSettings.prototype.phpInfoLink = function() SecurityAdminSettings.prototype.phpInfoLink = function()
{ {
@ -183,5 +178,3 @@
}; };
module.exports = SecurityAdminSettings; module.exports = SecurityAdminSettings;
}());

View file

@ -1,15 +1,10 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Utils = require('Common/Utils') Utils = require('Common/Utils');
;
/** /**
* @constructor * @constructor
@ -60,8 +55,7 @@
{ {
var var
self = this, self = this,
Remote = require('Remote/Admin/Ajax') Remote = require('Remote/Admin/Ajax');
;
_.delay(function() { _.delay(function() {
@ -73,8 +67,7 @@
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self), f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self), f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self), f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self) f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self);
;
self.facebookEnable.subscribe(function(bValue) { self.facebookEnable.subscribe(function(bValue) {
if (self.facebookSupported()) if (self.facebookSupported())
@ -179,5 +172,3 @@
}; };
module.exports = SocialAdminSettings; module.exports = SocialAdminSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
window = require('window'), window = require('window'),
_ = require('_'), _ = require('_'),
@ -15,8 +11,7 @@
IdentityStore = require('Stores/User/Identity'), IdentityStore = require('Stores/User/Identity'),
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -78,8 +73,7 @@
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
fRemoveAccount = function(oAccount) { fRemoveAccount = function(oAccount) {
return oAccountToRemove === oAccount; return oAccountToRemove === oAccount;
} };
;
if (oAccountToRemove) if (oAccountToRemove)
{ {
@ -154,10 +148,7 @@
{ {
self.editIdentity(oIdentityItem); self.editIdentity(oIdentityItem);
} }
}) });
;
}; };
module.exports = AccountsUserSettings; module.exports = AccountsUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -11,8 +7,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Translator = require('Common/Translator'), Translator = require('Common/Translator'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -120,5 +115,3 @@
}; };
module.exports = ChangePasswordUserSettings; module.exports = ChangePasswordUserSettings;
}());

View file

@ -1,16 +1,11 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
AppStore = require('Stores/User/App'), AppStore = require('Stores/User/App'),
ContactStore = require('Stores/User/Contact'), ContactStore = require('Stores/User/Contact'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -54,5 +49,3 @@
}; };
module.exports = ContactsUserSettings; module.exports = ContactsUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
_ = require('_'), _ = require('_'),
@ -13,8 +9,7 @@
FilterStore = require('Stores/User/Filter'), FilterStore = require('Stores/User/Filter'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -123,8 +118,7 @@
{ {
var var
self = this, self = this,
FilterModel = require('Model/Filter') FilterModel = require('Model/Filter');
;
if (!this.filters.loading()) if (!this.filters.loading())
{ {
@ -183,8 +177,7 @@
var var
self = this, self = this,
FilterModel = require('Model/Filter'), FilterModel = require('Model/Filter'),
oNew = new FilterModel() oNew = new FilterModel();
;
oNew.generateID(); oNew.generateID();
require('Knoin/Knoin').showScreenPopup( require('Knoin/Knoin').showScreenPopup(
@ -198,16 +191,14 @@
{ {
var var
self = this, self = this,
oCloned = oEdit.cloneSelf() oCloned = oEdit.cloneSelf();
;
require('Knoin/Knoin').showScreenPopup( require('Knoin/Knoin').showScreenPopup(
require('View/Popup/Filter'), [oCloned, function() { require('View/Popup/Filter'), [oCloned, function() {
var var
aFilters = self.filters(), aFilters = self.filters(),
iIndex = aFilters.indexOf(oEdit) iIndex = aFilters.indexOf(oEdit);
;
if (-1 < iIndex && aFilters[iIndex]) if (-1 < iIndex && aFilters[iIndex])
{ {
@ -232,8 +223,7 @@
{ {
self.editFilter(oFilterItem); self.editFilter(oFilterItem);
} }
}) });
;
}; };
FiltersUserSettings.prototype.onShow = function() FiltersUserSettings.prototype.onShow = function()
@ -242,5 +232,3 @@
}; };
module.exports = FiltersUserSettings; module.exports = FiltersUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
@ -18,8 +14,7 @@
FolderStore = require('Stores/User/Folder'), FolderStore = require('Stores/User/Folder'),
Promises = require('Promises/User/Ajax'), Promises = require('Promises/User/Ajax'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -37,8 +32,7 @@
bLoading = FolderStore.foldersLoading(), bLoading = FolderStore.foldersLoading(),
bCreating = FolderStore.foldersCreating(), bCreating = FolderStore.foldersCreating(),
bDeleting = FolderStore.foldersDeleting(), bDeleting = FolderStore.foldersDeleting(),
bRenaming = FolderStore.foldersRenaming() bRenaming = FolderStore.foldersRenaming();
;
return bLoading || bCreating || bDeleting || bRenaming; return bLoading || bCreating || bDeleting || bRenaming;
@ -66,8 +60,7 @@
FoldersUserSettings.prototype.folderEditOnEnter = function(oFolder) FoldersUserSettings.prototype.folderEditOnEnter = function(oFolder)
{ {
var var
sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '' sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '';
;
if ('' !== sEditName && oFolder.name() !== sEditName) if ('' !== sEditName && oFolder.name() !== sEditName)
{ {
@ -114,8 +107,7 @@
}) })
.on('mouseout', '.subscribe-folder-parent, .check-folder-parent, .delete-folder-parent', function() { .on('mouseout', '.subscribe-folder-parent, .check-folder-parent, .delete-folder-parent', function() {
self.folderListHelp(''); self.folderListHelp('');
}) });
;
}; };
FoldersUserSettings.prototype.createFolder = function() FoldersUserSettings.prototype.createFolder = function()
@ -145,8 +137,7 @@
oFolder.subFolders.remove(fRemoveFolder); oFolder.subFolders.remove(fRemoveFolder);
return false; return false;
} };
;
if (oFolderToRemove) if (oFolderToRemove)
{ {
@ -199,5 +190,3 @@
}; };
module.exports = FoldersUserSettings; module.exports = FoldersUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -20,8 +16,7 @@
NotificationStore = require('Stores/User/Notification'), NotificationStore = require('Stores/User/Notification'),
MessageStore = require('Stores/User/Message'), MessageStore = require('Stores/User/Message'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -68,7 +63,7 @@
this.identityMain = ko.computed(function() { this.identityMain = ko.computed(function() {
var aList = this.identities(); var aList = this.identities();
return Utils.isArray(aList) ? _.find(aList, function(oItem) { return Utils.isArray(aList) ? _.find(aList, function(oItem) {
return oItem && '' === oItem.id() ? true : false; return oItem && '' === oItem.id();
}) : null; }) : null;
}, this); }, this);
@ -128,8 +123,7 @@
self.languageTrigger(Enums.SaveSettingsStep.Idle); self.languageTrigger(Enums.SaveSettingsStep.Idle);
}, 1000); }, 1000);
}; };
} };
;
self.language.subscribe(function(sValue) { self.language.subscribe(function(sValue) {
@ -228,5 +222,3 @@
}; };
module.exports = GeneralUserSettings; module.exports = GeneralUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -12,8 +8,7 @@
kn = require('Knoin/Knoin'), kn = require('Knoin/Knoin'),
PgpStore = require('Stores/User/Pgp') PgpStore = require('Stores/User/Pgp');
;
/** /**
* @constructor * @constructor
@ -79,5 +74,3 @@
}; };
module.exports = OpenPgpUserSettings; module.exports = OpenPgpUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
@ -15,8 +11,7 @@
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -58,8 +53,7 @@
_.delay(function() { _.delay(function() {
var var
f0 = Utils.settingsSaveHelperSimpleFunction(self.autoLogout.trigger, self) f0 = Utils.settingsSaveHelperSimpleFunction(self.autoLogout.trigger, self);
;
self.autoLogout.subscribe(function(sValue) { self.autoLogout.subscribe(function(sValue) {
Remote.saveSettings(f0, { Remote.saveSettings(f0, {
@ -72,5 +66,3 @@
}; };
module.exports = SecurityUserSettings; module.exports = SecurityUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
/** /**
* @constructor * @constructor
*/ */
@ -10,8 +6,7 @@
{ {
var var
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
SocialStore = require('Stores/Social') SocialStore = require('Stores/Social');
;
this.googleEnable = SocialStore.google.enabled; this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth; this.googleEnableAuth = SocialStore.google.capa.auth;
@ -76,5 +71,3 @@
} }
module.exports = SocialUserSettings; module.exports = SocialUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
@ -10,8 +6,7 @@
TemplateStore = require('Stores/User/Template'), TemplateStore = require('Stores/User/Template'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -66,8 +61,7 @@
self = this, self = this,
fRemoveAccount = function(oAccount) { fRemoveAccount = function(oAccount) {
return oTemplateToRemove === oAccount; return oTemplateToRemove === oAccount;
} };
;
if (oTemplateToRemove) if (oTemplateToRemove)
{ {
@ -96,12 +90,9 @@
{ {
self.editTemplate(oTemplateItem); self.editTemplate(oTemplateItem);
} }
}) });
;
this.reloadTemplates(); this.reloadTemplates();
}; };
module.exports = TemplatesUserSettings; module.exports = TemplatesUserSettings;
}());

View file

@ -1,8 +1,4 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
$ = require('$'), $ = require('$'),
@ -19,8 +15,7 @@
Settings = require('Storage/Settings'), Settings = require('Storage/Settings'),
Remote = require('Remote/User/Ajax') Remote = require('Remote/User/Ajax');
;
/** /**
* @constructor * @constructor
@ -125,8 +120,7 @@
'disableDragAndDrop': true, 'disableDragAndDrop': true,
'disableMultiple': true, 'disableMultiple': true,
'clickElement': this.background.uploaderButton() 'clickElement': this.background.uploaderButton()
}) });
;
oJua oJua
.on('onStart', _.bind(function() { .on('onStart', _.bind(function() {
@ -162,6 +156,7 @@
case Enums.UploadErrorCode.FileType: case Enums.UploadErrorCode.FileType:
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR'); sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
break; break;
// no default
} }
} }
@ -175,11 +170,8 @@
return true; return true;
}, this)) }, this));
;
} }
}; };
module.exports = ThemesUserSettings; module.exports = ThemesUserSettings;
}());

View file

@ -12,7 +12,7 @@ const driver = SupportedStorageDriver ? new SupportedStorageDriver() : null;
/** /**
* @param {number} key * @param {number} key
* @param {*} data * @param {*} data
* @return {boolean} * @returns {boolean}
*/ */
export function set(key, data) export function set(key, data)
{ {
@ -21,7 +21,7 @@ export function set(key, data)
/** /**
* @param {number} key * @param {number} key
* @return {*} * @returns {*}
*/ */
export function get(key) export function get(key)
{ {

View file

@ -45,35 +45,43 @@ const timestamp = () => window.Math.round((new window.Date()).getTime() / 1000);
const setTimestamp = () => __set(TIME_KEY, timestamp()); const setTimestamp = () => __set(TIME_KEY, timestamp());
const getTimestamp = () => { const getTimestamp = () => {
let time = __get(TIME_KEY, 0); const time = __get(TIME_KEY, 0);
return time ? (window.parseInt(time, 10) || 0) : 0; return time ? (window.parseInt(time, 10) || 0) : 0;
}; };
/** /**
* @return {string} * @returns {string}
*/ */
export function getHash() export function getHash()
{ {
return __get(STORAGE_KEY); return __get(STORAGE_KEY);
} }
/**
* @returns {void}
*/
export function setHash() export function setHash()
{ {
const const
key = 'AuthAccountHash', key = 'AuthAccountHash',
appData = window.__rlah_data() appData = window.__rlah_data();
;
__set(STORAGE_KEY, appData && appData[key] ? appData[key] : ''); __set(STORAGE_KEY, appData && appData[key] ? appData[key] : '');
setTimestamp(); setTimestamp();
} }
/**
* @returns {void}
*/
export function clearHash() export function clearHash()
{ {
__set(STORAGE_KEY, ''); __set(STORAGE_KEY, '');
setTimestamp(); setTimestamp();
} }
/**
* @returns {boolean}
*/
export function checkTimestamp() export function checkTimestamp()
{ {
if (timestamp() > getTimestamp() + 1000 * 60 * 60) // 60m if (timestamp() > getTimestamp() + 1000 * 60 * 60) // 60m

View file

@ -10,7 +10,7 @@ APP_SETTINGS = isNormal(APP_SETTINGS) ? APP_SETTINGS : {};
/** /**
* @param {string} name * @param {string} name
* @return {*} * @returns {*}
*/ */
export function settingsGet(name) export function settingsGet(name)
{ {
@ -28,7 +28,7 @@ export function settingsSet(name, value)
/** /**
* @param {string} name * @param {string} name
* @return {*} * @returns {*}
*/ */
export function appSettingsGet(name) export function appSettingsGet(name)
{ {
@ -37,7 +37,7 @@ export function appSettingsGet(name)
/** /**
* @param {string} name * @param {string} name
* @return {boolean} * @returns {boolean}
*/ */
export function capa(name) export function capa(name)
{ {

View file

@ -1,15 +1,10 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
Enums = require('Common/Enums'), Enums = require('Common/Enums'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -47,5 +42,3 @@
}; };
module.exports = new CapaAdminStore(); module.exports = new CapaAdminStore();
}());

View file

@ -1,11 +1,5 @@
(function () { var ko = require('ko');
'use strict';
var
ko = require('ko')
;
/** /**
* @constructor * @constructor
@ -27,5 +21,3 @@
} }
module.exports = new CoreAdminStore(); module.exports = new CoreAdminStore();
}());

View file

@ -1,11 +1,5 @@
(function () { var ko = require('ko');
'use strict';
var
ko = require('ko')
;
/** /**
* @constructor * @constructor
@ -21,5 +15,3 @@
} }
module.exports = new DomainAdminStore(); module.exports = new DomainAdminStore();
}());

View file

@ -1,11 +1,5 @@
(function () { var ko = require('ko');
'use strict';
var
ko = require('ko')
;
/** /**
* @constructor * @constructor
@ -22,5 +16,3 @@
} }
module.exports = new LicenseAdminStore(); module.exports = new LicenseAdminStore();
}());

View file

@ -1,11 +1,5 @@
(function () { var ko = require('ko');
'use strict';
var
ko = require('ko')
;
/** /**
* @constructor * @constructor
@ -20,5 +14,3 @@
} }
module.exports = new PackageAdminStore(); module.exports = new PackageAdminStore();
}());

View file

@ -1,11 +1,5 @@
(function () { var ko = require('ko');
'use strict';
var
ko = require('ko')
;
/** /**
* @constructor * @constructor
@ -18,5 +12,3 @@
} }
module.exports = new PluginAdminStore(); module.exports = new PluginAdminStore();
}());

View file

@ -1,15 +1,10 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -21,13 +16,11 @@
this.language = ko.observable('') this.language = ko.observable('')
.extend({'limitedList': this.languages}) .extend({'limitedList': this.languages})
.extend({'reversible': true}) .extend({'reversible': true});
;
this.languageAdmin = ko.observable('') this.languageAdmin = ko.observable('')
.extend({'limitedList': this.languagesAdmin}) .extend({'limitedList': this.languagesAdmin})
.extend({'reversible': true}) .extend({'reversible': true});
;
this.userLanguage = ko.observable(''); this.userLanguage = ko.observable('');
this.userLanguageAdmin = ko.observable(''); this.userLanguageAdmin = ko.observable('');
@ -37,8 +30,7 @@
{ {
var var
aLanguages = Settings.appSettingsGet('languages'), aLanguages = Settings.appSettingsGet('languages'),
aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin') aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin');
;
this.languages(Utils.isArray(aLanguages) ? aLanguages : []); this.languages(Utils.isArray(aLanguages) ? aLanguages : []);
this.languagesAdmin(Utils.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []); this.languagesAdmin(Utils.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
@ -51,5 +43,3 @@
}; };
module.exports = new LanguageStore(); module.exports = new LanguageStore();
}());

View file

@ -1,11 +1,5 @@
(function () { var ko = require('ko');
'use strict';
var
ko = require('ko')
;
/** /**
* @constructor * @constructor
@ -107,5 +101,3 @@
}; };
module.exports = new SocialStore(); module.exports = new SocialStore();
}());

View file

@ -1,15 +1,10 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -35,5 +30,3 @@
}; };
module.exports = new ThemeStore(); module.exports = new ThemeStore();
}());

View file

@ -1,14 +1,9 @@
(function () {
'use strict';
var var
_ = require('_'), _ = require('_'),
ko = require('ko'), ko = require('ko'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -59,7 +54,7 @@
}; };
/** /**
* @return {boolean} * @returns {boolean}
*/ */
AccountUserStore.prototype.isRootAccount = function() AccountUserStore.prototype.isRootAccount = function()
{ {
@ -67,5 +62,3 @@
}; };
module.exports = new AccountUserStore(); module.exports = new AccountUserStore();
}());

View file

@ -21,8 +21,6 @@ class AppUserStore extends AbstractAppStore
switch (value) switch (value)
{ {
default:
break;
case Focused.MessageList: case Focused.MessageList:
keyScope(KeyState.MessageList); keyScope(KeyState.MessageList);
break; break;
@ -32,6 +30,8 @@ class AppUserStore extends AbstractAppStore
case Focused.FolderList: case Focused.FolderList:
keyScope(KeyState.FolderList); keyScope(KeyState.FolderList);
break; break;
default:
break;
} }
}, this); }, this);

View file

@ -1,13 +1,8 @@
(function () {
'use strict';
var var
ko = require('ko'), ko = require('ko'),
Settings = require('Storage/Settings') Settings = require('Storage/Settings');
;
/** /**
* @constructor * @constructor
@ -39,5 +34,3 @@
}; };
module.exports = new ContactUserStore(); module.exports = new ContactUserStore();
}());

Some files were not shown because too many files have changed in this diff Show more