Bugzilla - reveal the Depends and Blocks bug titles

It reveals the the Depends and Blocks bug titles via a keyboard shortcut

当前为 2015-12-01 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Bugzilla - reveal the Depends and Blocks bug titles
// @namespace   darkred
// @description It reveals the the Depends and Blocks bug titles via a keyboard shortcut
// @include     https://bugzilla.mozilla.org/show_bug.cgi?id=*
// @version     1
// @grant       none
// @require     http://code.jquery.com/ui/1.11.4/jquery-ui.min.js
// @require     https://cdnjs.cloudflare.com/ajax/libs/keypress/2.1.3/keypress.min.js
// ==/UserScript==



var flag = 1;

var listener = new window.keypress.Listener();


listener.simple_combo('`', function() {
    console.log('You pressed `');
    if (flag === 1) {
        flag = 0;
        var depends = $('#dependson_input_area').siblings();
        var blocks = $('#blocked_input_area').siblings();
        var combined = [].concat(Array.prototype.slice.call(depends), Array.prototype.slice.call(blocks));

        for (var i = 0; i < combined.length; i++) {
            combined[i].innerHTML = '(' + combined[i].innerHTML + ')  ' + combined[i].title;
            combined[i].outerHTML += '<br/>';
        }

    } else {

        var regex = /^https:\/\/bugzilla\.mozilla\.org\/show_bug\.cgi\?id=(.*)$/;
        console.log('You pressed ~');

        var depends = $('#dependson_input_area').siblings();
        var blocks = $('#blocked_input_area').siblings();
        var combined = [].concat(Array.prototype.slice.call(depends), Array.prototype.slice.call(blocks));

        if (flag === 0) {
            flag = 1;
            for (var i = 0; i < combined.length; i += 2) {
                combined[i].innerHTML = combined[i].href.match(regex)[1];
            }

            for (var i = (combined.length) - 1; i => 0; i -= 2) {
                // if (typeof(combined[i]) !== 'undefined' ){
                combined[i].remove();
                // }
            }
        }
    }

});