Greasy Fork

Greasy Fork is available in English.

禅道看板

禅道看板自动展开

当前为 2018-06-19 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         禅道看板
// @description  禅道看板自动展开
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  try to take over the world!
// @author       gccd
// @match        http://cd.midea.com/pms/*
// @match        https://cd.midea.com/pms/*
// @grant        none
// @icon         http://www.meicloud.com/favicon.ico
// @copyright    2018+, @MeiCloud
// ==/UserScript==

(function() {
    'use strict';
    //显示指派人员
    $("input[name^='dates']").each(function(){
        $(this).attr('autocomplete',"off");
    })

    //加入搜索
    if(document.location.href.indexOf("kanban") != -1){
        $(".board-footer").show();
        function filter(keyword){
            //粒度到 pbi
            $("tr").each(function(i){
                if(keyword == null || keyword.length == 0){
                    $(this).show();
                }else{
                    var smalls = $(this).find("small");
                    var match = false;
                    for(var j =0;j<smalls.size();j++){
                        //console.log("small:"+$(smalls[j]).html()+","+keyword);
                        if($(smalls[j]).html().indexOf(keyword) != -1){
                            match = true;
                        }
                    }
                    if(match){
                        $(this).show();
                    }else{
                        $(this).hide();
                    }
                }
            })
            //粒度到任务
            $(".board-task").each(function(i){
                if(keyword == null || keyword.length == 0){
                    $(this).show();
                }else{
                    if($(this).find("small").last().html().indexOf(keyword) != -1){
                        $(this).show();
                    }else{
                        $(this).hide();
                    }
                }

            })
        }
        var newElement = $('<input id="filter" type="text" placeholder="张三"/>');
        newElement.css({
            position: 'fixed',
            top: 270,
            right: 50,
            width: 100
        })
        $("#kanban").append(newElement);
        newElement.on('input onpropertychange',function(e){
            var keyword = $(this).val();
            if(keyword == null || keyword.length == 0){
                filter(keyword);
                return;
            }
            var reg = /^[\u4E00-\u9FA5]+$/
            // var reg = /.*[\u4e00-\u9fa5]+.*$/
            if(reg.test(keyword)) {
                filter(keyword);
            }
        });
    }


    // Your code here...
})();