2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
import window from 'window';
|
2016-08-30 06:10:24 +08:00
|
|
|
import {killCtrlACtrlS, detectDropdownVisibility, createCommandLegacy, domReady} from 'Common/Utils';
|
2016-06-07 05:57:52 +08:00
|
|
|
import {$win, $html, data as GlobalsData, bMobileDevice} from 'Common/Globals';
|
2016-06-16 07:36:44 +08:00
|
|
|
import * as Enums from 'Common/Enums';
|
|
|
|
import * as Plugins from 'Common/Plugins';
|
2016-06-17 07:23:49 +08:00
|
|
|
import {i18n} from 'Common/Translator';
|
2016-07-07 05:03:30 +08:00
|
|
|
import {EmailModel} from 'Model/Email';
|
2016-06-07 05:57:52 +08:00
|
|
|
|
2015-11-19 01:32:29 +08:00
|
|
|
export default (App) => {
|
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
GlobalsData.__APP__ = App;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
$win
|
2016-07-16 05:29:42 +08:00
|
|
|
.on('keydown', killCtrlACtrlS)
|
2016-06-07 05:57:52 +08:00
|
|
|
.on('unload', () => {
|
|
|
|
GlobalsData.bUnload = true;
|
2016-06-30 08:02:45 +08:00
|
|
|
});
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
$html
|
|
|
|
.addClass(bMobileDevice ? 'mobile' : 'no-mobile')
|
2016-08-30 06:10:24 +08:00
|
|
|
.on('click.dropdown.data-api', detectDropdownVisibility);
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
const rl = window.rl || {};
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-17 07:23:49 +08:00
|
|
|
rl.i18n = i18n;
|
2016-08-17 06:01:20 +08:00
|
|
|
rl.createCommand = createCommandLegacy;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-16 07:36:44 +08:00
|
|
|
rl.addSettingsViewModel = Plugins.addSettingsViewModel;
|
|
|
|
rl.addSettingsViewModelForAdmin = Plugins.addSettingsViewModelForAdmin;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-16 07:36:44 +08:00
|
|
|
rl.addHook = Plugins.addHook;
|
|
|
|
rl.settingsGet = Plugins.mainSettingsGet;
|
|
|
|
rl.pluginSettingsGet = Plugins.settingsGet;
|
|
|
|
rl.pluginRemoteRequest = Plugins.remoteRequest;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
rl.EmailModel = EmailModel;
|
|
|
|
rl.Enums = Enums;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
window.rl = rl;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
window.__APP_BOOT = (fErrorCallback) => {
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-08-30 06:10:24 +08:00
|
|
|
domReady(() => {
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-16 07:36:44 +08:00
|
|
|
window.setTimeout(() => {
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
if (window.rainloopTEMPLATES && window.rainloopTEMPLATES[0])
|
|
|
|
{
|
2016-08-30 06:10:24 +08:00
|
|
|
window.document.getElementById('rl-templates').innerHTML = window.rainloopTEMPLATES[0];
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-16 07:36:44 +08:00
|
|
|
window.setTimeout(() => {
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
$html
|
|
|
|
.removeClass('no-js rl-booted-trigger')
|
2016-06-30 08:02:45 +08:00
|
|
|
.addClass('rl-booted');
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-16 07:36:44 +08:00
|
|
|
App.bootstart();
|
|
|
|
|
2016-08-24 06:17:50 +08:00
|
|
|
}, Enums.Magics.Time10ms);
|
2016-06-07 05:57:52 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fErrorCallback();
|
|
|
|
}
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
window.__APP_BOOT = null;
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-08-24 06:17:50 +08:00
|
|
|
}, Enums.Magics.Time10ms);
|
2015-11-19 01:32:29 +08:00
|
|
|
|
2016-06-07 05:57:52 +08:00
|
|
|
});
|
2015-11-19 01:32:29 +08:00
|
|
|
};
|
2016-04-21 01:12:51 +08:00
|
|
|
};
|