aboutsummaryrefslogtreecommitdiffstats
path: root/skip-process-bug.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2009-11-15 23:38:56 +0100
committerMatěj Cepl <mcepl@redhat.com>2009-11-15 23:38:56 +0100
commit6ff24e0517c8d1718df93784acd94688a7640be0 (patch)
treedbf29e64e7299ec1382f70490614f390b3c098a9 /skip-process-bug.js
parent16bc245ccedb4a6771bf98ebeed2d0b3ad4b38d2 (diff)
downloadbugzilla-triage-6ff24e0517c8d1718df93784acd94688a7640be0.tar.gz
Some progress on jetpackization
* bugzillaBugTriage.js -- some basic function works, no JSON yet * skip-process-bug.js -- skip over process pages.
Diffstat (limited to 'skip-process-bug.js')
-rw-r--r--skip-process-bug.js56
1 files changed, 41 insertions, 15 deletions
diff --git a/skip-process-bug.js b/skip-process-bug.js
index 3972893..045eb8d 100644
--- a/skip-process-bug.js
+++ b/skip-process-bug.js
@@ -1,16 +1,42 @@
-jetpack.tabs.onReady(function(doc){
- var root = 'https://bugzilla.mozilla.org/',
- pages = ['attachment', 'post_bug', 'process_bug'],
- paths = pages.map(function(p) root + p + '.cgi'),
- collision = 'Mid-air collision!';
- if (paths.some(function(p) doc.location == p) && doc.title != collision) {
- var $doc = $(doc),
- mail = $doc.find('#bugzilla-body > dl').text(),
- bug = $($doc.find('.bz_alias_short_desc_container > a'));
- /* Bail if we sense a disturbance. */
- if (bug.size() != 0) {
- jetpack.notifications.show({title: 'Mail sent for ' + bug.text(), body: mail});
- doc.location = root + bug.attr('href');
+jetpack.future.import("pageMods");
+
+var callback = function(document){
+ var stemURL = "https://HOSTNAME/show_bug.cgi?id=";
+ var titleStr = $("title",document).text();
+ var REArr = RegExp("[0-9]+").exec(titleStr);
+ var REHostname = RegExp("\/\/([^/]+)\/").exec(document.location.toString());
+ if (REArr) {
+ var bugNo = REArr[0];
+ var hostname = REHostname[1];
+ console.log("bugNo = " + bugNo + ", hostname = " + hostname);
+// jetpack.notifications.show('Bug ' + bugNo);
+ var emailsSent = $("#bugzilla-body > dl:first",document).text();
+ emailsSent = emailsSent.replace(/^(\s*)$/mg,"");
+ console.log(emailsSent); // to be sent to jetpack.notifications.show when available
+ document.location = stemURL.replace("HOSTNAME",hostname) + bugNo;
}
- }
-});
+};
+
+var options = {};
+options.matches = [
+ "https://bugzilla.redhat.com/process_bug.cgi",
+ "https://bugzilla.mozilla.org/post_bug.cgi",
+ ];
+jetpack.pageMods.add(callback, options);
+
+// "https://bugzilla.redhat.com/attachment.cgi",
+// http://code.google.com/chrome/extensions/match_patterns.html sucks, we don't have $
+
+// paths = pages.map(function(p) root + p + '.cgi'),
+// collision = 'Mid-air collision!';
+// if (paths.some(function(p) doc.location == p) && doc.title != collision) {
+// var $doc = $(doc),
+// mail = $doc.find('#bugzilla-body > dl').text(),
+// bug = $($doc.find('.bz_alias_short_desc_container > a'));
+// /* Bail if we sense a disturbance. */
+// if (bug.size() != 0) {
+// jetpack.notifications.show({title: 'Mail sent for ' + bug.text(), body: mail});
+// doc.location = root + bug.attr('href');
+// }
+// }
+//});