mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 22:17:03 +03:00
CommonJS (research)
This commit is contained in:
parent
2fa2cd191e
commit
56607de87c
91 changed files with 20220 additions and 12933 deletions
|
|
@ -1,164 +1,171 @@
|
|||
/*jslint bitwise: true*/
|
||||
// Base64 encode / decode
|
||||
// http://www.webtoolkit.info/
|
||||
|
||||
Base64 = {
|
||||
|
||||
// private property
|
||||
_keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||
|
||||
// public method for urlsafe encoding
|
||||
urlsafe_encode : function (input) {
|
||||
return Base64.encode(input).replace(/[+]/g, '-').replace(/[\/]/g, '_').replace(/[=]/g, '.');
|
||||
},
|
||||
|
||||
// public method for encoding
|
||||
encode : function (input) {
|
||||
var
|
||||
output = '',
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4,
|
||||
i = 0
|
||||
;
|
||||
|
||||
input = Base64._utf8_encode(input);
|
||||
|
||||
while (i < input.length)
|
||||
{
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2))
|
||||
{
|
||||
enc3 = enc4 = 64;
|
||||
}
|
||||
else if (isNaN(chr3))
|
||||
{
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output +
|
||||
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
// public method for decoding
|
||||
decode : function (input) {
|
||||
var
|
||||
output = '',
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4,
|
||||
i = 0
|
||||
;
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
||||
|
||||
while (i < input.length)
|
||||
{
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 !== 64)
|
||||
{
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
|
||||
if (enc4 !== 64)
|
||||
{
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
return Base64._utf8_decode(output);
|
||||
},
|
||||
|
||||
// private method for UTF-8 encoding
|
||||
_utf8_encode : function (string) {
|
||||
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
|
||||
var
|
||||
utftext = '',
|
||||
n = 0,
|
||||
l = string.length,
|
||||
c = 0
|
||||
;
|
||||
|
||||
for (; n < l; n++) {
|
||||
|
||||
c = string.charCodeAt(n);
|
||||
|
||||
if (c < 128)
|
||||
{
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if ((c > 127) && (c < 2048))
|
||||
{
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else
|
||||
{
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
|
||||
return utftext;
|
||||
},
|
||||
|
||||
// private method for UTF-8 decoding
|
||||
_utf8_decode : function (utftext) {
|
||||
var
|
||||
string = '',
|
||||
i = 0,
|
||||
c = 0,
|
||||
c2 = 0,
|
||||
c3 = 0
|
||||
;
|
||||
|
||||
while ( i < utftext.length )
|
||||
{
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128)
|
||||
{
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
}
|
||||
else if((c > 191) && (c < 224))
|
||||
{
|
||||
c2 = utftext.charCodeAt(i+1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
c2 = utftext.charCodeAt(i+1);
|
||||
c3 = utftext.charCodeAt(i+2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
};
|
||||
|
||||
/*jslint bitwise: false*/
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/*jslint bitwise: true*/
|
||||
var Base64 = {
|
||||
|
||||
// private property
|
||||
_keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||
|
||||
// public method for urlsafe encoding
|
||||
urlsafe_encode : function (input) {
|
||||
return Base64.encode(input).replace(/[+]/g, '-').replace(/[\/]/g, '_').replace(/[=]/g, '.');
|
||||
},
|
||||
|
||||
// public method for encoding
|
||||
encode : function (input) {
|
||||
var
|
||||
output = '',
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4,
|
||||
i = 0
|
||||
;
|
||||
|
||||
input = Base64._utf8_encode(input);
|
||||
|
||||
while (i < input.length)
|
||||
{
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2))
|
||||
{
|
||||
enc3 = enc4 = 64;
|
||||
}
|
||||
else if (isNaN(chr3))
|
||||
{
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output +
|
||||
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
|
||||
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
// public method for decoding
|
||||
decode : function (input) {
|
||||
var
|
||||
output = '',
|
||||
chr1, chr2, chr3, enc1, enc2, enc3, enc4,
|
||||
i = 0
|
||||
;
|
||||
|
||||
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
||||
|
||||
while (i < input.length)
|
||||
{
|
||||
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
||||
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
||||
|
||||
chr1 = (enc1 << 2) | (enc2 >> 4);
|
||||
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
||||
chr3 = ((enc3 & 3) << 6) | enc4;
|
||||
|
||||
output = output + String.fromCharCode(chr1);
|
||||
|
||||
if (enc3 !== 64)
|
||||
{
|
||||
output = output + String.fromCharCode(chr2);
|
||||
}
|
||||
|
||||
if (enc4 !== 64)
|
||||
{
|
||||
output = output + String.fromCharCode(chr3);
|
||||
}
|
||||
}
|
||||
|
||||
return Base64._utf8_decode(output);
|
||||
},
|
||||
|
||||
// private method for UTF-8 encoding
|
||||
_utf8_encode : function (string) {
|
||||
|
||||
string = string.replace(/\r\n/g, "\n");
|
||||
|
||||
var
|
||||
utftext = '',
|
||||
n = 0,
|
||||
l = string.length,
|
||||
c = 0
|
||||
;
|
||||
|
||||
for (; n < l; n++) {
|
||||
|
||||
c = string.charCodeAt(n);
|
||||
|
||||
if (c < 128)
|
||||
{
|
||||
utftext += String.fromCharCode(c);
|
||||
}
|
||||
else if ((c > 127) && (c < 2048))
|
||||
{
|
||||
utftext += String.fromCharCode((c >> 6) | 192);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
else
|
||||
{
|
||||
utftext += String.fromCharCode((c >> 12) | 224);
|
||||
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
||||
utftext += String.fromCharCode((c & 63) | 128);
|
||||
}
|
||||
}
|
||||
|
||||
return utftext;
|
||||
},
|
||||
|
||||
// private method for UTF-8 decoding
|
||||
_utf8_decode : function (utftext) {
|
||||
var
|
||||
string = '',
|
||||
i = 0,
|
||||
c = 0,
|
||||
c2 = 0,
|
||||
c3 = 0
|
||||
;
|
||||
|
||||
while ( i < utftext.length )
|
||||
{
|
||||
c = utftext.charCodeAt(i);
|
||||
|
||||
if (c < 128)
|
||||
{
|
||||
string += String.fromCharCode(c);
|
||||
i++;
|
||||
}
|
||||
else if((c > 191) && (c < 224))
|
||||
{
|
||||
c2 = utftext.charCodeAt(i+1);
|
||||
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
||||
i += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
c2 = utftext.charCodeAt(i+1);
|
||||
c3 = utftext.charCodeAt(i+2);
|
||||
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
||||
i += 3;
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Base64;
|
||||
/*jslint bitwise: false*/
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
Consts.Defaults = {};
|
||||
Consts.Values = {};
|
||||
Consts.DataImages = {};
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPage = 20;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsPerPage = 50;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Array}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.DefaultAjaxTimeout = 30000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SearchAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SendMessageAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SaveMessageAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsSyncAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.UnuseOptionValue = '__UNUSE__';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.ClientSideCookieIndexName = 'rlcsc';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulPort = 143;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulSecurePort = 993;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulPort = 25;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulSecurePort = 465;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.MessageBodyCacheLimit = 15;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.AjaxErrorLimit = 7;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.TokenErrorLimit = 10;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
|
||||
129
dev/Common/Consts.js
Normal file
129
dev/Common/Consts.js
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var Consts = {};
|
||||
|
||||
Consts.Values = {};
|
||||
Consts.DataImages = {};
|
||||
Consts.Defaults = {};
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPage = 20;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsPerPage = 50;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Array}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.DefaultAjaxTimeout = 30000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SearchAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SendMessageAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SaveMessageAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsSyncAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.UnuseOptionValue = '__UNUSE__';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.ClientSideCookieIndexName = 'rlcsc';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulPort = 143;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulSecurePort = 993;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulPort = 25;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulSecurePort = 465;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.MessageBodyCacheLimit = 15;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.AjaxErrorLimit = 7;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.TokenErrorLimit = 10;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
|
||||
|
||||
module.exports = Consts;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,430 +1,440 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.StorageResultType = {
|
||||
'Success': 'success',
|
||||
'Abort': 'abort',
|
||||
'Error': 'error',
|
||||
'Unload': 'unload'
|
||||
};
|
||||
(function (module) {
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.State = {
|
||||
'Empty': 10,
|
||||
'Login': 20,
|
||||
'Auth': 30
|
||||
};
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.StateType = {
|
||||
'Webmail': 0,
|
||||
'Admin': 1
|
||||
};
|
||||
var Enums = {};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.Capa = {
|
||||
'Prem': 'PREM',
|
||||
'TwoFactor': 'TWO_FACTOR',
|
||||
'OpenPGP': 'OPEN_PGP',
|
||||
'Prefetch': 'PREFETCH',
|
||||
'Gravatar': 'GRAVATAR',
|
||||
'Themes': 'THEMES',
|
||||
'Filters': 'FILTERS',
|
||||
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
|
||||
'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.StorageResultType = {
|
||||
'Success': 'success',
|
||||
'Abort': 'abort',
|
||||
'Error': 'error',
|
||||
'Unload': 'unload'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.KeyState = {
|
||||
'All': 'all',
|
||||
'None': 'none',
|
||||
'ContactList': 'contact-list',
|
||||
'MessageList': 'message-list',
|
||||
'FolderList': 'folder-list',
|
||||
'MessageView': 'message-view',
|
||||
'Compose': 'compose',
|
||||
'Settings': 'settings',
|
||||
'Menu': 'menu',
|
||||
'PopupComposeOpenPGP': 'compose-open-pgp',
|
||||
'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help',
|
||||
'PopupAsk': 'popup-ask'
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.State = {
|
||||
'Empty': 10,
|
||||
'Login': 20,
|
||||
'Auth': 30
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.FolderType = {
|
||||
'Inbox': 10,
|
||||
'SentItems': 11,
|
||||
'Draft': 12,
|
||||
'Trash': 13,
|
||||
'Spam': 14,
|
||||
'Archive': 15,
|
||||
'NotSpam': 80,
|
||||
'User': 99
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.StateType = {
|
||||
'Webmail': 0,
|
||||
'Admin': 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.LoginSignMeTypeAsString = {
|
||||
'DefaultOff': 'defaultoff',
|
||||
'DefaultOn': 'defaulton',
|
||||
'Unused': 'unused'
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.Capa = {
|
||||
'Prem': 'PREM',
|
||||
'TwoFactor': 'TWO_FACTOR',
|
||||
'OpenPGP': 'OPEN_PGP',
|
||||
'Prefetch': 'PREFETCH',
|
||||
'Gravatar': 'GRAVATAR',
|
||||
'Themes': 'THEMES',
|
||||
'Filters': 'FILTERS',
|
||||
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
|
||||
'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.LoginSignMeType = {
|
||||
'DefaultOff': 0,
|
||||
'DefaultOn': 1,
|
||||
'Unused': 2
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.KeyState = {
|
||||
'All': 'all',
|
||||
'None': 'none',
|
||||
'ContactList': 'contact-list',
|
||||
'MessageList': 'message-list',
|
||||
'FolderList': 'folder-list',
|
||||
'MessageView': 'message-view',
|
||||
'Compose': 'compose',
|
||||
'Settings': 'settings',
|
||||
'Menu': 'menu',
|
||||
'PopupComposeOpenPGP': 'compose-open-pgp',
|
||||
'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help',
|
||||
'PopupAsk': 'popup-ask'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.ComposeType = {
|
||||
'Empty': 'empty',
|
||||
'Reply': 'reply',
|
||||
'ReplyAll': 'replyall',
|
||||
'Forward': 'forward',
|
||||
'ForwardAsAttachment': 'forward-as-attachment',
|
||||
'Draft': 'draft',
|
||||
'EditAsNew': 'editasnew'
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.FolderType = {
|
||||
'Inbox': 10,
|
||||
'SentItems': 11,
|
||||
'Draft': 12,
|
||||
'Trash': 13,
|
||||
'Spam': 14,
|
||||
'Archive': 15,
|
||||
'NotSpam': 80,
|
||||
'User': 99
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.UploadErrorCode = {
|
||||
'Normal': 0,
|
||||
'FileIsTooBig': 1,
|
||||
'FilePartiallyUploaded': 2,
|
||||
'FileNoUploaded': 3,
|
||||
'MissingTempFolder': 4,
|
||||
'FileOnSaveingError': 5,
|
||||
'FileType': 98,
|
||||
'Unknown': 99
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.LoginSignMeTypeAsString = {
|
||||
'DefaultOff': 'defaultoff',
|
||||
'DefaultOn': 'defaulton',
|
||||
'Unused': 'unused'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SetSystemFoldersNotification = {
|
||||
'None': 0,
|
||||
'Sent': 1,
|
||||
'Draft': 2,
|
||||
'Spam': 3,
|
||||
'Trash': 4,
|
||||
'Archive': 5
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.LoginSignMeType = {
|
||||
'DefaultOff': 0,
|
||||
'DefaultOn': 1,
|
||||
'Unused': 2
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ClientSideKeyName = {
|
||||
'FoldersLashHash': 0,
|
||||
'MessagesInboxLastHash': 1,
|
||||
'MailBoxListSize': 2,
|
||||
'ExpandedFolders': 3,
|
||||
'FolderListSize': 4
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.ComposeType = {
|
||||
'Empty': 'empty',
|
||||
'Reply': 'reply',
|
||||
'ReplyAll': 'replyall',
|
||||
'Forward': 'forward',
|
||||
'ForwardAsAttachment': 'forward-as-attachment',
|
||||
'Draft': 'draft',
|
||||
'EditAsNew': 'editasnew'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.EventKeyCode = {
|
||||
'Backspace': 8,
|
||||
'Tab': 9,
|
||||
'Enter': 13,
|
||||
'Esc': 27,
|
||||
'PageUp': 33,
|
||||
'PageDown': 34,
|
||||
'Left': 37,
|
||||
'Right': 39,
|
||||
'Up': 38,
|
||||
'Down': 40,
|
||||
'End': 35,
|
||||
'Home': 36,
|
||||
'Space': 32,
|
||||
'Insert': 45,
|
||||
'Delete': 46,
|
||||
'A': 65,
|
||||
'S': 83
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.UploadErrorCode = {
|
||||
'Normal': 0,
|
||||
'FileIsTooBig': 1,
|
||||
'FilePartiallyUploaded': 2,
|
||||
'FileNoUploaded': 3,
|
||||
'MissingTempFolder': 4,
|
||||
'FileOnSaveingError': 5,
|
||||
'FileType': 98,
|
||||
'Unknown': 99
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.MessageSetAction = {
|
||||
'SetSeen': 0,
|
||||
'UnsetSeen': 1,
|
||||
'SetFlag': 2,
|
||||
'UnsetFlag': 3
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SetSystemFoldersNotification = {
|
||||
'None': 0,
|
||||
'Sent': 1,
|
||||
'Draft': 2,
|
||||
'Spam': 3,
|
||||
'Trash': 4,
|
||||
'Archive': 5
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.MessageSelectAction = {
|
||||
'All': 0,
|
||||
'None': 1,
|
||||
'Invert': 2,
|
||||
'Unseen': 3,
|
||||
'Seen': 4,
|
||||
'Flagged': 5,
|
||||
'Unflagged': 6
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ClientSideKeyName = {
|
||||
'FoldersLashHash': 0,
|
||||
'MessagesInboxLastHash': 1,
|
||||
'MailBoxListSize': 2,
|
||||
'ExpandedFolders': 3,
|
||||
'FolderListSize': 4
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.DesktopNotifications = {
|
||||
'Allowed': 0,
|
||||
'NotAllowed': 1,
|
||||
'Denied': 2,
|
||||
'NotSupported': 9
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.EventKeyCode = {
|
||||
'Backspace': 8,
|
||||
'Tab': 9,
|
||||
'Enter': 13,
|
||||
'Esc': 27,
|
||||
'PageUp': 33,
|
||||
'PageDown': 34,
|
||||
'Left': 37,
|
||||
'Right': 39,
|
||||
'Up': 38,
|
||||
'Down': 40,
|
||||
'End': 35,
|
||||
'Home': 36,
|
||||
'Space': 32,
|
||||
'Insert': 45,
|
||||
'Delete': 46,
|
||||
'A': 65,
|
||||
'S': 83
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.MessagePriority = {
|
||||
'Low': 5,
|
||||
'Normal': 3,
|
||||
'High': 1
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.MessageSetAction = {
|
||||
'SetSeen': 0,
|
||||
'UnsetSeen': 1,
|
||||
'SetFlag': 2,
|
||||
'UnsetFlag': 3
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.EditorDefaultType = {
|
||||
'Html': 'Html',
|
||||
'Plain': 'Plain'
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.MessageSelectAction = {
|
||||
'All': 0,
|
||||
'None': 1,
|
||||
'Invert': 2,
|
||||
'Unseen': 3,
|
||||
'Seen': 4,
|
||||
'Flagged': 5,
|
||||
'Unflagged': 6
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.CustomThemeType = {
|
||||
'Light': 'Light',
|
||||
'Dark': 'Dark'
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.DesktopNotifications = {
|
||||
'Allowed': 0,
|
||||
'NotAllowed': 1,
|
||||
'Denied': 2,
|
||||
'NotSupported': 9
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ServerSecure = {
|
||||
'None': 0,
|
||||
'SSL': 1,
|
||||
'TLS': 2
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.MessagePriority = {
|
||||
'Low': 5,
|
||||
'Normal': 3,
|
||||
'High': 1
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SearchDateType = {
|
||||
'All': -1,
|
||||
'Days3': 3,
|
||||
'Days7': 7,
|
||||
'Month': 30
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.EditorDefaultType = {
|
||||
'Html': 'Html',
|
||||
'Plain': 'Plain'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.EmailType = {
|
||||
'Defailt': 0,
|
||||
'Facebook': 1,
|
||||
'Google': 2
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.CustomThemeType = {
|
||||
'Light': 'Light',
|
||||
'Dark': 'Dark'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SaveSettingsStep = {
|
||||
'Animate': -2,
|
||||
'Idle': -1,
|
||||
'TrueResult': 1,
|
||||
'FalseResult': 0
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ServerSecure = {
|
||||
'None': 0,
|
||||
'SSL': 1,
|
||||
'TLS': 2
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.InterfaceAnimation = {
|
||||
'None': 'None',
|
||||
'Normal': 'Normal',
|
||||
'Full': 'Full'
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SearchDateType = {
|
||||
'All': -1,
|
||||
'Days3': 3,
|
||||
'Days7': 7,
|
||||
'Month': 30
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.Layout = {
|
||||
'NoPreview': 0,
|
||||
'SidePreview': 1,
|
||||
'BottomPreview': 2
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.EmailType = {
|
||||
'Defailt': 0,
|
||||
'Facebook': 1,
|
||||
'Google': 2
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionField = {
|
||||
'From': 'From',
|
||||
'To': 'To',
|
||||
'Recipient': 'Recipient',
|
||||
'Subject': 'Subject'
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SaveSettingsStep = {
|
||||
'Animate': -2,
|
||||
'Idle': -1,
|
||||
'TrueResult': 1,
|
||||
'FalseResult': 0
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionType = {
|
||||
'Contains': 'Contains',
|
||||
'NotContains': 'NotContains',
|
||||
'EqualTo': 'EqualTo',
|
||||
'NotEqualTo': 'NotEqualTo'
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.InterfaceAnimation = {
|
||||
'None': 'None',
|
||||
'Normal': 'Normal',
|
||||
'Full': 'Full'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FiltersAction = {
|
||||
'None': 'None',
|
||||
'Move': 'Move',
|
||||
'Discard': 'Discard',
|
||||
'Forward': 'Forward',
|
||||
};
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.Layout = {
|
||||
'NoPreview': 0,
|
||||
'SidePreview': 1,
|
||||
'BottomPreview': 2
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterRulesType = {
|
||||
'And': 'And',
|
||||
'Or': 'Or'
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionField = {
|
||||
'From': 'From',
|
||||
'To': 'To',
|
||||
'Recipient': 'Recipient',
|
||||
'Subject': 'Subject'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SignedVerifyStatus = {
|
||||
'UnknownPublicKeys': -4,
|
||||
'UnknownPrivateKey': -3,
|
||||
'Unverified': -2,
|
||||
'Error': -1,
|
||||
'None': 0,
|
||||
'Success': 1
|
||||
};
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterConditionType = {
|
||||
'Contains': 'Contains',
|
||||
'NotContains': 'NotContains',
|
||||
'EqualTo': 'EqualTo',
|
||||
'NotEqualTo': 'NotEqualTo'
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ContactPropertyType = {
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FiltersAction = {
|
||||
'None': 'None',
|
||||
'Move': 'Move',
|
||||
'Discard': 'Discard',
|
||||
'Forward': 'Forward',
|
||||
};
|
||||
|
||||
'Unknown': 0,
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
Enums.FilterRulesType = {
|
||||
'And': 'And',
|
||||
'Or': 'Or'
|
||||
};
|
||||
|
||||
'FullName': 10,
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.SignedVerifyStatus = {
|
||||
'UnknownPublicKeys': -4,
|
||||
'UnknownPrivateKey': -3,
|
||||
'Unverified': -2,
|
||||
'Error': -1,
|
||||
'None': 0,
|
||||
'Success': 1
|
||||
};
|
||||
|
||||
'FirstName': 15,
|
||||
'LastName': 16,
|
||||
'MiddleName': 16,
|
||||
'Nick': 18,
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.ContactPropertyType = {
|
||||
|
||||
'NamePrefix': 20,
|
||||
'NameSuffix': 21,
|
||||
'Unknown': 0,
|
||||
|
||||
'Email': 30,
|
||||
'Phone': 31,
|
||||
'Web': 32,
|
||||
'FullName': 10,
|
||||
|
||||
'Birthday': 40,
|
||||
'FirstName': 15,
|
||||
'LastName': 16,
|
||||
'MiddleName': 16,
|
||||
'Nick': 18,
|
||||
|
||||
'Facebook': 90,
|
||||
'Skype': 91,
|
||||
'GitHub': 92,
|
||||
'NamePrefix': 20,
|
||||
'NameSuffix': 21,
|
||||
|
||||
'Note': 110,
|
||||
'Email': 30,
|
||||
'Phone': 31,
|
||||
'Web': 32,
|
||||
|
||||
'Custom': 250
|
||||
};
|
||||
'Birthday': 40,
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.Notification = {
|
||||
'InvalidToken': 101,
|
||||
'AuthError': 102,
|
||||
'AccessError': 103,
|
||||
'ConnectionError': 104,
|
||||
'CaptchaError': 105,
|
||||
'SocialFacebookLoginAccessDisable': 106,
|
||||
'SocialTwitterLoginAccessDisable': 107,
|
||||
'SocialGoogleLoginAccessDisable': 108,
|
||||
'DomainNotAllowed': 109,
|
||||
'AccountNotAllowed': 110,
|
||||
'Facebook': 90,
|
||||
'Skype': 91,
|
||||
'GitHub': 92,
|
||||
|
||||
'AccountTwoFactorAuthRequired': 120,
|
||||
'AccountTwoFactorAuthError': 121,
|
||||
'Note': 110,
|
||||
|
||||
'CouldNotSaveNewPassword': 130,
|
||||
'CurrentPasswordIncorrect': 131,
|
||||
'NewPasswordShort': 132,
|
||||
'NewPasswordWeak': 133,
|
||||
'NewPasswordForbidden': 134,
|
||||
'Custom': 250
|
||||
};
|
||||
|
||||
'ContactsSyncError': 140,
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
Enums.Notification = {
|
||||
'InvalidToken': 101,
|
||||
'AuthError': 102,
|
||||
'AccessError': 103,
|
||||
'ConnectionError': 104,
|
||||
'CaptchaError': 105,
|
||||
'SocialFacebookLoginAccessDisable': 106,
|
||||
'SocialTwitterLoginAccessDisable': 107,
|
||||
'SocialGoogleLoginAccessDisable': 108,
|
||||
'DomainNotAllowed': 109,
|
||||
'AccountNotAllowed': 110,
|
||||
|
||||
'CantGetMessageList': 201,
|
||||
'CantGetMessage': 202,
|
||||
'CantDeleteMessage': 203,
|
||||
'CantMoveMessage': 204,
|
||||
'CantCopyMessage': 205,
|
||||
'AccountTwoFactorAuthRequired': 120,
|
||||
'AccountTwoFactorAuthError': 121,
|
||||
|
||||
'CantSaveMessage': 301,
|
||||
'CantSendMessage': 302,
|
||||
'InvalidRecipients': 303,
|
||||
'CouldNotSaveNewPassword': 130,
|
||||
'CurrentPasswordIncorrect': 131,
|
||||
'NewPasswordShort': 132,
|
||||
'NewPasswordWeak': 133,
|
||||
'NewPasswordForbidden': 134,
|
||||
|
||||
'CantCreateFolder': 400,
|
||||
'CantRenameFolder': 401,
|
||||
'CantDeleteFolder': 402,
|
||||
'CantSubscribeFolder': 403,
|
||||
'CantUnsubscribeFolder': 404,
|
||||
'CantDeleteNonEmptyFolder': 405,
|
||||
'ContactsSyncError': 140,
|
||||
|
||||
'CantSaveSettings': 501,
|
||||
'CantSavePluginSettings': 502,
|
||||
'CantGetMessageList': 201,
|
||||
'CantGetMessage': 202,
|
||||
'CantDeleteMessage': 203,
|
||||
'CantMoveMessage': 204,
|
||||
'CantCopyMessage': 205,
|
||||
|
||||
'DomainAlreadyExists': 601,
|
||||
'CantSaveMessage': 301,
|
||||
'CantSendMessage': 302,
|
||||
'InvalidRecipients': 303,
|
||||
|
||||
'CantInstallPackage': 701,
|
||||
'CantDeletePackage': 702,
|
||||
'InvalidPluginPackage': 703,
|
||||
'UnsupportedPluginPackage': 704,
|
||||
'CantCreateFolder': 400,
|
||||
'CantRenameFolder': 401,
|
||||
'CantDeleteFolder': 402,
|
||||
'CantSubscribeFolder': 403,
|
||||
'CantUnsubscribeFolder': 404,
|
||||
'CantDeleteNonEmptyFolder': 405,
|
||||
|
||||
'LicensingServerIsUnavailable': 710,
|
||||
'LicensingExpired': 711,
|
||||
'LicensingBanned': 712,
|
||||
'CantSaveSettings': 501,
|
||||
'CantSavePluginSettings': 502,
|
||||
|
||||
'DemoSendMessageError': 750,
|
||||
'DomainAlreadyExists': 601,
|
||||
|
||||
'AccountAlreadyExists': 801,
|
||||
'CantInstallPackage': 701,
|
||||
'CantDeletePackage': 702,
|
||||
'InvalidPluginPackage': 703,
|
||||
'UnsupportedPluginPackage': 704,
|
||||
|
||||
'MailServerError': 901,
|
||||
'ClientViewError': 902,
|
||||
'InvalidInputArgument': 903,
|
||||
'UnknownNotification': 999,
|
||||
'UnknownError': 999
|
||||
};
|
||||
'LicensingServerIsUnavailable': 710,
|
||||
'LicensingExpired': 711,
|
||||
'LicensingBanned': 712,
|
||||
|
||||
'DemoSendMessageError': 750,
|
||||
|
||||
'AccountAlreadyExists': 801,
|
||||
|
||||
'MailServerError': 901,
|
||||
'ClientViewError': 902,
|
||||
'InvalidInputArgument': 903,
|
||||
'UnknownNotification': 999,
|
||||
'UnknownError': 999
|
||||
};
|
||||
|
||||
module.exports = Enums;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,157 +1,184 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.now = (new Date()).getTime();
|
||||
(function (module) {
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.momentTrigger = ko.observable(true);
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
|
||||
var
|
||||
Globals = {},
|
||||
window = require('../External/window.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
$html = require('../External/$html.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.now = (new window.Date()).getTime();
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.langChangeTrigger = ko.observable(true);
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.momentTrigger = ko.observable(true);
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Globals.iAjaxErrorCount = 0;
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Globals.iTokenErrorCount = 0;
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Globals.iMessageBodyCacheCount = 0;
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.langChangeTrigger = ko.observable(true);
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bUnload = false;
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Globals.iAjaxErrorCount = 0;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
Globals.sUserAgent = (navigator.userAgent || '').toLowerCase();
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Globals.iTokenErrorCount = 0;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
Globals.iMessageBodyCacheCount = 0;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bUnload = false;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
Globals.sAnimationType = '';
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Globals.oHtmlEditorDefaultConfig = {
|
||||
'title': false,
|
||||
'stylesSet': false,
|
||||
'customConfig': '',
|
||||
'contentsCss': '',
|
||||
'toolbarGroups': [
|
||||
{name: 'spec'},
|
||||
{name: 'styles'},
|
||||
{name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
|
||||
{name: 'colors'},
|
||||
{name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']},
|
||||
{name: 'links'},
|
||||
{name: 'insert'},
|
||||
{name: 'others'}
|
||||
// {name: 'document', groups: ['mode', 'document', 'doctools']}
|
||||
],
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
||||
|
||||
'removePlugins': 'contextmenu', //blockquote
|
||||
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll',
|
||||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||
|
||||
'extraPlugins': 'plain',
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
Globals.sAnimationType = '';
|
||||
|
||||
'allowedContent': true,
|
||||
'autoParagraph': false,
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Globals.oHtmlEditorDefaultConfig = {
|
||||
'title': false,
|
||||
'stylesSet': false,
|
||||
'customConfig': '',
|
||||
'contentsCss': '',
|
||||
'toolbarGroups': [
|
||||
{name: 'spec'},
|
||||
{name: 'styles'},
|
||||
{name: 'basicstyles', groups: ['basicstyles', 'cleanup']},
|
||||
{name: 'colors'},
|
||||
{name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']},
|
||||
{name: 'links'},
|
||||
{name: 'insert'},
|
||||
{name: 'others'}
|
||||
// {name: 'document', groups: ['mode', 'document', 'doctools']}
|
||||
],
|
||||
|
||||
'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'
|
||||
};
|
||||
'removePlugins': 'contextmenu', //blockquote
|
||||
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll',
|
||||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Globals.oHtmlEditorLangsMap = {
|
||||
'de': 'de',
|
||||
'es': 'es',
|
||||
'fr': 'fr',
|
||||
'hu': 'hu',
|
||||
'is': 'is',
|
||||
'it': 'it',
|
||||
'ko': 'ko',
|
||||
'ko-kr': 'ko',
|
||||
'lv': 'lv',
|
||||
'nl': 'nl',
|
||||
'no': 'no',
|
||||
'pl': 'pl',
|
||||
'pt': 'pt',
|
||||
'pt-pt': 'pt',
|
||||
'pt-br': 'pt-br',
|
||||
'ru': 'ru',
|
||||
'ro': 'ro',
|
||||
'zh': 'zh',
|
||||
'zh-cn': 'zh-cn'
|
||||
};
|
||||
'extraPlugins': 'plain',
|
||||
|
||||
if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
|
||||
{
|
||||
Globals.bAllowPdfPreview = !!_.find(navigator.mimeTypes, function (oType) {
|
||||
return oType && 'application/pdf' === oType.type;
|
||||
});
|
||||
}
|
||||
'allowedContent': true,
|
||||
'autoParagraph': 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'
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Globals.oHtmlEditorLangsMap = {
|
||||
'de': 'de',
|
||||
'es': 'es',
|
||||
'fr': 'fr',
|
||||
'hu': 'hu',
|
||||
'is': 'is',
|
||||
'it': 'it',
|
||||
'ko': 'ko',
|
||||
'ko-kr': 'ko',
|
||||
'lv': 'lv',
|
||||
'nl': 'nl',
|
||||
'no': 'no',
|
||||
'pl': 'pl',
|
||||
'pt': 'pt',
|
||||
'pt-pt': 'pt',
|
||||
'pt-br': 'pt-br',
|
||||
'ru': 'ru',
|
||||
'ro': 'ro',
|
||||
'zh': 'zh',
|
||||
'zh-cn': 'zh-cn'
|
||||
};
|
||||
|
||||
if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
|
||||
{
|
||||
Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
|
||||
return oType && 'application/pdf' === oType.type;
|
||||
});
|
||||
}
|
||||
|
||||
Globals.oI18N = {},
|
||||
|
||||
Globals.oNotificationI18N = {},
|
||||
|
||||
Globals.aBootstrapDropdowns = [],
|
||||
|
||||
Globals.aViewModels = {
|
||||
'settings': [],
|
||||
'settings-removed': [],
|
||||
'settings-disabled': []
|
||||
};
|
||||
|
||||
module.exports = Globals;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,846 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
ko.bindingHandlers.tooltip = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
sClass = $oEl.data('tooltip-class') || '',
|
||||
sPlacement = $oEl.data('tooltip-placement') || 'top'
|
||||
;
|
||||
|
||||
$oEl.tooltip({
|
||||
'delay': {
|
||||
'show': 500,
|
||||
'hide': 100
|
||||
},
|
||||
'html': true,
|
||||
'container': 'body',
|
||||
'placement': sPlacement,
|
||||
'trigger': 'hover',
|
||||
'title': function () {
|
||||
return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : '<span class="tooltip-class ' + sClass + '">' +
|
||||
Utils.i18n(ko.utils.unwrapObservable(fValueAccessor())) + '</span>';
|
||||
}
|
||||
}).click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.tooltip2 = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
sClass = $oEl.data('tooltip-class') || '',
|
||||
sPlacement = $oEl.data('tooltip-placement') || 'top'
|
||||
;
|
||||
|
||||
$oEl.tooltip({
|
||||
'delay': {
|
||||
'show': 500,
|
||||
'hide': 100
|
||||
},
|
||||
'html': true,
|
||||
'container': 'body',
|
||||
'placement': sPlacement,
|
||||
'title': function () {
|
||||
return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
|
||||
'<span class="tooltip-class ' + sClass + '">' + fValueAccessor()() + '</span>';
|
||||
}
|
||||
}).click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.tooltip3 = {
|
||||
'init': function (oElement) {
|
||||
|
||||
var $oEl = $(oElement);
|
||||
|
||||
$oEl.tooltip({
|
||||
'container': 'body',
|
||||
'trigger': 'hover manual',
|
||||
'title': function () {
|
||||
return $oEl.data('tooltip3-data') || '';
|
||||
}
|
||||
});
|
||||
|
||||
$document.click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var sValue = ko.utils.unwrapObservable(fValueAccessor());
|
||||
if ('' === sValue)
|
||||
{
|
||||
$(oElement).data('tooltip3-data', '').tooltip('hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).data('tooltip3-data', sValue).tooltip('show');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.registrateBootstrapDropdown = {
|
||||
'init': function (oElement) {
|
||||
BootstrapDropdowns.push($(oElement));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.openDropdownTrigger = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (ko.utils.unwrapObservable(fValueAccessor()))
|
||||
{
|
||||
var $el = $(oElement);
|
||||
if (!$el.hasClass('open'))
|
||||
{
|
||||
$el.find('.dropdown-toggle').dropdown('toggle');
|
||||
Utils.detectDropdownVisibility();
|
||||
}
|
||||
|
||||
fValueAccessor()(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.dropdownCloser = {
|
||||
'init': function (oElement) {
|
||||
$(oElement).closest('.dropdown').on('click', '.e-item', function () {
|
||||
$(oElement).dropdown('toggle');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.popover = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
$(oElement).popover(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.csstext = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
|
||||
{
|
||||
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
|
||||
{
|
||||
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.resizecrop = {
|
||||
'init': function (oElement) {
|
||||
$(oElement).addClass('resizecrop').resizecrop({
|
||||
'width': '100',
|
||||
'height': '100',
|
||||
'wrapperCSS': {
|
||||
'border-radius': '10px'
|
||||
}
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
fValueAccessor()();
|
||||
$(oElement).resizecrop({
|
||||
'width': '100',
|
||||
'height': '100'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.onEnter = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
$(oElement).on('keypress', function (oEvent) {
|
||||
if (oEvent && 13 === window.parseInt(oEvent.keyCode, 10))
|
||||
{
|
||||
$(oElement).trigger('change');
|
||||
fValueAccessor().call(oViewModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.onEsc = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
$(oElement).on('keypress', function (oEvent) {
|
||||
if (oEvent && 27 === window.parseInt(oEvent.keyCode, 10))
|
||||
{
|
||||
$(oElement).trigger('change');
|
||||
fValueAccessor().call(oViewModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.clickOnTrue = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (ko.utils.unwrapObservable(fValueAccessor()))
|
||||
{
|
||||
$(oElement).click();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.modal = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
|
||||
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
|
||||
'keyboard': false,
|
||||
'show': ko.utils.unwrapObservable(fValueAccessor())
|
||||
})
|
||||
.on('shown', function () {
|
||||
Utils.windowResize();
|
||||
})
|
||||
.find('.close').click(function () {
|
||||
fValueAccessor()(false);
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).modal(ko.utils.unwrapObservable(fValueAccessor()) ? 'show' : 'hide');
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nInit = {
|
||||
'init': function (oElement) {
|
||||
Utils.i18nToNode(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nUpdate = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
ko.utils.unwrapObservable(fValueAccessor());
|
||||
Utils.i18nToNode(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.link = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).attr('href', ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.title = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).attr('title', ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.textF = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.initDom = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
fValueAccessor()(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.initResizeTrigger = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
var aValues = ko.utils.unwrapObservable(fValueAccessor());
|
||||
$(oElement).css({
|
||||
'height': aValues[1],
|
||||
'min-height': aValues[1]
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var
|
||||
aValues = ko.utils.unwrapObservable(fValueAccessor()),
|
||||
iValue = Utils.pInt(aValues[1]),
|
||||
iSize = 0,
|
||||
iOffset = $(oElement).offset().top
|
||||
;
|
||||
|
||||
if (0 < iOffset)
|
||||
{
|
||||
iOffset += Utils.pInt(aValues[2]);
|
||||
iSize = $window.height() - iOffset;
|
||||
|
||||
if (iValue < iSize)
|
||||
{
|
||||
iValue = iSize;
|
||||
}
|
||||
|
||||
$(oElement).css({
|
||||
'height': iValue,
|
||||
'min-height': iValue
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.appendDom = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).hide().empty().append(ko.utils.unwrapObservable(fValueAccessor())).show();
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.draggable = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
iTriggerZone = 100,
|
||||
iScrollSpeed = 3,
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
sDroppableSelector = fAllValueFunc && fAllValueFunc['droppableSelector'] ? fAllValueFunc['droppableSelector'] : '',
|
||||
oConf = {
|
||||
'distance': 20,
|
||||
'handle': '.dragHandle',
|
||||
'cursorAt': {'top': 22, 'left': 3},
|
||||
'refreshPositions': true,
|
||||
'scroll': true
|
||||
}
|
||||
;
|
||||
|
||||
if (sDroppableSelector)
|
||||
{
|
||||
oConf['drag'] = function (oEvent) {
|
||||
|
||||
$(sDroppableSelector).each(function () {
|
||||
var
|
||||
moveUp = null,
|
||||
moveDown = null,
|
||||
$this = $(this),
|
||||
oOffset = $this.offset(),
|
||||
bottomPos = oOffset.top + $this.height()
|
||||
;
|
||||
|
||||
window.clearInterval($this.data('timerScroll'));
|
||||
$this.data('timerScroll', false);
|
||||
|
||||
if (oEvent.pageX >= oOffset.left && oEvent.pageX <= oOffset.left + $this.width())
|
||||
{
|
||||
if (oEvent.pageY >= bottomPos - iTriggerZone && oEvent.pageY <= bottomPos)
|
||||
{
|
||||
moveUp = function() {
|
||||
$this.scrollTop($this.scrollTop() + iScrollSpeed);
|
||||
Utils.windowResize();
|
||||
};
|
||||
|
||||
$this.data('timerScroll', window.setInterval(moveUp, 10));
|
||||
moveUp();
|
||||
}
|
||||
|
||||
if (oEvent.pageY >= oOffset.top && oEvent.pageY <= oOffset.top + iTriggerZone)
|
||||
{
|
||||
moveDown = function() {
|
||||
$this.scrollTop($this.scrollTop() - iScrollSpeed);
|
||||
Utils.windowResize();
|
||||
};
|
||||
|
||||
$this.data('timerScroll', window.setInterval(moveDown, 10));
|
||||
moveDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
oConf['stop'] = function() {
|
||||
$(sDroppableSelector).each(function () {
|
||||
window.clearInterval($(this).data('timerScroll'));
|
||||
$(this).data('timerScroll', false);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
oConf['helper'] = function (oEvent) {
|
||||
return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null);
|
||||
};
|
||||
|
||||
$(oElement).draggable(oConf).on('mousedown', function () {
|
||||
Utils.removeInFocus();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.droppable = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
fValueFunc = fValueAccessor(),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fOverCallback = fAllValueFunc && fAllValueFunc['droppableOver'] ? fAllValueFunc['droppableOver'] : null,
|
||||
fOutCallback = fAllValueFunc && fAllValueFunc['droppableOut'] ? fAllValueFunc['droppableOut'] : null,
|
||||
oConf = {
|
||||
'tolerance': 'pointer',
|
||||
'hoverClass': 'droppableHover'
|
||||
}
|
||||
;
|
||||
|
||||
if (fValueFunc)
|
||||
{
|
||||
oConf['drop'] = function (oEvent, oUi) {
|
||||
fValueFunc(oEvent, oUi);
|
||||
};
|
||||
|
||||
if (fOverCallback)
|
||||
{
|
||||
oConf['over'] = function (oEvent, oUi) {
|
||||
fOverCallback(oEvent, oUi);
|
||||
};
|
||||
}
|
||||
|
||||
if (fOutCallback)
|
||||
{
|
||||
oConf['out'] = function (oEvent, oUi) {
|
||||
fOutCallback(oEvent, oUi);
|
||||
};
|
||||
}
|
||||
|
||||
$(oElement).droppable(oConf);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.nano = {
|
||||
'init': function (oElement) {
|
||||
if (!Globals.bDisableNanoScroll)
|
||||
{
|
||||
$(oElement)
|
||||
.addClass('nano')
|
||||
.nanoScroller({
|
||||
'iOSNativeScrolling': false,
|
||||
'preventPageScrolling': true
|
||||
})
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.saveTrigger = {
|
||||
'init': function (oElement) {
|
||||
|
||||
var $oEl = $(oElement);
|
||||
|
||||
$oEl.data('save-trigger-type', $oEl.is('input[type=text],input[type=email],input[type=password],select,textarea') ? 'input' : 'custom');
|
||||
|
||||
if ('custom' === $oEl.data('save-trigger-type'))
|
||||
{
|
||||
$oEl.append(
|
||||
' <i class="icon-spinner animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>'
|
||||
).addClass('settings-saved-trigger');
|
||||
}
|
||||
else
|
||||
{
|
||||
$oEl.addClass('settings-saved-trigger-input');
|
||||
}
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var
|
||||
mValue = ko.utils.unwrapObservable(fValueAccessor()),
|
||||
$oEl = $(oElement)
|
||||
;
|
||||
|
||||
if ('custom' === $oEl.data('save-trigger-type'))
|
||||
{
|
||||
switch (mValue.toString())
|
||||
{
|
||||
case '1':
|
||||
$oEl
|
||||
.find('.animated,.error').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.success').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case '0':
|
||||
$oEl
|
||||
.find('.animated,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.error').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case '-2':
|
||||
$oEl
|
||||
.find('.error,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.animated').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
default:
|
||||
$oEl
|
||||
.find('.animated').hide()
|
||||
.end()
|
||||
.find('.error,.success').removeClass('visible')
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mValue.toString())
|
||||
{
|
||||
case '1':
|
||||
$oEl.addClass('success').removeClass('error');
|
||||
break;
|
||||
case '0':
|
||||
$oEl.addClass('error').removeClass('success');
|
||||
break;
|
||||
case '-2':
|
||||
// $oEl;
|
||||
break;
|
||||
default:
|
||||
$oEl.removeClass('error success');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.emailsTags = {
|
||||
'init': function(oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fValue = fValueAccessor(),
|
||||
fFocusCallback = function (bValue) {
|
||||
if (fValue && fValue.focusTrigger)
|
||||
{
|
||||
fValue.focusTrigger(bValue);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
$oEl.inputosaurus({
|
||||
'parseOnBlur': true,
|
||||
'allowDragAndDrop': true,
|
||||
'focusCallback': fFocusCallback,
|
||||
'inputDelimiters': [',', ';'],
|
||||
'autoCompleteSource': function (oData, fResponse) {
|
||||
RL.getAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oEmailItem) {
|
||||
return oEmailItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
},
|
||||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oEmail = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oEmail = new EmailModel();
|
||||
oEmail.mailsoParse(sValue);
|
||||
oEmail.clearDuplicateName();
|
||||
return [oEmail.toLine(false), oEmail];
|
||||
}
|
||||
|
||||
return [sValue, null];
|
||||
|
||||
});
|
||||
},
|
||||
'change': _.bind(function (oEvent) {
|
||||
$oEl.data('EmailsTagsValue', oEvent.target.value);
|
||||
fValue(oEvent.target.value);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fEmailsTagsFilter = fAllValueFunc['emailsTagsFilter'] || null,
|
||||
sValue = ko.utils.unwrapObservable(fValueAccessor())
|
||||
;
|
||||
|
||||
if ($oEl.data('EmailsTagsValue') !== sValue)
|
||||
{
|
||||
$oEl.val(sValue);
|
||||
$oEl.data('EmailsTagsValue', sValue);
|
||||
$oEl.inputosaurus('refresh');
|
||||
}
|
||||
|
||||
if (fEmailsTagsFilter && ko.utils.unwrapObservable(fEmailsTagsFilter))
|
||||
{
|
||||
$oEl.inputosaurus('focus');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.contactTags = {
|
||||
'init': function(oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fValue = fValueAccessor(),
|
||||
fFocusCallback = function (bValue) {
|
||||
if (fValue && fValue.focusTrigger)
|
||||
{
|
||||
fValue.focusTrigger(bValue);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
$oEl.inputosaurus({
|
||||
'parseOnBlur': true,
|
||||
'allowDragAndDrop': false,
|
||||
'focusCallback': fFocusCallback,
|
||||
'inputDelimiters': [',', ';'],
|
||||
'outputDelimiter': ',',
|
||||
'autoCompleteSource': function (oData, fResponse) {
|
||||
RL.getContactTagsAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oTagItem) {
|
||||
return oTagItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
},
|
||||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oTag = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oTag = new ContactTagModel();
|
||||
oTag.name(sValue);
|
||||
return [oTag.toLine(false), oTag];
|
||||
}
|
||||
|
||||
return [sValue, null];
|
||||
|
||||
});
|
||||
},
|
||||
'change': _.bind(function (oEvent) {
|
||||
$oEl.data('ContactTagsValue', oEvent.target.value);
|
||||
fValue(oEvent.target.value);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fContactTagsFilter = fAllValueFunc['contactTagsFilter'] || null,
|
||||
sValue = ko.utils.unwrapObservable(fValueAccessor())
|
||||
;
|
||||
|
||||
if ($oEl.data('ContactTagsValue') !== sValue)
|
||||
{
|
||||
$oEl.val(sValue);
|
||||
$oEl.data('ContactTagsValue', sValue);
|
||||
$oEl.inputosaurus('refresh');
|
||||
}
|
||||
|
||||
if (fContactTagsFilter && ko.utils.unwrapObservable(fContactTagsFilter))
|
||||
{
|
||||
$oEl.inputosaurus('focus');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.command = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
var
|
||||
jqElement = $(oElement),
|
||||
oCommand = fValueAccessor()
|
||||
;
|
||||
|
||||
if (!oCommand || !oCommand.enabled || !oCommand.canExecute)
|
||||
{
|
||||
throw new Error('You are not using command function');
|
||||
}
|
||||
|
||||
jqElement.addClass('command');
|
||||
ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments);
|
||||
},
|
||||
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
|
||||
var
|
||||
bResult = true,
|
||||
jqElement = $(oElement),
|
||||
oCommand = fValueAccessor()
|
||||
;
|
||||
|
||||
bResult = oCommand.enabled();
|
||||
jqElement.toggleClass('command-not-enabled', !bResult);
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
bResult = oCommand.canExecute();
|
||||
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
||||
}
|
||||
|
||||
jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
|
||||
|
||||
if (jqElement.is('input') || jqElement.is('button'))
|
||||
{
|
||||
jqElement.prop('disabled', !bResult);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.extenders.trimmer = function (oTarget)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
oTarget(Utils.trim(sNewValue.toString()));
|
||||
},
|
||||
'owner': this
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.posInterer = function (oTarget, iDefault)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
var iNew = Utils.pInt(sNewValue.toString(), iDefault);
|
||||
if (0 >= iNew)
|
||||
{
|
||||
iNew = iDefault;
|
||||
}
|
||||
|
||||
if (iNew === oTarget() && '' + iNew !== '' + sNewValue)
|
||||
{
|
||||
oTarget(iNew + 1);
|
||||
}
|
||||
|
||||
oTarget(iNew);
|
||||
}
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.reversible = function (oTarget)
|
||||
{
|
||||
var mValue = oTarget();
|
||||
|
||||
oTarget.commit = function ()
|
||||
{
|
||||
mValue = oTarget();
|
||||
};
|
||||
|
||||
oTarget.reverse = function ()
|
||||
{
|
||||
oTarget(mValue);
|
||||
};
|
||||
|
||||
oTarget.commitedValue = function ()
|
||||
{
|
||||
return mValue;
|
||||
};
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.extenders.toggleSubscribe = function (oTarget, oOptions)
|
||||
{
|
||||
oTarget.subscribe(oOptions[1], oOptions[0], 'beforeChange');
|
||||
oTarget.subscribe(oOptions[2], oOptions[0]);
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.extenders.falseTimeout = function (oTarget, iOption)
|
||||
{
|
||||
oTarget.iTimeout = 0;
|
||||
oTarget.subscribe(function (bValue) {
|
||||
if (bValue)
|
||||
{
|
||||
window.clearTimeout(oTarget.iTimeout);
|
||||
oTarget.iTimeout = window.setTimeout(function () {
|
||||
oTarget(false);
|
||||
oTarget.iTimeout = 0;
|
||||
}, Utils.pInt(iOption));
|
||||
}
|
||||
});
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateNone = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
||||
this.subscribe(function (sValue) {
|
||||
sValue = Utils.trim(sValue);
|
||||
this.hasError('' !== sValue && !(/^[^@\s]+@[^@\s]+$/.test(sValue)));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateSimpleEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
||||
this.subscribe(function (sValue) {
|
||||
sValue = Utils.trim(sValue);
|
||||
this.hasError('' !== sValue && !(/^.+@.+$/.test(sValue)));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateFunc = function (fFunc)
|
||||
{
|
||||
this.hasFuncError = ko.observable(false);
|
||||
|
||||
if (Utils.isFunc(fFunc))
|
||||
{
|
||||
this.subscribe(function (sValue) {
|
||||
this.hasFuncError(!fFunc(sValue));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
@ -1,315 +1,328 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LinkBuilder()
|
||||
{
|
||||
this.sBase = '#/';
|
||||
this.sServer = './?';
|
||||
this.sVersion = RL.settingsGet('Version');
|
||||
this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
|
||||
this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
|
||||
}
|
||||
(function (module) {
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.root = function ()
|
||||
{
|
||||
return this.sBase;
|
||||
};
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @param {string} sDownload
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.attachmentDownload = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sDownload
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.attachmentPreview = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sDownload
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.upload = function ()
|
||||
{
|
||||
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.uploadContacts = function ()
|
||||
{
|
||||
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.uploadBackground = function ()
|
||||
{
|
||||
return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.append = function ()
|
||||
{
|
||||
return this.sServer + '/Append/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.change = function (sEmail)
|
||||
{
|
||||
return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string=} sAdd
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.ajax = function (sAdd)
|
||||
{
|
||||
return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sRequestHash
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sRequestHash
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.avatarLink = function (sEmail)
|
||||
{
|
||||
return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
|
||||
// return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.inbox = function ()
|
||||
{
|
||||
return this.sBase + 'mailbox/Inbox';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.messagePreview = function ()
|
||||
{
|
||||
return this.sBase + 'mailbox/message-preview';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string=} sScreenName
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.settings = function (sScreenName)
|
||||
{
|
||||
var sResult = this.sBase + 'settings';
|
||||
if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
Utils = require('./Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LinkBuilder()
|
||||
{
|
||||
sResult += '/' + sScreenName;
|
||||
this.sBase = '#/';
|
||||
this.sServer = './?';
|
||||
this.sVersion = RL.settingsGet('Version');
|
||||
this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
|
||||
this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.admin = function (sScreenName)
|
||||
{
|
||||
var sResult = this.sBase;
|
||||
switch (sScreenName) {
|
||||
case 'AdminDomains':
|
||||
sResult += 'domains';
|
||||
break;
|
||||
case 'AdminSecurity':
|
||||
sResult += 'security';
|
||||
break;
|
||||
case 'AdminLicensing':
|
||||
sResult += 'licensing';
|
||||
break;
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolder
|
||||
* @param {number=} iPage = 1
|
||||
* @param {string=} sSearch = ''
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
|
||||
{
|
||||
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
|
||||
sSearch = Utils.pString(sSearch);
|
||||
|
||||
var sResult = this.sBase + 'mailbox/';
|
||||
if ('' !== sFolder)
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.root = function ()
|
||||
{
|
||||
sResult += encodeURI(sFolder);
|
||||
}
|
||||
if (1 < iPage)
|
||||
return this.sBase;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sDownload
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.attachmentDownload = function (sDownload)
|
||||
{
|
||||
sResult = sResult.replace(/[\/]+$/, '');
|
||||
sResult += '/p' + iPage;
|
||||
}
|
||||
if ('' !== sSearch)
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sDownload
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.attachmentPreview = function (sDownload)
|
||||
{
|
||||
sResult = sResult.replace(/[\/]+$/, '');
|
||||
sResult += '/' + encodeURI(sSearch);
|
||||
}
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
|
||||
};
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.phpInfo = function ()
|
||||
{
|
||||
return this.sServer + 'Info';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sLang
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.langLink = function (sLang)
|
||||
{
|
||||
return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.exportContactsVcf = function ()
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.exportContactsCsv = function ()
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.emptyContactPic = function ()
|
||||
{
|
||||
return this.sStaticPrefix + 'css/images/empty-contact.png';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFileName
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.sound = function (sFileName)
|
||||
{
|
||||
return this.sStaticPrefix + 'sounds/' + sFileName;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sTheme
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.themePreviewLink = function (sTheme)
|
||||
{
|
||||
var sPrefix = 'rainloop/v/' + this.sVersion + '/';
|
||||
if ('@custom' === sTheme.substr(-7))
|
||||
/**
|
||||
* @param {string} sDownload
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
|
||||
{
|
||||
sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
|
||||
sPrefix = '';
|
||||
}
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
|
||||
};
|
||||
|
||||
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
|
||||
};
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.upload = function ()
|
||||
{
|
||||
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.notificationMailIcon = function ()
|
||||
{
|
||||
return this.sStaticPrefix + 'css/images/icom-message-notification.png';
|
||||
};
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.uploadContacts = function ()
|
||||
{
|
||||
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.openPgpJs = function ()
|
||||
{
|
||||
return this.sStaticPrefix + 'js/openpgp.min.js';
|
||||
};
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.uploadBackground = function ()
|
||||
{
|
||||
return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.socialGoogle = function ()
|
||||
{
|
||||
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.append = function ()
|
||||
{
|
||||
return this.sServer + '/Append/' + this.sSpecSuffix + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.socialTwitter = function ()
|
||||
{
|
||||
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.change = function (sEmail)
|
||||
{
|
||||
return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.socialFacebook = function ()
|
||||
{
|
||||
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
/**
|
||||
* @param {string=} sAdd
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.ajax = function (sAdd)
|
||||
{
|
||||
return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sRequestHash
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sRequestHash
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.avatarLink = function (sEmail)
|
||||
{
|
||||
return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
|
||||
// return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.inbox = function ()
|
||||
{
|
||||
return this.sBase + 'mailbox/Inbox';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.messagePreview = function ()
|
||||
{
|
||||
return this.sBase + 'mailbox/message-preview';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string=} sScreenName
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.settings = function (sScreenName)
|
||||
{
|
||||
var sResult = this.sBase + 'settings';
|
||||
if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
|
||||
{
|
||||
sResult += '/' + sScreenName;
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.admin = function (sScreenName)
|
||||
{
|
||||
var sResult = this.sBase;
|
||||
switch (sScreenName) {
|
||||
case 'AdminDomains':
|
||||
sResult += 'domains';
|
||||
break;
|
||||
case 'AdminSecurity':
|
||||
sResult += 'security';
|
||||
break;
|
||||
case 'AdminLicensing':
|
||||
sResult += 'licensing';
|
||||
break;
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolder
|
||||
* @param {number=} iPage = 1
|
||||
* @param {string=} sSearch = ''
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
|
||||
{
|
||||
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
|
||||
sSearch = Utils.pString(sSearch);
|
||||
|
||||
var sResult = this.sBase + 'mailbox/';
|
||||
if ('' !== sFolder)
|
||||
{
|
||||
sResult += encodeURI(sFolder);
|
||||
}
|
||||
if (1 < iPage)
|
||||
{
|
||||
sResult = sResult.replace(/[\/]+$/, '');
|
||||
sResult += '/p' + iPage;
|
||||
}
|
||||
if ('' !== sSearch)
|
||||
{
|
||||
sResult = sResult.replace(/[\/]+$/, '');
|
||||
sResult += '/' + encodeURI(sSearch);
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.phpInfo = function ()
|
||||
{
|
||||
return this.sServer + 'Info';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sLang
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.langLink = function (sLang)
|
||||
{
|
||||
return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.exportContactsVcf = function ()
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.exportContactsCsv = function ()
|
||||
{
|
||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.emptyContactPic = function ()
|
||||
{
|
||||
return this.sStaticPrefix + 'css/images/empty-contact.png';
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFileName
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.sound = function (sFileName)
|
||||
{
|
||||
return this.sStaticPrefix + 'sounds/' + sFileName;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sTheme
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.themePreviewLink = function (sTheme)
|
||||
{
|
||||
var sPrefix = 'rainloop/v/' + this.sVersion + '/';
|
||||
if ('@custom' === sTheme.substr(-7))
|
||||
{
|
||||
sTheme = Utils.trim(sTheme.substring(0, sTheme.length - 7));
|
||||
sPrefix = '';
|
||||
}
|
||||
|
||||
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.notificationMailIcon = function ()
|
||||
{
|
||||
return this.sStaticPrefix + 'css/images/icom-message-notification.png';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.openPgpJs = function ()
|
||||
{
|
||||
return this.sStaticPrefix + 'js/openpgp.min.js';
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.socialGoogle = function ()
|
||||
{
|
||||
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.socialTwitter = function ()
|
||||
{
|
||||
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
LinkBuilder.prototype.socialFacebook = function ()
|
||||
{
|
||||
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
module.exports = LinkBuilder;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,260 +1,274 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} oElement
|
||||
* @param {Function=} fOnBlur
|
||||
* @param {Function=} fOnReady
|
||||
* @param {Function=} fOnModeChange
|
||||
*/
|
||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
||||
{
|
||||
var self = this;
|
||||
self.editor = null;
|
||||
self.iBlurTimer = 0;
|
||||
self.fOnBlur = fOnBlur || null;
|
||||
self.fOnReady = fOnReady || null;
|
||||
self.fOnModeChange = fOnModeChange || null;
|
||||
(function (module) {
|
||||
|
||||
self.$element = $(oElement);
|
||||
'use strict';
|
||||
|
||||
self.resize = _.throttle(_.bind(self.resize, self), 100);
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
Globals = require('./Globals.js')
|
||||
;
|
||||
|
||||
self.init();
|
||||
}
|
||||
|
||||
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
|
||||
{
|
||||
if (this.fOnBlur)
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} oElement
|
||||
* @param {Function=} fOnBlur
|
||||
* @param {Function=} fOnReady
|
||||
* @param {Function=} fOnModeChange
|
||||
*/
|
||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
||||
{
|
||||
var self = this;
|
||||
window.clearTimeout(self.iBlurTimer);
|
||||
self.iBlurTimer = window.setTimeout(function () {
|
||||
self.fOnBlur();
|
||||
}, 200);
|
||||
self.editor = null;
|
||||
self.iBlurTimer = 0;
|
||||
self.fOnBlur = fOnBlur || null;
|
||||
self.fOnReady = fOnReady || null;
|
||||
self.fOnModeChange = fOnModeChange || null;
|
||||
|
||||
self.$element = $(oElement);
|
||||
|
||||
self.resize = _.throttle(_.bind(self.resize, self), 100);
|
||||
|
||||
self.init();
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
|
||||
{
|
||||
if (this.fOnBlur)
|
||||
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
|
||||
{
|
||||
window.clearTimeout(this.iBlurTimer);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
NewHtmlEditorWrapper.prototype.isHtml = function ()
|
||||
{
|
||||
return this.editor ? 'wysiwyg' === this.editor.mode : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
NewHtmlEditorWrapper.prototype.checkDirty = function ()
|
||||
{
|
||||
return this.editor ? this.editor.checkDirty() : false;
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.resetDirty = function ()
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
this.editor.resetDirty();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
|
||||
if (this.fOnBlur)
|
||||
{
|
||||
return this.editor.__plain.getRawData();
|
||||
var self = this;
|
||||
window.clearTimeout(self.iBlurTimer);
|
||||
self.iBlurTimer = window.setTimeout(function () {
|
||||
self.fOnBlur();
|
||||
}, 200);
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
|
||||
{
|
||||
if (this.fOnBlur)
|
||||
{
|
||||
window.clearTimeout(this.iBlurTimer);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
NewHtmlEditorWrapper.prototype.isHtml = function ()
|
||||
{
|
||||
return this.editor ? 'wysiwyg' === this.editor.mode : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {boolean}
|
||||
*/
|
||||
NewHtmlEditorWrapper.prototype.checkDirty = function ()
|
||||
{
|
||||
return this.editor ? this.editor.checkDirty() : false;
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.resetDirty = function ()
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
this.editor.resetDirty();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
|
||||
{
|
||||
return this.editor.__plain.getRawData();
|
||||
}
|
||||
|
||||
return bWrapIsHtml ?
|
||||
'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' +
|
||||
this.editor.getData() + '</div>' : this.editor.getData();
|
||||
}
|
||||
|
||||
return bWrapIsHtml ?
|
||||
'<div data-html-editor-font-wrapper="true" style="font-family: arial, sans-serif; font-size: 13px;">' +
|
||||
this.editor.getData() + '</div>' : this.editor.getData();
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
|
||||
{
|
||||
if (this.editor)
|
||||
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
|
||||
{
|
||||
if (bPlain)
|
||||
if (this.editor)
|
||||
{
|
||||
if ('plain' === this.editor.mode)
|
||||
if (bPlain)
|
||||
{
|
||||
this.editor.setMode('wysiwyg');
|
||||
if ('plain' === this.editor.mode)
|
||||
{
|
||||
this.editor.setMode('wysiwyg');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ('wysiwyg' === this.editor.mode)
|
||||
{
|
||||
this.editor.setMode('plain');
|
||||
}
|
||||
}
|
||||
|
||||
this.resize();
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
this.modeToggle(true);
|
||||
this.editor.setData(sHtml);
|
||||
|
||||
if (bFocus)
|
||||
{
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
else
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
if ('wysiwyg' === this.editor.mode)
|
||||
this.modeToggle(false);
|
||||
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
|
||||
{
|
||||
this.editor.setMode('plain');
|
||||
return this.editor.__plain.setRawData(sPlain);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.editor.setData(sPlain);
|
||||
}
|
||||
|
||||
if (bFocus)
|
||||
{
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.resize();
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
|
||||
{
|
||||
if (this.editor)
|
||||
NewHtmlEditorWrapper.prototype.init = function ()
|
||||
{
|
||||
this.modeToggle(true);
|
||||
this.editor.setData(sHtml);
|
||||
|
||||
if (bFocus)
|
||||
if (this.$element && this.$element[0])
|
||||
{
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
var
|
||||
self = this,
|
||||
fInit = function () {
|
||||
|
||||
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
this.modeToggle(false);
|
||||
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
|
||||
{
|
||||
return this.editor.__plain.setRawData(sPlain);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.editor.setData(sPlain);
|
||||
}
|
||||
var
|
||||
oConfig = Globals.oHtmlEditorDefaultConfig,
|
||||
sLanguage = RL.settingsGet('Language'), // TODO cjs
|
||||
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
|
||||
;
|
||||
|
||||
if (bFocus)
|
||||
{
|
||||
this.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.init = function ()
|
||||
{
|
||||
if (this.$element && this.$element[0])
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
fInit = function () {
|
||||
|
||||
var
|
||||
oConfig = Globals.oHtmlEditorDefaultConfig,
|
||||
sLanguage = RL.settingsGet('Language'),
|
||||
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
|
||||
;
|
||||
|
||||
if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)
|
||||
{
|
||||
oConfig.toolbarGroups.__SourceInited = true;
|
||||
oConfig.toolbarGroups.push({name: 'document', groups: ['mode', 'document', 'doctools']});
|
||||
}
|
||||
|
||||
oConfig.enterMode = window.CKEDITOR.ENTER_BR;
|
||||
oConfig.shiftEnterMode = window.CKEDITOR.ENTER_BR;
|
||||
|
||||
oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
|
||||
if (window.CKEDITOR.env)
|
||||
{
|
||||
window.CKEDITOR.env.isCompatible = true;
|
||||
}
|
||||
|
||||
self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
|
||||
|
||||
self.editor.on('key', function(oEvent) {
|
||||
if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
|
||||
if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)
|
||||
{
|
||||
return false;
|
||||
oConfig.toolbarGroups.__SourceInited = true;
|
||||
oConfig.toolbarGroups.push({name: 'document', groups: ['mode', 'document', 'doctools']});
|
||||
}
|
||||
});
|
||||
|
||||
self.editor.on('blur', function() {
|
||||
self.blurTrigger();
|
||||
});
|
||||
oConfig.enterMode = window.CKEDITOR.ENTER_BR;
|
||||
oConfig.shiftEnterMode = window.CKEDITOR.ENTER_BR;
|
||||
|
||||
self.editor.on('mode', function() {
|
||||
|
||||
self.blurTrigger();
|
||||
|
||||
if (self.fOnModeChange)
|
||||
oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
|
||||
if (window.CKEDITOR.env)
|
||||
{
|
||||
self.fOnModeChange('plain' !== self.editor.mode);
|
||||
window.CKEDITOR.env.isCompatible = true;
|
||||
}
|
||||
});
|
||||
|
||||
self.editor.on('focus', function() {
|
||||
self.focusTrigger();
|
||||
});
|
||||
self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
|
||||
|
||||
if (self.fOnReady)
|
||||
{
|
||||
self.editor.on('instanceReady', function () {
|
||||
|
||||
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
|
||||
|
||||
self.fOnReady();
|
||||
self.__resizable = true;
|
||||
self.resize();
|
||||
self.editor.on('key', function(oEvent) {
|
||||
if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
self.editor.on('blur', function() {
|
||||
self.blurTrigger();
|
||||
});
|
||||
|
||||
self.editor.on('mode', function() {
|
||||
|
||||
self.blurTrigger();
|
||||
|
||||
if (self.fOnModeChange)
|
||||
{
|
||||
self.fOnModeChange('plain' !== self.editor.mode);
|
||||
}
|
||||
});
|
||||
|
||||
self.editor.on('focus', function() {
|
||||
self.focusTrigger();
|
||||
});
|
||||
|
||||
if (self.fOnReady)
|
||||
{
|
||||
self.editor.on('instanceReady', function () {
|
||||
|
||||
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
|
||||
|
||||
self.fOnReady();
|
||||
self.__resizable = true;
|
||||
self.resize();
|
||||
});
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
if (window.CKEDITOR)
|
||||
{
|
||||
fInit();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.__initEditor = fInit;
|
||||
}
|
||||
;
|
||||
|
||||
if (window.CKEDITOR)
|
||||
{
|
||||
fInit();
|
||||
}
|
||||
else
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.focus = function ()
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
window.__initEditor = fInit;
|
||||
this.editor.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.focus = function ()
|
||||
{
|
||||
if (this.editor)
|
||||
NewHtmlEditorWrapper.prototype.blur = function ()
|
||||
{
|
||||
this.editor.focus();
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.blur = function ()
|
||||
{
|
||||
if (this.editor)
|
||||
{
|
||||
this.editor.focusManager.blur(true);
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.resize = function ()
|
||||
{
|
||||
if (this.editor && this.__resizable)
|
||||
{
|
||||
try
|
||||
if (this.editor)
|
||||
{
|
||||
this.editor.resize(this.$element.width(), this.$element.innerHeight());
|
||||
this.editor.focusManager.blur(true);
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
|
||||
{
|
||||
this.setHtml('', bFocus);
|
||||
};
|
||||
NewHtmlEditorWrapper.prototype.resize = function ()
|
||||
{
|
||||
if (this.editor && this.__resizable)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.editor.resize(this.$element.width(), this.$element.innerHeight());
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
};
|
||||
|
||||
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
|
||||
{
|
||||
this.setHtml('', bFocus);
|
||||
};
|
||||
|
||||
|
||||
module.exports = NewHtmlEditorWrapper;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,95 +1,106 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Plugins.oViewModelsHooks = {};
|
||||
(function (module) {
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Plugins.oSimpleHooks = {};
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @param {Function} ViewModel
|
||||
*/
|
||||
Plugins.regViewModelHook = function (sName, ViewModel)
|
||||
{
|
||||
if (ViewModel)
|
||||
var
|
||||
Plugins = {},
|
||||
Utils = require('./Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Plugins.oViewModelsHooks = {};
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Plugins.oSimpleHooks = {};
|
||||
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @param {Function} ViewModel
|
||||
*/
|
||||
Plugins.regViewModelHook = function (sName, ViewModel)
|
||||
{
|
||||
ViewModel.__hookName = sName;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @param {Function} fCallback
|
||||
*/
|
||||
Plugins.addHook = function (sName, fCallback)
|
||||
{
|
||||
if (Utils.isFunc(fCallback))
|
||||
{
|
||||
if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
|
||||
if (ViewModel)
|
||||
{
|
||||
Plugins.oSimpleHooks[sName] = [];
|
||||
ViewModel.__hookName = sName;
|
||||
}
|
||||
|
||||
Plugins.oSimpleHooks[sName].push(fCallback);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @param {Array=} aArguments
|
||||
*/
|
||||
Plugins.runHook = function (sName, aArguments)
|
||||
{
|
||||
if (Utils.isArray(Plugins.oSimpleHooks[sName]))
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @param {Function} fCallback
|
||||
*/
|
||||
Plugins.addHook = function (sName, fCallback)
|
||||
{
|
||||
aArguments = aArguments || [];
|
||||
|
||||
_.each(Plugins.oSimpleHooks[sName], function (fCallback) {
|
||||
fCallback.apply(null, aArguments);
|
||||
});
|
||||
}
|
||||
};
|
||||
if (Utils.isFunc(fCallback))
|
||||
{
|
||||
if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
|
||||
{
|
||||
Plugins.oSimpleHooks[sName] = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @return {?}
|
||||
*/
|
||||
Plugins.mainSettingsGet = function (sName)
|
||||
{
|
||||
return RL ? RL.settingsGet(sName) : null;
|
||||
};
|
||||
Plugins.oSimpleHooks[sName].push(fCallback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Function} fCallback
|
||||
* @param {string} sAction
|
||||
* @param {Object=} oParameters
|
||||
* @param {?number=} iTimeout
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
*/
|
||||
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
if (RL)
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @param {Array=} aArguments
|
||||
*/
|
||||
Plugins.runHook = function (sName, aArguments)
|
||||
{
|
||||
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
|
||||
}
|
||||
};
|
||||
if (Utils.isArray(Plugins.oSimpleHooks[sName]))
|
||||
{
|
||||
aArguments = aArguments || [];
|
||||
|
||||
/**
|
||||
* @param {string} sPluginSection
|
||||
* @param {string} sName
|
||||
* @return {?}
|
||||
*/
|
||||
Plugins.settingsGet = function (sPluginSection, sName)
|
||||
{
|
||||
var oPlugin = Plugins.mainSettingsGet('Plugins');
|
||||
oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
|
||||
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
|
||||
};
|
||||
_.each(Plugins.oSimpleHooks[sName], function (fCallback) {
|
||||
fCallback.apply(null, aArguments);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sName
|
||||
* @return {?}
|
||||
*/
|
||||
Plugins.mainSettingsGet = function (sName)
|
||||
{
|
||||
return RL ? RL.settingsGet(sName) : null; // TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Function} fCallback
|
||||
* @param {string} sAction
|
||||
* @param {Object=} oParameters
|
||||
* @param {?number=} iTimeout
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
*/
|
||||
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
if (RL) // TODO cjs
|
||||
{
|
||||
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions); // TODO cjs
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sPluginSection
|
||||
* @param {string} sName
|
||||
* @return {?}
|
||||
*/
|
||||
Plugins.settingsGet = function (sPluginSection, sName)
|
||||
{
|
||||
var oPlugin = Plugins.mainSettingsGet('Plugins');
|
||||
oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
|
||||
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
|
||||
};
|
||||
|
||||
module.exports = Plugins;
|
||||
|
||||
}(module));
|
||||
File diff suppressed because it is too large
Load diff
3963
dev/Common/Utils.js
3963
dev/Common/Utils.js
File diff suppressed because it is too large
Load diff
|
|
@ -1,78 +0,0 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Consts = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Enums = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
NotificationI18N = {},
|
||||
|
||||
/**
|
||||
* @type {Object.<Function>}
|
||||
*/
|
||||
Utils = {},
|
||||
|
||||
/**
|
||||
* @type {Object.<Function>}
|
||||
*/
|
||||
Plugins = {},
|
||||
|
||||
/**
|
||||
* @type {Object.<Function>}
|
||||
*/
|
||||
Base64 = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Globals = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
ViewModels = {
|
||||
'settings': [],
|
||||
'settings-removed': [],
|
||||
'settings-disabled': []
|
||||
},
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
BootstrapDropdowns = [],
|
||||
|
||||
/**
|
||||
* @type {*}
|
||||
*/
|
||||
kn = null,
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
AppData = window['rainloopAppData'] || {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
I18n = window['rainloopI18N'] || {},
|
||||
|
||||
$html = $('html'),
|
||||
|
||||
// $body = $('body'),
|
||||
|
||||
$window = $(window),
|
||||
|
||||
$document = $(window.document),
|
||||
|
||||
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
|
||||
;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/*jshint onevar: false*/
|
||||
/**
|
||||
* @type {?AdminApp}
|
||||
*/
|
||||
var RL = null;
|
||||
/*jshint onevar: true*/
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/*jshint onevar: false*/
|
||||
/**
|
||||
* @type {?RainLoopApp}
|
||||
*/
|
||||
var
|
||||
RL = null,
|
||||
|
||||
$proxyDiv = $('<div></div>')
|
||||
;
|
||||
/*jshint onevar: true*/
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
|
||||
|
||||
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
|
||||
$window.unload(function () {
|
||||
Globals.bUnload = true;
|
||||
});
|
||||
|
||||
$html.on('click.dropdown.data-api', function () {
|
||||
Utils.detectDropdownVisibility();
|
||||
});
|
||||
|
||||
// export
|
||||
window['rl'] = window['rl'] || {};
|
||||
window['rl']['addHook'] = Plugins.addHook;
|
||||
window['rl']['settingsGet'] = Plugins.mainSettingsGet;
|
||||
window['rl']['remoteRequest'] = Plugins.remoteRequest;
|
||||
window['rl']['pluginSettingsGet'] = Plugins.settingsGet;
|
||||
window['rl']['addSettingsViewModel'] = Utils.addSettingsViewModel;
|
||||
window['rl']['createCommand'] = Utils.createCommand;
|
||||
|
||||
window['rl']['EmailModel'] = EmailModel;
|
||||
window['rl']['Enums'] = Enums;
|
||||
|
||||
window['__RLBOOT'] = function (fCall) {
|
||||
|
||||
// boot
|
||||
$(function () {
|
||||
|
||||
if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
|
||||
{
|
||||
$('#rl-templates').html(window['rainloopTEMPLATES'][0]);
|
||||
|
||||
_.delay(function () {
|
||||
window['rainloopAppData'] = {};
|
||||
window['rainloopI18N'] = {};
|
||||
window['rainloopTEMPLATES'] = {};
|
||||
|
||||
kn.setBoot(RL).bootstart();
|
||||
$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
|
||||
|
||||
}, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
fCall(false);
|
||||
}
|
||||
|
||||
window['__RLBOOT'] = null;
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue