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

fhemweb.js: support links in attr/set help (Forum #130694)

git-svn-id: https://svn.fhem.de/fhem/trunk@26782 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-12-05 12:36:32 +00:00
parent 120cb37c3d
commit 36121ef4a3
2 changed files with 17 additions and 3 deletions

View File

@ -204,7 +204,6 @@ fd_csrfRefresh(callback)
{
if(fd_mode != "FHEM")
return;
console.log("fd_csrfRefresh");
$.ajax({
url:location.pathname.replace(/docs.*/,'')+"?XHR=1",
success: function(data, textStatus, request){
@ -265,8 +264,15 @@ $(document).ready(function(){
for(var i1 in fd_otherSrc)
fd_modLinks[i1] = fd_otherSrc[i1];
if(location.hash && location.hash.length > 1)
loadOneDoc(location.hash.substr(1), fd_lang);
if(location.hash && location.hash.length > 1) {
var h = location.hash.substr(1);
var m = h.match(/(.*)(&fwcsrf=.*)$/);
if(m) {
h = m[1];
csrfToken = m[2];
}
loadOneDoc(h, fd_lang);
}
$(window).bind('hashchange', function() {
if(location.hash.length > 1)

View File

@ -372,6 +372,14 @@ FW_displayHelp(devName, sel, selType, val, group)
$(sel).closest("div[cmd='"+selType+"']")
.after('<div class="makeTable" id="devSpecHelp"></div>')
$("#devSpecHelp").html($(liTag).html());
$("#devSpecHelp a").each(function(){ // #130694
var href = $(this).attr("href");
if(href && href.indexOf("#") == 0) {
$(this).attr("target", "_blank");
$(this).attr("href",
addcsrf(FW_root+"/docs/commandref.html"+$(this).attr("href")));
}
});
}
}
wb.remove();