chaurAr commited on
Commit
2809405
Β·
verified Β·
1 Parent(s): ec9f97a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +95 -7
index.html CHANGED
@@ -304,6 +304,16 @@
304
  font-size: 0.95rem;
305
  }
306
 
 
 
 
 
 
 
 
 
 
 
307
  /* ── Language picker ─────────────────────────────── */
308
  .lang-picker-title {
309
  font-size: 1.25rem;
@@ -430,6 +440,34 @@
430
  vertical-align: middle;
431
  margin-right: 0.4rem;
432
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  </style>
434
  </head>
435
 
@@ -461,17 +499,22 @@
461
  nip19,
462
  nip44,
463
  } from "https://esm.sh/nostr-tools@2.3.2";
 
 
 
 
 
 
 
464
 
465
  // ── Edit this disclaimer to update what's shown on the language selection screen ──
466
- const DISCLAIMER = `By participating in this survey, you agree that your anonymized responses may be used for academic research as part of a master’s thesis. No personally identifiable information will be collected.\n Please select only one language that you are a native speaker of or fluent in at a bilingual level. Do not proceed if you are not proficient in any of the listed languages, as inaccurate responses may affect the validity of the survey results.\n If you speak multiple languages, please complete the survey for one language first. You will have the option to select another language and complete a new survey afterward.`;
467
  // ─────────────────────────────────────────────────────────────────────────────────
468
 
469
  // ── HuggingFace dataset configuration ───────────────────────────────────────────
470
  const HF_DATASET = "chaurAr/crosslingual-asr-entity-benchmark";
471
- const METADATA_URL = `https://huggingface.co/datasets/${HF_DATASET}/raw/main/metadata.csv`;
472
- // URL pattern: https://huggingface.co/datasets/chaurAr/crosslingual-asr-entity-benchmark/blob/main/audio/.wav
473
  // ─────────────────────────────────────────────────────────────────────────────────
474
-
475
  // Map language names to CSV language codes
476
  const LANGUAGE_CODE_MAP = {
477
  "French": "fr",
@@ -627,6 +670,23 @@
627
  input.style.display = "none";
628
  }
629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  let formDef = null;
631
  let submitted = 0;
632
  let selectedLanguage = null;
@@ -721,14 +781,14 @@
721
  const cols = norm(colsRaw);
722
  const n = cols.length;
723
 
724
- // Value goes from N (leftmost column) down to 1 (rightmost column)
725
  const headerCells = cols.map((c) => `<th>${c.label}</th>`).join("");
726
  const bodyRows = rows
727
  .map(
728
  (r) => `
729
  <tr>
730
  <td class="grid-row-label">${r.label}</td>
731
- ${cols.map((c, i) => `<td><input type="radio" name="${fieldId}__${r.id}" value="${n - i}"></td>`).join("")}
732
  </tr>`,
733
  )
734
  .join("");
@@ -754,8 +814,19 @@
754
  <div class="done-icon">πŸŽ‰</div>
755
  <div class="done-title">All done!</div>
756
  <div class="done-sub">All 10 responses have been submitted. Thank you!</div>
 
 
 
 
757
  </div>
758
  `;
 
 
 
 
 
 
 
759
  return;
760
  }
761
 
@@ -775,9 +846,26 @@
775
  ${isLast ? "Submit" : "Next β†’"}
776
  </button>
777
  </div>
 
 
 
778
  `;
779
 
780
  applyUniqueIdField();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
 
782
  // Insert audio player after the form intro (name/description) block
783
  // Use the pre-sampled audio files based on current submission count
@@ -879,4 +967,4 @@
879
  showLanguagePicker();
880
  </script>
881
  </body>
882
- </html>
 
304
  font-size: 0.95rem;
305
  }
306
 
307
+ .done-actions {
308
+ margin-top: 1.5rem;
309
+ }
310
+
311
+ .done-close {
312
+ margin-top: 1rem;
313
+ color: #9ca3af;
314
+ font-size: 0.85rem;
315
+ }
316
+
317
  /* ── Language picker ─────────────────────────────── */
318
  .lang-picker-title {
319
  font-size: 1.25rem;
 
440
  vertical-align: middle;
441
  margin-right: 0.4rem;
442
  }
443
+
444
+ /* ── Footer ───────────────────────────────────────── */
445
+ .form-footer {
446
+ margin-top: 1.5rem;
447
+ padding-top: 1rem;
448
+ border-top: 1px solid #e5e7eb;
449
+ text-align: center;
450
+ font-size: 0.8rem;
451
+ color: #9ca3af;
452
+ }
453
+ .form-footer a {
454
+ color: #7c3aed;
455
+ text-decoration: none;
456
+ }
457
+ .form-footer a:hover {
458
+ text-decoration: underline;
459
+ }
460
+
461
+ /* ── Markdown list styling ─────────────────────────── */
462
+ .form-body p ul,
463
+ .form-body p ol {
464
+ margin: 0.5rem 0 0.5rem 1.5rem;
465
+ padding-left: 0.5rem;
466
+ }
467
+ .form-body p li {
468
+ margin-bottom: 0.25rem;
469
+ line-height: 1.5;
470
+ }
471
  </style>
472
  </head>
473
 
 
499
  nip19,
500
  nip44,
501
  } from "https://esm.sh/nostr-tools@2.3.2";
502
+ import { marked } from "https://esm.sh/marked@12.0.0";
503
+
504
+ // Parse markdown string to HTML
505
+ function parseMarkdown(text) {
506
+ if (!text) return "";
507
+ return marked.parse(text);
508
+ }
509
 
510
  // ── Edit this disclaimer to update what's shown on the language selection screen ──
511
+ const DISCLAIMER = `By participating in this survey, you agree that your anonymized responses may be used for academic research as part of a master's thesis. No personally identifiable information will be collected.\n\nPlease select only one language that you are a native speaker of or fluent in at a bilingual level. <strong style="color:#dc2626;">⚠️ Do not proceed if you are not proficient in any of the listed languages, as inaccurate responses may affect the validity of the survey results.</strong>\n\nEach audio clip you hear will not exceed 30 seconds.\n\nIf you speak multiple languages, please complete the survey for one language first. You will have the option to select another language and complete a new survey afterward.`;
512
  // ─────────────────────────────────────────────────────────────────────────────────
513
 
514
  // ── HuggingFace dataset configuration ───────────────────────────────────────────
515
  const HF_DATASET = "chaurAr/crosslingual-asr-entity-benchmark";
 
 
516
  // ─────────────────────────────────────────────────────────────────────────────────
517
+ const METADATA_URL= 'https://huggingface.co/datasets/chaurAr/crosslingual-asr-entity-benchmark/raw/main/metadata.csv'
518
  // Map language names to CSV language codes
519
  const LANGUAGE_CODE_MAP = {
520
  "French": "fr",
 
670
  input.style.display = "none";
671
  }
672
 
673
+ function applyLanguageField() {
674
+ const field = Object.values(formDef.fields).find(
675
+ (f) => f.labelHtml.trim().toLowerCase() === "language",
676
+ );
677
+ if (!field) return;
678
+
679
+ const input = document.querySelector(`input[name="${field.id}"]`);
680
+ if (!input) return;
681
+
682
+ input.value = selectedLanguage;
683
+
684
+ // Hide the label immediately before the input and the input itself
685
+ const label = input.previousElementSibling;
686
+ if (label?.tagName === "LABEL") label.style.display = "none";
687
+ input.style.display = "none";
688
+ }
689
+
690
  let formDef = null;
691
  let submitted = 0;
692
  let selectedLanguage = null;
 
781
  const cols = norm(colsRaw);
782
  const n = cols.length;
783
 
784
+ // Value goes from 1 (leftmost column) to N (rightmost column)
785
  const headerCells = cols.map((c) => `<th>${c.label}</th>`).join("");
786
  const bodyRows = rows
787
  .map(
788
  (r) => `
789
  <tr>
790
  <td class="grid-row-label">${r.label}</td>
791
+ ${cols.map((c, i) => `<td><input type="radio" name="${fieldId}__${r.id}" value="${i + 1}"></td>`).join("")}
792
  </tr>`,
793
  )
794
  .join("");
 
814
  <div class="done-icon">πŸŽ‰</div>
815
  <div class="done-title">All done!</div>
816
  <div class="done-sub">All 10 responses have been submitted. Thank you!</div>
817
+ <div class="done-actions">
818
+ <button class="next-btn" id="restart-btn">Continue with Another Language</button>
819
+ </div>
820
+ <div class="done-close">You can close this page now.</div>
821
  </div>
822
  `;
823
+ document.getElementById("restart-btn").addEventListener("click", () => {
824
+ submitted = 0;
825
+ selectedLanguage = null;
826
+ audioSamples = [];
827
+ document.getElementById("progress-header").style.display = "none";
828
+ showLanguagePicker();
829
+ });
830
  return;
831
  }
832
 
 
846
  ${isLast ? "Submit" : "Next β†’"}
847
  </button>
848
  </div>
849
+ <div class="form-footer">
850
+ Powered by <a href="https://formstr.app/" target="_blank" rel="noopener">form*</a>
851
+ </div>
852
  `;
853
 
854
  applyUniqueIdField();
855
+ applyLanguageField();
856
+
857
+ // Render markdown in question labels
858
+ document.querySelectorAll(`#form-${formDef.id} p`).forEach((label) => {
859
+ const originalText = label.getAttribute('data-original') || label.innerHTML;
860
+ if (!label.getAttribute('data-original')) {
861
+ label.setAttribute('data-original', originalText);
862
+ }
863
+ console.log(originalText)
864
+ // Check if the label contains markdown syntax
865
+ if (originalText.includes('**') || originalText.includes('*') || originalText.includes('`') || originalText.includes('#')) {
866
+ label.innerHTML = parseMarkdown(originalText);
867
+ }
868
+ });
869
 
870
  // Insert audio player after the form intro (name/description) block
871
  // Use the pre-sampled audio files based on current submission count
 
967
  showLanguagePicker();
968
  </script>
969
  </body>
970
+ </html>