BS Shoutbox Popout

popup für die shoutbox wahlweise als iframe auf der video seite

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         BS Shoutbox Popout
// @namespace    http://tampermonkey.net/
// @version      2.0000005
// @description  popup für die shoutbox wahlweise als iframe auf der video seite
// @author       jonnyy / High_village
// @match        https://bs.to/*
// @grant        none
// @icon         https://bs.to/favicon.ico
// ==/UserScript==

(function() {
	'use strict';
	var t;
	if(!location.hash.split("popup=")[1]||location.hash.split("popup=")[1].indexOf("true")===-1){
		if(document.getElementById("navigation")){
			if(location.href.replace(location.hash,"")=="https://bs.to/"||location.href.replace(location.hash,"")=="https://bs.to/home"){
				document.getElementById("shoutbox").children[0].appendChild(t=document.getElementById("navigation").children[0].children[0].cloneNode(true));
				t.innerText="POPOUT";
				t.style.cursor="pointer";
				var width=60;
				t.style.float="right";
				t.style.left=t.parentElement.clientWidth-width+"px";
				t.onclick=function(){
					var wnd=open("https://bs.to/home#popup=true",null,{width:280,height:500,location:0,menubar:0});
				};
			}else{
				localStorage.setItem("BSTOPOPUP",true);
				var btn = document.createElement("BUTTON");
				document.body.appendChild(btn);
				btn.innerText="SB";
				btn.onmouseover=function(a,b){
					a.target.children[0].style.visibility="visible";
				};
				btn.onmouseleave=function(a){
					a.target.children[0].style.visibility="hidden";
				};
				btn.style.opacity="0.85";
				var s=btn.style;
				s.position="fixed";
				s.height="30px";
				s.width="30px";
				s.top="0";
				s.zIndex=20999999999;
				var i = document.createElement('iframe');
				i.style.position="fixed";
				btn.appendChild(i);
				i.frameBorder = "0";
				i.src = "https://bs.to/home#popup=true";
				var st=i.style;
				st.transform="scale(0.8)";
				st.left="-46px";
				st.top="-64px";
				st.height="614px";
				st.width="435px";
				st.zIndex=20999999999;
				st.visibility="hidden";
			}
		}
	}else if(location.hash.split("popup=")[1].indexOf("true")===0){
		var el=document.getElementsByClassName("home")[0].children;
		for(var i=el.length-1;i>-1;i--){
			if(el[i].localName=="h2"){
				el[i].remove();
			}
			for(var j=el[i].children.length-1;j>-1;j--){
				if(el[i].children[j].id!=="shoutbox"){
					el[i].children[j].remove();
				}else{
					el[i].children[j].style.marginTop="0px";
					el[i].children[j].style.position="fixed";
					el[i].children[j].style.left="5px";
				}
			}

		}
		$("nav")[0].remove();
		$("header")[0].remove();
		$("footer")[0].remove();
		document.getElementsByClassName("home")[0].style.height="0px";
		document.getElementsByClassName("home")[0].style.padding="0px";
		document.getElementById("root").style.height="0px";
		document.getElementById("root").style.paddingBottom="0px";
		window.resizeTo(435,700);
	}
	// Your code here...
})();