Subham9126 commited on
Commit
eb91707
·
verified ·
1 Parent(s): 3aeff5a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +5 -7
index.html CHANGED
@@ -153,10 +153,9 @@
153
  alert('Invalid facet format. Please check your input and try again.');
154
  }
155
  });
156
-
157
  function generateBoxes(facetObj, method) {
158
  const $dynamicBoxes = $('#dynamicBoxes').empty();
159
-
160
  if (method === 'v1') {
161
  Object.entries(facetObj).forEach(([key, values]) => {
162
  createBox(key, values);
@@ -170,7 +169,7 @@
170
  function createBox(key, values, index = null) {
171
  const $box = $('<div>').addClass('bg-white rounded-lg shadow-md p-6 fade-in');
172
  const $title = $('<div>').addClass('flex items-center justify-between mb-4')
173
- .append($('<h2>').addClass('text-xl font-semibold').text(`'${key}'`))
174
  .append($('<input>').attr({
175
  type: 'checkbox',
176
  name: key,
@@ -185,20 +184,19 @@
185
  $dynamicBoxes.append($box);
186
  }
187
  }
188
-
189
  $('#getList').click(function() {
190
  const processingMethod = $('input[name="processingMethod"]:checked').val();
191
  let result;
192
  if (processingMethod === 'v1') {
193
  result = $('input[type="checkbox"]:checked').map(function() {
194
- return `'${this.name}'`;
195
  }).get();
196
  } else {
197
  result = facetData.reduce((acc, facetObj, index) => {
198
  const [key] = Object.keys(facetObj);
199
  const $categoryCheckbox = $(`input[type="checkbox"][data-index="${index}"]`);
200
  if ($categoryCheckbox.is(':checked')) {
201
- acc.push(`'${key}'`);
202
  }
203
  return acc;
204
  }, []);
@@ -273,7 +271,7 @@
273
  e.preventDefault();
274
  const inputs = document.querySelectorAll('#inputContainer input');
275
  const values = Array.from(inputs).map(input => processInputValue(input.value));
276
- const formattedOutput = `[${result.join(', ')}]`;
277
  document.getElementById('formattedOutput').textContent = formattedOutput;
278
  document.getElementById('output').classList.remove('hidden');
279
  });
 
153
  alert('Invalid facet format. Please check your input and try again.');
154
  }
155
  });
 
156
  function generateBoxes(facetObj, method) {
157
  const $dynamicBoxes = $('#dynamicBoxes').empty();
158
+
159
  if (method === 'v1') {
160
  Object.entries(facetObj).forEach(([key, values]) => {
161
  createBox(key, values);
 
169
  function createBox(key, values, index = null) {
170
  const $box = $('<div>').addClass('bg-white rounded-lg shadow-md p-6 fade-in');
171
  const $title = $('<div>').addClass('flex items-center justify-between mb-4')
172
+ .append($('<h2>').addClass('text-xl font-semibold').text(key))
173
  .append($('<input>').attr({
174
  type: 'checkbox',
175
  name: key,
 
184
  $dynamicBoxes.append($box);
185
  }
186
  }
 
187
  $('#getList').click(function() {
188
  const processingMethod = $('input[name="processingMethod"]:checked').val();
189
  let result;
190
  if (processingMethod === 'v1') {
191
  result = $('input[type="checkbox"]:checked').map(function() {
192
+ return this.name;
193
  }).get();
194
  } else {
195
  result = facetData.reduce((acc, facetObj, index) => {
196
  const [key] = Object.keys(facetObj);
197
  const $categoryCheckbox = $(`input[type="checkbox"][data-index="${index}"]`);
198
  if ($categoryCheckbox.is(':checked')) {
199
+ acc.push(key);
200
  }
201
  return acc;
202
  }, []);
 
271
  e.preventDefault();
272
  const inputs = document.querySelectorAll('#inputContainer input');
273
  const values = Array.from(inputs).map(input => processInputValue(input.value));
274
+ const formattedOutput = '[' + values.map(v => `'${v}'`).join(', ') + ']';
275
  document.getElementById('formattedOutput').textContent = formattedOutput;
276
  document.getElementById('output').classList.remove('hidden');
277
  });