Files

188 lines
4.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
body {
width: 320px;
padding: 15px;
font-family: Arial, sans-serif;
}
h3 {
margin: 0 0 10px 0;
font-size: 16px;
}
.toggle-container {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 15px;
}
.switch {
position: relative;
display: inline-block;
width: 50px;
height: 24px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 24px;
}
.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #4CAF50;
}
input:checked + .slider:before {
transform: translateX(26px);
}
#status {
font-size: 12px;
color: #666;
margin-top: 10px;
}
.info {
font-size: 11px;
color: #888;
margin-top: 10px;
line-height: 1.4;
}
.api-section {
margin-top: 15px;
padding-top: 15px;
border-top: 1px solid #eee;
}
.api-section label {
display: block;
font-size: 12px;
margin-bottom: 5px;
font-weight: bold;
}
.api-section input[type="text"] {
width: 100%;
padding: 6px;
font-size: 11px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
margin-bottom: 8px;
}
.api-section button {
width: 100%;
padding: 6px;
font-size: 11px;
background: #0078d4;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.api-section button:hover {
background: #106ebe;
}
.api-status {
font-size: 11px;
margin-top: 5px;
padding: 5px;
border-radius: 3px;
}
.api-status.success {
background: #d4edda;
color: #155724;
}
.api-status.error {
background: #f8d7da;
color: #721c24;
}
.warning {
background: #fff3cd;
border: 1px solid #ffc107;
padding: 10px;
border-radius: 4px;
font-size: 11px;
margin-bottom: 15px;
}
.warning strong {
display: block;
margin-bottom: 5px;
}
.retry-btn {
padding: 6px 12px;
font-size: 11px;
background: #28a745;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.retry-btn:hover {
background: #218838;
}
.retry-btn:disabled {
background: #ccc;
cursor: not-allowed;
}
</style>
</head>
<body>
<h3>Quiz Helper</h3>
<div class="warning">
<strong>⚠️ API Key Required</strong>
This extension requires an OpenAI API key to work. Add your key below to get started.
</div>
<div class="api-section">
<label>OpenAI API Key (Required):</label>
<input type="text" id="apiKey" placeholder="sk-..." />
<button id="saveApiKey">Save API Key</button>
<div id="apiStatus" class="api-status" style="display: none;"></div>
<div class="info">
Get a free API key at <a href="https://platform.openai.com/api-keys" target="_blank">platform.openai.com</a>.
New accounts get $5 in free credits. Cost per question: ~$0.002 with GPT-4o.
</div>
</div>
<div class="toggle-container">
<label class="switch">
<input type="checkbox" id="toggleSwitch">
<span class="slider"></span>
</label>
<span id="toggleLabel">Off</span>
<button id="retryBtn" class="retry-btn">Retry Scan</button>
</div>
<div id="status"></div>
<div class="info">
When enabled, GPT-4o will analyze quiz questions and highlight correct answers in <strong style="color: #28a745;">green</strong>.
Questions without highlighting mean the AI couldn't determine the answer with confidence.
<br><br>
Check the browser console (F12) for detailed logs and reasoning.
</div>
<script src="popup.js"></script>
</body>
</html>