-
Notifications
You must be signed in to change notification settings - Fork 1
/
arbiter.min.js
2 lines (2 loc) · 1.23 KB
/
arbiter.min.js
1
2
/*! arbiter v0.0.2 https://github.com/iamdustan/arbiter | MIT License */
(function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define(a,b):this[a]=b()})("arbiter",function(){if(!window.history||!history.pushState)return!1;var a=window.ender,b={},c={},d=function(a,b){for(var c in b)c.isOwnPropery(b)&&(a[c]=b[c]);return a},e=function(a,b){for(var c in b)a[c]||(a[c]=b[c]);return a},f=function(a){c.state?c.state.transition=a.type:c={state:{page:location.pathname,transition:undefined,reverse:undefined},title:"",url:location.pathname},history.replaceState(c.state,c.title,c.url)},g=function(a){c={state:{page:a.page,transition:a.type,reverse:a.reverse},title:"",url:a.page},history.pushState(c.state,c.title,c.url)},h=function(a,b){var c;typeof b=="function"&&(c=b),b=b||{},e(b,{type:null,reverse:null,page:a,success:c}),f(b),g(b),i(b)},i=function(b){b=e(b||{},{url:c.url,type:"html",method:"get",success:function(b){a("#slider").html(a(b).find("#slider").html())}}),a.ajax(b)};return"addEventListener"in window&&window.addEventListener("popstate",function(a){if(!a.state)return;c={state:{page:a.state.page,transition:a.state.transition,reverse:a.state.reverse},title:"",url:a.state.page},i()},!1),b.change=h,b})