diff options
author | Matěj Cepl <mcepl@redhat.com> | 2009-11-15 23:40:43 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2009-11-15 23:40:43 +0100 |
commit | 0171e40748b01f28fbe0da530c27162735db70e4 (patch) | |
tree | 5f1427c04c6a83cc6c8dbc67fc5d258fc2b60e9e | |
parent | ceea1e8adb15846bafee330ff92f6d8361c6f22f (diff) | |
download | bugzilla-triage-0171e40748b01f28fbe0da530c27162735db70e4.tar.gz |
Kind of working again!
-rw-r--r-- | bugzillaBugTriage.js | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 38274c9..53423c7 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -151,15 +151,16 @@ function bzPage(doc) { this.CCList = $("#cc", this.doc).attr("value"); this.defaultAssignee = filterByRegexp(defAssigneeList, this.component).toLowerCase(); this.maintCCAddr = filterByRegexp(AddrArray,this.component).toLowerCase(); - this.attachments = this.getAttachments(); - console.log("attachments = " + this.attachments); + this.attachments = $("#attachment_table tr", + this.doc).slice(1,-1).map(this.parseAttachmentLine); + this.originalButton = $("#commit", this.doc).get(0); // Take care of signature for Fedora bugzappers if (signatureFedoraString.length > 0) { // (or a form named "changeform") - $("form::nth-child(2)", this.doc).submit(function () { + $("form:nth-child(2)", this.doc).submit(function () { var cmntText = $("#comment", this.doc); if ((signatureFedoraString.length > 0) && ($.trim(cmntText.text()).length > 0)) { @@ -296,7 +297,7 @@ bzPage.prototype.fillInWhiteBoard = function (iLine,driverStr) { var cardID = iLine.replace(ATIgetIDRE,"$1"); cardIDArr = checkChipStringFromID("1002",cardID); if (cardIDArr.length > 0) { - cardIDStr = cardIDArr[0]; + cardIDStr = cardIDArr[0]; if (cardIDArr[1]) { optionStr = cardIDArr[1]; outStr = groupIDs(driverStr,cardIDStr)+"/" + optionStr; @@ -441,7 +442,7 @@ bzPage.prototype.fillInChipMagic = function () { integer of size in kilobytes, and the whole element itself */ -bzPage.prototype.parseAttachmentLine = function (inElem) { +bzPage.prototype.parseAttachmentLine = function (index,inElem) { var MIMEtype = String(); var size = Number(); inElem.normalize(); @@ -452,10 +453,12 @@ bzPage.prototype.parseAttachmentLine = function (inElem) { } // getting name of the attachment - var attName = $.trim($("b:first",inElem).text()); + var attName = $.trim($("b:first", inElem).text()); // getting id - var id = parseInt($("a:first",inElem).attr("href"). - replace(/^.*attachment.cgi\?id=/,""),10); + var aHrefs = $("a", inElem); + console.log("aHrefs = " + aHrefs.html()); + var id = parseInt(aHrefs.attr("href").replace(/^.*attachment.cgi\?id=/, ""),10); + console.log("id = " + id); //getting MIME type and size var stringArray = $(".bz_attach_extra_info >*:first",inElem).text(). @@ -467,18 +470,6 @@ bzPage.prototype.parseAttachmentLine = function (inElem) { }; /** - * Get list of attachments to the bug - * - * @return array of attachments - */ -bzPage.prototype.getAttachments = function () { - var tempT = $("#attachment_table tr:gt(1)", this.doc); - var tempTLen = tempT.length-1; - return($("lt("+tempTLen+")",tempT). - get().map(this.parseAttachmentLine)); -}; - -/** * Main executable functioning actually building all buttons on the page -- * separated into function, so that * it could be called from onload method of the GM_XMLHTTPRequest. |