Merge pull request #1199 from mek1986/main

删除多余分号
This commit is contained in:
贤心 2023-02-10 11:48:44 +08:00 committed by GitHub
commit 62ea89979f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 38 deletions

View File

@ -184,7 +184,7 @@ layui.define('jquery', function(exports){
//避免重复插入
if(options.elem.find('.'+ELEM_ARROW)[0]){
options.elem.find('.'+ELEM_ARROW).remove();
};
}
options.elem.append(tplArrow);
//事件
@ -229,7 +229,7 @@ layui.define('jquery', function(exports){
//避免重复插入
if(options.elem.find('.'+ELEM_IND)[0]){
options.elem.find('.'+ELEM_IND).remove();
};
}
options.elem.append(tplInd);
if(options.anim === 'updown'){
@ -267,7 +267,7 @@ layui.define('jquery', function(exports){
elemItem.eq(thisIndex).addClass(ELEM_LEFT);
elemItem.eq(options.index).addClass(ELEM_LEFT);
}, 50);
};
}
//移除过度类
setTimeout(function(){
@ -314,8 +314,7 @@ layui.define('jquery', function(exports){
//核心入口
carousel.render = function(options){
var inst = new Class(options);
return inst;
return new Class(options);
};
exports(MOD_NAME, carousel);

View File

@ -230,7 +230,7 @@ layui.define(['lay', 'util', 'element', 'form'], function(exports){
run(thisItemBody);
}
});
};
}
// 有序或无序列表

View File

@ -57,25 +57,25 @@ layui.define(['jquery', 'lay'], function(exports){
var max = Math.max(rgb.r, rgb.g, rgb.b);
var delta = max - min;
hsb.b = max;
hsb.s = max != 0 ? 255*delta/max : 0;
if(hsb.s != 0){
if(rgb.r == max){
hsb.s = max !== 0 ? 255*delta/max : 0;
if(hsb.s !== 0){
if(rgb.r === max){
hsb.h = (rgb.g - rgb.b) / delta;
}else if(rgb.g == max){
}else if(rgb.g === max){
hsb.h = 2 + (rgb.b - rgb.r) / delta;
}else{
hsb.h = 4 + (rgb.r - rgb.g) / delta;
}
}else{
hsb.h = -1;
};
if(max == min){
}
if(max === min){
hsb.h = 0;
};
}
hsb.h *= 60;
if(hsb.h < 0) {
hsb.h += 360;
};
}
hsb.s *= 100/255;
hsb.b *= 100/255;
return hsb;
@ -83,11 +83,11 @@ layui.define(['jquery', 'lay'], function(exports){
//HEX转HSB
,HEXToHSB = function(hex){
var hex = hex.indexOf('#') > -1 ? hex.substring(1) : hex;
if(hex.length == 3){
hex = hex.indexOf('#') > -1 ? hex.substring(1) : hex;
if(hex.length === 3){
var num = hex.split("");
hex = num[0]+num[0]+num[1]+num[1]+num[2]+num[2]
};
}
hex = parseInt(hex, 16);
var rgb = {r:hex >> 16, g:(hex & 0x00FF00) >> 8, b:(hex & 0x0000FF)};
return RGBToHSB(rgb);
@ -99,13 +99,13 @@ layui.define(['jquery', 'lay'], function(exports){
var h = hsb.h;
var s = hsb.s*255/100;
var b = hsb.b*255/100;
if(s == 0){
if(s === 0){
rgb.r = rgb.g = rgb.b = b;
}else{
var t1 = b;
var t2 = (255 - s) * b /255;
var t3 = (t1 - t2) * (h % 60) /60;
if(h == 360) h = 0;
if(h === 360) h = 0;
if(h < 60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3}
else if(h < 120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3}
else if(h < 180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3}
@ -126,7 +126,7 @@ layui.define(['jquery', 'lay'], function(exports){
,rgb.b.toString(16)
];
$.each(hex, function(nr, val){
if(val.length == 1){
if(val.length === 1){
hex[nr] = '0' + val;
}
});
@ -360,25 +360,25 @@ layui.define(['jquery', 'lay'], function(exports){
//如果格式要求为rgb
if(type === 'torgb'){
elemPickerInput.find('input').val(bgcolor);
};
}
//如果格式要求为rgba
if(type === 'rgba'){
var rgb = RGBSTo(bgcolor);
//如果开启透明度而没有设置,则给默认值
if((bgcolor.match(/[0-9]{1,3}/g) || []).length == 3){
if((bgcolor.match(/[0-9]{1,3}/g) || []).length === 3){
elemPickerInput.find('input').val('rgba('+ rgb.r +', '+ rgb.g +', '+ rgb.b +', 1)');
that.elemPicker.find('.'+ PICKER_ALPHA_SLIDER).css("left", 280);
} else {
elemPickerInput.find('input').val(bgcolor);
var left = bgcolor.slice(bgcolor.lastIndexOf(",") + 1, bgcolor.length - 1) * 280;
that.elemPicker.find('.'+ PICKER_ALPHA_SLIDER).css("left", left);
};
}
//设置span背景色
that.elemPicker.find('.'+ PICKER_ALPHA_BG)[0].style.background = 'linear-gradient(to right, rgba('+ rgb.r +', '+ rgb.g +', '+ rgb.b +', 0), rgb('+ rgb.r +', '+ rgb.g +', '+ rgb.b +'))';
};
}
}else{
//如果没有背景颜色则默认到最初始的状态
@ -424,15 +424,14 @@ layui.define(['jquery', 'lay'], function(exports){
if(type === 'torgb'){
elemInput.val('rgb('+ rgb.r +', '+ rgb.g +', '+ rgb.b +')');
} else if(type === 'rgba'){
var left = 0;
left = a * 280;
var left = a * 280;
alphaslider.css("left", left);
elemInput.val('rgba('+ rgb.r +', '+ rgb.g +', '+ rgb.b +', '+ a +')');
span[0].style.background = 'rgba('+ rgb.r +', '+ rgb.g +', '+ rgb.b +', '+ a +')';
alphacolor[0].style.background = 'linear-gradient(to right, rgba('+ rgb.r +', '+ rgb.g +', '+ rgb.b +', 0), rgb('+ rgb.r +', '+ rgb.g +', '+ rgb.b +'))'
} else {
elemInput.val('#'+ color);
};
}
//回调更改的颜色
options.change && options.change(that.elemPicker.find('.' + PICKER_INPUT).find('input').val());
@ -562,7 +561,7 @@ layui.define(['jquery', 'lay'], function(exports){
_h = hsb.h;
_s = hsb.s;
_b = hsb.b;
if((color.match(/[0-9]{1,3}/g) || []).length == 3) a = 1;
if((color.match(/[0-9]{1,3}/g) || []).length === 3) a = 1;
_a = a;
left = a * 280;
change(hsb.h, hsb.s, hsb.b, a);
@ -589,7 +588,7 @@ layui.define(['jquery', 'lay'], function(exports){
,"left": left
});
if(type === 'change') return;
// if(type === 'change') return;
// 选中的颜色
// that.elemPicker.find('.' + PICKER_INPUT).find('input').val('#'+ color);
@ -616,8 +615,8 @@ layui.define(['jquery', 'lay'], function(exports){
//确认
,confirm: function(othis, change){
var value = elemPickerInput.val()
,colorValue = value
,hsb = {};
,colorValue
,hsb;
if(value.indexOf(',') > -1){
hsb = RGBToHSB(RGBSTo(value));
@ -629,12 +628,12 @@ layui.define(['jquery', 'lay'], function(exports){
that.elemPicker.find('.' + PICKER_ALPHA_SLIDER).css("left", left);
elemColorBoxSpan[0].style.background = value;
colorValue = value;
};
}
} else {
hsb = HEXToHSB(value);
elemColorBoxSpan[0].style.background = (colorValue = '#' + HSBToHEX(hsb));
that.elemColorBox.find('.' + PICKER_TRIG_I).removeClass(ICON_PICKER_CLOSE).addClass(ICON_PICKER_DOWN);
};
}
if(change === 'change'){
that.select(hsb.h, hsb.s, hsb.b, change);
@ -673,7 +672,7 @@ layui.define(['jquery', 'lay'], function(exports){
if($(ELEM_MAIN)[0]){
that.val();
that.side();
};
}
});
};

View File

@ -106,12 +106,12 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
}
//若重复执行 render则视为 reload 处理
if(!rerender && elem[0] && elem.data(MOD_INDEX)){;
if(!rerender && elem[0] && elem.data(MOD_INDEX)){
var newThat = thisModule.getThis(elem.data(MOD_INDEX));
if(!newThat) return;
return newThat.reload(options);
};
}
//初始化 id 参数
options.id = ('id' in options) ? options.id : that.index;
@ -482,7 +482,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
if(('isAllowSpread' in options) ? options.isAllowSpread : true){
thisModule.spread(elemGroup);
};
}
});
//判断子级菜单是否超出屏幕
@ -507,7 +507,7 @@ layui.define(['jquery', 'laytpl', 'lay'], function(exports){
//是否超出底部屏幕
if(rect.bottom > _WIN.height()){
elemPanel.eq(0).css('margin-top', -(rect.bottom - _WIN.height() + 5));
};
}
}).on('mouseleave', ELEM_LI_PAR, function(e){
var othis = $(this)
,elemPanel = othis.children('.'+ STR_MENU_PANEL);