dimanche 19 avril 2015

Opening webpage in javascript on trigger

I'm using a script called "HIT Scraper WITH EXPORT" to help me with my job. Right now it's set up in a way that any time there is a new posting the page plays a audible sound/ding. Normally when this happens I have to switch tabs and manually click on the new listing to preview it. I'm trying to make it so it automatically opens the listing before/after dinging. Also if possible having it put focus on that tab if I'm in a different one. Is any of this possible, where should I start? I'll post the code and some areas of interest I noticed, I just don't know what to do with these areas.. Thank you in advance.


The function that runs when a new hit is found I think:



function newHits(dingNoise) {
//console.log(dingNoise);
if (dingNoise || newHitDing)
document.getElementById("ding_noise"+audio_index).play();
}


I think "preview_link" is the var I need to automatically open after the ding sound plays.



var preview_link = "/mturk/preview?groupId=" + group_ID;


So my logic was something like:



function newHits(dingNoise) {
//console.log(dingNoise);
if (dingNoise || newHitDing)
document.getElementById("ding_noise"+audio_index).play();
window.open("/mturk/preview?groupId=") + group_ID;

}


Which did not work.. Here's the full script if anyone has any ideas.. Thanks again.


http://ift.tt/1HGVfBY


Aucun commentaire:

Enregistrer un commentaire