Greasy Fork is available in English.

Procore Development helper (Mturk)

Makes it easier to do Procore Development drawing number and title HITs on Mturk.

< Commentaires sur Procore Development helper (Mturk)

Avis: Bon - le script fonctionne correctement

§
Posté le: 21/06/2015

Trying to add auto return on dead end.

I am trying to learn how to script and I wanted to add an auto return when procore brings up a dead end.
I tried various things and can't seem to get it to return.
I added this code and tested it, it detects the dead end page but doesn't return. Any ideas?

var deadend = $('title:contains("The page you were looking for")').length > 0;
if (deadend) {
var mturk_iframe = document.querySelector("a[href*='mturk/return']");
$("img[src='/media/return_hit.gif']").click();
}

Any help would be appreciated.
Thanks!

DonovanMAuteur
§
Posté le: 21/06/2015

That's a great idea! Instead of using click() on the <img>, you should use it on the link that you got from the querySelector. I think $("a[href*='mturk/return']").click() should do the trick.

DonovanMAuteur
§
Posté le: 21/06/2015

Just to clarify, use this:

var deadend = $('title:contains("The page you were looking for")').length > 0;
if (deadend) {
    $("a[href*='mturk/return']").click();
}
§
Posté le: 21/06/2015

That's pretty much what I had before. What I posted above was actually the remnants of some code I had tried earlier but forgot to revert. I had used:

$("a[href^='/mturk/return'")[0].click();

and rest of code was same as what you have, but that didn't work. Will try with this new code as soon as some more come up.

Thanks!!

DonovanMAuteur
§
Posté le: 22/06/2015

Ahh...I know why it isn't working for you. The Procore script runs in the iframe of the HIT and can't "see" the return button since it's outside of the iframe.

You might have to do something like

$("a[href*='mturk/return']", parent.window.document).click();

for it to work. That should make it look for the return button in the parent window. This is off the top of my head so it might not be 100% correct but will hopefully put you in the right direction.

§
Posté le: 22/06/2015

Ah! I thought it was something to do with the iframe. I will try this. Thanks again.

Poster une réponse

Connectez-vous pour poster une réponse.