自动关闭 Felo Search 的侧边栏

启动 Felo Search 后自动点击关闭侧边栏的按钮

目前為 2024-10-03 提交的版本,檢視 最新版本

// ==UserScript==
// @name         自动关闭 Felo Search 的侧边栏
// @namespace    http://tampermonkey.net/
// @version      0.1
// @icon         https://www.google.com/s2/favicons?sz=64&domain=felo.ai
// @description  启动 Felo Search 后自动点击关闭侧边栏的按钮
// @author       Jing Wang
// @contact      [email protected]
// @license      GPL-3.0
// @match        https://felo.ai/search/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to click the sidebar toggle button
    function closeSidebar() {
        const sidebarToggle = document.querySelector('section.hidden.md\\:block.cursor-pointer');
        if (sidebarToggle) {
            sidebarToggle.click();
        }
    }

    // Run the function when the page loads
    window.addEventListener('load', closeSidebar);

    // // Also run the function periodically in case the button is added dynamically
    // setInterval(closeSidebar, 2000);
})();