Code refactoring (5) (es5 -> es2015)

This commit is contained in:
RainLoop Team 2016-07-16 00:29:42 +03:00
parent c148e19ea3
commit cec53b111f
68 changed files with 2210 additions and 2472 deletions

View file

@ -8,8 +8,7 @@ import {trim} from 'Common/Utils';
class Audio
{
constructor()
{
constructor() {
this.notificator = null;
this.supportedMp3 = false;

View file

@ -158,8 +158,8 @@ const Base64 = {
return string;
}
};
/* eslint-enable */
export const decode = Base64.decode;
export const encode = Base64.encode;
export const urlsafe_encode = Base64.urlsafe_encode;
/* eslint-enable */

View file

@ -10,10 +10,12 @@ import {getHash, setHash, clearHash} from 'Storage/RainLoop';
let RL_APP_DATA_STORAGE = null;
/* eslint-disable */
window.__rlah = () => getHash();
window.__rlah_set = () => setHash();
window.__rlah_clear = () => clearHash();
window.__rlah_data = () => RL_APP_DATA_STORAGE;
/* eslint-enable */
/**
* @param {string} id

View file

@ -7,8 +7,7 @@ import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
class LocalStorageDriver
{
constructor()
{
constructor() {
this.s = window.localStorage || null;
}

View file

@ -82,15 +82,20 @@ export const bAnimationSupported = !bMobileDevice && $html.hasClass('csstransiti
*/
export const bXMLHttpRequestSupported = !!window.XMLHttpRequest;
/**
* @type {boolean}
*/
export const bIsHttps = window.document && window.document.location ? 'https:' === window.document.location.protocol : false;
/**
* @type {Object}
*/
export const oHtmlEditorDefaultConfig = {
title: false,
stylesSet: false,
customConfig: '',
contentsCss: '',
toolbarGroups: [
'title': false,
'stylesSet': false,
'customConfig': '',
'contentsCss': '',
'toolbarGroups': [
{name: 'spec'},
{name: 'styles'},
{name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi']},
@ -102,54 +107,54 @@ export const oHtmlEditorDefaultConfig = {
{name: 'others'}
],
removePlugins: 'liststyle',
removeButtons: 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source',
removeDialogTabs: 'link:advanced;link:target;image:advanced;images:advanced',
'removePlugins': 'liststyle',
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source',
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
extraPlugins: 'plain,signature',
'extraPlugins': 'plain,signature',
allowedContent: true,
extraAllowedContent: true,
'allowedContent': true,
'extraAllowedContent': true,
fillEmptyBlocks: false,
ignoreEmptyParagraph: true,
disableNativeSpellChecker: false,
'fillEmptyBlocks': false,
'ignoreEmptyParagraph': true,
'disableNativeSpellChecker': false,
font_defaultLabel: 'Arial',
fontSize_defaultLabel: '13',
fontSize_sizes: '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
'font_defaultLabel': 'Arial',
'fontSize_defaultLabel': '13',
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
};
/**
* @type {Object}
*/
export const oHtmlEditorLangsMap = {
bg_bg: 'bg',
de_de: 'de',
el_gr: 'el',
es_es: 'es',
fr_fr: 'fr',
hu_hu: 'hu',
is_is: 'is',
it_it: 'it',
ja_jp: 'ja',
ko_kr: 'ko',
lt_lt: 'lt',
lv_lv: 'lv',
nl_nl: 'nl',
bg_no: 'no',
pl_pl: 'pl',
pt_pt: 'pt',
pt_br: 'pt-br',
ro_ro: 'ro',
ru_ru: 'ru',
sk_sk: 'sk',
sl_si: 'sl',
sv_se: 'sv',
tr_tr: 'tr',
uk_ua: 'ru',
zh_tw: 'zh',
zh_cn: 'zh-cn'
'bg_bg': 'bg',
'de_de': 'de',
'el_gr': 'el',
'es_es': 'es',
'fr_fr': 'fr',
'hu_hu': 'hu',
'is_is': 'is',
'it_it': 'it',
'ja_jp': 'ja',
'ko_kr': 'ko',
'lt_lt': 'lt',
'lv_lv': 'lv',
'nl_nl': 'nl',
'bg_no': 'no',
'pl_pl': 'pl',
'pt_pt': 'pt',
'pt_br': 'pt-br',
'ro_ro': 'ro',
'ru_ru': 'ru',
'sk_sk': 'sk',
'sl_si': 'sl',
'sv_se': 'sv',
'tr_tr': 'tr',
'uk_ua': 'ru',
'zh_tw': 'zh',
'zh_cn': 'zh-cn'
};
/**

View file

@ -163,12 +163,12 @@ export function i18nToNodes(elements, animate = false)
if (animate && bAnimationSupported)
{
$('.i18n-animation[data-i18n]', elements).letterfx({
fx: 'fall fade',
backwards: false,
timing: 50,
fx_duration: '50ms',
letter_end: 'restore',
element_end: 'restore'
'fx': 'fall fade',
'backwards': false,
'timing': 50,
'fx_duration': '50ms',
'letter_end': 'restore',
'element_end': 'restore'
});
}
});

View file

@ -145,7 +145,10 @@ export function encodeURI(url)
*/
export function simpleQueryParser(queryString)
{
let index = 0, len = 0, temp = null;
let
index = 0,
len = 0,
temp = null;
const
queries = queryString.split('&'),
@ -498,7 +501,7 @@ export function delegateRun(object, methodName, params, delay = 0)
/**
* @param {?} event
*/
export function kill_CtrlA_CtrlS(event)
export function killCtrlACtrlS(event)
{
event = event || window.event;
if (event && event.ctrlKey && !event.shiftKey && !event.altKey)
@ -1055,8 +1058,8 @@ export function plainToHtml(plain, findEmailAndLinksInText = false)
return findEmailAndLinksInText ? findEmailAndLinks(plain) : plain;
}
window.rainloop_Utils_htmlToPlain = htmlToPlain;
window.rainloop_Utils_plainToHtml = plainToHtml;
window['rainloop_Utils_htmlToPlain'] = htmlToPlain; // eslint-disable-line dot-notation
window['rainloop_Utils_plainToHtml'] = plainToHtml; // eslint-disable-line dot-notation
/**
* @param {Array} aSystem
@ -1195,7 +1198,10 @@ export function folderListOptionsBuilder(aSystem, aList, aDisabled, aHeaderLines
*/
export function selectElement(element)
{
let sel = null, range = null;
let
sel = null,
range = null;
if (window.getSelection)
{
sel = window.getSelection();