From: Dion O. <dol...@us...> - 2005-11-21 15:20:20
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15113/magicajax/Core/script Modified Files: AjaxCallObject.js Log Message: reverted back changes Index: AjaxCallObject.js =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AjaxCallObject.js 21 Nov 2005 15:11:04 -0000 1.13 --- AjaxCallObject.js 21 Nov 2005 15:20:12 -0000 1.14 *************** *** 1,5 **** __AJAXCboList = new Array(); __bPageIsStored = false; - __bUnloadStoredPage = false; __PageStateCache = null; __bTracing = false; --- 1,4 ---- *************** *** 7,10 **** --- 6,10 ---- __PreviousPostBack = null; __PreviousOnPageLoad = null; + __PreviousOnPageBeforeUnload = null; __PreviousOnPageUnload = null; *************** *** 73,77 **** __bPageIsStored = bPageIsStored; - __bUnloadStoredPage = bUnloadStoredPage; __PageStateCache = pageStateCache; __bTracing = bTracing; --- 73,76 ---- *************** *** 83,90 **** __PreviousOnPageLoad = window.onload; window.onload = this.OnPageLoad; } ! __PreviousOnPageUnload = window.onunload; ! window.onunload = this.OnPageUnload; } --- 82,95 ---- __PreviousOnPageLoad = window.onload; window.onload = this.OnPageLoad; + + __PreviousOnPageBeforeUnload = window.onbeforeunload; + window.onbeforeunload = this.OnPageBeforeUnload; } ! if ( bPageIsStored && bUnloadStoredPage ) ! { ! __PreviousOnPageUnload = window.onunload; ! window.onunload = this.OnPageUnload; ! } } *************** *** 160,164 **** if (html != "") { - //alert('about to restore state'); document.forms[0].innerHTML = decodeURIComponent(html.substr(5)); __PageStateCache.value = ""; --- 165,168 ---- *************** *** 169,206 **** } AjaxCallObject.prototype.OnPageUnload = function() { ! if ( !__bPageIsStored || !__bUnloadStoredPage ) ! { ! // Save the html of the form, so that it can be restored for the ! // browser's "Back Button" ! __PageStateCache.value = "HTML:" + encodeURIComponent(document.forms[0].innerHTML); ! //alert('just saved state'); ! } ! else ! { ! if (document.forms[0]["__AJAX_PAGEKEY"] == null) ! return; ! var thePage = document.forms[0].action; ! var index = thePage.indexOf("?"); ! if (index != -1) ! thePage = thePage.substring(0, index); ! thePage = thePage + "?__AJAX_PAGEUNLOAD=" + encodeURIComponent(document.forms[0]["__AJAX_PAGEKEY"].value); ! var oThis = AJAXCbo; ! __AJAXCboList.push(oThis); ! AJAXCbo = new AjaxCallObject(); ! if( oThis.XmlHttp ) ! { ! oThis.XmlHttp.open('GET', thePage, true); ! oThis.XmlHttp.onreadystatechange = function(){ }; ! oThis.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ! oThis.XmlHttp.send(null); ! } } ! if (__PreviousOnPageUnload != null) return __PreviousOnPageUnload(); --- 173,210 ---- } + AjaxCallObject.prototype.OnPageBeforeUnload = function() + { + // Save the html of the form, so that it can be restored for the + // browser's "Back Button" + __PageStateCache.value = "HTML:" + encodeURIComponent(document.forms[0].innerHTML); + + if (__PreviousOnPageBeforeUnload != null) + return __PreviousOnPageBeforeUnload(); + } + AjaxCallObject.prototype.OnPageUnload = function() { ! if (document.forms[0]["__AJAX_PAGEKEY"] == null) ! return; ! var thePage = document.forms[0].action; ! var index = thePage.indexOf("?"); ! if (index != -1) ! thePage = thePage.substring(0, index); ! thePage = thePage + "?__AJAX_PAGEUNLOAD=" + encodeURIComponent(document.forms[0]["__AJAX_PAGEKEY"].value); ! var oThis = AJAXCbo; ! __AJAXCboList.push(oThis); ! AJAXCbo = new AjaxCallObject(); ! if( oThis.XmlHttp ) ! { ! oThis.XmlHttp.open('GET', thePage, true); ! oThis.XmlHttp.onreadystatechange = function(){ }; ! oThis.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ! oThis.XmlHttp.send(null); } ! if (__PreviousOnPageUnload != null) return __PreviousOnPageUnload(); |