- // Return true
- return true;
- };
-
- /**
- * getStateByIndex()
- * Gets a state by the index
- * @param {integer} index
- * @return {Object}
- */
- getStateByIndex = function(index){
- // Prepare
- var State = null;
-
- // Handle
- if ( typeof index === 'undefined' ) {
- // Get the last inserted
- State = this.savedStates[this.savedStates.length-1];
- }
- else if ( index < 0 ) {
- // Get from the end
- State = this.savedStates[this.savedStates.length+index];
- }
- else {
- // Get from the beginning
- State = this.savedStates[index];
- }
-
- // Return State
- return State;
- };
-
- /**
- * getCurrentIndex()
- * Gets the current index
- * @return (integer)
- */
- getCurrentIndex = function(){
- // Prepare
- var index = null;
-
- // No states saved
- if(this.savedStates.length < 1) {
- index = 0;
- }
- else {
- index = this.savedStates.length-1;
- }
- return index;
- };
-
- // ====================================================================
- // Hash Helpers
-
- /**
- * getHash()
- * @param {Location=} location
- * Gets the current document hash
- * Note: unlike location.hash, this is guaranteed to return the escaped hash in all browsers
- * @return {string}
- */
- getHash = function(doc){
- var url = this.getLocationHref(doc),
- hash;
- hash = this.getHashByUrl(url);
- return hash;
- };
-
- /**
- * unescapeHash()
- * normalize and Unescape a Hash
- * @param {String} hash
- * @return {string}
- */
- unescapeHash = function(hash){
- // Prepare
- var result = this.normalizeHash(hash);
-
- // Unescape hash
- result = decodeURIComponent(result);