From 617fb64a7652c78fdbb588eb0b77b37c242a4e00 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Mon, 23 Mar 2020 12:01:00 +0100 Subject: [PATCH] permanent link to settings on xml pages --- web/htdocs/commands/xmlpage.pm | 1 + web/htdocs/scripts/xmlpage.js | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/web/htdocs/commands/xmlpage.pm b/web/htdocs/commands/xmlpage.pm index 59d4233..0960860 100644 --- a/web/htdocs/commands/xmlpage.pm +++ b/web/htdocs/commands/xmlpage.pm @@ -84,6 +84,7 @@ print qq|
+
|; diff --git a/web/htdocs/scripts/xmlpage.js b/web/htdocs/scripts/xmlpage.js index 60d641d..c736105 100644 --- a/web/htdocs/scripts/xmlpage.js +++ b/web/htdocs/scripts/xmlpage.js @@ -2,7 +2,7 @@ if(e.target.getAttribute("class") && e.target.getAttribute("class").indexOf("editable")!=-1) { var curr = e.target.innerHTML.split('<',1); if (e.target.parentNode.getAttribute("bit") == '1') { // search for fields that represent single bits - console.debug("single bit clicked"); +// console.debug("single bit clicked"); if ( parseInt(e.target.parentNode.getAttribute("raw")) == 0 ) getdataprint('../xml-db/put.pl?'+e.target.parentNode.getAttribute("cstr")+'-'+'1','returntext',false,-1,refresh); if ( parseInt(e.target.parentNode.getAttribute("raw")) == 1 ) @@ -70,7 +70,6 @@ if(e != -1) {refresh(period);} makeCookies(); - } /* command = ""; @@ -108,7 +107,8 @@ } if(document.getElementById("address")) { setCookie("address"+currentpage,document.getElementById("address").value); - } + } + document.getElementById("permalink").href=permaLink(); } function eatCookies() { @@ -145,7 +145,23 @@ } } - +function permaLink() { + var link = location.origin + location.pathname + location.search + "#"; + + if(document.getElementById("address")) { + link += "&address="+document.getElementById("address").value; + } + if(document.getElementById("period")) { + link += "&period="+document.getElementById("period").value; + } + if(document.getElementById("target")) { + link += "&target="+document.getElementById("target").value; + } + link += "&cache="+document.getElementById("cache").checked; + link += "&rate="+document.getElementById("rate").checked; + return link; + } + /*From w3schools.com*/ function getCookie(cname,pagename) { //URI -- 2.43.0