// ==UserScript==
// @name Worker Queue Elegant Return
// @namespace https://turkerview.com/mturk-scripts/
// @version 0.1
// @description Fix a few pain points w/ worker queue until someone more motivated comes along and truly fixes it.
// @author ChrisTurk
// @match https://worker.mturk.com/tasks
// @grant GM_log
// @require https://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
$(document).ready(function(){
//handle the returning of hits so worker doesn't
$('body').on('click', 'button:contains(Return)', function(e){
e.preventDefault();
let form = $(this).closest('form');
let postTo = 'https://worker.mturk.com' + form.attr('action');
// do NOT remove the li from the DOM.. it'll throw endless react errors lol. Just hide it.
$.post(postTo, form.serialize()).done(function(){
console.log('done');
form.closest('li.table-row').hide();
}).fail(function(){
console.log('fail');
form.closest('li.table-row').hide();
});
});
});