3v324v23 commited on
Commit
f9118d2
·
1 Parent(s): 81e4ede

Add radio button values for feedback questions and enhance fallback logic

Browse files
Files changed (2) hide show
  1. feedback.js +63 -5
  2. main.js +19 -0
feedback.js CHANGED
@@ -107,6 +107,61 @@ function resetFeedbackForm() {
107
  }
108
 
109
  function assignRadioValues() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  const questions = document.querySelectorAll('.question');
111
 
112
  questions.forEach((question) => {
@@ -116,17 +171,20 @@ function assignRadioValues() {
116
  options.forEach((option, index) => {
117
  const radio = option.querySelector('input[type="radio"]');
118
  if (!radio) return;
 
 
 
 
 
 
 
119
  if (questionId === '') {
120
  radio.value = String(index + 1);
121
  } else {
122
  const optionText = option
123
  .querySelector('.option-text')
124
  ?.textContent?.trim();
125
- if (optionText) {
126
- radio.value = optionText;
127
- } else if (!radio.value) {
128
- radio.value = String(index + 1);
129
- }
130
  }
131
  });
132
  });
 
107
  }
108
 
109
  function assignRadioValues() {
110
+ const enValues = {
111
+ q0: [
112
+ 'Journalist / Fact Checker',
113
+ 'Researcher / Student',
114
+ 'Law Enforcement / OSINT',
115
+ 'General User',
116
+ ],
117
+ q1: [
118
+ 'Spot on',
119
+ 'Mostly correct',
120
+ 'Mixed results',
121
+ 'Missed key context',
122
+ 'Completely wrong',
123
+ ],
124
+ q2: [
125
+ 'Yes',
126
+ 'No - It was actually Real',
127
+ 'No - It was actually AI-Generated',
128
+ ],
129
+ q3: [
130
+ 'All links worked and were relevant',
131
+ 'Some links were broken/dead',
132
+ 'Links were unrelated to the topic',
133
+ ],
134
+ q4: [
135
+ 'No issues',
136
+ 'Invented dates/times',
137
+ 'Invented people/names',
138
+ "Citations that don't exist",
139
+ ],
140
+ q5: [
141
+ 'Very Clear',
142
+ 'Clear',
143
+ 'Moderately Clear',
144
+ 'Slightly Clear',
145
+ 'Not Clear',
146
+ ],
147
+ q6: ['Yes', 'Partially', 'No'],
148
+ q7: [
149
+ 'Very Clear',
150
+ 'Clear',
151
+ 'Moderately Clear',
152
+ 'Slightly Clear',
153
+ 'Not Clear',
154
+ ],
155
+ q8: ['Yes', 'Not Applicable', 'No'],
156
+ q9: [
157
+ 'Clearly Explained',
158
+ 'Well Explained',
159
+ 'Moderately Explained',
160
+ 'Poorly Explained',
161
+ 'Not Explained',
162
+ ],
163
+ };
164
+
165
  const questions = document.querySelectorAll('.question');
166
 
167
  questions.forEach((question) => {
 
171
  options.forEach((option, index) => {
172
  const radio = option.querySelector('input[type="radio"]');
173
  if (!radio) return;
174
+ const enList = enValues[questionId];
175
+ if (enList && enList[index]) {
176
+ radio.value = enList[index];
177
+ return;
178
+ }
179
+
180
+ // Fallbacks if question not mapped
181
  if (questionId === '') {
182
  radio.value = String(index + 1);
183
  } else {
184
  const optionText = option
185
  .querySelector('.option-text')
186
  ?.textContent?.trim();
187
+ radio.value = optionText || radio.value || String(index + 1);
 
 
 
 
188
  }
189
  });
190
  });
main.js CHANGED
@@ -196,6 +196,7 @@ let isReplacedBlock = true;
196
  renderer.text = function ({ text }) {
197
  const hiddenTexts = [];
198
  const noReplaces = [
 
199
  '**Tags:**',
200
  '**Filename:**',
201
  '**Authenticity Assessment:**',
@@ -207,6 +208,24 @@ renderer.text = function ({ text }) {
207
  '**Supporting Sources:**',
208
  '**Cross-Checking Information:**',
209
  '**Other Info:**',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  ];
211
  isReplaced = !noReplaces.some((item) => text.includes(item));
212
  if (isReplacedBlock) {
 
196
  renderer.text = function ({ text }) {
197
  const hiddenTexts = [];
198
  const noReplaces = [
199
+ //EN
200
  '**Tags:**',
201
  '**Filename:**',
202
  '**Authenticity Assessment:**',
 
208
  '**Supporting Sources:**',
209
  '**Cross-Checking Information:**',
210
  '**Other Info:**',
211
+
212
+ //JA
213
+ '**タグ:**',
214
+ '**真正性評価:**',
215
+ '**検証方法:**',
216
+ '**詳細:**',
217
+ '**サポートソース:**',
218
+ '**クロスチェック情報:**',
219
+ '**その他の情報:**',
220
+
221
+ //Vi
222
+ '**Thẻ:**',
223
+ '**Đánh giá tính xác thực:**',
224
+ '**Phương pháp xác minh:**',
225
+ '**Chi tiết:**',
226
+ '**Nguồn hỗ trợ:**',
227
+ '**Thông tin đối chiếu chéo:**',
228
+ '**Thông tin khác:**',
229
  ];
230
  isReplaced = !noReplaces.some((item) => text.includes(item));
231
  if (isReplacedBlock) {