Greasy Fork 支持简体中文。

Fixing twitch

Recent Twitch UI change where title is above video player. This reverts that.

  1. // ==UserScript==
  2. // @name Fixing twitch
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-12-12
  5. // @description Recent Twitch UI change where title is above video player. This reverts that.
  6. // @author You
  7. // @match https://www.twitch.tv/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @license MIT
  10. // @grant none
  11. // @run-at document-end
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. function sleep(ms) {
  18. return new Promise(resolve => setTimeout(resolve, ms));
  19. }
  20.  
  21. window.onload = async function () {
  22. await sleep(2000);
  23.  
  24. const parentDiv = document.querySelector('.channel-root__info');
  25. if (!parentDiv) return;
  26.  
  27. const channelDiv = document.querySelector('.channel-root__upper-watch');
  28. if (!channelDiv) return;
  29.  
  30. const children = Array.from(parentDiv.children);
  31.  
  32. parentDiv.insertBefore(channelDiv, children[0]);
  33. };
  34. })();