2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +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
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,'_');
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,'_');
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,'_');
aTag = $("#content > #workbench").find("a[name="+v+"]");
}
@ -374,10 +374,15 @@ FW_displayHelp(devName, sel, selType, val, level)
$("#content > #workbench").remove();
if(!$(aTag).length) {
if(devName != "FHEMWEB" && level == 1)
return FW_displayHelp("FHEMWEB", sel, selType, val, 2);
if(devName != "commandref" && level < 3)
return FW_displayHelp("commandref", sel, selType, val, 3);
var ma = val.match(/(.*?)[0-9]+$/);
while(++level <= 4) {
if(level == 2 && ma)
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);
}
}
});
}