Greasy Fork

来自缓存

Greasy Fork is available in English.

Fogbugz Filter Person/只看某人

在Fogbug case页面增加下拉框,选择只看某个人的帖子。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name       Fogbugz Filter Person/只看某人
// @namespace  https://gqqnbig.me
// @version    0.1
// @description 在Fogbug case页面增加下拉框,选择只看某个人的帖子。
// @copyright  2016, Gqqnbig
// @run-at     document-end
// @require    https://code.jquery.com/jquery-2.2.3.min.js
// @include    http://www.fogcreek.com/fogbugz/ or your own sites
// ==/UserScript==
 
function createFilter()
{
    var persons = ["All"];
 
 
    $(".person").each(function ()
    {
        var name = $(this).text().trim();
        if (persons.indexOf(name) === -1)
            persons.push(name);
    });
 
    persons.sort();
 
    //console.log(persons);
 
    var $select = $("<select></select>");
    $select.change(function ()
    {
        var person = $(this).val();
        //alert(person);
        $(".bugevent").each(function ()
        {
            var result = $(this).find(".person").is(function ()
            {
                return person === "All" || $(this).text().trim() === person;
            });
            if (result)
                $(this).closest(".bugevent").css("display", "");//.show();
            else
                $(this).closest(".bugevent").css("display", "none");// hide();
        });
    });
 
    $select.css("visibility", "visible");
    $select.css("display", "inline");
 
    for (var i = 0; i < persons.length; i++)
    {
        $select.append($("<option>" + persons[i] + "</option>"));
    }
 
    var $li = $("<li/>");
 
    $li.append($select);
 
 
    $(".toolbar.buttons").prepend($li);
    //If there is more than one target element, however, cloned copies of the inserted element will be created for each target except for the last one.
    //That's why we cannot register change event later.
}
 
setTimeout(createFilter, 100);