Steve Sears

Added buttons that auto fill yes, no and n/a. Also makes instructions hidable.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Steve Sears
// @namespace    https://greasyfork.org/en/users/10782
// @version      0.3001
// @description  Added buttons that auto fill yes, no and n/a. Also makes instructions hidable.
// @author       tismyname
// @include      https://www.mturkcontent.com/dynamic/*
// @grant        none
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// ==/UserScript==

$(".panel-heading").before('<label><input type="checkbox" id="toggler">Show/Hide Instructions</input><br></label>')
$(".panel-heading").hide();
$(".panel-body").hide();

$('#toggler').click(function() {
    $(".panel-heading").toggle();
    $(".panel-body").toggle();
});    
               

var link = $('a[href]').attr('href');


// Grabs parent div to manipulate since it has no id
var $parentDiv1 = $('#marketing_company').parent();

$parentDiv1.prepend('<a href="' + link + '" target="_new">'+link+'</a> <br>');
//$parentDiv1.prepend('<button id="button">Show/Hide Instructions</button><br>');

// Radio buttons so you don't have to type
var radioList = [   '<label><input type="radio" name="marketing_company" value="Yes"> Yes</label>',
                    '<label><input type="radio" name="marketing_company" value="No"> No</label>',
                    '<label><input type="radio" name="marketing_company" value="N/A"> N/A</label>', 
                ].join('\n');
// append radio buttons                 
$parentDiv1.append(radioList);
 
var $parentDiv2 = $('#postalcode').parent();
$parentDiv2.append('<label><input type="radio" name="postalcode" value="N/A"> N/A</label>');                 
                 
var $parentDiv3 = $('#country').parent();
$parentDiv3.append('<label><input type="radio" name="country" value="N/A"> N/A</label>');  
                 
// auto fill input based on selection
$('input[type="radio"]').on('change', function() {
    var name = this.name;
    if(name == 'marketing_company')
        $('#marketing_company').val($(this).val());      
    else if(name == 'postalcode')
        $('#postalcode').val($(this).val());
    else                 
        $('#country').val($(this).val());
});