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

View file

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

View file

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

View file

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

View file

@ -14,6 +14,11 @@ window.__rlah_set = () => setHash();
window.__rlah_clear = () => clearHash();
window.__rlah_data = () => RL_APP_DATA_STORAGE;
/**
* @param {string} id
* @param {string} name
* @returns {string}
*/
function getComputedStyle(id, name)
{
var element = window.document.getElementById(id);
@ -21,16 +26,27 @@ function getComputedStyle(id, name)
(window.getComputedStyle ? window.getComputedStyle(element, null).getPropertyValue(name) : null);
}
/**
* @param {string} styles
* @returns {void}
*/
function includeStyle(styles)
{
window.document.write(unescape('%3Csty' + 'le%3E' + styles + '"%3E%3C/' + 'sty' + 'le%3E'));
}
/**
* @param {string} src
* @returns {void}
*/
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'));
}
/**
* @returns {boolean}
*/
function includeLayout()
{
const app = window.document.getElementById('rl-app');
@ -49,18 +65,25 @@ function includeLayout()
return false;
}
function includeAppScr(data = {})
/**
* @param {mixed} data
* @returns {void}
*/
function includeAppScr({admin = false, mobile = false, mobileDevice = false})
{
let src = './?/';
src += data.admin ? 'Admin' : '';
src += admin ? 'Admin' : '';
src += 'AppData@';
src += data.mobile ? 'mobile' : 'no-mobile';
src += data.mobileDevice ? '-1' : '-0';
src += mobile ? 'mobile' : 'no-mobile';
src += mobileDevice ? '-1' : '-0';
src += '/';
includeScr(src + (window.__rlah ? window.__rlah() || '0' : '0') + '/' + window.Math.random().toString().substr(2) + '/');
}
/**
* @returns {object}
*/
function getRainloopBootData()
{
let result = {};
@ -74,13 +97,16 @@ function getRainloopBootData()
return result;
}
/**
* @param {string} additionalError
* @returns {void}
*/
function showError(additionalError)
{
const
oR = window.document.getElementById('rl-loading'),
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)
{
@ -104,12 +130,15 @@ function showError(additionalError)
}
}
/**
* @param {string} description
* @returns {void}
*/
function showDescriptionAndLoading(description)
{
const
oE = window.document.getElementById('rl-loading'),
oElDesc = window.document.getElementById('rl-loading-desc')
;
oElDesc = window.document.getElementById('rl-loading-desc');
if (oElDesc && description)
{
@ -125,6 +154,11 @@ function showDescriptionAndLoading(description)
}
}
/**
* @param {boolean} withError
* @param {string} additionalError
* @returns {void}
*/
function runMainBoot(withError, additionalError)
{
if (window.__APP_BOOT && !withError)
@ -139,6 +173,9 @@ function runMainBoot(withError, additionalError)
}
}
/**
* @returns {void}
*/
function runApp()
{
const appData = window.__rlah_data();
@ -162,16 +199,14 @@ function runApp()
window.$('#rl-bg').attr('style', 'background-image: none !important;')
.backstretch(appData.IncludeBackground.replace('{{USER}}',
(window.__rlah ? (window.__rlah() || '0') : '0')), {fade: 100, centeredX: true, centeredY: true})
.removeAttr('style')
;
.removeAttr('style');
}
}
}),
common = window.Promise.all([
window.jassl(appData.TemplatesLink),
window.jassl(appData.LangLink)
])
;
]);
window.Promise.all([libs, common])
.then(() => {
@ -193,8 +228,7 @@ function runApp()
window.__initEditor();
window.__initEditor = null;
}
})
;
});
}
else
{
@ -202,6 +236,10 @@ function runApp()
}
}
/**
* @param {mixed} data
* @returns {void}
*/
window.__initAppData = function(data) {
RL_APP_DATA_STORAGE = data;
@ -226,6 +264,9 @@ window.__initAppData = function(data) {
runApp();
};
/**
* @returns {void}
*/
window.__runBoot = function() {
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 Settings from 'Storage/Settings';
let FOLDERS_CACHE = {};
let FOLDERS_NAME_CACHE = {};
let FOLDERS_HASH_CACHE = {};
let FOLDERS_UID_NEXT_CACHE = {};
let MESSAGE_FLAGS_CACHE = {};
let FOLDERS_CACHE = {},
FOLDERS_NAME_CACHE = {},
FOLDERS_HASH_CACHE = {},
FOLDERS_UID_NEXT_CACHE = {},
MESSAGE_FLAGS_CACHE = {},
NEW_MESSAGE_CACHE = {},
inboxFolderName = '';
let NEW_MESSAGE_CACHE = {};
let REQUESTED_MESSAGE_CACHE = {};
const capaGravatar = Settings.capa(Capa.Gravatar);
let inboxFolderName = '';
const REQUESTED_MESSAGE_CACHE = {},
capaGravatar = Settings.capa(Capa.Gravatar);
/**
* @returns {void}
*/
export function clear()
{
FOLDERS_CACHE = {};
@ -29,7 +31,7 @@ export function clear()
/**
* @param {string} email
* @param {Function} callback
* @return {string}
* @returns {string}
*/
export function getUserPic(email, callback)
{
@ -40,7 +42,7 @@ export function getUserPic(email, callback)
/**
* @param {string} folderFullNameRaw
* @param {string} uid
* @return {string}
* @returns {string}
*/
export function getMessageKey(folderFullNameRaw, uid)
{
@ -59,7 +61,7 @@ export function addRequestedMessage(folder, uid)
/**
* @param {string} folder
* @param {string} uid
* @return {boolean}
* @returns {boolean}
*/
export function hasRequestedMessage(folder, uid)
{
@ -89,13 +91,16 @@ export function hasNewMessageAndRemoveFromCache(folderFullNameRaw, uid)
return false;
}
/**
* @returns {void}
*/
export function clearNewMessageCache()
{
NEW_MESSAGE_CACHE = {};
}
/**
* @return {string}
* @returns {string}
*/
export function getFolderInboxName()
{
@ -104,7 +109,7 @@ export function getFolderInboxName()
/**
* @param {string} folderHash
* @return {string}
* @returns {string}
*/
export function getFolderFullNameRaw(folderHash)
{
@ -126,7 +131,7 @@ export function setFolderFullNameRaw(folderHash, folderFullNameRaw)
/**
* @param {string} folderFullNameRaw
* @return {string}
* @returns {string}
*/
export function getFolderHash(folderFullNameRaw)
{
@ -147,7 +152,7 @@ export function setFolderHash(folderFullNameRaw, folderHash)
/**
* @param {string} folderFullNameRaw
* @return {string}
* @returns {string}
*/
export function getFolderUidNext(folderFullNameRaw)
{
@ -165,7 +170,7 @@ export function setFolderUidNext(folderFullNameRaw, uidNext)
/**
* @param {string} folderFullNameRaw
* @return {?FolderModel}
* @returns {?FolderModel}
*/
export function getFolderFromCacheList(folderFullNameRaw)
{
@ -192,7 +197,7 @@ export function removeFolderFromCacheList(folderFullNameRaw)
/**
* @param {string} folderFullName
* @param {string} uid
* @return {?Array}
* @returns {?Array}
*/
export function getMessageFlagsFromCache(folderFullName, uid)
{
@ -233,14 +238,13 @@ export function initMessageFlagsFromCache(message)
{
const
uid = message.uid,
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid)
;
flags = getMessageFlagsFromCache(message.folderFullNameRaw, uid);
if (flags && 0 < flags.length)
{
message.flagged(!!flags[1]);
if (!message.__simple_message__)
if (!message.isSimpleMessage)
{
message.unseen(!!flags[0]);
message.answered(!!flags[2]);
@ -334,6 +338,7 @@ export function storeMessageFlagsToCacheBySetAction(folder, uid, setAction)
case MessageSetAction.UnsetFlag:
flags[1] = false;
break;
// no default
}
setMessageFlagsToCache(folder, uid, flags);

View file

@ -8,14 +8,13 @@ class CookieDriver
/**
* @param {string} key
* @param {*} data
* @return {boolean}
* @returns {boolean}
*/
set(key, data) {
let
result = false,
storageResult = null
;
storageResult = null;
try
{
@ -41,7 +40,7 @@ class CookieDriver
/**
* @param {string} key
* @return {*}
* @returns {*}
*/
get(key) {
@ -51,8 +50,7 @@ class CookieDriver
{
const
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;
}
@ -62,7 +60,7 @@ class CookieDriver
}
/**
* @return {boolean}
* @returns {boolean}
*/
static supported() {
return !!(window.navigator && window.navigator.cookieEnabled);

View file

@ -8,14 +8,13 @@ class LocalStorageDriver
/**
* @param {string} key
* @param {*} data
* @return {boolean}
* @returns {boolean}
*/
set(key, data) {
let
result = false,
storageResult = null
;
storageResult = null;
try
{
@ -38,7 +37,7 @@ class LocalStorageDriver
/**
* @param {string} key
* @return {*}
* @returns {*}
*/
get(key) {
@ -48,8 +47,7 @@ class LocalStorageDriver
{
const
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;
}
@ -59,7 +57,7 @@ class LocalStorageDriver
}
/**
* @return {boolean}
* @returns {boolean}
*/
static supported() {
return !!window.localStorage;

View file

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

View file

@ -6,6 +6,7 @@ import * as Settings from 'Storage/Settings';
class HtmlEditor
{
/**
* @constructor
* @param {Object} element
* @param {Function=} onBlur
* @param {Function=} onReady
@ -47,7 +48,7 @@ class HtmlEditor
}
/**
* @return {boolean}
* @returns {boolean}
*/
isHtml() {
return this.editor ? 'wysiwyg' === this.editor.mode : false;
@ -70,7 +71,7 @@ class HtmlEditor
}
/**
* @return {boolean}
* @returns {boolean}
*/
checkDirty() {
return this.editor ? this.editor.checkDirty() : false;
@ -85,7 +86,7 @@ class HtmlEditor
/**
* @param {string} text
* @return {string}
* @returns {string}
*/
clearSignatureSigns(text) {
return text.replace(/(\u200C|\u0002)/g, '');
@ -94,7 +95,7 @@ class HtmlEditor
/**
* @param {boolean=} wrapIsHtml = false
* @param {boolean=} clearSignatureSigns = false
* @return {string}
* @returns {string}
*/
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;">' +
this.editor.getData() + '</div>' : this.editor.getData();
}
} catch (e) {/* eslint-disable-line no-empty */}
}
catch (e) {/* eslint-disable-line no-empty */}
if (clearSignatureSigns)
{
@ -127,7 +129,7 @@ class HtmlEditor
/**
* @param {boolean=} wrapIsHtml = false
* @param {boolean=} clearSignatureSigns = false
* @return {string}
* @returns {string}
*/
getDataWithHtmlMark(wrapIsHtml = false, clearSignatureSigns = false) {
return (this.isHtml() ? ':HTML:' : '') + this.getData(wrapIsHtml, clearSignatureSigns);
@ -151,7 +153,8 @@ class HtmlEditor
this.editor.setMode('plain');
}
}
} catch (e) {/* eslint-disable-line no-empty */}
}
catch (e) {/* eslint-disable-line no-empty */}
if (resize)
{
@ -180,7 +183,8 @@ class HtmlEditor
try {
this.editor.setData(html);
} catch (e) {/* eslint-disable-line no-empty */}
}
catch (e) {/* eslint-disable-line no-empty */}
if (focus)
{
@ -195,7 +199,8 @@ class HtmlEditor
try {
this.editor.setData(
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 {
this.editor.setData(plain);
} catch (e) {/* eslint-disable-line no-empty */}
}
catch (e) {/* eslint-disable-line no-empty */}
}
if (focus)
@ -231,8 +237,7 @@ class HtmlEditor
config = oHtmlEditorDefaultConfig,
language = Settings.settingsGet('Language'),
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons')
;
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons');
if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited)
{
@ -295,8 +300,7 @@ class HtmlEditor
var
id = event.data.dataTransfer.id,
imageId = `[img=${id}]`,
reader = new window.FileReader()
;
reader = new window.FileReader();
reader.onloadend = () => {
if (reader.result)
@ -333,8 +337,7 @@ class HtmlEditor
}
});
}
;
};
if (window.CKEDITOR)
{
@ -352,7 +355,8 @@ class HtmlEditor
{
try {
this.editor.focus();
} catch (e) {/* eslint-disable-line no-empty */}
}
catch (e) {/* eslint-disable-line no-empty */}
}
}
@ -361,7 +365,8 @@ class HtmlEditor
{
try {
return !!this.editor.focusManager.hasFocus;
} catch (e) {/* eslint-disable-line no-empty */}
}
catch (e) {/* eslint-disable-line no-empty */}
}
return false;
@ -372,7 +377,8 @@ class HtmlEditor
{
try {
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 {
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 {
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 * as Settings from 'Storage/Settings';
const ROOT = './';
const HASH_PREFIX = '#/';
const SERVER_PREFIX = './?';
const SUB_QUERY_PREFIX = '&q[]=';
const
ROOT = './',
HASH_PREFIX = '#/',
SERVER_PREFIX = './?',
SUB_QUERY_PREFIX = '&q[]=',
const VERSION = Settings.appSettingsGet('version');
VERSION = Settings.appSettingsGet('version'),
const WEB_PREFIX = Settings.appSettingsGet('webPath') || '';
const VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/';
const STATIC_PREFIX = VERSION_PREFIX + 'static/';
WEB_PREFIX = Settings.appSettingsGet('webPath') || '',
VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/',
STATIC_PREFIX = VERSION_PREFIX + 'static/',
const ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse');
const ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin';
ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse'),
ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin';
let AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
/**
* @returns {void}
*/
export function populateAuthSuffix()
{
AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
}
/**
* @return {string}
* @returns {string}
*/
export function subQueryPrefix()
{
@ -34,7 +38,7 @@ export function subQueryPrefix()
/**
* @param {string=} startupUrl
* @return {string}
* @returns {string}
*/
export function root(startupUrl = '')
{
@ -42,7 +46,7 @@ export function root(startupUrl = '')
}
/**
* @return {string}
* @returns {string}
*/
export function rootAdmin()
{
@ -51,7 +55,7 @@ export function rootAdmin()
/**
* @param {boolean=} mobile = false
* @return {string}
* @returns {string}
*/
export function rootUser(mobile = false)
{
@ -62,7 +66,7 @@ export function rootUser(mobile = false)
* @param {string} type
* @param {string} download
* @param {string=} customSpecSuffix
* @return {string}
* @returns {string}
*/
export function attachmentRaw(type, download, customSpecSuffix)
{
@ -73,7 +77,7 @@ export function attachmentRaw(type, download, customSpecSuffix)
/**
* @param {string} download
* @param {string=} customSpecSuffix
* @return {string}
* @returns {string}
*/
export function attachmentDownload(download, customSpecSuffix)
{
@ -83,7 +87,7 @@ export function attachmentDownload(download, customSpecSuffix)
/**
* @param {string} download
* @param {string=} customSpecSuffix
* @return {string}
* @returns {string}
*/
export function attachmentPreview(download, customSpecSuffix)
{
@ -93,7 +97,7 @@ export function attachmentPreview(download, customSpecSuffix)
/**
* @param {string} download
* @param {string=} customSpecSuffix
* @return {string}
* @returns {string}
*/
export function attachmentThumbnailPreview(download, customSpecSuffix)
{
@ -103,7 +107,7 @@ export function attachmentThumbnailPreview(download, customSpecSuffix)
/**
* @param {string} download
* @param {string=} customSpecSuffix
* @return {string}
* @returns {string}
*/
export function attachmentPreviewAsPlain(download, customSpecSuffix)
{
@ -113,7 +117,7 @@ export function attachmentPreviewAsPlain(download, customSpecSuffix)
/**
* @param {string} download
* @param {string=} customSpecSuffix
* @return {string}
* @returns {string}
*/
export function attachmentFramed(download, customSpecSuffix)
{
@ -122,7 +126,7 @@ export function attachmentFramed(download, customSpecSuffix)
/**
* @param {string} type
* @return {string}
* @returns {string}
*/
export function serverRequest(type)
{
@ -130,7 +134,7 @@ export function serverRequest(type)
}
/**
* @return {string}
* @returns {string}
*/
export function upload()
{
@ -138,7 +142,7 @@ export function upload()
}
/**
* @return {string}
* @returns {string}
*/
export function uploadContacts()
{
@ -146,7 +150,7 @@ export function uploadContacts()
}
/**
* @return {string}
* @returns {string}
*/
export function uploadBackground()
{
@ -154,7 +158,7 @@ export function uploadBackground()
}
/**
* @return {string}
* @returns {string}
*/
export function append()
{
@ -163,7 +167,7 @@ export function append()
/**
* @param {string} email
* @return {string}
* @returns {string}
*/
export function change(email)
{
@ -172,7 +176,7 @@ export function change(email)
/**
* @param {string} add
* @return {string}
* @returns {string}
*/
export function ajax(add)
{
@ -181,7 +185,7 @@ export function ajax(add)
/**
* @param {string} requestHash
* @return {string}
* @returns {string}
*/
export function messageViewLink(requestHash)
{
@ -190,7 +194,7 @@ export function messageViewLink(requestHash)
/**
* @param {string} requestHash
* @return {string}
* @returns {string}
*/
export function messageDownloadLink(requestHash)
{
@ -199,7 +203,7 @@ export function messageDownloadLink(requestHash)
/**
* @param {string} email
* @return {string}
* @returns {string}
*/
export function avatarLink(email)
{
@ -208,7 +212,7 @@ export function avatarLink(email)
/**
* @param {string} hash
* @return {string}
* @returns {string}
*/
export function publicLink(hash)
{
@ -217,7 +221,7 @@ export function publicLink(hash)
/**
* @param {string} hash
* @return {string}
* @returns {string}
*/
export function userBackground(hash)
{
@ -225,7 +229,7 @@ export function userBackground(hash)
}
/**
* @return {string}
* @returns {string}
*/
export function phpInfo()
{
@ -235,7 +239,7 @@ export function phpInfo()
/**
* @param {string} lang
* @param {boolean} isAdmin
* @return {string}
* @returns {string}
*/
export function langLink(lang, isAdmin)
{
@ -243,7 +247,7 @@ export function langLink(lang, isAdmin)
}
/**
* @return {string}
* @returns {string}
*/
export function exportContactsVcf()
{
@ -251,7 +255,7 @@ export function exportContactsVcf()
}
/**
* @return {string}
* @returns {string}
*/
export function exportContactsCsv()
{
@ -260,7 +264,7 @@ export function exportContactsCsv()
/**
* @param {boolean} xauth = false
* @return {string}
* @returns {string}
*/
export function socialGoogle(xauth = false)
{
@ -269,7 +273,7 @@ export function socialGoogle(xauth = false)
}
/**
* @return {string}
* @returns {string}
*/
export function socialTwitter()
{
@ -278,7 +282,7 @@ export function socialTwitter()
}
/**
* @return {string}
* @returns {string}
*/
export function socialFacebook()
{
@ -288,7 +292,7 @@ export function socialFacebook()
/**
* @param {string} path
* @return {string}
* @returns {string}
*/
export function staticPrefix(path)
{
@ -296,7 +300,7 @@ export function staticPrefix(path)
}
/**
* @return {string}
* @returns {string}
*/
export function emptyContactPic()
{
@ -305,7 +309,7 @@ export function emptyContactPic()
/**
* @param {string} fileName
* @return {string}
* @returns {string}
*/
export function sound(fileName)
{
@ -313,7 +317,7 @@ export function sound(fileName)
}
/**
* @return {string}
* @returns {string}
*/
export function notificationMailIcon()
{
@ -321,7 +325,7 @@ export function notificationMailIcon()
}
/**
* @return {string}
* @returns {string}
*/
export function openPgpJs()
{
@ -329,7 +333,7 @@ export function openPgpJs()
}
/**
* @return {string}
* @returns {string}
*/
export function openPgpWorkerJs()
{
@ -337,7 +341,7 @@ export function openPgpWorkerJs()
}
/**
* @return {string}
* @returns {string}
*/
export function openPgpWorkerPath()
{
@ -346,7 +350,7 @@ export function openPgpWorkerPath()
/**
* @param {string} theme
* @return {string}
* @returns {string}
*/
export function themePreviewLink(theme)
{
@ -362,7 +366,7 @@ export function themePreviewLink(theme)
/**
* @param {string} inboxFolderName = 'INBOX'
* @return {string}
* @returns {string}
*/
export function inbox(inboxFolderName = 'INBOX')
{
@ -371,7 +375,7 @@ export function inbox(inboxFolderName = 'INBOX')
/**
* @param {string=} screenName = ''
* @return {string}
* @returns {string}
*/
export function settings(screenName = '')
{
@ -379,7 +383,7 @@ export function settings(screenName = '')
}
/**
* @return {string}
* @returns {string}
*/
export function about()
{
@ -388,12 +392,13 @@ export function about()
/**
* @param {string} screenName
* @return {string}
* @returns {string}
*/
export function admin(screenName)
{
let result = HASH_PREFIX;
switch (screenName) {
switch (screenName)
{
case 'AdminDomains':
result += 'domains';
break;
@ -403,6 +408,7 @@ export function admin(screenName)
case 'AdminLicensing':
result += 'licensing';
break;
// no default
}
return result;
@ -413,7 +419,7 @@ export function admin(screenName)
* @param {number=} page = 1
* @param {string=} search = ''
* @param {string=} threadUid = ''
* @return {string}
* @returns {string}
*/
export function mailBox(folder, page = 1, search = '', threadUid = '')
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,6 +7,7 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstractInput extends AbstractComponent
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {
@ -32,10 +33,9 @@ class AbstractInput extends AbstractComponent
var
size = ko.unwrap(this.size),
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);

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,8 @@
import {$} from 'common';
let
cachedUrl = null,
getUtl = () => {
let cachedUrl = null;
const getUrl = () => {
if (!cachedUrl)
{
const version = $('#rlAppVersion').attr('content') || '0.0.0';
@ -11,18 +10,16 @@ let
}
return cachedUrl;
}
;
};
module.exports = {
template: '<b></b>',
viewModel: {
createViewModel: (params, componentInfo) => {
createViewModel: ({icon = 'null'}, componentInfo) => {
if (componentInfo && componentInfo.element)
{
const icon = params.icon || 'null';
$(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
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

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

123
dev/External/ko.js vendored
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,24 +1,10 @@
(function () {
'use strict';
var
window = require('window'),
_ = 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'),
AbstractAjaxPromises = require('Promises/AbstractAjax')
;
AbstractAjaxPromises = require('Promises/AbstractAjax');
/**
* @constructor
@ -41,14 +27,14 @@
});
};
UserAjaxUserPromises.prototype._folders_timeout_ = 0;
UserAjaxUserPromises.prototype.foldersTimeout = 0;
UserAjaxUserPromises.prototype.foldersReloadWithTimeout = function(fTrigger)
{
this.setTrigger(fTrigger, true);
var self = this;
window.clearTimeout(this._folders_timeout_);
this._folders_timeout_ = window.setTimeout(function () {
window.clearTimeout(this.foldersTimeout);
this.foldersTimeout = window.setTimeout(function() {
self.foldersReload(fTrigger);
}, 500);
};
@ -90,5 +76,3 @@
};
module.exports = new UserAjaxUserPromises();
}());

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ const driver = SupportedStorageDriver ? new SupportedStorageDriver() : null;
/**
* @param {number} key
* @param {*} data
* @return {boolean}
* @returns {boolean}
*/
export function set(key, data)
{
@ -21,7 +21,7 @@ export function set(key, data)
/**
* @param {number} key
* @return {*}
* @returns {*}
*/
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 getTimestamp = () => {
let time = __get(TIME_KEY, 0);
const time = __get(TIME_KEY, 0);
return time ? (window.parseInt(time, 10) || 0) : 0;
};
/**
* @return {string}
* @returns {string}
*/
export function getHash()
{
return __get(STORAGE_KEY);
}
/**
* @returns {void}
*/
export function setHash()
{
const
key = 'AuthAccountHash',
appData = window.__rlah_data()
;
appData = window.__rlah_data();
__set(STORAGE_KEY, appData && appData[key] ? appData[key] : '');
setTimestamp();
}
/**
* @returns {void}
*/
export function clearHash()
{
__set(STORAGE_KEY, '');
setTimestamp();
}
/**
* @returns {boolean}
*/
export function checkTimestamp()
{
if (timestamp() > getTimestamp() + 1000 * 60 * 60) // 60m

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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