dekindled/options.html
2025-06-07 14:47:25 -07:00

177 lines
No EOL
5.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>DeKindled Options</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 600px;
margin: 40px auto;
padding: 20px;
background: #f5f5f5;
}
.container {
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
color: #1976d2;
margin-bottom: 30px;
display: flex;
align-items: center;
gap: 10px;
}
.section {
margin-bottom: 30px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #333;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 12px;
border: 2px solid #ddd;
border-radius: 4px;
font-size: 14px;
box-sizing: border-box;
}
input[type="text"]:focus, input[type="password"]:focus {
outline: none;
border-color: #1976d2;
}
textarea {
width: 100%;
padding: 12px;
border: 2px solid #ddd;
border-radius: 4px;
font-size: 14px;
box-sizing: border-box;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
line-height: 1.4;
resize: vertical;
}
textarea:focus {
outline: none;
border-color: #1976d2;
}
.help-text {
font-size: 12px;
color: #666;
margin-top: 5px;
line-height: 1.4;
}
.help-text a {
color: #1976d2;
text-decoration: none;
}
.help-text a:hover {
text-decoration: underline;
}
button {
background: #1976d2;
color: white;
border: none;
padding: 12px 24px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
}
button:hover {
background: #1565c0;
}
button:disabled {
background: #ccc;
cursor: not-allowed;
}
.reset-btn {
background: #6c757d;
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
font-weight: 500;
margin-top: 8px;
}
.reset-btn:hover {
background: #5a6268;
}
.status {
margin-top: 15px;
padding: 10px;
border-radius: 4px;
font-size: 14px;
}
.status.success {
background: #e8f5e8;
color: #2e7d32;
border: 1px solid #4caf50;
}
.status.error {
background: #fce8e8;
color: #d32f2f;
border: 1px solid #f44336;
}
.api-key-status {
margin-top: 10px;
font-size: 12px;
}
.api-key-status.valid {
color: #2e7d32;
}
.api-key-status.invalid {
color: #d32f2f;
}
</style>
</head>
<body>
<div class="container">
<h1>📚 DeKindled Options</h1>
<div class="section">
<label for="apiKey">OpenAI API Key:</label>
<input type="password" id="apiKey" placeholder="sk-...">
<div class="help-text">
Get your API key from <a href="https://platform.openai.com/api-keys" target="_blank">OpenAI Platform</a>.
Your key is stored securely in your browser and never shared.
</div>
<div id="apiKeyStatus" class="api-key-status"></div>
</div>
<div class="section">
<label for="bookTitle">Default Book Title:</label>
<input type="text" id="bookTitle" placeholder="My DeKindled Book" value="DeKindled Book">
<div class="help-text">
Default title to use for generated EPUB files. You can override this during conversion.
</div>
</div>
<div class="section">
<label for="analysisPrompt">Analysis Prompt:</label>
<textarea id="analysisPrompt" rows="12" placeholder="Enter the prompt used for analyzing book pages..."></textarea>
<div class="help-text">
The prompt sent to OpenAI for analyzing each book page. This controls how the AI interprets and converts the scanned text to markdown.
<br><strong>Advanced setting:</strong> Modify only if you want to customize the conversion behavior.
</div>
<button id="resetPromptBtn" class="reset-btn">Reset to Default</button>
</div>
<div style="display: flex; gap: 10px; align-items: center;">
<button id="saveBtn">Save Settings</button>
<button id="testBtn" disabled>Test API Key</button>
</div>
<div id="status"></div>
</div>
<script src="options.js"></script>
</body>
</html>