Greasy Fork is available in English.

Cqmbo Client for YT!

Anti - Adblocker Removal, Download Video, Auto Like & More!

  1. // ==UserScript==
  2. // @name Cqmbo Client for YT!
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Anti - Adblocker Removal, Download Video, Auto Like & More!
  6. // @author Cqmbo__
  7. // @match https://www.youtube.com/*
  8. // @icon https://yt3.googleusercontent.com/ofXbHpiwGc4bYnwwljjZJo53E7JRODr-SG32NPV1W6QiUnGUtVAYDwTP2NMz2pUPGnt99Juh5w=s160-c-k-c0x00ffffff-no-rj
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16.  
  17. var removalInterval;
  18. var isRemoving = false;
  19. var removeAdsInterval
  20. var isRemovingAds = false;
  21. var autoLikeInterval;
  22. var isAutoLiking = false;
  23. var autoDislikeInterval;
  24. var isAutoDisliking = false;
  25. var repeatVideoInterval;
  26. var isRepeating = false;
  27. var autoSubscribeInterval;
  28. var isAutoSubscribing = false;
  29. var ishidden = false;
  30.  
  31. function toggleelements(){
  32. const elements = [
  33. 'download-button',
  34. 'screenshot-button',
  35. 'thumbnail-button',
  36. 'repeat-button',
  37. 'youtubelabel',
  38. 'youtubeinput',
  39. 'auto-subscribe-button',
  40. 'colored-ui-button',
  41. 'auto-dislike-button',
  42. 'auto-like-button',
  43. 'removeads-button',
  44. 'removal-button',
  45. ];
  46.  
  47. elements.forEach(id => {
  48. const toggleableelement = document.getElementById(id);
  49. if (toggleableelement) {
  50. toggleableelement.style.display = toggleableelement.style.display === 'none' ? 'block' : 'none';
  51. }
  52. });
  53. }
  54.  
  55.  
  56. var toggleelementbutton = document.createElement('button');
  57. toggleelementbutton.id = 'toggle-element-button';
  58. toggleelementbutton.textContent = 'Hide Menu';
  59. toggleelementbutton.style.position = 'fixed';
  60. toggleelementbutton.style.top = '520px';
  61. toggleelementbutton.style.right = '10px';
  62. toggleelementbutton.style.zIndex = '10000';
  63. toggleelementbutton.title = 'Toggle Menu/Functions';
  64.  
  65. toggleelementbutton.addEventListener('click', function() {
  66. if (!ishidden) {
  67. toggleelementbutton.textContent = 'Show Menu';
  68. toggleelements();
  69. ishidden = true;
  70. } else {
  71. toggleelementbutton.textContent = 'Hide Menu';
  72. toggleelements();
  73. ishidden = false;
  74. }
  75. });
  76.  
  77. document.body.appendChild(toggleelementbutton);
  78.  
  79.  
  80. function startRemovingElement() {
  81. removalInterval = setInterval(function() {
  82. var element1 = document.querySelector('.style-scope.yt-playability-error-supported-renderers');
  83. if (element1) {
  84. element1.remove();
  85. }
  86. }, 100);
  87. isRemoving = true;
  88. }
  89.  
  90. function stopRemovingElement() {
  91. clearInterval(removalInterval);
  92. isRemoving = false;
  93. }
  94.  
  95. var removalButton = document.createElement('button');
  96. removalButton.id = 'removal-button';
  97. removalButton.textContent = 'Remove Anti-Adblocker (Disabled)';
  98. removalButton.style.position = 'fixed';
  99. removalButton.style.top = '160px';
  100. removalButton.style.right = '10px';
  101. removalButton.style.zIndex = '10000';
  102. removalButton.title = 'Remove Anti-Adblocker';
  103.  
  104. removalButton.addEventListener('click', function() {
  105. if (!isRemoving) {
  106. removalButton.textContent = 'Remove Anti-Adblocker (Enabled)';
  107. startRemovingElement();
  108. } else {
  109. removalButton.textContent = 'Remove Anti-Adblocker (Disabled)';
  110. stopRemovingElement();
  111. }
  112. });
  113.  
  114. document.body.appendChild(removalButton);
  115.  
  116. var autoLikeButton = document.createElement('button');
  117. autoLikeButton.id = 'auto-like-button';
  118. autoLikeButton.textContent = 'Auto Like (Disabled)';
  119. autoLikeButton.style.position = 'fixed';
  120. autoLikeButton.style.top = '410px';
  121. autoLikeButton.style.right = '10px';
  122. autoLikeButton.style.zIndex = '10000';
  123. autoLikeButton.title = 'Automatically like video every 10 seconds';
  124.  
  125. autoLikeButton.addEventListener('click', function() {
  126. if (!isAutoLiking) {
  127. autoLikeButton.textContent = 'Auto Like (Enabled)';
  128. startAutoLiking();
  129. } else {
  130. autoLikeButton.textContent = 'Auto Like (Disabled)';
  131. stopAutoLiking();
  132. }
  133. });
  134.  
  135. document.body.appendChild(autoLikeButton);
  136.  
  137. function startAutoLiking() {
  138. clickLikeButton(); // Click immediately when enabled
  139. autoLikeInterval = setInterval(clickLikeButton, 10000);
  140. isAutoLiking = true;
  141. }
  142.  
  143. function stopAutoLiking() {
  144. clearInterval(autoLikeInterval);
  145. isAutoLiking = false;
  146. }
  147.  
  148.  
  149. function clickLikeButton() {
  150. var dislikeButton = document.querySelector('.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-button.yt-spec-button-shape-next--segmented-end');
  151. var likeButton = document.querySelector('.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.yt-spec-button-shape-next--segmented-start');
  152. if (likeButton && likeButton.getAttribute('aria-pressed') === 'false' && !isAutoDisliking && dislikeButton && dislikeButton.getAttribute('aria-pressed') === 'false') {
  153. likeButton.click();
  154. }
  155. var ShortsdislikeButton = document.querySelector('[aria-label="Dislike this video"]');
  156. var ShortslikeButton = document.querySelector('.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-l.yt-spec-button-shape-next--icon-button');
  157. var DislikeButtonConfirmer = 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-l.yt-spec-button-shape-next--icon-button');
  158. if (ShortslikeButton && ShortslikeButton.getAttribute('aria-pressed') === 'false' && !isAutoDisliking && ShortsdislikeButton && !DislikeButtonConfirmer) {
  159. ShortslikeButton.click();
  160. }
  161. }
  162.  
  163. var autoDislikeButton = document.createElement('button');
  164. autoDislikeButton.id = 'auto-dislike-button';
  165. autoDislikeButton.textContent = 'Auto Dislike (Disabled)';
  166. autoDislikeButton.style.position = 'fixed';
  167. autoDislikeButton.style.top = '500px';
  168. autoDislikeButton.style.right = '10px';
  169. autoDislikeButton.style.zIndex = '10000';
  170. autoDislikeButton.title = 'Automatically dislike video every 10 seconds';
  171.  
  172. autoDislikeButton.addEventListener('click', function() {
  173. if (!isAutoDisliking) {
  174. autoDislikeButton.textContent = 'Auto Dislike (Enabled)';
  175. startAutoDisliking();
  176. } else {
  177. autoDislikeButton.textContent = 'Auto Dislike (Disabled)';
  178. stopAutoDisliking();
  179. }
  180. });
  181.  
  182. document.body.appendChild(autoDislikeButton);
  183.  
  184. function startAutoDisliking() {
  185. clickDislikeButton(); // Click immediately when enabled
  186. autoDislikeInterval = setInterval(clickDislikeButton, 10000);
  187. isAutoDisliking = true;
  188. }
  189.  
  190. function stopAutoDisliking() {
  191. clearInterval(autoDislikeInterval);
  192. isAutoDisliking = false;
  193. }
  194.  
  195. function clickDislikeButton() {
  196. var dislikeButton = document.querySelector('.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-button.yt-spec-button-shape-next--segmented-end');
  197. var likeButton = document.querySelector('.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.yt-spec-button-shape-next--segmented-start');
  198. if (dislikeButton && dislikeButton.getAttribute('aria-pressed') === 'false' && !isAutoLiking && likeButton && likeButton.getAttribute('aria-pressed') === 'false') {
  199. dislikeButton.click();
  200. }
  201. var ShortsdislikeButton = document.querySelector('[aria-label="Dislike this video"]');
  202. var ShortslikeButton = document.querySelector('.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-l.yt-spec-button-shape-next--icon-button');
  203. var DislikeButtonConfirmer = 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-l.yt-spec-button-shape-next--icon-button');
  204. if (ShortsdislikeButton && !isAutoLiking && ShortslikeButton && ShortslikeButton.getAttribute('aria-pressed') === 'false' && !DislikeButtonConfirmer) {
  205. ShortsdislikeButton.click();
  206. }
  207. }
  208.  
  209. var validButtons = true;
  210. // Create the screenshot button
  211. const screenshotButton = document.createElement('button');
  212. screenshotButton.id = 'screenshot-button';
  213. screenshotButton.title = 'Screenshot Video at Current Timestamp';
  214. screenshotButton.style.position = 'fixed';
  215. screenshotButton.style.top = '210px';
  216. screenshotButton.style.right = '10px';
  217. screenshotButton.style.zIndex = '10000';
  218. screenshotButton.style.backgroundColor = '#4caf50';
  219. screenshotButton.style.color = 'white';
  220.  
  221. // Create and append the screenshot icon
  222. const screenshotIcon = document.createElement('img');
  223. screenshotIcon.src = 'https://static-00.iconduck.com/assets.00/screenshot-icon-512x512-hmhvvh50.png';
  224. screenshotIcon.alt = 'Screenshot';
  225. screenshotIcon.style.width = '24px';
  226. screenshotIcon.style.height = '24px';
  227. screenshotButton.appendChild(screenshotIcon);
  228.  
  229. // Create the thumbnail button
  230. const thumbnailButton = document.createElement('button');
  231. thumbnailButton.id = 'thumbnail-button';
  232. thumbnailButton.title = 'Download Video Thumbnail';
  233. thumbnailButton.style.position = 'fixed';
  234. thumbnailButton.style.top = '255px';
  235. thumbnailButton.style.right = '10px';
  236. thumbnailButton.style.zIndex = '10000';
  237. thumbnailButton.style.backgroundColor = '#ff5722';
  238. thumbnailButton.style.color = 'white';
  239.  
  240. // Create and append the thumbnail icon
  241. const thumbnailIcon = document.createElement('img');
  242. thumbnailIcon.src = 'https://th.bing.com/th/id/R.5d0756cfcc115698fa5571019979269b?rik=CyyaHNz7YvDWyQ&pid=ImgRaw&r=0';
  243. thumbnailIcon.alt = 'Thumbnail';
  244. thumbnailIcon.style.width = '24px';
  245. thumbnailIcon.style.height = '24px';
  246. thumbnailButton.appendChild(thumbnailIcon);
  247.  
  248. // Create the download button
  249. const downloadButton = document.createElement('button');
  250. downloadButton.id = 'download-button';
  251. downloadButton.title = 'Download Video';
  252. downloadButton.style.position = 'fixed';
  253. downloadButton.style.top = '300px';
  254. downloadButton.style.right = '10px';
  255. downloadButton.style.zIndex = '10000';
  256. downloadButton.style.backgroundColor = '#2196F3';
  257. downloadButton.style.color = 'white';
  258.  
  259. // Create and append the download icon
  260. const downloadIcon = document.createElement('img');
  261. downloadIcon.src = 'https://th.bing.com/th/id/OIP.tdSxNLAn5NVt39tvjk9tIAHaHa?w=159&h=180&c=7&r=0&o=5&pid=1.7';
  262. downloadIcon.alt = 'Download';
  263. downloadIcon.style.width = '24px';
  264. downloadIcon.style.height = '24px';
  265. downloadButton.appendChild(downloadIcon);
  266.  
  267.  
  268. // Create the speed button
  269. const speedButton = document.createElement('button');
  270. speedButton.id = 'speed-button';
  271. speedButton.title = 'Modify Speed of Video';
  272. speedButton.style.position = 'fixed';
  273. speedButton.style.top = '345px';
  274. speedButton.style.right = '10px';
  275. speedButton.style.zIndex = '10000';
  276. speedButton.style.backgroundColor = '#ffff00';
  277. speedButton.style.color = 'white';
  278.  
  279. // Create and append the speed icon
  280. const speedIcon = document.createElement('img');
  281. speedIcon.src = 'https://th.bing.com/th/id/OIP.FqXL96sm01sDe4pfJAl0cwHaHa?w=180&h=180&c=7&r=0&o=5&pid=1.7';
  282. speedIcon.alt = 'Speed';
  283. speedIcon.style.width = '24px';
  284. speedIcon.style.height = '24px';
  285. speedButton.appendChild(speedIcon);
  286.  
  287.  
  288. function renderizarContenido() {
  289. if (validButtons) {
  290. validButtons = false;
  291. // Append the buttons to the body
  292. document.body.appendChild(screenshotButton);
  293. document.body.appendChild(thumbnailButton);
  294. document.body.appendChild(speedButton);
  295. document.body.appendChild(downloadButton);
  296.  
  297. // Attach event listeners for buttons
  298. attachButtonListeners();
  299. }
  300. }
  301.  
  302. function attachButtonListeners() {
  303. const screenShotButton = document.getElementById('screenshot-button');
  304. if (screenShotButton) {
  305. screenShotButton.onclick = () => {
  306. const video = document.querySelector('video');
  307. const canvas = document.createElement('canvas');
  308. canvas.width = video.videoWidth;
  309. canvas.height = video.videoHeight;
  310. const context = canvas.getContext('2d');
  311. context.drawImage(video, 0, 0, canvas.width, canvas.height);
  312. const imagenURL = canvas.toDataURL('image/png');
  313. const linkDownload = document.createElement('a');
  314. linkDownload.href = imagenURL;
  315. const titleVideo = document.querySelector('h1.style-scope.ytd-watch-metadata').innerText;
  316. linkDownload.download = `${video.currentTime.toFixed(0)}s_${titleVideo}.png`;
  317. linkDownload.click();
  318. };
  319. }
  320.  
  321. const downloadButton = document.getElementById('download-button');
  322. if (downloadButton) {
  323. downloadButton.onclick = () => {
  324. let currentUrl = window.location.href;
  325.  
  326. // Check if the URL contains 'shorts/' and replace it with 'watch?v='
  327. if (currentUrl.includes('/shorts/')) {
  328. currentUrl = currentUrl.replace('/shorts/', '/watch?v=');
  329. }
  330.  
  331. const CutURL = new URLSearchParams(new URL(currentUrl).search);
  332. let enlace = CutURL.get('v');
  333.  
  334. if (enlace) {
  335. window.open(
  336. `https://www.y2mate.com/en/convert-youtube/${enlace}`,
  337. 'popUpWindow',
  338. 'height=800,width=1000,left=50%,top=100,resizable=no,scrollbars=yes,toolbar=no,menubar=yes,location=no,directories=yes,status=no'
  339. );
  340. } else {
  341. alert('No video ID found in the URL.');
  342. }
  343. };
  344. }
  345.  
  346. const thumbnailButton = document.getElementById('thumbnail-button');
  347. if (thumbnailButton) {
  348. thumbnailButton.onclick = () => {
  349. let currentUrl = window.location.href;
  350.  
  351. // Check if the URL contains 'shorts/' and replace it with 'watch?v='
  352. if (currentUrl.includes('/shorts/')) {
  353. currentUrl = currentUrl.replace('/shorts/', '/watch?v=');
  354. }
  355.  
  356. const CutURL = new URLSearchParams(new URL(currentUrl).search);
  357. let enlace = CutURL.get('v');
  358.  
  359. if (enlace) {
  360. const maxResImageUrl = `https://i1.ytimg.com/vi/${enlace}/maxresdefault.jpg`;
  361. const highQualityImageUrl = `https://i1.ytimg.com/vi/${enlace}/hqdefault.jpg`;
  362.  
  363. fetchImage(maxResImageUrl)
  364. .catch(() => fetchImage(highQualityImageUrl))
  365. .catch((error) => {
  366. alert('No image found');
  367. console.error('Error getting image:', error);
  368. });
  369. }
  370. };
  371. }
  372. var ans = '';
  373. const speedbutton = document.getElementById('speed-button');
  374. speedbutton.onclick = () => {
  375. ans = prompt('How much do you want to in/decrease the speed of your video? 1 is default.');
  376. document.getElementsByTagName('video')[0].playbackRate = Number(ans);
  377. }
  378. }
  379.  
  380. function fetchImage(imageUrl) {
  381. return fetch(imageUrl)
  382. .then((response) => {
  383. if (!response.ok) {
  384. throw new Error(`HTTP error! Status: ${response.status}`);
  385. }
  386. return response.blob();
  387. })
  388. .then((blob) => {
  389. const imageSizeKB = blob.size / 1024;
  390.  
  391. if (imageSizeKB >= 20) {
  392. window.open(
  393. imageUrl,
  394. 'popUpWindow',
  395. 'height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes'
  396. );
  397.  
  398. const imageUrlObject = URL.createObjectURL(blob);
  399. const linkDownload = document.createElement('a');
  400. linkDownload.href = imageUrlObject;
  401. const titleVideo = document.querySelector('h1.style-scope.ytd-watch-metadata').innerText;
  402. linkDownload.download = `thumbnail_${titleVideo}.jpg`;
  403. linkDownload.click();
  404. } else {
  405. alert('No image found');
  406. throw new Error('No image found');
  407. }
  408. });
  409. }
  410.  
  411.  
  412.  
  413.  
  414. function observeDOM() {
  415. const observer = new MutationObserver(mutations => {
  416. mutations.forEach(mutation => {
  417. if (mutation.type === 'childList' && mutation.addedNodes.length) {
  418. renderizarContenido();
  419. }
  420. });
  421. });
  422.  
  423. observer.observe(document.body, { childList: true, subtree: true });
  424. }
  425.  
  426. observeDOM();
  427.  
  428. var coloredElements = ['video-title', 'style-scope ytd-watch-metadata'];
  429. var whiteElements = ['primary'];
  430.  
  431. const rainbowColors = ['#ff0000', '#ff7f00', '#ffff00', '#00ff00', '#0000ff', '#4b0082', '#9400d3'];
  432.  
  433. let currentColor = 'black'; // Default color
  434. let savedCustomColor = 'black'; // Save custom color to restore it later
  435. let isCustomColorEnabled = false;
  436. let isRainbowEnabled = false;
  437. let isColoredUIEnabled = false;
  438. let rainbowFlashInterval;
  439.  
  440. function toggleColoredUI() {
  441. const button = document.getElementById('colored-ui-button');
  442. if (!isColoredUIEnabled) {
  443. isColoredUIEnabled = true;
  444. button.textContent = 'Colored UI (Enabled)';
  445. createColoredUIDropdown();
  446. if (isCustomColorEnabled) {
  447. applyCustomColor(savedCustomColor);
  448. } else if (isRainbowEnabled) {
  449. startRainbowFlash();
  450. } else {
  451. applyCustomColor(currentColor);
  452. }
  453. } else {
  454. isColoredUIEnabled = false;
  455. button.textContent = 'Colored UI (Disabled)';
  456. removeColoredUIDropdown();
  457. applyCustomColor('black');
  458. stopRainbowFlash();
  459. }
  460. }
  461.  
  462. function createColoredUIDropdown() {
  463. const dropdown = document.createElement('div');
  464. dropdown.id = 'colored-ui-dropdown';
  465. dropdown.style.position = 'fixed';
  466. dropdown.style.top = '360px';
  467. dropdown.style.right = '10px';
  468. dropdown.style.zIndex = '10000';
  469.  
  470. const label = document.createElement('div');
  471. label.textContent = 'Select Color:';
  472. dropdown.appendChild(label);
  473.  
  474. const defaultOption = createOptionElement('Black (Default)', 'black');
  475. const customOption = createOptionElement('Custom Color', 'custom');
  476. const rainbowOption = createOptionElement('Rainbow Flash', 'rainbow');
  477. const dropdownMenu = document.createElement('select');
  478. dropdownMenu.id = 'colored-ui-dropdown-menu';
  479. dropdownMenu.appendChild(defaultOption);
  480. dropdownMenu.appendChild(customOption);
  481. dropdownMenu.appendChild(rainbowOption);
  482. dropdown.appendChild(dropdownMenu);
  483.  
  484. if (isCustomColorEnabled) {
  485. dropdownMenu.value = 'custom';
  486. } else if (isRainbowEnabled) {
  487. dropdownMenu.value = 'rainbow';
  488. } else {
  489. dropdownMenu.value = currentColor;
  490. }
  491.  
  492. dropdownMenu.addEventListener('change', function() {
  493. const selectedColor = this.value;
  494. if (selectedColor === 'custom') {
  495. isCustomColorEnabled = true;
  496. stopRainbowFlash();
  497. openCustomColorPicker();
  498. } else if (selectedColor === 'rainbow') {
  499. isRainbowEnabled = true;
  500. isCustomColorEnabled = false;
  501. startRainbowFlash();
  502. } else {
  503. isCustomColorEnabled = false;
  504. stopRainbowFlash();
  505. applyCustomColor(selectedColor);
  506. }
  507. });
  508.  
  509. document.body.appendChild(dropdown);
  510. }
  511.  
  512. function removeColoredUIDropdown() {
  513. const dropdown = document.getElementById('colored-ui-dropdown');
  514. if (dropdown) {
  515. dropdown.remove();
  516. }
  517. }
  518.  
  519. function createOptionElement(text, value) {
  520. const option = document.createElement('option');
  521. option.text = text;
  522. option.value = value;
  523. return option;
  524. }
  525.  
  526. function openCustomColorPicker() {
  527. if (document.getElementById('custom-color-picker')) {
  528. return;
  529. }
  530.  
  531. const customColorPicker = document.createElement('input');
  532. customColorPicker.type = 'color';
  533. customColorPicker.id = 'custom-color-picker';
  534. customColorPicker.style.position = 'fixed';
  535. customColorPicker.style.top = '395px';
  536. customColorPicker.style.right = '10px';
  537. customColorPicker.style.zIndex = '10000';
  538.  
  539. customColorPicker.addEventListener('input', function() {
  540. const selectedColor = this.value;
  541. currentColor = selectedColor;
  542. savedCustomColor = selectedColor;
  543. applyCustomColor(selectedColor);
  544. });
  545.  
  546. document.body.appendChild(customColorPicker);
  547. }
  548.  
  549. function applyCustomColor(color) {
  550. coloredElements.forEach(elementId => {
  551. const elements = document.getElementsByClassName(elementId);
  552. for (let element of elements) {
  553. element.style.color = color;
  554. }
  555. });
  556.  
  557. whiteElements.forEach(elementId => {
  558. const elements = document.getElementsByClassName(elementId);
  559. for (let element of elements) {
  560. element.style.color = (isColoredUIEnabled && (isCustomColorEnabled || isRainbowEnabled)) ? color : 'white';
  561. }
  562. });
  563.  
  564. currentColor = color;
  565. }
  566.  
  567. function startRainbowFlash() {
  568. if (rainbowFlashInterval) {
  569. clearInterval(rainbowFlashInterval);
  570. }
  571. let currentIndex = 0;
  572.  
  573. rainbowFlashInterval = setInterval(() => {
  574. const currentColor = rainbowColors[currentIndex];
  575. applyCustomColor(currentColor);
  576. currentIndex = (currentIndex + 1) % rainbowColors.length;
  577. }, 500);
  578. }
  579.  
  580. function stopRainbowFlash() {
  581. clearInterval(rainbowFlashInterval);
  582. isRainbowEnabled = false;
  583. if (!isColoredUIEnabled) {
  584. applyCustomColor('black');
  585. } else if (isCustomColorEnabled) {
  586. applyCustomColor(savedCustomColor);
  587. } else {
  588. applyCustomColor(currentColor);
  589. }
  590. }
  591.  
  592. function toggleElement() {
  593. const elementToToggle = [
  594. 'custom-color-picker'
  595. ];
  596.  
  597. elementToToggle.forEach(id => {
  598. const element = document.getElementById(id);
  599. if (element) {
  600. element.style.display = element.style.display === 'none' ? 'block' : 'none';
  601. }
  602. });
  603. }
  604.  
  605. function createColoredUIButton() {
  606. if (document.getElementById('colored-ui-button')) {
  607. return;
  608. }
  609.  
  610. const button = document.createElement('button');
  611. button.id = 'colored-ui-button';
  612. button.textContent = 'Colored UI (Disabled)';
  613. button.style.position = 'fixed';
  614. button.style.top = '480px';
  615. button.style.right = '10px';
  616. button.title = 'Color Selected Elements';
  617. button.style.zIndex = '10000';
  618.  
  619. button.addEventListener('click', toggleElement);
  620. button.addEventListener('click', toggleColoredUI);
  621.  
  622. document.body.appendChild(button);
  623. }
  624.  
  625. createColoredUIButton();
  626.  
  627. // New background function
  628. function createBackgroundFunctionality() {
  629. const youtubeLabel = document.createElement('label');
  630. youtubeLabel.textContent = 'Background Image:';
  631. youtubeLabel.style.position = 'fixed';
  632. youtubeLabel.style.top = '430px';
  633. youtubeLabel.style.right = '10px';
  634. youtubeLabel.style.zIndex = '10000';
  635. youtubeLabel.id = 'youtubelabel';
  636. youtubeLabel.style.color = 'red';
  637.  
  638. const youtubeInput = document.createElement('input');
  639. youtubeInput.type = 'text';
  640. youtubeInput.placeholder = 'Paste image URL here...';
  641. youtubeInput.style.position = 'fixed';
  642. youtubeInput.style.top = '460px';
  643. youtubeInput.style.right = '10px';
  644. youtubeInput.style.zIndex = '10000';
  645. youtubeInput.id = 'youtubeinput';
  646.  
  647. youtubeInput.addEventListener('keydown', function(event) {
  648. if (event.key === 'Enter') {
  649. const url = youtubeInput.value;
  650. console.log('URL Entered:', url); // Debugging line
  651. if (url) {
  652. setBackground(url);
  653. } else {
  654. clearBackground();
  655. }
  656. }
  657. });
  658.  
  659. document.body.appendChild(youtubeLabel);
  660. document.body.appendChild(youtubeInput);
  661. }
  662.  
  663. function setBackground(url) {
  664. const primaryInner = document.getElementById('primary-inner');
  665. console.log('Setting background for primary-inner with URL:', url); // Debugging line
  666. if (primaryInner) {
  667. primaryInner.style.backgroundImage = `url(${url})`;
  668. primaryInner.style.backgroundSize = 'cover';
  669. primaryInner.style.backgroundPosition = 'center';
  670. }
  671. }
  672.  
  673. function clearBackground() {
  674. const primaryInner = document.getElementById('primary-inner');
  675. console.log('Clearing background for primary-inner'); // Debugging line
  676. if (primaryInner) {
  677. primaryInner.style.backgroundImage = '';
  678. }
  679. }
  680.  
  681. createBackgroundFunctionality();
  682.  
  683. var autoSubscribeButton = document.createElement('button');
  684. autoSubscribeButton.id = 'auto-subscribe-button';
  685. autoSubscribeButton.textContent = 'Auto Subscribe (Disabled)';
  686. autoSubscribeButton.style.position = 'fixed';
  687. autoSubscribeButton.style.top = '120px';
  688. autoSubscribeButton.style.right = '10px';
  689. autoSubscribeButton.style.zIndex = '10000';
  690. autoSubscribeButton.title = 'Automatically subscribe to channels';
  691.  
  692. autoSubscribeButton.addEventListener('click', function() {
  693. if (!isAutoSubscribing) {
  694. autoSubscribeButton.textContent = 'Auto Subscribe (Enabled)';
  695. startAutoSubscribing();
  696. } else {
  697. autoSubscribeButton.textContent = 'Auto Subscribe (Disabled)';
  698. stopAutoSubscribing();
  699. }
  700. });
  701.  
  702. document.body.appendChild(autoSubscribeButton);
  703.  
  704. function startAutoSubscribing() {
  705. clickSubscribeButton(); // Click immediately when enabled
  706. autoSubscribeInterval = setInterval(clickSubscribeButton, 10000);
  707. isAutoSubscribing = true;
  708. }
  709.  
  710. function stopAutoSubscribing() {
  711. clearInterval(autoSubscribeInterval);
  712. isAutoSubscribing = false;
  713. }
  714.  
  715. function clickSubscribeButton() {
  716. var subscribeButton = document.querySelector('[aria-label^="Subscribe to"]');
  717. if (subscribeButton && subscribeButton.textContent.includes('Subscribe')) {
  718. subscribeButton.click();
  719. }
  720. }
  721.  
  722.  
  723. })();