您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Close google docs tab UI automatically (Left arrow button on lefthand side of page) by automatically closing it
当前为
- // ==UserScript==
- // @name Close google docs tab UI automatically
- // @version 2025-01-12
- // @description Close google docs tab UI automatically (Left arrow button on lefthand side of page) by automatically closing it
- // @match *://*.docs.google.com/document/*
- // @license MIT
- // @namespace https://greasyfork.org/users/1422626
- // ==/UserScript==
- var interval = 2; // ms, how often the loop should run
- var maxTime = 5000; // ms, max time to try to run the loop for
- var startTime = new Date().getTime();
- var checkTimer = setInterval(TimeLoop, interval);
- checkTimer();
- function TimeLoop() {
- const warning = document.getElementsByClassName("div.goog-flat-button.goog-inline-block.goog-flat-button-disabled"); //class of the button
- if (warning !== undefined){ //see if it exists yet
- var button = document.getElementsByClassName('goog-inline-block docs-material-gm-select miniChapterSwitcherView miniChapterSwitcherCollapsed');
- var evt = new MouseEvent('click');
- button[0].dispatchEvent(evt);
- clearInterval(checkTimer)
- }
- if (warning !== undefined){ //see if it exists yet
- button[0].dispatchEvent(evt);
- clearInterval(checkTimer)
- }
- if (new Date().getTime() - startTime > maxTime) {
- clearInterval(checkTimer); //kill the timer if the button hasnt shown after maxTime milliseconds
- }
- }