From f0cfe83e3725f9a3928da97a6e3085e79cb25309 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 18 Mar 2013 10:26:24 +0400 Subject: upgrade dojo to 1.8.3 (refs #570) --- lib/dojo/back.js.uncompressed.js | 397 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 397 insertions(+) create mode 100644 lib/dojo/back.js.uncompressed.js (limited to 'lib/dojo/back.js.uncompressed.js') diff --git a/lib/dojo/back.js.uncompressed.js b/lib/dojo/back.js.uncompressed.js new file mode 100644 index 000000000..f19052b9e --- /dev/null +++ b/lib/dojo/back.js.uncompressed.js @@ -0,0 +1,397 @@ +define("dojo/back", ["./_base/config", "./_base/lang", "./sniff", "./dom", "./dom-construct", "./_base/window", "require"], + function(config, lang, has, dom, domConstruct, baseWindow, require){ + // module: + // dojo/back + + var back = { + // summary: + // Browser history management resources + }; + 1 && lang.setObject("dojo.back", back); + + // everyone deals with encoding the hash slightly differently + + var getHash = back.getHash = function(){ + var h = window.location.hash; + if(h.charAt(0) == "#"){ h = h.substring(1); } + return has("mozilla") ? h : decodeURIComponent(h); + }, + + setHash = back.setHash = function(h){ + if(!h){ h = ""; } + window.location.hash = encodeURIComponent(h); + historyCounter = history.length; + }; + + var initialHref = (typeof(window) !== "undefined") ? window.location.href : ""; + var initialHash = (typeof(window) !== "undefined") ? getHash() : ""; + var initialState = null; + + var locationTimer = null; + var bookmarkAnchor = null; + var historyIframe = null; + var forwardStack = []; + var historyStack = []; + var moveForward = false; + var changingUrl = false; + var historyCounter; + + function handleBackButton(){ + // summary: + // private method. Do not call this directly. + + //The "current" page is always at the top of the history stack. + var current = historyStack.pop(); + if(!current){ return; } + var last = historyStack[historyStack.length-1]; + if(!last && historyStack.length == 0){ + last = initialState; + } + if(last){ + if(last.kwArgs["back"]){ + last.kwArgs["back"](); + }else if(last.kwArgs["backButton"]){ + last.kwArgs["backButton"](); + }else if(last.kwArgs["handle"]){ + last.kwArgs.handle("back"); + } + } + forwardStack.push(current); + } + + back.goBack = handleBackButton; + + function handleForwardButton(){ + // summary: + // private method. Do not call this directly. + var last = forwardStack.pop(); + if(!last){ return; } + if(last.kwArgs["forward"]){ + last.kwArgs.forward(); + }else if(last.kwArgs["forwardButton"]){ + last.kwArgs.forwardButton(); + }else if(last.kwArgs["handle"]){ + last.kwArgs.handle("forward"); + } + historyStack.push(last); + } + + back.goForward = handleForwardButton; + + function createState(url, args, hash){ + // summary: + // private method. Do not call this directly. + return {"url": url, "kwArgs": args, "urlHash": hash}; //Object + } + + function getUrlQuery(url){ + // summary: + // private method. Do not call this directly. + var segments = url.split("?"); + if(segments.length < 2){ + return null; //null + } + else{ + return segments[1]; //String + } + } + + function loadIframeHistory(){ + // summary: + // private method. Do not call this directly. + var url = (config["dojoIframeHistoryUrl"] || require.toUrl("./resources/iframe_history.html")) + "?" + (new Date()).getTime(); + moveForward = true; + if(historyIframe){ + has("webkit") ? historyIframe.location = url : window.frames[historyIframe.name].location = url; + }else{ + //console.warn("dojo/back: Not initialised. You need to call back.init() from a