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 https://player.kick.com/
  4. // @version 1.5
  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 nobody
  7. // @match *://player.kick.com/*
  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', true);
  17.  
  18. GM_registerMenuCommand('Toggle chat button visibility', () => {
  19. chatButtonVisible = !chatButtonVisible;
  20. GM_setValue('kickChatButtonVisible', chatButtonVisible);
  21.  
  22. alert('Refresh for changes to take effect.');
  23. });
  24.  
  25. if (window.location.host.includes("player.kick.com")) {
  26. // Code for the embed page: Replace the Kick player with a full channel page
  27. const observer = new MutationObserver(() => {
  28. const playerContainer = document.querySelector(".video-container");
  29. if (playerContainer) {
  30. // Extract channel information from the URL
  31. const channelUrl = window.location.href;
  32. console.log("Channel URL:", channelUrl);
  33. const channelId = channelUrl.split("/")[3]; // Assumes URL is like: https://player.kick.com/channel/{channelId}
  34. console.log("Channel ID:", channelId);
  35.  
  36. // Create an iframe for the full Kick channel page
  37. const iframe = document.createElement("iframe");
  38. iframe.src = `https://kick.com/${channelId}`;
  39. iframe.style.width = "100%";
  40. iframe.style.height = "100vh"; // Full viewport height
  41. iframe.style.border = "none";
  42.  
  43. // Replace the embed with the full channel page
  44. playerContainer.innerHTML = "";
  45. playerContainer.appendChild(iframe);
  46.  
  47. // Stop observing and mark that we replaced the embed
  48. observer.disconnect();
  49. GM_setValue("embedReplaced", true);
  50. }
  51. });
  52. observer.observe(document.body, {
  53. subtree: true,
  54. childList: true,
  55. });
  56. } else if (window.location.host.includes("kick.com")) {
  57. // Code for kick.com: Only run if the embed was replaced and the referrer indicates it came from player.kick.com
  58. const embedReplacedValue = GM_getValue("embedReplaced", false);
  59. if (embedReplacedValue && document.referrer.includes("player.kick.com")) {
  60. console.log("Embed replacement detected via referrer. Enabling theatre mode...");
  61. const observer2 = new MutationObserver(() => {
  62. const el = document.querySelector('[data-sidebar]');
  63. el.dataset.sidebar = 'false';
  64. el.dataset.chat = 'false';
  65. el.dataset.theatre = 'true';
  66.  
  67. GM_addStyle(`
  68. [data-sidebar] > .w-xvw {
  69. padding-top: unset !important;
  70. }
  71.  
  72. #channel-content {
  73. display: none;
  74. }
  75. `);
  76.  
  77. if (!chatButtonVisible) {
  78. GM_addStyle(`
  79. [data-theatre-mode-container] .z-controls > button {
  80. display: none !important;
  81. }
  82. `);
  83. }
  84.  
  85. observer2.disconnect();
  86. // Clear the flag so subsequent direct visits to kick.com don't trigger theatre mode
  87. GM_setValue("embedReplaced", false);
  88. });
  89. observer2.observe(document.body, {
  90. subtree: true,
  91. childList: true,
  92. });
  93. }
  94. }

QingJ © 2025

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