aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib/skip-bug.js
blob: 9fcb531c28c1543ec1ff7c24a4726cdb9bde0571 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
// "use strict";

function reloadPage() {
    var stemURL = 'https://HOSTNAME/show_bug.cgi?id=';
    var titleElems = document.getElementsByTagName('title');
    if (titleElems) {
        var REArr = new RegExp('[bB]ug\\s+([0-9]+)').
            exec(titleElems[0].textContent);
        var hostname = document.location.hostname;
        if (REArr) {
            console.log("Reloading bug " + REArr[1] + "!");
            document.location = stemURL.
                replace('HOSTNAME',hostname) + REArr[1];
        }
    }
}

reloadPage();