Last active
June 19, 2026 02:51
-
-
Save jlewin/5bacc1cdc7bab4f6e5ca42145896ae3f to your computer and use it in GitHub Desktop.
Massage Saddleback MySite transcripts into usable output for sharing
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
| // Select summary tables from unofficial transcripts view | |
| // Note: if results are blank, make sure to focus and select the right document context. Right | |
| // Click -> Inspect element seems to ensure devtools works as expected. | |
| // | |
| // - Updated to collect term from subheading | |
| // | |
| // Use var throughout while rerunning and troublshooting - const in devtools is a dead-end | |
| var tables = Array.from(document.querySelectorAll('table.xe-table-xs')); | |
| for (var i = 0; i < tables.length; i++) | |
| { | |
| const table = tables[i]; | |
| if (table.querySelector('th').innerText.includes('Term Totals')) { | |
| table.parentNode.removeChild(table); | |
| } | |
| } | |
| // Purge info columns | |
| var columnContainers = Array.from(document.querySelectorAll('.column-container')); | |
| for (var i = 0; i < columnContainers.length; i++) { | |
| var item = columnContainers[i]; | |
| item.parentNode.removeChild(item); | |
| } | |
| var results = []; | |
| var skipped = []; | |
| // Refresh tables after cleanup | |
| tables = Array.from(document.querySelectorAll('table.xe-table-xs')); | |
| // Filter to | |
| var majors = ['CIMP', 'CS', 'CIMW']; | |
| // Process tables, push formatted values to results array | |
| for (var i = 0; i < tables.length; i++) | |
| { | |
| var table = tables[i]; | |
| var rows = Array.from(table.querySelectorAll('tr')); | |
| var term = getTerm(table); | |
| for(var j = 0; j < rows.length; j++) | |
| { | |
| var row = rows[j]; | |
| var cells = Array.from(row.querySelectorAll('td')); | |
| var cellText = cells.map(c => c.innerText); | |
| // Filter to desired majors only and rows with actual results | |
| if (cellText.length > 6) | |
| { | |
| var include = majors.some(m => cellText[0].startsWith(m)); | |
| // Extract and whitespace pad values | |
| var vals = [ | |
| `${cellText[0]} ${cellText[1]}`.padEnd(12), | |
| term.padEnd(16), | |
| cellText[4].padEnd(26), | |
| cellText[5].padEnd(8), | |
| cellText[6].padEnd(8), | |
| ]; | |
| if (include) { | |
| results.push(vals.join('')); | |
| } else { | |
| skipped.push(vals.join('')); | |
| } | |
| } | |
| } | |
| } | |
| function getTerm(tr) { | |
| var node = tr; | |
| while (node && node.className != 'ng-scope') | |
| { | |
| node = node.parentNode; | |
| } | |
| var heading = node.querySelector('.sub-heading'); | |
| if (!heading) { | |
| console.log(tr, 'unknown'); | |
| return 'Unkown'; | |
| } | |
| var text = heading.innerText; | |
| return text.includes(':') ? text.split(':')[1].trim() : text; | |
| } | |
| // Dump results to console | |
| console.log('------------------ Skipped ------------------'); | |
| console.log(skipped.join("\n")); | |
| console.log('------------------ Results ------------------'); | |
| console.log(results.join("\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment