[Phpfreechat-svn] SF.net SVN: phpfreechat: [1050] trunk
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-07-01 11:52:31
|
Revision: 1050 http://svn.sourceforge.net/phpfreechat/?rev=1050&view=rev Author: kerphi Date: 2007-07-01 04:52:09 -0700 (Sun, 01 Jul 2007) Log Message: ----------- Bug fix : IE6 clients were frequently disconnected Modified Paths: -------------- trunk/data/public/js/pfcclient.js trunk/data/public/js/prototype.js trunk/themes/default/chat.js.tpl.php Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-07-01 10:41:31 UTC (rev 1049) +++ trunk/data/public/js/pfcclient.js 2007-07-01 11:52:09 UTC (rev 1050) @@ -44,7 +44,6 @@ this.max_refresh_delay = pfc_max_refresh_delay; this.last_response_time = new Date().getTime(); this.last_request_time = new Date().getTime(); - this.canupdatenexttime = true; /* unique client id for each windows used to identify a open window * this id is passed every time the JS communicate with server @@ -333,11 +332,6 @@ } else if (cmd == "update") { - // if the first ever refresh request never makes it back then the chat will keep - // trying to refresh as usual - // this only helps if we temporarily lose connection in the middle of an established - // chat session - this.canupdatenexttime = true; } else if (cmd == "version") { @@ -925,20 +919,8 @@ clearTimeout(this.timeout); if (start) { - var res = true; - if (this.canupdatenexttime) - { - // the connection is ok - res = this.sendRequest('/update'); - this.canupdatenexttime = false; // don't update if the last 'ok' response is not yet received - } - else if ((new Date().getTime() - this.last_response_time) > this.max_refresh_delay) - { - // the connection is probably closed or very slow - res = this.sendRequest('/update'); - this.canupdatenexttime = false; // don't update if the last 'ok' response is not yet received - this.last_response_time = new Date().getTime(); - } + this.sendRequest('/update'); + // setup the next update this.timeout = setTimeout('pfc.updateChat(true)', this.refresh_delay); } @@ -1802,4 +1784,4 @@ this.pfc = new pfcPrompt($('pfc_container')); return this.pfc; } -}; \ No newline at end of file +}; Modified: trunk/data/public/js/prototype.js =================================================================== --- trunk/data/public/js/prototype.js 2007-07-01 10:41:31 UTC (rev 1049) +++ trunk/data/public/js/prototype.js 2007-07-01 11:52:09 UTC (rev 1050) @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.5.1 +/* Prototype JavaScript framework, version 1.5.1.1 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. @@ -7,7 +7,7 @@ /*--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.5.1', + Version: '1.5.1.1', Browser: { IE: !!(window.attachEvent && !window.opera), @@ -24,8 +24,8 @@ document.createElement('form').__proto__) }, - ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>', - JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/, + ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, emptyFunction: function() { }, K: function(x) { return x } @@ -364,11 +364,15 @@ return this.sub(filter || Prototype.JSONFilter, '#{1}'); }, + isJSON: function() { + var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + evalJSON: function(sanitize) { var json = this.unfilterJSON(); try { - if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json))) - return eval('(' + json + ')'); + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); } catch (e) { } throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); }, @@ -1270,10 +1274,12 @@ } else document.getElementsByClassName = function(className, parentElement) { var children = ($(parentElement) || document.body).getElementsByTagName('*'); - var elements = [], child; + var elements = [], child, pattern = new RegExp("(^|\\s)" + className + "(\\s|$)"); for (var i = 0, length = children.length; i < length; i++) { child = children[i]; - if (Element.hasClassName(child, className)) + var elementClassName = child.className; + if (elementClassName.length == 0) continue; + if (elementClassName == className || elementClassName.match(pattern)) elements.push(Element.extend(child)); } return elements; Modified: trunk/themes/default/chat.js.tpl.php =================================================================== --- trunk/themes/default/chat.js.tpl.php 2007-07-01 10:41:31 UTC (rev 1049) +++ trunk/themes/default/chat.js.tpl.php 2007-07-01 11:52:09 UTC (rev 1050) @@ -73,7 +73,7 @@ params['f'] = 'handleRequest'; params['cmd'] = cmd; new Ajax.Request(url, { - method: 'post', + method: 'get', parameters: params, onSuccess: function(transport) { eval( transport.responseText ); @@ -158,4 +158,4 @@ <?php if ($debug) { ?> <div id="pfc_debug"></div> -<?php } ?> \ No newline at end of file +<?php } ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |