User:Proteins/translateinterwikicodes.js: Difference between revisions

Content deleted Content added
Proteins (talk | contribs)
place alert_string restriction elsewhere
Proteins (talk | contribs)
more careful checking for error modes
Line 396:
}
}
alert_string += "This page has " + num_hyperlinks + "potential interwiki links.\n\n";
// window.alert(alert_string); alert_string = "";
 
Line 404:
 
parent_node = temp_hyperlink.parentNode;
if (!parent_node) { continue; }
alert_string += "No parent node in hyperlink " + hyperlink_index + "\n");
if ((parent_node.nodeName != "LI") || (!parent_node.className)) { continue; }
continue;
}
if ((parent_node.nodeName != "LI") || (!parent_node.className)) { continue; }
alert_string += "No LI parent node in hyperlink " + hyperlink_index + "\n");
continue;
}
if (!parent_node.className) {
alert_string += "No className for parent node in hyperlink " + hyperlink_index + "\n");
continue;
}
hyperlink_counter++;
language_code = parent_node.className.replace(/interwiki-/, "");
English_translation = interwiki_English_names[language_code];
if (!English_translation) {
alert_string += "No English translation for " + language_code + " in hyperlink " + hyperlink_index + "\n");
continue;
}
hyperlink_counter++;
 
if (hyperlink_counter < 41) {