aboutsummaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-05-06 23:27:12 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:52:35 +0200
commit59d6e1bf4e439febbc40c15486303e12febb7e42 (patch)
treed0d6b29f8b3b66e501e51d81caa2f4a5504a5083 /data
parentd2518a3ab99afce2b2f33358cbb41778eaae0f7f (diff)
downloadbugzilla-triage-59d6e1bf4e439febbc40c15486303e12febb7e42.tar.gz
Make the script working with bugzilla.gnome.org
* Fix Config_gnome.json for new system of killNodes * Make the script more tolerable to non-RH configuration Fixes #75
Diffstat (limited to 'data')
-rw-r--r--data/lib/bugzillaDOMFunctions.js24
-rw-r--r--data/lib/bzpage.js7
-rw-r--r--data/tweaks/bug-page-mod.js6
3 files changed, 20 insertions, 17 deletions
diff --git a/data/lib/bugzillaDOMFunctions.js b/data/lib/bugzillaDOMFunctions.js
index 0f7e1e0..7d9bca5 100644
--- a/data/lib/bugzillaDOMFunctions.js
+++ b/data/lib/bugzillaDOMFunctions.js
@@ -348,26 +348,28 @@ function getCCList () {
function killNodes(doc, target, remove) {
var victimElements = [];
- target.forEach(function(x) {
- var targetNode = doc.querySelector(x);
- if (targetNode) {
- if (remove) {
- victimElements.push([x,targetNode]);
+ if (target.forEach) {
+ target.forEach(function(x) {
+ var targetNode = doc.querySelector(x);
+ if (targetNode) {
+ if (remove) {
+ victimElements.push([x,targetNode]);
+ }
+ else {
+ targetNode.style.display = "none";
+ }
}
- else {
- targetNode.style.display = "none";
- }
- }
- });
+ });
+ }
var elem = {};
// Don't run victimElements.forEach here as we are effectively
// removing its members.
for(var i = 0, ii = victimElements.length; i < ii; i++) {
elem = victimElements[i];
+ console.myDebug("Killing element " + elem[0]);
try {
elem[1].parentNode.removeChild(elem[1]);
-// elem[1].style.backgroundColor = "red";
}
catch (e if e instanceof TypeError) {
console.error("Cannot remove: " + elem[0]);
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js
index 7b8a764..e34f38d 100644
--- a/data/lib/bzpage.js
+++ b/data/lib/bzpage.js
@@ -314,13 +314,12 @@ function generateButtons (pkgs, kNodes) {
// constantData etc.
// are finally defined and available.
if (RHBZinit) {
- console.log("call RHBZinit!");
RHBZinit();
}
-// if (tweakBugzilla) {
-// tweakBugzilla(document, constantData);
-// }
+ if (tweakBugzilla) {
+ tweakBugzilla(document, constantData);
+ }
}
function setConfigurationButton () {
diff --git a/data/tweaks/bug-page-mod.js b/data/tweaks/bug-page-mod.js
index c2b529e..2c92aee 100644
--- a/data/tweaks/bug-page-mod.js
+++ b/data/tweaks/bug-page-mod.js
@@ -196,8 +196,10 @@ function tweakBugzilla(d, cData) {
var CheckinComment = new CheckinCommentCtor();
CheckinComment.initialize(d, AttachmentFlagHandler._interestingFlags);
- var XMLRPCUrl = cData.XMLRPCData[d.location.hostname].url;
- collectHistory(XMLRPCUrl);
+ if (d.location.hostname in cData.XMLRPCData) {
+ var XMLRPCUrl = cData.XMLRPCData[d.location.hostname].url;
+ collectHistory(XMLRPCUrl);
+ }
tbplbotSpamCollapser(d);
}