Greasy Fork is available in English.
Adds keyboard shortcuts [ and ] for liking and disliking videos, and s for skipping pre-video and banner ads.
< Commentaires sur Youtube like/dislike video and skip ad keyboard shortcuts
Actually that's being a little flaky... this might work better:
videoinfo = document.getElementsByTagName("ytd-watch-metadata");
if(videoinfo.length >= 1) {
buttons = videoinfo[0].getElementsByTagName("ytd-toggle-button-renderer");
like = buttons[0];
dislike = buttons[1];
}
This doesn't work in the latest youtube after last week's update. Any thoughts?
Nevermind, switching to another available script recently updated.
Nevermind, switching to another available script recently updated.
What script did you switch to?
Here's a new version that works (with no skippind key shortcut anymore):
// ==UserScript==
// @name Youtube like/dislike video and skip ad keyboard shortcuts
// @namespace nerevar009
// @include https://www.youtube.com/*
// @description Adds keyboard shortcuts [ and ] for liking and disliking videos
// @version 1.2
// @grant none
// ==/UserScript==
var onvideopage, like, dislike, tag;
onvideopage = true;
if(!/^\/watch/.test(location.pathname)) onvideopage = false;
addEventListener("keypress", function(e) {
if(!onvideopage)
return;
if(e.target.getAttribute("contenteditable") == "true")
return;
tag = e.target.tagName.toLowerCase();
if(tag == "input" || tag == "textarea")
return;
like=document.getElementById("segmented-like-button").children[0].children[0].children[0];
dislike=document.getElementById("segmented-dislike-button").children[0].children[0].children[0];
if(e.code == "BracketLeft" && like)
like.click();
else if(e.code == "BracketRight" && dislike)
dislike.click();
});
To fix this for current (2022-05-14) youtube, do this:
Change:
videoinfo = document.getElementsByTagName("ytd-video-primary-info-renderer");
if(videoinfo.length == 1) {
To:
videoinfo = document.getElementsByTagName("ytd-menu-renderer");
if(videoinfo.length >= 1) {