Last active
December 9, 2018 21:40
-
-
Save evitolins/6ed0f1ec68523f17fcfc7256dad35b2a to your computer and use it in GitHub Desktop.
AnimSchool Javascript Hacks
This file contains hidden or 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
var v = $('#video_html5_api')[0]; | |
var offsetTime = function (video, offset) { | |
video.currentTime = (video.currentTime + offset); | |
}; | |
var c = document.createElement('div'); | |
c.style.position="absolute"; | |
c.style.top="0"; | |
c.style.right="0"; | |
var createButton = function (video, label, offset) { | |
var b = document.createElement("button"); | |
b.innerHTML = label; | |
b.addEventListener('click', function(){ | |
offsetTime(video, offset); | |
}); | |
return b; | |
}; | |
document.body.appendChild(c); | |
c.appendChild(createButton(v, "-10m", 10 * -60)); | |
c.appendChild(createButton(v, "-1m", 1 * -60)); | |
c.appendChild(createButton(v, "-5s", -5)); | |
c.appendChild(createButton(v, "5s", 5)); | |
c.appendChild(createButton(v, "1m", 1 * 60)); | |
c.appendChild(createButton(v, "10m", 10 * 60)); |
This file contains hidden or 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
var get_rgb_playlist_url = function () { | |
var anchors = [].slice.call(document.querySelectorAll('a')); | |
var rgb_anchors = anchors.filter(function(a){return a.href.includes("rgbnotes")}); | |
var rgb_ids = rgb_anchors.map(function(a){ | |
return a.href.split('?')[0].split('=')[1]; | |
}); | |
var rgb_token = rgb_anchors[0].href.split('?')[1].split('token=')[1]; | |
var playlist_link = 'https://rgbnotes.com/viewer/#file_id='+rgb_ids[0] + '&file_ids=' + rgb_ids.join(',') + '&token=' + rgb_token; | |
return playlist_link; | |
}; | |
var url = get_rgb_playlist_url(); | |
window.open(url); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment