NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Get selected parent emails from SID // @namespace http://tampermonkey.net/ // @version 0.1 // @description Click in first cell in the row (with the number) and the parent email addresses for that student will be copied to the clickboard // @author You // @match https://staffapps.ocdsb.ca/sid/class.aspx?* // @icon https://www.google.com/s2/favicons?sz=64&domain=ocdsb.ca // @require http://code.jquery.com/jquery-3.3.1.min.js // @license MIT // @grant none // ==/UserScript== (function() { 'use strict'; var $ = window.jQuery; $(`<style type='text/css'> .emailAdded { border: 2px solid red; } </style>`).appendTo("head"); $('tr').find('td:first-of-type').click(addEmails) //document.execCommand("copy"); function addEmails(){ let tp = $(this).parents('tr') if ( tp.hasClass('emailAdded') ){ tp.removeClass('emailAdded') } else{ tp.addClass('emailAdded') } let emailList=[] $('.emailAdded').each(function(){ $(this).children('.email').each(function(a,b){ let ema = $(this).text().trim() if(a== 0 || !ema || ema=='' || ema==' ') return emailList.push( ema ) }) }) var $temp = $("<input>"); $("body").append($temp); $temp.val(emailList.join(',')).select(); document.execCommand("copy"); $temp.remove(); } })();