akhaliq HF Staff commited on
Commit
b9fe78a
·
1 Parent(s): ca9c6e4

feat: implement interactive hover-to-reveal redaction styling and update line height

Browse files
Files changed (1) hide show
  1. index.html +68 -20
index.html CHANGED
@@ -267,35 +267,83 @@
267
  border-radius: 12px;
268
  padding: 1.5rem;
269
  font-size: 1.05rem;
270
- line-height: 1.9;
271
  white-space: pre-wrap;
272
  min-height: 100px;
273
  }
274
 
275
- .entity {
276
- display: inline-flex;
 
 
277
  align-items: center;
 
 
278
  border-radius: 6px;
279
- padding: 0.1rem 0.3rem 0.1rem 0.4rem;
280
  margin: 0 0.2rem;
281
- font-weight: 500;
282
- position: relative;
283
- cursor: default;
284
- transition: all 0.2s;
285
- color: var(--text-primary);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
287
 
288
- .entity:hover { filter: brightness(1.2); }
 
 
 
 
 
 
 
289
 
290
- .entity-tag {
 
291
  font-size: 0.65rem;
 
 
 
 
292
  text-transform: uppercase;
293
- letter-spacing: 0.05em;
294
- margin-left: 0.4rem;
295
- background: rgba(0,0,0,0.5);
296
- padding: 0.15rem 0.35rem;
297
- border-radius: 4px;
298
- font-weight: 600;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  }
300
 
301
  /* Footer Legend */
@@ -523,9 +571,9 @@
523
  const color = entityColors[type] || '#888';
524
  const label = type.replace('private_', '');
525
 
526
- html += `<span class="entity" style="background-color: ${color}20; border-bottom: 2px solid ${color};">
527
- ${escapeHtml(text.substring(ent.start, ent.end))}
528
- <span class="entity-tag" style="color: ${color};">${label}</span>
529
  </span>`;
530
 
531
  lastIdx = ent.end;
 
267
  border-radius: 12px;
268
  padding: 1.5rem;
269
  font-size: 1.05rem;
270
+ line-height: 2.2; /* Increased line-height to accommodate badges */
271
  white-space: pre-wrap;
272
  min-height: 100px;
273
  }
274
 
275
+ /* Redaction Styling */
276
+ .redacted {
277
+ position: relative;
278
+ display: inline-grid;
279
  align-items: center;
280
+ justify-items: center;
281
+ background-color: var(--bg);
282
  border-radius: 6px;
 
283
  margin: 0 0.2rem;
284
+ padding: 0.1rem 0.5rem;
285
+ cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>'), pointer;
286
+ overflow: hidden;
287
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
288
+ box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
289
+ vertical-align: middle;
290
+ }
291
+
292
+ .redacted::before {
293
+ content: '';
294
+ position: absolute;
295
+ inset: 0;
296
+ background: repeating-linear-gradient(
297
+ -45deg,
298
+ rgba(0,0,0,0.1) 0,
299
+ rgba(0,0,0,0.1) 4px,
300
+ rgba(0,0,0,0.2) 4px,
301
+ rgba(0,0,0,0.2) 8px
302
+ );
303
+ z-index: 1;
304
+ pointer-events: none;
305
+ transition: opacity 0.3s ease;
306
  }
307
 
308
+ .redacted-text {
309
+ grid-area: 1 / 1;
310
+ opacity: 0;
311
+ filter: blur(4px);
312
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
313
+ color: #fff;
314
+ font-weight: 500;
315
+ }
316
 
317
+ .redacted-label {
318
+ grid-area: 1 / 1;
319
  font-size: 0.65rem;
320
+ font-family: 'Outfit', sans-serif;
321
+ font-weight: 700;
322
+ color: #fff;
323
+ letter-spacing: 0.1em;
324
  text-transform: uppercase;
325
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
326
+ z-index: 2;
327
+ text-shadow: 0 1px 3px rgba(0,0,0,0.6);
328
+ }
329
+
330
+ .redacted:hover {
331
+ background-color: rgba(255, 255, 255, 0.1);
332
+ box-shadow: inset 0 0 0 rgba(0,0,0,0);
333
+ }
334
+
335
+ .redacted:hover .redacted-text {
336
+ opacity: 1;
337
+ filter: blur(0);
338
+ }
339
+
340
+ .redacted:hover .redacted-label {
341
+ opacity: 0;
342
+ transform: scale(0.9);
343
+ }
344
+
345
+ .redacted:hover::before {
346
+ opacity: 0;
347
  }
348
 
349
  /* Footer Legend */
 
571
  const color = entityColors[type] || '#888';
572
  const label = type.replace('private_', '');
573
 
574
+ html += `<span class="redacted" style="--bg: ${color};">
575
+ <span class="redacted-text">${escapeHtml(text.substring(ent.start, ent.end))}</span>
576
+ <span class="redacted-label">${label}</span>
577
  </span>`;
578
 
579
  lastIdx = ent.end;