Greasy Fork

Greasy Fork is available in English.

Trello - 显示我的

trello显示我的

当前为 2016-12-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         Trello - show my card
// @name:zh-CN   Trello - 显示我的
// @namespace    null
// @homepageurl  null
// @version      1.1.1
// @description  trello show my card
// @description:zh-CN trello显示我的
// @author       will
// @match        http*://*trello.com/b/*
// @grant        none
// ==/UserScript==

var addShowMyCardBtn = function(){
    var flag = $('#showMyCard20161219').html();
    if(!flag){
        var showMyCard = $('<a class="board-header-btn board-header-btn-org-name board-header-btn-without-icon"><span class="board-header-btn-text" id="showMyCard20161219">显示我的</span></a>');
        $('div.board-header').append(showMyCard); // 添加按钮
        showMyCard.click(function(){
            var name = $('span.js-member-name').html();
            $('div.list-card').each(function(){
                var img = $(this).find("img[alt^='"+name+"']");
                var alt = img.attr('alt');
                if(alt === undefined){
                   //console.log(img.attr('alt'));
                   $(this).hide();
                }
            });
        });
    }
};
var addShowAllCardBtn = function(){
    var flag = $('#showAllCard20161219').html();
    if(!flag){
        var showAllCard = $('<a class="board-header-btn board-header-btn-org-name board-header-btn-without-icon"><span class="board-header-btn-text" id="showAllCard20161219">显示所有</span></a>');
        $('div.board-header').append(showAllCard); // 添加按钮
        showAllCard.click(function(){
            $('div.list-card').each(function(){
                $(this).show();
            });
        });
    }
};

var init = function() {
    setInterval(function(){
        addShowMyCardBtn();
        addShowAllCardBtn();
    },1000);
};

$(function(){
    init();
});