MyBB Community Forums

Full Version: Javascript Modification Relating to Expanders
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, everyone. I've been enjoying the ease and usability of MyBB recently and in the process, I've developed a question involving one of the Javascript files (general.js). I'll try to be to the point, but I'll be happy to explain further if there are any questions.

What I'm Trying to Do

The reason I'm modifying the js file in the first place is so that I can have more control when it comes to being able to expand and collapse forum categories, etc. (usually indicated by "+" or "-" icons). Instead of using just images to activate the appropriate functions, I'm editing them in order to allow "div" tags, instead.

Where I'm Coming From

The website I'm currently trying to get this to work with is located at: w w w . p o k e g a z e . c o m (without the spaces - I'm trying to limit google exposure for now). Currently, you are able to click on the forum category name (in the dark, blue bars) and FireFox will follow suit. However, Internet Explorer doesn't want to cooperate.

What I've Done So Far

So far I've edited a total of 7 lines in general.js. Here they are:
On line 435 of general.js: Wrote:expanders = DomLib.getElementsByClassName(document, "div", "expander"); //Original: expanders = DomLib.getElementsByClassName(document, "img", "expander");
On line 454 of general.js: Wrote:expander.controls = expander.id.replace("_div", ""); //Original: expander.controls = expander.id.replace("_img", "");
On line 459 of general.js: Wrote:row.controls = expander.id.replace("_div", ""); //Original: row.controls = expander.id.replace("_img", "");
On line 495 of general.js: Wrote:// -deleted- Original: element.src = element.src.replace("collapse_collapsed.gif", "collapse.gif");
On line 496 of general.js: Wrote:// -deleted- Original: element.alt = "[-]";
On line 502 of general.js: Wrote:// -deleted- Original: element.src = element.src.replace("collapse.gif", "collapse_collapsed.gif");
On line 503 of general.js: Wrote:// -deleted- Original: element.alt = "[+]";

My Question/Problem

Basically, my problem is that IE won't work. I think I've broken it down to line 470 of general.js where it returns false since apparently the conditional statement above 470 returns "undefined" for elements.controls. Any help on what I might be able to do in order to fix this would be highly appreciated.

Please note I've developed my own javascript which acts as an excellent collapse/expand script for other websites (non-forums) while including the saving of state in cookies, too. However, I would really like to just make changes in the myBB js, instead, in order to help keep it uniform with the rest of myBB's programming, scripting, etc.

Thank you for your time. Have a good day!