aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib
diff options
context:
space:
mode:
Diffstat (limited to 'data/lib')
-rw-r--r--data/lib/bugzillaDOMFunctions.js41
-rw-r--r--data/lib/bzpage.js53
-rw-r--r--data/lib/util.js3
3 files changed, 56 insertions, 41 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js
index 7d9bca5..6823bc1 100644
--- a/data/lib/bugzillaDOMFunctions.js
+++ b/data/lib/bugzillaDOMFunctions.js
@@ -265,6 +265,47 @@ function commentsWalker (fce) {
});
}
+
+/**
+ * Parse the row with the attachment
+ *
+ * @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
+ *
+ * TODO error handling is missing ... it's bleee
+ */
+function parseAttachmentLine(inElem) {
+ var MIMEtype = "";
+ var size = 0;
+
+ // Skip over obsolete attachments
+ if (inElem.getElementsByClassName("bz_obsolete").length > 0) {
+ return ([]);
+ }
+
+ // getting name of the attachment
+ var attName = inElem.getElementsByTagName("b")[0].textContent.trim();
+
+ // TODO probably could use url.URL object
+ var aHrefsArr = inElem.getElementsByTagName("a");
+ var aHref = Array.filter(aHrefsArr, function(x) {
+ return x.textContent.trim() === "Details";
+ })[0];
+ var id = parseURL(aHref.getAttribute("href")).params.id;
+
+ // getting MIME type and size
+ var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0].textContent.
+ replace(/[\n ()]+/g, " ").trim().split(", ");
+ size = parseInt(stringArray[0], 10);
+ MIMEtype = stringArray[1].split(" ")[0];
+
+ return [ attName, id, MIMEtype, size, inElem ];
+}
+
+
/**
* collect the list of attachments in a structured format
*
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js
index e34f38d..35f993c 100644
--- a/data/lib/bzpage.js
+++ b/data/lib/bzpage.js
@@ -36,6 +36,7 @@ self.on('message', function onMessage(msg) {
equivalentComponents = ("equivalentComponents" in constantData) ?
constantData.equivalentComponents : null;
generateButtons(msg.data.instPkgs, msg.data.kNodes);
+ completeInit();
break;
case "Error":
alert("Error " + msg.data);
@@ -310,16 +311,6 @@ function generateButtons (pkgs, kNodes) {
}
}
}
- // TODO This is weird in this place, but that's the place where all
- // constantData etc.
- // are finally defined and available.
- if (RHBZinit) {
- RHBZinit();
- }
-
- if (tweakBugzilla) {
- tweakBugzilla(document, constantData);
- }
}
function setConfigurationButton () {
@@ -360,45 +351,25 @@ function getOptionTableCell(tableId, label) {
return null;
}
+
/**
- * Parse the row with the attachment
- *
- * @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
+ * Complete startup, mainly run alternate inits for non-standard BZ
+ * with proper arguments
*
- * TODO error handling is missing ... it's bleee
*/
-function parseAttachmentLine(inElem) {
- var MIMEtype = "";
- var size = 0;
+function completeInit() {
+ var attachments = getAttachments();
- // Skip over obsolete attachments
- if (inElem.getElementsByClassName("bz_obsolete").length > 0) {
- return ([]);
+ if (RHBZinit) {
+ RHBZinit(attachments);
}
- // getting name of the attachment
- var attName = inElem.getElementsByTagName("b")[0].textContent.trim();
-
- // TODO probably could use url.URL object
- var aHrefsArr = inElem.getElementsByTagName("a");
- var aHref = Array.filter(aHrefsArr, function(x) {
- return x.textContent.trim() === "Details";
- })[0];
- var id = parseURL(aHref.getAttribute("href")).params.id;
-
- // getting MIME type and size
- var stringArray = inElem.getElementsByClassName("bz_attach_extra_info")[0].textContent.
- replace(/[\n ()]+/g, " ").trim().split(", ");
- size = parseInt(stringArray[0], 10);
- MIMEtype = stringArray[1].split(" ")[0];
-
- return [ attName, id, MIMEtype, size, inElem ];
+ if (tweakBugzilla) {
+ tweakBugzilla(attachments, constantData);
+ }
}
+
function startup() {
// First, preflight check ... if we are not logged in, there
// is nothing we can do.
diff --git a/data/lib/util.js b/data/lib/util.js
index 11cf3bc..1c3e607 100644
--- a/data/lib/util.js
+++ b/data/lib/util.js
@@ -160,6 +160,9 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac
else if (before === "dash") {
locParent.insertBefore(document.createTextNode("\u00A0-\u00A0"), newAElem);
}
+ else if (before === "pipe") {
+ locParent.insertBefore(document.createTextNode("\u00A0|\u00A0"), newAElem);
+ }
else if (before === "parens") {
locParent.appendChild(document.createTextNode(")"));
locParent.insertBefore(document.createTextNode("("), newAElem);