mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 15:07:02 +03:00
eslint (additional rules)
This commit is contained in:
parent
77a1d3f3df
commit
8e8a041032
150 changed files with 21911 additions and 23106 deletions
|
|
@ -1,95 +1,88 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function LanguagesPopupView()
|
||||
{
|
||||
AbstractView.call(this, 'Popups', 'PopupsLanguages');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
var self = this;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function LanguagesPopupView()
|
||||
{
|
||||
AbstractView.call(this, 'Popups', 'PopupsLanguages');
|
||||
this.fLang = null;
|
||||
this.userLanguage = ko.observable('');
|
||||
|
||||
var self = this;
|
||||
this.langs = ko.observableArray([]);
|
||||
|
||||
this.fLang = null;
|
||||
this.userLanguage = ko.observable('');
|
||||
|
||||
this.langs = ko.observableArray([]);
|
||||
|
||||
this.languages = ko.computed(function () {
|
||||
var sUserLanguage = self.userLanguage();
|
||||
return _.map(self.langs(), function (sLanguage) {
|
||||
return {
|
||||
'key': sLanguage,
|
||||
'user': sLanguage === sUserLanguage,
|
||||
'selected': ko.observable(false),
|
||||
'fullName': Utils.convertLangName(sLanguage)
|
||||
};
|
||||
});
|
||||
this.languages = ko.computed(function() {
|
||||
var sUserLanguage = self.userLanguage();
|
||||
return _.map(self.langs(), function(sLanguage) {
|
||||
return {
|
||||
'key': sLanguage,
|
||||
'user': sLanguage === sUserLanguage,
|
||||
'selected': ko.observable(false),
|
||||
'fullName': Utils.convertLangName(sLanguage)
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
this.langs.subscribe(function () {
|
||||
this.setLanguageSelection();
|
||||
}, this);
|
||||
this.langs.subscribe(function() {
|
||||
this.setLanguageSelection();
|
||||
}, this);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/Popup/Languages', 'PopupsLanguagesViewModel'], LanguagesPopupView);
|
||||
_.extend(LanguagesPopupView.prototype, AbstractView.prototype);
|
||||
|
||||
LanguagesPopupView.prototype.languageTooltipName = function(sLanguage)
|
||||
{
|
||||
var sResult = Utils.convertLangName(sLanguage, true);
|
||||
return Utils.convertLangName(sLanguage, false) === sResult ? '' : sResult;
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.setLanguageSelection = function()
|
||||
{
|
||||
var currentLang = this.fLang ? ko.unwrap(this.fLang) : '';
|
||||
_.each(this.languages(), function(item) {
|
||||
item.selected(item.key === currentLang);
|
||||
});
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.onBeforeShow = function()
|
||||
{
|
||||
this.fLang = null;
|
||||
this.userLanguage('');
|
||||
|
||||
this.langs([]);
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.onShow = function(fLanguage, aLangs, sUserLanguage)
|
||||
{
|
||||
this.fLang = fLanguage;
|
||||
this.userLanguage(sUserLanguage || '');
|
||||
|
||||
this.langs(aLangs);
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.changeLanguage = function(sLang)
|
||||
{
|
||||
if (this.fLang)
|
||||
{
|
||||
this.fLang(sLang);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/Popup/Languages', 'PopupsLanguagesViewModel'], LanguagesPopupView);
|
||||
_.extend(LanguagesPopupView.prototype, AbstractView.prototype);
|
||||
this.cancelCommand();
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.languageTooltipName = function (sLanguage)
|
||||
{
|
||||
var sResult = Utils.convertLangName(sLanguage, true);
|
||||
return Utils.convertLangName(sLanguage, false) === sResult ? '' : sResult;
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.setLanguageSelection = function ()
|
||||
{
|
||||
var currentLang = this.fLang ? ko.unwrap(this.fLang) : '';
|
||||
_.each(this.languages(), function (item) {
|
||||
item.selected(item.key === currentLang);
|
||||
});
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.onBeforeShow = function ()
|
||||
{
|
||||
this.fLang = null;
|
||||
this.userLanguage('');
|
||||
|
||||
this.langs([]);
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.onShow = function (fLanguage, aLangs, sUserLanguage)
|
||||
{
|
||||
this.fLang = fLanguage;
|
||||
this.userLanguage(sUserLanguage || '');
|
||||
|
||||
this.langs(aLangs);
|
||||
};
|
||||
|
||||
LanguagesPopupView.prototype.changeLanguage = function (sLang)
|
||||
{
|
||||
if (this.fLang)
|
||||
{
|
||||
this.fLang(sLang);
|
||||
}
|
||||
|
||||
this.cancelCommand();
|
||||
};
|
||||
|
||||
module.exports = LanguagesPopupView;
|
||||
|
||||
}());
|
||||
module.exports = LanguagesPopupView;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue