您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Makes it so text input areas vertically expand to fit the size of the text you have put inside, making it easier to visualize what you have written in full.
- // ==UserScript==
- // @name Auto-expanding text input areas
- // @match *://*/*
- // @version 1.0
- // @license MIT
- // @namespace https://greasyfork.org/en/users/1436613-gosha305
- // @author gosha305
- // @description Makes it so text input areas vertically expand to fit the size of the text you have put inside, making it easier to visualize what you have written in full.
- // ==/UserScript==
- function autoExpandTextareas() {
- if (document.querySelector("textarea:not(.autoExpandable)")) {
- document.querySelectorAll("textarea:not(.autoExpandable)").forEach((e) => {
- e.classList.add("autoExpandable");
- e.addEventListener("input", function () {
- e.style.height = "auto";
- e.style.height = e.scrollHeight + "px";
- });
- });
- }
- }
- window.onload = function () {
- autoExpandTextareas();
- new MutationObserver(autoExpandTextareas).observe(document.body, {
- childList: true,
- subtree: true,
- });
- };