-
-
Save nsina/8d8846789bddfbea02f0158493bc24d1 to your computer and use it in GitHub Desktop.
OMBA Blackboard Grade Calculator
This file contains 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
javascript:(function(){var rows=document.querySelectorAll('.row');var data=[["Your Points","Max Points","Item"]];rows.forEach(function(row){var gradeElement=row.querySelector('.grade-value .grade-input-display');var linkText=row.querySelector('a.bb-click-target')?row.querySelector('a.bb-click-target').textContent.trim():'N/A';if(gradeElement){var gradeText=gradeElement.querySelector('bdi')?gradeElement.querySelector('bdi').textContent.trim():gradeElement.textContent.trim();var parts=gradeText.split('/');if(parts.length===2){var achieved=parseFloat(parts[0].trim());var possible=parseFloat(parts[1].trim());if(!isNaN(achieved)&&!isNaN(possible)){data.push([achieved,possible,linkText])}}}});var csvContent="data:text/csv;charset=utf-8,";data.forEach(function(row,index){var dataString=row.join(",");csvContent+=index<data.length?dataString+"\n":dataString});var encodedUri=encodeURI(csvContent);var link=document.createElement("a");link.setAttribute("href",encodedUri);link.setAttribute("download","grade_data.csv");document.body.appendChild(link);link.click()})(); |
This file contains 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
// v2 (Latest Version) | |
// Chrome, Firefox, Safari | |
javascript:(function() { const gradeElements = document.querySelectorAll('.grade-input-display.grade-ellipsis'); if (gradeElements.length > 0) { let totalNumber1 = 0; let totalNumber2 = 0; gradeElements.forEach((gradeSpan) => { const bdiElement = gradeSpan.querySelector('bdi'); if (bdiElement) { const numberText = bdiElement.textContent.trim(); const numbers = numberText.split('/'); if (numbers.length === 2) { const number1 = parseFloat(numbers[0].trim()); const number2 = parseFloat(numbers[1].trim()); if (!isNaN(number1) && !isNaN(number2)) { totalNumber1 += number1; totalNumber2 += number2; } } } }); if (totalNumber1 !== 0 && totalNumber2 !== 0) { const percentage = (totalNumber1 / totalNumber2) * 100; alert(`OMBA Grade Calculator v2\n\nYour points: ${totalNumber1}\nMax points: ${totalNumber2}\nTotal Percentage: ${percentage.toFixed(2)}%\n\nDisclaimer: This tool is provided for informational purposes only. The accuracy of the calculations cannot be guaranteed, and the user is solely responsible for verifying any results obtained.`); } else { alert('No valid grade information found.'); } } else { alert('No <span> elements with class "grade-input-display grade-ellipsis" found on the page'); } })(); | |
// v1 | |
// Firefox & Safari (grades and percentage) | |
javascript:(function() { const gradeElements = document.querySelectorAll('.grade-input-display.grade-ellipsis'); if (gradeElements.length > 0) { let result = ''; let totalNumber1 = 0; let totalNumber2 = 0; gradeElements.forEach((gradeSpan, index) => { const bdiElement = gradeSpan.querySelector('bdi'); if (bdiElement) { const numberText = bdiElement.textContent.trim(); const numbers = numberText.split('/'); if (numbers.length === 2) { const number1 = parseFloat(numbers[0].trim()); const number2 = parseFloat(numbers[1].trim()); if (!isNaN(number1) && !isNaN(number2)) { totalNumber1 += number1; totalNumber2 += number2; result += `Grade ${index + 1}: Your grade - ${number1}, Max Grade - ${number2}\n`; } else { result += `Grade ${index + 1}: Invalid number format\n`; } } else { result += `Grade ${index + 1}: Number format is not "number1 / number2"\n`; } } else { result += `Grade ${index + 1}: No <bdi> element found\n`; } }); if (totalNumber1 !== 0 && totalNumber2 !== 0) { const percentage = (totalNumber1 / totalNumber2) * 100; result += `Total Percentage: ${percentage.toFixed(2)}%\n`; } if (result !== '') { alert(result); } } else { alert('No <span> elements with class "grade-input-display grade-ellipsis" found on the page'); } })(); | |
// Chrome & Safari (only percentage) | |
javascript:(function() { const gradeElements = document.querySelectorAll('.grade-input-display.grade-ellipsis'); if (gradeElements.length > 0) { let totalNumber1 = 0; let totalNumber2 = 0; gradeElements.forEach((gradeSpan) => { const bdiElement = gradeSpan.querySelector('bdi'); if (bdiElement) { const numberText = bdiElement.textContent.trim(); const numbers = numberText.split('/'); if (numbers.length === 2) { const number1 = parseFloat(numbers[0].trim()); const number2 = parseFloat(numbers[1].trim()); if (!isNaN(number1) && !isNaN(number2)) { totalNumber1 += number1; totalNumber2 += number2; } } } }); if (totalNumber1 !== 0 && totalNumber2 !== 0) { const percentage = (totalNumber1 / totalNumber2) * 100; alert(`Total Percentage: ${percentage.toFixed(2)}%`); } else { alert('No valid grade information found.'); } } else { alert('No <span> elements with class "grade-input-display grade-ellipsis" found on the page'); } })(); |
This is really cool! I love how simple it is to implement! Thanks for sharing it with us!
Already using the Blackboard-CSV-Grade-Export.js to extract my grades.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello OMBA students!
I currently have two tools for Blackboard Grades:
Blackboard CSV Grade Export (1/31/24):
This is my latest tool that will export all your grades into a downloadable CSV file. Find the code snippet above, and follow the same process as described below under "How to install".
v3 BETA update (10/29/23):
I have a new version that will provide the grades separately for each category (Knowledge Checks [20%] and Assignments [40%]).
It is currently being tested, and is in BETA (not yet ready for release). You can download from here.
v2.1 update (10/24/23):
This version includes calculation of the latest Group Assignment (Week 3-6 Team Assignment). I would recommend that you create a separate bookmark for this version since future assignments may or may not break the functionality. The prior versions that I created should work for the entire MOD.
Download it from this page: https://gist.github.com/nsina/b9ce5cafd2879deff8fcc817eaa6bba8
v2 update (09/29/23):
I've made some updates to the code. You can now use the same code snippet for all major browsers.
How to install
javascript:
). You only need the latest versionv2
Safari
Apple requires additional steps to allow JavaScript. Follow the steps here or below.