Replace Kick Embed with Channel Page and Enable Theatre Mode

Replaces Kick embed with a full channel page and enables theatre mode on Kick.com only when loaded as an embed replacement

  1. // ==UserScript==
  2. // @name Replace Kick Embed with Channel Page and Enable Theatre Mode
  3. // @namespace kick.com
  4. // @version 1.8.2
  5. // @description Replaces Kick embed with a full channel page and enables theatre mode on Kick.com only when loaded as an embed replacement
  6. // @author Ignelious
  7. // @match *://player.kick.cx/*
  8. // @match *://kick.com/*
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant GM_addStyle
  12. // @grant GM_registerMenuCommand
  13. // @license GPL-3.0-or-later
  14. // ==/UserScript==
  15.  
  16. let chatButtonVisible = GM_getValue('kickChatButtonVisible', false);
  17. GM_registerMenuCommand('Toggle chat button visibility', () => {
  18. chatButtonVisible = !chatButtonVisible;
  19. GM_setValue('kickChatButtonVisible', chatButtonVisible);
  20.  
  21. alert('Refresh for changes to take effect.');
  22. });
  23.  
  24. let liveInformationVisible = GM_getValue('kickLiveInformationVisible', false);
  25. GM_registerMenuCommand('Toggle live information visibility', () => {
  26. liveInformationVisible = !liveInformationVisible;
  27. GM_setValue('kickLiveInformationVisible', liveInformationVisible);
  28.  
  29. alert('Refresh for changes to take effect.');
  30. });
  31.  
  32. if (window.location.host.includes("player.kick.cx")) {
  33. // Code for the embed page: Replace the Kick player with a full channel page
  34. const observer = new MutationObserver(() => {
  35. const playerContainer = document.querySelector(".video-container");
  36. if (playerContainer) {
  37. // Extract channel information from the URL
  38. const channelUrl = window.location.href;
  39. console.log("Channel URL:", channelUrl);
  40. const splitURL = channelUrl.split("/");
  41. const channelId = splitURL[splitURL.length - 1]; // Assumes URL is like: https://player.kick.cx/{channelId}
  42. console.log("Channel ID:", channelId);
  43.  
  44. // Create an iframe for the full Kick channel page
  45. const iframe = document.createElement("iframe");
  46. iframe.src = `https://kick.com/${channelId}`;
  47. iframe.style.width = "100%";
  48. iframe.style.height = "100vh"; // Full viewport height
  49. iframe.style.border = "none";
  50.  
  51. // Replace the embed with the full channel page
  52. playerContainer.innerHTML = "";
  53. playerContainer.appendChild(iframe);
  54.  
  55. if (!liveInformationVisible) {
  56. GM_addStyle(`
  57. .live-informations {
  58. display: none !important;
  59. }
  60. `);
  61. }
  62.  
  63. // Stop observing and mark that we replaced the embed
  64. observer.disconnect();
  65. GM_setValue("embedReplaced", true);
  66. }
  67. });
  68. observer.observe(document.body, {
  69. subtree: true,
  70. childList: true,
  71. });
  72. } else if (window.location.host.includes("kick.com")) {
  73. // Code for kick.com: Only run if the embed was replaced and the referrer indicates it came from player.kick.cx
  74. const embedReplacedValue = GM_getValue("embedReplaced", false);
  75. if (embedReplacedValue && document.referrer.includes("player.kick.cx")) {
  76. console.log("Embed replacement detected via referrer. Enabling theatre mode...");
  77. const observer2 = new MutationObserver(() => {
  78. const el = document.querySelector('[data-sidebar]');
  79. el.dataset.sidebar = 'false';
  80. el.dataset.chat = 'false';
  81. el.dataset.theatre = 'true';
  82.  
  83. if (!chatButtonVisible) {
  84. GM_addStyle(`
  85. [data-theatre-mode-container] .z-controls > button {
  86. display: none !important;
  87. }
  88. `);
  89. }
  90.  
  91. GM_addStyle(`
  92. [data-sidebar] > .w-xvw {
  93. padding-top: unset !important;
  94. }
  95.  
  96. #channel-content .watermark-container {
  97. display: none !important;
  98. }
  99. `);
  100.  
  101. observer2.disconnect();
  102. // Clear the flag so subsequent direct visits to kick.com don't trigger theatre mode
  103. GM_setValue("embedReplaced", false);
  104. });
  105. observer2.observe(document.body, {
  106. subtree: true,
  107. childList: true,
  108. });
  109. }
  110. }

QingJ © 2025

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