Quick and dirty job counter

Counts up the table rows in the work history dashboard

当前为 2015-10-22 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Quick and dirty job counter
// @namespace    mobiusevalon.tibbius.com
// @version      0.1
// @description  Counts up the table rows in the work history dashboard
// @author       Mobius Evalon
// @include      /^https{0,1}:\/\/work\.crowdsurfwork\.com\/reports\/work_data\/worker.*$/
// @grant        none
// ==/UserScript==

function counter()
{
    var counter = document.createElement("span");
    var script = document.createElement("script");
    var head = document.getElementsByTagName("head")[0];

    script.type = "text/javascript";
    script.innerHTML = "function count() {"+
        "var table = document.getElementsByTagName('table')[0];"+
        "if(table !== undefined) {"+
        "var tbody = table.getElementsByTagName('tbody')[0];"+
        "if(tbody !== undefined) this.innerHTML = 'Job count: '+tbody.getElementsByTagName('tr').length+' (click to refresh)'; }}";
    head.appendChild(script);

    counter.style.paddingLeft = "10px;"
    counter.innerHTML = "Job count: 0 (click to refresh)";
    if(counter.addEventListener) counter.addEventListener("click",count,false);
    else if(counter.attachEvent) counter.attachEvent("onclick",count);
    return counter;
}

var date_filter = document.getElementById("date_filter");
if(date_filter !== undefined && date_filter.tagName == "SELECT") date_filter.parentNode.appendChild(counter());