summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--blueprints/anmeldelse.lua3
-rwxr-xr-xtears3
-rwxr-xr-xtears.cgi14
-rw-r--r--tears.js50
-rw-r--r--tears.rc5
6 files changed, 57 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index f7dcdea..a164470 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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)
diff --git a/tears b/tears
index cedbffa..8183774 100755
--- a/tears
+++ b/tears
@@ -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";;
diff --git a/tears.cgi b/tears.cgi
index bd299a0..11dfe6f 100755
--- a/tears.cgi
+++ b/tears.cgi
@@ -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)'>"
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');
diff --git a/tears.rc b/tears.rc
index 308bc0f..d332773 100644
--- a/tears.rc
+++ b/tears.rc
@@ -1,3 +1,8 @@
+BASE="/tears"
+HOST="localhost"
+SCHEME="http://"
+
byline() {
stat -c 'skrevet av %U for %G' $1
}
+