Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's Collapsing Forums Block
Author Message
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 178

PostPosted: Tue Aug 01, 2006 5:47 pm Reply with quote

I have been doing some testing, and figured out this is a fix for the issues people are having with ShoutBox / vWar Countdown & Ravens ForumsCollapsing Block.

A simple change in the readme, could fix everyones issue.

Here is the problem, in the block file itself, it calls upon the window.onload command, and its a known issue, that this command being used multiple times will cause conflicts.

After doing a little reading I found out how to fix this.
Look for the line (around 413):
Code:
window.onload=start_ticking

Comment out this line, by adding // in front of it
Code:
//window.onload=start_ticking


Now open your shoutbox.js file located in your root directory, and under:
Code:
function allonloads(){

SBpopulate();
}

Add
Code:
start_ticking();


Like this:
Code:
function allonloads(){

SBpopulate();
getVWarTime();
start_ticking();
}


What this does, is eliminates the block from executing the command to actually start the ticker, and other javascripts.....and it executes it from the shoutbox.js file....along with all the other functions that need to be executed. Im more a better coder could elaborate more.

getVWarTime loads my match countdown for the vwar block, so ignore that line...unless you use vwar and are having issues.

I hope this contributes to this amazing community that has helped me out so much.
 
View user's profile Send private message Visit poster's website
ciph3r
PostPosted: Tue Aug 01, 2006 6:40 pm Reply with quote

Ive noticed that once I made this change, when I go into anything that DOES NOT display the block, the page gets errors.
 
ciph3r
PostPosted: Tue Aug 01, 2006 8:08 pm Reply with quote

Ok, it seems that I have corrected that issue.

What I did, is kind of reverse from what was previously posted.
In the shoutbox.js file, I commented out the window.onload for all the onloads:
Code:
//window.onload=allonloads;


Then in the block-ForumsCollapsing.php file I changed:
Code:
window.onload=start_ticking

To:
Code:
window.onload=allonloads;


All 3 blocks are working now, with no errors on any pages.
 
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9449
Location: Arizona

PostPosted: Tue Aug 01, 2006 8:19 pm Reply with quote

I have made this a sticky, but want everyone to understand that there are too many combinations of blocks / scripts out there to cover them in the readme, nor does the author have time to test this out on all sorts of combinations.

That is what makes this community so great in that we have folks like yourself which offer up these excellent solutions. I know that this will help others and applaud you for it.

Thanks!

Cheers

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
ciph3r
PostPosted: Tue Aug 01, 2006 10:57 pm Reply with quote

Well, I want to update this, saying its not 100% a fix. I was under the impression it fixed all the pages with all the errors, but for some reason Im stilling getting them on some pages. It is deffinatly the way the start_ticking is set up to load...and I would I knew more about coding so I could figure out another way to execute it.
 
ciph3r
PostPosted: Wed Aug 23, 2006 1:25 am Reply with quote

Anyone got any Ideas?
 
technocrat
Life Cycles Becoming CPU Cycles


Joined: Jul 07, 2005
Posts: 511

PostPosted: Wed Aug 23, 2006 9:25 am Reply with quote

You need to handle the loads differently. First of all the standard is to not even use onload at all. You should be using window.addEventListener. So what you need to do is the change them to an if statement. In this example you just need to change "function" to what your javascript function is.

Code:
    if (window.addEventListener)

        window.addEventListener(\"load\", function, false)
    else if (window.attachEvent)
        window.attachEvent(\"onload\", function)
    else if (document.getElementById)
        womAdd('function()');


The last line uses this: Only registered users can see links on this board! Get registered or login!
Which is simular to what you are using, but a bit cleaner and faster. If you want to see a working example is in the Evo 2.0.0 RC1 download.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! / Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message
ciph3r
PostPosted: Sun Aug 27, 2006 1:31 pm Reply with quote

so if im running the shoutbox, and the forumscollapsing block...............where exactly will i put this.

Im sorry but im a bit of a newbie.

Would I put this in the shoutbox.js file.......or add it where the onload function is in both the forumscollapsing block, and the shoutbox.js?
 
technocrat
PostPosted: Mon Aug 28, 2006 10:42 am Reply with quote

You just need to replace ALL the onload with the code I provided and then use the WOM loader, or something else like it to create a loading system as a backup for all other browsers.
 
ciph3r
PostPosted: Mon Aug 28, 2006 7:35 pm Reply with quote

Ok, so I erase all the window.onload commands, and paste that code.

Then where exactly would I use the command to initiate that new loader, and what exactly would the command be?

Sorry, just a bit confused.
 
ciph3r
PostPosted: Tue Aug 29, 2006 12:32 pm Reply with quote

Any help will be greatly appriciated.

This is still what i have so far.

Code:
function allonloads(){ 

SBpopulate();
getVWarTime();
start_ticking();
}
 
technocrat
PostPosted: Wed Aug 30, 2006 9:09 am Reply with quote

Did you read the article I posted it explains what to do
 
ciph3r
PostPosted: Wed Aug 30, 2006 1:26 pm Reply with quote

Yes I read it, but am a little bit confused.

I would remove function allonloads from the shoutbox.js file.
I opened that file, removed the allonloads and added the code you gave me.

Code:
if (window.addEventListener) 

        window.addEventListener(\"load\", function, false)
    else if (window.attachEvent)
        window.attachEvent(\"onload\", function)
    else if (document.getElementById)
        womAdd('SBPopulate()');


But cant get the shoutbox working.
I uploaded the WOM.js file, which I think is the loader right?
 
ciph3r
PostPosted: Wed Aug 30, 2006 1:47 pm Reply with quote

Dont ask me how, but everything seems to be working fine now.
I changed the window.onload=start_ticking to window.onload1=start_ticking() and it seems like everything is working fine now, without errors on any of the pages.

I have
Code:
function allonloads(){ 

SBpopulate();
getVWarTime();
}


in the Shoutbox.js file, and the block is still working on the main page, so i dunno what changed.........but its working.

I do however want to get this WOM loader stuff figured out, because I would like to use that instead of how it is setup.

Thx in advance.
 
technocrat
PostPosted: Thu Aug 31, 2006 9:33 am Reply with quote

But you dont want to use window.onload thats not a good way to make your scripts work. Which is what I have been telling you. Confused

I am not sure how to make it any clearer. I have given you all the tools to make this work, but I dont know what each script you have is using or how they are setup. So hopefully you will figure this out
 
ciph3r
PostPosted: Thu Aug 31, 2006 12:23 pm Reply with quote

The only thing that really confuses me is this:

Code:
if (window.addEventListener) 

        window.addEventListener(\"load\", function, false)
    else if (window.attachEvent)
        window.attachEvent(\"onload\", function)
    else if (document.getElementById)
        womAdd('SBPopulate()');
        womAdd('start_ticking()');
        womAdd('getvWarTime()');


I pasted this code where the function allonloads was in the shoutbox.js file.
I then uploaded the WOM.js file, and refreshed my site, and nothing that used javascripts worked. I noticed in dreamweaver when I pasted the code, half of it was still blue, which means its not closed correctly i think.

I have been reading, and trying different things, but my schedule @ work, and trying to run a clan are keeping me busy.

Ill keep trying.
Thx
 
technocrat
PostPosted: Thu Aug 31, 2006 12:25 pm Reply with quote

Have you been changing function to the name of the function to load?
 
ciph3r
PostPosted: Thu Aug 31, 2006 11:24 pm Reply with quote

all the functions...im retarted....

I just changed the last function, in the womAdd part.
I didnt change all the functions.

So how would I do more than one function? For example, if I wanted to load the shoutbox, vwartime, and forumscollapsing on the main page, but not use forumscollapsing on other pages.

Code:
if (window.addEventListener) 

        window.addEventListener(\"load\", SBPopulate, false)
    else if (window.attachEvent)
        window.attachEvent(\"onload\", SBPopulate)
    else if (document.getElementById)
        womAdd('SBPopulate()');


Instead of

Code:
window.onload=allonloads


Am I on the right track?
 
technocrat
PostPosted: Fri Sep 01, 2006 10:10 am Reply with quote

Yes you are
 
ciph3r
PostPosted: Fri Sep 01, 2006 2:23 pm Reply with quote

I cant seem to get it to work. I noticed when i pasted that code into the shoutbox.js file, it was still blue (i use dreamweaver) like it isnt closed off correctly or something.
 
ciph3r
PostPosted: Wed Oct 04, 2006 11:19 am Reply with quote

Any ideas?
 
technocrat
PostPosted: Thu Oct 05, 2006 9:30 am Reply with quote

Here is what we used
Code:
if(window.addEventListener) 

    window.addEventListener("load",allonloads,false);
else if (window.attachEvent)
    window.attachEvent("onload", allonloads)
else if (document.getElementById)
    womAdd('allonloads()');
 
ciph3r
PostPosted: Sun Oct 22, 2006 11:39 pm Reply with quote

Fixed, and thank you so much.
 
ciph3r
PostPosted: Sat Nov 18, 2006 2:21 pm Reply with quote

I am a bit confused still on what I did.......but I deleted the WOM.js file from my root to see if the javascripts would still work, and they do.

I was told by a friend that the code doesnt call anything from the wom.js file, so they were unsure why I was told to use it. So I deleted it, and still have the code I posted above (that you gave me) and all seems to be working.

Any ideas, or better ways to explain exactly what is happening?
 
technocrat
PostPosted: Sun Nov 19, 2006 10:16 am Reply with quote

It's meant for browsers that do not follow the previous 2 types of loading. Its a backup plan basically. If all else fails do this. IE 5 for example would need this.

Though rare, it is better to error on the side of caution in my opinion.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's Collapsing Forums Block

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©