F95 Zone Auto Redirect

Will auto redirect when clicking on download links

  1. // ==UserScript==
  2. // @name F95 Zone Auto Redirect
  3. // @namespace http://tampermonkey.net/
  4. // @version 1
  5. // @description Will auto redirect when clicking on download links
  6. // @author https://github.com/IrisV3rm
  7. // @match https://f95zone.to/masked/*
  8. // @icon https://f95zone.to/favicon.ico
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function clickDownloadLink() {
  17. document.title = "Auto | Redirecting..."
  18. const downloadLinks = document.querySelectorAll('.host_link');
  19. if (downloadLinks.length > 0) {
  20. downloadLinks[0].click();
  21. }
  22. }
  23.  
  24. const observer = new MutationObserver(mutations => {
  25. const errorElement = document.querySelector("#error");
  26. if (errorElement && errorElement.children.length > 0) {
  27. clickDownloadLink();
  28. observer.disconnect();
  29. }
  30. });
  31.  
  32. observer.observe(document.body, {
  33. childList: true,
  34. subtree: true
  35. });
  36.  
  37. setTimeout(clickDownloadLink, 50);
  38. })();