diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | blueprints/anmeldelse.lua | 3 | ||||
-rwxr-xr-x | tears | 3 | ||||
-rwxr-xr-x | tears.cgi | 14 | ||||
-rw-r--r-- | tears.js | 50 | ||||
-rw-r--r-- | tears.rc | 5 |
6 files changed, 57 insertions, 19 deletions
@@ -1,3 +1,4 @@ +embed.db todo vis spökvåningen diff --git a/blueprints/anmeldelse.lua b/blueprints/anmeldelse.lua index 6c449a0..9f63745 100644 --- a/blueprints/anmeldelse.lua +++ b/blueprints/anmeldelse.lua @@ -48,11 +48,8 @@ function artikkel.html(body, data) if data.portrait then html.print("<img class='headshot' src='%s'>", data.portrait) end - html.dl(data.info) - html.print("</aside>") - html.print("<section class=body>") html.print("<p><b>" .. data.lead .. "</b>") html.marxup(body) @@ -5,7 +5,8 @@ LINKS="ditt gruppe lagre oppdater rediger skriv teatime todo vis" case $1 in prepare) for link in $LINKS; do - ln -s index.html "$link" + rm "$link" + # ln -s tears.cgi "$link" done ;; '') echo "$0 [-h] command";; @@ -124,15 +124,14 @@ meny() { liste() { n=$((${GET_n:-0} + 7)) - finder="$finder -printf %h\t%TT\t%f\n" - ok=1 - $finder | sort -r | head -$n | tail -7 | while read path; do - # while read path; do + finder="$finder -printf '%h\t%TT\t%f\n'" + #$finder | sort -r | head -$n | tail -7 | while read path; do + while read path; do d=$(cut -f 1 <<<"$path") f=$(cut -f 3 <<<"$path") ok=1 - [ "$f" ] && kort "$d/$f" - done # <<< $(eval $finder | sort -r | head -$n | tail -7) + [ "$f" ] && kort $d/$f + done <<< $(eval $finder | sort -r | head -$n | tail -7) if [ -z "$ok" ]; then echo "<p><b>Ingen artikler</b>" else @@ -164,7 +163,8 @@ stikk() { skjema() { [ ! -f "$1" ] && echo "<p>finner ikke $1: <pre>$(xxd <<<$1)</pre>" && exit [ ! -w "$1" ] && echo "<p>du har ikke skrivetilgang" && exit - echo "<form id=update-article method=post action='$BASE/oppdater/$1'>" + url=$(/opt/bin/pencode <<< $1) + echo "<form id=update-article method=post action='$BASE/oppdater/$url'>" lupin -f $1 echo "<p><label>Stikkord:</label>" echo "<input type='text' name='stikkord' value='$(stikkord $1)'>" @@ -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'); @@ -1,3 +1,8 @@ +BASE="/tears" +HOST="localhost" +SCHEME="http://" + byline() { stat -c 'skrevet av %U for %G' $1 } + |