Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Old chat
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.1
  5. // @description  try to take over the world!
  6. // @author       You
  7. // @match        https://www.twitch.tv/*
  8. // @grant        none
  9. // @run-at       document-idle
  10. // ==/UserScript==
  11.  
  12. var oldChat = false;
  13. var chat;
  14.  
  15. new MutationObserver(function(mutations) {
  16.     if (!chat)
  17.         chat = document.querySelector("div.chat__container.full-width.full-height.overflow-hidden.flex.flex-column.flex-grow-1.flex-shrink-1 > div");
  18.     if (chat) {
  19.         if (!oldChat) {
  20.             chat.innerHTML = '<iframe src="' + window.location.href + '/chat?popout=" style="height: 100%;"></iframe>';
  21.             oldChat = true;
  22.         }
  23.         if (chat.childElementCount !== 1) {
  24.             for (let x = 1;x < chat.childElementCount;x++) {
  25.                 chat.children[x].remove();
  26.             }
  27.         }
  28.     }
  29. }).observe(document, {childList: true, subtree: true});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement