10 __coverage__['build/history-hash/history-hash.js'] = {"path":"build/history-hash/history-hash.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0,0,0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":43}}},"2":{"name":"HistoryHash","line":33,"loc":{"start":{"line":33,"column":0},"end":{"line":33,"column":23}}},"3":{"name":"(anonymous_3)","line":39,"loc":{"start":{"line":39,"column":11},"end":{"line":39,"column":29}}},"4":{"name":"(anonymous_4)","line":57,"loc":{"start":{"line":57,"column":13},"end":{"line":57,"column":44}}},"5":{"name":"(anonymous_5)","line":60,"loc":{"start":{"line":60,"column":28},"end":{"line":60,"column":50}}},"6":{"name":"(anonymous_6)","line":69,"loc":{"start":{"line":69,"column":17},"end":{"line":69,"column":42}}},"7":{"name":"(anonymous_7)","line":96,"loc":{"start":{"line":96,"column":22},"end":{"line":96,"column":35}}},"8":{"name":"(anonymous_8)","line":161,"loc":{"start":{"line":161,"column":16},"end":{"line":161,"column":34}}},"9":{"name":"(anonymous_9)","line":165,"loc":{"start":{"line":165,"column":29},"end":{"line":165,"column":51}}},"10":{"name":"(anonymous_10)","line":183,"loc":{"start":{"line":183,"column":12},"end":{"line":183,"column":30}}},"11":{"name":"(anonymous_11)","line":196,"loc":{"start":{"line":196,"column":12},"end":{"line":196,"column":30}}},"12":{"name":"(anonymous_12)","line":208,"loc":{"start":{"line":208,"column":27},"end":{"line":208,"column":39}}},"13":{"name":"(anonymous_13)","line":221,"loc":{"start":{"line":221,"column":8},"end":{"line":221,"column":20}}},"14":{"name":"(anonymous_14)","line":241,"loc":{"start":{"line":241,"column":12},"end":{"line":241,"column":24}}},"15":{"name":"(anonymous_15)","line":255,"loc":{"start":{"line":255,"column":15},"end":{"line":255,"column":31}}},"16":{"name":"(anonymous_16)","line":303,"loc":{"start":{"line":303,"column":17},"end":{"line":303,"column":33}}},"17":{"name":"(anonymous_17)","line":322,"loc":{"start":{"line":322,"column":13},"end":{"line":322,"column":29}}},"18":{"name":"(anonymous_18)","line":391,"loc":{"start":{"line":391,"column":8},"end":{"line":391,"column":46}}},"19":{"name":"(anonymous_19)","line":401,"loc":{"start":{"line":401,"column":12},"end":{"line":401,"column":50}}},"20":{"name":"(anonymous_20)","line":417,"loc":{"start":{"line":417,"column":61},"end":{"line":417,"column":74}}},"21":{"name":"(anonymous_21)","line":423,"loc":{"start":{"line":423,"column":48},"end":{"line":423,"column":68}}},"22":{"name":"(anonymous_22)","line":441,"loc":{"start":{"line":441,"column":48},"end":{"line":441,"column":60}}},"23":{"name":"(anonymous_23)","line":458,"loc":{"start":{"line":458,"column":52},"end":{"line":458,"column":72}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":475,"column":77}},"2":{"start":{"line":19,"column":0},"end":{"line":31,"column":47}},"3":{"start":{"line":33,"column":0},"end":{"line":35,"column":1}},"4":{"start":{"line":34,"column":4},"end":{"line":34,"column":62}},"5":{"start":{"line":37,"column":0},"end":{"line":331,"column":3}},"6":{"start":{"line":40,"column":8},"end":{"line":40,"column":54}},"7":{"start":{"line":44,"column":8},"end":{"line":44,"column":30}},"8":{"start":{"line":46,"column":8},"end":{"line":47,"column":80}},"9":{"start":{"line":51,"column":8},"end":{"line":51,"column":72}},"10":{"start":{"line":53,"column":8},"end":{"line":53,"column":60}},"11":{"start":{"line":60,"column":8},"end":{"line":64,"column":11}},"12":{"start":{"line":61,"column":12},"end":{"line":63,"column":13}},"13":{"start":{"line":62,"column":16},"end":{"line":62,"column":46}},"14":{"start":{"line":66,"column":8},"end":{"line":66,"column":78}},"15":{"start":{"line":70,"column":8},"end":{"line":71,"column":55}},"16":{"start":{"line":73,"column":8},"end":{"line":73,"column":66}},"17":{"start":{"line":82,"column":8},"end":{"line":84,"column":9}},"18":{"start":{"line":83,"column":12},"end":{"line":83,"column":94}},"19":{"start":{"line":97,"column":8},"end":{"line":97,"column":77}},"20":{"start":{"line":162,"column":8},"end":{"line":163,"column":24}},"21":{"start":{"line":165,"column":8},"end":{"line":169,"column":11}},"22":{"start":{"line":166,"column":12},"end":{"line":168,"column":13}},"23":{"start":{"line":167,"column":16},"end":{"line":167,"column":61}},"24":{"start":{"line":171,"column":8},"end":{"line":171,"column":30}},"25":{"start":{"line":184,"column":8},"end":{"line":184,"column":62}},"26":{"start":{"line":197,"column":8},"end":{"line":197,"column":63}},"27":{"start":{"line":214,"column":8},"end":{"line":217,"column":46}},"28":{"start":{"line":219,"column":8},"end":{"line":220,"column":52}},"29":{"start":{"line":222,"column":8},"end":{"line":224,"column":46}},"30":{"start":{"line":230,"column":8},"end":{"line":231,"column":52}},"31":{"start":{"line":242,"column":8},"end":{"line":242,"column":29}},"32":{"start":{"line":256,"column":8},"end":{"line":264,"column":24}},"33":{"start":{"line":266,"column":8},"end":{"line":266,"column":65}},"34":{"start":{"line":268,"column":8},"end":{"line":274,"column":9}},"35":{"start":{"line":269,"column":12},"end":{"line":269,"column":47}},"36":{"start":{"line":271,"column":12},"end":{"line":273,"column":13}},"37":{"start":{"line":272,"column":16},"end":{"line":272,"column":48}},"38":{"start":{"line":276,"column":8},"end":{"line":276,"column":60}},"39":{"start":{"line":278,"column":8},"end":{"line":288,"column":9}},"40":{"start":{"line":279,"column":12},"end":{"line":279,"column":31}},"41":{"start":{"line":281,"column":12},"end":{"line":281,"column":37}},"42":{"start":{"line":283,"column":12},"end":{"line":287,"column":13}},"43":{"start":{"line":284,"column":16},"end":{"line":284,"column":60}},"44":{"start":{"line":286,"column":16},"end":{"line":286,"column":43}},"45":{"start":{"line":290,"column":8},"end":{"line":290,"column":22}},"46":{"start":{"line":304,"column":8},"end":{"line":305,"column":57}},"47":{"start":{"line":307,"column":8},"end":{"line":309,"column":9}},"48":{"start":{"line":308,"column":12},"end":{"line":308,"column":37}},"49":{"start":{"line":311,"column":8},"end":{"line":311,"column":77}},"50":{"start":{"line":323,"column":8},"end":{"line":323,"column":39}},"51":{"start":{"line":325,"column":8},"end":{"line":327,"column":9}},"52":{"start":{"line":326,"column":12},"end":{"line":326,"column":37}},"53":{"start":{"line":329,"column":8},"end":{"line":329,"column":62}},"54":{"start":{"line":384,"column":0},"end":{"line":384,"column":37}},"55":{"start":{"line":386,"column":0},"end":{"line":388,"column":1}},"56":{"start":{"line":387,"column":4},"end":{"line":387,"column":46}},"57":{"start":{"line":390,"column":0},"end":{"line":408,"column":3}},"58":{"start":{"line":396,"column":8},"end":{"line":398,"column":9}},"59":{"start":{"line":397,"column":12},"end":{"line":397,"column":41}},"60":{"start":{"line":402,"column":8},"end":{"line":402,"column":60}},"61":{"start":{"line":404,"column":8},"end":{"line":406,"column":9}},"62":{"start":{"line":405,"column":12},"end":{"line":405,"column":43}},"63":{"start":{"line":410,"column":0},"end":{"line":410,"column":32}},"64":{"start":{"line":411,"column":0},"end":{"line":411,"column":31}},"65":{"start":{"line":413,"column":0},"end":{"line":464,"column":1}},"66":{"start":{"line":416,"column":4},"end":{"line":436,"column":5}},"67":{"start":{"line":417,"column":8},"end":{"line":435,"column":16}},"68":{"start":{"line":418,"column":12},"end":{"line":419,"column":47}},"69":{"start":{"line":423,"column":12},"end":{"line":431,"column":15}},"70":{"start":{"line":424,"column":16},"end":{"line":430,"column":19}},"71":{"start":{"line":433,"column":12},"end":{"line":433,"column":30}},"72":{"start":{"line":434,"column":12},"end":{"line":434,"column":29}},"73":{"start":{"line":440,"column":4},"end":{"line":463,"column":5}},"74":{"start":{"line":441,"column":8},"end":{"line":462,"column":23}},"75":{"start":{"line":442,"column":12},"end":{"line":443,"column":31}},"76":{"start":{"line":445,"column":12},"end":{"line":461,"column":13}},"77":{"start":{"line":446,"column":16},"end":{"line":446,"column":46}},"78":{"start":{"line":448,"column":16},"end":{"line":453,"column":18}},"79":{"start":{"line":455,"column":16},"end":{"line":455,"column":34}},"80":{"start":{"line":456,"column":16},"end":{"line":456,"column":33}},"81":{"start":{"line":458,"column":16},"end":{"line":460,"column":19}},"82":{"start":{"line":459,"column":20},"end":{"line":459,"column":42}},"83":{"start":{"line":466,"column":0},"end":{"line":466,"column":28}},"84":{"start":{"line":469,"column":0},"end":{"line":472,"column":1}},"85":{"start":{"line":471,"column":4},"end":{"line":471,"column":28}}},"branchMap":{"1":{"line":44,"type":"binary-expr","locations":[{"start":{"line":44,"column":17},"end":{"line":44,"column":23}},{"start":{"line":44,"column":27},"end":{"line":44,"column":29}}]},"2":{"line":46,"type":"cond-expr","locations":[{"start":{"line":47,"column":16},"end":{"line":47,"column":61}},{"start":{"line":47,"column":64},"end":{"line":47,"column":79}}]},"3":{"line":61,"type":"if","locations":[{"start":{"line":61,"column":12},"end":{"line":61,"column":12}},{"start":{"line":61,"column":12},"end":{"line":61,"column":12}}]},"4":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":8},"end":{"line":82,"column":8}},{"start":{"line":82,"column":8},"end":{"line":82,"column":8}}]},"5":{"line":82,"type":"binary-expr","locations":[{"start":{"line":82,"column":12},"end":{"line":82,"column":28}},{"start":{"line":82,"column":32},"end":{"line":82,"column":81}}]},"6":{"line":83,"type":"cond-expr","locations":[{"start":{"line":83,"column":58},"end":{"line":83,"column":71}},{"start":{"line":83,"column":74},"end":{"line":83,"column":83}}]},"7":{"line":166,"type":"if","locations":[{"start":{"line":166,"column":12},"end":{"line":166,"column":12}},{"start":{"line":166,"column":12},"end":{"line":166,"column":12}}]},"8":{"line":208,"type":"cond-expr","locations":[{"start":{"line":208,"column":27},"end":{"line":221,"column":5}},{"start":{"line":221,"column":8},"end":{"line":232,"column":5}}]},"9":{"line":216,"type":"binary-expr","locations":[{"start":{"line":216,"column":23},"end":{"line":216,"column":30}},{"start":{"line":216,"column":34},"end":{"line":216,"column":44}},{"start":{"line":216,"column":48},"end":{"line":216,"column":50}}]},"10":{"line":219,"type":"cond-expr","locations":[{"start":{"line":220,"column":20},"end":{"line":220,"column":44}},{"start":{"line":220,"column":47},"end":{"line":220,"column":51}}]},"11":{"line":219,"type":"binary-expr","locations":[{"start":{"line":219,"column":15},"end":{"line":219,"column":21}},{"start":{"line":219,"column":25},"end":{"line":219,"column":51}}]},"12":{"line":230,"type":"cond-expr","locations":[{"start":{"line":231,"column":20},"end":{"line":231,"column":44}},{"start":{"line":231,"column":47},"end":{"line":231,"column":51}}]},"13":{"line":230,"type":"binary-expr","locations":[{"start":{"line":230,"column":15},"end":{"line":230,"column":21}},{"start":{"line":230,"column":25},"end":{"line":230,"column":51}}]},"14":{"line":266,"type":"cond-expr","locations":[{"start":{"line":266,"column":36},"end":{"line":266,"column":40}},{"start":{"line":266,"column":43},"end":{"line":266,"column":64}}]},"15":{"line":268,"type":"if","locations":[{"start":{"line":268,"column":8},"end":{"line":268,"column":8}},{"start":{"line":268,"column":8},"end":{"line":268,"column":8}}]},"16":{"line":271,"type":"if","locations":[{"start":{"line":271,"column":12},"end":{"line":271,"column":12}},{"start":{"line":271,"column":12},"end":{"line":271,"column":12}}]},"17":{"line":271,"type":"binary-expr","locations":[{"start":{"line":271,"column":16},"end":{"line":271,"column":33}},{"start":{"line":271,"column":38},"end":{"line":271,"column":55}},{"start":{"line":271,"column":59},"end":{"line":271,"column":81}}]},"18":{"line":276,"type":"binary-expr","locations":[{"start":{"line":276,"column":18},"end":{"line":276,"column":53}},{"start":{"line":276,"column":57},"end":{"line":276,"column":59}}]},"19":{"line":283,"type":"if","locations":[{"start":{"line":283,"column":12},"end":{"line":283,"column":12}},{"start":{"line":283,"column":12},"end":{"line":283,"column":12}}]},"20":{"line":307,"type":"if","locations":[{"start":{"line":307,"column":8},"end":{"line":307,"column":8}},{"start":{"line":307,"column":8},"end":{"line":307,"column":8}}]},"21":{"line":311,"type":"binary-expr","locations":[{"start":{"line":311,"column":39},"end":{"line":311,"column":61}},{"start":{"line":311,"column":65},"end":{"line":311,"column":67}}]},"22":{"line":325,"type":"if","locations":[{"start":{"line":325,"column":8},"end":{"line":325,"column":8}},{"start":{"line":325,"column":8},"end":{"line":325,"column":8}}]},"23":{"line":329,"type":"binary-expr","locations":[{"start":{"line":329,"column":25},"end":{"line":329,"column":47}},{"start":{"line":329,"column":51},"end":{"line":329,"column":53}}]},"24":{"line":386,"type":"if","locations":[{"start":{"line":386,"column":0},"end":{"line":386,"column":0}},{"start":{"line":386,"column":0},"end":{"line":386,"column":0}}]},"25":{"line":396,"type":"if","locations":[{"start":{"line":396,"column":8},"end":{"line":396,"column":8}},{"start":{"line":396,"column":8},"end":{"line":396,"column":8}}]},"26":{"line":396,"type":"binary-expr","locations":[{"start":{"line":396,"column":12},"end":{"line":396,"column":31}},{"start":{"line":396,"column":35},"end":{"line":396,"column":68}}]},"27":{"line":404,"type":"if","locations":[{"start":{"line":404,"column":8},"end":{"line":404,"column":8}},{"start":{"line":404,"column":8},"end":{"line":404,"column":8}}]},"28":{"line":413,"type":"if","locations":[{"start":{"line":413,"column":0},"end":{"line":413,"column":0}},{"start":{"line":413,"column":0},"end":{"line":413,"column":0}}]},"29":{"line":416,"type":"if","locations":[{"start":{"line":416,"column":4},"end":{"line":416,"column":4}},{"start":{"line":416,"column":4},"end":{"line":416,"column":4}}]},"30":{"line":440,"type":"if","locations":[{"start":{"line":440,"column":4},"end":{"line":440,"column":4}},{"start":{"line":440,"column":4},"end":{"line":440,"column":4}}]},"31":{"line":445,"type":"if","locations":[{"start":{"line":445,"column":12},"end":{"line":445,"column":12}},{"start":{"line":445,"column":12},"end":{"line":445,"column":12}}]},"32":{"line":469,"type":"if","locations":[{"start":{"line":469,"column":0},"end":{"line":469,"column":0}},{"start":{"line":469,"column":0},"end":{"line":469,"column":0}}]},"33":{"line":469,"type":"binary-expr","locations":[{"start":{"line":469,"column":4},"end":{"line":469,"column":29}},{"start":{"line":469,"column":34},"end":{"line":469,"column":44}},{"start":{"line":469,"column":48},"end":{"line":469,"column":72}},{"start":{"line":470,"column":9},"end":{"line":470,"column":27}},{"start":{"line":470,"column":31},"end":{"line":470,"column":46}}]}},"code":["(function () { YUI.add('history-hash', function (Y, NAME) {","","/**"," * Provides browser history management backed by"," * <code>window.location.hash</code>, as well as convenience methods for working"," * with the location hash and a synthetic <code>hashchange</code> event that"," * normalizes differences across browsers."," *"," * @module history"," * @submodule history-hash"," * @since 3.2.0"," * @class HistoryHash"," * @extends HistoryBase"," * @constructor"," * @param {Object} config (optional) Configuration object. See the HistoryBase"," * documentation for details."," */","","var HistoryBase = Y.HistoryBase,"," Lang = Y.Lang,"," YArray = Y.Array,"," YObject = Y.Object,"," GlobalEnv = YUI.namespace('Env.HistoryHash'),",""," SRC_HASH = 'hash',",""," hashNotifiers,"," oldHash,"," oldUrl,"," win = Y.config.win,"," useHistoryHTML5 = Y.config.useHistoryHTML5;","","function HistoryHash() {"," HistoryHash.superclass.constructor.apply(this, arguments);","}","","Y.extend(HistoryHash, HistoryBase, {"," // -- Initialization -------------------------------------------------------"," _init: function (config) {"," var bookmarkedState = HistoryHash.parseHash();",""," // If an initialState was provided, merge the bookmarked state into it"," // (the bookmarked state wins)."," config = config || {};",""," this._initialState = config.initialState ?"," Y.merge(config.initialState, bookmarkedState) : bookmarkedState;",""," // Subscribe to the synthetic hashchange event (defined below) to handle"," // changes."," Y.after('hashchange', Y.bind(this._afterHashChange, this), win);",""," HistoryHash.superclass._init.apply(this, arguments);"," },",""," // -- Protected Methods ----------------------------------------------------"," _change: function (src, state, options) {"," // Stringify all values to ensure that comparisons don't fail after"," // they're coerced to strings in the location hash."," YObject.each(state, function (value, key) {"," if (Lang.isValue(value)) {"," state[key] = value.toString();"," }"," });",""," return HistoryHash.superclass._change.call(this, src, state, options);"," },",""," _storeState: function (src, newState) {"," var decode = HistoryHash.decode,"," newHash = HistoryHash.createHash(newState);",""," HistoryHash.superclass._storeState.apply(this, arguments);",""," // Update the location hash with the changes, but only if the new hash"," // actually differs from the current hash (this avoids creating multiple"," // history entries for a single state)."," //"," // We always compare decoded hashes, since it's possible that the hash"," // could be set incorrectly to a non-encoded value outside of"," // HistoryHash."," if (src !== SRC_HASH && decode(HistoryHash.getHash()) !== decode(newHash)) {"," HistoryHash[src === HistoryBase.SRC_REPLACE ? 'replaceHash' : 'setHash'](newHash);"," }"," },",""," // -- Protected Event Handlers ---------------------------------------------",""," /**"," * Handler for hashchange events."," *"," * @method _afterHashChange"," * @param {Event} e"," * @protected"," */"," _afterHashChange: function (e) {"," this._resolveChanges(SRC_HASH, HistoryHash.parseHash(e.newHash), {});"," }","}, {"," // -- Public Static Properties ---------------------------------------------"," NAME: 'historyHash',",""," /**"," * Constant used to identify state changes originating from"," * <code>hashchange</code> events."," *"," * @property SRC_HASH"," * @type String"," * @static"," * @final"," */"," SRC_HASH: SRC_HASH,",""," /**"," * <p>"," * Prefix to prepend when setting the hash fragment. For example, if the"," * prefix is <code>!</code> and the hash fragment is set to"," * <code>#foo=bar&baz=quux</code>, the final hash fragment in the URL will"," * become <code>#!foo=bar&baz=quux</code>. This can be used to help make an"," * Ajax application crawlable in accordance with Google's guidelines at"," * <a href=\"http://code.google.com/web/ajaxcrawling/\">http://code.google.com/web/ajaxcrawling/</a>."," * </p>"," *"," * <p>"," * Note that this prefix applies to all HistoryHash instances. It's not"," * possible for individual instances to use their own prefixes since they"," * all operate on the same URL."," * </p>"," *"," * @property hashPrefix"," * @type String"," * @default ''"," * @static"," */"," hashPrefix: '',",""," // -- Protected Static Properties ------------------------------------------",""," /**"," * Regular expression used to parse location hash/query strings."," *"," * @property _REGEX_HASH"," * @type RegExp"," * @protected"," * @static"," * @final"," */"," _REGEX_HASH: /([^\\?#&=]+)=?([^&=]*)/g,",""," // -- Public Static Methods ------------------------------------------------",""," /**"," * Creates a location hash string from the specified object of key/value"," * pairs."," *"," * @method createHash"," * @param {Object} params object of key/value parameter pairs"," * @return {String} location hash string"," * @static"," */"," createHash: function (params) {"," var encode = HistoryHash.encode,"," hash = [];",""," YObject.each(params, function (value, key) {"," if (Lang.isValue(value)) {"," hash.push(encode(key) + '=' + encode(value));"," }"," });",""," return hash.join('&');"," },",""," /**"," * Wrapper around <code>decodeURIComponent()</code> that also converts +"," * chars into spaces."," *"," * @method decode"," * @param {String} string string to decode"," * @return {String} decoded string"," * @static"," */"," decode: function (string) {"," return decodeURIComponent(string.replace(/\\+/g, ' '));"," },",""," /**"," * Wrapper around <code>encodeURIComponent()</code> that converts spaces to"," * + chars."," *"," * @method encode"," * @param {String} string string to encode"," * @return {String} encoded string"," * @static"," */"," encode: function (string) {"," return encodeURIComponent(string).replace(/%20/g, '+');"," },",""," /**"," * Gets the raw (not decoded) current location hash, minus the preceding '#'"," * character and the hashPrefix (if one is set)."," *"," * @method getHash"," * @return {String} current location hash"," * @static"," */"," getHash: (Y.UA.gecko ? function () {"," // Gecko's window.location.hash returns a decoded string and we want all"," // encoding untouched, so we need to get the hash value from"," // window.location.href instead. We have to use UA sniffing rather than"," // feature detection, since the only way to detect this would be to"," // actually change the hash."," var location = Y.getLocation(),"," matches = /#(.*)$/.exec(location.href),"," hash = matches && matches[1] || '',"," prefix = HistoryHash.hashPrefix;",""," return prefix && hash.indexOf(prefix) === 0 ?"," hash.replace(prefix, '') : hash;"," } : function () {"," var location = Y.getLocation(),"," hash = location.hash.substring(1),"," prefix = HistoryHash.hashPrefix;",""," // Slight code duplication here, but execution speed is of the essence"," // since getHash() is called every 50ms to poll for changes in browsers"," // that don't support native onhashchange. An additional function call"," // would add unnecessary overhead."," return prefix && hash.indexOf(prefix) === 0 ?"," hash.replace(prefix, '') : hash;"," }),",""," /**"," * Gets the current bookmarkable URL."," *"," * @method getUrl"," * @return {String} current bookmarkable URL"," * @static"," */"," getUrl: function () {"," return location.href;"," },",""," /**"," * Parses a location hash string into an object of key/value parameter"," * pairs. If <i>hash</i> is not specified, the current location hash will"," * be used."," *"," * @method parseHash"," * @param {String} hash (optional) location hash string"," * @return {Object} object of parsed key/value parameter pairs"," * @static"," */"," parseHash: function (hash) {"," var decode = HistoryHash.decode,"," i,"," len,"," match,"," matches,"," param,"," params = {},"," prefix = HistoryHash.hashPrefix,"," prefixIndex;",""," hash = Lang.isValue(hash) ? hash : HistoryHash.getHash();",""," if (prefix) {"," prefixIndex = hash.indexOf(prefix);",""," if (prefixIndex === 0 || (prefixIndex === 1 && hash.charAt(0) === '#')) {"," hash = hash.replace(prefix, '');"," }"," }",""," matches = hash.match(HistoryHash._REGEX_HASH) || [];",""," for (i = 0, len = matches.length; i < len; ++i) {"," match = matches[i];",""," param = match.split('=');",""," if (param.length > 1) {"," params[decode(param[0])] = decode(param[1]);"," } else {"," params[decode(match)] = '';"," }"," }",""," return params;"," },",""," /**"," * Replaces the browser's current location hash with the specified hash"," * and removes all forward navigation states, without creating a new browser"," * history entry. Automatically prepends the <code>hashPrefix</code> if one"," * is set."," *"," * @method replaceHash"," * @param {String} hash new location hash"," * @static"," */"," replaceHash: function (hash) {"," var location = Y.getLocation(),"," base = location.href.replace(/#.*$/, '');",""," if (hash.charAt(0) === '#') {"," hash = hash.substring(1);"," }",""," location.replace(base + '#' + (HistoryHash.hashPrefix || '') + hash);"," },",""," /**"," * Sets the browser's location hash to the specified string. Automatically"," * prepends the <code>hashPrefix</code> if one is set."," *"," * @method setHash"," * @param {String} hash new location hash"," * @static"," */"," setHash: function (hash) {"," var location = Y.getLocation();",""," if (hash.charAt(0) === '#') {"," hash = hash.substring(1);"," }",""," location.hash = (HistoryHash.hashPrefix || '') + hash;"," }","});","","// -- Synthetic hashchange Event -----------------------------------------------","","// TODO: YUIDoc currently doesn't provide a good way to document synthetic DOM","// events. For now, we're just documenting the hashchange event on the YUI","// object, which is about the best we can do until enhancements are made to","// YUIDoc.","","/**","Synthetic <code>window.onhashchange</code> event that normalizes differences","across browsers and provides support for browsers that don't natively support","<code>onhashchange</code>.","","This event is provided by the <code>history-hash</code> module.","","@example",""," YUI().use('history-hash', function (Y) {"," Y.on('hashchange', function (e) {"," // Handle hashchange events on the current window."," }, Y.config.win);"," });","","@event hashchange","@param {EventFacade} e Event facade with the following additional"," properties:","","<dl>"," <dt>oldHash</dt>"," <dd>"," Previous hash fragment value before the change."," </dd>",""," <dt>oldUrl</dt>"," <dd>"," Previous URL (including the hash fragment) before the change."," </dd>",""," <dt>newHash</dt>"," <dd>"," New hash fragment value after the change."," </dd>",""," <dt>newUrl</dt>"," <dd>"," New URL (including the hash fragment) after the change."," </dd>","</dl>","@for YUI","@since 3.2.0","**/","","hashNotifiers = GlobalEnv._notifiers;","","if (!hashNotifiers) {"," hashNotifiers = GlobalEnv._notifiers = [];","}","","Y.Event.define('hashchange', {"," on: function (node, subscriber, notifier) {"," // Ignore this subscription if the node is anything other than the"," // window or document body, since those are the only elements that"," // should support the hashchange event. Note that the body could also be"," // a frameset, but that's okay since framesets support hashchange too."," if (node.compareTo(win) || node.compareTo(Y.config.doc.body)) {"," hashNotifiers.push(notifier);"," }"," },",""," detach: function (node, subscriber, notifier) {"," var index = YArray.indexOf(hashNotifiers, notifier);",""," if (index !== -1) {"," hashNotifiers.splice(index, 1);"," }"," }","});","","oldHash = HistoryHash.getHash();","oldUrl = HistoryHash.getUrl();","","if (HistoryBase.nativeHashChange) {"," // Wrap the browser's native hashchange event if there's not already a"," // global listener."," if (!GlobalEnv._hashHandle) {"," GlobalEnv._hashHandle = Y.Event.attach('hashchange', function (e) {"," var newHash = HistoryHash.getHash(),"," newUrl = HistoryHash.getUrl();",""," // Iterate over a copy of the hashNotifiers array since a subscriber"," // could detach during iteration and cause the array to be re-indexed."," YArray.each(hashNotifiers.concat(), function (notifier) {"," notifier.fire({"," _event : e,"," oldHash: oldHash,"," oldUrl : oldUrl,"," newHash: newHash,"," newUrl : newUrl"," });"," });",""," oldHash = newHash;"," oldUrl = newUrl;"," }, win);"," }","} else {"," // Begin polling for location hash changes if there's not already a global"," // poll running."," if (!GlobalEnv._hashPoll) {"," GlobalEnv._hashPoll = Y.later(50, null, function () {"," var newHash = HistoryHash.getHash(),"," facade, newUrl;",""," if (oldHash !== newHash) {"," newUrl = HistoryHash.getUrl();",""," facade = {"," oldHash: oldHash,"," oldUrl : oldUrl,"," newHash: newHash,"," newUrl : newUrl"," };",""," oldHash = newHash;"," oldUrl = newUrl;",""," YArray.each(hashNotifiers.concat(), function (notifier) {"," notifier.fire(facade);"," });"," }"," }, null, true);"," }","}","","Y.HistoryHash = HistoryHash;","","// HistoryHash will never win over HistoryHTML5 unless useHistoryHTML5 is false.","if (useHistoryHTML5 === false || (!Y.History && useHistoryHTML5 !== true &&"," (!HistoryBase.html5 || !Y.HistoryHTML5))) {"," Y.History = HistoryHash;","}","","","}, '3.13.0', {\"requires\": [\"event-synthetic\", \"history-base\", \"yui-later\"]});","","}());"]};