summaryrefslogtreecommitdiff
path: root/tears.js
diff options
context:
space:
mode:
authorbie <bie@blekksprut.net>2017-08-04 07:05:12 +0000
committerbie <bie@blekksprut.net>2017-08-04 07:05:12 +0000
commit23b87b2cf914115bfdd7dea7fbea31588964cd79 (patch)
tree2b378e5b0b61635c771359fc81c74735c85b7b07 /tears.js
parent8171e8677431b360c83e69d383e367386e132f32 (diff)
parente1e6b653051119212c4c951096204160f3514f83 (diff)
downloadtears-master.tar.xz
Diffstat (limited to 'tears.js')
-rw-r--r--tears.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/tears.js b/tears.js
index e4789bf..8cec70f 100644
--- a/tears.js
+++ b/tears.js
@@ -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);
+ }
+ }
+ }
});