Back from Typescript to ES2015

This commit is contained in:
RainLoop Team 2016-06-27 21:14:33 +03:00
parent a74a92638a
commit 40b3f929e9
16 changed files with 305 additions and 358 deletions

View file

@ -2,16 +2,17 @@
// Base64 encode / decode
// http://www.webtoolkit.info/
const BASE_64_CHR: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
const BASE_64_CHR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/* eslint-disable */
const Base64 = {
// public method for urlsafe encoding
urlsafe_encode: (input: string): string => Base64.encode(input)
urlsafe_encode: (input) => Base64.encode(input)
.replace(/[+]/g, '-').replace(/[\/]/g, '_').replace(/[=]/g, '.'),
// public method for encoding
encode: (input: string): string => {
encode: (input) => {
let
output = '',
@ -50,7 +51,7 @@ const Base64 = {
},
// public method for decoding
decode: (input: string): string => {
decode: (input) => {
let
output = '',
@ -88,7 +89,7 @@ const Base64 = {
},
// private method for UTF-8 encoding
_utf8_encode: (string: string): string => {
_utf8_encode: (string) => {
string = string.replace(/\r\n/g, "\n");
@ -124,7 +125,7 @@ const Base64 = {
},
// private method for UTF-8 decoding
_utf8_decode: (utftext: string): string => {
_utf8_decode: (utftext) => {
let
string = '',
@ -161,6 +162,7 @@ const Base64 = {
return string;
}
};
/* eslint-enable */
export const decode = Base64.decode;
export const encode = Base64.encode;

43
dev/Common/Consts.jsx Normal file
View file

@ -0,0 +1,43 @@
/* eslint max-len: 0 */
export const MESSAGES_PER_PAGE = 20;
export const MESSAGES_PER_PAGE_VALUES = [10, 20, 30, 50, 100];
export const CONTACTS_PER_PAGE = 50;
export const DEFAULT_AJAX_TIMEOUT = 30000;
export const SEARCH_AJAX_TIMEOUT = 300000;
export const SEND_MESSAGE_AJAX_TIMEOUT = 300000;
export const SAVE_MESSAGE_AJAX_TIMEOUT = 200000;
export const CONTACTS_SYNC_AJAX_TIMEOUT = 200000;
export const UNUSED_OPTION_VALUE = '__UNUSE__';
export const CLIENT_SIDE_STORAGE_INDEX_NAME = 'rlcsc';
export const IMAP_DEFAULT_PORT = 143;
export const IMAP_DEFAULT_SECURE_PORT = 993;
export const SMTP_DEFAULT_PORT = 25;
export const SMTP_DEFAULT_SECURE_PORT = 465;
export const SIEVE_DEFAULT_PORT = 4190;
export const MESSAGE_BODY_CACHE_LIMIT = 15;
export const AJAX_ERROR_LIMIT = 7;
export const TOKEN_ERROR_LIMIT = 10;
export const RAINLOOP_TRIAL_KEY = 'RAINLOOP-TRIAL-KEY';
export const DATA_IMAGE_USER_DOT_PIC = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAYAAABXuSs3AAAHHklEQVRoQ7VZW08bVxCeXRuwIbTGXIwNtBBaqjwgVUiR8lDlbza9qe1DpVZ9aNQ/0KpPeaJK07SpcuEeCEmUAObm21bfrL9lONjexSYrWfbunj37zXdmvpkz9oIgCKTD0Wg0xPd94TDP83Q0zvWa50vzklSrdanVanqf4/D84GBGr+F+Op3S8fqoJxLOdnZgTvsO/nYhenHA+UC7CWF1uXwkb9++ldPTUwVerVbVqFQqpR8YPjQ0JCMjI5LNDijoRgP3PQVu5+5Eor2XGLg7IV4GkIdHJ/LmzRs5ODiIwNbrdR0O0GCcq4Xz4eFhmZyclP7+tDQaIik/BG5XKQn4SwG3zJTLZXn9+rUclI8UHD5YVoDDN8bSzXhONwL48fFxGR4eilzFZT1uFRIB5yT8BqCdnR3Z3d0VP9Un6XRawYJpggVrZBv38ME4XKtUKnLt2jUplUoy1PR/l3U7T6sVSAQcgMAkj8PDQ9ne3pajoyMRL7zeKsYZWHgWYDGmv78/mmdwcFA+mJlSgziHDWrERrsjEXDXegTi1tZW+DLxI2bxIrqFNYTXyDyCFweMAHCwb8e4RnTNuOsqe3t7sra21pTD0Kct666E8XlcZyzw9/RUUXK5nK5oUinUQI6TQ3cynO/v78vq6qrKXCNwlTiJJpyNGc3nZHp6uqV2dwrQWOCtZBDAV1ZWwsQ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w1FyedF+83xG/2FNGCRpU4NjamMsn+OZ9xE5RXqdaDdPpib6RWCzuwKF9RxqI2AVNQBwQYJoK0wdBejnqtEikP3pfP51XjUTESl12FqJEKxsEorARYDD44ONTeID7YpsEnrRvQfWAI2e8WfDaTUSIwJ0iBCmFOtOUAHvVMPp/TPwvYFVYFIuP8l+DBgwdaa2Miqwa0GgYwfeMltovbDfh6c1vIgMYcliSsKv4IWFr6VDHxvldvBAH+1sA+cnl5WYOPmmr9ir+1l9I0Cgz0yjhXjfJJ0JROnmezWbl165ayr/5fqwcBNr7IfhjMqKcvESSM4eRcCasQ3bDNObmKPLdGUGpZsN24cUNLBm9zazu4d++e6qpNBFaTuUS26U5dpuR1CxyA7J9ddrMRqlz4pwLLYawymPd++/2PADt2ugcGwq9gCCdhQ96C6xWwa6j1ceuq+I0EhW0i8MAIVJfeL3d/DVD8EKi12P6/2S2jV/EccVB54O/ejz/9HGCpoBBMta5rXMXLu53D1XAwjhXwvvv+h4BAXVe4bOu3O3ChxF08LiZFG3fel199G9CH3fLyqv24NcB44MRhpdK788U3CpyKwsCw590xmfSpzsBt0Fqc3ud3vtZigxWcVZCklVpSiN0w3q5E/h9TGMIUuA3+EQAAAABJRU5ErkJggg==';
export const DATA_IMAGE_TRANSP_PIC = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';

View file

@ -1,42 +0,0 @@
export const MESSAGES_PER_PAGE: number = 20;
export const MESSAGES_PER_PAGE_VALUES: number[] = [10, 20, 30, 50, 100];
export const CONTACTS_PER_PAGE: number = 50;
export const DEFAULT_AJAX_TIMEOUT: number = 30000;
export const SEARCH_AJAX_TIMEOUT: number = 300000;
export const SEND_MESSAGE_AJAX_TIMEOUT: number = 300000;
export const SAVE_MESSAGE_AJAX_TIMEOUT: number = 200000;
export const CONTACTS_SYNC_AJAX_TIMEOUT: number = 200000;
export const UNUSED_OPTION_VALUE: string = '__UNUSE__';
export const CLIENT_SIDE_STORAGE_INDEX_NAME: string = 'rlcsc';
export const IMAP_DEFAULT_PORT: number = 143;
export const IMAP_DEFAULT_SECURE_PORT: number = 993;
export const SMTP_DEFAULT_PORT: number = 25;
export const SMTP_DEFAULT_SECURE_PORT: number = 465;
export const SIEVE_DEFAULT_PORT: number = 4190;
export const MESSAGE_BODY_CACHE_LIMIT: number = 15;
export const AJAX_ERROR_LIMIT: number = 7;
export const TOKEN_ERROR_LIMIT: number = 10;
export const RAINLOOP_TRIAL_KEY: string = 'RAINLOOP-TRIAL-KEY';
export const DATA_IMAGE_USER_DOT_PIC: string = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuCAYAAABXuSs3AAAHHklEQVRoQ7VZW08bVxCeXRuwIbTGXIwNtBBaqjwgVUiR8lDlbza9qe1DpVZ9aNQ/0KpPeaJK07SpcuEeCEmUAObm21bfrL9lONjexSYrWfbunj37zXdmvpkz9oIgCKTD0Wg0xPd94TDP83Q0zvWa50vzklSrdanVanqf4/D84GBGr+F+Op3S8fqoJxLOdnZgTvsO/nYhenHA+UC7CWF1uXwkb9++ldPTUwVerVbVqFQqpR8YPjQ0JCMjI5LNDijoRgP3PQVu5+5Eor2XGLg7IV4GkIdHJ/LmzRs5ODiIwNbrdR0O0GCcq4Xz4eFhmZyclP7+tDQaIik/BG5XKQn4SwG3zJTLZXn9+rUclI8UHD5YVoDDN8bSzXhONwL48fFxGR4eilzFZT1uFRIB5yT8BqCdnR3Z3d0VP9Un6XRawYJpggVrZBv38ME4XKtUKnLt2jUplUoy1PR/l3U7T6sVSAQcgMAkj8PDQ9ne3pajoyMRL7zeKsYZWHgWYDGmv78/mmdwcFA+mJlSgziHDWrERrsjEXDXegTi1tZW+DLxI2bxIrqFNYTXyDyCFweMAHCwb8e4RnTNuOsqe3t7sra21pTD0Kct666E8XlcZyzw9/RUUXK5nK5oUinUQI6TQ3cynO/v78vq6qrKXCNwlTi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Rq2j3FAb/zffT6zuxFXxsNzs3NTXn16lW4gYiW96w1FyedF+83xG/2FNGCRpU4NjamMsn+OZ9xE5RXqdaDdPpib6RWCzuwKF9RxqI2AVNQBwQYJoK0wdBejnqtEikP3pfP51XjUTESl12FqJEKxsEorARYDD44ONTeID7YpsEnrRvQfWAI2e8WfDaTUSIwJ0iBCmFOtOUAHvVMPp/TPwvYFVYFIuP8l+DBgwdaa2Miqwa0GgYwfeMltovbDfh6c1vIgMYcliSsKv4IWFr6VDHxvldvBAH+1sA+cnl5WYOPmmr9ir+1l9I0Cgz0yjhXjfJJ0JROnmezWbl165ayr/5fqwcBNr7IfhjMqKcvESSM4eRcCasQ3bDNObmKPLdGUGpZsN24cUNLBm9zazu4d++e6qpNBFaTuUS26U5dpuR1CxyA7J9ddrMRqlz4pwLLYawymPd++/2PADt2ugcGwq9gCCdhQ96C6xWwa6j1ceuq+I0EhW0i8MAIVJfeL3d/DVD8EKi12P6/2S2jV/EccVB54O/ejz/9HGCpoBBMta5rXMXLu53D1XAwjhXwvvv+h4BAXVe4bOu3O3ChxF08LiZFG3fel199G9CH3fLyqv24NcB44MRhpdK788U3CpyKwsCw590xmfSpzsBt0Fqc3ud3vtZigxWcVZCklVpSiN0w3q5E/h9TGMIUuA3+EQAAAABJRU5ErkJggg==';
export const DATA_IMAGE_TRANSP_PIC: string = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';

View file

@ -1,4 +1,6 @@
/* eslint quote-props: 0 */
/**
* @enum {string}
*/

View file

@ -1,5 +1,8 @@
const Mime: { [id: string]: string } = {
/* eslint key-spacing: 0 */
/* eslint quote-props: 0 */
const Mime = {
'eml' : 'message/rfc822',
'mime' : 'message/rfc822',
'txt' : 'text/plain',

View file

@ -1,202 +0,0 @@
import { Mime } from './Mime';
import { EventKeyCode } from './Enums';
interface IPage {
current: boolean,
name: string,
custom: boolean,
title: string,
value: string
};
export function computedPagenatorHelper(koCurrentPage: () => number, koPageCount: () => number)
{
return (): IPage[] => {
const
currentPage: number = koCurrentPage(),
pageCount: number = koPageCount(),
result: IPage[] = [],
fAdd = (index: number, push: boolean = true, customName: string = ''): void => {
const data: IPage = {
current: index === currentPage,
name: '' === customName ? index.toString() : customName.toString(),
custom: '' === customName ? false : true,
title: '' === customName ? '' : index.toString(),
value: index.toString()
};
if (push)
{
result.push(data);
}
else
{
result.unshift(data);
}
}
;
let
prev: number = 0,
next: number = 0,
limit: number = 2
;
if (1 < pageCount || (0 < pageCount && pageCount < currentPage))
{
if (pageCount < currentPage)
{
fAdd(pageCount);
prev = pageCount;
next = pageCount;
}
else
{
if (3 >= currentPage || pageCount - 2 <= currentPage)
{
limit += 2;
}
fAdd(currentPage);
prev = currentPage;
next = currentPage;
}
while (0 < limit) {
prev -= 1;
next += 1;
if (0 < prev)
{
fAdd(prev, false);
limit--;
}
if (pageCount >= next)
{
fAdd(next, true);
limit--;
}
else if (0 >= prev)
{
break;
}
}
if (3 === prev)
{
fAdd(2, false);
}
else if (3 < prev)
{
fAdd(Math.round((prev - 1) / 2), false, '...');
}
if (pageCount - 2 === next)
{
fAdd(pageCount - 1, true);
}
else if (pageCount - 2 > next)
{
fAdd(Math.round((pageCount + next) / 2), true, '...');
}
// first and last
if (1 < prev)
{
fAdd(1, false);
}
if (pageCount > next)
{
fAdd(pageCount, true);
}
}
return result;
};
}
/**
* @param {string} fileName
* @return {string}
*/
export function getFileExtension(fileName: string): string
{
fileName = fileName.trim().toLowerCase();
const result = fileName.split('.').pop();
return result === fileName ? '' : result;
}
/**
* @param {string} fileName
* @return {string}
*/
export function mimeContentType(fileName: string): string
{
let
ext = '',
result = 'application/octet-stream'
;
fileName = fileName.trim().toLowerCase();
if ('winmail.dat' === fileName)
{
return 'application/ms-tnef';
}
ext = getFileExtension(fileName);
if (ext && 0 < ext.length && undefined !== Mime[ext])
{
result = Mime[ext];
}
return result;
}
/**
* @param {string} url
* @param {number} value
* @param {Function} fCallback
*/
export function resizeAndCrop(url: string, value: number, fCallback: (data: string) => void)
{
const img = new Image();
img.onload = function() {
let
diff: number[] = [0, 0]
;
const
canvas: HTMLCanvasElement = window.document.createElement('canvas'),
ctx: CanvasRenderingContext2D = canvas.getContext('2d')
;
canvas.width = value;
canvas.height = value;
if (this.width > this.height)
{
diff = [this.width - this.height, 0];
}
else
{
diff = [0, this.height - this.width];
}
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, value, value);
ctx.drawImage(this, diff[0] / 2, diff[1] / 2, this.width - diff[0], this.height - diff[1], 0, 0, value, value);
fCallback(canvas.toDataURL('image/jpeg'));
};
img.src = url;
}

View file

@ -5,6 +5,7 @@ import _ from '_';
import ko from 'ko';
import {$win, $div, dropdownVisibility, data as GlobalsData} from 'Common/Globals';
import {ComposeType, EventKeyCode, SaveSettingsStep, FolderType} from 'Common/Enums';
import {Mime} from 'Common/Mime';
import JSEncrypt from 'JSEncrypt';
import Autolinker from 'Autolinker';
@ -1374,15 +1375,195 @@ export function changeTheme(value, themeTrigger)
}
}
let substr = window.String.substr;
if ('ab'.substr(-1) !== 'b')
export function computedPagenatorHelper(koCurrentPage, koPageCount)
{
substr = (str, start, length) => {
start = start < 0 ? str.length + start : start;
return str.substr(start, length);
return () => {
const
currentPage = koCurrentPage(),
pageCount = koPageCount(),
result = [],
fAdd = (index, push = true, customName = '') => {
const data = {
current: index === currentPage,
name: '' === customName ? index.toString() : customName.toString(),
custom: '' === customName ? false : true,
title: '' === customName ? '' : index.toString(),
value: index.toString()
};
if (push)
{
result.push(data);
}
else
{
result.unshift(data);
}
}
;
let
prev = 0,
next = 0,
limit = 2
;
if (1 < pageCount || (0 < pageCount && pageCount < currentPage))
{
if (pageCount < currentPage)
{
fAdd(pageCount);
prev = pageCount;
next = pageCount;
}
else
{
if (3 >= currentPage || pageCount - 2 <= currentPage)
{
limit += 2;
}
fAdd(currentPage);
prev = currentPage;
next = currentPage;
}
while (0 < limit) {
prev -= 1;
next += 1;
if (0 < prev)
{
fAdd(prev, false);
limit--;
}
if (pageCount >= next)
{
fAdd(next, true);
limit--;
}
else if (0 >= prev)
{
break;
}
}
if (3 === prev)
{
fAdd(2, false);
}
else if (3 < prev)
{
fAdd(Math.round((prev - 1) / 2), false, '...');
}
if (pageCount - 2 === next)
{
fAdd(pageCount - 1, true);
}
else if (pageCount - 2 > next)
{
fAdd(Math.round((pageCount + next) / 2), true, '...');
}
// first and last
if (1 < prev)
{
fAdd(1, false);
}
if (pageCount > next)
{
fAdd(pageCount, true);
}
}
return result;
};
}
/**
* @param {string} fileName
* @return {string}
*/
export function getFileExtension(fileName)
{
fileName = trim(fileName).toLowerCase();
const result = fileName.split('.').pop();
return result === fileName ? '' : result;
}
/**
* @param {string} fileName
* @return {string}
*/
export function mimeContentType(fileName)
{
let
ext = '',
result = 'application/octet-stream'
;
fileName = trim(fileName).toLowerCase();
if ('winmail.dat' === fileName)
{
return 'application/ms-tnef';
}
ext = getFileExtension(fileName);
if (ext && 0 < ext.length && !isUnd(Mime[ext]))
{
result = Mime[ext];
}
return result;
}
/**
* @param {string} url
* @param {number} value
* @param {Function} fCallback
*/
export function resizeAndCrop(url, value, fCallback)
{
const img = new Image();
img.onload = function() {
let
diff = [0, 0]
;
const
canvas = window.document.createElement('canvas'),
ctx = canvas.getContext('2d')
;
canvas.width = value;
canvas.height = value;
if (this.width > this.height)
{
diff = [this.width - this.height, 0];
}
else
{
diff = [0, this.height - this.width];
}
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, value, value);
ctx.drawImage(this, diff[0] / 2, diff[1] / 2, this.width - diff[0], this.height - diff[1], 0, 0, value, value);
fCallback(canvas.toDataURL('image/jpeg'));
};
window.String.substr = substr;
img.src = url;
}
/**
@ -1461,3 +1642,14 @@ export function windowResizeCallback()
{
windowResize();
}
let substr = window.String.substr;
if ('ab'.substr(-1) !== 'b')
{
substr = (str, start, length) => {
start = start < 0 ? str.length + start : start;
return str.substr(start, length);
};
window.String.substr = substr;
}

View file

@ -11,7 +11,6 @@
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Spec = require('Common/Spec'),
Links = require('Common/Links'),
Audio = require('Common/Audio'),
@ -103,7 +102,7 @@
this.friendlySize = Utils.friendlySize(this.estimatedSize);
this.cidWithOutTags = this.cid.replace(/^<+/, '').replace(/>+$/, '');
this.fileNameExt = Spec.getFileExtension(this.fileName);
this.fileNameExt = Utils.getFileExtension(this.fileName);
this.fileType = AttachmentModel.staticFileType(this.fileNameExt, this.mimeType);
bResult = true;
@ -489,7 +488,7 @@
aTypes = _.uniq(_.compact(_.map(aData, function (aItem) {
return aItem ? AttachmentModel.staticFileType(
Spec.getFileExtension(aItem[0]), aItem[1]) : '';
Utils.getFileExtension(aItem[0]), aItem[1]) : '';
})));
if (aTypes && 1 === aTypes.length && aTypes[0])

View file

@ -8,7 +8,6 @@
ko = require('ko'),
Utils = require('Common/Utils'),
Spec = require('Common/Spec'),
AttachmentModel = require('Model/Attachment'),
@ -68,11 +67,11 @@
}, this);
this.mimeType = ko.computed(function () {
return Spec.mimeContentType(this.fileName());
return Utils.mimeContentType(this.fileName());
}, this);
this.fileExt = ko.computed(function () {
return Spec.getFileExtension(this.fileName());
return Utils.getFileExtension(this.fileName());
}, this);
this.regDisposables([this.progressText, this.progressStyle, this.title, this.friendlySize, this.mimeType, this.fileExt]);

View file

@ -14,7 +14,6 @@
Consts = require('Common/Consts'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Spec = require('Common/Spec'),
Selector = require('Common/Selector'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
@ -73,7 +72,7 @@
return 0 >= iPage ? 1 : iPage;
}, this);
this.contactsPagenator = ko.computed(Spec.computedPagenatorHelper(this.contactsPage, this.contactsPageCount));
this.contactsPagenator = ko.computed(Utils.computedPagenatorHelper(this.contactsPage, this.contactsPageCount));
this.emptySelection = ko.observable(true);
this.viewClearSearch = ko.observable(false);

View file

@ -16,7 +16,6 @@
Consts = require('Common/Consts'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Spec = require('Common/Spec'),
Links = require('Common/Links'),
Events = require('Common/Events'),
Selector = require('Common/Selector'),
@ -117,7 +116,7 @@
return '' === sValue ? '' : Translator.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
});
this.messageListPagenator = ko.computed(Spec.computedPagenatorHelper(
this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(
MessageStore.messageListPage, MessageStore.messageListPageCount));
this.checkAll = ko.computed({