Ozzu Fader script problem

  • King Moonraiser
  • Born
  • Born
  • User avatar
  • Posts: 1

Post 3+ Months Ago

If you browse these forums using Opera 8.x, you will notice the link fader doesn't work too well. I believe this is due to Opera fixing their DOM to be more standard in the new release. Just replace the detection logic:

Before:
Code: [ Select ]
if (navigator.userAgent.indexOf("Opera") != -1) opera = true
else if (document.all && !opera) ie = true
else if (!document.all && document.getElementById) dom = true;
  1. if (navigator.userAgent.indexOf("Opera") != -1) opera = true
  2. else if (document.all && !opera) ie = true
  3. else if (!document.all && document.getElementById) dom = true;

After:
Code: [ Select ]
// Modified to let Opera 8 use standard dom
opera = false;
ie = false;
dom = false;

if (navigator.userAgent.indexOf("Opera 8") != -1 || navigator.userAgent.indexOf("Opera/8") != -1) dom = true;
else if (navigator.userAgent.indexOf("Opera") != -1) opera = true;
else if (document.all && !opera) ie = true;
else if (!document.all && document.getElementById) dom = true;
  1. // Modified to let Opera 8 use standard dom
  2. opera = false;
  3. ie = false;
  4. dom = false;
  5. if (navigator.userAgent.indexOf("Opera 8") != -1 || navigator.userAgent.indexOf("Opera/8") != -1) dom = true;
  6. else if (navigator.userAgent.indexOf("Opera") != -1) opera = true;
  7. else if (document.all && !opera) ie = true;
  8. else if (!document.all && document.getElementById) dom = true;

Opera 8.0 seemed to need the variables to be explicitly set (true of false) rather than undefined.

I don't know if the fix applies to the 7.x series of Opera. If so, it could be extended to check for Opera 7.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ScienceOfSpock
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1893
  • Loc: Las Vegas

Post 3+ Months Ago

I think someone needs to take a look at the fader.js script here on Ozzu.

It throws errors almost constantly in Firefox, and rarely, it throws about 10 errors a second, which clogs up the Firefox JS console so bad, it slows the browser to a crawl until I refresh the page or click a link.

The first error is:
Code: [ Select ]
Error: fader is not defined
Source File: http://www.ozzu.com/fader.js
Line: 130
  1. Error: fader is not defined
  2. Source File: http://www.ozzu.com/fader.js
  3. Line: 130


the second error is:
Code: [ Select ]
Error: document.links[x] has no properties
Source File: http://www.ozzu.com/fader.js
Line: 118
  1. Error: document.links[x] has no properties
  2. Source File: http://www.ozzu.com/fader.js
  3. Line: 118


and the one that clogs my JS console is:
Code: [ Select ]
Error: uncaught exception: [Exception... "Object cannot be created in this context" code: "9" nsresult: "0x80530009 (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location: "http://www.ozzu.com/fader.js Line: 58"]


All of this is on Firefox 1.0.6 (but has happened since at least 1.0.4)

Anyone else seeing similar behavior or is it just me?
  • MISC/A++
  • Expert
  • Expert
  • User avatar
  • Posts: 508
  • Loc: UnderGround

Post 3+ Months Ago

I use FireFox both on linux and windows and it works fine, not sure what could it be.
  • ScienceOfSpock
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1893
  • Loc: Las Vegas

Post 3+ Months Ago

Check your Javascript Console. Sometimes when it seems that Ozzu is lagging, it's actually doing the 10-second thing I mentioned above.

Should have mentioned this when I posted, this is on Windows. Under Suse 9.3 I have no problems.
  • sana
  • Expert
  • Expert
  • User avatar
  • Posts: 592
  • Loc: I am back!!

Post 3+ Months Ago

I am using Firefox on windows , and never encountered this problem.
  • sana
  • Expert
  • Expert
  • User avatar
  • Posts: 592
  • Loc: I am back!!

Post 3+ Months Ago

I am using Firefox on windows , and never encountered this problem.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Interesting. I get the lagging from time to time but never associated it with the fader.js. But you are correct. The error is there. My javascript console is loaded with them.
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2391
  • Loc: Edinburgh, Scotland

Post 3+ Months Ago

I've seen this error since waaaaay back - ever since I started using Firefox (about 0.9-ish). Never reported the error as I never thought it was a big deal.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9089
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

So if I am understanding correctly this error seems to happens randomly? If any of you can figure out when it happens exactly that would help me duplicate the problem so that I can attempt to fix it.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

The primary error is this:
Error: hex has no properties
Source File: http://www.ozzu.com/fader.js
Line: 77

The code function is:
Code: [ Select ]
function convert2Dec(hex)
    {    
        var rgb = new Array();
        for (var u = 0; u < 3; u++)
            rgb[u] = parseInt(hex.substring(u*2, u*2+2), 16);
        return rgb;
    }
  1. function convert2Dec(hex)
  2.     {    
  3.         var rgb = new Array();
  4.         for (var u = 0; u < 3; u++)
  5.             rgb[u] = parseInt(hex.substring(u*2, u*2+2), 16);
  6.         return rgb;
  7.     }


Other errors:
Error: fader is not defined
Source File: http://www.ozzu.com/fader.js
Line: 130

Code: [ Select ]
function clearFade()
    {
        if (document.layers) return;
        if (fader) clearInterval(fader);
        fader = setInterval("fade(" + x + ", 0)", speed);
    }
  1. function clearFade()
  2.     {
  3.         if (document.layers) return;
  4.         if (fader) clearInterval(fader);
  5.         fader = setInterval("fade(" + x + ", 0)", speed);
  6.     }


Error: document.links[x] has no properties
Source File: http://www.ozzu.com/fader.js
Line: 118

Code: [ Select ]
function findLink(over)
    {
        if (document.layers) return;
        if (fader)
            {
                clearInterval(fader);
                document.links[x].style.color = "#" + ocs[x];
            }
        if (over && !this.id) this.id = over;
        x = 0;
        while (!(this.id == document.links[x].id) && (x < document.links.length))
            x++;
        if (this.id == document.links[x].id)
            {
                oc = currentColour(x);
                fader = setInterval("fade(" + x + ", 1)", speed);
            }
    }
  1. function findLink(over)
  2.     {
  3.         if (document.layers) return;
  4.         if (fader)
  5.             {
  6.                 clearInterval(fader);
  7.                 document.links[x].style.color = "#" + ocs[x];
  8.             }
  9.         if (over && !this.id) this.id = over;
  10.         x = 0;
  11.         while (!(this.id == document.links[x].id) && (x < document.links.length))
  12.             x++;
  13.         if (this.id == document.links[x].id)
  14.             {
  15.                 oc = currentColour(x);
  16.                 fader = setInterval("fade(" + x + ", 1)", speed);
  17.             }
  18.     }


Unfortunately Firefox's javascript console doesn't give the time of the error, so I've cleared my log in an attempt to discover when it happens.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

It appears to be random. Same three errors. I was able to initiate the error by mousing over the Meet The Mods Link and I got the error when entering this post to reply. But I wasn't able to consistantly duplicate the errors.
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2391
  • Loc: Edinburgh, Scotland

Post 3+ Months Ago

I think the error comes about when you "mouse over" a link before the page loads up entirely. If you refresh the page, or click on one of the forums, and then quickly mouse over some links, you'll see the error in the JS console.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Yes. I can duplicate the errors fairly consistantly that way.
  • ScienceOfSpock
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1893
  • Loc: Las Vegas

Post 3+ Months Ago

I see the lag error after replying mostly, I think.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I did get that frequently as well. I seem to be able to duplicate it more consistantly where simple_header.tpl is involved.

//edit -- strike that. I forgot the reply thing uses overall_header.tpl
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

Mine was full of the hex error aswell, but I cleared it and haven't had it come back yet. I'll keep an eye out ;)
  • Alan Lastufka
  • Proficient
  • Proficient
  • User avatar
  • Posts: 318
  • Loc: ChicagoLand, IL, USA

Post 3+ Months Ago

Only works on regular links, the Moderators and SuperModerators and Admins all go back to their original color.

This would lead me to believe that they have extra code on the mouse out that restores that color. Seems it would be pretty easy to add that to the regular links as well so my view of Ozzu doesn't look so bloddy evil compared to everyone elses... :)

Then of course, it might not matter to change it for the 2% of us using Opera...
  • pramitroy
  • Guru
  • Guru
  • pramitroy
  • Posts: 1284

Post 3+ Months Ago

The links turned red by mouse over cannot be retained.
  • Alan Lastufka
  • Proficient
  • Proficient
  • User avatar
  • Posts: 318
  • Loc: ChicagoLand, IL, USA

Post 3+ Months Ago

But the links to the Mods and Admin user profiles, which turn red when I roll over them, do restore to their original colors on mouse out.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

I'll point this out to Bigwebmaster when I see him later. I'm not sure if he saw the original post on this. He's the only one that can do anything with the actual code here.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Only difference I see between thoose links is an inline style applied to the admin/mod specific ones.
Code: [ Select ]
style="color:#123456;"

Which leads me to believe that this line in fader.js is not able to access the original color of other links. (approx line 56)
Code: [ Select ]
        if (opera) cc = document.links[index].style.color


Making this edit seems to get things going in Opera 8.5
Code: [ Select ]
        if (opera) cc = document.links[index].style.color
        else if (ie) cc = document.links[index].currentStyle.color
        else if (dom) cc = document.defaultView.getComputedStyle(document.links[index], '').getPropertyValue("color");
  1.         if (opera) cc = document.links[index].style.color
  2.         else if (ie) cc = document.links[index].currentStyle.color
  3.         else if (dom) cc = document.defaultView.getComputedStyle(document.links[index], '').getPropertyValue("color");

Code: [ Select ]
        if (false) cc = document.links[index].style.color //if (opera) cc = document.links[index].style.color
        else if (ie) cc = document.links[index].currentStyle.color
        else if (dom || opera) cc = document.defaultView.getComputedStyle(document.links[index], '').getPropertyValue("color");
  1.         if (false) cc = document.links[index].style.color //if (opera) cc = document.links[index].style.color
  2.         else if (ie) cc = document.links[index].currentStyle.color
  3.         else if (dom || opera) cc = document.defaultView.getComputedStyle(document.links[index], '').getPropertyValue("color");

I'll leave it to Bigweb to verify though.
Thanks for pointing this out Alan. :D
  • Alan Lastufka
  • Proficient
  • Proficient
  • User avatar
  • Posts: 318
  • Loc: ChicagoLand, IL, USA

Post 3+ Months Ago

joebert wrote:
Thanks for pointing this out Alan. :D

No prob. That's what happens when you get stuck working late alone at the office and have nothing to do, so you decide to make every link change bright red, just because you can, and then the darn Admin and Mod links won't stay changed and it messes up the whole thing... lol
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

That might help Joebert. Bigweb was trying to decide whether to try to fix it or just remove it. That might make it easier for him to decide.

Post Information

  • Total Posts in this topic: 23 posts
  • Users browsing this forum: No registered users and 9 guests
  • 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 post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.