List Tags

Retrieves all HTML tags used on a webpage

  1. // ==UserScript==
  2. // @name List Tags
  3. // @namespace https://github.com/x3ric
  4. // @match https://*/*
  5. // @grant GM_registerMenuCommand
  6. // @version 1.0
  7. // @author x3ric
  8. // @license MIT
  9. // @description Retrieves all HTML tags used on a webpage
  10. // ==/UserScript==
  11. (function() {
  12. 'use strict';
  13. function getAllTags() {
  14. var elements = document.querySelectorAll('*');
  15. var tagCounts = {};
  16. elements.forEach(function(element) {
  17. var tagName = element.tagName.toLowerCase();
  18. if (tagCounts[tagName]) {
  19. tagCounts[tagName]++;
  20. } else {
  21. tagCounts[tagName] = 1;
  22. }
  23. });
  24. return tagCounts;
  25. }
  26. function displayTagCounts() {
  27. var tagCounts = getAllTags();
  28. console.log("Tag Counts:");
  29. console.log(tagCounts);
  30. alert("Tag Counts:\n" + JSON.stringify(tagCounts, null, 2));
  31. }
  32. GM_registerMenuCommand('Show', displayTagCounts);
  33. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址