Cqmbo Client for YT! 1.1.4

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

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