HSTM link

Click TM button on HS to send to TM

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         HSTM link
// @namespace    saqfish
// @version      0.1
// @description  Click TM button on HS to send to TM
// @author       saqfish
// @match        https://www.mturk.com/mturk/findhits?*hit_scraper
// @require     http://code.jquery.com/jquery-3.1.0.min.js
// @grant        none
// ==/UserScript==

$('#resultsTable').on('DOMSubtreeModified', function(){ $(this).off(); e(this);});
var e = function tee(t){
    $(t).children('tbody').children('tr').each(function(){
        var cols = $(this).children('td');
        var hit = { req_col : cols.eq(0).children('div').eq(1), title_col : cols.eq(1), title_div : cols.eq(1).children('div').eq(0),pr_col : cols.eq(2),};
        var tm_butt=$('<button/>', {text: "TM",
                                    click: function(event){var box = $('<div/>', {id: "tmBox"})
                                    .append($('<input/>',{value:'1000', id: "delayValue", size: 20}))
                                    .append($('<button/>',{text:'Add', click:function(){sM({header: 'add_watcher',content: { id : hit.pr_col.children('a').attr('href').split('=')[1], duration: $('#delayValue').val(), type: 'hit', name: `${hit.req_col.text()} -${hit.title_div.next().text()}`, auto: true, alert: true, stopOnCatch : false },timestamp : true}); $(this).parent().remove();}}))
                                    .append($('<button/>',{text:'Close', click:function(){$(this).parent().remove();}}))
                                    .css({'adding-top': '5px', 'padding-bottom': '5px', 'padding-left': '5px', 'padding-right': '5px', 'background-color':'black', "position": "absolute","top": $(this).position().top,"left": $(this).position().left, "border" :" 3px solid green"});
                                                           $('body').append(box);},
                                   }).attr({type: "button", width: '33px',});
        hit.title_div.append(tm_butt);
    });
    $('#resultsTable').on('DOMSubtreeModified', function(){ $(this).off(); tee(this);});
};
function sM(message) {
    var header    = message.header;
    var content   = message.content || new Date().getTime();
    var timestamp = message.timestamp && new Date().getTime();
    localStorage.setItem('notifier_msg_' + header, JSON.stringify({ content: content, timestamp: timestamp}));

}