Greasy Fork is available in English.

YouTube Clickbait-Buster

Check whether it's worth watching a video before actually clicking on it by peeking it's visual or verbal content, description, comments, viewing the thumbnail in full-size and displaying the full title. Works on both YouTube's desktop and mobile layouts, and is also compatible with dark theme.

< Spätná väzba na YouTube Clickbait-Buster

Hodnotenie: Dobré - skript funguje

§
Pridaný: 16.07.2023

Hello, I have implemented keyboard shortcuts through AI, but I am unable to make them stop working when the menu button disappears. This can cause conflicts with other key inputs, such as when typing in a search bar. Do you have any solutions for this?

Here is the code

function processVideoItem(node) {

const videoTitleEll = node.querySelector(isMobile ? "h3, h4" : "#video-title, #movie-title");

if (!videoTitleEll)
return;


let videoUrl = videoTitleEll.href || videoTitleEll.parentElement.href || videoTitleEll.parentElement.parentElement.href;

const videoMenuBtn = node.querySelector(isMobile ? ".media-item-menu" : "ytd-menu-renderer");

//
//

if (videoMenuBtn) {

//
videoMenuBtn.parentElement.onclick = function() {

selectedVideoURL = videoUrl;

//
document.addEventListener('keydown', function(event) {
if (event.key === 'a' && selectedVideoURL) {
viewStoryboardButton.click();
}
});

//
document.addEventListener('keydown', function(event) {
if (event.key === 'q' && selectedVideoURL) {
viewThumbnailButton.click();
}
});

//
document.body.click();

}

}

}

This is my previous proposal
https://greasyfork.org/en/scripts/439305-youtube-clickbait-buster/discussions/119911

§
Pridaný: 16.07.2023

I found a new problem, the video of this channel does not have a menu button with three dots, which makes it impossible to use this script
https://www.youtube.com/@topsecret_ma/videos

§
Pridaný: 17.07.2023

I thought of a solution to disable A and Q by pressing W
function processVideoItem(node) {

const videoTitleEll = node.querySelector(isMobile ? "h3, h4" : "#video-title, #movie-title");

if (!videoTitleEll)
return;

let videoUrl = videoTitleEll.href || videoTitleEll.parentElement.href || videoTitleEll.parentElement.parentElement.href;

const videoMenuBtn = node.querySelector(isMobile ? ".media-item-menu" : "ytd-menu-renderer");

//
//

if (videoMenuBtn) {

//
videoMenuBtn.parentElement.onclick = function() {

selectedVideoURL = videoUrl;

let enableHotkeys = true;

// A
document.addEventListener('keydown', function(event) {
if (enableHotkeys && event.key === 'a' && selectedVideoURL) {
viewStoryboardButton.click();
}
});

// Q
document.addEventListener('keydown', function(event) {
if (enableHotkeys && event.key === 'q' && selectedVideoURL) {
viewThumbnailButton.click();
}
});

// W
document.addEventListener('keydown', function(event) {
if (event.key === 'w') {
enableHotkeys = false;
}
});

//
document.body.click();

}

}

}

§
Pridaný: 17.07.2023

Possibly the perfect solution
function processVideoItem(node) {
const videoTitleEll = node.querySelector(isMobile ? "h3, h4" : "#video-title, #movie-title");

if (!videoTitleEll) {
return;
}

let videoUrl = videoTitleEll.href || videoTitleEll.parentElement.href || videoTitleEll.parentElement.parentElement.href;

const videoMenuBtn = node.querySelector(isMobile ? ".media-item-menu" : "ytd-menu-renderer");

if (videoMenuBtn) {
videoMenuBtn.parentElement.onclick = function () {
selectedVideoURL = videoUrl;
let hotkeysEnabled = true;

//
document.addEventListener('keydown', function (event) {
if (hotkeysEnabled && event.key === 'a' && selectedVideoURL) {
viewStoryboardButton.click();
}
});

//
document.addEventListener('keydown', function (event) {
if (hotkeysEnabled && event.key === 'q' && selectedVideoURL) {
viewThumbnailButton.click();
}
});

//
document.addEventListener('keydown', function (event) {
if (event.key === 'a' || event.key === 'q') {
hotkeysEnabled = false;
}
});

document.body.click();
};
}
}

§
Pridaný: 19.07.2023

The strongest version
// ==/UserScript==

// A
function registerHotkey() {
$(document).keydown(function(event) {
if (event.key === 'a') {
$('#storyboard,#highresThumbnail,#transcriptContainer,#channelViewportContainer,#commentsContainer').remove();
}
});
}
function processVideoItem(node) {
const videoTitleEll = node.querySelector(isMobile ? "h3, h4" : "#video-title, #movie-title");

if (!videoTitleEll) {
return;
}

let videoUrl = videoTitleEll.href || videoTitleEll.parentElement.href || videoTitleEll.parentElement.parentElement.href;

const videoMenuBtn = node.querySelector(isMobile ? ".media-item-menu" : "ytd-menu-renderer");

//
//

if (videoMenuBtn) {
//
videoMenuBtn.parentElement.onclick = function () {
selectedVideoURL = videoUrl;
let hotkeysEnabled = true;

// W
document.addEventListener('keydown', function (event) {
if (hotkeysEnabled && event.key === 'w' && selectedVideoURL) {
viewStoryboardButton.click();
}
});

// Q
document.addEventListener('keydown', function (event) {
if (hotkeysEnabled && event.key === 'q' && selectedVideoURL) {
viewThumbnailButton.click();
}
});

// W Q
document.addEventListener('keydown', function (event) {
if (event.key === 'w' || event.key === 'q') {
hotkeysEnabled = false;
}
});
//
document.body.click();
// A
registerHotkey();
};
}
}

Pridať odpoveď

Aby ste mohli pridať odpoveď, prihláste sa.