~thekorn/launchpad-gm-scripts/show_patches

« back to all changes in this revision

Viewing changes to lp_workflowreports.user.js

  • Committer: Kees Cook
  • Date: 2008-05-06 23:48:23 UTC
  • mfrom: (16.1.4 ubuntu-gm-scripts)
  • Revision ID: kees@outflux.net-20080506234823-yqlwfg2g89blaus9
merge lp_workflow.user.js from bdmurray

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ==UserScript==
 
2
// @name           LP_Workflow
 
3
// @namespace      http://murraytwins.com/greasemonkey/
 
4
// @description    (Launchpad) Identify workflow reports
 
5
// @include        https://*.launchpad.net/*
 
6
// @include        https://*.edge.launchpad.net/*
 
7
// @include        https://launchpad.net/*
 
8
// @date           2008-05-05
 
9
// @creator        Brian Murray <brian@ubuntu.com>
 
10
// ==/UserScript==
 
11
 
 
12
 
 
13
(function() {
 
14
 
 
15
// List of special teams whose bugs shouldn't be meddled with
 
16
var special_subscribers = {
 
17
    'ubuntu-archive':'<br>This is a workflow report',
 
18
    'ubuntu-release':'<br>This is a workflow report',
 
19
    'ubuntu-universe-sponsors':'<br>This is a workflow report',
 
20
    'ubuntu-main-sponsors':'<br>This is a workflow report',
 
21
    'motu-release':'<br>This is a workflow report',
 
22
    'ubuntu-mir':'<br>This is a workflow report'
 
23
}
 
24
// ------- End of User settable data -------
 
25
 
 
26
function xpath(query, context) {
 
27
//    GM_log('xpath running');
 
28
    context = context ? context : document;
 
29
    return document.evaluate(query, context, null,
 
30
                            XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
 
31
}
 
32
 
 
33
window.addEventListener("load", function(e) {
 
34
 
 
35
    var debug = 0
 
36
 
 
37
    var bug_heading = xpath("//div[contains(@style,'float: left;')]").snapshotItem(0);
 
38
   
 
39
    var current_subscribers = xpath("//div[contains(@id,'portlet-subscribers')]//ul[contains(@class,'person')]/li/a")
 
40
    for ( var i = 0; i < current_subscribers.snapshotLength; i++ ) {
 
41
        var node = current_subscribers.snapshotItem(i);
 
42
        var link = "" + node;
 
43
        var person = link.substr(link.lastIndexOf("~")+1);  
 
44
        if (debug) {
 
45
            GM_log( "subscribers " + person );
 
46
        } 
 
47
 
 
48
        if ( person in special_subscribers ) {
 
49
            if (debug) {
 
50
                GM_log( "Special subscriber is " + person );
 
51
            }
 
52
            
 
53
            var special_K = document.createElement("h1");
 
54
            special_K.sytle = "clear: left;";
 
55
            special_K.innerHTML = special_subscribers[person];
 
56
            bug_heading.parentNode.insertBefore(special_K, bug_heading.nextSibling); 
 
57
        }
 
58
    }
 
59
 
 
60
  }, false);
 
61
})();