diff options
author | Matěj Cepl <mcepl@redhat.com> | 2009-12-18 03:24:04 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2009-12-18 03:24:04 +0100 |
commit | 1ba3d3a3b4436697e65618ee60d8a822fe3cae95 (patch) | |
tree | 4030fce0ee47269a1a72056804d5dac119e5b0e2 | |
parent | 6c712499e59c6a5d2067d189a27cc1e10008964d (diff) | |
download | bugzilla-triage-1ba3d3a3b4436697e65618ee60d8a822fe3cae95.tar.gz |
And even more deJQuerization and repair of broken branch.
-rw-r--r-- | bugzillaBugTriage.js | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index e95a0ca..5c0ab9c 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -506,16 +506,15 @@ bzPage.prototype.addTextToTextBox = function(id,string2BAdded) { */ bzPage.prototype.checkComments = function () { var that = this; - var comments = this.dok.getElementById("comments").getElementsByClassName("bz_comment"); -// comments.forEach(function (el, idx, arr) { - for (var i = 0, ii = comments.length; i < ii; i++) { - var email = comments[i].getElementsByClassName("vcard")[0]. + var comments = this.dok.getElementById("comments"). + getElementsByClassName("bz_comment"); + Array.forEach(comments,function (item) { + var email = item.getElementsByClassName("vcard")[0]. getElementsByTagName("a")[0].textContent; if (new RegExp(this.reporter).test(email)) { - comments[i].style.backgroundColor = ReporterColor.toString(); + item.style.backgroundColor = ReporterColor.toString(); } - } -// }); + }); }; /** @@ -834,7 +833,7 @@ bzPage.prototype.queryForSelection = function() { integer of size in kilobytes, and the whole element itself */ -bzPage.prototype.parseAttachmentLine = function (inElem,idx) { +bzPage.prototype.parseAttachmentLine = function (inElem) { var MIMEtype = new String(); var size = new Number(); @@ -1401,11 +1400,9 @@ function bzPage(doc) { this.version = this.getVersion(); var ITbutton = this.dok.getElementById("cf_issuetracker"); this.its = ITbutton ? ITbutton.value.trim() : ""; - this.CCList = []; - var CCListHTMLColl = this.dok.getElementById("cc"); - for (let i = 0, ii = CCListHTMLColl.length; i < ii; i++) { - this.CCList.push(CCListHTMLColl[i].value); - } + this.CCList = Array.map(this.dok.getElementById("cc"), + function (item) { return item.value; } + ); // TODO be careful about this, seems breaking for non-RH BugZappers, // but I cannot see why this.owner = this.dok.getElementById("bz_assignee_edit_container"). @@ -1421,7 +1418,7 @@ function bzPage(doc) { var atts = this.dok.getElementById("attachment_table"). getElementsByTagName("tr"); for (let i = 1, ii = atts.length-1; i < ii; i++) { - this.attachments.push(this.parseAttachmentLine(atts[i],i)); + this.attachments.push(this.parseAttachmentLine(atts[i])); } var badAttachments = this.attachments.filter(function (att,idx,arr) { @@ -1444,13 +1441,20 @@ function bzPage(doc) { var bugTitle = this.dok.getElementById("short_desc_nonedit_display").textContent; if (AbrtRE.test(bugTitle)) { - var notedLabel = $("label[for='newcc']", this.doc); - notedLabel.replaceWith(notedLabel.children()); - $(".bz_alias_short_desc_container:first", this.doc). - append("\u00A0<a accesskey='a' href='"+abrtQueryURL+"'>Abrt bugs</a>"); + var notedLabel = this.dok.querySelector("label[for='newcc']"); + while (notedLabel.firstChild) { + let node = notedLabel.removeChild(notedLabel.firstChild); + notedLabel.parentNode.insertBefore(node,notedLabel); + }; + notedLabel.parentNode.removeChild(notedLabel); + + this.dok.getElementsByClassName("bz_alias_short_desc_container")[0]. + innerHTML = "\u00A0<a accesskey='a' href='"+ + abrtQueryURL+"'>Abrt bugs</a>"; if (!(this.hasKeyword("Triaged") || - /btparsed/.test($("#cf_devel_whiteboard",this.doc).val()))) { + /btparsed/.test(this.dok. + getElementById("cf_devel_whiteboard").value))) { var btAttachments = this.attachments.filter(function (att,idx,arr) { return (/backtrace/.test(att[0])); }); @@ -1474,21 +1478,23 @@ function bzPage(doc) { // Take care of signature for Fedora bugzappers if (signatureFedoraString.length > 0) { - // (or a form named "changeform") - $("form:nth-child(2)", this.doc).submit(function () { - this.addTextToTextBox("comment", signatureFedoraString); - }); + this.dok.forms.namedItem("changeform").addEventListener("submit", + function () { + this.addTextToTextBox("comment", signatureFedoraString); + } + ,true); } this.setBranding(); this.checkComments(); this.buildButtons(topRow,bottomRow); - $("#component",this.doc).change(function (){ - that.component = $("#component option:selected:first", this.doc).val(); - that.changeOwner(filterByRegexp(defAssigneeList, that.component). - toLowerCase()); - }); + this.dok.getElementById("component").addEventListener("change", + function (){ + that.component = that.getOptionValue("component"); + that.changeOwner(filterByRegexp(defAssigneeList, that.component). + toLowerCase()); + },false); } var callback = function (doc) { |