diff options
-rw-r--r-- | blueprints/anmeldelse.lua | 82 | ||||
-rw-r--r-- | blueprints/artikkel.lua | 65 | ||||
-rw-r--r-- | date.js | 14 | ||||
-rw-r--r-- | lupin/anmeldelse.lua | 22 | ||||
-rw-r--r-- | lupin/artikkel.lua | 18 | ||||
-rw-r--r-- | sortable.js | 2 | ||||
-rwxr-xr-x | tears | 3 | ||||
-rwxr-xr-x | tears.cgi | 42 | ||||
-rw-r--r-- | tears.css | 39 | ||||
-rw-r--r-- | tears.js | 112 | ||||
-rw-r--r-- | tears.rc | 7 |
11 files changed, 307 insertions, 99 deletions
diff --git a/blueprints/anmeldelse.lua b/blueprints/anmeldelse.lua new file mode 100644 index 0000000..6c849d6 --- /dev/null +++ b/blueprints/anmeldelse.lua @@ -0,0 +1,82 @@ +local artikkel = blueprint("anmeldelse") + +local TERMS = { + ['regissør'] = 'Regissør', + manus = 'Manus', + medvirkende = 'Medvirkende', + sjanger = 'Sjanger', + norgespremiere = 'Norgespremiere', + aldersgrense = 'Aldersgrense' + +} +-- 'medvirkende', +-- 'sjanger', +-- 'norgespremiere', +-- 'aldersgrense' + +function artikkel.env(data) + data.image = os.getenv("POST_image") + data.published = os.getenv("POST_published") +end + +function artikkel.html(body, data) + if data.mode == "title" then + html.h2(data.title) + return + end + + if data.mode == "short" then + html.p{} + html.print(body or "") + return + end + + html.print("<p class=figure>") + html.img{src = data.image} + + html.h2(data.title) + + html.print("<p class=byline>") + if data.portrait then + html.print("<img class='headshot mini' src='%s'>", data.portrait) + end + html.print("<span class=navn>%s for %s</span>", data.author, data.group) + + html.print("<section class=content>") + html.print("<aside>") + if data.portrait then + html.print("<img class='headshot' src='%s'>", data.portrait) + end + html.print("</aside>") + + html.print("<section class=body>") + html.marxup(data.lead or "") + html.marxup(body) + html.print("</section>") + + html.print("</section>") +end + +function artikkel.form(body, data) + html.p{} + html.label{text="Overskrift:"} + html.text{name='title', value=data.title, size=32} + html.p{} + html.label{text="Bilde:"} + html.orz{name = "image", value = data.image} + + html.p{} + html.label{text="Inline-bilde:"} + html.orz{inline = true} + + html.p{} + html.textarea{name='text', value=body} + + html.p{} + html.infobox{values=data.info, terms=TERMS} + + html.hidden{name='type', value='anmeldelse'} +end + +return artikkel + diff --git a/blueprints/artikkel.lua b/blueprints/artikkel.lua new file mode 100644 index 0000000..506c701 --- /dev/null +++ b/blueprints/artikkel.lua @@ -0,0 +1,65 @@ +local artikkel = blueprint("default") + +function artikkel.env(data) + data.image = os.getenv("POST_image") + data.published = os.getenv("POST_published") + data.lead = os.getenv("POST_lead") +end + +function artikkel.html(body, data) + if data.mode == "title" then + html.h2(data.title) + return + end + + if data.mode == "short" then + html.p() + html.print(body) + return + end + + html.print("<p class=figure>") + html.img(data.image) + + html.h2(data.title) + + html.print("<p class=byline>") + if data.portrait then + html.print("<img class='headshot mini' src='%s'>", data.portrait) + end + html.print("<span class=navn>") + html.print("<a href='/folk/%s'>%s</a>", data.author, data.author) + html.print(" for ") + html.print("<a href='/redaksjoner/%s'>%s</a>", data.group, data.group) + html.print("</span>") + + html.print("<section class=content>") + html.print("<aside>") + if data.portrait then + html.print("<img class='headshot' src='%s'>", data.portrait) + end + html.print("</aside>") + + html.print("<section class=body>") + html.print("<p><b>" .. data.lead .. "</b>") + html.marxup(body or "") + html.print("</section>") + + html.print("</section>") +end + +function artikkel.form(body, data) + html.p{} + html.label{text="Overskrift:"} + html.text{name='title', value=data.title, size=32} + html.p{} + html.label{text="Bilde:"} + html.orz{name = "image", value = data.image} + html.p{} + html.textarea{name='lead', value=data.lead, rows=3} + html.p{} + html.textarea{name='text', value=body} +end + +return artikkel + @@ -0,0 +1,14 @@ +// moment.js +// // version : 1.7.2 +// // author : Tim Wood +// // license : MIT +// // momentjs.com +(function(a){function E(a,b,c,d){var e=c.lang();return e[a].call?e[a](c,d):e[a][b]}function F(a,b){return function(c){return K(a.call(this,c),b)}}function G(a){return function(b){var c=a.call(this,b);return c+this.lang().ordinal(c)}}function H(a,b,c){this._d=a,this._isUTC=!!b,this._a=a._a||null,this._lang=c||!1}function I(a){var b=this._data={},c=a.years||a.y||0,d=a.months||a.M||0,e=a.weeks||a.w||0,f=a.days||a.d||0,g=a.hours||a.h||0,h=a.minutes||a.m||0,i=a.seconds||a.s||0,j=a.milliseconds||a.ms||0;this._milliseconds=j+i*1e3+h*6e4+g*36e5,this._days=f+e*7,this._months=d+c*12,b.milliseconds=j%1e3,i+=J(j/1e3),b.seconds=i%60,h+=J(i/60),b.minutes=h%60,g+=J(h/60),b.hours=g%24,f+=J(g/24),f+=e*7,b.days=f%30,d+=J(f/30),b.months=d%12,c+=J(d/12),b.years=c,this._lang=!1}function J(a){return a<0?Math.ceil(a):Math.floor(a)}function K(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function L(a,b,c){var d=b._milliseconds,e=b._days,f=b._months,g;d&&a._d.setTime(+a+d*c),e&&a.date(a.date()+e*c),f&&(g=a.date(),a.date(1).month(a.month()+f*c).date(Math.min(g,a.daysInMonth())))}function M(a){return Object.prototype.toString.call(a)==="[object Array]"}function N(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function O(a,b,c,d){var e,f,g=[];for(e=0;e<7;e++)g[e]=a[e]=a[e]==null?e===2?1:0:a[e];return a[7]=g[7]=b,a[8]!=null&&(g[8]=a[8]),a[3]+=c||0,a[4]+=d||0,f=new Date(0),b?(f.setUTCFullYear(a[0],a[1],a[2]),f.setUTCHours(a[3],a[4],a[5],a[6])):(f.setFullYear(a[0],a[1],a[2]),f.setHours(a[3],a[4],a[5],a[6])),f._a=g,f}function P(a,c){var d,e,g=[];!c&&h&&(c=require("./lang/"+a));for(d=0;d<i.length;d++)c[i[d]]=c[i[d]]||f.en[i[d]];for(d=0;d<12;d++)e=b([2e3,d]),g[d]=new RegExp("^"+(c.months[d]||c.months(e,""))+"|^"+(c.monthsShort[d]||c.monthsShort(e,"")).replace(".",""),"i");return c.monthsParse=c.monthsParse||g,f[a]=c,c}function Q(a){var c=typeof a=="string"&&a||a&&a._lang||null;return c?f[c]||P(c):b}function R(a){return a.match(/\[.*\]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function S(a){var b=a.match(k),c,d;for(c=0,d=b.length;c<d;c++)D[b[c]]?b[c]=D[b[c]]:b[c]=R(b[c]);return function(e){var f="";for(c=0;c<d;c++)f+=typeof b[c].call=="function"?b[c].call(e,a):b[c];return f}}function T(a,b){function d(b){return a.lang().longDateFormat[b]||b}var c=5;while(c--&&l.test(b))b=b.replace(l,d);return A[b]||(A[b]=S(b)),A[b](a)}function U(a){switch(a){case"DDDD":return p;case"YYYY":return q;case"S":case"SS":case"SSS":case"DDD":return o;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return r;case"Z":case"ZZ":return s;case"T":return t;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return n;default:return new RegExp(a.replace("\\",""))}}function V(a,b,c,d){var e,f;switch(a){case"M":case"MM":c[1]=b==null?0:~~b-1;break;case"MMM":case"MMMM":for(e=0;e<12;e++)if(Q().monthsParse[e].test(b)){c[1]=e,f=!0;break}f||(c[8]=!1);break;case"D":case"DD":case"DDD":case"DDDD":b!=null&&(c[2]=~~b);break;case"YY":c[0]=~~b+(~~b>70?1900:2e3);break;case"YYYY":c[0]=~~Math.abs(b);break;case"a":case"A":d.isPm=(b+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b;break;case"S":case"SS":case"SSS":c[6]=~~(("0."+b)*1e3);break;case"Z":case"ZZ":d.isUTC=!0,e=(b+"").match(x),e&&e[1]&&(d.tzh=~~e[1]),e&&e[2]&&(d.tzm=~~e[2]),e&&e[0]==="+"&&(d.tzh=-d.tzh,d.tzm=-d.tzm)}b==null&&(c[8]=!1)}function W(a,b){var c=[0,0,1,0,0,0,0],d={tzh:0,tzm:0},e=b.match(k),f,g;for(f=0;f<e.length;f++)g=(U(e[f]).exec(a)||[])[0],g&&(a=a.slice(a.indexOf(g)+g.length)),D[e[f]]&&V(e[f],g,c,d);return d.isPm&&c[3]<12&&(c[3]+=12),d.isPm===!1&&c[3]===12&&(c[3]=0),O(c,d.isUTC,d.tzh,d.tzm)}function X(a,b){var c,d=a.match(m)||[],e,f=99,g,h,i;for(g=0;g<b.length;g++)h=W(a,b[g]),e=T(new H(h),b[g]).match(m)||[],i=N(d,e),i<f&&(f=i,c=h);return c}function Y(a){var b="YYYY-MM-DDT",c;if(u.exec(a)){for(c=0;c<4;c++)if(w[c][1].exec(a)){b+=w[c][0];break}return s.exec(a)?W(a,b+" Z"):W(a,b)}return new Date(a)}function Z(a,b,c,d,e){var f=e.relativeTime[a];return typeof f=="function"?f(b||1,!!c,a,d):f.replace(/%d/i,b||1)}function $(a,b,c){var e=d(Math.abs(a)/1e3),f=d(e/60),g=d(f/60),h=d(g/24),i=d(h/365),j=e<45&&["s",e]||f===1&&["m"]||f<45&&["mm",f]||g===1&&["h"]||g<22&&["hh",g]||h===1&&["d"]||h<=25&&["dd",h]||h<=45&&["M"]||h<345&&["MM",d(h/30)]||i===1&&["y"]||["yy",i];return j[2]=b,j[3]=a>0,j[4]=c,Z.apply({},j)}function _(a,c){b.fn[a]=function(a){var b=this._isUTC?"UTC":"";return a!=null?(this._d["set"+b+c](a),this):this._d["get"+b+c]()}}function ab(a){b.duration.fn[a]=function(){return this._data[a]}}function bb(a,c){b.duration.fn["as"+a]=function(){return+this/c}}var b,c="1.7.2",d=Math.round,e,f={},g="en",h=typeof module!="undefined"&&module.exports,i="months|monthsShort|weekdays|weekdaysShort|weekdaysMin|longDateFormat|calendar|relativeTime|ordinal|meridiem".split("|"),j=/^\/?Date\((\-?\d+)/i,k=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?|.)/g,l=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?)/g,m=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,n=/\d\d?/,o=/\d{1,3}/,p=/\d{3}/,q=/\d{1,4}/,r=/[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+/i,s=/Z|[\+\-]\d\d:?\d\d/i,t=/T/i,u=/^\s*\d{4}-\d\d-\d\d(T(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,v="YYYY-MM-DDTHH:mm:ssZ",w=[["HH:mm:ss.S",/T\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/T\d\d:\d\d:\d\d/],["HH:mm",/T\d\d:\d\d/],["HH",/T\d\d/]],x=/([\+\-]|\d\d)/gi,y="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),z={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},A={},B="DDD w M D d".split(" "),C="M D H h m s w".split(" "),D={M:function(){return this.month()+1},MMM:function(a){return E("monthsShort",this.month(),this,a)},MMMM:function(a){return E("months",this.month(),this,a)},D:function(){return this.date()},DDD:function(){var a=new Date(this.year(),this.month(),this.date()),b=new Date(this.year(),0,1);return~~((a-b)/864e5+1.5)},d:function(){return this.day()},dd:function(a){return E("weekdaysMin",this.day(),this,a)},ddd:function(a){return E("weekdaysShort",this.day(),this,a)},dddd:function(a){return E("weekdays",this.day(),this,a)},w:function(){var a=new Date(this.year(),this.month(),this.date()-this.day()+5),b=new Date(a.getFullYear(),0,4);return~~((a-b)/864e5/7+1.5)},YY:function(){return K(this.year()%100,2)},YYYY:function(){return K(this.year(),4)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return K(~~(this.milliseconds()/10),2)},SSS:function(){return K(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return a<0&&(a=-a,b="-"),b+K(~~(a/60),2)+":"+K(~~a%60,2)},ZZ:function(){var a=-this.zone(),b="+";return a<0&&(a=-a,b="-"),b+K(~~(10*a/6),4)}};while(B.length)e=B.pop(),D[e+"o"]=G(D[e]);while(C.length)e=C.pop(),D[e+e]=F(D[e],2);D.DDDD=F(D.DDD,3),b=function(c,d){if(c===null||c==="")return null;var e,f;return b.isMoment(c)?new H(new Date(+c._d),c._isUTC,c._lang):(d?M(d)?e=X(c,d):e=W(c,d):(f=j.exec(c),e=c===a?new Date:f?new Date(+f[1]):c instanceof Date?c:M(c)?O(c):typeof c=="string"?Y(c):new Date(c)),new H(e))},b.utc=function(a,c){return M(a)?new H(O(a,!0),!0):(typeof a=="string"&&!s.exec(a)&&(a+=" +0000",c&&(c+=" Z")),b(a,c).utc())},b.unix=function(a){return b(a*1e3)},b.duration=function(a,c){var d=b.isDuration(a),e=typeof a=="number",f=d?a._data:e?{}:a,g;return e&&(c?f[c]=a:f.milliseconds=a),g=new I(f),d&&(g._lang=a._lang),g},b.humanizeDuration=function(a,c,d){return b.duration(a,c===!0?null:c).humanize(c===!0?!0:d)},b.version=c,b.defaultFormat=v,b.lang=function(a,c){var d;if(!a)return g;(c||!f[a])&&P(a,c);if(f[a]){for(d=0;d<i.length;d++)b[i[d]]=f[a][i[d]];b.monthsParse=f[a].monthsParse,g=a}},b.langData=Q,b.isMoment=function(a){return a instanceof H},b.isDuration=function(a){return a instanceof I},b.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),b.fn=H.prototype={clone:function(){return b(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this._d.toString()},toDate:function(){return this._d},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds(),!!this._isUTC]},isValid:function(){return this._a?this._a[8]!=null?!!this._a[8]:!N(this._a,(this._a[7]?b.utc(this._a):b(this._a)).toArray()):!isNaN(this._d.getTime())},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(a){return T(this,a?a:b.defaultFormat)},add:function(a,c){var d=c?b.duration(+c,a):b.duration(a);return L(this,d,1),this},subtract:function(a,c){var d=c?b.duration(+c,a):b.duration(a);return L(this,d,-1),this},diff:function(a,c,e){var f=this._isUTC?b(a).utc():b(a).local(),g=(this.zone()-f.zone())*6e4,h=this._d-f._d-g,i=this.year()-f.year(),j=this.month()-f.month(),k=this.date()-f.date(),l;return c==="months"?l=i*12+j+k/30:c==="years"?l=i+(j+k/30)/12:l=c==="seconds"?h/1e3:c==="minutes"?h/6e4:c==="hours"?h/36e5:c==="days"?h/864e5:c==="weeks"?h/6048e5:h,e?l:d(l)},from:function(a,c){return b.duration(this.diff(a)).lang(this._lang).humanize(!c)},fromNow:function(a){return this.from(b(),a)},calendar:function(){var a=this.diff(b().sod(),"days",!0),c=this.lang().calendar,d=c.sameElse,e=a<-6?d:a<-1?c.lastWeek:a<0?c.lastDay:a<1?c.sameDay:a<2?c.nextDay:a<7?c.nextWeek:d;return this.format(typeof e=="function"?e.apply(this):e)},isLeapYear:function(){var a=this.year();return a%4===0&&a%100!==0||a%400===0},isDST:function(){return this.zone()<b([this.year()]).zone()||this.zone()<b([this.year(),5]).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return a==null?b:this.add({d:a-b})},startOf:function(a){switch(a.replace(/s$/,"")){case"year":this.month(0);case"month":this.date(1);case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return this},endOf:function(a){return this.startOf(a).add(a.replace(/s?$/,"s"),1).subtract("ms",1)},sod:function(){return this.clone().startOf("day")},eod:function(){return this.clone().endOf("day")},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return b.utc([this.year(),this.month()+1,0]).date()},lang:function(b){return b===a?Q(this):(this._lang=b,this)}};for(e=0;e<y.length;e++)_(y[e].toLowerCase(),y[e]);_("year","FullYear"),b.duration.fn=I.prototype={weeks:function(){return J(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(a){var b=+this,c=this.lang().relativeTime,d=$(b,!a,this.lang()),e=b<=0?c.past:c.future;return a&&(typeof e=="function"?d=e(d):d=e.replace(/%s/i,d)),d},lang:b.fn.lang};for(e in z)z.hasOwnProperty(e)&&(bb(e,z[e]),ab(e.toLowerCase()));bb("Weeks",6048e5),h&&(module.exports=b),typeof ender=="undefined"&&(this.moment=b),typeof define=="function"&&define.amd&&define("moment",[],function(){return b})}).call(this); + +/*! + * Pikaday + * Copyright © 2012 David Bushell | BSD & MIT license | http://dbushell.com/ + */ +(function(e,t,n){"use strict";var r=typeof e.moment=="function",i=!!e.addEventListener,s=e.setTimeout,o=function(e,t,n,r){i?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n)},u=function(e,t,n,r){i?e.removeEventListener(t,n,!!r):e.detachEvent("on"+t,n)},a=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},f=function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")!==-1},l=function(e,t){f(e,t)||(e.className=e.className===""?t:e.className+" "+t)},c=function(e,t){e.className=a((" "+e.className+" ").replace(" "+t+" "," "))},h=function(e){return/Array/.test(Object.prototype.toString.call(e))},p=function(e){return/Date/.test(Object.prototype.toString.call(e))&&!isNaN(e.getTime())},d=function(e){return e%4===0&&e%100!==0||e%400===0},v=function(e,t){return[31,d(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},m=function(e,t){return e.getTime()===t.getTime()},g=function(e,t,r){var i,s;for(i in t){s=e[i]!==n;if(s&&typeof t[i]=="object"&&t[i].nodeName===n)p(t[i])?r&&(e[i]=new Date(t[i].getTime())):h(t[i])?r&&(e[i]=t[i].slice(0)):e[i]=g({},t[i],r);else if(r||!s)e[i]=t[i]}return e},y={field:null,bound:n,format:"YYYY-MM-DD",defaultDate:null,setDefaultDate:!1,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:n,maxMonth:n,isRTL:!1,numberOfMonths:1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},onSelect:null,onOpen:null,onClose:null},b=function(e,t,n){t+=e.firstDay;while(t>=7)t-=7;return n?e.i18n.weekdaysShort[t]:e.i18n.weekdays[t]},w=function(e,t,n,r,i){if(i)return'<td class="is-empty"></td>';var s=[];return r&&s.push("is-disabled"),n&&s.push("is-today"),t&&s.push("is-selected"),'<td data-day="'+e+'" class="'+s.join(" ")+'"><button class="pika-button" type="button">'+e+"</button>"+"</td>"},E=function(e,t){return"<tr>"+(t?e.reverse():e).join("")+"</tr>"},S=function(e){return"<tbody>"+e.join("")+"</tbody>"},x=function(e){var t,n=[];for(t=0;t<7;t++)n.push('<th scope="col"><abbr title="'+b(e,t)+'">'+b(e,t,!0)+"</abbr></th>");return"<thead>"+(e.isRTL?n.reverse():n).join("")+"</thead>"},T=function(e){var t,n,r,i=e._o,s=e._m,o=e._y,u=o===i.minYear,a=o===i.maxYear,f='<div class="pika-title">',l=!0,c=!0;for(r=[],t=0;t<12;t++)r.push('<option value="'+t+'"'+(t===s?" selected":"")+(u&&t<i.minMonth||a&&t>i.maxMonth?"disabled":"")+">"+i.i18n.months[t]+"</option>");f+='<div class="pika-label">'+i.i18n.months[s]+'<select class="pika-select pika-select-month">'+r.join("")+"</select></div>",h(i.yearRange)?(t=i.yearRange[0],n=i.yearRange[1]+1):(t=o-i.yearRange,n=1+o+i.yearRange);for(r=[];t<n&&t<=i.maxYear;t++)t>=i.minYear&&r.push('<option value="'+t+'"'+(t===o?" selected":"")+">"+t+"</option>");return f+='<div class="pika-label">'+o+'<select class="pika-select pika-select-year">'+r.join("")+"</select></div>",u&&(s===0||i.minMonth>=s)&&(l=!1),a&&(s===11||i.maxMonth<=s)&&(c=!1),f+='<button class="pika-prev'+(l?"":" is-disabled")+'" type="button">Previous Month</button>',f+='<button class="pika-next'+(c?"":" is-disabled")+'" type="button">Next Month</button>',f+="</div>"},N=function(e,t){return'<table cellpadding="0" cellspacing="0" class="pika-table">'+x(e)+S(t)+"</table>"};e.Pikaday=function(n){var u=this,a=u.config(n);u._onMouseDown=function(t){if(!u._v)return;t=t||e.event;var n=t.target||t.srcElement;if(!n)return;if(!f(n,"is-disabled")){if(f(n,"pika-button")&&!f(n,"is-empty")){u.setDate(new Date(u._y,u._m,parseInt(n.innerHTML,10))),a.bound&&s(function(){u.hide()},100);return}f(n,"pika-prev")?u.prevMonth():f(n,"pika-next")&&u.nextMonth()}if(!f(n,"pika-select")){if(!t.preventDefault)return t.returnValue=!1;t.preventDefault()}else u._c=!0},u._onChange=function(t){t=t||e.event;var n=t.target||t.srcElement;if(!n)return;f(n,"pika-select-month")?u.gotoMonth(n.value):f(n,"pika-select-year")&&u.gotoYear(n.value)},u._onInputChange=function(t){if(r)u.setDate(e.moment(a.field.value,a.format).toDate());else{var n=new Date(Date.parse(a.field.value));u.setDate(p(n)?n:null)}u._v||u.show()},u._onInputFocus=function(e){u.show()},u._onInputClick=function(e){u.show()},u._onInputBlur=function(e){u._c||(u._b=s(function(){u.hide()},50)),u._c=!1},u._onClick=function(t){t=t||e.event;var n=t.target||t.srcElement,r=n;if(!n)return;!i&&f(n,"pika-select")&&(n.onchange||(n.setAttribute("onchange","return;"),o(n,"change",u._onChange)));do if(f(r,"pika-single"))return;while(r=r.parentNode);u._v&&n!==a.field&&u.hide()},u.el=t.createElement("div"),u.el.className="pika-single"+(a.isRTL?" is-rtl":""),o(u.el,"mousedown",u._onMouseDown,!0),o(u.el,"change",u._onChange),a.field&&(a.bound?t.body.appendChild(u.el):a.field.parentNode.insertBefore(u.el,a.field.nextSibling),o(a.field,"change",u._onInputChange),a.defaultDate||(r&&a.field.value?a.defaultDate=e.moment(a.field.value,a.format).toDate():a.defaultDate=new Date(Date.parse(a.field.value)),a.setDefaultDate=!0));var l=a.defaultDate;p(l)?a.setDefaultDate?u.setDate(l):u.gotoDate(l):u.gotoDate(new Date),a.bound?(this.hide(),u.el.className+=" is-bound",o(a.field,"click",u._onInputClick),o(a.field,"focus",u._onInputFocus),o(a.field,"blur",u._onInputBlur)):this.show()},e.Pikaday.prototype={config:function(e){this._o||(this._o=g({},y,!0));var t=g(this._o,e,!0);t.isRTL=!!t.isRTL,t.field=t.field&&t.field.nodeName?t.field:null,t.bound=!!(t.bound!==n?t.field&&t.bound:t.field);var r=parseInt(t.numberOfMonths,10)||1;t.numberOfMonths=r>4?4:r,p(t.minDate)||(t.minDate=!1),p(t.maxDate)||(t.maxDate=!1),t.minDate&&t.maxDate&&t.maxDate<t.minDate&&(t.maxDate=t.minDate=!1),t.minDate&&(t.minYear=t.minDate.getFullYear(),t.minMonth=t.minDate.getMonth()),t.maxDate&&(t.maxYear=t.maxDate.getFullYear(),t.maxMonth=t.maxDate.getMonth());if(h(t.yearRange)){var i=(new Date).getFullYear()-10;t.yearRange[0]=parseInt(t.yearRange[0],10)||i,t.yearRange[1]=parseInt(t.yearRange[1],10)||i}else t.yearRange=Math.abs(parseInt(t.yearRange,10))||y.yearRange,t.yearRange>100&&(t.yearRange=100);return t},toString:function(t){return p(this._d)?r?e.moment(this._d).format(t||this._o.format):this._d.toDateString():""},getMoment:function(){return r?e.moment(this._d):null},getDate:function(){return p(this._d)?new Date(this._d.getTime()):null},setDate:function(e){if(!e)return this._d=null,this.draw();typeof e=="string"&&(e=new Date(Date.parse(e)));if(!p(e))return;var t=this._o.minDate,n=this._o.maxDate;p(t)&&e<t?e=t:p(n)&&e>n&&(e=n),this._d=new Date(e.getTime()),this._d.setHours(0,0,0,0),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString()),typeof this._o.onSelect=="function"&&this._o.onSelect.call(this,this.getDate())},gotoDate:function(e){if(!p(e))return;this._y=e.getFullYear(),this._m=e.getMonth(),this.draw()},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(e){isNaN(e=parseInt(e,10))||(this._m=e<0?0:e>11?11:e,this.draw())},nextMonth:function(){++this._m>11&&(this._m=0,this._y++),this.draw()},prevMonth:function(){--this._m<0&&(this._m=11,this._y--),this.draw()},gotoYear:function(e){isNaN(e)||(this._y=parseInt(e,10),this.draw())},draw:function(e){if(!this._v&&!e)return;var t=this._o,n=t.minYear,r=t.maxYear,i=t.minMonth,o=t.maxMonth;this._y<=n&&(this._y=n,!isNaN(i)&&this._m<i&&(this._m=i)),this._y>=r&&(this._y=r,!isNaN(o)&&this._m>o&&(this._m=o)),this.el.innerHTML=T(this)+this.render(this._y,this._m);if(t.bound){var u=t.field,a=u.offsetLeft,f=u.offsetTop+u.offsetHeight;while(u=u.offsetParent)a+=u.offsetLeft,f+=u.offsetTop;this.el.style.cssText="position:absolute;left:"+a+"px;top:"+f+"px;",s(function(){t.field.focus()},1)}},render:function(e,t){var n=this._o,r=new Date,i=v(e,t),s=(new Date(e,t,1)).getDay(),o=[],u=[];r.setHours(0,0,0,0),n.firstDay>0&&(s-=n.firstDay,s<0&&(s+=7));var a=i+s,f=a;while(f>7)f-=7;a+=7-f;for(var l=0,c=0;l<a;l++){var h=new Date(e,t,1+(l-s)),d=n.minDate&&h<n.minDate||n.maxDate&&h>n.maxDate,g=p(this._d)?m(h,this._d):!1,y=m(h,r),b=l<s||l>=i+s;u.push(w(1+(l-s),g,y,d,b)),++c===7&&(o.push(E(u,n.isRTL)),u=[],c=0)}return N(n,o)},isVisible:function(){return this._v},show:function(){this._v||(this._o.bound&&o(t,"click",this._onClick),c(this.el,"is-hidden"),this._v=!0,this.draw(),typeof this._o.onOpen=="function"&&this._o.onOpen.call(this))},hide:function(){var e=this._v;e!==!1&&(this._o.bound&&u(t,"click",this._onClick),this.el.style.cssText="",l(this.el,"is-hidden"),this._v=!1,e!==n&&typeof this._o.onClose=="function"&&this._o.onClose.call(this))},destroy:function(){this.hide(),u(this.el,"mousedown",this._onMouseDown,!0),u(this.el,"change",this._onChange),this._o.field&&(u(this._o.field,"change",this._onInputChange),this._o.bound&&(u(this._o.field,"click",this._onInputClick),u(this._o.field,"focus",this._onInputFocus),u(this._o.field,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}})(window,window.document); + + diff --git a/lupin/anmeldelse.lua b/lupin/anmeldelse.lua deleted file mode 100644 index 37a441b..0000000 --- a/lupin/anmeldelse.lua +++ /dev/null @@ -1,22 +0,0 @@ -local artikkel = blueprint("anmeldelse") - -function artikkel.env(data) - data.terningkast = os.getenv("POST_terningkast") or "" - data.publisert = os.getenv("POST_publisert") or "" -end - -function artikkel.form(body, data) - html.p() - html.label("Overskrift:") - html.text('title', data.title, 32) - html.p() - html.label("Terningkast:") - html.p(data.terningkast) - html.select('terningkast', { 1, 2, 3, 4, 5, 6 }, data.terningkast or 1) - html.p() - html.textarea('tekst', body) - html.hidden('type', 'anmeldelse') -end - -return artikkel - diff --git a/lupin/artikkel.lua b/lupin/artikkel.lua deleted file mode 100644 index 3ad2f4d..0000000 --- a/lupin/artikkel.lua +++ /dev/null @@ -1,18 +0,0 @@ -local artikkel = blueprint("default") - -function artikkel.env(data) - data.bilde = os.getenv("POST_bilde") - data.publisert = os.getenv("POST_publisert") -end - -function artikkel.form(body, data) - html.p() - html.label("Overskrift:") - html.text('title', data.title, 32) - html.orz('bilde', data.bilde or '') - html.p() - html.textarea('tekst', body) -end - -return artikkel - diff --git a/sortable.js b/sortable.js new file mode 100644 index 0000000..573538f --- /dev/null +++ b/sortable.js @@ -0,0 +1,2 @@ +/*! Sortable 1.6.0 - MIT | git://github.com/rubaxa/Sortable.git */ +!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():window.Sortable=a()}(function(){"use strict";function a(a,b){if(!a||!a.nodeType||1!==a.nodeType)throw"Sortable: `el` must be HTMLElement, and not "+{}.toString.call(a);this.el=a,this.options=b=t({},b),a[T]=this;var c={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0}};for(var d in c)!(d in b)&&(b[d]=c[d]);ga(b);for(var e in this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this));this.nativeDraggable=!b.forceFallback&&$,f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(f(a,"dragover",this),f(a,"dragenter",this)),ea.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a,b){"clone"!==a.lastPullMode&&(b=!0),z&&z.state!==b&&(i(z,"display",b?"none":""),b||z.state&&(a.options.group.revertClone?(A.insertBefore(z,B),a._animate(w,z)):A.insertBefore(z,w)),z.state=b)}function c(a,b,c){if(a){c=c||V;do if(">*"===b&&a.parentNode===c||r(a,b))return a;while(a=d(a))}return null}function d(a){var b=a.host;return b&&b.nodeType?b:a.parentNode}function e(a){a.dataTransfer&&(a.dataTransfer.dropEffect="move"),a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,Z)}function g(a,b,c){a.removeEventListener(b,c,Z)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(R," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(R," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return V.defaultView&&V.defaultView.getComputedStyle?c=V.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;e<f;e++)c(d[e],e);return d}return[]}function k(a,b,c,d,e,f,g){a=a||b[T];var h=V.createEvent("Event"),i=a.options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.to=b,h.from=e||b,h.item=d||b,h.clone=z,h.oldIndex=f,h.newIndex=g,b.dispatchEvent(h),i[j]&&i[j].call(a,h)}function l(a,b,c,d,e,f,g,h){var i,j,k=a[T],l=k.options.onMove;return i=V.createEvent("Event"),i.initEvent("move",!0,!0),i.to=b,i.from=a,i.dragged=c,i.draggedRect=d,i.related=e||b,i.relatedRect=f||b.getBoundingClientRect(),i.willInsertAfter=h,a.dispatchEvent(i),l&&(j=l.call(k,i,g)),j}function m(a){a.draggable=!1}function n(){aa=!1}function o(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return b.clientY-(d.top+d.height)>5||b.clientX-(d.left+d.width)>5}function p(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function q(a,b){var c=0;if(!a||!a.parentNode)return-1;for(;a&&(a=a.previousElementSibling);)"TEMPLATE"===a.nodeName.toUpperCase()||">*"!==b&&!r(a,b)||c++;return c}function r(a,b){if(a){b=b.split(".");var c=b.shift().toUpperCase(),d=new RegExp("\\s("+b.join("|")+")(?=\\s)","g");return!(""!==c&&a.nodeName.toUpperCase()!=c||b.length&&((" "+a.className+" ").match(d)||[]).length!=b.length)}return!1}function s(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function t(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function u(a){return X?X(a).clone(!0)[0]:Y&&Y.dom?Y.dom(a).cloneNode(!0):a.cloneNode(!0)}function v(a){for(var b=a.getElementsByTagName("input"),c=b.length;c--;){var d=b[c];d.checked&&da.push(d)}}if("undefined"==typeof window||!window.document)return function(){throw new Error("Sortable.js requires a window with a document")};var w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q={},R=/\s+/g,S=/left|right|inline/,T="Sortable"+(new Date).getTime(),U=window,V=U.document,W=U.parseInt,X=U.jQuery||U.Zepto,Y=U.Polymer,Z=!1,$=!!("draggable"in V.createElement("div")),_=function(a){return!navigator.userAgent.match(/Trident.*rv[ :]?11\./)&&(a=V.createElement("x"),a.style.cssText="pointer-events:auto","auto"===a.style.pointerEvents)}(),aa=!1,ba=Math.abs,ca=Math.min,da=[],ea=[],fa=s(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h,i,j=c[T],k=b.scrollSensitivity,l=b.scrollSpeed,m=a.clientX,n=a.clientY,o=window.innerWidth,p=window.innerHeight;if(E!==c&&(D=b.scroll,E=c,F=b.scrollFn,D===!0)){D=c;do if(D.offsetWidth<D.scrollWidth||D.offsetHeight<D.scrollHeight)break;while(D=D.parentNode)}D&&(d=D,e=D.getBoundingClientRect(),f=(ba(e.right-m)<=k)-(ba(e.left-m)<=k),g=(ba(e.bottom-n)<=k)-(ba(e.top-n)<=k)),f||g||(f=(o-m<=k)-(m<=k),g=(p-n<=k)-(n<=k),(f||g)&&(d=U)),Q.vx===f&&Q.vy===g&&Q.el===d||(Q.el=d,Q.vx=f,Q.vy=g,clearInterval(Q.pid),d&&(Q.pid=setInterval(function(){return i=g?g*l:0,h=f?f*l:0,"function"==typeof F?F.call(j,h,i,a):void(d===U?U.scrollTo(U.pageXOffset+h,U.pageYOffset+i):(d.scrollTop+=i,d.scrollLeft+=h))},24)))}},30),ga=function(a){function b(a,b){return void 0!==a&&a!==!0||(a=c.name),"function"==typeof a?a:function(c,d){var e=d.options.group.name;return b?a:a&&(a.join?a.indexOf(e)>-1:e==a)}}var c={},d=a.group;d&&"object"==typeof d||(d={name:d}),c.name=d.name,c.checkPull=b(d.pull,!0),c.checkPut=b(d.put),c.revertClone=d.revertClone,a.group=c};a.prototype={constructor:a,_onTapStart:function(a){var b,d=this,e=this.el,f=this.options,g=f.preventOnFilter,h=a.type,i=a.touches&&a.touches[0],j=(i||a).target,l=a.target.shadowRoot&&a.path[0]||j,m=f.filter;if(v(e),!w&&!("mousedown"===h&&0!==a.button||f.disabled)&&(j=c(j,f.draggable,e),j&&C!==j)){if(b=q(j,f.draggable),"function"==typeof m){if(m.call(this,a,j,this))return k(d,l,"filter",j,e,b),void(g&&a.preventDefault())}else if(m&&(m=m.split(",").some(function(a){if(a=c(l,a.trim(),e))return k(d,a,"filter",j,e,b),!0})))return void(g&&a.preventDefault());f.handle&&!c(l,f.handle,e)||this._prepareDragStart(a,i,j,b)}},_prepareDragStart:function(a,b,c,d){var e,g=this,i=g.el,l=g.options,n=i.ownerDocument;c&&!w&&c.parentNode===i&&(N=a,A=i,w=c,x=w.parentNode,B=w.nextSibling,C=c,L=l.group,J=d,this._lastX=(b||a).clientX,this._lastY=(b||a).clientY,w.style["will-change"]="transform",e=function(){g._disableDelayedDrag(),w.draggable=g.nativeDraggable,h(w,l.chosenClass,!0),g._triggerDragStart(a,b),k(g,A,"choose",w,A,J)},l.ignore.split(",").forEach(function(a){j(w,a.trim(),m)}),f(n,"mouseup",g._onDrop),f(n,"touchend",g._onDrop),f(n,"touchcancel",g._onDrop),f(n,"pointercancel",g._onDrop),f(n,"selectstart",g),l.delay?(f(n,"mouseup",g._disableDelayedDrag),f(n,"touchend",g._disableDelayedDrag),f(n,"touchcancel",g._disableDelayedDrag),f(n,"mousemove",g._disableDelayedDrag),f(n,"touchmove",g._disableDelayedDrag),f(n,"pointermove",g._disableDelayedDrag),g._dragStartTimer=setTimeout(e,l.delay)):e())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mouseup",this._disableDelayedDrag),g(a,"touchend",this._disableDelayedDrag),g(a,"touchcancel",this._disableDelayedDrag),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag),g(a,"pointermove",this._disableDelayedDrag)},_triggerDragStart:function(a,b){b=b||("touch"==a.pointerType?a:null),b?(N={target:w,clientX:b.clientX,clientY:b.clientY},this._onDragStart(N,"touch")):this.nativeDraggable?(f(w,"dragend",this),f(A,"dragstart",this._onDragStart)):this._onDragStart(N,!0);try{V.selection?setTimeout(function(){V.selection.empty()}):window.getSelection().removeAllRanges()}catch(a){}},_dragStarted:function(){if(A&&w){var b=this.options;h(w,b.ghostClass,!0),h(w,b.dragClass,!1),a.active=this,k(this,A,"start",w,A,J)}else this._nulling()},_emulateDragOver:function(){if(O){if(this._lastX===O.clientX&&this._lastY===O.clientY)return;this._lastX=O.clientX,this._lastY=O.clientY,_||i(y,"display","none");var a=V.elementFromPoint(O.clientX,O.clientY),b=a,c=ea.length;if(b)do{if(b[T]){for(;c--;)ea[c]({clientX:O.clientX,clientY:O.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);_||i(y,"display","")}},_onTouchMove:function(b){if(N){var c=this.options,d=c.fallbackTolerance,e=c.fallbackOffset,f=b.touches?b.touches[0]:b,g=f.clientX-N.clientX+e.x,h=f.clientY-N.clientY+e.y,j=b.touches?"translate3d("+g+"px,"+h+"px,0)":"translate("+g+"px,"+h+"px)";if(!a.active){if(d&&ca(ba(f.clientX-this._lastX),ba(f.clientY-this._lastY))<d)return;this._dragStarted()}this._appendGhost(),P=!0,O=f,i(y,"webkitTransform",j),i(y,"mozTransform",j),i(y,"msTransform",j),i(y,"transform",j),b.preventDefault()}},_appendGhost:function(){if(!y){var a,b=w.getBoundingClientRect(),c=i(w),d=this.options;y=w.cloneNode(!0),h(y,d.ghostClass,!1),h(y,d.fallbackClass,!0),h(y,d.dragClass,!0),i(y,"top",b.top-W(c.marginTop,10)),i(y,"left",b.left-W(c.marginLeft,10)),i(y,"width",b.width),i(y,"height",b.height),i(y,"opacity","0.8"),i(y,"position","fixed"),i(y,"zIndex","100000"),i(y,"pointerEvents","none"),d.fallbackOnBody&&V.body.appendChild(y)||A.appendChild(y),a=y.getBoundingClientRect(),i(y,"width",2*b.width-a.width),i(y,"height",2*b.height-a.height)}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;this._offUpEvents(),L.checkPull(this,this,w,a)&&(z=u(w),z.draggable=!1,z.style["will-change"]="",i(z,"display","none"),h(z,this.options.chosenClass,!1),A.insertBefore(z,w),k(this,A,"clone",w)),h(w,d.dragClass,!0),b?("touch"===b?(f(V,"touchmove",this._onTouchMove),f(V,"touchend",this._onDrop),f(V,"touchcancel",this._onDrop),f(V,"pointermove",this._onTouchMove),f(V,"pointerup",this._onDrop)):(f(V,"mousemove",this._onTouchMove),f(V,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,50)):(c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,w)),f(V,"drop",this),setTimeout(this._dragStarted,0))},_onDragOver:function(d){var e,f,g,h,j=this.el,k=this.options,m=k.group,p=a.active,q=L===m,r=!1,s=k.sort;if(void 0!==d.preventDefault&&(d.preventDefault(),!k.dragoverBubble&&d.stopPropagation()),!w.animated&&(P=!0,p&&!k.disabled&&(q?s||(h=!A.contains(w)):M===this||(p.lastPullMode=L.checkPull(this,p,w,d))&&m.checkPut(this,p,w,d))&&(void 0===d.rootEl||d.rootEl===this.el))){if(fa(d,k,this.el),aa)return;if(e=c(d.target,k.draggable,j),f=w.getBoundingClientRect(),M!==this&&(M=this,r=!0),h)return b(p,!0),x=A,void(z||B?A.insertBefore(w,z||B):s||A.appendChild(w));if(0===j.children.length||j.children[0]===y||j===d.target&&o(j,d)){if(0!==j.children.length&&j.children[0]!==y&&j===d.target&&(e=j.lastElementChild),e){if(e.animated)return;g=e.getBoundingClientRect()}b(p,q),l(A,j,w,f,e,g,d)!==!1&&(w.contains(j)||(j.appendChild(w),x=j),this._animate(f,w),e&&this._animate(g,e))}else if(e&&!e.animated&&e!==w&&void 0!==e.parentNode[T]){G!==e&&(G=e,H=i(e),I=i(e.parentNode)),g=e.getBoundingClientRect();var t=g.right-g.left,u=g.bottom-g.top,v=S.test(H.cssFloat+H.display)||"flex"==I.display&&0===I["flex-direction"].indexOf("row"),C=e.offsetWidth>w.offsetWidth,D=e.offsetHeight>w.offsetHeight,E=(v?(d.clientX-g.left)/t:(d.clientY-g.top)/u)>.5,F=e.nextElementSibling,J=!1;if(v){var K=w.offsetTop,N=e.offsetTop;J=K===N?e.previousElementSibling===w&&!C||E&&C:e.previousElementSibling===w||w.previousElementSibling===e?(d.clientY-g.top)/u>.5:N>K}else r||(J=F!==w&&!D||E&&D);var O=l(A,j,w,f,e,g,d,J);O!==!1&&(1!==O&&O!==-1||(J=1===O),aa=!0,setTimeout(n,30),b(p,q),w.contains(j)||(J&&!F?j.appendChild(w):e.parentNode.insertBefore(w,J?F:e)),x=w.parentNode,this._animate(f,w),this._animate(g,e))}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();1===a.nodeType&&(a=a.getBoundingClientRect()),i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(V,"touchmove",this._onTouchMove),g(V,"pointermove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"pointerup",this._onDrop),g(a,"touchcancel",this._onDrop),g(a,"pointercancel",this._onDrop),g(a,"selectstart",this)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(Q.pid),clearTimeout(this._dragStartTimer),g(V,"mousemove",this._onTouchMove),this.nativeDraggable&&(g(V,"drop",this),g(c,"dragstart",this._onDragStart)),this._offUpEvents(),b&&(P&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation()),y&&y.parentNode&&y.parentNode.removeChild(y),A!==x&&"clone"===a.active.lastPullMode||z&&z.parentNode&&z.parentNode.removeChild(z),w&&(this.nativeDraggable&&g(w,"dragend",this),m(w),w.style["will-change"]="",h(w,this.options.ghostClass,!1),h(w,this.options.chosenClass,!1),k(this,A,"unchoose",w,A,J),A!==x?(K=q(w,d.draggable),K>=0&&(k(null,x,"add",w,A,J,K),k(this,A,"remove",w,A,J,K),k(null,x,"sort",w,A,J,K),k(this,A,"sort",w,A,J,K))):w.nextSibling!==B&&(K=q(w,d.draggable),K>=0&&(k(this,A,"update",w,A,J,K),k(this,A,"sort",w,A,J,K))),a.active&&(null!=K&&K!==-1||(K=J),k(this,A,"end",w,A,J,K),this.save()))),this._nulling()},_nulling:function(){A=w=x=y=B=z=C=D=E=N=O=P=K=G=H=M=L=a.active=null,da.forEach(function(a){a.checked=!0}),da.length=0},handleEvent:function(a){switch(a.type){case"drop":case"dragend":this._onDrop(a);break;case"dragover":case"dragenter":w&&(this._onDragOver(a),e(a));break;case"selectstart":a.preventDefault()}},toArray:function(){for(var a,b=[],d=this.el.children,e=0,f=d.length,g=this.options;e<f;e++)a=d[e],c(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||p(a));return b},sort:function(a){var b={},d=this.el;this.toArray().forEach(function(a,e){var f=d.children[e];c(f,this.options.draggable,d)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(d.removeChild(b[a]),d.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return c(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:(c[a]=b,void("group"===a&&ga(c)))},destroy:function(){var a=this.el;a[T]=null,g(a,"mousedown",this._onTapStart),g(a,"touchstart",this._onTapStart),g(a,"pointerdown",this._onTapStart),this.nativeDraggable&&(g(a,"dragover",this),g(a,"dragenter",this)),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),ea.splice(ea.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},f(V,"touchmove",function(b){a.active&&b.preventDefault()});try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){Z={capture:!1,passive:!1}}}))}catch(a){}return a.utils={on:f,off:g,css:i,find:j,is:function(a,b){return!!c(a,b,a)},extend:t,throttle:s,closest:c,toggleClass:h,clone:u,index:q},a.create=function(b,c){return new a(b,c)},a.version="1.6.0",a});
\ No newline at end of file @@ -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";; @@ -3,8 +3,6 @@ <% VERSION=0.4 -BASE="/tears" -HOST="happiest.place" path=$(/opt/bin/pdecode <<<"${PATH_INFO#/}") @@ -43,7 +41,7 @@ qlink() { } redirect() { - echo -ne "Location: https://$HOST$1\r\n" + echo -ne "Location: $SCHEME$HOST$1\r\n" echo -ne "Status: 302\r\n" echo -ne "Content-Type: text/html; charset=utf-8\r\n\r\n" echo "٩(͡๏̯͡๏)۶>" @@ -104,6 +102,8 @@ meny() { echo "<!doctype html>" echo "<title>tears</title>" echo "<link href=$BASE/tears.css rel=stylesheet>" + echo "<script src=$BASE/date.js></script>" + echo "<script src=$BASE/sortable.js></script>" echo "<script src=$BASE/tears.js></script>" echo "<div id='meny'>" link "<pre>$(figlet -f threepoint tears)</pre>" "" @@ -124,13 +124,13 @@ meny() { liste() { n=$((${GET_n:-0} + 7)) - $finder -printf '%h\t%TT\t%f\n' | sort -r | head -$n | tail -7 | while read - do - ok=1 + finder="$finder -printf '%h\t%TT\t%f\n'" + while read; do d=$(cut -f 1 <<<"$REPLY") f=$(cut -f 3 <<<"$REPLY") - kort $d/$f - done + ok=1 + [ "$f" ] && kort $d/$f + done <<< $(eval $finder | sort -r | head -$n | tail -7) if [ -z "$ok" ]; then echo "<p><b>Ingen artikler</b>" else @@ -162,8 +162,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 method='post' action='$BASE/oppdater/$1'>" - lupin -f <$1 + echo "<form id=update-article method=post action='$BASE/oppdater/$1'>" + lupin -f $1 echo "<p><label>Stikkord:</label>" echo "<input type='text' name='stikkord' value='$(stikkord $1)'>" echo "<p>" @@ -172,13 +172,15 @@ skjema() { echo "<input name=publish type='submit' value='Publiser'>" [ -r "$1" ] && link "Vis" $(/opt/bin/pencode / <<<"vis/$1") preview echo "</form>" - echo "<p><b>$(info $1)</b>" + #echo "<p><b>$(info $1)</b>" } vis() { [ ! -f "$1" ] && echo "<p>finner ikke $1: <pre>$(xxd <<<$1)</pre>" && exit [ ! -r "$1" ] && echo "<p>du har ikke lesetilgang" && exit - lupin -h <$1 + echo "<article>" + lupin $1 | /opt/bin/refine + echo "</article>" } lagre() { @@ -188,7 +190,7 @@ lagre() { [ -f "artikler/$path/$slug.txt" ] && error "Artikkelen finnes allerede" umask 0000 mkdir -p "artikler/$path" - lupin -l -e >"artikler/$path/$slug.txt" + lupin -p -e - >"artikler/$path/$slug.txt" if [ -z "$POST_privat" ]; then chmod 660 "artikler/$path/$slug.txt" else @@ -212,20 +214,20 @@ oppdater() { [ -z "$POST_stikkord" ] && error "ingen stikkord" stikk "$1" "$POST_stikkord" - lupin -l -e >$1 + lupin -p -e - >$1 irc "$(whoami) redigerte $POST_title" [ -n "$POST_publish" ] && chmod o+r "$1" - pushd /home/bie/maker >/dev/null; sudo -uwww ./maker; popd >/dev/null + # pushd /home/bie/code/maker >/dev/null; ./maker; popd >/dev/null redirect "$BASE/rediger/$1" } kort() { IFS=/. read -r type y m d hhmm slug ext <<< "$1" - lupin -t -h <$1 + lupin -t $1 echo "<p class='x'>$(byline $1), $y/$m/$d" [ -r "$1" ] && echo "·" && link "vis" $(/opt/bin/pencode / <<<"vis/$1") [ -w "$1" ] && echo "·" && link "rediger" $(/opt/bin/pencode / <<<"rediger/$1") - lupin -s -h <$1 + lupin -s $1 } velkommen() { @@ -241,7 +243,7 @@ forbered() { echo "<input type=date name=publisert value=$(date +%Y-%m-%d) size=10>" echo "<p><label>*</label>" echo "<select name='type'>" - for type in lupin/*.lua; do + for type in blueprints/*.lua; do id=$(basename $type .lua) echo "<option value='$id'>$id</option>" done @@ -275,10 +277,10 @@ fi mappe="artikler" [ -n "$GET_stikkord" ] && mappe="stikkord/$GET_stikkord" kilde="$mappe/$(sed 's|-|/|g' <<<$GET_dato)" -finder="find -L $kilde -type f" +finder="find -L $kilde -type f -not -name '*~'" [ "$action" = gruppe ] && finder="$finder -group $args" [ "$action" = ditt ] && finder="$finder -user $REMOTE_USER" -[ "$REQUEST_METHOD" = GET ] && $finder | meny +[ "$REQUEST_METHOD" = GET ] && eval $finder | meny case $action in "") velkommen;; index.html|ditt|gruppe) liste;; @@ -1,9 +1,9 @@ body { font: 16px/1.4 sans-serif; } html, body { background: #eee; color: #000; } -body { left: 240px; position: relative; max-width: 900px; margin-top: 6em; } +body { margin: 6em 1em 1em 240px; position: relative; max-width: 100%; margin-top: 6em; } form, select, textarea, input { font: inherit; } -textarea { width: 100%; } +textarea { width: 100%; max-width: 42em; } div#meny { position: fixed; left: 0; top: 0; width: 180px; height: 100%; } div#meny { border-right: 1px dotted Tomato; padding: 0 1em; } div#meny { background: #fff; overflow: auto; } @@ -15,9 +15,9 @@ p.x a { text-align: right; } pre { font-weight: bold; } a { text-decoration: none; color: DarkOrange; } a:hover, a:visited { color: Tomato; } -img { border: 1px solid #000; max-width: 50%; } +img { border: 1px solid #000; max-width: 100%; } pre { position: relative; } -img.orz { width: 50px; height: 50px; display: block; } +img.orz { max-width: 160px; display: inline-block; vertical-align: middle;} label { width: 8em; float: left; margin: 0.25em 0; } @@ -25,6 +25,37 @@ blockquote { font-style: italic; position: relative; } img.teatime { max-width: 100%; } +article { font: 18px/1.2 "Open Sans", sans-serif; } + +article { flex: 0 0 100%; width: 960px; max-width: 100%; } +article p { margin: 0; } +article h2 { margin-top: 0; font-size: 4em; } +article a { color: black; text-decoration: none; } +article img { width: 100%; } +article video { width: 100%; } + +article h2 { margin-bottom: 0; } +article .content { display: flex; align-content: stretch; justify-content: space-between; align-items: flex-start; } +.byline { margin: 0 0 2em 0; font-style: italic; } +.byline a { font-weight: bold; } +article .content .body { margin: 0 2em; } +.body p { margin-bottom: 1em; } + +article .content .body { flex: 1 1 auto; } + +article aside { max-width: 160px; font-size: 12px; flex: 1 0 160px; } +article aside dt { font-weight: bold; margin-top: 0.5em; } +article aside dd { margin-left: 1em; } + +article img.headshot { border-radius: 50%; width: 160px; } +article img.headshot.mini { display: none; } + +.error { border: 1px solid red; } + +.infobox { margin: 0; padding: 0; } +.infobox li { margin: 8px 0; list-style: none; } +.infobox select { margin-right: 8px; } + /*! * Pikaday * Copyright © 2012 David Bushell | BSD & MIT license | http://dbushell.com/ @@ -1,19 +1,20 @@ -// moment.js -// // version : 1.7.2 -// // author : Tim Wood -// // license : MIT -// // momentjs.com -(function(a){function E(a,b,c,d){var e=c.lang();return e[a].call?e[a](c,d):e[a][b]}function F(a,b){return function(c){return K(a.call(this,c),b)}}function G(a){return function(b){var c=a.call(this,b);return c+this.lang().ordinal(c)}}function H(a,b,c){this._d=a,this._isUTC=!!b,this._a=a._a||null,this._lang=c||!1}function I(a){var b=this._data={},c=a.years||a.y||0,d=a.months||a.M||0,e=a.weeks||a.w||0,f=a.days||a.d||0,g=a.hours||a.h||0,h=a.minutes||a.m||0,i=a.seconds||a.s||0,j=a.milliseconds||a.ms||0;this._milliseconds=j+i*1e3+h*6e4+g*36e5,this._days=f+e*7,this._months=d+c*12,b.milliseconds=j%1e3,i+=J(j/1e3),b.seconds=i%60,h+=J(i/60),b.minutes=h%60,g+=J(h/60),b.hours=g%24,f+=J(g/24),f+=e*7,b.days=f%30,d+=J(f/30),b.months=d%12,c+=J(d/12),b.years=c,this._lang=!1}function J(a){return a<0?Math.ceil(a):Math.floor(a)}function K(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function L(a,b,c){var d=b._milliseconds,e=b._days,f=b._months,g;d&&a._d.setTime(+a+d*c),e&&a.date(a.date()+e*c),f&&(g=a.date(),a.date(1).month(a.month()+f*c).date(Math.min(g,a.daysInMonth())))}function M(a){return Object.prototype.toString.call(a)==="[object Array]"}function N(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function O(a,b,c,d){var e,f,g=[];for(e=0;e<7;e++)g[e]=a[e]=a[e]==null?e===2?1:0:a[e];return a[7]=g[7]=b,a[8]!=null&&(g[8]=a[8]),a[3]+=c||0,a[4]+=d||0,f=new Date(0),b?(f.setUTCFullYear(a[0],a[1],a[2]),f.setUTCHours(a[3],a[4],a[5],a[6])):(f.setFullYear(a[0],a[1],a[2]),f.setHours(a[3],a[4],a[5],a[6])),f._a=g,f}function P(a,c){var d,e,g=[];!c&&h&&(c=require("./lang/"+a));for(d=0;d<i.length;d++)c[i[d]]=c[i[d]]||f.en[i[d]];for(d=0;d<12;d++)e=b([2e3,d]),g[d]=new RegExp("^"+(c.months[d]||c.months(e,""))+"|^"+(c.monthsShort[d]||c.monthsShort(e,"")).replace(".",""),"i");return c.monthsParse=c.monthsParse||g,f[a]=c,c}function Q(a){var c=typeof a=="string"&&a||a&&a._lang||null;return c?f[c]||P(c):b}function R(a){return a.match(/\[.*\]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function S(a){var b=a.match(k),c,d;for(c=0,d=b.length;c<d;c++)D[b[c]]?b[c]=D[b[c]]:b[c]=R(b[c]);return function(e){var f="";for(c=0;c<d;c++)f+=typeof b[c].call=="function"?b[c].call(e,a):b[c];return f}}function T(a,b){function d(b){return a.lang().longDateFormat[b]||b}var c=5;while(c--&&l.test(b))b=b.replace(l,d);return A[b]||(A[b]=S(b)),A[b](a)}function U(a){switch(a){case"DDDD":return p;case"YYYY":return q;case"S":case"SS":case"SSS":case"DDD":return o;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return r;case"Z":case"ZZ":return s;case"T":return t;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return n;default:return new RegExp(a.replace("\\",""))}}function V(a,b,c,d){var e,f;switch(a){case"M":case"MM":c[1]=b==null?0:~~b-1;break;case"MMM":case"MMMM":for(e=0;e<12;e++)if(Q().monthsParse[e].test(b)){c[1]=e,f=!0;break}f||(c[8]=!1);break;case"D":case"DD":case"DDD":case"DDDD":b!=null&&(c[2]=~~b);break;case"YY":c[0]=~~b+(~~b>70?1900:2e3);break;case"YYYY":c[0]=~~Math.abs(b);break;case"a":case"A":d.isPm=(b+"").toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b;break;case"S":case"SS":case"SSS":c[6]=~~(("0."+b)*1e3);break;case"Z":case"ZZ":d.isUTC=!0,e=(b+"").match(x),e&&e[1]&&(d.tzh=~~e[1]),e&&e[2]&&(d.tzm=~~e[2]),e&&e[0]==="+"&&(d.tzh=-d.tzh,d.tzm=-d.tzm)}b==null&&(c[8]=!1)}function W(a,b){var c=[0,0,1,0,0,0,0],d={tzh:0,tzm:0},e=b.match(k),f,g;for(f=0;f<e.length;f++)g=(U(e[f]).exec(a)||[])[0],g&&(a=a.slice(a.indexOf(g)+g.length)),D[e[f]]&&V(e[f],g,c,d);return d.isPm&&c[3]<12&&(c[3]+=12),d.isPm===!1&&c[3]===12&&(c[3]=0),O(c,d.isUTC,d.tzh,d.tzm)}function X(a,b){var c,d=a.match(m)||[],e,f=99,g,h,i;for(g=0;g<b.length;g++)h=W(a,b[g]),e=T(new H(h),b[g]).match(m)||[],i=N(d,e),i<f&&(f=i,c=h);return c}function Y(a){var b="YYYY-MM-DDT",c;if(u.exec(a)){for(c=0;c<4;c++)if(w[c][1].exec(a)){b+=w[c][0];break}return s.exec(a)?W(a,b+" Z"):W(a,b)}return new Date(a)}function Z(a,b,c,d,e){var f=e.relativeTime[a];return typeof f=="function"?f(b||1,!!c,a,d):f.replace(/%d/i,b||1)}function $(a,b,c){var e=d(Math.abs(a)/1e3),f=d(e/60),g=d(f/60),h=d(g/24),i=d(h/365),j=e<45&&["s",e]||f===1&&["m"]||f<45&&["mm",f]||g===1&&["h"]||g<22&&["hh",g]||h===1&&["d"]||h<=25&&["dd",h]||h<=45&&["M"]||h<345&&["MM",d(h/30)]||i===1&&["y"]||["yy",i];return j[2]=b,j[3]=a>0,j[4]=c,Z.apply({},j)}function _(a,c){b.fn[a]=function(a){var b=this._isUTC?"UTC":"";return a!=null?(this._d["set"+b+c](a),this):this._d["get"+b+c]()}}function ab(a){b.duration.fn[a]=function(){return this._data[a]}}function bb(a,c){b.duration.fn["as"+a]=function(){return+this/c}}var b,c="1.7.2",d=Math.round,e,f={},g="en",h=typeof module!="undefined"&&module.exports,i="months|monthsShort|weekdays|weekdaysShort|weekdaysMin|longDateFormat|calendar|relativeTime|ordinal|meridiem".split("|"),j=/^\/?Date\((\-?\d+)/i,k=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|zz?|ZZ?|.)/g,l=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?)/g,m=/([0-9a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)/gi,n=/\d\d?/,o=/\d{1,3}/,p=/\d{3}/,q=/\d{1,4}/,r=/[0-9a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+/i,s=/Z|[\+\-]\d\d:?\d\d/i,t=/T/i,u=/^\s*\d{4}-\d\d-\d\d(T(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,v="YYYY-MM-DDTHH:mm:ssZ",w=[["HH:mm:ss.S",/T\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/T\d\d:\d\d:\d\d/],["HH:mm",/T\d\d:\d\d/],["HH",/T\d\d/]],x=/([\+\-]|\d\d)/gi,y="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),z={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},A={},B="DDD w M D d".split(" "),C="M D H h m s w".split(" "),D={M:function(){return this.month()+1},MMM:function(a){return E("monthsShort",this.month(),this,a)},MMMM:function(a){return E("months",this.month(),this,a)},D:function(){return this.date()},DDD:function(){var a=new Date(this.year(),this.month(),this.date()),b=new Date(this.year(),0,1);return~~((a-b)/864e5+1.5)},d:function(){return this.day()},dd:function(a){return E("weekdaysMin",this.day(),this,a)},ddd:function(a){return E("weekdaysShort",this.day(),this,a)},dddd:function(a){return E("weekdays",this.day(),this,a)},w:function(){var a=new Date(this.year(),this.month(),this.date()-this.day()+5),b=new Date(a.getFullYear(),0,4);return~~((a-b)/864e5/7+1.5)},YY:function(){return K(this.year()%100,2)},YYYY:function(){return K(this.year(),4)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return K(~~(this.milliseconds()/10),2)},SSS:function(){return K(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return a<0&&(a=-a,b="-"),b+K(~~(a/60),2)+":"+K(~~a%60,2)},ZZ:function(){var a=-this.zone(),b="+";return a<0&&(a=-a,b="-"),b+K(~~(10*a/6),4)}};while(B.length)e=B.pop(),D[e+"o"]=G(D[e]);while(C.length)e=C.pop(),D[e+e]=F(D[e],2);D.DDDD=F(D.DDD,3),b=function(c,d){if(c===null||c==="")return null;var e,f;return b.isMoment(c)?new H(new Date(+c._d),c._isUTC,c._lang):(d?M(d)?e=X(c,d):e=W(c,d):(f=j.exec(c),e=c===a?new Date:f?new Date(+f[1]):c instanceof Date?c:M(c)?O(c):typeof c=="string"?Y(c):new Date(c)),new H(e))},b.utc=function(a,c){return M(a)?new H(O(a,!0),!0):(typeof a=="string"&&!s.exec(a)&&(a+=" +0000",c&&(c+=" Z")),b(a,c).utc())},b.unix=function(a){return b(a*1e3)},b.duration=function(a,c){var d=b.isDuration(a),e=typeof a=="number",f=d?a._data:e?{}:a,g;return e&&(c?f[c]=a:f.milliseconds=a),g=new I(f),d&&(g._lang=a._lang),g},b.humanizeDuration=function(a,c,d){return b.duration(a,c===!0?null:c).humanize(c===!0?!0:d)},b.version=c,b.defaultFormat=v,b.lang=function(a,c){var d;if(!a)return g;(c||!f[a])&&P(a,c);if(f[a]){for(d=0;d<i.length;d++)b[i[d]]=f[a][i[d]];b.monthsParse=f[a].monthsParse,g=a}},b.langData=Q,b.isMoment=function(a){return a instanceof H},b.isDuration=function(a){return a instanceof I},b.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),b.fn=H.prototype={clone:function(){return b(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this._d.toString()},toDate:function(){return this._d},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds(),!!this._isUTC]},isValid:function(){return this._a?this._a[8]!=null?!!this._a[8]:!N(this._a,(this._a[7]?b.utc(this._a):b(this._a)).toArray()):!isNaN(this._d.getTime())},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(a){return T(this,a?a:b.defaultFormat)},add:function(a,c){var d=c?b.duration(+c,a):b.duration(a);return L(this,d,1),this},subtract:function(a,c){var d=c?b.duration(+c,a):b.duration(a);return L(this,d,-1),this},diff:function(a,c,e){var f=this._isUTC?b(a).utc():b(a).local(),g=(this.zone()-f.zone())*6e4,h=this._d-f._d-g,i=this.year()-f.year(),j=this.month()-f.month(),k=this.date()-f.date(),l;return c==="months"?l=i*12+j+k/30:c==="years"?l=i+(j+k/30)/12:l=c==="seconds"?h/1e3:c==="minutes"?h/6e4:c==="hours"?h/36e5:c==="days"?h/864e5:c==="weeks"?h/6048e5:h,e?l:d(l)},from:function(a,c){return b.duration(this.diff(a)).lang(this._lang).humanize(!c)},fromNow:function(a){return this.from(b(),a)},calendar:function(){var a=this.diff(b().sod(),"days",!0),c=this.lang().calendar,d=c.sameElse,e=a<-6?d:a<-1?c.lastWeek:a<0?c.lastDay:a<1?c.sameDay:a<2?c.nextDay:a<7?c.nextWeek:d;return this.format(typeof e=="function"?e.apply(this):e)},isLeapYear:function(){var a=this.year();return a%4===0&&a%100!==0||a%400===0},isDST:function(){return this.zone()<b([this.year()]).zone()||this.zone()<b([this.year(),5]).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return a==null?b:this.add({d:a-b})},startOf:function(a){switch(a.replace(/s$/,"")){case"year":this.month(0);case"month":this.date(1);case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return this},endOf:function(a){return this.startOf(a).add(a.replace(/s?$/,"s"),1).subtract("ms",1)},sod:function(){return this.clone().startOf("day")},eod:function(){return this.clone().endOf("day")},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return b.utc([this.year(),this.month()+1,0]).date()},lang:function(b){return b===a?Q(this):(this._lang=b,this)}};for(e=0;e<y.length;e++)_(y[e].toLowerCase(),y[e]);_("year","FullYear"),b.duration.fn=I.prototype={weeks:function(){return J(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months*2592e6},humanize:function(a){var b=+this,c=this.lang().relativeTime,d=$(b,!a,this.lang()),e=b<=0?c.past:c.future;return a&&(typeof e=="function"?d=e(d):d=e.replace(/%s/i,d)),d},lang:b.fn.lang};for(e in z)z.hasOwnProperty(e)&&(bb(e,z[e]),ab(e.toLowerCase()));bb("Weeks",6048e5),h&&(module.exports=b),typeof ender=="undefined"&&(this.moment=b),typeof define=="function"&&define.amd&&define("moment",[],function(){return b})}).call(this); - -/*! - * Pikaday - * Copyright © 2012 David Bushell | BSD & MIT license | http://dbushell.com/ - */ -(function(e,t,n){"use strict";var r=typeof e.moment=="function",i=!!e.addEventListener,s=e.setTimeout,o=function(e,t,n,r){i?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n)},u=function(e,t,n,r){i?e.removeEventListener(t,n,!!r):e.detachEvent("on"+t,n)},a=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},f=function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")!==-1},l=function(e,t){f(e,t)||(e.className=e.className===""?t:e.className+" "+t)},c=function(e,t){e.className=a((" "+e.className+" ").replace(" "+t+" "," "))},h=function(e){return/Array/.test(Object.prototype.toString.call(e))},p=function(e){return/Date/.test(Object.prototype.toString.call(e))&&!isNaN(e.getTime())},d=function(e){return e%4===0&&e%100!==0||e%400===0},v=function(e,t){return[31,d(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},m=function(e,t){return e.getTime()===t.getTime()},g=function(e,t,r){var i,s;for(i in t){s=e[i]!==n;if(s&&typeof t[i]=="object"&&t[i].nodeName===n)p(t[i])?r&&(e[i]=new Date(t[i].getTime())):h(t[i])?r&&(e[i]=t[i].slice(0)):e[i]=g({},t[i],r);else if(r||!s)e[i]=t[i]}return e},y={field:null,bound:n,format:"YYYY-MM-DD",defaultDate:null,setDefaultDate:!1,firstDay:0,minDate:null,maxDate:null,yearRange:10,minYear:0,maxYear:9999,minMonth:n,maxMonth:n,isRTL:!1,numberOfMonths:1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},onSelect:null,onOpen:null,onClose:null},b=function(e,t,n){t+=e.firstDay;while(t>=7)t-=7;return n?e.i18n.weekdaysShort[t]:e.i18n.weekdays[t]},w=function(e,t,n,r,i){if(i)return'<td class="is-empty"></td>';var s=[];return r&&s.push("is-disabled"),n&&s.push("is-today"),t&&s.push("is-selected"),'<td data-day="'+e+'" class="'+s.join(" ")+'"><button class="pika-button" type="button">'+e+"</button>"+"</td>"},E=function(e,t){return"<tr>"+(t?e.reverse():e).join("")+"</tr>"},S=function(e){return"<tbody>"+e.join("")+"</tbody>"},x=function(e){var t,n=[];for(t=0;t<7;t++)n.push('<th scope="col"><abbr title="'+b(e,t)+'">'+b(e,t,!0)+"</abbr></th>");return"<thead>"+(e.isRTL?n.reverse():n).join("")+"</thead>"},T=function(e){var t,n,r,i=e._o,s=e._m,o=e._y,u=o===i.minYear,a=o===i.maxYear,f='<div class="pika-title">',l=!0,c=!0;for(r=[],t=0;t<12;t++)r.push('<option value="'+t+'"'+(t===s?" selected":"")+(u&&t<i.minMonth||a&&t>i.maxMonth?"disabled":"")+">"+i.i18n.months[t]+"</option>");f+='<div class="pika-label">'+i.i18n.months[s]+'<select class="pika-select pika-select-month">'+r.join("")+"</select></div>",h(i.yearRange)?(t=i.yearRange[0],n=i.yearRange[1]+1):(t=o-i.yearRange,n=1+o+i.yearRange);for(r=[];t<n&&t<=i.maxYear;t++)t>=i.minYear&&r.push('<option value="'+t+'"'+(t===o?" selected":"")+">"+t+"</option>");return f+='<div class="pika-label">'+o+'<select class="pika-select pika-select-year">'+r.join("")+"</select></div>",u&&(s===0||i.minMonth>=s)&&(l=!1),a&&(s===11||i.maxMonth<=s)&&(c=!1),f+='<button class="pika-prev'+(l?"":" is-disabled")+'" type="button">Previous Month</button>',f+='<button class="pika-next'+(c?"":" is-disabled")+'" type="button">Next Month</button>',f+="</div>"},N=function(e,t){return'<table cellpadding="0" cellspacing="0" class="pika-table">'+x(e)+S(t)+"</table>"};e.Pikaday=function(n){var u=this,a=u.config(n);u._onMouseDown=function(t){if(!u._v)return;t=t||e.event;var n=t.target||t.srcElement;if(!n)return;if(!f(n,"is-disabled")){if(f(n,"pika-button")&&!f(n,"is-empty")){u.setDate(new Date(u._y,u._m,parseInt(n.innerHTML,10))),a.bound&&s(function(){u.hide()},100);return}f(n,"pika-prev")?u.prevMonth():f(n,"pika-next")&&u.nextMonth()}if(!f(n,"pika-select")){if(!t.preventDefault)return t.returnValue=!1;t.preventDefault()}else u._c=!0},u._onChange=function(t){t=t||e.event;var n=t.target||t.srcElement;if(!n)return;f(n,"pika-select-month")?u.gotoMonth(n.value):f(n,"pika-select-year")&&u.gotoYear(n.value)},u._onInputChange=function(t){if(r)u.setDate(e.moment(a.field.value,a.format).toDate());else{var n=new Date(Date.parse(a.field.value));u.setDate(p(n)?n:null)}u._v||u.show()},u._onInputFocus=function(e){u.show()},u._onInputClick=function(e){u.show()},u._onInputBlur=function(e){u._c||(u._b=s(function(){u.hide()},50)),u._c=!1},u._onClick=function(t){t=t||e.event;var n=t.target||t.srcElement,r=n;if(!n)return;!i&&f(n,"pika-select")&&(n.onchange||(n.setAttribute("onchange","return;"),o(n,"change",u._onChange)));do if(f(r,"pika-single"))return;while(r=r.parentNode);u._v&&n!==a.field&&u.hide()},u.el=t.createElement("div"),u.el.className="pika-single"+(a.isRTL?" is-rtl":""),o(u.el,"mousedown",u._onMouseDown,!0),o(u.el,"change",u._onChange),a.field&&(a.bound?t.body.appendChild(u.el):a.field.parentNode.insertBefore(u.el,a.field.nextSibling),o(a.field,"change",u._onInputChange),a.defaultDate||(r&&a.field.value?a.defaultDate=e.moment(a.field.value,a.format).toDate():a.defaultDate=new Date(Date.parse(a.field.value)),a.setDefaultDate=!0));var l=a.defaultDate;p(l)?a.setDefaultDate?u.setDate(l):u.gotoDate(l):u.gotoDate(new Date),a.bound?(this.hide(),u.el.className+=" is-bound",o(a.field,"click",u._onInputClick),o(a.field,"focus",u._onInputFocus),o(a.field,"blur",u._onInputBlur)):this.show()},e.Pikaday.prototype={config:function(e){this._o||(this._o=g({},y,!0));var t=g(this._o,e,!0);t.isRTL=!!t.isRTL,t.field=t.field&&t.field.nodeName?t.field:null,t.bound=!!(t.bound!==n?t.field&&t.bound:t.field);var r=parseInt(t.numberOfMonths,10)||1;t.numberOfMonths=r>4?4:r,p(t.minDate)||(t.minDate=!1),p(t.maxDate)||(t.maxDate=!1),t.minDate&&t.maxDate&&t.maxDate<t.minDate&&(t.maxDate=t.minDate=!1),t.minDate&&(t.minYear=t.minDate.getFullYear(),t.minMonth=t.minDate.getMonth()),t.maxDate&&(t.maxYear=t.maxDate.getFullYear(),t.maxMonth=t.maxDate.getMonth());if(h(t.yearRange)){var i=(new Date).getFullYear()-10;t.yearRange[0]=parseInt(t.yearRange[0],10)||i,t.yearRange[1]=parseInt(t.yearRange[1],10)||i}else t.yearRange=Math.abs(parseInt(t.yearRange,10))||y.yearRange,t.yearRange>100&&(t.yearRange=100);return t},toString:function(t){return p(this._d)?r?e.moment(this._d).format(t||this._o.format):this._d.toDateString():""},getMoment:function(){return r?e.moment(this._d):null},getDate:function(){return p(this._d)?new Date(this._d.getTime()):null},setDate:function(e){if(!e)return this._d=null,this.draw();typeof e=="string"&&(e=new Date(Date.parse(e)));if(!p(e))return;var t=this._o.minDate,n=this._o.maxDate;p(t)&&e<t?e=t:p(n)&&e>n&&(e=n),this._d=new Date(e.getTime()),this._d.setHours(0,0,0,0),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString()),typeof this._o.onSelect=="function"&&this._o.onSelect.call(this,this.getDate())},gotoDate:function(e){if(!p(e))return;this._y=e.getFullYear(),this._m=e.getMonth(),this.draw()},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(e){isNaN(e=parseInt(e,10))||(this._m=e<0?0:e>11?11:e,this.draw())},nextMonth:function(){++this._m>11&&(this._m=0,this._y++),this.draw()},prevMonth:function(){--this._m<0&&(this._m=11,this._y--),this.draw()},gotoYear:function(e){isNaN(e)||(this._y=parseInt(e,10),this.draw())},draw:function(e){if(!this._v&&!e)return;var t=this._o,n=t.minYear,r=t.maxYear,i=t.minMonth,o=t.maxMonth;this._y<=n&&(this._y=n,!isNaN(i)&&this._m<i&&(this._m=i)),this._y>=r&&(this._y=r,!isNaN(o)&&this._m>o&&(this._m=o)),this.el.innerHTML=T(this)+this.render(this._y,this._m);if(t.bound){var u=t.field,a=u.offsetLeft,f=u.offsetTop+u.offsetHeight;while(u=u.offsetParent)a+=u.offsetLeft,f+=u.offsetTop;this.el.style.cssText="position:absolute;left:"+a+"px;top:"+f+"px;",s(function(){t.field.focus()},1)}},render:function(e,t){var n=this._o,r=new Date,i=v(e,t),s=(new Date(e,t,1)).getDay(),o=[],u=[];r.setHours(0,0,0,0),n.firstDay>0&&(s-=n.firstDay,s<0&&(s+=7));var a=i+s,f=a;while(f>7)f-=7;a+=7-f;for(var l=0,c=0;l<a;l++){var h=new Date(e,t,1+(l-s)),d=n.minDate&&h<n.minDate||n.maxDate&&h>n.maxDate,g=p(this._d)?m(h,this._d):!1,y=m(h,r),b=l<s||l>=i+s;u.push(w(1+(l-s),g,y,d,b)),++c===7&&(o.push(E(u,n.isRTL)),u=[],c=0)}return N(n,o)},isVisible:function(){return this._v},show:function(){this._v||(this._o.bound&&o(t,"click",this._onClick),c(this.el,"is-hidden"),this._v=!0,this.draw(),typeof this._o.onOpen=="function"&&this._o.onOpen.call(this))},hide:function(){var e=this._v;e!==!1&&(this._o.bound&&u(t,"click",this._onClick),this.el.style.cssText="",l(this.el,"is-hidden"),this._v=!1,e!==n&&typeof this._o.onClose=="function"&&this._o.onClose.call(this))},destroy:function(){this.hide(),u(this.el,"mousedown",this._onMouseDown,!0),u(this.el,"change",this._onChange),this._o.field&&(u(this._o.field,"change",this._onInputChange),this._o.bound&&(u(this._o.field,"click",this._onInputClick),u(this._o.field,"focus",this._onInputFocus),u(this._o.field,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}})(window,window.document); - /* tears.js */ var tears = {} +function additem(e) { + var item = e.target.parentNode.cloneNode(true); + e.target.parentNode.className = ""; + e.target.textContent = "x"; + e.target.onclick = function(e) { + e.target.parentNode.remove(); + return false; + } + item.getElementsByTagName('input')[0].value = ""; + item.getElementsByTagName('a')[0].onclick = additem; + e.target.parentNode.parentNode.appendChild(item); + return false; +} + function pick(src) { if(tears.input) { var name = tears.input.getAttribute("data-name"); @@ -24,9 +25,8 @@ function pick(src) { } } - function insert(text) { - var t = document.getElementsByName('tekst')[0]; + var t = document.getElementsByName('text')[0]; if(!t) return; if(t.selectionStart || t.selectionStart == '0') { var pos = t.selectionStart; @@ -39,7 +39,7 @@ function insert(text) { } function wrap(prefix, postfix) { - var t = document.getElementsByName('tekst')[0]; + var t = document.getElementsByName('text')[0]; if(!t) return; if(t.selectionStart || t.selectionStart == '0') { var pos = t.selectionStart; @@ -54,7 +54,7 @@ function wrap(prefix, postfix) { } function prepend(text) { - var t = document.getElementsByName('tekst')[0]; + var t = document.getElementsByName('text')[0]; if(!t) return; if(t.selectionStart || t.selectionStart == '0') { var pos = t.selectionStart; @@ -124,8 +124,25 @@ function button(node, html, fun) { node.parentNode.insertBefore(a, node.nextSibling); } -function orz(src) { - insert("\n{" + src.replace(".t.jpg", "") + "}\n"); +function orz(src, receiver) { + // insert("\n{" + src.replace(".t.jpg", "") + "}\n"); + console.log(receiver); + console.log(src); + if(!receiver) { + console.log(src); + insert("\n{" + src + "}\n"); + return; + } + var e = document.getElementsByName(receiver); + if(e && e[0]) { + e[0].value = src; + } + var imgs = document.getElementsByClassName('orz'); + for(var i = 0; i < imgs.length; i++) { + if(imgs[i].getAttribute('data-name') == receiver) { + imgs[i].src = src; + } + } } document.addEventListener("DOMContentLoaded", function(e) { @@ -133,16 +150,6 @@ document.addEventListener("DOMContentLoaded", function(e) { if(field) { new Pikaday({ field: field, format: 'YYYY-MM-DD' }); } -/* - var els = document.getElementsByClassName('orz'); - for(var i=0; i < els.length; i++) { - els[i].onclick = function(e) { - tears.input = e.target; - window.open(e.target.getAttribute('data-uri')); - return false; - } - } -*/ var title = document.getElementsByTagName('h1')[0]; var headers = document.getElementsByTagName("h2"); @@ -158,13 +165,17 @@ document.addEventListener("DOMContentLoaded", function(e) { title.parentNode.insertBefore(menu, title.nextSibling); } -// var orz = document.getElementById('orz'); - var orz = document.getElementsByClassName('orz')[0]; - if(orz) { - orz.onclick = function(e) { + var orz = document.getElementsByClassName('orz'); + for(var i = 0; i < orz.length; i++) { + orz[i].onclick = function(e) { + window.receiver = e.target.getAttribute('data-name') window.open("/orz"); return false; } + } + + var lol = document.getElementById('lol'); + if(lol) { button(orz, "> sitat", marxup_quote); button(orz, "* liste", marxup_list); button(orz, "[lenke]", marxup_link); @@ -173,6 +184,41 @@ document.addEventListener("DOMContentLoaded", function(e) { 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); + } + } + } }); @@ -1,3 +1,8 @@ +BASE="/tears" +HOST="localhost" +SCHEME="http://" + byline() { - stat -f '%Su' $1 + stat -c 'skrevet av %U for %G' $1 } + |