您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Toggle page zoom on/off with Z key and show indicator
// ==UserScript== // @name Klavia Page Zoom (Toggleable) // @namespace https://www.playklavia.com // @version 2.1 // @description Toggle page zoom on/off with Z key and show indicator // @match https://www.playklavia.com* // @match https://www.playklavia.com* // @grant none // ==/UserScript== (function() { 'use strict'; const ZOOM_LEVEL = 1.4; // 140% const STORAGE_KEY = 'klaviaZoomOn'; let zoomed = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? 'true'); // Create the on-screen indicator const indicator = document.createElement('div'); indicator.style.position = 'fixed'; indicator.style.bottom = '12px'; indicator.style.right = '12px'; indicator.style.padding = '6px 10px'; indicator.style.background = 'rgba(0,0,0,0.7)'; indicator.style.color = '#fff'; indicator.style.fontFamily = 'Arial, sans-serif'; indicator.style.fontSize = '14px'; indicator.style.borderRadius = '6px'; indicator.style.zIndex = '999999'; indicator.style.userSelect = 'none'; document.body.appendChild(indicator); function updateIndicator() { indicator.textContent = zoomed ? `Zoom: ON (${ZOOM_LEVEL * 100}%)` : 'Zoom: OFF'; } // Apply zoom function applyZoom() { document.body.style.zoom = zoomed ? `${ZOOM_LEVEL}` : '1'; updateIndicator(); } // Initial application applyZoom(); // Toggle zoom with Z key document.addEventListener('keydown', e => { if (e.key.toLowerCase() === 'z') { zoomed = !zoomed; localStorage.setItem(STORAGE_KEY, JSON.stringify(zoomed)); applyZoom(); } }); })();