Torn UI Elements (for Developers)

Develop Torn Scripts Faster

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/501645/1492684/Torn%20UI%20Elements%20%28for%20Developers%29.js

  1. // ==UserScript==
  2. // @name Torn UI Elements (for Developers)
  3. // @namespace http://tampermonkey.net/
  4. // @version beta-0.1
  5. // @description Develop Torn Scripts Faster
  6. // @author Jayam Patel
  7. // @match https://www.torn.com/*
  8. // @match https://yata.yt/*
  9. // @icon https://raw.githubusercontent.com/jayam04/torn-scripts/master/tornSpotlightSearch/icon.png
  10. // @license Apache License 2.0
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. /**
  15. * Adds icon to Status Icons for quick navigation.
  16. *
  17. * @param {string} href - The href of the link to be added.
  18. * @param {string} iconURL - The URL of the icon to be added.
  19. *
  20. * @returns {number} - 0 if successful, 1 if unsuccessful.
  21. */
  22. function addIconInStatusIcons(href, iconURL) {
  23. const statusIconsLinks = document.querySelector('[class^="status-icons"]');
  24. if (statusIconsLinks.length == 0) return 1;
  25.  
  26. const iconItem = document.createElement("li");
  27. const iconHref = document.createElement("a");
  28. iconHref.href = href;
  29. iconHref.ariaLabel = "Spotlight Settings";
  30. iconItem.appendChild(iconHref);
  31. iconItem.style.backgroundImage = `url("${iconURL}")`;
  32. iconItem.style.backgroundSize = "100%";
  33. statusIconsLinks.appendChild(iconItem);
  34. return 0;
  35. }

QingJ © 2025

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