���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
.trash
/
node_modules.1
/
@nuxt
/
ui
/
dist
/
runtime
/
composables
/
Viewing: defineShortcuts.js
import { ref, computed } from "vue"; import { logicAnd, logicNot } from "@vueuse/math"; import { useEventListener, useDebounceFn } from "@vueuse/core"; import { useShortcuts } from "./useShortcuts.js"; const chainedShortcutRegex = /^[^-]+.*-.*[^-]+$/; const combinedShortcutRegex = /^[^_]+.*_.*[^_]+$/; export const defineShortcuts = (config, options = {}) => { const { macOS, usingInput } = useShortcuts(); let shortcuts = []; const chainedInputs = ref([]); const clearChainedInput = () => { chainedInputs.value.splice(0, chainedInputs.value.length); }; const debouncedClearChainedInput = useDebounceFn(clearChainedInput, options.chainDelay ?? 800); const onKeyDown = (e) => { if (!e.key) { return; } const alphabeticalKey = /^[a-z]{1}$/i.test(e.key); let chainedKey; chainedInputs.value.push(e.key); if (chainedInputs.value.length >= 2) { chainedKey = chainedInputs.value.slice(-2).join("-"); for (const shortcut of shortcuts.filter((s) => s.chained)) { if (shortcut.key !== chainedKey) { continue; } if (shortcut.condition.value) { e.preventDefault(); shortcut.handler(); } clearChainedInput(); return; } } for (const shortcut of shortcuts.filter((s) => !s.chained)) { if (e.key.toLowerCase() !== shortcut.key) { continue; } if (e.metaKey !== shortcut.metaKey) { continue; } if (e.ctrlKey !== shortcut.ctrlKey) { continue; } if (alphabeticalKey && e.shiftKey !== shortcut.shiftKey) { continue; } if (shortcut.condition.value) { e.preventDefault(); shortcut.handler(); } clearChainedInput(); return; } debouncedClearChainedInput(); }; shortcuts = Object.entries(config).map(([key, shortcutConfig]) => { if (!shortcutConfig) { return null; } let shortcut; if (key.includes("-") && key !== "-" && !key.match(chainedShortcutRegex)?.length) { console.trace(`[Shortcut] Invalid key: "${key}"`); } if (key.includes("_") && key !== "_" && !key.match(combinedShortcutRegex)?.length) { console.trace(`[Shortcut] Invalid key: "${key}"`); } const chained = key.includes("-") && key !== "-"; if (chained) { shortcut = { key: key.toLowerCase(), metaKey: false, ctrlKey: false, shiftKey: false, altKey: false }; } else { const keySplit = key.toLowerCase().split("_").map((k) => k); shortcut = { key: keySplit.filter((k) => !["meta", "ctrl", "shift", "alt"].includes(k)).join("_"), metaKey: keySplit.includes("meta"), ctrlKey: keySplit.includes("ctrl"), shiftKey: keySplit.includes("shift"), altKey: keySplit.includes("alt") }; } shortcut.chained = chained; if (!macOS.value && shortcut.metaKey && !shortcut.ctrlKey) { shortcut.metaKey = false; shortcut.ctrlKey = true; } if (typeof shortcutConfig === "function") { shortcut.handler = shortcutConfig; } else if (typeof shortcutConfig === "object") { shortcut = { ...shortcut, handler: shortcutConfig.handler }; } if (!shortcut.handler) { console.trace("[Shortcut] Invalid value"); return null; } const conditions = []; if (!shortcutConfig.usingInput) { conditions.push(logicNot(usingInput)); } else if (typeof shortcutConfig.usingInput === "string") { conditions.push(computed(() => usingInput.value === shortcutConfig.usingInput)); } shortcut.condition = logicAnd(...conditions, ...shortcutConfig.whenever || []); return shortcut; }).filter(Boolean); useEventListener("keydown", onKeyDown); };
Coded With 💗 by
0x6ick Mod By V1rus_Alfa