diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-19 00:19:53 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:45:52 +0200 |
commit | 50c6825e5d1aecca1edc75b305e28fce86e12b36 (patch) | |
tree | caa56c933d0e01d48df2550ba20b7d5daea1591d /data/lib | |
parent | 3371681e2fd62add63543f6229d5339698460d28 (diff) | |
download | bugzilla-triage-50c6825e5d1aecca1edc75b305e28fce86e12b36.tar.gz |
Working on analysis of bug-page-mod module.
* Add some notes
* remove getBugNumber and replaced with my getBugNo.
Diffstat (limited to 'data/lib')
-rw-r--r-- | data/lib/bug-page-mod.js | 19 | ||||
-rw-r--r-- | data/lib/util.js | 8 |
2 files changed, 13 insertions, 14 deletions
diff --git a/data/lib/bug-page-mod.js b/data/lib/bug-page-mod.js index 8972ee6..a8ce6de 100644 --- a/data/lib/bug-page-mod.js +++ b/data/lib/bug-page-mod.js @@ -46,8 +46,8 @@ function tweakBugzilla(d) { if (!d.getElementById("comments")) // don't process the mid-air collision pages return; - // Make the comment box bigger - var commentBox = d.querySelector("#comment"); + // Make the comment box bigger ... TODO not necessary on RH BZ, but doesn't hurt + var commentBox = d.getElementById("comment"); if (commentBox) commentBox.rows=20; @@ -58,6 +58,8 @@ function tweakBugzilla(d) { viewAttachmentSource(d); // Mark up history along right hand edge + // TODO ... not sure what does this mean ... this + // <link> element is I suppose everywhere. var historyLink = d.querySelector("link[title='Bug Activity']"); if (!historyLink) return; @@ -479,7 +481,7 @@ var reviewBoardUrlBase = "http://reviews.visophyte.org/"; * review board magic. */ function attachmentDiffLinkify(doc) { - var bug_id = getBugNumber(doc); + var bug_id = getBugNo(doc); var table = doc.getElementById("attachment_table"); if (!table) @@ -696,7 +698,7 @@ function CheckinCommentCtor() { } CheckinCommentCtor.prototype = { initialize: function(doc, flags) { - this.bugNumber = getBugNumber(doc); + this.bugNumber = getBugNo(doc); var summarySpan = doc.getElementById("short_desc_nonedit_display"); if (summarySpan) { this.summary = summarySpan.textContent; @@ -819,7 +821,7 @@ function DataStoreCtor(doc) { DataStoreCtor.prototype = { initialize: function(doc) { - this.bugNumber = getBugNumber(doc); + this.bugNumber = getBugNo(doc); var data = this._ensureEntry(this.bugNumber, this.data); // last visited date data.visitedTime = (new Date()).getTime(); @@ -917,13 +919,6 @@ DataStoreCtor.prototype = { _reAttachmentHref: /attachment\.cgi\?id=(\d+)$/i }; -function getBugNumber(doc) { - var idField = doc.querySelector("form[name=changeform] input[name=id]"); - if (idField) { - return idField.value; - } - return null; -} function getUserName(doc) { var links = doc.querySelectorAll("#header .links li"); diff --git a/data/lib/util.js b/data/lib/util.js index 6256171..40a782f 100644 --- a/data/lib/util.js +++ b/data/lib/util.js @@ -64,8 +64,12 @@ function parseXMLfromString (inStuff) { * Get a bug no */ function getBugNo() { - console.log("bugNo = " + document.forms.namedItem('changeform').getElementsByName("id")[0].value); - return document.forms.namedItem('changeform').getElementsByName("id")[0].value; + var bugNoElem = document.forms.namedItem('changeform').getElementsByName("id")[0]; + if (bugNoElem) { + return bugNoElem.value; + } else { + return null; + } } /** |