-
Notifications
You must be signed in to change notification settings - Fork 181
/
history.ielte7.min.js
36 lines (36 loc) · 10.9 KB
/
history.ielte7.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*!
* History API JavaScript Library v4.2.10
*
* Support: IE6+, FF3+, Opera 9+, Safari, Chrome and other
*
* Copyright 2011-2018, Dmitrii Pakhtinov ( [email protected] )
*
* http://spb-piksel.ru/
*
* MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Update: 2018-04-15 13:54
*/
(function(q){if("function"===typeof define&&define.amd){if("undefined"!==typeof requirejs){var v=requirejs,l="[history"+(new Date).getTime()+"]",D=v.onError;q.toString=function(){return l};v.onError=function(q){-1===q.message.indexOf(l)&&D.call(v,q)}}define([],q)}if("object"===typeof exports&&"undefined"!==typeof module)module.exports=q();else return q()})(function(){var i=!0,k=null,p=!1;function q(a,b){var c=e.history!==r;c&&(e.history=r);a.apply(r,b);c&&(e.history=m)}function v(){}function l(a,b,c){if(a!=k&&""!==a&&
!b){var b=l(),g=f.getElementsByTagName("base")[0];!c&&(g&&g.getAttribute("href"))&&(g.href=g.href,b=l(g.href,k,i));c=b.e;g=b.h;a=""+a;a=/^(?:\w+\:)?\/\//.test(a)?0===a.indexOf("/")?g+a:a:g+"//"+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,!j||c)a=a.replace(/^[^#]*/,"")||"#",a=d.protocol.replace(/:.*$|$/,":")+"//"+d.host+h.basepath+a.replace(RegExp("^#[/]?(?:"+h.type+")?"),"");S.href=a;var a=/(?:([a-zA-Z0-9\-]+\:))?(?:\/\/(?:[^@]*@)?([^\/:\?#]+)(?::([0-9]+))?)?([^\?#]*)(?:(\?[^#]+)|\?)?(?:(#.*))?/.exec(S.href),
b=a[2]+(a[3]?":"+a[3]:""),c=a[4]||"/",g=a[5]||"",e="#"===a[6]?"":a[6]||"",T=c+g+e,x=c.replace(RegExp("^"+h.basepath,"i"),h.type)+g;return{a:a[1]+"//"+b+T,h:a[1],g:b,i:a[2],k:a[3]||"",e:c,f:g,b:e,c:T,j:x,d:x+e}}function D(a){return a&&e&&e.EventTarget&&"function"===typeof e.EventTarget.prototype.addEventListener&&"function"===typeof a.bind?a.bind(e):a}function ca(){var a;try{a=e.sessionStorage,a.setItem(G+"t","1"),a.removeItem(G+"t")}catch(b){a={getItem:function(a){a=f.cookie.split(a+"=");return 1<
a.length&&a.pop().split(";").shift()||"null"},setItem:function(a){var b={};if(b[d.href]=m.state)f.cookie=a+"="+s.stringify(b)}}}try{n=s.parse(a.getItem(G))||{}}catch(c){n={}}w(y+"unload",function(){a.setItem(G,s.stringify(n))},p)}function z(a,b,c,g){var d=0;c||(c={set:v},d=1);var f=!c.set,x=!c.get,L={configurable:i,set:function(){f=1},get:function(){x=1}};try{E(a,b,L),a[b]=a[b],E(a,b,c)}catch(la){}if(!f||!x)if(a.__defineGetter__&&(a.__defineGetter__(b,L.get),a.__defineSetter__(b,L.set),a[b]=a[b],
c.get&&a.__defineGetter__(b,c.get),c.set&&a.__defineSetter__(b,c.set)),!f||!x){if(d)return p;if(a===e){try{var da=a[b];a[b]=k}catch(l){}if("execScript"in e)e.execScript("Public "+b,"VBScript"),e.execScript("var "+b+";","JavaScript");else try{E(a,b,{value:v})}catch(m){"onpopstate"===b&&(w("popstate",c=function(){M("popstate",c,p);var b=a.onpopstate;a.onpopstate=k;setTimeout(function(){a.onpopstate=b},1)},p),U=0)}a[b]=da}else try{try{var h=H.create(a);E(H.getPrototypeOf(h)===a?h:a,b,c);for(var j in a)"function"===
typeof a[j]&&(h[j]=a[j].bind(a));try{g.call(h,h,a)}catch(n){}a=h}catch(o){E(a.constructor.prototype,b,c)}}catch(q){return p}}return a}function ea(a,b,c){c=c||{};a=a===N?d:a;c.set=c.set||function(c){a[b]=c};c.get=c.get||function(){return a[b]};return c}function fa(a,b,c){a in A?A[a].push(b):3<arguments.length?w(a,b,c,arguments[3]):w(a,b,c)}function ga(a,b,c){var e=A[a];if(e)for(a=e.length;a--;){if(e[a]===b){e.splice(a,1);break}}else M(a,b,c)}function I(a,b){var c=(""+("string"===typeof a?a:a.type)).replace(/^on/,
""),g=A[c];if(g){b="string"===typeof a?b:a;if(b.target==k)for(var d=["target","currentTarget","srcElement","type"];a=d.pop();)b=z(b,a,{get:"type"===a?function(){return c}:function(){return e}});U&&(("popstate"===c?e.onpopstate:e.onhashchange)||v).call(e,b);for(var d=0,f=g.length;d<f;d++)g[d].call(e,b);return i}return ha(a,b)}function V(){var a=f.createEvent?f.createEvent("Event"):f.createEventObject();a.initEvent?a.initEvent("popstate",p,p):a.type="popstate";a.state=m.state;I(a)}function u(a,b,c,
e){j?B=d.href:(0===o&&(o=2),b=l(b,2===o&&-1!==(""+b).indexOf("#")),b.c!==l().c&&(B=e,c?d.replace("#"+b.d):d.hash=b.d));!J&&a&&(n[d.href]=a);F=p}function O(a){var b=B;B=d.href;if(b){W!==d.href&&V();var a=a||e.event,b=l(b,i),c=l();a.oldURL||(a.oldURL=b.a,a.newURL=c.a);b.b!==c.b&&I(a)}}function X(a){setTimeout(function(){w("popstate",function(a){W=d.href;J||(a=z(a,"state",{get:function(){return m.state}}));I(a)},p)},0);!j&&(a!==i&&"location"in m)&&(Y(t.hash),F&&(F=p,V()))}function ia(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===p;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&&(t.hash=b.b),Y(b.b),a.preventDefault?a.preventDefault():a.returnValue=p))}function Y(a){var b=f.getElementById(a=(a||"").replace(/^#/,""));b&&(b.id===a&&"A"===b.nodeName)&&(a=b.getBoundingClientRect(),e.scrollTo(K.scrollLeft||
0,a.top+(K.scrollTop||0)-(K.clientTop||0)))}function ja(){function a(a){var b=[],d="VBHistoryClass"+(new Date).getTime()+c++,g=["Class "+d],f;for(f in a)if(a.hasOwnProperty(f)){var h=a[f];h&&(h.get||h.set)?(h.get&&g.push("Public "+("_"===f?"Default ":"")+"Property Get ["+f+"]","Call VBCVal([(accessors)].["+f+"].get.call(me),["+f+"])","End Property"),h.set&&g.push("Public Property Let ["+f+"](val)",h="Call [(accessors)].["+f+"].set.call(me,val)\nEnd Property","Public Property Set ["+f+"](val)",h)):
(b.push(f),g.push("Public ["+f+"]"))}g.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(g.join("\n"),"VBScript");e[d+"FactoryJS"]=function(){return a};d=e[d+"Factory"]();for(g=0;g<b.length;g++)d[b[g]]=a[b[g]];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.execScript&&(e.execScript("var documentMsie/*@cc_on =1@*/;","JavaScript"),e.documentMsie);if(c&&!(f.documentMode&&7<f.documentMode)){var g=z,h=l().a,j=f.createElement("iframe");j.src="javascript:true;";j=K.firstChild.appendChild(j).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:N.toString}};m={back:r.back,forward:r.forward,go:r.go,emulate:k,_:{get:function(){return"[object History]"}}};s={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]"===H.prototype.toString.call(a))?"[":"{";if(c)for(var d=0;d<a.length;d++)e+=(0==d?"":",")+s.stringify(a[d]);
else for(d in a)a.hasOwnProperty(d)&&(e+=(1==e.length?"":",")+b(d)+":"+s.stringify(a[d]));a=e+(c?"]":"}")}else a="null";else a="void 0";return a}};u=function(a,b,c,e,g){var f=j.document;0===o&&(o=2);b=l(b,2===o&&-1!==(""+b).indexOf("#"));F=p;if(b.c===l().c&&!g)a&&(n[d.href]=a);else{B=e;if(c)j.lfirst?(history.back(),u(a,b.a,0,e,1)):d.replace("#"+b.d);else if(b.a!=h||g)j.lfirst?g&&(g=0,a=n[d.href]):(j.lfirst=1,u(a,h,0,e,1)),f.open(),f.write('<script>lfirst=1;parent.location.hash="'+b.d.replace(/"/g,
'\\"')+'";<\/script>'),f.close();!g&&a&&(n[d.href]=a)}};z=function(b,c,d,f){g.apply(this,arguments)||(b===t?t[c]=d:b===m?(m[c]=d,"state"===c&&(t=a(t),e.history=m=a(m),e.execScript("var history = window.history;","JavaScript"))):b[c]=d.get&&d.get());return b};setInterval(function(){var a=l().a;if(a!=h){var b=f.createEventObject();b.oldURL=h;b.newURL=h=a;b.type="hashchange";O(b)}},100);e.JSON=s}}var e=("object"===typeof window?window:this)||{};if(!e.history||"emulate"in e.history)return e.history;var f=
e.document,K=f.documentElement,H=e.Object,s=e.JSON,d=e.location,r=e.history,m=r,P=r.pushState,Z=r.replaceState,j=function(){var a=e.navigator.userAgent;return(-1!==a.indexOf("Android 2.")||-1!==a.indexOf("Android 4.0"))&&-1!==a.indexOf("Mobile Safari")&&-1===a.indexOf("Chrome")&&-1===a.indexOf("Windows Phone")?p:!!P}(),J="state"in r,E=H.defineProperty,t=z({},"t")?{}:f.createElement("a"),y="",Q=e.addEventListener?"addEventListener":(y="on")&&"attachEvent",$=e.removeEventListener?"removeEventListener":
"detachEvent",aa=e.dispatchEvent?"dispatchEvent":"fireEvent",w=D(e[Q]),M=D(e[$]),ha=D(e[aa]),h={basepath:"/",redirect:0,type:"/",init:0},G="__historyAPI__",S=f.createElement("a"),B=d.href,W="",U=1,F=p,o=0,n={},A={},C=f.title,R,ka={onhashchange:k,onpopstate:k},ba={setup:function(a,b,c){h.basepath=(""+(a==k?h.basepath:a)).replace(/(?:^|\/)[^\/]*$/,"/");h.type=b==k?h.type:b;h.redirect=c==k?h.redirect:!!c},redirect:function(a,b){m.setup(b,a);b=h.basepath;if(e.top==e.self){var c=l(k,p,i).c,g=d.pathname+
d.search;j?(g=g.replace(/([^\/])$/,"$1/"),c!=b&&RegExp("^"+b+"$","i").test(g)&&d.replace(c)):g!=b&&(g=g.replace(/([^\/])\?/,"$1/?"),RegExp("^"+b,"i").test(g)&&d.replace(b+"#"+g.replace(RegExp("^"+b,"i"),h.type)+d.hash))}},pushState:function(a,b,c){var e=f.title;C!=k&&(f.title=C);P&&q(P,arguments);u(a,c);f.title=e;C=b},replaceState:function(a,b,c){var e=f.title;C!=k&&(f.title=C);delete n[d.href];Z&&q(Z,arguments);u(a,c,i);f.title=e;C=b},location:{set:function(a){0===o&&(o=1);e.location=a},get:function(){0===
o&&(o=1);return t}},state:{get:function(){return"object"===typeof n[d.href]?s.parse(s.stringify(n[d.href])):"undefined"!==typeof n[d.href]?n[d.href]:k}}},N={assign:function(a){!j&&0===(""+a).indexOf("#")?u(k,a):d.assign(a)},reload:function(a){d.reload(a)},replace:function(a){!j&&0===(""+a).indexOf("#")?u(k,a,i):d.replace(a)},toString:function(){return this.href},origin:{get:function(){return void 0!==R?R:!d.origin?d.protocol+"//"+d.hostname+(d.port?":"+d.port:""):d.origin},set:function(a){R=a}},href:j?
k:{get:function(){return l().a}},protocol:k,host:k,hostname:k,port:k,pathname:j?k:{get:function(){return l().e}},search:j?k:{get:function(){return l().f}},hash:j?k:{set:function(a){u(k,(""+a).replace(/^(#|)/,"#"),p,B)},get:function(){return l().b}}};if(function(){var a=f.getElementsByTagName("script"),a=(a[a.length-1]||{}).src||"";(-1!==a.indexOf("?")?a.split("?").pop():"").replace(/(\w+)(?:=([^&]*))?/g,function(a,b,c){h[b]=(c||"").replace(/^(0|false)$/,"")});ja();w(y+"hashchange",O,p);var b=[N,t,
ka,e,ba,m];J&&delete ba.state;for(var c=0;c<b.length;c+=2)for(var d in b[c])if(b[c].hasOwnProperty(d))if("object"!==typeof b[c][d])b[c+1][d]=b[c][d];else{a=ea(b[c],d,b[c][d]);if(!z(b[c+1],d,a,function(a,d){if(d===m)e.history=m=b[c+1]=a}))return M(y+"hashchange",O,p),p;b[c+1]===e&&(A[d]=A[d.substr(2)]=[])}m.setup();h.redirect&&m.redirect();h.init&&(o=1);!J&&s&&ca();if(!j)f[Q](y+"click",ia,p);"complete"===f.readyState?X(i):(!j&&l().c!==h.basepath&&(F=i),w(y+"load",X,p));return i}())return m.emulate=
!j,e[Q]=fa,e[$]=ga,e[aa]=I,m});