Greasy Fork is available in English.

Discussions » Creation Requests

Need help with a script

§
Posted: 13 Oktober 2016

Need help with a script

Hi, i am looking for someone who can right a simple script for me.

I just need it to refresh certain page every few mins

and click this play button on a video.

Thanks in advance :)

§
Posted: 16 Oktober 2016

To refresh a page every 3 minutes, you only need to use this function:

setInterval(function(){ location.reload(); }, (3 * 60 * 1000));

The function uses miliseconds, so the 3 minutes are (3 * 60 * 1000) miliseconds. To change to 5 minutes, you only need to change the "3" by a "5".


To make the click, you first need to find the video control, and then only need to use this function:

document.querySelector("#example").click();

In this example, you search for a video control named with an id="example". You can search by id: #id_example, or by class: .class_example, or by tag: img, and you can mix multiple selectors: body .content #mainvideo img.playbutton. Every website is different, so nobody can give you more help without more information.

§
Posted: 07 November 2016

leoncastro, since the page is reloading you could use setTimeout. ;)

§
Posted: 07 November 2016

Yes, right. Thanks for the remark.

Post reply

Sign in to post a reply.