Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name yandex music autoplay
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @run-at document-end
- // @require http://code.jquery.com/jquery-1.12.4.min.js
- // @match *://music.yandex.ru/users/tohadev/*
- // @grant none
- // ==/UserScript==
- console.log("START");
- var iter = 0;
- function sleep(milliseconds) {
- var start = new Date().getTime();
- for (var i = 0; i < 1e7; i++) {
- if ((new Date().getTime() - start) > milliseconds){
- break;
- }
- }
- }
- function wtf()
- {
- console.log("H WTF");
- console.log("iter:"+iter);
- iter++;
- if (iter == 5)
- {
- //document.getElementsByClassName("icon icon_next icon_size_XL")[0].click();
- //document.querySelector('.player-controls__btn_next').click();
- externalAPI.next();
- /*var musicID = Math.floor(Math.random() * (20 - 0) + 0);
- console.log('page loaded mid:'+musicID);
- document.getElementsByClassName("icon icon_pp icon_size_L")[musicID].click();*/
- }
- else
- setTimeout(wtf, 1000);
- }
- function onload_ev()
- {
- console.log("H EV LOADED");
- /*var musicID = Math.floor(Math.random() * (20 - 0) + 0);
- console.log('page loaded mid:'+musicID);
- sleep(120000);
- document.getElementsByClassName("icon icon_pp icon_size_L")[musicID].click(); */
- setTimeout(wtf(), 5000); //setTimeout isnt working
- }
- window.onload = onload_ev;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement