Template:Tooltip-Map - REDUX

Discussion and support for the primary English wiki. Click here for live help.

Re: Template:Tooltip-Map - REDUX

Postby lirmont on Wed Nov 04, 2009 3:38 pm

1: The $P object you created by changing the prototype.js library doesn't seem to exist in IE8, since it doesn't show up in the debugger and the prototype.js file is loaded. Perhaps the error broke it, or it really doesn't exist for IE8 users.
2: The initial error is thrown by line 158 of User:Anthoron/tooltip.js. Specifically, that the HTML Object "document.body" doesn't have the function "getElementsByClassName".
3: Lines 159 and 160 are affected by this, since the variable "divs" doesn't exist (i.e. is "undefined") because of the error thrown in line 158.
4: There is a $D object that exists (see screenshot of IE8's debugger) that has "getElementsByClassName". I didn't bother to look where it came from.
5: To fix the error in line 158 for IE8, you might do something like:
Code: Select all
// starting from line 158
var divs;
try {
    // Existing, working code
    var divs = document.getElementsByClassName('tooltip');
} catch (e) {
    // When above code invariably fails in IE8, do...
    var divs = $D.getElementsByClassName('tooltip');
}

// continuing with current line 159
for (i = 0; i < divs.length; i++) {
    new Tooltip(divs[i].id, divs[i].id + '-tooltip');
}
// END OF FILE

6: The variable "Tooltip", which is used as a class object, also uses the newly added $P object (which doesn't exist). This occurs on lines 30 and 31 in the same file.
7: To fix the errors these will undoubtedly throw since $P doesn't exist, you might replace $P each time with the following:
Code: Select all
// starting from line 30, replacing lines 30 and 31
    var this.element;
    var this.tool_tip;
    try {
        this.element      = $P(element);
    } catch (e) {
        this.element      = document.getElementById(element);
    }
    try {
        this.tool_tip     = $P(tool_tip);
    } catch (e) {
        this.tool_tip     = document.getElementById(tool_tip);
    }   
// ...

8: Another thought, I remember there being some separate loading javascript code that first loaded the prototype.js library and then the tooltip.js file. Have you looked at it to see if the changes Wikia made to prototype.js would affect it? I mean, it clearly works in Firefox, prototype.js and all, so I'd think it would be worth looking at just to check and see if some prototype.js function was used within the loading portion that maybe needs to be updated after the changes. I forget where that code was placed, though.
9: In reference to #2, the actual code responsible for the error is in prototype.js, line 4857, and it can probably be fixed by the following:
Code: Select all
// starting at line 4857, replacing the line
    try {
        return $P(parentElement || document.body).getElementsByClassName(className);
    } catch (e) {
        // "document" has the function "getElementsByClassName", according to the IE8 debugger
        return $P(parentElement || document).getElementsByClassName(className);
    }

10: The code I'm providing you with was tested within IE8's developer tool's debugger that comes integrated with IE8. If it doesn't work in actual implementation, I'm sorry.

Screenshot:
IE Debug: Proof of $D ("getElementsByClassName" is the 19th function under $D)
lirmont
Too weak
 
Posts: 41
Joined: Wed Nov 07, 2007 5:04 am
World: Shiva
Nation: San d'Oria

Re: Template:Tooltip-Map - REDUX

Postby KyleH on Fri Nov 06, 2009 6:59 am

Thanks for your help! I went ahead and implemented your changes, and it looks like the number of errors on FFXIclopedia has gone down dramatically. We're still getting quite a few, but I think that a substantial number of them are because users are browsing with cached javascript.

I have some other good news too: we recently hired a new engineer, and I was able to snag some of his time to come help out here. I'll have him take a look at tooltip.js and the rest of the site javascript and see what we can optimize.

I appreciate your patience as well as the time that you have already put in to helping with this issue. Thanks a lot!
KyleH
Wikia Staff
Wikia Staff
 
Posts: 10
Joined: Tue Feb 26, 2008 8:06 pm

Re: Template:Tooltip-Map - REDUX

Postby Gahoo on Fri Nov 06, 2009 3:18 pm

Thanks to all those that are helping with this! We have the bestest community ever!
User avatar
Gahoo
Impossible to gauge!
 
Posts: 2445
Joined: Fri Feb 03, 2006 5:42 am
World: Phoenix
Nation: Windurst
Title: Editor's Hatchet Man

Re: Template:Tooltip-Map - REDUX

Postby KyleH on Fri Nov 06, 2009 9:51 pm

FYI, the engineer who will be helping out is Meitar. I've asked him to take a look and determine if migrating the code to jQuery is something that he can do within a reasonable amount of time. You'll probably see him messing around with the site JavaScript. I've also pointed him to this thread in case he has any questions about how things are supposed to work.

Regardless, it looks like the fixes that lirmont suggested work beautifully, so there is no urgent need to worry about anything else. We can finally see how many people actually visit FFXI ... the script error was blocking our analytics calls for a large number of users before. :)

Thanks!
KyleH
Wikia Staff
Wikia Staff
 
Posts: 10
Joined: Tue Feb 26, 2008 8:06 pm

Re: Template:Tooltip-Map - REDUX

Postby Catrinm on Thu Nov 12, 2009 11:26 am

Thanks Lirmont, you saved me a ton of work :)

And I wish Meitar the best of luck with the code - Ffxiclopedia does things with wiki code that some porn stars refuse to do (^.^)
Catrinm of Shiva, formerly User:Idun_Midgardsormr
Image
User avatar
Catrinm
Decent Challenge
 
Posts: 517
Joined: Sat Apr 12, 2008 12:19 am
Location: Arizona
World: Shiva
Nation: Windurst
Title: Pursuer of the Past
Jobs: [75BST] [75WHM] [75SMN] [56BRD] [40BLM] [38PLD] [38NIN] [37WAR] - alt char is [75BST] [37WHM]

Re: Template:Tooltip-Map - REDUX

Postby KyleH on Thu Nov 12, 2009 9:02 pm

Heya! Meitar finished porting the tooltip code to jQuery today and he just put the changes in place. Could you guys take a look and let me know if everything appears to be working properly?
KyleH
Wikia Staff
Wikia Staff
 
Posts: 10
Joined: Tue Feb 26, 2008 8:06 pm

Re: Template:Tooltip-Map - REDUX

Postby Gahoo on Thu Nov 12, 2009 10:52 pm

Seems to be working just fine on my end.

EDIT: I take that back. Crt+f5 and now not working.

EDIT2: Looks like maybe Meitar changed the class from "tooltip" to "ffxiTooltip". I tried changing the class at Template:Tooltip but that didn't solve the problem.
User avatar
Gahoo
Impossible to gauge!
 
Posts: 2445
Joined: Fri Feb 03, 2006 5:42 am
World: Phoenix
Nation: Windurst
Title: Editor's Hatchet Man

Re: Template:Tooltip-Map - REDUX

Postby KyleH on Sat Nov 14, 2009 1:46 am

Heya ... are you still having trouble? I just tested in IE8, Firefox 3, and Safari 4, and they seem to be working properly. Can you give a specific page where they aren't working properly? I've been using Bastok Markets as my test page, but it's possible that there are implementations of the tooltip code that isn't used there. Also, please let me know what browser you're using, as well as any javascript errors that you experience.

Thanks!
KyleH
Wikia Staff
Wikia Staff
 
Posts: 10
Joined: Tue Feb 26, 2008 8:06 pm

Re: Template:Tooltip-Map - REDUX

Postby Catrinm on Mon Nov 16, 2009 8:33 am

Just a thought, but since this is now a site-wide script, should it not be moved into the site pages and out of a user page? No offense to Anthoron, he did 99% of the work on the original, and perhaps could be attributed for that, but if his account ever expires or gets deleted, we're back to square one!
Catrinm of Shiva, formerly User:Idun_Midgardsormr
Image
User avatar
Catrinm
Decent Challenge
 
Posts: 517
Joined: Sat Apr 12, 2008 12:19 am
Location: Arizona
World: Shiva
Nation: Windurst
Title: Pursuer of the Past
Jobs: [75BST] [75WHM] [75SMN] [56BRD] [40BLM] [38PLD] [38NIN] [37WAR] - alt char is [75BST] [37WHM]

Re: Template:Tooltip-Map - REDUX

Postby Gahoo on Mon Nov 16, 2009 7:24 pm

KyleH wrote:Heya ... are you still having trouble? I just tested in IE8, Firefox 3, and Safari 4, and they seem to be working properly. Can you give a specific page where they aren't working properly? I've been using Bastok Markets as my test page, but it's possible that there are implementations of the tooltip code that isn't used there. Also, please let me know what browser you're using, as well as any javascript errors that you experience.

Thanks!

Hmm... seems to be working. So I guess we're all good.
User avatar
Gahoo
Impossible to gauge!
 
Posts: 2445
Joined: Fri Feb 03, 2006 5:42 am
World: Phoenix
Nation: Windurst
Title: Editor's Hatchet Man

Re: Template:Tooltip-Map - REDUX

Postby Gahoo on Mon Nov 16, 2009 7:25 pm

Catrinm wrote:Just a thought, but since this is now a site-wide script, should it not be moved into the site pages and out of a user page? No offense to Anthoron, he did 99% of the work on the original, and perhaps could be attributed for that, but if his account ever expires or gets deleted, we're back to square one!

I would but I hesitate to touch it for fear of breaking something.
User avatar
Gahoo
Impossible to gauge!
 
Posts: 2445
Joined: Fri Feb 03, 2006 5:42 am
World: Phoenix
Nation: Windurst
Title: Editor's Hatchet Man

Re: Template:Tooltip-Map - REDUX

Postby KyleH on Wed Nov 18, 2009 7:40 pm

The site would load faster if we moved the code in to MediaWiki:Common.js. The downside is that doing so would remove the ability of non-sysops to edit the code. That's actually probably a good idea anyway, but is anyone still actively working on it? If not, I can move it for you (there will need to be a few changes, but nothing major).
KyleH
Wikia Staff
Wikia Staff
 
Posts: 10
Joined: Tue Feb 26, 2008 8:06 pm

Re: Template:Tooltip-Map - REDUX

Postby Tahngarthor on Wed Nov 18, 2009 8:04 pm

I would think it's a good idea, as it would lessen the chance that someone who doesn't know what they're doing would mess it up. of course I'd wait for gahoo's words on this.
Image
User avatar
Tahngarthor
Impossible to gauge!
 
Posts: 6107
Joined: Tue Dec 19, 2006 12:12 am
Location: Shiva
World: Shiva
Nation: Bastok
Title: Dynamis-Tavnazia Interloper
Jobs: Summoner - Puppetmaster - Scholar - Dancer 75

Re: Template:Tooltip-Map - REDUX

Postby Gahoo on Wed Nov 18, 2009 10:17 pm

KyleH wrote:The site would load faster if we moved the code in to MediaWiki:Common.js. The downside is that doing so would remove the ability of non-sysops to edit the code. That's actually probably a good idea anyway, but is anyone still actively working on it? If not, I can move it for you (there will need to be a few changes, but nothing major).

It can be moved. Thanks Kyle.
User avatar
Gahoo
Impossible to gauge!
 
Posts: 2445
Joined: Fri Feb 03, 2006 5:42 am
World: Phoenix
Nation: Windurst
Title: Editor's Hatchet Man

Re: Template:Tooltip-Map - REDUX

Postby Catrinm on Thu Nov 19, 2009 9:26 pm

Any changes that need to be made would necessarily need sysop approval anyway, so it's for the best :)
Catrinm of Shiva, formerly User:Idun_Midgardsormr
Image
User avatar
Catrinm
Decent Challenge
 
Posts: 517
Joined: Sat Apr 12, 2008 12:19 am
Location: Arizona
World: Shiva
Nation: Windurst
Title: Pursuer of the Past
Jobs: [75BST] [75WHM] [75SMN] [56BRD] [40BLM] [38PLD] [38NIN] [37WAR] - alt char is [75BST] [37WHM]

Previous

Return to English

Who is online

Users browsing this forum: CommonCrawl [Bot] and 1 guest