2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 01:14:19 +00:00

fhemweb.js: direct help for attr on dropdown change

git-svn-id: https://svn.fhem.de/fhem/trunk@17049 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-07-29 15:07:19 +00:00
parent 386efe1743
commit 7c65aa776f
2 changed files with 38 additions and 3 deletions

View File

@ -3423,6 +3423,7 @@ FW_widgetOverride($$)
instance from now on. instance from now on.
</li><br> </li><br>
<a name="allowedHttpMethods"></a>
<li>allowedHttpMethods<br> <li>allowedHttpMethods<br>
FHEMWEB implements the GET, POST and OPTIONS HTTP methods. Some external FHEMWEB implements the GET, POST and OPTIONS HTTP methods. Some external
devices require the HEAD method, which is not implemented correctly in devices require the HEAD method, which is not implemented correctly in
@ -4116,6 +4117,7 @@ FW_widgetOverride($$)
f&uuml;r eine FHEMWEB Instanz unerw&uuml;nscht. f&uuml;r eine FHEMWEB Instanz unerw&uuml;nscht.
</li><br> </li><br>
<a name="allowedHttpMethods"></a>
<li>allowedHttpMethods</br> <li>allowedHttpMethods</br>
FHEMWEB implementiert die HTTP Methoden GET, POST und OPTIONS. Manche FHEMWEB implementiert die HTTP Methoden GET, POST und OPTIONS. Manche
externe Ger&auml;te ben&ouml;tigen HEAD, das ist aber in FHEMWEB nicht externe Ger&auml;te ben&ouml;tigen HEAD, das ist aber in FHEMWEB nicht

View File

@ -223,9 +223,7 @@ FW_jqueryReadyFn()
return; return;
} }
$("#content").append('<div id="devSpecHelp"></div>'); $("#content").append('<div id="devSpecHelp"></div>');
FW_cmd(FW_root+"?cmd=help "+dev+"&XHR=1", function(data) { FW_getHelp(dev, function(data){
if(!$("#devSpecHelp").length) // FHEM slow, user clicked again, #68166
return;
$("#devSpecHelp").html(data); $("#devSpecHelp").html(data);
var off = $("#devSpecHelp").position().top-20; var off = $("#devSpecHelp").position().top-20;
$('body, html').animate({scrollTop:off}, 500); $('body, html').animate({scrollTop:off}, 500);
@ -280,12 +278,47 @@ FW_jqueryReadyFn()
FW_urlParams[kv[0]] = kv[1]; FW_urlParams[kv[0]] = kv[1];
} }
$("select[id^=sel_attr],select[id^=sel_set],select[id^=sel_get]")
.change(function(){ // online help
var val = $(this).val();
var m = $(this).attr("id").match(/sel_(set|get|attr)(.*)/);
if(!m)
return;
if($("#devSpecHelp").length == 0)
$("#content").append('<div id="devSpecHelp"></div>');
FW_getHelp(m[2], function(data) {
var str = '<a name="'+val+'"></a>'; // my regexp crashes Chrome :(
var o1 = data.indexOf(str);
if(o1 < 0)
return;
data = data.substr(o1+str.length);
o1 = data.indexOf('<a name="');
if(o1 > 0)
data = data.substr(0,o1);
$("#devSpecHelp").html(data);
});
});
FW_smallScreenCommands(); FW_smallScreenCommands();
FW_inlineModify(); FW_inlineModify();
FW_rawDef(); FW_rawDef();
FW_treeMenu(); FW_treeMenu();
} }
var FW_helpData;
function
FW_getHelp(dev, fn)
{
if(FW_helpData)
return fn(FW_helpData);
FW_cmd(FW_root+"?cmd=help "+dev+"&XHR=1", function(data) {
FW_helpData = data;
if(!$("#devSpecHelp").length) // FHEM slow, user clicked again, #68166
return;
return fn(FW_helpData);
});
}
function function
FW_showVersion(val) FW_showVersion(val)
{ {