eslint (additional rules)

This commit is contained in:
RainLoop Team 2016-06-30 03:02:45 +03:00
parent 77a1d3f3df
commit 8e8a041032
150 changed files with 21911 additions and 23106 deletions

View file

@ -1,139 +1,134 @@
(function () {
var
_ = require('_'),
ko = require('ko'),
key = require('key'),
'use strict';
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
var
_ = require('_'),
ko = require('ko'),
key = require('key'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView');
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
/**
* @constructor
* @extends AbstractView
*/
function AskPopupView()
{
AbstractView.call(this, 'Popups', 'PopupsAsk');
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
this.askDesc = ko.observable('');
this.yesButton = ko.observable('');
this.noButton = ko.observable('');
/**
* @constructor
* @extends AbstractView
*/
function AskPopupView()
this.yesFocus = ko.observable(false);
this.noFocus = ko.observable(false);
this.fYesAction = null;
this.fNoAction = null;
this.bFocusYesOnShow = true;
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
kn.constructorEnd(this);
}
kn.extendAsViewModel(['View/Popup/Ask', 'PopupsAskViewModel'], AskPopupView);
_.extend(AskPopupView.prototype, AbstractView.prototype);
AskPopupView.prototype.clearPopup = function()
{
this.askDesc('');
this.yesButton(Translator.i18n('POPUPS_ASK/BUTTON_YES'));
this.noButton(Translator.i18n('POPUPS_ASK/BUTTON_NO'));
this.yesFocus(false);
this.noFocus(false);
this.fYesAction = null;
this.fNoAction = null;
};
AskPopupView.prototype.yesClick = function()
{
this.cancelCommand();
if (Utils.isFunc(this.fYesAction))
{
AbstractView.call(this, 'Popups', 'PopupsAsk');
this.fYesAction.call(null);
}
};
this.askDesc = ko.observable('');
this.yesButton = ko.observable('');
this.noButton = ko.observable('');
AskPopupView.prototype.noClick = function()
{
this.cancelCommand();
this.yesFocus = ko.observable(false);
this.noFocus = ko.observable(false);
if (Utils.isFunc(this.fNoAction))
{
this.fNoAction.call(null);
}
};
this.fYesAction = null;
this.fNoAction = null;
/**
* @param {string} sAskDesc
* @param {Function=} fYesFunc
* @param {Function=} fNoFunc
* @param {string=} sYesButton
* @param {string=} sNoButton
* @param {boolean=} bFocusYesOnShow
* @returns {void}
*/
AskPopupView.prototype.onShow = function(sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton, bFocusYesOnShow)
{
this.clearPopup();
this.bFocusYesOnShow = true;
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = Enums.KeyState.PopupAsk;
this.fYesAction = fYesFunc || null;
this.fNoAction = fNoFunc || null;
kn.constructorEnd(this);
this.askDesc(sAskDesc || '');
if (sYesButton)
{
this.yesButton(sYesButton);
}
kn.extendAsViewModel(['View/Popup/Ask', 'PopupsAskViewModel'], AskPopupView);
_.extend(AskPopupView.prototype, AbstractView.prototype);
AskPopupView.prototype.clearPopup = function ()
if (sNoButton)
{
this.askDesc('');
this.yesButton(Translator.i18n('POPUPS_ASK/BUTTON_YES'));
this.noButton(Translator.i18n('POPUPS_ASK/BUTTON_NO'));
this.noButton(sNoButton);
}
this.yesFocus(false);
this.noFocus(false);
this.bFocusYesOnShow = Utils.isUnd(bFocusYesOnShow) ? true : !!bFocusYesOnShow;
};
this.fYesAction = null;
this.fNoAction = null;
};
AskPopupView.prototype.yesClick = function ()
AskPopupView.prototype.onShowWithDelay = function()
{
if (this.bFocusYesOnShow)
{
this.cancelCommand();
this.yesFocus(true);
}
};
if (Utils.isFunc(this.fYesAction))
AskPopupView.prototype.onBuild = function()
{
key('tab, shift+tab, right, left', Enums.KeyState.PopupAsk, _.bind(function() {
if (this.yesFocus())
{
this.fYesAction.call(null);
this.noFocus(true);
}
};
AskPopupView.prototype.noClick = function ()
{
this.cancelCommand();
if (Utils.isFunc(this.fNoAction))
{
this.fNoAction.call(null);
}
};
/**
* @param {string} sAskDesc
* @param {Function=} fYesFunc
* @param {Function=} fNoFunc
* @param {string=} sYesButton
* @param {string=} sNoButton
* @param {boolean=} bFocusYesOnShow
*/
AskPopupView.prototype.onShow = function (sAskDesc, fYesFunc, fNoFunc, sYesButton, sNoButton, bFocusYesOnShow)
{
this.clearPopup();
this.fYesAction = fYesFunc || null;
this.fNoAction = fNoFunc || null;
this.askDesc(sAskDesc || '');
if (sYesButton)
{
this.yesButton(sYesButton);
}
if (sYesButton)
{
this.yesButton(sNoButton);
}
this.bFocusYesOnShow = Utils.isUnd(bFocusYesOnShow) ? true : !!bFocusYesOnShow;
};
AskPopupView.prototype.onShowWithDelay = function ()
{
if (this.bFocusYesOnShow)
else
{
this.yesFocus(true);
}
};
return false;
}, this));
AskPopupView.prototype.onBuild = function ()
{
key('tab, shift+tab, right, left', Enums.KeyState.PopupAsk, _.bind(function () {
if (this.yesFocus())
{
this.noFocus(true);
}
else
{
this.yesFocus(true);
}
return false;
}, this));
key('esc', Enums.KeyState.PopupAsk, _.bind(function() {
this.noClick();
return false;
}, this));
};
key('esc', Enums.KeyState.PopupAsk, _.bind(function () {
this.noClick();
return false;
}, this));
};
module.exports = AskPopupView;
}());
module.exports = AskPopupView;