Greasy Fork is available in English.

Procore Development helper (Mturk)

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

< 腳本Procore Development helper (Mturk)的回應

評論:正評 - 腳本一切正常

§
發表於:2015-06-21

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!

DonovanM作者
§
發表於:2015-06-21

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.

DonovanM作者
§
發表於:2015-06-21

Just to clarify, use this:

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

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!!

DonovanM作者
§
發表於:2015-06-22

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.

§
發表於:2015-06-22

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

發表回覆

登入以回復