2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhemweb_icon*.js: fix case insensitivity

git-svn-id: https://svn.fhem.de/fhem/trunk@15404 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Ellert 2017-11-06 14:47:33 +00:00
parent 89b0f28b39
commit fb7a438f6a
4 changed files with 10 additions and 10 deletions

View File

@ -36,7 +36,7 @@ FW_iconButtonsCreate(elName, devName, vArr, currVal, set, params, cmd)
vArr[1] = vArr[1].replace(/^use4icon@|^@/,"");
}
if( vArr[1].match(/^[A-F0-9]{6}$/,"i"))
if( vArr[1].match(/^[A-F0-9]{6}$/i))
vArr[1] = "#"+vArr[1];
var newEl = $("<div style='display:inline-block;'>").get(0);
@ -81,7 +81,7 @@ FW_iconButtonsCreate(elName, devName, vArr, currVal, set, params, cmd)
var ico = vArr[ind*ipar+3];
var m = ico.match(/.*@(.*)/);
var uscol = m && m[1] ? m[1] : "none";
if( uscol.match(/^[A-F0-9]{6}$/,"i"))
if( uscol.match(/^[A-F0-9]{6}$/i))
uscol = "#"+uscol;
if(uscol == 'none')
ico += "@none";
@ -145,7 +145,7 @@ FW_iconButtonsCreate(elName, devName, vArr, currVal, set, params, cmd)
var span = button.next().find("span");
var sc = $(span).attr("selectcolor");
var usc = $(span).attr("unselectcolor") == "none" ? "" : $(span).attr("unselectcolor");
if( usc.match(/^[A-F0-9]{6}$/,"i"))
if( usc.match(/^[A-F0-9]{6}$/i))
usc = "#"+usc;
button.prop("checked", arg.match(new RegExp('(^|,)'+vArr[i*ipar+2]+'($|,)') ) );
if (button.prop("checked")==true){

View File

@ -66,7 +66,7 @@ FW_IconLabelCreate(elName, devName, vArr, currVal, set, params, cmd)
if(ilast > 0) { //text only with color
if (vArr[i+1] && vArr[i+1].indexOf("@") == 0) {
col = vArr[i+1].replace(/@/,'');
if( col.match(/^[A-F0-9]{6}$/,"i"))
if( col.match(/^[A-F0-9]{6}$/i))
col = "#"+col;
$(newEl).find("span").html(arg+"")
.attr("style","color: "+col+" !important; padding:0.0em 0.3em ")
@ -82,7 +82,7 @@ FW_IconLabelCreate(elName, devName, vArr, currVal, set, params, cmd)
});
} else if (vArr[i+1] && vArr[i+1].indexOf("@") > 0) { //text or image with color
ico = vArr[i+1].split("@");
if( ico[1] && ico[1].match(/^[A-F0-9]{6}$/,"i"))
if( ico[1] && ico[1].match(/^[A-F0-9]{6}$/i))
ico[1] = "#"+ico[1];
FW_cmd(FW_root+"?cmd={FW_makeImage('"+vArr[i+1]+"','"+arg+"',"+(iconclass.length > 0 ? "'"+iconclass+"'" :'')+")}&XHR=1",function(data){
data = data.replace(/\n$/,'');

View File

@ -36,7 +36,7 @@ FW_iconRadioCreate(elName, devName, vArr, currVal, set, params, cmd)
vArr[1] = vArr[1].replace(/^use4icon@|^@/,"");
}
if( vArr[1].match(/^[A-F0-9]{6}$/,"i"))
if( vArr[1].match(/^[A-F0-9]{6}$/i))
vArr[1] = "#"+vArr[1];
var newEl = $("<div style='display:inline-block;'>").get(0);
@ -115,7 +115,7 @@ FW_iconRadioCreate(elName, devName, vArr, currVal, set, params, cmd)
var ico = vArr[ind*ipar+3];
var m = ico.match(/.*@(.*)/);
var uscol = m && m[1] ? m[1] : "none";
if( uscol.match(/^[A-F0-9]{6}$/,"i"))
if( uscol.match(/^[A-F0-9]{6}$/i))
uscol = "#"+uscol;
if(uscol == 'none')
ico += "@none";
@ -205,7 +205,7 @@ FW_iconRadioCreate(elName, devName, vArr, currVal, set, params, cmd)
var span = button.next().find("span");
var sc = $(span).attr("selectcolor");
var usc = $(span).attr("unselectcolor") == "none" ? "" : $(span).attr("unselectcolor");
if( usc.match(/^[A-F0-9]{6}$/,"i"))
if( usc.match(/^[A-F0-9]{6}$/i))
usc = "#"+usc;
// console.log("setFn usc_"+i+": "+usc+": sc_"+i+": "+sc+", arg: "+arg);
// console.log("setFn, i:",i,"ascd:",ascd,"istart:",istart,"iend:",iend);

View File

@ -100,7 +100,7 @@ FW_iconSwitchCreate(elName, devName, vArr, currVal, set, params, cmd)
}
if (vArr[i+1] && vArr[i+1].indexOf("@") == 0) { //text only with color
col = vArr[i+1].replace(/@/,'');
if( col.match(/^[A-F0-9]{6}$/,"i"))
if( col.match(/^[A-F0-9]{6}$/i))
col = "#"+col;
$(newEl).find("span").html(vArr[i]+"")
.attr("style","color: "+col+" !important; padding:0.0em 0.3em ")
@ -117,7 +117,7 @@ FW_iconSwitchCreate(elName, devName, vArr, currVal, set, params, cmd)
});
} else if (vArr[i+1] && vArr[i+1].indexOf("@") > 0) { //text or image with color
ico = vArr[i+1].split("@");
if( ico[1] && ico[1].match(/^[A-F0-9]{6}$/,"i"))
if( ico[1] && ico[1].match(/^[A-F0-9]{6}$/i))
ico[1] = "#"+ico[1];
FW_cmd(FW_root+"?cmd={FW_makeImage('"+vArr[i+1]+"','"+arg+"',"+(iconclass.length > 0 ? "'"+iconclass+"'" :'')+")}&XHR=1",function(data){
data = data.replace(/\n$/,'');