diff options
author | Andrew Dolgov <[email protected]> | 2011-11-08 20:40:44 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2011-11-08 20:40:44 +0400 |
commit | 81bea17aefb26859f825b9293c7c99192874806e (patch) | |
tree | fb244408ca271affa2899adb634788802c9a89d8 /lib/dojo/back.js | |
parent | 870a70e109ac9e80a88047044530de53d0404ec7 (diff) |
upgrade Dojo to 1.6.1
Diffstat (limited to 'lib/dojo/back.js')
-rw-r--r-- | lib/dojo/back.js | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/lib/dojo/back.js b/lib/dojo/back.js index 5e2998c97..0bb4817b4 100644 --- a/lib/dojo/back.js +++ b/lib/dojo/back.js @@ -1,5 +1,5 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ @@ -9,6 +9,8 @@ if(!dojo._hasResource["dojo.back"]){ //_hasResource checks added by build. Do no dojo._hasResource["dojo.back"] = true; dojo.provide("dojo.back"); +dojo.getObject("back", true, dojo); + /*===== dojo.back = { // summary: Browser history management resources @@ -16,29 +18,23 @@ dojo.back = { =====*/ -(function(){ - var back = dojo.back; +(function(){ + var back = dojo.back, // everyone deals with encoding the hash slightly differently - function getHash(){ + getHash= back.getHash= function(){ var h = window.location.hash; if(h.charAt(0) == "#"){ h = h.substring(1); } - return dojo.isMozilla ? h : decodeURIComponent(h); - } + return dojo.isMozilla ? h : decodeURIComponent(h); + }, - function setHash(h){ + setHash= back.setHash= function(h){ if(!h){ h = ""; } window.location.hash = encodeURIComponent(h); historyCounter = history.length; - } - - // if we're in the test for these methods, expose them on dojo.back. ok'd with alex. - if(dojo.exists("tests.back-hash")){ - back.getHash = getHash; - back.setHash = setHash; - } - + }; + var initialHref = (typeof(window) !== "undefined") ? window.location.href : ""; var initialHash = (typeof(window) !== "undefined") ? getHash() : ""; var initialState = null; @@ -150,18 +146,11 @@ dojo.back = { return; } } - - if(dojo.isSafari && dojo.isSafari < 3){ - var hisLen = history.length; - if(hisLen > historyCounter) handleForwardButton(); - else if(hisLen < historyCounter) handleBackButton(); - historyCounter = hisLen; - } } }; back.init = function(){ - //summary: Initializes the undo stack. This must be called from a <script> + //summary: Initializes the undo stack. This must be called from a <script> // block that lives inside the <body> tag to prevent bugs on IE. // description: // Only call this method before the page's DOM is finished loading. Otherwise @@ -179,7 +168,7 @@ dojo.back = { }; back.setInitialState = function(/*Object*/args){ - //summary: + //summary: // Sets the state object and back callback for the very first page // that is loaded. //description: @@ -213,14 +202,14 @@ dojo.back = { =====*/ back.addToHistory = function(/*dojo.__backArgs*/ args){ - // summary: - // adds a state object (args) to the history list. + // summary: + // adds a state object (args) to the history list. // description: // To support getting back button notifications, the object // argument should implement a function called either "back", // "backButton", or "handle". The string "back" will be passed as // the first and only argument to this callback. - // + // // To support getting forward button notifications, the object // argument should implement a function called either "forward", // "forwardButton", or "handle". The string "forward" will be @@ -247,7 +236,7 @@ dojo.back = { // | }); // BROWSER NOTES: - // Safari 1.2: + // Safari 1.2: // back button "works" fine, however it's not possible to actually // DETECT that you've moved backwards by inspecting window.location. // Unless there is some other means of locating. @@ -261,10 +250,10 @@ dojo.back = { // previous hash value, but to the last full page load. This suggests // that the iframe is the correct way to capture the back button in // these cases. - // Don't test this page using local disk for MSIE. MSIE will not create - // a history list for iframe_history.html if served from a file: URL. - // The XML served back from the XHR tests will also not be properly - // created if served from local disk. Serve the test pages from a web + // Don't test this page using local disk for MSIE. MSIE will not create + // a history list for iframe_history.html if served from a file: URL. + // The XML served back from the XHR tests will also not be properly + // created if served from local disk. Serve the test pages from a web // server to test in that browser. // IE 6.0: // same behavior as IE 5.5 SP2 @@ -276,7 +265,7 @@ dojo.back = { //If addToHistory is called, then that means we prune the //forward stack -- the user went back, then wanted to //start a new forward path. - forwardStack = []; + forwardStack = []; var hash = null; var url = null; @@ -310,9 +299,9 @@ dojo.back = { } changingUrl = true; - setTimeout(function() { - setHash(hash); - changingUrl = false; + setTimeout(function() { + setHash(hash); + changingUrl = false; }, 1); bookmarkAnchor.href = hash; @@ -380,10 +369,10 @@ dojo.back = { }; back._iframeLoaded = function(evt, ifrLoc){ - //summary: + //summary: // private method. Do not call this directly. var query = getUrlQuery(ifrLoc.href); - if(query == null){ + if(query == null){ // alert("iframeLoaded"); // we hit the end of the history, so we should go back if(historyStack.length == 1){ |