Download Subtitles without Waiting

Download subtitles without waiting. Supports My-Subs.co and so on.

  1. // ==UserScript==
  2. // @name Download Subtitles without Waiting
  3. // @namespace https://github.com/lcandy2/user.js/tree/main/websites/my-subs.co/download-subtitles-without-waiting
  4. // @version 1.2
  5. // @author 甜檸Cirtron (lcandy2)
  6. // @description Download subtitles without waiting. Supports My-Subs.co and so on.
  7. // @license AGPL-3.0-or-later
  8. // @copyright lcandy2 All Rights Reserved
  9. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAA7AAAAOwBeShxvQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAJNSURBVFiF5dZbaM9hGAfwz+a/nE2ojXJhF+ZQkgunqMkVKeeWEq5olFpyIS5cKJLDjRxujHazcqHUEtLUFHOBkoSEmCUhYc79Xbzv5k/bf7//YbnYt379np738Hzf5/C+DwMdJfFfhiWoRmkR93+Ji3iXjcBYXMJk3MW3IhkvxdRoYzlu9TbxNG5jXJEMZ6IMDXgki2c7UNsPxrswHmlM6WmwFJV43Y8EOuK/sjcC/xW5EEjhDI6gvJgk0qhJMK86zk2jHSuKYSMXDwzKkCfgPJqETM8bheZALar+F4GPqMPDQgikcpjbmSE3R+MvCjGeK4Fn2IT3uFCo4UwkrYKeMAG79X2QrFWQ9udVzBVzsA+NCUj0iBSeYBpaEq5ZhNlRni68nouFsryeZd06gTD8QhtaS7AL9diAq/iRZZMdOICb+Bp1D3EK+zE44SGGYG7cTwpHI6t0gq8uoZG+sBXtmbEvxwzZT3FFCME1zBSq4i1O4g3W4z7uoAIbcTDOm4cvgrceCEmZNOzd6MrmMfiEy9FgcxxvxZ4oL8XnKLcJYWvFUyHpa5DO9yYciWGCJ2qwNsGax7gh9AXdFZMvgefYjC3CidYkWLNaiPt3TCyUQIXQZFbhMA5FfSdGRHmUvytqL0YL3dfKLmVel4eQiI1CNz0V96K+CSeibiHOZaxZhVmYJDTBBRFoEnq9ZYInjkV9Az5EgjtxNuqPYz5+RiIt8rz+XwlxLAa2+eceSILtQszbhJrOF0OFa7k+n0dogeDi4QUQ+CyEIdvbMUDwG8Y/gAllrDkCAAAAAElFTkSuQmCC
  10. // @homepage https://greasyfork.org/scripts/495404
  11. // @homepageURL https://greasyfork.org/scripts/495404
  12. // @source https://github.com/lcandy2/user.js/tree/main/websites/my-subs.co/download-subtitles-without-waiting
  13. // @match *://my-subs.co/downloads/*
  14. // @run-at document-end
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. 'use strict';
  19.  
  20. function removeTimingScripts() {
  21. const scripts = document.querySelectorAll("script");
  22. scripts.forEach((script) => {
  23. if (script.innerHTML.includes("#timer")) {
  24. script.remove();
  25. }
  26. });
  27. countDownInterval && clearInterval(countDownInterval);
  28. }
  29. function removeTimingElements() {
  30. const elements = document.querySelectorAll(".countdown");
  31. elements.forEach((element) => {
  32. element.remove();
  33. });
  34. }
  35. function makeDownloadAvaliable() {
  36. const downloadBtnElement = downloadBtn || document.querySelector("#downloadBtn");
  37. downloadBtnElement && downloadBtnElement.removeAttribute("disabled");
  38. }
  39. function addBrandization() {
  40. var _a;
  41. const counterDownElement = counterDown || document.querySelector("#countdown");
  42. if (counterDownElement) {
  43. const span = counterDownElement.querySelector("span");
  44. if (span) {
  45. const p1 = document.createElement("p");
  46. const style = span.getAttribute("style");
  47. style && p1.setAttribute("style", style);
  48. p1.textContent = "Download subtitles now! without any waiting!";
  49. counterDownElement.replaceChild(p1, span);
  50. const p2 = document.createElement("p");
  51. style && p2.setAttribute("style", style);
  52. p2.style.fontWeight = "normal";
  53. p2.innerHTML = `by <a href="https://greasyfork.org/scripts/495403" target="_blank">[Download Subtitles without Waiting]</a>, A <a href="https://github.com/lcandy2" target="_blank">甜檸Cirtron@lcandy2</a>'s project.`;
  54. counterDownElement.appendChild(p2);
  55. }
  56. }
  57. const brandizationElement = counterDownElement == null ? void 0 : counterDownElement.cloneNode(true);
  58. if (brandizationElement) {
  59. (_a = counterDownElement == null ? void 0 : counterDownElement.parentNode) == null ? void 0 : _a.replaceChild(
  60. brandizationElement,
  61. counterDownElement
  62. );
  63. }
  64. }
  65. removeTimingScripts();
  66. addBrandization();
  67. removeTimingElements();
  68. makeDownloadAvaliable();
  69.  
  70. })();