Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AnimSchool Javascript Hacks
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));
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
You can’t perform that action at this time.