-
-
HackerWeb
A simply readable Hacker News web app.
+
+
@@ -171,17 +92,24 @@
About
var link = d.createElement('link');
link.rel = 'stylesheet';
- link.href = 'assets/css/hw-' + theme + '.css';
+ link.href = 'assets/css/hw-' + theme + '.min.css';
head.insertBefore(link, head.lastChild);
var script = d.createElement('script');
script.src = 'js/hw-' + theme + '.min.js';
head.insertBefore(script, head.lastChild);
-
- if (typeof ga != 'undefined') setTimeout(function(){
- ga('send', 'event', 'App', 'Theme', theme);
- }, 2000);
})(document, navigator.userAgent);
+
+if ('serviceWorker' in navigator){
+ navigator.serviceWorker.register('service-worker.js').then(function(registration){
+ console.log('ServiceWorker registration successful with scope: ', registration.scope);
+ }).catch(function(err){
+ console.log('ServiceWorker registration failed: ', err);
+ });
+}
+
+if (/preview/i.test(location.search)) document.querySelector('.scroll').style.height = 'auto';
+
diff --git a/js/hnapi-worker.js b/js/hnapi-worker.js
index eeb79945..b17fa73e 100644
--- a/js/hnapi-worker.js
+++ b/js/hnapi-worker.js
@@ -37,8 +37,8 @@ addEventListener('message', function(e){
});
}
if (r.readyState <= 1){
- r.open('GET', url + '?' + (+new Date()), true);
+ r.open('GET', url, true);
r.send();
}
requests[url] = r;
-});
\ No newline at end of file
+});
diff --git a/js/hw-ios-2.min.js b/js/hw-ios-2.min.js
index f6110b06..ebfffbcd 100644
--- a/js/hw-ios-2.min.js
+++ b/js/hw-ios-2.min.js
@@ -1,4 +1,80 @@
-!function(a){var b=[],c=function(){},d={defaultPath:"/",before:c,on:c,notfound:c},e={current:null,previous:null,config:function(a){for(var b in a)a.hasOwnProperty(b)&&(d[b]=a[b]);return e},add:function(a,c,d){return a&&c&&("function"==typeof c&&(d=c,c=null),b.push({path:a,name:c,fn:d||function(){}})),e},go:function(a){return location.hash=a,e},back:function(a){return e.previous?(history.back(),e.previous=null):a&&(location.hash=a),e}},f=function(){var a=location.hash.slice(1),c=!1,f=e.current;a||(a=d.defaultPath),f&&f!=e.previous&&(e.previous=f),e.current=a;for(var g=0,h=b.length;h>g&&!c;g++){var i=b[g],j=i.path,k=i.name,l=i.fn;if("string"==typeof j)j.toLowerCase()==a.toLowerCase()&&(d.before.call(e,j,k),l.call(e),d.on.call(e,j,k),c=!0);else{var m=a.match(j);m&&(d.before.call(e,j,k,m),l.apply(e,m),d.on.call(e,j,k,m),c=!0)}}return c||d.notfound.call(e),e};e.init=function(b){return a.addEventListener("hashchange",f),f()},e.reload=f,a.ruto=e}(window),function(a,b){function c(a,c){d.addType(a,function(f,g,h){var i,j,k,l,m=g,n=(new Date).getTime();if(!f){m={},l=[],k=0;try{for(f=c.length;f=c.key(k++);)e.test(f)&&(j=JSON.parse(c.getItem(f)),j.expires&&j.expires<=n?l.push(f):m[f.replace(e,"")]=j.data);for(;f=l.pop();)c.removeItem(f)}catch(o){}return m}if(f="__amplify__"+f,g===b){if(i=c.getItem(f),j=i?JSON.parse(i):{expires:-1},!(j.expires&&j.expires<=n))return j.data;c.removeItem(f)}else if(null===g)c.removeItem(f);else{j=JSON.stringify({data:g,expires:h.expires?n+h.expires:null});try{c.setItem(f,j)}catch(o){d[a]();try{c.setItem(f,j)}catch(o){throw d.error()}}}return m})}var d=a.store=function(a,b,c){var e=d.type;return c&&c.type&&c.type in d.types&&(e=c.type),d.types[e](a,b,c||{})};d.types={},d.type=null,d.addType=function(a,b){d.type||(d.type=a),d.types[a]=b,d[a]=function(b,c,e){return e=e||{},e.type=a,d(b,c,e)}},d.error=function(){return"amplify.store quota exceeded"};var e=/^__amplify__/;for(var f in{localStorage:1,sessionStorage:1})try{window[f].setItem("__amplify__","x"),window[f].removeItem("__amplify__"),c(f,window[f])}catch(g){}if(!d.types.localStorage&&window.globalStorage)try{c("globalStorage",window.globalStorage[window.location.hostname]),"sessionStorage"===d.type&&(d.type="globalStorage")}catch(g){}!function(){if(!d.types.localStorage){var a=document.createElement("div"),c="amplify";a.style.display="none",document.getElementsByTagName("head")[0].appendChild(a);try{a.addBehavior("#default#userdata"),a.load(c)}catch(e){return void a.parentNode.removeChild(a)}d.addType("userData",function(e,f,g){a.load(c);var h,i,j,k,l,m=f,n=(new Date).getTime();if(!e){for(m={},l=[],k=0;h=a.XMLDocument.documentElement.attributes[k++];)i=JSON.parse(h.value),i.expires&&i.expires<=n?l.push(h.name):m[h.name]=i.data;for(;e=l.pop();)a.removeAttribute(e);return a.save(c),m}if(e=e.replace(/[^\-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g,"-"),e=e.replace(/^-/,"_-"),f===b){if(h=a.getAttribute(e),i=h?JSON.parse(h):{expires:-1},!(i.expires&&i.expires<=n))return i.data;a.removeAttribute(e)}else null===f?a.removeAttribute(e):(j=a.getAttribute(e),i=JSON.stringify({data:f,expires:g.expires?n+g.expires:null}),a.setAttribute(e,i));try{a.save(c)}catch(o){null===j?a.removeAttribute(e):a.setAttribute(e,j),d.userData();try{a.setAttribute(e,i),a.save(c)}catch(o){throw null===j?a.removeAttribute(e):a.setAttribute(e,j),d.error()}}return m})}}(),function(){function a(a){return a===b?b:JSON.parse(JSON.stringify(a))}var c={},e={};d.addType("memory",function(d,f,g){return d?f===b?a(c[d]):(e[d]&&(clearTimeout(e[d]),delete e[d]),null===f?(delete c[d],null):(c[d]=f,g.expires&&(e[d]=setTimeout(function(){delete c[d],delete e[d]},g.expires)),f)):a(c)})}()}(this.amplify=this.amplify||{});var Hogan={};!function(a,b){function c(a,b,c){var d;return b&&"object"==typeof b&&(null!=b[a]?d=b[a]:c&&b.get&&"function"==typeof b.get&&(d=b.get(a))),d}function d(a,b,c,d,e,f){function g(){}function h(){}g.prototype=a,h.prototype=a.subs;var i,j=new g;j.subs=new h,j.subsText={},j.ib(),d=d||{},j.stackSubs=d;for(i in b)d[i]||(d[i]=b[i]),j.subsText[i]=f;for(i in d)j.subs[i]=d[i];e=e||{},j.stackPartials=e;for(i in c)e[i]||(e[i]=c[i]);for(i in e)j.partials[i]=e[i];return j}function e(a){return String(null===a||void 0===a?"":a)}function f(a){return a=e(a),l.test(a)?a.replace(g,"&").replace(h,"<").replace(i,">").replace(j,"'").replace(k,"""):a}a.Template=function(a,b,c,d){a=a||{},this.r=a.code||this.r,this.c=c,this.options=d||{},this.text=b||"",this.partials=a.partials||{},this.subs=a.subs||{},this.ib()},a.Template.prototype={r:function(a,b,c){return""},v:f,t:e,render:function(a,b,c){return this.ri([a],b||{},c)},ri:function(a,b,c){return this.r(a,b,c)},ep:function(a,b){var c=this.partials[a],e=b[c.name];if(c.instance&&c.base==e)return c.instance;if("string"==typeof e){if(!this.c)throw new Error("No compiler available.");e=this.c.compile(e,this.options)}return e?(this.partials[a].base=e,c.subs&&(void 0===this.activeSub&&(b.stackText=this.text),e=d(e,c.subs,c.partials,this.stackSubs,this.stackPartials,b.stackText||this.text)),this.partials[a].instance=e,e):null},rp:function(a,b,c,d){var e=this.ep(a,c);return e?e.ri(b,c,d):""},rs:function(a,b,c){var d=a[a.length-1];if(!m(d))return void c(a,b,this);for(var e=0;e
=0;j--)if(g=b[j],f=c(a,g,i),null!=f){h=!0;break}return h?(e||"function"!=typeof f||(f=this.mv(f,b,d)),f):e?!1:""},ls:function(a,b,c,d,f){var g=this.options.delimiters;return this.options.delimiters=f,this.b(this.ct(e(a.call(b,d)),b,c)),this.options.delimiters=g,!1},ct:function(a,b,c){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(a,this.options).render(b,c)},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ib:function(){this.buf=b?[]:""},ms:function(a,b,c,d,e,f,g){var h,i=b[b.length-1],j=a.call(i);return"function"==typeof j?d?!0:(h=this.activeSub&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(j,i,c,h.substring(e,f),g)):j},mv:function(a,b,c){var d=b[b.length-1],f=a.call(d);return"function"==typeof f?this.ct(e(f.call(d)),d,c):f},sub:function(a,b,c,d){var e=this.subs[a];e&&(this.activeSub=a,e(b,c,this,d),this.activeSub=!1)}};var g=/&/g,h=//g,j=/\'/g,k=/\"/g,l=/[&<>\"\']/,m=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}}("undefined"!=typeof exports?exports:Hogan),function(a){var b=function(){return+new Date},c=!!a.XDomainRequest,d="withCredentials"in new XMLHttpRequest||c,e=!1,f=2e4,g={};try{e=new Worker("js/hnapi-worker.js"),e.addEventListener("message",function(a){var b=a.data,c=b.url||"";if(g[c]){var d=g[c],e=d.error,f=d.success;delete g[c],b.error?e(b.error):f(b.response)}},!1)}catch(h){}var i=function(h,i,j){if(i||(i=function(){}),j||(j=function(){}),d)if(e)g[h]={success:i,error:j},e.postMessage({url:h,timeout:f});else{var k=g[h]||(c?new XDomainRequest:new XMLHttpRequest);k._timeout&&clearTimeout(k._timeout),k._timeout=setTimeout(function(){k.abort()},f),k.onload=function(){clearTimeout(this._timeout),delete g[h];try{i(JSON.parse(this.responseText))}catch(a){j(a)}},k.onerror=k.onabort=k.ontimeout=function(a){clearTimeout(this._timeout),delete g[h],j(a)},(k.readyState<=1||c)&&(k.open("GET",h+"?"+b(),!0),k.send()),g[h]=k}else{var l=a.document,m=l.createElement("script"),n="callback"+b();a[n]=i,m.onerror=j,m.src=h+"?callback="+n,l.body.appendChild(m)}},j=["//node-hnapi-eu.herokuapp.com/","//node-hnapi.azurewebsites.net/","//node-hnapi-asia.azurewebsites.net/","//node-hnapi-eus.azurewebsites.net/","//node-hnapi-weu.azurewebsites.net/","//node-hnapi-wus.azurewebsites.net/","//node-hnapi-ncus.azurewebsites.net/"],k=function(a){for(var b=a.length-1;b>0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}};k(j);var l=j.length,m=function(a,b,c,d){var e=l-1>a?function(){m(a+1,b,c,d)}:d;i(j[a]+b,c,e)},n=function(a,b,c){i(j[0]+a,b,function(){m(0,a,b,c)})},o={urls:j,news:function(a,b){n("news",a,b)},news2:function(a,b){n("news2",a,b)},item:function(a,b,c){n("item/"+a,b,c)},comments:function(a,b,c){n("comments/"+a,b,c)}};a.hnapi=o}(window),function(a,b){"function"==typeof define&&define.amd?define("tappable",[],function(){return b(a,window.document),a.tappable}):b(a,window.document)}(this,function(a,b){var c=Math.abs,d=function(){},e={noScroll:!1,activeClass:"tappable-active",onTap:d,onStart:d,onMove:d,onMoveOut:d,onMoveIn:d,onEnd:d,onCancel:d,allowClick:!1,boundMargin:50,noScrollDelay:0,activeClassDelay:0,inactiveClassDelay:0},f="ontouchend"in document,g={start:f?"touchstart":"mousedown",move:f?"touchmove":"mousemove",end:f?"touchend":"mouseup"},h=function(a,c){var d=b.elementFromPoint(a,c);return 3==d.nodeType&&(d=d.parentNode),d},i=function(a){var b=a.target;if(b)return 3==b.nodeType&&(b=b.parentNode),b;var c=a.targetTouches[0];return h(c.clientX,c.clientY)},j=function(a){return a.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")},k=function(a,b){return b?a.classList?void a.classList.add(b):void(j(a.className).indexOf(b)>-1||(a.className=j(a.className+" "+b))):void 0},l=function(a,b){return b?a.classList?void a.classList.remove(b):void(a.className=a.className.replace(new RegExp("(^|\\s)"+b+"(?:\\s|$)"),"$1")):void 0},m=function(a,c){var d=b.documentElement,e=d.matchesSelector||d.mozMatchesSelector||d.webkitMatchesSelector||d.oMatchesSelector||d.msMatchesSelector;return e.call(a,c)},n=function(a,b){var c=!1;do c=m(a,b);while(!c&&(a=a.parentNode)&&a.ownerDocument);return c?a:!1};a.tappable=function(a,d){"function"==typeof d&&(d={onTap:d});var f={};for(var j in e)f[j]=d[j]||e[j];var m,o,p,q,r,s,t,u,v=f.containerElement||b.body,w=!1,x=!1,y=f.activeClass,z=f.activeClassDelay,A=f.inactiveClassDelay,B=f.noScroll,C=f.noScrollDelay,D=f.boundMargin,E=function(b){var c=n(i(b),a);if(c){if(z?(clearTimeout(s),s=setTimeout(function(){k(c,y)},z)):k(c,y),A&&c==o&&clearTimeout(t),p=b.clientX,q=b.clientY,!p||!q){var d=b.targetTouches[0];p=d.clientX,q=d.clientY}m=c,w=!1,x=!1,r=B?c.getBoundingClientRect():null,C&&(clearTimeout(u),B=!1,u=setTimeout(function(){B=!0},C)),f.onStart.call(v,b,c)}},F=function(a){if(m){B?a.preventDefault():clearTimeout(s);var b=a.target,d=a.clientX,e=a.clientY;if(!b||!d||!e){var g=a.changedTouches[0];d||(d=g.clientX),e||(e=g.clientY),b||(b=h(d,e))}B?d>r.left-D&&dr.top-D&&e10&&(w=!0,l(m,y),f.onCancel.call(b,a)),f.onMove.call(v,a,b)}},G=function(a){if(m){if(clearTimeout(s),A){z&&!w&&k(m,y);var b=m;t=setTimeout(function(){l(b,y)},A)}else l(m,y);f.onEnd.call(v,a,m);var c=3==a.which||2==a.button;w||x||c||f.onTap.call(v,a,m),o=m,m=null,setTimeout(function(){p=q=null},400)}},H=function(a){m&&(l(m,y),m=p=q=null,f.onCancel.call(v,a))},I=function(b){var d=n(b.target,a);d?b.preventDefault():p&&q&&c(b.clientX-p)<25&&c(b.clientY-q)<25&&(b.stopPropagation(),b.preventDefault())};return v.addEventListener(g.start,E,!1),v.addEventListener(g.move,F,!1),v.addEventListener(g.end,G,!1),v.addEventListener("touchcancel",H,!1),f.allowClick||v.addEventListener("click",I,!1),{el:v,destroy:function(){return v.removeEventListener(g.start,E,!1),v.removeEventListener(g.move,F,!1),v.removeEventListener(g.end,G,!1),v.removeEventListener("touchcancel",H,!1),f.allowClick||v.removeEventListener("click",I,!1),this}}}}),void 0===Date.now&&(Date.now=function(){return(new Date).valueOf()});var TWEEN=TWEEN||function(){var a=[];return{REVISION:"12",getAll:function(){return a},removeAll:function(){a=[]},add:function(b){a.push(b)},remove:function(b){var c=a.indexOf(b);-1!==c&&a.splice(c,1)},update:function(b){if(0===a.length)return!1;var c=0;for(b=void 0!==b?b:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now():Date.now();ca;a++)o[a].stop()},this.delay=function(a){return k=a,this},this.repeat=function(a){return g=a,this},this.yoyo=function(a){return h=a,this},this.easing=function(a){return m=a,this},this.interpolation=function(a){return n=a,this},this.chain=function(){return o=arguments,this},this.onStart=function(a){return p=a,this},this.onUpdate=function(a){return r=a,this},this.onComplete=function(a){return s=a,this},this.update=function(a){var i;if(l>a)return!0;q===!1&&(null!==p&&p.call(b),q=!0);var t=(a-l)/f;t=t>1?1:t;var u=m(t);for(i in d){var v=c[i]||0,w=d[i];w instanceof Array?b[i]=n(w,u):("string"==typeof w&&(w=v+parseFloat(w,10)),"number"==typeof w&&(b[i]=v+(w-v)*u))}if(null!==r&&r.call(b,u),1==t){if(g>0){isFinite(g)&&g--;for(i in e){if("string"==typeof d[i]&&(e[i]=e[i]+parseFloat(d[i],10)),h){var x=e[i];e[i]=d[i],d[i]=x,j=!j}c[i]=e[i]}return l=a+k,!0}null!==s&&s.call(b);for(var y=0,z=o.length;z>y;y++)o[y].start(a);return!1}return!0}},TWEEN.Easing={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),-(c*Math.pow(2,10*(a-=1))*Math.sin(2*(a-b)*Math.PI/d)))},Out:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),c*Math.pow(2,-10*a)*Math.sin(2*(a-b)*Math.PI/d)+1)},InOut:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),(a*=2)<1?-.5*c*Math.pow(2,10*(a-=1))*Math.sin(2*(a-b)*Math.PI/d):c*Math.pow(2,-10*(a-=1))*Math.sin(2*(a-b)*Math.PI/d)*.5+1)}},Back:{In:function(a){var b=1.70158;return a*a*((b+1)*a-b)},Out:function(a){var b=1.70158;return--a*a*((b+1)*a+b)+1},InOut:function(a){var b=2.5949095;return(a*=2)<1?.5*a*a*((b+1)*a-b):.5*((a-=2)*a*((b+1)*a+b)+2)}},Bounce:{In:function(a){return 1-TWEEN.Easing.Bounce.Out(1-a)},Out:function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return.5>a?.5*TWEEN.Easing.Bounce.In(2*a):.5*TWEEN.Easing.Bounce.Out(2*a-1)+.5}}},TWEEN.Interpolation={Linear:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d),f=TWEEN.Interpolation.Utils.Linear;return 0>b?f(a[0],a[1],d):b>1?f(a[c],a[c-1],c-d):f(a[e],a[e+1>c?c:e+1],d-e)},Bezier:function(a,b){var c,d=0,e=a.length-1,f=Math.pow,g=TWEEN.Interpolation.Utils.Bernstein;for(c=0;e>=c;c++)d+=f(1-b,e-c)*f(b,c)*a[c]*g(e,c);return d},CatmullRom:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d),f=TWEEN.Interpolation.Utils.CatmullRom;return a[0]===a[c]?(0>b&&(e=Math.floor(d=c*(1+b))),f(a[(e-1+c)%c],a[e],a[(e+1)%c],a[(e+2)%c],d-e)):0>b?a[0]-(f(a[0],a[0],a[1],a[1],-d)-a[0]):b>1?a[c]-(f(a[c],a[c],a[c-1],a[c-1],d-c)-a[c]):f(a[e?e-1:0],a[e],a[e+1>c?c:e+1],a[e+2>c?c:e+2],d-e)},Utils:{Linear:function(a,b,c){return(b-a)*c+a},Bernstein:function(a,b){var c=TWEEN.Interpolation.Utils.Factorial;return c(a)/c(b)/c(a-b)},Factorial:function(){var a=[1];return function(b){var c,d=1;if(a[b])return a[b];for(c=b;c>1;c--)d*=c;return a[b]=d}}(),CatmullRom:function(a,b,c,d,e){var f=.5*(c-a),g=.5*(d-b),h=e*e,i=e*h;return(2*b-2*c+f+g)*i+(-3*b+3*c-2*f-g)*h+f*e+b}}},function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c "),d.fl()},partials:{"'),d.b(d.v(d.f("i",a,b,0))),d.b('
'),d.b(d.v(d.f("title",a,b,0))),d.b(""),d.s(d.f("user",a,b,1),a,b,0,301,593,"{{ }}")&&(d.rs(a,b,function(a,b,c){c.b(''),c.s(c.f("domain",a,b,1),a,b,0,335,380,"{{ }}")&&(c.rs(a,b,function(a,b,c){c.b(''),c.b(c.v(c.f("domain",a,b,0))),c.b("
")}),a.pop()),c.b(''),c.b(c.v(c.f("points",a,b,0))),c.b(" "),c.b(c.v(c.f("i_point",a,b,0))),c.b(" by "),c.b(c.v(c.f("user",a,b,0))),c.b(' '),c.b(c.v(c.f("time_ago",a,b,0))),c.s(c.f("comments_count",a,b,1),a,b,0,518,560,"{{ }}")&&(c.rs(a,b,function(a,b,c){c.b(" · "),c.b(c.v(c.f("comments_count",a,b,0))),c.b(" "),c.b(c.v(c.f("i_comment",a,b,0)))}),a.pop()),c.b("")}),a.pop()),d.s(d.f("user",a,b,1),a,b,1,0,0,"")||(d.b(''),d.s(d.f("domain",a,b,1),a,b,0,645,690,"{{ }}")&&(d.rs(a,b,function(a,b,c){c.b(''),c.b(c.v(c.f("domain",a,b,0))),c.b("
")}),a.pop()),d.b(''),d.b(d.v(d.f("time_ago",a,b,0))),d.b("")),d.b("
"),d.s(d.f("detail_disclosure",a,b,1),a,b,0,795,869,"{{ }}")&&(d.rs(a,b,function(a,b,c){c.b('')}),a.pop()),d.b(""),d.fl()},partials:{},subs:{}}),"stories-load":new a({code:function(a,b,c){var d=this;return d.b(c=c||""),d.s(d.f("loading",a,b,1),a,b,0,12,82,"{{ }}")&&(d.rs(a,b,function(a,b,c){c.b(' Loading…
')}),a.pop()),d.s(d.f("load_error",a,b,1),a,b,0,109,161,"{{ }}")&&(d.rs(a,b,function(a,b,c){c.b('Couldn\'t load stories.
')}),a.pop()),d.fl()},partials:{},subs:{}})}}(Hogan.Template),function(a){var b=a.document,c=a.$=function(a){return b.getElementById(a)},d={},e=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},f={pub:function(a,b){var c=d[a];if(c)for(var e=0,f=c.length;f>e;e++)c[e].call(this,b)},sub:function(a,b){d[a]||(d[a]=[]),d[a].push(b)},currentView:null,hideAllViews:function(){for(var a=b.querySelectorAll(".view"),c=0,d=a.length;d>c;c++)a[c].classList.add("hidden")},tmpl:function(a,b){var c=TEMPLATES[a];if(c)return b?c.render(b):c},setTitle:function(a){var b="HackerWeb";a&&(a=a.replace(/^\s+|\s+$/g,""),a.toLowerCase()!=b.toLowerCase()&&(b=a+" – "+b)),document.title=b}};"undefined"!=typeof ga&&f.sub("logAPIError",function(a){ga("send","event","Errors","API",a)});var g=f.tmpl;amplify.store.sessionStorage&&"function"==typeof amplify.store.sessionStorage||(amplify.store.sessionStorage=amplify.store.memory);var h=b.createElement("a"),i={},j=function(a){var b=i[a];if(b)return b;h.href=a;var c=h.hostname.replace(/^www\./,""),d=h.pathname.replace(/^\//,"").split("/")[0],e=d.length,f=c.length<=25&&e>3&&15>=e&&/^[^0-9][^.]+$/.test(d)?"/"+d:"";return b=c+f},k=b.querySelector("#view-home .scroll"),l=k.querySelector("section"),m=!1;f.news={options:{disclosure:!0},markupStory:function(a){return/^item/i.test(a.url)?a.url="#/item/"+a.id:(a.external=!0,a.domain=j(a.url)),f.news.options.disclosure?("link"==a.type&&(a.detail_disclosure=!0),/^#\//.test(a.url)&&(a.disclosure=!0,a.domain=null)):a.id&&(a.url="#/item/"+a.id),a.i_point=1==a.points?"point":"points",a.i_comment=1==a.comments_count?"comment":"comments",g("post",a)},markupStories:function(a,b){var c="";b||(b=1);var d=f.news.markupStory;return a.forEach(function(a){a.i=b++,c+=d(a)}),c},updateStory:function(a){if(a&&a.id){var b,d=a.id,e=a.data,g="hacker-news",h=amplify.store(g);if(h)for(var i=0,j=h.length;j>i;i++){var k=h[i];if(d==k.id){b=k;break}}if(!b&&(g="hacker-news2",h=amplify.store(g)))for(var i=0,j=h.length;j>i;i++){var k=h[i];if(d==k.id){b=k;break}}if(b){var l=!1;if(["title","url","time_ago","comments_count","points"].forEach(function(a){var c=e[a];b[a]!=c&&(b[a]=c,l=!0)}),l){amplify.store(g,h);var m=c("story-"+d);m&&(b.selected=!!m.querySelector("a[href].selected"),b.i=m.dataset?m.dataset.index:m.getAttribute("data-index"),m.insertAdjacentHTML("afterend",f.news.markupStory(b)),m.parentNode.removeChild(m))}}}},render:function(a){if(!m){a||(a={});var b=amplify.store("hacker-news-cached"),d=g("stories-load"),e=function(a){var b=a.slice(),c=''+f.news.markupStories(b)+(amplify.store("hacker-news2")?'- More…
':"")+"
";l.innerHTML=c,f.pub("onRenderNews")};if(b){var h=amplify.store("hacker-news"),i=a.delay;i?(m=!0,l.innerHTML=d.render({loading:!0}),setTimeout(function(){m=!1,e(h)},i)):e(h)}else{m=!0,l.innerHTML=d.render({loading:!0});var j=function(){l.innerHTML=d.render({load_error:!0}),f.pub("logAPIError","news")};hnapi.news(function(a){return m=!1,!a||a.error?void j():(amplify.store("hacker-news",a),amplify.store("hacker-news-cached",!0,{expires:6e5}),amplify.store("hacker-news2",null),e(a),void hnapi.news2(function(a){a&&!a.error&&(amplify.store("hacker-news2",a),c("hwlist").insertAdjacentHTML("beforeend",'More…'))}))},function(a){m=!1,j()})}}},reload:function(){f.news.render({delay:300})},more:function(a){a.classList.add("loading");var b=amplify.store("hacker-news2");setTimeout(function(){a.classList.remove("loading");var d=a.parentNode;if(d&&(d.parentNode&&d.parentNode.removeChild(d),b)){var e=b.slice(),g=f.news.markupStories(e,31);c("hwlist").insertAdjacentHTML("beforeend",g)}},400)}};var n=c("view-comments"),o=n.querySelector("header h1"),p=n.querySelector("section");f.comments={currentID:null,render:function(a){if(a){var c=amplify.store.sessionStorage("hacker-item-"+a);if(f.comments.currentID!=a||!c){f.comments.currentID=a;var d=function(a,b){if(a&&!a.error){var c=e(a);amplify.store.sessionStorage("hacker-comments-"+b,c);var d=p.querySelector(".comments>ul");if(d.querySelector(".more-link-container")||d.insertAdjacentHTML("beforeend",'More…'),c.more_comments_id){var f=function(a){var b=amplify.store.sessionStorage("hacker-comments-"+a);b?b.more_comments_id&&f(b.more_comments_id):hnapi.comments(a,function(b){b&&!b.error&&(amplify.store.sessionStorage("hacker-comments-"+a,b),b.more_comments_id&&f(b.more_comments_id))})};f(c.more_comments_id)}}},h=function(a,c){var h=e(a),i=g("post-comments");if(h.has_post=!!h.title,!h.has_post)return f.setTitle(),o.innerHTML="",p.innerHTML=i.render(h),f.pub("adjustCommentsSection"),void f.pub("onRenderComments");var k=g("comments");if(/^item/i.test(h.url)?h.url="//news.ycombinator.com/"+h.url:h.domain=j(h.url),h.has_comments=h.comments&&!!h.comments.length,h.i_point=1==h.points?"point":"points",h.i_comment=1==h.comments_count?"comment":"comments",h.has_content=!!h.content,h.poll){var l=0,m=0;h.poll.forEach(function(a){var b=a.points;b>m&&(m=b),l+=b,a.i_point=1==b?"point":"points"}),h.poll.forEach(function(a){var b=a.points;a.percentage=(b/l*100).toFixed(1),a.width=(b/m*100).toFixed(1)+"%"}),h.has_poll=h.has_content=!0}h.short_hn_url="news.ycombinator.com/item?id="+c,h.hn_url="//"+h.short_hn_url,f.setTitle(h.title),o.innerHTML=h.title;var n=i.render(h,{comments_list:k}),q=b.createElement("div");q.innerHTML=n;for(var r=q.querySelectorAll("a"),s=0,t=r.length;t>s;s++){var u=r[s];if(u.classList.contains("comment-permalink")){var c=u.dataset?u.dataset.id:u.getAttribute("data-id");u.href="//news.ycombinator.com/item?id="+c}u.target="_blank"}var v=h.user;if(v)for(var w=q.querySelectorAll(".user"),s=0,t=w.length;t>s;s++){var x=w[s];x.textContent.trim()==v&&(x.classList.add("op"),x.title="Original Poster")}if(n.length>2e4)for(var y=q.querySelectorAll(".comments>ul>li>ul"),z=g("comments-toggle"),A=0,t=y.length;t>A;A++){var B=y[A],C=B.querySelectorAll(".metadata").length;B.style.display="none",C&&B.insertAdjacentHTML("beforebegin",z.render({comments_count:C,i_reply:1==C?"reply":"replies"}))}for(;p.hasChildNodes();)p.removeChild(p.childNodes[0]);for(;q.hasChildNodes();)p.appendChild(q.childNodes[0]);if(delete q,h.more_comments_id){var c=h.more_comments_id,D=amplify.store.sessionStorage("hacker-comments-"+c);D?d(D,c):hnapi.comments(c,function(a){d(a,c)})}f.pub("onRenderComments")};if(c)p.scrollTop=0,h(c,a);else{var i=amplify.store("hacker-news");if(i)for(var k=0,l=i.length;l>k;k++){var m=i[k];if(a==m.id){c=m;break}}if(!c){var i=amplify.store("hacker-news2");if(i)for(var k=0,l=i.length;l>k;k++){var m=i[k];if(a==m.id){c=m;break}}}c?(c.loading=!0,h(c,a)):h({loading:!0},a);var n=function(){c?(delete c.loading,c.load_error=!0,h(c,a)):h({load_error:!0},a),f.pub("logAPIError","comments")};hnapi.item(a,function(b){if(f.comments.currentID==a){if(!b||b.error&&"comments"==f.currentView)return void n();amplify.store.sessionStorage("hacker-item-"+a,b,{expires:3e5}),f.news.updateStory({id:a,data:b}),h(b,a)}},function(b){f.comments.currentID==a&&n()})}}}},toggle:function(a){var b=a.nextElementSibling;if(b){var c=b.style,d=p.scrollTop;c.display="none"==c.display?"":"none",p.scrollTop=d}},more:function(a){var c=a.dataset?a.dataset.id:a.getAttribute("data-id"),d=amplify.store.sessionStorage("hacker-comments-"+c);if(d){var e=g("comments"),f=g("comments"),h=e.render(d,{comments_list:e}),i=a.parentNode,j=i.parentNode,k=d.more_comments_id,l=b.createElement("ul");
-
-l.innerHTML=h;for(var m=l.querySelectorAll("a"),n=0,o=m.length;o>n;n++)m[n].target="_blank";for(var p=l.children,n=0,o=p.length;o>n;n++){var q=p[n].getElementsByTagName("ul")[0],r=q.querySelectorAll(".metadata").length;q.style.display="none",r&&q.insertAdjacentHTML("beforebegin",f.render({comments_count:r,i_reply:1==r?"reply":"replies"}))}for(k&&lify.store.sessionStorage("hacker-comments-"+k)&&l.insertAdjacentHTML("beforeend",'More…'),j.removeChild(i);l.hasChildNodes();)j.appendChild(l.childNodes[0]);delete l}else alert("Oops, the comments have expired.")},reload:function(){f.comments.currentID=null,ruto.reload()}},f.init=function(){f.news.render(),ruto.init()},a.hw=f,ruto.config({before:function(a,b){f.hideAllViews();var d=c("view-"+b);d.classList.remove("hidden"),f.currentView=b,f.setTitle(d.querySelector("header h1").textContent)},notfound:function(){ruto.go("/")}}).add("/","home").add("/about","about").add(/^\/item\/(\d+)$/i,"comments",function(a,b){f.comments.render(b)})}(window),function(a){var b=a.document,c=b.body,d=["webkit","moz","MS","o",""],e=d.length,f=function(a,b,c){for(var f=0;e>f;f++)d[f]||(b=b.toLowerCase()),a.addEventListener(d[f]+b,c,!1)},g=function(a,b,c){for(var f=0;e>f;f++)d[f]||(b=b.toLowerCase()),a.removeEventListener(d[f]+b,c,!1)},h={rtl:["slide-out-to-left","slide-in-from-right"],ltr:["slide-out-to-right","slide-in-from-left"]},i=function(a){var b=a["in"],c=a.out,d=b.classList,e=c.classList,i=a.direction,j=h[i],k=function(){e.add("hidden"),e.remove(j[0]),d.remove(j[1]),g(b,"AnimationEnd",k)};f(b,"AnimationEnd",k),d.remove("hidden"),d.add(j[1]),e.add(j[0])},j=function(a){var b=a["in"],c=a.out,d=b.classList,e=c.classList,h=a.direction;if("up"==h)e.add("no-pointer"),d.remove("hidden"),d.add("slide-up");else{var i=function(){e.remove("slide-down"),e.add("hidden"),d.remove("no-pointer"),g(c,"AnimationEnd",i)};f(c,"AnimationEnd",i),e.remove("slide-up"),e.add("slide-down")}},k=function(){return a.innerWidth>=640?"wide":"narrow"},l=b.querySelector("meta[name=viewport]");l||(l=b.createElement("meta"),l.name="viewport",b.head.appendChild(l)),l.content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0";var m="wide"==k();a.addEventListener("resize",function(){var a="wide"==k();a!=m&&(m=a,location.reload())}),m&&c.insertAdjacentHTML("beforeend",'');var n=!1;document.addEventListener("touchstart",function(a){var b=a.targetTouches[0],c=b.clientX;(20>c||c>window.innerWidth-20)&&(n=!0)}),document.addEventListener("touchend",function(a){n=!1}),ruto.config({before:function(a,b,c){var d=hw.previousView=hw.currentView,e=hw.currentView=b,f=hw.hideAllViews,g=$("view-"+e);switch(hw.setTitle(g.querySelector("header h1").textContent),e){case"home":if(m){f(),$("overlay").classList.add("hide"),g.classList.remove("hidden");var h=$("view-comments");h.classList.remove("hidden"),h.querySelector("section").innerHTML='',h.querySelector("header h1").innerHTML="",h.querySelector("header a.header-back-button").style.display="none",hw.comments.currentID=null,hw.pub("selectCurrentStory")}else"comments"!=d||n?"about"!=d||n?(f(),g.classList.remove("hidden")):j({in:g,out:$("view-"+d),direction:"down"}):i({in:g,out:$("view-"+d),direction:"ltr"});break;case"about":if(m)g.classList.remove("hidden"),$("view-home").classList.remove("hidden"),$("view-comments").classList.remove("hidden"),setTimeout(function(){$("overlay").classList.remove("hide")},1);else if("home"!=d||n){f();var k=$("view-home");k.classList.remove("hidden"),g.classList.remove("hidden")}else j({in:g,out:$("view-"+d),direction:"up"});break;case"comments":if(m)f(),$("overlay").classList.add("hide"),g.classList.remove("hidden"),$("view-home").classList.remove("hidden"),hw.pub("selectCurrentStory",c[1]),g.querySelector("header a.header-back-button").style.display="";else if("home"!=d||n)f(),g.classList.remove("hidden");else{var l=c[1];l&&hw.comments.currentID!=l&&(g.querySelector("section").scrollTop=0),i({in:g,out:$("view-"+d),direction:"rtl"})}}}}),a.addEventListener("pagehide",function(){for(var a=b.querySelectorAll(".view"),c={},d=0,e=a.length;e>d;d++){var f=a[d];c[f.id]=f.querySelector(".scroll section").scrollTop||0}amplify.store("hacker-scrolltops",c)},!1);var o=function(){var a=amplify.store("hacker-scrolltops");for(var b in a){var c=$(b).querySelector(".scroll section");c.scrollTop=a[b]}};a.addEventListener("pageshow",o,!1),o(),tappable(".view>header a.header-button[href]",{noScroll:!0,onTap:function(a,b){var c=b.hash;m&&/about/i.test(ruto.current)&&"#/"==c?ruto.back("/"):location.hash=c}}),tappable("#view-home-refresh",{noScroll:!0,onTap:hw.news.reload});var p=!1;tappable(".view>header h1",{onTap:function(a,b){var c=b.parentNode.nextElementSibling.firstElementChild;if(0!=c.scrollTop&&!p&&!p){p=!0;var d=c.style.overflow;c.style.overflow="hidden",setTimeout(function(){c.style.overflow=d;var a,b=new TWEEN.Tween({scrollTop:c.scrollTop}).to({scrollTop:0},300).easing(TWEEN.Easing.Cubic.InOut).onUpdate(function(){c.scrollTop=this.scrollTop}).onComplete(function(){cancelAnimationFrame(a),b.stop(),p=!1,delete b}).start(),e=function(){TWEEN.update(),requestAnimationFrame(e)};a=requestAnimationFrame(e)},200)}}});var q;if(tappable("#view-home .tableview-links li>a:first-child",{allowClick:!m,activeClassDelay:100,inactiveClassDelay:m?100:1e3,onStart:function(a,b){if(m){var c=b.parentNode;c&&(c=c.parentNode,q=setTimeout(function(){c&&c.classList.add("list-tapped")},100))}},onMove:function(){m&&clearTimeout(q)},onEnd:function(a,b){if(m){clearTimeout(q);var c=b.parentNode.parentNode;setTimeout(function(){c&&c.classList.remove("list-tapped")},100)}},onTap:function(b,c){c.classList.contains("more-link")?hw.news.more(c):/^#\//.test(c.getAttribute("href"))?location.hash=c.hash:c.href&&m&&a.open(c.href)}}),tappable("#view-about .grouped-tableview-links li>a:first-child",{allowClick:!0,activeClassDelay:100,inactiveClassDelay:1e3}),tappable("#view-home .tableview-links li>a.detail-disclosure-button",{noScroll:!0,noScrollDelay:100,onTap:function(a,b){"comments"!=hw.currentView&&(location.hash=b.hash)}}),tappable("button.comments-toggle",function(a,b){hw.comments.toggle(b)}),tappable("section.comments li>a.more-link",function(a,b){hw.comments.more(b)}),tappable("#view-comments .load-error button",hw.comments.reload),hw.sub("selectCurrentStory",function(a){if(m){a||(a=(location.hash.match(/item\/(\d+)/)||[,""])[1]);for(var b=$("view-home"),c=b.querySelectorAll("a[href].selected"),d=0,e=c.length;e>d;d++)c[d].classList.remove("selected");if(a){var f=b.querySelector('a[href*="item/'+a+'"]');f&&(f.classList.add("selected"),setTimeout(function(){f.scrollIntoViewIfNeeded?f.scrollIntoViewIfNeeded():f.scrollIntoView()},1))}}}),hw.sub("onRenderNews",function(){hw.pub("selectCurrentStory")}),a.addEventListener("pageshow",function(){setTimeout(function(){"home"==hw.currentView&&$("hwlist")&&!amplify.store("hacker-news-cached")&&hw.news.reload()},1)},!1),m){var r=$("apploader");r.parentNode.removeChild(r)}else setTimeout(function(){var a=$("apploader");a&&(a.classList.add("hide"),f(a,"TransitionEnd",function(){a.parentNode.removeChild(a)}))},200);m&&setTimeout(function(){$("view-about").classList.add("animated")},400),hw.news.options.disclosure=!m,hw.init()}(window);
+!function(t){function e(){}function n(){var e=location.hash.slice(1),t=!1,n=f.current,e=e||d.defaultPath;n&&n!=f.previous&&(f.previous=n),f.current=e;for(var o=0,i=u.length;o/g,i=/\'/g,r=/\"/g,a=/[&<>\"\']/;function s(e){return String(null==e?"":e)}var d=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}("undefined"!=typeof exports?exports:Hogan),function(s){var l=!!s.XDomainRequest,c="withCredentials"in new XMLHttpRequest||l,u=!1,d={};try{(u=new Worker("js/hnapi-worker.js")).addEventListener("message",
+function(e){var t,n,o,i=e.data,r=i.url||"";d[r]&&(n=(t=d[r]).error,o=t.success,delete d[r],i.error?n(i.error):o(i.response))},!1)}catch(e){}function r(t,e,n){var o,i,r,a;e=e||function(){},n=n||function(){},c?u?(d[t]={success:e,error:n},u.postMessage({url:t,timeout:2e4})):((o=d[t]||new(l?XDomainRequest:XMLHttpRequest))._timeout&&clearTimeout(o._timeout),o._timeout=setTimeout(function(){o.abort()},2e4),o.onload=function(){clearTimeout(this._timeout),delete d[t];try{e(JSON.parse(this.responseText))
+}catch(e){n(e)}},o.onerror=o.onabort=o.ontimeout=function(e){clearTimeout(this._timeout),delete d[t],n(e)},(o.readyState<=1||l)&&(o.open("GET",t,!0),o.send()),d[t]=o):(r=(i=s.document).createElement("script"),a="callback"+ +new Date,s[a]=e,r.onerror=n,r.src=t+"?callback="+a,i.body.appendChild(r))}var a=["https://node-hnapi-eu.herokuapp.com/","https://node-hnapi.azurewebsites.net/","https://node-hnapi-eus.azurewebsites.net/"];!function(e){for(var t=e.length-1;0p.left-_&&np.top-_&&o
"),c.b(c.rp("")}),a.pop()),d.s(d.f("has_comments",a,b,1),a,b,1,0,0,"")||d.b('
No comments.
')),d.b("