Twitch Sidebar Hover

Channel sidebar will expand when hovered over and collapsed when the mouse exits

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Twitch Sidebar Hover
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Channel sidebar will expand when hovered over and collapsed when the mouse exits
// @author       You
// @match        https://www.twitch.tv/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitch.tv
// @grant        none
// @license MIT
// ==/UserScript==

/* jshint esversion: 6 */
(function() {
    'use strict';
    const sideNav = document.querySelector(".side-nav");
    const expandBtn = document.querySelector("button[data-a-target='side-nav-arrow']");
    sideNav.onmouseenter = e => {
        if (sideNav.classList.contains("side-nav--collapsed")) {
            expandBtn.click();
        }
    };
    sideNav.onmouseleave = e => {
        if (sideNav.classList.contains("side-nav--expanded")) {
            expandBtn.click();
        }
    };
})();