From 4aad39f7fa3ea21725ecab1f124f31b2b4f9f935 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Fri, 20 Dec 2013 16:07:17 +0100 Subject: [PATCH] easily toggle single bits --- web/htdocs/scripts/xmlpage.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/htdocs/scripts/xmlpage.js b/web/htdocs/scripts/xmlpage.js index 9e3e22e..dc6ffa9 100644 --- a/web/htdocs/scripts/xmlpage.js +++ b/web/htdocs/scripts/xmlpage.js @@ -1,7 +1,15 @@ function editsetting(e) { if(e.target.getAttribute("class") && e.target.getAttribute("class").indexOf("editable")!=-1) { - var text = e.target.parentNode.getAttribute("cstr"); var curr = e.target.innerHTML.split('<',1); + if (curr == '\u25a1' || curr == '\u25a0') { // search for □ and ■ + console.debug("single bit clicked"); + if (curr == '\u25a1') // in case it's □ + getdataprint('../xml-db/put.pl?'+e.target.parentNode.getAttribute("cstr")+'-'+'1','returntext',false,-1,refresh); + if (curr == '\u25a0') // in case it's ■ + getdataprint('../xml-db/put.pl?'+e.target.parentNode.getAttribute("cstr")+'-'+'0','returntext',false,-1,refresh); + return; + } + var text = e.target.parentNode.getAttribute("cstr"); text += "\nCurrent Value: "+curr+" ("+e.target.parentNode.getAttribute("raw")+")\n "; var newval = prompt(text,e.target.parentNode.getAttribute("raw")); if (newval != null) { -- 2.43.0