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. document.querySelector("#changelogTabs").children[3].click();
  17. let span = document.createElement('span'),
  18. check = document.createElement('input');
  19. span.innerText = 'Hide empty Servers';
  20. span.style.display = 'flex';
  21. check.type = 'checkbox';
  22. check.checked = !!localStorage.getItem("hideEmptyServers");
  23. check.style.width = '13px';
  24. check.style.height = '13px';
  25. check.style.marginTop = '0px';
  26. check.style.marginBottom = '0px';
  27. check.oninput = () => {
  28. empties.forEach(x => x.hidden = check.checked);
  29. localStorage.setItem("hideEmptyServers", check.checked ? ' ' : '');
  30. };
  31. span.append(check);
  32. document.getElementById('serverFilterRegion').append(span);
  33. document.getElementById('serverFilterRegion').style.display = 'flex';
  34. //document.getElementById('serverFilterRegion').style.height = '21px';
  35.  
  36. let empties = [],
  37.  
  38. doThing = () => {
  39.  
  40. //i am not sorry that you had to read this code
  41. // https://cdn.discordapp.com/emojis/983734696083075113.png
  42. try {
  43. empties = Array.from(document.getElementById('serverSelector').children).slice(1).filter(x => x.children[2].innerText.split('/')[0] == '0');
  44. check.oninput();
  45.  
  46. let rules = Array.from(Array.from(document.styleSheets).find(x => x.href.includes('arras')).rules),
  47. Ratio = 'Attachment';
  48.  
  49. for (let ruleName of [
  50. '.serverSelector',
  51. '#startMenuSlidingTrigger',
  52. '.slider',
  53. '.shadowScroll',
  54. '.sliderHolder',
  55. '.startMenuHolder.changelogHolder',
  56. '.startMenuHolder',
  57. '.startMenu',
  58. '#startMenuWrapper',
  59. '#patchNotes',
  60. '.mainWrapper'
  61. ]) {
  62. let style = rules.find(x => x.selectorText == ruleName).style;
  63.  
  64. if (ruleName == '.serverSelector' ) {
  65. style.maxHeight = style.height = 'calc(100% - 159px)';
  66. } else if (ruleName == '.slider' ) {
  67. style.maxHeight = style.height = 'min-content';
  68. } else if (ruleName == '.sliderHolder' ) {
  69. style.maxHeight = style.height = 'calc(100% - 50px)';
  70. } else if (ruleName == '.startMenuHolder' ) {
  71. style.maxHeight = style.height = 'calc(100% - 20px)';
  72. } else if (ruleName == '#startMenuSlidingTrigger' ) {
  73. 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';
  74. } else if (ruleName == '.startMenuHolder.changelogHolder' ) {
  75. style.maxHeight = style.height = 'calc(100% - 20px)';
  76. style.display = 'block';
  77. }
  78. if (ruleName == '.startMenu' ) {
  79. style.maxHeight = 'calc(100%)';
  80. style.height = 'calc(100%)';
  81. } else if (ruleName == '#startMenuWrapper' ) {
  82. style.maxHeight = style.height = 'calc(100% - 20px)';
  83. } else if (ruleName == '#patchNotes' ) {
  84. style.height = style.maxHeight = 'calc(100% - 39px)';
  85. } else if (ruleName == '.mainWrapper' ) {
  86. 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()
  87. style.maxHeight = style.height = 'calc(100% - 40px)';
  88. } else if (ruleName == '.shadowScroll' ) {
  89. let L = 'background';
  90. style[L] = style[L + 'Size'] = style[L + 'Color'] = style[L + 'Repeat'] = style[L + Ratio] = '';
  91. }
  92. }
  93.  
  94. //POV: You're using document.querySelector()
  95. // https://youtu.be/mdquYEw36TU
  96. let style = document.querySelector("#startMenuWrapper > div > div.startMenuHolder.mainHolder > div.sliderHolder > div:nth-child(1)").style
  97. style.maxHeight = style.height = 'calc(100% - 315px)';
  98. } catch (err) {}
  99. }
  100.  
  101. doThing();
  102. setInterval(doThing, 1000);