Added async script loader

This commit is contained in:
RainLoop Team 2014-08-14 13:26:58 +04:00
parent 9a30680748
commit 25cf891037
23 changed files with 1200 additions and 342 deletions

View file

@ -119,9 +119,6 @@ Globals.oHtmlEditorDefaultConfig = {
'allowedContent': true,
'autoParagraph': false,
'enterMode': window.CKEDITOR.ENTER_BR,
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
'font_defaultLabel': 'Arial',
'fontSize_defaultLabel': '13',
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'

View file

@ -17,9 +17,9 @@ function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
self.$element = $(oElement);
self.init();
self.resize = _.throttle(_.bind(self.resize, self), 100);
self.init();
}
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
@ -150,60 +150,77 @@ NewHtmlEditorWrapper.prototype.init = function ()
{
var
self = this,
oConfig = Globals.oHtmlEditorDefaultConfig,
sLanguage = RL.settingsGet('Language'),
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
fInit = function () {
var
oConfig = Globals.oHtmlEditorDefaultConfig,
sLanguage = RL.settingsGet('Language'),
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
;
if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)
{
oConfig.toolbarGroups.__SourceInited = true;
oConfig.toolbarGroups.push({name: 'document', groups: ['mode', 'document', 'doctools']});
}
oConfig.enterMode = window.CKEDITOR.ENTER_BR;
oConfig.shiftEnterMode = window.CKEDITOR.ENTER_BR;
oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
if (window.CKEDITOR.env)
{
window.CKEDITOR.env.isCompatible = true;
}
self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
self.editor.on('key', function(oEvent) {
if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
{
return false;
}
});
self.editor.on('blur', function() {
self.blurTrigger();
});
self.editor.on('mode', function() {
self.blurTrigger();
if (self.fOnModeChange)
{
self.fOnModeChange('plain' !== self.editor.mode);
}
});
self.editor.on('focus', function() {
self.focusTrigger();
});
if (self.fOnReady)
{
self.editor.on('instanceReady', function () {
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
self.fOnReady();
self.__resizable = true;
self.resize();
});
}
}
;
if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)
if (window.CKEDITOR)
{
oConfig.toolbarGroups.__SourceInited = true;
oConfig.toolbarGroups.push({name: 'document', groups: ['mode', 'document', 'doctools']});
fInit();
}
oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
if (window.CKEDITOR.env)
else
{
window.CKEDITOR.env.isCompatible = true;
}
self.editor = window.CKEDITOR.appendTo(self.$element[0], oConfig);
self.editor.on('key', function(oEvent) {
if (oEvent && oEvent.data && 9 /* Tab */ === oEvent.data.keyCode)
{
return false;
}
});
self.editor.on('blur', function() {
self.blurTrigger();
});
self.editor.on('mode', function() {
self.blurTrigger();
if (self.fOnModeChange)
{
self.fOnModeChange('plain' !== self.editor.mode);
}
});
self.editor.on('focus', function() {
self.focusTrigger();
});
if (self.fOnReady)
{
self.editor.on('instanceReady', function () {
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
self.fOnReady();
self.__resizable = true;
self.resize();
});
window.__initEditor = fInit;
}
}
};

View file

@ -1,3 +0,0 @@
if (window.SimplePace) {
window.SimplePace.add(10);
}

View file

@ -1,3 +0,0 @@
if (window.SimplePace) {
window.SimplePace.add(10);
}

View file

@ -1,3 +0,0 @@
if (window.SimplePace) {
window.SimplePace.add(20);
}