[Phpfreechat-svn] SF.net SVN: phpfreechat: [835] trunk/src/client/pfcgui.js
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-10-17 08:06:37
|
Revision: 835 http://svn.sourceforge.net/phpfreechat/?rev=835&view=rev Author: kerphi Date: 2006-10-17 01:06:31 -0700 (Tue, 17 Oct 2006) Log Message: ----------- add some comments to scrollDown function Modified Paths: -------------- trunk/src/client/pfcgui.js Modified: trunk/src/client/pfcgui.js =================================================================== --- trunk/src/client/pfcgui.js 2006-10-17 07:44:45 UTC (rev 834) +++ trunk/src/client/pfcgui.js 2006-10-17 08:06:31 UTC (rev 835) @@ -22,16 +22,26 @@ }, /** - * scroll down from the posted message height + * Scroll down the message list area by elttoscroll height + * - elttoscroll is a message DOM element which has been appended to the tabid's message list + * - this.elttoscroll is an array containing the list of messages that will be scrolled + * when the corresponding tab will be shown (see setTabById bellow). + * It is necessary to keep in cache the list of hidden (because the tab is inactive) messages + * because the 'scrollTop' javascript attribute + * will not work if the element (tab content) is hidden. */ scrollDown: function(tabid, elttoscroll) { + // check the wanted tabid is the current active one if (this.getTabId() != tabid) { + // no it's not the current active one so just cache the elttoscroll in the famouse this.elttoscroll array if (!this.elttoscroll[tabid]) this.elttoscroll[tabid] = Array(); this.elttoscroll[tabid].push(elttoscroll); return; } + // the wanted tab is active so just scroll down the tab content element + // by elttoscroll element height (use 'offsetHeight' attribute) var content = this.getChatContentFromTabId(tabid); content.scrollTop += elttoscroll.offsetHeight+2; this.scrollpos[tabid] = content.scrollTop; @@ -98,6 +108,7 @@ // on by one for (var i=0; i<this.elttoscroll[tabid].length; i++) this.scrollDown(tabid,this.elttoscroll[tabid][i]); + // empty the cached element list because it has been scrolled this.elttoscroll[tabid] = Array(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |