hygiene: minimalist unification with chess tool (F tokens) + prune legacy
- plugin/manager.html: replace stark B mono (#ffffff/#0a0a0a, radius 0) with chess F Cleaned D+B tokens (#f8f8f8/#ddd, radius 8px, soft shadow, Inter + iA Writer Duo) — same :root, --bg/--panel/--line/--accent/--radius, unified tabs as underline (vs boxed), cards/tables/pills with shadow. Update inline JS styles (#0a0a0a -> var(--accent)/var(--line)) for reimport bar, infobox, status, artifacts. - plugin/bootstrap.js: remove 394 lines legacy static-dashboard code (openStaticDashboard, buildManagerHtml, conflictRows, groupedRows, tableRows, conflictTables, statusCards, countStatuses, escapeHtml, fileHref, artifactLink, importClippings, configure, pickDirectory) — now only manager pipeline + annotation writer remain (881 vs 1275 lines). - src/kindle_zotero_importer/cli.py: minimalist description, primary highlighted (others are developer utilities). - Build verified: tests pass, XPI rebuilt 23K, JS syntax ok.
This commit is contained in:
parent
0aded721e1
commit
8096d23e4f
3 changed files with 128 additions and 478 deletions
394
plugin/bootstrap.js
vendored
394
plugin/bootstrap.js
vendored
|
|
@ -206,27 +206,6 @@ var KindleZoteroImporter = {
|
||||||
return ok && value.value ? value.value : null;
|
return ok && value.value ? value.value : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
async configure() {
|
|
||||||
const current = {
|
|
||||||
projectDir: this.getProjectDir(),
|
|
||||||
pythonPath: this.getPythonPath(),
|
|
||||||
zoteroDbPath: this.getZoteroDbPath(),
|
|
||||||
zoteroStorageRoot: this.getZoteroStorageRoot(),
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
const configPath = this.getConfigPath();
|
|
||||||
await Zotero.File.putContentsAsync(configPath, JSON.stringify(current, null, 2) + "\n");
|
|
||||||
this.alert(
|
|
||||||
"Kindle Zotero Importer Configuration",
|
|
||||||
`Configuration file written to:\n${configPath}\n\nEdit this file to change paths. The import dialog will show the active settings before running.`
|
|
||||||
);
|
|
||||||
this.revealFile(configPath);
|
|
||||||
} catch (error) {
|
|
||||||
Zotero.logError(error);
|
|
||||||
this.alert("Kindle Zotero Importer Failed", String(error && error.stack ? error.stack : error));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async openManager() {
|
async openManager() {
|
||||||
if (this.managerWindow && !this.managerWindow.closed) {
|
if (this.managerWindow && !this.managerWindow.closed) {
|
||||||
this.managerWindow.focus();
|
this.managerWindow.focus();
|
||||||
|
|
@ -254,21 +233,6 @@ var KindleZoteroImporter = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async openStaticDashboard() {
|
|
||||||
const settings = await this.getRuntimeSettings();
|
|
||||||
const data = {
|
|
||||||
matches: await this.readJsonArtifact("matches.json"),
|
|
||||||
generatedOverrides: await this.readJsonArtifact("match-overrides.generated.json"),
|
|
||||||
positionedPlan: await this.readJsonArtifact("import-plan.positioned.json"),
|
|
||||||
finalPlan: await this.readJsonArtifact("import-plan.final.json"),
|
|
||||||
summary: await this.readJsonArtifact("plugin-summary.json"),
|
|
||||||
persistentOverrides: await this.readJsonArtifact("match-overrides.json"),
|
|
||||||
};
|
|
||||||
const outputPath = this.artifactPath("kindle-import-manager.html");
|
|
||||||
await Zotero.File.putContentsAsync(outputPath, this.buildManagerHtml(settings, data));
|
|
||||||
this.openFile(outputPath);
|
|
||||||
},
|
|
||||||
|
|
||||||
async loadOverridesFile() {
|
async loadOverridesFile() {
|
||||||
const path = this.artifactPath("match-overrides.json");
|
const path = this.artifactPath("match-overrides.json");
|
||||||
try {
|
try {
|
||||||
|
|
@ -355,337 +319,6 @@ var KindleZoteroImporter = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
escapeHtml(value) {
|
|
||||||
return String(value ?? "")
|
|
||||||
.replaceAll("&", "&")
|
|
||||||
.replaceAll("<", "<")
|
|
||||||
.replaceAll(">", ">")
|
|
||||||
.replaceAll('"', """)
|
|
||||||
.replaceAll("'", "'");
|
|
||||||
},
|
|
||||||
|
|
||||||
fileHref(path) {
|
|
||||||
return "file://" + encodeURI(path).replaceAll("#", "%23");
|
|
||||||
},
|
|
||||||
|
|
||||||
artifactLink(label, relativePath) {
|
|
||||||
const path = this.artifactPath(relativePath);
|
|
||||||
return `<a href="${this.escapeHtml(this.fileHref(path))}">${this.escapeHtml(label)}</a>`;
|
|
||||||
},
|
|
||||||
|
|
||||||
countStatuses(items, key = "status") {
|
|
||||||
const counts = {};
|
|
||||||
for (const item of items || []) {
|
|
||||||
const status = item[key] || "unknown";
|
|
||||||
counts[status] = (counts[status] || 0) + 1;
|
|
||||||
}
|
|
||||||
return counts;
|
|
||||||
},
|
|
||||||
|
|
||||||
statusCards(counts) {
|
|
||||||
return Object.entries(counts || {})
|
|
||||||
.sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))
|
|
||||||
.map(([status, count]) => `<div class="card"><strong>${this.escapeHtml(count)}</strong><span>${this.escapeHtml(status)}</span></div>`)
|
|
||||||
.join("\n");
|
|
||||||
},
|
|
||||||
|
|
||||||
conflictRows(data) {
|
|
||||||
const rows = [];
|
|
||||||
for (const match of data.matches?.matches || []) {
|
|
||||||
if (["matched", "ignored"].includes(match.status)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const candidates = (match.candidates || [])
|
|
||||||
.slice(0, 3)
|
|
||||||
.map((candidate) => `${candidate.citation_key || candidate.key || candidate.item_id}: ${candidate.title || ""}`)
|
|
||||||
.join("; ");
|
|
||||||
rows.push({
|
|
||||||
type: "title-match",
|
|
||||||
status: match.status,
|
|
||||||
title: match.clipping_title,
|
|
||||||
count: match.clipping_count,
|
|
||||||
detail: candidates || "No candidates",
|
|
||||||
snippet: this.overrideSnippet(match.clipping_title, match.clipping_count, match.status, match.candidates?.[0]),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const override of data.generatedOverrides?.overrides || []) {
|
|
||||||
const candidateText = (override.candidates || [])
|
|
||||||
.slice(0, 3)
|
|
||||||
.map((candidate) => `${candidate.citation_key || candidate.key || candidate.item_id}: ${candidate.title || ""}`)
|
|
||||||
.join("; ");
|
|
||||||
rows.push({
|
|
||||||
type: "override-suggestion",
|
|
||||||
status: override.review?.status || "review",
|
|
||||||
title: override.clipping_title,
|
|
||||||
count: override.review?.clipping_count || "",
|
|
||||||
detail: candidateText || override.notes || "Needs override decision",
|
|
||||||
snippet: JSON.stringify({
|
|
||||||
clipping_title: override.clipping_title,
|
|
||||||
resolution: override.resolution || { ignore: false, citation_key: "" },
|
|
||||||
review: override.review,
|
|
||||||
}, null, 2),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const item of data.positionedPlan?.items || []) {
|
|
||||||
const status = item.status || "unknown";
|
|
||||||
if (["positioned", "ignored-title"].includes(status)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
rows.push({
|
|
||||||
type: "positioning/import-plan",
|
|
||||||
status,
|
|
||||||
title: item.clipping?.title || "(missing clipping title)",
|
|
||||||
count: 1,
|
|
||||||
detail: (item.problems || []).join("; ") || item.annotation?.text || "Needs review",
|
|
||||||
snippet: "Fix source data, attachment availability, or matching override; then rerun Import Kindle Clippings.",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return rows;
|
|
||||||
},
|
|
||||||
|
|
||||||
overrideSnippet(title, clippingCount, status, candidate) {
|
|
||||||
const resolution = candidate?.citation_key
|
|
||||||
? { ignore: false, citation_key: candidate.citation_key }
|
|
||||||
: { ignore: true };
|
|
||||||
return JSON.stringify({
|
|
||||||
clipping_title: title,
|
|
||||||
resolution,
|
|
||||||
review: {
|
|
||||||
status,
|
|
||||||
clipping_count: clippingCount,
|
|
||||||
},
|
|
||||||
}, null, 2);
|
|
||||||
},
|
|
||||||
|
|
||||||
groupedRows(rows) {
|
|
||||||
const groups = {
|
|
||||||
"Title Matching": [],
|
|
||||||
"Override Suggestions": [],
|
|
||||||
"Attachment / Positioning": [],
|
|
||||||
};
|
|
||||||
for (const row of rows) {
|
|
||||||
if (row.type === "title-match") {
|
|
||||||
groups["Title Matching"].push(row);
|
|
||||||
} else if (row.type === "override-suggestion") {
|
|
||||||
groups["Override Suggestions"].push(row);
|
|
||||||
} else {
|
|
||||||
groups["Attachment / Positioning"].push(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return groups;
|
|
||||||
},
|
|
||||||
|
|
||||||
tableRows(rows, limit = 200) {
|
|
||||||
if (!rows.length) {
|
|
||||||
return '<tr><td colspan="6">No conflicts found in this group.</td></tr>';
|
|
||||||
}
|
|
||||||
return rows.slice(0, limit).map((row) => `
|
|
||||||
<tr data-search="${this.escapeHtml(`${row.type} ${row.status} ${row.title} ${row.detail}`.toLowerCase())}">
|
|
||||||
<td>${this.escapeHtml(row.type)}</td>
|
|
||||||
<td><span class="pill">${this.escapeHtml(row.status)}</span></td>
|
|
||||||
<td>${this.escapeHtml(row.count)}</td>
|
|
||||||
<td>${this.escapeHtml(row.title)}</td>
|
|
||||||
<td>${this.escapeHtml(row.detail)}</td>
|
|
||||||
<td><pre>${this.escapeHtml(row.snippet || "")}</pre></td>
|
|
||||||
</tr>`).join("\n");
|
|
||||||
},
|
|
||||||
|
|
||||||
conflictTables(rows) {
|
|
||||||
const groups = this.groupedRows(rows);
|
|
||||||
return Object.entries(groups).map(([label, groupRows]) => `
|
|
||||||
<section class="panel">
|
|
||||||
<h3>${this.escapeHtml(label)} <span class="muted">${this.escapeHtml(groupRows.length)} rows</span></h3>
|
|
||||||
<table>
|
|
||||||
<thead><tr><th>Type</th><th>Status</th><th>Count</th><th>Kindle Title</th><th>Details / Candidate Differences</th><th>Override / Fix Snippet</th></tr></thead>
|
|
||||||
<tbody>${this.tableRows(groupRows)}</tbody>
|
|
||||||
</table>
|
|
||||||
</section>`).join("\n");
|
|
||||||
},
|
|
||||||
|
|
||||||
buildManagerHtml(settings, data) {
|
|
||||||
const matchCounts = this.countStatuses(data.matches?.matches || []);
|
|
||||||
const planCounts = data.positionedPlan?.status_counts || this.countStatuses(data.positionedPlan?.items || []);
|
|
||||||
const finalCount = data.finalPlan?.annotation_count || 0;
|
|
||||||
const skippedCounts = data.finalPlan?.skipped_counts || {};
|
|
||||||
const conflicts = this.conflictRows(data);
|
|
||||||
const generatedAt = new Date().toLocaleString();
|
|
||||||
return `<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Kindle Zotero Importer Manager</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin: 28px; color: #202124; background: #f6f4ef; }
|
|
||||||
h1 { margin: 0 0 4px; font-size: 30px; }
|
|
||||||
h2 { margin-top: 28px; border-bottom: 1px solid #d8d0c2; padding-bottom: 6px; }
|
|
||||||
h3 { margin-top: 18px; }
|
|
||||||
code, pre { background: #eee7dc; border-radius: 6px; padding: 2px 5px; }
|
|
||||||
pre { white-space: pre-wrap; max-width: 360px; font-size: 12px; }
|
|
||||||
.meta { color: #6b6258; margin-bottom: 24px; }
|
|
||||||
.nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
|
|
||||||
.nav a { background: #263238; color: white; text-decoration: none; padding: 7px 10px; border-radius: 999px; font-size: 13px; }
|
|
||||||
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
|
|
||||||
.card { background: white; border: 1px solid #ded6c9; border-radius: 12px; padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
|
|
||||||
.card strong { display: block; font-size: 24px; }
|
|
||||||
.card span { color: #6b6258; }
|
|
||||||
table { width: 100%; border-collapse: collapse; background: white; border: 1px solid #ded6c9; }
|
|
||||||
th, td { text-align: left; vertical-align: top; border-bottom: 1px solid #eee7dc; padding: 8px; }
|
|
||||||
th { background: #eee7dc; position: sticky; top: 0; }
|
|
||||||
.pill { display: inline-block; background: #263238; color: white; border-radius: 999px; padding: 2px 8px; font-size: 12px; }
|
|
||||||
.paths li { margin: 6px 0; }
|
|
||||||
.notice { background: #fff8d6; border: 1px solid #ead37a; border-radius: 10px; padding: 12px; }
|
|
||||||
.panel { margin: 18px 0 28px; }
|
|
||||||
.muted { color: #6b6258; font-weight: normal; font-size: 13px; }
|
|
||||||
.search { width: 100%; box-sizing: border-box; font-size: 16px; padding: 10px; border: 1px solid #d8d0c2; border-radius: 10px; margin: 10px 0 16px; }
|
|
||||||
.todo { background: #e8f1ff; border: 1px solid #a7c7ef; border-radius: 10px; padding: 12px; }
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
function filterRows() {
|
|
||||||
const needle = document.getElementById('conflict-search').value.toLowerCase();
|
|
||||||
for (const row of document.querySelectorAll('tbody tr[data-search]')) {
|
|
||||||
row.style.display = row.dataset.search.includes(needle) ? '' : 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Kindle Zotero Importer Manager</h1>
|
|
||||||
<div class="meta">Generated ${this.escapeHtml(generatedAt)} from <code>${this.escapeHtml(settings.projectDir)}</code></div>
|
|
||||||
|
|
||||||
<div class="nav">
|
|
||||||
<a href="#settings">Settings</a>
|
|
||||||
<a href="#run">Run Import</a>
|
|
||||||
<a href="#statuses">Statuses</a>
|
|
||||||
<a href="#artifacts">Artifacts</a>
|
|
||||||
<a href="#conflicts">Conflicts</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="notice">
|
|
||||||
This dashboard is generated from importer artifacts. Copy override snippets into <code>match-overrides.json</code> for now, then rerun Import Kindle Clippings. Direct in-dashboard editing is the next step.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2 id="settings">Settings</h2>
|
|
||||||
<ul class="paths">
|
|
||||||
<li><strong>Project directory:</strong> <code>${this.escapeHtml(settings.projectDir)}</code></li>
|
|
||||||
<li><strong>Python:</strong> <code>${this.escapeHtml(settings.pythonPath)}</code></li>
|
|
||||||
<li><strong>Zotero DB:</strong> <code>${this.escapeHtml(settings.zoteroDbPath)}</code></li>
|
|
||||||
<li><strong>Zotero storage:</strong> <code>${this.escapeHtml(settings.zoteroStorageRoot)}</code></li>
|
|
||||||
<li><strong>Config:</strong> <code>${this.escapeHtml(this.getConfigPath())}</code></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="run">Run Import</h2>
|
|
||||||
<div class="todo">
|
|
||||||
Run from Zotero: <strong>Tools > Import Kindle Clippings...</strong>. The import now shows preflight settings, progress, final counts, existing-comment updates, existing-sort-order repairs, and any guarded delete/recreate confirmations for <code>kindle-import</code> annotations.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2>Import Summary</h2>
|
|
||||||
<div class="grid">
|
|
||||||
<div class="card"><strong>${this.escapeHtml(data.summary?.counts?.clippings || "-")}</strong><span>clippings</span></div>
|
|
||||||
<div class="card"><strong>${this.escapeHtml(data.summary?.counts?.unique_titles || "-")}</strong><span>unique titles</span></div>
|
|
||||||
<div class="card"><strong>${this.escapeHtml(finalCount)}</strong><span>final annotations</span></div>
|
|
||||||
<div class="card"><strong>${this.escapeHtml(conflicts.length)}</strong><span>conflict rows</span></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2 id="statuses">Match Statuses</h2>
|
|
||||||
<div class="grid">${this.statusCards(matchCounts) || '<div class="card">No match data yet</div>'}</div>
|
|
||||||
|
|
||||||
<h2>Plan Statuses</h2>
|
|
||||||
<div class="grid">${this.statusCards(planCounts) || '<div class="card">No plan data yet</div>'}</div>
|
|
||||||
|
|
||||||
<h2>Final Plan Skips</h2>
|
|
||||||
<div class="grid">${this.statusCards(skippedCounts) || '<div class="card">No skipped final annotations</div>'}</div>
|
|
||||||
|
|
||||||
<h2 id="artifacts">Artifacts</h2>
|
|
||||||
<ul>
|
|
||||||
<li>${this.artifactLink("Mismatch review", "docs/mismatch-review.md")}</li>
|
|
||||||
<li>${this.artifactLink("Persistent overrides", "match-overrides.json")}</li>
|
|
||||||
<li>${this.artifactLink("Generated override suggestions", "match-overrides.generated.json")}</li>
|
|
||||||
<li>${this.artifactLink("Positioned plan", "import-plan.positioned.json")}</li>
|
|
||||||
<li>${this.artifactLink("Final writer plan", "import-plan.final.json")}</li>
|
|
||||||
<li>${this.artifactLink("Plugin summary", "plugin-summary.json")}</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 id="conflicts">Conflicts and Exceptions</h2>
|
|
||||||
<p>Rows include unresolved title matches, generated override suggestions, attachment problems, and positioning failures. Use search to filter titles, statuses, citekeys, and candidate text. Showing first 200 rows per group.</p>
|
|
||||||
<input id="conflict-search" class="search" type="search" oninput="filterRows()" placeholder="Filter conflicts by title, status, candidate, citekey...">
|
|
||||||
${this.conflictTables(conflicts)}
|
|
||||||
</body>
|
|
||||||
</html>`;
|
|
||||||
},
|
|
||||||
|
|
||||||
async importClippings() {
|
|
||||||
let progressWindow = null;
|
|
||||||
try {
|
|
||||||
const clippingsPath = await this.pickFile("Select Kindle My Clippings.txt", "*.txt");
|
|
||||||
if (!clippingsPath) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const settings = await this.getRuntimeSettings();
|
|
||||||
const settingsMessage = [
|
|
||||||
"Run Kindle import pipeline with these settings?",
|
|
||||||
"",
|
|
||||||
`Clippings: ${clippingsPath}`,
|
|
||||||
`Project directory: ${settings.projectDir}`,
|
|
||||||
`Python: ${settings.pythonPath}`,
|
|
||||||
`Zotero DB: ${settings.zoteroDbPath}`,
|
|
||||||
`Zotero storage: ${settings.zoteroStorageRoot}`,
|
|
||||||
`Config file: ${this.getConfigPath()}`,
|
|
||||||
"",
|
|
||||||
"This first creates/updates review files. You can choose whether to import annotations after the summary.",
|
|
||||||
].join("\n");
|
|
||||||
if (!Services.prompt.confirm(this.getMainWindow(), "Kindle Zotero Importer", settingsMessage)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
progressWindow = this.createProgress("Starting Kindle import...");
|
|
||||||
if (progressWindow) {
|
|
||||||
progressWindow.changeHeadline("Kindle Zotero Importer: reading clippings");
|
|
||||||
}
|
|
||||||
const summary = await this.runPipeline(clippingsPath, settings);
|
|
||||||
if (progressWindow && progressWindow.progress) {
|
|
||||||
progressWindow.progress.setProgress(100);
|
|
||||||
progressWindow.changeHeadline("Kindle Zotero Importer: pipeline complete");
|
|
||||||
}
|
|
||||||
const finalPlanPath = summary.outputs.final_plan;
|
|
||||||
const finalPlan = JSON.parse(await Zotero.File.getContentsAsync(finalPlanPath));
|
|
||||||
this.notify(
|
|
||||||
`Pipeline completed. ${summary.counts.final_annotations || 0} final annotations ready.`,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
const decision = this.confirmImport(summary);
|
|
||||||
if (decision === "review") {
|
|
||||||
this.revealFile(summary.outputs.mismatch_review);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (decision !== "import") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progressWindow) {
|
|
||||||
progressWindow.changeHeadline("Kindle Zotero Importer: writing annotations");
|
|
||||||
}
|
|
||||||
const results = await this.writeAnnotations(finalPlan, false);
|
|
||||||
this.notify(
|
|
||||||
`Import finished. Created ${results.created}; skipped ${results.skippedExisting}; updated order ${results.updatedSortIndex}; recreated ${results.recreatedForSortIndex}; failed ${results.failed.length}.`,
|
|
||||||
results.failed.length === 0
|
|
||||||
);
|
|
||||||
this.alert("Kindle Zotero Importer", this.formatWriterResults(results));
|
|
||||||
} catch (error) {
|
|
||||||
Zotero.logError(error);
|
|
||||||
this.notify("Import failed. See the error dialog for details.", false);
|
|
||||||
this.alert("Kindle Zotero Importer Failed", String(error && error.stack ? error.stack : error));
|
|
||||||
} finally {
|
|
||||||
if (progressWindow && progressWindow.startCloseTimer) {
|
|
||||||
progressWindow.startCloseTimer(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async pickFile(title, filter) {
|
async pickFile(title, filter) {
|
||||||
try {
|
try {
|
||||||
const pickerModule = ChromeUtils.importESModule(
|
const pickerModule = ChromeUtils.importESModule(
|
||||||
|
|
@ -717,33 +350,6 @@ var KindleZoteroImporter = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async pickDirectory(title) {
|
|
||||||
try {
|
|
||||||
const pickerModule = ChromeUtils.importESModule(
|
|
||||||
"chrome://zotero/content/modules/filePicker.mjs"
|
|
||||||
);
|
|
||||||
const FilePicker = pickerModule.FilePicker;
|
|
||||||
if (typeof FilePicker !== "function") {
|
|
||||||
throw new Error(`Zotero FilePicker module did not export a constructor: ${Object.keys(pickerModule)}`);
|
|
||||||
}
|
|
||||||
const fp = new FilePicker();
|
|
||||||
fp.init(this.getPickerWindow(), title, fp.modeGetFolder);
|
|
||||||
|
|
||||||
const result = await fp.show();
|
|
||||||
if (result !== fp.returnOK) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return fp.file;
|
|
||||||
} catch (error) {
|
|
||||||
Zotero.logError(error);
|
|
||||||
return this.promptForPath(
|
|
||||||
"Kindle Zotero Importer",
|
|
||||||
"Folder picker failed. Enter the full project directory path:",
|
|
||||||
this.defaultProjectDir
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async runPipeline(clippingsPath, settings, isFull = false) {
|
async runPipeline(clippingsPath, settings, isFull = false) {
|
||||||
const python = settings.pythonPath;
|
const python = settings.pythonPath;
|
||||||
const projectDir = settings.projectDir;
|
const projectDir = settings.projectDir;
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,54 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Kindle Zotero Importer</title>
|
<title>Kindle Zotero Importer</title>
|
||||||
<style>
|
<style>
|
||||||
:root { color: #0a0a0a; background: #ffffff; font-family: 'iA Writer Duo', 'iA Writer Duos', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }
|
/* Design Tokens — F (Cleaned D+B) — unified with chess tool 2026-09-21 */
|
||||||
#root { padding: 20px; max-width: 1600px; margin: 0 auto; background: #ffffff; color: #0a0a0a; line-height: 1.5; }
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
|
||||||
h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-family: 'iA Writer Duo', ui-monospace, monospace; }
|
:root {
|
||||||
h2 { margin: 24px 0 10px; border-bottom: 1px solid #0a0a0a; padding-bottom: 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
|
font-family: 'iA Writer Duo', 'iA Writer Duos', 'JetBrains Mono', ui-monospace, monospace;
|
||||||
.tabs { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; border-bottom: 1px solid #0a0a0a; padding-bottom: 10px; }
|
color: #111;
|
||||||
.tab-button { padding: 6px 14px; border-radius: 0; border: 1px solid #0a0a0a; background: #ffffff; color: #0a0a0a; cursor: pointer; font-family: 'iA Writer Duo', ui-monospace, monospace; font-size: 13px; letter-spacing: 0.02em; }
|
background: #f8f8f8;
|
||||||
.tab-button.active { background: #0a0a0a; color: #ffffff; }
|
--bg: #f8f8f8;
|
||||||
|
--panel: #ffffff;
|
||||||
|
--panel-soft: #f0f0f0;
|
||||||
|
--line: #ddd;
|
||||||
|
--line-strong: #bbb;
|
||||||
|
--text: #111;
|
||||||
|
--muted: #666;
|
||||||
|
--faint: #999;
|
||||||
|
--accent: #111;
|
||||||
|
--accent-2: #111;
|
||||||
|
--accent-soft: #f0f0f0;
|
||||||
|
--danger: #a00;
|
||||||
|
--danger-soft: #fff0f0;
|
||||||
|
--shadow: 0 1px 4px rgba(0,0,0,.06);
|
||||||
|
--shadow-strong: 0 4px 12px rgba(0,0,0,.08);
|
||||||
|
--radius: 8px;
|
||||||
|
--pill-radius: 8px;
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body { margin: 0; background: var(--bg); }
|
||||||
|
#root { padding: 0 24px 24px; max-width: 1280px; margin: 0 auto; background: var(--bg); color: var(--text); line-height: 1.5; }
|
||||||
|
h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-family: inherit; color: var(--text); }
|
||||||
|
h2 { margin: 24px 0 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
|
||||||
|
.tabs { display: flex; gap: 4px; margin: 16px 0 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
|
||||||
|
.tab-button { padding: 12px 16px 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
|
||||||
|
.tab-button.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
|
||||||
|
.tab-button:hover { color: var(--text); }
|
||||||
.tab { display: none; }
|
.tab { display: none; }
|
||||||
.tab.active { display: block; }
|
.tab.active { display: block; padding-top: 16px; }
|
||||||
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
|
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
|
||||||
.card { background: #ffffff; border: 1px solid #0a0a0a; border-radius: 0; padding: 12px; }
|
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
|
||||||
.card strong { display: block; font-size: 22px; font-weight: 700; }
|
.card strong { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
|
||||||
label { display: block; margin: 9px 0 3px; font-weight: 600; }
|
.card span { color: var(--muted); font-size: 12px; }
|
||||||
input, textarea, select { width: 100%; box-sizing: border-box; padding: 7px; font-family: 'iA Writer Duo', ui-monospace, monospace; border: 1px solid #0a0a0a; background: #ffffff; color: #0a0a0a; }
|
label { display: block; margin: 9px 0 3px; font-weight: 600; font-size: 12px; color: var(--text); }
|
||||||
|
input, textarea, select { width: 100%; box-sizing: border-box; padding: 8px 10px; font-family: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
|
||||||
|
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17,17,17,.06); }
|
||||||
textarea { min-height: 72px; }
|
textarea { min-height: 72px; }
|
||||||
table { width: 100%; border-collapse: collapse; background: #ffffff; table-layout: fixed; border: 1px solid #0a0a0a; }
|
table { width: 100%; border-collapse: collapse; background: var(--panel); table-layout: fixed; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
|
||||||
th, td { text-align: left; vertical-align: top; border-bottom: 1px solid #d0d0d0; border-right: 1px solid #e8e8e8; padding: 8px 10px; font-size: 12.5px; overflow-wrap: anywhere; user-select: text; position: relative; }
|
th, td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: 10px 12px; font-size: 12.5px; overflow-wrap: anywhere; user-select: text; position: relative; }
|
||||||
th { background: #ffffff; color: #0a0a0a; position: sticky; top: 0; font-weight: 600; border-bottom: 1px solid #0a0a0a; z-index: 1; }
|
th { background: var(--panel-soft); color: var(--muted); position: sticky; top: 0; font-weight: 600; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; border-bottom: 1px solid var(--line); z-index: 1; }
|
||||||
th .resizer { position: absolute; top: 0; right: -3px; width: 6px; height: 100%; cursor: col-resize; user-select: none; }
|
th .resizer { position: absolute; top: 0; right: -3px; width: 6px; height: 100%; cursor: col-resize; user-select: none; }
|
||||||
th .resizer:hover { background: #0a0a0a; opacity: 0.15; }
|
th .resizer:hover { background: var(--accent); opacity: 0.15; }
|
||||||
th:nth-child(1), td:nth-child(1) { width: 10%; }
|
th:nth-child(1), td:nth-child(1) { width: 10%; }
|
||||||
th:nth-child(2), td:nth-child(2) { width: 9%; }
|
th:nth-child(2), td:nth-child(2) { width: 9%; }
|
||||||
th:nth-child(3), td:nth-child(3) { width: 6%; }
|
th:nth-child(3), td:nth-child(3) { width: 6%; }
|
||||||
|
|
@ -37,31 +65,32 @@
|
||||||
#tab-integrated th:nth-child(4), #tab-integrated td:nth-child(4) { width: 11%; }
|
#tab-integrated th:nth-child(4), #tab-integrated td:nth-child(4) { width: 11%; }
|
||||||
#tab-integrated th:nth-child(5), #tab-integrated td:nth-child(5) { width: 11%; }
|
#tab-integrated th:nth-child(5), #tab-integrated td:nth-child(5) { width: 11%; }
|
||||||
#tab-integrated th:nth-child(6), #tab-integrated td:nth-child(6) { width: 12%; }
|
#tab-integrated th:nth-child(6), #tab-integrated td:nth-child(6) { width: 12%; }
|
||||||
.pill { display: inline-block; background: #0a0a0a; color: #ffffff; border-radius: 0; padding: 2px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
|
.pill { display: inline-block; background: var(--accent); color: white; border-radius: var(--pill-radius); padding: 3px 8px; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--accent); }
|
||||||
.row-actions button, .row-actions .row-btn { margin: 2px; padding: 5px 10px; border: 1px solid #0a0a0a; border-radius: 0; background: #ffffff; color: #0a0a0a; cursor: pointer; font-size: 12px; font-family: 'iA Writer Duo', ui-monospace, monospace; }
|
.row-actions button, .row-actions .row-btn { margin: 2px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); cursor: pointer; font-size: 12px; font-family: inherit; transition: all .12s; }
|
||||||
.row-actions button:hover, .row-actions .row-btn:hover { background: #0a0a0a; color: #ffffff; }
|
.row-actions button:hover, .row-actions .row-btn:hover { border-color: var(--line-strong); background: var(--panel-soft); }
|
||||||
.candidate-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
|
.candidate-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
|
||||||
.candidate-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid #0a0a0a; padding: 6px 8px; background: #ffffff; font-size: 12px; line-height: 1.3; }
|
.candidate-option { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--panel); font-size: 12px; line-height: 1.3; box-shadow: var(--shadow); }
|
||||||
.candidate-option:hover { background: #f4f4f4; }
|
.candidate-option:hover { background: var(--panel-soft); border-color: var(--line-strong); }
|
||||||
.candidate-option span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.candidate-option span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
|
||||||
.candidate-option button { flex-shrink: 0; padding: 3px 8px; font-size: 11px; border: 1px solid #0a0a0a; background: #0a0a0a; color: #ffffff; cursor: pointer; }
|
.candidate-option button { flex-shrink: 0; padding: 4px 10px; font-size: 11px; border-radius: var(--pill-radius); border: 1px solid var(--accent); background: var(--accent); color: white; cursor: pointer; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .06em; }
|
||||||
.candidate-option button:hover { background: #ffffff; color: #0a0a0a; }
|
.candidate-option button:hover { background: var(--panel); color: var(--accent); }
|
||||||
.manual-row { display: flex; gap: 4px; margin-top: 6px; }
|
.manual-row { display: flex; gap: 6px; margin-top: 8px; }
|
||||||
.manual-row input { flex: 1; min-width: 0; font-size: 12px; border: 1px solid #0a0a0a; }
|
.manual-row input { flex: 1; min-width: 0; font-size: 12px; }
|
||||||
.manual-row button { white-space: nowrap; flex-shrink: 0; }
|
.manual-row button { white-space: nowrap; flex-shrink: 0; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: white; cursor: pointer; font-weight: 600; }
|
||||||
.notice { background: #ffffff; border: 1px solid #0a0a0a; border-radius: 0; padding: 10px; margin: 10px 0; font-size: 13px; }
|
.manual-row button:hover { background: var(--panel); color: var(--accent); }
|
||||||
.run-panel { background: #ffffff; color: #0a0a0a; border: 1px solid #0a0a0a; border-radius: 0; padding: 18px; margin: 16px 0; }
|
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; font-size: 13px; box-shadow: var(--shadow); }
|
||||||
.file-button { display: inline-block; min-width: 240px; padding: 11px 16px; margin-bottom: 8px; font-size: 14px; font-weight: 700; text-align: center; color: #ffffff; background: #0a0a0a; border: 1px solid #0a0a0a; border-radius: 0; cursor: pointer; font-family: 'iA Writer Duo', ui-monospace, monospace; letter-spacing: 0.02em; }
|
.run-panel { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
|
||||||
.file-button:hover, .file-button:focus { background: #ffffff; color: #0a0a0a; outline: 1px solid #0a0a0a; }
|
.file-button { display: inline-block; min-width: 240px; padding: 11px 16px; margin-bottom: 8px; font-size: 13px; font-weight: 600; text-align: center; color: white; background: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius); cursor: pointer; font-family: inherit; letter-spacing: 0.02em; box-shadow: 0 2px 10px rgba(0,0,0,.12); transition: all .12s; }
|
||||||
.file-button.disabled { opacity: 0.4; cursor: wait; }
|
.file-button:hover, .file-button:focus { background: #1a1a1a; transform: translateY(-1px); box-shadow: var(--shadow-strong); outline: none; }
|
||||||
.run-panel progress { width: 100%; height: 14px; margin: 12px 0 5px; accent-color: #0a0a0a; }
|
.file-button.disabled { opacity: 0.4; cursor: wait; transform: none; }
|
||||||
.run-meta { display: flex; justify-content: space-between; gap: 12px; color: #0a0a0a; font-size: 12px; }
|
.run-panel progress { width: 100%; height: 6px; margin: 12px 0 5px; accent-color: var(--accent); border-radius: 999px; }
|
||||||
.ok { color: #0a7a0a; }
|
.run-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: .06em; }
|
||||||
.err { color: #a00; }
|
.ok { color: var(--accent); }
|
||||||
.muted { color: #555; font-size: 12px; }
|
.err { color: var(--danger); }
|
||||||
.highlight-text { max-width: 520px; white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.45; font-family: 'iA Writer Duo', ui-monospace, monospace; }
|
.muted { color: var(--muted); font-size: 12px; }
|
||||||
.integrated-meta { font-size: 10.5px; color: #555; font-family: 'iA Writer Duo', ui-monospace, monospace; }
|
.highlight-text { max-width: 520px; white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.45; font-family: inherit; }
|
||||||
::selection { background: #0a0a0a; color: #ffffff; }
|
.integrated-meta { font-size: 10.5px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
|
||||||
|
::selection { background: var(--accent); color: white; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
var KindleManager = {
|
var KindleManager = {
|
||||||
|
|
@ -251,12 +280,12 @@
|
||||||
html += `<div>${integrated} integrated · ${conflicts} conflicts · ${pending} mappings</div>`;
|
html += `<div>${integrated} integrated · ${conflicts} conflicts · ${pending} mappings</div>`;
|
||||||
if (hasPendingReimport) {
|
if (hasPendingReimport) {
|
||||||
const info = document.getElementById('reimport-info')?.textContent || 'New mapping saved';
|
const info = document.getElementById('reimport-info')?.textContent || 'New mapping saved';
|
||||||
html += `<div style="margin-top:6px; padding-top:6px; border-top:1px solid #0a0a0a; color:#0a0a0a;">${this.esc(info)}</div>`;
|
html += `<div style="margin-top:6px; padding-top:6px; border-top:1px solid var(--line); color:var(--text);">${this.esc(info)}</div>`;
|
||||||
html += `<div style="margin-top:6px;"><button onclick="KindleManager.reimportWithOverrides()" style="width:100%; padding:6px; border:1px solid #0a0a0a; background:#0a0a0a; color:#fff; cursor:pointer; font-family:'iA Writer Duo', ui-monospace, monospace;">↻ Re-import now</button></div>`;
|
html += `<div style="margin-top:6px;"><button onclick="KindleManager.reimportWithOverrides()" style="width:100%; padding:8px; border:1px solid var(--accent); background:var(--accent); color:white; cursor:pointer; font-family:inherit; border-radius:var(--radius); font-weight:600;">↻ Re-import now</button></div>`;
|
||||||
} else {
|
} else {
|
||||||
html += `<div style="margin-top:6px; color:#555;">No pending mappings — choose a candidate in Conflicts or delete in Mappings, then re-import.</div>`;
|
html += `<div style="margin-top:6px; color:var(--muted);">No pending mappings — choose a candidate in Conflicts or delete in Mappings, then re-import.</div>`;
|
||||||
}
|
}
|
||||||
html += `<div style="margin-top:10px; padding-top:8px; border-top:1px dashed #999; text-align:center;"><button onclick="try{Zotero.launchURL('https://github.com/sponsors/UtkuBilenDemir')}catch(e){window.open('https://github.com/sponsors/UtkuBilenDemir','_blank')}" style="padding:6px 12px; border:1px solid #0a0a0a; background:#0a0a0a; color:#fff; cursor:pointer; font-family:'iA Writer Duo', ui-monospace, monospace; font-size:12px;">please give me money+</button></div>`;
|
html += `<div style="margin-top:10px; padding-top:8px; border-top:1px dashed var(--line); text-align:center;"><button onclick="try{Zotero.launchURL('https://github.com/sponsors/UtkuBilenDemir')}catch(e){window.open('https://github.com/sponsors/UtkuBilenDemir','_blank')}" style="padding:6px 12px; border:1px solid var(--accent); background:var(--accent); color:white; cursor:pointer; font-family:inherit; font-size:12px; border-radius:var(--pill-radius); font-weight:600;">please give me money+</button></div>`;
|
||||||
box.innerHTML = html;
|
box.innerHTML = html;
|
||||||
box.style.display = 'block';
|
box.style.display = 'block';
|
||||||
},
|
},
|
||||||
|
|
@ -541,8 +570,8 @@
|
||||||
}
|
}
|
||||||
el.style.display = 'block';
|
el.style.display = 'block';
|
||||||
el.className = 'notice';
|
el.className = 'notice';
|
||||||
el.style.borderLeft = error ? '4px solid #a00' : '4px solid #0a0a0a';
|
el.style.borderLeft = error ? '4px solid var(--danger)' : '4px solid var(--accent)';
|
||||||
el.style.background = error ? '#fff0f0' : '#f9f9f9';
|
el.style.background = error ? 'var(--danger-soft)' : 'var(--panel-soft)';
|
||||||
el.textContent = message;
|
el.textContent = message;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -695,13 +724,14 @@
|
||||||
const delBtn = document.createElement('button');
|
const delBtn = document.createElement('button');
|
||||||
delBtn.textContent = 'Delete';
|
delBtn.textContent = 'Delete';
|
||||||
delBtn.title = 'Remove this override and return to Conflicts';
|
delBtn.title = 'Remove this override and return to Conflicts';
|
||||||
delBtn.style.padding = '3px 8px';
|
delBtn.style.padding = '4px 10px';
|
||||||
delBtn.style.border = '1px solid #a00';
|
delBtn.style.border = '1px solid var(--danger)';
|
||||||
delBtn.style.background = '#ffffff';
|
delBtn.style.background = 'var(--panel)';
|
||||||
delBtn.style.color = '#a00';
|
delBtn.style.color = 'var(--danger)';
|
||||||
delBtn.style.cursor = 'pointer';
|
delBtn.style.cursor = 'pointer';
|
||||||
delBtn.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
delBtn.style.fontFamily = 'inherit';
|
||||||
delBtn.style.fontSize = '11px';
|
delBtn.style.fontSize = '11px';
|
||||||
|
delBtn.style.borderRadius = 'var(--radius)';
|
||||||
delBtn.addEventListener('click', () => this.deleteMapping(entry.clipping_title));
|
delBtn.addEventListener('click', () => this.deleteMapping(entry.clipping_title));
|
||||||
tdAction.appendChild(delBtn);
|
tdAction.appendChild(delBtn);
|
||||||
tr.appendChild(tdAction);
|
tr.appendChild(tdAction);
|
||||||
|
|
@ -770,12 +800,14 @@
|
||||||
infobox.id = 'infobox';
|
infobox.id = 'infobox';
|
||||||
infobox.style.minWidth = '260px';
|
infobox.style.minWidth = '260px';
|
||||||
infobox.style.maxWidth = '380px';
|
infobox.style.maxWidth = '380px';
|
||||||
infobox.style.border = '1px solid #0a0a0a';
|
infobox.style.border = '1px solid var(--line)';
|
||||||
infobox.style.background = '#ffffff';
|
infobox.style.background = 'var(--panel)';
|
||||||
infobox.style.padding = '10px';
|
infobox.style.padding = '10px';
|
||||||
infobox.style.fontSize = '12px';
|
infobox.style.fontSize = '12px';
|
||||||
infobox.style.lineHeight = '1.4';
|
infobox.style.lineHeight = '1.4';
|
||||||
infobox.style.display = 'none';
|
infobox.style.display = 'none';
|
||||||
|
infobox.style.borderRadius = 'var(--radius)';
|
||||||
|
infobox.style.boxShadow = 'var(--shadow)';
|
||||||
headerWrap.appendChild(infobox);
|
headerWrap.appendChild(infobox);
|
||||||
root.appendChild(headerWrap);
|
root.appendChild(headerWrap);
|
||||||
const panel = document.createElement('div');
|
const panel = document.createElement('div');
|
||||||
|
|
@ -842,7 +874,7 @@
|
||||||
fullLabel.textContent = 'Full re-import from scratch (ignore incremental, re-process all)';
|
fullLabel.textContent = 'Full re-import from scratch (ignore incremental, re-process all)';
|
||||||
fullLabel.style.margin = '0';
|
fullLabel.style.margin = '0';
|
||||||
fullLabel.style.fontSize = '12px';
|
fullLabel.style.fontSize = '12px';
|
||||||
fullLabel.style.color = '#0a0a0a';
|
fullLabel.style.color = 'var(--muted)';
|
||||||
fullLabel.title = 'When checked, re-processes all 2379 clippings from scratch (slow). Unchecked = incremental (only new/changed highlights, fast).';
|
fullLabel.title = 'When checked, re-processes all 2379 clippings from scratch (slow). Unchecked = incremental (only new/changed highlights, fast).';
|
||||||
fullRow.appendChild(fullLabel);
|
fullRow.appendChild(fullLabel);
|
||||||
panel.appendChild(fullRow);
|
panel.appendChild(fullRow);
|
||||||
|
|
@ -937,11 +969,12 @@
|
||||||
const reimportBar = document.createElement('div');
|
const reimportBar = document.createElement('div');
|
||||||
reimportBar.id = 'reimport-bar';
|
reimportBar.id = 'reimport-bar';
|
||||||
reimportBar.style.display = 'none';
|
reimportBar.style.display = 'none';
|
||||||
reimportBar.style.border = '1px solid #0a0a0a';
|
reimportBar.style.border = '1px solid var(--accent)';
|
||||||
reimportBar.style.background = '#0a0a0a';
|
reimportBar.style.background = 'var(--panel-soft)';
|
||||||
reimportBar.style.color = '#ffffff';
|
reimportBar.style.color = 'var(--text)';
|
||||||
reimportBar.style.padding = '10px';
|
reimportBar.style.padding = '10px';
|
||||||
reimportBar.style.margin = '10px 0';
|
reimportBar.style.margin = '10px 0';
|
||||||
|
reimportBar.style.borderRadius = 'var(--radius)';
|
||||||
const reimportText = document.createElement('span');
|
const reimportText = document.createElement('span');
|
||||||
reimportText.id = 'reimport-info';
|
reimportText.id = 'reimport-info';
|
||||||
reimportText.textContent = 'Override saved — click to re-import.';
|
reimportText.textContent = 'Override saved — click to re-import.';
|
||||||
|
|
@ -949,12 +982,14 @@
|
||||||
const reimportBtn = document.createElement('button');
|
const reimportBtn = document.createElement('button');
|
||||||
reimportBtn.textContent = '↻ Re-import with saved overrides';
|
reimportBtn.textContent = '↻ Re-import with saved overrides';
|
||||||
reimportBtn.style.marginLeft = '10px';
|
reimportBtn.style.marginLeft = '10px';
|
||||||
reimportBtn.style.background = '#ffffff';
|
reimportBtn.style.background = 'var(--accent)';
|
||||||
reimportBtn.style.color = '#0a0a0a';
|
reimportBtn.style.color = 'white';
|
||||||
reimportBtn.style.border = '1px solid #ffffff';
|
reimportBtn.style.border = '1px solid var(--accent)';
|
||||||
reimportBtn.style.padding = '4px 10px';
|
reimportBtn.style.padding = '6px 12px';
|
||||||
reimportBtn.style.cursor = 'pointer';
|
reimportBtn.style.cursor = 'pointer';
|
||||||
reimportBtn.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
reimportBtn.style.fontFamily = 'inherit';
|
||||||
|
reimportBtn.style.borderRadius = 'var(--pill-radius)';
|
||||||
|
reimportBtn.style.fontWeight = '600';
|
||||||
reimportBtn.addEventListener('click', () => this.reimportWithOverrides());
|
reimportBtn.addEventListener('click', () => this.reimportWithOverrides());
|
||||||
reimportBar.appendChild(reimportBtn);
|
reimportBar.appendChild(reimportBtn);
|
||||||
conflictsTab.appendChild(reimportBar);
|
conflictsTab.appendChild(reimportBar);
|
||||||
|
|
@ -1057,12 +1092,14 @@
|
||||||
const sSaveBtn = document.createElement('button');
|
const sSaveBtn = document.createElement('button');
|
||||||
sSaveBtn.textContent = 'Save Settings';
|
sSaveBtn.textContent = 'Save Settings';
|
||||||
sSaveBtn.style.marginTop = '12px';
|
sSaveBtn.style.marginTop = '12px';
|
||||||
sSaveBtn.style.padding = '6px 14px';
|
sSaveBtn.style.padding = '8px 14px';
|
||||||
sSaveBtn.style.border = '1px solid #0a0a0a';
|
sSaveBtn.style.border = '1px solid var(--accent)';
|
||||||
sSaveBtn.style.background = '#0a0a0a';
|
sSaveBtn.style.background = 'var(--accent)';
|
||||||
sSaveBtn.style.color = '#ffffff';
|
sSaveBtn.style.color = 'white';
|
||||||
sSaveBtn.style.cursor = 'pointer';
|
sSaveBtn.style.cursor = 'pointer';
|
||||||
sSaveBtn.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
sSaveBtn.style.fontFamily = 'inherit';
|
||||||
|
sSaveBtn.style.borderRadius = 'var(--radius)';
|
||||||
|
sSaveBtn.style.fontWeight = '600';
|
||||||
sSaveBtn.addEventListener('click', () => this.saveSettings());
|
sSaveBtn.addEventListener('click', () => this.saveSettings());
|
||||||
sForm.appendChild(sSaveBtn);
|
sForm.appendChild(sSaveBtn);
|
||||||
const sNotice = document.createElement('div');
|
const sNotice = document.createElement('div');
|
||||||
|
|
@ -1096,10 +1133,12 @@
|
||||||
row.style.display = 'flex';
|
row.style.display = 'flex';
|
||||||
row.style.justifyContent = 'space-between';
|
row.style.justifyContent = 'space-between';
|
||||||
row.style.alignItems = 'center';
|
row.style.alignItems = 'center';
|
||||||
row.style.border = '1px solid #0a0a0a';
|
row.style.border = '1px solid var(--line)';
|
||||||
row.style.padding = '6px 10px';
|
row.style.padding = '8px 12px';
|
||||||
row.style.margin = '6px 0';
|
row.style.margin = '6px 0';
|
||||||
row.style.background = '#ffffff';
|
row.style.background = 'var(--panel)';
|
||||||
|
row.style.borderRadius = 'var(--radius)';
|
||||||
|
row.style.boxShadow = 'var(--shadow)';
|
||||||
const left = document.createElement('div');
|
const left = document.createElement('div');
|
||||||
left.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
left.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
||||||
left.style.fontSize = '12px';
|
left.style.fontSize = '12px';
|
||||||
|
|
@ -1110,21 +1149,26 @@
|
||||||
right.style.gap = '4px';
|
right.style.gap = '4px';
|
||||||
const openBtn = document.createElement('button');
|
const openBtn = document.createElement('button');
|
||||||
openBtn.textContent = 'Open';
|
openBtn.textContent = 'Open';
|
||||||
openBtn.style.padding = '3px 8px';
|
openBtn.style.padding = '4px 10px';
|
||||||
openBtn.style.border = '1px solid #0a0a0a';
|
openBtn.style.border = '1px solid var(--line)';
|
||||||
openBtn.style.background = '#ffffff';
|
openBtn.style.background = 'var(--panel)';
|
||||||
openBtn.style.cursor = 'pointer';
|
openBtn.style.cursor = 'pointer';
|
||||||
openBtn.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
openBtn.style.fontFamily = 'inherit';
|
||||||
|
openBtn.style.borderRadius = 'var(--radius)';
|
||||||
|
openBtn.style.fontSize = '12px';
|
||||||
openBtn.addEventListener('click', () => this.plugin.openArtifact(rel));
|
openBtn.addEventListener('click', () => this.plugin.openArtifact(rel));
|
||||||
right.appendChild(openBtn);
|
right.appendChild(openBtn);
|
||||||
const revealBtn = document.createElement('button');
|
const revealBtn = document.createElement('button');
|
||||||
revealBtn.textContent = 'Reveal';
|
revealBtn.textContent = 'Reveal';
|
||||||
revealBtn.style.padding = '3px 8px';
|
revealBtn.style.padding = '4px 10px';
|
||||||
revealBtn.style.border = '1px solid #0a0a0a';
|
revealBtn.style.border = '1px solid var(--accent)';
|
||||||
revealBtn.style.background = '#0a0a0a';
|
revealBtn.style.background = 'var(--accent)';
|
||||||
revealBtn.style.color = '#ffffff';
|
revealBtn.style.color = 'white';
|
||||||
revealBtn.style.cursor = 'pointer';
|
revealBtn.style.cursor = 'pointer';
|
||||||
revealBtn.style.fontFamily = "'iA Writer Duo', ui-monospace, monospace";
|
revealBtn.style.fontFamily = 'inherit';
|
||||||
|
revealBtn.style.borderRadius = 'var(--radius)';
|
||||||
|
revealBtn.style.fontSize = '12px';
|
||||||
|
revealBtn.style.fontWeight = '600';
|
||||||
revealBtn.addEventListener('click', () => this.plugin.revealFile(this.plugin.artifactPath(rel)));
|
revealBtn.addEventListener('click', () => this.plugin.revealFile(this.plugin.artifactPath(rel)));
|
||||||
right.appendChild(revealBtn);
|
right.appendChild(revealBtn);
|
||||||
row.appendChild(right);
|
row.appendChild(right);
|
||||||
|
|
@ -1137,8 +1181,8 @@
|
||||||
statusDiv.className = 'notice';
|
statusDiv.className = 'notice';
|
||||||
statusDiv.style.display = 'none';
|
statusDiv.style.display = 'none';
|
||||||
statusDiv.style.marginTop = '16px';
|
statusDiv.style.marginTop = '16px';
|
||||||
statusDiv.style.borderLeft = '4px solid #0a0a0a';
|
statusDiv.style.borderLeft = '4px solid var(--accent)';
|
||||||
statusDiv.style.background = '#f9f9f9';
|
statusDiv.style.background = 'var(--panel-soft)';
|
||||||
root.appendChild(statusDiv);
|
root.appendChild(statusDiv);
|
||||||
|
|
||||||
this.refreshRows();
|
this.refreshRows();
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ from .zotero_index import build_zotero_index
|
||||||
def main(argv: list[str] | None = None) -> int:
|
def main(argv: list[str] | None = None) -> int:
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="kindle-zotero-importer",
|
prog="kindle-zotero-importer",
|
||||||
description="Generate Zotero import-plan data from Kindle clippings.",
|
description="Minimalist Kindle → Zotero importer. Primary command is `run`; others are developer utilities.",
|
||||||
)
|
)
|
||||||
subparsers = parser.add_subparsers(dest="command", required=True)
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue