* escaped node modules from vcs * feat: added copy to clipboard feature * feat: added tests * feat: added feature spec * feat: added toggle for save to pc * feat: added tests * refactor: change toggle from '?' button to the 'switch' component * Fix failing tests * Update gitignore and remove unnecessary files * Remove tooltips because they are unnecessary --------- Co-authored-by: Joey Yakimowich-Payne <jyapayne@gmail.com>
272 lines
No EOL
5.7 KiB
HTML
272 lines
No EOL
5.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
body {
|
|
width: 300px;
|
|
padding: 20px;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
margin: 0;
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.header h1 {
|
|
margin: 0 0 10px 0;
|
|
font-size: 18px;
|
|
color: #333;
|
|
}
|
|
|
|
.header p {
|
|
margin: 0;
|
|
font-size: 12px;
|
|
color: #666;
|
|
}
|
|
|
|
.setting-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.setting-group label {
|
|
display: block;
|
|
margin-bottom: 8px;
|
|
font-weight: 500;
|
|
color: #333;
|
|
font-size: 14px;
|
|
}
|
|
|
|
select {
|
|
width: 100%;
|
|
padding: 8px 12px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
background: white;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.btn {
|
|
width: 100%;
|
|
padding: 12px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #007bff;
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #0056b3;
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: #6c757d;
|
|
color: white;
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: #545b62;
|
|
}
|
|
|
|
.toggle-container {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.toggle-label {
|
|
font-weight: 500;
|
|
color: #333;
|
|
font-size: 14px;
|
|
margin: 0;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.toggle-switch {
|
|
position: relative;
|
|
display: inline-block;
|
|
width: 44px;
|
|
height: 24px;
|
|
}
|
|
|
|
.toggle-switch input {
|
|
opacity: 0;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
.toggle-slider {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: #ccc;
|
|
transition: 0.3s;
|
|
border-radius: 24px;
|
|
}
|
|
|
|
.toggle-slider:before {
|
|
position: absolute;
|
|
content: "";
|
|
height: 18px;
|
|
width: 18px;
|
|
left: 3px;
|
|
bottom: 3px;
|
|
background-color: white;
|
|
transition: 0.3s;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
input:checked + .toggle-slider {
|
|
background-color: #007bff;
|
|
}
|
|
|
|
input:focus + .toggle-slider {
|
|
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
|
|
}
|
|
|
|
input:checked + .toggle-slider:before {
|
|
transform: translateX(20px);
|
|
}
|
|
|
|
.toggle-help {
|
|
font-size: 11px;
|
|
color: #666;
|
|
margin-top: 4px;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
.shortcut-info {
|
|
font-size: 11px;
|
|
color: #666;
|
|
text-align: center;
|
|
margin-top: 10px;
|
|
padding: 8px;
|
|
background: #e9ecef;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.status {
|
|
text-align: center;
|
|
padding: 8px;
|
|
border-radius: 4px;
|
|
margin: 10px 0;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.status.success {
|
|
background: #d4edda;
|
|
color: #155724;
|
|
}
|
|
|
|
.status.error {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
|
|
.status.warning {
|
|
background: #fff3cd;
|
|
color: #856404;
|
|
border: 1px solid #ffeaa7;
|
|
}
|
|
|
|
.btn:disabled {
|
|
background: #6c757d;
|
|
color: #fff;
|
|
cursor: not-allowed;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.btn:disabled:hover {
|
|
background: #6c757d;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>📸 Screenshot Selector</h1>
|
|
<p>Capture full element screenshots</p>
|
|
</div>
|
|
|
|
<div class="setting-group">
|
|
<label for="background-select">Background Color:</label>
|
|
<select id="background-select">
|
|
<option value="black">Black</option>
|
|
<option value="transparent">Transparent</option>
|
|
<option value="white">White</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="setting-group">
|
|
<div class="toggle-container">
|
|
<label class="toggle-label">Save to PC</label>
|
|
<label class="toggle-switch" for="save-to-pc-toggle">
|
|
<input
|
|
type="checkbox"
|
|
id="save-to-pc-toggle"
|
|
checked
|
|
aria-describedby="save-to-pc-help"
|
|
aria-label="Toggle save screenshot to PC"
|
|
>
|
|
<span class="toggle-slider" role="presentation"></span>
|
|
</label>
|
|
</div>
|
|
<div id="save-to-pc-help" class="toggle-help">
|
|
Automatically download screenshots as PNG files to your default downloads folder.
|
|
</div>
|
|
</div>
|
|
|
|
<div class="setting-group">
|
|
<div class="toggle-container">
|
|
<label class="toggle-label">Copy to Clipboard</label>
|
|
<label class="toggle-switch" for="clipboard-toggle">
|
|
<input
|
|
type="checkbox"
|
|
id="clipboard-toggle"
|
|
checked
|
|
aria-describedby="clipboard-help"
|
|
aria-label="Toggle copy screenshot to clipboard"
|
|
>
|
|
<span class="toggle-slider" role="presentation"></span>
|
|
</label>
|
|
</div>
|
|
<div id="clipboard-help" class="toggle-help">
|
|
Automatically copy screenshots to your clipboard for quick pasting.
|
|
</div>
|
|
</div>
|
|
|
|
<div id="validation-warning" class="status warning" style="display: none;" role="alert" aria-live="polite">
|
|
⚠️ Please enable at least one output method (Save to PC or Copy to Clipboard) to capture screenshots.
|
|
</div>
|
|
|
|
<button id="start-selector" class="btn btn-primary">
|
|
Start Element Selector
|
|
</button>
|
|
|
|
<button id="stop-selector" class="btn btn-secondary" style="display: none;">
|
|
Stop Selector
|
|
</button>
|
|
|
|
<div id="status" class="status" style="display: none;"></div>
|
|
|
|
<div class="shortcut-info">
|
|
💡 Tip: Use <strong>Alt+Shift+S</strong> (or Option+Shift+S on Mac) to quickly activate
|
|
</div>
|
|
|
|
<script src="popup.js"></script>
|
|
</body>
|
|
</html> |