Sunday, April 22, 2007

Update: Warn Logger

Ok, after roughly 12 hours of the release of Warn Logger v1.3, its now time to release the second edition to it. Introducing Warn Logger v1.3.1!

The only added feature is the long-awaited "New Topic" mode, in which logs are saved as individual topics instead of replies to an existing topic. Along with this mode comes some dynamic tags used to show helpful data to the administrators who review the logs. Check out the installation instructions for more info.

Saturday, April 21, 2007

Update: Warn Logger

Warn Logger v1.3 was released today. It fixes a few compatibility issues with FireFox and actually works a lot smoother with both FF and IE now. One of the major issues fixed was the bug with the onLoad event.

The Frame responsible for loading post data and external links during Warn Logger's execution is required to load a page and let Warn Logger know when the page is done loading and execution can continue. The easy way of doing this is to use the onLoad event. Unfortunately, the onLoad event has some serious issues, especially when trying to dynamically change the function it calls. So, I swapped out the onLoad event with a substitute function that seems to work just as well. Here's the function:

function waitForLoad(nextcall)
{
// Since there are issues with the onLoad event, this function recurses until the document has no updated content
if (currentdoc == ""){ currentdoc = window.frames['wlframe'].location.toString() }

if (currentdoc == window.frames['wlframe'].location.toString()){ setTimeout("waitForLoad('" + nextcall + "')", 500) }
else
{
try
{
if (olddoc == window.frames['wlframe'].document.body.innerHTML){ currentdoc = ""; olddoc = "" }
else{ olddoc = window.frames['wlframe'].document.body.innerHTML; setTimeout("waitForLoad('" + nextcall + "')", 100) }
}
catch(e){ setTimeout("waitForLoad('" + nextcall + "')", 100) }
if (currentdoc == "" && olddoc == ""){ eval(nextcall) }
}
}


I call this function and pass the function to run after the page is loaded to it. Then, I change the frame SRC (document.getElementsById('wlframe').src), and ta-da! A custom onLoad event! Feel free to use this code as you please.