Advertisement
MeKLiN2

Untitled

Oct 8th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Left-handed Stumblechat
  3. // @namespace https://greasyfork.org/en/users/1244737
  4. // @version 1.4
  5. // @description Makes the messages only use 1 line and sets chat div position to fixed with bottom-left alignment.
  6. // @author meklin and robomoist
  7. // @license MIT
  8. // @grant GM_addStyle
  9. // @run-at document-start
  10. // @match https://stumblechat.com/room/*
  11. // @downloadURL https://update.greasyfork.org/scripts/510473/Left-handed%20Stumblechat.user.js
  12. // @updateURL https://update.greasyfork.org/scripts/510473/Left-handed%20Stumblechat.meta.js
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. let css = `
  17. .message .nickname ~ .content {
  18. display: inline-block;
  19. top: -7px;
  20. position: relative;
  21. margin-left: 2px;
  22. margin-right: 1em;
  23. }
  24. .content + .content {
  25. display: inline-block!important;
  26. margin-right: 1em;
  27. }
  28. .message .nickname ~ .content span {
  29. line-height: 1.5em;
  30. }
  31. #chat-wrapper {
  32. position: fixed !important;
  33. bottom: 0 !important;
  34. left: 0 !important;
  35. width: 250px !important;
  36. height: 100% !important;
  37. z-index: 9999 !important;
  38. display: block !important;
  39. }
  40. #videos {
  41. left: 250px !important;
  42. }
  43. #userlist {
  44. position: fixed !important;
  45. top: 0 !important; /* Align it to the top */
  46. right: 0 !important; /* Fix it to the right */
  47. width: 210px !important; /* Adjust width as needed */
  48. height: 100% !important; /* Full height */
  49. z-index: 9998 !important; /* Make sure it stays above other elements */
  50. overflow-y: auto !important; /* Scroll if needed */
  51. }
  52. sc-chat {
  53. z-index: 1 !important; /* Set the z-index to 1 */
  54. position: relative !important; /* Ensuring it doesn't float above */
  55. }
  56. `;
  57.  
  58. // Apply CSS when the page loads
  59. if (typeof GM_addStyle !== "undefined") {
  60. GM_addStyle(css);
  61. } else {
  62. let styleNode = document.createElement("style");
  63. styleNode.appendChild(document.createTextNode(css));
  64. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  65. }
  66.  
  67. // Optional: Use MutationObserver to detect dynamic loading of the sc-chat element
  68. const observer = new MutationObserver((mutations) => {
  69. mutations.forEach((mutation) => {
  70. if (document.querySelector('sc-chat #chat-wrapper')) {
  71. GM_addStyle(css);
  72. observer.disconnect(); // Stop observing once the changes are applied
  73. }
  74. });
  75. });
  76.  
  77. // Observe the document body for changes
  78. observer.observe(document.body, { childList: true, subtree: true });
  79. })();
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement