hide twitch sidebar
当前为
// ==UserScript==
// @name Hide Twitch SideBar
// @version 1.6.1
// @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(){
var navSidebar = document.querySelector(`[data-a-target="side-nav-bar-collapsed"]`)
navSidebar.style.display = "block"
esconder(navSidebar)
function esconder(navSidebar){
let sidebar = navSidebar
let where = document.querySelector('div.tw-flex.tw-flex-column.tw-full-height.tw-pd-x-1.tw-xl-pd-x-2')
let start = "beforeBegin"
var arrow = `<div class="tw-align-items-center tw-flex tw-full-height tw-pd-x-1 HideBarra"><div class="tw-inline-flex tw-relative tw-tooltip-wrapper">
<button class="tw-align-items-center tw-align-middle tw-border-bottom-left-radius-medium tw-border-bottom-right-radius-medium tw-border-top-left-radius-medium tw-border-top-right-radius-medium tw-button-icon tw-core-button tw-inline-flex tw-interactive tw-justify-content-center tw-overflow-hidden tw-relative">
<div class="tw-align-items-center tw-core-button-label tw-flex tw-flex-grow-0" id="btnSideBar"><figure class="tw-svg"><svg class="tw-icon__svg" width="20px" height="20px" version="1.1" viewBox="0 0 20 20" x="0px" y="0px">
<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></figure></div></button>
</div></div></div>`
where.insertAdjacentHTML(`${start}`,`${arrow}`)
let btnHide = document.querySelector('#btnSideBar').addEventListener("click", function (call){changeSide(sidebar)})
}
function changeSide(sidebar){
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(sidebar.style.display == "none"){sidebar.style.display = "block" ; pSeta.innerHTML = `${sideL}`}
else {sidebar.style.display = "none" ; pSeta.innerHTML = `${sideR}`}
}
}, 10000);
console.log('Hide Twitch SideBar is enabled')