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,91 +1,84 @@
(function () {
var
_ = require('_'),
ko = require('ko'),
'use strict';
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
var
_ = require('_'),
ko = require('ko'),
Remote = require('Remote/User/Ajax'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView');
Remote = require('Remote/User/Ajax'),
/**
* @constructor
* @extends AbstractView
*/
function TwoFactorTestPopupView()
{
AbstractView.call(this, 'Popups', 'PopupsTwoFactorTest');
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
var self = this;
/**
* @constructor
* @extends AbstractView
*/
function TwoFactorTestPopupView()
this.code = ko.observable('');
this.code.focused = ko.observable(false);
this.code.status = ko.observable(null);
this.koTestedTrigger = null;
this.testing = ko.observable(false);
// commands
this.testCode = Utils.createCommand(this, function() {
this.testing(true);
Remote.testTwoFactor(function(sResult, oData) {
self.testing(false);
self.code.status(Enums.StorageResultType.Success === sResult && oData && !!oData.Result);
if (self.koTestedTrigger && self.code.status())
{
self.koTestedTrigger(true);
}
}, this.code());
}, function() {
return '' !== this.code() && !this.testing();
});
kn.constructorEnd(this);
}
kn.extendAsViewModel(['View/Popup/TwoFactorTest', 'PopupsTwoFactorTestViewModel'], TwoFactorTestPopupView);
_.extend(TwoFactorTestPopupView.prototype, AbstractView.prototype);
TwoFactorTestPopupView.prototype.clearPopup = function()
{
this.code('');
this.code.focused(false);
this.code.status(null);
this.testing(false);
this.koTestedTrigger = null;
};
TwoFactorTestPopupView.prototype.onShow = function(koTestedTrigger)
{
this.clearPopup();
this.koTestedTrigger = koTestedTrigger;
};
TwoFactorTestPopupView.prototype.onShowWithDelay = function()
{
if (!Globals.bMobile)
{
AbstractView.call(this, 'Popups', 'PopupsTwoFactorTest');
var self = this;
this.code = ko.observable('');
this.code.focused = ko.observable(false);
this.code.status = ko.observable(null);
this.koTestedTrigger = null;
this.testing = ko.observable(false);
// commands
this.testCode = Utils.createCommand(this, function () {
this.testing(true);
Remote.testTwoFactor(function (sResult, oData) {
self.testing(false);
self.code.status(Enums.StorageResultType.Success === sResult && oData && oData.Result ? true : false);
if (self.koTestedTrigger && self.code.status())
{
self.koTestedTrigger(true);
}
}, this.code());
}, function () {
return '' !== this.code() && !this.testing();
});
kn.constructorEnd(this);
this.code.focused(true);
}
};
kn.extendAsViewModel(['View/Popup/TwoFactorTest', 'PopupsTwoFactorTestViewModel'], TwoFactorTestPopupView);
_.extend(TwoFactorTestPopupView.prototype, AbstractView.prototype);
TwoFactorTestPopupView.prototype.clearPopup = function ()
{
this.code('');
this.code.focused(false);
this.code.status(null);
this.testing(false);
this.koTestedTrigger = null;
};
TwoFactorTestPopupView.prototype.onShow = function (koTestedTrigger)
{
this.clearPopup();
this.koTestedTrigger = koTestedTrigger;
};
TwoFactorTestPopupView.prototype.onShowWithDelay = function ()
{
if (!Globals.bMobile)
{
this.code.focused(true);
}
};
module.exports = TwoFactorTestPopupView;
}());
module.exports = TwoFactorTestPopupView;