Code refactoring

This commit is contained in:
RainLoop Team 2014-08-27 19:59:44 +04:00
parent 36329110e5
commit b4f416b6f8
105 changed files with 4331 additions and 4339 deletions

View file

@ -8,7 +8,7 @@
window = require('window'),
_ = require('_'),
Globals = require('Globals'),
AppSettings = require('../Storages/AppSettings.js')
Settings = require('Storage:Settings')
;
/**
@ -18,7 +18,7 @@
* @param {Function=} fOnReady
* @param {Function=} fOnModeChange
*/
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
function HtmlEditor(oElement, fOnBlur, fOnReady, fOnModeChange)
{
this.editor = null;
this.iBlurTimer = 0;
@ -33,7 +33,7 @@
this.init();
}
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
HtmlEditor.prototype.blurTrigger = function ()
{
if (this.fOnBlur)
{
@ -45,7 +45,7 @@
}
};
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
HtmlEditor.prototype.focusTrigger = function ()
{
if (this.fOnBlur)
{
@ -56,7 +56,7 @@
/**
* @return {boolean}
*/
NewHtmlEditorWrapper.prototype.isHtml = function ()
HtmlEditor.prototype.isHtml = function ()
{
return this.editor ? 'wysiwyg' === this.editor.mode : false;
};
@ -64,12 +64,12 @@
/**
* @return {boolean}
*/
NewHtmlEditorWrapper.prototype.checkDirty = function ()
HtmlEditor.prototype.checkDirty = function ()
{
return this.editor ? this.editor.checkDirty() : false;
};
NewHtmlEditorWrapper.prototype.resetDirty = function ()
HtmlEditor.prototype.resetDirty = function ()
{
if (this.editor)
{
@ -80,7 +80,7 @@
/**
* @return {string}
*/
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
HtmlEditor.prototype.getData = function (bWrapIsHtml)
{
if (this.editor)
{
@ -97,7 +97,7 @@
return '';
};
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
HtmlEditor.prototype.modeToggle = function (bPlain)
{
if (this.editor)
{
@ -120,7 +120,7 @@
}
};
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
HtmlEditor.prototype.setHtml = function (sHtml, bFocus)
{
if (this.editor)
{
@ -134,7 +134,7 @@
}
};
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
HtmlEditor.prototype.setPlain = function (sPlain, bFocus)
{
if (this.editor)
{
@ -155,7 +155,7 @@
}
};
NewHtmlEditorWrapper.prototype.init = function ()
HtmlEditor.prototype.init = function ()
{
if (this.$element && this.$element[0])
{
@ -165,8 +165,8 @@
var
oConfig = Globals.oHtmlEditorDefaultConfig,
sLanguage = AppSettings.settingsGet('Language'),
bSource = !!AppSettings.settingsGet('AllowHtmlEditorSourceButton')
sLanguage = Settings.settingsGet('Language'),
bSource = !!Settings.settingsGet('AllowHtmlEditorSourceButton')
;
if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)
@ -236,7 +236,7 @@
}
};
NewHtmlEditorWrapper.prototype.focus = function ()
HtmlEditor.prototype.focus = function ()
{
if (this.editor)
{
@ -244,7 +244,7 @@
}
};
NewHtmlEditorWrapper.prototype.blur = function ()
HtmlEditor.prototype.blur = function ()
{
if (this.editor)
{
@ -252,7 +252,7 @@
}
};
NewHtmlEditorWrapper.prototype.resize = function ()
HtmlEditor.prototype.resize = function ()
{
if (this.editor && this.__resizable)
{
@ -264,12 +264,12 @@
}
};
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
HtmlEditor.prototype.clear = function (bFocus)
{
this.setHtml('', bFocus);
};
module.exports = NewHtmlEditorWrapper;
module.exports = HtmlEditor;
}(module, require));

View file

@ -14,13 +14,13 @@
*/
function LinkBuilder()
{
var AppSettings = require('../Storages/AppSettings.js');
var Settings = require('Storage:Settings');
this.sBase = '#/';
this.sServer = './?';
this.sVersion = AppSettings.settingsGet('Version');
this.sSpecSuffix = AppSettings.settingsGet('AuthAccountHash') || '0';
this.sStaticPrefix = AppSettings.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
this.sVersion = Settings.settingsGet('Version');
this.sSpecSuffix = Settings.settingsGet('AuthAccountHash') || '0';
this.sStaticPrefix = Settings.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
}
/**
@ -167,6 +167,14 @@
return sResult;
};
/**
* @return {string}
*/
LinkBuilder.prototype.about = function ()
{
return this.sBase + 'about';
};
/**
* @param {string} sScreenName
* @return {string}

View file

@ -12,7 +12,7 @@
},
_ = require('_'),
Utils = require('Utils'),
AppSettings = require('../Storages/AppSettings.js')
Settings = require('Storage:Settings')
;
/**
@ -76,7 +76,7 @@
*/
Plugins.mainSettingsGet = function (sName)
{
return AppSettings.settingsGet(sName);
return Settings.settingsGet(sName);
};
/**
@ -102,7 +102,7 @@
*/
Plugins.settingsGet = function (sPluginSection, sName)
{
var oPlugin = AppSettings.settingsGet('Plugins');
var oPlugin = Settings.settingsGet('Plugins');
oPlugin = oPlugin && !Utils.isUnd(oPlugin[sPluginSection]) ? oPlugin[sPluginSection] : null;
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
};

View file

@ -11,7 +11,7 @@
_ = require('_'),
ko = require('ko'),
window = require('window'),
$window = require('$window'),
$win = require('$win'),
$html = require('$html'),
$div = require('$div'),
$doc = require('$doc'),
@ -42,12 +42,12 @@
Utils.windowResize = _.debounce(function (iTimeout) {
if (Utils.isUnd(iTimeout))
{
$window.resize();
$win.resize();
}
else
{
window.setTimeout(function () {
$window.resize();
$win.resize();
}, iTimeout);
}
}, 50);