Download src/js/util/zoomLevel.js from merve/git-101: direct link, hf CLI and curl.
- Browser
- Download file 638 Bytes
-
https://huggingface.co/spaces/merve/git-101/resolve/main/src/js/util/zoomLevel.js
- Command line
-
hf download hf://spaces/merve/git-101/src/js/util/zoomLevel.js
-
curl -L -o zoomLevel.js https://huggingface.co/spaces/merve/git-101/resolve/main/src/js/util/zoomLevel.js
638 Bytes
| var _warnOnce = true; | |
| function detectZoom() { | |
| /** | |
| * Note: this method has only been tested on Chrome | |
| * but seems to work. A much more elaborate library is available here: | |
| * https://github.com/yonran/detect-zoom | |
| * but seems to return a "2" zoom level for my computer (who knows) | |
| * so I can't use it. The ecosystem for zoom level detection is a mess | |
| */ | |
| if (!window.outerWidth || !window.innerWidth) { | |
| if (_warnOnce) { | |
| console.warn("Can't detect zoom level correctly :-/"); | |
| _warnOnce = false; | |
| } | |
| return 1; | |
| } | |
| return window.outerWidth / window.innerWidth; | |
| } | |
| exports.detectZoom = detectZoom; | |