aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-08-08 00:07:48 -0400
committerMatěj Cepl <mcepl@redhat.com>2010-08-08 00:07:48 -0400
commitea31bb39676ac5667dd6f481408280201675fcc3 (patch)
tree95f52f0f476e1ae8332b44b6a98c173055022cd7
parenta08f7e8595dfb576396857270e9218db9ef59824 (diff)
downloadbugzilla-triage-ea31bb39676ac5667dd6f481408280201675fcc3.tar.gz
More compatibility with bugzilla.gnome.org
-rw-r--r--lib/bzpage.js26
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 1731b64..8b96c9c 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -687,6 +687,23 @@ BZPage.prototype.hasKeyword = function hasKeyword (str) {
};
/**
+ */
+BZPage.prototype.getOptionTableCell = function getOptionTableCell(tableId, label) {
+ var cleanLabelRE = /^\s*([^. :]*):?\s*$/;
+ label = label.replace(cleanLabelRE,"$1").toLowerCase();
+ var rows = this.doc.getElementById(tableId).getElementsByTagName("tr");
+ var ourLine = Array.filter(rows, function(row) {
+ var curLabel = row.getElementsByTagName("td")[0].textContent.toLowerCase();
+ curLabel = curLabel.replace(cleanLabelRE,"$1");
+ return (curLabel === label);
+ });
+ if (ourLine.length > 0) {
+ return ourLine[0].getElementsByTagName("td")[1].textContent;
+ }
+ return null;
+};
+
+/**
*
*/
BZPage.prototype.getOptionValue = function getOptionValue (id) {
@@ -695,8 +712,13 @@ BZPage.prototype.getOptionValue = function getOptionValue (id) {
if (element) {
return element.value;
} else {
- console.error("Failed to find element with id = " + id);
- return "#NA";
+ // this doesn't work on bugzilla.gnome.org
+ element = this.getOptionTableCell("bug_summary", id);
+ if (element) {
+ return element;
+ }
+ throw new Error("Failed to find element with id = " + id);
+ return null;
}
};