// ==UserScript== // @name Extract Roster // @namespace http://tampermonkey.net/ // @version 1.0 // @description GUI Extract emails from a specific table and copy to clipboard or display them // @author Jason Hemann // @match *://setonhall.instructure.com/courses/*/users // @grant GM_setClipboard // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Function to extract names and emails, then copy to clipboard or alert them function extractNamesAndEmails() { let rows = document.querySelectorAll('div:nth-of-type(3) > div:nth-of-type(2) > div:nth-of-type(2) > div:nth-of-type(3) > div:nth-of-type(1) > div > div:nth-of-type(2) > div > div:nth-of-type(2) > div > div:nth-of-type(2) > table > tbody > tr'); let results = []; rows.forEach((row, index) => { let nameCell = row.querySelector('td:nth-of-type(2) > a'); let emailCell = row.querySelector('td:nth-of-type(3)'); if (nameCell && emailCell) { let name = nameCell.textContent.trim(); let email = emailCell.textContent.trim(); results.push(`${name}\t${email}`); } }); if (results.length > 0) { // Copy to clipboard GM_setClipboard(results.join('\n')); } else { alert('No names or emails found.'); } } // Create a button and style it let button = document.createElement('button'); button.innerHTML = 'Extract Names and Emails'; button.style.position = 'fixed'; button.style.top = '10px'; button.style.right = '10px'; button.style.zIndex = '1000'; button.style.padding = '10px'; button.style.backgroundColor = '#28a745'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; // Add the button to the page document.body.appendChild(button); // Add click event listener to the button button.addEventListener('click', extractNamesAndEmails); })();