Created
February 2, 2025 19:40
-
-
Save MaxySpark/2d902b18bb3a9b0c9aaf3e623ab3a10b to your computer and use it in GitHub Desktop.
UGC Net Score Calculate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extractFormOptionsData() { | |
let rows = document.querySelectorAll('.form-options-item'); | |
let data = {}; | |
rows.forEach(row => { | |
let cells = row.getElementsByTagName('td'); | |
if (cells.length >= 2) { | |
let key = cells[0].textContent.trim(); | |
let value = cells[1].textContent.trim().replace(/"/g, '').trim(); | |
data[key] = parseInt(value, 10); | |
} | |
}); | |
return data; | |
} | |
extractFormOptionsData(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extractAllQuestionData() { | |
let tables = document.querySelectorAll('.menu-tbl'); | |
let data = {}; | |
tables.forEach(table => { | |
let rows = table.getElementsByTagName('tr'); | |
let questionID = null; | |
let chosenOption = null; | |
for (let row of rows) { | |
let keyCell = row.cells[0]?.textContent.trim(); | |
let valueCell = row.cells[1]?.textContent.trim(); | |
if (keyCell === 'Question ID :') { | |
questionID = valueCell; | |
} else if (keyCell === 'Chosen Option :') { | |
chosenOption = valueCell; | |
} | |
} | |
if (questionID && chosenOption) { | |
data[questionID] = parseInt(chosenOption, 10); | |
} | |
}); | |
return data; | |
} | |
extractAllQuestionData(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment