DGG - Add close stream button

2024-10-03, tfw you learn javashit to do Jaydr's job

  1. // ==UserScript==
  2. // @name DGG - Add close stream button
  3. // @namespace Jaydr do your job
  4. // @match https://www.destiny.gg/bigscreen
  5. // @match https://www.destiny.gg/bigscreen*
  6. // @match https://www.destiny.gg/embed/chat
  7. // @match https://www.omniliberal.dev/bigscreen
  8. // @match https://www.omniliberal.dev/bigscreen*
  9. // @match https://www.omniliberal.dev/embed/chat
  10. // @match https://www.twitch.tv/destiny
  11. // @grant none
  12. // @version 0.3
  13. // @author mif
  14. // @license MIT
  15. // @description 2024-10-03, tfw you learn javashit to do Jaydr's job
  16. // ==/UserScript==
  17.  
  18. // idk how to do events so I'm clicking the other buttons
  19. function click_close_embed() {document.getElementById("close-embed-btn").click();}
  20. function click_change_platform() {document.getElementById("change-platform-btn").click();}
  21. function blank_embed_function() {window.location.href = "#twitch/destiny";}
  22.  
  23. function css_overwrite (cssStr) { // this function injects CSS
  24. var D = document;
  25. var newNode = D.createElement ('style');
  26. newNode.textContent = cssStr;
  27.  
  28. var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
  29. targ.appendChild (newNode);
  30. }
  31.  
  32. // set a base element to attach to (CINEMA one)
  33. let target_element = document.querySelector('#theater-mode');
  34.  
  35. // define new buttons to add after CINEMA mode
  36. let custom_close_embed_button = document.createElement("button");
  37. let blank_screen_button = document.createElement("button");
  38. let change_platform_button = document.createElement("button");
  39.  
  40. // configuring the new buttons
  41.  
  42. // custom_close_embed_button.id = "close-embed-custom"; // useless
  43. // custom_close_embed_button.style = "color:dedede!important"; // make it distinct
  44. // custom_close_embed_button.style = "color:teal!important"; // make it distinct
  45. custom_close_embed_button.textContent = "✖️ Embed"; // name the button
  46. custom_close_embed_button.title = "Close Embed"; // hover text
  47. custom_close_embed_button.addEventListener("click", click_close_embed, false); // can't copy the initial listner so target the other button
  48.  
  49. // blank_screen_button to hide forced hosted embeds
  50. blank_screen_button.textContent = "⬛"; // name the button
  51. blank_screen_button.title = "Black screen (using #twitch/destiny)"; // hover text
  52. blank_screen_button.href = "#twitch/destiny";
  53. blank_screen_button.addEventListener("click", blank_embed_function, false);
  54.  
  55. change_platform_button.textContent = "↔️"; // name the button
  56. change_platform_button.title = "Switch Kick/Youtube (he needs to be live on both)"; // hover text
  57. change_platform_button.addEventListener("click", click_change_platform, false); // can't copy the initial listner so target the other button
  58.  
  59. // he's not getting unbanned so it's fine to mess with and use this for the blank page
  60. css_overwrite('[src="https://player.twitch.tv/?channel=destiny&parent=www.destiny.gg&parent=stage.destiny.gg"] {display: None;}');
  61.  
  62. // actually add the buttons after target_element
  63. target_element.textContent = "🎥"; // text too long, make this one shorter also
  64. target_element.after(custom_close_embed_button);
  65. target_element.after(change_platform_button);
  66. target_element.after(blank_screen_button);

QingJ © 2025

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