您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows all replies in thread with a keyboard shortcut (press 'a'), excluding typing in textarea
当前为
- // ==UserScript==
- // @name Expand All Hidden Replies in a 4chan Thread with Keyboard Shortcut
- // @version 0.4
- // @description Shows all replies in thread with a keyboard shortcut (press 'a'), excluding typing in textarea
- // @author Anon
- // @match https://boards.4chan.org/*/thread/*
- // @grant none
- // @license MIT
- // @namespace https://greasyfork.org/users/1165708
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function to show all reply buttons
- function showAllReplyButtons() {
- // Select all reply buttons
- var replyButtons = document.querySelectorAll('.stub .show-reply-button');
- // Loop through each reply button
- replyButtons.forEach(function(button) {
- // Click the button
- button.click();
- });
- }
- // Function to handle keydown event
- function handleKeyDown(event) {
- // Check if the pressed key is 'a' and the active element is not an input or textarea
- if (event.key === 'a' && document.activeElement.tagName.toLowerCase() !== 'input' && document.activeElement.tagName.toLowerCase() !== 'textarea') {
- // Show all reply buttons
- showAllReplyButtons();
- // Prevent the default action of the 'a' key
- event.preventDefault();
- }
- }
- // Add keydown event listener to the document
- document.addEventListener('keydown', handleKeyDown);
- })();