MRX - Write the code shown in an image

Discussion in 'mTurk Scripts & Resources' started by rosesword975, Dec 4, 2016.

  1. rosesword975

    rosesword975 New Turker

    Messages:
    19
    Gender:
    Female
    Ratings:
    +11
    In honor of the new site I will post two of my scripts. One is for masters (another post) and this one is just a basic one that does not require masters.
    I know it ain't much, but it might help out some newbies.

    Code:
    
    // ==UserScript==
    // @name        @shared - MRX - Write the code shown in an image
    // @namespace   https://greasyfork.org/en/users/13132-rosesword975
    // @version     1
    // @author       rosesword975
    // @description puts cursor in box automatically and hides instructions
    // @grant       none
    // @include     https://www.mturkcontent.com/dynamic/*
    // @require     http://code.jquery.com/jquery-2.1.4.min.js
    // @require     https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
    // ==/UserScript==
    
    $(document).ready(function(){
      if($('body:contains(Transcribe the code contained in the image.)').length){
       
        // Creates button and hides instructions.
        $(".panel.panel-primary").before('<button id="toggle" type="button"><span>Show Instructions</span></button>');
        $(".panel.panel-primary").after('<br></br>');
        $(".panel.panel-primary").hide();
    
        // Toggles instructions and changes toggle text.
        $('#toggle').click(function() {
        $(".panel.panel-primary").toggle();
        $('#toggle').text() == 'Show Instructions' ? str = 'Hide Instructions' : str = 'Show Instructions';
        $('#toggle span').html(str);
        });
       
        $('input[name="Answer"]').focus();
       
      }
    });