Created
March 1, 2026 18:02
-
-
Save Explosion-Scratch/6a6c5195eaf0885aee1ac7b67ffad5f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Dynamic Anti-AutoZoom | |
| // @namespace vet.skynet.userscripts | |
| // @author userscripts@skynet.vet | |
| // @match *://*/* | |
| // @run-at document-start | |
| // ==/UserScript== | |
| (function () { | |
| function updateRule() { | |
| const scale = window.visualViewport?.scale || 1; | |
| const targetSize = 16 / scale; | |
| const id = 'safari-dynamic-antizoom-style'; | |
| document.getElementById(id)?.remove(); | |
| const style = document.createElement('style'); | |
| style.id = id; | |
| style.textContent = ` | |
| input:focus, | |
| textarea:focus, | |
| [contenteditable]:focus { | |
| font-size: ${targetSize}px !important; | |
| line-height: 1.2 !important; | |
| } | |
| `; | |
| document.documentElement.appendChild(style); | |
| } | |
| updateRule(); | |
| if (window.visualViewport) { | |
| window.visualViewport.addEventListener('resize', updateRule); | |
| window.visualViewport.addEventListener('scroll', updateRule); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment