Technology Tools for Ministry

Community

Web-Empowered Church User Community
All Categories > Ministry Tools > eBible Extension > javascript error
Total Posts: 9 - Pages (1): [1]
Author: Barry Gresens
Posted: Jan 22 2008 - 07:14 PM
Subject: javascript error
I get an eBible javascript error on the following page:

http://www.galileeumc.org/index.php?id=194

When I debug the error, it shows the error on line 708 of

http://www.galileeumc.org/typo3conf/ext/wec_ebible/res/ebibleicious.js

which reads

"if (node.nextSibling) {" where the value of node is null.

Knowing javascript I could code in a workaround for this, but it might be a sign of a bigger problem.

Any ideas?

By the way, my site was one of those hit with migration errors a couple days ago through VineHosting. I do NOT know if the problem existed prior to the migration, but after eBible installation.

Thanks for any help you can provide

-Barry Gresens
barry@gresens.org
user picture Author: Christoph Koehler
Posted: Jan 22 2008 - 09:14 PM
Subject: re: javascript error
Barry,

I checked the link to the site you gave and don't see any javascript errors. Maybe it's fixed now...

Let me know if you keep seeing errors!

Christoph
Author: Barry Gresens
Posted: Jan 23 2008 - 09:00 AM
Subject: re: javascript error
I still get the error.

I am using IE7. Did you use IE7?

-Barry Gresens
Author: Jeff Segars
Posted: Jan 23 2008 - 10:36 AM
Subject: re: javascript error
Hey Barry,
Jumping in here for Christoph until he gets back. I can duplicate the problem on that page with IE7, but I it seems that eBible is working on all the other pages where I could find it in use. That would make me think there's a problem specific to the HTML on that page.

eBible works by walking the the XHTML structure of a page, so if anything gets out of whack there (elements not closed properly or nested incorrectly) then it can end up generating errors.

Thanks,
Jeff
Author: Barry Gresens
Posted: Jan 23 2008 - 11:02 AM
Subject: re: javascript error
Ok

I will check the HMTL for tag issues.

However, as a full-time developer where I work I am constantly reminded of the need for my code to fail in a user-friendly manner. When doing web development, if I put out code that results in a javascript error, then I have a bug that must be fixed. The code should handle the error in some smooth fashion that either results in no action or a user-friendly notice to the user.

In the case of the eBible extension, it is my professional opinion that the javascript code should have a try-catch embedded that effectively results in no action if any errors are found. The average user will simply see "Matthew 6" with no hyperlink. The page designer, seeing this, would review the documentation and see in the notes that that any violation of standardized XHTML tag structure on the page results in this loss of functionality.

I am going to implement this change in my javascript file and humbly recommend you guys do the same.

In Christ -

Barry Gresens
barry@gresens.org
Author: Jeff Segars
Posted: Jan 23 2008 - 11:47 AM
Subject: re: javascript error
Barry,
If you get something with more robust error handling working across browsers, please pass it along to us and we'll be happy to include it in the next release.

The eBible extension is largely third-party code from the guys at eBible.com so we're not as familiar with all the Javascript as we would normally be on something written in house.

Thanks,
Jeff
Author: Barry Gresens
Posted: Jan 23 2008 - 12:33 PM
Subject: re: javascript error
Replacing the function "traverseDOM" in

http://www.galileeumc.org/typo3conf/ext/wec_ebible/res/ebibleicious.js

fixes the bug for me in IE and Firefox. I do not have access to other browsers:

function traverseDOM(node, depth, textproc) {
var skipre = /^(a|script|style|textarea|h1|h2|h3|h4|h5|h6|h7|h/i;
var count = 0;
while (node && depth > 0) {
count ++;
if (count >= eBibleicious.max_nodes) {
var handler = function() {
traverseDOM(node, depth, textproc);
};
setTimeout(handler, 50);
return;
}

try {
switch (node.nodeType) {
case 1: // ELEMENT_NODE
if (!skipre.test(node.tagName) && node.childNodes.length > 0) {
node = node.childNodes[0];
depth ++;
continue;
}
break;
case 3: // TEXT_NODE
case 4: // CDATA_SECTION_NODE
node = textproc(node);
break;
}

if (node.nextSibling) {
node = node.nextSibling;
} else {
while (depth > 0) {
node = node.parentNode;
depth --;
if (node.nextSibling) {
node = node.nextSibling;
break;
}
}
}
}
catch(e) {
return;
}
}
}

-Barry Gresens
Author: Jeff Segars
Posted: Jan 23 2008 - 01:12 PM
Subject: re: javascript error
Thanks Barry! We'll give it a shot in Safari, Opera, etc and report back if we have any problems.
user picture Author: Christoph Koehler
Posted: Feb 13 2008 - 04:28 PM
Subject: re: javascript error
Barry,

Thanks for the code! I tested it, it doesn't break anything, and looks good, so it's added to our codebase now in SVN and will be included in the next version.

Christoph
Total Posts: 9 - Pages (1): [1]
You must login to post a message to this conference.