// ==UserScript==
// @name Ans youtube GUI (ADBLOCKER, BASSBOOST)
// @name:fi Anin Youtube käyttöliittymä (MAINOSESTÄJÄ, BASSON KOROSTUS)
// @namespace http://tampermonkey.net/
// @version 1.0.7
// @description Tools for youtube, these tools let you modify the likes, video title, subscribers and views of the vid, dm me on dc if you want me to add ur idea
// @description:fi Työkaluja youtubeen nämä työkalut antaa sinun modifioida tykkäyksiä, videon nimeä, tilaajia ja videon katselukertoja, lähetä viestiä discordissa jos haluat että minä lisään ideasi.
// @author @theyhoppingonme on discord
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
//patch logs:
// V1.0.0: GUI released
// V1.0.1: Adblock
// V1.0.2: Just a simple name change and patch logs
// V1.0.3 Added more unsubscribe button filters
// V1.0.4 New GUI name
// V1.0.5 Added desc changer
// V1.0.6 Added pinned comment name changer
// V1.0.7 Added date changer, volume changer (bass boost epic), video width changer, video height changer, video duration changer, video time watched changer
const style = document.createElement('style'); // style for the menu
style.textContent = `
.container {
text-align: center;
width: 90%;
max-width: 800px;
padding: 30px;
background-color: #333;
border-radius: 15px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
font-family: 'Arial', sans-serif;
color: white;
position: fixed;
top: 10px;
right: 10px;
z-index: 10000;
}
button:hover {
background-color: #6B3EFF;
}
.close-button, .minimize-button {
position: absolute;
top: 10px;
background-color: transparent;
border: none;
color: white;
font-size: 20px;
cursor: pointer;
}
.close-button {
right: 30px;
}
.minimize-button {
right: 70px;
}
`;
document.head.appendChild(style);
const container = document.createElement('div'); //Creating the menu
container.className = 'container';
document.body.appendChild(container);
const title = document.createElement('h1'); // menu name
title.textContent = 'Ans Youtube GUI V1.0.7';
container.appendChild(title);
const closeButton = document.createElement('button'); // close button
closeButton.className = 'close-button';
closeButton.textContent = 'X';
container.appendChild(closeButton);
closeButton.addEventListener('click', () => {
container.style.display = 'none';
});
// minimize menu (button not shown, press insert to minimize)
const minimizeButton = document.createElement('button');
minimizeButton.className = 'minimize-button';
minimizeButton.textContent = '';
container.appendChild(minimizeButton);
minimizeButton.addEventListener('click', () => {
container.style.display = 'none';
});
const inputs = [ // inputs
{ placeholder: 'Fake likes', action: setFakeLikes },
{ placeholder: 'Fake subs', action: setFakeSubs },
{ placeholder: 'Fake views', action: setFakeViews },
{ placeholder: 'Change Title', action: setChangeTitle },
{ placeholder: 'Change ChannelName', action: setFakeName },
{ placeholder: 'Change Playbackspeed', action: setPlaybackSpeed },
{ placeholder: 'Fake Description', action: setDesc },
{ placeholder: 'Fake CommentPinner', action: setPinner },
{ placeholder: 'Fake date', action: setDate },
{ placeholder: 'Change volume', action: setVolume },
{ placeholder: 'Video Height', action: setHeight },
{ placeholder: 'Video Width', action: setWidth },
{ placeholder: 'Video Duration', action: setDuration },
{ placeholder: 'Set TimeWatched (seconds)', action: setTime }
];
function createInputButton(inputConfig) { // creating input buttons
const input = document.createElement('input');
input.type = 'text';
input.placeholder = inputConfig.placeholder;
container.appendChild(input);
const button = document.createElement('button');
button.textContent = `Set ${inputConfig.placeholder.split(' ')[1]}`;
container.appendChild(button);
button.addEventListener('click', () => {
inputConfig.action(input.value);
});
}
function createToggleButton(label, enableFunction, disableFunction) { // creating toggles
const toggleContainer = document.createElement('div');
toggleContainer.style.marginTop = '10px';
container.appendChild(toggleContainer);
const labelElement = document.createElement('span');
labelElement.textContent = label;
labelElement.style.marginRight = '10px';
toggleContainer.appendChild(labelElement);
const toggleButton = document.createElement('button');
toggleButton.textContent = 'OFF';
toggleButton.style.padding = '5px 10px';
toggleButton.style.cursor = 'pointer';
toggleContainer.appendChild(toggleButton);
let isToggled = false;
toggleButton.addEventListener('click', () => {
isToggled = !isToggled;
toggleButton.textContent = isToggled ? 'ON' : 'OFF';
toggleButton.style.backgroundColor = isToggled ? '#6B3EFF' : '';
if (isToggled) {
enableFunction();
} else {
disableFunction();
}
});
}
function skipYouTubeAds() {
const skipButton = document.querySelector('.ytp-ad-skip-button');
if (skipButton) {
skipButton.click();
}
const overlayAd = document.querySelector('.ytp-ad-overlay-slot');
if (overlayAd) {
overlayAd.style.display = 'none';
}
const bannerAd = document.querySelector('.ytp-ce-element');
if (bannerAd) {
bannerAd.style.display = 'none';
}
const adFrame = document.querySelector('iframe[src*="ads"]');
if (adFrame) {
adFrame.style.display = 'none';
}
}
function blockYouTubeAds() {
setInterval(() => {
const skipButton = document.querySelector('.ytp-ad-skip-button');
if (skipButton) {
skipButton.click();
}
const overlayAd = document.querySelector('.ytp-ad-overlay-slot');
if (overlayAd) {
overlayAd.style.display = 'none';
}
const bannerAd = document.querySelector('.ytp-ce-element');
if (bannerAd) {
bannerAd.style.display = 'none';
}
const adFrame = document.querySelector('iframe[src*="ads"]');
if (adFrame) {
adFrame.style.display = 'none';
}
const adOverlay = document.querySelector('.ytp-ad-player-overlay');
if (adOverlay) {
adOverlay.style.display = 'none';
}
const skipButtonCountDown = document.querySelector('.ytp-ad-preview-container');
if (skipButtonCountDown) {
skipButtonCountDown.style.display = 'none';
}
}, 10);
}
createToggleButton('Toggle YouTube Ad Blocker (W?)', skipYouTubeAds, blockYouTubeAds);
// ad block
createToggleButton('Toggle Mute', // mute button, emulates the M key press
() => {
const keyEvent = new KeyboardEvent('keydown', {
key: 'm',
code: 'KeyM',
keyCode: 77,
which: 77,
bubbles: true,
cancelable: true
});
document.dispatchEvent(keyEvent);
},
() => {
const keyEvent = new KeyboardEvent('keydown', {
key: 'm',
code: 'KeyM',
keyCode: 77,
which: 77,
bubbles: true,
cancelable: true
});
document.dispatchEvent(keyEvent);
}
);
createToggleButton(
'Toggle subscription',
() => {
const subscribeButton = document.querySelector('.yt-spec-button-shape-next.yt-spec-button-shape-next--filled.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-m');
if (subscribeButton) {
const clickEvent = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
subscribeButton.dispatchEvent(clickEvent);
} else {
console.error('Subscribe button not found');
}
},
() => {
const unsubscribeButton = document.querySelector('button[aria-label="Unsubscribe"].yt-spec-button-shape-next.yt-spec-button-shape-next--text.yt-spec-button-shape-next--call-to-action.yt-spec-button-shape-next--size-m');
if (unsubscribeButton) {
const clickEvent = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
unsubscribeButton.dispatchEvent(clickEvent);
} else {
console.error('Unsubscribe button not found, creating it...');
const Creator = document.querySelector('tp-yt-paper-item.style-scope.ytd-menu-service-item-renderer[role="option"]');
if (Creator) {
Creator.click();
console.log("Step 1 success!");
setTimeout(() => {
const Cancel = document.querySelector('button.yt-spec-button-shape-next[aria-label="Cancel"]');
if (Cancel) {
Cancel.click();
console.log("Unsubscribe button created!");
if (unsubscribeButton) {
const clickEvent = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
unsubscribeButton.dispatchEvent(clickEvent);
} else {
console.error('Failed');
}
} else {
console.error("404");
}
}, 100);
} else {
console.error("Unsubscribe button was failed to be created.");
}
}
}
);
createToggleButton('Paused', // pausing, self explainitory
() => {
const video = document.querySelector('video');
video.pause();
},
() => {
const video = document.querySelector('video');
video.play();
}
);
// fake likes, reminder do not change the likes first letter to be a character, it breaks the script
function setFakeLikes(value) {
const likesElement = document.querySelectorAll('div[class="yt-spec-button-shape-next__button-text-content"]');
likesElement.forEach(element => {
const textContent = element.textContent.trim();
if (textContent && !isNaN(textContent[0])) {
element.textContent = value;
}
});
}
// playbackspeed
function setPlaybackSpeed(value) {
const video = document.querySelector("video");
video.playbackRate = value;
}
// set volume
let audioContext;
let gainNode;
function setVolume(value) {
const video = document.querySelector("video");
// Initialize the AudioContext and GainNode only once
if (!audioContext) {
audioContext = new AudioContext();
}
if (!gainNode) {
gainNode = audioContext.createGain();
const source = audioContext.createMediaElementSource(video);
source.connect(gainNode);
gainNode.connect(audioContext.destination);
}
// Update the gain value dynamically
gainNode.gain.value = value;
}
// desc
function setDesc(value) {
const Desc = document.querySelector(
'span.yt-core-attributed-string.yt-core-attributed-string--white-space-pre-wrap[dir="auto"] > span.yt-core-attributed-string--link-inherit-color.yt-core-attributed-string--strikethrough.yt-core-attributed-string--line-style-single[dir="auto"][style="color: rgb(19, 19, 19);"]'
);
Desc.textContent = value;
}
//fake subs
function setFakeSubs(value) {
const subsElement = document.getElementById('owner-sub-count');
if (subsElement) subsElement.textContent = value;
}
//fake date
function setDate(value) {
const date = document.querySelector(
'span.bold.style-scope.yt-formatted-string[dir="auto"][style-target="bold"]'
);
date.textContent = value;
}
//fake pin
function setPinner(value) {
const pinner = document.querySelector('yt-formatted-string#label.style-scope.ytd-pinned-comment-badge-renderer');
if (pinner && pinner.id === 'label') {
pinner.textContent = value;
} else {
console.log('404');
}
}
// fake views
function setFakeViews(value) {
const viewsElement = document.getElementsByClassName('style-scope yt-formatted-string bold');
if (viewsElement) viewsElement[0].textContent = value;
}
// width
function setWidth(value) {
const width = document.querySelector("video");
width.videoWidth = value;
}
//height
function setHeight(value) {
const height = document.querySelector("video");
height.videoHeight = value;
}
//duration
function setDuration(value) {
const duration = document.getElementsByClassName("ytp-time-duration");
const duration2 = document.querySelector('span[class="ytp-time-duration"]')
duration.value = value;
duration.textContent = value;
duration2.textContent = value;
}
//Time watched
function setTime(value) {
const time = document.querySelector("video");
time.currentTime = value;
}
//fake name
function setFakeName(value) {
const nameElement = document.querySelector('a.yt-simple-endpoint.style-scope.yt-formatted-string[spellcheck="false"]');
if (nameElement) {
nameElement.textContent = value;
} else {
console.log("Element not found");
}
}
// title changer
function setChangeTitle(value) {
const titleElement = document.querySelector('h1.style-scope.ytd-watch-metadata yt-formatted-string');
if (titleElement) {
titleElement.textContent = value;
}
}
inputs.forEach(createInputButton);
// dragging script
let isDragging = false;
let offsetX, offsetY;
// minimizing
container.addEventListener('mousedown', (e) => {
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'BUTTON') {
isDragging = true;
offsetX = e.clientX - container.getBoundingClientRect().left;
offsetY = e.clientY - container.getBoundingClientRect().top;
}
});
document.addEventListener('mousemove', (e) => {
if (isDragging) {
container.style.left = `${e.clientX - offsetX}px`;
container.style.top = `${e.clientY - offsetY}px`;
}
});
document.addEventListener('mouseup', () => {
isDragging = false;
});
let isVisible = true;
document.addEventListener('keydown', (e) => {
if (e.key === 'Insert') {
if (isVisible) {
container.style.display = 'none';
} else {
container.style.display = 'block';
}
isVisible = !isVisible;
}
});
// made by theyhoppingonme on discord
})();