Skip to content

Commit

Permalink
Update built script and inline it.
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed May 12, 2014
1 parent 6283f1a commit 11f62bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1 class="site-title"><a href="{{site.baseurl}}/">{{site.title}}</a></h1>
<script src="/js/src/app.js"></script>
{% else %}
<script>Mithril=m=new function e(t){function n(){var e=arguments,t="[object Object]"==j.call(e[1]),n=t?e[1]:{},r="class"in n?"class":"className",o=b[e[0]];if(void 0===o){b[e[0]]=o={tag:"div",attrs:{}};for(var a,i=[];a=N.exec(e[0]);)if(""==a[1])o.tag=a[2];else if("#"==a[1])o.attrs.id=a[2];else if("."==a[1])i.push(a[2]);else if("["==a[3][0]){var c=C.exec(a[3]);o.attrs[c[1]]=c[3]||!0}i.length>0&&(o.attrs[r]=i.join(" "))}o=u(o),o.attrs=u(o.attrs),o.children=t?e[2]:e[1];for(var l in n)o.attrs[l]=l==r?(o.attrs[l]||"")+" "+n[l]:n[l];return o}function r(e,n,u,c,l,s,d,f){if((null===u||void 0===u)&&(u=""),"retain"!==u.subtree){var m=j.call(c),h=j.call(u);if(m!=h&&(null!==c&&void 0!==c&&a(c.nodes),c=new u.constructor,c.nodes=[]),"[object Array]"==h){for(var g=[],p=c.length===u.length,v=0,y=0,w=0;y<u.length;y++){var b=r(e,null,u[y],c[w],l,s+v||v,d,f);void 0!==b&&(b.nodes.intact||(p=!1),v+=b instanceof Array?b.length:1,c[w++]=b)}if(!p){for(var y=0;y<u.length;y++)void 0!==c[y]&&(g=g.concat(c[y].nodes));for(var N,y=g.length;N=c.nodes[y];y++)null!==N.parentNode&&N.parentNode.removeChild(N);for(var N,y=c.nodes.length;N=g[y];y++)null===N.parentNode&&e.appendChild(N);u.length<c.length&&(c.length=u.length),c.nodes=g}}else if("[object Object]"==h){if((u.tag!=c.tag||Object.keys(u.attrs).join()!=Object.keys(c.attrs).join()||u.attrs.id!=c.attrs.id)&&a(c.nodes),"string"!=typeof u.tag)return;var N,C=0===c.nodes.length;"svg"===u.tag&&(f="http://www.w3.org/2000/svg"),C?(N=void 0===f?t.document.createElement(u.tag):t.document.createElementNS(f,u.tag),c={tag:u.tag,attrs:o(N,u.tag,u.attrs,{},f),children:r(N,u.tag,u.children,c.children,!0,0,u.attrs.contenteditable?N:d,f),nodes:[N]},e.insertBefore(N,e.childNodes[s]||null)):(N=c.nodes[0],o(N,u.tag,u.attrs,c.attrs,f),c.children=r(N,u.tag,u.children,c.children,!1,0,u.attrs.contenteditable?N:d,f),c.nodes.intact=!0,l===!0&&e.insertBefore(N,e.childNodes[s]||null)),"[object Function]"==j.call(u.attrs.config)&&u.attrs.config(N,!C)}else{var N;if(0===c.nodes.length)u.$trusted?N=i(e,s,u):(N=t.document.createTextNode(u),e.insertBefore(N,e.childNodes[s]||null)),c="string number boolean".indexOf(typeof u)>-1?new u.constructor(u):u,c.nodes=[N];else if(c.valueOf()!==u.valueOf()||l===!0){if(!d||d!==t.document.activeElement)if(u.$trusted){var x=c.nodes[0],g=[x];if(x){for(;x=x.nextSibling;)g.push(x);a(g),N=i(e,s,u)}else e.innerHTML=u}else N=c.nodes[0],"textarea"===n?e.value=u:d?d.innerHTML=u:(e.insertBefore(N,e.childNodes[s]||null),N.nodeValue=u);c=new u.constructor(u),c.nodes=[N]}else c.nodes.intact=!0}return c}}function o(e,n,r,o,a){for(var i in r){var u=r[i],l=o[i];if(!(i in o)||l!==u||e===t.document.activeElement){if(o[i]=u,"config"===i)continue;if("function"==typeof u&&0==i.indexOf("on"))e[i]=c(u,e);else if("style"===i)for(var s in u)(void 0===l||l[s]!==u[s])&&(e.style[s]=u[s]);else void 0!==a?"href"===i?e.setAttributeNS("http://www.w3.org/1999/xlink","href",u):"className"===i?e.setAttribute("class",u):e.setAttribute(i,u):"value"===i&&"input"===n?e.value!==u&&(e.value=u):i in e&&"list"!=i?e[i]=u:e.setAttribute(i,u)}}return o}function a(e){for(var t=e.length-1;t>-1;t--)e[t].parentNode.removeChild(e[t]);e.length=0}function i(e,t,n){var r=e.childNodes[t];return r?r.insertAdjacentHTML("beforebegin",n):e.insertAdjacentHTML("beforeend",n),r?r.previousSibling:e.firstChild}function u(e){var t={};for(var n in e)t[n]=e[n];return t}function c(e,t){return function(r){n.startComputation();try{return e.call(t,r)}finally{n.endComputation()}}}function l(){for(var e=0;e<E.length;e++)n.render(E[e],S[e].view(A[e]));H&&(H(),H=null),M=L}function s(e,t,r){J={};for(var o in t){if(o==r)return!void n.module(e,t[o]);var a=new RegExp("^"+o.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"$");if(a.test(r))return!void r.replace(a,function(){for(var r=o.match(/:[^\/]+/g),a=[].slice.call(arguments,1,-2),i=0;i<r.length;i++)J[r[i].replace(/:|\./g,"")]=decodeURIComponent(a[i]);n.module(e,t[o])})}}function d(e){e.ctrlKey||e.metaKey||2==e.which||(e.preventDefault(),n.route(e.currentTarget[n.route.mode].slice(B[n.route.mode].length)))}function f(){"hash"!=n.route.mode&&t.location.hash&&(t.location.hash=t.location.hash)}function m(e){return e}function h(e){var n=t.XDomainRequest?new t.XDomainRequest:new t.XMLHttpRequest;return n.open(e.method,e.url,!0,e.user,e.password),n.onload="function"==typeof e.onload?e.onload:function(){},n.onerror="function"==typeof e.onerror?e.onerror:function(){},n.onreadystatechange=function(){4===n.readyState&&0===n.status&&n.onerror({type:"error",target:n})},"function"==typeof e.config&&e.config(n,e),n.send(e.data),n}function g(e,t){var n=[];for(var r in e){var o=t?t+"["+r+"]":r,a=e[r];n.push("object"==typeof a?g(a,o):encodeURIComponent(o)+"="+encodeURIComponent(a))}return n.join("&")}function p(e,t,n){return t&&Object.keys(t).length>0&&("GET"==e.method?e.url=e.url+(e.url.indexOf("?")<0?"?":"&")+g(t):e.data=n(t)),e}function v(e,t){var n=e.match(/:[a-z]\w+/gi);if(n&&t)for(var r=0;r<n.length;r++){var o=n[r].slice(1);e=e.replace(n[r],t[o]),delete t[o]}return e}function y(e){var t=e.then;return function(e,n){var r=t(function(t){return r(e(t))},function(e){return r(n(e))});return r.then=y(r),r}}var w,b={},j={}.toString,N=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,C=/\[(.+?)(?:=("|'|)(.+?)\2)?\]/,x={insertAdjacentHTML:function(e,n){t.document.write(n),t.document.close()},appendChild:function(e){void 0===w&&(w=t.document.createElement("html")),"HTML"==e.nodeName?w=e:w.appendChild(e),t.document.documentElement!==w&&t.document.replaceChild(w,t.document.documentElement)},insertBefore:function(e){this.appendChild(e)},childNodes:[]},O=[],T={};n.render=function(e,n){var o=O.indexOf(e),a=0>o?O.push(e)-1:o,i=e==t.document||e==t.document.documentElement?x:e;T[a]=r(i,null,n,T[a],!1,0,null,void 0)},n.trust=function(e){return e=new String(e),e.$trusted=!0,e};var E=[],S=[],A=[],L=0,M=0,k=0,H=null;n.module=function(e,t){n.startComputation();var r=E.indexOf(e);0>r&&(r=E.length),E[r]=e,S[r]=t,A[r]=new t.controller,n.endComputation()},n.redraw=function(){if(L=t.performance&&t.performance.now?t.performance.now():(new t.Date).getTime(),L-M>16)l();else{var e=t.cancelAnimationFrame||t.clearTimeout,n=t.requestAnimationFrame||t.setTimeout;e(k),k=n(l,0)}};var R=0;n.startComputation=function(){R++},n.endComputation=function(){R=Math.max(R-1,0),0==R&&n.redraw()},n.withAttr=function(e,t){return function(n){t(e in n.currentTarget?n.currentTarget[e]:n.currentTarget.getAttribute(e))}};var q,B={pathname:"",hash:"#",search:"?"},D=function(){},J={};return n.route=function(){if(0===arguments.length)return q;if(3===arguments.length){q=t.location[n.route.mode].slice(B[n.route.mode].length);var e=arguments[0],r=arguments[1],o=arguments[2];D=function(t){var a=t.slice(B[n.route.mode].length);s(e,o,a)||n.route(r,!0)};var a="hash"==n.route.mode?"onhashchange":"onpopstate";t[a]=function(){D(t.location[n.route.mode])},H=f,t[a]()}else if(arguments[0].addEventListener){var i=arguments[0],u=arguments[1];i.href.indexOf(B[n.route.mode])<0&&(i.href=location.pathname+B[n.route.mode]+i.pathname),u||(i.removeEventListener("click",d),i.addEventListener("click",d))}else if("string"==typeof arguments[0]){q=arguments[0];var c=arguments[1]===!0;t.history.pushState?(H=function(){t.history[c?"replaceState":"pushState"](null,t.document.title,B[n.route.mode]+q),f()},D(B[n.route.mode]+q)):t.location[n.route.mode]=q}},n.route.param=function(e){return J[e]},n.route.mode="search",n.prop=function(e){var t=function(){return arguments.length&&(e=arguments[0]),e};return t.toJSON=function(){return e},t},n.deferred=function(){var e=[],t=[],r={resolve:function(t){for(var n=0;n<e.length;n++)e[n](t)},reject:function(e){for(var n=0;n<t.length;n++)t[n](e)},promise:n.prop()};return r.promise.resolvers=e,r.promise.then=function(r,o){function a(e,t,n){e.push(function(e){try{var r=n(e);r&&"function"==typeof r.then?r.then(i[t],o):i[t](void 0!==r?r:e)}catch(a){if(a instanceof Error&&a.constructor!==Error)throw a;i.reject(a)}})}var i=n.deferred();return r||(r=m),o||(o=m),a(e,"resolve",r),a(t,"reject",o),i.promise},r},n.sync=function(e){function t(t){return function(n){return a.push(n),t||(r="reject"),a.length==e.length&&(o.promise(a),o[r](a)),n}}for(var r="resolve",o=n.deferred(),a=[],i=0;i<e.length;i++)e[i].then(t(!0),t(!1));return o.promise},n.request=function(e){e.background!==!0&&n.startComputation();var t=n.deferred(),r=e.serialize||JSON.stringify,o=e.deserialize||JSON.parse,a=e.extract||function(e){return 0===e.responseText.length&&o===JSON.parse?null:e.responseText};return e.url=v(e.url,e.data),e=p(e,e.data,r),e.onload=e.onerror=function(r){var i=("load"==r.type?e.unwrapSuccess:e.unwrapError)||m,u=i(o(a(r.target,e)));if(u instanceof Array&&e.type)for(var c=0;c<u.length;c++)u[c]=new e.type(u[c]);else e.type&&(u=new e.type(u));t.promise(u),t["load"==r.type?"resolve":"reject"](u),e.background!==!0&&n.endComputation()},h(e),t.promise.then=y(t.promise),t.promise},n.deps=function(e){return t=e},n.deps.factory=e,n}(this),"undefined"!=typeof module&&null!==module&&(module.exports=m),"function"==typeof define&&define.amd&&define(function(){return m});
var c=document.getElementById("content"),list={controller:function(){if(window&&window.localStorage&&window.localStorage.getItem("redirect")){var t=window.localStorage.getItem("redirect");window.localStorage.clear("redirect"),setTimeout(function(){m.route(t)},10)}this.list=[];for(var e=0;e<appUrls.length;e++)this.list.push(appUrls[e])},view:function(t){return m("div.content",[t.list.map(function(t){return m("div.post",[m('a[href="'+baseUrl+t.url+'"].postlink',{config:m.route},[m("h2",[m("span.readmore",">"),m("span.title",t.title)]),m("span.date",t.date)])])})])}},post={controller:function(){this.year=m.route.param("year"),this.month=m.route.param("month"),this.day=m.route.param("day"),this.file=m.route.param("file"),this.text="";var t=this;m.request({method:"GET",url:baseUrl+"/blog/"+this.year+"/"+this.month+"/"+this.day+"/"+this.file+"/index.html",deserialize:function(t){return t}}).then(function(e){t.text=e})},view:function(t){if("undefined"!=typeof disqus_shortname){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="//"+disqus_shortname+".disqus.com/embed.js",(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(e)}return m("div.content",[m("div.post-full",m.trust(t.text))])}};m.route.mode="pathname";var routeConf={};routeConf["/"]=list,routeConf[baseUrl+"/"]=list,routeConf["/blog/:year/:month/:day/:file"]=post,routeConf["/blog/:year/:month/:day/:file/"]=post,routeConf[baseUrl+"/blog/:year/:month/:day/:file"]=post,routeConf[baseUrl+"/blog/:year/:month/:day/:file/"]=post,m.route(c,baseUrl+"/",routeConf);var body=document.body,html=document.documentElement,height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);onScrollFunction=function(){height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);var t=window.scrollY,e=document.getElementsByClassName("site-title")[0],o=window.innerHeight/6;e.style.opacity=1-t/o,t>=height-window.innerHeight-100&&document.getElementsByTagName("footer")[0].setAttribute("style","opacity: "+(1+(t-(height-window.innerHeight))/100))},window.onscroll=onScrollFunction;</script>
var c=document.getElementById("content"),list={controller:function(){if(window&&window.localStorage&&window.localStorage.getItem("redirect")){var t=window.localStorage.getItem("redirect");window.localStorage.clear("redirect"),setTimeout(function(){m.route(t)},10)}this.list=[];for(var e=0;e<appUrls.length;e++)this.list.push(appUrls[e])},view:function(t){return m("div.content",[t.list.map(function(t){return m("div.post",[m('a[href="'+baseUrl+t.url+'"].postlink',{config:m.route},[m("h2",[m("span.readmore",">"),m("span.title",t.title)]),m("span.date",t.date)])])})])}},post={controller:function(){this.year=m.route.param("year"),this.month=m.route.param("month"),this.day=m.route.param("day"),this.file=m.route.param("file"),this.text="";var t=this;m.request({method:"GET",url:baseUrl+"/blog/"+this.year+"/"+this.month+"/"+this.day+"/"+this.file+"/index.html",deserialize:function(t){return t}}).then(function(e){t.text=e})},view:function(t){if("undefined"!=typeof disqus_shortname){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="//"+disqus_shortname+".disqus.com/embed.js","undefined"!=typeof disqus_dry_run?window.appendedScript=e.src:document.getElementsByTagName("head")[0].appendChild(e)}return m("div.content",[m("div.post-full",m.trust(t.text))])}};m.route.mode="pathname";var routeConf={};routeConf["/"]=list,routeConf[baseUrl+"/"]=list,routeConf["/blog/:year/:month/:day/:file"]=post,routeConf["/blog/:year/:month/:day/:file/"]=post,routeConf[baseUrl+"/blog/:year/:month/:day/:file"]=post,routeConf[baseUrl+"/blog/:year/:month/:day/:file/"]=post,m.route(c,baseUrl+"/",routeConf);var body=document.body,html=document.documentElement,height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);onScrollFunction=function(){height=Math.max(body.scrollHeight,body.offsetHeight,html.clientHeight,html.scrollHeight,html.offsetHeight);var t=window.scrollY,e=document.getElementsByClassName("site-title")[0],o=window.innerHeight/6;e.style.opacity=1-t/o,t>=height-window.innerHeight-100&&document.getElementsByTagName("footer")[0].setAttribute("style","opacity: "+(1+(t-(height-window.innerHeight))/100))},window.onscroll=onScrollFunction;</script>
{% endif %}
<footer class="footer">
Created by <a href="https://twitter.com/orkj">eiriksm</a>. <a href="https://github.com/eiriksm/kyll-thrill">Source code</a>.
Expand Down

0 comments on commit 11f62bd

Please sign in to comment.