Skip to content

Instantly share code, notes, and snippets.

@luislobo14rap
Last active March 27, 2022 01:28
Show Gist options
  • Save luislobo14rap/b50b99aa3c19a5a504f929e289e13783 to your computer and use it in GitHub Desktop.
Save luislobo14rap/b50b99aa3c19a5a504f929e289e13783 to your computer and use it in GitHub Desktop.
//js-youtube-speeds alpha.js v0.1
let waitJquery = setInterval(function() {
if ($ == jQuery && jQuery != undefined) {
clearInterval(waitJquery);
$('.ytp-button.ytp-settings-button').on('click', function() {
setTimeout(function() {
$('.ytp-menuitem').each(function() {
if ($(this).text().indexOf('Velocidade') > -1) {
$(this).css('background', 'red');
$(this).attr('onclick', 'jsVelocidade()');
$(this).children().eq(0).next().addClass('velocidade-indicador');
};
});
}, 250);
});
top.jsVelocidade = function() {
$('.ytp-menuitem-label').each(function() {
if ($(this).text().indexOf('1.5') > -1) {
$(this).parent().addClass('js-1-5');
$('.js-1-5').css('background', 'red');
if (typeof btn1_75 == 'undefined') {
top.btn1_75 = $('.js-1-5').clone();
btn1_75.insertAfter($('.js-1-5'));
btn1_75.children().text('1.75');
btn1_75.attr('onclick', 'videoVelocidade(1.75)');
};
};
});
};
top.videoVelocidade = function(velocidade) {
$('video')[0].playbackRate = velocidade;
$('.ytp-popup.ytp-settings-menu').css('display', 'none');
$('.velocidade-indicador').text(velocidade);
};
};
}, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment