1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
|
(function(a,b){"use strict";var c=a.console||b,d=a.document,e=a.navigator,f=a.amplify||!1,g=a.setTimeout,h=a.clearTimeout,i=a.setInterval,j=a.clearInterval,k=a.JSON,l=a.History=a.History||{},m=a.history;k.stringify=k.stringify||k.encode,k.parse=k.parse||k.decode;if(typeof l.init!="undefined")throw new Error("History.js Core has already been loaded...");l.init=function(){if(typeof l.Adapter=="undefined")return!1;typeof l.initCore!="undefined"&&l.initCore(),typeof l.initHtml4!="undefined"&&l.initHtml4();return!0},l.initCore=function(){if(typeof l.initCore.initialized!="undefined")return!1;l.initCore.initialized=!0,l.options=l.options||{},l.options.hashChangeInterval=l.options.hashChangeInterval||100,l.options.safariPollInterval=l.options.safariPollInterval||500,l.options.doubleCheckInterval=l.options.doubleCheckInterval||500,l.options.storeInterval=l.options.storeInterval||1e3,l.options.busyDelay=l.options.busyDelay||250,l.options.debug=l.options.debug||!1,l.options.initialTitle=l.options.initialTitle||d.title,l.intervalList=[],l.clearAllIntervals=function(){var a,b=l.intervalList;if(typeof b!="undefined"&&b!==null){for(a=0;a<b.length;a++)j(b[a]);l.intervalList=null}},l.Adapter.bind(a,"beforeunload",l.clearAllIntervals),l.Adapter.bind(a,"unload",l.clearAllIntervals),l.debug=function(){(l.options.debug||!1)&&l.log.apply(l,arguments)},l.log=function(){var a=typeof c!="undefined"&&typeof c.log!="undefined"&&typeof c.log.apply!="undefined",b=d.getElementById("log"),e,f,g;if(a){var h=Array.prototype.slice.call(arguments);e=h.shift(),typeof c.debug!="undefined"?c.debug.apply(c,[e,h]):c.log.apply(c,[e,h])}else e="\n"+arguments[0]+"\n";for(f=1,g=arguments.length;f<g;++f){var i=arguments[f];if(typeof i=="object"&&typeof k!="undefined")try{i=k.stringify(i)}catch(j){}e+="\n"+i+"\n"}b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||alert(e);return!0},l.getInternetExplorerMajorVersion=function(){var a=l.getInternetExplorerMajorVersion.cached=typeof l.getInternetExplorerMajorVersion.cached!="undefined"?l.getInternetExplorerMajorVersion.cached:function(){var a=3,b=d.createElement("div"),c=b.getElementsByTagName("i");while((b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->")&&c[0]);return a>4?a:!1}();return a},l.isInternetExplorer=function(){var a=l.isInternetExplorer.cached=typeof l.isInternetExplorer.cached!="undefined"?l.isInternetExplorer.cached:Boolean(l.getInternetExplorerMajorVersion());return a},l.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||l.isInternetExplorer()&&l.getInternetExplorerMajorVersion()<8)},l.enabled=!l.emulated.pushState,l.bugs={setHash:Boolean(!l.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!l.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(l.isInternetExplorer()&&l.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(l.isInternetExplorer()&&l.getInternetExplorerMajorVersion()<7)},l.isEmptyObject=function(a){for(var b in a)return!1;return!0},l.cloneObject=function(a){var b,c;a?(b=k.stringify(a),c=k.parse(b)):c={};return c},l.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;a+="/";return a},l.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/");return c},l.getBaseUrl=function(){var a=l.getBaseHref()||l.getBasePageUrl()||l.getRootUrl();return a},l.getPageUrl=function(){var a=l.getState(!1,!1),b=(a||{}).url||d.location.href,c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"});return c},l.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,
|