aboutsummaryrefslogtreecommitdiffstats
path: root/bugzillaBugTriage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2009-12-18 11:33:25 +0100
committerMatěj Cepl <mcepl@redhat.com>2009-12-18 11:33:25 +0100
commitfdce5496672425c70a305d240fc989ca84276ea0 (patch)
tree6a3ddca470b93127241288b2738e56c996c159ab /bugzillaBugTriage.js
parentfdaa4c2f5dc20ba4af7ff8e64c5bffffb52d86ad (diff)
downloadbugzilla-triage-fdce5496672425c70a305d240fc989ca84276ea0.tar.gz
Making jsLint.js happy (at least a little bit more)
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r--bugzillaBugTriage.js146
1 files changed, 73 insertions, 73 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index f1c5cd4..9bbe4e5 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -1,4 +1,4 @@
-/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 100, immed: false, white: false, plusplus: false, regexp: false, undef: false */
+/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
/*global jQuery, $, jetpack */
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
@@ -197,9 +197,9 @@ Color.prototype.hs = function(nStr) {
};
Color.prototype.toString = function() {
- var rH = new Number(this.r.toFixed()).toString(16);
- var gH = new Number(this.g.toFixed()).toString(16);
- var bH = new Number(this.b.toFixed()).toString(16);
+ var rH = Number(this.r.toFixed()).toString(16);
+ var gH = Number(this.g.toFixed()).toString(16);
+ var bH = Number(this.b.toFixed()).toString(16);
return "#"+this.hs(rH)+this.hs(gH)+this.hs(bH);
};
@@ -207,7 +207,7 @@ Color.prototype.toString = function() {
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
- * returns h, s, and l in the set [0, 1].
+ * returns h, s, and l in the set [0, 1].4343
*
* @param Number r The red color value
* @param Number g The green color value
@@ -379,8 +379,8 @@ Color.prototype.hsvToRgb = function (h, s, v){
*/
Color.prototype.lightColor = function() {
var hslArray = this.hsl();
- var h = new Number(hslArray[0]);
- var s = new Number(hslArray[1]) * Desaturated;
+ var h = Number(hslArray[0]);
+ var s = Number(hslArray[1]) * Desaturated;
var l = Luminosity;
var desA = this.hslToRgb(h, s, l);
return new Color(desA[0],desA[1],desA[2]);
@@ -388,7 +388,7 @@ Color.prototype.lightColor = function() {
//====================================================================================
-// bzPage's methods
+// BzPage's methods
/**
* Check for the presence of a keyword
@@ -396,7 +396,7 @@ Color.prototype.lightColor = function() {
* @param str string with the keyword
* @return Boolean
*/
-bzPage.prototype.hasKeyword = function (str) {
+BzPage.prototype.hasKeyword = function (str) {
var kwd = this.dok.getElementById('keywords').value.trim();
return (new RegExp(str).test(kwd));
};
@@ -407,7 +407,7 @@ bzPage.prototype.hasKeyword = function (str) {
* @param str string with the keyword
* @return none
*/
-bzPage.prototype.setKeyword = function (str) {
+BzPage.prototype.setKeyword = function (str) {
// Could be probably rewrote to use this.addTextToTextBox, but
// it would be too complicated with a little gain.
var keywordInput = this.dok.getElementById('keywords');
@@ -418,9 +418,9 @@ bzPage.prototype.setKeyword = function (str) {
}
};
-bzPage.prototype.getOptionValue = function (id) {
+BzPage.prototype.getOptionValue = function (id) {
return this.dok.getElementById(id).value;
-}
+};
/* Bugzilla functions.*/
@@ -429,7 +429,7 @@ bzPage.prototype.getOptionValue = function (id) {
*
* @return string
*/
-bzPage.prototype.getReporter = function () {
+BzPage.prototype.getReporter = function () {
return this.dok.
querySelector("#bz_show_bug_column_2 > table .vcard:first-of-type > a").
textContent;
@@ -441,13 +441,13 @@ bzPage.prototype.getReporter = function () {
*
* @return string (integer for released Fedora, float for RHEL, rawhide)
*/
-bzPage.prototype.getVersion = function () {
+BzPage.prototype.getVersion = function () {
var verStr = this.getOptionValue("version").toLowerCase();
var verNo = 0;
if (/rawhide/.test(verStr)) {
verNo = 999;
} else {
- verNo = new Number(verStr);
+ verNo = Number(verStr);
}
return verNo;
};
@@ -457,7 +457,7 @@ bzPage.prototype.getVersion = function () {
* @param element where to send mouseclick to
* @return None
*/
-bzPage.prototype.clickMouse = function(target) {
+BzPage.prototype.clickMouse = function(target) {
var localEvent = this.dok.createEvent("MouseEvents");
localEvent.initMouseEvent("click", true, true,
this.doc.defaultView,
@@ -473,7 +473,7 @@ bzPage.prototype.clickMouse = function(target) {
*
* Checks for the existing keywords.
*/
-bzPage.prototype.addKeyword = function (str) {
+BzPage.prototype.addKeyword = function (str) {
this.addTextToTextBox("keywords",str);
};
@@ -485,10 +485,10 @@ bzPage.prototype.addKeyword = function (str) {
*
* @return none
*/
-bzPage.prototype.addTextToTextBox = function(id,string2BAdded) {
+BzPage.prototype.addTextToTextBox = function(id,string2BAdded) {
var textBox = this.dok.getElementById(id);
- var separator = ", "
- if (textBox.tagName.toLowerCase() == "textarea") {
+ var separator = ", ";
+ if (textBox.tagName.toLowerCase() === "textarea") {
separator = "\n\n";
}
@@ -504,7 +504,7 @@ bzPage.prototype.addTextToTextBox = function(id,string2BAdded) {
* Set background color of all comments made by reporter in ReporterColor color
*
*/
-bzPage.prototype.checkComments = function () {
+BzPage.prototype.checkComments = function () {
var that = this;
var comments = this.dok.getElementById("comments").
getElementsByClassName("bz_comment");
@@ -522,12 +522,12 @@ bzPage.prototype.checkComments = function () {
*
* @return Boolean true if it is a RHEL bug
*/
-bzPage.prototype.isRHEL = function() {
+BzPage.prototype.isRHEL = function() {
return (/Red Hat Enterprise Linux/).test(this.product);
};
-bzPage.prototype.isTriaged = function() {
+BzPage.prototype.isTriaged = function() {
if (this.version > 11) {
return this.hasKeyword("Triaged");
} else {
@@ -545,7 +545,7 @@ bzPage.prototype.isTriaged = function() {
* @return none
*
*/
-bzPage.prototype.setBranding = function () {
+BzPage.prototype.setBranding = function () {
var brandColor = {};
var TriagedColor = {};
@@ -591,7 +591,7 @@ bzPage.prototype.setBranding = function () {
// we should make visible whether maintCCAddr is in CCList
if (isInList(this.maintCCAddr, this.CCList)) {
- let ccEditBoxElem = this.dok.getElementById("cc_edit_area_showhide");
+ var ccEditBoxElem = this.dok.getElementById("cc_edit_area_showhide");
//ccEditBoxElem.textContent = "*"+ccEditBoxElem.textContent;
ccEditBoxElem.style.color = "navy";
ccEditBoxElem.style.fontWeight = "bolder";
@@ -607,7 +607,7 @@ bzPage.prototype.setBranding = function () {
/**
*/
-bzPage.prototype.groupIDs = function (manStr,cardStrID) {
+BzPage.prototype.groupIDs = function (manStr,cardStrID) {
var outStr = filterByRegexp(chipIDsGroupings,manStr+","+cardStrID);
if (outStr.length === 0) {
outStr = "UNGROUPED_" + manStr+"/"+cardStrID;
@@ -623,7 +623,7 @@ bzPage.prototype.groupIDs = function (manStr,cardStrID) {
*
* @return array with chip string and optinoal variants
*/
-bzPage.prototype.checkChipStringFromID = function (manufacturerNo,cardNo) {
+BzPage.prototype.checkChipStringFromID = function (manufacturerNo,cardNo) {
var soughtID = (manufacturerNo+","+cardNo).toUpperCase();
var outList = PCI_ID_Array[soughtID];
if (outList) {
@@ -640,7 +640,7 @@ bzPage.prototype.checkChipStringFromID = function (manufacturerNo,cardNo) {
* @param driverStr string with the driver name
* @return None
*/
-bzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
+BzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
var outStr = "";
var cardIDStr = "";
var cardIDArr = [];
@@ -702,7 +702,7 @@ bzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
*
* @return none
*/
-bzPage.prototype.addNewButton = function (originalLocation,newId,newLabel,
+BzPage.prototype.addNewButton = function (originalLocation,newId,newLabel,
commentString,nState,secPar,doSubmit,after) {
var that = this;
var commStr = "";
@@ -739,7 +739,7 @@ bzPage.prototype.addNewButton = function (originalLocation,newId,newLabel,
*
* @return None
*/
-bzPage.prototype.fillInChipMagic = function () {
+BzPage.prototype.fillInChipMagic = function () {
var XorgLogURL = "";
var XorgLogAttID = "";
var XorgLogFound = false;
@@ -786,7 +786,7 @@ bzPage.prototype.fillInChipMagic = function () {
*
* FIXME search only in the same version &version=11
*/
-bzPage.prototype.queryInNewTab = function(text,component,product) {
+BzPage.prototype.queryInNewTab = function(text,component,product) {
// Optional parameter
if (product === undefined) {
product = this.product;
@@ -813,7 +813,7 @@ bzPage.prototype.queryInNewTab = function(text,component,product) {
* Get the text to search for and prepare other things for the real executive
* function this.queryInNewTab, and run it.
*/
-bzPage.prototype.queryForSelection = function() {
+BzPage.prototype.queryForSelection = function() {
var text = jetpack.selection.text;
if (!text) {
text = jetpack.clipboard.get();
@@ -833,9 +833,9 @@ bzPage.prototype.queryForSelection = function() {
integer of size in kilobytes,
and the whole element itself
*/
-bzPage.prototype.parseAttachmentLine = function (inElem) {
- var MIMEtype = new String();
- var size = new Number();
+BzPage.prototype.parseAttachmentLine = function (inElem) {
+ var MIMEtype = "";
+ var size = 0;
// Skip over obsolete attachments
if (inElem.getElementsByClassName("bz_obsolete").length>0) {
@@ -867,10 +867,10 @@ bzPage.prototype.parseAttachmentLine = function (inElem) {
* @param label
* @return none
*/
-bzPage.prototype.selectOption = function(id,label) {
+BzPage.prototype.selectOption = function(id,label) {
var sel = this.dok.getElementById(id);
var options = Array.filter(sel.getElementsByTagName("option"),
- function (x){ return x.value == label; }
+ function (x){ return x.value === label; }
);
theOption = options.length ? options[0] : [];
theOption.selected = true;
@@ -886,7 +886,7 @@ bzPage.prototype.selectOption = function(id,label) {
* @return Boolean
*
*/
-bzPage.prototype.hasKeyword = function(str) {
+BzPage.prototype.hasKeyword = function(str) {
var kwd = this.dok.getElementById('keywords').value.trim();
return (new RegExp(str).test(kwd));
};
@@ -901,7 +901,7 @@ bzPage.prototype.hasKeyword = function(str) {
* @return modified element with the fixed accesskey
* FIXME isn't this closure and possible memleak?
*/
-bzPage.prototype.fixElement = function (elem,beforeText,accKey,afterText) {
+BzPage.prototype.fixElement = function (elem,beforeText,accKey,afterText) {
elem.setAttribute("accesskey",accKey.toLowerCase());
elem.innerHTML = beforeText + "<b><u>" + accKey + "</u></b>" + afterText;
return elem;
@@ -913,7 +913,7 @@ bzPage.prototype.fixElement = function (elem,beforeText,accKey,afterText) {
* @param evt event which made this function active
* @return none
*/
-bzPage.prototype.changeOwner = function(newAssignee) {
+BzPage.prototype.changeOwner = function(newAssignee) {
/** Take care that when changing assignment of the bug,
* current owner is added to CC list.
* Switch off setting to the default assignee
@@ -935,7 +935,7 @@ bzPage.prototype.changeOwner = function(newAssignee) {
* Working function.
* @return none
*/
-bzPage.prototype.setNeedinfoReporter = function() {
+BzPage.prototype.setNeedinfoReporter = function() {
this.clickMouse(this.dok.getElementById("needinfo"));
this.selectOption("needinfo_role", "reporter");
};
@@ -947,7 +947,7 @@ bzPage.prototype.setNeedinfoReporter = function() {
* @param URLhostname string hostname of the external bugzilla
* @return string with the string for the external_id SELECT
*/
-bzPage.prototype.getBugzillaName = function(URLhostname) {
+BzPage.prototype.getBugzillaName = function(URLhostname) {
var bugzillaID = "";
if (hashBugzillaName[URLhostname]) {
bugzillaID = hashBugzillaName[URLhostname];
@@ -963,7 +963,7 @@ bzPage.prototype.getBugzillaName = function(URLhostname) {
* @param bugID Number which is bug ID
* @return string with the URL
*/
-bzPage.prototype.getWholeURL = function(selectValue,bugID) {
+BzPage.prototype.getWholeURL = function(selectValue,bugID) {
var returnURL = "";
if (hashBugzillaWholeURL[selectValue]) {
returnURL = hashBugzillaWholeURL[selectValue]+bugID;
@@ -983,7 +983,7 @@ bzPage.prototype.getWholeURL = function(selectValue,bugID) {
* + responseHeaders
* + responseText
*/
-bzPage.prototype.callBack = function(data,textStatus) {
+BzPage.prototype.callBack = function(data,textStatus) {
if (--this.reqCounter <= 0) {
setTimeout(document.location.reload,1000);
}
@@ -1014,7 +1014,7 @@ Update the attachment mime type of an attachment. The first argument is a data h
# OPTIONAL Flag that is either 1 or 0 if you want email to be sent or not for this change
};
*/
-bzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType,email) {
+BzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType,email) {
if (mimeType === undefined) {
mimeType = "text/plain";
}
@@ -1060,7 +1060,7 @@ bzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType
* @param id integer with the attachment id to be fixed
* @param type string with the new MIME type, e.g. "text/plain"
*/
-bzPage.prototype.fixAttachById = function(id,type) {
+BzPage.prototype.fixAttachById = function(id,type) {
var msg = this.createXMLRPCMessage(this.login,this.password,id,type);
var ret = $.ajax({
type: "POST",
@@ -1075,7 +1075,7 @@ bzPage.prototype.fixAttachById = function(id,type) {
this.reqCounter++;
};
-bzPage.prototype.fixAllAttachments = function(list) {
+BzPage.prototype.fixAllAttachments = function(list) {
var tmpElem = {};
for(var i=0;i<list.length;i++) {
@@ -1091,7 +1091,7 @@ bzPage.prototype.fixAllAttachments = function(list) {
* @return button fixing all bad Attachments
* FIXME deJQuerize!!!
*/
-bzPage.prototype.createFixAllButton = function (list) {
+BzPage.prototype.createFixAllButton = function (list) {
var that = this;
var elem = this.dok.createElement("a");
elem.setAttribute("href","");
@@ -1109,7 +1109,7 @@ bzPage.prototype.createFixAllButton = function (list) {
* @param <TR> DOM jQuery element with a bad attachment
* @return none
*/
-bzPage.prototype.addTextLink = function (row) {
+BzPage.prototype.addTextLink = function (row) {
var that = this;
var elemS = row.getElementsByTagName("td");
var elem = elemS[elemS.length-1];
@@ -1125,7 +1125,7 @@ bzPage.prototype.addTextLink = function (row) {
*
* @return none
*/
-bzPage.prototype.addClosingUpstream = function() {
+BzPage.prototype.addClosingUpstream = function() {
var refs = this.dok.getElementById("external_bugs_table").
getElementsByTagName("tr");
// that's a bad id, if there is a one. :)
@@ -1181,7 +1181,7 @@ bzPage.prototype.addClosingUpstream = function() {
* @param array array of data for buttons to be generated
* @return none
*/
-bzPage.prototype.generateToolBar = function(anchor,array) {
+BzPage.prototype.generateToolBar = function(anchor,array) {
for (var i=0; i<array.length; i++) {
var butt = array[i];
this.addNewButton(anchor, butt.idx,
@@ -1201,7 +1201,7 @@ bzPage.prototype.generateToolBar = function(anchor,array) {
* for reason of closing the bug
* @return none
*/
-bzPage.prototype.generalPurposeCureForAllDisease = function
+BzPage.prototype.generalPurposeCureForAllDisease = function
(addString,nextState,secondParameter) {
var verNo = this.getVersion();
@@ -1289,7 +1289,7 @@ bzPage.prototype.generalPurposeCureForAllDisease = function
/**
*
*/
-bzPage.prototype.parseBacktrace = function (ret) {
+BzPage.prototype.parseBacktrace = function (ret) {
var splitArray = ret.split("\n");
var i = 0, ii = splitArray.length;
var outStr = "", curLine = "", numStr = "";
@@ -1328,7 +1328,7 @@ bzPage.prototype.parseBacktrace = function (ret) {
* @param jsonList Array created from JSON
* @return none
*/
-bzPage.prototype.buildButtons = function (above,below) {
+BzPage.prototype.buildButtons = function (above,below) {
//Generate a list of <input> elements in the page
this.addNewButton(this.dok.getElementById("commit_top"),
"changeOwnerbtn","reASSIGN","","ASSIGNED","NODEFAULTASSIGNEE");
@@ -1368,7 +1368,7 @@ bzPage.prototype.buildButtons = function (above,below) {
};
///////////////////////////////////////////////////////////////////////////////
-function bzPage(doc) {
+function BzPage(doc) {
this.doc = $(doc);
this.dok = doc;
var that = this;
@@ -1379,17 +1379,17 @@ function bzPage(doc) {
if (myConfig.BZpassword) {
this.password = myConfig.BZpassword;
} else {
- let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
- let password = {value: ""}; // default the password to pass
- let check = {value: true}; // default the checkbox to true
- let result = prompts.promptPassword(null,
+ var password = {value: ""}; // default the password to pass
+ var check = {value: true}; // default the checkbox to true
+ var result = prompts.promptPassword(null,
"Title", "Enter password:", password, null, check);
// result is true if OK was pressed, false if cancel was pressed. password.value is
// set if OK was pressed. The checkbox is not displayed.
if (result) {
this.password = password.value;
- myConfig.BZpassword = this.password;
+ myConfig.BZpassword = this.password;
}
var bugNoTitle = $("#title > p:first", this.doc).text().trim();
@@ -1418,7 +1418,7 @@ function bzPage(doc) {
this.reqCounter=0;
var atts = this.dok.getElementById("attachment_table").
getElementsByTagName("tr");
- for (let i = 1, ii = atts.length-1; i < ii; i++) {
+ for (var i = 1, ii = atts.length-1; i < ii; i++) {
this.attachments.push(this.parseAttachmentLine(atts[i]));
}
@@ -1442,20 +1442,20 @@ function bzPage(doc) {
var bugTitle = this.dok.getElementById("short_desc_nonedit_display").textContent;
if (AbrtRE.test(bugTitle)) {
- 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);
+ var notedLabel = this.dok.querySelector("label[for='newcc']");
+ while (notedLabel.firstChild) {
+ var 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>";
+ 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(this.dok.
- getElementById("cf_devel_whiteboard").value))) {
+ (/btparsed/.test(this.dok.
+ getElementById("cf_devel_whiteboard").value)))) {
var btAttachments = this.attachments.filter(function (att,idx,arr) {
return (/backtrace/.test(att[0]));
});
@@ -1499,7 +1499,7 @@ function bzPage(doc) {
}
var callback = function (doc) {
- var curPage = new bzPage(doc);
+ var curPage = new BzPage(doc);
};
var options = {};