Compare commits
19 Commits
776f367ee1
...
v0.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
e817ff6169
|
|||
|
8e8bf47297
|
|||
|
1d7fd9a5bc
|
|||
|
8bf44cde6a
|
|||
|
782786ec7e
|
|||
|
c8a009dda1
|
|||
|
7c4f1b20b3
|
|||
|
c3f96bacc7
|
|||
|
8655533a2d
|
|||
|
bec57f9e49
|
|||
|
9ec71db87c
|
|||
|
3b229b4719
|
|||
|
c6baace721
|
|||
|
ab2da36aa1
|
|||
|
8691106d2f
|
|||
|
5480b57615
|
|||
|
f0dffa6cad
|
|||
|
ace98a0fbc
|
|||
|
b2ddd95ff5
|
1
dev-dist/registerSW.js
Normal file
1
dev-dist/registerSW.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
if('serviceWorker' in navigator) navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'classic' })
|
||||||
92
dev-dist/sw.js
Normal file
92
dev-dist/sw.js
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2018 Google Inc. All Rights Reserved.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// If the loader is already loaded, just stop.
|
||||||
|
if (!self.define) {
|
||||||
|
let registry = {};
|
||||||
|
|
||||||
|
// Used for `eval` and `importScripts` where we can't get script URL by other means.
|
||||||
|
// In both cases, it's safe to use a global var because those functions are synchronous.
|
||||||
|
let nextDefineUri;
|
||||||
|
|
||||||
|
const singleRequire = (uri, parentUri) => {
|
||||||
|
uri = new URL(uri + ".js", parentUri).href;
|
||||||
|
return registry[uri] || (
|
||||||
|
|
||||||
|
new Promise(resolve => {
|
||||||
|
if ("document" in self) {
|
||||||
|
const script = document.createElement("script");
|
||||||
|
script.src = uri;
|
||||||
|
script.onload = resolve;
|
||||||
|
document.head.appendChild(script);
|
||||||
|
} else {
|
||||||
|
nextDefineUri = uri;
|
||||||
|
importScripts(uri);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
.then(() => {
|
||||||
|
let promise = registry[uri];
|
||||||
|
if (!promise) {
|
||||||
|
throw new Error(`Module ${uri} didn’t register its module`);
|
||||||
|
}
|
||||||
|
return promise;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.define = (depsNames, factory) => {
|
||||||
|
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
|
||||||
|
if (registry[uri]) {
|
||||||
|
// Module is already loading or loaded.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let exports = {};
|
||||||
|
const require = depUri => singleRequire(depUri, uri);
|
||||||
|
const specialDeps = {
|
||||||
|
module: { uri },
|
||||||
|
exports,
|
||||||
|
require
|
||||||
|
};
|
||||||
|
registry[uri] = Promise.all(depsNames.map(
|
||||||
|
depName => specialDeps[depName] || require(depName)
|
||||||
|
)).then(deps => {
|
||||||
|
factory(...deps);
|
||||||
|
return exports;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
define(['./workbox-5a5d9309'], (function (workbox) { 'use strict';
|
||||||
|
|
||||||
|
self.skipWaiting();
|
||||||
|
workbox.clientsClaim();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The precacheAndRoute() method efficiently caches and responds to
|
||||||
|
* requests for URLs in the manifest.
|
||||||
|
* See https://goo.gl/S9QRab
|
||||||
|
*/
|
||||||
|
workbox.precacheAndRoute([{
|
||||||
|
"url": "registerSW.js",
|
||||||
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
|
}, {
|
||||||
|
"url": "index.html",
|
||||||
|
"revision": "0.mj22prstr4"
|
||||||
|
}], {});
|
||||||
|
workbox.cleanupOutdatedCaches();
|
||||||
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
allowlist: [/^\/$/]
|
||||||
|
}));
|
||||||
|
|
||||||
|
}));
|
||||||
3395
dev-dist/workbox-5a5d9309.js
Normal file
3395
dev-dist/workbox-5a5d9309.js
Normal file
File diff suppressed because it is too large
Load Diff
156
extension/background.js
Normal file
156
extension/background.js
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
// background.js
|
||||||
|
// Listen for messages from content scripts or offscreen document
|
||||||
|
|
||||||
|
let isSniffing = false;
|
||||||
|
let lastClipboardContent = '';
|
||||||
|
let creatingOffscreenDocument;
|
||||||
|
|
||||||
|
// Hot-reconnect: Inject content script into existing tabs upon installation/update/restart
|
||||||
|
const injectContentScriptIfNeeded = async () => {
|
||||||
|
const tabs = await chrome.tabs.query({ url: ['http://localhost/*', 'http://localhost:*/*', 'https://tools.7u.pl/*'] });
|
||||||
|
for (const tab of tabs) {
|
||||||
|
try {
|
||||||
|
// Try to ping the tab first
|
||||||
|
try {
|
||||||
|
await chrome.tabs.sendMessage(tab.id, { action: 'ping' });
|
||||||
|
// console.log('Content script already active in tab:', tab.id);
|
||||||
|
} catch (e) {
|
||||||
|
// If ping fails (no listener), inject script
|
||||||
|
await chrome.scripting.executeScript({
|
||||||
|
target: { tabId: tab.id },
|
||||||
|
files: ['content.js']
|
||||||
|
});
|
||||||
|
// console.log('Injected content script into existing tab:', tab.id);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// console.error('Failed to handle tab:', tab.id, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
chrome.runtime.onInstalled.addListener(injectContentScriptIfNeeded);
|
||||||
|
// Also run on startup (when extension is enabled/reloaded)
|
||||||
|
injectContentScriptIfNeeded();
|
||||||
|
|
||||||
|
// Listen for alarms
|
||||||
|
try {
|
||||||
|
if (chrome.alarms) {
|
||||||
|
chrome.alarms.onAlarm.addListener((alarm) => {
|
||||||
|
if (alarm.name === 'keepAlive') {
|
||||||
|
refreshOffscreenDocument();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// console.warn('chrome.alarms API is not available.');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// console.error('Error initializing alarms:', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup offscreen document
|
||||||
|
async function setupOffscreenDocument(path) {
|
||||||
|
// Check if an offscreen document already exists
|
||||||
|
const existingContexts = await chrome.runtime.getContexts({
|
||||||
|
contextTypes: ['OFFSCREEN_DOCUMENT'],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (existingContexts.length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create an offscreen document
|
||||||
|
if (creatingOffscreenDocument) {
|
||||||
|
await creatingOffscreenDocument;
|
||||||
|
} else {
|
||||||
|
creatingOffscreenDocument = chrome.offscreen.createDocument({
|
||||||
|
url: path,
|
||||||
|
reasons: ['CLIPBOARD', 'AUDIO_PLAYBACK'],
|
||||||
|
justification: 'To read clipboard content in the background and play notification sounds',
|
||||||
|
});
|
||||||
|
await creatingOffscreenDocument;
|
||||||
|
creatingOffscreenDocument = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lifecycle management: Refresh offscreen document every 25s to avoid 30s timeout
|
||||||
|
async function refreshOffscreenDocument() {
|
||||||
|
if (isSniffing) {
|
||||||
|
await chrome.offscreen.closeDocument();
|
||||||
|
await setupOffscreenDocument('offscreen.html');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start sniffing when requested
|
||||||
|
chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
|
||||||
|
if (request.action === 'startSniffing') {
|
||||||
|
if (isSniffing) {
|
||||||
|
sendResponse({ status: 'already_started' });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSniffing = true;
|
||||||
|
// console.log('Starting sniffing process...');
|
||||||
|
await setupOffscreenDocument('offscreen.html');
|
||||||
|
|
||||||
|
// Setup interval to keep offscreen alive - more aggressive
|
||||||
|
chrome.alarms.create('keepAlive', { periodInMinutes: 0.1 }); // every 6 seconds
|
||||||
|
|
||||||
|
sendResponse({ status: 'started' });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.action === 'stopSniffing') {
|
||||||
|
if (!isSniffing) {
|
||||||
|
sendResponse({ status: 'not_running' });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSniffing = false;
|
||||||
|
// console.log('Stopping sniffing process...');
|
||||||
|
|
||||||
|
// Stop alarm
|
||||||
|
chrome.alarms.clear('keepAlive');
|
||||||
|
|
||||||
|
// Close offscreen document
|
||||||
|
if (creatingOffscreenDocument) {
|
||||||
|
await creatingOffscreenDocument;
|
||||||
|
}
|
||||||
|
await chrome.offscreen.closeDocument().catch(() => {});
|
||||||
|
creatingOffscreenDocument = null;
|
||||||
|
|
||||||
|
sendResponse({ status: 'stopped' });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.type === 'clipboard-data' && request.target === 'background') {
|
||||||
|
// Received data from offscreen document
|
||||||
|
if (isSniffing && request.data && request.data !== lastClipboardContent) {
|
||||||
|
lastClipboardContent = request.data;
|
||||||
|
// console.log('Clipboard changed:', request.data.substring(0, 20) + '...');
|
||||||
|
|
||||||
|
// Check if sound should be played
|
||||||
|
chrome.storage.local.get(['playSound'], (result) => {
|
||||||
|
if (result.playSound !== false) {
|
||||||
|
// Send message to offscreen document to play sound
|
||||||
|
chrome.runtime.sendMessage({
|
||||||
|
target: 'offscreen',
|
||||||
|
type: 'play-sound'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Broadcast to all active tabs (content scripts)
|
||||||
|
// We could filter by sender.tab.id if we knew which tab started sniffing,
|
||||||
|
// but broadcasting is simpler for now and covers multiple open tabs of the app.
|
||||||
|
const tabs = await chrome.tabs.query({ url: ['http://localhost/*', 'http://localhost:*/*', 'https://tools.7u.pl/*'] });
|
||||||
|
for (const tab of tabs) {
|
||||||
|
chrome.tabs.sendMessage(tab.id, {
|
||||||
|
action: 'clipboardUpdate',
|
||||||
|
content: request.data
|
||||||
|
}).catch(() => {
|
||||||
|
// Tab might be closed or content script not injected yet
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
66
extension/content.js
Normal file
66
extension/content.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
// content.js
|
||||||
|
// This script runs on the web app page (e.g. localhost:5173)
|
||||||
|
|
||||||
|
console.log('Tools App Extension: Content script injected');
|
||||||
|
|
||||||
|
// Listen for messages from the Web App (Vue)
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
// We should verify the origin, but since we are running on the page itself, we trust window messages
|
||||||
|
// from our own app.
|
||||||
|
if (event.source !== window) return;
|
||||||
|
|
||||||
|
if (event.data.type && event.data.type === 'TOOLS_APP_INIT') {
|
||||||
|
// console.log('Tools App Extension: Received init from Web App');
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_EXTENSION_READY', version: '1.0' }, '*');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Heartbeat check
|
||||||
|
if (event.data.type === 'TOOLS_APP_PING') {
|
||||||
|
try {
|
||||||
|
// Only respond if the extension context is still valid
|
||||||
|
if (chrome.runtime && chrome.runtime.id) {
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_PONG' }, '*');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Extension context invalidated
|
||||||
|
// console.warn('Extension context invalidated during ping');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example: Receive request to sniff clipboard
|
||||||
|
if (event.data.type === 'TOOLS_APP_START_SNIFFING') {
|
||||||
|
// console.log('Tools App Extension: Start sniffing request');
|
||||||
|
// Relay to background script
|
||||||
|
try {
|
||||||
|
chrome.runtime.sendMessage({ action: 'startSniffing' });
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Tools App Extension: Connection lost, please reload the page', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.data.type === 'TOOLS_APP_STOP_SNIFFING') {
|
||||||
|
// console.log('Tools App Extension: Stop sniffing request');
|
||||||
|
try {
|
||||||
|
chrome.runtime.sendMessage({ action: 'stopSniffing' });
|
||||||
|
} catch (e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen for messages from the Extension Background
|
||||||
|
try {
|
||||||
|
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||||
|
if (request.action === 'clipboardUpdate') {
|
||||||
|
// Send to Web App
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_CLIPBOARD_UPDATE', content: request.content }, '*');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Respond to background ping to confirm we are alive
|
||||||
|
if (request.action === 'ping') {
|
||||||
|
sendResponse('pong');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Tools App Extension: Could not add listener', e);
|
||||||
|
}
|
||||||
BIN
extension/icon-128.png
Normal file
BIN
extension/icon-128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
extension/icon-16.png
Normal file
BIN
extension/icon-16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 862 B |
BIN
extension/icon-48.png
Normal file
BIN
extension/icon-48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
47
extension/manifest.json
Normal file
47
extension/manifest.json
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 3,
|
||||||
|
"name": "Tools App Extension",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "Browser extension for Tools App",
|
||||||
|
"permissions": [
|
||||||
|
"clipboardRead",
|
||||||
|
"offscreen",
|
||||||
|
"storage",
|
||||||
|
"alarms",
|
||||||
|
"scripting"
|
||||||
|
],
|
||||||
|
"host_permissions": [
|
||||||
|
"http://localhost/*",
|
||||||
|
"http://localhost:*/*",
|
||||||
|
"https://tools.7u.pl/*"
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"service_worker": "background.js"
|
||||||
|
},
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": [
|
||||||
|
"http://localhost/*",
|
||||||
|
"http://localhost:*/*",
|
||||||
|
"https://tools.7u.pl/*"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"content.js"
|
||||||
|
],
|
||||||
|
"run_at": "document_start"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"action": {
|
||||||
|
"default_popup": "popup.html",
|
||||||
|
"default_icon": {
|
||||||
|
"16": "icon-16.png",
|
||||||
|
"48": "icon-48.png",
|
||||||
|
"128": "icon-128.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icons": {
|
||||||
|
"16": "icon-16.png",
|
||||||
|
"48": "icon-48.png",
|
||||||
|
"128": "icon-128.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
extension/offscreen.html
Normal file
10
extension/offscreen.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Offscreen Clipboard Access</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<textarea id="text"></textarea>
|
||||||
|
<script src="offscreen.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
72
extension/offscreen.js
Normal file
72
extension/offscreen.js
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
// offscreen.js
|
||||||
|
// This script runs in the offscreen document to access DOM APIs like navigator.clipboard
|
||||||
|
|
||||||
|
const textEl = document.querySelector('#text');
|
||||||
|
|
||||||
|
let lastText = '';
|
||||||
|
|
||||||
|
setInterval(async () => {
|
||||||
|
try {
|
||||||
|
textEl.focus();
|
||||||
|
textEl.value = '';
|
||||||
|
textEl.select();
|
||||||
|
|
||||||
|
// Method 1: execCommand
|
||||||
|
try {
|
||||||
|
document.execCommand('paste');
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = textEl.value;
|
||||||
|
|
||||||
|
// Method 2: navigator.clipboard (Fallback)
|
||||||
|
if (!text) {
|
||||||
|
try {
|
||||||
|
text = await navigator.clipboard.readText();
|
||||||
|
} catch (e) {
|
||||||
|
// Silent fail for navigator
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text && text.trim().length > 0 && text !== lastText) {
|
||||||
|
lastText = text;
|
||||||
|
chrome.runtime.sendMessage({
|
||||||
|
type: 'clipboard-data',
|
||||||
|
target: 'background',
|
||||||
|
data: text
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// Ignore critical errors to keep running
|
||||||
|
}
|
||||||
|
}, 50);
|
||||||
|
|
||||||
|
// Listen for messages from background if we need to change behavior
|
||||||
|
chrome.runtime.onMessage.addListener((message) => {
|
||||||
|
if (message.target === 'offscreen') {
|
||||||
|
// Handle commands
|
||||||
|
if (message.type === 'play-sound') {
|
||||||
|
playNotificationSound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function playNotificationSound() {
|
||||||
|
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
|
const oscillator = audioContext.createOscillator();
|
||||||
|
const gainNode = audioContext.createGain();
|
||||||
|
|
||||||
|
oscillator.connect(gainNode);
|
||||||
|
gainNode.connect(audioContext.destination);
|
||||||
|
|
||||||
|
oscillator.type = 'sine';
|
||||||
|
oscillator.frequency.setValueAtTime(500, audioContext.currentTime);
|
||||||
|
oscillator.frequency.exponentialRampToValueAtTime(1000, audioContext.currentTime + 0.1);
|
||||||
|
|
||||||
|
gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);
|
||||||
|
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.1);
|
||||||
|
|
||||||
|
oscillator.start();
|
||||||
|
oscillator.stop(audioContext.currentTime + 0.1);
|
||||||
|
}
|
||||||
55
extension/popup.html
Normal file
55
extension/popup.html
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Tools App Extension</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
width: 250px;
|
||||||
|
padding: 15px;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
margin-top: 0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.status {
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #e0e0e0;
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.status.active {
|
||||||
|
background: #e3f2fd;
|
||||||
|
color: #1565c0;
|
||||||
|
border: 1px solid #90caf9;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
margin-top: 15px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3>Tools App Extension</h3>
|
||||||
|
<div class="status active">
|
||||||
|
Extension is active and ready to communicate with Tools App.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-top: 15px;">
|
||||||
|
<label style="display: flex; align-items: center; cursor: pointer;">
|
||||||
|
<input type="checkbox" id="soundToggle" style="margin-right: 8px;">
|
||||||
|
<span>Play sound on capture</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
Visit <a href="https://tools.7u.pl" target="_blank">tools.7u.pl</a>
|
||||||
|
</div>
|
||||||
|
<script src="popup.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
34
extension/popup.js
Normal file
34
extension/popup.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// popup.js
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const soundToggle = document.getElementById('soundToggle');
|
||||||
|
|
||||||
|
// Load saved setting
|
||||||
|
chrome.storage.local.get(['playSound'], (result) => {
|
||||||
|
soundToggle.checked = result.playSound !== false; // Default to true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Save setting on change
|
||||||
|
soundToggle.addEventListener('change', () => {
|
||||||
|
chrome.storage.local.set({ playSound: soundToggle.checked });
|
||||||
|
|
||||||
|
// Play test sound if enabled
|
||||||
|
if (soundToggle.checked) {
|
||||||
|
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
|
const oscillator = audioContext.createOscillator();
|
||||||
|
const gainNode = audioContext.createGain();
|
||||||
|
|
||||||
|
oscillator.connect(gainNode);
|
||||||
|
gainNode.connect(audioContext.destination);
|
||||||
|
|
||||||
|
oscillator.type = 'sine';
|
||||||
|
oscillator.frequency.setValueAtTime(500, audioContext.currentTime);
|
||||||
|
oscillator.frequency.exponentialRampToValueAtTime(1000, audioContext.currentTime + 0.1);
|
||||||
|
|
||||||
|
gainNode.gain.setValueAtTime(0.1, audioContext.currentTime);
|
||||||
|
gainNode.gain.exponentialRampToValueAtTime(0.01, audioContext.currentTime + 0.1);
|
||||||
|
|
||||||
|
oscillator.start();
|
||||||
|
oscillator.stop(audioContext.currentTime + 0.1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
||||||
|
<meta name="theme-color" content="#4facfe" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Tools App</title>
|
<title>Tools App</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
4776
package-lock.json
generated
4776
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "tools-app",
|
"name": "tools-app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.1",
|
"version": "0.3.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^6.0.2",
|
"@vitejs/plugin-vue": "^6.0.2",
|
||||||
"vite": "^7.3.1"
|
"vite": "^7.3.1",
|
||||||
|
"vite-plugin-pwa": "^1.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
public/favicon.svg
Normal file
20
public/favicon.svg
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||||
|
<stop offset="0%" style="stop-color:#6366f1;stop-opacity:1" />
|
||||||
|
<stop offset="100%" style="stop-color:#0ea5e9;stop-opacity:1" />
|
||||||
|
</linearGradient>
|
||||||
|
<filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
|
||||||
|
<feDropShadow dx="0" dy="4" stdDeviation="4" flood-opacity="0.25"/>
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- Background Circle with Gradient -->
|
||||||
|
<circle cx="256" cy="256" r="240" fill="url(#grad1)" />
|
||||||
|
|
||||||
|
<!-- Gear Icon -->
|
||||||
|
<g transform="translate(106, 106) scale(0.6)" filter="url(#shadow)">
|
||||||
|
<path fill="white" d="M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.5 KiB |
82
src/App.vue
82
src/App.vue
@@ -1,21 +1,58 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
import Header from './components/Header.vue'
|
import Header from './components/Header.vue'
|
||||||
import Footer from './components/Footer.vue'
|
import Footer from './components/Footer.vue'
|
||||||
import Sidebar from './components/Sidebar.vue'
|
import Sidebar from './components/Sidebar.vue'
|
||||||
|
import InstallPrompt from './components/InstallPrompt.vue'
|
||||||
|
|
||||||
const isSidebarOpen = ref(true)
|
const isSidebarOpen = ref(window.innerWidth >= 768)
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
// Close sidebar on route change for mobile
|
||||||
|
router.afterEach(() => {
|
||||||
|
if (window.innerWidth < 768) {
|
||||||
|
isSidebarOpen.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let lastWidth = window.innerWidth
|
||||||
|
|
||||||
|
const handleResize = () => {
|
||||||
|
const width = window.innerWidth
|
||||||
|
// Only change state when crossing the breakpoint
|
||||||
|
if (width >= 768 && lastWidth < 768) {
|
||||||
|
isSidebarOpen.value = true
|
||||||
|
} else if (width < 768 && lastWidth >= 768) {
|
||||||
|
isSidebarOpen.value = false
|
||||||
|
}
|
||||||
|
lastWidth = width
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('resize', handleResize)
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('resize', handleResize)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Header @toggle-sidebar="isSidebarOpen = !isSidebarOpen" />
|
<Header @toggle-sidebar="isSidebarOpen = !isSidebarOpen" />
|
||||||
<div class="app-body">
|
<div class="app-body">
|
||||||
|
<div
|
||||||
|
class="sidebar-overlay"
|
||||||
|
:class="{ 'is-visible': isSidebarOpen }"
|
||||||
|
@click="isSidebarOpen = false"
|
||||||
|
></div>
|
||||||
<Sidebar :is-open="isSidebarOpen" />
|
<Sidebar :is-open="isSidebarOpen" />
|
||||||
<main class="main-content">
|
<main class="main-content">
|
||||||
<router-view />
|
<router-view />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
<InstallPrompt />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -30,6 +67,45 @@ const isSidebarOpen = ref(true)
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%; /* Ensure it doesn't overflow */
|
max-width: 100%;
|
||||||
|
/* Space for fixed footer on mobile + extra margin (match top padding 2rem + footer height ~40px) */
|
||||||
|
padding-bottom: calc(2rem + 40px + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.app-body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
overflow-y: auto;
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: 2rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 900; /* Below sidebar (1000), above content */
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
backdrop-filter: blur(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-overlay.is-visible {
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.sidebar-overlay {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const version = __APP_VERSION__;
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<footer class="app-footer unselectable">
|
<footer class="app-footer glass-panel unselectable">
|
||||||
<div class="footer-content">
|
<div class="footer-content">
|
||||||
<p>© {{ currentYear }} Tools App. v{{ version }}</p>
|
<p>© {{ currentYear }} Tools App. v{{ version }}</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,13 +14,29 @@ const version = __APP_VERSION__;
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.app-footer {
|
.app-footer {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 1rem;
|
padding: 0.5rem;
|
||||||
background-color: #242424;
|
/* Background handled by glass-panel */
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
border-bottom: none;
|
||||||
|
border-radius: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-top: auto; /* Push to bottom in flex container */
|
z-index: 10;
|
||||||
|
/* Remove fixed height to allow content to dictate size */
|
||||||
|
/* height: 30px; */
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.app-footer {
|
||||||
|
position: static;
|
||||||
|
margin-top: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-content {
|
.footer-content {
|
||||||
@@ -31,7 +47,7 @@ const version = __APP_VERSION__;
|
|||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
color: rgba(255, 255, 255, 0.6);
|
color: var(--text-muted);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,13 @@ onMounted(() => {
|
|||||||
<header class="app-header glass-panel unselectable">
|
<header class="app-header glass-panel unselectable">
|
||||||
<div class="header-content">
|
<div class="header-content">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<button class="menu-btn" @click="$emit('toggleSidebar')" aria-label="Toggle Menu" v-ripple>
|
<button
|
||||||
|
class="menu-btn"
|
||||||
|
@click="$emit('toggleSidebar')"
|
||||||
|
aria-label="Toggle Menu"
|
||||||
|
title="Toggle Menu"
|
||||||
|
v-ripple
|
||||||
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<line x1="3" y1="12" x2="21" y2="12"></line>
|
<line x1="3" y1="12" x2="21" y2="12"></line>
|
||||||
<line x1="3" y1="6" x2="21" y2="6"></line>
|
<line x1="3" y1="6" x2="21" y2="6"></line>
|
||||||
@@ -61,7 +67,8 @@ onMounted(() => {
|
|||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
/* box-shadow handled by glass-panel class */
|
/* box-shadow handled by glass-panel class */
|
||||||
position: relative;
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
border-left: none;
|
border-left: none;
|
||||||
border-right: none;
|
border-right: none;
|
||||||
|
|||||||
153
src/components/InstallPrompt.vue
Normal file
153
src/components/InstallPrompt.vue
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="showInstallPrompt" class="install-prompt glass-panel unselectable">
|
||||||
|
<div class="prompt-content">
|
||||||
|
<span class="prompt-text">Install app for faster access</span>
|
||||||
|
<div class="prompt-actions">
|
||||||
|
<button @click="installPWA" class="install-btn">Install</button>
|
||||||
|
<button @click="dismissPrompt" class="dismiss-btn">✕</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||||
|
|
||||||
|
const showInstallPrompt = ref(false)
|
||||||
|
let deferredPrompt = null
|
||||||
|
|
||||||
|
const handleBeforeInstallPrompt = (e) => {
|
||||||
|
// Prevent Chrome 67 and earlier from automatically showing the prompt
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
// Only show install prompt if we are on the specific domain
|
||||||
|
if (window.location.hostname !== 'tools.7u.pl') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stash the event so it can be triggered later.
|
||||||
|
deferredPrompt = e
|
||||||
|
// Update UI to notify the user they can add to home screen
|
||||||
|
showInstallPrompt.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const installPWA = async () => {
|
||||||
|
if (!deferredPrompt) return
|
||||||
|
|
||||||
|
// Show the install prompt
|
||||||
|
deferredPrompt.prompt()
|
||||||
|
|
||||||
|
// Wait for the user to respond to the prompt
|
||||||
|
const { outcome } = await deferredPrompt.userChoice
|
||||||
|
console.log(`User response to the install prompt: ${outcome}`)
|
||||||
|
|
||||||
|
// We've used the prompt, and can't use it again, throw it away
|
||||||
|
deferredPrompt = null
|
||||||
|
showInstallPrompt.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const dismissPrompt = () => {
|
||||||
|
showInstallPrompt.value = false
|
||||||
|
deferredPrompt = null
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('beforeinstallprompt', handleBeforeInstallPrompt)
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
window.removeEventListener('beforeinstallprompt', handleBeforeInstallPrompt)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.install-prompt {
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(5rem + env(safe-area-inset-bottom)); /* Above footer with extra space */
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 90%;
|
||||||
|
max-width: 400px;
|
||||||
|
padding: 1rem;
|
||||||
|
z-index: 9999;
|
||||||
|
animation: slideUp 0.3s ease-out;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt-text {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-strong);
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.install-btn {
|
||||||
|
background-color: var(--primary-accent);
|
||||||
|
color: #000; /* Dark text on bright cyan accent for dark mode */
|
||||||
|
border: none;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dismiss-btn {
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, 20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.install-prompt {
|
||||||
|
bottom: 2rem;
|
||||||
|
right: 2rem;
|
||||||
|
left: auto;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Light theme overrides for better contrast */
|
||||||
|
:global(:root[data-theme="light"]) .install-btn {
|
||||||
|
background-color: var(--accent-purple);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -11,26 +11,49 @@ defineProps({
|
|||||||
<aside class="sidebar unselectable" :class="{ 'is-open': isOpen }">
|
<aside class="sidebar unselectable" :class="{ 'is-open': isOpen }">
|
||||||
<nav class="sidebar-nav">
|
<nav class="sidebar-nav">
|
||||||
<router-link to="/passwords" class="nav-item" v-ripple>Passwords</router-link>
|
<router-link to="/passwords" class="nav-item" v-ripple>Passwords</router-link>
|
||||||
|
<router-link to="/clipboard-sniffer" class="nav-item" v-ripple>Clipboard Sniffer</router-link>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.sidebar {
|
.sidebar {
|
||||||
width: 0;
|
/* Mobile First Styles */
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 250px;
|
||||||
background-color: var(--panel-bg);
|
background-color: var(--panel-bg);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
-webkit-backdrop-filter: blur(12px);
|
-webkit-backdrop-filter: blur(12px);
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
transition: width 0.3s ease;
|
transition: transform 0.3s ease;
|
||||||
border-right: 1px solid var(--panel-border);
|
border-right: 1px solid var(--panel-border);
|
||||||
flex-shrink: 0;
|
z-index: 1000;
|
||||||
height: 100%;
|
|
||||||
box-shadow: var(--panel-shadow);
|
box-shadow: var(--panel-shadow);
|
||||||
|
transform: translateX(-100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar.is-open {
|
.sidebar.is-open {
|
||||||
width: 250px;
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.sidebar {
|
||||||
|
position: static;
|
||||||
|
transform: none;
|
||||||
|
width: 0;
|
||||||
|
height: auto;
|
||||||
|
transition: width 0.3s ease;
|
||||||
|
z-index: auto;
|
||||||
|
box-shadow: none; /* Shadow handled by panel logic or not needed inline */
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar.is-open {
|
||||||
|
width: 250px;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-nav {
|
.sidebar-nav {
|
||||||
@@ -38,11 +61,19 @@ defineProps({
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
width: 250px; /* Fixed width for content */
|
width: 250px; /* Fixed width for content */
|
||||||
|
min-width: 250px;
|
||||||
|
padding-top: 1rem; /* Add some top padding for mobile aesthetic */
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.sidebar-nav {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-item {
|
.nav-item {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 0.5rem;
|
padding: 0.75rem 1rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: background-color 0.2s, color 0.2s;
|
transition: background-color 0.2s, color 0.2s;
|
||||||
|
|||||||
423
src/components/tools/ClipboardSniffer.vue
Normal file
423
src/components/tools/ClipboardSniffer.vue
Normal file
@@ -0,0 +1,423 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, onUnmounted, nextTick, onMounted } from 'vue'
|
||||||
|
import { useFillHeight } from '../../composables/useFillHeight'
|
||||||
|
import { Plug, Info, X } from 'lucide-vue-next'
|
||||||
|
|
||||||
|
const clipboardContent = ref('')
|
||||||
|
const isListening = ref(false)
|
||||||
|
const lastClipboardText = ref('')
|
||||||
|
const textareaRef = ref(null)
|
||||||
|
const isExtensionReady = ref(false)
|
||||||
|
const showExtensionModal = ref(false)
|
||||||
|
let intervalId = null
|
||||||
|
let extensionCheckInterval = null
|
||||||
|
|
||||||
|
const { height: textareaHeight } = useFillHeight(textareaRef, 40) // 40px margin bottom
|
||||||
|
|
||||||
|
// Listen for extension messages
|
||||||
|
const handleExtensionMessage = (event) => {
|
||||||
|
if (event.source !== window) return
|
||||||
|
|
||||||
|
if (event.data.type === 'TOOLS_APP_EXTENSION_READY' || event.data.type === 'TOOLS_APP_PONG') {
|
||||||
|
isExtensionReady.value = true
|
||||||
|
lastPongTime = Date.now()
|
||||||
|
// console.log('Extension is ready')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.data.type === 'TOOLS_APP_CLIPBOARD_UPDATE' && isListening.value) {
|
||||||
|
const text = event.data.content
|
||||||
|
if (text && text !== lastClipboardText.value) {
|
||||||
|
lastClipboardText.value = text
|
||||||
|
clipboardContent.value += (clipboardContent.value ? '\n' : '') + text
|
||||||
|
scrollToBottom()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeModalOnEsc = (e) => {
|
||||||
|
if (e.key === 'Escape' && showExtensionModal.value) {
|
||||||
|
showExtensionModal.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watchdog for extension
|
||||||
|
let lastPongTime = Date.now()
|
||||||
|
const PING_INTERVAL = 200
|
||||||
|
const TIMEOUT_THRESHOLD = 500
|
||||||
|
|
||||||
|
const startExtensionWatchdog = () => {
|
||||||
|
extensionCheckInterval = setInterval(() => {
|
||||||
|
// 1. Send Ping
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_PING' }, '*')
|
||||||
|
|
||||||
|
// 2. Check timeout
|
||||||
|
// If current time - lastPongTime > threshold, then disconnected
|
||||||
|
if (Date.now() - lastPongTime > TIMEOUT_THRESHOLD) {
|
||||||
|
isExtensionReady.value = false
|
||||||
|
}
|
||||||
|
}, PING_INTERVAL)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrapper to intercept PONG and update heartbeat
|
||||||
|
const messageListener = (event) => {
|
||||||
|
if (event.source !== window) return
|
||||||
|
|
||||||
|
if (event.data.type === 'TOOLS_APP_PONG' || event.data.type === 'TOOLS_APP_EXTENSION_READY') {
|
||||||
|
lastPongTime = Date.now()
|
||||||
|
isExtensionReady.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
handleExtensionMessage(event)
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('message', messageListener)
|
||||||
|
window.addEventListener('keydown', closeModalOnEsc)
|
||||||
|
|
||||||
|
// Initial check
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_INIT' }, '*')
|
||||||
|
|
||||||
|
// Start heartbeat
|
||||||
|
startExtensionWatchdog()
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
stopListening()
|
||||||
|
if (extensionCheckInterval) clearInterval(extensionCheckInterval)
|
||||||
|
window.removeEventListener('message', messageListener)
|
||||||
|
window.removeEventListener('keydown', closeModalOnEsc)
|
||||||
|
})
|
||||||
|
|
||||||
|
const scrollToBottom = () => {
|
||||||
|
nextTick(() => {
|
||||||
|
const textarea = document.querySelector('.tool-textarea')
|
||||||
|
if (textarea) {
|
||||||
|
textarea.scrollTop = textarea.scrollHeight
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const startListening = async () => {
|
||||||
|
try {
|
||||||
|
isListening.value = true
|
||||||
|
|
||||||
|
// Try native API first (for web app usage without extension)
|
||||||
|
// Initial read
|
||||||
|
try {
|
||||||
|
const text = await navigator.clipboard.readText()
|
||||||
|
if (text) {
|
||||||
|
lastClipboardText.value = text
|
||||||
|
clipboardContent.value += (clipboardContent.value ? '\n' : '') + text
|
||||||
|
scrollToBottom()
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Native clipboard read failed (expected if not focused), relying on extension if available')
|
||||||
|
}
|
||||||
|
|
||||||
|
// If extension is ready, ask it to start sniffing
|
||||||
|
if (isExtensionReady.value) {
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_START_SNIFFING' }, '*')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback polling for web app (only works when focused usually)
|
||||||
|
intervalId = setInterval(async () => {
|
||||||
|
try {
|
||||||
|
const currentText = await navigator.clipboard.readText()
|
||||||
|
if (currentText && currentText !== lastClipboardText.value) {
|
||||||
|
lastClipboardText.value = currentText
|
||||||
|
clipboardContent.value += (clipboardContent.value ? '\n' : '') + currentText
|
||||||
|
scrollToBottom()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Ignore errors in polling (e.g. lost focus)
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Permission denied or clipboard error:', err)
|
||||||
|
alert('Clipboard access denied. Please allow clipboard access to use this tool.')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const stopListening = () => {
|
||||||
|
isListening.value = false
|
||||||
|
if (intervalId) {
|
||||||
|
clearInterval(intervalId)
|
||||||
|
intervalId = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isExtensionReady.value) {
|
||||||
|
window.postMessage({ type: 'TOOLS_APP_STOP_SNIFFING' }, '*')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearText = () => {
|
||||||
|
clipboardContent.value = ''
|
||||||
|
// Don't reset lastClipboardText so if they copy the same thing again it's detected?
|
||||||
|
// No, if they clear, they might want to see it again if they copy it again.
|
||||||
|
// But usually "change" means diff from clipboard.
|
||||||
|
// If I clear text, but clipboard still has "A", and I copy "A" again (refresh clipboard), readText still returns "A".
|
||||||
|
// So it won't be detected as a change.
|
||||||
|
// If user wants to capture "A" again, they need to copy something else then "A".
|
||||||
|
// That's standard behavior for "sniffer" (detect changes).
|
||||||
|
}
|
||||||
|
|
||||||
|
const copyToClipboard = async () => {
|
||||||
|
if (!clipboardContent.value) return
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(clipboardContent.value)
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to copy to clipboard:', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
stopListening()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="tool-container" style="max-width: 100%;">
|
||||||
|
<div class="tool-panel">
|
||||||
|
<div class="tool-header">
|
||||||
|
<h2 class="tool-title">Clipboard Sniffer</h2>
|
||||||
|
<div
|
||||||
|
class="extension-status"
|
||||||
|
:class="{ 'connected': isExtensionReady }"
|
||||||
|
@click="showExtensionModal = true"
|
||||||
|
:title="isExtensionReady ? 'Extension connected' : 'Extension not detected - Click for info'"
|
||||||
|
>
|
||||||
|
<Plug v-if="isExtensionReady" size="20" />
|
||||||
|
<Info v-else size="20" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<button
|
||||||
|
v-if="!isListening"
|
||||||
|
class="btn-neon"
|
||||||
|
@click="startListening"
|
||||||
|
v-ripple
|
||||||
|
>
|
||||||
|
Start Sniffing
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="btn-neon active"
|
||||||
|
@click="stopListening"
|
||||||
|
v-ripple
|
||||||
|
>
|
||||||
|
Stop Sniffing
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="btn-neon" @click="copyToClipboard" v-ripple>
|
||||||
|
Copy
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button class="btn-neon" @click="clearText" v-ripple>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="result-area" style="margin-top: 1rem;">
|
||||||
|
<div ref="textareaRef" :style="{ height: textareaHeight, width: '100%' }">
|
||||||
|
<textarea
|
||||||
|
v-model="clipboardContent"
|
||||||
|
class="tool-textarea"
|
||||||
|
placeholder="Clipboard content will appear here line by line..."
|
||||||
|
readonly
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Extension Info Modal -->
|
||||||
|
<div v-if="showExtensionModal" class="modal-overlay" @click.self="showExtensionModal = false">
|
||||||
|
<div class="modal-content glass-panel">
|
||||||
|
<button class="close-btn" @click="showExtensionModal = false">
|
||||||
|
<X size="24" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div v-if="!isExtensionReady">
|
||||||
|
<h3>Enhance Your Experience</h3>
|
||||||
|
<p>
|
||||||
|
Install our browser extension to enable <strong>background clipboard sniffing</strong>!
|
||||||
|
</p>
|
||||||
|
<p class="description">
|
||||||
|
Without the extension, this tool can only capture clipboard content when the tab is active.
|
||||||
|
With the extension, you can capture content even when you're working in other apps.
|
||||||
|
</p>
|
||||||
|
<div class="modal-actions">
|
||||||
|
<a href="#" class="btn-neon" @click.prevent>Extension Coming Soon</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
<h3>Extension Connected!</h3>
|
||||||
|
<p>
|
||||||
|
You have successfully enabled <strong>background clipboard sniffing</strong>.
|
||||||
|
</p>
|
||||||
|
<p class="description">
|
||||||
|
The extension is active and monitoring your clipboard in the background.
|
||||||
|
You can now switch to other apps and copy text - it will appear here automatically.
|
||||||
|
</p>
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button class="btn-neon" @click="showExtensionModal = false">Got it!</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tool-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.extension-status {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(:root[data-theme="light"]) .extension-status {
|
||||||
|
background: rgba(0, 0, 0, 0.05);
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.extension-status:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
:global(:root[data-theme="light"]) .extension-status:hover {
|
||||||
|
background: rgba(0, 0, 0, 0.1);
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.extension-status.connected {
|
||||||
|
color: #4ade80; /* Green for connected */
|
||||||
|
cursor: pointer; /* Allow clicking to see status */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :global(:root[data-theme="light"]) .extension-status.connected {
|
||||||
|
color: #16a34a;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.extension-status.connected:hover {
|
||||||
|
background: rgba(74, 222, 128, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :global(:root[data-theme="light"]) .extension-status.connected:hover {
|
||||||
|
background: rgba(22, 163, 74, 0.1);
|
||||||
|
} */
|
||||||
|
|
||||||
|
.modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.7);
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
position: relative;
|
||||||
|
width: 90%;
|
||||||
|
max-width: 500px;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: var(--glass-bg);
|
||||||
|
border: 1px solid var(--glass-border);
|
||||||
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 1rem;
|
||||||
|
right: 1rem;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: all 0.2s;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content h3 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content p {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.description {
|
||||||
|
color: var(--text-secondary) !important;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin-bottom: 2rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-neon {
|
||||||
|
padding: 0.75rem 1.5rem;
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-neon.active {
|
||||||
|
background: rgba(255, 0, 0, 0.2);
|
||||||
|
border-color: rgba(255, 0, 0, 0.5);
|
||||||
|
box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-textarea {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,15 +1,374 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useFillHeight } from '../../composables/useFillHeight';
|
||||||
|
|
||||||
|
// Options
|
||||||
|
const useLower = ref(true);
|
||||||
|
const useUpper = ref(true);
|
||||||
|
const useDigits = ref(true);
|
||||||
|
const useSpecial = ref(false);
|
||||||
|
const skipSimilar = ref(true);
|
||||||
|
const length = ref(16);
|
||||||
|
const count = ref(20);
|
||||||
|
|
||||||
|
// Result
|
||||||
|
const result = ref('');
|
||||||
|
const textareaRef = ref(null);
|
||||||
|
const { height: textareaHeight } = useFillHeight(textareaRef, 40);
|
||||||
|
|
||||||
|
// Character Sets
|
||||||
|
const CHARS_LOWER = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
const CHARS_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
const CHARS_DIGITS = '0123456789';
|
||||||
|
const CHARS_SPECIAL = '!@#$%^&*()_+~`|}{[]:;?><,./-=';
|
||||||
|
const CHARS_SIMILAR = /[Il1O0o]/g;
|
||||||
|
|
||||||
|
const generatePasswords = () => {
|
||||||
|
let charset = '';
|
||||||
|
if (useLower.value) charset += CHARS_LOWER;
|
||||||
|
if (useUpper.value) charset += CHARS_UPPER;
|
||||||
|
if (useDigits.value) charset += CHARS_DIGITS;
|
||||||
|
if (useSpecial.value) charset += CHARS_SPECIAL;
|
||||||
|
|
||||||
|
if (skipSimilar.value) {
|
||||||
|
charset = charset.replace(CHARS_SIMILAR, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!charset) {
|
||||||
|
result.value = 'Please select at least one character set.';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const passwords = [];
|
||||||
|
const charsetLength = charset.length;
|
||||||
|
|
||||||
|
// We need (count * length) random values.
|
||||||
|
// However, crypto.getRandomValues has a limit on array size (65536 bytes).
|
||||||
|
// So we'll generate one random value per character needed in a loop or batch.
|
||||||
|
// For simplicity and safety, let's generate per password or per character if needed.
|
||||||
|
// The most robust way for "bulk" is to just loop.
|
||||||
|
|
||||||
|
for (let i = 0; i < count.value; i++) {
|
||||||
|
let password = '';
|
||||||
|
// Create a typed array for the random values for this password
|
||||||
|
const randomValues = new Uint32Array(length.value);
|
||||||
|
crypto.getRandomValues(randomValues);
|
||||||
|
|
||||||
|
for (let j = 0; j < length.value; j++) {
|
||||||
|
// Use modulo to map the random 32-bit integer to a charset index
|
||||||
|
// Note: This introduces a tiny bias if charsetLength is not a power of 2,
|
||||||
|
// but for typical password generation it is negligible compared to Math.random().
|
||||||
|
// For cryptographic perfection, rejection sampling would be needed,
|
||||||
|
// but this is standard practice for password managers.
|
||||||
|
const randomIndex = randomValues[j] % charsetLength;
|
||||||
|
password += charset[randomIndex];
|
||||||
|
}
|
||||||
|
passwords.push(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
result.value = passwords.join('\n');
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="passwords-tool">
|
<div class="tool-container full-width">
|
||||||
<h2>Passwords Generator</h2>
|
<div class="tool-panel">
|
||||||
<p>This is the passwords generator tool (work in progress).</p>
|
<div class="panel-header">
|
||||||
|
<h2 class="tool-title">Bulk Passwords Generator</h2>
|
||||||
|
<div class="action-area">
|
||||||
|
<button class="btn-neon generate-btn" @click="generatePasswords" v-ripple>
|
||||||
|
Generate
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="options-grid">
|
||||||
|
<div class="checkbox-group">
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="useLower">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
Lower Case (a-z)
|
||||||
|
</label>
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="useUpper">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
Upper Case (A-Z)
|
||||||
|
</label>
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="useDigits">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
Digits (0-9)
|
||||||
|
</label>
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="useSpecial">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
Special Chars
|
||||||
|
</label>
|
||||||
|
<label class="checkbox-label">
|
||||||
|
<input type="checkbox" v-model="skipSimilar">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
Skip Similar (I, l, 1, O, 0, o)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="inputs-group">
|
||||||
|
<div class="input-wrapper">
|
||||||
|
<label>Length</label>
|
||||||
|
<div class="number-control">
|
||||||
|
<button class="control-btn" @click="length > 4 ? length-- : null">-</button>
|
||||||
|
<input type="number" v-model="length" min="4" max="128" class="number-input">
|
||||||
|
<button class="control-btn" @click="length < 128 ? length++ : null">+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="input-wrapper">
|
||||||
|
<label>Count</label>
|
||||||
|
<div class="number-control">
|
||||||
|
<button class="control-btn" @click="count > 1 ? count-- : null">-</button>
|
||||||
|
<input type="number" v-model="count" min="1" max="1000" class="number-input">
|
||||||
|
<button class="control-btn" @click="count < 1000 ? count++ : null">+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="result-area" :style="{ height: textareaHeight }">
|
||||||
|
<textarea
|
||||||
|
class="tool-textarea"
|
||||||
|
v-model="result"
|
||||||
|
placeholder="Generated passwords will appear here..."
|
||||||
|
readonly
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.passwords-tool {
|
.tool-container.full-width {
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
gap: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-title {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.options-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 2rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
background: var(--toggle-bg);
|
||||||
|
border: 1px solid var(--toggle-border);
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-group {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 1.5rem;
|
||||||
|
flex: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputs-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 2rem;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom Checkbox */
|
||||||
|
.checkbox-label input {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
height: 0;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkmark {
|
||||||
|
position: relative;
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
background-color: var(--toggle-bg);
|
||||||
|
border: 1px solid var(--toggle-border);
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-label:hover .checkmark {
|
||||||
|
border-color: var(--toggle-hover-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-label input:checked ~ .checkmark {
|
||||||
|
background-color: var(--primary-accent);
|
||||||
|
border-color: var(--primary-accent);
|
||||||
|
box-shadow: 0 0 10px var(--primary-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkmark:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-label input:checked ~ .checkmark:after {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-label .checkmark:after {
|
||||||
|
left: 6px;
|
||||||
|
top: 2px;
|
||||||
|
width: 5px;
|
||||||
|
height: 10px;
|
||||||
|
border: solid #000;
|
||||||
|
border-width: 0 2px 2px 0;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Number Control */
|
||||||
|
.number-control {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
background: var(--toggle-bg);
|
||||||
|
border: 1px solid var(--toggle-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-btn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-color);
|
||||||
|
font-size: 1.2rem;
|
||||||
|
width: 40px;
|
||||||
|
height: auto;
|
||||||
|
min-height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.2s;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-btn:hover {
|
||||||
|
background: var(--button-hover-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.number-input {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-color);
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
appearance: textfield;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 0;
|
||||||
|
min-width: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.number-input:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
background: rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.number-input::-webkit-outer-spin-button,
|
||||||
|
.number-input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-area {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid var(--glass-border);
|
||||||
|
background: var(--glass-bg);
|
||||||
|
color: var(--text-color);
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
resize: none;
|
||||||
|
outline: none;
|
||||||
|
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.generate-btn {
|
||||||
|
padding: 0.75rem 2rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.options-grid {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inputs-group {
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel-header {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.generate-btn {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
47
src/composables/useFillHeight.js
Normal file
47
src/composables/useFillHeight.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import { onMounted, onUnmounted, ref, nextTick } from 'vue'
|
||||||
|
|
||||||
|
export function useFillHeight(elementRef, marginBottom = 20) {
|
||||||
|
const height = ref('auto')
|
||||||
|
|
||||||
|
const updateHeight = () => {
|
||||||
|
if (!elementRef.value) return
|
||||||
|
|
||||||
|
const rect = elementRef.value.getBoundingClientRect()
|
||||||
|
const windowHeight = window.innerHeight
|
||||||
|
// Calculate available space: window height - element top position - margin bottom
|
||||||
|
// We also need to account for the footer height if it's fixed or layout related
|
||||||
|
// The user mentioned "margin bottom from footer".
|
||||||
|
// If footer is in the flow, we might just want to fill the parent container?
|
||||||
|
// But user asked for JS resizing.
|
||||||
|
|
||||||
|
// Let's assume we want to fill down to (windowHeight - marginBottom).
|
||||||
|
// This assumes the element should stretch to the bottom of the viewport.
|
||||||
|
|
||||||
|
const availableHeight = windowHeight - rect.top - marginBottom
|
||||||
|
|
||||||
|
// Ensure minimum height
|
||||||
|
if (availableHeight > 100) {
|
||||||
|
height.value = `${availableHeight}px`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// Initial update after render
|
||||||
|
nextTick(() => {
|
||||||
|
updateHeight()
|
||||||
|
window.addEventListener('resize', updateHeight)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Also update after a short delay to ensure layout is settled (e.g. sidebar transitions)
|
||||||
|
setTimeout(updateHeight, 300)
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('resize', updateHeight)
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
height,
|
||||||
|
updateHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import Main from '../components/Main.vue'
|
import Main from '../components/Main.vue'
|
||||||
import Passwords from '../components/tools/Passwords.vue'
|
import Passwords from '../components/tools/Passwords.vue'
|
||||||
|
import ClipboardSniffer from '../components/tools/ClipboardSniffer.vue'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
@@ -12,6 +13,11 @@ const routes = [
|
|||||||
path: '/passwords',
|
path: '/passwords',
|
||||||
name: 'Passwords',
|
name: 'Passwords',
|
||||||
component: Passwords
|
component: Passwords
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/clipboard-sniffer',
|
||||||
|
name: 'ClipboardSniffer',
|
||||||
|
component: ClipboardSniffer
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
146
src/style.css
146
src/style.css
@@ -1,3 +1,9 @@
|
|||||||
|
/* Box sizing reset */
|
||||||
|
*, *::before, *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@import 'tailwindcss';
|
||||||
:root {
|
:root {
|
||||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
@@ -49,7 +55,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:root[data-theme="light"] {
|
:root[data-theme="light"] {
|
||||||
--bg-gradient: radial-gradient(circle at center, #ffffff 0%, #cccccc 100%);
|
--bg-gradient: radial-gradient(circle at center, #ffffff 0%, #e5e7eb 100%);
|
||||||
--glass-bg: rgba(255, 255, 255, 0.75);
|
--glass-bg: rgba(255, 255, 255, 0.75);
|
||||||
--glass-border: rgba(15, 23, 42, 0.12);
|
--glass-border: rgba(15, 23, 42, 0.12);
|
||||||
--glass-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.12);
|
--glass-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.12);
|
||||||
@@ -85,15 +91,145 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
min-width: 320px;
|
min-width: 320px;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
overflow-x: hidden;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selectable {
|
||||||
|
user-select: text;
|
||||||
|
-webkit-user-select: text;
|
||||||
|
cursor: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
body {
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Shared styles for all tools (moved from tools.css) --- */
|
||||||
|
|
||||||
|
.tool-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
height: 100%;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel {
|
||||||
|
width: 100%;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
background: var(--glass-bg);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
border: 1px solid var(--glass-border);
|
||||||
|
box-shadow: var(--glass-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom scrollbar for tool panel */
|
||||||
|
.tool-panel::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel::-webkit-scrollbar-track {
|
||||||
|
background: rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-title {
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
background: var(--title-gradient);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
color: transparent;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
filter: drop-shadow(0 0 10px var(--title-glow));
|
||||||
|
}
|
||||||
|
|
||||||
|
:root[data-theme="light"] .tool-title {
|
||||||
|
/* background: none !important;
|
||||||
|
-webkit-background-clip: unset !important;
|
||||||
|
background-clip: unset !important;
|
||||||
|
color: #000000 !important;
|
||||||
|
-webkit-text-fill-color: #000000 !important;
|
||||||
|
filter: none !important; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2) !important;
|
||||||
|
border: 1px solid var(--toggle-border);
|
||||||
|
border-radius: 12px;
|
||||||
|
color: #ffffff !important; /* Explicit white color for dark mode */
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
resize: none;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root[data-theme="light"] .tool-textarea {
|
||||||
|
color: #000000 !important;
|
||||||
|
background-color: rgba(255, 255, 255, 0.5) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #00f2fe !important; /* Force cyan accent */
|
||||||
|
box-shadow: 0 0 0 1px #00f2fe !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-area {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-area label {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
/* Common UI Element Styles */
|
/* Common UI Element Styles */
|
||||||
.glass-panel {
|
.glass-panel {
|
||||||
background: var(--glass-bg);
|
background: var(--glass-bg);
|
||||||
@@ -120,6 +256,12 @@ body {
|
|||||||
outline: none; /* Remove focus outline */
|
outline: none; /* Remove focus outline */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Global button styles */
|
||||||
|
button {
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove focus outline for all buttons */
|
/* Remove focus outline for all buttons */
|
||||||
button:focus {
|
button:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|||||||
107
src/styles/tools.css
Normal file
107
src/styles/tools.css
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
/* Shared styles for all tools */
|
||||||
|
|
||||||
|
.tool-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
height: 100%;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel {
|
||||||
|
width: 100%;
|
||||||
|
padding: 2rem;
|
||||||
|
border-radius: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.5rem;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
background: var(--glass-bg);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
border: 1px solid var(--glass-border);
|
||||||
|
box-shadow: var(--glass-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Custom scrollbar for tool panel */
|
||||||
|
.tool-panel::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel::-webkit-scrollbar-track {
|
||||||
|
background: rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel::-webkit-scrollbar-thumb {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-panel::-webkit-scrollbar-thumb:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-title {
|
||||||
|
margin: 0;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
background: var(--title-gradient);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
color: transparent;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
filter: drop-shadow(0 0 10px var(--title-glow));
|
||||||
|
}
|
||||||
|
|
||||||
|
:root[data-theme="light"] .tool-title {
|
||||||
|
background: none;
|
||||||
|
-webkit-background-clip: unset;
|
||||||
|
background-clip: unset;
|
||||||
|
color: #000000;
|
||||||
|
-webkit-text-fill-color: #000000;
|
||||||
|
filter: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
border: 1px solid var(--toggle-border);
|
||||||
|
border-radius: 12px;
|
||||||
|
color: #ffffff; /* Explicit white color for dark mode */
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
resize: none;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root[data-theme="light"] .tool-textarea {
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #00f2fe; /* Force cyan accent */
|
||||||
|
box-shadow: 0 0 0 1px #00f2fe;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-area {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-area label {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
@@ -1,10 +1,46 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
import packageJson from './package.json'
|
import packageJson from './package.json'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
VitePWA({
|
||||||
|
registerType: 'autoUpdate',
|
||||||
|
includeAssets: ['favicon.svg'],
|
||||||
|
manifest: {
|
||||||
|
name: 'Tools App',
|
||||||
|
short_name: 'Tools',
|
||||||
|
description: 'A collection of useful tools',
|
||||||
|
theme_color: '#4facfe',
|
||||||
|
background_color: '#242424',
|
||||||
|
display: 'standalone',
|
||||||
|
orientation: 'portrait',
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
src: 'favicon.svg',
|
||||||
|
sizes: 'any',
|
||||||
|
type: 'image/svg+xml',
|
||||||
|
purpose: 'any maskable'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
workbox: {
|
||||||
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,json,vue,txt,woff2}'],
|
||||||
|
cleanupOutdatedCaches: true,
|
||||||
|
clientsClaim: true,
|
||||||
|
skipWaiting: true
|
||||||
|
},
|
||||||
|
devOptions: {
|
||||||
|
enabled: true,
|
||||||
|
/* when using generateSW the PWA plugin will switch to classic */
|
||||||
|
type: 'module',
|
||||||
|
navigateFallback: 'index.html',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
],
|
||||||
define: {
|
define: {
|
||||||
'__APP_VERSION__': JSON.stringify(packageJson.version)
|
'__APP_VERSION__': JSON.stringify(packageJson.version)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user