2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

fhemweb.js: add help for regexp attributeNames (Forum #120779)

git-svn-id: https://svn.fhem.de/fhem/trunk@24366 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-05-01 10:05:24 +00:00
parent 58b1adcf83
commit c2f8195fb0

View File

@ -346,15 +346,15 @@ FW_displayHelp(devName, sel, selType, val, level)
if(level == 3) // commandref if(level == 3) // commandref
mtype = ""; mtype = "";
if(mtype) { // old style #1 syntax: MODULETYPEattrname if(mtype) { // current syntax: FHEMWEB-attr-webCmd
var mv = (""+mtype+"-"+selType+"-"+val).replace(/[^a-z0-9_-]/ig,'_'); var mv = (""+mtype+"-"+selType+"-"+val).replace(/[^a-z0-9_-]/ig,'_');
aTag = $("#content > #workbench").find("a[id="+mv+"]"); aTag = $("#content > #workbench").find("a[id="+mv+"]");
if(!$(aTag).length) { if(!$(aTag).length) { // old style #1 syntax: FHEMWEBwebCmd
mv = (""+mtype+val).replace(/[^a-z0-9_-]/ig,'_'); mv = (""+mtype+val).replace(/[^a-z0-9_-]/ig,'_');
aTag = $("#content > #workbench").find("a[name="+mv+"]"); aTag = $("#content > #workbench").find("a[name="+mv+"]");
} }
} }
if(!$(aTag).length) { // old style #2 syntax without type if(!$(aTag).length) { // old style #2 syntax : webCmd
var v = (val).replace(/[^a-z0-9_-]/ig,'_'); var v = (val).replace(/[^a-z0-9_-]/ig,'_');
aTag = $("#content > #workbench").find("a[name="+v+"]"); aTag = $("#content > #workbench").find("a[name="+v+"]");
} }
@ -374,10 +374,15 @@ FW_displayHelp(devName, sel, selType, val, level)
$("#content > #workbench").remove(); $("#content > #workbench").remove();
if(!$(aTag).length) { if(!$(aTag).length) {
if(devName != "FHEMWEB" && level == 1) var ma = val.match(/(.*?)[0-9]+$/);
return FW_displayHelp("FHEMWEB", sel, selType, val, 2); while(++level <= 4) {
if(devName != "commandref" && level < 3) if(level == 2 && ma)
return FW_displayHelp("commandref", sel, selType, val, 3); return FW_displayHelp(devName, sel, selType, ma[1], level);
if(level == 3 && devName != "FHEMWEB")
return FW_displayHelp("FHEMWEB", sel, selType, val, level);
if(level == 4 && devName != "commandref")
return FW_displayHelp("commandref", sel, selType, val, level);
}
} }
}); });
} }