open in new tab

This Script makes all EH Galleries mangas open in a new tab

  1. // ==UserScript==
  2. // @name open in new tab
  3. // @namespace Violentmonkey Scripts
  4. // @match https://e-hentai.org/*
  5. // @match https://exhentai.org/*
  6. // @grant none
  7. // @version 1.2
  8. // @author UglyOldLazyBastard
  9. // @license WTFPL http://www.wtfpl.net/faq/
  10. // @description This Script makes all EH Galleries mangas open in a new tab
  11.  
  12. // @require https://cdn.jsdelivr.net/npm/@violentmonkey/dom@2
  13.  
  14. // ==/UserScript==
  15. const elementList1 = document.querySelectorAll('.gl3t a');
  16. const elementList2 = document.querySelectorAll('.gl1t > a');
  17.  
  18. // Function to add target="_blank" attribute
  19. function addTargetBlank(node) {
  20. node.setAttribute('target', '_blank');
  21. }
  22.  
  23. // Apply the function to elements in the first NodeList
  24. elementList1.forEach(addTargetBlank);
  25.  
  26. // Apply the function to elements in the second NodeList
  27. elementList2.forEach(addTargetBlank);