2014 for Google neocities Part 1

Remove specific nodes from websites containing a specific URL

当前为 2023-07-13 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 2014 for Google neocities Part 1
  3. // @namespace https://vanced-youtube.neocities.org/2013/
  4. // @version 1.0
  5. // @description Remove specific nodes from websites containing a specific URL
  6. // @match *://*/*
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. // Define the node selectors to remove
  14. const selectorsToRemove = [
  15. 'div.nbpr > span.nbprs',
  16. 'div.bg'
  17. ];
  18.  
  19. // Function to remove nodes
  20. function removeNodes() {
  21. selectorsToRemove.forEach(selector => {
  22. const nodes = document.querySelectorAll(selector);
  23. nodes.forEach(node => {
  24. if (node.parentNode) {
  25. node.parentNode.removeChild(node);
  26. }
  27. });
  28. });
  29. }
  30.  
  31. // Check if the current URL contains the target URL
  32. if (window.location.href.includes('https://vanced-youtube.neocities.org/2013/')) {
  33. // Wait for the page to load and then remove the nodes
  34. window.addEventListener('load', removeNodes);
  35. }
  36. })();