hide twitch sidebar
当前为
// ==UserScript==
// @name Hide Twitch SideBar
// @version 1.6.5
// @description hide twitch sidebar
// @author raianwz
// @match https://www.twitch.tv/*
// @exclude *://*.twitch.tv/moderator/*
// @exclude *://*.twitch.tv/embed/*
// @exclude *://*.twitch.tv/popout/*
// @namespace https://greasyfork.org/users/425245
// ==/UserScript==
setTimeout(function(){CheckBar();},5*1000);
const getElement = (e) => document.querySelector(e);
function CheckBar(){if(!getElement('#btnSideBar')){setTimeout(()=>{LoadBar();CheckBar();},5*1000)}};
function LoadBar(){
var navSidebar = getElement(`[data-a-target="side-nav-bar-collapsed"]`)
navSidebar.style.display="block"
esconder(navSidebar)
function esconder(navSidebar){
let where = getElement('div.sc-AxjAm .kycibo')
var arrow = `<div class="sc-AxjAm kycibo"><div class="sc-AxjAm iJZwey">
<button class="ScCoreButton-sc-1qn4ixc-0 iyLrol ScButtonIcon-o7ndmn-0 hSxEIC"><div class="ScButtonIconFigure-o7ndmn-1 dfPonN" id="btnSideBar">
<div class="ScIconLayout-sc-1bgeryd-0 kbOjdP tw-icon"><div class="ScAspectRatio-sc-1sw3lwy-1 dNNaBC tw-aspect"><div class="ScAspectSpacer-sc-1sw3lwy-0 gkBhyN">
</div><svg width="100%" height="100%" version="1.1"viewBox="0 0 20 20" x="0px" y="0px" class="ScIconSVG-sc-1bgeryd-1 cMQeyU"><g id="pSeta">
<path d="M16 16V4h2v12h-2zM6 9l2.501-2.5-1.5-1.5-5 5 5 5 1.5-1.5-2.5-2.5h8V9H6z"></path></g></svg></div></div></div</button></div></div>`
where.insertAdjacentHTML("beforeBegin",`${arrow}`)
getElement('#btnSideBar').addEventListener("click", function (call){changeSide(navSidebar)})
}
function changeSide(navSidebar){
let pSeta = document.querySelector('#pSeta')
let sideR = `<path d="M4 16V4H2v12h2zM13 15l-1.5-1.5L14 11H6V9h8l-2.5-2.5L13 5l5 5-5 5z">`
let sideL = `<path d="M16 16V4h2v12h-2zM6 9l2.501-2.5-1.5-1.5-5 5 5 5 1.5-1.5-2.5-2.5h8V9H6z">`
if(navSidebar.style.display == "none"){navSidebar.style.display = "block" ; pSeta.innerHTML = `${sideL}`}
else {navSidebar.style.display = "none" ; pSeta.innerHTML = `${sideR}`}
}
}
console.log('Hide Twitch SideBar is enabled')