Skip to content
Browse files

#34 changes code associated with sessionStorage

  • Loading branch information...
1 parent 9be1cda commit d2d92f0d9dd6b2fc349ba7470b7e6d4d54cde6a7 @devote committed Nov 20, 2013
Showing with 101 additions and 101 deletions.
  1. +1 −1 bower.json
  2. +32 −32 history.iegte8.js
  3. +15 −15 history.iegte8.min.js
  4. +32 −32 history.js
  5. +20 −20 history.min.js
  6. +1 −1 package.json
View
2 bower.json
@@ -2,7 +2,7 @@
"name": "history",
"repo": "devote/HTML5-History-API",
"description": "HTML5 History API expansion for browsers not supporting pushState, replaceState",
- "version": "4.0.8",
+ "version": "4.0.9",
"keywords": ["history", "pushState", "replaceState"],
"main": "history.js",
"scripts": ["history.js"],
View
64 history.iegte8.js
@@ -1,5 +1,5 @@
/*!
- * History API JavaScript Library v4.0.8
+ * History API JavaScript Library v4.0.9
*
* Support: IE8+, FF3+, Opera 9+, Safari, Chrome and other
*
@@ -11,7 +11,7 @@
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
- * Update: 2013-10-31 16:06
+ * Update: 2013-11-20 13:03
*/
(function(window) {
// Prevent the code from running if there is no window.history object
@@ -20,8 +20,6 @@
var document = window.document;
// HTML element
var documentElement = document.documentElement;
- // symlink to sessionStorage
- var sessionStorage = null;
// symlink to constructor of Object
var Object = window['Object'];
// symlink to JSON Object
@@ -404,33 +402,44 @@
* Initializing storage for the custom state's object
*/
function storageInitialize() {
- var storage = '';
- if (sessionStorage) {
- // get cache from the storage in browser
- storage += sessionStorage.getItem(sessionStorageKey);
- } else {
- var cookie = document.cookie.split(sessionStorageKey + "=");
- if (cookie.length > 1) {
- storage += (cookie.pop().split(";").shift() || 'null');
+ var sessionStorage;
+ /**
+ * sessionStorage throws error when cookies are disabled
+ * Chrome content settings when running the site in a Facebook IFrame.
+ * see: https://github.com/devote/HTML5-History-API/issues/34
+ * and: http://stackoverflow.com/a/12976988/669360
+ */
+ try {
+ sessionStorage = window['sessionStorage'];
+ sessionStorage.setItem(sessionStorageKey + 't', '1');
+ sessionStorage.removeItem(sessionStorageKey + 't');
+ } catch(_e_) {
+ sessionStorage = {
+ getItem: function(key) {
+ var cookie = document.cookie.split(key + "=");
+ return cookie.length > 1 && cookie.pop().split(";").shift() || 'null';
+ },
+ setItem: function(key, value) {
+ var state = {};
+ // insert one current element to cookie
+ if (state[windowLocation.href] = historyObject.state) {
+ document.cookie = key + '=' + JSON.stringify(state);
+ }
+ }
}
}
+
try {
- stateStorage = JSON.parse(storage) || {};
+ // get cache from the storage in browser
+ stateStorage = JSON.parse(sessionStorage.getItem(sessionStorageKey)) || {};
} catch(_e_) {
stateStorage = {};
}
+
// hang up the event handler to event unload page
addEvent(eventNamePrefix + 'unload', function() {
- if (sessionStorage) {
- // save current state's object
- sessionStorage.setItem(sessionStorageKey, JSON.stringify(stateStorage));
- } else {
- // save the current 'state' in the cookie
- var state = {};
- if (state[windowLocation.href] = historyObject.state) {
- document.cookie = sessionStorageKey + '=' + JSON.stringify(state);
- }
- }
+ // save current state's object
+ sessionStorage.setItem(sessionStorageKey, JSON.stringify(stateStorage));
}, false);
}
@@ -850,15 +859,6 @@
});
/**
- * sessionStorage throws error when cookies are disabled
- * Chrome content settings when running the site in a Facebook IFrame.
- * see: https://github.com/devote/HTML5-History-API/issues/34
- */
- try {
- sessionStorage = window['sessionStorage'];
- } catch(_e_) {}
-
- /**
* hang up the event handler to listen to the events hashchange
*/
addEvent(eventNamePrefix + 'hashchange', onHashChange, false);
View
30 history.iegte8.min.js
@@ -1,5 +1,5 @@
/*!
- * History API JavaScript Library v4.0.8
+ * History API JavaScript Library v4.0.9
*
* Support: IE8+, FF3+, Opera 9+, Safari, Chrome and other
*
@@ -11,18 +11,18 @@
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
- * Update: 2013-10-31 16:06
+ * Update: 2013-11-20 13:03
*/
-(function(f){var h=!0,j=null,n=!1;function E(){}function k(a,b,c){if(a!=j&&""!==a&&!b)var b=k(),c=b.d,d=b.h,a=""+a,a=/^(?:[\w0-9]+\:)?\/\//.test(a)?0===a.indexOf("/")?d+a:a:d+"//"+b.g+(0===a.indexOf("/")?a:0===a.indexOf("?")?c+a:0===a.indexOf("#")?c+b.e+a:c.replace(/[^\/]+$/g,"")+a);else if(a=b?a:e.href,!p||c)a=a.replace(/^[^#]*/,"")||"#",a=e.protocol+"//"+e.host+l.basepath+a.replace(RegExp("^#[/]?(?:"+l.type+")?"),"");J.href=a;var a=/(?:([\w0-9]+:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/.exec(J.href),b=
-a[2]+(a[3]?":"+a[3]:""),c=a[4]||"/",d=a[5]||"",f="#"===a[6]?"":a[6]||"",g=c+d+f,i=c.replace(RegExp("^"+l.basepath,"i"),l.type)+d;return{b:a[1]+"//"+b+g,h:a[1],g:b,i:a[2],k:a[3]||"",d:c,e:d,a:f,c:g,j:i,f:i+f}}function X(){var a="";if(u)a+=u.getItem(y);else{var b=g.cookie.split(y+"=");1<b.length&&(a+=b.pop().split(";").shift()||"null")}try{m=z.parse(a)||{}}catch(c){m={}}o(r+"unload",function(){if(u)u.setItem(y,z.stringify(m));else{var a={};if(a[e.href]=i.state)g.cookie=y+"="+z.stringify(a)}},n)}function A(a,
-b,c,d){var c=c||{set:E},e=!c.set,g=!c.get,i={configurable:h,set:function(){e=1},get:function(){g=1}};try{v(a,b,i),a[b]=a[b],v(a,b,c)}catch(k){}if(!e||!g)if(a.__defineGetter__&&(a.__defineGetter__(b,i.get),a.__defineSetter__(b,i.set),a[b]=a[b],c.get&&a.__defineGetter__(b,c.get),c.set&&a.__defineSetter__(b,c.set)),(!e||!g)&&a===f){try{var l=a[b];a[b]=j}catch(p){}if("execScript"in f)f.execScript("Public "+b,"VBScript");else try{v(a,b,{value:E})}catch(q){}a[b]=l}else if(!e||!g)try{try{var m=F.create(a);
-v(F.getPrototypeOf(m)===a?m:a,b,c);for(var o in a)"function"===typeof a[o]&&(m[o]=a[o].bind(a));try{d.call(m,m,a)}catch(r){}a=m}catch(s){v(a.constructor.prototype,b,c)}}catch(t){return n}return a}function Y(a,b,c){c=c||{};a=a===K?e:a;c.set=c.set||function(c){a[b]=c};c.get=c.get||function(){return a[b]};return c}function B(a,b){var c=(""+("string"===typeof a?a:a.type)).replace(/^on/,""),d=s[c];if(d){b="string"===typeof a?b:a;if(b.target==j)for(var e=["target","currentTarget","srcElement","type"];a=
-e.pop();)b=A(b,a,{get:"type"===a?function(){return c}:function(){return f}});(("popstate"===c?f.onpopstate:f.onhashchange)||E).call(f,b);for(var e=0,g=d.length;e<g;e++)d[e].call(f,b);return h}return Z(a,b)}function L(){var a=g.createEvent?g.createEvent("Event"):g.createEventObject();a.initEvent?a.initEvent("popstate",n,n):a.type="popstate";a.state=i.state;B(a)}function w(a,b,c,d){p||(b=k(b),b.c!==k().c&&(x=d,c?e.replace("#"+b.f):e.hash=b.f));!C&&a&&(m[e.href]=a);D=n}function M(a){if(x){N!==e.href&&
-L();var a=a||f.event,b=k(x,h),c=k();a.oldURL||(a.oldURL=b.b,a.newURL=c.b);b.a!==c.a&&B(a)}x=e.href}function O(a){setTimeout(function(){o("popstate",function(a){N=e.href;C||(a=A(a,"state",{get:function(){return i.state}}));B(a)},n)},0);!p&&a!==h&&i.location&&(P(i.location.hash),D&&(D=n,L()))}function $(a){var a=a||f.event,b;a:{for(b=a.target||a.srcElement;b;){if("A"===b.nodeName)break a;b=b.parentNode}b=void 0}var c="defaultPrevented"in a?a.defaultPrevented:a.returnValue===n;b&&"A"===b.nodeName&&!c&&
-(c=k(),b=k(b.getAttribute("href",2)),c.b.split("#").shift()===b.b.split("#").shift()&&b.a&&(c.a!==b.a&&(i.location.hash=b.a),P(b.a),a.preventDefault?a.preventDefault():a.returnValue=n))}function P(a){var b=g.getElementById(a=(a||"").replace(/^#/,""));b&&b.id===a&&"A"===b.nodeName&&(a=b.getBoundingClientRect(),f.scrollTo(G.scrollLeft||0,a.top+(G.scrollTop||0)-(G.clientTop||0)))}if(f.history){var g=f.document,G=g.documentElement,u=j,F=f.Object,z=f.JSON,e=f.location,q=f.history,i=q,H=q.pushState,Q=q.replaceState,
-p=!!H,C="state"in q,v=F.defineProperty,R=A({},"t")?{}:g.createElement("a"),r="",I=f.addEventListener?"addEventListener":(r="on")&&"attachEvent",S=f.removeEventListener?"removeEventListener":"detachEvent",T=f.dispatchEvent?"dispatchEvent":"fireEvent",o=f[I],U=f[S],Z=f[T],l={basepath:"/",redirect:0,type:"/"},y="__historyAPI__",J=g.createElement("a"),x=e.href,N="",D=n,m={},s={},t=g.title,aa={onhashchange:j,onpopstate:j},V=function(a,b){var c=f.history!==q;c&&(f.history=q);a.apply(q,b);c&&(f.history=
-i)},W={redirect:function(a,b){l.basepath=b=b==j?l.basepath:b;l.type=a=a==j?l.type:a;if(f.top==f.self){var c=k(j,n,h).c,d=e.pathname+e.search;p?(d=d.replace(/([^\/])$/,"$1/"),c!=b&&RegExp("^"+b+"$","i").test(d)&&e.replace(c)):d!=b&&(d=d.replace(/([^\/])\?/,"$1/?"),RegExp("^"+b,"i").test(d)&&e.replace(b+"#"+d.replace(RegExp("^"+b,"i"),a)+e.hash))}},pushState:function(a,b,c){var d=g.title;t!=j&&(g.title=t);H&&V(H,arguments);w(a,c);g.title=d;t=b},replaceState:function(a,b,c){var d=g.title;t!=j&&(g.title=
-t);delete m[e.href];Q&&V(Q,arguments);w(a,c,h);g.title=d;t=b},location:{set:function(a){f.location=a},get:function(){return p?e:R}},state:{get:function(){return m[e.href]||j}}},K={assign:function(a){0===(""+a).indexOf("#")?w(j,a):e.assign(a)},reload:function(){e.reload()},replace:function(a){0===(""+a).indexOf("#")?w(j,a,h):e.replace(a)},toString:function(){return this.href},href:{get:function(){return k().b}},protocol:j,host:j,hostname:j,port:j,pathname:{get:function(){return k().d}},search:{get:function(){return k().e}},
-hash:{set:function(a){w(j,(""+a).replace(/^(#|)/,"#"),n,x)},get:function(){return k().a}}};(function(){var a=g.getElementsByTagName("script"),a=(a[a.length-1]||{}).src||"";(-1!==a.indexOf("?")?a.split("?").pop():"").replace(/(\w+)(?:=([^&]*))?/g,function(a,b,c){l[b]=(c||("basepath"===b?"/":"")).replace(/^(0|false)$/,"")});try{u=f.sessionStorage}catch(b){}o(r+"hashchange",M,n);var c=[K,R,aa,f,W,i];C&&delete W.state;for(var d=0;d<c.length;d+=2)for(var e in c[d])if(c[d].hasOwnProperty(e))if("function"===
-typeof c[d][e])c[d+1][e]=c[d][e];else{a=Y(c[d],e,c[d][e]);if(!A(c[d+1],e,a,function(a,b){if(b===i)f.history=i=c[d+1]=a}))return U(r+"hashchange",M,n),n;c[d+1]===f&&(s[e]=s[e.substr(2)]=[])}l.redirect&&i.redirect();!C&&z&&X();if(!p)g[I](r+"click",$,n);"complete"===g.readyState?O(h):(!p&&k().c!==l.basepath&&(D=h),o(r+"load",O,n));return h})()&&(i.emulate=!p,f[I]=function(a,b,c){a in s?s[a].push(b):3<arguments.length?o(a,b,c,arguments[3]):o(a,b,c)},f[S]=function(a,b,c){var d=s[a];if(d)for(a=d.length;--a;){if(d[a]===
-b){d.splice(a,1);break}}else U(a,b,c)},f[T]=B)}})(window);
+(function(e){var i=!0,j=null,n=!1;function D(){}function k(a,b,c){if(a!=j&&""!==a&&!b)var b=k(),c=b.d,d=b.h,a=""+a,a=/^(?:[\w0-9]+\:)?\/\//.test(a)?0===a.indexOf("/")?d+a:a:d+"//"+b.g+(0===a.indexOf("/")?a:0===a.indexOf("?")?c+a:0===a.indexOf("#")?c+b.e+a:c.replace(/[^\/]+$/g,"")+a);else if(a=b?a:f.href,!p||c)a=a.replace(/^[^#]*/,"")||"#",a=f.protocol+"//"+f.host+l.basepath+a.replace(RegExp("^#[/]?(?:"+l.type+")?"),"");I.href=a;var a=/(?:([\w0-9]+:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/.exec(I.href),b=
+a[2]+(a[3]?":"+a[3]:""),c=a[4]||"/",d=a[5]||"",e="#"===a[6]?"":a[6]||"",g=c+d+e,h=c.replace(RegExp("^"+l.basepath,"i"),l.type)+d;return{b:a[1]+"//"+b+g,h:a[1],g:b,i:a[2],k:a[3]||"",d:c,e:d,a:e,c:g,j:h,f:h+e}}function W(){var a;try{a=e.sessionStorage,a.setItem(x+"t","1"),a.removeItem(x+"t")}catch(b){a={getItem:function(a){a=g.cookie.split(a+"=");return 1<a.length&&a.pop().split(";").shift()||"null"},setItem:function(a){var b={};if(b[f.href]=h.state)g.cookie=a+"="+y.stringify(b)}}}try{m=y.parse(a.getItem(x))||
+{}}catch(c){m={}}o(r+"unload",function(){a.setItem(x,y.stringify(m))},n)}function z(a,b,c,d){var c=c||{set:D},f=!c.set,g=!c.get,h={configurable:i,set:function(){f=1},get:function(){g=1}};try{u(a,b,h),a[b]=a[b],u(a,b,c)}catch(k){}if(!f||!g)if(a.__defineGetter__&&(a.__defineGetter__(b,h.get),a.__defineSetter__(b,h.set),a[b]=a[b],c.get&&a.__defineGetter__(b,c.get),c.set&&a.__defineSetter__(b,c.set)),(!f||!g)&&a===e){try{var l=a[b];a[b]=j}catch(p){}if("execScript"in e)e.execScript("Public "+b,"VBScript");
+else try{u(a,b,{value:D})}catch(q){}a[b]=l}else if(!f||!g)try{try{var m=E.create(a);u(E.getPrototypeOf(m)===a?m:a,b,c);for(var o in a)"function"===typeof a[o]&&(m[o]=a[o].bind(a));try{d.call(m,m,a)}catch(r){}a=m}catch(s){u(a.constructor.prototype,b,c)}}catch(t){return n}return a}function X(a,b,c){c=c||{};a=a===J?f:a;c.set=c.set||function(c){a[b]=c};c.get=c.get||function(){return a[b]};return c}function A(a,b){var c=(""+("string"===typeof a?a:a.type)).replace(/^on/,""),d=s[c];if(d){b="string"===typeof a?
+b:a;if(b.target==j)for(var f=["target","currentTarget","srcElement","type"];a=f.pop();)b=z(b,a,{get:"type"===a?function(){return c}:function(){return e}});(("popstate"===c?e.onpopstate:e.onhashchange)||D).call(e,b);for(var f=0,g=d.length;f<g;f++)d[f].call(e,b);return i}return Y(a,b)}function K(){var a=g.createEvent?g.createEvent("Event"):g.createEventObject();a.initEvent?a.initEvent("popstate",n,n):a.type="popstate";a.state=h.state;A(a)}function v(a,b,c,d){p||(b=k(b),b.c!==k().c&&(w=d,c?f.replace("#"+
+b.f):f.hash=b.f));!B&&a&&(m[f.href]=a);C=n}function L(a){if(w){M!==f.href&&K();var a=a||e.event,b=k(w,i),c=k();a.oldURL||(a.oldURL=b.b,a.newURL=c.b);b.a!==c.a&&A(a)}w=f.href}function N(a){setTimeout(function(){o("popstate",function(a){M=f.href;B||(a=z(a,"state",{get:function(){return h.state}}));A(a)},n)},0);!p&&a!==i&&h.location&&(O(h.location.hash),C&&(C=n,K()))}function Z(a){var a=a||e.event,b;a:{for(b=a.target||a.srcElement;b;){if("A"===b.nodeName)break a;b=b.parentNode}b=void 0}var c="defaultPrevented"in
+a?a.defaultPrevented:a.returnValue===n;b&&"A"===b.nodeName&&!c&&(c=k(),b=k(b.getAttribute("href",2)),c.b.split("#").shift()===b.b.split("#").shift()&&b.a&&(c.a!==b.a&&(h.location.hash=b.a),O(b.a),a.preventDefault?a.preventDefault():a.returnValue=n))}function O(a){var b=g.getElementById(a=(a||"").replace(/^#/,""));b&&b.id===a&&"A"===b.nodeName&&(a=b.getBoundingClientRect(),e.scrollTo(F.scrollLeft||0,a.top+(F.scrollTop||0)-(F.clientTop||0)))}if(e.history){var g=e.document,F=g.documentElement,E=e.Object,
+y=e.JSON,f=e.location,q=e.history,h=q,G=q.pushState,P=q.replaceState,p=!!G,B="state"in q,u=E.defineProperty,Q=z({},"t")?{}:g.createElement("a"),r="",H=e.addEventListener?"addEventListener":(r="on")&&"attachEvent",R=e.removeEventListener?"removeEventListener":"detachEvent",S=e.dispatchEvent?"dispatchEvent":"fireEvent",o=e[H],T=e[R],Y=e[S],l={basepath:"/",redirect:0,type:"/"},x="__historyAPI__",I=g.createElement("a"),w=f.href,M="",C=n,m={},s={},t=g.title,$={onhashchange:j,onpopstate:j},U=function(a,
+b){var c=e.history!==q;c&&(e.history=q);a.apply(q,b);c&&(e.history=h)},V={redirect:function(a,b){l.basepath=b=b==j?l.basepath:b;l.type=a=a==j?l.type:a;if(e.top==e.self){var c=k(j,n,i).c,d=f.pathname+f.search;p?(d=d.replace(/([^\/])$/,"$1/"),c!=b&&RegExp("^"+b+"$","i").test(d)&&f.replace(c)):d!=b&&(d=d.replace(/([^\/])\?/,"$1/?"),RegExp("^"+b,"i").test(d)&&f.replace(b+"#"+d.replace(RegExp("^"+b,"i"),a)+f.hash))}},pushState:function(a,b,c){var d=g.title;t!=j&&(g.title=t);G&&U(G,arguments);v(a,c);g.title=
+d;t=b},replaceState:function(a,b,c){var d=g.title;t!=j&&(g.title=t);delete m[f.href];P&&U(P,arguments);v(a,c,i);g.title=d;t=b},location:{set:function(a){e.location=a},get:function(){return p?f:Q}},state:{get:function(){return m[f.href]||j}}},J={assign:function(a){0===(""+a).indexOf("#")?v(j,a):f.assign(a)},reload:function(){f.reload()},replace:function(a){0===(""+a).indexOf("#")?v(j,a,i):f.replace(a)},toString:function(){return this.href},href:{get:function(){return k().b}},protocol:j,host:j,hostname:j,
+port:j,pathname:{get:function(){return k().d}},search:{get:function(){return k().e}},hash:{set:function(a){v(j,(""+a).replace(/^(#|)/,"#"),n,w)},get:function(){return k().a}}};(function(){var a=g.getElementsByTagName("script"),a=(a[a.length-1]||{}).src||"";(-1!==a.indexOf("?")?a.split("?").pop():"").replace(/(\w+)(?:=([^&]*))?/g,function(a,b,c){l[b]=(c||("basepath"===b?"/":"")).replace(/^(0|false)$/,"")});o(r+"hashchange",L,n);var b=[J,Q,$,e,V,h];B&&delete V.state;for(var c=0;c<b.length;c+=2)for(var d in b[c])if(b[c].hasOwnProperty(d))if("function"===
+typeof b[c][d])b[c+1][d]=b[c][d];else{a=X(b[c],d,b[c][d]);if(!z(b[c+1],d,a,function(a,d){if(d===h)e.history=h=b[c+1]=a}))return T(r+"hashchange",L,n),n;b[c+1]===e&&(s[d]=s[d.substr(2)]=[])}l.redirect&&h.redirect();!B&&y&&W();if(!p)g[H](r+"click",Z,n);"complete"===g.readyState?N(i):(!p&&k().c!==l.basepath&&(C=i),o(r+"load",N,n));return i})()&&(h.emulate=!p,e[H]=function(a,b,c){a in s?s[a].push(b):3<arguments.length?o(a,b,c,arguments[3]):o(a,b,c)},e[R]=function(a,b,c){var d=s[a];if(d)for(a=d.length;--a;){if(d[a]===
+b){d.splice(a,1);break}}else T(a,b,c)},e[S]=A)}})(window);
View
64 history.js
@@ -1,5 +1,5 @@
/*!
- * History API JavaScript Library v4.0.8
+ * History API JavaScript Library v4.0.9
*
* Support: IE6+, FF3+, Opera 9+, Safari, Chrome and other
*
@@ -11,7 +11,7 @@
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
- * Update: 2013-10-31 16:06
+ * Update: 2013-11-20 13:03
*/
(function(window) {
// Prevent the code from running if there is no window.history object
@@ -20,8 +20,6 @@
var document = window.document;
// HTML element
var documentElement = document.documentElement;
- // symlink to sessionStorage
- var sessionStorage = null;
// symlink to constructor of Object
var Object = window['Object'];
// symlink to JSON Object
@@ -404,33 +402,44 @@
* Initializing storage for the custom state's object
*/
function storageInitialize() {
- var storage = '';
- if (sessionStorage) {
- // get cache from the storage in browser
- storage += sessionStorage.getItem(sessionStorageKey);
- } else {
- var cookie = document.cookie.split(sessionStorageKey + "=");
- if (cookie.length > 1) {
- storage += (cookie.pop().split(";").shift() || 'null');
+ var sessionStorage;
+ /**
+ * sessionStorage throws error when cookies are disabled
+ * Chrome content settings when running the site in a Facebook IFrame.
+ * see: https://github.com/devote/HTML5-History-API/issues/34
+ * and: http://stackoverflow.com/a/12976988/669360
+ */
+ try {
+ sessionStorage = window['sessionStorage'];
+ sessionStorage.setItem(sessionStorageKey + 't', '1');
+ sessionStorage.removeItem(sessionStorageKey + 't');
+ } catch(_e_) {
+ sessionStorage = {
+ getItem: function(key) {
+ var cookie = document.cookie.split(key + "=");
+ return cookie.length > 1 && cookie.pop().split(";").shift() || 'null';
+ },
+ setItem: function(key, value) {
+ var state = {};
+ // insert one current element to cookie
+ if (state[windowLocation.href] = historyObject.state) {
+ document.cookie = key + '=' + JSON.stringify(state);
+ }
+ }
}
}
+
try {
- stateStorage = JSON.parse(storage) || {};
+ // get cache from the storage in browser
+ stateStorage = JSON.parse(sessionStorage.getItem(sessionStorageKey)) || {};
} catch(_e_) {
stateStorage = {};
}
+
// hang up the event handler to event unload page
addEvent(eventNamePrefix + 'unload', function() {
- if (sessionStorage) {
- // save current state's object
- sessionStorage.setItem(sessionStorageKey, JSON.stringify(stateStorage));
- } else {
- // save the current 'state' in the cookie
- var state = {};
- if (state[windowLocation.href] = historyObject.state) {
- document.cookie = sessionStorageKey + '=' + JSON.stringify(state);
- }
- }
+ // save current state's object
+ sessionStorage.setItem(sessionStorageKey, JSON.stringify(stateStorage));
}, false);
}
@@ -850,15 +859,6 @@
});
/**
- * sessionStorage throws error when cookies are disabled
- * Chrome content settings when running the site in a Facebook IFrame.
- * see: https://github.com/devote/HTML5-History-API/issues/34
- */
- try {
- sessionStorage = window['sessionStorage'];
- } catch(_e_) {}
-
- /**
* Includes support for IE6+
*/
ie6DriverStart();
View
40 history.min.js
@@ -1,5 +1,5 @@
/*!
- * History API JavaScript Library v4.0.8
+ * History API JavaScript Library v4.0.9
*
* Support: IE6+, FF3+, Opera 9+, Safari, Chrome and other
*
@@ -11,23 +11,23 @@
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
- * Update: 2013-10-31 16:06
+ * Update: 2013-11-20 13:03
*/
-(function(f){var i=!0,k=null,n=!1;function K(){}function l(a,b,c){if(a!=k&&""!==a&&!b)var b=l(),c=b.e,e=b.h,a=""+a,a=/^(?:[\w0-9]+\:)?\/\//.test(a)?0===a.indexOf("/")?e+a:a:e+"//"+b.g+(0===a.indexOf("/")?a:0===a.indexOf("?")?c+a:0===a.indexOf("#")?c+b.f+a:c.replace(/[^\/]+$/g,"")+a);else if(a=b?a:d.href,!o||c)a=a.replace(/^[^#]*/,"")||"#",a=d.protocol+"//"+d.host+j.basepath+a.replace(RegExp("^#[/]?(?:"+j.type+")?"),"");P.href=a;var a=/(?:([\w0-9]+:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/.exec(P.href),b=
-a[2]+(a[3]?":"+a[3]:""),c=a[4]||"/",e=a[5]||"",f="#"===a[6]?"":a[6]||"",g=c+e+f,t=c.replace(RegExp("^"+j.basepath,"i"),j.type)+e;return{a:a[1]+"//"+b+g,h:a[1],g:b,i:a[2],k:a[3]||"",e:c,f:e,b:f,c:g,j:t,d:t+f}}function $(){var a="";if(C)a+=C.getItem(F);else{var b=g.cookie.split(F+"=");1<b.length&&(a+=b.pop().split(";").shift()||"null")}try{p=q.parse(a)||{}}catch(c){p={}}u(v+"unload",function(){if(C)C.setItem(F,q.stringify(p));else{var a={};if(a[d.href]=h.state)g.cookie=F+"="+q.stringify(a)}},n)}function w(a,
-b,c,e){var c=c||{set:K},d=!c.set,g=!c.get,t={configurable:i,set:function(){d=1},get:function(){g=1}};try{D(a,b,t),a[b]=a[b],D(a,b,c)}catch(ga){}if(!d||!g)if(a.__defineGetter__&&(a.__defineGetter__(b,t.get),a.__defineSetter__(b,t.set),a[b]=a[b],c.get&&a.__defineGetter__(b,c.get),c.set&&a.__defineSetter__(b,c.set)),(!d||!g)&&a===f){try{var aa=a[b];a[b]=k}catch(ha){}if("execScript"in f)f.execScript("Public "+b,"VBScript");else try{D(a,b,{value:K})}catch(l){}a[b]=aa}else if(!d||!g)try{try{var x=G.create(a);
-D(G.getPrototypeOf(x)===a?x:a,b,c);for(var h in a)"function"===typeof a[h]&&(x[h]=a[h].bind(a));try{e.call(x,x,a)}catch(j){}a=x}catch(m){D(a.constructor.prototype,b,c)}}catch(o){return n}return a}function ba(a,b,c){c=c||{};a=a===L?d:a;c.set=c.set||function(c){a[b]=c};c.get=c.get||function(){return a[b]};return c}function H(a,b){var c=(""+("string"===typeof a?a:a.type)).replace(/^on/,""),e=y[c];if(e){b="string"===typeof a?b:a;if(b.target==k)for(var d=["target","currentTarget","srcElement","type"];a=
-d.pop();)b=w(b,a,{get:"type"===a?function(){return c}:function(){return f}});(("popstate"===c?f.onpopstate:f.onhashchange)||K).call(f,b);for(var d=0,g=e.length;d<g;d++)e[d].call(f,b);return i}return ca(a,b)}function Q(){var a=g.createEvent?g.createEvent("Event"):g.createEventObject();a.initEvent?a.initEvent("popstate",n,n):a.type="popstate";a.state=h.state;H(a)}function r(a,b,c,e){o||(b=l(b),b.c!==l().c&&(z=e,c?d.replace("#"+b.d):d.hash=b.d));!I&&a&&(p[d.href]=a);E=n}function M(a){if(z){R!==d.href&&
-Q();var a=a||f.event,b=l(z,i),c=l();a.oldURL||(a.oldURL=b.a,a.newURL=c.a);b.b!==c.b&&H(a)}z=d.href}function S(a){setTimeout(function(){u("popstate",function(a){R=d.href;I||(a=w(a,"state",{get:function(){return h.state}}));H(a)},n)},0);!o&&a!==i&&h.location&&(T(h.location.hash),E&&(E=n,Q()))}function da(a){var a=a||f.event,b;a:{for(b=a.target||a.srcElement;b;){if("A"===b.nodeName)break a;b=b.parentNode}b=void 0}var c="defaultPrevented"in a?a.defaultPrevented:a.returnValue===n;b&&"A"===b.nodeName&&
-!c&&(c=l(),b=l(b.getAttribute("href",2)),c.a.split("#").shift()===b.a.split("#").shift()&&b.b&&(c.b!==b.b&&(h.location.hash=b.b),T(b.b),a.preventDefault?a.preventDefault():a.returnValue=n))}function T(a){var b=g.getElementById(a=(a||"").replace(/^#/,""));b&&b.id===a&&"A"===b.nodeName&&(a=b.getBoundingClientRect(),f.scrollTo(J.scrollLeft||0,a.top+(J.scrollTop||0)-(J.clientTop||0)))}function ea(){function a(a){var b=[],e="VBHistoryClass"+(new Date).getTime()+c++,d=["Class "+e],g;for(g in a)if(a.hasOwnProperty(g)){var h=
-a[g];h&&(h.get||h.set)?(h.get&&d.push("Public "+("_"===g?"Default ":"")+"Property Get ["+g+"]","Call VBCVal([(accessors)].["+g+"].get.call(me),["+g+"])","End Property"),h.set&&d.push("Public Property Let ["+g+"](val)",h="Call [(accessors)].["+g+"].set.call(me,val)\nEnd Property","Public Property Set ["+g+"](val)",h)):(b.push(g),d.push("Public ["+g+"]"))}d.push("Private [(accessors)]","Private Sub Class_Initialize()","Set [(accessors)]="+e+"FactoryJS()","End Sub","End Class","Function "+e+"Factory()",
-"Set "+e+"Factory=New "+e,"End Function");f.execScript(d.join("\n"),"VBScript");f[e+"FactoryJS"]=function(){return a};e=f[e+"Factory"]();for(d=0;d<b.length;d++)e[b[d]]=a[b[d]];return e}function b(a){var b=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,c={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return b.test(a)?'"'+a.replace(b,function(a){return a in c?c[a]:"\\u"+("0000"+
-a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}var c=f.eval&&eval("/*@cc_on 1;@*/");if(c&&!(7<+(/msie (\d+)/i.exec(navigator.userAgent)||[,8])[1])){var e=w,B=l().a,j=g.createElement("iframe");j.src="javascript:true;";j=J.firstChild.appendChild(j).contentWindow;f.execScript("Public history\nFunction VBCVal(o,r) If IsObject(o) Then Set r=o Else r=o End If End Function","VBScript");s={_:{get:L.toString}};h={back:m.back,forward:m.forward,go:m.go,emulate:k,_:{get:function(){return"[object History]"}}};
-q={parse:function(a){try{return(new Function("","return "+a))()}catch(b){return k}},stringify:function(a){var c=(typeof a).charCodeAt(2);if(114===c)a=b(a);else if(109===c)a=isFinite(a)?""+a:"null";else if(111===c||108===c)a=""+a;else if(106===c)if(a){var e=(c="[object Array]"===G.prototype.toString.call(a))?"[":"{";if(c)for(var d=0;d<a.length;d++)e+=(0==d?"":",")+q.stringify(a[d]);else for(d in a)a.hasOwnProperty(d)&&(e+=(1==e.length?"":",")+b(d)+":"+q.stringify(a[d]));a=e+(c?"]":"}")}else a="null";
-else a="void 0";return a}};r=function(a,b,c,e,f){var g=j.document,b=l(b);E=n;if(b.c===l().c&&!f)a&&(p[d.href]=a);else{z=e;if(c)j.lfirst?(history.back(),r(a,b.a,0,e,1)):d.replace("#"+b.d);else if(b.a!=B||f)j.lfirst||(j.lfirst=1,r(a,B,0,e,1)),g.open(),g.write('<script>lfirst=1;parent.location.hash="'+b.d.replace(/"/g,'\\"')+'";<\/script>'),g.close();!f&&a&&(p[d.href]=a)}};w=function(b,c,d,g){e.apply(this,arguments)||(b===s?s[c]=d:b===h?(h[c]=d,"state"===c&&(s=a(s),f.history=h=a(h))):b[c]=d.get&&d.get());
-return b};setInterval(function(){var a=l().a;if(a!=B){var b=g.createEventObject();b.oldURL=B;b.newURL=B=a;b.type="hashchange";M(b)}},100);f.JSON=q}}if(f.history){var g=f.document,J=g.documentElement,C=k,G=f.Object,q=f.JSON,d=f.location,m=f.history,h=m,N=m.pushState,U=m.replaceState,o=!!N,I="state"in m,D=G.defineProperty,s=w({},"t")?{}:g.createElement("a"),v="",O=f.addEventListener?"addEventListener":(v="on")&&"attachEvent",V=f.removeEventListener?"removeEventListener":"detachEvent",W=f.dispatchEvent?
-"dispatchEvent":"fireEvent",u=f[O],X=f[V],ca=f[W],j={basepath:"/",redirect:0,type:"/"},F="__historyAPI__",P=g.createElement("a"),z=d.href,R="",E=n,p={},y={},A=g.title,fa={onhashchange:k,onpopstate:k},Y=function(a,b){var c=f.history!==m;c&&(f.history=m);a.apply(m,b);c&&(f.history=h)},Z={redirect:function(a,b){j.basepath=b=b==k?j.basepath:b;j.type=a=a==k?j.type:a;if(f.top==f.self){var c=l(k,n,i).c,e=d.pathname+d.search;o?(e=e.replace(/([^\/])$/,"$1/"),c!=b&&RegExp("^"+b+"$","i").test(e)&&d.replace(c)):
-e!=b&&(e=e.replace(/([^\/])\?/,"$1/?"),RegExp("^"+b,"i").test(e)&&d.replace(b+"#"+e.replace(RegExp("^"+b,"i"),a)+d.hash))}},pushState:function(a,b,c){var e=g.title;A!=k&&(g.title=A);N&&Y(N,arguments);r(a,c);g.title=e;A=b},replaceState:function(a,b,c){var e=g.title;A!=k&&(g.title=A);delete p[d.href];U&&Y(U,arguments);r(a,c,i);g.title=e;A=b},location:{set:function(a){f.location=a},get:function(){return o?d:s}},state:{get:function(){return p[d.href]||k}}},L={assign:function(a){0===(""+a).indexOf("#")?
-r(k,a):d.assign(a)},reload:function(){d.reload()},replace:function(a){0===(""+a).indexOf("#")?r(k,a,i):d.replace(a)},toString:function(){return this.href},href:{get:function(){return l().a}},protocol:k,host:k,hostname:k,port:k,pathname:{get:function(){return l().e}},search:{get:function(){return l().f}},hash:{set:function(a){r(k,(""+a).replace(/^(#|)/,"#"),n,z)},get:function(){return l().b}}};(function(){var a=g.getElementsByTagName("script"),a=(a[a.length-1]||{}).src||"";(-1!==a.indexOf("?")?a.split("?").pop():
-"").replace(/(\w+)(?:=([^&]*))?/g,function(a,b,c){j[b]=(c||("basepath"===b?"/":"")).replace(/^(0|false)$/,"")});try{C=f.sessionStorage}catch(b){}ea();u(v+"hashchange",M,n);var c=[L,s,fa,f,Z,h];I&&delete Z.state;for(var e=0;e<c.length;e+=2)for(var d in c[e])if(c[e].hasOwnProperty(d))if("function"===typeof c[e][d])c[e+1][d]=c[e][d];else{a=ba(c[e],d,c[e][d]);if(!w(c[e+1],d,a,function(a,b){if(b===h)f.history=h=c[e+1]=a}))return X(v+"hashchange",M,n),n;c[e+1]===f&&(y[d]=y[d.substr(2)]=[])}j.redirect&&
-h.redirect();!I&&q&&$();if(!o)g[O](v+"click",da,n);"complete"===g.readyState?S(i):(!o&&l().c!==j.basepath&&(E=i),u(v+"load",S,n));return i})()&&(h.emulate=!o,f[O]=function(a,b,c){a in y?y[a].push(b):3<arguments.length?u(a,b,c,arguments[3]):u(a,b,c)},f[V]=function(a,b,c){var d=y[a];if(d)for(a=d.length;--a;){if(d[a]===b){d.splice(a,1);break}}else X(a,b,c)},f[W]=H)}})(window);
+(function(e){var i=!0,j=null,o=!1;function J(){}function h(a,b,c){if(a!=j&&""!==a&&!b)var b=h(),c=b.e,d=b.h,a=""+a,a=/^(?:[\w0-9]+\:)?\/\//.test(a)?0===a.indexOf("/")?d+a:a:d+"//"+b.g+(0===a.indexOf("/")?a:0===a.indexOf("?")?c+a:0===a.indexOf("#")?c+b.f+a:c.replace(/[^\/]+$/g,"")+a);else if(a=b?a:f.href,!p||c)a=a.replace(/^[^#]*/,"")||"#",a=f.protocol+"//"+f.host+k.basepath+a.replace(RegExp("^#[/]?(?:"+k.type+")?"),"");O.href=a;var a=/(?:([\w0-9]+:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/.exec(O.href),b=
+a[2]+(a[3]?":"+a[3]:""),c=a[4]||"/",d=a[5]||"",e="#"===a[6]?"":a[6]||"",m=c+d+e,u=c.replace(RegExp("^"+k.basepath,"i"),k.type)+d;return{a:a[1]+"//"+b+m,h:a[1],g:b,i:a[2],k:a[3]||"",e:c,f:d,b:e,c:m,j:u,d:u+e}}function Z(){var a;try{a=e.sessionStorage,a.setItem(E+"t","1"),a.removeItem(E+"t")}catch(b){a={getItem:function(a){a=g.cookie.split(a+"=");return 1<a.length&&a.pop().split(";").shift()||"null"},setItem:function(a){var b={};if(b[f.href]=l.state)g.cookie=a+"="+q.stringify(b)}}}try{r=q.parse(a.getItem(E))||
+{}}catch(c){r={}}v(w+"unload",function(){a.setItem(E,q.stringify(r))},o)}function x(a,b,c,d){var c=c||{set:J},f=!c.set,m=!c.get,u={configurable:i,set:function(){f=1},get:function(){m=1}};try{C(a,b,u),a[b]=a[b],C(a,b,c)}catch(fa){}if(!f||!m)if(a.__defineGetter__&&(a.__defineGetter__(b,u.get),a.__defineSetter__(b,u.set),a[b]=a[b],c.get&&a.__defineGetter__(b,c.get),c.set&&a.__defineSetter__(b,c.set)),(!f||!m)&&a===e){try{var $=a[b];a[b]=j}catch(ga){}if("execScript"in e)e.execScript("Public "+b,"VBScript");
+else try{C(a,b,{value:J})}catch(g){}a[b]=$}else if(!f||!m)try{try{var y=F.create(a);C(F.getPrototypeOf(y)===a?y:a,b,c);for(var h in a)"function"===typeof a[h]&&(y[h]=a[h].bind(a));try{d.call(y,y,a)}catch(l){}a=y}catch(k){C(a.constructor.prototype,b,c)}}catch(n){return o}return a}function aa(a,b,c){c=c||{};a=a===K?f:a;c.set=c.set||function(c){a[b]=c};c.get=c.get||function(){return a[b]};return c}function G(a,b){var c=(""+("string"===typeof a?a:a.type)).replace(/^on/,""),d=z[c];if(d){b="string"===typeof a?
+b:a;if(b.target==j)for(var f=["target","currentTarget","srcElement","type"];a=f.pop();)b=x(b,a,{get:"type"===a?function(){return c}:function(){return e}});(("popstate"===c?e.onpopstate:e.onhashchange)||J).call(e,b);for(var f=0,g=d.length;f<g;f++)d[f].call(e,b);return i}return ba(a,b)}function P(){var a=g.createEvent?g.createEvent("Event"):g.createEventObject();a.initEvent?a.initEvent("popstate",o,o):a.type="popstate";a.state=l.state;G(a)}function s(a,b,c,e){p||(b=h(b),b.c!==h().c&&(A=e,c?f.replace("#"+
+b.d):f.hash=b.d));!H&&a&&(r[f.href]=a);D=o}function L(a){if(A){Q!==f.href&&P();var a=a||e.event,b=h(A,i),c=h();a.oldURL||(a.oldURL=b.a,a.newURL=c.a);b.b!==c.b&&G(a)}A=f.href}function R(a){setTimeout(function(){v("popstate",function(a){Q=f.href;H||(a=x(a,"state",{get:function(){return l.state}}));G(a)},o)},0);!p&&a!==i&&l.location&&(S(l.location.hash),D&&(D=o,P()))}function ca(a){var a=a||e.event,b;a:{for(b=a.target||a.srcElement;b;){if("A"===b.nodeName)break a;b=b.parentNode}b=void 0}var c="defaultPrevented"in
+a?a.defaultPrevented:a.returnValue===o;b&&"A"===b.nodeName&&!c&&(c=h(),b=h(b.getAttribute("href",2)),c.a.split("#").shift()===b.a.split("#").shift()&&b.b&&(c.b!==b.b&&(l.location.hash=b.b),S(b.b),a.preventDefault?a.preventDefault():a.returnValue=o))}function S(a){var b=g.getElementById(a=(a||"").replace(/^#/,""));b&&b.id===a&&"A"===b.nodeName&&(a=b.getBoundingClientRect(),e.scrollTo(I.scrollLeft||0,a.top+(I.scrollTop||0)-(I.clientTop||0)))}function da(){function a(a){var b=[],d="VBHistoryClass"+(new Date).getTime()+
+c++,f=["Class "+d],g;for(g in a)if(a.hasOwnProperty(g)){var h=a[g];h&&(h.get||h.set)?(h.get&&f.push("Public "+("_"===g?"Default ":"")+"Property Get ["+g+"]","Call VBCVal([(accessors)].["+g+"].get.call(me),["+g+"])","End Property"),h.set&&f.push("Public Property Let ["+g+"](val)",h="Call [(accessors)].["+g+"].set.call(me,val)\nEnd Property","Public Property Set ["+g+"](val)",h)):(b.push(g),f.push("Public ["+g+"]"))}f.push("Private [(accessors)]","Private Sub Class_Initialize()","Set [(accessors)]="+
+d+"FactoryJS()","End Sub","End Class","Function "+d+"Factory()","Set "+d+"Factory=New "+d,"End Function");e.execScript(f.join("\n"),"VBScript");e[d+"FactoryJS"]=function(){return a};d=e[d+"Factory"]();for(f=0;f<b.length;f++)d[b[f]]=a[b[f]];return d}function b(a){var b=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,c={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return b.test(a)?
+'"'+a.replace(b,function(a){return a in c?c[a]:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}var c=e.eval&&eval("/*@cc_on 1;@*/");if(c&&!(7<+(/msie (\d+)/i.exec(navigator.userAgent)||[,8])[1])){var d=x,k=h().a,m=g.createElement("iframe");m.src="javascript:true;";m=I.firstChild.appendChild(m).contentWindow;e.execScript("Public history\nFunction VBCVal(o,r) If IsObject(o) Then Set r=o Else r=o End If End Function","VBScript");t={_:{get:K.toString}};l={back:n.back,forward:n.forward,
+go:n.go,emulate:j,_:{get:function(){return"[object History]"}}};q={parse:function(a){try{return(new Function("","return "+a))()}catch(b){return j}},stringify:function(a){var c=(typeof a).charCodeAt(2);if(114===c)a=b(a);else if(109===c)a=isFinite(a)?""+a:"null";else if(111===c||108===c)a=""+a;else if(106===c)if(a){var d=(c="[object Array]"===F.prototype.toString.call(a))?"[":"{";if(c)for(var e=0;e<a.length;e++)d+=(0==e?"":",")+q.stringify(a[e]);else for(e in a)a.hasOwnProperty(e)&&(d+=(1==d.length?
+"":",")+b(e)+":"+q.stringify(a[e]));a=d+(c?"]":"}")}else a="null";else a="void 0";return a}};s=function(a,b,c,d,e){var g=m.document,b=h(b);D=o;if(b.c===h().c&&!e)a&&(r[f.href]=a);else{A=d;if(c)m.lfirst?(history.back(),s(a,b.a,0,d,1)):f.replace("#"+b.d);else if(b.a!=k||e)m.lfirst||(m.lfirst=1,s(a,k,0,d,1)),g.open(),g.write('<script>lfirst=1;parent.location.hash="'+b.d.replace(/"/g,'\\"')+'";<\/script>'),g.close();!e&&a&&(r[f.href]=a)}};x=function(b,c,f,g){d.apply(this,arguments)||(b===t?t[c]=f:b===
+l?(l[c]=f,"state"===c&&(t=a(t),e.history=l=a(l))):b[c]=f.get&&f.get());return b};setInterval(function(){var a=h().a;if(a!=k){var b=g.createEventObject();b.oldURL=k;b.newURL=k=a;b.type="hashchange";L(b)}},100);e.JSON=q}}if(e.history){var g=e.document,I=g.documentElement,F=e.Object,q=e.JSON,f=e.location,n=e.history,l=n,M=n.pushState,T=n.replaceState,p=!!M,H="state"in n,C=F.defineProperty,t=x({},"t")?{}:g.createElement("a"),w="",N=e.addEventListener?"addEventListener":(w="on")&&"attachEvent",U=e.removeEventListener?
+"removeEventListener":"detachEvent",V=e.dispatchEvent?"dispatchEvent":"fireEvent",v=e[N],W=e[U],ba=e[V],k={basepath:"/",redirect:0,type:"/"},E="__historyAPI__",O=g.createElement("a"),A=f.href,Q="",D=o,r={},z={},B=g.title,ea={onhashchange:j,onpopstate:j},X=function(a,b){var c=e.history!==n;c&&(e.history=n);a.apply(n,b);c&&(e.history=l)},Y={redirect:function(a,b){k.basepath=b=b==j?k.basepath:b;k.type=a=a==j?k.type:a;if(e.top==e.self){var c=h(j,o,i).c,d=f.pathname+f.search;p?(d=d.replace(/([^\/])$/,
+"$1/"),c!=b&&RegExp("^"+b+"$","i").test(d)&&f.replace(c)):d!=b&&(d=d.replace(/([^\/])\?/,"$1/?"),RegExp("^"+b,"i").test(d)&&f.replace(b+"#"+d.replace(RegExp("^"+b,"i"),a)+f.hash))}},pushState:function(a,b,c){var d=g.title;B!=j&&(g.title=B);M&&X(M,arguments);s(a,c);g.title=d;B=b},replaceState:function(a,b,c){var d=g.title;B!=j&&(g.title=B);delete r[f.href];T&&X(T,arguments);s(a,c,i);g.title=d;B=b},location:{set:function(a){e.location=a},get:function(){return p?f:t}},state:{get:function(){return r[f.href]||
+j}}},K={assign:function(a){0===(""+a).indexOf("#")?s(j,a):f.assign(a)},reload:function(){f.reload()},replace:function(a){0===(""+a).indexOf("#")?s(j,a,i):f.replace(a)},toString:function(){return this.href},href:{get:function(){return h().a}},protocol:j,host:j,hostname:j,port:j,pathname:{get:function(){return h().e}},search:{get:function(){return h().f}},hash:{set:function(a){s(j,(""+a).replace(/^(#|)/,"#"),o,A)},get:function(){return h().b}}};(function(){var a=g.getElementsByTagName("script"),a=(a[a.length-
+1]||{}).src||"";(-1!==a.indexOf("?")?a.split("?").pop():"").replace(/(\w+)(?:=([^&]*))?/g,function(a,b,c){k[b]=(c||("basepath"===b?"/":"")).replace(/^(0|false)$/,"")});da();v(w+"hashchange",L,o);var b=[K,t,ea,e,Y,l];H&&delete Y.state;for(var c=0;c<b.length;c+=2)for(var d in b[c])if(b[c].hasOwnProperty(d))if("function"===typeof b[c][d])b[c+1][d]=b[c][d];else{a=aa(b[c],d,b[c][d]);if(!x(b[c+1],d,a,function(a,d){if(d===l)e.history=l=b[c+1]=a}))return W(w+"hashchange",L,o),o;b[c+1]===e&&(z[d]=z[d.substr(2)]=
+[])}k.redirect&&l.redirect();!H&&q&&Z();if(!p)g[N](w+"click",ca,o);"complete"===g.readyState?R(i):(!p&&h().c!==k.basepath&&(D=i),v(w+"load",R,o));return i})()&&(l.emulate=!p,e[N]=function(a,b,c){a in z?z[a].push(b):3<arguments.length?v(a,b,c,arguments[3]):v(a,b,c)},e[U]=function(a,b,c){var d=z[a];if(d)for(a=d.length;--a;){if(d[a]===b){d.splice(a,1);break}}else W(a,b,c)},e[V]=G)}})(window);
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "html5-history-api",
- "version": "4.0.8",
+ "version": "4.0.9",
"description": "HTML5 History API expansion for browsers not supporting pushState, replaceState",
"main": "history.js",
"repository": {

0 comments on commit d2d92f0

Please sign in to comment.
Something went wrong with that request. Please try again.