Mturk Worker Userscripts

Discussion in 'mTurk Scripts & Resources' started by Kadauchi, Oct 22, 2017.

  1. Totally Not Salem

    Totally Not Salem Survey Slinger

    Messages:
    5,664
    Gender:
    Male
    Ratings:
    +5,034
    Works in the current stable versions of Chrome and Firefox on W10 for me.

    I have it appended to the end of your original script like so:

    PHP:
    // ==UserScript==
    // @name        MakeTitlesFit
    // @namespace   https://greasyfork.org/en/users/6503-turk05022014
    // @version     1.0.20180114
    // @description    Makes it so the title isn't truncated in the Title column.
    //              In addition to making titles fit, it will also help make requester names fit.
    //              Really long requester names won't look correct.
    //              This may break scripts.
    //              Use at your own risk.
    //              I won't be held liable; you've been warned.
    //              Has a 1500 millisecond delay to help mitigate interference with scripts.
    // @match       https://worker.mturk.com/?filters*
    // @match       https://worker.mturk.com/projects?*
    // @match       https://worker.mturk.com/projects
    // @match       https://worker.mturk.com/projects/
    // @match       https://worker.mturk.com/projects/?filters*
    // @match       https://worker.mturk.com/projects/?page_size=*
    // @match       https://worker.mturk.com/requesters/*
    // @match       https://worker.mturk.com/?*
    // @match       https://worker.mturk.com/
    // @require     http://code.jquery.com/jquery-latest.min.js
    // @grant       none
    // ==/UserScript==

    this.$ = this.jQuery jQuery.noConflict(true);
    $().
    ready(function() {
        
    window.setTimeout(function () {
            $(
    "span.requester-column.text-truncate").each(function(index) {
                $(
    this).find("a.hidden-sm-down").wrap('<div style="float:left;height:25px;"></div>');
            });
            $(
    'span.project-name-column.text-truncate, span.requester-column.text-truncate').each(function(index) {
                var 
    el = $(this).get(0);
                var 
    link = $(this).find("a");
                $(
    this).css('white-space''normal');
                if ($(
    this).parent().height() < el.clientHeight) {
                    $(
    this).parent().height(el.clientHeight);
                }
            });
        }, 
    1500);
        
    //Will wait 1500 milliseconds before activating to help prevent script conflicts.
    });

    window.addEventListener("resize"=> {
        
    let allTitles document.querySelectorAll("span.project-name-column.text-truncate, span.requester-column.text-truncate");
        for(
    let title of allTitles) {
            if(
    title.parentElement.clientHeight title.clientHeight) {
                
    title.parentElement.style.height = `${title.clientHeight}px`;
            }
        }
    });
     
  2. Turker2013

    Turker2013 New Turker

    Messages:
    23
    Ratings:
    +5
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
    I test this on FireFox v24. The person who coded that MakeTitlesFit script is going to help me later on figure out a workaround.
    I've been trying to test the scripts on FireFox v24, FireFox v51 (greasemonkey and violentmonkey), and Chrome 49. Although, I really should be testing on more than just that, but that is what I have set up for the moment.
     
  3. Totally Not Salem

    Totally Not Salem Survey Slinger

    Messages:
    5,664
    Gender:
    Male
    Ratings:
    +5,034
    Is there some sort of reason you can't use up-to-date browsers?

    Chrome's current stable version is 63, and Firefox is on 59.

    It could be tweaked to work on older browsers, but it begs the question of why a newer browser can't just be used. Are you using a public computer that has its configuration frozen or something?
     
  4. Turker2013

    Turker2013 New Turker

    Messages:
    23
    Ratings:
    +5
    There are some turkers who use lower versions of browsers. Chrome 49 is the highest for XP users. I think either FireFox 51 or 52 is the highest for XP users. I think FireFox 31 ESR is when the Chromification began, hence FireFox 24 ESR.

    Also, thank you for that snippet. It might help in an unreleased script that I use. Unreleased because I need the original author's permission before uploading it to my greasyfork account.
     
    Last edited: Jan 19, 2018
  5. Totally Not Salem

    Totally Not Salem Survey Slinger

    Messages:
    5,664
    Gender:
    Male
    Ratings:
    +5,034
    XP was released in 2001. A kid born in the year XP was released would be graduating high school right now.
    Between Vista, 7, 8, and 10, we've had 4 widely-spaced major releases since XP.
    "You can't please everyone" is a major life philosophy of mine, and "you shouldn't try to support everyone" is a convenient extension of that.

    Alright, with all of that said, this should work to dynamically resize the elements on any browser where the static resize was successful.

    But I feel dirty fixing the code, because I'd rather not encourage people to use outdated browsers.

    PHP:
    // ==UserScript==
    // @name        MakeTitlesFit
    // @namespace   https://greasyfork.org/en/users/6503-turk05022014
    // @version     1.0.20180114
    // @description    Makes it so the title isn't truncated in the Title column.
    //              In addition to making titles fit, it will also help make requester names fit.
    //              Really long requester names won't look correct.
    //              This may break scripts.
    //              Use at your own risk.
    //              I won't be held liable; you've been warned.
    //              Has a 1500 millisecond delay to help mitigate interference with scripts.
    // @match       https://worker.mturk.com/?filters*
    // @match       https://worker.mturk.com/projects?*
    // @match       https://worker.mturk.com/projects
    // @match       https://worker.mturk.com/projects/
    // @match       https://worker.mturk.com/projects/?filters*
    // @match       https://worker.mturk.com/projects/?page_size=*
    // @match       https://worker.mturk.com/requesters/*
    // @match       https://worker.mturk.com/?*
    // @match       https://worker.mturk.com/
    // @require     http://code.jquery.com/jquery-latest.min.js
    // @grant       none
    // ==/UserScript==

    this.$ = this.jQuery jQuery.noConflict(true);

    function 
    resizeOffendingRowHeights() {
        $(
    'span.project-name-column.text-truncate, span.requester-column.text-truncate').each(function(index) {
            var 
    el = $(this).get(0);
            var 
    link = $(this).find("a");
            $(
    this).css('white-space''normal');
            if ($(
    this).parent().height() < el.clientHeight) {
                $(
    this).parent().height(el.clientHeight);
            }
        });
    }

    $().
    ready(function() {
        
    window.setTimeout(function () {
            $(
    "span.requester-column.text-truncate").each(function(index) {
                $(
    this).find("a.hidden-sm-down").wrap('<div style="float:left;height:25px;"></div>');
            });
            
    resizeOffendingRowHeights();
        }, 
    0);
        
    //Will wait 1500 milliseconds before activating to help prevent script conflicts.
    });

    window.addEventListener("resize", function(e) {
        
    resizeOffendingRowHeights();
    });
     
  6. Turker2013

    Turker2013 New Turker

    Messages:
    23
    Ratings:
    +5
    Resize window to make it smaller. Refresh page. Text overlaps. Maximize and unmaximize it. Text is no longer overlapping. Anyway, it is an improvement so far.

    On an unrelated note, is MTG unsafe to visit? I put it through virustotal.com and the Emsisoft engine came up with Phishing. Maybe it's a false positive.
     
    Last edited: Jan 19, 2018
  7. Totally Not Salem

    Totally Not Salem Survey Slinger

    Messages:
    5,664
    Gender:
    Male
    Ratings:
    +5,034
    Turker2013, your name checks out lol.

    MTG is long-dead.

    I've turked my way to Masters, and MTG was dead even before I even started working on the platform.
     
    • LOL LOL x 1
  8. Turker2013

    Turker2013 New Turker

    Messages:
    23
    Ratings:
    +5
    Does anyone actually want mmmturkeybacon floating timers fixed? There's already some scripts that put the timer in the titlebar, although that counts down, not up.

    I do have a modified version of Color coded search with checkpoint that I'm using, but I need mmmturkeybacon's permission before uploading it. Either that, or rebuild the script so it doesn't use the same code.
    I've noticed TO1 fails quite often during the morning hours. Cache can certainly help, so that's been added. Cache expires after 30 days. Other than turkopticon.ucsd.edu and mturk-api.istrack.in, are there any mirrors I'm missing?
     
  9. TurkTiger

    TurkTiger New Turker

    Messages:
    22
    Gender:
    Male
    Ratings:
    +20
  10. Kadauchi

    Kadauchi Administrator Former MTG MotM

    Messages:
    4,367
    Ratings:
    +8,589
    floating timers has been mentioned a few times to me and suggested + shot down to be included into MTS.

    Just give authorship credit to MTB, you're being overly worried about it. Hell, I've only ever explicitly given permission for HIT Forker, everything else would be the same thing as you fixing/upgrading the original.

    As in won't check for that requester again for 30 days or something else?

    HIT Tracker which is part of MTS and acts similarly to how HITDB did. Nothing else and nothing close to that.
     
    • Today I Learned Today I Learned x 1
  11. TurkTiger

    TurkTiger New Turker

    Messages:
    22
    Gender:
    Male
    Ratings:
    +20
    Ok, thanks i'll start using that then.
     
  12. Turker2013

    Turker2013 New Turker

    Messages:
    23
    Ratings:
    +5
    When mmmturkeybacon Color Coded Search with Checkpoints loads reviews from turkopticon, it will cache them for 30 days. If the 5000 timeout is triggered, it will load the cached reviews instead of resulting in a plain page. This is an issue during the morning hours when TO1 tends to fail regularly. Stuff cached locally expires after 30 days because at that point, it may be too old to use anyway.

    How would floating timers work? Would it be having the current timer counting up, but hovering in view on the page at all times?
     
  13. Kadauchi

    Kadauchi Administrator Former MTG MotM

    Messages:
    4,367
    Ratings:
    +8,589
    Take a look at how MTS handles cache, you don't want to be sending a request to the shitty TO servers every page load, especially during the day.

    You wouldn't really need to change how it functions, just where it gets the info from, not even having to touch where it appends.
     
  14. Turker2013

    Turker2013 New Turker

    Messages:
    23
    Ratings:
    +5
    I brought that up to the person who modified the script for me. I think it now uses a cache after the five second timeout. The cache will be valid for 30 days.

    I don't want to rely on the cache 100% of the time as it can become outdated. Although, maybe I can factor in how many reviews a HIT has. Something with over 100 reviews would probably be okay, whereas something with a handful could quickly change it's rating. Especially if a requester decided to mass reject.

    I sort of want to factor TO2 into the script, but the poor way TO2 has been done complicates things.
     
  15. Kadauchi

    Kadauchi Administrator Former MTG MotM

    Messages:
    4,367
    Ratings:
    +8,589
    Its a rolling updated cache. It work like this
    1. Checks the cache for all requesters on page to see the last time their review data was cached
    2. If any on page requesters cache was updated more than X min ago, update the cache for all requesters on page

    This makes it so it is never outdated and cuts down the requests significantly. Requester requester review data on every page load is borderline malicious considering the state of TO now.
     
    • Like Like x 2
  16. gman42

    gman42 New Turker

    Messages:
    5
    Gender:
    Male
    Ratings:
    +3
    Looks like somewhere in the past month or so (no idea what update may have triggered it), pandas created via either of HIT Forker's panda buttons get created as "collect once", not just the O button. I know others have reported this so it's not just me. Not sure if the bug is on Forker's side, or Panda Crazy.