Greasy Fork

Greasy Fork is available in English.

Mturk Compare Image MMSP

Allow Selection of right or left image with "a" and "d" keys, as well as autoclick "submit" after last picture is chosen.

目前为 2020-09-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         Mturk Compare Image MMSP
// @namespace    https://github.com/rrockwel
// @version      0.2
// @description  Allow Selection of right or left image with "a" and "d" keys, as well as autoclick "submit" after last picture is chosen.
// @author       Richard Rockwell
// @match        https://worker.mturk.com/projects/30L3LKLDIOU8DWS8TAS8WR6UX4NSKX/tasks/*
// @include      https://www.mturkcontent.com/dynamic/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @contributionURL  https://www.paypal.com/cgi-bin/webscr?cmd=_donations&[email protected]&item_name=Greasy+Fork+donation
// ==/UserScript==


let $ = window.jQuery;

document.addEventListener('keypress', keyDetect);

// Detect Keypress
function keyDetect(e){
    if(e.which===97){
        console.log('a clicked');
      let left = document.querySelector('.leftBtn');
        console.log(left);
      left.click();
        console.log('left clicked');
    }
    if(e.which===100){
      let right = document.querySelector('.rightBtn');
      right.click();
    }

    // Autosubmit If Submit Button Exists
    let submit = document.querySelector('input[type=submit]');
    if(submit){
      submit.click();
    }
}