Spaces:
Running
Running
ui/ux update
Browse files- index.html +23 -7
- wasm-demo.js +10 -6
index.html
CHANGED
@@ -270,21 +270,37 @@
|
|
270 |
/* Result styling */
|
271 |
#decResult {
|
272 |
font-family: 'Telegraf', sans-serif;
|
273 |
-
padding: calc(var(--spacing-unit) *
|
274 |
background: var(--grey-050);
|
275 |
border: 2px solid var(--black);
|
276 |
border-radius: 8px;
|
277 |
-
min-height:
|
278 |
display: flex;
|
|
|
|
|
279 |
align-items: center;
|
|
|
280 |
font-weight: 600;
|
281 |
-
font-size: 1.
|
|
|
282 |
}
|
283 |
|
284 |
#decResult:not(:empty) {
|
285 |
color: var(--black);
|
286 |
}
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
/* Responsive adjustments */
|
289 |
@media (max-width: 968px) {
|
290 |
.hero {
|
@@ -418,10 +434,10 @@ sequenceDiagram
|
|
418 |
<span id="tokenizerSpin" class="loader" hidden aria-label="Loading tokenizer"></span>
|
419 |
</div>
|
420 |
<label for="tokenInput" class="visually-hidden">Text to encrypt</label>
|
421 |
-
<textarea id="tokenInput" rows="2" placeholder="Enter text to encrypt" autocomplete="off"></textarea>
|
422 |
-
<div style="display: flex; gap: calc(var(--spacing-unit) * 1); margin-bottom: calc(var(--spacing-unit) * 2); flex-wrap: wrap;">
|
423 |
-
<button id="btnWatermarked" class="btn" style="min-width: auto; padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 1.5); font-size: 1rem;"
|
424 |
-
<
|
425 |
</div>
|
426 |
<div class="controls" style="margin-top: auto;">
|
427 |
<button id="btnEncrypt" class="btn" disabled>🛡️ Encrypt</button>
|
|
|
270 |
/* Result styling */
|
271 |
#decResult {
|
272 |
font-family: 'Telegraf', sans-serif;
|
273 |
+
padding: calc(var(--spacing-unit) * 3);
|
274 |
background: var(--grey-050);
|
275 |
border: 2px solid var(--black);
|
276 |
border-radius: 8px;
|
277 |
+
min-height: 80px;
|
278 |
display: flex;
|
279 |
+
flex-direction: column;
|
280 |
+
justify-content: center;
|
281 |
align-items: center;
|
282 |
+
gap: calc(var(--spacing-unit) * 1);
|
283 |
font-weight: 600;
|
284 |
+
font-size: 1.4rem;
|
285 |
+
text-align: center;
|
286 |
}
|
287 |
|
288 |
#decResult:not(:empty) {
|
289 |
color: var(--black);
|
290 |
}
|
291 |
|
292 |
+
.watermark-flag {
|
293 |
+
font-size: 2rem;
|
294 |
+
font-weight: 700;
|
295 |
+
margin-bottom: calc(var(--spacing-unit) * 1);
|
296 |
+
}
|
297 |
+
|
298 |
+
.watermark-score {
|
299 |
+
font-size: 1.2rem;
|
300 |
+
font-weight: 500;
|
301 |
+
opacity: 0.8;
|
302 |
+
}
|
303 |
+
|
304 |
/* Responsive adjustments */
|
305 |
@media (max-width: 968px) {
|
306 |
.hero {
|
|
|
434 |
<span id="tokenizerSpin" class="loader" hidden aria-label="Loading tokenizer"></span>
|
435 |
</div>
|
436 |
<label for="tokenInput" class="visually-hidden">Text to encrypt</label>
|
437 |
+
<textarea id="tokenInput" rows="2" placeholder="Enter text to encrypt or use the example below" autocomplete="off"></textarea>
|
438 |
+
<div style="display: flex; gap: calc(var(--spacing-unit) * 1); margin-bottom: calc(var(--spacing-unit) * 2); flex-wrap: wrap; align-items: center;">
|
439 |
+
<button id="btnWatermarked" class="btn" style="min-width: auto; padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 1.5); font-size: 1rem;">✨ Use watermarked example</button>
|
440 |
+
<span style="font-size: 1rem; color: var(--black); opacity: 0.7;">← Try this to see watermark detection in action</span>
|
441 |
</div>
|
442 |
<div class="controls" style="margin-top: auto;">
|
443 |
<button id="btnEncrypt" class="btn" disabled>🛡️ Encrypt</button>
|
wasm-demo.js
CHANGED
@@ -181,11 +181,6 @@ $('btnWatermarked').onclick = () => {
|
|
181 |
$('tokenInput').dispatchEvent(new Event('input'));
|
182 |
};
|
183 |
|
184 |
-
$('btnNotWatermarked').onclick = () => {
|
185 |
-
$('tokenInput').value = 'watermarking serves multiple purposes, including verifying authenticity and enhancing data confidentiality';
|
186 |
-
$('tokenInput').dispatchEvent(new Event('input'));
|
187 |
-
};
|
188 |
-
|
189 |
// Add token counter functionality
|
190 |
$('tokenInput').addEventListener('input', () => {
|
191 |
const text = $('tokenInput').value.trim();
|
@@ -402,7 +397,16 @@ $('btnDecrypt').onclick = () => {
|
|
402 |
const score = (Number(score_scaled) / 1e6).toFixed(6);
|
403 |
console.log('[Main] Decryption successful');
|
404 |
console.log(`[Main] Result - flag: ${flag}, score: ${score}, total_g: ${total_g}`);
|
405 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
} catch (e) {
|
407 |
console.error('[Main] Decryption error:', e);
|
408 |
$('decResult').textContent = `Decryption failed: ${e.message}`;
|
|
|
181 |
$('tokenInput').dispatchEvent(new Event('input'));
|
182 |
};
|
183 |
|
|
|
|
|
|
|
|
|
|
|
184 |
// Add token counter functionality
|
185 |
$('tokenInput').addEventListener('input', () => {
|
186 |
const text = $('tokenInput').value.trim();
|
|
|
397 |
const score = (Number(score_scaled) / 1e6).toFixed(6);
|
398 |
console.log('[Main] Decryption successful');
|
399 |
console.log(`[Main] Result - flag: ${flag}, score: ${score}, total_g: ${total_g}`);
|
400 |
+
|
401 |
+
// Create elegant result display
|
402 |
+
const isWatermarked = flag === 1;
|
403 |
+
const flagText = isWatermarked ? '✅ Watermarked' : '❌ Not Watermarked';
|
404 |
+
const scoreText = `Confidence Score: ${score}`;
|
405 |
+
|
406 |
+
$('decResult').innerHTML = `
|
407 |
+
<div class="watermark-flag">${flagText}</div>
|
408 |
+
<div class="watermark-score">${scoreText}</div>
|
409 |
+
`;
|
410 |
} catch (e) {
|
411 |
console.error('[Main] Decryption error:', e);
|
412 |
$('decResult').textContent = `Decryption failed: ${e.message}`;
|