Kick.com Auto Hide (Chat + Sidebar)

Automatically hides both chat and sidebar on Kick.com streams for a cleaner viewing experience

  1. // ==UserScript==
  2. // @name Kick.com Auto Hide (Chat + Sidebar)
  3. // @namespace https://gf.qytechs.cn/en/users/1392176-codificalo-xyz
  4. // @version 1.0.1
  5. // @description Automatically hides both chat and sidebar on Kick.com streams for a cleaner viewing experience
  6. // @author codeandoando
  7. // @icon https://play-lh.googleusercontent.com/66czInHo_spTFWwLVYntxW8Fa_FHCDRPnd3y0HT14_xz6xb_lqSv005ARvdkJJE2TA=s256-rw
  8. // @match https://kick.com/*
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. /*
  14. MIT License
  15. Copyright (c) 2024 codeandoando
  16. Permission is hereby granted, free of charge, to any person obtaining a copy of this software...
  17. */
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. function hideChat() {
  23. const chatContainer = document.getElementById('channel-chatroom');
  24. if (chatContainer) {
  25. const mainContainer = chatContainer.closest('[data-chat]');
  26. if (mainContainer) {
  27. mainContainer.setAttribute('data-chat', 'false');
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33.  
  34. function collapseSidebar() {
  35. const sidebarButton = document.querySelector('button[aria-label="Collapse sidebar"]');
  36. if (sidebarButton) {
  37. sidebarButton.click();
  38. return true;
  39. }
  40. return false;
  41. }
  42.  
  43. function initializeHiding() {
  44. let chatHidden = false;
  45. let sidebarCollapsed = false;
  46.  
  47. function retry(attempt = 0) {
  48. if (!chatHidden) {
  49. chatHidden = hideChat();
  50. }
  51. if (!sidebarCollapsed) {
  52. sidebarCollapsed = collapseSidebar();
  53. }
  54.  
  55. if (!chatHidden || !sidebarCollapsed) {
  56. const delay = Math.min(500 * (attempt + 1), 2000);
  57. setTimeout(() => retry(attempt + 1), delay);
  58. }
  59. }
  60.  
  61. retry();
  62. }
  63.  
  64. window.addEventListener('load', () => {
  65. setTimeout(initializeHiding, 2000);
  66. });
  67.  
  68. let lastUrl = location.href;
  69. new MutationObserver(() => {
  70. const url = location.href;
  71. if (url !== lastUrl) {
  72. lastUrl = url;
  73. setTimeout(initializeHiding, 2000);
  74. }
  75. }).observe(document, {subtree: true, childList: true});
  76. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址