Skip to content

Instantly share code, notes, and snippets.

@nsina
Last active February 1, 2024 20:31
Show Gist options
  • Save nsina/8d8846789bddfbea02f0158493bc24d1 to your computer and use it in GitHub Desktop.
Save nsina/8d8846789bddfbea02f0158493bc24d1 to your computer and use it in GitHub Desktop.
OMBA Blackboard Grade Calculator
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()})();
// 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'); } })();
@nsina
Copy link
Author

nsina commented Sep 27, 2023

Hello OMBA students!

I currently have two tools for Blackboard Grades:

  1. The OG Grade Calculator, which will calculate your grades in Blackboard and provide a percentage (your grade divided by the total). The grades will be displayed in a pop-up on the screen.
  2. The newest tool CSV Grade Export will automatically export your grades into an organized CSV with 3 columns (Your Points, Max Points, and Item name). The item name is in the format "Wk 1 Team Assignment | Six Steps to Solving a Problem | Due Tuesday".

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.

v3-beta

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.

Screenshot 2023-09-29 at 3 11 30 PM


How to install

  1. Create a bookmark in your browser. It can be a bookmark of any page. The tool works in all major browsers.
  2. Copy the code from above (starting with javascript:). You only need the latest version v2
  3. Go to your browser and edit the bookmark and replace the URL with the code snippet you just copied.
  4. Go to the Grades page on Blackboard and open the bookmark. Remain on the page when you click on the bookmark.
  5. Check your grades!

Safari

Apple requires additional steps to allow JavaScript. Follow the steps here or below.

  1. You will need to enable the Develop menu. If you don’t see the Develop menu in the menu bar, choose Safari > Settings, click Advanced, then select “Show features for web developers.”
  2. Open the Develop menu, and select the option "Allow Javascript from Smart Search...".
  3. Now you can continue with step 4 from above instructions.

Firefox

@asofiene
Copy link

asofiene commented Feb 1, 2024

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