aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2012-04-11 01:03:00 +0200
committerMatěj Cepl <mcepl@redhat.com>2012-04-11 01:03:00 +0200
commitba9bd8b38bb04421dbc4fa045b02a6f320d817d6 (patch)
tree8e9af1d43b81796c154fe6e15fc48721d9d16e42
parent0f33ced7ef3e2729c5e31733990dd7c60e0720ad (diff)
downloadbugzilla-triage-ba9bd8b38bb04421dbc4fa045b02a6f320d817d6.tar.gz
Attempts to make the script work on bugs.eclipse.org.
-rw-r--r--data/lib/bugzillaDOMFunctions.js25
-rw-r--r--data/lib/util.js1
-rw-r--r--data/rhlib/rhbzpage.js13
-rw-r--r--lib/main.js7
4 files changed, 30 insertions, 16 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js
index aedf131..5c9423e 100644
--- a/data/lib/bugzillaDOMFunctions.js
+++ b/data/lib/bugzillaDOMFunctions.js
@@ -187,8 +187,9 @@ function getOptionTableCell(tableId, label) {
* @return none
*/
function createNewButton (location, after, cmdObj) {
+ var newId = "";
try {
- var newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn";
+ newId = cmdObj.name.toLowerCase().replace(/[^a-z0-9]+/,"","g") + "_btn";
} catch (e) {
console.error("createNewButton : e = " + e +
"\ncreateNewButton : cmdObj.toSource() = " +
@@ -355,7 +356,21 @@ function getAttachments () {
* @return String with the login name of the currently logged-in user
*/
function getLogin () {
- var lastLIElement = document.querySelector("#header ul.links li:last-of-type");
+ var lastElemArr = "";
+ var LIElementsArr = document.querySelectorAll("#header ul.links li");
+ // This should never be null
+ console.log("LIElementsArr = " + LIElementsArr);
+ if (LIElementsArr.length > 0) {
+ lastElemArr = Array.filter(LIElementsArr, function(el) {
+ console.log("el = " + el.toSource());
+ return (el.textContent.indexOf("Log") !== -1);
+ });
+ }
+ console.log("lastElemArr = " + lastElemArr.toSource());
+ var lastLIElement = "";
+ if (lastElemArr) {
+ lastLIElement = lastElemArr.pop();
+ }
var loginArr = lastLIElement.textContent.split("\n");
var loginStr = loginArr[loginArr.length - 1].trim();
return loginStr;
@@ -439,8 +454,8 @@ function killNodes(doc, target, remove) {
}
catch (e if e instanceof TypeError) {
console.error("Cannot remove: " + elem[0]);
- }
- }
+ };
+ };
}
/**
@@ -489,7 +504,7 @@ function getBugzillaName(URLhostname, bzLabelNames) {
function parseBZCommentDate(dateString) {
var tZone = {
"EDT": 4,
- "EST": 5
+ "EST": 5,
};
var dateArr = dateString.trim().split(/\s+/);
diff --git a/data/lib/util.js b/data/lib/util.js
index 2782f0c..5b2372e 100644
--- a/data/lib/util.js
+++ b/data/lib/util.js
@@ -4,7 +4,6 @@
// http://www.opensource.org/licenses/mit-license.php
"use strict";
// ==============================================================
-
/**
* parse URL to get its parts.
*
diff --git a/data/rhlib/rhbzpage.js b/data/rhlib/rhbzpage.js
index eb10238..f8c7ca7 100644
--- a/data/rhlib/rhbzpage.js
+++ b/data/rhlib/rhbzpage.js
@@ -489,8 +489,11 @@ function RHBZinit(things) {
}, false);
// Uncheck "set default assignee" when the assignee is changed by other means
- document.getElementById("assigned_to").addEventListener("change",
- function() {
- changeAssignee(null);
- }, false);
-}
+ var assAnchor = document.getElementById("assigned_to");
+ if (assAnchor) {
+ assAnchor.addEventListener("change",
+ function() {
+ changeAssignee(null);
+ }, false);
+ };
+};
diff --git a/lib/main.js b/lib/main.js
index 7b475a5..2c99185 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -115,8 +115,7 @@ var contentScriptLibraries = [
];
libbz.initialize(function(config) {
- console.log("config.configData.bugPageMatch = " +
- config.configData.bugPageMatch);
+ console.log("config.configData.bugPageMatch = " + config.configData.bugPageMatch);
pageMod.PageMod({
include : config.configData.bugPageMatch,
contentScriptWhen : 'ready',
@@ -135,8 +134,6 @@ libbz.initialize(function(config) {
}
});
- console.log("config.configData.skipMatch = " +
- config.configData.skipMatch);
pageMod.PageMod({
include : config.configData.skipMatch,
contentScriptWhen : 'ready',
@@ -167,4 +164,4 @@ contextMenu.Item({
require("clipboard").set(comment);
}
});
-//tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=710548");
+tabs.open("https://bugs.eclipse.org/bugs/show_bug.cgi?id=304933");