{"version":3,"sources":["../ts/modules/jquery.history.js"],"names":["JSON","f","n","Date","prototype","toJSON","key","isFinite","this","valueOf","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","String","Number","Boolean","cx","escapable","gap","indent","meta","\b","\t","\n","\f","\r","\"","\\","rep","quote","string","lastIndex","test","replace","a","c","charCodeAt","toString","slice","str","holder","i","k","v","length","partial","mind","value","call","Object","apply","join","push","hasOwnProperty","stringify","replacer","space","","Error","parse","text","reviver","j","walk","undefined","eval","SyntaxError","window","History","jQuery","Adapter","bind","el","event","callback","trigger","extra","extractEventData","originalEvent","onDomLoad","init","document","setTimeout","clearTimeout","setInterval","initHtml4","initialized","enabled","savedHashes","isLastHash","newHash","getHashByIndex","isHashEqual","oldHash","encodeURIComponent","saveHash","index","discardedHashes","discardedStates","discardState","discardedState","forwardState","backState","discardedStateHash","getHashByState","discardHash","discardedHash","State","StateHash","hash","recycleState","emulated","hashChange","hashChangeInit","checkerFunction","iframe","lastIframeHash","checkerRunning","lastDocumentHash","startedWithHash","getHash","isInternetExplorer","createElement","setAttribute","style","display","body","appendChild","contentWindow","open","close","documentHash","iframeHash","location","escapeHash","back","setHash","intervalList","options","hashChangeInterval","pushState","onHashChange","discardObject","currentUrl","newURL","getLocationHref","currentHash","getHashByUrl","busy","doubleCheckComplete","isTraditionalAnchor","currentState","extractState","getFullUrl","isLastSavedState","forward","data","title","encodeURI","url","queue","pushQueue","scope","args","arguments","newState","createStateObject","newStateHash","oldState","getState","oldStateHash","html4Hash","wasExpected","expectedStateId","id","storeState","setTitle","saveState","getShortUrl","replaceState","previousState","getStateByIndex","console","navigator","sessionStorage","clearInterval","alert","history","setItem","removeItem","e","encode","decode","initCore","emptyFunction","safariPollInterval","doubleCheckInterval","disableSuid","storeInterval","busyDelay","debug","initialTitle","html4Mode","delayInit","clearAllIntervals","il","log","message","arg","consoleExists","textarea","getElementById","Array","shift","Exception","scrollTop","scrollHeight","clientHeight","getInternetExplorerMajorVersion","cached","div","all","getElementsByTagName","innerHTML","userAgent","bugs","vendor","safariPoll","ieDoubleCheck","hashEscape","isEmptyObject","obj","name","cloneObject","newObj","getRootUrl","rootUrl","protocol","hostname","host","port","getBaseHref","baseElements","baseHref","href","getBaseUrl","getBasePageUrl","getPageUrl","part","allowBaseHref","fullUrl","firstChar","substring","baseUrl","shortUrl","doc","URL","decodeURIComponent","indexOf","store","idToState","stateToId","urlToId","storedStates","savedStates","normalizeStore","friendly","create","getLastSavedState","cleanUrl","getIdByState","extractId","getStateString","getTime","Math","random","normalizeState","normalized","dataNotEmpty","hashedUrl","hasUrlDuplicate","getStateById","passedState","cleanedState","getStateId","url_or_hash","tmp","split","parts","exec","getIdByUrl","getLastStoredState","isLast","getCurrentIndex","unescapeHash","result","normalizeHash","pageUrl","firstState","queues","fireNext","flag","timeout","item","fireQueueItem","clearQueue","stateChanged","doubleChecker","doubleCheckClear","doubleCheck","tryAgain","safariStatePoll","urlState","go","onPopState","stateId","getItem","err","onUnload","currentStore","currentStoreString","code","DOMException","QUOTA_EXCEEDED_ERR","appCodeName"],"mappings":"AAiKoB,UAAhB,OAAOA,OACPA,KAAO,IAGX,CAAC,WACG,aAEA,SAASC,EAAEC,GAEP,OAAOA,EAAI,GAAK,IAAMA,EAAIA,CAC9B,CAEqC,YAAjC,OAAOC,KAAKC,UAAUC,SAEtBF,KAAKC,UAAUC,OAAS,SAAUC,KAE9B,OAAOC,SAASC,KAAKC,QAAO,CAAE,EACxBD,KAAKE,eAAc,EAAS,IAC1BT,EAAEO,KAAKG,YAAW,EAAK,CAAC,EAAI,IAC5BV,EAAEO,KAAKI,WAAU,CAAE,EAAS,IAC5BX,EAAEO,KAAKK,YAAW,CAAE,EAAQ,IAC5BZ,EAAEO,KAAKM,cAAa,CAAE,EAAM,IAC5Bb,EAAEO,KAAKO,cAAa,CAAE,EAAM,IAC9B,IACV,EAEAC,OAAOZ,UAAUC,OACbY,OAAOb,UAAUC,OACjBa,QAAQd,UAAUC,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AAO,aAAa,WACxCC,QAAQE,QAAQK,QAAQR,OAAO,UAAU,CAC1C,CAAC,EAGIC,QAAQoD,QAAO,GACnBpD,QAAQE,QAAQS,UAAU,WACzBX,QAAQE,QAAQK,QAAQR,OAAO,YAAY,CAC5C,CAAC,EAOL,EAGKC,QAAQsE,SAAYtE,QAAQsE,QAAQiE,WACxCvI,QAAQY,KAAI,CAGb,EAAEb,MAAM","file":"jquery.history.js","sourcesContent":["/*\r\n json2.js\r\n 2012-10-08\r\n\r\n Public Domain.\r\n\r\n NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.\r\n\r\n See http://www.JSON.org/js.html\r\n\r\n\r\n This code should be minified before deployment.\r\n See http://javascript.crockford.com/jsmin.html\r\n\r\n USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO\r\n NOT CONTROL.\r\n\r\n\r\n This file creates a global JSON object containing two methods: stringify\r\n and parse.\r\n\r\n JSON.stringify(value, replacer, space)\r\n value any JavaScript value, usually an object or array.\r\n\r\n replacer an optional parameter that determines how object\r\n values are stringified for objects. It can be a\r\n function or an array of strings.\r\n\r\n space an optional parameter that specifies the indentation\r\n of nested structures. If it is omitted, the text will\r\n be packed without extra whitespace. If it is a number,\r\n it will specify the number of spaces to indent at each\r\n level. If it is a string (such as '\\t' or ' '),\r\n it contains the characters used to indent at each level.\r\n\r\n This method produces a JSON text from a JavaScript value.\r\n\r\n When an object value is found, if the object contains a toJSON\r\n method, its toJSON method will be called and the result will be\r\n stringified. A toJSON method does not serialize: it returns the\r\n value represented by the name/value pair that should be serialized,\r\n or undefined if nothing should be serialized. The toJSON method\r\n will be passed the key associated with the value, and this will be\r\n bound to the value\r\n\r\n For example, this would serialize Dates as ISO strings.\r\n\r\n Date.prototype.toJSON = function (key) {\r\n function f(n) {\r\n // Format integers to have at least two digits.\r\n return n < 10 ? '0' + n : n;\r\n }\r\n\r\n return this.getUTCFullYear() + '-' +\r\n f(this.getUTCMonth() + 1) + '-' +\r\n f(this.getUTCDate()) + 'T' +\r\n f(this.getUTCHours()) + ':' +\r\n f(this.getUTCMinutes()) + ':' +\r\n f(this.getUTCSeconds()) + 'Z';\r\n };\r\n\r\n You can provide an optional replacer method. It will be passed the\r\n key and value of each member, with this bound to the containing\r\n object. The value that is returned from your method will be\r\n serialized. If your method returns undefined, then the member will\r\n be excluded from the serialization.\r\n\r\n If the replacer parameter is an array of strings, then it will be\r\n used to select the members to be serialized. It filters the results\r\n such that only members with keys listed in the replacer array are\r\n stringified.\r\n\r\n Values that do not have JSON representations, such as undefined or\r\n functions, will not be serialized. Such values in objects will be\r\n dropped; in arrays they will be replaced with null. You can use\r\n a replacer function to replace those with JSON values.\r\n JSON.stringify(undefined) returns undefined.\r\n\r\n The optional space parameter produces a stringification of the\r\n value that is filled with line breaks and indentation to make it\r\n easier to read.\r\n\r\n If the space parameter is a non-empty string, then that string will\r\n be used for indentation. If the space parameter is a number, then\r\n the indentation will be that many spaces.\r\n\r\n Example:\r\n\r\n text = JSON.stringify(['e', {pluribus: 'unum'}]);\r\n // text is '[\"e\",{\"pluribus\":\"unum\"}]'\r\n\r\n\r\n text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\\t');\r\n // text is '[\\n\\t\"e\",\\n\\t{\\n\\t\\t\"pluribus\": \"unum\"\\n\\t}\\n]'\r\n\r\n text = JSON.stringify([new Date()], function (key, value) {\r\n return this[key] instanceof Date ?\r\n 'Date(' + this[key] + ')' : value;\r\n });\r\n // text is '[\"Date(---current time---)\"]'\r\n\r\n\r\n JSON.parse(text, reviver)\r\n This method parses a JSON text to produce an object or array.\r\n It can throw a SyntaxError exception.\r\n\r\n The optional reviver parameter is a function that can filter and\r\n transform the results. It receives each of the keys and values,\r\n and its return value is used instead of the original value.\r\n If it returns what it received, then the structure is not modified.\r\n If it returns undefined then the member is deleted.\r\n\r\n Example:\r\n\r\n // Parse the text. Values that look like ISO date strings will\r\n // be converted to Date objects.\r\n\r\n myData = JSON.parse(text, function (key, value) {\r\n var a;\r\n if (typeof value === 'string') {\r\n a =\r\n/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}(?:\\.\\d*)?)Z$/.exec(value);\r\n if (a) {\r\n return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],\r\n +a[5], +a[6]));\r\n }\r\n }\r\n return value;\r\n });\r\n\r\n myData = JSON.parse('[\"Date(09/09/2001)\"]', function (key, value) {\r\n var d;\r\n if (typeof value === 'string' &&\r\n value.slice(0, 5) === 'Date(' &&\r\n value.slice(-1) === ')') {\r\n d = new Date(value.slice(5, -1));\r\n if (d) {\r\n return d;\r\n }\r\n }\r\n return value;\r\n });\r\n\r\n\r\n This is a reference implementation. You are free to copy, modify, or\r\n redistribute.\r\n*/\r\n\r\n/*jslint evil: true, regexp: true */\r\n\r\n/*members \"\", \"\\b\", \"\\t\", \"\\n\", \"\\f\", \"\\r\", \"\\\"\", JSON, \"\\\\\", apply,\r\n call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,\r\n getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,\r\n lastIndex, length, parse, prototype, push, replace, slice, stringify,\r\n test, toJSON, toString, valueOf\r\n*/\r\n\r\n\r\n// Create a JSON object only if one does not already exist. We create the\r\n// methods in a closure to avoid creating global variables.\r\n\r\nif (typeof JSON !== 'object') {\r\n JSON = {};\r\n}\r\n\r\n(function () {\r\n 'use strict';\r\n\r\n function f(n) {\r\n // Format integers to have at least two digits.\r\n return n < 10 ? '0' + n : n;\r\n }\r\n\r\n if (typeof Date.prototype.toJSON !== 'function') {\r\n\r\n Date.prototype.toJSON = function (key) {\r\n\r\n return isFinite(this.valueOf())\r\n ? this.getUTCFullYear() + '-' +\r\n f(this.getUTCMonth() + 1) + '-' +\r\n f(this.getUTCDate()) + 'T' +\r\n f(this.getUTCHours()) + ':' +\r\n f(this.getUTCMinutes()) + ':' +\r\n f(this.getUTCSeconds()) + 'Z'\r\n : null;\r\n };\r\n\r\n String.prototype.toJSON =\r\n Number.prototype.toJSON =\r\n Boolean.prototype.toJSON = function (key) {\r\n return this.valueOf();\r\n };\r\n }\r\n\r\n var cx = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\r\n escapable = /[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\r\n gap,\r\n indent,\r\n meta = { // table of character substitutions\r\n '\\b': '\\\\b',\r\n '\\t': '\\\\t',\r\n '\\n': '\\\\n',\r\n '\\f': '\\\\f',\r\n '\\r': '\\\\r',\r\n '\"' : '\\\\\"',\r\n '\\\\': '\\\\\\\\'\r\n },\r\n rep;\r\n\r\n\r\n function quote(string) {\r\n\r\n// If the string contains no control characters, no quote characters, and no\r\n// backslash characters, then we can safely slap some quotes around it.\r\n// Otherwise we must also replace the offending characters with safe escape\r\n// sequences.\r\n\r\n escapable.lastIndex = 0;\r\n return escapable.test(string) ? '\"' + string.replace(escapable, function (a) {\r\n var c = meta[a];\r\n return typeof c === 'string'\r\n ? c\r\n : '\\\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\r\n }) + '\"' : '\"' + string + '\"';\r\n }\r\n\r\n\r\n function str(key, holder) {\r\n\r\n// Produce a string from holder[key].\r\n\r\n var i, // The loop counter.\r\n k, // The member key.\r\n v, // The member value.\r\n length,\r\n mind = gap,\r\n partial,\r\n value = holder[key];\r\n\r\n// If the value has a toJSON method, call it to obtain a replacement value.\r\n\r\n if (value && typeof value === 'object' &&\r\n typeof value.toJSON === 'function') {\r\n value = value.toJSON(key);\r\n }\r\n\r\n// If we were called with a replacer function, then call the replacer to\r\n// obtain a replacement value.\r\n\r\n if (typeof rep === 'function') {\r\n value = rep.call(holder, key, value);\r\n }\r\n\r\n// What happens next depends on the value's type.\r\n\r\n switch (typeof value) {\r\n case 'string':\r\n return quote(value);\r\n\r\n case 'number':\r\n\r\n// JSON numbers must be finite. Encode non-finite numbers as null.\r\n\r\n return isFinite(value) ? String(value) : 'null';\r\n\r\n case 'boolean':\r\n case 'null':\r\n\r\n// If the value is a boolean or null, convert it to a string. Note:\r\n// typeof null does not produce 'null'. The case is included here in\r\n// the remote chance that this gets fixed someday.\r\n\r\n return String(value);\r\n\r\n// If the type is 'object', we might be dealing with an object or an array or\r\n// null.\r\n\r\n case 'object':\r\n\r\n// Due to a specification blunder in ECMAScript, typeof null is 'object',\r\n// so watch out for that case.\r\n\r\n if (!value) {\r\n return 'null';\r\n }\r\n\r\n// Make an array to hold the partial results of stringifying this object value.\r\n\r\n gap += indent;\r\n partial = [];\r\n\r\n// Is the value an array?\r\n\r\n if (Object.prototype.toString.apply(value) === '[object Array]') {\r\n\r\n// The value is an array. Stringify every element. Use null as a placeholder\r\n// for non-JSON values.\r\n\r\n length = value.length;\r\n for (i = 0; i < length; i += 1) {\r\n partial[i] = str(i, value) || 'null';\r\n }\r\n\r\n// Join all of the elements together, separated with commas, and wrap them in\r\n// brackets.\r\n\r\n v = partial.length === 0\r\n ? '[]'\r\n : gap\r\n ? '[\\n' + gap + partial.join(',\\n' + gap) + '\\n' + mind + ']'\r\n : '[' + partial.join(',') + ']';\r\n gap = mind;\r\n return v;\r\n }\r\n\r\n// If the replacer is an array, use it to select the members to be stringified.\r\n\r\n if (rep && typeof rep === 'object') {\r\n length = rep.length;\r\n for (i = 0; i < length; i += 1) {\r\n if (typeof rep[i] === 'string') {\r\n k = rep[i];\r\n v = str(k, value);\r\n if (v) {\r\n partial.push(quote(k) + (gap ? ': ' : ':') + v);\r\n }\r\n }\r\n }\r\n } else {\r\n\r\n// Otherwise, iterate through all of the keys in the object.\r\n\r\n for (k in value) {\r\n if (Object.prototype.hasOwnProperty.call(value, k)) {\r\n v = str(k, value);\r\n if (v) {\r\n partial.push(quote(k) + (gap ? ': ' : ':') + v);\r\n }\r\n }\r\n }\r\n }\r\n\r\n// Join all of the member texts together, separated with commas,\r\n// and wrap them in braces.\r\n\r\n v = partial.length === 0\r\n ? '{}'\r\n : gap\r\n ? '{\\n' + gap + partial.join(',\\n' + gap) + '\\n' + mind + '}'\r\n : '{' + partial.join(',') + '}';\r\n gap = mind;\r\n return v;\r\n }\r\n }\r\n\r\n// If the JSON object does not yet have a stringify method, give it one.\r\n\r\n if (typeof JSON.stringify !== 'function') {\r\n JSON.stringify = function (value, replacer, space) {\r\n\r\n// The stringify method takes a value and an optional replacer, and an optional\r\n// space parameter, and returns a JSON text. The replacer can be a function\r\n// that can replace values, or an array of strings that will select the keys.\r\n// A default replacer method can be provided. Use of the space parameter can\r\n// produce text that is more easily readable.\r\n\r\n var i;\r\n gap = '';\r\n indent = '';\r\n\r\n// If the space parameter is a number, make an indent string containing that\r\n// many spaces.\r\n\r\n if (typeof space === 'number') {\r\n for (i = 0; i < space; i += 1) {\r\n indent += ' ';\r\n }\r\n\r\n// If the space parameter is a string, it will be used as the indent string.\r\n\r\n } else if (typeof space === 'string') {\r\n indent = space;\r\n }\r\n\r\n// If there is a replacer, it must be a function or an array.\r\n// Otherwise, throw an error.\r\n\r\n rep = replacer;\r\n if (replacer && typeof replacer !== 'function' &&\r\n (typeof replacer !== 'object' ||\r\n typeof replacer.length !== 'number')) {\r\n throw new Error('JSON.stringify');\r\n }\r\n\r\n// Make a fake root object containing our value under the key of ''.\r\n// Return the result of stringifying the value.\r\n\r\n return str('', {'': value});\r\n };\r\n }\r\n\r\n\r\n// If the JSON object does not yet have a parse method, give it one.\r\n\r\n if (typeof JSON.parse !== 'function') {\r\n JSON.parse = function (text, reviver) {\r\n\r\n// The parse method takes a text and an optional reviver function, and returns\r\n// a JavaScript value if the text is a valid JSON text.\r\n\r\n var j;\r\n\r\n function walk(holder, key) {\r\n\r\n// The walk method is used to recursively walk the resulting structure so\r\n// that modifications can be made.\r\n\r\n var k, v, value = holder[key];\r\n if (value && typeof value === 'object') {\r\n for (k in value) {\r\n if (Object.prototype.hasOwnProperty.call(value, k)) {\r\n v = walk(value, k);\r\n if (v !== undefined) {\r\n value[k] = v;\r\n } else {\r\n delete value[k];\r\n }\r\n }\r\n }\r\n }\r\n return reviver.call(holder, key, value);\r\n }\r\n\r\n\r\n// Parsing happens in four stages. In the first stage, we replace certain\r\n// Unicode characters with escape sequences. JavaScript handles many characters\r\n// incorrectly, either silently deleting them, or treating them as line endings.\r\n\r\n text = String(text);\r\n cx.lastIndex = 0;\r\n if (cx.test(text)) {\r\n text = text.replace(cx, function (a) {\r\n return '\\\\u' +\r\n ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\r\n });\r\n }\r\n\r\n// In the second stage, we run the text against regular expressions that look\r\n// for non-JSON patterns. We are especially concerned with '()' and 'new'\r\n// because they can cause invocation, and '=' because it can cause mutation.\r\n// But just to be safe, we want to reject all unexpected forms.\r\n\r\n// We split the second stage into 4 regexp operations in order to work around\r\n// crippling inefficiencies in IE's and Safari's regexp engines. First we\r\n// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we\r\n// replace all simple value tokens with ']' characters. Third, we delete all\r\n// open brackets that follow a colon or comma or that begin the text. Finally,\r\n// we look to see that the remaining characters are only whitespace or ']' or\r\n// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.\r\n\r\n if (/^[\\],:{}\\s]*$/\r\n .test(text.replace(/\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')\r\n .replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g, ']')\r\n .replace(/(?:^|:|,)(?:\\s*\\[)+/g, ''))) {\r\n\r\n// In the third stage we use the eval function to compile the text into a\r\n// JavaScript structure. The '{' operator is subject to a syntactic ambiguity\r\n// in JavaScript: it can begin a block or an object literal. We wrap the text\r\n// in parens to eliminate the ambiguity.\r\n\r\n j = eval('(' + text + ')');\r\n\r\n// In the optional fourth stage, we recursively walk the new structure, passing\r\n// each name/value pair to a reviver function for possible transformation.\r\n\r\n return typeof reviver === 'function'\r\n ? walk({'': j}, '')\r\n : j;\r\n }\r\n\r\n// If the text is not JSON parseable, then a SyntaxError is thrown.\r\n\r\n throw new SyntaxError('JSON.parse');\r\n };\r\n }\r\n}());/**\r\n * History.js jQuery Adapter\r\n * @author Benjamin Arthur Lupton <contact@balupton.com>\r\n * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>\r\n * @license New BSD License <http://creativecommons.org/licenses/BSD/>\r\n */\r\n\r\n// Closure\r\n(function(window,undefined){\r\n\t\"use strict\";\r\n\r\n\t// Localise Globals\r\n\tvar\r\n\t\tHistory = window.History = window.History||{},\r\n\t\tjQuery = window.jQuery;\r\n\r\n\t// Check Existence\r\n\tif ( typeof History.Adapter !== 'undefined' ) {\r\n\t\tthrow new Error('History.js Adapter has already been loaded...');\r\n\t}\r\n\r\n\t// Add the Adapter\r\n\tHistory.Adapter = {\r\n\t\t/**\r\n\t\t * History.Adapter.bind(el,event,callback)\r\n\t\t * @param {Element|string} el\r\n\t\t * @param {string} event - custom and standard events\r\n\t\t * @param {function} callback\r\n\t\t * @return {void}\r\n\t\t */\r\n\t\tbind: function(el,event,callback){\r\n\t\t\tjQuery(el).bind(event,callback);\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * History.Adapter.trigger(el,event)\r\n\t\t * @param {Element|string} el\r\n\t\t * @param {string} event - custom and standard events\r\n\t\t * @param {Object=} extra - a object of extra event data (optional)\r\n\t\t * @return {void}\r\n\t\t */\r\n\t\ttrigger: function(el,event,extra){\r\n\t\t\tjQuery(el).trigger(event,extra);\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * History.Adapter.extractEventData(key,event,extra)\r\n\t\t * @param {string} key - key for the event data to extract\r\n\t\t * @param {string} event - custom and standard events\r\n\t\t * @param {Object=} extra - a object of extra event data (optional)\r\n\t\t * @return {mixed}\r\n\t\t */\r\n\t\textractEventData: function(key,event,extra){\r\n\t\t\t// jQuery Native then jQuery Custom\r\n\t\t\tvar result = (event && event.originalEvent && event.originalEvent[key]) || (extra && extra[key]) || undefined;\r\n\r\n\t\t\t// Return\r\n\t\t\treturn result;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * History.Adapter.onDomLoad(callback)\r\n\t\t * @param {function} callback\r\n\t\t * @return {void}\r\n\t\t */\r\n\t\tonDomLoad: function(callback) {\r\n\t\t\tjQuery(callback);\r\n\t\t}\r\n\t};\r\n\r\n\t// Try and Initialise History\r\n\tif ( typeof History.init !== 'undefined' ) {\r\n\t\tHistory.init();\r\n\t}\r\n\r\n})(window);\r\n\r\n/**\r\n * History.js HTML4 Support\r\n * Depends on the HTML5 Support\r\n * @author Benjamin Arthur Lupton <contact@balupton.com>\r\n * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>\r\n * @license New BSD License <http://creativecommons.org/licenses/BSD/>\r\n */\r\n\r\n(function(window,undefined){\r\n\t\"use strict\";\r\n\r\n\t// ========================================================================\r\n\t// Initialise\r\n\r\n\t// Localise Globals\r\n\tvar\r\n\t\tdocument = window.document, // Make sure we are using the correct document\r\n\t\tsetTimeout = window.setTimeout||setTimeout,\r\n\t\tclearTimeout = window.clearTimeout||clearTimeout,\r\n\t\tsetInterval = window.setInterval||setInterval,\r\n\t\tHistory = window.History = window.History||{}; // Public History Object\r\n\r\n\t// Check Existence\r\n\tif ( typeof History.initHtml4 !== 'undefined' ) {\r\n\t\tthrow new Error('History.js HTML4 Support has already been loaded...');\r\n\t}\r\n\r\n\r\n\t// ========================================================================\r\n\t// Initialise HTML4 Support\r\n\r\n\t// Initialise HTML4 Support\r\n\tHistory.initHtml4 = function(){\r\n\t\t// Initialise\r\n\t\tif ( typeof History.initHtml4.initialized !== 'undefined' ) {\r\n\t\t\t// Already Loaded\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tHistory.initHtml4.initialized = true;\r\n\t\t}\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Properties\r\n\r\n\t\t/**\r\n\t\t * History.enabled\r\n\t\t * Is History enabled?\r\n\t\t */\r\n\t\tHistory.enabled = true;\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Hash Storage\r\n\r\n\t\t/**\r\n\t\t * History.savedHashes\r\n\t\t * Store the hashes in an array\r\n\t\t */\r\n\t\tHistory.savedHashes = [];\r\n\r\n\t\t/**\r\n\t\t * History.isLastHash(newHash)\r\n\t\t * Checks if the hash is the last hash\r\n\t\t * @param {string} newHash\r\n\t\t * @return {boolean} true\r\n\t\t */\r\n\t\tHistory.isLastHash = function(newHash){\r\n\t\t\t// Prepare\r\n\t\t\tvar oldHash = History.getHashByIndex(),\r\n\t\t\t\tisLast;\r\n\r\n\t\t\t// Check\r\n\t\t\tisLast = newHash === oldHash;\r\n\r\n\t\t\t// Return isLast\r\n\t\t\treturn isLast;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.isHashEqual(newHash, oldHash)\r\n\t\t * Checks to see if two hashes are functionally equal\r\n\t\t * @param {string} newHash\r\n\t\t * @param {string} oldHash\r\n\t\t * @return {boolean} true\r\n\t\t */\r\n\t\tHistory.isHashEqual = function(newHash, oldHash){\r\n\t\t\tnewHash = encodeURIComponent(newHash).replace(/%25/g, \"%\");\r\n\t\t\toldHash = encodeURIComponent(oldHash).replace(/%25/g, \"%\");\r\n\t\t\treturn newHash === oldHash;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.saveHash(newHash)\r\n\t\t * Push a Hash\r\n\t\t * @param {string} newHash\r\n\t\t * @return {boolean} true\r\n\t\t */\r\n\t\tHistory.saveHash = function(newHash){\r\n\t\t\t// Check Hash\r\n\t\t\tif ( History.isLastHash(newHash) ) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Push the Hash\r\n\t\t\tHistory.savedHashes.push(newHash);\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getHashByIndex()\r\n\t\t * Gets a hash by the index\r\n\t\t * @param {integer} index\r\n\t\t * @return {string}\r\n\t\t */\r\n\t\tHistory.getHashByIndex = function(index){\r\n\t\t\t// Prepare\r\n\t\t\tvar hash = null;\r\n\r\n\t\t\t// Handle\r\n\t\t\tif ( typeof index === 'undefined' ) {\r\n\t\t\t\t// Get the last inserted\r\n\t\t\t\thash = History.savedHashes[History.savedHashes.length-1];\r\n\t\t\t}\r\n\t\t\telse if ( index < 0 ) {\r\n\t\t\t\t// Get from the end\r\n\t\t\t\thash = History.savedHashes[History.savedHashes.length+index];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Get from the beginning\r\n\t\t\t\thash = History.savedHashes[index];\r\n\t\t\t}\r\n\r\n\t\t\t// Return hash\r\n\t\t\treturn hash;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Discarded States\r\n\r\n\t\t/**\r\n\t\t * History.discardedHashes\r\n\t\t * A hashed array of discarded hashes\r\n\t\t */\r\n\t\tHistory.discardedHashes = {};\r\n\r\n\t\t/**\r\n\t\t * History.discardedStates\r\n\t\t * A hashed array of discarded states\r\n\t\t */\r\n\t\tHistory.discardedStates = {};\r\n\r\n\t\t/**\r\n\t\t * History.discardState(State)\r\n\t\t * Discards the state by ignoring it through History\r\n\t\t * @param {object} State\r\n\t\t * @return {true}\r\n\t\t */\r\n\t\tHistory.discardState = function(discardedState,forwardState,backState){\r\n\t\t\t//History.debug('History.discardState', arguments);\r\n\t\t\t// Prepare\r\n\t\t\tvar discardedStateHash = History.getHashByState(discardedState),\r\n\t\t\t\tdiscardObject;\r\n\r\n\t\t\t// Create Discard Object\r\n\t\t\tdiscardObject = {\r\n\t\t\t\t'discardedState': discardedState,\r\n\t\t\t\t'backState': backState,\r\n\t\t\t\t'forwardState': forwardState\r\n\t\t\t};\r\n\r\n\t\t\t// Add to DiscardedStates\r\n\t\t\tHistory.discardedStates[discardedStateHash] = discardObject;\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.discardHash(hash)\r\n\t\t * Discards the hash by ignoring it through History\r\n\t\t * @param {string} hash\r\n\t\t * @return {true}\r\n\t\t */\r\n\t\tHistory.discardHash = function(discardedHash,forwardState,backState){\r\n\t\t\t//History.debug('History.discardState', arguments);\r\n\t\t\t// Create Discard Object\r\n\t\t\tvar discardObject = {\r\n\t\t\t\t'discardedHash': discardedHash,\r\n\t\t\t\t'backState': backState,\r\n\t\t\t\t'forwardState': forwardState\r\n\t\t\t};\r\n\r\n\t\t\t// Add to discardedHash\r\n\t\t\tHistory.discardedHashes[discardedHash] = discardObject;\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.discardedState(State)\r\n\t\t * Checks to see if the state is discarded\r\n\t\t * @param {object} State\r\n\t\t * @return {bool}\r\n\t\t */\r\n\t\tHistory.discardedState = function(State){\r\n\t\t\t// Prepare\r\n\t\t\tvar StateHash = History.getHashByState(State),\r\n\t\t\t\tdiscarded;\r\n\r\n\t\t\t// Check\r\n\t\t\tdiscarded = History.discardedStates[StateHash]||false;\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn discarded;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.discardedHash(hash)\r\n\t\t * Checks to see if the state is discarded\r\n\t\t * @param {string} State\r\n\t\t * @return {bool}\r\n\t\t */\r\n\t\tHistory.discardedHash = function(hash){\r\n\t\t\t// Check\r\n\t\t\tvar discarded = History.discardedHashes[hash]||false;\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn discarded;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.recycleState(State)\r\n\t\t * Allows a discarded state to be used again\r\n\t\t * @param {object} data\r\n\t\t * @param {string} title\r\n\t\t * @param {string} url\r\n\t\t * @return {true}\r\n\t\t */\r\n\t\tHistory.recycleState = function(State){\r\n\t\t\t//History.debug('History.recycleState', arguments);\r\n\t\t\t// Prepare\r\n\t\t\tvar StateHash = History.getHashByState(State);\r\n\r\n\t\t\t// Remove from DiscardedStates\r\n\t\t\tif ( History.discardedState(State) ) {\r\n\t\t\t\tdelete History.discardedStates[StateHash];\r\n\t\t\t}\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// HTML4 HashChange Support\r\n\r\n\t\tif ( History.emulated.hashChange ) {\r\n\t\t\t/*\r\n\t\t\t * We must emulate the HTML4 HashChange Support by manually checking for hash changes\r\n\t\t\t */\r\n\r\n\t\t\t/**\r\n\t\t\t * History.hashChangeInit()\r\n\t\t\t * Init the HashChange Emulation\r\n\t\t\t */\r\n\t\t\tHistory.hashChangeInit = function(){\r\n\t\t\t\t// Define our Checker Function\r\n\t\t\t\tHistory.checkerFunction = null;\r\n\r\n\t\t\t\t// Define some variables that will help in our checker function\r\n\t\t\t\tvar lastDocumentHash = '',\r\n\t\t\t\t\tiframeId, iframe,\r\n\t\t\t\t\tlastIframeHash, checkerRunning,\r\n\t\t\t\t\tstartedWithHash = Boolean(History.getHash());\r\n\r\n\t\t\t\t// Handle depending on the browser\r\n\t\t\t\tif ( History.isInternetExplorer() ) {\r\n\t\t\t\t\t// IE6 and IE7\r\n\t\t\t\t\t// We need to use an iframe to emulate the back and forward buttons\r\n\r\n\t\t\t\t\t// Create iFrame\r\n\t\t\t\t\tiframeId = 'historyjs-iframe';\r\n\t\t\t\t\tiframe = document.createElement('iframe');\r\n\r\n\t\t\t\t\t// Adjust iFarme\r\n\t\t\t\t\t// IE 6 requires iframe to have a src on HTTPS pages, otherwise it will throw a\r\n\t\t\t\t\t// \"This page contains both secure and nonsecure items\" warning.\r\n\t\t\t\t\tiframe.setAttribute('id', iframeId);\r\n\t\t\t\t\tiframe.setAttribute('src', '#');\r\n\t\t\t\t\tiframe.style.display = 'none';\r\n\r\n\t\t\t\t\t// Append iFrame\r\n\t\t\t\t\tdocument.body.appendChild(iframe);\r\n\r\n\t\t\t\t\t// Create initial history entry\r\n\t\t\t\t\tiframe.contentWindow.document.open();\r\n\t\t\t\t\tiframe.contentWindow.document.close();\r\n\r\n\t\t\t\t\t// Define some variables that will help in our checker function\r\n\t\t\t\t\tlastIframeHash = '';\r\n\t\t\t\t\tcheckerRunning = false;\r\n\r\n\t\t\t\t\t// Define the checker function\r\n\t\t\t\t\tHistory.checkerFunction = function(){\r\n\t\t\t\t\t\t// Check Running\r\n\t\t\t\t\t\tif ( checkerRunning ) {\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Update Running\r\n\t\t\t\t\t\tcheckerRunning = true;\r\n\r\n\t\t\t\t\t\t// Fetch\r\n\t\t\t\t\t\tvar\r\n\t\t\t\t\t\t\tdocumentHash = History.getHash(),\r\n\t\t\t\t\t\t\tiframeHash = History.getHash(iframe.contentWindow.document);\r\n\r\n\t\t\t\t\t\t// The Document Hash has changed (application caused)\r\n\t\t\t\t\t\tif ( documentHash !== lastDocumentHash ) {\r\n\t\t\t\t\t\t\t// Equalise\r\n\t\t\t\t\t\t\tlastDocumentHash = documentHash;\r\n\r\n\t\t\t\t\t\t\t// Create a history entry in the iframe\r\n\t\t\t\t\t\t\tif ( iframeHash !== documentHash ) {\r\n\t\t\t\t\t\t\t\t//History.debug('hashchange.checker: iframe hash change', 'documentHash (new):', documentHash, 'iframeHash (old):', iframeHash);\r\n\r\n\t\t\t\t\t\t\t\t// Equalise\r\n\t\t\t\t\t\t\t\tlastIframeHash = iframeHash = documentHash;\r\n\r\n\t\t\t\t\t\t\t\t// Create History Entry\r\n\t\t\t\t\t\t\t\tiframe.contentWindow.document.open();\r\n\t\t\t\t\t\t\t\tiframe.contentWindow.document.close();\r\n\r\n\t\t\t\t\t\t\t\t// Update the iframe's hash\r\n\t\t\t\t\t\t\t\tiframe.contentWindow.document.location.hash = History.escapeHash(documentHash);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t// Trigger Hashchange Event\r\n\t\t\t\t\t\t\tHistory.Adapter.trigger(window,'hashchange');\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// The iFrame Hash has changed (back button caused)\r\n\t\t\t\t\t\telse if ( iframeHash !== lastIframeHash ) {\r\n\t\t\t\t\t\t\t//History.debug('hashchange.checker: iframe hash out of sync', 'iframeHash (new):', iframeHash, 'documentHash (old):', documentHash);\r\n\r\n\t\t\t\t\t\t\t// Equalise\r\n\t\t\t\t\t\t\tlastIframeHash = iframeHash;\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// If there is no iframe hash that means we're at the original\r\n\t\t\t\t\t\t\t// iframe state.\r\n\t\t\t\t\t\t\t// And if there was a hash on the original request, the original\r\n\t\t\t\t\t\t\t// iframe state was replaced instantly, so skip this state and take\r\n\t\t\t\t\t\t\t// the user back to where they came from.\r\n\t\t\t\t\t\t\tif (startedWithHash && iframeHash === '') {\r\n\t\t\t\t\t\t\t\tHistory.back();\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t// Update the Hash\r\n\t\t\t\t\t\t\t\tHistory.setHash(iframeHash,false);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Reset Running\r\n\t\t\t\t\t\tcheckerRunning = false;\r\n\r\n\t\t\t\t\t\t// Return true\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// We are not IE\r\n\t\t\t\t\t// Firefox 1 or 2, Opera\r\n\r\n\t\t\t\t\t// Define the checker function\r\n\t\t\t\t\tHistory.checkerFunction = function(){\r\n\t\t\t\t\t\t// Prepare\r\n\t\t\t\t\t\tvar documentHash = History.getHash()||'';\r\n\r\n\t\t\t\t\t\t// The Document Hash has changed (application caused)\r\n\t\t\t\t\t\tif ( documentHash !== lastDocumentHash ) {\r\n\t\t\t\t\t\t\t// Equalise\r\n\t\t\t\t\t\t\tlastDocumentHash = documentHash;\r\n\r\n\t\t\t\t\t\t\t// Trigger Hashchange Event\r\n\t\t\t\t\t\t\tHistory.Adapter.trigger(window,'hashchange');\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Return true\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t};\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Apply the checker function\r\n\t\t\t\tHistory.intervalList.push(setInterval(History.checkerFunction, History.options.hashChangeInterval));\r\n\r\n\t\t\t\t// Done\r\n\t\t\t\treturn true;\r\n\t\t\t}; // History.hashChangeInit\r\n\r\n\t\t\t// Bind hashChangeInit\r\n\t\t\tHistory.Adapter.onDomLoad(History.hashChangeInit);\r\n\r\n\t\t} // History.emulated.hashChange\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// HTML5 State Support\r\n\r\n\t\t// Non-Native pushState Implementation\r\n\t\tif ( History.emulated.pushState ) {\r\n\t\t\t/*\r\n\t\t\t * We must emulate the HTML5 State Management by using HTML4 HashChange\r\n\t\t\t */\r\n\r\n\t\t\t/**\r\n\t\t\t * History.onHashChange(event)\r\n\t\t\t * Trigger HTML5's window.onpopstate via HTML4 HashChange Support\r\n\t\t\t */\r\n\t\t\tHistory.onHashChange = function(event){\r\n\t\t\t\t//History.debug('History.onHashChange', arguments);\r\n\r\n\t\t\t\t// Prepare\r\n\t\t\t\tvar currentUrl = ((event && event.newURL) || History.getLocationHref()),\r\n\t\t\t\t\tcurrentHash = History.getHashByUrl(currentUrl),\r\n\t\t\t\t\tcurrentState = null,\r\n\t\t\t\t\tcurrentStateHash = null,\r\n\t\t\t\t\tcurrentStateHashExits = null,\r\n\t\t\t\t\tdiscardObject;\r\n\r\n\t\t\t\t// Check if we are the same state\r\n\t\t\t\tif ( History.isLastHash(currentHash) ) {\r\n\t\t\t\t\t// There has been no change (just the page's hash has finally propagated)\r\n\t\t\t\t\t//History.debug('History.onHashChange: no change');\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Reset the double check\r\n\t\t\t\tHistory.doubleCheckComplete();\r\n\r\n\t\t\t\t// Store our location for use in detecting back/forward direction\r\n\t\t\t\tHistory.saveHash(currentHash);\r\n\r\n\t\t\t\t// Expand Hash\r\n\t\t\t\tif ( currentHash && History.isTraditionalAnchor(currentHash) ) {\r\n\t\t\t\t\t//History.debug('History.onHashChange: traditional anchor', currentHash);\r\n\t\t\t\t\t// Traditional Anchor Hash\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'anchorchange');\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Create State\r\n\t\t\t\tcurrentState = History.extractState(History.getFullUrl(currentHash||History.getLocationHref()),true);\r\n\r\n\t\t\t\t// Check if we are the same state\r\n\t\t\t\tif ( History.isLastSavedState(currentState) ) {\r\n\t\t\t\t\t//History.debug('History.onHashChange: no change');\r\n\t\t\t\t\t// There has been no change (just the page's hash has finally propagated)\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Create the state Hash\r\n\t\t\t\tcurrentStateHash = History.getHashByState(currentState);\r\n\r\n\t\t\t\t// Check if we are DiscardedState\r\n\t\t\t\tdiscardObject = History.discardedState(currentState);\r\n\t\t\t\tif ( discardObject ) {\r\n\t\t\t\t\t// Ignore this state as it has been discarded and go back to the state before it\r\n\t\t\t\t\tif ( History.getHashByIndex(-2) === History.getHashByState(discardObject.forwardState) ) {\r\n\t\t\t\t\t\t// We are going backwards\r\n\t\t\t\t\t\t//History.debug('History.onHashChange: go backwards');\r\n\t\t\t\t\t\tHistory.back(false);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// We are going forwards\r\n\t\t\t\t\t\t//History.debug('History.onHashChange: go forwards');\r\n\t\t\t\t\t\tHistory.forward(false);\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Push the new HTML5 State\r\n\t\t\t\t//History.debug('History.onHashChange: success hashchange');\r\n\t\t\t\tHistory.pushState(currentState.data,currentState.title,encodeURI(currentState.url),false);\r\n\r\n\t\t\t\t// End onHashChange closure\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\t\t\tHistory.Adapter.bind(window,'hashchange',History.onHashChange);\r\n\r\n\t\t\t/**\r\n\t\t\t * History.pushState(data,title,url)\r\n\t\t\t * Add a new State to the history object, become it, and trigger onpopstate\r\n\t\t\t * We have to trigger for HTML4 compatibility\r\n\t\t\t * @param {object} data\r\n\t\t\t * @param {string} title\r\n\t\t\t * @param {string} url\r\n\t\t\t * @return {true}\r\n\t\t\t */\r\n\t\t\tHistory.pushState = function(data,title,url,queue){\r\n\t\t\t\t//History.debug('History.pushState: called', arguments);\r\n\r\n\t\t\t\t// We assume that the URL passed in is URI-encoded, but this makes\r\n\t\t\t\t// sure that it's fully URI encoded; any '%'s that are encoded are\r\n\t\t\t\t// converted back into '%'s\r\n\t\t\t\turl = encodeURI(url).replace(/%25/g, \"%\");\r\n\r\n\t\t\t\t// Check the State\r\n\t\t\t\tif ( History.getHashByUrl(url) ) {\r\n\t\t\t\t\tthrow new Error('History.js does not support states with fragment-identifiers (hashes/anchors).');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Handle Queueing\r\n\t\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t\t//History.debug('History.pushState: we must wait', arguments);\r\n\t\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\t\tscope: History,\r\n\t\t\t\t\t\tcallback: History.pushState,\r\n\t\t\t\t\t\targs: arguments,\r\n\t\t\t\t\t\tqueue: queue\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Make Busy\r\n\t\t\t\tHistory.busy(true);\r\n\r\n\t\t\t\t// Fetch the State Object\r\n\t\t\t\tvar newState = History.createStateObject(data,title,url),\r\n\t\t\t\t\tnewStateHash = History.getHashByState(newState),\r\n\t\t\t\t\toldState = History.getState(false),\r\n\t\t\t\t\toldStateHash = History.getHashByState(oldState),\r\n\t\t\t\t\thtml4Hash = History.getHash(),\r\n\t\t\t\t\twasExpected = History.expectedStateId == newState.id;\r\n\r\n\t\t\t\t// Store the newState\r\n\t\t\t\tHistory.storeState(newState);\r\n\t\t\t\tHistory.expectedStateId = newState.id;\r\n\r\n\t\t\t\t// Recycle the State\r\n\t\t\t\tHistory.recycleState(newState);\r\n\r\n\t\t\t\t// Force update of the title\r\n\t\t\t\tHistory.setTitle(newState);\r\n\r\n\t\t\t\t// Check if we are the same State\r\n\t\t\t\tif ( newStateHash === oldStateHash ) {\r\n\t\t\t\t\t//History.debug('History.pushState: no change', newStateHash);\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Update HTML5 State\r\n\t\t\t\tHistory.saveState(newState);\r\n\r\n\t\t\t\t// Fire HTML5 Event\r\n\t\t\t\tif(!wasExpected)\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'statechange');\r\n\r\n\t\t\t\t// Update HTML4 Hash\r\n\t\t\t\tif ( !History.isHashEqual(newStateHash, html4Hash) && !History.isHashEqual(newStateHash, History.getShortUrl(History.getLocationHref())) ) {\r\n\t\t\t\t\tHistory.setHash(newStateHash,false);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tHistory.busy(false);\r\n\r\n\t\t\t\t// End pushState closure\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\r\n\t\t\t/**\r\n\t\t\t * History.replaceState(data,title,url)\r\n\t\t\t * Replace the State and trigger onpopstate\r\n\t\t\t * We have to trigger for HTML4 compatibility\r\n\t\t\t * @param {object} data\r\n\t\t\t * @param {string} title\r\n\t\t\t * @param {string} url\r\n\t\t\t * @return {true}\r\n\t\t\t */\r\n\t\t\tHistory.replaceState = function(data,title,url,queue){\r\n\t\t\t\t//History.debug('History.replaceState: called', arguments);\r\n\r\n\t\t\t\t// We assume that the URL passed in is URI-encoded, but this makes\r\n\t\t\t\t// sure that it's fully URI encoded; any '%'s that are encoded are\r\n\t\t\t\t// converted back into '%'s\r\n\t\t\t\turl = encodeURI(url).replace(/%25/g, \"%\");\r\n\r\n\t\t\t\t// Check the State\r\n\t\t\t\tif ( History.getHashByUrl(url) ) {\r\n\t\t\t\t\tthrow new Error('History.js does not support states with fragment-identifiers (hashes/anchors).');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Handle Queueing\r\n\t\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t\t//History.debug('History.replaceState: we must wait', arguments);\r\n\t\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\t\tscope: History,\r\n\t\t\t\t\t\tcallback: History.replaceState,\r\n\t\t\t\t\t\targs: arguments,\r\n\t\t\t\t\t\tqueue: queue\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Make Busy\r\n\t\t\t\tHistory.busy(true);\r\n\r\n\t\t\t\t// Fetch the State Objects\r\n\t\t\t\tvar newState = History.createStateObject(data,title,url),\r\n\t\t\t\t\tnewStateHash = History.getHashByState(newState),\r\n\t\t\t\t\toldState = History.getState(false),\r\n\t\t\t\t\toldStateHash = History.getHashByState(oldState),\r\n\t\t\t\t\tpreviousState = History.getStateByIndex(-2);\r\n\r\n\t\t\t\t// Discard Old State\r\n\t\t\t\tHistory.discardState(oldState,newState,previousState);\r\n\r\n\t\t\t\t// If the url hasn't changed, just store and save the state\r\n\t\t\t\t// and fire a statechange event to be consistent with the\r\n\t\t\t\t// html 5 api\r\n\t\t\t\tif ( newStateHash === oldStateHash ) {\r\n\t\t\t\t\t// Store the newState\r\n\t\t\t\t\tHistory.storeState(newState);\r\n\t\t\t\t\tHistory.expectedStateId = newState.id;\r\n\t\r\n\t\t\t\t\t// Recycle the State\r\n\t\t\t\t\tHistory.recycleState(newState);\r\n\t\r\n\t\t\t\t\t// Force update of the title\r\n\t\t\t\t\tHistory.setTitle(newState);\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Update HTML5 State\r\n\t\t\t\t\tHistory.saveState(newState);\r\n\r\n\t\t\t\t\t// Fire HTML5 Event\r\n\t\t\t\t\t//History.debug('History.pushState: trigger popstate');\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'statechange');\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Alias to PushState\r\n\t\t\t\t\tHistory.pushState(newState.data,newState.title,newState.url,false);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// End replaceState closure\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\r\n\t\t} // History.emulated.pushState\r\n\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Initialise\r\n\r\n\t\t// Non-Native pushState Implementation\r\n\t\tif ( History.emulated.pushState ) {\r\n\t\t\t/**\r\n\t\t\t * Ensure initial state is handled correctly\r\n\t\t\t */\r\n\t\t\tif ( History.getHash() && !History.emulated.hashChange ) {\r\n\t\t\t\tHistory.Adapter.onDomLoad(function(){\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'hashchange');\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t} // History.emulated.pushState\r\n\r\n\t}; // History.initHtml4\r\n\r\n\t// Try to Initialise History\r\n\tif ( typeof History.init !== 'undefined' ) {\r\n\t\tHistory.init();\r\n\t}\r\n\r\n})(window);\r\n/**\r\n * History.js Core\r\n * @author Benjamin Arthur Lupton <contact@balupton.com>\r\n * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>\r\n * @license New BSD License <http://creativecommons.org/licenses/BSD/>\r\n */\r\n\r\n(function(window,undefined){\r\n\t\"use strict\";\r\n\r\n\t// ========================================================================\r\n\t// Initialise\r\n\r\n\t// Localise Globals\r\n\tvar\r\n\t\tconsole = window.console||undefined, // Prevent a JSLint complain\r\n\t\tdocument = window.document, // Make sure we are using the correct document\r\n\t\tnavigator = window.navigator, // Make sure we are using the correct navigator\r\n\t\tsessionStorage = false, // sessionStorage\r\n\t\tsetTimeout = window.setTimeout,\r\n\t\tclearTimeout = window.clearTimeout,\r\n\t\tsetInterval = window.setInterval,\r\n\t\tclearInterval = window.clearInterval,\r\n\t\tJSON = window.JSON,\r\n\t\talert = window.alert,\r\n\t\tHistory = window.History = window.History||{}, // Public History Object\r\n\t\thistory = window.history; // Old History Object\r\n\r\n\ttry {\r\n\t\tsessionStorage = window.sessionStorage; // This will throw an exception in some browsers when cookies/localStorage are explicitly disabled (i.e. Chrome)\r\n\t\tsessionStorage.setItem('TEST', '1');\r\n\t\tsessionStorage.removeItem('TEST');\r\n\t} catch(e) {\r\n\t\tsessionStorage = false;\r\n\t}\r\n\r\n\t// MooTools Compatibility\r\n\tJSON.stringify = JSON.stringify||JSON.encode;\r\n\tJSON.parse = JSON.parse||JSON.decode;\r\n\r\n\t// Check Existence\r\n\tif ( typeof History.init !== 'undefined' ) {\r\n\t\tthrow new Error('History.js Core has already been loaded...');\r\n\t}\r\n\r\n\t// Initialise History\r\n\tHistory.init = function(options){\r\n\t\t// Check Load Status of Adapter\r\n\t\tif ( typeof History.Adapter === 'undefined' ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t// Check Load Status of Core\r\n\t\tif ( typeof History.initCore !== 'undefined' ) {\r\n\t\t\tHistory.initCore();\r\n\t\t}\r\n\r\n\t\t// Check Load Status of HTML4 Support\r\n\t\tif ( typeof History.initHtml4 !== 'undefined' ) {\r\n\t\t\tHistory.initHtml4();\r\n\t\t}\r\n\r\n\t\t// Return true\r\n\t\treturn true;\r\n\t};\r\n\r\n\r\n\t// ========================================================================\r\n\t// Initialise Core\r\n\r\n\t// Initialise Core\r\n\tHistory.initCore = function(options){\r\n\t\t// Initialise\r\n\t\tif ( typeof History.initCore.initialized !== 'undefined' ) {\r\n\t\t\t// Already Loaded\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse {\r\n\t\t\tHistory.initCore.initialized = true;\r\n\t\t}\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Options\r\n\r\n\t\t/**\r\n\t\t * History.options\r\n\t\t * Configurable options\r\n\t\t */\r\n\t\tHistory.options = History.options||{};\r\n\r\n\t\t/**\r\n\t\t * History.options.hashChangeInterval\r\n\t\t * How long should the interval be before hashchange checks\r\n\t\t */\r\n\t\tHistory.options.hashChangeInterval = History.options.hashChangeInterval || 100;\r\n\r\n\t\t/**\r\n\t\t * History.options.safariPollInterval\r\n\t\t * How long should the interval be before safari poll checks\r\n\t\t */\r\n\t\tHistory.options.safariPollInterval = History.options.safariPollInterval || 500;\r\n\r\n\t\t/**\r\n\t\t * History.options.doubleCheckInterval\r\n\t\t * How long should the interval be before we perform a double check\r\n\t\t */\r\n\t\tHistory.options.doubleCheckInterval = History.options.doubleCheckInterval || 500;\r\n\r\n\t\t/**\r\n\t\t * History.options.disableSuid\r\n\t\t * Force History not to append suid\r\n\t\t */\r\n\t\tHistory.options.disableSuid = History.options.disableSuid || false;\r\n\r\n\t\t/**\r\n\t\t * History.options.storeInterval\r\n\t\t * How long should we wait between store calls\r\n\t\t */\r\n\t\tHistory.options.storeInterval = History.options.storeInterval || 1000;\r\n\r\n\t\t/**\r\n\t\t * History.options.busyDelay\r\n\t\t * How long should we wait between busy events\r\n\t\t */\r\n\t\tHistory.options.busyDelay = History.options.busyDelay || 250;\r\n\r\n\t\t/**\r\n\t\t * History.options.debug\r\n\t\t * If true will enable debug messages to be logged\r\n\t\t */\r\n\t\tHistory.options.debug = History.options.debug || false;\r\n\r\n\t\t/**\r\n\t\t * History.options.initialTitle\r\n\t\t * What is the title of the initial state\r\n\t\t */\r\n\t\tHistory.options.initialTitle = History.options.initialTitle || document.title;\r\n\r\n\t\t/**\r\n\t\t * History.options.html4Mode\r\n\t\t * If true, will force HTMl4 mode (hashtags)\r\n\t\t */\r\n\t\tHistory.options.html4Mode = History.options.html4Mode || false;\r\n\r\n\t\t/**\r\n\t\t * History.options.delayInit\r\n\t\t * Want to override default options and call init manually.\r\n\t\t */\r\n\t\tHistory.options.delayInit = History.options.delayInit || false;\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Interval record\r\n\r\n\t\t/**\r\n\t\t * History.intervalList\r\n\t\t * List of intervals set, to be cleared when document is unloaded.\r\n\t\t */\r\n\t\tHistory.intervalList = [];\r\n\r\n\t\t/**\r\n\t\t * History.clearAllIntervals\r\n\t\t * Clears all setInterval instances.\r\n\t\t */\r\n\t\tHistory.clearAllIntervals = function(){\r\n\t\t\tvar i, il = History.intervalList;\r\n\t\t\tif (typeof il !== \"undefined\" && il !== null) {\r\n\t\t\t\tfor (i = 0; i < il.length; i++) {\r\n\t\t\t\t\tclearInterval(il[i]);\r\n\t\t\t\t}\r\n\t\t\t\tHistory.intervalList = null;\r\n\t\t\t}\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Debug\r\n\r\n\t\t/**\r\n\t\t * History.debug(message,...)\r\n\t\t * Logs the passed arguments if debug enabled\r\n\t\t */\r\n\t\tHistory.debug = function(){\r\n\t\t\tif ( (History.options.debug||false) ) {\r\n\t\t\t\tHistory.log.apply(History,arguments);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.log(message,...)\r\n\t\t * Logs the passed arguments\r\n\t\t */\r\n\t\tHistory.log = function(){\r\n\t\t\t// Prepare\r\n\t\t\tvar\r\n\t\t\t\tconsoleExists = !(typeof console === 'undefined' || typeof console.log === 'undefined' || typeof console.log.apply === 'undefined'),\r\n\t\t\t\ttextarea = document.getElementById('log'),\r\n\t\t\t\tmessage,\r\n\t\t\t\ti,n,\r\n\t\t\t\targs,arg\r\n\t\t\t\t;\r\n\r\n\t\t\t// Write to Console\r\n\t\t\tif ( consoleExists ) {\r\n\t\t\t\targs = Array.prototype.slice.call(arguments);\r\n\t\t\t\tmessage = args.shift();\r\n\t\t\t\tif ( typeof console.debug !== 'undefined' ) {\r\n\t\t\t\t\tconsole.debug.apply(console,[message,args]);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tconsole.log.apply(console,[message,args]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tmessage = (\"\\n\"+arguments[0]+\"\\n\");\r\n\t\t\t}\r\n\r\n\t\t\t// Write to log\r\n\t\t\tfor ( i=1,n=arguments.length; i<n; ++i ) {\r\n\t\t\t\targ = arguments[i];\r\n\t\t\t\tif ( typeof arg === 'object' && typeof JSON !== 'undefined' ) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\targ = JSON.stringify(arg);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcatch ( Exception ) {\r\n\t\t\t\t\t\t// Recursive Object\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tmessage += \"\\n\"+arg+\"\\n\";\r\n\t\t\t}\r\n\r\n\t\t\t// Textarea\r\n\t\t\tif ( textarea ) {\r\n\t\t\t\ttextarea.value += message+\"\\n-----\\n\";\r\n\t\t\t\ttextarea.scrollTop = textarea.scrollHeight - textarea.clientHeight;\r\n\t\t\t}\r\n\t\t\t// No Textarea, No Console\r\n\t\t\telse if ( !consoleExists ) {\r\n\t\t\t\talert(message);\r\n\t\t\t}\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Emulated Status\r\n\r\n\t\t/**\r\n\t\t * History.getInternetExplorerMajorVersion()\r\n\t\t * Get's the major version of Internet Explorer\r\n\t\t * @return {integer}\r\n\t\t * @license Public Domain\r\n\t\t * @author Benjamin Arthur Lupton <contact@balupton.com>\r\n\t\t * @author James Padolsey <https://gist.github.com/527683>\r\n\t\t */\r\n\t\tHistory.getInternetExplorerMajorVersion = function(){\r\n\t\t\tvar result = History.getInternetExplorerMajorVersion.cached =\r\n\t\t\t\t\t(typeof History.getInternetExplorerMajorVersion.cached !== 'undefined')\r\n\t\t\t\t?\tHistory.getInternetExplorerMajorVersion.cached\r\n\t\t\t\t:\t(function(){\r\n\t\t\t\t\t\tvar v = 3,\r\n\t\t\t\t\t\t\t\tdiv = document.createElement('div'),\r\n\t\t\t\t\t\t\t\tall = div.getElementsByTagName('i');\r\n\t\t\t\t\t\twhile ( (div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->') && all[0] ) {}\r\n\t\t\t\t\t\treturn (v > 4) ? v : false;\r\n\t\t\t\t\t})()\r\n\t\t\t\t;\r\n\t\t\treturn result;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.isInternetExplorer()\r\n\t\t * Are we using Internet Explorer?\r\n\t\t * @return {boolean}\r\n\t\t * @license Public Domain\r\n\t\t * @author Benjamin Arthur Lupton <contact@balupton.com>\r\n\t\t */\r\n\t\tHistory.isInternetExplorer = function(){\r\n\t\t\tvar result =\r\n\t\t\t\tHistory.isInternetExplorer.cached =\r\n\t\t\t\t(typeof History.isInternetExplorer.cached !== 'undefined')\r\n\t\t\t\t\t?\tHistory.isInternetExplorer.cached\r\n\t\t\t\t\t:\tBoolean(History.getInternetExplorerMajorVersion())\r\n\t\t\t\t;\r\n\t\t\treturn result;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.emulated\r\n\t\t * Which features require emulating?\r\n\t\t */\r\n\r\n\t\tif (History.options.html4Mode) {\r\n\t\t\tHistory.emulated = {\r\n\t\t\t\tpushState : true,\r\n\t\t\t\thashChange: true\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\telse {\r\n\r\n\t\t\tHistory.emulated = {\r\n\t\t\t\tpushState: !Boolean(\r\n\t\t\t\t\twindow.history && window.history.pushState && window.history.replaceState\r\n\t\t\t\t\t&& !(\r\n\t\t\t\t\t\t(/ Mobile\\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) /* disable for versions of iOS before version 4.3 (8F190) */\r\n\t\t\t\t\t\t|| (/AppleWebKit\\/5([0-2]|3[0-2])/i).test(navigator.userAgent) /* disable for the mercury iOS browser, or at least older versions of the webkit engine */\r\n\t\t\t\t\t)\r\n\t\t\t\t),\r\n\t\t\t\thashChange: Boolean(\r\n\t\t\t\t\t!(('onhashchange' in window) || ('onhashchange' in document))\r\n\t\t\t\t\t||\r\n\t\t\t\t\t(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8)\r\n\t\t\t\t)\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * History.enabled\r\n\t\t * Is History enabled?\r\n\t\t */\r\n\t\tHistory.enabled = !History.emulated.pushState;\r\n\r\n\t\t/**\r\n\t\t * History.bugs\r\n\t\t * Which bugs are present\r\n\t\t */\r\n\t\tHistory.bugs = {\r\n\t\t\t/**\r\n\t\t\t * Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call\r\n\t\t\t * https://bugs.webkit.org/show_bug.cgi?id=56249\r\n\t\t\t */\r\n\t\t\tsetHash: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\\/5([0-2]|3[0-3])/.test(navigator.userAgent)),\r\n\r\n\t\t\t/**\r\n\t\t\t * Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions\r\n\t\t\t * https://bugs.webkit.org/show_bug.cgi?id=42940\r\n\t\t\t */\r\n\t\t\tsafariPoll: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\\/5([0-2]|3[0-3])/.test(navigator.userAgent)),\r\n\r\n\t\t\t/**\r\n\t\t\t * MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)\r\n\t\t\t */\r\n\t\t\tieDoubleCheck: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8),\r\n\r\n\t\t\t/**\r\n\t\t\t * MSIE 6 requires the entire hash to be encoded for the hashes to trigger the onHashChange event\r\n\t\t\t */\r\n\t\t\thashEscape: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 7)\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.isEmptyObject(obj)\r\n\t\t * Checks to see if the Object is Empty\r\n\t\t * @param {Object} obj\r\n\t\t * @return {boolean}\r\n\t\t */\r\n\t\tHistory.isEmptyObject = function(obj) {\r\n\t\t\tfor ( var name in obj ) {\r\n\t\t\t\tif ( obj.hasOwnProperty(name) ) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.cloneObject(obj)\r\n\t\t * Clones a object and eliminate all references to the original contexts\r\n\t\t * @param {Object} obj\r\n\t\t * @return {Object}\r\n\t\t */\r\n\t\tHistory.cloneObject = function(obj) {\r\n\t\t\tvar hash,newObj;\r\n\t\t\tif ( obj ) {\r\n\t\t\t\thash = JSON.stringify(obj);\r\n\t\t\t\tnewObj = JSON.parse(hash);\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tnewObj = {};\r\n\t\t\t}\r\n\t\t\treturn newObj;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// URL Helpers\r\n\r\n\t\t/**\r\n\t\t * History.getRootUrl()\r\n\t\t * Turns \"http://mysite.com/dir/page.html?asd\" into \"http://mysite.com\"\r\n\t\t * @return {String} rootUrl\r\n\t\t */\r\n\t\tHistory.getRootUrl = function(){\r\n\t\t\t// Create\r\n\t\t\tvar rootUrl = document.location.protocol+'//'+(document.location.hostname||document.location.host);\r\n\t\t\tif ( document.location.port||false ) {\r\n\t\t\t\trootUrl += ':'+document.location.port;\r\n\t\t\t}\r\n\t\t\trootUrl += '/';\r\n\r\n\t\t\t// Return\r\n\t\t\treturn rootUrl;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getBaseHref()\r\n\t\t * Fetches the `href` attribute of the `<base href=\"...\">` element if it exists\r\n\t\t * @return {String} baseHref\r\n\t\t */\r\n\t\tHistory.getBaseHref = function(){\r\n\t\t\t// Create\r\n\t\t\tvar\r\n\t\t\t\tbaseElements = document.getElementsByTagName('base'),\r\n\t\t\t\tbaseElement = null,\r\n\t\t\t\tbaseHref = '';\r\n\r\n\t\t\t// Test for Base Element\r\n\t\t\tif ( baseElements.length === 1 ) {\r\n\t\t\t\t// Prepare for Base Element\r\n\t\t\t\tbaseElement = baseElements[0];\r\n\t\t\t\tbaseHref = baseElement.href.replace(/[^\\/]+$/,'');\r\n\t\t\t}\r\n\r\n\t\t\t// Adjust trailing slash\r\n\t\t\tbaseHref = baseHref.replace(/\\/+$/,'');\r\n\t\t\tif ( baseHref ) baseHref += '/';\r\n\r\n\t\t\t// Return\r\n\t\t\treturn baseHref;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getBaseUrl()\r\n\t\t * Fetches the baseHref or basePageUrl or rootUrl (whichever one exists first)\r\n\t\t * @return {String} baseUrl\r\n\t\t */\r\n\t\tHistory.getBaseUrl = function(){\r\n\t\t\t// Create\r\n\t\t\tvar baseUrl = History.getBaseHref()||History.getBasePageUrl()||History.getRootUrl();\r\n\r\n\t\t\t// Return\r\n\t\t\treturn baseUrl;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getPageUrl()\r\n\t\t * Fetches the URL of the current page\r\n\t\t * @return {String} pageUrl\r\n\t\t */\r\n\t\tHistory.getPageUrl = function(){\r\n\t\t\t// Fetch\r\n\t\t\tvar\r\n\t\t\t\tState = History.getState(false,false),\r\n\t\t\t\tstateUrl = (State||{}).url||History.getLocationHref(),\r\n\t\t\t\tpageUrl;\r\n\r\n\t\t\t// Create\r\n\t\t\tpageUrl = stateUrl.replace(/\\/+$/,'').replace(/[^\\/]+$/,function(part,index,string){\r\n\t\t\t\treturn (/\\./).test(part) ? part : part+'/';\r\n\t\t\t});\r\n\r\n\t\t\t// Return\r\n\t\t\treturn pageUrl;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getBasePageUrl()\r\n\t\t * Fetches the Url of the directory of the current page\r\n\t\t * @return {String} basePageUrl\r\n\t\t */\r\n\t\tHistory.getBasePageUrl = function(){\r\n\t\t\t// Create\r\n\t\t\tvar basePageUrl = (History.getLocationHref()).replace(/[#\\?].*/,'').replace(/[^\\/]+$/,function(part,index,string){\r\n\t\t\t\treturn (/[^\\/]$/).test(part) ? '' : part;\r\n\t\t\t}).replace(/\\/+$/,'')+'/';\r\n\r\n\t\t\t// Return\r\n\t\t\treturn basePageUrl;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getFullUrl(url)\r\n\t\t * Ensures that we have an absolute URL and not a relative URL\r\n\t\t * @param {string} url\r\n\t\t * @param {Boolean} allowBaseHref\r\n\t\t * @return {string} fullUrl\r\n\t\t */\r\n\t\tHistory.getFullUrl = function(url,allowBaseHref){\r\n\t\t\t// Prepare\r\n\t\t\tvar fullUrl = url, firstChar = url.substring(0,1);\r\n\t\t\tallowBaseHref = (typeof allowBaseHref === 'undefined') ? true : allowBaseHref;\r\n\r\n\t\t\t// Check\r\n\t\t\tif ( /[a-z]+\\:\\/\\//.test(url) ) {\r\n\t\t\t\t// Full URL\r\n\t\t\t}\r\n\t\t\telse if ( firstChar === '/' ) {\r\n\t\t\t\t// Root URL\r\n\t\t\t\tfullUrl = History.getRootUrl()+url.replace(/^\\/+/,'');\r\n\t\t\t}\r\n\t\t\telse if ( firstChar === '#' ) {\r\n\t\t\t\t// Anchor URL\r\n\t\t\t\tfullUrl = History.getPageUrl().replace(/#.*/,'')+url;\r\n\t\t\t}\r\n\t\t\telse if ( firstChar === '?' ) {\r\n\t\t\t\t// Query URL\r\n\t\t\t\tfullUrl = History.getPageUrl().replace(/[\\?#].*/,'')+url;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Relative URL\r\n\t\t\t\tif ( allowBaseHref ) {\r\n\t\t\t\t\tfullUrl = History.getBaseUrl()+url.replace(/^(\\.\\/)+/,'');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tfullUrl = History.getBasePageUrl()+url.replace(/^(\\.\\/)+/,'');\r\n\t\t\t\t}\r\n\t\t\t\t// We have an if condition above as we do not want hashes\r\n\t\t\t\t// which are relative to the baseHref in our URLs\r\n\t\t\t\t// as if the baseHref changes, then all our bookmarks\r\n\t\t\t\t// would now point to different locations\r\n\t\t\t\t// whereas the basePageUrl will always stay the same\r\n\t\t\t}\r\n\r\n\t\t\t// Return\r\n\t\t\treturn fullUrl.replace(/\\#$/,'');\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getShortUrl(url)\r\n\t\t * Ensures that we have a relative URL and not a absolute URL\r\n\t\t * @param {string} url\r\n\t\t * @return {string} url\r\n\t\t */\r\n\t\tHistory.getShortUrl = function(url){\r\n\t\t\t// Prepare\r\n\t\t\tvar shortUrl = url, baseUrl = History.getBaseUrl(), rootUrl = History.getRootUrl();\r\n\r\n\t\t\t// Trim baseUrl\r\n\t\t\tif ( History.emulated.pushState ) {\r\n\t\t\t\t// We are in a if statement as when pushState is not emulated\r\n\t\t\t\t// The actual url these short urls are relative to can change\r\n\t\t\t\t// So within the same session, we the url may end up somewhere different\r\n\t\t\t\tshortUrl = shortUrl.replace(baseUrl,'');\r\n\t\t\t}\r\n\r\n\t\t\t// Trim rootUrl\r\n\t\t\tshortUrl = shortUrl.replace(rootUrl,'/');\r\n\r\n\t\t\t// Ensure we can still detect it as a state\r\n\t\t\tif ( History.isTraditionalAnchor(shortUrl) ) {\r\n\t\t\t\tshortUrl = './'+shortUrl;\r\n\t\t\t}\r\n\r\n\t\t\t// Clean It\r\n\t\t\tshortUrl = shortUrl.replace(/^(\\.\\/)+/g,'./').replace(/\\#$/,'');\r\n\r\n\t\t\t// Return\r\n\t\t\treturn shortUrl;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getLocationHref(document)\r\n\t\t * Returns a normalized version of document.location.href\r\n\t\t * accounting for browser inconsistencies, etc.\r\n\t\t *\r\n\t\t * This URL will be URI-encoded and will include the hash\r\n\t\t *\r\n\t\t * @param {object} document\r\n\t\t * @return {string} url\r\n\t\t */\r\n\t\tHistory.getLocationHref = function(doc) {\r\n\t\t\tdoc = doc || document;\r\n\r\n\t\t\t// most of the time, this will be true\r\n\t\t\tif (doc.URL === doc.location.href)\r\n\t\t\t\treturn doc.location.href;\r\n\r\n\t\t\t// some versions of webkit URI-decode document.location.href\r\n\t\t\t// but they leave document.URL in an encoded state\r\n\t\t\tif (doc.location.href === decodeURIComponent(doc.URL))\r\n\t\t\t\treturn doc.URL;\r\n\r\n\t\t\t// FF 3.6 only updates document.URL when a page is reloaded\r\n\t\t\t// document.location.href is updated correctly\r\n\t\t\tif (doc.location.hash && decodeURIComponent(doc.location.href.replace(/^[^#]+/, \"\")) === doc.location.hash)\r\n\t\t\t\treturn doc.location.href;\r\n\r\n\t\t\tif (doc.URL.indexOf('#') == -1 && doc.location.href.indexOf('#') != -1)\r\n\t\t\t\treturn doc.location.href;\r\n\t\t\t\r\n\t\t\treturn doc.URL || doc.location.href;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// State Storage\r\n\r\n\t\t/**\r\n\t\t * History.store\r\n\t\t * The store for all session specific data\r\n\t\t */\r\n\t\tHistory.store = {};\r\n\r\n\t\t/**\r\n\t\t * History.idToState\r\n\t\t * 1-1: State ID to State Object\r\n\t\t */\r\n\t\tHistory.idToState = History.idToState||{};\r\n\r\n\t\t/**\r\n\t\t * History.stateToId\r\n\t\t * 1-1: State String to State ID\r\n\t\t */\r\n\t\tHistory.stateToId = History.stateToId||{};\r\n\r\n\t\t/**\r\n\t\t * History.urlToId\r\n\t\t * 1-1: State URL to State ID\r\n\t\t */\r\n\t\tHistory.urlToId = History.urlToId||{};\r\n\r\n\t\t/**\r\n\t\t * History.storedStates\r\n\t\t * Store the states in an array\r\n\t\t */\r\n\t\tHistory.storedStates = History.storedStates||[];\r\n\r\n\t\t/**\r\n\t\t * History.savedStates\r\n\t\t * Saved the states in an array\r\n\t\t */\r\n\t\tHistory.savedStates = History.savedStates||[];\r\n\r\n\t\t/**\r\n\t\t * History.noramlizeStore()\r\n\t\t * Noramlize the store by adding necessary values\r\n\t\t */\r\n\t\tHistory.normalizeStore = function(){\r\n\t\t\tHistory.store.idToState = History.store.idToState||{};\r\n\t\t\tHistory.store.urlToId = History.store.urlToId||{};\r\n\t\t\tHistory.store.stateToId = History.store.stateToId||{};\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getState()\r\n\t\t * Get an object containing the data, title and url of the current state\r\n\t\t * @param {Boolean} friendly\r\n\t\t * @param {Boolean} create\r\n\t\t * @return {Object} State\r\n\t\t */\r\n\t\tHistory.getState = function(friendly,create){\r\n\t\t\t// Prepare\r\n\t\t\tif ( typeof friendly === 'undefined' ) { friendly = true; }\r\n\t\t\tif ( typeof create === 'undefined' ) { create = true; }\r\n\r\n\t\t\t// Fetch\r\n\t\t\tvar State = History.getLastSavedState();\r\n\r\n\t\t\t// Create\r\n\t\t\tif ( !State && create ) {\r\n\t\t\t\tState = History.createStateObject();\r\n\t\t\t}\r\n\r\n\t\t\t// Adjust\r\n\t\t\tif ( friendly ) {\r\n\t\t\t\tState = History.cloneObject(State);\r\n\t\t\t\tState.url = State.cleanUrl||State.url;\r\n\t\t\t}\r\n\r\n\t\t\t// Return\r\n\t\t\treturn State;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getIdByState(State)\r\n\t\t * Gets a ID for a State\r\n\t\t * @param {State} newState\r\n\t\t * @return {String} id\r\n\t\t */\r\n\t\tHistory.getIdByState = function(newState){\r\n\r\n\t\t\t// Fetch ID\r\n\t\t\tvar id = History.extractId(newState.url),\r\n\t\t\t\tstr;\r\n\r\n\t\t\tif ( !id ) {\r\n\t\t\t\t// Find ID via State String\r\n\t\t\t\tstr = History.getStateString(newState);\r\n\t\t\t\tif ( typeof History.stateToId[str] !== 'undefined' ) {\r\n\t\t\t\t\tid = History.stateToId[str];\r\n\t\t\t\t}\r\n\t\t\t\telse if ( typeof History.store.stateToId[str] !== 'undefined' ) {\r\n\t\t\t\t\tid = History.store.stateToId[str];\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Generate a new ID\r\n\t\t\t\t\twhile ( true ) {\r\n\t\t\t\t\t\tid = (new Date()).getTime() + String(Math.random()).replace(/\\D/g,'');\r\n\t\t\t\t\t\tif ( typeof History.idToState[id] === 'undefined' && typeof History.store.idToState[id] === 'undefined' ) {\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Apply the new State to the ID\r\n\t\t\t\t\tHistory.stateToId[str] = id;\r\n\t\t\t\t\tHistory.idToState[id] = newState;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Return ID\r\n\t\t\treturn id;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.normalizeState(State)\r\n\t\t * Expands a State Object\r\n\t\t * @param {object} State\r\n\t\t * @return {object}\r\n\t\t */\r\n\t\tHistory.normalizeState = function(oldState){\r\n\t\t\t// Variables\r\n\t\t\tvar newState, dataNotEmpty;\r\n\r\n\t\t\t// Prepare\r\n\t\t\tif ( !oldState || (typeof oldState !== 'object') ) {\r\n\t\t\t\toldState = {};\r\n\t\t\t}\r\n\r\n\t\t\t// Check\r\n\t\t\tif ( typeof oldState.normalized !== 'undefined' ) {\r\n\t\t\t\treturn oldState;\r\n\t\t\t}\r\n\r\n\t\t\t// Adjust\r\n\t\t\tif ( !oldState.data || (typeof oldState.data !== 'object') ) {\r\n\t\t\t\toldState.data = {};\r\n\t\t\t}\r\n\r\n\t\t\t// ----------------------------------------------------------------\r\n\r\n\t\t\t// Create\r\n\t\t\tnewState = {};\r\n\t\t\tnewState.normalized = true;\r\n\t\t\tnewState.title = oldState.title||'';\r\n\t\t\tnewState.url = History.getFullUrl(oldState.url?oldState.url:(History.getLocationHref()));\r\n\t\t\tnewState.hash = History.getShortUrl(newState.url);\r\n\t\t\tnewState.data = History.cloneObject(oldState.data);\r\n\r\n\t\t\t// Fetch ID\r\n\t\t\tnewState.id = History.getIdByState(newState);\r\n\r\n\t\t\t// ----------------------------------------------------------------\r\n\r\n\t\t\t// Clean the URL\r\n\t\t\tnewState.cleanUrl = newState.url.replace(/\\??\\&_suid.*/,'');\r\n\t\t\tnewState.url = newState.cleanUrl;\r\n\r\n\t\t\t// Check to see if we have more than just a url\r\n\t\t\tdataNotEmpty = !History.isEmptyObject(newState.data);\r\n\r\n\t\t\t// Apply\r\n\t\t\tif ( (newState.title || dataNotEmpty) && History.options.disableSuid !== true ) {\r\n\t\t\t\t// Add ID to Hash\r\n\t\t\t\tnewState.hash = History.getShortUrl(newState.url).replace(/\\??\\&_suid.*/,'');\r\n\t\t\t\tif ( !/\\?/.test(newState.hash) ) {\r\n\t\t\t\t\tnewState.hash += '?';\r\n\t\t\t\t}\r\n\t\t\t\tnewState.hash += '&_suid='+newState.id;\r\n\t\t\t}\r\n\r\n\t\t\t// Create the Hashed URL\r\n\t\t\tnewState.hashedUrl = History.getFullUrl(newState.hash);\r\n\r\n\t\t\t// ----------------------------------------------------------------\r\n\r\n\t\t\t// Update the URL if we have a duplicate\r\n\t\t\tif ( (History.emulated.pushState || History.bugs.safariPoll) && History.hasUrlDuplicate(newState) ) {\r\n\t\t\t\tnewState.url = newState.hashedUrl;\r\n\t\t\t}\r\n\r\n\t\t\t// ----------------------------------------------------------------\r\n\r\n\t\t\t// Return\r\n\t\t\treturn newState;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.createStateObject(data,title,url)\r\n\t\t * Creates a object based on the data, title and url state params\r\n\t\t * @param {object} data\r\n\t\t * @param {string} title\r\n\t\t * @param {string} url\r\n\t\t * @return {object}\r\n\t\t */\r\n\t\tHistory.createStateObject = function(data,title,url){\r\n\t\t\t// Hashify\r\n\t\t\tvar State = {\r\n\t\t\t\t'data': data,\r\n\t\t\t\t'title': title,\r\n\t\t\t\t'url': url\r\n\t\t\t};\r\n\r\n\t\t\t// Expand the State\r\n\t\t\tState = History.normalizeState(State);\r\n\r\n\t\t\t// Return object\r\n\t\t\treturn State;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getStateById(id)\r\n\t\t * Get a state by it's UID\r\n\t\t * @param {String} id\r\n\t\t */\r\n\t\tHistory.getStateById = function(id){\r\n\t\t\t// Prepare\r\n\t\t\tid = String(id);\r\n\r\n\t\t\t// Retrieve\r\n\t\t\tvar State = History.idToState[id] || History.store.idToState[id] || undefined;\r\n\r\n\t\t\t// Return State\r\n\t\t\treturn State;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * Get a State's String\r\n\t\t * @param {State} passedState\r\n\t\t */\r\n\t\tHistory.getStateString = function(passedState){\r\n\t\t\t// Prepare\r\n\t\t\tvar State, cleanedState, str;\r\n\r\n\t\t\t// Fetch\r\n\t\t\tState = History.normalizeState(passedState);\r\n\r\n\t\t\t// Clean\r\n\t\t\tcleanedState = {\r\n\t\t\t\tdata: State.data,\r\n\t\t\t\ttitle: passedState.title,\r\n\t\t\t\turl: passedState.url\r\n\t\t\t};\r\n\r\n\t\t\t// Fetch\r\n\t\t\tstr = JSON.stringify(cleanedState);\r\n\r\n\t\t\t// Return\r\n\t\t\treturn str;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * Get a State's ID\r\n\t\t * @param {State} passedState\r\n\t\t * @return {String} id\r\n\t\t */\r\n\t\tHistory.getStateId = function(passedState){\r\n\t\t\t// Prepare\r\n\t\t\tvar State, id;\r\n\r\n\t\t\t// Fetch\r\n\t\t\tState = History.normalizeState(passedState);\r\n\r\n\t\t\t// Fetch\r\n\t\t\tid = State.id;\r\n\r\n\t\t\t// Return\r\n\t\t\treturn id;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getHashByState(State)\r\n\t\t * Creates a Hash for the State Object\r\n\t\t * @param {State} passedState\r\n\t\t * @return {String} hash\r\n\t\t */\r\n\t\tHistory.getHashByState = function(passedState){\r\n\t\t\t// Prepare\r\n\t\t\tvar State, hash;\r\n\r\n\t\t\t// Fetch\r\n\t\t\tState = History.normalizeState(passedState);\r\n\r\n\t\t\t// Hash\r\n\t\t\thash = State.hash;\r\n\r\n\t\t\t// Return\r\n\t\t\treturn hash;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.extractId(url_or_hash)\r\n\t\t * Get a State ID by it's URL or Hash\r\n\t\t * @param {string} url_or_hash\r\n\t\t * @return {string} id\r\n\t\t */\r\n\t\tHistory.extractId = function ( url_or_hash ) {\r\n\t\t\t// Prepare\r\n\t\t\tvar id,parts,url, tmp;\r\n\r\n\t\t\t// Extract\r\n\t\t\t\r\n\t\t\t// If the URL has a #, use the id from before the #\r\n\t\t\tif (url_or_hash.indexOf('#') != -1)\r\n\t\t\t{\r\n\t\t\t\ttmp = url_or_hash.split(\"#\")[0];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\ttmp = url_or_hash;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tparts = /(.*)\\&_suid=([0-9]+)$/.exec(tmp);\r\n\t\t\turl = parts ? (parts[1]||url_or_hash) : url_or_hash;\r\n\t\t\tid = parts ? String(parts[2]||'') : '';\r\n\r\n\t\t\t// Return\r\n\t\t\treturn id||false;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.isTraditionalAnchor\r\n\t\t * Checks to see if the url is a traditional anchor or not\r\n\t\t * @param {String} url_or_hash\r\n\t\t * @return {Boolean}\r\n\t\t */\r\n\t\tHistory.isTraditionalAnchor = function(url_or_hash){\r\n\t\t\t// Check\r\n\t\t\tvar isTraditional = !(/[\\/\\?\\.]/.test(url_or_hash));\r\n\r\n\t\t\t// Return\r\n\t\t\treturn isTraditional;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.extractState\r\n\t\t * Get a State by it's URL or Hash\r\n\t\t * @param {String} url_or_hash\r\n\t\t * @return {State|null}\r\n\t\t */\r\n\t\tHistory.extractState = function(url_or_hash,create){\r\n\t\t\t// Prepare\r\n\t\t\tvar State = null, id, url;\r\n\t\t\tcreate = create||false;\r\n\r\n\t\t\t// Fetch SUID\r\n\t\t\tid = History.extractId(url_or_hash);\r\n\t\t\tif ( id ) {\r\n\t\t\t\tState = History.getStateById(id);\r\n\t\t\t}\r\n\r\n\t\t\t// Fetch SUID returned no State\r\n\t\t\tif ( !State ) {\r\n\t\t\t\t// Fetch URL\r\n\t\t\t\turl = History.getFullUrl(url_or_hash);\r\n\r\n\t\t\t\t// Check URL\r\n\t\t\t\tid = History.getIdByUrl(url)||false;\r\n\t\t\t\tif ( id ) {\r\n\t\t\t\t\tState = History.getStateById(id);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Create State\r\n\t\t\t\tif ( !State && create && !History.isTraditionalAnchor(url_or_hash) ) {\r\n\t\t\t\t\tState = History.createStateObject(null,null,url);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Return\r\n\t\t\treturn State;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getIdByUrl()\r\n\t\t * Get a State ID by a State URL\r\n\t\t */\r\n\t\tHistory.getIdByUrl = function(url){\r\n\t\t\t// Fetch\r\n\t\t\tvar id = History.urlToId[url] || History.store.urlToId[url] || undefined;\r\n\r\n\t\t\t// Return\r\n\t\t\treturn id;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getLastSavedState()\r\n\t\t * Get an object containing the data, title and url of the current state\r\n\t\t * @return {Object} State\r\n\t\t */\r\n\t\tHistory.getLastSavedState = function(){\r\n\t\t\treturn History.savedStates[History.savedStates.length-1]||undefined;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getLastStoredState()\r\n\t\t * Get an object containing the data, title and url of the current state\r\n\t\t * @return {Object} State\r\n\t\t */\r\n\t\tHistory.getLastStoredState = function(){\r\n\t\t\treturn History.storedStates[History.storedStates.length-1]||undefined;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.hasUrlDuplicate\r\n\t\t * Checks if a Url will have a url conflict\r\n\t\t * @param {Object} newState\r\n\t\t * @return {Boolean} hasDuplicate\r\n\t\t */\r\n\t\tHistory.hasUrlDuplicate = function(newState) {\r\n\t\t\t// Prepare\r\n\t\t\tvar hasDuplicate = false,\r\n\t\t\t\toldState;\r\n\r\n\t\t\t// Fetch\r\n\t\t\toldState = History.extractState(newState.url);\r\n\r\n\t\t\t// Check\r\n\t\t\thasDuplicate = oldState && oldState.id !== newState.id;\r\n\r\n\t\t\t// Return\r\n\t\t\treturn hasDuplicate;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.storeState\r\n\t\t * Store a State\r\n\t\t * @param {Object} newState\r\n\t\t * @return {Object} newState\r\n\t\t */\r\n\t\tHistory.storeState = function(newState){\r\n\t\t\t// Store the State\r\n\t\t\tHistory.urlToId[newState.url] = newState.id;\r\n\r\n\t\t\t// Push the State\r\n\t\t\tHistory.storedStates.push(History.cloneObject(newState));\r\n\r\n\t\t\t// Return newState\r\n\t\t\treturn newState;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.isLastSavedState(newState)\r\n\t\t * Tests to see if the state is the last state\r\n\t\t * @param {Object} newState\r\n\t\t * @return {boolean} isLast\r\n\t\t */\r\n\t\tHistory.isLastSavedState = function(newState){\r\n\t\t\t// Prepare\r\n\t\t\tvar isLast = false,\r\n\t\t\t\tnewId, oldState, oldId;\r\n\r\n\t\t\t// Check\r\n\t\t\tif ( History.savedStates.length ) {\r\n\t\t\t\tnewId = newState.id;\r\n\t\t\t\toldState = History.getLastSavedState();\r\n\t\t\t\toldId = oldState.id;\r\n\r\n\t\t\t\t// Check\r\n\t\t\t\tisLast = (newId === oldId);\r\n\t\t\t}\r\n\r\n\t\t\t// Return\r\n\t\t\treturn isLast;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.saveState\r\n\t\t * Push a State\r\n\t\t * @param {Object} newState\r\n\t\t * @return {boolean} changed\r\n\t\t */\r\n\t\tHistory.saveState = function(newState){\r\n\t\t\t// Check Hash\r\n\t\t\tif ( History.isLastSavedState(newState) ) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Push the State\r\n\t\t\tHistory.savedStates.push(History.cloneObject(newState));\r\n\r\n\t\t\t// Return true\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getStateByIndex()\r\n\t\t * Gets a state by the index\r\n\t\t * @param {integer} index\r\n\t\t * @return {Object}\r\n\t\t */\r\n\t\tHistory.getStateByIndex = function(index){\r\n\t\t\t// Prepare\r\n\t\t\tvar State = null;\r\n\r\n\t\t\t// Handle\r\n\t\t\tif ( typeof index === 'undefined' ) {\r\n\t\t\t\t// Get the last inserted\r\n\t\t\t\tState = History.savedStates[History.savedStates.length-1];\r\n\t\t\t}\r\n\t\t\telse if ( index < 0 ) {\r\n\t\t\t\t// Get from the end\r\n\t\t\t\tState = History.savedStates[History.savedStates.length+index];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// Get from the beginning\r\n\t\t\t\tState = History.savedStates[index];\r\n\t\t\t}\r\n\r\n\t\t\t// Return State\r\n\t\t\treturn State;\r\n\t\t};\r\n\t\t\r\n\t\t/**\r\n\t\t * History.getCurrentIndex()\r\n\t\t * Gets the current index\r\n\t\t * @return (integer)\r\n\t\t*/\r\n\t\tHistory.getCurrentIndex = function(){\r\n\t\t\t// Prepare\r\n\t\t\tvar index = null;\r\n\t\t\t\r\n\t\t\t// No states saved\r\n\t\t\tif(History.savedStates.length < 1) {\r\n\t\t\t\tindex = 0;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tindex = History.savedStates.length-1;\r\n\t\t\t}\r\n\t\t\treturn index;\r\n\t\t};\r\n\r\n\t\t// ====================================================================\r\n\t\t// Hash Helpers\r\n\r\n\t\t/**\r\n\t\t * History.getHash()\r\n\t\t * @param {Location=} location\r\n\t\t * Gets the current document hash\r\n\t\t * Note: unlike location.hash, this is guaranteed to return the escaped hash in all browsers\r\n\t\t * @return {string}\r\n\t\t */\r\n\t\tHistory.getHash = function(doc){\r\n\t\t\tvar url = History.getLocationHref(doc),\r\n\t\t\t\thash;\r\n\t\t\thash = History.getHashByUrl(url);\r\n\t\t\treturn hash;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.unescapeHash()\r\n\t\t * normalize and Unescape a Hash\r\n\t\t * @param {String} hash\r\n\t\t * @return {string}\r\n\t\t */\r\n\t\tHistory.unescapeHash = function(hash){\r\n\t\t\t// Prepare\r\n\t\t\tvar result = History.normalizeHash(hash);\r\n\r\n\t\t\t// Unescape hash\r\n\t\t\tresult = decodeURIComponent(result);\r\n\r\n\t\t\t// Return result\r\n\t\t\treturn result;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.normalizeHash()\r\n\t\t * normalize a hash across browsers\r\n\t\t * @return {string}\r\n\t\t */\r\n\t\tHistory.normalizeHash = function(hash){\r\n\t\t\t// Prepare\r\n\t\t\tvar result = hash.replace(/[^#]*#/,'').replace(/#.*/, '');\r\n\r\n\t\t\t// Return result\r\n\t\t\treturn result;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.setHash(hash)\r\n\t\t * Sets the document hash\r\n\t\t * @param {string} hash\r\n\t\t * @return {History}\r\n\t\t */\r\n\t\tHistory.setHash = function(hash,queue){\r\n\t\t\t// Prepare\r\n\t\t\tvar State, pageUrl;\r\n\r\n\t\t\t// Handle Queueing\r\n\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t//History.debug('History.setHash: we must wait', arguments);\r\n\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\tscope: History,\r\n\t\t\t\t\tcallback: History.setHash,\r\n\t\t\t\t\targs: arguments,\r\n\t\t\t\t\tqueue: queue\r\n\t\t\t\t});\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Log\r\n\t\t\t//History.debug('History.setHash: called',hash);\r\n\r\n\t\t\t// Make Busy + Continue\r\n\t\t\tHistory.busy(true);\r\n\r\n\t\t\t// Check if hash is a state\r\n\t\t\tState = History.extractState(hash,true);\r\n\t\t\tif ( State && !History.emulated.pushState ) {\r\n\t\t\t\t// Hash is a state so skip the setHash\r\n\t\t\t\t//History.debug('History.setHash: Hash is a state so skipping the hash set with a direct pushState call',arguments);\r\n\r\n\t\t\t\t// PushState\r\n\t\t\t\tHistory.pushState(State.data,State.title,State.url,false);\r\n\t\t\t}\r\n\t\t\telse if ( History.getHash() !== hash ) {\r\n\t\t\t\t// Hash is a proper hash, so apply it\r\n\r\n\t\t\t\t// Handle browser bugs\r\n\t\t\t\tif ( History.bugs.setHash ) {\r\n\t\t\t\t\t// Fix Safari Bug https://bugs.webkit.org/show_bug.cgi?id=56249\r\n\r\n\t\t\t\t\t// Fetch the base page\r\n\t\t\t\t\tpageUrl = History.getPageUrl();\r\n\r\n\t\t\t\t\t// Safari hash apply\r\n\t\t\t\t\tHistory.pushState(null,null,pageUrl+'#'+hash,false);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Normal hash apply\r\n\t\t\t\t\tdocument.location.hash = hash;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.escape()\r\n\t\t * normalize and Escape a Hash\r\n\t\t * @return {string}\r\n\t\t */\r\n\t\tHistory.escapeHash = function(hash){\r\n\t\t\t// Prepare\r\n\t\t\tvar result = History.normalizeHash(hash);\r\n\r\n\t\t\t// Escape hash\r\n\t\t\tresult = window.encodeURIComponent(result);\r\n\r\n\t\t\t// IE6 Escape Bug\r\n\t\t\tif ( !History.bugs.hashEscape ) {\r\n\t\t\t\t// Restore common parts\r\n\t\t\t\tresult = result\r\n\t\t\t\t\t.replace(/\\%21/g,'!')\r\n\t\t\t\t\t.replace(/\\%26/g,'&')\r\n\t\t\t\t\t.replace(/\\%3D/g,'=')\r\n\t\t\t\t\t.replace(/\\%3F/g,'?');\r\n\t\t\t}\r\n\r\n\t\t\t// Return result\r\n\t\t\treturn result;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.getHashByUrl(url)\r\n\t\t * Extracts the Hash from a URL\r\n\t\t * @param {string} url\r\n\t\t * @return {string} url\r\n\t\t */\r\n\t\tHistory.getHashByUrl = function(url){\r\n\t\t\t// Extract the hash\r\n\t\t\tvar hash = String(url)\r\n\t\t\t\t.replace(/([^#]*)#?([^#]*)#?(.*)/, '$2')\r\n\t\t\t\t;\r\n\r\n\t\t\t// Unescape hash\r\n\t\t\thash = History.unescapeHash(hash);\r\n\r\n\t\t\t// Return hash\r\n\t\t\treturn hash;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.setTitle(title)\r\n\t\t * Applies the title to the document\r\n\t\t * @param {State} newState\r\n\t\t * @return {Boolean}\r\n\t\t */\r\n\t\tHistory.setTitle = function(newState){\r\n\t\t\t// Prepare\r\n\t\t\tvar title = newState.title,\r\n\t\t\t\tfirstState;\r\n\r\n\t\t\t// Initial\r\n\t\t\tif ( !title ) {\r\n\t\t\t\tfirstState = History.getStateByIndex(0);\r\n\t\t\t\tif ( firstState && firstState.url === newState.url ) {\r\n\t\t\t\t\ttitle = firstState.title||History.options.initialTitle;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Apply\r\n\t\t\ttry {\r\n\t\t\t\tdocument.getElementsByTagName('title')[0].innerHTML = title.replace('<','<').replace('>','>').replace(' & ',' & ');\r\n\t\t\t}\r\n\t\t\tcatch ( Exception ) { }\r\n\t\t\tdocument.title = title;\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Queueing\r\n\r\n\t\t/**\r\n\t\t * History.queues\r\n\t\t * The list of queues to use\r\n\t\t * First In, First Out\r\n\t\t */\r\n\t\tHistory.queues = [];\r\n\r\n\t\t/**\r\n\t\t * History.busy(value)\r\n\t\t * @param {boolean} value [optional]\r\n\t\t * @return {boolean} busy\r\n\t\t */\r\n\t\tHistory.busy = function(value){\r\n\t\t\t// Apply\r\n\t\t\tif ( typeof value !== 'undefined' ) {\r\n\t\t\t\t//History.debug('History.busy: changing ['+(History.busy.flag||false)+'] to ['+(value||false)+']', History.queues.length);\r\n\t\t\t\tHistory.busy.flag = value;\r\n\t\t\t}\r\n\t\t\t// Default\r\n\t\t\telse if ( typeof History.busy.flag === 'undefined' ) {\r\n\t\t\t\tHistory.busy.flag = false;\r\n\t\t\t}\r\n\r\n\t\t\t// Queue\r\n\t\t\tif ( !History.busy.flag ) {\r\n\t\t\t\t// Execute the next item in the queue\r\n\t\t\t\tclearTimeout(History.busy.timeout);\r\n\t\t\t\tvar fireNext = function(){\r\n\t\t\t\t\tvar i, queue, item;\r\n\t\t\t\t\tif ( History.busy.flag ) return;\r\n\t\t\t\t\tfor ( i=History.queues.length-1; i >= 0; --i ) {\r\n\t\t\t\t\t\tqueue = History.queues[i];\r\n\t\t\t\t\t\tif ( queue.length === 0 ) continue;\r\n\t\t\t\t\t\titem = queue.shift();\r\n\t\t\t\t\t\tHistory.fireQueueItem(item);\r\n\t\t\t\t\t\tHistory.busy.timeout = setTimeout(fireNext,History.options.busyDelay);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\tHistory.busy.timeout = setTimeout(fireNext,History.options.busyDelay);\r\n\t\t\t}\r\n\r\n\t\t\t// Return\r\n\t\t\treturn History.busy.flag;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.busy.flag\r\n\t\t */\r\n\t\tHistory.busy.flag = false;\r\n\r\n\t\t/**\r\n\t\t * History.fireQueueItem(item)\r\n\t\t * Fire a Queue Item\r\n\t\t * @param {Object} item\r\n\t\t * @return {Mixed} result\r\n\t\t */\r\n\t\tHistory.fireQueueItem = function(item){\r\n\t\t\treturn item.callback.apply(item.scope||History,item.args||[]);\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.pushQueue(callback,args)\r\n\t\t * Add an item to the queue\r\n\t\t * @param {Object} item [scope,callback,args,queue]\r\n\t\t */\r\n\t\tHistory.pushQueue = function(item){\r\n\t\t\t// Prepare the queue\r\n\t\t\tHistory.queues[item.queue||0] = History.queues[item.queue||0]||[];\r\n\r\n\t\t\t// Add to the queue\r\n\t\t\tHistory.queues[item.queue||0].push(item);\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.queue (item,queue), (func,queue), (func), (item)\r\n\t\t * Either firs the item now if not busy, or adds it to the queue\r\n\t\t */\r\n\t\tHistory.queue = function(item,queue){\r\n\t\t\t// Prepare\r\n\t\t\tif ( typeof item === 'function' ) {\r\n\t\t\t\titem = {\r\n\t\t\t\t\tcallback: item\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\tif ( typeof queue !== 'undefined' ) {\r\n\t\t\t\titem.queue = queue;\r\n\t\t\t}\r\n\r\n\t\t\t// Handle\r\n\t\t\tif ( History.busy() ) {\r\n\t\t\t\tHistory.pushQueue(item);\r\n\t\t\t} else {\r\n\t\t\t\tHistory.fireQueueItem(item);\r\n\t\t\t}\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.clearQueue()\r\n\t\t * Clears the Queue\r\n\t\t */\r\n\t\tHistory.clearQueue = function(){\r\n\t\t\tHistory.busy.flag = false;\r\n\t\t\tHistory.queues = [];\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// IE Bug Fix\r\n\r\n\t\t/**\r\n\t\t * History.stateChanged\r\n\t\t * States whether or not the state has changed since the last double check was initialised\r\n\t\t */\r\n\t\tHistory.stateChanged = false;\r\n\r\n\t\t/**\r\n\t\t * History.doubleChecker\r\n\t\t * Contains the timeout used for the double checks\r\n\t\t */\r\n\t\tHistory.doubleChecker = false;\r\n\r\n\t\t/**\r\n\t\t * History.doubleCheckComplete()\r\n\t\t * Complete a double check\r\n\t\t * @return {History}\r\n\t\t */\r\n\t\tHistory.doubleCheckComplete = function(){\r\n\t\t\t// Update\r\n\t\t\tHistory.stateChanged = true;\r\n\r\n\t\t\t// Clear\r\n\t\t\tHistory.doubleCheckClear();\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.doubleCheckClear()\r\n\t\t * Clear a double check\r\n\t\t * @return {History}\r\n\t\t */\r\n\t\tHistory.doubleCheckClear = function(){\r\n\t\t\t// Clear\r\n\t\t\tif ( History.doubleChecker ) {\r\n\t\t\t\tclearTimeout(History.doubleChecker);\r\n\t\t\t\tHistory.doubleChecker = false;\r\n\t\t\t}\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.doubleCheck()\r\n\t\t * Create a double check\r\n\t\t * @return {History}\r\n\t\t */\r\n\t\tHistory.doubleCheck = function(tryAgain){\r\n\t\t\t// Reset\r\n\t\t\tHistory.stateChanged = false;\r\n\t\t\tHistory.doubleCheckClear();\r\n\r\n\t\t\t// Fix IE6,IE7 bug where calling history.back or history.forward does not actually change the hash (whereas doing it manually does)\r\n\t\t\t// Fix Safari 5 bug where sometimes the state does not change: https://bugs.webkit.org/show_bug.cgi?id=42940\r\n\t\t\tif ( History.bugs.ieDoubleCheck ) {\r\n\t\t\t\t// Apply Check\r\n\t\t\t\tHistory.doubleChecker = setTimeout(\r\n\t\t\t\t\tfunction(){\r\n\t\t\t\t\t\tHistory.doubleCheckClear();\r\n\t\t\t\t\t\tif ( !History.stateChanged ) {\r\n\t\t\t\t\t\t\t//History.debug('History.doubleCheck: State has not yet changed, trying again', arguments);\r\n\t\t\t\t\t\t\t// Re-Attempt\r\n\t\t\t\t\t\t\ttryAgain();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t},\r\n\t\t\t\t\tHistory.options.doubleCheckInterval\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Safari Bug Fix\r\n\r\n\t\t/**\r\n\t\t * History.safariStatePoll()\r\n\t\t * Poll the current state\r\n\t\t * @return {History}\r\n\t\t */\r\n\t\tHistory.safariStatePoll = function(){\r\n\t\t\t// Poll the URL\r\n\r\n\t\t\t// Get the Last State which has the new URL\r\n\t\t\tvar\r\n\t\t\t\turlState = History.extractState(History.getLocationHref()),\r\n\t\t\t\tnewState;\r\n\r\n\t\t\t// Check for a difference\r\n\t\t\tif ( !History.isLastSavedState(urlState) ) {\r\n\t\t\t\tnewState = urlState;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Check if we have a state with that url\r\n\t\t\t// If not create it\r\n\t\t\tif ( !newState ) {\r\n\t\t\t\t//History.debug('History.safariStatePoll: new');\r\n\t\t\t\tnewState = History.createStateObject();\r\n\t\t\t}\r\n\r\n\t\t\t// Apply the New State\r\n\t\t\t//History.debug('History.safariStatePoll: trigger');\r\n\t\t\tHistory.Adapter.trigger(window,'popstate');\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// State Aliases\r\n\r\n\t\t/**\r\n\t\t * History.back(queue)\r\n\t\t * Send the browser history back one item\r\n\t\t * @param {Integer} queue [optional]\r\n\t\t */\r\n\t\tHistory.back = function(queue){\r\n\t\t\t//History.debug('History.back: called', arguments);\r\n\r\n\t\t\t// Handle Queueing\r\n\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t//History.debug('History.back: we must wait', arguments);\r\n\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\tscope: History,\r\n\t\t\t\t\tcallback: History.back,\r\n\t\t\t\t\targs: arguments,\r\n\t\t\t\t\tqueue: queue\r\n\t\t\t\t});\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Make Busy + Continue\r\n\t\t\tHistory.busy(true);\r\n\r\n\t\t\t// Fix certain browser bugs that prevent the state from changing\r\n\t\t\tHistory.doubleCheck(function(){\r\n\t\t\t\tHistory.back(false);\r\n\t\t\t});\r\n\r\n\t\t\t// Go back\r\n\t\t\thistory.go(-1);\r\n\r\n\t\t\t// End back closure\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.forward(queue)\r\n\t\t * Send the browser history forward one item\r\n\t\t * @param {Integer} queue [optional]\r\n\t\t */\r\n\t\tHistory.forward = function(queue){\r\n\t\t\t//History.debug('History.forward: called', arguments);\r\n\r\n\t\t\t// Handle Queueing\r\n\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t//History.debug('History.forward: we must wait', arguments);\r\n\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\tscope: History,\r\n\t\t\t\t\tcallback: History.forward,\r\n\t\t\t\t\targs: arguments,\r\n\t\t\t\t\tqueue: queue\r\n\t\t\t\t});\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\t// Make Busy + Continue\r\n\t\t\tHistory.busy(true);\r\n\r\n\t\t\t// Fix certain browser bugs that prevent the state from changing\r\n\t\t\tHistory.doubleCheck(function(){\r\n\t\t\t\tHistory.forward(false);\r\n\t\t\t});\r\n\r\n\t\t\t// Go forward\r\n\t\t\thistory.go(1);\r\n\r\n\t\t\t// End forward closure\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t\t/**\r\n\t\t * History.go(index,queue)\r\n\t\t * Send the browser history back or forward index times\r\n\t\t * @param {Integer} queue [optional]\r\n\t\t */\r\n\t\tHistory.go = function(index,queue){\r\n\t\t\t//History.debug('History.go: called', arguments);\r\n\r\n\t\t\t// Prepare\r\n\t\t\tvar i;\r\n\r\n\t\t\t// Handle\r\n\t\t\tif ( index > 0 ) {\r\n\t\t\t\t// Forward\r\n\t\t\t\tfor ( i=1; i<=index; ++i ) {\r\n\t\t\t\t\tHistory.forward(queue);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if ( index < 0 ) {\r\n\t\t\t\t// Backward\r\n\t\t\t\tfor ( i=-1; i>=index; --i ) {\r\n\t\t\t\t\tHistory.back(queue);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthrow new Error('History.go: History.go requires a positive or negative integer passed.');\r\n\t\t\t}\r\n\r\n\t\t\t// Chain\r\n\t\t\treturn History;\r\n\t\t};\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// HTML5 State Support\r\n\r\n\t\t// Non-Native pushState Implementation\r\n\t\tif ( History.emulated.pushState ) {\r\n\t\t\t/*\r\n\t\t\t * Provide Skeleton for HTML4 Browsers\r\n\t\t\t */\r\n\r\n\t\t\t// Prepare\r\n\t\t\tvar emptyFunction = function(){};\r\n\t\t\tHistory.pushState = History.pushState||emptyFunction;\r\n\t\t\tHistory.replaceState = History.replaceState||emptyFunction;\r\n\t\t} // History.emulated.pushState\r\n\r\n\t\t// Native pushState Implementation\r\n\t\telse {\r\n\t\t\t/*\r\n\t\t\t * Use native HTML5 History API Implementation\r\n\t\t\t */\r\n\r\n\t\t\t/**\r\n\t\t\t * History.onPopState(event,extra)\r\n\t\t\t * Refresh the Current State\r\n\t\t\t */\r\n\t\t\tHistory.onPopState = function(event,extra){\r\n\t\t\t\t// Prepare\r\n\t\t\t\tvar stateId = false, newState = false, currentHash, currentState;\r\n\r\n\t\t\t\t// Reset the double check\r\n\t\t\t\tHistory.doubleCheckComplete();\r\n\r\n\t\t\t\t// Check for a Hash, and handle apporiatly\r\n\t\t\t\tcurrentHash = History.getHash();\r\n\t\t\t\tif ( currentHash ) {\r\n\t\t\t\t\t// Expand Hash\r\n\t\t\t\t\tcurrentState = History.extractState(currentHash||History.getLocationHref(),true);\r\n\t\t\t\t\tif ( currentState ) {\r\n\t\t\t\t\t\t// We were able to parse it, it must be a State!\r\n\t\t\t\t\t\t// Let's forward to replaceState\r\n\t\t\t\t\t\t//History.debug('History.onPopState: state anchor', currentHash, currentState);\r\n\t\t\t\t\t\tHistory.replaceState(currentState.data, currentState.title, currentState.url, false);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t// Traditional Anchor\r\n\t\t\t\t\t\t//History.debug('History.onPopState: traditional anchor', currentHash);\r\n\t\t\t\t\t\tHistory.Adapter.trigger(window,'anchorchange');\r\n\t\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// We don't care for hashes\r\n\t\t\t\t\tHistory.expectedStateId = false;\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Ensure\r\n\t\t\t\tstateId = History.Adapter.extractEventData('state',event,extra) || false;\r\n\r\n\t\t\t\t// Fetch State\r\n\t\t\t\tif ( stateId ) {\r\n\t\t\t\t\t// Vanilla: Back/forward button was used\r\n\t\t\t\t\tnewState = History.getStateById(stateId);\r\n\t\t\t\t}\r\n\t\t\t\telse if ( History.expectedStateId ) {\r\n\t\t\t\t\t// Vanilla: A new state was pushed, and popstate was called manually\r\n\t\t\t\t\tnewState = History.getStateById(History.expectedStateId);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Initial State\r\n\t\t\t\t\tnewState = History.extractState(History.getLocationHref());\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// The State did not exist in our store\r\n\t\t\t\tif ( !newState ) {\r\n\t\t\t\t\t// Regenerate the State\r\n\t\t\t\t\tnewState = History.createStateObject(null,null,History.getLocationHref());\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Clean\r\n\t\t\t\tHistory.expectedStateId = false;\r\n\r\n\t\t\t\t// Check if we are the same state\r\n\t\t\t\tif ( History.isLastSavedState(newState) ) {\r\n\t\t\t\t\t// There has been no change (just the page's hash has finally propagated)\r\n\t\t\t\t\t//History.debug('History.onPopState: no change', newState, History.savedStates);\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Store the State\r\n\t\t\t\tHistory.storeState(newState);\r\n\t\t\t\tHistory.saveState(newState);\r\n\r\n\t\t\t\t// Force update of the title\r\n\t\t\t\tHistory.setTitle(newState);\r\n\r\n\t\t\t\t// Fire Our Event\r\n\t\t\t\tHistory.Adapter.trigger(window,'statechange');\r\n\t\t\t\tHistory.busy(false);\r\n\r\n\t\t\t\t// Return true\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\t\t\tHistory.Adapter.bind(window,'popstate',History.onPopState);\r\n\r\n\t\t\t/**\r\n\t\t\t * History.pushState(data,title,url)\r\n\t\t\t * Add a new State to the history object, become it, and trigger onpopstate\r\n\t\t\t * We have to trigger for HTML4 compatibility\r\n\t\t\t * @param {object} data\r\n\t\t\t * @param {string} title\r\n\t\t\t * @param {string} url\r\n\t\t\t * @return {true}\r\n\t\t\t */\r\n\t\t\tHistory.pushState = function(data,title,url,queue){\r\n\t\t\t\t//History.debug('History.pushState: called', arguments);\r\n\r\n\t\t\t\t// Check the State\r\n\t\t\t\tif ( History.getHashByUrl(url) && History.emulated.pushState ) {\r\n\t\t\t\t\tthrow new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Handle Queueing\r\n\t\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t\t//History.debug('History.pushState: we must wait', arguments);\r\n\t\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\t\tscope: History,\r\n\t\t\t\t\t\tcallback: History.pushState,\r\n\t\t\t\t\t\targs: arguments,\r\n\t\t\t\t\t\tqueue: queue\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Make Busy + Continue\r\n\t\t\t\tHistory.busy(true);\r\n\r\n\t\t\t\t// Create the newState\r\n\t\t\t\tvar newState = History.createStateObject(data,title,url);\r\n\r\n\t\t\t\t// Check it\r\n\t\t\t\tif ( History.isLastSavedState(newState) ) {\r\n\t\t\t\t\t// Won't be a change\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Store the newState\r\n\t\t\t\t\tHistory.storeState(newState);\r\n\t\t\t\t\tHistory.expectedStateId = newState.id;\r\n\r\n\t\t\t\t\t// Push the newState\r\n\t\t\t\t\thistory.pushState(newState.id,newState.title,newState.url);\r\n\r\n\t\t\t\t\t// Fire HTML5 Event\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'popstate');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// End pushState closure\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\r\n\t\t\t/**\r\n\t\t\t * History.replaceState(data,title,url)\r\n\t\t\t * Replace the State and trigger onpopstate\r\n\t\t\t * We have to trigger for HTML4 compatibility\r\n\t\t\t * @param {object} data\r\n\t\t\t * @param {string} title\r\n\t\t\t * @param {string} url\r\n\t\t\t * @return {true}\r\n\t\t\t */\r\n\t\t\tHistory.replaceState = function(data,title,url,queue){\r\n\t\t\t\t//History.debug('History.replaceState: called', arguments);\r\n\r\n\t\t\t\t// Check the State\r\n\t\t\t\tif ( History.getHashByUrl(url) && History.emulated.pushState ) {\r\n\t\t\t\t\tthrow new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Handle Queueing\r\n\t\t\t\tif ( queue !== false && History.busy() ) {\r\n\t\t\t\t\t// Wait + Push to Queue\r\n\t\t\t\t\t//History.debug('History.replaceState: we must wait', arguments);\r\n\t\t\t\t\tHistory.pushQueue({\r\n\t\t\t\t\t\tscope: History,\r\n\t\t\t\t\t\tcallback: History.replaceState,\r\n\t\t\t\t\t\targs: arguments,\r\n\t\t\t\t\t\tqueue: queue\r\n\t\t\t\t\t});\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Make Busy + Continue\r\n\t\t\t\tHistory.busy(true);\r\n\r\n\t\t\t\t// Create the newState\r\n\t\t\t\tvar newState = History.createStateObject(data,title,url);\r\n\r\n\t\t\t\t// Check it\r\n\t\t\t\tif ( History.isLastSavedState(newState) ) {\r\n\t\t\t\t\t// Won't be a change\r\n\t\t\t\t\tHistory.busy(false);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// Store the newState\r\n\t\t\t\t\tHistory.storeState(newState);\r\n\t\t\t\t\tHistory.expectedStateId = newState.id;\r\n\r\n\t\t\t\t\t// Push the newState\r\n\t\t\t\t\thistory.replaceState(newState.id,newState.title,newState.url);\r\n\r\n\t\t\t\t\t// Fire HTML5 Event\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'popstate');\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// End replaceState closure\r\n\t\t\t\treturn true;\r\n\t\t\t};\r\n\r\n\t\t} // !History.emulated.pushState\r\n\r\n\r\n\t\t// ====================================================================\r\n\t\t// Initialise\r\n\r\n\t\t/**\r\n\t\t * Load the Store\r\n\t\t */\r\n\t\tif ( sessionStorage ) {\r\n\t\t\t// Fetch\r\n\t\t\ttry {\r\n\t\t\t\tHistory.store = JSON.parse(sessionStorage.getItem('History.store'))||{};\r\n\t\t\t}\r\n\t\t\tcatch ( err ) {\r\n\t\t\t\tHistory.store = {};\r\n\t\t\t}\r\n\r\n\t\t\t// Normalize\r\n\t\t\tHistory.normalizeStore();\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// Default Load\r\n\t\t\tHistory.store = {};\r\n\t\t\tHistory.normalizeStore();\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Clear Intervals on exit to prevent memory leaks\r\n\t\t */\r\n\t\tHistory.Adapter.bind(window,\"unload\",History.clearAllIntervals);\r\n\r\n\t\t/**\r\n\t\t * Create the initial State\r\n\t\t */\r\n\t\tHistory.saveState(History.storeState(History.extractState(History.getLocationHref(),true)));\r\n\r\n\t\t/**\r\n\t\t * Bind for Saving Store\r\n\t\t */\r\n\t\tif ( sessionStorage ) {\r\n\t\t\t// When the page is closed\r\n\t\t\tHistory.onUnload = function(){\r\n\t\t\t\t// Prepare\r\n\t\t\t\tvar\tcurrentStore, item, currentStoreString;\r\n\r\n\t\t\t\t// Fetch\r\n\t\t\t\ttry {\r\n\t\t\t\t\tcurrentStore = JSON.parse(sessionStorage.getItem('History.store'))||{};\r\n\t\t\t\t}\r\n\t\t\t\tcatch ( err ) {\r\n\t\t\t\t\tcurrentStore = {};\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Ensure\r\n\t\t\t\tcurrentStore.idToState = currentStore.idToState || {};\r\n\t\t\t\tcurrentStore.urlToId = currentStore.urlToId || {};\r\n\t\t\t\tcurrentStore.stateToId = currentStore.stateToId || {};\r\n\r\n\t\t\t\t// Sync\r\n\t\t\t\tfor ( item in History.idToState ) {\r\n\t\t\t\t\tif ( !History.idToState.hasOwnProperty(item) ) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcurrentStore.idToState[item] = History.idToState[item];\r\n\t\t\t\t}\r\n\t\t\t\tfor ( item in History.urlToId ) {\r\n\t\t\t\t\tif ( !History.urlToId.hasOwnProperty(item) ) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcurrentStore.urlToId[item] = History.urlToId[item];\r\n\t\t\t\t}\r\n\t\t\t\tfor ( item in History.stateToId ) {\r\n\t\t\t\t\tif ( !History.stateToId.hasOwnProperty(item) ) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcurrentStore.stateToId[item] = History.stateToId[item];\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Update\r\n\t\t\t\tHistory.store = currentStore;\r\n\t\t\t\tHistory.normalizeStore();\r\n\r\n\t\t\t\t// In Safari, going into Private Browsing mode causes the\r\n\t\t\t\t// Session Storage object to still exist but if you try and use\r\n\t\t\t\t// or set any property/function of it it throws the exception\r\n\t\t\t\t// \"QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to\r\n\t\t\t\t// add something to storage that exceeded the quota.\" infinitely\r\n\t\t\t\t// every second.\r\n\t\t\t\tcurrentStoreString = JSON.stringify(currentStore);\r\n\t\t\t\ttry {\r\n\t\t\t\t\t// Store\r\n\t\t\t\t\tsessionStorage.setItem('History.store', currentStoreString);\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e) {\r\n\t\t\t\t\tif (e.code === DOMException.QUOTA_EXCEEDED_ERR) {\r\n\t\t\t\t\t\tif (sessionStorage.length) {\r\n\t\t\t\t\t\t\t// Workaround for a bug seen on iPads. Sometimes the quota exceeded error comes up and simply\r\n\t\t\t\t\t\t\t// removing/resetting the storage can work.\r\n\t\t\t\t\t\t\tsessionStorage.removeItem('History.store');\r\n\t\t\t\t\t\t\tsessionStorage.setItem('History.store', currentStoreString);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// Otherwise, we're probably private browsing in Safari, so we'll ignore the exception.\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tthrow e;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\t// For Internet Explorer\r\n\t\t\tHistory.intervalList.push(setInterval(History.onUnload,History.options.storeInterval));\r\n\r\n\t\t\t// For Other Browsers\r\n\t\t\tHistory.Adapter.bind(window,'beforeunload',History.onUnload);\r\n\t\t\tHistory.Adapter.bind(window,'unload',History.onUnload);\r\n\r\n\t\t\t// Both are enabled for consistency\r\n\t\t}\r\n\r\n\t\t// Non-Native pushState Implementation\r\n\t\tif ( !History.emulated.pushState ) {\r\n\t\t\t// Be aware, the following is only for native pushState implementations\r\n\t\t\t// If you are wanting to include something for all browsers\r\n\t\t\t// Then include it above this if block\r\n\r\n\t\t\t/**\r\n\t\t\t * Setup Safari Fix\r\n\t\t\t */\r\n\t\t\tif ( History.bugs.safariPoll ) {\r\n\t\t\t\tHistory.intervalList.push(setInterval(History.safariStatePoll, History.options.safariPollInterval));\r\n\t\t\t}\r\n\r\n\t\t\t/**\r\n\t\t\t * Ensure Cross Browser Compatibility\r\n\t\t\t */\r\n\t\t\tif ( navigator.vendor === 'Apple Computer, Inc.' || (navigator.appCodeName||'') === 'Mozilla' ) {\r\n\t\t\t\t/**\r\n\t\t\t\t * Fix Safari HashChange Issue\r\n\t\t\t\t */\r\n\r\n\t\t\t\t// Setup Alias\r\n\t\t\t\tHistory.Adapter.bind(window,'hashchange',function(){\r\n\t\t\t\t\tHistory.Adapter.trigger(window,'popstate');\r\n\t\t\t\t});\r\n\r\n\t\t\t\t// Initialise Alias\r\n\t\t\t\tif ( History.getHash() ) {\r\n\t\t\t\t\tHistory.Adapter.onDomLoad(function(){\r\n\t\t\t\t\t\tHistory.Adapter.trigger(window,'hashchange');\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t} // !History.emulated.pushState\r\n\r\n\r\n\t}; // History.initCore\r\n\r\n\t// Try to Initialise History\r\n\tif (!History.options || !History.options.delayInit) {\r\n\t\tHistory.init();\r\n\t}\r\n\r\n})(window);\r\n"]}