From 57201f648847efb0d3e41ab2f304659340c46b47 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 9 Aug 2015 09:18:18 +0000 Subject: [PATCH] fhmweb.js: enable detail-help on smallscreen (Forum #39777) git-svn-id: https://svn.fhem.de/fhem/trunk@9037 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/www/pgm2/fhemweb.js | 51 ++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index 82526ec68..f7f9f3b3a 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -56,23 +56,6 @@ FW_jqueryReadyFn() if(document.body.getAttribute("longpoll")) setTimeout("FW_longpoll()", 100); - $("div.devSpecHelp a").each(function(){ // Help on detail window - var dev = $(this).attr("href").split("#").pop(); - $(this).attr("href", "#"); - $(this).click(function(evt){ - if($("#devSpecHelp").length) { - $("#devSpecHelp").remove(); - return; - } - $("#content").append('
'); - FW_cmd(FW_root+"?cmd=help "+dev+"&XHR=1", function(data) { - $("#devSpecHelp").html(data); - var off = $("#devSpecHelp").position().top-20; - $('body, html').animate({scrollTop:off}, 500); - }); - }); - }); - $("a").each(function() { FW_replaceLink(this); }) $("head script").each(function() { var sname = $(this).attr("src"), @@ -173,6 +156,26 @@ FW_jqueryReadyFn() }); }); + $("div.devSpecHelp a").each(function(){ // Help on detail window + var dev = FW_getLink(this).split("#").pop(); + $(this).unbind("click"); + $(this).attr("href", "#"); // Desktop: show underlined Text + $(this).removeAttr("onclick"); + + $(this).click(function(evt){ + if($("#devSpecHelp").length) { + $("#devSpecHelp").remove(); + return; + } + $("#content").append('
'); + FW_cmd(FW_root+"?cmd=help "+dev+"&XHR=1", function(data) { + $("#devSpecHelp").html(data); + var off = $("#devSpecHelp").position().top-20; + $('body, html').animate({scrollTop:off}, 500); + }); + }); + }); + } @@ -337,18 +340,26 @@ FW_menu(evt, el, arr, dis, fn, embedEl) $('html').bind('click.fwmenu', function() { delfwmenu(); }); } - function -FW_replaceLink(el) +FW_getLink(el) { var attr = $(el).attr("href"); if(!attr) { attr = $(el).attr("onclick"); // Tablet/smallScreen version if(!attr) - return; + return ""; attr = attr.replace(/^location.href='/,''); attr = attr.replace(/'$/,''); } + return attr; +} + +function +FW_replaceLink(el) +{ + var attr = FW_getLink(el); + if(!attr) + return; var ma = attr.match(/^(.*\?)(cmd[^=]*=.*)$/); if(ma == null || ma.length == 0 || !ma[2].match(/=(save|set)/)) {