NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name GSW RAIN Class Roster processor // @namespace http://tampermonkey.net/ // @version 0.10 // @description Prepares Final grades for nice formatted printing // @author Simon Baev // @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.min.js // @require https://code.jquery.com/jquery-1.11.3.min.js // @require https://malsup.github.io/min/jquery.form.min.js // @match https://gsw.gabest.usg.edu/pls/B420/bwlkfcwl.P_FacClaListSum // ==/UserScript== /* jshint ignore:start */ var inline_src = (<><![CDATA[ /* jshint ignore:end */ /* jshint esnext:true */ function addGlobalStyle(css) { var head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = css; head.appendChild(style); } //-- Create printBody var printBody = $('<div>') .addClass('printBody') .append( $('<h1>') .text('Class Roster') ) .append( $('<h2>') .addClass('title-left') .text($('table.datadisplaytable:eq(0) tr:eq(0) th:eq(0) a').text() + ' (CRN:' + $('table.datadisplaytable:eq(0) tr:eq(1) td:eq(0) a').text().trim() + ')') ) .append( $('<h2>') .addClass('title-right') .text($('div.staticheaders').html().split(/<br>/g)[1].trim()) ) .append($('<hr>')) .append( $('<table>') .addClass('printTable') ); //-- Add printBody into the dome $('div.pagetitlediv').after(printBody); //-- Fill invisible div.printBody with table data $('table.printTable') .empty() .append( $('<thead>') .append( $('<tr>') .append($('<th>').text('#').addClass('deheader')) .append($('<th>').text('Name').addClass('deheader')) .append($('<th>').text('GSW ID').addClass('deheader')) .append($('<th>').text('E-Mail').addClass('deheader')) ) ) .append( $('<tbody>') ); $('table.datadisplaytable:eq(2) tr:gt(0)').each(function(){ var tr = $(this); $('table.printTable tbody') .append( $('<tr>') .append($('<td>').text(tr.find('td:eq(0)').text())) .append($('<td>').text(tr.find('td:eq(1)').text())) .append($('<td>').text(tr.find('td:eq(2)').text())) .append( $('<td>') .text(tr.find('td span.fieldmediumtext a').last().attr('href').split(/[:]/)[1]) ) ); }); //-- Add 'print' link $('span.pageheaderlinks').prepend( $('<a>') .addClass('submenulinktext2') .attr('href','#') .html('<b>PRINT</b>') .click(function(){ window.print(); return false; }) ); //-- Adjust document CSS addGlobalStyle(` div.printBody { display : none; } @media print { @page { size: portrait; } div.printBody { font-size : x-small; font-family: arial; display : block !important; } div:not(.printBody){ display : none !important; } div.printBody hr { margin-top: 25px; margin-bottom: 50px; } div.printBody h2.title-left { } div.printBody h2.title-right { } table.printTable { border:none; border-collapse: collapse; margin: 0px auto; } table.printTable thead tr { border-bottom: 1px solid #013395; } table.printTable tbody tr:first-child td { padding-top: 10px; } table.printTable td, table.printTable th { padding : 5px 20px; border-left: 1px solid #013395; border-right: 1px solid #013395; vertical-align: middle; } table.printTable td:first-child, table.printTable th:first-child { border-left: none; } table.printTable td:last-child, table.printTable th:last-child { border-right: none; } table.printTable td a { text-decoration: none; } } `); /* jshint ignore:start */ ]]></>).toString(); var c = babel.transform(inline_src); eval(c.code); /* jshint ignore:end */