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
|
|
|
|
2014-08-27 23:59:44 +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
|
|
|
|
2014-08-25 15:10:51 +08:00
|
|
|
Plugins.__boot = App;
|
|
|
|
Plugins.__remote = App.remote();
|
|
|
|
Plugins.__data = App.data();
|
2014-08-22 23:08:56 +08:00
|
|
|
|
2014-09-02 00:05:32 +08:00
|
|
|
Globals.$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
|
2014-08-22 23:08:56 +08:00
|
|
|
|
2014-09-02 00:05:32 +08:00
|
|
|
Globals.$win.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
|
2014-09-02 08:15:31 +08:00
|
|
|
|
2014-09-02 00:05:32 +08:00
|
|
|
Globals.$win.unload(function () {
|
2014-08-22 23:08:56 +08:00
|
|
|
Globals.bUnload = true;
|
|
|
|
});
|
|
|
|
|
2014-09-02 00:05:32 +08:00
|
|
|
Globals.$html.on('click.dropdown.data-api', function () {
|
2014-08-22 23:08:56 +08:00
|
|
|
Utils.detectDropdownVisibility();
|
|
|
|
});
|
|
|
|
|
|
|
|
// export
|
|
|
|
window['rl'] = window['rl'] || {};
|
2014-09-02 08:15:31 +08:00
|
|
|
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
|
|
|
|
|
|
|
// boot
|
|
|
|
$(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-09-02 00:05:32 +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
|
|
|
}());
|