Update index.html
Browse files- index.html +67 -4
index.html
CHANGED
|
@@ -852,11 +852,11 @@
|
|
| 852 |
<div class="done-card">
|
| 853 |
<div class="done-icon">🎉</div>
|
| 854 |
<div class="done-title">All done!</div>
|
| 855 |
-
<div class="done-sub">All 10 responses have been submitted. Thank you!</div>
|
| 856 |
<div class="done-actions">
|
| 857 |
<button class="next-btn" id="restart-btn">Continue with Another Language</button>
|
| 858 |
</div>
|
| 859 |
-
<div class="done-close">
|
| 860 |
</div>
|
| 861 |
`;
|
| 862 |
document.getElementById("restart-btn").addEventListener("click", () => {
|
|
@@ -951,6 +951,61 @@
|
|
| 951 |
// Insert grid fields first, then option-groups
|
| 952 |
formBody.insertAdjacentHTML("beforeend", gridFieldsHtml);
|
| 953 |
optionGroupsArray.forEach(og => formBody.appendChild(og));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 954 |
}
|
| 955 |
|
| 956 |
document
|
|
@@ -959,6 +1014,13 @@
|
|
| 959 |
const btn = document.getElementById("next-btn");
|
| 960 |
const statusEl = document.getElementById("status-msg");
|
| 961 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 962 |
btn.disabled = true;
|
| 963 |
btn.innerHTML = `<span class="spinner"></span>${isLast ? "Submitting…" : "Saving…"}`;
|
| 964 |
statusEl.style.display = "none";
|
|
@@ -985,7 +1047,8 @@
|
|
| 985 |
});
|
| 986 |
}
|
| 987 |
|
| 988 |
-
|
|
|
|
| 989 |
|
| 990 |
function showLanguagePicker() {
|
| 991 |
const languages = ["French", "German", "Italian", "Spanish"];
|
|
@@ -1027,4 +1090,4 @@
|
|
| 1027 |
showLanguagePicker();
|
| 1028 |
</script>
|
| 1029 |
</body>
|
| 1030 |
-
</html>
|
|
|
|
| 852 |
<div class="done-card">
|
| 853 |
<div class="done-icon">🎉</div>
|
| 854 |
<div class="done-title">All done!</div>
|
| 855 |
+
<div class="done-sub">All 10 responses have been submitted. Thank you!<br /><br />If you are a native or near-native speaker of a <strong>different language</strong> than the one you just completed, you can continue with another language.</div>
|
| 856 |
<div class="done-actions">
|
| 857 |
<button class="next-btn" id="restart-btn">Continue with Another Language</button>
|
| 858 |
</div>
|
| 859 |
+
<div class="done-close">Otherwise, you may close this page now.</div>
|
| 860 |
</div>
|
| 861 |
`;
|
| 862 |
document.getElementById("restart-btn").addEventListener("click", () => {
|
|
|
|
| 951 |
// Insert grid fields first, then option-groups
|
| 952 |
formBody.insertAdjacentHTML("beforeend", gridFieldsHtml);
|
| 953 |
optionGroupsArray.forEach(og => formBody.appendChild(og));
|
| 954 |
+
|
| 955 |
+
// Find the optional comments field (label containing "additional comments" with input right after)
|
| 956 |
+
const allLabels = formBody.querySelectorAll('label');
|
| 957 |
+
allLabels.forEach(label => {
|
| 958 |
+
if (label.textContent.includes('additional comments')) {
|
| 959 |
+
// Check if the next sibling is an input or textarea
|
| 960 |
+
const nextSibling = label.nextElementSibling;
|
| 961 |
+
if (nextSibling && (nextSibling.tagName === 'INPUT' || nextSibling.tagName === 'TEXTAREA')) {
|
| 962 |
+
// Create a container for label + input
|
| 963 |
+
const container = document.createElement('div');
|
| 964 |
+
container.appendChild(label);
|
| 965 |
+
container.appendChild(nextSibling);
|
| 966 |
+
formBody.appendChild(container);
|
| 967 |
+
}
|
| 968 |
+
}
|
| 969 |
+
});
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
// Validate that all required fields are answered
|
| 973 |
+
function validateForm() {
|
| 974 |
+
const missingFields = [];
|
| 975 |
+
|
| 976 |
+
// Check grid fields - each row needs a radio button selected
|
| 977 |
+
const gridTables = document.querySelectorAll('.grid-table');
|
| 978 |
+
gridTables.forEach(table => {
|
| 979 |
+
const rows = table.querySelectorAll('tbody tr');
|
| 980 |
+
rows.forEach(row => {
|
| 981 |
+
const radios = row.querySelectorAll('input[type="radio"]');
|
| 982 |
+
const isAnswered = Array.from(radios).some(r => r.checked);
|
| 983 |
+
if (!isAnswered) {
|
| 984 |
+
const labelCell = row.querySelector('.grid-row-label');
|
| 985 |
+
const fieldLabel = labelCell ? labelCell.textContent.trim() : 'Grid question';
|
| 986 |
+
missingFields.push(fieldLabel);
|
| 987 |
+
}
|
| 988 |
+
});
|
| 989 |
+
});
|
| 990 |
+
|
| 991 |
+
// Check option groups (radio button groups)
|
| 992 |
+
const optionGroups = document.querySelectorAll('.option-group');
|
| 993 |
+
optionGroups.forEach(og => {
|
| 994 |
+
const radios = og.querySelectorAll('input[type="radio"]');
|
| 995 |
+
const isAnswered = Array.from(radios).some(r => r.checked);
|
| 996 |
+
if (!isAnswered) {
|
| 997 |
+
const label = og.querySelector('.option-label');
|
| 998 |
+
const fieldLabel = label ? label.textContent.trim() : 'Option question';
|
| 999 |
+
missingFields.push(fieldLabel);
|
| 1000 |
+
}
|
| 1001 |
+
});
|
| 1002 |
+
|
| 1003 |
+
return missingFields;
|
| 1004 |
+
}
|
| 1005 |
+
|
| 1006 |
+
// Show popup notification
|
| 1007 |
+
function showValidationError() {
|
| 1008 |
+
alert("Please answer all questions before moving forward");
|
| 1009 |
}
|
| 1010 |
|
| 1011 |
document
|
|
|
|
| 1014 |
const btn = document.getElementById("next-btn");
|
| 1015 |
const statusEl = document.getElementById("status-msg");
|
| 1016 |
|
| 1017 |
+
// Validate all required fields before submitting
|
| 1018 |
+
const missingFields = validateForm();
|
| 1019 |
+
if (missingFields.length > 0) {
|
| 1020 |
+
showValidationError();
|
| 1021 |
+
return;
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
btn.disabled = true;
|
| 1025 |
btn.innerHTML = `<span class="spinner"></span>${isLast ? "Submitting…" : "Saving…"}`;
|
| 1026 |
statusEl.style.display = "none";
|
|
|
|
| 1047 |
});
|
| 1048 |
}
|
| 1049 |
|
| 1050 |
+
|
| 1051 |
+
const SURVEY_DES = "In this survey, you will evaluate <strong>10 audio samples</strong>. Each audio clip contains few sentences in your selected language with an embedded English-language entity (e.g., a name or term). You will rate the overall audio quality as well as how naturally this entity is pronounced within the sentence. For each audio, you need to answer <strong>4 questions</strong> related to 3 aspects:\n\n<strong>Pronunciation</strong> – How clearly and correctly the words are pronounced\n<strong>Grammar</strong> – How grammatically correct the speech sounds\n<strong>Naturalness</strong> – How natural the overall speech sounds\n\n<strong>Rating Scale:</strong> 1 (Poor) to 5 (Excellent)\n\nPlease listen to each audio carefully before providing your ratings.";
|
| 1052 |
|
| 1053 |
function showLanguagePicker() {
|
| 1054 |
const languages = ["French", "German", "Italian", "Spanish"];
|
|
|
|
| 1090 |
showLanguagePicker();
|
| 1091 |
</script>
|
| 1092 |
</body>
|
| 1093 |
+
</html>
|