NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name count absents // @namespace http://tampermonkey.net/ // @version 0.1.3 // @description count the number of absents at the top of the Reported As column // @author allan.caughey@ocdsb.ca // @match https://webapps.ocdsb.ca/twebschool/TWEBATT* // @require http://code.jquery.com/jquery-3.3.1.min.js // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; var $ = window.jQuery; function getAbsents() { var absent = 0, late = 0, total = $('input[title="Mark as Absent"]').length $('input[title="Mark as Absent"]').each(function (a, b) { if ($(b).hasClass('buttonRegularActive')) absent++ else if ($(b).siblings('span').text().trim() !== "") late++ //if($(b).siblings('span').text().trim()!="") console.log('*'+$(b).siblings('span').text()+'*') }) $("#abspres").text('Absent: ' + absent + ' / Present: ' + (total - absent)) } $("body *").addClass('noChangeTracking') $("th:nth-of-type(5)").attr('id', "abspres") //$('#abspres').css('{: ;: ;: ;: ;}') $("#abspres").css({ "width": "100%", "text-align": "center", "display": "inline-block", "color": "#bb0000" }); getAbsents() $('input[title="Mark as Absent"]').unbind('change').click(function () { getAbsents() }) })();