Ans youtube GUI

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

目前為 2025-01-26 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Ans youtube GUI
// @name:fi         Anin Youtube käyttöliittymä
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @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';
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';
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 }
];
 
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', // subscribes to the current videos creator
    () => {
	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"]');
  // unsubscribes to the current current videos creator
if (unsubscribeButton) {
    const clickEvent = new MouseEvent('click', {
        bubbles: true,
        cancelable: true,
        view: window
    });
 
    unsubscribeButton.dispatchEvent(clickEvent);
} else {
    console.error('Unsubscribe button not found');
}
});
 
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;
}
//fake subs
function setFakeSubs(value) {
    const subsElement = document.getElementById('owner-sub-count');
    if (subsElement) subsElement.textContent = value;
}
// fake views
function setFakeViews(value) {
    const viewsElement = document.getElementsByClassName('style-scope yt-formatted-string bold');
    if (viewsElement) viewsElement[0].textContent = 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
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址