snappymail/dev/bootstrap.js

79 lines
1.6 KiB
JavaScript
Raw Normal View History

2014-08-22 23:08:56 +08:00
2014-09-05 06:49:03 +08:00
(function () {
2014-08-25 23:49:01 +08:00
'use strict';
2014-08-22 23:08:56 +08:00
2014-08-25 15:10:51 +08:00
module.exports = function (App) {
2014-08-22 23:08:56 +08:00
2014-08-26 23:24:47 +08:00
var
window = require('window'),
_ = require('_'),
$ = require('$'),
2014-09-05 06:49:03 +08:00
Globals = require('Common/Globals'),
Plugins = require('Common/Plugins'),
Utils = require('Common/Utils'),
Enums = require('Common/Enums'),
2014-08-26 23:24:47 +08:00
EmailModel = require('Model/Email')
2014-08-26 23:24:47 +08:00
;
Globals.__APP__ = App;
2014-08-22 23:08:56 +08:00
Globals.$win
.keydown(Utils.killCtrlAandS)
.keyup(Utils.killCtrlAandS)
.unload(function () {
Globals.bUnload = true;
})
;
2014-08-22 23:08:56 +08:00
Globals.$html
.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile')
.on('click.dropdown.data-api', function () {
Utils.detectDropdownVisibility();
})
;
2014-08-22 23:08:56 +08:00
// export
window['rl'] = window['rl'] || {};
window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins);
window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins);
window['rl']['remoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
2014-08-22 23:08:56 +08:00
window['rl']['createCommand'] = Utils.createCommand;
2014-08-26 23:24:47 +08:00
window['rl']['EmailModel'] = EmailModel;
window['rl']['Enums'] = Enums;
2014-08-22 23:08:56 +08:00
2014-08-26 23:24:47 +08:00
window['__APP_BOOT'] = function (fCall) {
2014-08-22 23:08:56 +08:00
$(function () {
if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
{
$('#rl-templates').html(window['rainloopTEMPLATES'][0]);
_.delay(function () {
2014-08-25 15:10:51 +08:00
App.bootstart();
2014-10-29 06:05:50 +08:00
Globals.$html
.removeClass('no-js rl-booted-trigger')
.addClass('rl-booted')
;
2014-08-22 23:08:56 +08:00
2014-08-27 23:59:44 +08:00
}, 10);
2014-08-22 23:08:56 +08:00
}
else
{
fCall(false);
}
2014-08-26 23:24:47 +08:00
window['__APP_BOOT'] = null;
2014-08-22 23:08:56 +08:00
});
};
};
2014-09-05 06:49:03 +08:00
}());