create(options) -> undefined
{} -
set user-agent flags
initialize() -> undefined
addListener(listener) -> undefined
{} -
addEventListener(o, e, l) -> undefined
{} -
{} -
{} -
add(newLocation, historyData) -> undefined
{String} -
{Object} -
isFirstLoad() -> undefined
getVersion() -> undefined
getCurrentHash() -> undefined
Our history change listener.
MS to wait between add requests - will be reset for certain browsers
MS before an add request can execute
Our current hash location, without the "#" symbol.
Hidden iframe used to IE to detect history changes
Flags and DOM references used only by Safari
Private: Flag used to keep checkLocation() from doing anything when it discovers location changes we've made ourselves programmatically with the add() method. Basically, add() sets this to true. When checkLocation() discovers it's true, it refrains from firing our listener, then resets the flag to false for next cycle. That way, our listener only gets fired on history change events triggered by the user via back/forward buttons and manual hash changes. This flag also helps us set up IE's special iframe-based method of handling history changes.
Private: A flag that indicates that we should fire a history change event when we are ready, i.e. after we are initialized and we have a history change listener. This is needed due to an edge case in browsers other than IE; if you leave a page entirely then return, we must fire this as a history change event. Unfortunately, we have lost all references to listeners from earlier, because JavaScript clears out.
Private: A variable that indicates whether this is the first time this page has been loaded. If you go to a web page, leave it for another one, and then return, the page's onload listener fires again. We need a way to differentiate between the first page load and subsequent ones. This variable works hand in hand with the pageLoaded variable we store into historyStorage.
Private: A variable to handle an important edge case in IE. In IE, if a user manually types an address into their browser's location bar, we must intercept this by calling checkLocation() at regular intervals. However, if we are programmatically changing the location bar ourselves using the add() method, we need to ignore these changes in checkLocation(). Unfortunately, these changes take several lines of code to complete, so for the duration of those lines of code, we set this variable to true. That signals to checkLocation() to ignore the change-in-progress. Once we're done with our chunk of location-change code in add(), we set this back to false. We'll do the same thing when capturing user-entered address changes in checkLocation itself.
createIE(initialHash) -> undefined
{} -
write out a hidden iframe for IE and set the amount of time to wait between add() requests
createOpera() -> undefined
Opera needs longer between history updates
createSafari() -> undefined
getSafariStack() -> undefined
getSafariState() -> undefined
putSafariState(newLocation) -> undefined
{} -
fireHistoryEvent(newHash) -> undefined
{} -
checkLocation() -> undefined
Get hash location
Do nothing if there's been no change
In IE, users manually entering locations into the browser; we do this by comparing the browser's location against the iframe's location; if they differ, we are dealing with a manual event and need to place it inside our history, otherwise we can return
Save this new location
getIframeHash() -> undefined
removeHash(hashValue) -> undefined
{} -
iframeLoaded(newLocation) -> undefined
{} -
Get the new location
Keep the browser location bar in sync with the iframe hash
historyStorage: An object that uses a hidden form to store history state across page loads. The mechanism for doing so relies on the fact that browsers save the text in form data for the life of the browser session, which means the text is still there when the user navigates back to the page. This object can be used independently of the MVC.History object for caching of Ajax session information. dependencies: json2007.js (included in a separate file) or alternate JSON methods passed in through an options bundle.
setup(options) -> undefined
{} -
write a hidden form and textarea into the page; we'll stow our history stack here
get(key) -> undefined
{} -
remove(key) -> undefined
{} -
reset() -> undefined
hasKey(key) -> undefined
{} -
isValidKey(key) -> undefined
{} -
Public - CSS strings utilized by both objects to hide or show behind-the-scenes DOM elements
Public - debug mode flag
Private: If true, we have loaded our hash table out of the storage form.
Private: DOM reference to our history field
assertValidKey(key) -> undefined
{} -
loadHashTable() -> undefined
saveHashTable() -> undefined
toJSON(o) -> undefined
{} -
historyChange(newLocation, historyData) -> undefined
{Object} -
{Object} -