genericnode: show negation in label

This commit is contained in:
Nils Schneider 2015-07-08 20:50:26 +02:00
parent caf8383b6f
commit 036b6d6099

View file

@ -3,6 +3,11 @@ define(["filters/nodefilter"], function (nodefilter) {
var negate = false var negate = false
var refresh var refresh
var label = document.createElement("label")
var strong = document.createElement("strong")
label.textContent = name + " "
label.appendChild(strong)
function run(d) { function run(d) {
var o = dictGet(d, key.slice(0)) var o = dictGet(d, key.slice(0))
@ -21,18 +26,14 @@ define(["filters/nodefilter"], function (nodefilter) {
el.parentNode.classList.add("not") el.parentNode.classList.add("not")
else else
el.parentNode.classList.remove("not") el.parentNode.classList.remove("not")
strong.textContent = (negate ? "¬" : "" ) + value
} }
function render(el) { function render(el) {
var label = document.createElement("label") el.appendChild(label)
label.textContent = name + " "
var strong = document.createElement("strong")
strong.textContent = value
draw(el) draw(el)
label.appendChild(strong)
label.onclick = function () { label.onclick = function () {
negate = !negate negate = !negate
@ -41,8 +42,6 @@ define(["filters/nodefilter"], function (nodefilter) {
if (refresh) if (refresh)
refresh() refresh()
} }
el.appendChild(label)
} }
return { run: nodefilter(run), return { run: nodefilter(run),