HITs Accepted/HIT Scrapper Link on Dashboard

Shows the number of hits you have accepted and also a link to HIT scraper.

当前为 2014-10-15 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         HITs Accepted/HIT Scrapper Link on Dashboard
// @namespace    http://ericfraze.com
// @version      0.1
// @description  Shows the number of hits you have accepted and also a link to HIT scraper.
// @author       Eric Fraze
// @match        https://www.mturk.com/mturk/*
// @grant        none
// ==/UserScript==

var hitsAssigned = "N/A (there was an error or something, contact Magnilucent if it happens a lot)";
url = window.location.href;
if ( url.indexOf("dashboard") !== -1 ) {
    $.ajax({
        url: "https://www.mturk.com/mturk/myhits",
        dataType: "html",
        success: function(data) {
            if ( $("td:contains('There are currently no HITs assigned to you.')", data).length ) {
                hitsAssigned = 0;
            }else{
                var text = $("td.title_orange_text[style='white-space: nowrap; padding-top: 1ex;']", data).text();
                var regstring = /(\d{1,2})(\sResults)/;
                var reg = new RegExp(regstring);
                var groups = reg.exec(text);
                
                
                hitsAssigned = groups[1];
            }
        }
    });
}

$(document).ready(function() {
    if ( $("td:contains('Your HIT Status')").length ) {
        $("#subtabs a:contains('Introduction')").attr("href", "https://www.mturk.com/mturk/findhits?match=true?hit_scraper");
    	$("#subtabs a:contains('Introduction')").text("HIT Scraper");
    	$("td:contains('Your HIT Status')").parents("table").find(".container-content").prepend('<table class="metrics-table" width="100%"><tbody><tr class="metrics-table-header-row"><th class="metrics-table-first-header">HITs Assigned to You</th></tr><tr class="even"><td class="metrics-table-first-value">' + hitsAssigned + '</td></tr></tbody></table>');
    }else{
       $("#subtabs").prepend("<a class='subnavclass' href='https://www.mturk.com/mturk/findhits?match=true?hit_scraper'>HIT Scraper</a><span class='almostblack_text'>&nbsp;|&nbsp;</span>"); 
    }
});