HSTM link

Click TM button on HS to send to TM

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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}));

}