Thread Status:
Not open for further replies.
  1. TissueHime Survey Slinger

    Messages:
    2,408
    Gender:
    Male
    Ratings:
    +2,733
  2. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    Hello night owls, here is a present.

    Code:
    // ==UserScript==
    // @name
    Cliff DesPeaux
    // @namespace
    https://gist.github.com/Kadauchi
    // @version
    1.0.0
    // @description
    Hotel Image Rating
    // @author
    Kadauchi
    // @icon
    http://i.imgur.com/oGRQwPN.png
    // @include
    /^https://(www\.mturkcontent|s3\.amazonaws)\.com/
    // @hitsave
    https://www.mturkcontent.com/dynamic/hit?hitId=38G0E1M85M4QD3BEYP7BMC8YT7YVU5
    // @hitname
    Hotel Image Rating
    // ==/UserScript==
    if (document.getElementsByTagName(`strong`)[0].textContent !== `How much is the image making you want to stay at the hotel?`) return;
    function SHOW () {
    for (let i = 0; i < images.length; i ++) images[i].style.display = `none`;
    images[index].style.display = ``;
    counter.textContent = index + 1;
    for (let element of document.querySelectorAll(`[class="rate"]`)) element.style.backgroundColor = ``;
    for (let element of images[index].querySelectorAll(`[type="radio"]`)) if (element.checked) document.querySelector(`[class="rate"][value="${ element.value }"]`).style.backgroundColor = `lightgreen`;
    }
    function PREV () {
    if (index === 0) return;
    index --;
    SHOW();
    }
    function NEXT () {
    if (index === 9) return;
    index ++;
    SHOW();
    }
    document.getElementsByClassName(`container`)[0].insertAdjacentHTML(
    `afterend`,
    `<div class="text-center">` +
    `<button id="prev" style="margin: 3px;" type="button">Previous</button>` +
    `<button class="rate" value="1" style="margin: 3px;" type="button">1</button>` +
    `<button class="rate" value="2" style="margin: 3px;" type="button">2</button>` +
    `<button class="rate" value="3" style="margin: 3px;" type="button">3</button>` +
    `<button class="rate" value="4" style="margin: 3px;" type="button">4</button>` +
    `<button class="rate" value="5" style="margin: 3px;" type="button">5</button>` +
    `<button class="rate" value="6" style="margin: 3px;" type="button">6</button>` +
    `<button class="rate" value="7" style="margin: 3px;" type="button">7</button>` +
    `<button class="rate" value="8" style="margin: 3px;" type="button">8</button>` +
    `<button class="rate" value="9" style="margin: 3px;" type="button">9</button>` +
    `<button class="rate" value="10" style="margin: 3px;" type="button">10</button>` +
    `<button id="next" type="button">Next</button>` +
    `</div>` +
    `<div class="text-center"><span id="counter"></span> / 10</div>`
    );
    let index = 0;
    const images = document.getElementsByClassName(`form-group`);
    const counter = document.getElementById(`counter`);
    for (let i = 0; i < images.length; i ++) {
    images[i].style.display = `none`;
    images[i].parentElement.className = `text-center`;
    images[i].parentElement.parentElement.className = `text-center`;
    }
    document.addEventListener(`click`, function (event) {
    const element = event.target;
    if (element.matches(`#prev`)) PREV();
    if (element.matches(`#next`)) NEXT();
    if (element.matches(`.rate`)) {
    document.getElementById(`rating${ index + 1 }-${ element.value }`).click();
    NEXT();
    }
    });
    window.addEventListener(`keydown`, function (event) {
    const key = event.key;
    if (key.match(/0/)) document.querySelector(`[class="rate"][value="1${ key }"]`).click();
    if (key.match(/[1-9]/)) document.querySelector(`[class="rate"][value="${ key }"]`).click();
    if (key.match(/Enter/)) document.querySelector(`[type="submit"]`).click();
    });
    SHOW();
     
    • Today I Learned x 8
    • 5/5 Pay x 1
    • Love x 1
  3. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
    Big props to you and @slothbear for this. Not doing them myself. Doing regular hotels, but very classy of you both. :)
     
    • Like x 4
  4. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    I posted a script for regular hotels back in jan on MTC if you don't have one.
     
    • Like x 1
  5. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
    Oh wow. Didn't know that. I've always used my cobbled together ahk plus one simple javascript to submit, which @ChrisTurk made for me back on mtg.
     
  6. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    It is pretty decent. IIRC its all keybinds, so you can do them with just the numpad. If you do search for it, you can post it here (or pm it to me) so I can check if its the numpad too.
     
    • Like x 1
  7. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
    Cool. There are 3 different types of hotel hits which makes it problematic, hence my cobbled ahk's to do them.
     
  8. Davinna Well-Known Turker

    Messages:
    371
    Gender:
    Female
    Ratings:
    +441
    Title: Live Q/A about an Image (With Captions). | PANDA
    Requester: Research Tasks [A1CEBF7WRZ74YK] (Contact)
    TO: [Pay: 3.24] [Fair: 4.72] [Comm: 4.33] [Fast: 4.45] [Reviews: 215] [ToS: 0]
    Description:
    Ask or Answer questions about an image with a fellow Turker.
    Time: 20 minutes
    HITs Available: 2348
    Reward: $0.15
    Qualifications: Total approved HITs is not less than 5000; HIT approval rate (%) is not less than 95; Location is US;
    HIT exported from Mturk Suite v1.11.7
     
  9. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    Found it.

    Code:
    // ==UserScript==
    // @name
    Hotel Photos
    // @namespace
    https://github.com/Kadauchi/
    // @version
    1.0.0
    // @description
    Helps with Hotel Photos
    // @author
    Kadauchi
    // @icon
    http://i.imgur.com/oGRQwPN.png
    // @include
    https://s3.amazonaws.com/mturk_bulk/*
    // @grant
    GM_log
    // @hitsave
    https://s3.amazonaws.com/mturk_bulk/hits/245802341/_xoA59feByMOGyJnAVu_2Q.html
    // ==/UserScript==
    let q = 1, i = 0;
    const inputs = [
    `_DoesImageContainExterior_`,
    `_DoesContainMoreThanOneBuilding_`,
    `_DoesImageContainOver75_`,
    `_IsBuildingRestaurantOrStore_`,
    `_IsBuildingPrimarySubject_`,
    ];
    document.addEventListener(`keydown`, function (pressed) {
    switch (pressed.key) {
    case `1`: KEYPRESS(1); break;
    case `2`: KEYPRESS(2); break;
    case `Enter`: document.getElementsByName(`submit`)[0].click();
    }
    });
    function KEYPRESS (KEY) {
    const yn = KEY === 1 ? `yes` : `no`;
    document.getElementById(`ID0${q}${inputs[i]}${yn}`).click();
    if (document.getElementById(`ID0${q}_Done`).offsetParent !== null) {
    q ++;
    i = 0;
    }
    else {
    i ++;
    }
    if (q === 6) {/*document.getElementsByName(`submit`)[0].click();*/ return;}
    document.getElementById(`ID0${q}_DoesImageContainExterior_yes`).focus();
    document.getElementById(`ID0${q}_DoesImageContainExterior_yes`).scrollIntoView();
    }
     
    • Today I Learned x 1
  10. SAJ Survey Slinger

    Messages:
    27,503
    Gender:
    Male
    Ratings:
    +51,497
    Agreed very awesome of both! Thanks guys
     
    • Like x 1
  11. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
    Ah, yes, that works for one of the hit types they experimented with. The regular .07 .08 and .10s are different.
     
  12. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    I don't have masters so I never got the chance at the qual or I'd probably have one for all of them. I made this cause the script that was posted was just so bad that I had to fix it.
     
    • Like x 1
  13. Randomacts Survey Slinger

    Messages:
    94,624
    Gender:
    Male
    Ratings:
    +124,077
    @Kadauchi I don't currently use linux on my mturk machine.. but once I build a new computer I am planning to do so. I boot into linux sometimes on my laptop to do stuff ect and I used to have a dedicated server rented with debian on it.
     
    • Like x 1
  14. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
    If you figure out a way to use autohotkey with linux, please let us know. I tried a couple of ways but to no avail. I've got a 2nd laptop running linux.
     
  15. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    Use autokey. AHK can't because it uses Windows dependencies.
     
    • Like x 1
  16. Randomacts Survey Slinger

    Messages:
    94,624
    Gender:
    Male
    Ratings:
    +124,077
    Or if you are brave enough you should be able to do everything that AHK does with python I would assume.
     
  17. Kadauchi Administrator Former MTG MotM

    Messages:
    4,371
    Ratings:
    +8,609
    Or even better is that I don't use AHK cause I have it 100% replaced with js.
     
    • Like x 2
  18. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
    Yeah, I loaded that but haven't learned it yet. So used to creating ahk's that I've just been using the Linux laptop for other things instead.
     
  19. Randomacts Survey Slinger

    Messages:
    94,624
    Gender:
    Male
    Ratings:
    +124,077
    But you only get to be a cup of coffee if you use javascript.. with python you get to be a snake. :ay:
     
    • LOL x 1
  20. Bill Brasky Active Turker

    Messages:
    260
    Gender:
    Male
    Ratings:
    +427
Thread Status:
Not open for further replies.