diff options
author | bie <bie@blekksprut.net> | 2017-08-04 07:05:12 +0000 |
---|---|---|
committer | bie <bie@blekksprut.net> | 2017-08-04 07:05:12 +0000 |
commit | 23b87b2cf914115bfdd7dea7fbea31588964cd79 (patch) | |
tree | 2b378e5b0b61635c771359fc81c74735c85b7b07 /tears.js | |
parent | 8171e8677431b360c83e69d383e367386e132f32 (diff) | |
parent | e1e6b653051119212c4c951096204160f3514f83 (diff) | |
download | tears-master.tar.xz |
Diffstat (limited to 'tears.js')
-rw-r--r-- | tears.js | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -121,6 +121,7 @@ function button(node, html, fun) { a.innerHTML = html; a.href = "#"; a.onclick = fun; + node.parentNode.insertBefore(document.createTextNode(" "), node.nextSibling); node.parentNode.insertBefore(a, node.nextSibling); } @@ -219,6 +220,41 @@ document.addEventListener("DOMContentLoaded", function(e) { } } } + + var form = document.getElementById('update-article'); + if(form) { + form.onsubmit = function(e) { + var stikkord = document.getElementsByName('stikkord'); + if(stikkord && stikkord[0] && !stikkord[0].value) { + stikkord[0].className = "error"; + return false; + } + } + } + + var infoboxes = document.getElementsByClassName("infobox"); + for(var i = 0; i < infoboxes.length; i++) { + Sortable.create(infoboxes[i]); + var items = infoboxes[i].getElementsByTagName('li'); + for(var j = 0; j < items.length; j++) { + if(items[j].className == "last") { + var add = document.createElement("a"); + add.textContent = "+"; + add.href = "#"; + add.onclick = additem; + items[j].appendChild(add); + } else { + var del = document.createElement("a"); + del.textContent = "x"; + del.href = "#"; + del.onclick = function(e) { + e.target.parentNode.remove(); + return false; + } + items[j].appendChild(del); + } + } + } }); |