Socket
Socket
Sign inDemoInstall

hapi-decorators

Package Overview
Dependencies
4
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.3 to 1.0.0

CHANGELOG.md

19

_docpress/_docpress.json

@@ -39,5 +39,5 @@ {

{
"title": "`@config(config)`",
"title": "`@options(options)`",
"depth": 3,
"id": "@config(config)"
"id": "@options(options)"
},

@@ -53,2 +53,7 @@ {

"id": "@cache(cacheconfig)"
},
{
"title": "`@pre(preArray)`",
"depth": 3,
"id": "@pre(prearray)"
}

@@ -65,2 +70,3 @@ ]

"title": "hapi-decorators",
"pageTitle": "hapi-decorators",
"slug": "index",

@@ -96,5 +102,5 @@ "headings": [

{
"title": "`@config(config)`",
"title": "`@options(options)`",
"depth": 3,
"id": "@config(config)"
"id": "@options(options)"
},

@@ -110,2 +116,7 @@ {

"id": "@cache(cacheconfig)"
},
{
"title": "`@pre(preArray)`",
"depth": 3,
"id": "@pre(prearray)"
}

@@ -112,0 +123,0 @@ ]

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var Pjax=require("pjax"),Nprogress=require("nprogress"),onmount=require("onmount"),each=require("dom101/each"),toggleClass=require("dom101/toggle-class"),ready=require("dom101/ready"),Scrolltrack=require("./scrolltrack"),Scrollclass=require("./scrollclass");void function(){function e(){var e=document.querySelector("title");window.ga&&window.ga("send","pageview",{page:window.location.href,title:e&&e.text})}ready(function(){new Pjax({selectors:[".body",".toc-menu","title"],analytics:e})}),ready(e),document.addEventListener("pjax:send",function(){Nprogress.start()}),document.addEventListener("pjax:error",function(){Nprogress.done()}),document.addEventListener("pjax:complete",function(){Nprogress.done()})}(),onmount(".js-menu-toggle",function(){this.addEventListener("click",function(){toggleClass(document.body,"-menu-visible")})}),void function(){ready(function(){onmount()}),document.addEventListener("pjax:complete",function(){onmount()})}(),void function(){var e=new Scrolltrack({menu:".toc-menu",selector:"h2, h3",onupdate:function(e,n){var o=document.querySelector(".toc-menu"),t=o.querySelector(".link.-active, .link.-notactive");toggleClass(t,"-active",!e),toggleClass(t,"-notactive",e)}});document.addEventListener("pjax:complete",function(){e.update()}),ready(function(){e.update()})}(),void function(){onmount(".footer-nav",function(e){e.sc=Scrollclass(this,{className:"-expanded",onscroll:function(e){return this.maxScroll-e<88}})},function(e){e.sc.destroy()})}(),void function(){onmount(".header-nav",function(e){e.sc=Scrollclass(this,{className:"-expanded",onscroll:function(e){return 40>e}})},function(e){e.sc.destroy()})}();
},{"./scrollclass":2,"./scrolltrack":3,"dom101/each":8,"dom101/ready":10,"dom101/toggle-class":13,"nprogress":14,"onmount":15,"pjax":16}],2:[function(require,module,exports){
var Pjax=require("pjax"),Nprogress=require("nprogress"),onmount=require("onmount"),toggleClass=require("dom101/toggle-class"),ready=require("dom101/ready"),Scrolltrack=require("./scrolltrack"),Scrollclass=require("./scrollclass");void function(){function e(){var e=document.querySelector("title");window.ga&&window.ga("send","pageview",{page:window.location.href,title:e&&e.text})}ready(function(){new Pjax({selectors:[".body",".toc-menu","title"],analytics:e})}),ready(e),document.addEventListener("pjax:send",function(){Nprogress.start()}),document.addEventListener("pjax:error",function(){Nprogress.done()}),document.addEventListener("pjax:complete",function(){Nprogress.done()})}(),onmount(".js-menu-toggle",function(){this.addEventListener("click",function(){toggleClass(document.body,"-menu-visible")})}),void function(){ready(function(){onmount()}),document.addEventListener("pjax:complete",function(){onmount()})}(),void function(){var e=new Scrolltrack({menu:".toc-menu",selector:"h2, h3",onupdate:function(e,n){var o=document.querySelector(".toc-menu"),t=o.querySelector(".link.-active, .link.-notactive");toggleClass(t,"-active",!e),toggleClass(t,"-notactive",e)}});document.addEventListener("pjax:complete",function(){e.update()}),ready(function(){e.update()})}(),void function(){onmount(".footer-nav",function(e){e.sc=Scrollclass(this,{className:"-expanded",onscroll:function(e){return this.maxScroll-e<88}})},function(e){e.sc.destroy()})}(),void function(){onmount(".header-nav",function(e){e.sc=Scrollclass(this,{className:"-expanded",onscroll:function(e){return e<40}})},function(e){e.sc.destroy()})}();
},{"./scrollclass":2,"./scrolltrack":3,"dom101/ready":10,"dom101/toggle-class":13,"nprogress":14,"onmount":15,"pjax":16}],2:[function(require,module,exports){
function Scrollclass(e,o){return this instanceof Scrollclass?(o||(o={}),this.el=q(e),this.parent=q(o.parent||document),this.className=o.className||"active",this.onresize=(o.onresize||noop).bind(this),this.onscroll=(o.onscroll||noop).bind(this),this._onscroll=debounce(this.poll.bind(this),5),this._onresize=debounce(this.update.bind(this),5),void this.listen()):new Scrollclass(e,o)}function noop(){}function q(e){return"string"==typeof e?document.querySelector(e):"object"==typeof e&&e[0]?e[0]:e}var debounce=require("debounce"),documentHeight=require("dom101/document-height"),toggleClass=require("dom101/toggle-class"),scrollTop=require("dom101/scroll-top");Scrollclass.prototype.listen=function(){window.addEventListener("resize",this._onresize),window.addEventListener("resize",this._onscroll),document.addEventListener("load",this._onresize,!0),document.addEventListener("load",this._onscroll,!0),this.parent.addEventListener("scroll",this._onscroll),this._onresize(),this._onscroll()},Scrollclass.prototype.destroy=function(){window.removeEventListener("resize",this._onresize),window.removeEventListener("resize",this._onscroll),document.removeEventListener("load",this._onresize,!0),document.removeEventListener("load",this._onscroll,!0),this.parent.removeEventListener("scroll",this._onscroll)},Scrollclass.prototype.update=function(){this.documentHeight=documentHeight(),this.winHeight=window.innerHeight,this.maxScroll=this.documentHeight-this.winHeight,this.onresize()},Scrollclass.prototype.poll=function(){var e=this.onscroll(scrollTop());toggleClass(this.el,this.className,e)},module.exports=Scrollclass;

@@ -8,3 +8,3 @@ },{"debounce":4,"dom101/document-height":7,"dom101/scroll-top":12,"dom101/toggle-class":13}],3:[function(require,module,exports){

},{"debounce":4,"dom101/document-height":7,"dom101/each":8,"dom101/scroll-top":12,"dom101/toggle-class":13}],4:[function(require,module,exports){
var now=require("date-now");module.exports=function(n,u,t){function e(){var p=now()-a;u>p&&p>0?r=setTimeout(e,u-p):(r=null,t||(i=n.apply(o,l),r||(o=l=null)))}var r,l,o,a,i;return null==u&&(u=100),function(){o=this,l=arguments,a=now();var p=t&&!r;return r||(r=setTimeout(e,u)),p&&(i=n.apply(o,l),o=l=null),i}};
var now=require("date-now");module.exports=function(n,u,t){function e(){var p=now()-a;p<u&&p>0?l=setTimeout(e,u-p):(l=null,t||(i=n.apply(r,o),l||(r=o=null)))}var l,o,r,a,i;return null==u&&(u=100),function(){r=this,o=arguments,a=now();var p=t&&!l;return l||(l=setTimeout(e,u)),p&&(i=n.apply(r,o),r=o=null),i}};
},{"date-now":5}],5:[function(require,module,exports){

@@ -17,7 +17,7 @@ function now(){return(new Date).getTime()}module.exports=Date.now||now;

},{}],8:[function(require,module,exports){
function each(e,r){var n,o,t=e.length;if("number"==typeof t)for(n=0;t>n;n++)r(e[n],n);else{o=0;for(n in e)e.hasOwnProperty(n)&&r(e[n],n,o++)}return e}module.exports=each;
function each(e,r){var n,o,t=e.length;if("number"==typeof t)for(n=0;n<t;n++)r(e[n],n);else{o=0;for(n in e)e.hasOwnProperty(n)&&r(e[n],n,o++)}return e}module.exports=each;
},{}],9:[function(require,module,exports){
function hasClass(s,a){return s.classList?s.classList.contains(a):new RegExp("(^| )"+a+"( |$)","gi").test(s.className)}module.exports=hasClass;
},{}],10:[function(require,module,exports){
function ready(e){document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e()})}module.exports=ready;
function ready(e){return"complete"===document.readyState?e():void(document.addEventListener?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e()}))}module.exports=ready;
},{}],11:[function(require,module,exports){

@@ -30,7 +30,49 @@ function removeClass(s,e){if(s.classList)s.classList.remove(e);else{var a=new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi");s.className=s.className.replace(a," ")}}module.exports=removeClass;

},{"./add-class":6,"./has-class":9,"./remove-class":11}],14:[function(require,module,exports){
!function(n,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():n.NProgress=e()}(this,function(){function n(n,e,t){return e>n?e:n>t?t:n}function e(n){return 100*(-1+n)}function t(n,t,r){var i;return i="translate3d"===c.positionUsing?{transform:"translate3d("+e(n)+"%,0,0)"}:"translate"===c.positionUsing?{transform:"translate("+e(n)+"%,0)"}:{"margin-left":e(n)+"%"},i.transition="all "+t+"ms "+r,i}function r(n,e){var t="string"==typeof n?n:o(n);return t.indexOf(" "+e+" ")>=0}function i(n,e){var t=o(n),i=t+e;r(t,e)||(n.className=i.substring(1))}function s(n,e){var t,i=o(n);r(n,e)&&(t=i.replace(" "+e+" "," "),n.className=t.substring(1,t.length-1))}function o(n){return(" "+(n.className||"")+" ").replace(/\s+/gi," ")}function a(n){n&&n.parentNode&&n.parentNode.removeChild(n)}var u={};u.version="0.2.0";var c=u.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};u.configure=function(n){var e,t;for(e in n)t=n[e],void 0!==t&&n.hasOwnProperty(e)&&(c[e]=t);return this},u.status=null,u.set=function(e){var r=u.isStarted();e=n(e,c.minimum,1),u.status=1===e?null:e;var i=u.render(!r),s=i.querySelector(c.barSelector),o=c.speed,a=c.easing;return i.offsetWidth,l(function(n){""===c.positionUsing&&(c.positionUsing=u.getPositioningCSS()),f(s,t(e,o,a)),1===e?(f(i,{transition:"none",opacity:1}),i.offsetWidth,setTimeout(function(){f(i,{transition:"all "+o+"ms linear",opacity:0}),setTimeout(function(){u.remove(),n()},o)},o)):setTimeout(n,o)}),this},u.isStarted=function(){return"number"==typeof u.status},u.start=function(){u.status||u.set(0);var n=function(){setTimeout(function(){u.status&&(u.trickle(),n())},c.trickleSpeed)};return c.trickle&&n(),this},u.done=function(n){return n||u.status?u.inc(.3+.5*Math.random()).set(1):this},u.inc=function(e){var t=u.status;return t?("number"!=typeof e&&(e=(1-t)*n(Math.random()*t,.1,.95)),t=n(t+e,0,.994),u.set(t)):u.start()},u.trickle=function(){return u.inc(Math.random()*c.trickleRate)},function(){var n=0,e=0;u.promise=function(t){return t&&"resolved"!==t.state()?(0===e&&u.start(),n++,e++,t.always(function(){e--,0===e?(n=0,u.done()):u.set((n-e)/n)}),this):this}}(),u.render=function(n){if(u.isRendered())return document.getElementById("nprogress");i(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=c.template;var r,s=t.querySelector(c.barSelector),o=n?"-100":e(u.status||0),l=document.querySelector(c.parent);return f(s,{transition:"all 0 linear",transform:"translate3d("+o+"%,0,0)"}),c.showSpinner||(r=t.querySelector(c.spinnerSelector),r&&a(r)),l!=document.body&&i(l,"nprogress-custom-parent"),l.appendChild(t),t},u.remove=function(){s(document.documentElement,"nprogress-busy"),s(document.querySelector(c.parent),"nprogress-custom-parent");var n=document.getElementById("nprogress");n&&a(n)},u.isRendered=function(){return!!document.getElementById("nprogress")},u.getPositioningCSS=function(){var n=document.body.style,e="WebkitTransform"in n?"Webkit":"MozTransform"in n?"Moz":"msTransform"in n?"ms":"OTransform"in n?"O":"";return e+"Perspective"in n?"translate3d":e+"Transform"in n?"translate":"margin"};var l=function(){function n(){var t=e.shift();t&&t(n)}var e=[];return function(t){e.push(t),1==e.length&&n()}}(),f=function(){function n(n){return n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(n,e){return e.toUpperCase()})}function e(n){var e=document.body.style;if(n in e)return n;for(var t,r=i.length,s=n.charAt(0).toUpperCase()+n.slice(1);r--;)if(t=i[r]+s,t in e)return t;return n}function t(t){return t=n(t),s[t]||(s[t]=e(t))}function r(n,e,r){e=t(e),n.style[e]=r}var i=["Webkit","O","Moz","ms"],s={};return function(n,e){var t,i,s=arguments;if(2==s.length)for(t in e)i=e[t],void 0!==i&&e.hasOwnProperty(t)&&r(n,t,i);else r(n,s[1],s[2])}}();return u});
!function(n,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():n.NProgress=e()}(this,function(){function n(n,e,t){return n<e?e:n>t?t:n}function e(n){return 100*(-1+n)}function t(n,t,r){var i;return i="translate3d"===c.positionUsing?{transform:"translate3d("+e(n)+"%,0,0)"}:"translate"===c.positionUsing?{transform:"translate("+e(n)+"%,0)"}:{"margin-left":e(n)+"%"},i.transition="all "+t+"ms "+r,i}function r(n,e){var t="string"==typeof n?n:s(n);return t.indexOf(" "+e+" ")>=0}function i(n,e){var t=s(n),i=t+e;r(t,e)||(n.className=i.substring(1))}function o(n,e){var t,i=s(n);r(n,e)&&(t=i.replace(" "+e+" "," "),n.className=t.substring(1,t.length-1))}function s(n){return(" "+(n.className||"")+" ").replace(/\s+/gi," ")}function a(n){n&&n.parentNode&&n.parentNode.removeChild(n)}var u={};u.version="0.2.0";var c=u.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'};u.configure=function(n){var e,t;for(e in n)t=n[e],void 0!==t&&n.hasOwnProperty(e)&&(c[e]=t);return this},u.status=null,u.set=function(e){var r=u.isStarted();e=n(e,c.minimum,1),u.status=1===e?null:e;var i=u.render(!r),o=i.querySelector(c.barSelector),s=c.speed,a=c.easing;return i.offsetWidth,l(function(n){""===c.positionUsing&&(c.positionUsing=u.getPositioningCSS()),f(o,t(e,s,a)),1===e?(f(i,{transition:"none",opacity:1}),i.offsetWidth,setTimeout(function(){f(i,{transition:"all "+s+"ms linear",opacity:0}),setTimeout(function(){u.remove(),n()},s)},s)):setTimeout(n,s)}),this},u.isStarted=function(){return"number"==typeof u.status},u.start=function(){u.status||u.set(0);var n=function(){setTimeout(function(){u.status&&(u.trickle(),n())},c.trickleSpeed)};return c.trickle&&n(),this},u.done=function(n){return n||u.status?u.inc(.3+.5*Math.random()).set(1):this},u.inc=function(e){var t=u.status;return t?("number"!=typeof e&&(e=(1-t)*n(Math.random()*t,.1,.95)),t=n(t+e,0,.994),u.set(t)):u.start()},u.trickle=function(){return u.inc(Math.random()*c.trickleRate)},function(){var n=0,e=0;u.promise=function(t){return t&&"resolved"!==t.state()?(0===e&&u.start(),n++,e++,t.always(function(){e--,0===e?(n=0,u.done()):u.set((n-e)/n)}),this):this}}(),u.render=function(n){if(u.isRendered())return document.getElementById("nprogress");i(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=c.template;var r,o=t.querySelector(c.barSelector),s=n?"-100":e(u.status||0),l=document.querySelector(c.parent);return f(o,{transition:"all 0 linear",transform:"translate3d("+s+"%,0,0)"}),c.showSpinner||(r=t.querySelector(c.spinnerSelector),r&&a(r)),l!=document.body&&i(l,"nprogress-custom-parent"),l.appendChild(t),t},u.remove=function(){o(document.documentElement,"nprogress-busy"),o(document.querySelector(c.parent),"nprogress-custom-parent");var n=document.getElementById("nprogress");n&&a(n)},u.isRendered=function(){return!!document.getElementById("nprogress")},u.getPositioningCSS=function(){var n=document.body.style,e="WebkitTransform"in n?"Webkit":"MozTransform"in n?"Moz":"msTransform"in n?"ms":"OTransform"in n?"O":"";return e+"Perspective"in n?"translate3d":e+"Transform"in n?"translate":"margin"};var l=function(){function n(){var t=e.shift();t&&t(n)}var e=[];return function(t){e.push(t),1==e.length&&n()}}(),f=function(){function n(n){return n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(n,e){return e.toUpperCase()})}function e(n){var e=document.body.style;if(n in e)return n;for(var t,r=i.length,o=n.charAt(0).toUpperCase()+n.slice(1);r--;)if(t=i[r]+o,t in e)return t;return n}function t(t){return t=n(t),o[t]||(o[t]=e(t))}function r(n,e,r){e=t(e),n.style[e]=r}var i=["Webkit","O","Moz","ms"],o={};return function(n,e){var t,i,o=arguments;if(2==o.length)for(t in e)i=e[t],void 0!==i&&e.hasOwnProperty(t)&&r(n,t,i);else r(n,o[1],o[2])}}();return u});
},{}],15:[function(require,module,exports){
void function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():window.jQuery?window.jQuery.onmount=t():e.onmount=t()}(this,function(e){function t(e,o,i){if(0===arguments.length||u(e)||l(e))t.poll();else if(1===arguments.length)t.poll(e);else{var r=new n(e,o,i);d.push(r),r.register()}return this}function n(e,n,o){this.id="b"+v++,this.init=n,this.exit=o,this.selector=t.selectify(e),this.loaded=[],this.key="__onmount:"+v}function o(e){for(;e;){if(e===document.documentElement)return!0;e=e.parentElement}}function i(e,n){if(t.$)return t.$(e).each(n);for(var o=document.querySelectorAll(e),i=0,r=o.length;r>i;i++)n.apply(o[i])}function r(e,t){a[e]||(a[e]=[]),a[e].push(t),f.push(t)}function s(e,n){var o=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;if(t.$)return t.$(e).is(n);if(o)return o.call(e,n);if(e.parentNode){for(var i=e.parentNode.querySelectorAll(n),r=i.length;r--;0)if(i[r]===e)return!0;return!1}}function c(e,t){var n,o=e.length;if(o===+o)for(n=0;o>n;n++)t(e[n],n);else for(n in e)e.hasOwnProperty(n)&&t(e[n],n);return e}function u(e){return"function"==typeof e&&e.fn&&e.noConflict}function l(e){return"object"==typeof e&&e.target}var f,d,a,h,v=0,p=0;t.$=window.jQuery||window.Zepto||window.Ender,t.MutationObserver=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,t.debug=!1,t.poll=function(e){e&&(e=t.selectify(e));var n=(e?a[e]:f)||[];c(n,function(e){e()})},t.observe=function(){var e=t.MutationObserver;if("undefined"!=typeof e){var n=new e(function(e){c(d,function(t){c(e,function(e){c(e.addedNodes,function(e){s(e,t.selector)&&t.visitEnter(e)}),c(e.removedNodes,function(e){s(e,t.selector)&&t.visitExit(e)})})})});return n.observe(document,{subtree:!0,childList:!0}),t.observer=n,t(),!0}},t.unobserve=function(){this.observer&&(this.observer.disconnect(),delete this.observer)},t.reset=function(){f=t.handlers=[],a=t.selectors={},d=t.behaviors=[]},t.selectify=function(e){return"@"===e[0]?'[role~="'+e.substr(1).replace(/"/g,'\\"')+'"]':e},n.prototype.register=function(){var e=this,t=this.loaded,n=this.selector;r(n,function(){c(t,function(t,n){e.visitExit(t,n)}),i(n,function(){e.visitEnter(this)})})},n.prototype.visitEnter=function(e){if(!e[this.key]){var n={id:"c"+p,selector:this.selector};this.init.call(e,n)!==!1&&(t.debug&&h("enter",this.selector,e),e[this.key]=n,this.loaded.push(e),p++)}},n.prototype.visitExit=function(e,n){e&&!o(e)&&("undefined"==typeof n&&(n=this.loaded.indexOf(e)),this.loaded[n]=void 0,this.exit&&this.exit.call(e,e[this.key])!==!1&&(t.debug&&h("exit",this.selector,e),delete e[this.key]))};var b={enter:"background-color:#dfd;font-weight:bold;color:#141",exit:"background-color:#fdd;font-weight:bold;color:#411"};return h=~navigator.userAgent.indexOf("Mozilla")?function(e,t,n){console.log("%c %s ",b[e],t,n)}:function(e,t,n){console.log("(onmount)",e,t)},t.reset(),t});
void function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():window.jQuery?window.jQuery.onmount=t():e.onmount=t()}(this,function(e){function t(e,o,i,r){if("object"==typeof i&&(r=i,i=void 0),0===arguments.length||d(e)||l(e))t.poll();else if(1===arguments.length)t.poll(e);else{var s=new n(e,o,i,r);a.push(s),s.register()}return this}function n(e,n,o,i){this.id="b"+b++,this.init=n,this.exit=o,this.selector=t.selectify(e),this.loaded=[],this.key="__onmount:"+b,this.detectMutate=i&&i.detectMutate}function o(e){for(;e;){if(e===document.documentElement)return!0;e=e.parentElement}}function i(e,n){return t.$?t.$(e):document.querySelectorAll(e)}function r(e,n){return t.$?e.each(function(e){n(this,e)}):f(e,n)}function s(e,n){return t.$?e.index(n)>-1:e.indexOf(n)>-1}function c(e,t){v[e]||(v[e]=[]),v[e].push(t),h.push(t)}function u(e,n){var o=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;if(t.$)return t.$(e).is(n);if(o)return o.call(e,n);if(e.parentNode){for(var i=e.parentNode.querySelectorAll(n),r=i.length;r--;0)if(i[r]===e)return!0;return!1}}function f(e,t){var n,o=e.length;if(o===+o)for(n=0;n<o;n++)t(e[n],n);else for(n in e)e.hasOwnProperty(n)&&t(e[n],n);return e}function d(e){return"function"==typeof e&&e.fn&&e.noConflict}function l(e){return"object"==typeof e&&e.target}var h,a,v,p,b=0,y=0;t.$=window.jQuery||window.Zepto||window.Ender,t.MutationObserver=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,t.debug=!1,t.poll=function(e){e&&(e=t.selectify(e));var n=(e?v[e]:h)||[];f(n,function(e){e()})},t.observe=function(){var e=t.MutationObserver;if("undefined"!=typeof e){var n=new e(function(e){f(a,function(t){f(e,function(e){f(e.addedNodes,function(e){u(e,t.selector)&&t.visitEnter(e)}),f(e.removedNodes,function(e){u(e,t.selector)&&t.doExit(e)})})})});return n.observe(document,{subtree:!0,childList:!0}),t.observer=n,t(),!0}},t.unobserve=function(){this.observer&&(this.observer.disconnect(),delete this.observer)},t.teardown=function(){f(a,function(e){f(e.loaded,function(t,n){t&&e.doExit(t,n)})})},t.reset=function(){h=t.handlers=[],v=t.selectors={},a=t.behaviors=[]},t.selectify=function(e){return"@"===e[0]?'[role~="'+e.substr(1).replace(/"/g,'\\"')+'"]':e},n.prototype.register=function(){var e=this,t=this.loaded,n=this.selector;c(n,function(){var o=i(n);f(t,function(t,n){e.visitExit(t,n,o)}),r(o,function(t){e.visitEnter(t)})})},n.prototype.visitEnter=function(e){if(!e[this.key]){var n={id:"c"+y,selector:this.selector};this.init.call(e,n)!==!1&&(t.debug&&p("enter",this.selector,e),e[this.key]=n,this.loaded.push(e),y++)}},n.prototype.visitExit=function(e,t,n){if(e)if(this.detectMutate){if(!s(n,e))return this.doExit(e,t)}else if(!o(e))return this.doExit(e,t)},n.prototype.doExit=function(e,n){"undefined"==typeof n&&(n=this.loaded.indexOf(e)),this.loaded[n]=void 0,this.exit&&this.exit.call(e,e[this.key])!==!1&&(t.debug&&p("exit",this.selector,e),delete e[this.key])};var w={enter:"background-color:#dfd;font-weight:bold;color:#141",exit:"background-color:#fdd;font-weight:bold;color:#411"};return p=~navigator.userAgent.indexOf("Mozilla")?function(e,t,n){console.log("%c %s ",w[e],t,n)}:function(e,t,n){console.log("(onmount)",e,t)},t.reset(),t});
},{}],16:[function(require,module,exports){
!function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.Pjax=e()}(this,function(){"use strict";function t(){return(new Date).getTime()}var e=function(o){this.firstrun=!0,this.options=o,this.options.elements=this.options.elements||"a[href], form[action]",this.options.selectors=this.options.selectors||["title",".js-Pjax"],this.options.switches=this.options.switches||{},this.options.switchesOptions=this.options.switchesOptions||{},this.options.history=this.options.history||!0,this.options.currentUrlFullReload=this.options.currentUrlFullReload||!1,this.options.analytics=this.options.analytics||function(t){window._gaq&&_gaq.push(["_trackPageview"]),window.ga&&ga("send","pageview",{page:t.url,title:t.title})},this.options.scrollTo=this.options.scrollTo||0,this.options.debug=this.options.debug||!1,this.maxUid=this.lastUid=t(),this.options.switches.head||(this.options.switches.head=this.switchElementsAlt),this.options.switches.body||(this.options.switches.body=this.switchElementsAlt),this.log("Pjax options",this.options),"function"!=typeof o.analytics&&(o.analytics=function(){}),this.parseDOM(document),e.on(window,"popstate",function(t){if(t.state){var o=e.clone(this.options);o.url=t.state.url,o.title=t.state.title,o.history=!1,t.state.uid<this.lastUid?o.backward=!0:o.forward=!0,this.lastUid=t.state.uid,this.loadUrl(t.state.url,o)}}.bind(this))};if(e.isSupported=function(){return window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)},e.forEachEls=function(t,e,o){return t instanceof HTMLCollection||t instanceof NodeList?Array.prototype.forEach.call(t,e,o):void e.call(o,t)},e.on=function(t,o,s,n){o="string"==typeof o?o.split(" "):o,o.forEach(function(o){e.forEachEls(t,function(t){t.addEventListener(o,s,n)})},this)},e.off=function(t,o,s,n){o="string"==typeof o?o.split(" "):o,o.forEach(function(o){e.forEachEls(t,function(t){t.removeEventListener(o,s,n)})},this)},e.trigger=function(t,o){o="string"==typeof o?o.split(" "):o,o.forEach(function(o){var s;document.createEvent?(s=document.createEvent("HTMLEvents"),s.initEvent(o,!0,!0)):(s=document.createEventObject(),s.eventType=o),s.eventName=o,document.createEvent?e.forEachEls(t,function(t){t.dispatchEvent(s)}):e.forEachEls(t,function(t){t.fireEvent("on"+s.eventType,s)})},this)},e.clone=function(t){if(null===t||"object"!=typeof t)return t;var e=t.constructor();for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e},e.executeScripts=function(t){e.forEachEls(t.querySelectorAll("script"),function(t){t.type&&"text/javascript"!==t.type.toLowerCase()||(t.parentNode&&t.parentNode.removeChild(t),e.evalScript(t))})},e.evalScript=function(t){var e=t.text||t.textContent||t.innerHTML||"",o=document.querySelector("head")||document.documentElement,s=document.createElement("script");if(e.match("document.write"))return console&&console.log&&console.log("Script contains document.write. Can’t be executed correctly. Code skipped ",t),!1;s.type="text/javascript";try{s.appendChild(document.createTextNode(e))}catch(n){s.text=e}return o.insertBefore(s,o.firstChild),o.removeChild(s),!0},e.prototype={log:function(){this.options.debug&&console&&("function"==typeof console.log?console.log.apply(console,arguments):console.log&&console.log(arguments))},getElements:function(t){return t.querySelectorAll(this.options.elements)},parseDOM:function(t){e.forEachEls(this.getElements(t),function(t){switch(t.tagName.toLowerCase()){case"a":this.attachLink(t);break;case"form":this.log("Pjax doesnt support <form> yet. TODO :)");break;default:throw"Pjax can only be applied on <a> or <form> submit"}},this)},attachLink:function(t){e.on(t,"click",function(o){return o.which>1||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey?-1:t.protocol!==window.location.protocol||t.host!==window.location.host?-2:t.pathname===location.pathname&&t.hash.length>0?-3:t.hash&&t.href.replace(t.hash,"")===location.href.replace(location.hash,"")?-4:t.href===location.href+"#"?-5:(o.preventDefault(),this.options.currentUrlFullReload&&t.href===window.location.href?(window.location.reload(),-6):void this.loadUrl(t.href,e.clone(this.options)))}.bind(this)),e.on(t,"keyup",function(t){this.log("pjax todo")}.bind(this))},forEachSelectors:function(t,o,s){s=s||document,this.options.selectors.forEach(function(n){e.forEachEls(s.querySelectorAll(n),t,o)})},switchSelectors:function(t,o,s,n){t.forEach(function(t){var i=o.querySelectorAll(t),a=s.querySelectorAll(t);if(this.log("Pjax switch",t,i,a),i.length!==a.length)throw"DOM doesn’t look the same on new loaded page: ’"+t+"’ - new "+i.length+", old "+a.length;e.forEachEls(i,function(o,s){var i=a[s];this.log("newEl",o,"oldEl",i),this.options.switches[t]?this.options.switches[t].bind(this)(i,o,n,this.options.switchesOptions[t]):e.switches.outerHTML.bind(this)(i,o,n)},this)},this)},latestChance:function(t){window.location=t},onSwitch:function(){e.trigger(window,"resize scroll")},loadContent:function(t,o){var s=document.implementation.createHTMLDocument(""),n=/<html[^>]+>/gi,i=/\s?[a-z:]+(?:\=(?:\'|\")[^\'\">]+(?:\'|\"))*/gi,a=t.match(n);a&&a.length&&(a=a[0].match(i),a.length&&(a.shift(),a.forEach(function(t){var e=t.trim().split("=");s.documentElement.setAttribute(e[0],e[1].slice(1,-1))}))),s.documentElement.innerHTML=t,this.log("load content",s.documentElement.attributes,s.documentElement.innerHTML.length),this.switchSelectors(this.options.selectors,s,document,o);var c=Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop();c&&document.activeElement!==c&&c.focus(),this.options.selectors.forEach(function(t){e.forEachEls(document.querySelectorAll(t),function(t){e.executeScripts(t)})})},doRequest:function(t,e){var o=new XMLHttpRequest;o.onreadystatechange=function(){4===o.readyState&&200===o.status?e(o.responseText):4!==o.readyState||404!==o.status&&500!==o.status||e(!1)},o.open("GET",t+(/[?&]/.test(t)?"&":"?")+(new Date).getTime(),!0),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.send(null)},loadUrl:function(o,s){this.log("load href",o,s),e.trigger(document,"pjax:send",s),this.doRequest(o,function(n){if(n===!1)return void e.trigger(document,"pjax:complete pjax:error",s);document.activeElement.blur();try{this.loadContent(n,s)}catch(i){if(this.options.debug)throw i;return console&&console.error&&console.error("Pjax switch fail: ",i),void this.latestChance(o)}s.history&&(this.firstrun&&(this.lastUid=this.maxUid=t(),this.firstrun=!1,window.history.replaceState({url:window.location.href,title:document.title,uid:this.maxUid},document.title)),this.lastUid=this.maxUid=t(),window.history.pushState({url:o,title:s.title,uid:this.maxUid},s.title,o)),this.forEachSelectors(function(t){this.parseDOM(t)},this),e.trigger(document,"pjax:complete pjax:success",s),s.analytics(),s.scrollTo!==!1&&(s.scrollTo.length>1?window.scrollTo(s.scrollTo[0],s.scrollTo[1]):window.scrollTo(0,s.scrollTo))}.bind(this))}},e.switches={outerHTML:function(t,e,o){t.outerHTML=e.outerHTML,this.onSwitch()},innerHTML:function(t,e,o){t.innerHTML=e.innerHTML,t.className=e.className,this.onSwitch()},sideBySide:function(t,o,s,n){var i=Array.prototype.forEach,a=[],c=[],r=document.createDocumentFragment(),l="animationend webkitAnimationEnd MSAnimationEnd oanimationend",h=0,u=function(t){t.target==t.currentTarget&&(h--,0>=h&&a&&(a.forEach(function(t){t.parentNode&&t.parentNode.removeChild(t)}),c.forEach(function(t){t.className=t.className.replace(t.getAttribute("data-pjax-classes"),""),t.removeAttribute("data-pjax-classes")}),c=null,a=null,this.onSwitch()))}.bind(this);n=n||{},i.call(t.childNodes,function(t){a.push(t),t.classList&&!t.classList.contains("js-Pjax-remove")&&(t.hasAttribute("data-pjax-classes")&&(t.className=t.className.replace(t.getAttribute("data-pjax-classes"),""),t.removeAttribute("data-pjax-classes")),t.classList.add("js-Pjax-remove"),n.callbacks&&n.callbacks.removeElement&&n.callbacks.removeElement(t),n.classNames&&(t.className+=" "+n.classNames.remove+" "+(s.backward?n.classNames.backward:n.classNames.forward)),h++,e.on(t,l,u,!0))}),i.call(o.childNodes,function(t){if(t.classList){var o="";n.classNames&&(o=" js-Pjax-add "+n.classNames.add+" "+(s.backward?n.classNames.forward:n.classNames.backward)),n.callbacks&&n.callbacks.addElement&&n.callbacks.addElement(t),t.className+=o,t.setAttribute("data-pjax-classes",o),c.push(t),r.appendChild(t),h++,e.on(t,l,u,!0)}}),t.className=o.className,t.appendChild(r)}},e.isSupported())return e;var o=function(){};for(var s in e.prototype)e.prototype.hasOwnProperty(s)&&"function"==typeof e.prototype[s]&&(o[s]=o);return o});
var clone=require("./lib/clone.js"),executeScripts=require("./lib/execute-scripts.js"),forEachEls=require("./lib/foreach-els.js"),newUid=require("./lib/uniqueid.js"),on=require("./lib/events/on.js"),trigger=require("./lib/events/trigger.js"),Pjax=function(t){this.firstrun=!0;var e=require("./lib/proto/parse-options.js");e.apply(this,[t]),this.log("Pjax options",this.options),this.maxUid=this.lastUid=newUid(),this.parseDOM(document),on(window,"popstate",function(t){if(t.state){var e=clone(this.options);e.url=t.state.url,e.title=t.state.title,e.history=!1,t.state.uid<this.lastUid?e.backward=!0:e.forward=!0,this.lastUid=t.state.uid,this.loadUrl(t.state.url,e)}}.bind(this))};if(Pjax.prototype={log:require("./lib/proto/log.js"),getElements:require("./lib/proto/get-elements.js"),parseDOM:require("./lib/proto/parse-dom.js"),refresh:require("./lib/proto/refresh.js"),reload:require("./lib/reload.js"),attachLink:require("./lib/proto/attach-link.js"),forEachSelectors:function(t,e,i){return require("./lib/foreach-selectors.js").bind(this)(this.options.selectors,t,e,i)},switchSelectors:function(t,e,i,o){return require("./lib/switches-selectors.js").bind(this)(this.options.switches,this.options.switchesOptions,t,e,i,o)},latestChance:function(t){window.location=t},onSwitch:function(){trigger(window,"resize scroll")},loadContent:function(t,e){var i=document.implementation.createHTMLDocument(),o=/<html[^>]+>/gi,r=/\s?[a-z:]+(?:\=(?:\'|\")[^\'\">]+(?:\'|\"))*/gi,s=t.match(o);if(s&&s.length&&(s=s[0].match(r),s.length&&(s.shift(),s.forEach(function(t){var e=t.trim().split("=");1===e.length?i.documentElement.setAttribute(e[0],!0):i.documentElement.setAttribute(e[0],e[1].slice(1,-1))}))),i.documentElement.innerHTML=t,this.log("load content",i.documentElement.attributes,i.documentElement.innerHTML.length),document.activeElement&&!document.activeElement.value)try{document.activeElement.blur()}catch(t){}this.switchSelectors(this.options.selectors,i,document,e);var n=Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop();n&&document.activeElement!==n&&n.focus(),this.options.selectors.forEach(function(t){forEachEls(document.querySelectorAll(t),function(t){executeScripts(t)})})},doRequest:require("./lib/request.js"),loadUrl:function(t,e){this.log("load href",t,e),trigger(document,"pjax:send",e),this.doRequest(t,function(i){if(i===!1)return void trigger(document,"pjax:complete pjax:error",e);document.activeElement.blur();try{this.loadContent(i,e)}catch(e){if(this.options.debug)throw e;return console&&console.error&&console.error("Pjax switch fail: ",e),void this.latestChance(t)}e.history&&(this.firstrun&&(this.lastUid=this.maxUid=newUid(),this.firstrun=!1,window.history.replaceState({url:window.location.href,title:document.title,uid:this.maxUid},document.title)),this.lastUid=this.maxUid=newUid(),window.history.pushState({url:t,title:e.title,uid:this.maxUid},e.title,t)),this.forEachSelectors(function(t){this.parseDOM(t)},this),trigger(document,"pjax:complete pjax:success",e),e.analytics(),e.scrollTo!==!1&&(e.scrollTo.length>1?window.scrollTo(e.scrollTo[0],e.scrollTo[1]):window.scrollTo(0,e.scrollTo))}.bind(this))}},Pjax.isSupported=require("./lib/is-supported.js"),Pjax.isSupported())module.exports=Pjax;else{var stupidPjax=function(){};for(var key in Pjax.prototype)Pjax.prototype.hasOwnProperty(key)&&"function"==typeof Pjax.prototype[key]&&(stupidPjax[key]=stupidPjax);module.exports=stupidPjax}
},{"./lib/clone.js":17,"./lib/events/on.js":19,"./lib/events/trigger.js":20,"./lib/execute-scripts.js":21,"./lib/foreach-els.js":22,"./lib/foreach-selectors.js":23,"./lib/is-supported.js":24,"./lib/proto/attach-link.js":26,"./lib/proto/get-elements.js":27,"./lib/proto/log.js":28,"./lib/proto/parse-dom.js":29,"./lib/proto/parse-options.js":31,"./lib/proto/refresh.js":32,"./lib/reload.js":33,"./lib/request.js":34,"./lib/switches-selectors.js":35,"./lib/uniqueid.js":37}],17:[function(require,module,exports){
module.exports=function(r){if(null===r||"object"!=typeof r)return r;var o=r.constructor();for(var t in r)r.hasOwnProperty(t)&&(o[t]=r[t]);return o};
},{}],18:[function(require,module,exports){
module.exports=function(e){var t=e.text||e.textContent||e.innerHTML||"",o=document.querySelector("head")||document.documentElement,n=document.createElement("script");if(t.match("document.write"))return console&&console.log&&console.log("Script contains document.write. Can’t be executed correctly. Code skipped ",e),!1;n.type="text/javascript";try{n.appendChild(document.createTextNode(t))}catch(e){n.text=t}return o.insertBefore(n,o.firstChild),o.removeChild(n),!0};
},{}],19:[function(require,module,exports){
var forEachEls=require("../foreach-els");module.exports=function(e,o,r,n){o="string"==typeof o?o.split(" "):o,o.forEach(function(o){forEachEls(e,function(e){e.addEventListener(o,r,n)})})};
},{"../foreach-els":22}],20:[function(require,module,exports){
var forEachEls=require("../foreach-els");module.exports=function(e,n,t){n="string"==typeof n?n.split(" "):n,n.forEach(function(n){var o;o=document.createEvent("HTMLEvents"),o.initEvent(n,!0,!0),o.eventName=n,t&&Object.keys(t).forEach(function(e){o[e]=t[e]}),forEachEls(e,function(e){var n=!1;e.parentNode||e===document||e===window||(n=!0,document.body.appendChild(e)),e.dispatchEvent(o),n&&e.parentNode.removeChild(e)})})};
},{"../foreach-els":22}],21:[function(require,module,exports){
var forEachEls=require("./foreach-els"),evalScript=require("./eval-script");module.exports=function(e){forEachEls(e.querySelectorAll("script"),function(e){e.type&&"text/javascript"!==e.type.toLowerCase()||(e.parentNode&&e.parentNode.removeChild(e),evalScript(e))})};
},{"./eval-script":18,"./foreach-els":22}],22:[function(require,module,exports){
module.exports=function(o,n,t){return o instanceof HTMLCollection||o instanceof NodeList||o instanceof Array?Array.prototype.forEach.call(o,n,t):n.call(t,o)};
},{}],23:[function(require,module,exports){
var forEachEls=require("./foreach-els");module.exports=function(e,o,r,c){c=c||document,e.forEach(function(e){forEachEls(c.querySelectorAll(e),o,r)})};
},{"./foreach-els":22}],24:[function(require,module,exports){
module.exports=function(){return window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)};
},{}],25:[function(require,module,exports){
Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var o=Array.prototype.slice.call(arguments,1),n=this,i=function(){},r=function(){return n.apply(this instanceof i&&t?this:t,o.concat(Array.prototype.slice.call(arguments)))};return i.prototype=this.prototype,r.prototype=new i,r});
},{}],26:[function(require,module,exports){
require("../polyfills/Function.prototype.bind");var on=require("../events/on"),clone=require("../clone"),attrClick="data-pjax-click-state",attrKey="data-pjax-keyup-state",linkAction=function(t,e){return e.which>1||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey?void t.setAttribute(attrClick,"modifier"):t.protocol!==window.location.protocol||t.host!==window.location.host?void t.setAttribute(attrClick,"external"):t.pathname===window.location.pathname&&t.hash.length>0?void t.setAttribute(attrClick,"anchor-present"):t.hash&&t.href.replace(t.hash,"")===window.location.href.replace(location.hash,"")?void t.setAttribute(attrClick,"anchor"):t.href===window.location.href.split("#")[0]+"#"?void t.setAttribute(attrClick,"anchor-empty"):(e.preventDefault(),this.options.currentUrlFullReload&&t.href===window.location.href.split("#")[0]?(t.setAttribute(attrClick,"reload"),void this.reload()):(t.setAttribute(attrClick,"load"),void this.loadUrl(t.href,clone(this.options))))},isDefaultPrevented=function(t){return t.defaultPrevented||t.returnValue===!1};module.exports=function(t){var e=this;on(t,"click",function(i){isDefaultPrevented(i)||linkAction.call(e,t,i)}),on(t,"keyup",function(i){if(!isDefaultPrevented(i))return i.which>1||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey?void t.setAttribute(attrKey,"modifier"):void(13==i.keyCode&&linkAction.call(e,t,i))}.bind(this))};
},{"../clone":17,"../events/on":19,"../polyfills/Function.prototype.bind":25}],27:[function(require,module,exports){
module.exports=function(e){return e.querySelectorAll(this.options.elements)};
},{}],28:[function(require,module,exports){
module.exports=function(){this.options.debug&&console&&("function"==typeof console.log?console.log.apply(console,arguments):console.log&&console.log(arguments))};
},{}],29:[function(require,module,exports){
var forEachEls=require("../foreach-els"),parseElement=require("./parse-element");module.exports=function(e){forEachEls(this.getElements(e),parseElement,this)};
},{"../foreach-els":22,"./parse-element":30}],30:[function(require,module,exports){
module.exports=function(t){switch(t.tagName.toLowerCase()){case"a":t.hasAttribute("data-pjax-click-state")||this.attachLink(t);break;case"form":throw"Pjax doesnt support <form> yet.";default:throw"Pjax can only be applied on <a> or <form> submit"}};
},{}],31:[function(require,module,exports){
module.exports=function(t){this.options=t,this.options.elements=this.options.elements||"a[href], form[action]",this.options.selectors=this.options.selectors||["title",".js-Pjax"],this.options.switches=this.options.switches||{},this.options.switchesOptions=this.options.switchesOptions||{},this.options.history=this.options.history||!0,this.options.analytics=this.options.analytics||function(){window._gaq&&_gaq.push(["_trackPageview"]),window.ga&&ga("send","pageview",{page:location.pathname,title:document.title})},this.options.scrollTo="undefined"==typeof this.options.scrollTo?0:this.options.scrollTo,this.options.cacheBust="undefined"==typeof this.options.cacheBust||this.options.cacheBust,this.options.debug=this.options.debug||!1,this.options.switches.head||(this.options.switches.head=this.switchElementsAlt),this.options.switches.body||(this.options.switches.body=this.switchElementsAlt),"function"!=typeof t.analytics&&(t.analytics=function(){})};
},{}],32:[function(require,module,exports){
module.exports=function(e){this.parseDOM(e||document)};
},{}],33:[function(require,module,exports){
module.exports=function(){window.location.reload()};
},{}],34:[function(require,module,exports){
module.exports=function(e,t){var s=new XMLHttpRequest;return s.onreadystatechange=function(){4===s.readyState&&(200===s.status?t(s.responseText,s):t(null,s))},this.options.cacheBust&&(e+=(/[?&]/.test(e)?"&":"?")+(new Date).getTime()),s.open("GET",e,!0),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.send(null),s};
},{}],35:[function(require,module,exports){
var forEachEls=require("./foreach-els"),defaultSwitches=require("./switches");module.exports=function(e,t,l,o,h,i){l.forEach(function(l){var s=o.querySelectorAll(l),r=h.querySelectorAll(l);if(this.log&&this.log("Pjax switch",l,s,r),s.length!==r.length)throw"DOM doesn’t look the same on new loaded page: ’"+l+"’ - new "+s.length+", old "+r.length;forEachEls(s,function(o,h){var s=r[h];this.log&&this.log("newEl",o,"oldEl",s),e[l]?e[l].bind(this)(s,o,i,t[l]):defaultSwitches.outerHTML.bind(this)(s,o,i)},this)},this)};
},{"./foreach-els":22,"./switches":36}],36:[function(require,module,exports){
var on=require("./events/on.js");module.exports={outerHTML:function(a,s){a.outerHTML=s.outerHTML,this.onSwitch()},innerHTML:function(a,s){a.innerHTML=s.innerHTML,a.className=s.className,this.onSwitch()},sideBySide:function(a,s,e,t){var c=Array.prototype.forEach,l=[],n=[],r=document.createDocumentFragment(),i="animationend webkitAnimationEnd MSAnimationEnd oanimationend",o=0,d=function(a){a.target==a.currentTarget&&(o--,o<=0&&l&&(l.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)}),n.forEach(function(a){a.className=a.className.replace(a.getAttribute("data-pjax-classes"),""),a.removeAttribute("data-pjax-classes")}),n=null,l=null,this.onSwitch()))}.bind(this);t=t||{},c.call(a.childNodes,function(a){l.push(a),a.classList&&!a.classList.contains("js-Pjax-remove")&&(a.hasAttribute("data-pjax-classes")&&(a.className=a.className.replace(a.getAttribute("data-pjax-classes"),""),a.removeAttribute("data-pjax-classes")),a.classList.add("js-Pjax-remove"),t.callbacks&&t.callbacks.removeElement&&t.callbacks.removeElement(a),t.classNames&&(a.className+=" "+t.classNames.remove+" "+(e.backward?t.classNames.backward:t.classNames.forward)),o++,on(a,i,d,!0))}),c.call(s.childNodes,function(a){if(a.classList){var s="";t.classNames&&(s=" js-Pjax-add "+t.classNames.add+" "+(e.backward?t.classNames.forward:t.classNames.backward)),t.callbacks&&t.callbacks.addElement&&t.callbacks.addElement(a),a.className+=s,a.setAttribute("data-pjax-classes",s),n.push(a),r.appendChild(a),o++,on(a,i,d,!0)}}),a.className=s.className,a.appendChild(r)}};
},{"./events/on.js":19}],37:[function(require,module,exports){
module.exports=function(){var e=0;return function(){var n="pjax"+(new Date).getTime()+"_"+e;return e++,n}}();
},{}]},{},[1]);
'use strict'
var extend = require('extend')
var find = require('lodash.find')
var debug = require('debug')('hapi-decorators')

@@ -11,2 +10,3 @@ var routeMethods = {

delete: 'delete',
del: 'delete',
patch: 'patch',

@@ -17,2 +17,3 @@ all: '*'

exports.controller = function controller (baseUrl) {
debug(`@controller setup`)
return function (target) {

@@ -43,3 +44,3 @@ target.prototype.baseUrl = baseUrl

hapiRoute.path = url
hapiRoute.config.bind = self
hapiRoute.options.bind = self

@@ -61,3 +62,3 @@ return hapiRoute

path: path,
config: {
options: {
id: routeId

@@ -79,7 +80,7 @@ },

function config (config) {
debug('@config setup')
function options (options) {
debug('@options or @config setup')
return function (target, key, descriptor) {
setRoute(target, key, {
config: config
options: options
})

@@ -91,3 +92,3 @@

exports.config = config
exports.options = options

@@ -98,3 +99,3 @@ function validate (config) {

setRoute(target, key, {
config: {
options: {
validate: config

@@ -114,3 +115,3 @@ }

setRoute(target, key, {
config: {
options: {
cache: cacheConfig

@@ -126,2 +127,37 @@ }

function pre (pre) {
debug('@pre setup')
return function (target, key, descriptor) {
if (typeof pre === 'string') {
pre = [{ method: target.middleware[pre] }]
} else if (!Array.isArray(pre)) {
pre = [pre]
}
setRoute(target, key, {
options: {
pre: pre
}
})
return descriptor
}
}
exports.pre = pre
function middleware () {
return function (target, key, descriptor) {
if (!target.middleware) {
target.middleware = {}
}
target.middleware[key] = descriptor.value
return descriptor
}
}
exports.middleware = middleware
function setRoute (target, key, value) {

@@ -135,7 +171,7 @@ if (!target.rawRoutes) {

var defaultRoute = {
config: {
options: {
id: routeId
}
}
var found = find(target.rawRoutes, 'config.id', routeId)
var found = target.rawRoutes.find(r => r.options.id === routeId)

@@ -142,0 +178,0 @@ if (found) {

{
"name": "hapi-decorators",
"version": "0.4.3",
"version": "1.0.0",
"description": "Decorators for HapiJS routes using ES6 classes",
"main": "index.js",
"scripts": {
"lint": "snazzy index.js",
"test": "babel-node test/*.js | tspec",
"build": "babel index.js test/*.js test/**/*.js -d dist --source-maps",
"lint": "standard | snazzy index.js test/*.js test/**/*.js",
"pretest": "npm run lint",
"test": "npm run build && node dist/test/index.js | tspec",
"posttest": "npm run lint",

@@ -13,3 +15,5 @@ "coverage": "babel-node node_modules/.bin/isparta cover test/*.js | tspec",

"postcoveralls": "rimraf ./coverage",
"deploy:docs": "docpress build && git-update-ghpages knownasilya/hapi-decorators _docpress"
"deploy:docs": "docpress build && git-update-ghpages knownasilya/hapi-decorators _docpress",
"prepublish": "in-publish && npm run deploy:docs || not-in-publish",
"release": "standard-version"
},

@@ -25,21 +29,31 @@ "author": "Ilya Radchenko <ilya@burstcreations.com> (https://github.com/knownasilya)",

"hapi",
"es7"
"controller"
],
"license": "ISC",
"dependencies": {
"debug": "^2.2.0",
"debug": "^3.1.0",
"extend": "^3.0.0",
"lodash.find": "^3.2.1"
"in-publish": "^2.0.0"
},
"devDependencies": {
"babel": "^5.8.23",
"coveralls": "^2.11.4",
"docpress": "^0.6.13",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.x",
"babel-plugin-transform-async-to-module-method": "^6.24.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"coveralls": "^3.0.x",
"docpress": "^0.7.1",
"git-update-ghpages": "^1.3.0",
"isparta": "^3.0.4",
"isparta": "^4.0.0",
"rimraf": "^2.4.3",
"snazzy": "^2.0.1",
"tap-spec": "^4.1.0",
"snazzy": "^7.1.1",
"standard": "^11.0.1",
"standard-version": "^4.4.0",
"tap-spec": "^4.1.2",
"tape": "^4.2.0"
},
"standard": {
"parser": "babel-eslint"
}
}

@@ -14,3 +14,8 @@ # hapi-decorators

```no-highlight
Prerequisits:
- Hapi 17+ (Use 0.x for Hapi 16 or earlier)
- Node 6+ (Use 0.x for Node 5 or earlier)
```sh
npm install --save hapi-decorators

@@ -50,3 +55,3 @@ ```

// Add Test Controller routes to server
server.routes(test.routes())
server.route(test.routes())

@@ -79,2 +84,3 @@ // Start the server

### `@route(method, path)`

@@ -101,2 +107,3 @@

* `@delete(path)`
* `@del(path)`
* `@all(path)`

@@ -106,5 +113,5 @@

### `@config(config)`
### `@options(options)`
Overall configuration setting if none of the other decorators are sufficient.
Overall options setting if none of the other decorators are sufficient.

@@ -120,2 +127,7 @@ ### `@validate(validateConfig)`

### `@pre(preArray)`
Set prerequisite middleware array for a given route.
Expects an array, but if passed something else, it will put it into the pre array.
[babel]: https://www.npmjs.com/package/babel

@@ -122,0 +134,0 @@ [transform-decorators-legacy]: https://www.npmjs.com/package/babel-plugin-transform-decorators-legacy

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc