AIO Side Bar to Floating Windows - grundos.cafe

Moves the AIO Side Bars to separate floating windows.

  1. // ==UserScript==
  2. // @name AIO Side Bar to Floating Windows - grundos.cafe
  3. // @namespace Firestix
  4. // @match https://www.grundos.cafe/*
  5. // @grant GM_log
  6. // @grant GM_addStyle
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @grant GM_registerMenuCommand
  10. // @require https://greasyfork.org/scripts/477480-floatingwindow/code/FloatingWindow.js?version=1270124
  11. // @version 0.0.3
  12. // @author Firestix
  13. // @license MIT
  14. // @description Moves the AIO Side Bars to separate floating windows.
  15. // ==/UserScript==
  16.  
  17. GM_addStyle(`
  18. .floatingWindowTitleBar {
  19. background-color:var(--grid_head);
  20. padding:2px;
  21. line-height:20px;
  22. }
  23. .floatingWindowItemList {
  24. display:flex;
  25. flex-wrap: wrap;
  26. }
  27. `);
  28.  
  29. if (document.getElementById("aio_sidebar")) {
  30. let categories = document.querySelectorAll("#aio_sidebar > div");
  31. for (let x = 0, xlen = categories.length; x < xlen; x++) {
  32. let category = categories[x];
  33. if (!category.className || category.className === "") continue;
  34. let title = category.querySelector(".aio-section-header").innerText;
  35. let subTextElems = category.querySelectorAll(".aioImg > .aio-subtext, .aio-training-links");
  36. let bodyElems = category.querySelectorAll(".aioImg > div");
  37. let fWin = new FloatingWindow(title,{open:false,position:{x:window.innerWidth-200,y:x*24}});
  38. for (let s of subTextElems) {
  39. fWin.body.appendChild(s.cloneNode(true));
  40. }
  41. let flexBody = document.createElement("div");
  42. flexBody.className = "floatingWindowItemList";
  43. for (let b of bodyElems) {
  44. flexBody.appendChild(b.parentElement.removeChild(b));
  45. }
  46. fWin.body.appendChild(flexBody);
  47. }
  48. }