Created
December 8, 2025 08:15
-
-
Save kernkraft235/a7cda85f1e9e824780029fb356e8e427 to your computer and use it in GitHub Desktop.
Userscript: Anti-Keyboard-Zoom for Safari iOS
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