mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Made eslint using 'browser' environment and added globals, because RainLoop is used in browsers.
This also allowed to remove all webpack 'externals' overhead.
This commit is contained in:
parent
c3a213802d
commit
e7180a86ce
81 changed files with 1857 additions and 1259 deletions
32
.eslintrc.js
32
.eslintrc.js
|
|
@ -9,19 +9,45 @@ module.exports = {
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
commonjs: true,
|
browser: true,
|
||||||
es6: true
|
es6: true
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
|
// RainLoop
|
||||||
'RL_COMMUNITY': true,
|
'RL_COMMUNITY': true,
|
||||||
'RL_ES6': true
|
'RL_ES6': true,
|
||||||
|
'__rlah_set': "readonly",
|
||||||
|
'__rlah_clear': "readonly",
|
||||||
|
'__rlah_data': "readonly",
|
||||||
|
'rainloopI18N': "readonly",
|
||||||
|
'rainloopTEMPLATES': "readonly",
|
||||||
|
'rl': "readonly",
|
||||||
|
// '__APP_BOOT': "readonly",
|
||||||
|
// deb/boot.js
|
||||||
|
'progressJs': "readonly",
|
||||||
|
// others
|
||||||
|
'jQuery': "readonly",
|
||||||
|
'openpgp': "readonly",
|
||||||
|
// node_modules/knockout but dev/External/ko.js is used
|
||||||
|
// 'ko': "readonly",
|
||||||
|
// node_modules/simplestatemanager
|
||||||
|
'ssm': "readonly",
|
||||||
|
// vendors/routes/
|
||||||
|
'hasher': "readonly",
|
||||||
|
'signals': "readonly",
|
||||||
|
'Crossroads': "readonly",
|
||||||
|
// vendors/keymaster
|
||||||
|
'key': "readonly",
|
||||||
|
// vendors/jua
|
||||||
|
'Jua': "readonly",
|
||||||
|
// vendors/qr.js
|
||||||
|
'qr': "readonly"
|
||||||
},
|
},
|
||||||
// http://eslint.org/docs/rules/
|
// http://eslint.org/docs/rules/
|
||||||
rules: {
|
rules: {
|
||||||
// plugins
|
// plugins
|
||||||
// 'prettier/prettier': 'error',
|
// 'prettier/prettier': 'error',
|
||||||
'no-mixed-spaces-and-tabs': 'off',
|
'no-mixed-spaces-and-tabs': 'off',
|
||||||
'no-console': 'error',
|
|
||||||
'max-len': [
|
'max-len': [
|
||||||
'error',
|
'error',
|
||||||
120,
|
120,
|
||||||
|
|
|
||||||
22
README.md
22
README.md
|
|
@ -75,23 +75,23 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf
|
||||||
|
|
||||||
|js/* |1.14.0 |native |gzip 1.14 |gzip |
|
|js/* |1.14.0 |native |gzip 1.14 |gzip |
|
||||||
|----------- |--------: |--------: |--------: |--------: |
|
|----------- |--------: |--------: |--------: |--------: |
|
||||||
|admin.js |2.130.942 |1.210.331 | 485.481 | 297.342 |
|
|admin.js |2.130.942 |1.172.413 | 485.481 | 291.715 |
|
||||||
|app.js |4.184.455 |2.950.323 | 932.725 | 689.992 |
|
|app.js |4.184.455 |2.888.668 | 932.725 | 682.438 |
|
||||||
|boot.js | 671.522 | 46.647 | 169.502 | 16.138 |
|
|boot.js | 671.522 | 44.394 | 169.502 | 15.460 |
|
||||||
|libs.js | 647.614 | 437.187 | 194.728 | 133.728 |
|
|libs.js | 647.614 | 431.049 | 194.728 | 132.315 |
|
||||||
|polyfills.js | 325.834 | 0 | 71.825 | 0 |
|
|polyfills.js | 325.834 | 0 | 71.825 | 0 |
|
||||||
|TOTAL js |7.960.367 |4.644.488 |1.854.261 |1.137.200 |
|
|TOTAL js |7.960.367 |4.537.200 |1.854.261 |1.121.928 |
|
||||||
|
|
||||||
|js/min/* |1.14.0 |native |gzip 1.14 |gzip |
|
|js/min/* |1.14.0 |native |gzip 1.14 |gzip |
|
||||||
|--------------- |--------: |--------: |--------: |--------: |
|
|--------------- |--------: |--------: |--------: |--------: |
|
||||||
|admin.min.js | 252.147 | 156.113 | 73.657 | 44.598 |
|
|admin.min.js | 252.147 | 153.689 | 73.657 | 44.000 |
|
||||||
|app.min.js | 511.202 | 383.798 |140.462 |101.450 |
|
|app.min.js | 511.202 | 380.294 |140.462 |100.236 |
|
||||||
|boot.min.js | 66.007 | 5.970 | 22.567 | 2.420 |
|
|boot.min.js | 66.007 | 5.589 | 22.567 | 2.333 |
|
||||||
|libs.min.js | 572.545 | 392.436 |176.720 |123.484 |
|
|libs.min.js | 572.545 | 387.636 |176.720 |122.519 |
|
||||||
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 |
|
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 |
|
||||||
|TOTAL js/min |1.434.353 | 938.317 |424.718 |271.952 |
|
|TOTAL js/min |1.434.353 | 927.208 |424.718 |269.088 |
|
||||||
|
|
||||||
496.036 bytes (152.766 gzip) is not much, but it feels faster.
|
507.145 bytes (155.630 gzip) is not much, but it feels faster.
|
||||||
|
|
||||||
|
|
||||||
|css/* |1.14.0 |native |
|
|css/* |1.14.0 |native |
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
import ssm from 'ssm';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
$win,
|
$win,
|
||||||
|
|
@ -35,7 +32,7 @@ class AbstractApp extends AbstractBoot {
|
||||||
this.isLocalAutocomplete = true;
|
this.isLocalAutocomplete = true;
|
||||||
this.lastErrorTime = 0;
|
this.lastErrorTime = 0;
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
addEventListener('resize', () => {
|
||||||
Events.pub('window.resize');
|
Events.pub('window.resize');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -64,14 +61,14 @@ class AbstractApp extends AbstractBoot {
|
||||||
// DEBUG
|
// DEBUG
|
||||||
// Events.sub({
|
// Events.sub({
|
||||||
// 'window.resize': function() {
|
// 'window.resize': function() {
|
||||||
// window.console.log('window.resize');
|
// console.log('window.resize');
|
||||||
// },
|
// },
|
||||||
// 'window.resize.real': function() {
|
// 'window.resize.real': function() {
|
||||||
// window.console.log('window.resize.real');
|
// console.log('window.resize.real');
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const $doc = window.document;
|
const $doc = document;
|
||||||
$doc.addEventListener('keydown', (event) => {
|
$doc.addEventListener('keydown', (event) => {
|
||||||
if (event && event.ctrlKey) {
|
if (event && event.ctrlKey) {
|
||||||
$htmlCL.add('rl-ctrl-key-pressed');
|
$htmlCL.add('rl-ctrl-key-pressed');
|
||||||
|
|
@ -117,14 +114,14 @@ class AbstractApp extends AbstractBoot {
|
||||||
*/
|
*/
|
||||||
download(link) {
|
download(link) {
|
||||||
if (bMobileDevice) {
|
if (bMobileDevice) {
|
||||||
window.open(link, '_self');
|
open(link, '_self');
|
||||||
window.focus();
|
focus();
|
||||||
} else {
|
} else {
|
||||||
const oLink = window.document.createElement('a');
|
const oLink = document.createElement('a');
|
||||||
oLink.href = link;
|
oLink.href = link;
|
||||||
window.document.body.appendChild(oLink).click();
|
document.body.appendChild(oLink).click();
|
||||||
oLink.remove();
|
oLink.remove();
|
||||||
// window.open(link, '_self');
|
// open(link, '_self');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -138,18 +135,18 @@ class AbstractApp extends AbstractBoot {
|
||||||
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.document.title = title;
|
document.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
redirectToAdminPanel() {
|
redirectToAdminPanel() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = rootAdmin();
|
location.href = rootAdmin();
|
||||||
}, Magics.Time100ms);
|
}, Magics.Time100ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearClientSideToken() {
|
clearClientSideToken() {
|
||||||
if (window.__rlah_clear) {
|
if (window.__rlah_clear) {
|
||||||
window.__rlah_clear();
|
__rlah_clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,7 +155,7 @@ class AbstractApp extends AbstractBoot {
|
||||||
*/
|
*/
|
||||||
setClientSideToken(token) {
|
setClientSideToken(token) {
|
||||||
if (window.__rlah_set) {
|
if (window.__rlah_set) {
|
||||||
window.__rlah_set(token);
|
__rlah_set(token);
|
||||||
|
|
||||||
Settings.settingsSet('AuthAccountHash', token);
|
Settings.settingsSet('AuthAccountHash', token);
|
||||||
populateAuthSuffix();
|
populateAuthSuffix();
|
||||||
|
|
@ -184,12 +181,12 @@ class AbstractApp extends AbstractBoot {
|
||||||
|
|
||||||
customLogoutLink = customLogoutLink || (admin ? rootAdmin() : rootUser());
|
customLogoutLink = customLogoutLink || (admin ? rootAdmin() : rootUser());
|
||||||
|
|
||||||
if (logout && window.location.href !== customLogoutLink) {
|
if (logout && location.href !== customLogoutLink) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (inIframe && window.parent) {
|
if (inIframe && parent) {
|
||||||
window.parent.location.href = customLogoutLink;
|
parent.location.href = customLogoutLink;
|
||||||
} else {
|
} else {
|
||||||
window.location.href = customLogoutLink;
|
location.href = customLogoutLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
$win.trigger('rl.tooltips.diactivate');
|
$win.trigger('rl.tooltips.diactivate');
|
||||||
|
|
@ -200,10 +197,10 @@ class AbstractApp extends AbstractBoot {
|
||||||
routeOff();
|
routeOff();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (inIframe && window.parent) {
|
if (inIframe && parent) {
|
||||||
window.parent.location.reload();
|
parent.location.reload();
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
$win.trigger('rl.tooltips.diactivate');
|
$win.trigger('rl.tooltips.diactivate');
|
||||||
|
|
@ -212,12 +209,10 @@ class AbstractApp extends AbstractBoot {
|
||||||
}
|
}
|
||||||
|
|
||||||
historyBack() {
|
historyBack() {
|
||||||
window.history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstart() {
|
bootstart() {
|
||||||
// log('Ps' + 'ss, hac' + 'kers! The' + 're\'s not' + 'hing inte' + 'resting :' + ')');
|
|
||||||
|
|
||||||
Events.pub('rl.bootstart');
|
Events.pub('rl.bootstart');
|
||||||
|
|
||||||
const mobile = Settings.appSettingsGet('mobile');
|
const mobile = Settings.appSettingsGet('mobile');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { root } from 'Common/Links';
|
import { root } from 'Common/Links';
|
||||||
|
|
@ -110,7 +109,7 @@ class AdminApp extends AbstractApp {
|
||||||
CoreStore.coreVersionCompare(-2);
|
CoreStore.coreVersionCompare(-2);
|
||||||
if (StorageResultType.Success === result && data && data.Result) {
|
if (StorageResultType.Success === result && data && data.Result) {
|
||||||
CoreStore.coreReal(true);
|
CoreStore.coreReal(true);
|
||||||
window.location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
CoreStore.coreReal(false);
|
CoreStore.coreReal(false);
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +181,7 @@ class AdminApp extends AbstractApp {
|
||||||
|
|
||||||
bootend(bootendCallback = null) {
|
bootend(bootendCallback = null) {
|
||||||
if (window.progressJs) {
|
if (window.progressJs) {
|
||||||
window.progressJs.end();
|
progressJs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootendCallback) {
|
if (bootendCallback) {
|
||||||
|
|
@ -204,7 +203,7 @@ class AdminApp extends AbstractApp {
|
||||||
routeOff();
|
routeOff();
|
||||||
|
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
window.location.href = '/'
|
location.href = '/'
|
||||||
, 1);
|
, 1);
|
||||||
} else {
|
} else {
|
||||||
if (Settings.settingsGet('Auth')) {
|
if (Settings.settingsGet('Auth')) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
log,
|
|
||||||
isNormal,
|
isNormal,
|
||||||
isPosNumeric,
|
isPosNumeric,
|
||||||
isNonEmptyArray,
|
isNonEmptyArray,
|
||||||
|
|
@ -86,12 +83,12 @@ import { hideLoading, routeOff, routeOn, setHash, startScreens, showScreenPopup
|
||||||
|
|
||||||
import { AbstractApp } from 'App/Abstract';
|
import { AbstractApp } from 'App/Abstract';
|
||||||
|
|
||||||
const doc = window.document;
|
const doc = document;
|
||||||
|
|
||||||
if (!window.ResizeObserver) {
|
if (!window.ResizeObserver) {
|
||||||
window.ResizeObserver = class {
|
window.ResizeObserver = class {
|
||||||
constructor(callback) {
|
constructor(callback) {
|
||||||
this.observer = new window.MutationObserver(mutations => {
|
this.observer = new MutationObserver(mutations => {
|
||||||
let entries = [];
|
let entries = [];
|
||||||
mutations.forEach(mutation => {
|
mutations.forEach(mutation => {
|
||||||
if ('style' == mutation.attributeName) {
|
if ('style' == mutation.attributeName) {
|
||||||
|
|
@ -133,19 +130,19 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
this.moveOrDeleteResponseHelper = this.moveOrDeleteResponseHelper.bind(this);
|
this.moveOrDeleteResponseHelper = this.moveOrDeleteResponseHelper.bind(this);
|
||||||
|
|
||||||
window.setInterval(() => Events.pub('interval.30s'), Magics.Time30s);
|
setInterval(() => Events.pub('interval.30s'), Magics.Time30s);
|
||||||
window.setInterval(() => Events.pub('interval.1m'), Magics.Time1m);
|
setInterval(() => Events.pub('interval.1m'), Magics.Time1m);
|
||||||
window.setInterval(() => Events.pub('interval.2m'), Magics.Time2m);
|
setInterval(() => Events.pub('interval.2m'), Magics.Time2m);
|
||||||
window.setInterval(() => Events.pub('interval.3m'), Magics.Time3m);
|
setInterval(() => Events.pub('interval.3m'), Magics.Time3m);
|
||||||
window.setInterval(() => Events.pub('interval.5m'), Magics.Time5m);
|
setInterval(() => Events.pub('interval.5m'), Magics.Time5m);
|
||||||
window.setInterval(() => Events.pub('interval.10m'), Magics.Time10m);
|
setInterval(() => Events.pub('interval.10m'), Magics.Time10m);
|
||||||
window.setInterval(() => Events.pub('interval.15m'), Magics.Time15m);
|
setInterval(() => Events.pub('interval.15m'), Magics.Time15m);
|
||||||
window.setInterval(() => Events.pub('interval.20m'), Magics.Time20m);
|
setInterval(() => Events.pub('interval.20m'), Magics.Time20m);
|
||||||
|
|
||||||
window.setTimeout(() => window.setInterval(() => Events.pub('interval.2m-after5m'), Magics.Time2m), Magics.Time5m);
|
setTimeout(() => setInterval(() => Events.pub('interval.2m-after5m'), Magics.Time2m), Magics.Time5m);
|
||||||
window.setTimeout(() => window.setInterval(() => Events.pub('interval.5m-after5m'), Magics.Time5m), Magics.Time5m);
|
setTimeout(() => setInterval(() => Events.pub('interval.5m-after5m'), Magics.Time5m), Magics.Time5m);
|
||||||
window.setTimeout(
|
setTimeout(
|
||||||
() => window.setInterval(() => Events.pub('interval.10m-after5m'), Magics.Time10m),
|
() => setInterval(() => Events.pub('interval.10m-after5m'), Magics.Time10m),
|
||||||
Magics.Time5m
|
Magics.Time5m
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -187,10 +184,10 @@ class AppUser extends AbstractApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
if (window.parent && !!Settings.appSettingsGet('inIframe')) {
|
if (parent && !!Settings.appSettingsGet('inIframe')) {
|
||||||
window.parent.location.reload();
|
parent.location.reload();
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,7 +343,7 @@ class AppUser extends AbstractApp {
|
||||||
setFolderHash(FolderStore.currentFolderFullNameRaw(), '');
|
setFolderHash(FolderStore.currentFolderFullNameRaw(), '');
|
||||||
|
|
||||||
if (oData && [Notification.CantMoveMessage, Notification.CantCopyMessage].includes(oData.ErrorCode)) {
|
if (oData && [Notification.CantMoveMessage, Notification.CantCopyMessage].includes(oData.ErrorCode)) {
|
||||||
window.alert(getNotification(oData.ErrorCode));
|
alert(getNotification(oData.ErrorCode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -917,7 +914,7 @@ class AppUser extends AbstractApp {
|
||||||
source.classList.add('resizable');
|
source.classList.add('resizable');
|
||||||
if (!source.querySelector('.resizer')) {
|
if (!source.querySelector('.resizer')) {
|
||||||
const resizer = doc.createElement('div'),
|
const resizer = doc.createElement('div'),
|
||||||
cssint = s => parseFloat(window.getComputedStyle(source, null).getPropertyValue(s).replace('px', ''));
|
cssint = s => parseFloat(getComputedStyle(source, null).getPropertyValue(s).replace('px', ''));
|
||||||
resizer.className = 'resizer';
|
resizer.className = 'resizer';
|
||||||
source.appendChild(resizer);
|
source.appendChild(resizer);
|
||||||
resizer.addEventListener('mousedown', {
|
resizer.addEventListener('mousedown', {
|
||||||
|
|
@ -930,26 +927,26 @@ class AppUser extends AbstractApp {
|
||||||
this.min = cssint('min-'+this.mode);
|
this.min = cssint('min-'+this.mode);
|
||||||
this.max = cssint('max-'+this.mode);
|
this.max = cssint('max-'+this.mode);
|
||||||
this.org = cssint(this.mode);
|
this.org = cssint(this.mode);
|
||||||
window.addEventListener('mousemove', this);
|
addEventListener('mousemove', this);
|
||||||
window.addEventListener('mouseup', this);
|
addEventListener('mouseup', this);
|
||||||
} else if ('mousemove' == e.type) {
|
} else if ('mousemove' == e.type) {
|
||||||
const length = this.org + (('width' == this.mode ? e.pageX : e.pageY) - this.pos);
|
const length = this.org + (('width' == this.mode ? e.pageX : e.pageY) - this.pos);
|
||||||
if (length >= this.min && length <= this.max ) {
|
if (length >= this.min && length <= this.max ) {
|
||||||
this.source.style[this.mode] = length + 'px';
|
this.source.style[this.mode] = length + 'px';
|
||||||
}
|
}
|
||||||
} else if ('mouseup' == e.type) {
|
} else if ('mouseup' == e.type) {
|
||||||
window.removeEventListener('mousemove', this);
|
removeEventListener('mousemove', this);
|
||||||
window.removeEventListener('mouseup', this);
|
removeEventListener('mouseup', this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if ('width' == mode) {
|
if ('width' == mode) {
|
||||||
source.observer = new window.ResizeObserver(() => {
|
source.observer = new ResizeObserver(() => {
|
||||||
target.style.left = source.offsetWidth + 'px';
|
target.style.left = source.offsetWidth + 'px';
|
||||||
Local.set(sClientSideKeyName, source.offsetWidth);
|
Local.set(sClientSideKeyName, source.offsetWidth);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
source.observer = new window.ResizeObserver(() => {
|
source.observer = new ResizeObserver(() => {
|
||||||
target.style.top = (4 + source.offsetTop + source.offsetHeight) + 'px';
|
target.style.top = (4 + source.offsetTop + source.offsetHeight) + 'px';
|
||||||
Local.set(sClientSideKeyName, source.offsetHeight);
|
Local.set(sClientSideKeyName, source.offsetHeight);
|
||||||
});
|
});
|
||||||
|
|
@ -1032,14 +1029,14 @@ class AppUser extends AbstractApp {
|
||||||
routeOff();
|
routeOff();
|
||||||
|
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
window.location.href = customLoginLink
|
location.href = customLoginLink
|
||||||
, 1);
|
, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bootend() {
|
bootend() {
|
||||||
if (window.progressJs) {
|
if (window.progressJs) {
|
||||||
window.progressJs.set(100).end();
|
progressJs.set(100).end();
|
||||||
}
|
}
|
||||||
hideLoading();
|
hideLoading();
|
||||||
}
|
}
|
||||||
|
|
@ -1058,7 +1055,7 @@ class AppUser extends AbstractApp {
|
||||||
const startupUrl = pString(Settings.settingsGet('StartupUrl'));
|
const startupUrl = pString(Settings.settingsGet('StartupUrl'));
|
||||||
|
|
||||||
if (window.progressJs) {
|
if (window.progressJs) {
|
||||||
window.progressJs.set(90);
|
progressJs.set(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
leftPanelDisabled.subscribe((value) => {
|
leftPanelDisabled.subscribe((value) => {
|
||||||
|
|
@ -1091,15 +1088,18 @@ class AppUser extends AbstractApp {
|
||||||
routeOn();
|
routeOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.crypto && window.crypto.getRandomValues && Settings.capa(Capa.OpenPGP)) {
|
if (window.crypto && crypto.getRandomValues && Settings.capa(Capa.OpenPGP)) {
|
||||||
const openpgpCallback = (openpgp) => {
|
const openpgpCallback = () => {
|
||||||
|
if (!window.openpgp) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
PgpStore.openpgp = openpgp;
|
PgpStore.openpgp = openpgp;
|
||||||
|
|
||||||
if (window.Worker) {
|
if (window.Worker) {
|
||||||
try {
|
try {
|
||||||
PgpStore.openpgp.initWorker({ path: openPgpWorkerJs() });
|
PgpStore.openpgp.initWorker({ path: openPgpWorkerJs() });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1109,22 +1109,16 @@ class AppUser extends AbstractApp {
|
||||||
Events.pub('openpgp.init');
|
Events.pub('openpgp.init');
|
||||||
|
|
||||||
this.reloadOpenPgpKeys();
|
this.reloadOpenPgpKeys();
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (window.openpgp) {
|
if (!openpgpCallback()) {
|
||||||
openpgpCallback(window.openpgp);
|
const script = doc.createElement('script');
|
||||||
} else {
|
script.onload = openpgpCallback;
|
||||||
new window.Promise((resolve, reject) => {
|
script.onerror = () => console.error(script.src);
|
||||||
const script = doc.createElement('script');
|
script.src = openPgpJs();
|
||||||
script.onload = () => resolve();
|
doc.head.appendChild(script);
|
||||||
script.onerror = () => reject(new Error(script.src));
|
|
||||||
script.src = openPgpJs();
|
|
||||||
doc.head.appendChild(script);
|
|
||||||
}).then(() => {
|
|
||||||
if (window.openpgp) {
|
|
||||||
openpgpCallback(window.openpgp);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PgpStore.capaOpenPGP(false);
|
PgpStore.capaOpenPGP(false);
|
||||||
|
|
@ -1154,7 +1148,7 @@ class AppUser extends AbstractApp {
|
||||||
setTimeout(() => this.contactsSync(), Magics.Time10s);
|
setTimeout(() => this.contactsSync(), Magics.Time10s);
|
||||||
setTimeout(() => this.folderInformationMultiply(true), Magics.Time2s);
|
setTimeout(() => this.folderInformationMultiply(true), Magics.Time2s);
|
||||||
|
|
||||||
window.setInterval(() => this.contactsSync(), contactsSyncInterval * 60000 + 5000);
|
setInterval(() => this.contactsSync(), contactsSyncInterval * 60000 + 5000);
|
||||||
|
|
||||||
this.accountsAndIdentities(true);
|
this.accountsAndIdentities(true);
|
||||||
|
|
||||||
|
|
@ -1179,14 +1173,14 @@ class AppUser extends AbstractApp {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!!Settings.settingsGet('AccountSignMe') &&
|
!!Settings.settingsGet('AccountSignMe') &&
|
||||||
window.navigator.registerProtocolHandler &&
|
navigator.registerProtocolHandler &&
|
||||||
Settings.capa(Capa.Composer)
|
Settings.capa(Capa.Composer)
|
||||||
) {
|
) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
try {
|
try {
|
||||||
window.navigator.registerProtocolHandler(
|
navigator.registerProtocolHandler(
|
||||||
'mailto',
|
'mailto',
|
||||||
window.location.protocol + '//' + window.location.host + window.location.pathname + '?mailto&to=%s',
|
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
|
||||||
'' + (Settings.settingsGet('Title') || 'RainLoop')
|
'' + (Settings.settingsGet('Title') || 'RainLoop')
|
||||||
);
|
);
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import * as Links from 'Common/Links';
|
import * as Links from 'Common/Links';
|
||||||
import * as Events from 'Common/Events';
|
import * as Events from 'Common/Events';
|
||||||
|
|
||||||
|
|
@ -44,7 +43,7 @@ class Audio {
|
||||||
|
|
||||||
createNewObject() {
|
createNewObject() {
|
||||||
try {
|
try {
|
||||||
const player = window.Audio ? new window.Audio() : null;
|
const player = window.Audio ? new Audio() : null;
|
||||||
if (player && player.canPlayType && player.pause && player.play) {
|
if (player && player.canPlayType && player.pause && player.play) {
|
||||||
player.preload = 'none';
|
player.preload = 'none';
|
||||||
player.loop = false;
|
player.loop = false;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
/* eslint-env browser */
|
|
||||||
|
|
||||||
import { getHash, setHash, clearHash } from 'Storage/RainLoop';
|
import { getHash, setHash, clearHash } from 'Storage/RainLoop';
|
||||||
|
|
||||||
let RL_APP_DATA_STORAGE = null;
|
let RL_APP_DATA_STORAGE = null;
|
||||||
|
|
||||||
const doc = window.document;
|
const doc = document;
|
||||||
|
|
||||||
/* eslint-disable camelcase,spaced-comment */
|
/* eslint-disable camelcase,spaced-comment */
|
||||||
window.__rlah_set = () => setHash();
|
window.__rlah_set = () => setHash();
|
||||||
|
|
@ -27,7 +25,7 @@ function showError() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.progressJs) {
|
if (window.progressJs) {
|
||||||
window.progressJs.set(100).end();
|
progressJs.set(100).end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +53,7 @@ function loadScript(src) {
|
||||||
if (!src) {
|
if (!src) {
|
||||||
throw new Error('src should not be empty.');
|
throw new Error('src should not be empty.');
|
||||||
}
|
}
|
||||||
return new window.Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const script = doc.createElement('script');
|
const script = doc.createElement('script');
|
||||||
script.onload = () => resolve();
|
script.onload = () => resolve();
|
||||||
script.onerror = () => reject(new Error(src));
|
script.onerror = () => reject(new Error(src));
|
||||||
|
|
@ -93,11 +91,11 @@ window.__initAppData = data => {
|
||||||
}
|
}
|
||||||
if (oE && oE.style) {
|
if (oE && oE.style) {
|
||||||
oE.style.opacity = 0;
|
oE.style.opacity = 0;
|
||||||
window.setTimeout(() => oE.style.opacity = 1, 300);
|
setTimeout(() => oE.style.opacity = 1, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const appData = window.__rlah_data(), p = window.progressJs;
|
const appData = window.__rlah_data(), p = progressJs;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
p &&
|
p &&
|
||||||
|
|
@ -125,7 +123,7 @@ window.__initAppData = data => {
|
||||||
libs()
|
libs()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
p.set(20);
|
p.set(20);
|
||||||
return window.Promise.all([loadScript(appData.TemplatesLink), loadScript(appData.LangLink)]);
|
return Promise.all([loadScript(appData.TemplatesLink), loadScript(appData.LangLink)]);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
p.set(30);
|
p.set(30);
|
||||||
|
|
@ -133,7 +131,7 @@ window.__initAppData = data => {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
p.set(50);
|
p.set(50);
|
||||||
return appData.PluginsLink ? loadScript(appData.PluginsLink) : window.Promise.resolve();
|
return appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
p.set(70);
|
p.set(70);
|
||||||
|
|
@ -161,7 +159,7 @@ window.__initAppData = data => {
|
||||||
window.__runBoot = () => {
|
window.__runBoot = () => {
|
||||||
const app = doc.getElementById('rl-app');
|
const app = doc.getElementById('rl-app');
|
||||||
|
|
||||||
if (!window.navigator || !window.navigator.cookieEnabled) {
|
if (!navigator || !navigator.cookieEnabled) {
|
||||||
doc.location.replace('./?/NoCookie');
|
doc.location.replace('./?/NoCookie');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,7 +181,7 @@ window.__runBoot = () => {
|
||||||
+ '/'
|
+ '/'
|
||||||
+ (getHash() || '0')
|
+ (getHash() || '0')
|
||||||
+ '/'
|
+ '/'
|
||||||
+ window.Math.random().toString().substr(2)
|
+ Math.random().toString().substr(2)
|
||||||
+ '/').then(() => {});
|
+ '/').then(() => {});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts';
|
import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts';
|
||||||
|
|
||||||
|
|
@ -48,7 +47,7 @@ class CookieDriver {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
static supported() {
|
static supported() {
|
||||||
return !!(window.navigator && window.navigator.cookieEnabled);
|
return !!(navigator && navigator.cookieEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import { isStorageSupported } from 'Storage/RainLoop';
|
import { isStorageSupported } from 'Storage/RainLoop';
|
||||||
import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts';
|
import { CLIENT_SIDE_STORAGE_INDEX_NAME } from 'Common/Consts';
|
||||||
|
|
||||||
|
|
@ -22,13 +21,13 @@ class LocalStorageDriver {
|
||||||
let storageResult = null;
|
let storageResult = null;
|
||||||
try {
|
try {
|
||||||
const storageValue = this.s.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null;
|
const storageValue = this.s.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null;
|
||||||
storageResult = null === storageValue ? null : window.JSON.parse(storageValue);
|
storageResult = null === storageValue ? null : JSON.parse(storageValue);
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
(storageResult || (storageResult = {}))[key] = data;
|
(storageResult || (storageResult = {}))[key] = data;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.s.setItem(CLIENT_SIDE_STORAGE_INDEX_NAME, window.JSON.stringify(storageResult));
|
this.s.setItem(CLIENT_SIDE_STORAGE_INDEX_NAME, JSON.stringify(storageResult));
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
|
|
@ -46,7 +45,7 @@ class LocalStorageDriver {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const storageValue = this.s.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null,
|
const storageValue = this.s.getItem(CLIENT_SIDE_STORAGE_INDEX_NAME) || null,
|
||||||
storageResult = null === storageValue ? null : window.JSON.parse(storageValue);
|
storageResult = null === storageValue ? null : JSON.parse(storageValue);
|
||||||
|
|
||||||
return storageResult && undefined !== storageResult[key] ? storageResult[key] : null;
|
return storageResult && undefined !== storageResult[key] ? storageResult[key] : null;
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import key from 'key';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { KeyState } from 'Common/Enums';
|
import { KeyState } from 'Common/Enums';
|
||||||
|
|
||||||
const $win = $(window);
|
const $win = jQuery(window);
|
||||||
$win.__sizes = [0, 0];
|
$win.__sizes = [0, 0];
|
||||||
|
|
||||||
export { $win };
|
export { $win };
|
||||||
|
|
||||||
export const $html = $('html');
|
export const $html = jQuery('html');
|
||||||
export const $htmlCL = window.document.documentElement.classList;
|
export const $htmlCL = document.documentElement.classList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
|
@ -31,7 +28,7 @@ export const useKeyboardShortcuts = ko.observable(true);
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
const sUserAgent =
|
const sUserAgent =
|
||||||
('navigator' in window && 'userAgent' in window.navigator && window.navigator.userAgent.toLowerCase()) || '';
|
('navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase()) || '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
|
@ -189,7 +186,7 @@ export const keyScope = ko.computed({
|
||||||
});
|
});
|
||||||
|
|
||||||
keyScopeReal.subscribe((value) => {
|
keyScopeReal.subscribe((value) => {
|
||||||
// window.console.log('keyScope=' + sValue); // DEBUG
|
// console.log('keyScope=' + sValue); // DEBUG
|
||||||
key.setScope(value);
|
key.setScope(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import { htmlEditorDefaultConfig, htmlEditorLangsMap } from 'Common/Globals';
|
import { htmlEditorDefaultConfig, htmlEditorLangsMap } from 'Common/Globals';
|
||||||
import { EventKeyCode, Magics } from 'Common/Enums';
|
import { EventKeyCode, Magics } from 'Common/Enums';
|
||||||
import * as Settings from 'Storage/Settings';
|
import * as Settings from 'Storage/Settings';
|
||||||
|
|
@ -32,7 +30,7 @@ class HtmlEditor {
|
||||||
this.onModeChange = onModeChange;
|
this.onModeChange = onModeChange;
|
||||||
|
|
||||||
this.element = element;
|
this.element = element;
|
||||||
this.$element = $(element);
|
this.$element = jQuery(element);
|
||||||
|
|
||||||
// throttle
|
// throttle
|
||||||
var t, o = this;
|
var t, o = this;
|
||||||
|
|
@ -56,8 +54,8 @@ class HtmlEditor {
|
||||||
|
|
||||||
blurTrigger() {
|
blurTrigger() {
|
||||||
if (this.onBlur) {
|
if (this.onBlur) {
|
||||||
window.clearTimeout(this.blurTimer);
|
clearTimeout(this.blurTimer);
|
||||||
this.blurTimer = window.setTimeout(() => {
|
this.blurTimer = setTimeout(() => {
|
||||||
this.runOnBlur();
|
this.runOnBlur();
|
||||||
}, Magics.Time200ms);
|
}, Magics.Time200ms);
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +63,7 @@ class HtmlEditor {
|
||||||
|
|
||||||
focusTrigger() {
|
focusTrigger() {
|
||||||
if (this.onBlur) {
|
if (this.onBlur) {
|
||||||
window.clearTimeout(this.blurTimer);
|
clearTimeout(this.blurTimer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -275,10 +273,10 @@ class HtmlEditor {
|
||||||
this.editor.on('drop', (event) => {
|
this.editor.on('drop', (event) => {
|
||||||
if (0 < event.data.dataTransfer.getFilesCount()) {
|
if (0 < event.data.dataTransfer.getFilesCount()) {
|
||||||
const file = event.data.dataTransfer.getFile(0);
|
const file = event.data.dataTransfer.getFile(0);
|
||||||
if (file && window.FileReader && event.data.dataTransfer.id && file.type && file.type.match(/^image/i)) {
|
if (file && event.data.dataTransfer.id && file.type && file.type.match(/^image/i)) {
|
||||||
const id = event.data.dataTransfer.id,
|
const id = event.data.dataTransfer.id,
|
||||||
imageId = `[img=${id}]`,
|
imageId = `[img=${id}]`,
|
||||||
reader = new window.FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.onloadend = () => {
|
reader.onloadend = () => {
|
||||||
if (reader.result) {
|
if (reader.result) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
// let rainloopCaches = window.caches && window.caches.open ? window.caches : null;
|
// let rainloopCaches = window.caches && window.caches.open ? window.caches : null;
|
||||||
|
|
||||||
|
|
@ -12,9 +11,8 @@ export function jassl(src, async = false) {
|
||||||
throw new Error('src should not be empty.');
|
throw new Error('src should not be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new window.Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const doc = window.document,
|
const element = document.createElement('script');
|
||||||
element = doc.createElement('script');
|
|
||||||
|
|
||||||
element.onload = () => {
|
element.onload = () => {
|
||||||
resolve(src);
|
resolve(src);
|
||||||
|
|
@ -27,7 +25,7 @@ export function jassl(src, async = false) {
|
||||||
element.async = !!async;
|
element.async = !!async;
|
||||||
element.src = src;
|
element.src = src;
|
||||||
|
|
||||||
doc.body.appendChild(element);
|
document.body.appendChild(element);
|
||||||
}) /* .then((s) => {
|
}) /* .then((s) => {
|
||||||
|
|
||||||
const found = s && rainloopCaches ? s.match(/rainloop\/v\/([^\/]+)\/static\//) : null;
|
const found = s && rainloopCaches ? s.match(/rainloop\/v\/([^\/]+)\/static\//) : null;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import { pString, pInt, isNormal } from 'Common/Utils';
|
import { pString, pInt, isNormal } from 'Common/Utils';
|
||||||
import * as Settings from 'Storage/Settings';
|
import * as Settings from 'Storage/Settings';
|
||||||
|
|
||||||
|
|
@ -160,7 +159,7 @@ export function append() {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function change(email) {
|
export function change(email) {
|
||||||
return serverRequest('Change') + window.encodeURIComponent(email) + '/';
|
return serverRequest('Change') + encodeURIComponent(email) + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -204,7 +203,7 @@ export function messageDownloadLink(requestHash) {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function avatarLink(email) {
|
export function avatarLink(email) {
|
||||||
return SERVER_PREFIX + '/Raw/0/Avatar/' + window.encodeURIComponent(email) + '/';
|
return SERVER_PREFIX + '/Raw/0/Avatar/' + encodeURIComponent(email) + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -231,7 +230,7 @@ export function userBackground(hash) {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function langLink(lang, isAdmin) {
|
export function langLink(lang, isAdmin) {
|
||||||
return SERVER_PREFIX + '/Lang/0/' + (isAdmin ? 'Admin' : 'App') + '/' + window.encodeURI(lang) + '/' + VERSION + '/';
|
return SERVER_PREFIX + '/Lang/0/' + (isAdmin ? 'Admin' : 'App') + '/' + encodeURI(lang) + '/' + VERSION + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -310,7 +309,7 @@ export function themePreviewLink(theme) {
|
||||||
prefix = WEB_PREFIX;
|
prefix = WEB_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
return prefix + 'themes/' + window.encodeURI(theme) + '/images/preview.png';
|
return prefix + 'themes/' + encodeURI(theme) + '/images/preview.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -373,7 +372,7 @@ export function mailBox(folder, page = 1, search = '', threadUid = '') {
|
||||||
|
|
||||||
if (folder) {
|
if (folder) {
|
||||||
const resultThreadUid = pInt(threadUid);
|
const resultThreadUid = pInt(threadUid);
|
||||||
result += window.encodeURI(folder) + (0 < resultThreadUid ? '~' + resultThreadUid : '');
|
result += encodeURI(folder) + (0 < resultThreadUid ? '~' + resultThreadUid : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 < page) {
|
if (1 < page) {
|
||||||
|
|
@ -383,7 +382,7 @@ export function mailBox(folder, page = 1, search = '', threadUid = '') {
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
result = result.replace(/[/]+$/, '');
|
result = result.replace(/[/]+$/, '');
|
||||||
result += '/' + window.encodeURI(search);
|
result += '/' + encodeURI(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
||||||
let _moment = null;
|
let _moment = null;
|
||||||
|
|
@ -98,7 +96,7 @@ export function format(timeStampInUTC, formatStr) {
|
||||||
export function momentToNode(element) {
|
export function momentToNode(element) {
|
||||||
let key = '',
|
let key = '',
|
||||||
time = 0;
|
time = 0;
|
||||||
const $el = $(element);
|
const $el = jQuery(element);
|
||||||
|
|
||||||
time = $el.data('moment-time');
|
time = $el.data('moment-time');
|
||||||
if (time) {
|
if (time) {
|
||||||
|
|
@ -119,7 +117,7 @@ export function momentToNode(element) {
|
||||||
*/
|
*/
|
||||||
export function reload() {
|
export function reload() {
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
$('.moment', window.document).each((index, item) => {
|
jQuery('.moment', document).each((index, item) => {
|
||||||
momentToNode(item);
|
momentToNode(item);
|
||||||
})
|
})
|
||||||
, 1);
|
, 1);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import $ from '$';
|
|
||||||
import key from 'key';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { EventKeyCode } from 'Common/Enums';
|
import { EventKeyCode } from 'Common/Enums';
|
||||||
|
|
||||||
|
|
@ -274,7 +272,7 @@ class Selector {
|
||||||
this.oContentScrollable = contentScrollable ? contentScrollable[0] : null;
|
this.oContentScrollable = contentScrollable ? contentScrollable[0] : null;
|
||||||
|
|
||||||
if (this.oContentVisible && this.oContentScrollable) {
|
if (this.oContentVisible && this.oContentScrollable) {
|
||||||
$(this.oContentVisible)
|
jQuery(this.oContentVisible)
|
||||||
.on('selectstart', (event) => {
|
.on('selectstart', (event) => {
|
||||||
if (event && event.preventDefault) {
|
if (event && event.preventDefault) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -513,7 +511,7 @@ class Selector {
|
||||||
|
|
||||||
const offset = 20,
|
const offset = 20,
|
||||||
list = this.list(),
|
list = this.list(),
|
||||||
$focused = $(this.sItemFocusedSelector, this.oContentScrollable),
|
$focused = jQuery(this.sItemFocusedSelector, this.oContentScrollable),
|
||||||
pos = $focused.position(),
|
pos = $focused.position(),
|
||||||
visibleHeight = this.oContentVisible.height(),
|
visibleHeight = this.oContentVisible.height(),
|
||||||
focusedHeight = $focused.outerHeight();
|
focusedHeight = $focused.outerHeight();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { Notification, UploadErrorCode } from 'Common/Enums';
|
import { Notification, UploadErrorCode } from 'Common/Enums';
|
||||||
import { pInt } from 'Common/Utils';
|
import { pInt } from 'Common/Utils';
|
||||||
|
|
@ -109,7 +107,7 @@ export function i18n(key, valueList, defaulValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const i18nToNode = (element) => {
|
const i18nToNode = (element) => {
|
||||||
const $el = $(element),
|
const $el = jQuery(element),
|
||||||
key = $el.data('i18n');
|
key = $el.data('i18n');
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
|
|
@ -138,7 +136,7 @@ const i18nToNode = (element) => {
|
||||||
*/
|
*/
|
||||||
export function i18nToNodes(elements) {
|
export function i18nToNodes(elements) {
|
||||||
setTimeout(() =>
|
setTimeout(() =>
|
||||||
$('[data-i18n]', elements).each((index, item) => {
|
jQuery('[data-i18n]', elements).each((index, item) => {
|
||||||
i18nToNode(item);
|
i18nToNode(item);
|
||||||
})
|
})
|
||||||
, 1);
|
, 1);
|
||||||
|
|
@ -148,7 +146,7 @@ const reloadData = () => {
|
||||||
if (window.rainloopI18N) {
|
if (window.rainloopI18N) {
|
||||||
I18N_DATA = window.rainloopI18N || {};
|
I18N_DATA = window.rainloopI18N || {};
|
||||||
|
|
||||||
i18nToNodes(window.document);
|
i18nToNodes(document);
|
||||||
|
|
||||||
momentorReload();
|
momentorReload();
|
||||||
trigger(!trigger());
|
trigger(!trigger());
|
||||||
|
|
@ -196,12 +194,12 @@ export function initOnStartOrLangChange(startCallback, langCallback = null) {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function getNotification(code, message = '', defCode = null) {
|
export function getNotification(code, message = '', defCode = null) {
|
||||||
code = window.parseInt(code, 10) || 0;
|
code = parseInt(code, 10) || 0;
|
||||||
if (Notification.ClientViewError === code && message) {
|
if (Notification.ClientViewError === code && message) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
defCode = defCode ? window.parseInt(defCode, 10) || 0 : 0;
|
defCode = defCode ? parseInt(defCode, 10) || 0 : 0;
|
||||||
return undefined === I18N_NOTIFICATION_DATA[code]
|
return undefined === I18N_NOTIFICATION_DATA[code]
|
||||||
? defCode && undefined === I18N_NOTIFICATION_DATA[defCode]
|
? defCode && undefined === I18N_NOTIFICATION_DATA[defCode]
|
||||||
? I18N_NOTIFICATION_DATA[defCode]
|
? I18N_NOTIFICATION_DATA[defCode]
|
||||||
|
|
@ -226,7 +224,7 @@ export function getNotificationFromResponse(response, defCode = Notification.Unk
|
||||||
*/
|
*/
|
||||||
export function getUploadErrorDescByCode(code) {
|
export function getUploadErrorDescByCode(code) {
|
||||||
let result = '';
|
let result = '';
|
||||||
switch (window.parseInt(code, 10) || 0) {
|
switch (parseInt(code, 10) || 0) {
|
||||||
case UploadErrorCode.FileIsTooBig:
|
case UploadErrorCode.FileIsTooBig:
|
||||||
result = i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
|
result = i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
|
||||||
break;
|
break;
|
||||||
|
|
@ -263,7 +261,7 @@ export function reload(admin, language) {
|
||||||
$htmlCL.add('rl-changing-language');
|
$htmlCL.add('rl-changing-language');
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
return window.fetch(langLink(language, admin), {cache: 'reload'})
|
return fetch(langLink(language, admin), {cache: 'reload'})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const type = response.headers.get('Content-Type');
|
const type = response.headers.get('Content-Type');
|
||||||
|
|
@ -276,9 +274,9 @@ export function reload(admin, language) {
|
||||||
reject(new Error(error.message))
|
reject(new Error(error.message))
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
var doc = window.document, script = doc.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.text = data;
|
script.text = data;
|
||||||
doc.head.appendChild(script).parentNode.removeChild(script);
|
document.head.appendChild(script).parentNode.removeChild(script);
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => {
|
() => {
|
||||||
reloadData();
|
reloadData();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { $win, dropdownVisibility, data as GlobalsData } from 'Common/Globals';
|
import { $win, dropdownVisibility, data as GlobalsData } from 'Common/Globals';
|
||||||
|
|
@ -7,9 +5,9 @@ import { ComposeType, SaveSettingsStep, FolderType } from 'Common/Enums';
|
||||||
import { Mime } from 'Common/Mime';
|
import { Mime } from 'Common/Mime';
|
||||||
|
|
||||||
const
|
const
|
||||||
|
$ = jQuery,
|
||||||
$div = $('<div></div>'),
|
$div = $('<div></div>'),
|
||||||
isArray = Array.isArray,
|
isArray = Array.isArray;
|
||||||
decodeURIComponent = component => window.decodeURIComponent(component);
|
|
||||||
|
|
||||||
var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => {
|
var htmlspecialchars = ((de,se,gt,lt,sq,dq,bt) => {
|
||||||
return (str, quote_style = 3, double_encode = true) => {
|
return (str, quote_style = 3, double_encode = true) => {
|
||||||
|
|
@ -50,8 +48,8 @@ export function isPosNumeric(value, includeZero = true) {
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
export function pInt(value, defaultValur = 0) {
|
export function pInt(value, defaultValur = 0) {
|
||||||
const result = isNormal(value) && value ? window.parseInt(value, 10) : defaultValur;
|
const result = isNormal(value) && value ? parseInt(value, 10) : defaultValur;
|
||||||
return window.isNaN(result) ? defaultValur : result;
|
return isNaN(result) ? defaultValur : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,7 +96,7 @@ export function fakeMd5(len = 32) {
|
||||||
|
|
||||||
let result = '';
|
let result = '';
|
||||||
while (result.length < len) {
|
while (result.length < len) {
|
||||||
result += line.substr(window.Math.round(window.Math.random() * lineLen), 1);
|
result += line.substr(Math.round(Math.random() * lineLen), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -148,8 +146,8 @@ const timeOutAction = (() => {
|
||||||
const timeOuts = {};
|
const timeOuts = {};
|
||||||
return (action, fFunction, timeOut) => {
|
return (action, fFunction, timeOut) => {
|
||||||
timeOuts[action] = undefined === timeOuts[action] ? 0 : timeOuts[action];
|
timeOuts[action] = undefined === timeOuts[action] ? 0 : timeOuts[action];
|
||||||
window.clearTimeout(timeOuts[action]);
|
clearTimeout(timeOuts[action]);
|
||||||
timeOuts[action] = window.setTimeout(fFunction, timeOut);
|
timeOuts[action] = setTimeout(fFunction, timeOut);
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
@ -168,14 +166,14 @@ export function deModule(m) {
|
||||||
*/
|
*/
|
||||||
export function inFocus() {
|
export function inFocus() {
|
||||||
try {
|
try {
|
||||||
if (window.document.activeElement) {
|
if (document.activeElement) {
|
||||||
if (undefined === window.document.activeElement.__inFocusCache) {
|
if (undefined === document.activeElement.__inFocusCache) {
|
||||||
window.document.activeElement.__inFocusCache = $(window.document.activeElement).is(
|
document.activeElement.__inFocusCache = $(document.activeElement).is(
|
||||||
'input,textarea,iframe,.cke_editable'
|
'input,textarea,iframe,.cke_editable'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!window.document.activeElement.__inFocusCache;
|
return !!document.activeElement.__inFocusCache;
|
||||||
}
|
}
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
|
|
||||||
|
|
@ -187,13 +185,11 @@ export function inFocus() {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function removeInFocus(force) {
|
export function removeInFocus(force) {
|
||||||
if (window.document && window.document.activeElement && window.document.activeElement.blur) {
|
if (document.activeElement && document.activeElement.blur) {
|
||||||
try {
|
try {
|
||||||
const activeEl = $(window.document.activeElement);
|
const activeEl = $(document.activeElement);
|
||||||
if (activeEl && activeEl.is('input,textarea')) {
|
if (force || (activeEl && activeEl.is('input,textarea'))) {
|
||||||
window.document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
} else if (force) {
|
|
||||||
window.document.activeElement.blur();
|
|
||||||
}
|
}
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
|
|
@ -204,14 +200,7 @@ export function removeInFocus(force) {
|
||||||
*/
|
*/
|
||||||
export function removeSelection() {
|
export function removeSelection() {
|
||||||
try {
|
try {
|
||||||
if (window && window.getSelection) {
|
getSelection().removeAllRanges();
|
||||||
const sel = window.getSelection();
|
|
||||||
if (sel && sel.removeAllRanges) {
|
|
||||||
sel.removeAllRanges();
|
|
||||||
}
|
|
||||||
} else if (window.document && window.document.selection && window.document.selection.empty) {
|
|
||||||
window.document.selection.empty();
|
|
||||||
}
|
|
||||||
} catch (e) {} // eslint-disable-line no-empty
|
} catch (e) {} // eslint-disable-line no-empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,7 +253,7 @@ export function replySubjectAdd(prefix, subject) {
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
export function roundNumber(num, dec) {
|
export function roundNumber(num, dec) {
|
||||||
return window.Math.round(num * window.Math.pow(10, dec)) / window.Math.pow(10, dec);
|
return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -287,15 +276,6 @@ export function friendlySize(sizeInBytes) {
|
||||||
return sizeInBytes + 'B';
|
return sizeInBytes + 'B';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} desc
|
|
||||||
*/
|
|
||||||
export function log(desc) {
|
|
||||||
if (window.console && window.console.log) {
|
|
||||||
window.console.log(desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {?} object
|
* @param {?} object
|
||||||
* @param {string} methodName
|
* @param {string} methodName
|
||||||
|
|
@ -429,7 +409,7 @@ export function previewMessage(
|
||||||
isHtml,
|
isHtml,
|
||||||
print
|
print
|
||||||
) {
|
) {
|
||||||
const win = window.open(''),
|
const win = open(''),
|
||||||
doc = win.document,
|
doc = win.document,
|
||||||
bodyClone = body.clone(),
|
bodyClone = body.clone(),
|
||||||
bodyClass = isHtml ? 'html' : 'plain';
|
bodyClass = isHtml ? 'html' : 'plain';
|
||||||
|
|
@ -456,7 +436,7 @@ export function previewMessage(
|
||||||
doc.close();
|
doc.close();
|
||||||
|
|
||||||
if (print) {
|
if (print) {
|
||||||
window.setTimeout(() => win.print(), 100);
|
setTimeout(() => win.print(), 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -830,7 +810,7 @@ export function folderListOptionsBuilder(
|
||||||
aResult.push({
|
aResult.push({
|
||||||
id: oItem.fullNameRaw,
|
id: oItem.fullNameRaw,
|
||||||
name:
|
name:
|
||||||
new window.Array(oItem.deep + 1 - iUnDeep).join(sDeepPrefix) +
|
new Array(oItem.deep + 1 - iUnDeep).join(sDeepPrefix) +
|
||||||
(fRenameCallback ? fRenameCallback(oItem) : oItem.name()),
|
(fRenameCallback ? fRenameCallback(oItem) : oItem.name()),
|
||||||
system: false,
|
system: false,
|
||||||
seporator: false,
|
seporator: false,
|
||||||
|
|
@ -869,20 +849,11 @@ export function folderListOptionsBuilder(
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function selectElement(element) {
|
export function selectElement(element) {
|
||||||
let sel = null,
|
let sel = getSelection(),
|
||||||
range = null;
|
range = document.createRange();
|
||||||
|
sel.removeAllRanges();
|
||||||
if (window.getSelection) {
|
range.selectNodeContents(element);
|
||||||
sel = window.getSelection();
|
sel.addRange(range);
|
||||||
sel.removeAllRanges();
|
|
||||||
range = window.document.createRange();
|
|
||||||
range.selectNodeContents(element);
|
|
||||||
sel.addRange(range);
|
|
||||||
} else if (window.document.selection) {
|
|
||||||
range = window.document.body.createTextRange();
|
|
||||||
range.moveToElementText(element);
|
|
||||||
range.select();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var dv;
|
var dv;
|
||||||
|
|
@ -975,7 +946,7 @@ let __themeTimer = 0,
|
||||||
export function changeTheme(value, themeTrigger = ()=>{}) {
|
export function changeTheme(value, themeTrigger = ()=>{}) {
|
||||||
const themeLink = $('#app-theme-link'),
|
const themeLink = $('#app-theme-link'),
|
||||||
clearTimer = () => {
|
clearTimer = () => {
|
||||||
__themeTimer = window.setTimeout(() => themeTrigger(SaveSettingsStep.Idle), 1000);
|
__themeTimer = setTimeout(() => themeTrigger(SaveSettingsStep.Idle), 1000);
|
||||||
__themeAjax = null;
|
__themeAjax = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -995,7 +966,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
|
||||||
url += 'Json/';
|
url += 'Json/';
|
||||||
}
|
}
|
||||||
|
|
||||||
window.clearTimeout(__themeTimer);
|
clearTimeout(__themeTimer);
|
||||||
|
|
||||||
themeTrigger(SaveSettingsStep.Animate);
|
themeTrigger(SaveSettingsStep.Animate);
|
||||||
|
|
||||||
|
|
@ -1004,10 +975,10 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
|
||||||
}
|
}
|
||||||
let init = {};
|
let init = {};
|
||||||
if (window.AbortController) {
|
if (window.AbortController) {
|
||||||
__themeAjax = new window.AbortController();
|
__themeAjax = new AbortController();
|
||||||
init.signal = __themeAjax.signal;
|
init.signal = __themeAjax.signal;
|
||||||
}
|
}
|
||||||
window.fetch(url, init)
|
fetch(url, init)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data && isArray(data) && 2 === data.length) {
|
if (data && isArray(data) && 2 === data.length) {
|
||||||
|
|
@ -1163,11 +1134,11 @@ export function isTransparent(color) {
|
||||||
* @param {Function} fCallback
|
* @param {Function} fCallback
|
||||||
*/
|
*/
|
||||||
export function resizeAndCrop(url, value, fCallback) {
|
export function resizeAndCrop(url, value, fCallback) {
|
||||||
const img = new window.Image();
|
const img = new Image();
|
||||||
img.onload = function() {
|
img.onload = function() {
|
||||||
let diff = [0, 0];
|
let diff = [0, 0];
|
||||||
|
|
||||||
const canvas = window.document.createElement('canvas'),
|
const canvas = document.createElement('canvas'),
|
||||||
ctx = canvas.getContext('2d');
|
ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
canvas.width = value;
|
canvas.width = value;
|
||||||
|
|
@ -1264,23 +1235,6 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Function} fn
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
export function domReady(fn) {
|
|
||||||
$(() => fn());
|
|
||||||
//
|
|
||||||
// if ('loading' !== window.document.readyState)
|
|
||||||
// {
|
|
||||||
// fn();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// window.document.addEventListener('DOMContentLoaded', fn);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
var wr;
|
var wr;
|
||||||
export const windowResize = timeout => {
|
export const windowResize = timeout => {
|
||||||
wr && clearTimeout(wr);
|
wr && clearTimeout(wr);
|
||||||
|
|
@ -1298,12 +1252,12 @@ export function windowResizeCallback() {
|
||||||
windowResize();
|
windowResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
let substr = window.String.substr;
|
let substr = String.substr;
|
||||||
if ('b' !== 'ab'.substr(-1)) {
|
if ('b' !== 'ab'.substr(-1)) {
|
||||||
substr = (str, start, length) => {
|
substr = (str, start, length) => {
|
||||||
start = 0 > start ? str.length + start : start;
|
start = 0 > start ? str.length + start : start;
|
||||||
return str.substr(start, length);
|
return str.substr(start, length);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.String.substr = substr;
|
String.substr = substr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { i18nToNodes } from 'Common/Translator';
|
import { i18nToNodes } from 'Common/Translator';
|
||||||
|
|
@ -29,7 +28,7 @@ const componentExportHelper = (ClassObject, templateID = '') => ({
|
||||||
|
|
||||||
if (componentInfo && componentInfo.element) {
|
if (componentInfo && componentInfo.element) {
|
||||||
params.component = componentInfo;
|
params.component = componentInfo;
|
||||||
params.element = $(componentInfo.element);
|
params.element = jQuery(componentInfo.element);
|
||||||
|
|
||||||
i18nToNodes(params.element);
|
i18nToNodes(params.element);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import $ from '$';
|
|
||||||
import { AbstractComponent, componentExportHelper } from 'Component/Abstract';
|
import { AbstractComponent, componentExportHelper } from 'Component/Abstract';
|
||||||
|
|
||||||
class ScriptComponent extends AbstractComponent {
|
class ScriptComponent extends AbstractComponent {
|
||||||
|
|
@ -21,7 +20,7 @@ class ScriptComponent extends AbstractComponent {
|
||||||
if (script) {
|
if (script) {
|
||||||
params.element.text('');
|
params.element.text('');
|
||||||
params.element.replaceWith(
|
params.element.replaceWith(
|
||||||
$(script).text(
|
jQuery(script).text(
|
||||||
params.component.templateNodes[0] && params.component.templateNodes[0].nodeValue
|
params.component.templateNodes[0] && params.component.templateNodes[0].nodeValue
|
||||||
? params.component.templateNodes[0].nodeValue
|
? params.component.templateNodes[0].nodeValue
|
||||||
: ''
|
: ''
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import $ from '$';
|
|
||||||
|
|
||||||
let cachedUrl = null;
|
let cachedUrl = null;
|
||||||
const getUrl = () => {
|
const getUrl = () => {
|
||||||
if (!cachedUrl) {
|
if (!cachedUrl) {
|
||||||
const version = $('#rlAppVersion').attr('content') || '0.0.0';
|
const version = jQuery('#rlAppVersion').attr('content') || '0.0.0';
|
||||||
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
|
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,7 +13,7 @@ export default {
|
||||||
viewModel: {
|
viewModel: {
|
||||||
createViewModel: ({ icon = 'null' }, componentInfo) => {
|
createViewModel: ({ icon = 'null' }, componentInfo) => {
|
||||||
if (componentInfo && componentInfo.element) {
|
if (componentInfo && componentInfo.element) {
|
||||||
$(componentInfo.element).replaceWith(
|
jQuery(componentInfo.element).replaceWith(
|
||||||
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
|
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
dev/External/Opentip.js
vendored
2
dev/External/Opentip.js
vendored
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
const Opentip = window.Opentip || {};
|
const Opentip = window.Opentip || {};
|
||||||
|
|
||||||
Opentip.styles = Opentip.styles || {};
|
Opentip.styles = Opentip.styles || {};
|
||||||
|
|
|
||||||
94
dev/External/ko.js
vendored
94
dev/External/ko.js
vendored
|
|
@ -1,10 +1,10 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import Opentip from 'Opentip';
|
import Opentip from 'Opentip';
|
||||||
|
|
||||||
import { SaveSettingsStep, Magics } from 'Common/Enums';
|
import { SaveSettingsStep, Magics } from 'Common/Enums';
|
||||||
|
|
||||||
const ko = window.ko,
|
const
|
||||||
|
$ = jQuery,
|
||||||
|
ko = window.ko,
|
||||||
fDisposalTooltipHelper = (element) => {
|
fDisposalTooltipHelper = (element) => {
|
||||||
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
||||||
if (element && element.__opentip) {
|
if (element && element.__opentip) {
|
||||||
|
|
@ -14,26 +14,6 @@ const ko = window.ko,
|
||||||
},
|
},
|
||||||
isFunction = v => typeof v === 'function';
|
isFunction = v => typeof v === 'function';
|
||||||
|
|
||||||
ko.bindingHandlers.updateWidth = {
|
|
||||||
init: (element, fValueAccessor) => {
|
|
||||||
const $el = $(element),
|
|
||||||
fValue = fValueAccessor(),
|
|
||||||
fInit = () => {
|
|
||||||
fValue($el.width());
|
|
||||||
setTimeout(() => {
|
|
||||||
fValue($el.width());
|
|
||||||
}, Magics.Time500ms);
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('resize', fInit);
|
|
||||||
fInit();
|
|
||||||
|
|
||||||
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
|
||||||
window.removeEventListener('resize', fInit);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ko.bindingHandlers.editor = {
|
ko.bindingHandlers.editor = {
|
||||||
init: (element, fValueAccessor) => {
|
init: (element, fValueAccessor) => {
|
||||||
let editor = null;
|
let editor = null;
|
||||||
|
|
@ -70,10 +50,10 @@ ko.bindingHandlers.editor = {
|
||||||
|
|
||||||
ko.bindingHandlers.json = {
|
ko.bindingHandlers.json = {
|
||||||
init: (element, fValueAccessor) => {
|
init: (element, fValueAccessor) => {
|
||||||
$(element).text(window.JSON.stringify(ko.unwrap(fValueAccessor())));
|
$(element).text(JSON.stringify(ko.unwrap(fValueAccessor())));
|
||||||
},
|
},
|
||||||
update: (element, fValueAccessor) => {
|
update: (element, fValueAccessor) => {
|
||||||
$(element).text(window.JSON.stringify(ko.unwrap(fValueAccessor())));
|
$(element).text(JSON.stringify(ko.unwrap(fValueAccessor())));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -97,11 +77,11 @@ ko.bindingHandlers.scrollerShadows = {
|
||||||
|
|
||||||
if (cont) {
|
if (cont) {
|
||||||
$(cont).on('scroll resize', fFunc);
|
$(cont).on('scroll resize', fFunc);
|
||||||
window.addEventListener('resize', fFunc);
|
addEventListener('resize', fFunc);
|
||||||
|
|
||||||
ko.utils.domNodeDisposal.addDisposeCallback(cont, () => {
|
ko.utils.domNodeDisposal.addDisposeCallback(cont, () => {
|
||||||
$(cont).off();
|
$(cont).off();
|
||||||
window.removeEventListener('resize', fFunc);
|
removeEventListener('resize', fFunc);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -179,12 +159,12 @@ ko.bindingHandlers.tooltip = {
|
||||||
element.__opentip.setContent(sValue);
|
element.__opentip.setContent(sValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('rl.tooltips.diactivate', () => {
|
addEventListener('rl.tooltips.diactivate', () => {
|
||||||
element.__opentip.hide();
|
element.__opentip.hide();
|
||||||
element.__opentip.deactivate();
|
element.__opentip.deactivate();
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('rl.tooltips.activate', () => {
|
addEventListener('rl.tooltips.activate', () => {
|
||||||
element.__opentip.activate();
|
element.__opentip.activate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -223,7 +203,7 @@ ko.bindingHandlers.tooltipErrorTip = {
|
||||||
|
|
||||||
element.__opentip.deactivate();
|
element.__opentip.deactivate();
|
||||||
|
|
||||||
$(window.document).on('click', () => {
|
$(document).on('click', () => {
|
||||||
if (element && element.__opentip) {
|
if (element && element.__opentip) {
|
||||||
element.__opentip.hide();
|
element.__opentip.hide();
|
||||||
}
|
}
|
||||||
|
|
@ -303,7 +283,7 @@ ko.bindingHandlers.dropdownCloser = {
|
||||||
|
|
||||||
ko.bindingHandlers.popover = {
|
ko.bindingHandlers.popover = {
|
||||||
init: function(element, fValueAccessor) {
|
init: function(element, fValueAccessor) {
|
||||||
window.console.log('TODO: $(element).popover removed', element, fValueAccessor);
|
console.log('TODO: $(element).popover removed', element, fValueAccessor);
|
||||||
/*
|
/*
|
||||||
$(element).popover(ko.unwrap(fValueAccessor()));
|
$(element).popover(ko.unwrap(fValueAccessor()));
|
||||||
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
|
||||||
|
|
@ -313,36 +293,6 @@ ko.bindingHandlers.popover = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ko.bindingHandlers.csstext = {};
|
|
||||||
ko.bindingHandlers.csstext.init = ko.bindingHandlers.csstext.update = (element, fValueAccessor) => {
|
|
||||||
if (element && element.styleSheet && 'undefined' !== typeof element.styleSheet.cssText) {
|
|
||||||
element.styleSheet.cssText = ko.unwrap(fValueAccessor());
|
|
||||||
} else {
|
|
||||||
$(element).text(ko.unwrap(fValueAccessor()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ko.bindingHandlers.resizecrop = {
|
|
||||||
init: (element) => {
|
|
||||||
$(element)
|
|
||||||
.addClass('resizecrop')
|
|
||||||
.resizecrop({
|
|
||||||
'width': '100',
|
|
||||||
'height': '100',
|
|
||||||
'wrapperCSS': {
|
|
||||||
'border-radius': '10px'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
update: (element, fValueAccessor) => {
|
|
||||||
fValueAccessor()();
|
|
||||||
$(element).resizecrop({
|
|
||||||
'width': '100',
|
|
||||||
'height': '100'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ko.bindingHandlers.onKeyDown = {
|
ko.bindingHandlers.onKeyDown = {
|
||||||
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
||||||
$(element).on('keydown.koOnKeyDown', (event) => {
|
$(element).on('keydown.koOnKeyDown', (event) => {
|
||||||
|
|
@ -362,7 +312,7 @@ ko.bindingHandlers.onKeyDown = {
|
||||||
ko.bindingHandlers.onEnter = {
|
ko.bindingHandlers.onEnter = {
|
||||||
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
||||||
$(element).on('keypress.koOnEnter', (event) => {
|
$(element).on('keypress.koOnEnter', (event) => {
|
||||||
if (event && 13 === window.parseInt(event.keyCode, 10)) {
|
if (event && 13 === parseInt(event.keyCode, 10)) {
|
||||||
$(element).trigger('change');
|
$(element).trigger('change');
|
||||||
fValueAccessor().call(viewModel);
|
fValueAccessor().call(viewModel);
|
||||||
}
|
}
|
||||||
|
|
@ -377,7 +327,7 @@ ko.bindingHandlers.onEnter = {
|
||||||
ko.bindingHandlers.onSpace = {
|
ko.bindingHandlers.onSpace = {
|
||||||
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
||||||
$(element).on('keyup.koOnSpace', (event) => {
|
$(element).on('keyup.koOnSpace', (event) => {
|
||||||
if (event && 32 === window.parseInt(event.keyCode, 10)) {
|
if (event && 32 === parseInt(event.keyCode, 10)) {
|
||||||
fValueAccessor().call(viewModel, event);
|
fValueAccessor().call(viewModel, event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -391,7 +341,7 @@ ko.bindingHandlers.onSpace = {
|
||||||
ko.bindingHandlers.onTab = {
|
ko.bindingHandlers.onTab = {
|
||||||
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
||||||
$(element).on('keydown.koOnTab', (event) => {
|
$(element).on('keydown.koOnTab', (event) => {
|
||||||
if (event && 9 === window.parseInt(event.keyCode, 10)) {
|
if (event && 9 === parseInt(event.keyCode, 10)) {
|
||||||
return fValueAccessor().call(viewModel, !!event.shiftKey);
|
return fValueAccessor().call(viewModel, !!event.shiftKey);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -406,7 +356,7 @@ ko.bindingHandlers.onTab = {
|
||||||
ko.bindingHandlers.onEsc = {
|
ko.bindingHandlers.onEsc = {
|
||||||
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
init: (element, fValueAccessor, fAllBindingsAccessor, viewModel) => {
|
||||||
$(element).on('keyup.koOnEsc', (event) => {
|
$(element).on('keyup.koOnEsc', (event) => {
|
||||||
if (event && 27 === window.parseInt(event.keyCode, 10)) {
|
if (event && 27 === parseInt(event.keyCode, 10)) {
|
||||||
$(element).trigger('change');
|
$(element).trigger('change');
|
||||||
fValueAccessor().call(viewModel);
|
fValueAccessor().call(viewModel);
|
||||||
}
|
}
|
||||||
|
|
@ -529,7 +479,7 @@ ko.bindingHandlers.initFixedTrigger = {
|
||||||
let $container = $(values[0] || null);
|
let $container = $(values[0] || null);
|
||||||
$container = $container[0] ? $container : null;
|
$container = $container[0] ? $container : null;
|
||||||
if ($container) {
|
if ($container) {
|
||||||
window.addEventListener('resize', () => {
|
addEventListener('resize', () => {
|
||||||
const offset = $container ? $container.offset() : null;
|
const offset = $container ? $container.offset() : null;
|
||||||
if (offset && offset.top) {
|
if (offset && offset.top) {
|
||||||
$el.css('top', offset.top + top);
|
$el.css('top', offset.top + top);
|
||||||
|
|
@ -610,7 +560,7 @@ ko.bindingHandlers.draggable = {
|
||||||
offset = $this.offset(),
|
offset = $this.offset(),
|
||||||
bottomPos = offset.top + $this.height();
|
bottomPos = offset.top + $this.height();
|
||||||
|
|
||||||
window.clearInterval($this.data('timerScroll'));
|
clearInterval($this.data('timerScroll'));
|
||||||
$this.data('timerScroll', false);
|
$this.data('timerScroll', false);
|
||||||
|
|
||||||
if (event.pageX >= offset.left && event.pageX <= offset.left + $this.width()) {
|
if (event.pageX >= offset.left && event.pageX <= offset.left + $this.width()) {
|
||||||
|
|
@ -620,7 +570,7 @@ ko.bindingHandlers.draggable = {
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
$this.data('timerScroll', window.setInterval(moveUp, 10));
|
$this.data('timerScroll', setInterval(moveUp, 10));
|
||||||
moveUp();
|
moveUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,7 +580,7 @@ ko.bindingHandlers.draggable = {
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
$this.data('timerScroll', window.setInterval(moveDown, 10));
|
$this.data('timerScroll', setInterval(moveDown, 10));
|
||||||
moveDown();
|
moveDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -640,7 +590,7 @@ ko.bindingHandlers.draggable = {
|
||||||
conf.stop = () => {
|
conf.stop = () => {
|
||||||
$(droppableSelector).each(function() {
|
$(droppableSelector).each(function() {
|
||||||
const $this = $(this); // eslint-disable-line no-invalid-this
|
const $this = $(this); // eslint-disable-line no-invalid-this
|
||||||
window.clearInterval($this.data('timerScroll'));
|
clearInterval($this.data('timerScroll'));
|
||||||
$this.data('timerScroll', false);
|
$this.data('timerScroll', false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -1022,7 +972,7 @@ ko.extenders.falseTimeout = (target, option) => {
|
||||||
target.iFalseTimeoutTimeout = 0;
|
target.iFalseTimeoutTimeout = 0;
|
||||||
target.subscribe((value) => {
|
target.subscribe((value) => {
|
||||||
if (value) {
|
if (value) {
|
||||||
window.clearTimeout(target.iFalseTimeoutTimeout);
|
clearTimeout(target.iFalseTimeoutTimeout);
|
||||||
target.iFalseTimeoutTimeout = setTimeout(() => {
|
target.iFalseTimeoutTimeout = setTimeout(() => {
|
||||||
target(false);
|
target(false);
|
||||||
target.iFalseTimeoutTimeout = 0;
|
target.iFalseTimeoutTimeout = 0;
|
||||||
|
|
@ -1046,7 +996,7 @@ ko.extenders.specialThrottle = (target, option) => {
|
||||||
target.valueForRead(bValue);
|
target.valueForRead(bValue);
|
||||||
} else {
|
} else {
|
||||||
if (target.valueForRead()) {
|
if (target.valueForRead()) {
|
||||||
window.clearTimeout(target.iSpecialThrottleTimeout);
|
clearTimeout(target.iSpecialThrottleTimeout);
|
||||||
target.iSpecialThrottleTimeout = setTimeout(() => {
|
target.iSpecialThrottleTimeout = setTimeout(() => {
|
||||||
target.valueForRead(false);
|
target.valueForRead(false);
|
||||||
target.iSpecialThrottleTimeout = 0;
|
target.iSpecialThrottleTimeout = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import crossroads from 'crossroads';
|
|
||||||
import { isNonEmptyArray } from 'Common/Utils';
|
|
||||||
|
|
||||||
export class AbstractScreen {
|
export class AbstractScreen {
|
||||||
oCross = null;
|
oCross = null;
|
||||||
sScreenName;
|
sScreenName;
|
||||||
|
|
@ -47,9 +44,9 @@ export class AbstractScreen {
|
||||||
fMatcher = null;
|
fMatcher = null;
|
||||||
const routes = this.routes();
|
const routes = this.routes();
|
||||||
|
|
||||||
if (isNonEmptyArray(routes)) {
|
if (Array.isArray(routes) && routes.length) {
|
||||||
fMatcher = (this.onRoute || (()=>{})).bind(this);
|
fMatcher = (this.onRoute || (()=>{})).bind(this);
|
||||||
route = crossroads.create();
|
route = new Crossroads();
|
||||||
|
|
||||||
routes.forEach((item) => {
|
routes.forEach((item) => {
|
||||||
if (item && route) {
|
if (item && route) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
import { delegateRun, inFocus } from 'Common/Utils';
|
import { delegateRun, inFocus } from 'Common/Utils';
|
||||||
import { KeyState, EventKeyCode } from 'Common/Enums';
|
import { KeyState, EventKeyCode } from 'Common/Enums';
|
||||||
|
|
@ -36,7 +35,7 @@ export class AbstractViewNext {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
registerPopupKeyDown() {
|
registerPopupKeyDown() {
|
||||||
window.addEventListener('keydown', (event) => {
|
addEventListener('keydown', (event) => {
|
||||||
if (event && this.modalVisibility && this.modalVisibility()) {
|
if (event && this.modalVisibility && this.modalVisibility()) {
|
||||||
if (!this.bDisabeCloseOnEsc && EventKeyCode.Esc === event.keyCode) {
|
if (!this.bDisabeCloseOnEsc && EventKeyCode.Esc === event.keyCode) {
|
||||||
delegateRun(this, 'cancelCommand');
|
delegateRun(this, 'cancelCommand');
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,15 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import hasher from 'hasher';
|
|
||||||
import crossroads from 'crossroads';
|
|
||||||
|
|
||||||
import { Magics } from 'Common/Enums';
|
import { Magics } from 'Common/Enums';
|
||||||
import { runHook } from 'Common/Plugins';
|
import { runHook } from 'Common/Plugins';
|
||||||
import { $htmlCL, VIEW_MODELS, popupVisibilityNames } from 'Common/Globals';
|
import { $htmlCL, VIEW_MODELS, popupVisibilityNames } from 'Common/Globals';
|
||||||
|
|
||||||
import { pString, log, createCommandLegacy, delegateRun, isNonEmptyArray } from 'Common/Utils';
|
import { pString, createCommandLegacy, delegateRun, isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
let currentScreen = null,
|
let currentScreen = null,
|
||||||
defaultScreenName = '';
|
defaultScreenName = '';
|
||||||
|
|
||||||
const SCREENS = {};
|
const SCREENS = {}, $ = jQuery;
|
||||||
|
|
||||||
export const ViewType = {
|
export const ViewType = {
|
||||||
Popup: 'Popups',
|
Popup: 'Popups',
|
||||||
|
|
@ -224,7 +221,7 @@ export function buildViewModel(ViewModelClass, vmScreen) {
|
||||||
|
|
||||||
vmRunHook('view-model-post-build', ViewModelClass, vmDom);
|
vmRunHook('view-model-post-build', ViewModelClass, vmDom);
|
||||||
} else {
|
} else {
|
||||||
log('Cannot find view model position: ' + position);
|
console.log('Cannot find view model position: ' + position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -424,7 +421,7 @@ export function startScreens(screensClasses) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const cross = crossroads.create();
|
const cross = new Crossroads();
|
||||||
cross.addRoute(/^([a-zA-Z0-9-]*)\/?(.*)$/, screenOnRoute);
|
cross.addRoute(/^([a-zA-Z0-9-]*)\/?(.*)$/, screenOnRoute);
|
||||||
|
|
||||||
hasher.initialized.add(cross.parse, cross);
|
hasher.initialized.add(cross.parse, cross);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { FileType } from 'Common/Enums';
|
import { FileType } from 'Common/Enums';
|
||||||
|
|
@ -16,7 +15,7 @@ import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
import Audio from 'Common/Audio';
|
import Audio from 'Common/Audio';
|
||||||
|
|
||||||
const bAllowPdfPreview = !bMobileDevice && undefined !== window.navigator.mimeTypes['application/pdf'];
|
const bAllowPdfPreview = !bMobileDevice && undefined !== navigator.mimeTypes['application/pdf'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sExt
|
* @param {string} sExt
|
||||||
|
|
@ -405,7 +404,7 @@ class AttachmentModel extends AbstractModel {
|
||||||
generateTransferDownloadUrl() {
|
generateTransferDownloadUrl() {
|
||||||
let link = this.linkDownload();
|
let link = this.linkDownload();
|
||||||
if ('http' !== link.substr(0, 4)) {
|
if ('http' !== link.substr(0, 4)) {
|
||||||
link = window.location.protocol + '//' + window.location.host + window.location.pathname + link;
|
link = location.protocol + '//' + location.host + location.pathname + link;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.mimeType + ':' + this.fileName + ':' + link;
|
return this.mimeType + ':' + this.fileName + ':' + link;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
|
@ -23,6 +22,8 @@ import { emailArrayFromJson, emailArrayToStringClear, emailArrayToString, replyH
|
||||||
import { AttachmentModel, staticCombinedIconClass } from 'Model/Attachment';
|
import { AttachmentModel, staticCombinedIconClass } from 'Model/Attachment';
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
|
const $ = jQuery;
|
||||||
|
|
||||||
class MessageModel extends AbstractModel {
|
class MessageModel extends AbstractModel {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('MessageModel');
|
super('MessageModel');
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { isNonEmptyArray, log } from 'Common/Utils';
|
import { isNonEmptyArray } from 'Common/Utils';
|
||||||
|
|
||||||
import { AbstractModel } from 'Knoin/AbstractModel';
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ class OpenPgpKeyModel extends AbstractModel {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
import { ajax } from 'Common/Links';
|
import { ajax } from 'Common/Links';
|
||||||
import { isNormal, pString } from 'Common/Utils';
|
import { isNormal, pString } from 'Common/Utils';
|
||||||
import { DEFAULT_AJAX_TIMEOUT, TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT } from 'Common/Consts';
|
import { DEFAULT_AJAX_TIMEOUT, TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT } from 'Common/Consts';
|
||||||
|
|
@ -56,7 +54,7 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
||||||
};
|
};
|
||||||
params.XToken = Settings.appSettingsGet('token');
|
params.XToken = Settings.appSettingsGet('token');
|
||||||
// init.body = JSON.stringify(params);
|
// init.body = JSON.stringify(params);
|
||||||
const formData = new window.FormData();
|
const formData = new FormData();
|
||||||
Object.keys(params).forEach(key => {
|
Object.keys(params).forEach(key => {
|
||||||
formData.append(key, params[key])
|
formData.append(key, params[key])
|
||||||
});
|
});
|
||||||
|
|
@ -69,13 +67,13 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
||||||
|
|
||||||
if (window.AbortController) {
|
if (window.AbortController) {
|
||||||
this.abort(action);
|
this.abort(action);
|
||||||
const controller = new window.AbortController();
|
const controller = new AbortController();
|
||||||
setTimeout(() => controller.abort(), isNormal(timeOut) ? timeOut : DEFAULT_AJAX_TIMEOUT);
|
setTimeout(() => controller.abort(), isNormal(timeOut) ? timeOut : DEFAULT_AJAX_TIMEOUT);
|
||||||
init.signal = controller.signal;
|
init.signal = controller.signal;
|
||||||
this.oRequests[action] = controller;
|
this.oRequests[action] = controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
return window.fetch(ajax(additionalGetString), init)
|
return fetch(ajax(additionalGetString), init)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.abort(action, true);
|
this.abort(action, true);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
export class AbstractBasicPromises {
|
export class AbstractBasicPromises {
|
||||||
oPromisesStack = {};
|
oPromisesStack = {};
|
||||||
|
|
||||||
|
|
@ -9,11 +7,11 @@ export class AbstractBasicPromises {
|
||||||
}
|
}
|
||||||
|
|
||||||
fastResolve(mData) {
|
fastResolve(mData) {
|
||||||
return window.Promise.resolve(mData);
|
return Promise.resolve(mData);
|
||||||
}
|
}
|
||||||
|
|
||||||
fastReject(mData) {
|
fastReject(mData) {
|
||||||
return window.Promise.reject(mData);
|
return Promise.reject(mData);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTrigger(trigger, value) {
|
setTrigger(trigger, value) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
import PromisesPopulator from 'Promises/User/Populator';
|
import PromisesPopulator from 'Promises/User/Populator';
|
||||||
import { AbstractAjaxPromises } from 'Promises/AbstractAjax';
|
import { AbstractAjaxPromises } from 'Promises/AbstractAjax';
|
||||||
|
|
||||||
|
|
@ -23,8 +21,8 @@ class UserAjaxUserPromises extends AbstractAjaxPromises {
|
||||||
foldersReloadWithTimeout(fTrigger) {
|
foldersReloadWithTimeout(fTrigger) {
|
||||||
this.setTrigger(fTrigger, true);
|
this.setTrigger(fTrigger, true);
|
||||||
|
|
||||||
window.clearTimeout(this.foldersTimeout);
|
clearTimeout(this.foldersTimeout);
|
||||||
this.foldersTimeout = window.setTimeout(() => {
|
this.foldersTimeout = setTimeout(() => {
|
||||||
this.foldersReload(fTrigger);
|
this.foldersReload(fTrigger);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
import { TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT, DEFAULT_AJAX_TIMEOUT } from 'Common/Consts';
|
import { TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT, DEFAULT_AJAX_TIMEOUT } from 'Common/Consts';
|
||||||
import { StorageResultType, Notification } from 'Common/Enums';
|
import { StorageResultType, Notification } from 'Common/Enums';
|
||||||
import { pInt, pString } from 'Common/Utils';
|
import { pInt, pString } from 'Common/Utils';
|
||||||
|
|
@ -154,7 +152,7 @@ class AbstractAjaxRemote {
|
||||||
};
|
};
|
||||||
params.XToken = Settings.appSettingsGet('token');
|
params.XToken = Settings.appSettingsGet('token');
|
||||||
// init.body = JSON.stringify(params);
|
// init.body = JSON.stringify(params);
|
||||||
const formData = new window.FormData();
|
const formData = new FormData();
|
||||||
Object.keys(params).forEach(key => {
|
Object.keys(params).forEach(key => {
|
||||||
formData.append(key, params[key])
|
formData.append(key, params[key])
|
||||||
});
|
});
|
||||||
|
|
@ -163,7 +161,7 @@ class AbstractAjaxRemote {
|
||||||
|
|
||||||
if (window.AbortController) {
|
if (window.AbortController) {
|
||||||
this.abort(action);
|
this.abort(action);
|
||||||
const controller = new window.AbortController();
|
const controller = new AbortController();
|
||||||
if (iTimeOut) {
|
if (iTimeOut) {
|
||||||
setTimeout(() => controller.abort(), iTimeOut);
|
setTimeout(() => controller.abort(), iTimeOut);
|
||||||
}
|
}
|
||||||
|
|
@ -171,12 +169,12 @@ class AbstractAjaxRemote {
|
||||||
this.oRequests[action] = controller;
|
this.oRequests[action] = controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.fetch(ajax(sGetAdd), init)
|
fetch(ajax(sGetAdd), init)
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(oData => {
|
.then(oData => {
|
||||||
let cached = false;
|
let cached = false;
|
||||||
if (oData && oData.Time) {
|
if (oData && oData.Time) {
|
||||||
cached = pInt(oData.Time) > new window.Date().getTime() - start;
|
cached = pInt(oData.Time) > new Date().getTime() - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oData && oData.UpdateToken) {
|
if (oData && oData.UpdateToken) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { VIEW_MODELS } from 'Common/Globals';
|
import { VIEW_MODELS } from 'Common/Globals';
|
||||||
import { delegateRun, windowResize, log, pString } from 'Common/Utils';
|
import { delegateRun, windowResize, pString } from 'Common/Utils';
|
||||||
import { settings } from 'Common/Links';
|
import { settings } from 'Common/Links';
|
||||||
|
|
||||||
import { setHash } from 'Knoin/Knoin';
|
import { setHash } from 'Knoin/Knoin';
|
||||||
|
|
@ -72,7 +71,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
if (viewModelPlace && 1 === viewModelPlace.length) {
|
if (viewModelPlace && 1 === viewModelPlace.length) {
|
||||||
settingsScreen = new RoutedSettingsViewModel();
|
settingsScreen = new RoutedSettingsViewModel();
|
||||||
|
|
||||||
viewModelDom = $('<div></div>')
|
viewModelDom = jQuery('<div></div>')
|
||||||
.addClass('rl-settings-view-model')
|
.addClass('rl-settings-view-model')
|
||||||
.hide();
|
.hide();
|
||||||
viewModelDom.appendTo(viewModelPlace);
|
viewModelDom.appendTo(viewModelPlace);
|
||||||
|
|
@ -97,7 +96,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
|
|
||||||
delegateRun(settingsScreen, 'onBuild', [viewModelDom]);
|
delegateRun(settingsScreen, 'onBuild', [viewModelDom]);
|
||||||
} else {
|
} else {
|
||||||
log('Cannot find sub settings view model position: SettingsSubScreen');
|
console.log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +127,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#rl-content .b-settings .b-content')[0].scrollTop = 0;
|
jQuery('#rl-content .b-settings .b-content')[0].scrollTop = 0;
|
||||||
}
|
}
|
||||||
// --
|
// --
|
||||||
|
|
||||||
|
|
@ -167,7 +166,7 @@ class AbstractSettingsScreen extends AbstractScreen {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
this.oViewModelPlace = jQuery('#rl-content #rl-settings-subscreen');
|
||||||
}
|
}
|
||||||
|
|
||||||
routes() {
|
routes() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
|
|
||||||
import { Focused, Capa, ClientSideKeyName, Magics } from 'Common/Enums';
|
import { Focused, Capa, ClientSideKeyName, Magics } from 'Common/Enums';
|
||||||
import { $html, leftPanelDisabled, leftPanelType, moveAction, bMobileDevice } from 'Common/Globals';
|
import { $html, leftPanelDisabled, leftPanelType, moveAction, bMobileDevice } from 'Common/Globals';
|
||||||
import { pString, pInt, windowResizeCallback } from 'Common/Utils';
|
import { pString, pInt, windowResizeCallback } from 'Common/Utils';
|
||||||
|
|
@ -157,7 +155,7 @@ class MailBoxUserScreen extends AbstractScreen {
|
||||||
vals[1] = 1;
|
vals[1] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [window.decodeURI(vals[0]), vals[1], window.decodeURI(vals[2])];
|
return [decodeURI(vals[0]), vals[1], decodeURI(vals[2])];
|
||||||
},
|
},
|
||||||
fNormD = (request, vals) => {
|
fNormD = (request, vals) => {
|
||||||
vals[0] = pString(vals[0]);
|
vals[0] = pString(vals[0]);
|
||||||
|
|
@ -167,7 +165,7 @@ class MailBoxUserScreen extends AbstractScreen {
|
||||||
vals[0] = inboxFolderName;
|
vals[0] = inboxFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [window.decodeURI(vals[0]), 1, window.decodeURI(vals[1])];
|
return [decodeURI(vals[0]), 1, decodeURI(vals[1])];
|
||||||
};
|
};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { StorageResultType, Notification } from 'Common/Enums';
|
import { StorageResultType, Notification } from 'Common/Enums';
|
||||||
|
|
@ -58,7 +57,7 @@ class PackagesAdminSettings {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (StorageResultType.Success === result && data && data.Result && data.Result.Reload) {
|
if (StorageResultType.Success === result && data && data.Result && data.Result.Reload) {
|
||||||
window.location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
getApp().reloadPackagesList();
|
getApp().reloadPackagesList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Capa, StorageResultType } from 'Common/Enums';
|
import { Capa, StorageResultType } from 'Common/Enums';
|
||||||
|
|
@ -68,7 +67,7 @@ class AccountsUserSettings {
|
||||||
setHash(root(), true);
|
setHash(root(), true);
|
||||||
routeOff();
|
routeOff();
|
||||||
|
|
||||||
setTimeout(() => window.location.reload(), 1);
|
setTimeout(() => location.reload(), 1);
|
||||||
} else {
|
} else {
|
||||||
getApp().accountsAndIdentities();
|
getApp().accountsAndIdentities();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import Jua from 'Jua';
|
|
||||||
|
|
||||||
import { SaveSettingsStep, UploadErrorCode, Capa, Magics } from 'Common/Enums';
|
import { SaveSettingsStep, UploadErrorCode, Capa, Magics } from 'Common/Enums';
|
||||||
import { changeTheme, convertThemeName } from 'Common/Utils';
|
import { changeTheme, convertThemeName } from 'Common/Utils';
|
||||||
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
|
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
|
||||||
|
|
@ -47,7 +44,7 @@ class ThemesUserSettings {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.background.hash.subscribe((value) => {
|
this.background.hash.subscribe((value) => {
|
||||||
const b = window.document.body, cl = window.document.documentElement.classList;
|
const b = document.body, cl = document.documentElement.classList;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
cl.remove('UserBackground');
|
cl.remove('UserBackground');
|
||||||
b.removeAttribute('style');
|
b.removeAttribute('style');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
/* eslint-env browser */
|
|
||||||
|
|
||||||
const STORAGE_KEY = '__rlA';
|
const STORAGE_KEY = '__rlA';
|
||||||
const TIME_KEY = '__rlT';
|
const TIME_KEY = '__rlT';
|
||||||
|
|
||||||
|
|
@ -16,7 +14,7 @@ export function isStorageSupported(storageName) {
|
||||||
|
|
||||||
if (storageIsAvailable) {
|
if (storageIsAvailable) {
|
||||||
const s = window[storageName],
|
const s = window[storageName],
|
||||||
key = 'testLocalStorage_' + window.Math.random();
|
key = 'testLocalStorage_' + Math.random();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
s.setItem(key, key);
|
s.setItem(key, key);
|
||||||
|
|
@ -40,7 +38,7 @@ const __get = (key) => {
|
||||||
} else if (WIN_STORAGE) {
|
} else if (WIN_STORAGE) {
|
||||||
const data =
|
const data =
|
||||||
WIN_STORAGE.name && '{' === WIN_STORAGE.name.toString()[0]
|
WIN_STORAGE.name && '{' === WIN_STORAGE.name.toString()[0]
|
||||||
? window.JSON.parse(WIN_STORAGE.name.toString())
|
? JSON.parse(WIN_STORAGE.name.toString())
|
||||||
: null;
|
: null;
|
||||||
result = data ? data[key] || null : null;
|
result = data ? data[key] || null : null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import { isNormal } from 'Common/Utils';
|
import { isNormal } from 'Common/Utils';
|
||||||
|
|
||||||
let SETTINGS = window.__rlah_data() || null;
|
let SETTINGS = window.__rlah_data() || null;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class AppAdminStore extends AbstractAppStore {
|
||||||
this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages'));
|
this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages'));
|
||||||
/*
|
/*
|
||||||
if (settingsGet('Auth')) {
|
if (settingsGet('Auth')) {
|
||||||
window.fetch('./data/VERSION?' + window.Math.random()).then(() => this.dataFolderAccess(true));
|
fetch('./data/VERSION?' + Math.random()).then(() => this.dataFolderAccess(true));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import $ from '$';
|
|
||||||
|
|
||||||
import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
|
import { Magics, Layout, Focused, MessageSetAction, StorageResultType, Notification } from 'Common/Enums';
|
||||||
|
|
||||||
|
|
@ -50,6 +48,7 @@ import { getApp } from 'Helper/Apps/User';
|
||||||
import Remote from 'Remote/User/Ajax';
|
import Remote from 'Remote/User/Ajax';
|
||||||
|
|
||||||
const
|
const
|
||||||
|
$ = jQuery,
|
||||||
$div = $('<div></div>'),
|
$div = $('<div></div>'),
|
||||||
$hcont = $('<div></div>'),
|
$hcont = $('<div></div>'),
|
||||||
getRealHeight = $el => {
|
getRealHeight = $el => {
|
||||||
|
|
@ -142,7 +141,7 @@ class MessageUserStore {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.messageListPageCount = ko.computed(() => {
|
this.messageListPageCount = ko.computed(() => {
|
||||||
const page = window.Math.ceil(this.messageListCount() / SettingsStore.messagesPerPage());
|
const page = Math.ceil(this.messageListCount() / SettingsStore.messagesPerPage());
|
||||||
return 0 >= page ? 1 : page;
|
return 0 >= page ? 1 : page;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -798,7 +797,7 @@ class MessageUserStore {
|
||||||
|
|
||||||
this.messageListCount(iCount);
|
this.messageListCount(iCount);
|
||||||
this.messageListSearch(isNormal(data.Result.Search) ? data.Result.Search : '');
|
this.messageListSearch(isNormal(data.Result.Search) ? data.Result.Search : '');
|
||||||
this.messageListPage(window.Math.ceil(iOffset / SettingsStore.messagesPerPage() + 1));
|
this.messageListPage(Math.ceil(iOffset / SettingsStore.messagesPerPage() + 1));
|
||||||
this.messageListThreadUid(isNormal(data.Result.ThreadUid) ? pString(data.Result.ThreadUid) : '');
|
this.messageListThreadUid(isNormal(data.Result.ThreadUid) ? pString(data.Result.ThreadUid) : '');
|
||||||
|
|
||||||
this.messageListEndFolder(isNormal(data.Result.Folder) ? data.Result.Folder : '');
|
this.messageListEndFolder(isNormal(data.Result.Folder) ? data.Result.Folder : '');
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { DesktopNotification, Magics } from 'Common/Enums';
|
import { DesktopNotification, Magics } from 'Common/Enums';
|
||||||
|
|
@ -136,7 +135,7 @@ class NotificationUserStore {
|
||||||
|
|
||||||
if (nessageData) {
|
if (nessageData) {
|
||||||
notification.onclick = () => {
|
notification.onclick = () => {
|
||||||
window.focus();
|
focus();
|
||||||
|
|
||||||
if (nessageData.Folder && nessageData.Uid) {
|
if (nessageData.Folder && nessageData.Uid) {
|
||||||
Events.pub('mailbox.message.show', [nessageData.Folder, nessageData.Uid]);
|
Events.pub('mailbox.message.show', [nessageData.Folder, nessageData.Uid]);
|
||||||
|
|
@ -144,7 +143,7 @@ class NotificationUserStore {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setTimeout(
|
setTimeout(
|
||||||
(function(localNotifications) {
|
(function(localNotifications) {
|
||||||
return () => {
|
return () => {
|
||||||
if (localNotifications.cancel) {
|
if (localNotifications.cancel) {
|
||||||
|
|
@ -169,7 +168,7 @@ class NotificationUserStore {
|
||||||
* @returns {*|null}
|
* @returns {*|null}
|
||||||
*/
|
*/
|
||||||
notificationClass() {
|
notificationClass() {
|
||||||
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
|
return window.Notification && Notification.requestPermission ? Notification : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import $ from '$';
|
|
||||||
|
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
import { log, isNonEmptyArray, pString } from 'Common/Utils';
|
import { isNonEmptyArray, pString } from 'Common/Utils';
|
||||||
|
|
||||||
import AccountStore from 'Stores/User/Account';
|
import AccountStore from 'Stores/User/Account';
|
||||||
|
|
||||||
|
|
@ -197,7 +196,7 @@ class PgpUserStore {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,7 +238,7 @@ class PgpUserStore {
|
||||||
static domControlEncryptedClickHelper(store, dom, armoredMessage, recipients) {
|
static domControlEncryptedClickHelper(store, dom, armoredMessage, recipients) {
|
||||||
return function() {
|
return function() {
|
||||||
let message = null;
|
let message = null;
|
||||||
const $this = $(this); // eslint-disable-line no-invalid-this
|
const $this = jQuery(this); // eslint-disable-line no-invalid-this
|
||||||
|
|
||||||
if ($this.hasClass('success')) {
|
if ($this.hasClass('success')) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -248,7 +247,7 @@ class PgpUserStore {
|
||||||
try {
|
try {
|
||||||
message = store.openpgp.message.readArmored(armoredMessage);
|
message = store.openpgp.message.readArmored(armoredMessage);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message && message.getText && message.verify && message.decrypt) {
|
if (message && message.getText && message.verify && message.decrypt) {
|
||||||
|
|
@ -300,7 +299,7 @@ class PgpUserStore {
|
||||||
static domControlSignedClickHelper(store, dom, armoredMessage) {
|
static domControlSignedClickHelper(store, dom, armoredMessage) {
|
||||||
return function() {
|
return function() {
|
||||||
let message = null;
|
let message = null;
|
||||||
const $this = $(this); // eslint-disable-line no-invalid-this
|
const $this = jQuery(this); // eslint-disable-line no-invalid-this
|
||||||
|
|
||||||
if ($this.hasClass('success') || $this.hasClass('error')) {
|
if ($this.hasClass('success') || $this.hasClass('error')) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -309,7 +308,7 @@ class PgpUserStore {
|
||||||
try {
|
try {
|
||||||
message = store.openpgp.cleartext.readArmored(armoredMessage);
|
message = store.openpgp.cleartext.readArmored(armoredMessage);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message && message.getText && message.verify) {
|
if (message && message.getText && message.verify) {
|
||||||
|
|
@ -366,11 +365,11 @@ class PgpUserStore {
|
||||||
dom.data('openpgp-original', domText);
|
dom.data('openpgp-original', domText);
|
||||||
|
|
||||||
if (encrypted) {
|
if (encrypted) {
|
||||||
verControl = $('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
|
verControl = jQuery('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
|
||||||
.attr('title', i18n('MESSAGE/PGP_ENCRYPTED_MESSAGE_DESC'))
|
.attr('title', i18n('MESSAGE/PGP_ENCRYPTED_MESSAGE_DESC'))
|
||||||
.on('click', PgpUserStore.domControlEncryptedClickHelper(this, dom, domText, recipients));
|
.on('click', PgpUserStore.domControlEncryptedClickHelper(this, dom, domText, recipients));
|
||||||
} else if (signed) {
|
} else if (signed) {
|
||||||
verControl = $('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
|
verControl = jQuery('<div class="b-openpgp-control"><i class="icon-lock"></i></div>')
|
||||||
.attr('title', i18n('MESSAGE/PGP_SIGNED_MESSAGE_DESC'))
|
.attr('title', i18n('MESSAGE/PGP_SIGNED_MESSAGE_DESC'))
|
||||||
.on('click', PgpUserStore.domControlSignedClickHelper(this, dom, domText));
|
.on('click', PgpUserStore.domControlSignedClickHelper(this, dom, domText));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Magics } from 'Common/Enums';
|
import { Magics } from 'Common/Enums';
|
||||||
|
|
@ -12,7 +11,7 @@ class QuotaUserStore {
|
||||||
const quota = this.quota(),
|
const quota = this.quota(),
|
||||||
usage = this.usage();
|
usage = this.usage();
|
||||||
|
|
||||||
return 0 < quota ? window.Math.ceil((usage / quota) * 100) : 0;
|
return 0 < quota ? Math.ceil((usage / quota) * 100) : 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
||||||
|
|
@ -67,9 +66,9 @@ class SettingsUserStore {
|
||||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||||
|
|
||||||
Events.sub('rl.auto-logout-refresh', () => {
|
Events.sub('rl.auto-logout-refresh', () => {
|
||||||
window.clearTimeout(this.iAutoLogoutTimer);
|
clearTimeout(this.iAutoLogoutTimer);
|
||||||
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
|
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
|
||||||
this.iAutoLogoutTimer = window.setTimeout(() => {
|
this.iAutoLogoutTimer = setTimeout(() => {
|
||||||
Events.pub('rl.auto-logout');
|
Events.pub('rl.auto-logout');
|
||||||
}, this.autoLogout() * Magics.Time1m);
|
}, this.autoLogout() * Magics.Time1m);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import $ from '$';
|
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { leftPanelDisabled } from 'Common/Globals';
|
import { leftPanelDisabled } from 'Common/Globals';
|
||||||
import { KeyState } from 'Common/Enums';
|
import { KeyState } from 'Common/Enums';
|
||||||
|
|
||||||
|
|
@ -29,7 +26,7 @@ class MenuSettingsAdminView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
key('up, down', KeyState.Settings, settingsMenuKeysHandler($('.b-admin-menu .e-item', dom)));
|
key('up, down', KeyState.Settings, settingsMenuKeysHandler(jQuery('.b-admin-menu .e-item', dom)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { delegateRun, log } from 'Common/Utils';
|
import { delegateRun } from 'Common/Utils';
|
||||||
|
|
||||||
import PgpStore from 'Stores/User/Pgp';
|
import PgpStore from 'Stores/User/Pgp';
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.key.error(true);
|
this.key.error(true);
|
||||||
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
|
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
|
||||||
log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { KeyState } from 'Common/Enums';
|
import { KeyState } from 'Common/Enums';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
import Jua from 'Jua';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Capa,
|
Capa,
|
||||||
|
|
@ -943,7 +940,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
sSubject = message.subject();
|
sSubject = message.subject();
|
||||||
aDraftInfo = message.aDraftInfo;
|
aDraftInfo = message.aDraftInfo;
|
||||||
|
|
||||||
const clonedText = $(message.body).clone();
|
const clonedText = jQuery(message.body).clone();
|
||||||
if (clonedText) {
|
if (clonedText) {
|
||||||
clearBqSwitcher(clonedText);
|
clearBqSwitcher(clonedText);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { pString, log, defautOptionsAfterRender } from 'Common/Utils';
|
import { pString, defautOptionsAfterRender } from 'Common/Utils';
|
||||||
|
|
||||||
import { Magics, KeyState } from 'Common/Enums';
|
import { Magics, KeyState } from 'Common/Enums';
|
||||||
import { i18n } from 'Common/Translator';
|
import { i18n } from 'Common/Translator';
|
||||||
|
|
@ -103,7 +101,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
this.defautOptionsAfterRender(domOption, item);
|
this.defautOptionsAfterRender(domOption, item);
|
||||||
|
|
||||||
if (item && undefined !== item.class && domOption) {
|
if (item && undefined !== item.class && domOption) {
|
||||||
$(domOption).addClass(item.class);
|
jQuery(domOption).addClass(item.class);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -203,7 +201,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
|
|
||||||
this.notification(
|
this.notification(
|
||||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
import Jua from 'Jua';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SaveSettingsStep,
|
SaveSettingsStep,
|
||||||
|
|
@ -80,7 +76,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
|
|
||||||
this.contactsPage = ko.observable(1);
|
this.contactsPage = ko.observable(1);
|
||||||
this.contactsPageCount = ko.computed(() => {
|
this.contactsPageCount = ko.computed(() => {
|
||||||
const iPage = window.Math.ceil(this.contactsCount() / CONTACTS_PER_PAGE);
|
const iPage = Math.ceil(this.contactsCount() / CONTACTS_PER_PAGE);
|
||||||
return 0 >= iPage ? 1 : iPage;
|
return 0 >= iPage ? 1 : iPage;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -349,7 +345,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
syncCommand() {
|
syncCommand() {
|
||||||
getApp().contactsSync((result, data) => {
|
getApp().contactsSync((result, data) => {
|
||||||
if (StorageResultType.Success !== result || !data || !data.Result) {
|
if (StorageResultType.Success !== result || !data || !data.Result) {
|
||||||
window.alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
|
alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.reloadContactList(true);
|
this.reloadContactList(true);
|
||||||
|
|
@ -441,7 +437,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
this.contacts.importing(false);
|
this.contacts.importing(false);
|
||||||
this.reloadContactList();
|
this.reloadContactList();
|
||||||
if (!id || !result || !data || !data.Result) {
|
if (!id || !result || !data || !data.Result) {
|
||||||
window.alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -618,7 +614,7 @@ class ContactsPopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
this.oContentVisible = $('.b-list-content', dom);
|
this.oContentVisible = jQuery('.b-list-content', dom);
|
||||||
|
|
||||||
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.ContactList);
|
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.ContactList);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { KeyState, Magics } from 'Common/Enums';
|
import { KeyState, Magics } from 'Common/Enums';
|
||||||
|
|
||||||
import { popup } from 'Knoin/Knoin';
|
import { popup } from 'Knoin/Knoin';
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
import $ from '$';
|
|
||||||
|
|
||||||
import { pString, log } from 'Common/Utils';
|
import { pString } from 'Common/Utils';
|
||||||
import { KeyState, Magics } from 'Common/Enums';
|
import { KeyState, Magics } from 'Common/Enums';
|
||||||
|
|
||||||
import { popup, command } from 'Knoin/Knoin';
|
import { popup, command } from 'Knoin/Knoin';
|
||||||
|
|
@ -47,19 +45,19 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
|
||||||
if (privateKey) {
|
if (privateKey) {
|
||||||
try {
|
try {
|
||||||
if (!privateKey.decrypt(pString(this.password()))) {
|
if (!privateKey.decrypt(pString(this.password()))) {
|
||||||
log('Error: Private key cannot be decrypted');
|
console.log('Error: Private key cannot be decrypted');
|
||||||
privateKey = null;
|
privateKey = null;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
privateKey = null;
|
privateKey = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log('Error: Private key cannot be found');
|
console.log('Error: Private key cannot be found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
privateKey = null;
|
privateKey = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,7 +107,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext {
|
||||||
.addClass('icon-radio-unchecked')
|
.addClass('icon-radio-unchecked')
|
||||||
.removeClass('icon-radio-checked');
|
.removeClass('icon-radio-checked');
|
||||||
|
|
||||||
$(this)
|
jQuery(this)
|
||||||
.find('.key-list__item__radio') // eslint-disable-line no-invalid-this
|
.find('.key-list__item__radio') // eslint-disable-line no-invalid-this
|
||||||
.removeClass('icon-radio-unchecked')
|
.removeClass('icon-radio-unchecked')
|
||||||
.addClass('icon-radio-checked');
|
.addClass('icon-radio-checked');
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Magics } from 'Common/Enums';
|
import { Magics } from 'Common/Enums';
|
||||||
import { log, delegateRun, pInt } from 'Common/Utils';
|
import { delegateRun, pInt } from 'Common/Utils';
|
||||||
|
|
||||||
import PgpStore from 'Stores/User/Pgp';
|
import PgpStore from 'Stores/User/Pgp';
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
showError(e) {
|
showError(e) {
|
||||||
log(e);
|
console.log(e);
|
||||||
if (e && e.message) {
|
if (e && e.message) {
|
||||||
this.submitError(e.message);
|
this.submitError(e.message);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
|
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
|
||||||
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
|
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import window from 'window';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import { Capa, StorageResultType } from 'Common/Enums';
|
import { Capa, StorageResultType } from 'Common/Enums';
|
||||||
|
|
@ -137,18 +136,18 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
if (this.lock()) {
|
if (this.lock()) {
|
||||||
window.location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getQr() {
|
getQr() {
|
||||||
return (
|
return (
|
||||||
'otpauth://totp/' +
|
'otpauth://totp/' +
|
||||||
window.encodeURIComponent(this.viewUser()) +
|
encodeURIComponent(this.viewUser()) +
|
||||||
'?secret=' +
|
'?secret=' +
|
||||||
window.encodeURIComponent(this.viewSecret()) +
|
encodeURIComponent(this.viewSecret()) +
|
||||||
'&issuer=' +
|
'&issuer=' +
|
||||||
window.encodeURIComponent('')
|
encodeURIComponent('')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +165,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
||||||
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
|
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
|
||||||
|
|
||||||
this.viewUrlTitle(pString(oData.Result.UrlTitle));
|
this.viewUrlTitle(pString(oData.Result.UrlTitle));
|
||||||
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
|
this.viewUrl(qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
|
||||||
} else {
|
} else {
|
||||||
this.viewUser('');
|
this.viewUser('');
|
||||||
this.viewEnable_(false);
|
this.viewEnable_(false);
|
||||||
|
|
@ -186,7 +185,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
||||||
if (StorageResultType.Success === result && data && data.Result) {
|
if (StorageResultType.Success === result && data && data.Result) {
|
||||||
this.viewSecret(pString(data.Result.Secret));
|
this.viewSecret(pString(data.Result.Secret));
|
||||||
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
||||||
this.viewUrl(window.qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
this.viewUrl(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
||||||
} else {
|
} else {
|
||||||
this.viewSecret('');
|
this.viewSecret('');
|
||||||
this.viewUrlTitle('');
|
this.viewUrlTitle('');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { KeyState } from 'Common/Enums';
|
import { KeyState } from 'Common/Enums';
|
||||||
import { selectElement } from 'Common/Utils';
|
import { selectElement } from 'Common/Utils';
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import AppStore from 'Stores/User/App';
|
import AppStore from 'Stores/User/App';
|
||||||
import AccountStore from 'Stores/User/Account';
|
import AccountStore from 'Stores/User/Account';
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { isNormal, windowResize } from 'Common/Utils';
|
import { isNormal, windowResize } from 'Common/Utils';
|
||||||
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
|
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
|
||||||
|
|
@ -21,6 +18,8 @@ import { getApp } from 'Helper/Apps/User';
|
||||||
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||||
|
|
||||||
|
const $ = jQuery;
|
||||||
|
|
||||||
@view({
|
@view({
|
||||||
name: 'View/User/MailBox/FolderList',
|
name: 'View/User/MailBox/FolderList',
|
||||||
type: ViewType.Left,
|
type: ViewType.Left,
|
||||||
|
|
@ -194,9 +193,9 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
messagesDropOver(folder) {
|
messagesDropOver(folder) {
|
||||||
window.clearTimeout(this.iDropOverTimer);
|
clearTimeout(this.iDropOverTimer);
|
||||||
if (folder && folder.collapsed()) {
|
if (folder && folder.collapsed()) {
|
||||||
this.iDropOverTimer = window.setTimeout(() => {
|
this.iDropOverTimer = setTimeout(() => {
|
||||||
folder.collapsed(false);
|
folder.collapsed(false);
|
||||||
getApp().setExpandedFolder(folder.fullNameHash, true);
|
getApp().setExpandedFolder(folder.fullNameHash, true);
|
||||||
windowResize();
|
windowResize();
|
||||||
|
|
@ -205,7 +204,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
messagesDropOut() {
|
messagesDropOut() {
|
||||||
window.clearTimeout(this.iDropOverTimer);
|
clearTimeout(this.iDropOverTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollToFocused() {
|
scrollToFocused() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,4 @@
|
||||||
import window from 'window';
|
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
import Jua from 'Jua';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Capa,
|
Capa,
|
||||||
|
|
@ -400,7 +396,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.clearTimeout(this.iGoToUpUpOrDownDownTimeout);
|
clearTimeout(this.iGoToUpUpOrDownDownTimeout);
|
||||||
this.iGoToUpUpOrDownDownTimeout = setTimeout(() => {
|
this.iGoToUpUpOrDownDownTimeout = setTimeout(() => {
|
||||||
let prev = null,
|
let prev = null,
|
||||||
next = null,
|
next = null,
|
||||||
|
|
@ -739,7 +735,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
||||||
onBuild(dom) {
|
onBuild(dom) {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
this.oContentVisible = $('.b-content', dom);
|
this.oContentVisible = jQuery('.b-content', dom);
|
||||||
|
|
||||||
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.MessageList);
|
this.selector.init(this.oContentVisible, this.oContentVisible, KeyState.MessageList);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import $ from '$';
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { DATA_IMAGE_USER_DOT_PIC, UNUSED_OPTION_VALUE } from 'Common/Consts';
|
import { DATA_IMAGE_USER_DOT_PIC, UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||||
|
|
||||||
|
|
@ -450,7 +448,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
// aTo = [],
|
// aTo = [],
|
||||||
// EmailModel = require('Model/Email').default,
|
// EmailModel = require('Model/Email').default,
|
||||||
// fParseEmailLine = function(sLine) {
|
// fParseEmailLine = function(sLine) {
|
||||||
// return sLine ? [window.decodeURIComponent(sLine)].map(sItem => {
|
// return sLine ? [decodeURIComponent(sLine)].map(sItem => {
|
||||||
// var oEmailModel = new EmailModel();
|
// var oEmailModel = new EmailModel();
|
||||||
// oEmailModel.parse(sItem);
|
// oEmailModel.parse(sItem);
|
||||||
// return oEmailModel.email ? oEmailModel : null;
|
// return oEmailModel.email ? oEmailModel : null;
|
||||||
|
|
@ -473,7 +471,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
let index = 0,
|
let index = 0,
|
||||||
listIndex = 0;
|
listIndex = 0;
|
||||||
|
|
||||||
const div = $('<div>'),
|
const div = jQuery('<div>'),
|
||||||
dynamicEls = this.message().attachments().map(item => {
|
dynamicEls = this.message().attachments().map(item => {
|
||||||
if (item && !item.isLinked && item.isImage()) {
|
if (item && !item.isLinked && item.isImage()) {
|
||||||
if (item === attachment) {
|
if (item === attachment) {
|
||||||
|
|
@ -561,7 +559,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
|
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.oHeaderDom = $('.messageItemHeader', dom);
|
this.oHeaderDom = jQuery('.messageItemHeader', dom);
|
||||||
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
|
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
|
||||||
|
|
||||||
if (this.mobile) {
|
if (this.mobile) {
|
||||||
|
|
@ -578,7 +576,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
||||||
!!event &&
|
!!event &&
|
||||||
Magics.EventWhichMouseMiddle !== event.which &&
|
Magics.EventWhichMouseMiddle !== event.which &&
|
||||||
mailToHelper(
|
mailToHelper(
|
||||||
$(this).attr('href'),
|
jQuery(this).attr('href'),
|
||||||
Settings.capa(Capa.Composer) ? require('View/Popup/Compose') : null // eslint-disable-line no-invalid-this
|
Settings.capa(Capa.Composer) ? require('View/Popup/Compose') : null // eslint-disable-line no-invalid-this
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import $ from '$';
|
|
||||||
import key from 'key';
|
|
||||||
|
|
||||||
import { KeyState } from 'Common/Enums';
|
import { KeyState } from 'Common/Enums';
|
||||||
import { leftPanelDisabled } from 'Common/Globals';
|
import { leftPanelDisabled } from 'Common/Globals';
|
||||||
import { settings, inbox } from 'Common/Links';
|
import { settings, inbox } from 'Common/Links';
|
||||||
|
|
@ -37,7 +34,7 @@ class MenuSettingsUserView extends AbstractViewNext {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
key('up, down', KeyState.Settings, settingsMenuKeysHandler($('.b-settings-menu .e-item', dom)));
|
key('up, down', KeyState.Settings, settingsMenuKeysHandler(jQuery('.b-settings-menu .e-item', dom)));
|
||||||
}
|
}
|
||||||
|
|
||||||
link(route) {
|
link(route) {
|
||||||
|
|
|
||||||
202
dev/boot.js
202
dev/boot.js
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint-env browser */
|
import { getHash, setHash, clearHash } from 'Storage/RainLoop';
|
||||||
|
|
||||||
(win => {
|
(win => {
|
||||||
|
|
||||||
|
|
@ -38,10 +38,204 @@ win.progressJs = new class {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
require('Common/Booter');
|
let RL_APP_DATA_STORAGE = null;
|
||||||
|
|
||||||
if (win.__runBoot) {
|
win.__rlah_set = () => setHash();
|
||||||
win.__runBoot();
|
win.__rlah_clear = () => clearHash();
|
||||||
|
win.__rlah_data = () => RL_APP_DATA_STORAGE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function showError() {
|
||||||
|
const oR = doc.getElementById('rl-loading'),
|
||||||
|
oL = doc.getElementById('rl-loading-error');
|
||||||
|
|
||||||
|
if (oR) {
|
||||||
|
oR.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oL) {
|
||||||
|
oL.style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (win.progressJs) {
|
||||||
|
progressJs.set(100).end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {boolean} withError
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
function runMainBoot(withError) {
|
||||||
|
if (win.__APP_BOOT && !withError) {
|
||||||
|
win.__APP_BOOT(() => showError());
|
||||||
|
} else {
|
||||||
|
showError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeCSS(css) {
|
||||||
|
const style = doc.createElement('style');
|
||||||
|
style.type = 'text/css';
|
||||||
|
style.textContent = css;
|
||||||
|
// style.appendChild(doc.createTextNode(styles));
|
||||||
|
doc.head.appendChild(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadScript(src) {
|
||||||
|
if (!src) {
|
||||||
|
throw new Error('src should not be empty.');
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const script = doc.createElement('script');
|
||||||
|
script.onload = () => resolve();
|
||||||
|
script.onerror = () => reject(new Error(src));
|
||||||
|
script.src = src;
|
||||||
|
// script.type = 'text/javascript';
|
||||||
|
doc.head.appendChild(script);
|
||||||
|
// doc.body.appendChild(element);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {mixed} data
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
win.__initAppData = data => {
|
||||||
|
RL_APP_DATA_STORAGE = data;
|
||||||
|
|
||||||
|
win.__rlah_set();
|
||||||
|
|
||||||
|
if (RL_APP_DATA_STORAGE) {
|
||||||
|
const css = RL_APP_DATA_STORAGE.IncludeCss,
|
||||||
|
theme = RL_APP_DATA_STORAGE.NewThemeLink,
|
||||||
|
description= RL_APP_DATA_STORAGE.LoadingDescriptionEsc || '',
|
||||||
|
oE = doc.getElementById('rl-loading'),
|
||||||
|
oElDesc = doc.getElementById('rl-loading-desc');
|
||||||
|
|
||||||
|
if (theme) {
|
||||||
|
(doc.getElementById('app-theme-link') || {}).href = theme;
|
||||||
|
}
|
||||||
|
|
||||||
|
css && writeCSS(css);
|
||||||
|
|
||||||
|
if (oElDesc && description) {
|
||||||
|
oElDesc.innerHTML = description;
|
||||||
|
}
|
||||||
|
if (oE && oE.style) {
|
||||||
|
oE.style.opacity = 0;
|
||||||
|
setTimeout(() => oE.style.opacity = 1, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const appData = win.__rlah_data(), p = progressJs;
|
||||||
|
|
||||||
|
if (
|
||||||
|
p &&
|
||||||
|
appData &&
|
||||||
|
appData.TemplatesLink &&
|
||||||
|
appData.LangLink &&
|
||||||
|
appData.StaticLibJsLink &&
|
||||||
|
appData.StaticAppJsLink &&
|
||||||
|
appData.StaticEditorJsLink
|
||||||
|
) {
|
||||||
|
p.set(5);
|
||||||
|
|
||||||
|
const libs = () =>
|
||||||
|
loadScript(appData.StaticLibJsLink).then(() => {
|
||||||
|
doc.getElementById('rl-check').remove();
|
||||||
|
if (appData.IncludeBackground) {
|
||||||
|
const img = appData.IncludeBackground.replace('{{USER}}', getHash() || '0');
|
||||||
|
if (img) {
|
||||||
|
doc.documentElement.classList.add('UserBackground');
|
||||||
|
doc.body.style.backgroundImage = "url("+img+")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
libs()
|
||||||
|
.then(() => {
|
||||||
|
p.set(20);
|
||||||
|
return Promise.all([loadScript(appData.TemplatesLink), loadScript(appData.LangLink)]);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
p.set(30);
|
||||||
|
return loadScript(appData.StaticAppJsLink);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
p.set(50);
|
||||||
|
return appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve();
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
p.set(70);
|
||||||
|
runMainBoot(false);
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
runMainBoot(true);
|
||||||
|
throw e;
|
||||||
|
})
|
||||||
|
.then(() => loadScript(appData.StaticEditorJsLink))
|
||||||
|
.then(() => {
|
||||||
|
if (win.CKEDITOR && win.__initEditor) {
|
||||||
|
win.__initEditor();
|
||||||
|
win.__initEditor = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
runMainBoot(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const app = doc.getElementById('rl-app');
|
||||||
|
|
||||||
|
if (!navigator || !navigator.cookieEnabled) {
|
||||||
|
doc.location.replace('./?/NoCookie');
|
||||||
|
}
|
||||||
|
|
||||||
|
// require('Styles/@Boot.css');
|
||||||
|
writeCSS('#rl-content{display:none;}.internal-hiddden{display:none !important;}');
|
||||||
|
|
||||||
|
if (app) {
|
||||||
|
const
|
||||||
|
meta = doc.getElementById('app-boot-data'),
|
||||||
|
options = meta ? JSON.parse(meta.getAttribute('content')) || {} : {};
|
||||||
|
|
||||||
|
// require('Html/Layout.html')
|
||||||
|
app.innerHTML = '<div id="rl-loading" class="thm-loading" style="opacity:0">\
|
||||||
|
<div id="rl-loading-desc"></div>\
|
||||||
|
<div class="e-spinner">\
|
||||||
|
<div class="e-bounce bounce1"></div>\
|
||||||
|
<div class="e-bounce bounce2"></div>\
|
||||||
|
<div class="e-bounce bounce3"></div>\
|
||||||
|
</div>\
|
||||||
|
</div>\
|
||||||
|
<div id="rl-loading-error" class="thm-loading">\
|
||||||
|
An error occurred. <br /> Please refresh the page and try again.\
|
||||||
|
</div>\
|
||||||
|
<div id="rl-content">\
|
||||||
|
<div id="rl-popups"></div>\
|
||||||
|
<div id="rl-center">\
|
||||||
|
<div id="rl-top"></div>\
|
||||||
|
<div id="rl-left"></div>\
|
||||||
|
<div id="rl-right"></div>\
|
||||||
|
<div id="rl-bottom"></div>\
|
||||||
|
</div>\
|
||||||
|
</div>\
|
||||||
|
<div id="rl-templates"></div>\
|
||||||
|
<div id="rl-hidden"></div>'.replace(/[\r\n\t]+/g, '');
|
||||||
|
|
||||||
|
loadScript('./?/'
|
||||||
|
+ (options.admin ? 'Admin' : '')
|
||||||
|
+ 'AppData@'
|
||||||
|
+ (options.mobile ? 'mobile' : 'no-mobile')
|
||||||
|
+ (options.mobileDevice ? '-1' : '-0')
|
||||||
|
+ '/'
|
||||||
|
+ (getHash() || '0')
|
||||||
|
+ '/'
|
||||||
|
+ Math.random().toString().substr(2)
|
||||||
|
+ '/').then(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
})(window);
|
})(window);
|
||||||
|
|
|
||||||
26
dev/bootstrap.js
vendored
26
dev/bootstrap.js
vendored
|
|
@ -1,5 +1,4 @@
|
||||||
import window from 'window';
|
import { detectDropdownVisibility } from 'Common/Utils';
|
||||||
import { detectDropdownVisibility, createCommandLegacy, domReady } from 'Common/Utils';
|
|
||||||
import { $html, $htmlCL, data as GlobalsData, bMobileDevice } from 'Common/Globals';
|
import { $html, $htmlCL, data as GlobalsData, bMobileDevice } from 'Common/Globals';
|
||||||
import * as Enums from 'Common/Enums';
|
import * as Enums from 'Common/Enums';
|
||||||
import * as Plugins from 'Common/Plugins';
|
import * as Plugins from 'Common/Plugins';
|
||||||
|
|
@ -9,7 +8,7 @@ import { EmailModel } from 'Model/Email';
|
||||||
export default (App) => {
|
export default (App) => {
|
||||||
GlobalsData.__APP__ = App;
|
GlobalsData.__APP__ = App;
|
||||||
|
|
||||||
window.addEventListener('keydown', event => {
|
addEventListener('keydown', event => {
|
||||||
event = event || window.event;
|
event = event || window.event;
|
||||||
if (event && event.ctrlKey && !event.shiftKey && !event.altKey) {
|
if (event && event.ctrlKey && !event.shiftKey && !event.altKey) {
|
||||||
const key = event.keyCode || event.which;
|
const key = event.keyCode || event.which;
|
||||||
|
|
@ -25,17 +24,13 @@ export default (App) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.getSelection) {
|
getSelection().removeAllRanges();
|
||||||
window.getSelection().removeAllRanges();
|
|
||||||
} else if (window.document.selection && window.document.selection.clear) {
|
|
||||||
window.document.selection.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.addEventListener('unload', () => {
|
addEventListener('unload', () => {
|
||||||
GlobalsData.bUnload = true;
|
GlobalsData.bUnload = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -45,7 +40,6 @@ export default (App) => {
|
||||||
const rl = window.rl || {};
|
const rl = window.rl || {};
|
||||||
|
|
||||||
rl.i18n = i18n;
|
rl.i18n = i18n;
|
||||||
rl.createCommand = createCommandLegacy;
|
|
||||||
|
|
||||||
rl.addSettingsViewModel = Plugins.addSettingsViewModel;
|
rl.addSettingsViewModel = Plugins.addSettingsViewModel;
|
||||||
rl.addSettingsViewModelForAdmin = Plugins.addSettingsViewModelForAdmin;
|
rl.addSettingsViewModelForAdmin = Plugins.addSettingsViewModelForAdmin;
|
||||||
|
|
@ -61,7 +55,7 @@ export default (App) => {
|
||||||
window.rl = rl;
|
window.rl = rl;
|
||||||
|
|
||||||
const start = () => {
|
const start = () => {
|
||||||
window.setTimeout(() => {
|
setTimeout(() => {
|
||||||
$htmlCL.remove('no-js', 'rl-booted-trigger');
|
$htmlCL.remove('no-js', 'rl-booted-trigger');
|
||||||
$htmlCL.add('rl-booted');
|
$htmlCL.add('rl-booted');
|
||||||
|
|
||||||
|
|
@ -69,11 +63,11 @@ export default (App) => {
|
||||||
}, Enums.Magics.Time10ms);
|
}, Enums.Magics.Time10ms);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.__APP_BOOT = (fErrorCallback) => {
|
window.__APP_BOOT = fErrorCallback => {
|
||||||
domReady(() => {
|
jQuery(() => {
|
||||||
window.setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (window.rainloopTEMPLATES && window.rainloopTEMPLATES[0]) {
|
if (window.rainloopTEMPLATES && rainloopTEMPLATES[0]) {
|
||||||
window.document.getElementById('rl-templates').innerHTML = window.rainloopTEMPLATES[0];
|
document.getElementById('rl-templates').innerHTML = rainloopTEMPLATES[0];
|
||||||
start();
|
start();
|
||||||
} else {
|
} else {
|
||||||
fErrorCallback();
|
fErrorCallback();
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,11 @@ if ($return_var) {
|
||||||
exit("gulp failed with error code {$return_var}\n");
|
exit("gulp failed with error code {$return_var}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($gzip = trim(`which gzip`)) {
|
||||||
|
// passthru("{$gzip} -k --best -r ".escapeshellarg(__DIR__ . '/rainloop/v/0.0.0/static/js/*'), $return_var);
|
||||||
|
// passthru("{$gzip} -k --best -r ".escapeshellarg(__DIR__ . '/rainloop/v/0.0.0/static/css/*'), $return_var);
|
||||||
|
}
|
||||||
|
|
||||||
// Temporary rename folder to speed up PharData
|
// Temporary rename folder to speed up PharData
|
||||||
if (!rename('rainloop/v/0.0.0', "rainloop/v/{$package->version}")){
|
if (!rename('rainloop/v/0.0.0', "rainloop/v/{$package->version}")){
|
||||||
exit('Failed to temporary rename rainloop/v/0.0.0');
|
exit('Failed to temporary rename rainloop/v/0.0.0');
|
||||||
|
|
@ -67,6 +72,9 @@ $index = str_replace('source', 'community', $index);
|
||||||
$zip->addFromString('index.php', $index);
|
$zip->addFromString('index.php', $index);
|
||||||
$tar->addFromString('index.php', $index);
|
$tar->addFromString('index.php', $index);
|
||||||
|
|
||||||
|
$zip->addFile('README.md');
|
||||||
|
$tar->addFile('README.md');
|
||||||
|
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|
||||||
$tar->compress(Phar::GZ);
|
$tar->compress(Phar::GZ);
|
||||||
|
|
|
||||||
461
vendors/bootstrap/js/bootstrap.js
vendored
461
vendors/bootstrap/js/bootstrap.js
vendored
|
|
@ -1,6 +1,8 @@
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
* bootstrap-dropdown.js v2.3.2
|
* bootstrap-dropdown.js v2.3.2
|
||||||
* http://getbootstrap.com/2.3.2/javascript.html#dropdowns
|
* bootstrap-modal.js v2.3.2
|
||||||
|
* bootstrap-tab.js v2.3.2
|
||||||
|
* http://getbootstrap.com/2.3.2/javascript.html
|
||||||
* ============================================================
|
* ============================================================
|
||||||
* Copyright 2013 Twitter, Inc.
|
* Copyright 2013 Twitter, Inc.
|
||||||
*
|
*
|
||||||
|
|
@ -17,28 +19,25 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
|
|
||||||
|
($ => {
|
||||||
!function ($) {
|
|
||||||
|
|
||||||
"use strict"; // jshint ;_;
|
"use strict"; // jshint ;_;
|
||||||
|
|
||||||
|
const doc = document;
|
||||||
|
|
||||||
/* DROPDOWN CLASS DEFINITION
|
/* DROPDOWN CLASS DEFINITION
|
||||||
* ========================= */
|
* ========================= */
|
||||||
|
|
||||||
var toggle = '[data-toggle=dropdown]'
|
var toggle = '[data-toggle=dropdown]';
|
||||||
, Dropdown = function (element) {
|
|
||||||
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
|
||||||
$('html').on('click.dropdown.data-api', function () {
|
|
||||||
$el.parent().removeClass('open')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
Dropdown.prototype = {
|
class Dropdown {
|
||||||
|
|
||||||
constructor: Dropdown
|
constructor (element) {
|
||||||
|
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
||||||
|
$('html').on('click.dropdown.data-api', () => $el.parent().removeClass('open'))
|
||||||
|
}
|
||||||
|
|
||||||
, toggle: function (e) {
|
toggle () {
|
||||||
var $this = $(this)
|
var $this = $(this)
|
||||||
, $parent
|
, $parent
|
||||||
, isActive
|
, isActive
|
||||||
|
|
@ -52,7 +51,7 @@
|
||||||
clearMenus()
|
clearMenus()
|
||||||
|
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
if ('ontouchstart' in document.documentElement) {
|
if ('ontouchstart' in doc.documentElement) {
|
||||||
// if mobile we we use a backdrop because click events don't delegate
|
// if mobile we we use a backdrop because click events don't delegate
|
||||||
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
||||||
}
|
}
|
||||||
|
|
@ -64,10 +63,9 @@
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
, keydown: function (e) {
|
keydown (e) {
|
||||||
var $this
|
var $this
|
||||||
, $items
|
, $items
|
||||||
, $active
|
|
||||||
, $parent
|
, $parent
|
||||||
, isActive
|
, isActive
|
||||||
, index
|
, index
|
||||||
|
|
@ -134,8 +132,6 @@
|
||||||
/* DROPDOWN PLUGIN DEFINITION
|
/* DROPDOWN PLUGIN DEFINITION
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
var old = $.fn.dropdown
|
|
||||||
|
|
||||||
$.fn.dropdown = function (option) {
|
$.fn.dropdown = function (option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this)
|
||||||
|
|
@ -145,218 +141,182 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$.fn.dropdown.Constructor = Dropdown
|
|
||||||
|
|
||||||
|
|
||||||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||||
* =================================== */
|
* =================================== */
|
||||||
|
|
||||||
$(document)
|
$(doc)
|
||||||
.on('click.dropdown.data-api', clearMenus)
|
.on('click.dropdown.data-api', clearMenus)
|
||||||
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
.on('click.dropdown.data-api', '.dropdown form', e => e.stopPropagation())
|
||||||
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||||
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
|
|
||||||
}(window.jQuery);
|
|
||||||
/* =========================================================
|
|
||||||
* bootstrap-modal.js v2.3.2
|
|
||||||
* http://getbootstrap.com/2.3.2/javascript.html#modals
|
|
||||||
* =========================================================
|
|
||||||
* Copyright 2013 Twitter, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ========================================================= */
|
|
||||||
|
|
||||||
|
|
||||||
!function ($) {
|
|
||||||
|
|
||||||
"use strict"; // jshint ;_;
|
|
||||||
|
|
||||||
|
|
||||||
/* MODAL CLASS DEFINITION
|
/* MODAL CLASS DEFINITION
|
||||||
* ====================== */
|
* ====================== */
|
||||||
|
|
||||||
var Modal = function (element, options) {
|
class Modal {
|
||||||
this.options = options
|
|
||||||
this.$element = $(element)
|
|
||||||
.on('click.dismiss.modal', '[data-dismiss="modal"]', this.hide.bind(this))
|
|
||||||
this.options.remote && this.$element.find('.modal-body').on('load', this.options.remote)
|
|
||||||
}
|
|
||||||
|
|
||||||
Modal.prototype = {
|
constructor (element, options) {
|
||||||
|
this.options = options
|
||||||
|
this.$element = $(element)
|
||||||
|
.on('click.dismiss.modal', '[data-dismiss="modal"]', this.hide.bind(this))
|
||||||
|
this.options.remote && this.$element.find('.modal-body').on('load', this.options.remote)
|
||||||
|
}
|
||||||
|
|
||||||
constructor: Modal
|
toggle () {
|
||||||
|
return this[!this.isShown ? 'show' : 'hide']()
|
||||||
|
}
|
||||||
|
|
||||||
, toggle: function () {
|
show () {
|
||||||
return this[!this.isShown ? 'show' : 'hide']()
|
var that = this
|
||||||
}
|
, e = $.Event('show')
|
||||||
|
|
||||||
, show: function () {
|
this.$element.trigger(e)
|
||||||
var that = this
|
|
||||||
, e = $.Event('show')
|
|
||||||
|
|
||||||
this.$element.trigger(e)
|
if (this.isShown || e.isDefaultPrevented()) return
|
||||||
|
|
||||||
if (this.isShown || e.isDefaultPrevented()) return
|
this.isShown = true
|
||||||
|
|
||||||
this.isShown = true
|
this.escape()
|
||||||
|
|
||||||
this.escape()
|
this.backdrop(() => {
|
||||||
|
var transition = that.$element.hasClass('fade')
|
||||||
|
|
||||||
this.backdrop(function () {
|
if (!that.$element.parent().length) {
|
||||||
var transition = that.$element.hasClass('fade')
|
that.$element.appendTo(doc.body) //don't move modals dom position
|
||||||
|
|
||||||
if (!that.$element.parent().length) {
|
|
||||||
that.$element.appendTo(document.body) //don't move modals dom position
|
|
||||||
}
|
|
||||||
|
|
||||||
that.$element.show()
|
|
||||||
|
|
||||||
if (transition) {
|
|
||||||
that.$element[0].offsetWidth // force reflow
|
|
||||||
}
|
|
||||||
|
|
||||||
that.$element
|
|
||||||
.addClass('in')
|
|
||||||
.attr('aria-hidden', false)
|
|
||||||
|
|
||||||
that.enforceFocus()
|
|
||||||
|
|
||||||
transition ?
|
|
||||||
that.$element.one('transitionend', function () { that.$element.focus().trigger('shown') }) :
|
|
||||||
that.$element.focus().trigger('shown')
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
, hide: function (e) {
|
|
||||||
e && e.preventDefault()
|
|
||||||
|
|
||||||
var that = this
|
|
||||||
|
|
||||||
e = $.Event('hide')
|
|
||||||
|
|
||||||
this.$element.trigger(e)
|
|
||||||
|
|
||||||
if (!this.isShown || e.isDefaultPrevented()) return
|
|
||||||
|
|
||||||
this.isShown = false
|
|
||||||
|
|
||||||
this.escape()
|
|
||||||
|
|
||||||
$(document).off('focusin.modal')
|
|
||||||
|
|
||||||
this.$element
|
|
||||||
.removeClass('in')
|
|
||||||
.attr('aria-hidden', true)
|
|
||||||
|
|
||||||
this.$element.hasClass('fade') ?
|
|
||||||
this.hideWithTransition() :
|
|
||||||
this.hideModal()
|
|
||||||
}
|
|
||||||
|
|
||||||
, enforceFocus: function () {
|
|
||||||
var that = this
|
|
||||||
$(document).on('focusin.modal', function (e) {
|
|
||||||
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
|
|
||||||
that.$element.focus()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
, escape: function () {
|
|
||||||
var that = this
|
|
||||||
if (this.isShown && this.options.keyboard) {
|
|
||||||
this.$element.on('keyup.dismiss.modal', function ( e ) {
|
|
||||||
e.which == 27 && that.hide()
|
|
||||||
})
|
|
||||||
} else if (!this.isShown) {
|
|
||||||
this.$element.off('keyup.dismiss.modal')
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
, hideWithTransition: function () {
|
that.$element.show()
|
||||||
var that = this
|
|
||||||
, timeout = setTimeout(function () {
|
|
||||||
that.$element.off('transitionend')
|
|
||||||
that.hideModal()
|
|
||||||
}, 500)
|
|
||||||
|
|
||||||
this.$element.one('transitionend', function () {
|
if (transition) {
|
||||||
clearTimeout(timeout)
|
that.$element[0].offsetWidth // force reflow
|
||||||
that.hideModal()
|
}
|
||||||
|
|
||||||
|
that.$element
|
||||||
|
.addClass('in')
|
||||||
|
.attr('aria-hidden', false)
|
||||||
|
|
||||||
|
that.enforceFocus()
|
||||||
|
|
||||||
|
transition ?
|
||||||
|
that.$element.one('transitionend', function () { that.$element.focus().trigger('shown') }) :
|
||||||
|
that.$element.focus().trigger('shown')
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
hide (e) {
|
||||||
|
e && e.preventDefault()
|
||||||
|
|
||||||
|
e = $.Event('hide')
|
||||||
|
|
||||||
|
this.$element.trigger(e)
|
||||||
|
|
||||||
|
if (!this.isShown || e.isDefaultPrevented()) return
|
||||||
|
|
||||||
|
this.isShown = false
|
||||||
|
|
||||||
|
this.escape()
|
||||||
|
|
||||||
|
$(doc).off('focusin.modal')
|
||||||
|
|
||||||
|
this.$element
|
||||||
|
.removeClass('in')
|
||||||
|
.attr('aria-hidden', true)
|
||||||
|
|
||||||
|
this.$element.hasClass('fade') ?
|
||||||
|
this.hideWithTransition() :
|
||||||
|
this.hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
enforceFocus () {
|
||||||
|
var that = this
|
||||||
|
$(doc).on('focusin.modal', function (e) {
|
||||||
|
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
|
||||||
|
that.$element.focus()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
escape () {
|
||||||
|
var that = this
|
||||||
|
if (this.isShown && this.options.keyboard) {
|
||||||
|
this.$element.on('keyup.dismiss.modal', function ( e ) {
|
||||||
|
e.which == 27 && that.hide()
|
||||||
})
|
})
|
||||||
|
} else if (!this.isShown) {
|
||||||
|
this.$element.off('keyup.dismiss.modal')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
, hideModal: function () {
|
hideWithTransition () {
|
||||||
var that = this
|
var that = this
|
||||||
this.$element.hide()
|
, timeout = setTimeout(function () {
|
||||||
this.backdrop(function () {
|
that.$element.off('transitionend')
|
||||||
that.removeBackdrop()
|
that.hideModal()
|
||||||
that.$element.trigger('hidden')
|
}, 500)
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
, removeBackdrop: function () {
|
this.$element.one('transitionend', function () {
|
||||||
this.$backdrop && this.$backdrop.remove()
|
clearTimeout(timeout)
|
||||||
this.$backdrop = null
|
that.hideModal()
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
|
||||||
, backdrop: function (callback) {
|
hideModal () {
|
||||||
var that = this
|
var that = this
|
||||||
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
this.$element.hide()
|
||||||
|
this.backdrop(function () {
|
||||||
|
that.removeBackdrop()
|
||||||
|
that.$element.trigger('hidden')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isShown && this.options.backdrop) {
|
removeBackdrop () {
|
||||||
var doAnimate = animate
|
this.$backdrop && this.$backdrop.remove()
|
||||||
|
this.$backdrop = null
|
||||||
|
}
|
||||||
|
|
||||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
backdrop (callback) {
|
||||||
.appendTo(document.body)
|
var animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||||
|
|
||||||
this.$backdrop.click(
|
if (this.isShown && this.options.backdrop) {
|
||||||
this.options.backdrop == 'static' ?
|
|
||||||
this.$element[0].focus.bind(this.$element[0])
|
|
||||||
: this.hide.bind(this)
|
|
||||||
)
|
|
||||||
|
|
||||||
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||||
|
.appendTo(doc.body)
|
||||||
|
|
||||||
this.$backdrop.addClass('in')
|
this.$backdrop.click(
|
||||||
|
this.options.backdrop == 'static' ?
|
||||||
|
this.$element[0].focus.bind(this.$element[0])
|
||||||
|
: this.hide.bind(this)
|
||||||
|
)
|
||||||
|
|
||||||
if (!callback) return
|
if (animate) this.$backdrop[0].offsetWidth // force reflow
|
||||||
|
|
||||||
doAnimate ?
|
this.$backdrop.addClass('in')
|
||||||
this.$backdrop.one('transitionend', callback) :
|
|
||||||
callback()
|
|
||||||
|
|
||||||
} else if (!this.isShown && this.$backdrop) {
|
if (!callback) return
|
||||||
this.$backdrop.removeClass('in')
|
|
||||||
|
|
||||||
this.$element.hasClass('fade')?
|
animate ?
|
||||||
this.$backdrop.one('transitionend', callback) :
|
this.$backdrop.one('transitionend', callback) :
|
||||||
callback()
|
|
||||||
|
|
||||||
} else if (callback) {
|
|
||||||
callback()
|
callback()
|
||||||
}
|
|
||||||
|
} else if (!this.isShown && this.$backdrop) {
|
||||||
|
this.$backdrop.removeClass('in')
|
||||||
|
|
||||||
|
this.$element.hasClass('fade')?
|
||||||
|
this.$backdrop.one('transitionend', callback) :
|
||||||
|
callback()
|
||||||
|
|
||||||
|
} else if (callback) {
|
||||||
|
callback()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* MODAL PLUGIN DEFINITION
|
/* MODAL PLUGIN DEFINITION
|
||||||
* ======================= */
|
* ======================= */
|
||||||
|
|
||||||
var old = $.fn.modal
|
|
||||||
|
|
||||||
$.fn.modal = function (option) {
|
$.fn.modal = function (option) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this)
|
||||||
|
|
@ -374,13 +334,10 @@
|
||||||
, show: true
|
, show: true
|
||||||
}
|
}
|
||||||
|
|
||||||
$.fn.modal.Constructor = Modal
|
|
||||||
|
|
||||||
|
|
||||||
/* MODAL DATA-API
|
/* MODAL DATA-API
|
||||||
* ============== */
|
* ============== */
|
||||||
|
|
||||||
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
|
$(doc).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
|
||||||
var $this = $(this)
|
var $this = $(this)
|
||||||
, href = $this.attr('href')
|
, href = $this.attr('href')
|
||||||
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
||||||
|
|
@ -395,85 +352,14 @@
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
|
||||||
/* ========================================================
|
|
||||||
* bootstrap-tab.js v2.3.2
|
|
||||||
* http://getbootstrap.com/2.3.2/javascript.html#tabs
|
|
||||||
* ========================================================
|
|
||||||
* Copyright 2013 Twitter, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* ======================================================== */
|
|
||||||
|
|
||||||
|
|
||||||
!function ($) {
|
|
||||||
|
|
||||||
"use strict"; // jshint ;_;
|
|
||||||
|
|
||||||
|
|
||||||
/* TAB CLASS DEFINITION
|
/* TAB CLASS DEFINITION
|
||||||
* ==================== */
|
* ==================== */
|
||||||
|
|
||||||
var Tab = function (element) {
|
var activate = ( element, container, callback) => {
|
||||||
this.element = $(element)
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab.prototype = {
|
|
||||||
|
|
||||||
constructor: Tab
|
|
||||||
|
|
||||||
, show: function () {
|
|
||||||
var $this = this.element
|
|
||||||
, $ul = $this.closest('ul:not(.dropdown-menu)')
|
|
||||||
, selector = $this.attr('data-target')
|
|
||||||
, previous
|
|
||||||
, $target
|
|
||||||
, e
|
|
||||||
|
|
||||||
if (!selector) {
|
|
||||||
selector = $this.attr('href')
|
|
||||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $this.parent('li').hasClass('active') ) return
|
|
||||||
|
|
||||||
previous = $ul.find('.active:last a')[0]
|
|
||||||
|
|
||||||
e = $.Event('show', {
|
|
||||||
relatedTarget: previous
|
|
||||||
})
|
|
||||||
|
|
||||||
$this.trigger(e)
|
|
||||||
|
|
||||||
if (e.isDefaultPrevented()) return
|
|
||||||
|
|
||||||
$target = $(selector)
|
|
||||||
|
|
||||||
this.activate($this.parent('li'), $ul)
|
|
||||||
this.activate($target, $target.parent(), function () {
|
|
||||||
$this.trigger({
|
|
||||||
type: 'shown'
|
|
||||||
, relatedTarget: previous
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
, activate: function ( element, container, callback) {
|
|
||||||
var $active = container.find('> .active')
|
var $active = container.find('> .active')
|
||||||
, transition = callback
|
, transition = callback
|
||||||
&& $active.hasClass('fade')
|
&& $active.hasClass('fade')
|
||||||
|
, next = () => {
|
||||||
function next() {
|
|
||||||
$active
|
$active
|
||||||
.removeClass('active')
|
.removeClass('active')
|
||||||
.find('> .dropdown-menu > .active')
|
.find('> .dropdown-menu > .active')
|
||||||
|
|
@ -501,14 +387,54 @@
|
||||||
|
|
||||||
$active.removeClass('in')
|
$active.removeClass('in')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Tab {
|
||||||
|
|
||||||
|
constructor (element) {
|
||||||
|
this.element = $(element)
|
||||||
|
}
|
||||||
|
|
||||||
|
show () {
|
||||||
|
var $this = this.element
|
||||||
|
, $ul = $this.closest('ul:not(.dropdown-menu)')
|
||||||
|
, selector = $this.attr('data-target')
|
||||||
|
, previous
|
||||||
|
, $target
|
||||||
|
, e
|
||||||
|
|
||||||
|
if (!selector) {
|
||||||
|
selector = $this.attr('href')
|
||||||
|
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this.parent('li').hasClass('active') ) return
|
||||||
|
|
||||||
|
previous = $ul.find('.active:last a')[0]
|
||||||
|
|
||||||
|
e = $.Event('show', {
|
||||||
|
relatedTarget: previous
|
||||||
|
})
|
||||||
|
|
||||||
|
$this.trigger(e)
|
||||||
|
|
||||||
|
if (e.isDefaultPrevented()) return
|
||||||
|
|
||||||
|
$target = $(selector)
|
||||||
|
|
||||||
|
activate($this.parent('li'), $ul)
|
||||||
|
activate($target, $target.parent(), () => {
|
||||||
|
$this.trigger({
|
||||||
|
type: 'shown'
|
||||||
|
, relatedTarget: previous
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* TAB PLUGIN DEFINITION
|
/* TAB PLUGIN DEFINITION
|
||||||
* ===================== */
|
* ===================== */
|
||||||
|
|
||||||
var old = $.fn.tab
|
|
||||||
|
|
||||||
$.fn.tab = function ( option ) {
|
$.fn.tab = function ( option ) {
|
||||||
return this.each(function () {
|
return this.each(function () {
|
||||||
var $this = $(this)
|
var $this = $(this)
|
||||||
|
|
@ -518,15 +444,12 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$.fn.tab.Constructor = Tab
|
|
||||||
|
|
||||||
|
|
||||||
/* TAB DATA-API
|
/* TAB DATA-API
|
||||||
* ============ */
|
* ============ */
|
||||||
|
|
||||||
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
$(doc).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$(this).tab('show')
|
$(this).tab('show')
|
||||||
})
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
})(window.jQuery);
|
||||||
|
|
|
||||||
2
vendors/bootstrap/js/bootstrap.min.js
vendored
2
vendors/bootstrap/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
2
vendors/ckeditor/ckeditor.js
vendored
2
vendors/ckeditor/ckeditor.js
vendored
|
|
@ -56,7 +56,7 @@ fieldset:1,figcaption:1,figure:1,footer:1,form:1,header:1,hgroup:1,main:1,menu:1
|
||||||
track:1,wbr:1},$inline:b,$list:{dl:1,ol:1,ul:1},$listItem:{dd:1,dt:1,li:1},$nonBodyContent:a({body:1,head:1,html:1},d.head),$nonEditable:{applet:1,audio:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,param:1,script:1,textarea:1,video:1},$object:{applet:1,audio:1,button:1,hr:1,iframe:1,img:1,input:1,object:1,select:1,table:1,textarea:1,video:1},$removeEmpty:{abbr:1,acronym:1,b:1,bdi:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,mark:1,meter:1,output:1,q:1,ruby:1,
|
track:1,wbr:1},$inline:b,$list:{dl:1,ol:1,ul:1},$listItem:{dd:1,dt:1,li:1},$nonBodyContent:a({body:1,head:1,html:1},d.head),$nonEditable:{applet:1,audio:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,param:1,script:1,textarea:1,video:1},$object:{applet:1,audio:1,button:1,hr:1,iframe:1,img:1,input:1,object:1,select:1,table:1,textarea:1,video:1},$removeEmpty:{abbr:1,acronym:1,b:1,bdi:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,mark:1,meter:1,output:1,q:1,ruby:1,
|
||||||
s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,time:1,tt:1,u:1,"var":1},$tabIndex:{a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},$tableContent:{caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},$transparent:{a:1,audio:1,canvas:1,del:1,ins:1,map:1,noscript:1,object:1,video:1},$intermediate:{caption:1,colgroup:1,dd:1,dt:1,figcaption:1,legend:1,li:1,optgroup:1,option:1,rp:1,rt:1,summary:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1}});return d}();
|
s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,time:1,tt:1,u:1,"var":1},$tabIndex:{a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},$tableContent:{caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},$transparent:{a:1,audio:1,canvas:1,del:1,ins:1,map:1,noscript:1,object:1,video:1},$intermediate:{caption:1,colgroup:1,dd:1,dt:1,figcaption:1,legend:1,li:1,optgroup:1,option:1,rp:1,rt:1,summary:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1}});return d}();
|
||||||
CKEDITOR.dom.event=function(a){this.$=a};
|
CKEDITOR.dom.event=function(a){this.$=a};
|
||||||
CKEDITOR.dom.event.prototype={getKey:function(){return this.$.keyCode||this.$.which},getKeystroke:function(){var a=this.getKey();if(this.$.ctrlKey||this.$.metaKey)a+=CKEDITOR.CTRL;this.$.shiftKey&&(a+=CKEDITOR.SHIFT);this.$.altKey&&(a+=CKEDITOR.ALT);return a},preventDefault:function(a){var d=this.$;d.preventDefault?d.preventDefault():d.returnValue=!1;a&&this.stopPropagation()},stopPropagation:function(){var a=this.$;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},getTarget:function(){var a=
|
CKEDITOR.dom.event.prototype={getKey:function(){return this.$.keyCode||this.$.which},getKeystroke:function(){var a=this.getKey();if(this.$.ctrlKey||this.$.metaKey)a+=CKEDITOR.CTRL;this.$.shiftKey&&(a+=CKEDITOR.SHIFT);this.$.altKey&&(a+=CKEDITOR.ALT);return a},preventDefault:function(a){var d=this.$;d.preventDefault();a&&this.stopPropagation()},stopPropagation:function(){var a=this.$;a.stopPropagation()},getTarget:function(){var a=
|
||||||
this.$.target||this.$.srcElement;return a?new CKEDITOR.dom.node(a):null},getPhase:function(){return this.$.eventPhase||2},getPageOffset:function(){var a=this.getTarget().getDocument().$;return{x:this.$.pageX||this.$.clientX+(a.documentElement.scrollLeft||a.body.scrollLeft),y:this.$.pageY||this.$.clientY+(a.documentElement.scrollTop||a.body.scrollTop)}}};CKEDITOR.CTRL=1114112;CKEDITOR.SHIFT=2228224;CKEDITOR.ALT=4456448;CKEDITOR.EVENT_PHASE_CAPTURING=1;CKEDITOR.EVENT_PHASE_AT_TARGET=2;
|
this.$.target||this.$.srcElement;return a?new CKEDITOR.dom.node(a):null},getPhase:function(){return this.$.eventPhase||2},getPageOffset:function(){var a=this.getTarget().getDocument().$;return{x:this.$.pageX||this.$.clientX+(a.documentElement.scrollLeft||a.body.scrollLeft),y:this.$.pageY||this.$.clientY+(a.documentElement.scrollTop||a.body.scrollTop)}}};CKEDITOR.CTRL=1114112;CKEDITOR.SHIFT=2228224;CKEDITOR.ALT=4456448;CKEDITOR.EVENT_PHASE_CAPTURING=1;CKEDITOR.EVENT_PHASE_AT_TARGET=2;
|
||||||
CKEDITOR.EVENT_PHASE_BUBBLING=3;CKEDITOR.dom.domObject=function(a){a&&(this.$=a)};
|
CKEDITOR.EVENT_PHASE_BUBBLING=3;CKEDITOR.dom.domObject=function(a){a&&(this.$=a)};
|
||||||
CKEDITOR.dom.domObject.prototype=function(){var a=function(a,b){return function(c){"undefined"!=typeof CKEDITOR&&a.fire(b,new CKEDITOR.dom.event(c))}};return{getPrivate:function(){var a;(a=this.getCustomData("_"))||this.setCustomData("_",a={});return a},on:function(d){var b=this.getCustomData("_cke_nativeListeners");b||(b={},this.setCustomData("_cke_nativeListeners",b));b[d]||(b=b[d]=a(this,d),this.$.addEventListener?this.$.addEventListener(d,b,!!CKEDITOR.event.useCapture):this.$.attachEvent&&this.$.attachEvent("on"+
|
CKEDITOR.dom.domObject.prototype=function(){var a=function(a,b){return function(c){"undefined"!=typeof CKEDITOR&&a.fire(b,new CKEDITOR.dom.event(c))}};return{getPrivate:function(){var a;(a=this.getCustomData("_"))||this.setCustomData("_",a={});return a},on:function(d){var b=this.getCustomData("_cke_nativeListeners");b||(b={},this.setCustomData("_cke_nativeListeners",b));b[d]||(b=b[d]=a(this,d),this.$.addEventListener?this.$.addEventListener(d,b,!!CKEDITOR.event.useCapture):this.$.attachEvent&&this.$.attachEvent("on"+
|
||||||
|
|
|
||||||
617
vendors/jua/jua.js
vendored
617
vendors/jua/jua.js
vendored
|
|
@ -3,376 +3,301 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var
|
var
|
||||||
Globals = {},
|
iDefLimit = 20,
|
||||||
Utils = {},
|
|
||||||
$ = jQuery;
|
$ = jQuery;
|
||||||
|
|
||||||
Globals.iDefLimit = 20;
|
const
|
||||||
|
defined = v => undefined !== v;
|
||||||
|
|
||||||
/**
|
var Utils = {
|
||||||
* @param {*} mValue
|
/**
|
||||||
* @return {boolean}
|
* @param {*} oParent
|
||||||
*/
|
* @param {*} oDescendant
|
||||||
Utils.isUndefined = function (mValue)
|
*
|
||||||
{
|
* @return {boolean}
|
||||||
return 'undefined' === typeof mValue;
|
*/
|
||||||
};
|
contains : (oParent, oDescendant) =>
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} mObjectFirst
|
|
||||||
* @param {Object=} mObjectSecond
|
|
||||||
* @return {Object}
|
|
||||||
*/
|
|
||||||
Utils.extend = function (mObjectFirst, mObjectSecond)
|
|
||||||
{
|
|
||||||
if (mObjectSecond)
|
|
||||||
{
|
{
|
||||||
for (var sProp in mObjectSecond)
|
if (oParent && oDescendant)
|
||||||
{
|
{
|
||||||
if (mObjectSecond.hasOwnProperty(sProp))
|
if (oParent === oDescendant)
|
||||||
{
|
{
|
||||||
mObjectFirst[sProp] = mObjectSecond[sProp];
|
return true;
|
||||||
|
}
|
||||||
|
if (oParent.contains)
|
||||||
|
{
|
||||||
|
return oParent.contains(oDescendant);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mObjectFirst;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} oParent
|
|
||||||
* @param {*} oDescendant
|
|
||||||
*
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
Utils.contains = function (oParent, oDescendant)
|
|
||||||
{
|
|
||||||
var bResult = false;
|
|
||||||
if (oParent && oDescendant)
|
|
||||||
{
|
|
||||||
if (oParent === oDescendant)
|
|
||||||
{
|
|
||||||
bResult = true;
|
|
||||||
}
|
|
||||||
else if (oParent.contains)
|
|
||||||
{
|
|
||||||
bResult = oParent.contains(oDescendant);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*jshint bitwise: false*/
|
/*jshint bitwise: false*/
|
||||||
bResult = oDescendant.compareDocumentPosition ?
|
return oDescendant.compareDocumentPosition ?
|
||||||
!!(oDescendant.compareDocumentPosition(oParent) & 8) : false;
|
!!(oDescendant.compareDocumentPosition(oParent) & 8) : false;
|
||||||
/*jshint bitwise: true*/
|
/*jshint bitwise: true*/
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return bResult;
|
return false;
|
||||||
};
|
},
|
||||||
|
|
||||||
Utils.mainClearTimeout = function(iTimer)
|
mainClearTimeout : iTimer =>
|
||||||
{
|
|
||||||
if (0 < iTimer)
|
|
||||||
{
|
{
|
||||||
clearTimeout(iTimer);
|
if (0 < iTimer)
|
||||||
}
|
|
||||||
|
|
||||||
iTimer = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Event} oEvent
|
|
||||||
* @return {?Event}
|
|
||||||
*/
|
|
||||||
Utils.getEvent = function(oEvent)
|
|
||||||
{
|
|
||||||
oEvent = (oEvent && (oEvent.originalEvent ?
|
|
||||||
oEvent.originalEvent : oEvent)) || window.event;
|
|
||||||
|
|
||||||
return oEvent.dataTransfer ? oEvent : null;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} oValues
|
|
||||||
* @param {string} sKey
|
|
||||||
* @param {?} mDefault
|
|
||||||
* @return {?}
|
|
||||||
*/
|
|
||||||
Utils.getValue = function (oValues, sKey, mDefault)
|
|
||||||
{
|
|
||||||
return (!oValues || !sKey || Utils.isUndefined(oValues[sKey])) ? mDefault : oValues[sKey];
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} oOwner
|
|
||||||
* @param {string} sPublicName
|
|
||||||
* @param {*} mObject
|
|
||||||
*/
|
|
||||||
Utils.setValue = function(oOwner, sPublicName, mObject)
|
|
||||||
{
|
|
||||||
oOwner[sPublicName] = mObject;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} aData
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
Utils.isNonEmptyArray = function (aData)
|
|
||||||
{
|
|
||||||
return aData && aData.length && 0 < aData.length ? true : false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} mValue
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
Utils.pInt = function (mValue)
|
|
||||||
{
|
|
||||||
return parseInt(mValue || 0, 10);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Function} fFunction
|
|
||||||
* @param {Object=} oScope
|
|
||||||
* @return {Function}
|
|
||||||
*/
|
|
||||||
Utils.scopeBind = function (fFunction, oScope)
|
|
||||||
{
|
|
||||||
return function () {
|
|
||||||
return fFunction.apply(Utils.isUndefined(oScope) ? null : oScope,
|
|
||||||
Array.prototype.slice.call(arguments));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {number=} iLen
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
Utils.fakeMd5 = function (iLen)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
sResult = '',
|
|
||||||
sLine = '0123456789abcdefghijklmnopqrstuvwxyz'
|
|
||||||
;
|
|
||||||
|
|
||||||
iLen = Utils.isUndefined(iLen) ? 32 : Utils.pInt(iLen);
|
|
||||||
|
|
||||||
while (sResult.length < iLen)
|
|
||||||
{
|
|
||||||
sResult += sLine.substr(window.Math.round(window.Math.random() * sLine.length), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sResult;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
Utils.getNewUid = function ()
|
|
||||||
{
|
|
||||||
return 'jua-uid-' + Utils.fakeMd5(16) + '-' + (new window.Date()).getTime().toString();
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} oFile
|
|
||||||
* @return {Object}
|
|
||||||
*/
|
|
||||||
Utils.getDataFromFile = function (oFile)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
sFileName = Utils.isUndefined(oFile.fileName) ? (Utils.isUndefined(oFile.name) ? null : oFile.name) : oFile.fileName,
|
|
||||||
iSize = Utils.isUndefined(oFile.fileSize) ? (Utils.isUndefined(oFile.size) ? null : oFile.size) : oFile.fileSize,
|
|
||||||
sType = Utils.isUndefined(oFile.type) ? null : oFile.type
|
|
||||||
;
|
|
||||||
|
|
||||||
if (sFileName.charAt(0) === '/')
|
|
||||||
{
|
|
||||||
sFileName = sFileName.substr(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sType && 0 === iSize)
|
|
||||||
{
|
|
||||||
return null; // Folder
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
'FileName': sFileName,
|
|
||||||
'Size': iSize,
|
|
||||||
'Type': sType,
|
|
||||||
'Folder': '',
|
|
||||||
'File' : oFile
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {*} aItems
|
|
||||||
* @param {Function} fFileCallback
|
|
||||||
* @param {number=} iLimit = 20
|
|
||||||
* @param {Function=} fLimitCallback
|
|
||||||
*/
|
|
||||||
Utils.getDataFromFiles = function (aItems, fFileCallback, iLimit, fLimitCallback)
|
|
||||||
{
|
|
||||||
var
|
|
||||||
iInputLimit = 0,
|
|
||||||
iLen = 0,
|
|
||||||
iIndex = 0,
|
|
||||||
oItem = null,
|
|
||||||
oFile = null,
|
|
||||||
bUseLimit = false,
|
|
||||||
bCallLimit = false
|
|
||||||
;
|
|
||||||
|
|
||||||
iLimit = Utils.isUndefined(iLimit) ? Globals.iDefLimit : Utils.pInt(iLimit);
|
|
||||||
iInputLimit = iLimit;
|
|
||||||
bUseLimit = 0 < iLimit;
|
|
||||||
|
|
||||||
aItems = aItems && 0 < aItems.length ? aItems : null;
|
|
||||||
if (aItems)
|
|
||||||
{
|
|
||||||
for (iIndex = 0, iLen = aItems.length; iIndex < iLen; iIndex++)
|
|
||||||
{
|
{
|
||||||
oItem = aItems[iIndex];
|
clearTimeout(iTimer);
|
||||||
if (oItem)
|
|
||||||
{
|
|
||||||
if (!bUseLimit || 0 <= --iLimit)
|
|
||||||
{
|
|
||||||
oFile = Utils.getDataFromFile(oItem);
|
|
||||||
if (oFile)
|
|
||||||
{
|
|
||||||
fFileCallback(oFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (bUseLimit && !bCallLimit)
|
|
||||||
{
|
|
||||||
if (0 > iLimit && fLimitCallback)
|
|
||||||
{
|
|
||||||
bCallLimit = true;
|
|
||||||
fLimitCallback(iInputLimit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
iTimer = 0;
|
||||||
* @param {*} oInput
|
},
|
||||||
* @param {Function} fFileCallback
|
|
||||||
* @param {number=} iLimit = 20
|
|
||||||
* @param {Function=} fLimitCallback
|
|
||||||
*/
|
|
||||||
Utils.getDataFromInput = function (oInput, fFileCallback, iLimit, fLimitCallback)
|
|
||||||
{
|
|
||||||
var aFiles = oInput && oInput.files && 0 < oInput.files.length ? oInput.files : null;
|
|
||||||
if (aFiles)
|
|
||||||
{
|
|
||||||
Utils.getDataFromFiles(aFiles, fFileCallback, iLimit, fLimitCallback);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fFileCallback({
|
|
||||||
'FileName': oInput.value.split('\\').pop().split('/').pop(),
|
|
||||||
'Size': null,
|
|
||||||
'Type': null,
|
|
||||||
'Folder': '',
|
|
||||||
'File' : null
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.eventContainsFiles = function (oEvent)
|
/**
|
||||||
{
|
* @param {Event} oEvent
|
||||||
var bResult = false;
|
* @return {?Event}
|
||||||
if (oEvent && oEvent.dataTransfer && oEvent.dataTransfer.types && oEvent.dataTransfer.types.length)
|
*/
|
||||||
|
getEvent : oEvent =>
|
||||||
|
{
|
||||||
|
oEvent = (oEvent && (oEvent.originalEvent ?
|
||||||
|
oEvent.originalEvent : oEvent)) || window.event;
|
||||||
|
|
||||||
|
return oEvent.dataTransfer ? oEvent : null;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Object} oValues
|
||||||
|
* @param {string} sKey
|
||||||
|
* @param {?} mDefault
|
||||||
|
* @return {?}
|
||||||
|
*/
|
||||||
|
getValue : (oValues, sKey, mDefault) => (!oValues || !sKey || !defined(oValues[sKey])) ? mDefault : oValues[sKey],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Function} fFunction
|
||||||
|
* @param {Object=} oScope
|
||||||
|
* @return {Function}
|
||||||
|
*/
|
||||||
|
scopeBind : (fFunction, oScope) => (...args) => {
|
||||||
|
return fFunction.apply(defined(oScope) ? oScope : null,
|
||||||
|
Array.prototype.slice.call(args));
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number=} iLen
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
fakeMd5 : iLen =>
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
iIindex = 0,
|
sResult = '',
|
||||||
iLen = oEvent.dataTransfer.types.length
|
sLine = '0123456789abcdefghijklmnopqrstuvwxyz'
|
||||||
;
|
;
|
||||||
|
|
||||||
for (; iIindex < iLen; iIindex++)
|
iLen = defined(iLen) ? parseInt(iLen || 0, 10) : 32;
|
||||||
|
|
||||||
|
while (sResult.length < iLen)
|
||||||
{
|
{
|
||||||
if (oEvent.dataTransfer.types[iIindex].toLowerCase() === 'files')
|
sResult += sLine.substr(Math.round(Math.random() * sLine.length), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sResult;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getNewUid : () => 'jua-uid-' + Utils.fakeMd5(16) + '-' + (new Date()).getTime().toString(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {*} oFile
|
||||||
|
* @return {Object}
|
||||||
|
*/
|
||||||
|
getDataFromFile : oFile =>
|
||||||
|
{
|
||||||
|
var
|
||||||
|
sFileName = defined(oFile.fileName) ? oFile.fileName : (defined(oFile.name) ? oFile.name : null),
|
||||||
|
iSize = defined(oFile.fileSize) ? oFile.fileSize : (defined(oFile.size) ? oFile.size : null),
|
||||||
|
sType = defined(oFile.type) ? oFile.type : null
|
||||||
|
;
|
||||||
|
|
||||||
|
if (sFileName.charAt(0) === '/')
|
||||||
|
{
|
||||||
|
sFileName = sFileName.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sType && 0 === iSize)
|
||||||
|
{
|
||||||
|
return null; // Folder
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'FileName': sFileName,
|
||||||
|
'Size': iSize,
|
||||||
|
'Type': sType,
|
||||||
|
'Folder': '',
|
||||||
|
'File' : oFile
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {*} aItems
|
||||||
|
* @param {Function} fFileCallback
|
||||||
|
* @param {number=} iLimit = 20
|
||||||
|
* @param {Function=} fLimitCallback
|
||||||
|
*/
|
||||||
|
getDataFromFiles : (aItems, fFileCallback, iLimit, fLimitCallback) =>
|
||||||
|
{
|
||||||
|
var
|
||||||
|
iInputLimit = 0,
|
||||||
|
iLen = 0,
|
||||||
|
iIndex = 0,
|
||||||
|
oItem = null,
|
||||||
|
oFile = null,
|
||||||
|
bUseLimit = false,
|
||||||
|
bCallLimit = false
|
||||||
|
;
|
||||||
|
|
||||||
|
iLimit = defined(iLimit) ? parseInt(iLimit || 0, 10) : iDefLimit;
|
||||||
|
iInputLimit = iLimit;
|
||||||
|
bUseLimit = 0 < iLimit;
|
||||||
|
|
||||||
|
aItems = aItems && 0 < aItems.length ? aItems : null;
|
||||||
|
if (aItems)
|
||||||
|
{
|
||||||
|
for (iIndex = 0, iLen = aItems.length; iIndex < iLen; iIndex++)
|
||||||
{
|
{
|
||||||
bResult = true;
|
oItem = aItems[iIndex];
|
||||||
break;
|
if (oItem)
|
||||||
|
{
|
||||||
|
if (!bUseLimit || 0 <= --iLimit)
|
||||||
|
{
|
||||||
|
oFile = Utils.getDataFromFile(oItem);
|
||||||
|
if (oFile)
|
||||||
|
{
|
||||||
|
fFileCallback(oFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bUseLimit && !bCallLimit)
|
||||||
|
{
|
||||||
|
if (0 > iLimit && fLimitCallback)
|
||||||
|
{
|
||||||
|
bCallLimit = true;
|
||||||
|
fLimitCallback(iInputLimit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
return bResult;
|
/**
|
||||||
};
|
* @param {*} oInput
|
||||||
|
* @param {Function} fFileCallback
|
||||||
/**
|
* @param {number=} iLimit = 20
|
||||||
* @param {Event} oEvent
|
* @param {Function=} fLimitCallback
|
||||||
* @param {Function} fFileCallback
|
*/
|
||||||
* @param {number=} iLimit = 20
|
getDataFromInput : (oInput, fFileCallback, iLimit, fLimitCallback) =>
|
||||||
* @param {Function=} fLimitCallback
|
|
||||||
*/
|
|
||||||
Utils.getDataFromDragEvent = function (oEvent, fFileCallback, iLimit, fLimitCallback)
|
|
||||||
{
|
|
||||||
var aFiles = null;
|
|
||||||
|
|
||||||
oEvent = Utils.getEvent(oEvent);
|
|
||||||
if (oEvent && Utils.eventContainsFiles(oEvent))
|
|
||||||
{
|
{
|
||||||
aFiles = (Utils.getValue(oEvent, 'files', null) || (oEvent.dataTransfer ?
|
var aFiles = oInput && oInput.files && 0 < oInput.files.length ? oInput.files : null;
|
||||||
Utils.getValue(oEvent.dataTransfer, 'files', null) : null));
|
if (aFiles)
|
||||||
|
|
||||||
if (aFiles && 0 < aFiles.length)
|
|
||||||
{
|
{
|
||||||
Utils.getDataFromFiles(aFiles, fFileCallback, iLimit, fLimitCallback);
|
Utils.getDataFromFiles(aFiles, fFileCallback, iLimit, fLimitCallback);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
};
|
{
|
||||||
|
fFileCallback({
|
||||||
|
'FileName': oInput.value.split('\\').pop().split('/').pop(),
|
||||||
|
'Size': null,
|
||||||
|
'Type': null,
|
||||||
|
'Folder': '',
|
||||||
|
'File' : null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
Utils.createNextLabel = function ()
|
eventContainsFiles : oEvent =>
|
||||||
{
|
|
||||||
return $('<label style="' +
|
|
||||||
'position: absolute; background-color:#fff; right: 0px; top: 0px; left: 0px; bottom: 0px; margin: 0px; padding: 0px; cursor: pointer;' +
|
|
||||||
'"></label>').css({
|
|
||||||
'opacity': 0
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Utils.createNextInput = function ()
|
|
||||||
{
|
|
||||||
return $('<input type="file" tabindex="-1" hidefocus="hidefocus" style="position: absolute; left: -9999px;" />');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string=} sName
|
|
||||||
* @param {boolean=} bMultiple = true
|
|
||||||
* @return {?Object}
|
|
||||||
*/
|
|
||||||
Utils.getNewInput = function (sName, bMultiple)
|
|
||||||
{
|
|
||||||
sName = Utils.isUndefined(sName) ? '' : sName.toString();
|
|
||||||
|
|
||||||
var oLocal = Utils.createNextInput();
|
|
||||||
if (0 < sName.length)
|
|
||||||
{
|
{
|
||||||
oLocal.attr('name', sName);
|
var bResult = false;
|
||||||
}
|
if (oEvent && oEvent.dataTransfer && oEvent.dataTransfer.types && oEvent.dataTransfer.types.length)
|
||||||
|
{
|
||||||
|
var
|
||||||
|
iIindex = 0,
|
||||||
|
iLen = oEvent.dataTransfer.types.length
|
||||||
|
;
|
||||||
|
|
||||||
if (Utils.isUndefined(bMultiple) ? true : bMultiple)
|
for (; iIindex < iLen; iIindex++)
|
||||||
|
{
|
||||||
|
if (oEvent.dataTransfer.types[iIindex].toLowerCase() === 'files')
|
||||||
|
{
|
||||||
|
bResult = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bResult;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Event} oEvent
|
||||||
|
* @param {Function} fFileCallback
|
||||||
|
* @param {number=} iLimit = 20
|
||||||
|
* @param {Function=} fLimitCallback
|
||||||
|
*/
|
||||||
|
getDataFromDragEvent : (oEvent, fFileCallback, iLimit, fLimitCallback) =>
|
||||||
{
|
{
|
||||||
oLocal.prop('multiple', true);
|
var aFiles = null;
|
||||||
}
|
|
||||||
|
|
||||||
return oLocal;
|
oEvent = Utils.getEvent(oEvent);
|
||||||
};
|
if (oEvent && Utils.eventContainsFiles(oEvent))
|
||||||
|
{
|
||||||
|
aFiles = (Utils.getValue(oEvent, 'files', null) || (oEvent.dataTransfer ?
|
||||||
|
Utils.getValue(oEvent.dataTransfer, 'files', null) : null));
|
||||||
|
|
||||||
/**
|
if (aFiles && 0 < aFiles.length)
|
||||||
* @param {?} mStringOrFunction
|
{
|
||||||
* @param {Array=} aFunctionParams
|
Utils.getDataFromFiles(aFiles, fFileCallback, iLimit, fLimitCallback);
|
||||||
* @return {string}
|
}
|
||||||
*/
|
}
|
||||||
Utils.getStringOrCallFunction = function (mStringOrFunction, aFunctionParams)
|
},
|
||||||
{
|
|
||||||
return $.isFunction(mStringOrFunction) ?
|
createNextLabel : () =>
|
||||||
mStringOrFunction.apply(null, Array.isArray(aFunctionParams) ? aFunctionParams : []).toString() :
|
{
|
||||||
mStringOrFunction.toString();
|
return $('<label style="' +
|
||||||
|
'position: absolute; background-color:#fff; right: 0px; top: 0px; left: 0px; bottom: 0px; margin: 0px; padding: 0px; cursor: pointer;' +
|
||||||
|
'"></label>').css({
|
||||||
|
'opacity': 0
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
createNextInput : () => $('<input type="file" tabindex="-1" hidefocus="hidefocus" style="position: absolute; left: -9999px;" />'),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string=} sName
|
||||||
|
* @param {boolean=} bMultiple = true
|
||||||
|
* @return {?Object}
|
||||||
|
*/
|
||||||
|
getNewInput : (sName, bMultiple) =>
|
||||||
|
{
|
||||||
|
sName = defined(sName) ? sName.toString() : '';
|
||||||
|
|
||||||
|
var oLocal = Utils.createNextInput();
|
||||||
|
if (0 < sName.length)
|
||||||
|
{
|
||||||
|
oLocal.attr('name', sName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined(bMultiple) ? bMultiple : true)
|
||||||
|
{
|
||||||
|
oLocal.prop('multiple', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return oLocal;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {?} mStringOrFunction
|
||||||
|
* @param {Array=} aFunctionParams
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
getStringOrCallFunction : (mStringOrFunction, aFunctionParams) => $.isFunction(mStringOrFunction) ?
|
||||||
|
mStringOrFunction.apply(null, Array.isArray(aFunctionParams) ? aFunctionParams : []).toString() :
|
||||||
|
mStringOrFunction.toString()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -453,7 +378,7 @@
|
||||||
if (fProgressFunction && oXhr.upload)
|
if (fProgressFunction && oXhr.upload)
|
||||||
{
|
{
|
||||||
oXhr.upload.onprogress = function (oEvent) {
|
oXhr.upload.onprogress = function (oEvent) {
|
||||||
if (oEvent && oEvent.lengthComputable && !Utils.isUndefined(oEvent.loaded) && !Utils.isUndefined(oEvent.total))
|
if (oEvent && oEvent.lengthComputable && defined(oEvent.loaded) && defined(oEvent.total))
|
||||||
{
|
{
|
||||||
fProgressFunction(sUid, oEvent.loaded, oEvent.total);
|
fProgressFunction(sUid, oEvent.loaded, oEvent.total);
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +408,7 @@
|
||||||
fCompleteFunction(sUid, bResult, oResult);
|
fCompleteFunction(sUid, bResult, oResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Utils.isUndefined(self.oXhrs[sUid]))
|
if (defined(self.oXhrs[sUid]))
|
||||||
{
|
{
|
||||||
self.oXhrs[sUid] = null;
|
self.oXhrs[sUid] = null;
|
||||||
}
|
}
|
||||||
|
|
@ -557,7 +482,7 @@
|
||||||
oLabel.remove();
|
oLabel.remove();
|
||||||
}, 10);
|
}, 10);
|
||||||
},
|
},
|
||||||
Utils.getValue(self.oOptions, 'multipleSizeLimit', Globals.iDefLimit),
|
Utils.getValue(self.oOptions, 'multipleSizeLimit', iDefLimit),
|
||||||
self.oJua.getEvent('onLimitReached')
|
self.oJua.getEvent('onLimitReached')
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
@ -624,7 +549,7 @@
|
||||||
*/
|
*/
|
||||||
function Jua(oOptions)
|
function Jua(oOptions)
|
||||||
{
|
{
|
||||||
oOptions = Utils.isUndefined(oOptions) ? {} : oOptions;
|
oOptions = defined(oOptions) ? oOptions : {};
|
||||||
|
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
|
|
@ -649,7 +574,7 @@
|
||||||
'onLimitReached': null
|
'onLimitReached': null
|
||||||
};
|
};
|
||||||
|
|
||||||
self.oOptions = Utils.extend({
|
self.oOptions = {
|
||||||
'action': '',
|
'action': '',
|
||||||
'name': '',
|
'name': '',
|
||||||
'hidden': {},
|
'hidden': {},
|
||||||
|
|
@ -661,9 +586,10 @@
|
||||||
'disableMultiple': false,
|
'disableMultiple': false,
|
||||||
'disableDocumentDropPrevent': false,
|
'disableDocumentDropPrevent': false,
|
||||||
'multipleSizeLimit': 50
|
'multipleSizeLimit': 50
|
||||||
}, oOptions);
|
};
|
||||||
|
Object.entries(oOptions).forEach(([key, value])=>self.oOptions[key]=value);
|
||||||
|
|
||||||
self.oQueue = queue(Utils.pInt(Utils.getValue(self.oOptions, 'queueSize', 10)));
|
self.oQueue = queue(parseInt(Utils.getValue(self.oOptions, 'queueSize', 10) || 0, 10));
|
||||||
if (self.runEvent('onCompleteAll'))
|
if (self.runEvent('onCompleteAll'))
|
||||||
{
|
{
|
||||||
self.oQueue.await(function () {
|
self.oQueue.await(function () {
|
||||||
|
|
@ -694,7 +620,7 @@
|
||||||
{
|
{
|
||||||
(function (self) {
|
(function (self) {
|
||||||
var
|
var
|
||||||
$doc = $(window.document),
|
$doc = $(document),
|
||||||
oBigDropZone = $(Utils.getValue(self.oOptions, 'dragAndDropBodyElement', false) || $doc),
|
oBigDropZone = $(Utils.getValue(self.oOptions, 'dragAndDropBodyElement', false) || $doc),
|
||||||
oDragAndDropElement = Utils.getValue(self.oOptions, 'dragAndDropElement', false),
|
oDragAndDropElement = Utils.getValue(self.oOptions, 'dragAndDropElement', false),
|
||||||
fHandleDragOver = function (oEvent) {
|
fHandleDragOver = function (oEvent) {
|
||||||
|
|
@ -736,7 +662,7 @@
|
||||||
Utils.mainClearTimeout(self.iDocTimer);
|
Utils.mainClearTimeout(self.iDocTimer);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Utils.getValue(self.oOptions, 'multipleSizeLimit', Globals.iDefLimit),
|
Utils.getValue(self.oOptions, 'multipleSizeLimit', iDefLimit),
|
||||||
self.getEvent('onLimitReached')
|
self.getEvent('onLimitReached')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -763,7 +689,7 @@
|
||||||
oEvent = Utils.getEvent(oEvent);
|
oEvent = Utils.getEvent(oEvent);
|
||||||
if (oEvent)
|
if (oEvent)
|
||||||
{
|
{
|
||||||
var oRelatedTarget = window.document['elementFromPoint'] ? window.document['elementFromPoint'](oEvent['clientX'], oEvent['clientY']) : null;
|
var oRelatedTarget = document['elementFromPoint'] ? document['elementFromPoint'](oEvent['clientX'], oEvent['clientY']) : null;
|
||||||
if (oRelatedTarget && Utils.contains(this, oRelatedTarget))
|
if (oRelatedTarget && Utils.contains(this, oRelatedTarget))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -871,11 +797,6 @@
|
||||||
{
|
{
|
||||||
self.bEnableDnD = false;
|
self.bEnableDnD = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.setValue(self, 'on', self.on);
|
|
||||||
Utils.setValue(self, 'cancel', self.cancel);
|
|
||||||
Utils.setValue(self, 'isDragAndDropSupported', self.isDragAndDropSupported);
|
|
||||||
Utils.setValue(self, 'setDragAndDropEnabledStatus', self.setDragAndDropEnabledStatus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
2
vendors/jua/jua.min.js
vendored
2
vendors/jua/jua.min.js
vendored
File diff suppressed because one or more lines are too long
183
vendors/keymaster/keymaster.js
vendored
183
vendors/keymaster/keymaster.js
vendored
|
|
@ -30,9 +30,7 @@
|
||||||
';': 186, '\'': 222,
|
';': 186, '\'': 222,
|
||||||
'[': 219, ']': 221, '\\': 220
|
'[': 219, ']': 221, '\\': 220
|
||||||
},
|
},
|
||||||
code = function(x){
|
code = x => _MAP[x] || x.toUpperCase().charCodeAt(0),
|
||||||
return _MAP[x] || x.toUpperCase().charCodeAt(0);
|
|
||||||
},
|
|
||||||
_downKeys = [];
|
_downKeys = [];
|
||||||
|
|
||||||
for(k=1;k<20;k++) _MAP['f'+k] = 111+k;
|
for(k=1;k<20;k++) _MAP['f'+k] = 111+k;
|
||||||
|
|
@ -43,95 +41,15 @@
|
||||||
17:'ctrlKey',
|
17:'ctrlKey',
|
||||||
91:'metaKey'
|
91:'metaKey'
|
||||||
};
|
};
|
||||||
function updateModifierKey(event) {
|
|
||||||
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle keydown event
|
|
||||||
function dispatch(event) {
|
|
||||||
var key, handler, k, i, modifiersMatch, scope;
|
|
||||||
key = event.keyCode;
|
|
||||||
|
|
||||||
if (!_downKeys.includes(key)) {
|
|
||||||
_downKeys.push(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if a modifier key, set the key.<modifierkeyname> property to true and return
|
|
||||||
if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko
|
|
||||||
if(key in _mods) {
|
|
||||||
_mods[key] = true;
|
|
||||||
// 'assignKey' from inside this closure is exported to window.key
|
|
||||||
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateModifierKey(event);
|
|
||||||
|
|
||||||
// see if we need to ignore the keypress (filter() can can be overridden)
|
|
||||||
// by default ignore key presses if a select, textarea, or input is focused
|
|
||||||
if(!assignKey.filter.call(this, event)) return;
|
|
||||||
|
|
||||||
// abort if no potentially matching shortcuts found
|
|
||||||
if (!(key in _handlers)) return;
|
|
||||||
|
|
||||||
scope = getScope();
|
|
||||||
|
|
||||||
// for each potential shortcut
|
|
||||||
for (i = 0; i < _handlers[key].length; i++) {
|
|
||||||
handler = _handlers[key][i];
|
|
||||||
|
|
||||||
// see if it's in the current scope
|
|
||||||
if(handler.scope == scope || handler.scope == 'all'){
|
|
||||||
// check if modifiers match if any
|
|
||||||
modifiersMatch = handler.mods.length > 0;
|
|
||||||
for(k in _mods)
|
|
||||||
if((!_mods[k] && handler.mods.includes(+k)) ||
|
|
||||||
(_mods[k] && !handler.mods.includes(+k))) modifiersMatch = false;
|
|
||||||
// call the handler and stop the event if neccessary
|
|
||||||
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
|
|
||||||
if(handler.method(event, handler)===false){
|
|
||||||
if(event.preventDefault) event.preventDefault();
|
|
||||||
else event.returnValue = false;
|
|
||||||
if(event.stopPropagation) event.stopPropagation();
|
|
||||||
if(event.cancelBubble) event.cancelBubble = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// unset modifier keys on keyup
|
|
||||||
function clearModifier(event){
|
|
||||||
var key = event.keyCode, k,
|
|
||||||
i = _downKeys.indexOf(key);
|
|
||||||
|
|
||||||
// remove key from _downKeys
|
|
||||||
if (i >= 0) {
|
|
||||||
_downKeys.splice(i, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(key == 93 || key == 224) key = 91;
|
|
||||||
if(key in _mods) {
|
|
||||||
_mods[key] = false;
|
|
||||||
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetModifiers() {
|
|
||||||
for(let k in _mods) _mods[k] = false;
|
|
||||||
for(let k in _MODIFIERS) assignKey[k] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse and assign shortcut
|
// parse and assign shortcut
|
||||||
function assignKey(key, scope, method){
|
function assignKey(key, scope, method){
|
||||||
var keys, mods, bScopeIsArray = false;
|
var keys = getKeys(key), mods;
|
||||||
keys = getKeys(key);
|
|
||||||
if (method === undefined) {
|
if (method === undefined) {
|
||||||
method = scope;
|
method = scope;
|
||||||
scope = 'all';
|
scope = 'all';
|
||||||
}
|
}
|
||||||
|
|
||||||
bScopeIsArray = !!(typeof scope !== 'string' && scope.length && typeof scope[0] === 'string');
|
|
||||||
|
|
||||||
// for each shortcut
|
// for each shortcut
|
||||||
for (var i = 0; i < keys.length; i++) {
|
for (var i = 0; i < keys.length; i++) {
|
||||||
// set modifier keys if any
|
// set modifier keys if any
|
||||||
|
|
@ -147,22 +65,16 @@
|
||||||
// ...store handler
|
// ...store handler
|
||||||
if (!(key in _handlers)) _handlers[key] = [];
|
if (!(key in _handlers)) _handlers[key] = [];
|
||||||
|
|
||||||
if (bScopeIsArray) {
|
if (typeof scope !== 'string' && scope.length && typeof scope[0] === 'string') {
|
||||||
for (var j = 0; j < scope.length; j++) {
|
scope.forEach(item => {
|
||||||
_handlers[key].push({ shortcut: keys[i], scope: scope[j], method: method, key: keys[i], mods: mods });
|
_handlers[key].push({ shortcut: keys[i], scope: item, method: method, key: keys[i], mods: mods });
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
_handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });
|
_handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function filter(event){
|
|
||||||
var tagName = (event.target || event.srcElement).tagName;
|
|
||||||
// ignore keypressed in any elements that support keyboard data input
|
|
||||||
return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
|
|
||||||
}
|
|
||||||
|
|
||||||
// initialize key.<modifier> to false
|
// initialize key.<modifier> to false
|
||||||
for(k in _MODIFIERS) assignKey[k] = false;
|
for(k in _MODIFIERS) assignKey[k] = false;
|
||||||
|
|
||||||
|
|
@ -172,9 +84,8 @@
|
||||||
getScope = () => _scope || 'all',
|
getScope = () => _scope || 'all',
|
||||||
// abstract key logic for assign and unassign
|
// abstract key logic for assign and unassign
|
||||||
getKeys = key => {
|
getKeys = key => {
|
||||||
var keys;
|
|
||||||
key = key.replace(/\s/g, '');
|
key = key.replace(/\s/g, '');
|
||||||
keys = key.split(',');
|
var keys = key.split(',');
|
||||||
if ((keys[keys.length - 1]) == '') {
|
if ((keys[keys.length - 1]) == '') {
|
||||||
keys[keys.length - 2] += ',';
|
keys[keys.length - 2] += ',';
|
||||||
}
|
}
|
||||||
|
|
@ -183,24 +94,88 @@
|
||||||
// abstract mods logic for assign and unassign
|
// abstract mods logic for assign and unassign
|
||||||
getMods = key => {
|
getMods = key => {
|
||||||
var mods = key.slice(0, key.length - 1);
|
var mods = key.slice(0, key.length - 1);
|
||||||
for (var mi = 0; mi < mods.length; mi++)
|
mods.forEach((mod, mi) => mods[mi] = _MODIFIERS[mod]);
|
||||||
mods[mi] = _MODIFIERS[mods[mi]];
|
|
||||||
return mods;
|
return mods;
|
||||||
};
|
};
|
||||||
|
|
||||||
// set the handlers globally on document
|
// set the handlers globally on document
|
||||||
document.addEventListener('keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48
|
document.addEventListener('keydown', event => {
|
||||||
document.addEventListener('keyup', clearModifier);
|
var key = event.keyCode, k, modifiersMatch, scope;
|
||||||
|
|
||||||
|
if (!_downKeys.includes(key)) {
|
||||||
|
_downKeys.push(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if a modifier key, set the key.<modifierkeyname> property to true and return
|
||||||
|
if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko
|
||||||
|
if(key in _mods) {
|
||||||
|
_mods[key] = true;
|
||||||
|
// 'assignKey' from inside this closure is exported to window.key
|
||||||
|
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(k in _mods) _mods[k] = event[modifierMap[k]];
|
||||||
|
|
||||||
|
// see if we need to ignore the keypress (filter() can can be overridden)
|
||||||
|
// by default ignore key presses if a select, textarea, or input is focused
|
||||||
|
if(!assignKey.filter.call(this, event)) return;
|
||||||
|
|
||||||
|
// abort if no potentially matching shortcuts found
|
||||||
|
if (!(key in _handlers)) return;
|
||||||
|
|
||||||
|
scope = getScope();
|
||||||
|
|
||||||
|
// for each potential shortcut
|
||||||
|
_handlers[key].forEach(handler => {
|
||||||
|
// see if it's in the current scope
|
||||||
|
if(handler.scope == scope || handler.scope == 'all'){
|
||||||
|
// check if modifiers match if any
|
||||||
|
modifiersMatch = handler.mods.length > 0;
|
||||||
|
for(k in _mods)
|
||||||
|
if((!_mods[k] && handler.mods.includes(+k)) ||
|
||||||
|
(_mods[k] && !handler.mods.includes(+k))) modifiersMatch = false;
|
||||||
|
// call the handler and stop the event if neccessary
|
||||||
|
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
|
||||||
|
if(handler.method(event, handler)===false){
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// unset modifier keys on keyup
|
||||||
|
document.addEventListener('keyup', event => {
|
||||||
|
var key = event.keyCode, k,
|
||||||
|
i = _downKeys.indexOf(key);
|
||||||
|
|
||||||
|
// remove key from _downKeys
|
||||||
|
if (i >= 0) {
|
||||||
|
_downKeys.splice(i, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(key == 93 || key == 224) key = 91;
|
||||||
|
if(key in _mods) {
|
||||||
|
_mods[key] = false;
|
||||||
|
for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// reset modifiers to false whenever the window is (re)focused.
|
// reset modifiers to false whenever the window is (re)focused.
|
||||||
window.addEventListener('focus', resetModifiers);
|
window.addEventListener('focus', () => {
|
||||||
|
for(let k in _mods) _mods[k] = false;
|
||||||
|
for(let k in _MODIFIERS) assignKey[k] = false;
|
||||||
|
});
|
||||||
|
|
||||||
// set window.key and window.key.set/get, and the default filter
|
// set window.key and window.key.set/get, and the default filter
|
||||||
global.key = assignKey;
|
global.key = assignKey;
|
||||||
global.key.setScope = setScope;
|
global.key.setScope = setScope;
|
||||||
global.key.getScope = getScope;
|
global.key.getScope = getScope;
|
||||||
global.key.filter = filter;
|
global.key.filter = event => {
|
||||||
|
var tagName = event.target.tagName;
|
||||||
if(typeof module !== 'undefined') module.exports = key;
|
// ignore keypressed in any elements that support keyboard data input
|
||||||
|
return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');
|
||||||
|
};
|
||||||
|
|
||||||
})(this);
|
})(this);
|
||||||
|
|
|
||||||
8
vendors/lightgallery/dist/js/lightgallery.js
vendored
8
vendors/lightgallery/dist/js/lightgallery.js
vendored
|
|
@ -179,13 +179,7 @@
|
||||||
// Using different namespace for click because click event should not unbind if selector is same object('this')
|
// Using different namespace for click because click event should not unbind if selector is same object('this')
|
||||||
_this.$items.on('click.lgcustom', function(event) {
|
_this.$items.on('click.lgcustom', function(event) {
|
||||||
|
|
||||||
// For IE8
|
event.preventDefault();
|
||||||
try {
|
|
||||||
event.preventDefault();
|
|
||||||
event.preventDefault();
|
|
||||||
} catch (er) {
|
|
||||||
event.returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.$el.trigger('onBeforeOpen.lg');
|
_this.$el.trigger('onBeforeOpen.lg');
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
8
vendors/lightgallery/src/js/lightgallery.js
vendored
8
vendors/lightgallery/src/js/lightgallery.js
vendored
|
|
@ -176,13 +176,7 @@
|
||||||
// Using different namespace for click because click event should not unbind if selector is same object('this')
|
// Using different namespace for click because click event should not unbind if selector is same object('this')
|
||||||
_this.$items.on('click.lgcustom', function(event) {
|
_this.$items.on('click.lgcustom', function(event) {
|
||||||
|
|
||||||
// For IE8
|
event.preventDefault();
|
||||||
try {
|
|
||||||
event.preventDefault();
|
|
||||||
event.preventDefault();
|
|
||||||
} catch (er) {
|
|
||||||
event.returnValue = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_this.$el.trigger('onBeforeOpen.lg');
|
_this.$el.trigger('onBeforeOpen.lg');
|
||||||
|
|
||||||
|
|
|
||||||
290
vendors/routes/crossroads.js
vendored
Normal file
290
vendors/routes/crossroads.js
vendored
Normal file
|
|
@ -0,0 +1,290 @@
|
||||||
|
/** @license
|
||||||
|
* Crossroads.js <http://millermedeiros.github.com/crossroads.js>
|
||||||
|
* Released under the MIT license
|
||||||
|
* Author: Miller Medeiros
|
||||||
|
* Version: 0.7.1 - Build: 93 (2012/02/02 09:29 AM)
|
||||||
|
*/
|
||||||
|
|
||||||
|
(global => {
|
||||||
|
|
||||||
|
// Helpers -----------
|
||||||
|
//====================
|
||||||
|
|
||||||
|
//borrowed from AMD-utils
|
||||||
|
function typecastValue(val) {
|
||||||
|
var r;
|
||||||
|
if (val === null || val === 'null') {
|
||||||
|
r = null;
|
||||||
|
} else if (val === 'true') {
|
||||||
|
r = true;
|
||||||
|
} else if (val === 'false') {
|
||||||
|
r = false;
|
||||||
|
} else if (val === undefined || val === 'undefined') {
|
||||||
|
r = undefined;
|
||||||
|
} else if (val === '' || isNaN(val)) {
|
||||||
|
//isNaN('') returns false
|
||||||
|
r = val;
|
||||||
|
} else {
|
||||||
|
//parseFloat(null || '') returns NaN
|
||||||
|
r = parseFloat(val);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Crossroads --------
|
||||||
|
//====================
|
||||||
|
|
||||||
|
class Crossroads {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this._routes = [];
|
||||||
|
this.bypassed = new signals.Signal();
|
||||||
|
this.routed = new global.signals.Signal();
|
||||||
|
this.shouldTypecast = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
addRoute(pattern, callback, priority) {
|
||||||
|
var route = new Route(pattern, callback, priority, this),
|
||||||
|
routes = this._routes,
|
||||||
|
n = routes.length;
|
||||||
|
do { --n; } while (routes[n] && route._priority <= routes[n]._priority);
|
||||||
|
routes.splice(n+1, 0, route);
|
||||||
|
return route;
|
||||||
|
}
|
||||||
|
|
||||||
|
removeRoute(route) {
|
||||||
|
var i = this._routes.indexOf(route);
|
||||||
|
if (i !== -1) {
|
||||||
|
this._routes.splice(i, 1);
|
||||||
|
}
|
||||||
|
route._destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAllRoutes() {
|
||||||
|
var n = this.getNumRoutes();
|
||||||
|
while (n--) {
|
||||||
|
this._routes[n]._destroy();
|
||||||
|
}
|
||||||
|
this._routes.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
parse(request) {
|
||||||
|
request = request || '';
|
||||||
|
|
||||||
|
var routes = this._getMatchedRoutes(request),
|
||||||
|
i = 0,
|
||||||
|
n = routes.length,
|
||||||
|
cur;
|
||||||
|
|
||||||
|
if (n) {
|
||||||
|
//shold be incremental loop, execute routes in order
|
||||||
|
while (i < n) {
|
||||||
|
cur = routes[i];
|
||||||
|
cur.route.matched.dispatch.apply(cur.route.matched, cur.params);
|
||||||
|
cur.isFirst = !i;
|
||||||
|
this.routed.dispatch(request, cur);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.bypassed.dispatch(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getNumRoutes() {
|
||||||
|
return this._routes.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getMatchedRoutes(request) {
|
||||||
|
var res = [],
|
||||||
|
routes = this._routes,
|
||||||
|
n = routes.length,
|
||||||
|
route;
|
||||||
|
//should be decrement loop since higher priorities are added at the end of array
|
||||||
|
while (route = routes[--n]) {
|
||||||
|
if ((!res.length || route.greedy) && route.match(request)) {
|
||||||
|
res.push({
|
||||||
|
route : route,
|
||||||
|
params : route._getParamsArray(request)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Route --------------
|
||||||
|
//=====================
|
||||||
|
|
||||||
|
class Route {
|
||||||
|
|
||||||
|
constructor(pattern, callback, priority, router) {
|
||||||
|
this.greedy = false;
|
||||||
|
this.rules = void(0);
|
||||||
|
var isRegexPattern = pattern instanceof RegExp;
|
||||||
|
this._router = router;
|
||||||
|
this._pattern = pattern;
|
||||||
|
this._paramsIds = isRegexPattern ? null : patternLexer.getParamIds(this._pattern);
|
||||||
|
this._optionalParamsIds = isRegexPattern ? null : patternLexer.getOptionalParamsIds(this._pattern);
|
||||||
|
this._matchRegexp = isRegexPattern ? pattern : patternLexer.compilePattern(pattern);
|
||||||
|
this.matched = new global.signals.Signal();
|
||||||
|
if (callback) {
|
||||||
|
this.matched.add(callback);
|
||||||
|
}
|
||||||
|
this._priority = priority || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
match(request) {
|
||||||
|
return this._matchRegexp.test(request) && this._validateParams(request); //validate params even if regexp because of `request_` rule.
|
||||||
|
}
|
||||||
|
|
||||||
|
_validateParams(request) {
|
||||||
|
var rules = this.rules,
|
||||||
|
values = this._getParamsObject(request),
|
||||||
|
key;
|
||||||
|
for (key in rules) {
|
||||||
|
// normalize_ isn't a validation rule... (#39)
|
||||||
|
if(key !== 'normalize_' && rules.hasOwnProperty(key) && ! this._isValidParam(request, key, values)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isValidParam(request, prop, values) {
|
||||||
|
var validationRule = this.rules[prop],
|
||||||
|
val = values[prop],
|
||||||
|
isValid = false;
|
||||||
|
|
||||||
|
if (val == null && this._optionalParamsIds && this._optionalParamsIds.indexOf(prop) !== -1) {
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
else if (validationRule instanceof RegExp) {
|
||||||
|
isValid = validationRule.test(val);
|
||||||
|
}
|
||||||
|
else if (Array.isArray(validationRule)) {
|
||||||
|
isValid = validationRule.indexOf(val) !== -1;
|
||||||
|
}
|
||||||
|
else if (typeof validationRule === 'function') {
|
||||||
|
isValid = validationRule(val, request, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isValid; //fail silently if validationRule is from an unsupported type
|
||||||
|
}
|
||||||
|
|
||||||
|
_getParamsObject(request) {
|
||||||
|
var shouldTypecast = this._router.shouldTypecast,
|
||||||
|
values = patternLexer.getParamValues(request, this._matchRegexp, shouldTypecast),
|
||||||
|
o = {},
|
||||||
|
n = values.length;
|
||||||
|
while (n--) {
|
||||||
|
o[n] = values[n]; //for RegExp pattern and also alias to normal paths
|
||||||
|
if (this._paramsIds) {
|
||||||
|
o[this._paramsIds[n]] = values[n];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.request_ = shouldTypecast ? typecastValue(request) : request;
|
||||||
|
o.vals_ = values;
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
_getParamsArray(request) {
|
||||||
|
var norm = this.rules ? this.rules.normalize_ : null,
|
||||||
|
params;
|
||||||
|
if (norm && typeof norm === 'function') {
|
||||||
|
params = norm(request, this._getParamsObject(request));
|
||||||
|
} else {
|
||||||
|
params = patternLexer.getParamValues(request, this._matchRegexp, this._router.shouldTypecast);
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
this._router.removeRoute(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
_destroy() {
|
||||||
|
this.matched.dispose();
|
||||||
|
this.matched = this._pattern = this._matchRegexp = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Pattern Lexer ------
|
||||||
|
//=====================
|
||||||
|
|
||||||
|
const
|
||||||
|
ESCAPE_CHARS_REGEXP = /[\\.+*?^$[\](){}/'#]/g, //match chars that should be escaped on string regexp
|
||||||
|
UNNECESSARY_SLASHES_REGEXP = /\/$/g, //trailing slash
|
||||||
|
OPTIONAL_SLASHES_REGEXP = /([:}]|\w(?=\/))\/?(:)/g, //slash between `::` or `}:` or `\w:`. $1 = before, $2 = after
|
||||||
|
REQUIRED_SLASHES_REGEXP = /([:}])\/?(\{)/g, //used to insert slash between `:{` and `}{`
|
||||||
|
|
||||||
|
REQUIRED_PARAMS_REGEXP = /\{([^}]+)\}/g, //match everything between `{ }`
|
||||||
|
OPTIONAL_PARAMS_REGEXP = /:([^:]+):/g, //match everything between `: :`
|
||||||
|
PARAMS_REGEXP = /(?:\{|:)([^}:]+)(?:\}|:)/g, //capture everything between `{ }` or `: :`
|
||||||
|
|
||||||
|
//used to save params during compile (avoid escaping things that
|
||||||
|
//shouldn't be escaped).
|
||||||
|
SAVE_REQUIRED_PARAMS = '__CR_RP__',
|
||||||
|
SAVE_OPTIONAL_PARAMS = '__CR_OP__',
|
||||||
|
SAVE_REQUIRED_SLASHES = '__CR_RS__',
|
||||||
|
SAVE_OPTIONAL_SLASHES = '__CR_OS__',
|
||||||
|
SAVED_REQUIRED_REGEXP = new RegExp(SAVE_REQUIRED_PARAMS, 'g'),
|
||||||
|
SAVED_OPTIONAL_REGEXP = new RegExp(SAVE_OPTIONAL_PARAMS, 'g'),
|
||||||
|
SAVED_OPTIONAL_SLASHES_REGEXP = new RegExp(SAVE_OPTIONAL_SLASHES, 'g'),
|
||||||
|
SAVED_REQUIRED_SLASHES_REGEXP = new RegExp(SAVE_REQUIRED_SLASHES, 'g'),
|
||||||
|
|
||||||
|
|
||||||
|
captureVals = (regex, pattern) => {
|
||||||
|
var vals = [], match;
|
||||||
|
while (match = regex.exec(pattern)) {
|
||||||
|
vals.push(match[1]);
|
||||||
|
}
|
||||||
|
return vals;
|
||||||
|
},
|
||||||
|
|
||||||
|
tokenize = pattern => {
|
||||||
|
//save chars that shouldn't be escaped
|
||||||
|
return pattern.replace(OPTIONAL_SLASHES_REGEXP, '$1'+ SAVE_OPTIONAL_SLASHES +'$2')
|
||||||
|
.replace(REQUIRED_SLASHES_REGEXP, '$1'+ SAVE_REQUIRED_SLASHES +'$2')
|
||||||
|
.replace(OPTIONAL_PARAMS_REGEXP, SAVE_OPTIONAL_PARAMS)
|
||||||
|
.replace(REQUIRED_PARAMS_REGEXP, SAVE_REQUIRED_PARAMS);
|
||||||
|
},
|
||||||
|
|
||||||
|
untokenize = pattern => {
|
||||||
|
return pattern.replace(SAVED_OPTIONAL_SLASHES_REGEXP, '\\/?')
|
||||||
|
.replace(SAVED_REQUIRED_SLASHES_REGEXP, '\\/')
|
||||||
|
.replace(SAVED_OPTIONAL_REGEXP, '([^\\/]+)?/?')
|
||||||
|
.replace(SAVED_REQUIRED_REGEXP, '([^\\/]+)');
|
||||||
|
},
|
||||||
|
|
||||||
|
patternLexer = {
|
||||||
|
getParamIds : pattern => captureVals(PARAMS_REGEXP, pattern),
|
||||||
|
getOptionalParamsIds : pattern => captureVals(OPTIONAL_PARAMS_REGEXP, pattern),
|
||||||
|
getParamValues : (request, regexp, shouldTypecast) => {
|
||||||
|
var vals = regexp.exec(request);
|
||||||
|
if (vals) {
|
||||||
|
vals.shift();
|
||||||
|
if (shouldTypecast) {
|
||||||
|
vals = vals.map(v => typecastValue(v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return vals;
|
||||||
|
},
|
||||||
|
compilePattern : pattern => {
|
||||||
|
pattern = pattern || '';
|
||||||
|
if (pattern) {
|
||||||
|
pattern = untokenize(
|
||||||
|
tokenize(pattern.replace(UNNECESSARY_SLASHES_REGEXP, '')).replace(ESCAPE_CHARS_REGEXP, '\\$&')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return new RegExp('^'+ pattern + '/?$'); //trailing slash is optional
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
global.Crossroads = Crossroads;
|
||||||
|
|
||||||
|
})(this);
|
||||||
9
vendors/routes/crossroads.min.js
vendored
9
vendors/routes/crossroads.min.js
vendored
|
|
@ -4,11 +4,4 @@
|
||||||
Author: Miller Medeiros
|
Author: Miller Medeiros
|
||||||
Version: 0.7.1 - Build: 93 (2012/02/02 09:29 AM)
|
Version: 0.7.1 - Build: 93 (2012/02/02 09:29 AM)
|
||||||
*/
|
*/
|
||||||
(function(f){f(["signals"],function(g){function f(a,b){if(a.indexOf)return a.indexOf(b);else{for(var c=a.length;c--;)if(a[c]===b)return c;return-1}}function i(a,b){return"[object "+b+"]"===Object.prototype.toString.call(a)}function n(a){return a===null||a==="null"?null:a==="true"?!0:a==="false"?!1:a===m||a==="undefined"?m:a===""||isNaN(a)?a:parseFloat(a)}function k(){this._routes=[];this.bypassed=new g.Signal;this.routed=new g.Signal}function o(a,b,c,e){var d=i(a,"RegExp");this._router=e;this._pattern=
|
(e=>{function t(e){return null===e||"null"===e?null:"true"===e||"false"!==e&&(void 0===e||"undefined"===e?void 0:""===e||isNaN(e)?e:parseFloat(e))}class s{constructor(t,s,r,a){this.greedy=!1,this.rules=void 0;var i=t instanceof RegExp;this._router=a,this._pattern=t,this._paramsIds=i?null:c.getParamIds(this._pattern),this._optionalParamsIds=i?null:c.getOptionalParamsIds(this._pattern),this._matchRegexp=i?t:c.compilePattern(t),this.matched=new e.signals.Signal,s&&this.matched.add(s),this._priority=r||0}match(e){return this._matchRegexp.test(e)&&this._validateParams(e)}_validateParams(e){var t,s=this.rules,r=this._getParamsObject(e);for(t in s)if("normalize_"!==t&&s.hasOwnProperty(t)&&!this._isValidParam(e,t,r))return!1;return!0}_isValidParam(e,t,s){var r=this.rules[t],a=s[t],i=!1;return null==a&&this._optionalParamsIds&&-1!==this._optionalParamsIds.indexOf(t)?i=!0:r instanceof RegExp?i=r.test(a):Array.isArray(r)?i=-1!==r.indexOf(a):"function"==typeof r&&(i=r(a,e,s)),i}_getParamsObject(e){for(var s=this._router.shouldTypecast,r=c.getParamValues(e,this._matchRegexp,s),a={},i=r.length;i--;)a[i]=r[i],this._paramsIds&&(a[this._paramsIds[i]]=r[i]);return a.request_=s?t(e):e,a.vals_=r,a}_getParamsArray(e){var t=this.rules?this.rules.normalize_:null;return t&&"function"==typeof t?t(e,this._getParamsObject(e)):c.getParamValues(e,this._matchRegexp,this._router.shouldTypecast)}dispose(){this._router.removeRoute(this)}_destroy(){this.matched.dispose(),this.matched=this._pattern=this._matchRegexp=null}}const r=/[\\.+*?^$[\](){}\/'#]/g,a=/\/$/g,i=/([:}]|\w(?=\/))\/?(:)/g,_=/([:}])\/?(\{)/g,h=/\{([^}]+)\}/g,o=/:([^:]+):/g,l=/(?:\{|:)([^}:]+)(?:\}|:)/g,n=new RegExp("__CR_RP__","g"),u=new RegExp("__CR_OP__","g"),p=new RegExp("__CR_OS__","g"),g=new RegExp("__CR_RS__","g"),d=(e,t)=>{for(var s,r=[];s=e.exec(t);)r.push(s[1]);return r},c={getParamIds:e=>d(l,e),getOptionalParamsIds:e=>d(o,e),getParamValues:(e,s,r)=>{var a=s.exec(e);return a&&(a.shift(),r&&(a=a.map(e=>t(e)))),a},compilePattern:e=>((e=e||"")&&(e=(e=>e.replace(p,"\\/?").replace(g,"\\/").replace(u,"([^\\/]+)?/?").replace(n,"([^\\/]+)"))((e=>e.replace(i,"$1__CR_OS__$2").replace(_,"$1__CR_RS__$2").replace(o,"__CR_OP__").replace(h,"__CR_RP__"))(e.replace(a,"")).replace(r,"\\$&"))),new RegExp("^"+e+"/?$"))};e.Crossroads=class{constructor(){this._routes=[],this.bypassed=new signals.Signal,this.routed=new e.signals.Signal,this.shouldTypecast=!1}addRoute(e,t,r){var a=new s(e,t,r,this),i=this._routes,_=i.length;do{--_}while(i[_]&&a._priority<=i[_]._priority);return i.splice(_+1,0,a),a}removeRoute(e){var t=this._routes.indexOf(e);-1!==t&&this._routes.splice(t,1),e._destroy()}removeAllRoutes(){for(var e=this.getNumRoutes();e--;)this._routes[e]._destroy();this._routes.length=0}parse(e){e=e||"";var t,s=this._getMatchedRoutes(e),r=0,a=s.length;if(a)for(;r<a;)(t=s[r]).route.matched.dispatch.apply(t.route.matched,t.params),t.isFirst=!r,this.routed.dispatch(e,t),r+=1;else this.bypassed.dispatch(e)}getNumRoutes(){return this._routes.length}_getMatchedRoutes(e){for(var t,s=[],r=this._routes,a=r.length;t=r[--a];)s.length&&!t.greedy||!t.match(e)||s.push({route:t,params:t._getParamsArray(e)});return s}}})(this);
|
||||||
a;this._paramsIds=d?null:h.getParamIds(this._pattern);this._optionalParamsIds=d?null:h.getOptionalParamsIds(this._pattern);this._matchRegexp=d?a:h.compilePattern(a);this.matched=new g.Signal;b&&this.matched.add(b);this._priority=c||0}var j,h,m;k.prototype={normalizeFn:null,create:function(){return new k},shouldTypecast:!1,addRoute:function(a,b,c){a=new o(a,b,c,this);this._sortedInsert(a);return a},removeRoute:function(a){var b=f(this._routes,a);b!==-1&&this._routes.splice(b,1);a._destroy()},removeAllRoutes:function(){for(var a=
|
|
||||||
this.getNumRoutes();a--;)this._routes[a]._destroy();this._routes.length=0},parse:function(a){var a=a||"",b=this._getMatchedRoutes(a),c=0,e=b.length,d;if(e)for(;c<e;)d=b[c],d.route.matched.dispatch.apply(d.route.matched,d.params),d.isFirst=!c,this.routed.dispatch(a,d),c+=1;else this.bypassed.dispatch(a)},getNumRoutes:function(){return this._routes.length},_sortedInsert:function(a){var b=this._routes,c=b.length;do--c;while(b[c]&&a._priority<=b[c]._priority);b.splice(c+1,0,a)},_getMatchedRoutes:function(a){for(var b=
|
|
||||||
[],c=this._routes,e=c.length,d;d=c[--e];)(!b.length||d.greedy)&&d.match(a)&&b.push({route:d,params:d._getParamsArray(a)});return b},toString:function(){return"[crossroads numRoutes:"+this.getNumRoutes()+"]"}};j=new k;j.VERSION="0.7.1";o.prototype={greedy:!1,rules:void 0,match:function(a){return this._matchRegexp.test(a)&&this._validateParams(a)},_validateParams:function(a){var b=this.rules,c=this._getParamsObject(a),e;for(e in b)if(e!=="normalize_"&&b.hasOwnProperty(e)&&!this._isValidParam(a,e,c))return!1;
|
|
||||||
return!0},_isValidParam:function(a,b,c){var e=this.rules[b],d=c[b],l=!1;d==null&&this._optionalParamsIds&&f(this._optionalParamsIds,b)!==-1?l=!0:i(e,"RegExp")?l=e.test(d):i(e,"Array")?l=f(e,d)!==-1:i(e,"Function")&&(l=e(d,a,c));return l},_getParamsObject:function(a){for(var b=this._router.shouldTypecast,c=h.getParamValues(a,this._matchRegexp,b),e={},d=c.length;d--;)e[d]=c[d],this._paramsIds&&(e[this._paramsIds[d]]=c[d]);e.request_=b?n(a):a;e.vals_=c;return e},_getParamsArray:function(a){var b=this.rules?
|
|
||||||
this.rules.normalize_:null;return(b=b||this._router.normalizeFn)&&i(b,"Function")?b(a,this._getParamsObject(a)):h.getParamValues(a,this._matchRegexp,this._router.shouldTypecast)},dispose:function(){this._router.removeRoute(this)},_destroy:function(){this.matched.dispose();this.matched=this._pattern=this._matchRegexp=null},toString:function(){return'[Route pattern:"'+this._pattern+'", numListeners:'+this.matched.getNumListeners()+"]"}};h=j.patternLexer=function(){function a(a,b){for(var c=[],d;d=a.exec(b);)c.push(d[1]);
|
|
||||||
return c}var b=/[\\.+*?\^$\[\](){}\/'#]/g,c=/\/$/g,e=/([:}]|\w(?=\/))\/?(:)/g,d=/([:}])\/?(\{)/g,f=/\{([^}]+)\}/g,g=/:([^:]+):/g,h=/(?:\{|:)([^}:]+)(?:\}|:)/g,i=RegExp("__CR_RP__","g"),j=RegExp("__CR_OP__","g"),k=RegExp("__CR_OS__","g"),m=RegExp("__CR_RS__","g");return{getParamIds:function(b){return a(h,b)},getOptionalParamsIds:function(b){return a(g,b)},getParamValues:function(a,b,c){if(a=b.exec(a))if(a.shift(),c){c=a;a=c.length;for(b=[];a--;)b[a]=n(c[a]);a=b}return a},compilePattern:function(a){if(a=
|
|
||||||
a||"")a=a.replace(c,""),a=a.replace(e,"$1__CR_OS__$2"),a=a.replace(d,"$1__CR_RS__$2"),a=a.replace(g,"__CR_OP__"),a=a.replace(f,"__CR_RP__"),a=a.replace(b,"\\$&"),a=a.replace(k,"\\/?"),a=a.replace(m,"\\/"),a=a.replace(j,"([^\\/]+)?/?"),a=a.replace(i,"([^\\/]+)");return RegExp("^"+a+"/?$")}}}();return j})})(typeof define==="function"&&define.amd?define:function(f,g){typeof module!=="undefined"&&module.exports?module.exports=g(require(f[0])):window.crossroads=g(window[f[0]])});
|
|
||||||
|
|
|
||||||
168
vendors/routes/hasher.js
vendored
Normal file
168
vendors/routes/hasher.js
vendored
Normal file
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*!!
|
||||||
|
* Hasher <http://github.com/millermedeiros/hasher>
|
||||||
|
* @author Miller Medeiros
|
||||||
|
* @version 1.1.2 (2012/10/31 03:19 PM)
|
||||||
|
* Released under the MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
(global => {
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Private Vars
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
var
|
||||||
|
// local storage for brevity and better compression --------------------------------
|
||||||
|
|
||||||
|
Signal = signals.Signal,
|
||||||
|
|
||||||
|
// local vars ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
_hash,
|
||||||
|
_isActive,
|
||||||
|
_hashValRegexp = /#(.*)$/,
|
||||||
|
_hashRegexp = /^#/;
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Private Methods
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
const _trimHash = hash => {
|
||||||
|
if(! hash) return '';
|
||||||
|
var regexp = new RegExp('^\\/|\\$', 'g');
|
||||||
|
return hash.replace(regexp, '');
|
||||||
|
},
|
||||||
|
_getWindowHash = () => {
|
||||||
|
//parsed full URL instead of getting window.location.hash because Firefox decode hash value (and all the other browsers don't)
|
||||||
|
//also because of IE8 bug with hash query in local file [issue #6]
|
||||||
|
var result = _hashValRegexp.exec( global.location.href );
|
||||||
|
return (result && result[1])? decodeURIComponent(result[1]) : '';
|
||||||
|
},
|
||||||
|
_registerChange = newHash => {
|
||||||
|
if(_hash !== newHash){
|
||||||
|
var oldHash = _hash;
|
||||||
|
_hash = newHash; //should come before event dispatch to make sure user can get proper value inside event handler
|
||||||
|
hasher.changed.dispatch(_trimHash(newHash), _trimHash(oldHash));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_checkHistory = () => {
|
||||||
|
var windowHash = _getWindowHash();
|
||||||
|
if (windowHash !== _hash){
|
||||||
|
_registerChange(windowHash);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_makePath = path => {
|
||||||
|
path = path.join('/');
|
||||||
|
return path ? '/' + path.replace(_hashRegexp, '') : path;
|
||||||
|
},
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Public (API)
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
hasher = /** @lends hasher */ {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal dispatched when hash value changes.
|
||||||
|
* - pass current hash as 1st parameter to listeners and previous hash value as 2nd parameter.
|
||||||
|
* @type signals.Signal
|
||||||
|
*/
|
||||||
|
changed : new Signal(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal dispatched when hasher is initialized.
|
||||||
|
* - pass current hash as first parameter to listeners.
|
||||||
|
* @type signals.Signal
|
||||||
|
*/
|
||||||
|
initialized : new Signal(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start listening/dispatching changes in the hash/history.
|
||||||
|
* <ul>
|
||||||
|
* <li>hasher won't dispatch CHANGE events by manually typing a new value or pressing the back/forward buttons before calling this method.</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
init : () => {
|
||||||
|
if (!_isActive) {
|
||||||
|
|
||||||
|
_hash = _getWindowHash();
|
||||||
|
|
||||||
|
//thought about branching/overloading hasher.init() to avoid checking multiple times but
|
||||||
|
//don't think worth doing it since it probably won't be called multiple times.
|
||||||
|
global.addEventListener('hashchange', _checkHistory);
|
||||||
|
|
||||||
|
_isActive = true;
|
||||||
|
hasher.initialized.dispatch(_trimHash(_hash));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop listening/dispatching changes in the hash/history.
|
||||||
|
* <ul>
|
||||||
|
* <li>hasher won't dispatch CHANGE events by manually typing a new value or pressing the back/forward buttons after calling this method, unless you call hasher.init() again.</li>
|
||||||
|
* <li>hasher will still dispatch changes made programatically by calling hasher.setHash();</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
stop : () => {
|
||||||
|
if (_isActive) {
|
||||||
|
global.removeEventListener('hashchange', _checkHistory);
|
||||||
|
|
||||||
|
_isActive = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Hash value, generating a new history record.
|
||||||
|
* @param {...string} path Hash value without '#'.
|
||||||
|
* @example hasher.setHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor'
|
||||||
|
*/
|
||||||
|
setHash : (...path) => {
|
||||||
|
path = _makePath(path);
|
||||||
|
if(path !== _hash){
|
||||||
|
// we should store raw value
|
||||||
|
_registerChange(path);
|
||||||
|
if (path === _hash) {
|
||||||
|
// we check if path is still === _hash to avoid error in
|
||||||
|
// case of multiple consecutive redirects [issue #39]
|
||||||
|
global.location.hash = '#' + encodeURI(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Hash value without keeping previous hash on the history record.
|
||||||
|
* Similar to calling `window.location.replace("#/hash")` but will also work on IE6-7.
|
||||||
|
* @param {...string} path Hash value without '#'.
|
||||||
|
* @example hasher.replaceHash('lorem', 'ipsum', 'dolor') -> '#/lorem/ipsum/dolor'
|
||||||
|
*/
|
||||||
|
replaceHash : (...path) => {
|
||||||
|
path = _makePath(path);
|
||||||
|
if(path !== _hash){
|
||||||
|
// we should store raw value
|
||||||
|
_registerChange(path, true);
|
||||||
|
if (path === _hash) {
|
||||||
|
// we check if path is still === _hash to avoid error in
|
||||||
|
// case of multiple consecutive redirects [issue #39]
|
||||||
|
global.location.replace('#' + encodeURI(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all event listeners, stops hasher and destroy hasher object.
|
||||||
|
* - IMPORTANT: hasher won't work after calling this method, hasher Object will be deleted.
|
||||||
|
*/
|
||||||
|
dispose : () => {
|
||||||
|
hasher.stop();
|
||||||
|
hasher.initialized.dispose();
|
||||||
|
hasher.changed.dispose();
|
||||||
|
global.hasher = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
hasher.initialized.memorize = true; //see #33
|
||||||
|
|
||||||
|
global.hasher = hasher;
|
||||||
|
|
||||||
|
})(this);
|
||||||
2
vendors/routes/hasher.min.js
vendored
2
vendors/routes/hasher.min.js
vendored
|
|
@ -4,4 +4,4 @@
|
||||||
* @version 1.1.2 (2012/10/31 03:19 PM)
|
* @version 1.1.2 (2012/10/31 03:19 PM)
|
||||||
* Released under the MIT License
|
* Released under the MIT License
|
||||||
*/
|
*/
|
||||||
(function(a){a("hasher",["signals"],function(b){var c=(function(k){var o=25,q=k.document,n=k.history,w=b.Signal,f,u,m,E,d,C,s=/#(.*)$/,j=/(\?.*)|(\#.*)/,g=/^\#/,i=(!+"\v1"),A=("onhashchange" in k)&&q.documentMode!==7,e=i&&!A,r=(location.protocol==="file:");function t(G){if(!G){return""}var F=new RegExp("^\\"+f.prependHash+"|\\"+f.appendHash+"$","g");return G.replace(F,"")}function D(){var F=s.exec(f.getURL());return(F&&F[1])?decodeURIComponent(F[1]):""}function z(){return(d)?d.contentWindow.frameHash:null}function y(){d=q.createElement("iframe");d.src="about:blank";d.style.display="none";q.body.appendChild(d)}function h(){if(d&&u!==z()){var F=d.contentWindow.document;F.open();F.write("<html><head><title>"+q.title+'</title><script type="text/javascript">var frameHash="'+u+'";<\/script></head><body> </body></html>');F.close()}}function l(F,G){if(u!==F){var H=u;u=F;if(e){if(!G){h()}else{d.contentWindow.frameHash=F}}f.changed.dispatch(t(F),t(H))}}if(e){C=function(){var G=D(),F=z();if(F!==u&&F!==G){f.setHash(t(F))}else{if(G!==u){l(G)}}}}else{C=function(){var F=D();if(F!==u){l(F)}}}function B(H,F,G){if(H.addEventListener){H.addEventListener(F,G,false)}else{if(H.attachEvent){H.attachEvent("on"+F,G)}}}function x(H,F,G){if(H.removeEventListener){H.removeEventListener(F,G,false)}else{if(H.detachEvent){H.detachEvent("on"+F,G)}}}function p(G){G=Array.prototype.slice.call(arguments);var F=G.join(f.separator);F=F?f.prependHash+F.replace(g,"")+f.appendHash:F;return F}function v(F){F=encodeURI(F);if(i&&r){F=F.replace(/\?/,"%3F")}return F}f={VERSION:"1.1.2",appendHash:"",prependHash:"/",separator:"/",changed:new w(),stopped:new w(),initialized:new w(),init:function(){if(E){return}u=D();if(A){B(k,"hashchange",C)}else{if(e){if(!d){y()}h()}m=setInterval(C,o)}E=true;f.initialized.dispatch(t(u))},stop:function(){if(!E){return}if(A){x(k,"hashchange",C)}else{clearInterval(m);m=null}E=false;f.stopped.dispatch(t(u))},isActive:function(){return E},getURL:function(){return k.location.href},getBaseURL:function(){return f.getURL().replace(j,"")},setHash:function(F){F=p.apply(null,arguments);if(F!==u){l(F);if(F===u){k.location.hash="#"+v(F)}}},replaceHash:function(F){F=p.apply(null,arguments);if(F!==u){l(F,true);if(F===u){k.location.replace("#"+v(F))}}},getHash:function(){return t(u)},getHashAsArray:function(){return f.getHash().split(f.separator)},dispose:function(){f.stop();f.initialized.dispose();f.stopped.dispose();f.changed.dispose();d=f=k.hasher=null},toString:function(){return'[hasher version="'+f.VERSION+'" hash="'+f.getHash()+'"]'}};f.initialized.memorize=true;return f}(window));return c})}(typeof define==="function"&&define.amd?define:function(c,b,a){window[c]=a(window[b[0]])}));
|
(e=>{var i,a,n=signals.Signal,s=/#(.*)$/,t=/^#/;const r=e=>{if(!e)return"";var i=new RegExp("^\\/|\\$","g");return e.replace(i,"")},h=()=>{var i=s.exec(e.location.href);return i&&i[1]?decodeURIComponent(i[1]):""},o=e=>{if(i!==e){var a=i;i=e,l.changed.dispatch(r(e),r(a))}},c=()=>{var e=h();e!==i&&o(e)},d=e=>(e=e.join("/"))?"/"+e.replace(t,""):e,l={changed:new n,initialized:new n,init:()=>{a||(i=h(),e.addEventListener("hashchange",c),a=!0,l.initialized.dispatch(r(i)))},stop:()=>{a&&(e.removeEventListener("hashchange",c),a=!1)},setHash:(...a)=>{(a=d(a))!==i&&(o(a),a===i&&(e.location.hash="#"+encodeURI(a)))},replaceHash:(...a)=>{(a=d(a))!==i&&(o(a),a===i&&e.location.replace("#"+encodeURI(a)))},dispose:()=>{l.stop(),l.initialized.dispose(),l.changed.dispose(),e.hasher=null}};l.initialized.memorize=!0,e.hasher=l})(this);
|
||||||
|
|
|
||||||
326
vendors/routes/signals.js
vendored
Normal file
326
vendors/routes/signals.js
vendored
Normal file
|
|
@ -0,0 +1,326 @@
|
||||||
|
/** @license
|
||||||
|
* JS Signals <http://millermedeiros.github.com/js-signals/>
|
||||||
|
* Released under the MIT license
|
||||||
|
* Author: Miller Medeiros
|
||||||
|
* Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)
|
||||||
|
*/
|
||||||
|
|
||||||
|
(global=>{
|
||||||
|
|
||||||
|
// SignalBinding -------------------------------------------------
|
||||||
|
//================================================================
|
||||||
|
|
||||||
|
class SignalBinding {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object that represents a binding between a Signal and a listener function.
|
||||||
|
* <br />- <strong>This is an internal constructor and shouldn't be called by regular users.</strong>
|
||||||
|
* <br />- inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.
|
||||||
|
* @author Miller Medeiros
|
||||||
|
* @constructor
|
||||||
|
* @internal
|
||||||
|
* @name SignalBinding
|
||||||
|
* @param {Signal} signal Reference to Signal object that listener is currently bound to.
|
||||||
|
* @param {Function} listener Handler function bound to the signal.
|
||||||
|
* @param {boolean} isOnce If binding should be executed just once.
|
||||||
|
* @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
||||||
|
* @param {Number} [priority] The priority level of the event listener. (default = 0).
|
||||||
|
*/
|
||||||
|
constructor (signal, listener, isOnce, listenerContext, priority) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If binding is active and should be executed.
|
||||||
|
* @type boolean
|
||||||
|
*/
|
||||||
|
this.active = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default parameters passed to listener during `Signal.dispatch` and `SignalBinding.execute`. (curried parameters)
|
||||||
|
* @type Array|null
|
||||||
|
*/
|
||||||
|
this.params = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler function bound to the signal.
|
||||||
|
* @type Function
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._listener = listener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If binding should be executed just once.
|
||||||
|
* @type boolean
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._isOnce = isOnce;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
||||||
|
* @memberOf SignalBinding.prototype
|
||||||
|
* @name context
|
||||||
|
* @type Object|undefined|null
|
||||||
|
*/
|
||||||
|
this.context = listenerContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reference to Signal object that listener is currently bound to.
|
||||||
|
* @type Signal
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._signal = signal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener priority
|
||||||
|
* @type Number
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._priority = priority || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call listener passing arbitrary parameters.
|
||||||
|
* <p>If binding was added using `Signal.addOnce()` it will be automatically removed from signal dispatch queue, this method is used internally for the signal dispatch.</p>
|
||||||
|
* @param {Array} [paramsArr] Array of parameters that should be passed to the listener
|
||||||
|
* @return {*} Value returned by the listener.
|
||||||
|
*/
|
||||||
|
execute (paramsArr) {
|
||||||
|
var handlerReturn, params;
|
||||||
|
if (this.active && !!this._listener) {
|
||||||
|
params = this.params? this.params.concat(paramsArr) : paramsArr;
|
||||||
|
handlerReturn = this._listener.apply(this.context, params);
|
||||||
|
if (this._isOnce) {
|
||||||
|
this.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return handlerReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detach binding from signal.
|
||||||
|
* - alias to: mySignal.remove(myBinding.getListener());
|
||||||
|
* @return {Function|null} Handler function bound to the signal or `null` if binding was previously detached.
|
||||||
|
*/
|
||||||
|
detach () {
|
||||||
|
return this.isBound()? this._signal.remove(this._listener, this.context) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Boolean} `true` if binding is still bound to the signal and have a listener.
|
||||||
|
*/
|
||||||
|
isBound () {
|
||||||
|
return (!!this._signal && !!this._listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {boolean} If SignalBinding will only be executed once.
|
||||||
|
*/
|
||||||
|
isOnce () {
|
||||||
|
return this._isOnce;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Function} Handler function bound to the signal.
|
||||||
|
*/
|
||||||
|
getListener () {
|
||||||
|
return this._listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Signal} Signal that listener is currently bound to.
|
||||||
|
*/
|
||||||
|
getSignal () {
|
||||||
|
return this._signal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete instance properties
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_destroy () {
|
||||||
|
delete this._signal;
|
||||||
|
delete this._listener;
|
||||||
|
delete this.context;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Signal --------------------------------------------------------
|
||||||
|
//================================================================
|
||||||
|
|
||||||
|
function validateListener(listener, fnName) {
|
||||||
|
if (typeof listener !== 'function') {
|
||||||
|
throw new Error( 'listener is a required param of {fn}() and should be a Function.'.replace('{fn}', fnName) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Signal {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom event broadcaster
|
||||||
|
* <br />- inspired by Robert Penner's AS3 Signals.
|
||||||
|
* @name Signal
|
||||||
|
* @author Miller Medeiros
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
constructor () {
|
||||||
|
/**
|
||||||
|
* If Signal should keep record of previously dispatched parameters and
|
||||||
|
* automatically execute listener during `add()`/`addOnce()` if Signal was
|
||||||
|
* already dispatched before.
|
||||||
|
* @type boolean
|
||||||
|
*/
|
||||||
|
this.memorize = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If Signal is active and should broadcast events.
|
||||||
|
* <p><strong>IMPORTANT:</strong> Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
|
||||||
|
* @type boolean
|
||||||
|
*/
|
||||||
|
this.active = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type Array.<SignalBinding>
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
this._bindings = [];
|
||||||
|
this._prevParams = null;
|
||||||
|
|
||||||
|
// enforce dispatch to aways work on same context (#47)
|
||||||
|
var self = this;
|
||||||
|
this.dispatch = (...args) => Signal.prototype.dispatch.apply(self, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Function} listener
|
||||||
|
* @return {number}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_indexOfListener (listener, context) {
|
||||||
|
var n = this._bindings.length,
|
||||||
|
cur;
|
||||||
|
while (n--) {
|
||||||
|
cur = this._bindings[n];
|
||||||
|
if (cur._listener === listener && cur.context === context) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a listener to the signal.
|
||||||
|
* @param {Function} listener Signal handler function.
|
||||||
|
* @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
||||||
|
* @param {Number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
|
||||||
|
* @return {SignalBinding} An Object representing the binding between the Signal and listener.
|
||||||
|
*/
|
||||||
|
add (listener, listenerContext, priority) {
|
||||||
|
validateListener(listener, 'add');
|
||||||
|
|
||||||
|
var prevIndex = this._indexOfListener(listener, listenerContext),
|
||||||
|
binding;
|
||||||
|
|
||||||
|
if (prevIndex !== -1) {
|
||||||
|
binding = this._bindings[prevIndex];
|
||||||
|
if (binding.isOnce() !== false) {
|
||||||
|
throw new Error('You cannot addOnce() then add() the same listener without removing the relationship first.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding = new SignalBinding(this, listener, false, listenerContext, priority);
|
||||||
|
//simplified insertion sort
|
||||||
|
var n = this._bindings.length;
|
||||||
|
do { --n; } while (this._bindings[n] && binding._priority <= this._bindings[n]._priority);
|
||||||
|
this._bindings.splice(n + 1, 0, binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.memorize && this._prevParams){
|
||||||
|
binding.execute(this._prevParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
return binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a single listener from the dispatch queue.
|
||||||
|
* @param {Function} listener Handler function that should be removed.
|
||||||
|
* @param {Object} [context] Execution context (since you can add the same handler multiple times if executing in a different context).
|
||||||
|
* @return {Function} Listener handler function.
|
||||||
|
*/
|
||||||
|
remove (listener, context) {
|
||||||
|
validateListener(listener, 'remove');
|
||||||
|
|
||||||
|
var i = this._indexOfListener(listener, context);
|
||||||
|
if (i !== -1) {
|
||||||
|
this._bindings[i]._destroy(); //no reason to a SignalBinding exist if it isn't attached to a signal
|
||||||
|
this._bindings.splice(i, 1);
|
||||||
|
}
|
||||||
|
return listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all listeners from the Signal.
|
||||||
|
*/
|
||||||
|
removeAll () {
|
||||||
|
var n = this._bindings.length;
|
||||||
|
while (n--) {
|
||||||
|
this._bindings[n]._destroy();
|
||||||
|
}
|
||||||
|
this._bindings.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch/Broadcast Signal to all listeners added to the queue.
|
||||||
|
* @param {...*} [params] Parameters that should be passed to each handler.
|
||||||
|
*/
|
||||||
|
dispatch (...paramsArr) {
|
||||||
|
if (! this.active) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var n = this._bindings.length,
|
||||||
|
bindings;
|
||||||
|
|
||||||
|
if (this.memorize) {
|
||||||
|
this._prevParams = paramsArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! n) {
|
||||||
|
//should come after memorize
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bindings = this._bindings.slice(); //clone array in case add/remove items during dispatch
|
||||||
|
|
||||||
|
//execute all callbacks until end of the list or until a callback returns `false` or stops propagation
|
||||||
|
//reverse loop since listeners with higher priority will be added at the end of the list
|
||||||
|
do { n--; } while (bindings[n] && bindings[n].execute(paramsArr) !== false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).
|
||||||
|
* <p><strong>IMPORTANT:</strong> calling any method on the signal instance after calling dispose will throw errors.</p>
|
||||||
|
*/
|
||||||
|
dispose () {
|
||||||
|
this.removeAll();
|
||||||
|
delete this._bindings;
|
||||||
|
delete this._prevParams;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Namespace -----------------------------------------------------
|
||||||
|
//================================================================
|
||||||
|
|
||||||
|
var signals = Signal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom event broadcaster
|
||||||
|
* @see Signal
|
||||||
|
*/
|
||||||
|
// alias for backwards compatibility (see #gh-44)
|
||||||
|
signals.Signal = Signal;
|
||||||
|
|
||||||
|
global.signals = signals;
|
||||||
|
|
||||||
|
})(this);
|
||||||
8
vendors/routes/signals.min.js
vendored
8
vendors/routes/signals.min.js
vendored
|
|
@ -4,10 +4,4 @@
|
||||||
Author: Miller Medeiros
|
Author: Miller Medeiros
|
||||||
Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)
|
Version: 1.0.0 - Build: 268 (2012/11/29 05:48 PM)
|
||||||
*/
|
*/
|
||||||
(function(i){function h(a,b,c,d,e){this._listener=b;this._isOnce=c;this.context=d;this._signal=a;this._priority=e||0}function g(a,b){if(typeof a!=="function")throw Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b));}function e(){this._bindings=[];this._prevParams=null;var a=this;this.dispatch=function(){e.prototype.dispatch.apply(a,arguments)}}h.prototype={active:!0,params:null,execute:function(a){var b;this.active&&this._listener&&(a=this.params?this.params.concat(a):
|
(i=>{class t{constructor(i,t,e,s,n){this.active=!0,this.params=null,this._listener=t,this._isOnce=e,this.context=s,this._signal=i,this._priority=n||0}execute(i){var t,e;return this.active&&this._listener&&(e=this.params?this.params.concat(i):i,t=this._listener.apply(this.context,e),this._isOnce&&this.detach()),t}detach(){return this.isBound()?this._signal.remove(this._listener,this.context):null}isBound(){return!!this._signal&&!!this._listener}isOnce(){return this._isOnce}getListener(){return this._listener}getSignal(){return this._signal}_destroy(){delete this._signal,delete this._listener,delete this.context}}function e(i,t){if("function"!=typeof i)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",t))}class s{constructor(){this.memorize=!1,this.active=!0,this._bindings=[],this._prevParams=null;var i=this;this.dispatch=((...t)=>s.prototype.dispatch.apply(i,t))}_indexOfListener(i,t){for(var e,s=this._bindings.length;s--;)if((e=this._bindings[s])._listener===i&&e.context===t)return s;return-1}add(i,s,n){e(i,"add");var r,h=this._indexOfListener(i,s);if(-1!==h){if(!1!==(r=this._bindings[h]).isOnce())throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.")}else{r=new t(this,i,!1,s,n);var a=this._bindings.length;do{--a}while(this._bindings[a]&&r._priority<=this._bindings[a]._priority);this._bindings.splice(a+1,0,r)}return this.memorize&&this._prevParams&&r.execute(this._prevParams),r}remove(i,t){e(i,"remove");var s=this._indexOfListener(i,t);return-1!==s&&(this._bindings[s]._destroy(),this._bindings.splice(s,1)),i}removeAll(){for(var i=this._bindings.length;i--;)this._bindings[i]._destroy();this._bindings.length=0}dispatch(...i){if(this.active){var t,e=this._bindings.length;if(this.memorize&&(this._prevParams=i),e){t=this._bindings.slice();do{e--}while(t[e]&&!1!==t[e].execute(i))}}}dispose(){this.removeAll(),delete this._bindings,delete this._prevParams}}var n=s;n.Signal=s,i.signals=n})(this);
|
||||||
a,b=this._listener.apply(this.context,a),this._isOnce&&this.detach());return b},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal;delete this._listener;delete this.context},toString:function(){return"[SignalBinding isOnce:"+this._isOnce+
|
|
||||||
", isBound:"+this.isBound()+", active:"+this.active+"]"}};e.prototype={VERSION:"1.0.0",memorize:!1,_shouldPropagate:!0,active:!0,_registerListener:function(a,b,c,d){var e=this._indexOfListener(a,c);if(e!==-1){if(a=this._bindings[e],a.isOnce()!==b)throw Error("You cannot add"+(b?"":"Once")+"() then add"+(!b?"":"Once")+"() the same listener without removing the relationship first.");}else a=new h(this,a,b,c,d),this._addBinding(a);this.memorize&&this._prevParams&&a.execute(this._prevParams);return a},
|
|
||||||
_addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(var c=this._bindings.length,d;c--;)if(d=this._bindings[c],d._listener===a&&d.context===b)return c;return-1},has:function(a,b){return this._indexOfListener(a,b)!==-1},add:function(a,b,c){g(a,"add");return this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){g(a,"addOnce");return this._registerListener(a,
|
|
||||||
!0,b,c)},remove:function(a,b){g(a,"remove");var c=this._indexOfListener(a,b);c!==-1&&(this._bindings[c]._destroy(),this._bindings.splice(c,1));return a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(a){if(this.active){var b=Array.prototype.slice.call(arguments),c=this._bindings.length,d;if(this.memorize)this._prevParams=
|
|
||||||
b;if(c){d=this._bindings.slice();this._shouldPropagate=!0;do c--;while(d[c]&&this._shouldPropagate&&d[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};var f=e;f.Signal=e;typeof define==="function"&&define.amd?define(function(){return f}):typeof module!=="undefined"&&module.exports?module.exports=f:i.signals=
|
|
||||||
f})(this);
|
|
||||||
|
|
|
||||||
|
|
@ -114,13 +114,6 @@ module.exports = function(publicPath, pro, mode) {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
'window': 'window',
|
|
||||||
'crossroads': 'window.crossroads',
|
|
||||||
'hasher': 'window.hasher',
|
|
||||||
'Jua': 'window.Jua',
|
|
||||||
'ssm': 'window.ssm',
|
|
||||||
'key': 'window.key',
|
|
||||||
'$': 'window.jQuery'
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue