feat(popup): add toolbar action popup for link inspection and manual input

- Detect stored captured magnet link and show status indicator
- Provide Continue button to launch pairing page with captured link
- Add manual entry field and demo link filler for quick testing
This commit is contained in:
kiskaadee committed 2026-09-25 16:45:28 -05:00
1 parent d2bd0895f8
commit 6bb6b3a1ea
3 files changed
+258

No files matched your search

+154
View File
@@ -0,0 +1,154 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: #121214;
color: #ededed;
width: 360px;
padding: 16px;
}
.popup-container {
display: flex;
flex-direction: column;
gap: 14px;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #27272a;
padding-bottom: 10px;
}
.brand {
display: flex;
align-items: center;
gap: 8px;
}
.icon {
font-size: 20px;
}
.title {
font-weight: 700;
font-size: 16px;
color: #e50914;
letter-spacing: 0.5px;
}
.tag {
font-size: 10px;
text-transform: uppercase;
background: #27272a;
color: #a1a1aa;
padding: 2px 6px;
border-radius: 4px;
}
.subtitle {
font-size: 12px;
color: #a1a1aa;
line-height: 1.4;
margin-bottom: 10px;
}
.status-indicator {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.dot {
width: 8px;
height: 8px;
background-color: #22c55e;
border-radius: 50%;
box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.status-text {
font-size: 14px;
font-weight: 600;
color: #ffffff;
}
.magnet-preview {
background: #1c1c1f;
border: 1px solid #2e2e33;
border-radius: 8px;
padding: 10px;
font-family: monospace;
font-size: 11px;
color: #a1a1aa;
word-break: break-all;
max-height: 70px;
overflow-y: auto;
margin-bottom: 12px;
}
.input-group input {
width: 100%;
padding: 9px 12px;
background-color: #1c1c1f;
border: 1px solid #3f3f46;
border-radius: 6px;
color: #ffffff;
font-size: 12px;
outline: none;
transition: border-color 0.15s;
}
.input-group input:focus {
border-color: #e50914;
}
.actions {
display: flex;
gap: 8px;
margin-top: 10px;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 8px 14px;
border-radius: 6px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
border: none;
transition: background 0.15s, opacity 0.15s;
}
.btn-primary {
background: #e50914;
color: #ffffff;
flex: 1;
}
.btn-primary:hover {
background: #f6121d;
}
.btn-secondary {
background: #27272a;
color: #d4d4d8;
}
.btn-secondary:hover {
background: #3f3f46;
}
.hidden {
display: none !important;
}
+48
View File
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Magnetflix</title>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<div class="popup-container">
<div class="header">
<div class="brand">
<span class="icon">🧲</span>
<span class="title">Magnetflix</span>
</div>
<span class="tag">Proof of Concept</span>
</div>
<div id="captured-state" class="state-panel hidden">
<div class="status-indicator">
<span class="dot"></span>
<span class="status-text">Magnet link captured!</span>
</div>
<div class="magnet-preview" id="magnet-display"></div>
<button id="btn-continue-captured" class="btn btn-primary">
<span>Continue to IMDb Match</span>
<span>→</span>
</button>
</div>
<div id="manual-state" class="state-panel">
<p class="subtitle">Click any magnet link on the web, or paste one below to pair with IMDb:</p>
<div class="input-group">
<input
type="text"
id="manual-magnet-input"
placeholder="magnet:?xt=urn:btih:..."
autocomplete="off"
/>
</div>
<div class="actions">
<button id="btn-continue-manual" class="btn btn-primary">Continue</button>
<button id="btn-load-demo" class="btn btn-secondary">Use Sample Link</button>
</div>
</div>
</div>
<script src="popup.js"></script>
</body>
</html>
+56
View File
@@ -0,0 +1,56 @@
// popup.js for Magnetflix toolbar popup
const browserAPI = window.browser || window.chrome;
const SAMPLE_MAGNET = "magnet:?xt=urn:btih:1234567890abcdef1234567890abcdef12345678&dn=Perfect.Blue.1997.1080p.BluRay.x264";
document.addEventListener("DOMContentLoaded", () => {
const capturedPanel = document.getElementById("captured-state");
const manualPanel = document.getElementById("manual-state");
const magnetDisplay = document.getElementById("magnet-display");
const manualInput = document.getElementById("manual-magnet-input");
const btnContinueCaptured = document.getElementById("btn-continue-captured");
const btnContinueManual = document.getElementById("btn-continue-manual");
const btnLoadDemo = document.getElementById("btn-load-demo");
let currentCapturedMagnet = "";
// Check if a magnet was captured recently (within last 24h)
browserAPI.storage.local.get(["lastMagnet", "lastCapturedAt"], (result) => {
if (result && result.lastMagnet) {
currentCapturedMagnet = result.lastMagnet;
magnetDisplay.textContent = currentCapturedMagnet;
capturedPanel.classList.remove("hidden");
}
});
function openApp(magnetUrl) {
browserAPI.runtime.sendMessage(
{
action: "open_app",
magnet: magnetUrl
},
() => {
window.close();
}
);
}
btnContinueCaptured.addEventListener("click", () => {
if (currentCapturedMagnet) {
openApp(currentCapturedMagnet);
}
});
btnContinueManual.addEventListener("click", () => {
const val = manualInput.value.trim();
if (val) {
openApp(val);
} else {
manualInput.focus();
}
});
btnLoadDemo.addEventListener("click", () => {
manualInput.value = SAMPLE_MAGNET;
});
});