Torn Better UI

Make Torn Beautiful

当前为 2024-12-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Torn Better UI
  3. // @namespace http://tampermonkey.net/
  4. // @version alpha-1.1
  5. // @description Make Torn Beautiful
  6. // @author Jayam Patel
  7. // @match https://www.torn.com/*
  8. // @icon https://raw.githubusercontent.com/jayam04/torn-scripts/master/tornBetterUI/icon.png
  9. // @license Apache License 2.0
  10. // @grant none
  11. // @require https://update.greasyfork.org/scripts/501645/1416051/Torn%20UI%20Elements%20%28for%20Developers%29.js
  12. // @require https://update.greasyfork.org/scripts/501648/1416074/Constants%20for%20Torn%20Scripts%20%28for%20Developers%29.js
  13. // ==/UserScript==
  14.  
  15. function realignTornUI() {
  16. const mainContainer = document.getElementById("mainContainer");
  17. mainContainer.style.marginLeft = "20px";
  18.  
  19. // TODO: make this more robust.
  20. // TODO: make this more efficient, currently, it takes time and shift is visible on every page reload.
  21. const mainContentContainer =
  22. document.getElementsByClassName("content-wrapper")[0];
  23. const topHeaderContainer =
  24. document.getElementsByClassName("header-wrapper-top")[0];
  25. const topHeaderContainerChild = topHeaderContainer.children[0];
  26. topHeaderContainerChild.style.marginLeft = "20px";
  27.  
  28. const bottomHeaderContainer = document.getElementsByClassName(
  29. "header-wrapper-bottom"
  30. )[0];
  31. const bottomHeaderContainerChild = bottomHeaderContainer.children[0];
  32. bottomHeaderContainerChild.style.marginLeft = "20px";
  33. }
  34.  
  35. function updateFont() {
  36. const mainContainer = document.getElementById("mainContainer");
  37. mainContainer.style.fontFamily = "Pangolin";
  38. }
  39.  
  40. function main() {
  41. realignTornUI();
  42. }
  43.  
  44. main();