aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-04-28 13:28:55 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:47:40 +0200
commit55d9a312fbba91f1bcf5e3f3291b7bece8abb178 (patch)
treebb9ef165b425273da47aa000268395f87f26678e /data/lib
parent34bbe8e7306a0d0ec014db7512788ed92c625d19 (diff)
downloadbugzilla-triage-55d9a312fbba91f1bcf5e3f3291b7bece8abb178.tar.gz
Reformatting to MoFo coding style
Diffstat (limited to 'data/lib')
-rw-r--r--data/lib/addAttachmentRow.js32
-rw-r--r--data/lib/addNewLinks.js35
-rw-r--r--data/lib/bug-page-mod.js12
-rw-r--r--data/lib/bugzillaDOMFunctions.js122
-rw-r--r--data/lib/bzpage.js74
-rw-r--r--data/lib/checkin-context.js6
-rw-r--r--data/lib/color.js60
-rw-r--r--data/lib/fixingAttMIME.js51
-rw-r--r--data/lib/jumpNextBug.js61
-rw-r--r--data/lib/logging-front.js66
-rw-r--r--data/lib/makeBacktraceAttachment.js153
-rw-r--r--data/lib/otherButtons.js79
-rw-r--r--data/lib/preprocessDuplicates.js168
-rw-r--r--data/lib/queries.js122
-rw-r--r--data/lib/rhbzpage.js65
-rw-r--r--data/lib/skip-bug.js8
-rw-r--r--data/lib/urltest.js5
-rw-r--r--data/lib/util.js149
-rw-r--r--data/lib/viewSource.js52
-rw-r--r--data/lib/xorgBugCategories.js38
20 files changed, 763 insertions, 595 deletions
diff --git a/data/lib/addAttachmentRow.js b/data/lib/addAttachmentRow.js
index 204192e..a2b67ee 100644
--- a/data/lib/addAttachmentRow.js
+++ b/data/lib/addAttachmentRow.js
@@ -3,39 +3,41 @@
"use strict";
function addAttachmentCallback(resp) {
- var newAttachID = parseInt(resp.params.param.value.array.data.value.int, 10);
+ var newAttachID = parseInt(
+ resp.params.param.value.array.data.value.int, 10);
console.log("attachID = " + newAttachID);
// FIXME callback.call(param, newAttachID, data.length);
}
/**
- *
- * This has to stay in RHBugzillaPage because upstream doesn't have addAttachment
- * XML-RPC call yet.
+ *
+ * This has to stay in RHBugzillaPage because upstream doesn't have
+ * addAttachment XML-RPC call yet.
*/
function addAttachment(data, callback, param) {
var params = [];
if (!constantData.passwordState.passAvailable) {
- console.error("addAttachment : No password, no XML-RPC calls; sorry");
+ console
+ .error("addAttachment : No password, no XML-RPC calls; sorry");
return null;
}
params.push(getBugNo());
params.push({
- description: titleParsedAttachment,
- filename: "parsed-backtrace.txt",
- contenttype: "text/plain",
- data: window.btoa(data),
- nomail: true
+ description : titleParsedAttachment,
+ filename : "parsed-backtrace.txt",
+ contenttype : "text/plain",
+ data : window.btoa(data),
+ nomail : true
});
self.postMessage(new Message("MakeXMLRPCall", {
- url: constantData.XMLRPCData[window.location.hostname].url,
- login: getLogin(),
- method: "bugzilla.addAttachment",
- params: params,
- callRPC: "AddAttachmentCallback"
+ url : constantData.XMLRPCData[window.location.hostname].url,
+ login : getLogin(),
+ method : "bugzilla.addAttachment",
+ params : params,
+ callRPC : "AddAttachmentCallback"
}));
reqCounter++;
}
diff --git a/data/lib/addNewLinks.js b/data/lib/addNewLinks.js
index 02bd658..b8e7bd2 100644
--- a/data/lib/addNewLinks.js
+++ b/data/lib/addNewLinks.js
@@ -36,35 +36,42 @@
* ***** END LICENSE BLOCK ***** */
function addNewLinks(d) {
- var product = d.querySelector("#field_container_product option[selected]");
+ var product = d
+ .querySelector("#field_container_product option[selected]");
var component = d.querySelector("#component option[selected]");
if (product) {
var label = d.getElementById('field_container_product');
- var url = 'enter_bug.cgi?product=' + encodeURIComponent(product.value);
+ var url = 'enter_bug.cgi?product='
+ + encodeURIComponent(product.value);
if (label) {
- createDeadLink("file_new_bug_product", "new", label,
- url, [], "parens");
+ createDeadLink("file_new_bug_product", "new", label, url,
+ [], "parens");
}
}
if (product && component) {
var select = d.querySelector("select#component");
var label = select.parentNode;
- var url = 'enter_bug.cgi?product=' + encodeURIComponent(product.value) +
- '&component=' + encodeURIComponent(component.value);
+ var url = 'enter_bug.cgi?product='
+ + encodeURIComponent(product.value) + '&component='
+ + encodeURIComponent(component.value);
if (label) {
- var componentElement = document.getElementById("bz_component_input");
+ var componentElement = document
+ .getElementById("bz_component_input");
if (componentElement) { // We are in the Red Hat bugzilla
- // do we have components list visible?
- if (document.getElementById('bz_component_input').
- classList.contains("bz_default_hidden")) {
- label = document.getElementById("bz_component_edit_container");
- }
- } else {
+ // do we have components list visible?
+ if (document.getElementById('bz_component_input').classList
+ .contains("bz_default_hidden")) {
+ label = document
+ .getElementById("bz_component_edit_container");
+ }
+ }
+ else {
label = document.getElementById('component').parentNode;
}
- createDeadLink("file_new_bug_component", "new", label, url, [], "parens");
+ createDeadLink("file_new_bug_component", "new", label,
+ url, [], "parens");
}
}
}
diff --git a/data/lib/bug-page-mod.js b/data/lib/bug-page-mod.js
index 192900c..a7fb7e7 100644
--- a/data/lib/bug-page-mod.js
+++ b/data/lib/bug-page-mod.js
@@ -43,7 +43,8 @@ function tweakBugzilla(d) {
// Put the quicksearch text in the quicksearch boxes
quicksearchHandler(d);
- if (!d.getElementById("comments")) // don't process the mid-air collision pages
+ if (!d.getElementById("comments")) // don't process the mid-air collision
+ // pages
return;
// Make the comment box bigger ... TODO not necessary on RH BZ, but doesn't hurt
@@ -270,7 +271,8 @@ function tweakBugzilla(d) {
item = historyItems[++i].querySelectorAll("td")
ccPrefix = (trimContent(item[0]) == 'CC') ?
'<span class="bztw_cc bztw_historyitem">' : '<span class="bztw_historyitem">';
- // avoid showing a trailing semicolon if the previous entry wasn't a CC and this one is
+ // avoid showing a trailing semicolon if the previous entry
+ // wasn't a CC and this one is
var prefix = ccSuffix + ccPrefix;
// check to see if this is a flag setting
flagsFound = findFlag(item);
@@ -601,7 +603,8 @@ AttachmentFlagHandlerCtor.prototype = {
}
}
- // try to put the flag name and type part in a span which we will
+ // try to put the flag name and type part in a span
+ // which we will
// use in setupLinks to inject links into.
match = this._reLinkifyInterestingFlag.exec(previousText);
if (match) {
@@ -636,7 +639,8 @@ AttachmentFlagHandlerCtor.prototype = {
if (!(id in this._db)) {
this._db[id] = [];
}
- name = name.split('@')[0]; // convert the name to the fraction before the @
+ name = name.split('@')[0]; // convert the name to the fraction
+ // before the @
var added = this._parseData(name, trimContent(item[base + 2]));
for (var i = 0; i < added.length; ++i) {
var flag = added[i];
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js
index 8392b87..f58f0d9 100644
--- a/data/lib/bugzillaDOMFunctions.js
+++ b/data/lib/bugzillaDOMFunctions.js
@@ -4,13 +4,13 @@
/**
* Select option with given value on the <SELECT> element with given id.
- *
+ *
* Also execute change HTMLEvent, so that the form behaves accordingly.
- *
+ *
* @param id
* @param label
* @return none
- *
+ *
*/
function selectOption (id, label, fireEvent) {
if (!fireEvent) {
@@ -48,10 +48,12 @@ function selectOptionByLabel(id, label, fireEvent) {
/**
* Add object to the text box (comment box or status whiteboard)
- *
- * @param id String with the id of the element
- * @param stuff String/Array to be added to the comment box
- *
+ *
+ * @param id
+ * String with the id of the element
+ * @param stuff
+ * String/Array to be added to the comment box
+ *
* @return none
*/
function addStuffToTextBox (id, stuff) {
@@ -67,9 +69,11 @@ function addStuffToTextBox (id, stuff) {
/**
* Remove a keyword from the element if it is there
- *
- * @param id String with the id of the element
- * @param stuff String/Array with keyword(s) to be removed
+ *
+ * @param id
+ * String with the id of the element
+ * @param stuff
+ * String/Array with keyword(s) to be removed
*/
function removeStuffFromTextBox (id, stuff) {
var changedElement = document.getElementById(id);
@@ -78,9 +82,11 @@ function removeStuffFromTextBox (id, stuff) {
/**
* generalized hasKeyword ... search in the value of the box with given id
- *
- * @param id String with ID of the element we want to check
- * @param str String to be searched for
+ *
+ * @param id
+ * String with ID of the element we want to check
+ * @param str
+ * String to be searched for
* @return Boolean found?
*/
function idContainsWord (id, str) {
@@ -96,8 +102,9 @@ function idContainsWord (id, str) {
/**
* Check for the presence of a keyword
- *
- * @param str String with the keyword
+ *
+ * @param str
+ * String with the keyword
* @return Boolean
*/
function hasKeyword (str) {
@@ -106,11 +113,12 @@ function hasKeyword (str) {
/**
* Set the bug to NEEDINFO state
- *
+ *
* Working function.
+ *
* @return none
- * @todo TODO we may extend this to general setNeedinfo function
- * with parameter [reporter|assignee|general-email-address]
+ * @todo TODO we may extend this to general setNeedinfo function with parameter
+ * [reporter|assignee|general-email-address]
*/
function setNeedinfoReporter () {
clickMouse("needinfo");
@@ -118,7 +126,7 @@ function setNeedinfoReporter () {
}
/**
- *
+ *
*/
function getOwner () {
// TODO(maemo) doesn't work on maemo
@@ -127,9 +135,9 @@ function getOwner () {
}
/**
- * Return maintainer which is per default by bugzilla
- * (which is not necessarily the one who is default maintainer per component)
- *
+ * Return maintainer which is per default by bugzilla (which is not necessarily
+ * the one who is default maintainer per component)
+ *
* @return String with the maintainer's email address
*/
function getDefaultBugzillaMaintainer (component) {
@@ -139,11 +147,15 @@ function getDefaultBugzillaMaintainer (component) {
/**
* Generic function to add new button to the page. Actually copies new button
* from the old one (in order to have the same look-and-feel, etc.
- *
- * @param location Object around which the new button will be added
- * @param after Boolean before or after location ?
- * @param pkg String which package to take the command from
- * @param id String which command to take
+ *
+ * @param location
+ * Object around which the new button will be added
+ * @param after
+ * Boolean before or after location ?
+ * @param pkg
+ * String which package to take the command from
+ * @param id
+ * String which command to take
* @return none
*/
function createNewButton (location, after, cmdObj) {
@@ -195,7 +207,7 @@ function createNewButton (location, after, cmdObj) {
/**
* Get the current title of the bug
- *
+ *
* @return string
*/
function getSummary() {
@@ -204,7 +216,7 @@ function getSummary() {
/**
* Get the current title of the bug
- *
+ *
* @return string
*/
function getSeverity() {
@@ -213,7 +225,7 @@ function getSeverity() {
/**
* Get the current email of the reporter of the bug.
- *
+ *
* @return string
*/
function getReporter () {
@@ -222,7 +234,8 @@ function getReporter () {
if (!reporterElement) {
reporterElement = getOptionTableCell("bz_show_bug_column_1", "Reported", true);
}
- // Maemo calls the label "Reporter" and it doesn't have ids on table columns ... TODO(maemo)
+ // Maemo calls the label "Reporter" and it doesn't have ids on table columns
+ // ... TODO(maemo)
return parseMailto(reporterElement);
}
@@ -252,11 +265,10 @@ function commentsWalker (fce) {
/**
* collect the list of attachments in a structured format
- *
- * @return Array of arrays, one for each attachments;
- * each record has string name of the attachment, integer its id number,
- * string of MIME type, integer of size in kilobytes, and the whole
- * element itself
+ *
+ * @return Array of arrays, one for each attachments; each record has string
+ * name of the attachment, integer its id number, string of MIME type,
+ * integer of size in kilobytes, and the whole element itself
*/
function getAttachments () {
var outAtts = [];
@@ -270,7 +282,7 @@ function getAttachments () {
/**
* Get login of the currently logged-in user.
- *
+ *
* @return String with the login name of the currently logged-in user
*/
function getLogin () {
@@ -282,9 +294,10 @@ function getLogin () {
/**
* adds a person to the CC list, if it isn't already there
- *
- * @param who String with email address or "self" if the current user
- * of the bugzilla should be added
+ *
+ * @param who
+ * String with email address or "self" if the current user of the
+ * bugzilla should be added
*/
function addToCCList (who) {
if (!who) {
@@ -303,7 +316,7 @@ function addToCCList (who) {
/**
* a collect a list of emails on CC list
- *
+ *
* @return Array with email addresses as Strings.
*/
function getCCList () {
@@ -319,14 +332,16 @@ function getCCList () {
/**
* remove elements from the page based on their IDs
- *
- * @param doc Document object
- * @param target String/Array with ID(s)
- * @param remove Boolean indicating whether the node should be
- * actually removed or just hidden.
- * @return none
- * TODO remove parameter could be replaced by function which would
- * do actual activity.
+ *
+ * @param doc
+ * Document object
+ * @param target
+ * String/Array with ID(s)
+ * @param remove
+ * Boolean indicating whether the node should be actually removed or
+ * just hidden.
+ * @return none TODO remove parameter could be replaced by function which would
+ * do actual activity.
*/
function killNodes(doc, target, remove) {
var targetArr = target instanceof Array ? target : target.trim().split(/[,\s]+/);
@@ -343,7 +358,7 @@ function killNodes(doc, target, remove) {
/**
* Is this bug a RHEL bug?
- *
+ *
* @return Boolean true if it is a RHEL bug
*/
function isEnterprise() {
@@ -355,7 +370,7 @@ function isEnterprise() {
/**
* Find out whether the bug is needed an attention of bugZappers
- *
+ *
* @return Boolean whether the bug has been triaged or not
*/
function isTriaged() {
@@ -364,8 +379,9 @@ function isTriaged() {
/**
* Return string with the ID for the external_id SELECT for external bugzilla
- *
- * @param URLhostname String hostname of the external bugzilla
+ *
+ * @param URLhostname
+ * String hostname of the external bugzilla
* @return String with the string for the external_id SELECT
*/
function getBugzillaName(URLhostname, bzLabelNames) {
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js
index 3a832ea..9e65794 100644
--- a/data/lib/bzpage.js
+++ b/data/lib/bzpage.js
@@ -19,8 +19,8 @@ var constantData = {}; // This should be probably eliminated ASAP or
// or done by other means. TODO
var equivalentComponents = null;
/**
-* central handler processing messages from the main script.
-*/
+ * central handler processing messages from the main script.
+ */
onMessage = function onMessage(msg) {
console.log("onMessage - incoming : msg.cmd = " + msg.cmd);
switch (msg.cmd) {
@@ -53,15 +53,17 @@ onMessage = function onMessage(msg) {
};
/**
- * @param cmd Object with all commands to be executed
- *
- * PROBLEM: according to https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference\
- * /Statements/for...in there is no guaranteed order of execution of
- * commands (i.e., key, commentObj[key] pairs) in for..in cycle.
- * According to https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference\
- * /Operators/Special_Operators/delete_Operator#Cross-browser_issues it seems that
- * everywhere except of Internet Explorer this should work well, but waiting
- * impatiently when this bite us.
+ * @param cmd
+ * Object with all commands to be executed
+ *
+ * PROBLEM: according to
+ * https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference\
+ * /Statements/for...in there is no guaranteed order of execution of commands
+ * (i.e., key, commentObj[key] pairs) in for..in cycle. According to
+ * https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference\
+ * /Operators/Special_Operators/delete_Operator#Cross-browser_issues it seems
+ * that everywhere except of Internet Explorer this should work well, but
+ * waiting impatiently when this bite us.
*/
function executeCommand(cmdObj) {
for (var key in cmdObj) {
@@ -71,9 +73,11 @@ function executeCommand(cmdObj) {
/**
* Actual execution function
- *
- * @param cmdLabel String with the name of the command to be executed
- * @param cmdParams Object with the appropriate parameters for the command
+ *
+ * @param cmdLabel
+ * String with the name of the command to be executed
+ * @param cmdParams
+ * Object with the appropriate parameters for the command
*/
function centralCommandDispatch (cmdLabel, cmdParams) {
console.log("centralCommandDispatch : cmdLabel = " + cmdLabel);
@@ -180,10 +184,11 @@ function centralCommandDispatch (cmdLabel, cmdParams) {
/**
* Change assignee of the bug
- *
- * @param newAssignee String with the email address of new assigneeAElement
- * or 'default' if the component's default assignee should be used.
- * Value null clears "Reset Assignee to default for component" checkbox
+ *
+ * @param newAssignee
+ * String with the email address of new assigneeAElement or 'default'
+ * if the component's default assignee should be used. Value null
+ * clears "Reset Assignee to default for component" checkbox
* @return none
*/
function changeAssignee (newAssignee) {
@@ -223,11 +228,12 @@ function changeAssignee (newAssignee) {
/**
* Adds new option to the 'comment_action' scroll down box
- *
- * @param pkg String package name
- * @param cmd String with the name of the command
- * If the 'comment_action' scroll down box doesn't exist, this
- * function will set up new one.
+ *
+ * @param pkg
+ * String package name
+ * @param cmd
+ * String with the name of the command If the 'comment_action' scroll
+ * down box doesn't exist, this function will set up new one.
*/
function addToCommentsDropdown (cmdObj) {
var select = document.getElementById("comment_action");
@@ -302,7 +308,8 @@ function generateButtons (pkgs, kNodes) {
}
}
}
- // TODO This is weird in this place, but that's the place where all constantData etc.
+ // TODO This is weird in this place, but that's the place where all
+ // constantData etc.
// are finally defined and available.
if (RHBZinit) {
RHBZinit();
@@ -326,7 +333,7 @@ function setConfigurationButton () {
/**
* dd
- *
+ *
* @return Element with the href attribute containng the information
*/
function getOptionTableCell(tableId, label) {
@@ -349,12 +356,13 @@ function getOptionTableCell(tableId, label) {
/**
* Parse the row with the attachment
- *
- * @param DOM element to be parsed
+ *
+ * @param DOM
+ * element to be parsed
* @return array with string name of the attachment, integer its id number,
- * string of MIME type, integer of size in kilobytes, and the whole
- * element itself
- *
+ * string of MIME type, integer of size in kilobytes, and the whole
+ * element itself
+ *
* TODO error handling is missing ... it's bleee
*/
function parseAttachmentLine(inElem) {
@@ -399,7 +407,8 @@ function startup() {
// Prepare for query buttons
// element ID brElementPlace_location is later used in JSON files
// Stay with this add_comment element even if RH BZ upgrades, this seems
- // to be generally much more stable (even with other bugzillas, e.g. b.gnome.org)
+ // to be generally much more stable (even with other bugzillas, e.g.
+ // b.gnome.org)
// then some getElementById.
var commentArea = document.getElementsByName("add_comment")[0].parentNode;
if (commentArea) {
@@ -412,7 +421,8 @@ function startup() {
}
}
- // TODO Probably could be ignored ... used only once on line 973 of rhbzpage.js
+ // TODO Probably could be ignored ... used only once on line 973 of
+ // rhbzpage.js
// if (parseAbrtBacktraces && this.RE.Abrt.test(getSummary())) {
// title = document.getElementById("short_desc_nonedit_display").textContent;
diff --git a/data/lib/checkin-context.js b/data/lib/checkin-context.js
index 8ae482d..0ccec0c 100644
--- a/data/lib/checkin-context.js
+++ b/data/lib/checkin-context.js
@@ -1,11 +1,13 @@
self.on('click', function(node, data) {
- var message = document.getElementById("__bz_tw_checkin_comment");
+ var message = document
+ .getElementById("__bz_tw_checkin_comment");
self.postMessage(message.textContent);
});
self.on('context', function(node) {
if (!onBugzillaPage(document.URL))
return false;
- var message = document.getElementById("__bz_tw_checkin_comment");
+ var message = document
+ .getElementById("__bz_tw_checkin_comment");
return !!message;
});
diff --git a/data/lib/color.js b/data/lib/color.js
index 163071e..4d0c41f 100644
--- a/data/lib/color.js
+++ b/data/lib/color.js
@@ -51,10 +51,13 @@ 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].4343
- *
- * @param Number r The red color value
- * @param Number g The green color value
- * @param Number b The blue color value
+ *
+ * @param Number
+ * r The red color value
+ * @param Number
+ * g The green color value
+ * @param Number
+ * b The blue color value
* @return Array The HSL representation
*/
Color.prototype.hsl = function() {
@@ -84,17 +87,22 @@ Color.prototype.hsl = function() {
h /= 6;
}
- return [ h, s, l ];
+ return [
+ h, s, l
+ ];
};
/**
* Converts an HSL color value to RGB. Conversion formula adapted from
* http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are
* contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
- *
- * @param Number h The hue
- * @param Number s The saturation
- * @param Number l The lightness
+ *
+ * @param Number
+ * h The hue
+ * @param Number
+ * s The saturation
+ * @param Number
+ * l The lightness
* @return Array The RGB representation
*/
Color.prototype.hslToRgb = function(h, s, l) {
@@ -130,17 +138,22 @@ Color.prototype.hslToRgb = function(h, s, l) {
b = hue2rgb(p, q, h - 1 / 3);
}
- return [ r * 255, g * 255, b * 255 ];
+ return [
+ r * 255, g * 255, b * 255
+ ];
};
/**
* Converts an RGB color value to HSV. Conversion formula adapted from
* http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are
* contained in the set [0, 255] and returns h, s, and v in the set [0, 1].
- *
- * @param Number r The red color value
- * @param Number g The green color value
- * @param Number b The blue color value
+ *
+ * @param Number
+ * r The red color value
+ * @param Number
+ * g The green color value
+ * @param Number
+ * b The blue color value
* @return Array The HSV representation
*/
Color.prototype.hsv = function() {
@@ -171,17 +184,22 @@ Color.prototype.hsv = function() {
h /= 6;
}
- return [ h, s, v ];
+ return [
+ h, s, v
+ ];
};
/**
* Converts an HSV color value to RGB. Conversion formula adapted from
* http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are
* contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
- *
- * @param Number h The hue
- * @param Number s The saturation
- * @param Number v The value
+ *
+ * @param Number
+ * h The hue
+ * @param Number
+ * s The saturation
+ * @param Number
+ * v The value
* @return Array The RGB representation
*/
Color.prototype.hsvToRgb = function(h, s, v) {
@@ -226,7 +244,9 @@ Color.prototype.hsvToRgb = function(h, s, v) {
break;
}
- return [ r * 255, g * 255, b * 255 ];
+ return [
+ r * 255, g * 255, b * 255
+ ];
};
/**
diff --git a/data/lib/fixingAttMIME.js b/data/lib/fixingAttMIME.js
index a016fe6..365cfae 100644
--- a/data/lib/fixingAttMIME.js
+++ b/data/lib/fixingAttMIME.js
@@ -5,17 +5,15 @@ var reqCounter = 0; // TODO should be probably a dict indexed by called method
/**
* Callback function for the XMLRPC request
- *
- * @param ret Object with xmlhttprequest response with attributes:
- * + status -- int return code
- * + statusText
- * + responseHeaders
- * + responseText
+ *
+ * @param ret
+ * Object with xmlhttprequest response with attributes: + status -- int
+ * return code + statusText + responseHeaders + responseText
*/
function XMLRPCcallback() {
reqCounter--;
if (reqCounter <= 0) {
- setTimeout(function () {
+ setTimeout(function() {
window.location.reload(true);
}, 1000);
}
@@ -24,24 +22,27 @@ function XMLRPCcallback() {
/**
* The worker function -- call XMLRPC to fix MIME type of the particular
* attachment
- *
- * @param id Integer with the attachment id to be fixed
- * @param type String with the new MIME type, optional defaults to "text/plain"
- * @param email Boolean whether email should be sent to appropriate person;
- * option, defaults to false
- *
+ *
+ * @param id
+ * Integer with the attachment id to be fixed
+ * @param type
+ * String with the new MIME type, optional defaults to "text/plain"
+ * @param email
+ * Boolean whether email should be sent to appropriate person; option,
+ * defaults to false
+ *
* updateAttachMimeType($data_ref, $username, $password)
- *
+ *
* Update the attachment mime type of an attachment. The first argument is a
* data hash containing information on the new MIME type and the attachment id
* that you want to act on.
- *
+ *
* $data_ref = { "attach_id" => "<Attachment ID>", # Attachment ID to perform
* MIME type change on. "mime_type" => "<New MIME Type Value>", # Legal MIME
* type value that you want to change the attachment to. "nomail" => 0, #
* OPTIONAL Flag that is either 1 or 0 if you want email to be sent or not for
* this change };
- *
+ *
*/
function fixAttachById(id, XMLRPCURL, type, email) {
var params = [];
@@ -63,18 +64,18 @@ function fixAttachById(id, XMLRPCURL, type, email) {
});
self.postMessage(new Message("MakeXMLRPCall", {
- url: XMLRPCURL,
- login: getLogin(),
- method: "bugzilla.updateAttachMimeType",
- params: params,
- callRPC: "FixAttachmentMIMECallback"
+ url : XMLRPCURL,
+ login : getLogin(),
+ method : "bugzilla.updateAttachMimeType",
+ params : params,
+ callRPC : "FixAttachmentMIMECallback"
}));
reqCounter++;
}
/**
* Add a link to the bad attachment for fixing it.
- *
+ *
* @param
* <TR> DOM jQuery element with a bad attachment
* @return none
@@ -82,6 +83,8 @@ function fixAttachById(id, XMLRPCURL, type, email) {
function addTextLink(row, xmlRpcUrl) {
var elemS = row[4].getElementsByTagName("td");
var elem = elemS[elemS.length - 1];
- createDeadLink("addFix2TextLink", "text", elem,
- fixAttachById, [row[1], xmlRpcUrl], "br");
+ createDeadLink("addFix2TextLink", "text", elem, fixAttachById,
+ [
+ row[1], xmlRpcUrl
+ ], "br");
}
diff --git a/data/lib/jumpNextBug.js b/data/lib/jumpNextBug.js
index 348c776..b777fe8 100644
--- a/data/lib/jumpNextBug.js
+++ b/data/lib/jumpNextBug.js
@@ -2,16 +2,53 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
-var nextElement = {};
-var nextRE = new RegExp("Next");
+(function createRelationElements() {
+ var relation = {};
+ var linkLabels = [
+ "First", "Last", "Prev", "Next"
+ ];
+ var labelToRelation = {
+ "First" : {
+ rel : "start"
+ },
+ "Last" : {
+ rel : "last"
+ },
+ "Prev" : {
+ rel : "prev"
+ },
+ "Next" : {
+ rel : "next"
+ }
+ };
-var aNavigElements = document.querySelectorAll("#bugzilla-body .navigation a");
-var filteredElements = Array.filter(aNavigElements, function(elem) {
- return nextRE.test(elem.textContent);
-});
-console.log("filteredElements.length = " + filteredElements.length);
-if (filteredElements.length > 0) {
- nextElement = filteredElements[0];
- nextElement.setAttribute("accesskey", "n");
- nextElement.innerHTML = "<u>N</u>ext";
-}
+ function createLinkRel(rel, href) {
+ var newLinkElement = document.createElement("link");
+ newLinkElement.setAttribute("rel", rel);
+ newLinkElement.setAttribute("href", href);
+ document.getElementsByTagName("head")[0]
+ .appendChild(newLinkElement);
+ }
+
+ var aNavigElements = document
+ .querySelectorAll("#bugzilla-body .navigation a");
+ Array.forEach(aNavigElements, function(elem) {
+ var labelText = elem.textContent.trim();
+ if (isInList(labelText, linkLabels)) {
+ labelToRelation[labelText].href = elem
+ .getAttribute("href");
+ }
+ ;
+ });
+ console.myDebug("labelToRelation = "
+ + labelToRelation.toSource());
+
+ for ( var key in labelToRelation) {
+ if (labelToRelation.hasOwnProperty(key)) {
+ relation = labelToRelation[key];
+ if (relation.href) {
+ createLinkRel(relation.rel, relation.href);
+ }
+ }
+ }
+})();
diff --git a/data/lib/logging-front.js b/data/lib/logging-front.js
index b8343a4..2f85a51 100644
--- a/data/lib/logging-front.js
+++ b/data/lib/logging-front.js
@@ -12,8 +12,7 @@ function addLogRecord() {
rec.date = new Date();
rec.url = document.location.toString();
rec.title = document.title;
- var comment = window.prompt(
- "Enter comments for this comment");
+ var comment = window.prompt("Enter comments for this comment");
if (comment !== null) {
comment = comment.trim();
if (comment.length > 0) {
@@ -22,8 +21,7 @@ function addLogRecord() {
var dateStr = getISODate(rec.date);
var urlStr = window.location.hostname;
var bugNo = getBugNoFromURL(window.location.href);
- rec.key = dateStr + "+" +
- urlStr + "+" + bugNo;
+ rec.key = dateStr + "+" + urlStr + "+" + bugNo;
self.postMessage(new Message("AddLogRecord", rec));
}
return rec;
@@ -33,52 +31,50 @@ function addLogRecord() {
/**
*/
-function setUpLogging () {
+function setUpLogging() {
// Protection against double-call
if (document.getElementById("generateTSButton")) {
- return ;
+ return;
}
// For adding additional buttons to the top toolbar
- var additionalButtons = document.querySelector("#bugzilla-body *.related_actions");
+ var additionalButtons = document
+ .querySelector("#bugzilla-body *.related_actions");
var that = this;
// logging all submits for timesheet
if (!submitHandlerInstalled) {
- document.forms.namedItem("changeform").addEventListener("submit",function (evt) {
- if (addLogRecord() === null) {
- evt.stopPropagation();
- evt.preventDefault();
- }
- }, false);
+ document.forms.namedItem("changeform").addEventListener(
+ "submit", function(evt) {
+ if (addLogRecord() === null) {
+ evt.stopPropagation();
+ evt.preventDefault();
+ }
+ }, false);
submitHandlerInstalled = true;
}
// (id, text, parent, callback, params, before, covered, accesskey)
- createDeadLink("generateTSButton", "Generate TS", additionalButtons,
- function(evt) {
- self.postMessage(new Message("GenerateTS"));
- }, [], "dash", "li");
+ createDeadLink("generateTSButton", "Generate TS",
+ additionalButtons, function(evt) {
+ self.postMessage(new Message("GenerateTS"));
+ }, [], "dash", "li");
createDeadLink("clearLogs", "Clear TS", additionalButtons,
- function(evt) {
- self.postMessage(new Message("ClearTS"));
- }, [], "dash", "li");
+ function(evt) {
+ self.postMessage(new Message("ClearTS"));
+ }, [], "dash", "li");
- createDeadLink("importTSButton", "Import TS", additionalButtons,
- function(evt) {
- self.postMessage(new Message("ImportTS"));
- }, [], "dash", "li");
+ createDeadLink("importTSButton", "Import TS",
+ additionalButtons, function(evt) {
+ self.postMessage(new Message("ImportTS"));
+ }, [], "dash", "li");
- /* TODO
- var clearLogAElem = document.getElementById("clearLogs");
- if (this.log.isEmpty()) {
- clearLogAElem.style.color = this.log.EmptyLogsColor;
- clearLogAElem.style.fontWeight = "normal";
- }
- else {
- clearLogAElem.style.color = this.log.FullLogsColor;
- clearLogAElem.style.fontWeight = "bolder";
- }
- */
+ /*
+ * TODO var clearLogAElem = document.getElementById("clearLogs"); if
+ * (this.log.isEmpty()) { clearLogAElem.style.color = this.log.EmptyLogsColor;
+ * clearLogAElem.style.fontWeight = "normal"; } else {
+ * clearLogAElem.style.color = this.log.FullLogsColor;
+ * clearLogAElem.style.fontWeight = "bolder"; }
+ */
}
diff --git a/data/lib/makeBacktraceAttachment.js b/data/lib/makeBacktraceAttachment.js
index a6b6ab0..6011c06 100644
--- a/data/lib/makeBacktraceAttachment.js
+++ b/data/lib/makeBacktraceAttachment.js
@@ -3,69 +3,68 @@
var titleParsedAttachment = "Part of the thread where crash happened";
/**
- *
+ *
*/
function pasteBacktraceInComments(atts) {
/*
- Let's comment it out, and we'll see if anything breaks.
- TODO This paragraph looks suspicous ... what is it?
- Does it belong to this function?
- var notedLabel = document.querySelector("label[for='newcc']");
- while (notedLabel.firstChild) {
- var node = notedLabel.removeChild(notedLabel.firstChild);
- notedLabel.parentNode.insertBefore(node, notedLabel);
- }
- notedLabel.parentNode.removeChild(notedLabel);
- */
+ * Let's comment it out, and we'll see if anything breaks. TODO This paragraph
+ * looks suspicous ... what is it? Does it belong to this function? var
+ * notedLabel = document.querySelector("label[for='newcc']"); while
+ * (notedLabel.firstChild) { var node =
+ * notedLabel.removeChild(notedLabel.firstChild);
+ * notedLabel.parentNode.insertBefore(node, notedLabel); }
+ * notedLabel.parentNode.removeChild(notedLabel);
+ */
// FIXME BROKEN and its depending functions are even more broken
return null;
- var abrtQueryURL = "https://bugzilla.redhat.com/buglist.cgi?" +
- "cmdtype=dorem&remaction=run&namedcmd=all%20NEW%20abrt%20crashes&"+
- "sharer_id=74116";
+ var abrtQueryURL = "https://bugzilla.redhat.com/buglist.cgi?"
+ + "cmdtype=dorem&remaction=run&namedcmd=all%20NEW%20abrt%20crashes&"
+ + "sharer_id=74116";
var mainTitle = document
.getElementsByClassName("bz_alias_short_desc_container")[0];
- createDeadLink ("callAbrtQuery_link",
- "Abrt bugs", mainTitle, abrtQueryURL, [], false, null, "a");
+ createDeadLink("callAbrtQuery_link", "Abrt bugs", mainTitle,
+ abrtQueryURL, [], false, null, "a");
if (idContainsWord("cf_devel_whiteboard", 'btparsed')) {
addStuffToTextBox('status_whiteboard', 'btparsed');
}
- if (!(isTriaged() || idContainsWord("status_whiteboard",
- 'btparsed') || (atts.length > 0))) {
- var btAttachments = atts
- .filter(function(att) {
- return (/File: backtrace/.test(att[0]));
- });
+ if (!(isTriaged()
+ || idContainsWord("status_whiteboard", 'btparsed') || (atts.length > 0))) {
+ var btAttachments = atts.filter(function(att) {
+ return (/File: backtrace/.test(att[0]));
+ });
// TODO we need to go through all backtrace attachments, but
// just the first one will do for now, we would need to do async
//
- btAttachments.forEach(function(x) {
- var attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
- + x[1];
- if ((!btSnippet) && // ???? FIXME
- (!idContainsWord("status_whiteboard", 'btparsed'))) {
- Request({
- url: attURL,
- onComplete: function(response) {
- if (response.status == 200) {
- btSnippet = parseBacktrace(response.text);
- if (btSnippet) {
- addCheckShowLink(x,btSnippet);
+ btAttachments
+ .forEach(
+ function(x) {
+ var attURL = "https://bugzilla.redhat.com/attachment.cgi?id="
+ + x[1];
+ if ((!btSnippet) && // ???? FIXME
+ (!idContainsWord("status_whiteboard", 'btparsed'))) {
+ Request({
+ url : attURL,
+ onComplete : function(response) {
+ if (response.status == 200) {
+ btSnippet = parseBacktrace(response.text);
+ if (btSnippet) {
+ addCheckShowLink(x, btSnippet);
+ }
+ }
+ }
+ }).get();
}
- }
- }
- }).get();
- }
- }, this);
+ }, this);
}
// Add "show BT" links
if (parsedAttachments.length > 0) {
- this.parsedAttachments.forEach(function (att) {
+ this.parsedAttachments.forEach(function(att) {
addShowParsedBTLink(att);
});
}
@@ -73,85 +72,95 @@ function pasteBacktraceInComments(atts) {
/**
* Open new window with the content of the attachment.
- *
- * @param id Number of the attachment id
+ *
+ * @param id
+ * Number of the attachment id
* @return none
*/
function showAttachment(id) {
- self.postMessage(new Message("OpenURLinPanel",
- "https://" + window.location.hostname + "/attachment.cgi?id=" + id));
+ self.postMessage(new Message("OpenURLinPanel", "https://"
+ + window.location.hostname + "/attachment.cgi?id=" + id));
}
/**
* add a link opening a window with the parsed backtrace
- *
- * @param att Attachment object
+ *
+ * @param att
+ * Attachment object
*/
function addShowParsedBTLink(att) {
var elem = att[4].querySelector("td:last-of-type");
- createDeadLink("showParsedBacktraceWindow-" + att[1], "showBT",
- elem, showAttachment, att[1], true);
+ createDeadLink("showParsedBacktraceWindow-" + att[1],
+ "showBT", elem, showAttachment, att[1], true);
}
/**
* Unfinished ... see above FIXME BROKEN AND DOESN'T WORK
*/
-function addNewAttachmentRow(origAtt,
- newAttId, newAttSize) {
+function addNewAttachmentRow(origAtt, newAttId, newAttSize) {
var that = this;
- var oldAddBTLink = document.getElementById("attachBacktraceActivator");
+ var oldAddBTLink = document
+ .getElementById("attachBacktraceActivator");
oldAddBTLink.parentNode.removeChild(oldAddBTLink);
var newTRElem = origAtt[4].cloneNode(true);
// fix number of the attachment
- Array.forEach(newTRElem.getElementsByTagName("a"), function (aEl) {
- aEl.setAttribute("href",
- aEl.getAttribute("href").replace(origAtt[1], newAttId));
+ Array.forEach(newTRElem.getElementsByTagName("a"), function(
+ aEl) {
+ aEl.setAttribute("href", aEl.getAttribute("href").replace(
+ origAtt[1], newAttId));
});
var aElements = newTRElem.getElementsByTagName("a");
- aElements[0].setAttribute("name","parsed-backtrace.txt");
+ aElements[0].setAttribute("name", "parsed-backtrace.txt");
aElements[0].getElementsByTagName("b")[0].textContent = titleParsedAttachment;
- var sizeSpan = newTRElem.getElementsByClassName("bz_attach_extra_info")[0];
- sizeSpan.textContent = "(" + (newAttSize / 1024).toFixed(2) + " KB, text/plain)";
+ var sizeSpan = newTRElem
+ .getElementsByClassName("bz_attach_extra_info")[0];
+ sizeSpan.textContent = "(" + (newAttSize / 1024).toFixed(2)
+ + " KB, text/plain)";
- // aElements[1].textContent = new Date().toString(); TODO we should add eventually, but not pressing
+ // aElements[1].textContent = new Date().toString(); TODO we should add
+ // eventually, but not pressing
var vcardSpan = newTRElem.getElementsByClassName("vcard")[0];
if (vcardSpan !== undefined) {
var vcardSpanClassList = vcardSpan.classList;
- if (/@redhat\.com/.test(this.login) && !vcardSpanClassList.contains("redhat_user")) {
+ if (/@redhat\.com/.test(this.login)
+ && !vcardSpanClassList.contains("redhat_user")) {
vcardSpanClassList.add("redhat_user");
}
var vcardAElem = vcardSpan.getElementsByTagName("a")[0];
vcardAElem.setAttribute("title", this.login);
vcardAElem.setAttribute("href", "mailto:" + this.login);
vcardAElem.className = "email";
- vcardAElem.innerHTML="<span class='fn'>" + this.login + "</span>";
+ vcardAElem.innerHTML = "<span class='fn'>" + this.login
+ + "</span>";
}
var elem = newTRElem.querySelector("td:last-of-type");
this.createDeadLink("showBacktrace", "show BT", elem,
- this.showAttachment, newAttId, false);
+ this.showAttachment, newAttId, false);
- origAtt[4].parentNode.insertBefore(newTRElem, origAtt[4].nextSibling);
+ origAtt[4].parentNode.insertBefore(newTRElem,
+ origAtt[4].nextSibling);
}
/**
* Add a link to create a new attachment with a parsed backtrace
- *
- * @param oldAtt Object with an attachment row
- * @param snippet String with parsed backtrace
+ *
+ * @param oldAtt
+ * Object with an attachment row
+ * @param snippet
+ * String with parsed backtrace
* @return none
*/
function addCheckShowLink(oldAtt, snippet) {
var elem = oldAtt[4].querySelector("td:last-of-type");
-/*
- createDeadLink("attachBacktraceActivator", "add parsed BT", elem, function(x) {
- // pass function and parameters as two separate parameters, the function to be called from
- // addAttachment
- addAttachment(snippet, addNewAttachmentRow, oldAtt);
- }, [], true);
-*/
+ /*
+ * createDeadLink("attachBacktraceActivator", "add parsed BT", elem,
+ * function(x) { // pass function and parameters as two separate parameters,
+ * the function to be called from // addAttachment addAttachment(snippet,
+ * addNewAttachmentRow, oldAtt); }, [], true);
+ */
}
diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js
index 66b5a9b..ab8ec35 100644
--- a/data/lib/otherButtons.js
+++ b/data/lib/otherButtons.js
@@ -4,9 +4,9 @@
/**
* Set background color of all comments made by reporter in ReporterColor color
- *
+ *
*/
-function checkComments () {
+function checkComments() {
var reporter = getReporter();
commentsWalker(function(x) {
var email = parseMailto(x.getElementsByClassName("vcard")[0]
@@ -17,39 +17,39 @@ function checkComments () {
});
}
-function collectComments () {
+function collectComments() {
var outStr = "";
commentsWalker(function(x) {
- outStr += x.getElementsByTagName("pre")[0].textContent + "\n";
+ outStr += x.getElementsByTagName("pre")[0].textContent
+ + "\n";
});
return outStr.trim();
}
/**
* Find default assignee based on the current component
- *
- * @return String what would be a default assignee if
- * we haven't set it up.
+ *
+ * @return String what would be a default assignee if we haven't set it up.
*/
function getDefaultAssignee() {
return filterByRegexp(constantData.defaultAssignee,
- getComponent());
+ getComponent());
}
/**
* Set default assignee
- *
- * @return none
- * sets this.defaultAssignee property according to defaultAssignee list
+ *
+ * @return none sets this.defaultAssignee property according to defaultAssignee
+ * list
*/
function setDefaultAssignee() {
var defAss = getDefaultAssignee();
// Add setting default assignee
if (defAss && (defAss !== getOwner())) {
- createNewButton("bz_assignee_edit_container",true, {
- "name": "Def. Assignee",
- "assignee": "default"
+ createNewButton("bz_assignee_edit_container", true, {
+ "name" : "Def. Assignee",
+ "assignee" : "default"
});
}
}
@@ -67,7 +67,7 @@ function markBugTriaged() {
alert("This won't do! Specify some severity!");
}
else {
- addStuffToTextBox("keywords","Triaged");
+ addStuffToTextBox("keywords", "Triaged");
}
}
@@ -78,12 +78,13 @@ function addingEmbelishments(list) {
var maintCCAddr = "";
if (constantData.CCmaintainer) {
maintCCAddr = filterByRegexp(constantData.CCmaintainer,
- getComponent())[0]; // filterByRegexp returns array, not string
+ getComponent())[0]; // filterByRegexp returns array, not string
}
// we should make visible whether maintCCAddr is in CCList
if (maintCCAddr && isInList(maintCCAddr, getCCList())) {
- var ccEditBoxElem = document.getElementById("cc_edit_area_showhide");
+ var ccEditBoxElem = document
+ .getElementById("cc_edit_area_showhide");
ccEditBoxElem.style.color = "navy";
ccEditBoxElem.style.fontWeight = "bolder";
ccEditBoxElem.style.textDecoration = "underline";
@@ -93,8 +94,8 @@ function addingEmbelishments(list) {
if (config.signature && config.signature.length > 0) {
var signaturesCounter = 0;
var signatureFedoraString = config.signature;
- document.forms.namedItem("changeform").addEventListener("submit",
- function(aEvt) {
+ document.forms.namedItem("changeform").addEventListener(
+ "submit", function(aEvt) {
if (signaturesCounter < 1) {
addStuffToTextBox("comment", signatureFedoraString);
signaturesCounter += 1;
@@ -105,19 +106,19 @@ function addingEmbelishments(list) {
// set default assignee on change of the component
var compElement = document.getElementById("component");
if (compElement && (compElement.options)) {
- document.getElementById("component").addEventListener("change",
- function() {
+ document.getElementById("component").addEventListener(
+ "change", function() {
changeAssignee("default");
}, false);
}
// TODO Get compiz bugs as well
- if ((constantData.chipNames) &&
- (list[0]) &&
- (!FillMagicDoneRE.test(getSummary())) &&
- (maintCCAddr === "xgl-maint@redhat.com")) {
+ if ((constantData.chipNames) && (list[0])
+ && (!FillMagicDoneRE.test(getSummary()))
+ && (maintCCAddr === "xgl-maint@redhat.com")) {
// Add find chip magic button
- var whiteboard_string = document.getElementById("status_whiteboard").value;
+ var whiteboard_string = document
+ .getElementById("status_whiteboard").value;
if (!/card_/.test(whiteboard_string)) {
fillInChipMagic(list[0][1]);
}
@@ -126,10 +127,13 @@ function addingEmbelishments(list) {
/**
* Set branding colours to easily distinguish between Fedora and RHEL bugs
- *
- * @param brand String with product of the current bug
- * @param version String with the version of the bug
- * @param its String with the IsueTracker numbers
+ *
+ * @param brand
+ * String with product of the current bug
+ * @param version
+ * String with the version of the bug
+ * @param its
+ * String with the IsueTracker numbers
* @return none
*/
function setBranding(xLogAtts) {
@@ -147,8 +151,8 @@ function setBranding(xLogAtts) {
brandColor = RHColor;
}
}
- else if (new RegExp("Fedora").test(document.
- getElementById("product").value)) {
+ else if (new RegExp("Fedora").test(document
+ .getElementById("product").value)) {
if (document.getElementById("version").value === "rawhide") {
brandColor = RawhideColor;
}
@@ -161,7 +165,8 @@ function setBranding(xLogAtts) {
document.getElementsByTagName("body")[0].style.background = brandColor
.toString()
+ " none";
- document.getElementById("titles").style.background = brandColor.toString()
+ document.getElementById("titles").style.background = brandColor
+ .toString()
+ " none";
// Remove "Bug" from the title of the bug page, so we have more space with
@@ -169,7 +174,8 @@ function setBranding(xLogAtts) {
var titleElem = document.getElementsByTagName("title")[0];
titleElem.textContent = titleElem.textContent.slice(4);
- var bodyTitleParent = document.getElementById("summary_alias_container").parentNode;
+ var bodyTitleParent = document
+ .getElementById("summary_alias_container").parentNode;
var bodyTitleElem = bodyTitleParent.getElementsByTagName("b")[0];
bodyTitleElem.textContent = bodyTitleElem.textContent.slice(4);
@@ -177,7 +183,8 @@ function setBranding(xLogAtts) {
// for security bugs.
if (hasKeyword("Security")) {
document.getElementById("bugzilla-body").style.background = SalmonPink
- .toString() + ' none';
+ .toString()
+ + ' none';
}
// Make it visible whether the bug has been triaged
@@ -194,6 +201,6 @@ function setBranding(xLogAtts) {
.getElementById("bz_component_edit_container"))) {
compElems.style.background = "red none";
}
-
+
addingEmbelishments(xLogAtts);
}
diff --git a/data/lib/preprocessDuplicates.js b/data/lib/preprocessDuplicates.js
index 44ea5ca..d312fb9 100644
--- a/data/lib/preprocessDuplicates.js
+++ b/data/lib/preprocessDuplicates.js
@@ -36,85 +36,97 @@
* ***** END LICENSE BLOCK ***** */
function preprocessDuplicateMarkers(mainDoc, histDoc) {
- var comments = mainDoc.querySelectorAll(".bz_comment");
- var reDuplicate = /^\s*\*\*\*\s+Bug\s+(\d+)\s+has\s+been\s+marked\s+as\s+a\s+duplicate\s+of\s+this\s+bug.\s+\*\*\*\s*$/i;
- var row = 0;
- var rows = histDoc.querySelectorAll("#bugzilla-body tr");
- for (var i = 1 /* comment 0 can never be a duplicate marker */;
- i < comments.length; ++i) {
- var textHolder = comments[i].querySelector(".bz_comment_text");
- var match = reDuplicate.exec(trimContent(textHolder));
- if (match) {
- // construct the table row to be injected in histDoc
- var bugID = match[1];
- var email = comments[i].querySelector(".bz_comment_user .email")
- .href
- .substr(7);
- var link = textHolder.querySelector("a");
- var title = link.title;
- var time = trimContent(comments[i].querySelector(".bz_comment_time"));
- var what = 'Duplicate';
- var removed = '';
- var number = trimContent(comments[i].querySelector(".bz_comment_number")).
- replace(/[^\d]+/g, '');
- var class_ = '';
- if (/bz_closed/i.test(link.className + " " + link.parentNode.className)) {
- class_ += 'bz_closed ';
- }
- if (link.parentNode.tagName.toLowerCase() == 'i') {
- class_ += 'bztw_unconfirmed ';
- }
- var added = '<a href="show_bug.cgi?id=' + bugID + '" title="' +
- htmlEncode(title) + '" name="c' + number + '" class="' + class_ +
- '">' + bugID + '</a>';
+ var comments = mainDoc.querySelectorAll(".bz_comment");
+ var reDuplicate = /^\s*\*\*\*\s+Bug\s+(\d+)\s+has\s+been\s+marked\s+as\s+a\s+duplicate\s+of\s+this\s+bug.\s+\*\*\*\s*$/i;
+ var row = 0;
+ var rows = histDoc.querySelectorAll("#bugzilla-body tr");
+ for ( var i = 1 /* comment 0 can never be a duplicate marker */; i < comments.length; ++i) {
+ var textHolder = comments[i]
+ .querySelector(".bz_comment_text");
+ var match = reDuplicate.exec(trimContent(textHolder));
+ if (match) {
+ // construct the table row to be injected in histDoc
+ var bugID = match[1];
+ var email = comments[i]
+ .querySelector(".bz_comment_user .email").href
+ .substr(7);
+ var link = textHolder.querySelector("a");
+ var title = link.title;
+ var time = trimContent(comments[i]
+ .querySelector(".bz_comment_time"));
+ var what = 'Duplicate';
+ var removed = '';
+ var number = trimContent(
+ comments[i].querySelector(".bz_comment_number"))
+ .replace(/[^\d]+/g, '');
+ var class_ = '';
+ if (/bz_closed/i.test(link.className + " "
+ + link.parentNode.className)) {
+ class_ += 'bz_closed ';
+ }
+ if (link.parentNode.tagName.toLowerCase() == 'i') {
+ class_ += 'bztw_unconfirmed ';
+ }
+ var added = '<a href="show_bug.cgi?id=' + bugID
+ + '" title="' + htmlEncode(title) + '" name="c'
+ + number + '" class="' + class_ + '">' + bugID
+ + '</a>';
- // inject the table row
- var reachedEnd = false;
- for (; row < rows.length; ++row) {
- var cells = rows[row].querySelectorAll("td");
- if (cells.length != 5)
- continue;
- if (time > trimContent(cells[1])) {
- if (row < rows.length - 1) {
- continue;
- } else {
- reachedEnd = true;
- }
- }
- if (time == trimContent(cells[1])) {
- cells[0].rowSpan++;
- cells[1].rowSpan++;
- var rowContents = [what, removed, added];
- var tr = histDoc.createElement("tr");
- rowContents.forEach(function (cellContents) {
- var td = histDoc.createElement("td");
- td.innerHTML = cellContents;
- tr.appendChild(td);
- });
- if (row != rows.length - 1) {
- rows[row].parentNode.insertBefore(tr, rows[row+1]);
- } else {
- rows[row].parentNode.appendChild(tr);
- }
- } else {
- var rowContents = [email, time, what, removed, added];
- var tr = histDoc.createElement("tr");
- rowContents.forEach(function (cellContents) {
- var td = histDoc.createElement("td");
- td.innerHTML = cellContents;
- tr.appendChild(td);
- });
- if (reachedEnd) {
- rows[row].parentNode.appendChild(tr);
- } else {
- rows[row].parentNode.insertBefore(tr, rows[row]);
- }
- }
- break;
- }
-
- // remove the comment from the main doc
- comments[i].parentNode.removeChild(comments[i]);
+ // inject the table row
+ var reachedEnd = false;
+ for (; row < rows.length; ++row) {
+ var cells = rows[row].querySelectorAll("td");
+ if (cells.length != 5)
+ continue;
+ if (time > trimContent(cells[1])) {
+ if (row < rows.length - 1) {
+ continue;
+ }
+ else {
+ reachedEnd = true;
+ }
+ }
+ if (time == trimContent(cells[1])) {
+ cells[0].rowSpan++;
+ cells[1].rowSpan++;
+ var rowContents = [
+ what, removed, added
+ ];
+ var tr = histDoc.createElement("tr");
+ rowContents.forEach(function(cellContents) {
+ var td = histDoc.createElement("td");
+ td.innerHTML = cellContents;
+ tr.appendChild(td);
+ });
+ if (row != rows.length - 1) {
+ rows[row].parentNode.insertBefore(tr, rows[row + 1]);
+ }
+ else {
+ rows[row].parentNode.appendChild(tr);
+ }
}
+ else {
+ var rowContents = [
+ email, time, what, removed, added
+ ];
+ var tr = histDoc.createElement("tr");
+ rowContents.forEach(function(cellContents) {
+ var td = histDoc.createElement("td");
+ td.innerHTML = cellContents;
+ tr.appendChild(td);
+ });
+ if (reachedEnd) {
+ rows[row].parentNode.appendChild(tr);
+ }
+ else {
+ rows[row].parentNode.insertBefore(tr, rows[row]);
+ }
+ }
+ break;
+ }
+
+ // remove the comment from the main doc
+ comments[i].parentNode.removeChild(comments[i]);
}
+ }
}
diff --git a/data/lib/queries.js b/data/lib/queries.js
index 4bf959a..52c6ce6 100644
--- a/data/lib/queries.js
+++ b/data/lib/queries.js
@@ -2,57 +2,61 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
-function getSelection () {
- var text = "";
- var selectionObject = window.getSelection();
- if (selectionObject.rangeCount > 0) {
- text = selectionObject.getRangeAt(0).toString().trim();
- }
- return text;
+function getSelection() {
+ var text = "";
+ var selectionObject = window.getSelection();
+ if (selectionObject.rangeCount > 0) {
+ text = selectionObject.getRangeAt(0).toString().trim();
+ }
+ return text;
}
/**
* Opens a new tab with a query for the given text in the selected component
- *
- * @param text to be searched for
- * @param component String with the component name (maybe latter regexp?)
- * @param product (optional) string with the product name, if undefined,
- * search in all products
+ *
+ * @param text
+ * to be searched for
+ * @param component
+ * String with the component name (maybe latter regexp?)
+ * @param product
+ * (optional) string with the product name, if undefined, search in all
+ * products
* @return None
*
*/
function queryInNewTab(text, component, product, equivComps) {
- var urlStr = "https://" + window.location.hostname + "/buglist.cgi?query_format=advanced";
- if (product) {
- urlStr += "&product=" + product.trim();
- }
- if (component) {
- if (equivComps) {
- var equivCompsArr = equivComps.
- filter(function (REstr) {
- return new RegExp(REstr).test(component);
- }, this);
- if (equivCompsArr.length > 0) {
- component = equivCompsArr[0];
- }
- }
- urlStr += "&component=" + component.trim();
+ var urlStr = "https://" + window.location.hostname
+ + "/buglist.cgi?query_format=advanced";
+ if (product) {
+ urlStr += "&product=" + product.trim();
+ }
+ if (component) {
+ if (equivComps) {
+ var equivCompsArr = equivComps.filter(function(REstr) {
+ return new RegExp(REstr).test(component);
+ }, this);
+ if (equivCompsArr.length > 0) {
+ component = equivCompsArr[0];
+ }
}
+ urlStr += "&component=" + component.trim();
+ }
- // using more complicated query tables here, because they can be more easily
- // edited
- // for further investigative searches
- if (text) {
- text = encodeURIComponent(text.trim());
- var searchText = "&field0-0-0=longdesc&type0-0-0=substring&value0-0-0="
- + text
- + "&field0-0-1=attach_data.thedata&type0-0-1=substring&value0-0-1="
- + text
- + "&field0-0-2=status_whiteboard&type0-0-2=substring&value0-0-2="
- + text;
- urlStr += searchText;
- self.postMessage(new Message("OpenURLinTab", urlStr)); // utils.js is always avaiulable
- }
+ // using more complicated query tables here, because they can be more easily
+ // edited
+ // for further investigative searches
+ if (text) {
+ text = encodeURIComponent(text.trim());
+ var searchText = "&field0-0-0=longdesc&type0-0-0=substring&value0-0-0="
+ + text
+ + "&field0-0-1=attach_data.thedata&type0-0-1=substring&value0-0-1="
+ + text
+ + "&field0-0-2=status_whiteboard&type0-0-2=substring&value0-0-2="
+ + text;
+ urlStr += searchText;
+ self.postMessage(new Message("OpenURLinTab", urlStr)); // utils.js is
+ // always avaiulable
+ }
}
/**
@@ -60,39 +64,42 @@ function queryInNewTab(text, component, product, equivComps) {
* function this.queryInNewTab, and run it.
*/
function queryForSelection() {
- var text = getSelection();
- if (!text) {
- self.postMessage(new Message("GetClipboard", "queryLocal"));
- } else {
- if (equivalentComponents) {
- queryInNewTab(text, getComponent(), getProduct(), equivalentComponents);
- }
- else {
- queryInNewTab(text, getComponent(), getProduct());
- }
+ var text = getSelection();
+ if (!text) {
+ self.postMessage(new Message("GetClipboard", "queryLocal"));
+ }
+ else {
+ if (equivalentComponents) {
+ queryInNewTab(text, getComponent(), getProduct(),
+ equivalentComponents);
}
+ else {
+ queryInNewTab(text, getComponent(), getProduct());
+ }
+ }
}
/**
- *
+ *
*/
function queryUpstreamCallback(text, queryUpBug) {
var searchData = filterByRegexp(queryUpBug, getComponent());
if (!searchData) {
- return ; // not sure why it should happen, but certainly better
+ return; // not sure why it should happen, but certainly better
}
var urlBase = searchData.url;
- text = searchData.searchBy+":"+searchData.fillIn+" "+text.trim();
+ text = searchData.searchBy + ":" + searchData.fillIn + " "
+ + text.trim();
if (searchData.fillIn == "$$$") {
text = text.replace("$$$", getComponent());
}
- text = encodeURIComponent(text).replace("%20","+");
+ text = encodeURIComponent(text).replace("%20", "+");
self.postMessage(new Message("OpenURLinTab", urlBase + text));
}
/**
* Search simple query in the upstream bugzilla appropriate for the component
- *
+ *
* @return none
*/
function queryUpstream(qUpBug) {
@@ -102,7 +109,8 @@ function queryUpstream(qUpBug) {
}
var text = getSelection();
if (!text) {
- self.postMessage(new Message("GetClipboard", "queryUpstream"));
+ self
+ .postMessage(new Message("GetClipboard", "queryUpstream"));
}
else {
queryUpstreamCallback(text, qUpBug);
diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js
index 5daeea7..752e471 100644
--- a/data/lib/rhbzpage.js
+++ b/data/lib/rhbzpage.js
@@ -16,13 +16,14 @@ var RawhideColor = new Color(0, 119, 0); // or "green", or RGB 0, 119, 0, or
// 120, 0, 23
var RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20
-// [ 126.386] (--) NOUVEAU(0): Chipset: "NVIDIA NVaf"
+// [ 126.386] (--) NOUVEAU(0): Chipset: "NVIDIA NVaf"
var logAnalyzeLogic = {
"AnalyzeInterestingLine": {
/*
- [ 126.378] (--) PCI:*(0:4:0:0) 10de:08a0:106b:00c2 rev 162, Mem @ 0xd2000000/16777216, \
- 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x00001000/128, BIOS @ 0x????????/131072
- */
+ * [ 126.378] (--) PCI:*(0:4:0:0) 10de:08a0:106b:00c2 rev 162, Mem @
+ * 0xd2000000/16777216, \ 0xc0000000/268435456, 0xd0000000/33554432, I/O @
+ * 0x00001000/128, BIOS @ 0x????????/131072
+ */
re: [
"^(\\[[ .0-9]+\\])?\\s*\\(--\\) PCI:\\*\\([0-9:]+\\)\\s*" +
"([0-9a-f:]+).*$",
@@ -32,14 +33,13 @@ var logAnalyzeLogic = {
func: chipsetMagic
},
/*
- [ 126.385] (WW) Falling back to old probe method for vesa
- [ 126.385] (WW) Falling back to old probe method for fbdev
- [ 126.386] (--) NOUVEAU(0): Chipset: "NVIDIA NVaf"
- Backtrace:
-
- [ 33.158] Kernel command line: ro root=LABEL=root rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us drm.debug=0x04
-
- */
+ * [ 126.385] (WW) Falling back to old probe method for vesa [ 126.385] (WW)
+ * Falling back to old probe method for fbdev [ 126.386] (--) NOUVEAU(0):
+ * Chipset: "NVIDIA NVaf" Backtrace: [ 33.158] Kernel command line: ro
+ * root=LABEL=root rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8
+ * SYSFONT=latarcyrheb-sun16 KEYTABLE=us drm.debug=0x04
+ *
+ */
"AnalyzeXorgLogBacktrace": {
re: "^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.* [cC]hipset:.*)|\\s*(Backtrace|Kernel command line)",
func: analyzeXorg
@@ -145,8 +145,9 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) {
/**
* Make it sailent that the some attachments with bad MIME type are present
- *
- * @param atts Array of attachments subarrays
+ *
+ * @param atts
+ * Array of attachments subarrays
* @return none
*/
function markBadAttachments(atts) {
@@ -178,7 +179,7 @@ function markBadAttachments(atts) {
/**
* Open a tab in the upstream bugzilla to create a new bug
- *
+ *
* @return none
*/
function sendBugUpstream() {
@@ -197,7 +198,7 @@ function sendBugUpstream() {
/**
* Add a link opening selected lines of Xorg.0.log
- *
+ *
* @return none
*/
function addCheckXorgLogLink(attList) {
@@ -214,13 +215,14 @@ function addCheckXorgLogLink(attList) {
/**
* Given line to be parsed, find out which chipset it is and fill in the
* whiteboard
- *
- * @param PCIidArrObj object with two fields
- * id Array manufacturer-ID and product-ID (PCI IDs)
- * chipsetLine whole line containing PCI ID.
- * @param driverStr String with the driver name
+ *
+ * @param PCIidArrObj
+ * object with two fields id Array manufacturer-ID and product-ID (PCI
+ * IDs) chipsetLine whole line containing PCI ID.
+ * @param driverStr
+ * String with the driver name
* @return None
- *
+ *
*/
function fillInWhiteBoard(cardName) {
console.myDebug("fillInWhiteBoard: cardName = " + cardName);
@@ -234,8 +236,9 @@ function fillInWhiteBoard(cardName) {
* Get attached Xorg.0.log, parse it and find the value of chip. Does not fill
* the whiteboard itself, just adds button to do so,paramList so that slow
* XMLHttpRequest is done in advance.
- *
- * @param log array of XorgLogAttList
+ *
+ * @param log
+ * array of XorgLogAttList
* @return None
*/
function fillInChipMagic(XlogID) {
@@ -244,8 +247,9 @@ function fillInChipMagic(XlogID) {
/**
* Creates a button to change summary by adding a graphic chip label
- *
- * @param Array with matching results of re.exec()
+ *
+ * @param Array
+ * with matching results of re.exec()
*/
function chipsetMagic (interestingLineArr) {
// parse Xorg.0.log
@@ -287,7 +291,7 @@ function chipsetMagic (interestingLineArr) {
if (cardStr) {
createNewButton("short_desc_nonedit_display", false, {
"name": "Fill In",
- "chipMagic": cardStr,
+ "chipMagic": cardStr
});
}
}
@@ -358,8 +362,9 @@ function findInterestingLine(wholeLog, backMsg) {
/**
* Add information about the upstream bug upstream, and closing it.
- *
- * @param evt Event which called this handler
+ *
+ * @param evt
+ * Event which called this handler
* @return none
*/
function addClosingUpstream() {
@@ -409,7 +414,7 @@ function addClosingUpstream() {
}
/**
- *
+ *
*/
function parseBacktrace (ret) {
var signalHandler = new RegExp("^\\s*#[0-9]*\\s*<signal handler called>");
diff --git a/data/lib/skip-bug.js b/data/lib/skip-bug.js
index 3639448..c909a3e 100644
--- a/data/lib/skip-bug.js
+++ b/data/lib/skip-bug.js
@@ -6,12 +6,12 @@ function reloadPage() {
var stemURL = 'https://HOSTNAME/show_bug.cgi?id=';
var titleElems = document.getElementsByTagName('title');
if (titleElems) {
- var REArr = new RegExp('[bB]ug\\s+([0-9]+)').
- exec(titleElems[0].textContent);
+ var REArr = new RegExp('[bB]ug\\s+([0-9]+)')
+ .exec(titleElems[0].textContent);
var hostname = document.location.hostname;
if (REArr) {
- document.location = stemURL.
- replace('HOSTNAME',hostname) + REArr[1];
+ document.location = stemURL.replace('HOSTNAME', hostname)
+ + REArr[1];
}
}
}
diff --git a/data/lib/urltest.js b/data/lib/urltest.js
index a0dbabf..609e77b 100644
--- a/data/lib/urltest.js
+++ b/data/lib/urltest.js
@@ -1,4 +1,5 @@
function onBugzillaPage(url) {
- return /https:\/\/bugzilla(-[a-zA-Z]+)*\.mozilla\.org/.test(url)
+ return /https:\/\/bugzilla(-[a-zA-Z]+)*\.mozilla\.org/
+ .test(url)
|| /https:\/\/landfill.*\.bugzilla\.org/.test(url);
-} \ No newline at end of file
+}
diff --git a/data/lib/util.js b/data/lib/util.js
index 4a46403..be674bc 100644
--- a/data/lib/util.js
+++ b/data/lib/util.js
@@ -7,16 +7,17 @@
/**
* parse URL to get its parts.
- *
+ *
* @param url
* @return object with all parsed parts of URL as properties
- *
- * Originally from http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
- * Copyright February 19th, 2009, James Padolsey, <license undeclared>
- *
- * This function creates a new anchor element and uses location
- * properties (inherent) to get the desired URL data. Some String
- * operations are used (to normalize results across browsers).
+ *
+ * Originally from
+ * http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ Copyright
+ * February 19th, 2009, James Padolsey, <license undeclared>
+ *
+ * This function creates a new anchor element and uses location properties
+ * (inherent) to get the desired URL data. Some String operations are used (to
+ * normalize results across browsers).
*/
function parseURL(url) {
var a = document.createElement('a');
@@ -47,16 +48,19 @@ function parseURL(url) {
}
/**
- * parse XML object out of string working around various bugs in Gecko implementation
- * see https://developer.mozilla.org/en/E4X for more information
- *
- * @param inStr String with unparsed XML string
+ * parse XML object out of string working around various bugs in Gecko
+ * implementation see https://developer.mozilla.org/en/E4X for more information
+ *
+ * @param inStr
+ * String with unparsed XML string
* @return XML object
*/
function parseXMLfromString (inStuff) {
- // if (typeof inStuff !== 'string') In future we should recognize this.response
+ // if (typeof inStuff !== 'string') In future we should recognize
+ // this.response
// and get just .text property out of it. TODO
- var respStr = inStuff.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551
+ var respStr = inStuff.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug
+ // 336551
return new XML(respStr);
}
@@ -74,7 +78,9 @@ function getBugNo() {
/**
* Get a bug no from URL ... fails with aliases
- * @param url String with URL to be analyzed
+ *
+ * @param url
+ * String with URL to be analyzed
* @return String with the bug ID
*/
function getBugNoFromURL(url) {
@@ -86,8 +92,9 @@ function getBugNoFromURL(url) {
/**
* Send mouse click to the specified element
- *
- * @param String ID of the element to send mouseclick to
+ *
+ * @param String
+ * ID of the element to send mouseclick to
* @return None
*/
function clickMouse (targetID) {
@@ -98,14 +105,22 @@ function clickMouse (targetID) {
}
/**
- * Create a A element leadink nowhere, but with listener running a callback on the click
- *
- * @param id String with a id to be added to the element
- * @param text String with a string to be added as a textContent of the element
- * @param parent Node which is a parent of the object
- * @param callback Function to be called after clicking on the link
- * @param params Array with parameters of the callback
- * @param Boolean before if there should be a <br> element before.
+ * Create a A element leadink nowhere, but with listener running a callback on
+ * the click
+ *
+ * @param id
+ * String with a id to be added to the element
+ * @param text
+ * String with a string to be added as a textContent of the element
+ * @param parent
+ * Node which is a parent of the object
+ * @param callback
+ * Function to be called after clicking on the link
+ * @param params
+ * Array with parameters of the callback
+ * @param Boolean
+ * before if there should be a <br>
+ * element before.
* @return none
*/
function createDeadLink (id, text, parent, callback, params, before, covered, accesskey) {
@@ -156,13 +171,13 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac
}
/*
- * From <a> element diggs out just plain email address
- * Note that bugzilla.gnome.org doesn't have mailto: url but
+ * From <a> element diggs out just plain email address Note that
+ * bugzilla.gnome.org doesn't have mailto: url but
* https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=mcepl%40redhat.com
- *
- * @param aElement Element with href attribute or something else
- * @return String with the address or null
- *
+ *
+ * @param aElement Element with href attribute or something else @return String
+ * with the address or null
+ *
*/
function parseMailto(aElement) {
var emailStr = "", hrefStr = "";
@@ -182,7 +197,7 @@ function parseMailto(aElement) {
/**
* format date to be in ISO format (just day part)
- *
+ *
* @param date
* @return string with the formatted date
*/
@@ -198,9 +213,11 @@ function getISODate(dateStr) {
/**
* Check whether an item is member of the list. Idea is just to make long if
* commands slightly more readable.
- *
- * @param mbr string to be searched in the list
- * @param list list
+ *
+ * @param mbr
+ * string to be searched in the list
+ * @param list
+ * list
* @return position of the string in the list, or -1 if none found.
*/
function isInList(mbr, list) {
@@ -212,12 +229,12 @@ function isInList(mbr, list) {
/**
* Make sure value returned is Array
- *
+ *
* @param Array/String
* @return Array
- *
- * If something else than Array or String is passed to the function
- * the result will be untouched actual argument of the call.
+ *
+ * If something else than Array or String is passed to the function the result
+ * will be untouched actual argument of the call.
*/
function valToArray(val) {
var isArr = val &&
@@ -228,9 +245,11 @@ function valToArray(val) {
/**
* Merges two comma separated string as a list and returns new string
- *
- * @param str String with old values
- * @param value String/Array with other values
+ *
+ * @param str
+ * String with old values
+ * @param value
+ * String/Array with other values
* @return String with merged lists
*/
function addCSVValue(str, value) {
@@ -250,9 +269,11 @@ function addCSVValue(str, value) {
/**
* Treats comma separated string as a list and removes one item from it
- *
- * @param str String treated as a list
- * @param value String with the value to be removed from str
+ *
+ * @param str
+ * String treated as a list
+ * @param value
+ * String with the value to be removed from str
* @return String with the resulting list comma separated
*/
function removeCSVValue(str, value) {
@@ -268,9 +289,11 @@ function removeCSVValue(str, value) {
/**
* select element of the array where regexp in the first element matches second
* parameter of this function
- *
- * @param list Array with regexps and return values
- * @param chosingMark String by which the element of array is to be matched
+ *
+ * @param list
+ * Array with regexps and return values
+ * @param chosingMark
+ * String by which the element of array is to be matched
* @return Object chosen element
*/
function filterByRegexp(list, chosingMark) {
@@ -290,14 +313,16 @@ function filterByRegexp(list, chosingMark) {
/**
* remove elements from the page based on their IDs
- *
- * @param doc Document object
- * @param target String/Array with ID(s)
- * @param remove Boolean indicating whether the node should be
- * actually removed or just hidden.
- * @return none
- * TODO remove parameter could be replaced by function which would
- * do actual activity.
+ *
+ * @param doc
+ * Document object
+ * @param target
+ * String/Array with ID(s)
+ * @param remove
+ * Boolean indicating whether the node should be actually removed or
+ * just hidden.
+ * @return none TODO remove parameter could be replaced by function which would
+ * do actual activity.
*/
function killNodes(doc, target, remove) {
target = target.trim();
@@ -315,8 +340,9 @@ function killNodes(doc, target, remove) {
/**
* Remove duplicate elements from array
- *
- * @param arr Array which needs to be cleaned up
+ *
+ * @param arr
+ * Array which needs to be cleaned up
* @return cleaned up array
*/
function removeDuplicates (arr) {
@@ -332,11 +358,8 @@ function removeDuplicates (arr) {
// ============================================
/**
- * object to pack messaging. Use as in
- self.postMessage(new Message("GetPassword", {
- login: login,
- hostname: location.hostname
- }));
+ * object to pack messaging. Use as in self.postMessage(new
+ * Message("GetPassword", { login: login, hostname: location.hostname }));
*/
function Message(cmd, data) {
this.cmd = cmd;
diff --git a/data/lib/viewSource.js b/data/lib/viewSource.js
index 25cba58..fd47cec 100644
--- a/data/lib/viewSource.js
+++ b/data/lib/viewSource.js
@@ -51,7 +51,7 @@ function viewAttachmentSource(doc) {
if (!table)
return;
var rows = table.querySelectorAll("tr");
- for (var i = 0; i < rows.length; ++i) {
+ for ( var i = 0; i < rows.length; ++i) {
var items = rows[i].querySelectorAll("td");
if (items.length != 3)
continue;
@@ -68,32 +68,36 @@ function viewAttachmentSource(doc) {
// Match mime type followed by ";" (charset) or ")" (no charset)
typeName = span.textContent.match(reAttachmentType)[1];
typeName = typeName.split(";")[0]; // ignore charset following type
- } catch (e) {}
- if (typeName == "application/java-archive" ||
- typeName == "application/x-jar") {
+ }
+ catch (e) {
+ }
+ if (typeName == "application/java-archive"
+ || typeName == "application/x-jar") {
// Due to the fix for bug 369814, only zip files with this special
// mime type can be used with the jar: protocol.
// http://hg.mozilla.org/mozilla-central/rev/be54f6bb9e1e
- addLink(items[2], "JAR Contents", "jar:" + attachHref + "!/");
- // https://bugzilla.mozilla.org/show_bug.cgi?id=369814#c5 has more possible mime types for zips?
- } else if (typeName == "application/zip" ||
- typeName == "application/x-zip-compressed" ||
- typeName == "application/x-xpinstall") {
- addLink(items[2], "Static ZIP Contents", "jar:" + attachHref + "!/");
- } else if (typeName != "text/plain" &&
- typeName != "patch" &&
- // Other types that Gecko displays like text/plain
- // http://mxr.mozilla.org/mozilla-central/source/parser/htmlparser/public/nsIParser.h
- typeName != "text/css" &&
- typeName != "text/javascript" &&
- typeName != "text/ecmascript" &&
- typeName != "application/javascript" &&
- typeName != "application/ecmascript" &&
- typeName != "application/x-javascript" &&
- // Binary image types for which the "source" is not useful
- typeName != "image/gif" &&
- typeName != "image/png" &&
- typeName != "image/jpeg") {
+ addLink(items[2], "JAR Contents", "jar:" + attachHref
+ + "!/");
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=369814#c5 has more
+ // possible mime types for zips?
+ }
+ else if (typeName == "application/zip"
+ || typeName == "application/x-zip-compressed"
+ || typeName == "application/x-xpinstall") {
+ addLink(items[2], "Static ZIP Contents", "jar:"
+ + attachHref + "!/");
+ }
+ else if (typeName != "text/plain" && typeName != "patch" &&
+ // Other types that Gecko displays like text/plain
+ // http://mxr.mozilla.org/mozilla-central/source/parser/htmlparser/public/nsIParser.h
+ typeName != "text/css" && typeName != "text/javascript"
+ && typeName != "text/ecmascript"
+ && typeName != "application/javascript"
+ && typeName != "application/ecmascript"
+ && typeName != "application/x-javascript" &&
+ // Binary image types for which the "source" is not useful
+ typeName != "image/gif" && typeName != "image/png"
+ && typeName != "image/jpeg") {
addLink(items[2], "Source", "view-source:" + attachHref);
}
}
diff --git a/data/lib/xorgBugCategories.js b/data/lib/xorgBugCategories.js
index c2c9c9b..3357ed7 100644
--- a/data/lib/xorgBugCategories.js
+++ b/data/lib/xorgBugCategories.js
@@ -4,25 +4,26 @@
/**
* Returns true if the bug is in a good shape
- *
- * @return Boolean if the bug is either not in the category
- * where we care about it (i.e., we don't have set up categories for
- * this component) or if it is in the concerned categories, then it has
- * a category recorded in the whiteboard input box.
- *
+ *
+ * @return Boolean if the bug is either not in the category where we care about
+ * it (i.e., we don't have set up categories for this component) or if
+ * it is in the concerned categories, then it has a category recorded in
+ * the whiteboard input box.
+ *
*/
function hasXorgBugsCategory() {
var catRE = /\s*\[cat:.*?\]\s*/; // RE for testing whether
// there is already category tag in the Whiteboard
- var isXOrgBug = filterByRegexp(constantData.
- xorgBugsCategories, getComponent());
- var whiteboardContent = document.
- getElementById("status_whiteboard").value;
+ var isXOrgBug = filterByRegexp(
+ constantData.xorgBugsCategories, getComponent());
+ var whiteboardContent = document
+ .getElementById("status_whiteboard").value;
if (isXOrgBug) { // is it XOR?
return catRE.test(whiteboardContent);
- } else {
+ }
+ else {
return true;
}
}
@@ -47,23 +48,24 @@ function makeBugCategoriesList(catList) {
// Fill-in <select> with <options>s for each category one
if (catList) {
- catList.forEach(function (cat) {
+ catList.forEach(function(cat) {
optionElement = document.createElement("option");
optionElement.value = cat;
- optionElement.setAttribute("id", "catId_" +
- cat.replace(" ","").toLowerCase());
+ optionElement.setAttribute("id", "catId_"
+ + cat.replace(" ", "").toLowerCase());
optionElement.appendChild(document.createTextNode(cat));
categoryList.appendChild(optionElement);
});
}
- categoryList.addEventListener("change", function (evt) {
+ categoryList.addEventListener("change", function(evt) {
var selectedCategory = "[cat:" + this.value + "]";
- var whiteboardElement = document.getElementById("status_whiteboard");
+ var whiteboardElement = document
+ .getElementById("status_whiteboard");
if (hasXorgBugsCategory()) {
- whiteboardElement.value = whiteboardElement.
- value.replace(catRE, "");
+ whiteboardElement.value = whiteboardElement.value.replace(
+ catRE, "");
}
addStuffToTextBox("status_whiteboard", selectedCategory);
}, false);