From: Lo?c C. <lo...@us...> - 2001-05-10 11:47:24
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs In directory usw-pr-cvs1:/tmp/cvs-serv26624/chat/lib/index_libs Modified Files: connect_status.lib.js Log Message: Rewritten the automatic reconnection system Index: connect_status.lib.js =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/connect_status.lib.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** connect_status.lib.js 2001/05/06 16:47:51 1.1 --- connect_status.lib.js 2001/05/10 11:47:22 1.2 *************** *** 44,47 **** --- 44,74 ---- /** + * Refreshes the 'loader' frame + */ + function pmcDoRefreshLoader() + { + var jsLoaderFrame = window.frames['loader'].window; + var jsLoaderUrl = 'loader.' + jsPhpExt + + '?' + jsDbSessionSID + + jsQueryArgSeparator + 'isInitLoad=' + jsIsInitLoad + + jsQueryArgSeparator + 'lastMsgLoad=' + jsLastLoadedMsgTime + + jsQueryArgSeparator + 'lastUsrCheck=' + jsLastCheckedUserTime; + // Stop current loading + if (typeof(window.stop) != 'undefined') + { + jsLoaderFrame.stop(); + } + else if (typeof(document.execCommand) != 'undefined' + && typeof(jsLoaderFrame.document) != 'undefined' + && jsLoaderFrame.document) + { + jsLoaderFrame.document.execCommand('Stop'); + } + // Do refresh the 'loader' frame + jsLoaderFrame.location.replace(jsLoaderUrl); + } // end of the 'pmcDoRefreshLoader()' function + + + /** * Tries to connect twice if necessary and sets the icon for connection status * at the 'exit' frame *************** *** 55,86 **** jsConnect = numTry; ! var exitFrm = window.frames['exit']; ! if (typeof(exitFrm.document) == 'undefined') return; ! if (numTry == 1 || numTry == 2) ! { ! jsImgConnect.src = jsImgConnectOn.src; ! } ! else if (numTry == 3) ! { ! jsImgConnect.src = jsImgConnectErr.src; ! } if (jsIsDOM) { ! exitFrm.document.getElementById('imgConState').src = jsImgConnect.src; } else if (jsIsIE4) { ! exitFrm.document.all['imgConState'].src = jsImgConnect.src; } else if (jsIsNS4) { ! exitFrm.document.images['imgConState'].src = jsImgConnect.src; } if (numTry < 3) { numTry = numTry + 1; jsIsConnecting = setTimeout('pmcConnecting(' + numTry + ')', 30000); --- 82,108 ---- jsConnect = numTry; ! var exitFrame = window.frames['exit']; ! if (typeof(exitFrame.document) == 'undefined' ! || !exitFrame.document) return; ! jsImgConnect.src = (numTry < 3) ? jsImgConnectOn.src : jsImgConnectErr.src; if (jsIsDOM) { ! exitFrame.document.getElementById('imgConState').src = jsImgConnect.src; } else if (jsIsIE4) { ! exitFrame.document.all['imgConState'].src = jsImgConnect.src; } else if (jsIsNS4) { ! exitFrame.document.images['imgConState'].src = jsImgConnect.src; } if (numTry < 3) { + pmcDoRefreshLoader(); numTry = numTry + 1; jsIsConnecting = setTimeout('pmcConnecting(' + numTry + ')', 30000); *************** *** 103,107 **** function pmcConnectDone() { ! var exitFrm = window.frames['exit']; jsConnect = 0; --- 125,129 ---- function pmcConnectDone() { ! var exitFrame = window.frames['exit']; jsConnect = 0; *************** *** 111,143 **** if (jsIsDOM) { ! if (typeof(exitFrm.document.getElementById('imgConState')) != 'undefined') ! exitFrm.document.getElementById('imgConState').src = jsImgConnectOff.src; } else if (jsIsIE4) { ! if (typeof(exitFrm.document.all['imgConState']) != 'undefined') ! exitFrm.document.all['imgConState'].src = jsImgConnectOff.src; } else if (jsIsNS4) { ! if (typeof(exitFrm.document.images['imgConState']) != 'undefined') ! exitFrm.document.images['imgConState'].src = jsImgConnectOff.src; } - else return; - } // end of the 'pmcConnectDone()' function ! ! /** ! * Refreshes the 'loader' frame ! */ ! function pmcDoRefreshLoader() ! { ! var jsLoaderUrl = 'loader.' + jsPhpExt ! + '?' + jsDbSessionSID ! + jsQueryArgSeparator + 'isInitLoad=' + jsIsInitLoad ! + jsQueryArgSeparator + 'lastMsgLoad=' + jsLastLoadedMsgTime ! + jsQueryArgSeparator + 'lastUsrCheck=' + jsLastCheckedUserTime; ! window.frames['loader'].window.location.replace(jsLoaderUrl); ! } // end of the 'pmcDoRefreshLoader()' function --- 133,152 ---- if (jsIsDOM) { ! if (typeof(exitFrame.document.getElementById('imgConState')) != 'undefined') ! exitFrame.document.getElementById('imgConState').src = jsImgConnectOff.src; } else if (jsIsIE4) { ! if (typeof(exitFrame.document.all['imgConState']) != 'undefined') ! exitFrame.document.all['imgConState'].src = jsImgConnectOff.src; } else if (jsIsNS4) { ! if (typeof(exitFrame.document.images['imgConState']) != 'undefined') ! exitFrame.document.images['imgConState'].src = jsImgConnectOff.src; } ! return; ! } // end of the 'pmcConnectDone()' function *************** *** 151,159 **** { pmcConnecting(1); - pmcDoRefreshLoader(); var inputForm = pmcGetInputForm(); if (inputForm != null) { ! inputForm.elements['sent'].value = '0'; if (typeof(inputForm.elements['submitType'].disabled) != 'undefined') inputForm.elements['submitType'].disabled = false; --- 160,167 ---- { pmcConnecting(1); var inputForm = pmcGetInputForm(); if (inputForm != null) { ! inputForm.elements['sent'].value = 0; if (typeof(inputForm.elements['submitType'].disabled) != 'undefined') inputForm.elements['submitType'].disabled = false; |