嗨皮漫畫 - 隐藏特定位置的 導覽列

隱藏除了頂部和底部以外的 導覽列

目前為 2024-04-25 提交的版本,檢視 最新版本

// ==UserScript==
// @version      2.9
// @name         嗨皮漫畫 - 隐藏特定位置的 導覽列
// @name:zh-TW   嗨皮漫畫 - 隐藏特定位置的 導覽列
// @name:zh-CN   嗨皮漫画 - 隐藏特定位置的 导航栏
// @name:en Happy Comics - Hide Specific Position AppBar
// @namespace    https://www.youtube.com/c/ScottDoha
// @description  隱藏除了頂部和底部以外的 導覽列
// @description:zh-cn 隐藏除了顶部和底部以外的 導覽列
// @description:en Hide AppBar except at the top and bottom of the page
// @author       Scott
// @match        *://m.happymh.com/reads/*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 定義要顯示的元素的 CSS 選擇器
    var headerSelector = ".MuiPaper-root.MuiAppBar-root.MuiAppBar-positionSticky.MuiAppBar-colorPrimary.jss12.MuiPaper-elevation4";

    // 添加隱藏指定樣式的 CSS
    GM_addStyle(headerSelector + " { display: none !important; }");

    // 當滾動時檢查頁面位置
    window.addEventListener('scroll', function() {
        // 如果頁面在頂部,則顯示元素,否則隱藏它
        if (window.scrollY === 0) {
            document.querySelector(headerSelector).style.display = "block";
        } else {
            document.querySelector(headerSelector).style.display = "none";
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址