Skip to content

Commit ed3649a

Browse files
committed
Fix unnecessary dependence on current canvas
1 parent 94fac6f commit ed3649a

1 file changed

Lines changed: 13 additions & 25 deletions

File tree

web/index.html

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ <h1 class="text-xl md:text-2xl font-bold tracking-tight text-gray-900">Optimizer
132132
</div>
133133

134134
<div class="flex items-center gap-3 sm:gap-4">
135-
<a href="https://github.com/nrontsis/boox-note-optimizer" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-sm font-semibold text-gray-600 hover:text-black transition hidden sm:flex">
135+
<a href="https://github.com/nrontsis/boox-note-optimizer" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-sm font-semibold text-gray-600 hover:text-black transition">
136136
<svg class="w-5 h-5 shrink-0" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
137-
GitHub
137+
<span class="hidden sm:inline">GitHub</span>
138138
</a>
139139
<div class="w-px h-4 bg-gray-300 hidden sm:block"></div>
140140
<button onclick="openModal('modalExplain')" class="text-sm font-semibold text-gray-600 hover:text-black transition hidden sm:block">How it Works</button>
@@ -319,6 +319,11 @@ <h2 class="text-lg md:text-2xl font-extrabold text-gray-900 mb-0.5">Drop a .note
319319
</div>
320320
</div>
321321
</div>
322+
323+
<a href="https://github.com/nrontsis/boox-note-optimizer" target="_blank" rel="noopener noreferrer" class="flex items-center gap-1.5 text-xs font-semibold text-gray-400 hover:text-gray-600 transition mt-2 sm:hidden">
324+
<svg class="w-4 h-4 shrink-0" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"><path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd"></path></svg>
325+
GitHub
326+
</a>
322327
</div>
323328

324329
<div id="previewPlaceholder" class="hidden flex-1 bg-white flex-col items-center justify-center p-4 md:p-8 overflow-y-auto">
@@ -988,29 +993,12 @@ <h3 class="font-bold text-gray-900 mb-1 uppercase text-xs tracking-wider">MIT Li
988993
async function handleSvgImport(file) {
989994
const text = await file.text();
990995

991-
// If no workspace is loaded, use empty.note as a blank template
992-
// (cached by service worker for offline use)
993-
if (!app) {
994-
const btn = document.getElementById('btnDemo');
995-
const ogText = btn ? btn.innerText : "";
996-
if (btn) btn.innerText = "Initializing workspace...";
997-
try {
998-
const res = await fetch('empty.note');
999-
if (!res.ok) throw new Error();
1000-
const ab = await res.arrayBuffer();
1001-
filename = file.name.replace('.svg', '');
1002-
fileSource = { type: 'demo' };
1003-
await loadBuffer(new Uint8Array(ab));
1004-
await new Promise(r => setTimeout(r, 100));
1005-
} catch (err) {
1006-
alert("Could not initialize a blank workspace. Please load a .note file first.");
1007-
if (btn) btn.innerText = ogText;
1008-
return;
1009-
}
1010-
if (btn) btn.innerText = ogText;
1011-
} else {
1012-
filename = file.name.replace('.svg', '');
1013-
}
996+
// Use empty.note as a blank template for SVG import
997+
const res = await fetch('empty.note');
998+
const ab = await res.arrayBuffer();
999+
fileSource = { type: 'demo' };
1000+
await loadBuffer(new Uint8Array(ab));
1001+
filename = file.name.replace('.svg', '');
10141002

10151003
// Show loading indicator and yield so the browser paints it
10161004
ui.optResults.innerHTML = '<span class="animate-pulse text-blue-600 font-semibold">Importing SVG...</span>';

0 commit comments

Comments
 (0)