Autofix small errors

This commit is contained in:
Igor Barkov [iwork]
2019-01-16 19:45:30 +02:00
parent d330721114
commit 094b8a6027
313 changed files with 736 additions and 2280 deletions
+38 -34
View File
@@ -43,21 +43,21 @@ H.prototype.get = function(key, defaultValue){
H.prototype.setHP = function(id, curHP, maxHP){
curHP = curHP || 0;
maxHP = maxHP || 0;
var hp = this.getMainBox().find('#hpKey_'+id);
const hp = this.getMainBox().find('#hpKey_' + id);
if(hp.length < 1){
return false;
}
var hpA = $('img:eq(1)', hp);
var hpB = $('img:eq(2)', hp);
var redHP = 0.33; // меньше 30% красный цвет
var yellowHP = 0.66; // меньше 60% желтый цвет, иначе зеленый
const hpA = $('img:eq(1)', hp);
const hpB = $('img:eq(2)', hp);
const redHP = 0.33; // меньше 30% красный цвет
const yellowHP = 0.66; // меньше 60% желтый цвет, иначе зеленый
if(curHP > maxHP){
curHP = maxHP;
}
var text = curHP + '/' + maxHP;
var lengthHP = 170 - (text.length - 1) * 8;
var sizeFirst = Math.round((lengthHP / maxHP) * curHP);
var sizeSecond = lengthHP - sizeFirst;
const text = curHP + '/' + maxHP;
const lengthHP = 170 - (text.length - 1) * 8;
const sizeFirst = Math.round((lengthHP / maxHP) * curHP);
const sizeSecond = lengthHP - sizeFirst;
hpA.attr('width', sizeFirst);
hpB.attr('width', sizeSecond);
if(curHP / maxHP < redHP){
@@ -116,15 +116,19 @@ H.prototype.sdOptionsDefault = {
H.prototype._sd = function(options){
options = $.extend({}, this.sdOptionsDefault, options);
var m = $('<div class="sd-container"></div>').css('width',options.width);
var t = $('<div class="sd-title">').text(options.title);
var c = $('<img class="sd-closer" src="/i/clear.gif" title="Закрыть окно" alt="X">')
.click(function(){return options.onClose.call($(this).closest('div.sd-container'))});
var f = $('<form class="sd-form"></form>')
.attr('method', options.formMethod)
.attr('action', options.formAction)
.submit(function(){return options.onSubmit.call($(this).closest('div.sd-container'))});
for(var i in options.data){
const m = $('<div class="sd-container"></div>').css('width', options.width);
const t = $('<div class="sd-title">').text(options.title);
const c = $('<img class="sd-closer" src="/i/clear.gif" title="Закрыть окно" alt="X">')
.click(function () {
return options.onClose.call($(this).closest('div.sd-container'))
});
const f = $('<form class="sd-form"></form>')
.attr('method', options.formMethod)
.attr('action', options.formAction)
.submit(function () {
return options.onSubmit.call($(this).closest('div.sd-container'))
});
for(let i in options.data){
$('<input type=hidden>').attr('name',i).val(options.data[i]).appendTo(f);
}
if(options.formClass){
@@ -135,18 +139,18 @@ H.prototype._sd = function(options){
}
H.prototype.sd = function(options){
var tmp = this._sd(options);
return this.getMainBox().append(tmp);
const tmp = this._sd(options);
return this.getMainBox().append(tmp);
}
H.prototype.sdOneInput = function(options){
var onSubmit2 = options.onSubmit;
options = $.extend({},this.sdOptionsDefault, {inputName: 'target', inputValue: '', grabber: null}, options);
var i = $('<input type="text" class="text">')
.css({'width': options.width - 45})
.attr('name',options.inputName)
.val(options.inputValue);
if(options.grabber && this[options.grabber] instanceof Grabber){
let onSubmit2 = options.onSubmit;
options = $.extend({},this.sdOptionsDefault, {inputName: 'target', inputValue: '', grabber: null}, options);
const i = $('<input type="text" class="text">')
.css({'width': options.width - 45})
.attr('name', options.inputName)
.val(options.inputValue);
if(options.grabber && this[options.grabber] instanceof Grabber){
this[options.grabber].set(i);
}else{
i.select();
@@ -155,8 +159,8 @@ H.prototype.sdOneInput = function(options){
.append(i)
.append('<input type="submit" class="button" style="width:33px;" value=" »» ">'));
options.onSubmit = function(){
var v = i.val($.trim(i.val())).val();
if(v.length <= 0){
const v = i.val($.trim(i.val())).val();
if(v.length <= 0){
alert('Не заполнено обязательное поле');
return false
}
@@ -216,7 +220,7 @@ H.prototype.msgPopup = function(type, text){
if(this._popupConfig[type] == undefined){
type = 'w';
}
var conf = this._popupConfig[type];
const conf = this._popupConfig[type];
$.jGrowl(text,{
header: '<img src="/i/jgrowl_moover.png" alt="<>" class="jgrowl-moover" title="Передвинуть"> ' + conf[1],
glue: 'before',
@@ -251,10 +255,10 @@ Grabber.prototype.isActive = function(){
}
Grabber.prototype.set = function(input){
var obj = this;
this.clear();
var tmp = $(input);
if(tmp.length > 0){
const obj = this;
this.clear();
const tmp = $(input);
if(tmp.length > 0){
this.input = tmp.get(0);
$(this.input)
.addClass(this.options.inputClass)