summaryrefslogtreecommitdiff
path: root/tears.js
diff options
context:
space:
mode:
Diffstat (limited to 'tears.js')
-rw-r--r--tears.js50
1 files changed, 42 insertions, 8 deletions
diff --git a/tears.js b/tears.js
index 401dbc0..8cec70f 100644
--- a/tears.js
+++ b/tears.js
@@ -177,14 +177,48 @@ document.addEventListener("DOMContentLoaded", function(e) {
var lol = document.getElementById('lol');
if(lol) {
- console.log(orz);
- button(orz[orz.length - 1], "> sitat", marxup_quote);
- button(orz[orz.length - 1], "* liste", marxup_list);
- button(orz[orz.length - 1], "[lenke]", marxup_link);
- button(orz[orz.length - 1], "<i>_kursiv_</i>", marxup_italics);
- button(orz[orz.length - 1], "<b>*fet*</b>", marxup_bold);
- button(orz[orz.length - 1], "<small>liten</small>", marxup_small);
- button(orz[orz.length - 1], "= overskrift", marxup_header);
+ button(orz, "> sitat", marxup_quote);
+ button(orz, "* liste", marxup_list);
+ button(orz, "[lenke]", marxup_link);
+ button(orz, "<i>_kursiv_</i>", marxup_italics);
+ button(orz, "<b>*fet*</b>", marxup_bold);
+ button(orz, "<small>liten</small>", marxup_small);
+ button(orz, "= overskrift", marxup_header);
+ }
+
+ 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);
+ }
+ }
}
var form = document.getElementById('update-article');