Mturk Shite

Makes Money

2017-09-02 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Mturk Shite
// @namespace    https://greasyfork.org/users/144229
// @version      1.9
// @description  Makes Money
// @author       MasterNyborg
// @icon         http://i.imgur.com/wS1IQwd.jpg
// @include      *mturk.com*
// @include	     http://*.qualtrics.com/*
// @include	     https://*.qualtrics.com/*
// @include      https://*.*.qualtrics.com/*
// @include      http://*.*.qualtrics.com/*
// @include      http://*.surveygizmo.com/*
// @include      https://*.surveygizmo.com/*
// @include      https://docs.google.com/forms/*
// @include      https://*.surveymonkey.com/*
// @include      http://*.*.*.edu/*
// @include      https://*.*.*.edu/*
// @include      http://*.*.edu/*
// @include      https://*.*.edu/*
// @exclude      *worker.mturk.com/overwatch*
// @exclude      https://www.mturk.com/mturk/findhits?hit_scraper
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @match        https://*.mturk.com/mturk/preview*
// @match        https://*.mturk.com/mturk/accept*
// @match        https://*.mturk.com/mturk/continue*
// @match        https://*.mturk.com/mturk/submit*
// @match        https://*.mturk.com/mturk/return*
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @grant        GM_addStyle
// @grant        unsafeWindow
// ==/UserScript==

// Useful functions
function gmGet(name) {
    var theValue = GM_getValue(name);
    return theValue;
}
function gmSet(name, valuee) {
    GM_setValue(name, valuee);
}
function bigBub(pop) {
    var div = $('<div />', {
        html: '&shy;<style>' + pop + '</style>'
    } ).appendTo('body');
}
//HTML that needs to be moved before rendering the toolbar
$('a.top-stripe').hide();
var worker = `<input type="text" id="wiid" value=${GM_getValue('wid')}></input>`;
//Render toolbar and inputs
document.body.insertAdjacentHTML(
    `afterbegin`,
    `<div id="mtsb" style="background-color: lightblue;">` +
    `<label style="color: yellow; margin-left: 5px;">Nyborgs mTurk Shite </label>`+ worker +
    `<span style="margin-left: 3px;cursor:help" title="A compilation of scripts that increase the efficiency of the website and provides a better worker experience.">&#10068;</span>` +

    `<label style="cursor:help; color: black; float: right; margin-right: 10px;" title="PRE reloader will auto-refresh the page when mturk returns the error. ">PREloader:` +
    `<input style="cursor:pointer;" id="reload" type="checkbox" ${GM_getValue('reload') ? `checked` : ``}></input>` +
    `</label>` +

    `<label style="cursor:help; color: black; float: right; margin-right: 10px;"title="Auto-Expander will focus on the mturk HIT frame once a HIT is accepted. ">Auto-expander:` +
    `<input style="cursor:pointer;" id="expand" type="checkbox" ${GM_getValue('expand') ? `checked` : ``}></input>` +
    `</label>` +

    `<label style="cursor:help; color: black; float: right; margin-right: 10px;"title="Auto-check will automatically select 'Accept next HIT' when a HIT is accepted.">Accept-nexter:` +
    `<input style="cursor:pointer;" id="acn" type="checkbox" ${GM_getValue('acn') ? `checked` : ``}></input>` +
    `</label>` +

    `<label style="cursor:help; color: black; float: right; margin-right: 10px;"title="Makes radios and check boxes a bigger size on mturk/certain survey pages.">Big Bubbler:` +
    `<input style="cursor:pointer;" id="bbl" type="checkbox" ${GM_getValue('bbl') ? `checked` : ``}></input>` +
    `</label>` +

    `<label style="cursor:help; color: black; float: right; margin-right: 10px;"title="Hides some instruction panels and creates a toggle button.\nOnly works for certain HITs.">No instructions:` +
    `<input style="cursor:pointer;" id="tgi" type="checkbox" ${GM_getValue('tgi') ? `checked` : ``}></input>` +
    `</label>` +

    `<label style="color: black; float: right; margin-right: 10px;cursor:alias;"title="Click the white button to copy your worker ID to the clipboard.">Copy Worker ID: ` +
    `<input id="wid" style="cursor:alias;" type="button"></input>` +
    `</label>` +

    `</div>`
);
bigBub('div#mtsb {height: 1.7em;}');
bigBub('#wiid {width:0.3em}');
//Adds Queue link to dashboard
if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
    var theDiv = document.getElementById('subtabs');
    theDiv.innerHTML += '<span class="almostblack_text">&nbsp;|&nbsp;</span><a href="/mturk/myhits" class="subnavclass">HITs Queue</a>';
}
//Grabs worker ID from dashboard and adds functionality to button
workerID = GM_getValue("wid");
if(!workerID || workerID === "") {
    if (window.location.href == "https://www.mturk.com/mturk/dashboard") {
        workerIDNode = document.evaluate("//span[@class='orange_text_right']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
        for (i=0; i<workerIDNode.snapshotLength; i++) {
            nd = workerIDNode.snapshotItem(i);
            idstring = nd.innerHTML;
            workerID = idstring.split(': ')[1];
            GM_setValue("wid",workerID);
        }
    } else {
        workerID="";
        GM_setValue("wid","");
    }
} else {
    var copyTextareaBtn = document.querySelector('#wiid');
    $('#wid').click(function(event) {
        var copyTextarea = document.querySelector('#wiid');
        copyTextarea.select();
        try {
            var successful = document.execCommand('copy');
            var msg = successful ? 'successful' : 'unsuccessful';
            console.log('Copying text command was ' + msg);
        } catch (err) {
            console.log('Oops, unable to copy');
        }
    });
}
//Adds functionality to the checkboxes on the toolbar
const rel = document.getElementById('reload'); //PRE reloader
const exp = document.getElementById('expand'); //Auto expand
const che = document.getElementById('acn');    //Accept next checker
const bub = document.getElementById('bbl');    //Bigger bubbles
const tig = document.getElementById('tgi');    //toggle instructions
$('#reload').click(function(){
    if (rel.checked){
        gmSet('reload', 'checked');
    }else{
        gmSet('reload', '');
    }
});
$('#expand').click(function(){
    if (exp.checked){
        gmSet('expand', 'checked');
    }else{
        gmSet('expand', '');
    }
});
$('#acn').click(function(){
    if (che.checked){
        gmSet('acn', 'checked');
    }else{
        gmSet('acn', '');
    }
});
$('#bbl').click(function(){
    if (bub.checked){
        gmSet('bbl', 'checked');
    }else{
        gmSet('bbl', '');
    }
});
$('#tgi').click(function(){
    if (tig.checked){
        gmSet('tgi', 'checked');
    }else{
        gmSet('tgi', '');
    }
});
//PRE reloader code
if (rel.checked && $('.error_title:contains(You have exceeded the maximum allowed page request rate for this website.)').length || $('.error-page:contains(You have exceeded the allowable page request rate)').length) {
    setTimeout(window.location.reload.bind(window.location), 900); //some would say 1000 is a safer number here but I like to live fast
    return;
}
//Auto expand code
if (exp.checked) {
    var is_a_HIT = $('input[type="hidden"][name="isAccepted"]').length > 0;
    if (is_a_HIT === true){
        var captcha = $('input[name="userCaptchaResponse"]').length > 0;
        if (captcha === false){
            var workspace;
            var iframe = $('iframe')[0];
            var hit_wrapper = $('div[id="hit-wrapper"]')[0];
            if (iframe){
                iframe.style.minHeight = '100vh';
                $(window).load(function(){iframe.focus();});
                workspace = iframe;
            }
            else if (hit_wrapper){
                var hit_wrapper_ypos = hit_wrapper.getBoundingClientRect().top;
                var pad = hit_wrapper_ypos + window.innerHeight - document.documentElement.clientHeight;
                if (pad > 0){
                    $('form[name="hitForm"][method="POST"][action="/mturk/hitReview"]').parent().before('<div style="height: '+pad+'">');
                }
                workspace = hit_wrapper;
            }
            var isAccepted = $('input[type="hidden"][name="isAccepted"][value="true"]').length > 0;
            if (workspace && isAccepted === true){
                workspace.scrollIntoView();
            }
            else if (workspace && isAccepted === false){
                var timer = $('span[id="theTime"][class="title_orange_text"]')[0];
                timer.scrollIntoView();
            }
        }
    }
}
//Accept next checker code
if (che.checked ) {
    if ($('[name="autoAcceptEnabled"]').length ) {
        $('[name="autoAcceptEnabled"').prop('checked', true);
    }
    if ($('span.m-l-xs.detail-bar-value').length){
        $('span.m-l-xs.detail-bar-value').click();
    }
}
//Bigger bubbles and checkbox code
if (bub.checked){
    bigBub('div#mtsb {height: 2.5em;}');
    bigBub('input[type=radio] { width: 2.0em; height: 2.0em;}' );
    bigBub('input[type=checkbox] { width: 2.0em; height: 2.0em;}' );
}
//toggle instructions code
if(tig.checked$){
    ('.panel.panel-primary').hide().before('<div><button id="toggle" type="button">Show Instructions</button></div>');
    $('#toggle').click(function () {
        $(this).text($(this).text() === 'Show Instructions' ? 'Hide Instructions' : 'Show Instructions');
        $('.panel.panel-primary').toggle();
    });
}