aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bzpage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-07-23 21:33:08 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-07-23 21:33:25 +0200
commit9b3f22fd07c0cfcc1e2368c7f32a0423a3a4bd85 (patch)
tree7d02fcf6347fe51e06508080f7151c37e6dbd0d1 /lib/bzpage.js
parent64213233a16a49bda77f5bb9384c90c7d76f7d2f (diff)
downloadbugzilla-triage-9b3f22fd07c0cfcc1e2368c7f32a0423a3a4bd85.tar.gz
More resistance to differences with bugzilla.mozilla.org
Fixes #30
Diffstat (limited to 'lib/bzpage.js')
-rw-r--r--lib/bzpage.js29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index ff84aa9..084b924 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -477,6 +477,22 @@ BZPage.prototype.setConfigurationButton = function setConfigurationButton () {
}, false);
};
+/*
+ * From <a href="mailto:email"> element diggs out just plain email
+ * address
+ *
+ * @param aElement Element with href attribute or something else
+ * @return String with the address or null
+ *
+ */
+BZPage.prototype.parseMailto = function parseMailto(aElement) {
+ if (aElement) {
+ var email = decodeURI(aElement.getAttribute("href")).
+ split(":")[1];
+ }
+ return null;
+};
+
/**
* Get the current email of the reporter of the bug.
*
@@ -485,10 +501,7 @@ BZPage.prototype.setConfigurationButton = function setConfigurationButton () {
BZPage.prototype.getReporter = function getReporter () {
var reporterElement = this.doc.
querySelector("#bz_show_bug_column_2 > table .vcard:first-of-type > a");
- if (reporterElement) {
- return reporterElement.textContent;
- }
- return "";
+ return this.parseMailto(reporterElement);
};
/**
@@ -523,8 +536,8 @@ BZPage.prototype.commentsWalker = function commentsWalker (fce) {
BZPage.prototype.checkComments = function checkComments () {
var that = this;
this.commentsWalker(function(x) {
- var email = x.getElementsByClassName("vcard")[0]
- .getElementsByTagName("a")[0].textContent;
+ var email = that.parseMailto(x.getElementsByClassName("vcard")[0]
+ .getElementsByTagName("a")[0]);
if (new RegExp(that.reporter).test(email)) {
x.style.backgroundColor = that.ReporterColor.toString();
}
@@ -667,9 +680,7 @@ BZPage.prototype.getOwner = function getOwner () {
var priorityParent = this.doc.querySelector("label[for~='target_milestone']")
.parentNode.parentNode.parentNode;
var assigneeAElement = priorityParent.querySelector("tr:nth-of-type(1) a.email");
- var assgineeHref = decodeURI(assigneeAElement.getAttribute("href"));
- var email = assgineeHref.split(":")[1];
- return email;
+ return this.parseMailto(assigneeAElement);
};
/**