Greasy Fork镜像 支持简体中文。

Ans youtube GUI (ADBLOCKER, VOLUME CHANGER, 15+ MODS)

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-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Ans youtube GUI (ADBLOCKER, VOLUME CHANGER, 15+ MODS)
  3. // @name:fi Anin Youtube käyttöliittymä (MAINOSESTÄJÄ, ÄÄNITASON VAIHTAJA, 15+ MODIFIKAATIOTA)
  4. // @namespace http://tampermonkey.net/
  5. // @version 1.1.0
  6. // @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
  7. // @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.
  8. // @author @theyhoppingonme on discord
  9. // @match https://www.youtube.com/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. //patch logs:
  17. // V1.0.0: GUI released
  18. // V1.0.1: Adblock
  19. // V1.0.2: Just a simple name change and patch logs
  20. // V1.0.3 Added more unsubscribe button filters
  21. // V1.0.4 New GUI name
  22. // V1.0.5 Added desc changer
  23. // V1.0.6 Added pinned comment name changer
  24. // V1.0.7 Added volume changer (bass boost epic), video width changer, video height changer, video duration changer, video time watched changer
  25. // V1.0.8 Ad block has been fixed and enhanced as well as the unsubscribing, before you had to unsubscribe first manually but now its fully functional!
  26. // V1.0.9 Adblock is ACTUALLY fixed sorry for the inconvinience it was broken a bit
  27. // V1.1.0 Added change search placeholder
  28.  
  29. function isYouTubeShort() {
  30. const currentURL = window.location.href;
  31. if (currentURL.includes('youtube.com/shorts/')) {
  32. console.log('Mostly everything is bugged on shorts, if you wish to use the script on this video, go and watch the non-short version.');
  33. }
  34. }
  35. isYouTubeShort();
  36.  
  37. function isLiveChat() {
  38. const currentURL = window.location.href;
  39. if (currentURL.includes('youtube.com/live_chat')) {
  40. return;
  41. }
  42. }
  43. isLiveChat();
  44.  
  45. const style = document.createElement('style'); // style for the menu
  46. style.textContent = `
  47. .container {
  48. text-align: center;
  49. width: 90%;
  50. max-width: 800px;
  51. padding: 30px;
  52. background-color: #333;
  53. border-radius: 15px;
  54. box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  55. font-family: 'Arial', sans-serif;
  56. color: white;
  57. position: fixed;
  58. top: 10px;
  59. right: 10px;
  60. z-index: 10000;
  61. }
  62. button:hover {
  63. background-color: #6B3EFF;
  64. }
  65. .close-button, .minimize-button {
  66. position: absolute;
  67. top: 10px;
  68. background-color: transparent;
  69. border: none;
  70. color: white;
  71. font-size: 20px;
  72. cursor: pointer;
  73. }
  74. .close-button {
  75. right: 30px;
  76. }
  77. .minimize-button {
  78. right: 70px;
  79. }
  80. `;
  81. document.head.appendChild(style);
  82.  
  83. const container = document.createElement('div'); //Creating the menu
  84. container.className = 'container';
  85. document.body.appendChild(container);
  86.  
  87. const title = document.createElement('h1'); // menu name
  88. const nameElement = document.getElementById("account-name");
  89. const name = nameElement ? nameElement.textContent.trim() : "Guest";
  90. title.textContent = "Ans Youtube GUI V1.1.0";
  91. container.appendChild(title);
  92.  
  93. const closeButton = document.createElement('button'); // close button
  94. closeButton.className = 'close-button';
  95. closeButton.textContent = 'X';
  96. container.appendChild(closeButton);
  97. closeButton.addEventListener('click', () => {
  98. container.style.display = 'none';
  99. });
  100. // minimize menu (button not shown, press insert to minimize)
  101. const minimizeButton = document.createElement('button');
  102. minimizeButton.className = 'minimize-button';
  103. minimizeButton.textContent = '';
  104. container.appendChild(minimizeButton);
  105. minimizeButton.addEventListener('click', () => {
  106. container.style.display = 'none';
  107. });
  108.  
  109. const inputs = [ // inputs
  110. { placeholder: 'Fake likes', action: setFakeLikes },
  111. { placeholder: 'Fake subs', action: setFakeSubs },
  112. { placeholder: 'Fake views', action: setFakeViews },
  113. { placeholder: 'Change Title', action: setChangeTitle },
  114. { placeholder: 'Change ChannelName', action: setFakeName },
  115. { placeholder: 'Change Playbackspeed', action: setPlaybackSpeed },
  116. { placeholder: 'Fake Description', action: setDesc },
  117. { placeholder: 'Fake CommentPinner', action: setPinner },
  118. { placeholder: 'Change volume', action: setVolume },
  119. { placeholder: 'Video Height', action: setHeight },
  120. { placeholder: 'Video Width', action: setWidth },
  121. { placeholder: 'Video Duration', action: setDuration },
  122. { placeholder: 'Set TimeWatched (seconds)', action: setTime },
  123. { placeholder: 'Set SearchPlaceholder', action: setSearch }
  124. ];
  125.  
  126. function createInputButton(inputConfig) { // creating input buttons
  127. const input = document.createElement('input');
  128. input.type = 'text';
  129. input.placeholder = inputConfig.placeholder;
  130. container.appendChild(input);
  131.  
  132. const button = document.createElement('button');
  133. button.textContent = `Set ${inputConfig.placeholder.split(' ')[1]}`;
  134. container.appendChild(button);
  135.  
  136. button.addEventListener('click', () => {
  137. inputConfig.action(input.value);
  138. });
  139. }
  140.  
  141. function createToggleButton(label, enableFunction, disableFunction) { // creating toggles
  142. const toggleContainer = document.createElement('div');
  143. toggleContainer.style.marginTop = '10px';
  144. container.appendChild(toggleContainer);
  145.  
  146. const labelElement = document.createElement('span');
  147. labelElement.textContent = label;
  148. labelElement.style.marginRight = '10px';
  149. toggleContainer.appendChild(labelElement);
  150.  
  151. const toggleButton = document.createElement('button');
  152. toggleButton.textContent = 'OFF';
  153. toggleButton.style.padding = '5px 10px';
  154. toggleButton.style.cursor = 'pointer';
  155. toggleContainer.appendChild(toggleButton);
  156.  
  157. let isToggled = false;
  158.  
  159. toggleButton.addEventListener('click', () => {
  160. isToggled = !isToggled;
  161. toggleButton.textContent = isToggled ? 'ON' : 'OFF';
  162. toggleButton.style.backgroundColor = isToggled ? '#6B3EFF' : '';
  163.  
  164. if (isToggled) {
  165. enableFunction();
  166. } else {
  167. disableFunction();
  168. }
  169. });
  170. }
  171.  
  172. const Adblock = () => {
  173. const scrub = document.querySelector('.ytp-fine-scrubbing')
  174. const player = document.querySelector('#movie_player')
  175. const adyesno = player.classList.contains('ad-showing')
  176. const vid = player.querySelector('video.html5-main-video')
  177. if (adyesno) {
  178. const skip = document.querySelector(`
  179. .ytp-skip-ad-button,
  180. .ytp-ad-skip-button,
  181. .ytp-ad-skip-button-modern,
  182. .ytp-ad-survey-answer-button
  183. `)
  184. if (skip) {
  185. skip.click()
  186. skip.remove()
  187. }
  188. else if (vid && vid.src) {
  189. vid.currentTime = 9999999999;
  190. }
  191. }
  192. const adSelectors = [
  193. '.ytp-ad-module',
  194. '.ytp-ad-text',
  195. '.ad-interrupting',
  196. '.video-ads',
  197. '.ytp-ad-image-overlay'
  198. ];
  199.  
  200. const links = [
  201. 'about:blank'
  202. ];
  203.  
  204. const skipButton = document.querySelector('.ytp-ad-skip-button');
  205. if (skipButton) skipButton.click();
  206.  
  207. adSelectors.forEach(selector => {
  208. document.querySelectorAll(selector).forEach(ad => {
  209. ad.currentTime = ad.duration;
  210. });
  211. });
  212.  
  213. function checkAndSkipAd() {
  214. const adBadge = document.querySelector('.ad-simple-attributed-string.ytp-ad-badge__text#ad-simple-attributed-string\\:a[aria-label="Sponsored"]');
  215.  
  216. if (adBadge) {
  217. const vid = document.querySelector('video');
  218. if (vid) {
  219. vid.currentTime = 9489278134234324323424234;
  220. console.log('Ad detected and ad skipped.');
  221. }
  222. }
  223. }
  224.  
  225. const observer = new MutationObserver(() => {
  226. checkAndSkipAd();
  227. });
  228.  
  229. observer.observe(document.body, {
  230. childList: true,
  231. subtree: true,
  232. });
  233.  
  234. checkAndSkipAd();
  235.  
  236. };
  237.  
  238.  
  239.  
  240. const reenableAds = () => {
  241. const skipButton = document.querySelector('.ytp-ad-skip-button');
  242. if (skipButton) skipButton.style.display = 'block';
  243.  
  244. const overlayAd = document.querySelector('.ytp-ad-overlay-slot');
  245. if (overlayAd) overlayAd.style.display = 'block';
  246.  
  247. const bannerAd = document.querySelector('.ytp-ce-element');
  248. if (bannerAd) bannerAd.style.display = 'block';
  249.  
  250. const adFrame = document.querySelector('iframe[src*="ads"]');
  251. if (adFrame) adFrame.style.display = 'block';
  252.  
  253. const adSelectors = [
  254. '.ytp-ad-player-overlay',
  255. '.ytp-ad-module',
  256. '.ytp-ad-text',
  257. '.ad-interrupting',
  258. '.video-ads',
  259. '.ytp-ad-image-overlay'
  260. ];
  261.  
  262. adSelectors.forEach(selector => {
  263. document.querySelectorAll(selector).forEach(ad => {
  264. ad.style.display = 'block';
  265. });
  266. });
  267. const originalFetch = window.fetch;
  268. window.fetch = originalFetch;
  269.  
  270. const originalXhrOpen = XMLHttpRequest.prototype.open;
  271. XMLHttpRequest.prototype.open = originalXhrOpen;
  272. };
  273.  
  274. createToggleButton('Toggle YouTube Ad Blocker', Adblock, reenableAds);
  275. // ad block
  276.  
  277. createToggleButton('Toggle Mute', // mute button, emulates the M key press
  278. () => {
  279. const keyEvent = new KeyboardEvent('keydown', {
  280. key: 'm',
  281. code: 'KeyM',
  282. keyCode: 77,
  283. which: 77,
  284. bubbles: true,
  285. cancelable: true
  286. });
  287. document.dispatchEvent(keyEvent);
  288. },
  289. () => {
  290. const keyEvent = new KeyboardEvent('keydown', {
  291. key: 'm',
  292. code: 'KeyM',
  293. keyCode: 77,
  294. which: 77,
  295. bubbles: true,
  296. cancelable: true
  297. });
  298. document.dispatchEvent(keyEvent);
  299. }
  300. );
  301.  
  302. createToggleButton(
  303. 'Toggle subscription',
  304. () => {
  305. 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');
  306.  
  307. if (subscribeButton) {
  308. const clickEvent = new MouseEvent('click', {
  309. bubbles: true,
  310. cancelable: true,
  311. view: window
  312. });
  313. subscribeButton.dispatchEvent(clickEvent);
  314. } else {
  315. console.error('Subscribe button not found');
  316. }
  317. },
  318. () => {
  319. const unsubscribeButton = document.querySelector(
  320. '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'
  321. );
  322.  
  323. if (unsubscribeButton) {
  324. const clickEvent = new MouseEvent('click', {
  325. bubbles: true,
  326. cancelable: true,
  327. view: window
  328. });
  329. unsubscribeButton.dispatchEvent(clickEvent);
  330. } else {
  331. console.error('Unsubscribe button not found, creating it...');
  332.  
  333. const button = document.querySelector(
  334. 'button.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-m.yt-spec-button-shape-next--icon-leading-trailing'
  335. );
  336. button.click();
  337.  
  338. const observerz = new MutationObserver((mutationsList) => {
  339. mutationsList.forEach((mutation) => {
  340. mutation.addedNodes.forEach((node) => {
  341. if (node.nodeType === Node.ELEMENT_NODE && node.textContent === 'Unsubscribe') {
  342. node.click();
  343. observerz.disconnect();
  344. }
  345. });
  346. });
  347. });
  348.  
  349. observerz.observe(document.body, {
  350. childList: true,
  351. subtree: true
  352. });
  353.  
  354. console.log("Step 1 success!");
  355.  
  356. function wait50ms() {
  357. return new Promise(resolve => setTimeout(resolve, 50));
  358. }
  359.  
  360. wait50ms().then(() => {
  361. const cancelButton = document.querySelector(
  362. 'button.yt-spec-button-shape-next.yt-spec-button-shape-next--text.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-m[aria-label="Cancel"]'
  363. );
  364.  
  365. if (cancelButton) {
  366. cancelButton.click();
  367. console.log("Unsubscribe button created!");
  368.  
  369. if (unsubscribeButton) {
  370. const clickEvent = new MouseEvent('click', {
  371. bubbles: true,
  372. cancelable: true,
  373. view: window
  374. });
  375. unsubscribeButton.dispatchEvent(clickEvent);
  376. } else {
  377. console.error('Failed to find unsubscribe button after cancel.');
  378. }
  379. }
  380. });
  381. }
  382. }
  383. );
  384.  
  385. createToggleButton('Paused', // pausing, self explainitory
  386. () => {
  387. const video = document.querySelector('video');
  388. video.pause();
  389. },
  390. () => {
  391. const video = document.querySelector('video');
  392. video.play();
  393. }
  394. );
  395. // fake likes, reminder do not change the likes first letter to be a character, it breaks the script
  396. function setFakeLikes(value) {
  397. const likesElement = document.querySelectorAll('div[class="yt-spec-button-shape-next__button-text-content"]');
  398.  
  399. likesElement.forEach(element => {
  400. const textContent = element.textContent.trim();
  401.  
  402. if (textContent && !isNaN(textContent[0])) {
  403. element.textContent = value;
  404. }
  405. });
  406. }
  407. // playbackspeed
  408. function setPlaybackSpeed(value) {
  409. const video = document.querySelector("video");
  410. video.playbackRate = value;
  411. }
  412. // set volume
  413. let audioContext;
  414. let gainNode;
  415.  
  416. function setVolume(value) {
  417. const video = document.querySelector("video");
  418. if (!audioContext) {
  419. audioContext = new AudioContext();
  420. }
  421.  
  422. if (!gainNode) {
  423. gainNode = audioContext.createGain();
  424. const source = audioContext.createMediaElementSource(video);
  425. source.connect(gainNode);
  426. gainNode.connect(audioContext.destination);
  427. }
  428. gainNode.gain.value = value;
  429. }
  430. // desc
  431. function setDesc(value) {
  432. const Desc = document.querySelector(
  433. '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);"]'
  434. );
  435. Desc.textContent = value;
  436. }
  437. //fake subs
  438. function setFakeSubs(value) {
  439. const subsElement = document.getElementById('owner-sub-count');
  440. if (subsElement) subsElement.textContent = value;
  441. }
  442.  
  443. //fake pin
  444. function setPinner(value) {
  445. const pinner = document.querySelector('yt-formatted-string#label.style-scope.ytd-pinned-comment-badge-renderer');
  446.  
  447. if (pinner && pinner.id === 'label') {
  448. pinner.textContent = value;
  449. } else {
  450. console.log('404');
  451. }
  452.  
  453. }
  454. // fake views
  455. function setFakeViews(value) {
  456. const viewsElement = document.getElementsByClassName('style-scope yt-formatted-string bold');
  457. if (viewsElement) viewsElement[0].textContent = value;
  458. }
  459. // search placeholder
  460. function setSearch(value) {
  461. const searchInput = document.querySelector('.ytSearchboxComponentInput.yt-searchbox-input.title');
  462. if (searchInput) {
  463. searchInput.placeholder = value;
  464. }
  465. }
  466. // width
  467. function setWidth(value) {
  468. const width = document.querySelector("video");
  469. width.videoWidth = value;
  470. }
  471. //height
  472. function setHeight(value) {
  473. const height = document.querySelector("video");
  474. height.videoHeight = value;
  475. }
  476. //duration
  477. function setDuration(value) {
  478. const duration = document.getElementsByClassName("ytp-time-duration");
  479. const duration2 = document.querySelector('span[class="ytp-time-duration"]')
  480. duration.value = value;
  481. duration.textContent = value;
  482. duration2.textContent = value;
  483. }
  484. //Time watched
  485. function setTime(value) {
  486. const time = document.querySelector("video");
  487. time.currentTime = value;
  488. }
  489. //fake name
  490. function setFakeName(value) {
  491. const nameElement = document.querySelector('a.yt-simple-endpoint.style-scope.yt-formatted-string[spellcheck="false"]');
  492.  
  493. if (nameElement) {
  494. nameElement.textContent = value;
  495. } else {
  496. console.log("Element not found");
  497. }
  498. }
  499. // title changer
  500. function setChangeTitle(value) {
  501. const titleElement = document.querySelector('h1.style-scope.ytd-watch-metadata yt-formatted-string');
  502.  
  503. if (titleElement) {
  504. titleElement.textContent = value;
  505. }
  506. }
  507.  
  508. inputs.forEach(createInputButton);
  509. // dragging script
  510. let isDragging = false;
  511. let offsetX, offsetY;
  512. // minimizing
  513. container.addEventListener('mousedown', (e) => {
  514. if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'BUTTON') {
  515. isDragging = true;
  516. offsetX = e.clientX - container.getBoundingClientRect().left;
  517. offsetY = e.clientY - container.getBoundingClientRect().top;
  518. }
  519. });
  520.  
  521. document.addEventListener('mousemove', (e) => {
  522. if (isDragging) {
  523. container.style.left = `${e.clientX - offsetX}px`;
  524. container.style.top = `${e.clientY - offsetY}px`;
  525. }
  526. });
  527.  
  528. document.addEventListener('mouseup', () => {
  529. isDragging = false;
  530. });
  531.  
  532. let isVisible = true;
  533. document.addEventListener('keydown', (e) => {
  534. if (e.key === 'Insert') {
  535. if (isVisible) {
  536. container.style.display = 'none';
  537. } else {
  538. container.style.display = 'block';
  539. }
  540. isVisible = !isVisible;
  541. }
  542. });
  543.  
  544. // made by theyhoppingonme on discord
  545. })();

QingJ © 2025

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