Last active
December 7, 2016 12:01
-
-
Save fogrew/e0dedb5e1c1fa3803f82 to your computer and use it in GitHub Desktop.
vk.com music bookmarklets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Alarm | |
var played = 0; | |
var time = prompt("Во сколько разбудить?", "6:55"); | |
var waiting = setInterval(function() { | |
if ((new Date()) > (new Date("May,05,2015,"+time)) && played == 0) { // it is time to awake? | |
played = 1; | |
document.getElementById('play72450163_91647005').click(); | |
clearInterval(waiting); | |
} | |
}, 1000 * 60 * 3); // to check every 3 minutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lullaby | |
// run on page | |
// https://new.vk.com/audios72450163?q=snow | |
// https://vk.com/audios72450163?q=snow | |
$ = (query) => document.querySelector(query); | |
is = (node, query) => node.classList.contains(query); | |
var timer = prompt("When the turn off?", 30); | |
var repeat = $('#ac_repeat') || $('._audio_page_player_repeat'); | |
var play = $('#ac_play') || $('._audio_page_player_play'); | |
// turn track repeat | |
if(!is(repeat, 'on') && !is(repeat, 'audio_page_player_btn_enabled')) { | |
repeat.click(); | |
} | |
// turn track | |
if(!is(play, 'audio_playing')) { | |
$('#play_72450163_163994377').click(); | |
} | |
// stop playing when timer expires | |
setTimeout(() => play.click(), 1000 * 60 * timer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment