mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Code refactoring
This commit is contained in:
parent
759327527f
commit
fa795947cf
29 changed files with 478 additions and 890 deletions
|
|
@ -8,9 +8,6 @@
|
||||||
$ = require('$'),
|
$ = require('$'),
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
window = require('window'),
|
window = require('window'),
|
||||||
$html = require('$html'),
|
|
||||||
$win = require('$win'),
|
|
||||||
$doc = require('$doc'),
|
|
||||||
|
|
||||||
Globals = require('Globals'),
|
Globals = require('Globals'),
|
||||||
Utils = require('Utils'),
|
Utils = require('Utils'),
|
||||||
|
|
@ -35,7 +32,7 @@
|
||||||
|
|
||||||
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
|
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
|
||||||
|
|
||||||
$win.on('error', function (oEvent) {
|
Globals.$win.on('error', function (oEvent) {
|
||||||
if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
|
if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
|
||||||
-1 === Utils.inArray(oEvent.originalEvent.message, [
|
-1 === Utils.inArray(oEvent.originalEvent.message, [
|
||||||
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
||||||
|
|
@ -47,21 +44,21 @@
|
||||||
oEvent.originalEvent.filename,
|
oEvent.originalEvent.filename,
|
||||||
oEvent.originalEvent.lineno,
|
oEvent.originalEvent.lineno,
|
||||||
window.location && window.location.toString ? window.location.toString() : '',
|
window.location && window.location.toString ? window.location.toString() : '',
|
||||||
$html.attr('class'),
|
Globals.$html.attr('class'),
|
||||||
Utils.microtime() - Globals.now
|
Utils.microtime() - Globals.now
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$doc.on('keydown', function (oEvent) {
|
Globals.$doc.on('keydown', function (oEvent) {
|
||||||
if (oEvent && oEvent.ctrlKey)
|
if (oEvent && oEvent.ctrlKey)
|
||||||
{
|
{
|
||||||
$html.addClass('rl-ctrl-key-pressed');
|
Globals.$html.addClass('rl-ctrl-key-pressed');
|
||||||
}
|
}
|
||||||
}).on('keyup', function (oEvent) {
|
}).on('keyup', function (oEvent) {
|
||||||
if (oEvent && !oEvent.ctrlKey)
|
if (oEvent && !oEvent.ctrlKey)
|
||||||
{
|
{
|
||||||
$html.removeClass('rl-ctrl-key-pressed');
|
Globals.$html.removeClass('rl-ctrl-key-pressed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -210,11 +207,11 @@
|
||||||
'id': 'mobile',
|
'id': 'mobile',
|
||||||
'maxWidth': 767,
|
'maxWidth': 767,
|
||||||
'onEnter': function() {
|
'onEnter': function() {
|
||||||
$html.addClass('ssm-state-mobile');
|
Globals.$html.addClass('ssm-state-mobile');
|
||||||
Events.pub('ssm.mobile-enter');
|
Events.pub('ssm.mobile-enter');
|
||||||
},
|
},
|
||||||
'onLeave': function() {
|
'onLeave': function() {
|
||||||
$html.removeClass('ssm-state-mobile');
|
Globals.$html.removeClass('ssm-state-mobile');
|
||||||
Events.pub('ssm.mobile-leave');
|
Events.pub('ssm.mobile-leave');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -224,10 +221,10 @@
|
||||||
'minWidth': 768,
|
'minWidth': 768,
|
||||||
'maxWidth': 999,
|
'maxWidth': 999,
|
||||||
'onEnter': function() {
|
'onEnter': function() {
|
||||||
$html.addClass('ssm-state-tablet');
|
Globals.$html.addClass('ssm-state-tablet');
|
||||||
},
|
},
|
||||||
'onLeave': function() {
|
'onLeave': function() {
|
||||||
$html.removeClass('ssm-state-tablet');
|
Globals.$html.removeClass('ssm-state-tablet');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -236,10 +233,10 @@
|
||||||
'minWidth': 1000,
|
'minWidth': 1000,
|
||||||
'maxWidth': 1400,
|
'maxWidth': 1400,
|
||||||
'onEnter': function() {
|
'onEnter': function() {
|
||||||
$html.addClass('ssm-state-desktop');
|
Globals.$html.addClass('ssm-state-desktop');
|
||||||
},
|
},
|
||||||
'onLeave': function() {
|
'onLeave': function() {
|
||||||
$html.removeClass('ssm-state-desktop');
|
Globals.$html.removeClass('ssm-state-desktop');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -247,10 +244,10 @@
|
||||||
'id': 'desktop-large',
|
'id': 'desktop-large',
|
||||||
'minWidth': 1400,
|
'minWidth': 1400,
|
||||||
'onEnter': function() {
|
'onEnter': function() {
|
||||||
$html.addClass('ssm-state-desktop-large');
|
Globals.$html.addClass('ssm-state-desktop-large');
|
||||||
},
|
},
|
||||||
'onLeave': function() {
|
'onLeave': function() {
|
||||||
$html.removeClass('ssm-state-desktop-large');
|
Globals.$html.removeClass('ssm-state-desktop-large');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -263,7 +260,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.leftPanelDisabled.subscribe(function (bValue) {
|
Globals.leftPanelDisabled.subscribe(function (bValue) {
|
||||||
$html.toggleClass('rl-left-panel-disabled', bValue);
|
Globals.$html.toggleClass('rl-left-panel-disabled', bValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
ssm.ready();
|
ssm.ready();
|
||||||
|
|
|
||||||
12
dev/Boot.js
12
dev/Boot.js
|
|
@ -10,8 +10,6 @@
|
||||||
window = require('window'),
|
window = require('window'),
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
$ = require('$'),
|
$ = require('$'),
|
||||||
$win = require('$win'),
|
|
||||||
$html = require('$html'),
|
|
||||||
|
|
||||||
Globals = require('Globals'),
|
Globals = require('Globals'),
|
||||||
Plugins = require('Plugins'),
|
Plugins = require('Plugins'),
|
||||||
|
|
@ -29,15 +27,15 @@
|
||||||
Plugins.__remote = App.remote();
|
Plugins.__remote = App.remote();
|
||||||
Plugins.__data = App.data();
|
Plugins.__data = App.data();
|
||||||
|
|
||||||
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
|
Globals.$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
|
||||||
|
|
||||||
$win.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
|
Globals.$win.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
|
||||||
|
|
||||||
$win.unload(function () {
|
Globals.$win.unload(function () {
|
||||||
Globals.bUnload = true;
|
Globals.bUnload = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$html.on('click.dropdown.data-api', function () {
|
Globals.$html.on('click.dropdown.data-api', function () {
|
||||||
Utils.detectDropdownVisibility();
|
Utils.detectDropdownVisibility();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -64,7 +62,7 @@
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
|
|
||||||
App.bootstart();
|
App.bootstart();
|
||||||
$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
|
Globals.$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
|
||||||
|
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,18 @@
|
||||||
var
|
var
|
||||||
Globals = {},
|
Globals = {},
|
||||||
window = require('window'),
|
window = require('window'),
|
||||||
|
$ = require('$'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
key = require('key'),
|
key = require('key'),
|
||||||
$html = require('$html'),
|
|
||||||
|
|
||||||
Enums = require('Enums')
|
Enums = require('Enums')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Globals.$win = $(window);
|
||||||
|
Globals.$doc = $(window.document);
|
||||||
|
Globals.$html = $('html');
|
||||||
|
Globals.$div = $('<div></div>');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {?}
|
* @type {?}
|
||||||
*/
|
*/
|
||||||
|
|
@ -97,7 +102,7 @@
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
Globals.bAnimationSupported = !Globals.bMobileDevice && Globals.$html.hasClass('csstransitions');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,6 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
window = require('window'),
|
window = require('window'),
|
||||||
$win = require('$win'),
|
|
||||||
$html = require('$html'),
|
|
||||||
$div = require('$div'),
|
|
||||||
$doc = require('$doc'),
|
|
||||||
NotificationClass = require('NotificationClass'),
|
|
||||||
|
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
Consts = require('Consts'),
|
Consts = require('Consts'),
|
||||||
|
|
@ -42,12 +37,12 @@
|
||||||
Utils.windowResize = _.debounce(function (iTimeout) {
|
Utils.windowResize = _.debounce(function (iTimeout) {
|
||||||
if (Utils.isUnd(iTimeout))
|
if (Utils.isUnd(iTimeout))
|
||||||
{
|
{
|
||||||
$win.resize();
|
Globals.$win.resize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
$win.resize();
|
Globals.$win.resize();
|
||||||
}, iTimeout);
|
}, iTimeout);
|
||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
@ -95,6 +90,14 @@
|
||||||
return Utils.isArray(aValue) && 0 < aValue.length;
|
return Utils.isArray(aValue) && 0 < aValue.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {*|null}
|
||||||
|
*/
|
||||||
|
Utils.notificationClass = function ()
|
||||||
|
{
|
||||||
|
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sQueryString
|
* @param {string} sQueryString
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
|
|
@ -421,7 +424,7 @@
|
||||||
{
|
{
|
||||||
Globals.oI18N = window['rainloopI18N'] || {};
|
Globals.oI18N = window['rainloopI18N'] || {};
|
||||||
|
|
||||||
Utils.i18nToNode($doc);
|
Utils.i18nToNode(Globals.$doc);
|
||||||
|
|
||||||
Globals.langChangeTrigger(!Globals.langChangeTrigger());
|
Globals.langChangeTrigger(!Globals.langChangeTrigger());
|
||||||
}
|
}
|
||||||
|
|
@ -515,12 +518,8 @@
|
||||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' '));
|
sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' '));
|
||||||
|
|
||||||
var
|
var
|
||||||
iIndex = 0,
|
|
||||||
sResult = '',
|
|
||||||
bDrop = false,
|
bDrop = false,
|
||||||
sTrimmedPart = '',
|
|
||||||
aSubject = [],
|
aSubject = [],
|
||||||
aParts = [],
|
|
||||||
bRe = 'RE' === sPrefix,
|
bRe = 'RE' === sPrefix,
|
||||||
bFwd = 'FWD' === sPrefix,
|
bFwd = 'FWD' === sPrefix,
|
||||||
bPrefixIsRe = !bFwd
|
bPrefixIsRe = !bFwd
|
||||||
|
|
@ -528,15 +527,9 @@
|
||||||
|
|
||||||
if ('' !== sSubject)
|
if ('' !== sSubject)
|
||||||
{
|
{
|
||||||
bDrop = false;
|
_.each(sSubject.split(':'), function (sPart) {
|
||||||
|
var sTrimmedPart = Utils.trim(sPart);
|
||||||
aParts = sSubject.split(':');
|
if (!bDrop && (/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart)))
|
||||||
for (iIndex = 0; iIndex < aParts.length; iIndex++)
|
|
||||||
{
|
|
||||||
sTrimmedPart = Utils.trim(aParts[iIndex]);
|
|
||||||
if (!bDrop &&
|
|
||||||
(/^(RE|FWD)$/i.test(sTrimmedPart) || /^(RE|FWD)[\[\(][\d]+[\]\)]$/i.test(sTrimmedPart))
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (!bRe)
|
if (!bRe)
|
||||||
{
|
{
|
||||||
|
|
@ -550,15 +543,10 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aSubject.push(aParts[iIndex]);
|
aSubject.push(sPart);
|
||||||
bDrop = true;
|
bDrop = true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
if (0 < aSubject.length)
|
|
||||||
{
|
|
||||||
sResult = Utils.trim(aSubject.join(':'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPrefixIsRe)
|
if (bPrefixIsRe)
|
||||||
|
|
@ -574,117 +562,10 @@
|
||||||
(bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
|
(bPrefixIsRe ? 'Re: ' : 'Fwd: ') +
|
||||||
(bRe ? 'Re: ' : '') +
|
(bRe ? 'Re: ' : '') +
|
||||||
(bFwd ? 'Fwd: ' : '') +
|
(bFwd ? 'Fwd: ' : '') +
|
||||||
sResult
|
Utils.trim(aSubject.join(':'))
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} sSubject
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
Utils.fixLongSubject = function (sSubject)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
iLimit = 30,
|
|
||||||
mReg = /^Re([\[\(]([\d]+)[\]\)]|):[\s]{0,3}Re([\[\(]([\d]+)[\]\)]|):/ig,
|
|
||||||
oMatch = null
|
|
||||||
;
|
|
||||||
|
|
||||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' '));
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
iLimit--;
|
|
||||||
|
|
||||||
oMatch = mReg.exec(sSubject);
|
|
||||||
if (!oMatch || Utils.isUnd(oMatch[0]))
|
|
||||||
{
|
|
||||||
oMatch = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oMatch)
|
|
||||||
{
|
|
||||||
sSubject = sSubject.replace(mReg, 'Re:');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (oMatch || 0 < iLimit);
|
|
||||||
|
|
||||||
return sSubject.replace(/[\s]+/g, ' ');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @param {string} sPrefix
|
|
||||||
* @param {string} sSubject
|
|
||||||
* @param {boolean=} bFixLongSubject = true
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
Utils._replySubjectAdd_ = function (sPrefix, sSubject, bFixLongSubject)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
oMatch = null,
|
|
||||||
sResult = Utils.trim(sSubject)
|
|
||||||
;
|
|
||||||
|
|
||||||
if (null !== (oMatch = (new window.RegExp('^' + sPrefix + '[\\s]?\\:(.*)$', 'gi')).exec(sSubject)) && !Utils.isUnd(oMatch[1]))
|
|
||||||
{
|
|
||||||
sResult = sPrefix + '[2]: ' + oMatch[1];
|
|
||||||
}
|
|
||||||
else if (null !== (oMatch = (new window.RegExp('^(' + sPrefix + '[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$', 'gi')).exec(sSubject)) &&
|
|
||||||
!Utils.isUnd(oMatch[1]) && !Utils.isUnd(oMatch[2]) && !Utils.isUnd(oMatch[3]))
|
|
||||||
{
|
|
||||||
sResult = oMatch[1] + (Utils.pInt(oMatch[2]) + 1) + oMatch[3];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sResult = sPrefix + ': ' + sSubject;
|
|
||||||
}
|
|
||||||
|
|
||||||
sResult = sResult.replace(/[\s]+/g, ' ');
|
|
||||||
sResult = (Utils.isUnd(bFixLongSubject) ? true : bFixLongSubject) ? Utils.fixLongSubject(sResult) : sResult;
|
|
||||||
// sResult = sResult.replace(/^(Re|Fwd)[\s]?\[[\d]+\]:/ig, '$1:');
|
|
||||||
return sResult;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* @param {string} sSubject
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
Utils._fixLongSubject_ = function (sSubject)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
iCounter = 0,
|
|
||||||
oMatch = null
|
|
||||||
;
|
|
||||||
|
|
||||||
sSubject = Utils.trim(sSubject.replace(/[\s]+/g, ' '));
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
oMatch = /^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/ig.exec(sSubject);
|
|
||||||
if (!oMatch || Utils.isUnd(oMatch[0]))
|
|
||||||
{
|
|
||||||
oMatch = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oMatch)
|
|
||||||
{
|
|
||||||
iCounter = 0;
|
|
||||||
iCounter += Utils.isUnd(oMatch[2]) ? 1 : 0 + Utils.pInt(oMatch[2]);
|
|
||||||
iCounter += Utils.isUnd(oMatch[4]) ? 1 : 0 + Utils.pInt(oMatch[4]);
|
|
||||||
|
|
||||||
sSubject = sSubject.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi, 'Re' + (0 < iCounter ? '[' + iCounter + ']' : '') + ':');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
while (oMatch);
|
|
||||||
|
|
||||||
sSubject = sSubject.replace(/[\s]+/g, ' ');
|
|
||||||
return sSubject;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} iNum
|
* @param {number} iNum
|
||||||
* @param {number} iDec
|
* @param {number} iDec
|
||||||
|
|
@ -981,7 +862,7 @@
|
||||||
oData.interfaceAnimation.subscribe(function (sValue) {
|
oData.interfaceAnimation.subscribe(function (sValue) {
|
||||||
if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)
|
if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)
|
||||||
{
|
{
|
||||||
$html.removeClass('rl-anim rl-anim-full').addClass('no-rl-anim');
|
Globals.$html.removeClass('rl-anim rl-anim-full').addClass('no-rl-anim');
|
||||||
|
|
||||||
Globals.sAnimationType = Enums.InterfaceAnimation.None;
|
Globals.sAnimationType = Enums.InterfaceAnimation.None;
|
||||||
}
|
}
|
||||||
|
|
@ -990,11 +871,11 @@
|
||||||
switch (sValue)
|
switch (sValue)
|
||||||
{
|
{
|
||||||
case Enums.InterfaceAnimation.Full:
|
case Enums.InterfaceAnimation.Full:
|
||||||
$html.removeClass('no-rl-anim').addClass('rl-anim rl-anim-full');
|
Globals.$html.removeClass('no-rl-anim').addClass('rl-anim rl-anim-full');
|
||||||
Globals.sAnimationType = sValue;
|
Globals.sAnimationType = sValue;
|
||||||
break;
|
break;
|
||||||
case Enums.InterfaceAnimation.Normal:
|
case Enums.InterfaceAnimation.Normal:
|
||||||
$html.removeClass('no-rl-anim rl-anim-full').addClass('rl-anim');
|
Globals.$html.removeClass('no-rl-anim rl-anim-full').addClass('rl-anim');
|
||||||
Globals.sAnimationType = sValue;
|
Globals.sAnimationType = sValue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1004,8 +885,14 @@
|
||||||
oData.interfaceAnimation.valueHasMutated();
|
oData.interfaceAnimation.valueHasMutated();
|
||||||
|
|
||||||
oData.desktopNotificationsPermisions = ko.computed(function () {
|
oData.desktopNotificationsPermisions = ko.computed(function () {
|
||||||
|
|
||||||
oData.desktopNotifications();
|
oData.desktopNotifications();
|
||||||
var iResult = Enums.DesktopNotifications.NotSupported;
|
|
||||||
|
var
|
||||||
|
NotificationClass = Utils.notificationClass(),
|
||||||
|
iResult = Enums.DesktopNotifications.NotSupported
|
||||||
|
;
|
||||||
|
|
||||||
if (NotificationClass && NotificationClass.permission)
|
if (NotificationClass && NotificationClass.permission)
|
||||||
{
|
{
|
||||||
switch (NotificationClass.permission.toLowerCase())
|
switch (NotificationClass.permission.toLowerCase())
|
||||||
|
|
@ -1037,12 +924,16 @@
|
||||||
'write': function (bValue) {
|
'write': function (bValue) {
|
||||||
if (bValue)
|
if (bValue)
|
||||||
{
|
{
|
||||||
var iPermission = oData.desktopNotificationsPermisions();
|
var
|
||||||
if (Enums.DesktopNotifications.Allowed === iPermission)
|
NotificationClass = Utils.notificationClass(),
|
||||||
|
iPermission = oData.desktopNotificationsPermisions()
|
||||||
|
;
|
||||||
|
|
||||||
|
if (NotificationClass && Enums.DesktopNotifications.Allowed === iPermission)
|
||||||
{
|
{
|
||||||
oData.desktopNotifications(true);
|
oData.desktopNotifications(true);
|
||||||
}
|
}
|
||||||
else if (Enums.DesktopNotifications.NotAllowed === iPermission)
|
else if (NotificationClass && Enums.DesktopNotifications.NotAllowed === iPermission)
|
||||||
{
|
{
|
||||||
NotificationClass.requestPermission(function () {
|
NotificationClass.requestPermission(function () {
|
||||||
oData.desktopNotifications.valueHasMutated();
|
oData.desktopNotifications.valueHasMutated();
|
||||||
|
|
@ -1577,7 +1468,7 @@
|
||||||
.replace(/<[^>]*>/gm, '')
|
.replace(/<[^>]*>/gm, '')
|
||||||
;
|
;
|
||||||
|
|
||||||
sText = $div.html(sText).text();
|
sText = Globals.$div.html(sText).text();
|
||||||
|
|
||||||
sText = sText
|
sText = sText
|
||||||
.replace(/\n[ \t]+/gm, '\n')
|
.replace(/\n[ \t]+/gm, '\n')
|
||||||
|
|
@ -1714,7 +1605,7 @@
|
||||||
{
|
{
|
||||||
if ($.fn && $.fn.linkify)
|
if ($.fn && $.fn.linkify)
|
||||||
{
|
{
|
||||||
sHtml = $div.html(sHtml.replace(/&/ig, 'amp_amp_12345_amp_amp'))
|
sHtml = Globals.$div.html(sHtml.replace(/&/ig, 'amp_amp_12345_amp_amp'))
|
||||||
.linkify()
|
.linkify()
|
||||||
.find('.linkified').removeClass('linkified').end()
|
.find('.linkified').removeClass('linkified').end()
|
||||||
.html()
|
.html()
|
||||||
|
|
|
||||||
3
dev/External/$div.js
vendored
3
dev/External/$div.js
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
||||||
|
|
||||||
module.exports = require('$')('<div></div>');
|
|
||||||
3
dev/External/$doc.js
vendored
3
dev/External/$doc.js
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
||||||
|
|
||||||
module.exports = require('$')(window.document);
|
|
||||||
3
dev/External/$html.js
vendored
3
dev/External/$html.js
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
||||||
|
|
||||||
module.exports = require('$')('html');
|
|
||||||
3
dev/External/$win.js
vendored
3
dev/External/$win.js
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
||||||
|
|
||||||
module.exports = require('$')(window);
|
|
||||||
3
dev/External/AppData.js
vendored
3
dev/External/AppData.js
vendored
|
|
@ -1,3 +0,0 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
||||||
|
|
||||||
module.exports = require('window')['rainloopAppData'] || {};
|
|
||||||
4
dev/External/NotificationClass.js
vendored
4
dev/External/NotificationClass.js
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
||||||
|
|
||||||
var w = require('window');
|
|
||||||
module.exports = w.Notification && w.Notification.requestPermission ? w.Notification : null;
|
|
||||||
9
dev/External/ko.js
vendored
9
dev/External/ko.js
vendored
|
|
@ -7,9 +7,7 @@
|
||||||
var
|
var
|
||||||
window = require('window'),
|
window = require('window'),
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
$ = require('$'),
|
$ = require('$')
|
||||||
$win = require('$win'),
|
|
||||||
$doc = require('$doc')
|
|
||||||
;
|
;
|
||||||
|
|
||||||
ko.bindingHandlers.tooltip = {
|
ko.bindingHandlers.tooltip = {
|
||||||
|
|
@ -99,7 +97,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$doc.click(function () {
|
$(window.document).click(function () {
|
||||||
$oEl.tooltip('hide');
|
$oEl.tooltip('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -314,6 +312,7 @@
|
||||||
|
|
||||||
var
|
var
|
||||||
Utils = require('Utils'),
|
Utils = require('Utils'),
|
||||||
|
Globals = require('Globals'),
|
||||||
aValues = ko.utils.unwrapObservable(fValueAccessor()),
|
aValues = ko.utils.unwrapObservable(fValueAccessor()),
|
||||||
iValue = Utils.pInt(aValues[1]),
|
iValue = Utils.pInt(aValues[1]),
|
||||||
iSize = 0,
|
iSize = 0,
|
||||||
|
|
@ -323,7 +322,7 @@
|
||||||
if (0 < iOffset)
|
if (0 < iOffset)
|
||||||
{
|
{
|
||||||
iOffset += Utils.pInt(aValues[2]);
|
iOffset += Utils.pInt(aValues[2]);
|
||||||
iSize = $win.height() - iOffset;
|
iSize = Globals.$win.height() - iOffset;
|
||||||
|
|
||||||
if (iValue < iSize)
|
if (iValue < iSize)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
hasher = require('hasher'),
|
hasher = require('hasher'),
|
||||||
crossroads = require('crossroads'),
|
crossroads = require('crossroads'),
|
||||||
$html = require('$html'),
|
|
||||||
|
|
||||||
Globals = require('Globals'),
|
Globals = require('Globals'),
|
||||||
Plugins = require('Plugins'),
|
Plugins = require('Plugins'),
|
||||||
|
|
@ -415,7 +414,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
$html.removeClass('rl-started-trigger').addClass('rl-started');
|
Globals.$html.removeClass('rl-started-trigger').addClass('rl-started');
|
||||||
}, 50);
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
var
|
var
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
$win = require('$win'),
|
|
||||||
|
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
Globals = require('Globals'),
|
Globals = require('Globals'),
|
||||||
|
|
@ -88,7 +87,7 @@
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
$win.on('keydown', function (oEvent) {
|
Globals.$win.on('keydown', function (oEvent) {
|
||||||
if (oEvent && self.modalVisibility && self.modalVisibility())
|
if (oEvent && self.modalVisibility && self.modalVisibility())
|
||||||
{
|
{
|
||||||
if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
|
|
||||||
// this.visible.subscribe(function () {
|
// this.visible.subscribe(function () {
|
||||||
// Utils.timeOutAction('folder-list-folder-visibility-change', function () {
|
// Utils.timeOutAction('folder-list-folder-visibility-change', function () {
|
||||||
// require('$win').trigger('folder-list-folder-visibility-change');
|
// Globals.$win.trigger('folder-list-folder-visibility-change');
|
||||||
// }, 100);
|
// }, 100);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,10 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
moment = require('moment'),
|
moment = require('moment'),
|
||||||
$win = require('$win'),
|
|
||||||
$div = require('$div'),
|
|
||||||
|
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
Utils = require('Utils'),
|
Utils = require('Utils'),
|
||||||
|
Globals = require('Globals'),
|
||||||
LinkBuilder = require('LinkBuilder'),
|
LinkBuilder = require('LinkBuilder'),
|
||||||
|
|
||||||
EmailModel = require('Model:Email'),
|
EmailModel = require('Model:Email'),
|
||||||
|
|
@ -976,7 +975,7 @@
|
||||||
'container': $('.RL-MailMessageView .messageView .messageItem .content')[0]
|
'container': $('.RL-MailMessageView .messageView .messageItem .content')[0]
|
||||||
});
|
});
|
||||||
|
|
||||||
$win.resize();
|
Globals.$win.resize();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.windowResize(500);
|
Utils.windowResize(500);
|
||||||
|
|
@ -1173,12 +1172,12 @@
|
||||||
this.pgpSignedVerifyUser(oValidSysKey.user);
|
this.pgpSignedVerifyUser(oValidSysKey.user);
|
||||||
|
|
||||||
sPlain =
|
sPlain =
|
||||||
$div.empty().append(
|
Globals.$div.empty().append(
|
||||||
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
|
|
||||||
$div.empty();
|
Globals.$div.empty();
|
||||||
|
|
||||||
this.replacePlaneTextBody(sPlain);
|
this.replacePlaneTextBody(sPlain);
|
||||||
}
|
}
|
||||||
|
|
@ -1248,12 +1247,12 @@
|
||||||
sPlain = mPgpMessageDecrypted.getText();
|
sPlain = mPgpMessageDecrypted.getText();
|
||||||
|
|
||||||
sPlain =
|
sPlain =
|
||||||
$div.empty().append(
|
Globals.$div.empty().append(
|
||||||
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
|
|
||||||
$div.empty();
|
Globals.$div.empty();
|
||||||
|
|
||||||
this.replacePlaneTextBody(sPlain);
|
this.replacePlaneTextBody(sPlain);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
var
|
var
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
$html = require('$html'),
|
|
||||||
|
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
Globals = require('Globals'),
|
Globals = require('Globals'),
|
||||||
|
|
@ -129,14 +128,14 @@
|
||||||
Remote.appDelayStart(Utils.emptyFunction);
|
Remote.appDelayStart(Utils.emptyFunction);
|
||||||
}, 35000);
|
}, 35000);
|
||||||
|
|
||||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === Data.layout());
|
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === Data.layout());
|
||||||
|
|
||||||
Data.folderList.subscribe(fResizeFunction);
|
Data.folderList.subscribe(fResizeFunction);
|
||||||
Data.messageList.subscribe(fResizeFunction);
|
Data.messageList.subscribe(fResizeFunction);
|
||||||
Data.message.subscribe(fResizeFunction);
|
Data.message.subscribe(fResizeFunction);
|
||||||
|
|
||||||
Data.layout.subscribe(function (nValue) {
|
Data.layout.subscribe(function (nValue) {
|
||||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
|
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.sub('mailbox.inbox-unread-count', function (nCount) {
|
Events.sub('mailbox.inbox-unread-count', function (nCount) {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
moment = require('moment'),
|
moment = require('moment'),
|
||||||
$div = require('$div'),
|
|
||||||
NotificationClass = require('NotificationClass'),
|
|
||||||
|
|
||||||
Consts = require('Consts'),
|
Consts = require('Consts'),
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
|
|
@ -546,7 +544,11 @@
|
||||||
iLen = aNewMessages.length,
|
iLen = aNewMessages.length,
|
||||||
fNotificationHelper = function (sImageSrc, sTitle, sText)
|
fNotificationHelper = function (sImageSrc, sTitle, sText)
|
||||||
{
|
{
|
||||||
var oNotification = null;
|
var
|
||||||
|
NotificationClass = Utils.notificationClass(),
|
||||||
|
oNotification = null
|
||||||
|
;
|
||||||
|
|
||||||
if (NotificationClass && self.useDesktopNotifications())
|
if (NotificationClass && self.useDesktopNotifications())
|
||||||
{
|
{
|
||||||
oNotification = new NotificationClass(sTitle, {
|
oNotification = new NotificationClass(sTitle, {
|
||||||
|
|
@ -842,11 +844,11 @@
|
||||||
/-----BEGIN PGP SIGNATURE-----/.test(oMessage.plainRaw);
|
/-----BEGIN PGP SIGNATURE-----/.test(oMessage.plainRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
$div.empty();
|
Globals.$div.empty();
|
||||||
if (bPgpSigned && oMessage.isPgpSigned())
|
if (bPgpSigned && oMessage.isPgpSigned())
|
||||||
{
|
{
|
||||||
sResultHtml =
|
sResultHtml =
|
||||||
$div.append(
|
Globals.$div.append(
|
||||||
$('<pre class="b-plain-openpgp signed"></pre>').text(oMessage.plainRaw)
|
$('<pre class="b-plain-openpgp signed"></pre>').text(oMessage.plainRaw)
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
|
|
@ -854,13 +856,13 @@
|
||||||
else if (bPgpEncrypted && oMessage.isPgpEncrypted())
|
else if (bPgpEncrypted && oMessage.isPgpEncrypted())
|
||||||
{
|
{
|
||||||
sResultHtml =
|
sResultHtml =
|
||||||
$div.append(
|
Globals.$div.append(
|
||||||
$('<pre class="b-plain-openpgp encrypted"></pre>').text(oMessage.plainRaw)
|
$('<pre class="b-plain-openpgp encrypted"></pre>').text(oMessage.plainRaw)
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
$div.empty();
|
Globals.$div.empty();
|
||||||
|
|
||||||
oMessage.isPgpSigned(bPgpSigned);
|
oMessage.isPgpSigned(bPgpSigned);
|
||||||
oMessage.isPgpEncrypted(bPgpEncrypted);
|
oMessage.isPgpEncrypted(bPgpEncrypted);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var
|
var
|
||||||
|
window = require('window'),
|
||||||
Utils = require('Utils')
|
Utils = require('Utils')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
function SettingsStorage()
|
function SettingsStorage()
|
||||||
{
|
{
|
||||||
this.oSettings = require('AppData');
|
this.oSettings = window['rainloopAppData'] || {};
|
||||||
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
|
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
$ = require('$'),
|
$ = require('$'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
key = require('key'),
|
key = require('key'),
|
||||||
$html = require('$html'),
|
|
||||||
|
|
||||||
Utils = require('Utils'),
|
Utils = require('Utils'),
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
|
|
@ -235,7 +234,7 @@
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
|
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
|
||||||
bCopy = $html.hasClass('rl-ctrl-key-pressed'),
|
bCopy = Globals.$html.hasClass('rl-ctrl-key-pressed'),
|
||||||
aUids = oUi.helper.data('rl-uids')
|
aUids = oUi.helper.data('rl-uids')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
$ = require('$'),
|
$ = require('$'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
key = require('key'),
|
key = require('key'),
|
||||||
$html = require('$html'),
|
|
||||||
|
|
||||||
Consts = require('Consts'),
|
Consts = require('Consts'),
|
||||||
Enums = require('Enums'),
|
Enums = require('Enums'),
|
||||||
|
|
@ -219,11 +218,11 @@
|
||||||
this.fullScreenMode.subscribe(function (bValue) {
|
this.fullScreenMode.subscribe(function (bValue) {
|
||||||
if (bValue)
|
if (bValue)
|
||||||
{
|
{
|
||||||
$html.addClass('rl-message-fullscreen');
|
Globals.$html.addClass('rl-message-fullscreen');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$html.removeClass('rl-message-fullscreen');
|
Globals.$html.removeClass('rl-message-fullscreen');
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
moment = require('moment'),
|
moment = require('moment'),
|
||||||
$win = require('$win'),
|
|
||||||
JSON = require('JSON'),
|
JSON = require('JSON'),
|
||||||
Jua = require('Jua'),
|
Jua = require('Jua'),
|
||||||
|
|
||||||
|
|
@ -1055,7 +1054,7 @@
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$win.on('resize', function () {
|
Globals.$win.on('resize', function () {
|
||||||
self.triggerForResize();
|
self.triggerForResize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@
|
||||||
"window": "./dev/External/window.js",
|
"window": "./dev/External/window.js",
|
||||||
"JSON": "./dev/External/JSON.js",
|
"JSON": "./dev/External/JSON.js",
|
||||||
"$": "./dev/External/jquery.js",
|
"$": "./dev/External/jquery.js",
|
||||||
|
"jquery": "./dev/External/jquery.js",
|
||||||
"_": "./dev/External/underscore.js",
|
"_": "./dev/External/underscore.js",
|
||||||
|
"underscore": "./dev/External/underscore.js",
|
||||||
"ko": "./dev/External/ko.js",
|
"ko": "./dev/External/ko.js",
|
||||||
"key": "./dev/External/key.js",
|
"key": "./dev/External/key.js",
|
||||||
"moment": "./dev/External/moment.js",
|
"moment": "./dev/External/moment.js",
|
||||||
|
|
@ -53,12 +55,6 @@
|
||||||
"ifvisible": "./dev/External/ifvisible.js",
|
"ifvisible": "./dev/External/ifvisible.js",
|
||||||
"ssm": "./dev/External/ssm.js",
|
"ssm": "./dev/External/ssm.js",
|
||||||
"Jua": "./dev/External/Jua.js",
|
"Jua": "./dev/External/Jua.js",
|
||||||
"AppData": "./dev/External/AppData.js",
|
|
||||||
"NotificationClass": "./dev/External/NotificationClass.js",
|
|
||||||
"$win": "./dev/External/$win.js",
|
|
||||||
"$html": "./dev/External/$html.js",
|
|
||||||
"$doc": "./dev/External/$doc.js",
|
|
||||||
"$div": "./dev/External/$div.js",
|
|
||||||
|
|
||||||
"Base64": "./dev/Common/Base64.js",
|
"Base64": "./dev/Common/Base64.js",
|
||||||
"Consts": "./dev/Common/Consts.js",
|
"Consts": "./dev/Common/Consts.js",
|
||||||
|
|
@ -205,6 +201,5 @@
|
||||||
"gulp-closure-compiler": "*",
|
"gulp-closure-compiler": "*",
|
||||||
"gulp-csslint": "*",
|
"gulp-csslint": "*",
|
||||||
"gulp-concat-util": "*"
|
"gulp-concat-util": "*"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
12
rainloop/v/0.0.0/static/js/admin.min.js
vendored
12
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
20
rainloop/v/0.0.0/static/js/app.min.js
vendored
20
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue