Arras.io - Start Menu Modifier

Makes the start menu better to look at

目前为 2023-03-03 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Arras.io - Start Menu Modifier
  3. // @version 1.2
  4. // @description Makes the start menu better to look at
  5. // @author Taureon
  6. // @run-at document-end
  7. // @match https://arras.io/
  8. // @namespace https://greasyfork.org/users/935758
  9. // ==/UserScript==
  10.  
  11. //hey arras.io devs, i know you can see this
  12. //please make the server selector larger, i have a large enough monitor to render more
  13.  
  14. //unused element that takes up space
  15. document.querySelector('.menuTabs').remove();
  16.  
  17. //instant swap to changelog tab
  18. document.querySelector("#changelogTabs").children[3].click();
  19.  
  20. //inject UI for the hide empty server button
  21. let span = document.createElement('span'),
  22. check = document.createElement('input');
  23. span.innerText = 'Hide empty Servers';
  24. span.style.display = 'flex';
  25. check.type = 'checkbox';
  26. check.checked = !!localStorage.getItem("hideEmptyServers");
  27. check.style.width = '13px';
  28. check.style.height = '13px';
  29. check.style.marginTop = '0px';
  30. check.style.marginBottom = '0px';
  31. check.oninput = () => {
  32. empties.forEach(x => x.hidden = check.checked);
  33. localStorage.setItem("hideEmptyServers", check.checked ? ' ' : '');
  34. };
  35. span.append(check);
  36. document.getElementById('serverFilterRegion').append(span);
  37. document.getElementById('serverFilterRegion').style.display = 'flex';
  38. //document.getElementById('serverFilterRegion').style.height = '21px';
  39.  
  40. let empties = [],
  41.  
  42. doThing = () => {
  43.  
  44. //i am not sorry that you had to read this code
  45. // https://cdn.discordapp.com/emojis/983734696083075113.png
  46. try {
  47. empties = Array.from(document.getElementById('serverSelector').children).slice(1).filter(x => x.children[2].innerText.split('/')[0] == '0');
  48. check.oninput();
  49.  
  50. let rules = Array.from(Array.from(document.styleSheets).find(x => x.href.includes('arras')).rules),
  51. Ratio = 'Attachment';
  52.  
  53. for (let ruleName of [
  54. '.serverSelector',
  55. '#startMenuSlidingTrigger',
  56. '.slider',
  57. '.shadowScroll',
  58. '.sliderHolder',
  59. '.startMenuHolder.changelogHolder',
  60. '.startMenuHolder',
  61. '.startMenu',
  62. '#startMenuWrapper',
  63. '#patchNotes',
  64. '.mainWrapper'
  65. ]) {
  66. let style = rules.find(x => x.selectorText == ruleName).style;
  67.  
  68. if (ruleName == '.serverSelector' ) {
  69. style.maxHeight = style.height = 'calc(100% - 159px)';
  70. } else if (ruleName == '.slider' ) {
  71. style.maxHeight = style.height = 'min-content';
  72. } else if (ruleName == '.sliderHolder' ) {
  73. style.maxHeight = style.height = 'calc(100% - 50px)';
  74. } else if (ruleName == '.startMenuHolder' ) {
  75. style.maxHeight = style.height = 'calc(100% - 20px)';
  76. } else if (ruleName == '#startMenuSlidingTrigger' ) {
  77. style.padding = (-(0x1 * 0x1f2a + 0x8df * -0x4 + 0x6 * 0xb9) * (-0x236 + -0x102 + -0xd3 * -0xa) + (0x1 * 0xc1d + 0x71 * -0x67 + 0x4205 * 0x1) + -(-0x7f1 + 0x17c + -0x2 * -0x33b) * (0x1f32 + -0x11 * 0x1f9 + 0x3b8 * 0x4)) + 'px';
  78. } else if (ruleName == '.startMenuHolder.changelogHolder' ) {
  79. style.maxHeight = style.height = 'calc(100% - 20px)';
  80. style.display = 'block';
  81. }
  82. if (ruleName == '.startMenu' ) {
  83. style.maxHeight = 'calc(100%)';
  84. style.height = 'calc(100%)';
  85. } else if (ruleName == '#startMenuWrapper' ) {
  86. style.maxHeight = style.height = 'calc(100% - 20px)';
  87. } else if (ruleName == '#patchNotes' ) {
  88. style.height = style.maxHeight = 'calc(100% - 39px)';
  89. } else if (ruleName == '.mainWrapper' ) {
  90. style.padding = new Array(Math.floor(Math.PI)).fill(x => "20px").map(y => y()).reduce((a, b) => a + ' ' + b, '20px'); //what the fuck is a .join()
  91. style.maxHeight = style.height = 'calc(100% - 40px)';
  92. } else if (ruleName == '.shadowScroll' ) {
  93. let L = 'background';
  94. style[L] = style[L + 'Size'] = style[L + 'Color'] = style[L + 'Repeat'] = style[L + Ratio] = '';
  95. }
  96. }
  97.  
  98. //POV: You're using document.querySelector()
  99. // https://youtu.be/mdquYEw36TU
  100. let style = document.querySelector("#startMenuWrapper > div > div.startMenuHolder.mainHolder > div.sliderHolder > div:nth-child(1)").style
  101. style.maxHeight = style.height = 'calc(100% - 315px)';
  102. } catch (err) {}
  103. }
  104.  
  105. doThing();
  106. setInterval(doThing, 1000);