mcotton / Schoolsoft Radio Button Fixer

// ==UserScript==
// @author      Mark Cotton
// @name        Schoolsoft Radio Button Fixer
// @version     2.0
// @descrption  Makes radio buttons on Schoolsoft prettier and much easier to click
// @license     GPL-3.0
// @include     https://*.schoolsoft.se/*
// @require     http://code.jquery.com/jquery-latest.min.js
// ==/UserScript==

/* Function that injects CSS rules */
function injectStyles( rule ) {
    var div = $( '<div />', {
        html: '&shy;<style>' + rule + '</style>'
    } ).appendTo( 'body' );
}

/*Individual calls to add styles */
//injectStyles( 'input[type=radio] { width: 2em; height: 2em; margin: 0px 0px 0px 0px; opacity: 0.5;}' );

//Green
injectStyles( 'div.green[style="height:21px;width:21px;"] {background: none !important;}');
injectStyles( 'div.green[style="height:21px;width:21px;border:none;"] {background: none !important;}');
injectStyles( 'div.green > input[type="radio"]{ width: 100%; height: 100%; margin: 0px 0px 0px 0px; -webkit-appearance: none; border: #00CC00 2px solid;}' );
injectStyles( 'div.green > input[type="radio"]:checked{background: #00CC00;}' );

//Yellow
injectStyles( 'div.yellow[style="height:21px;width:21px;"] {background: none !important;}');
injectStyles( 'div.yellow[style="height:21px;width:21px;border:none;"] {background: none !important;}');
injectStyles( 'div.yellow > input[type="radio"]{ width: 100%; height: 100%; margin: 0px 0px 0px 0px; -webkit-appearance: none; border: #FFFF33 2px solid;}' );
injectStyles( 'div.yellow > input[type="radio"]:checked{background: #FFFF33;}' );

//None
injectStyles( 'div:nth-child(2) > input[type="radio"]{ width: 100%; height: 100%; margin: 0px 0px 0px 0px; -webkit-appearance: none; border: #aaaaaa 2px solid;}' );
injectStyles( 'div:nth-child(2) > input[type="radio"]:checked{background: #cccccc;}' );

//Summary
injectStyles( '#full > form > table:nth-child(32) > tbody > tr:nth-child(2) > td > input[type="radio"]{ width: 3em; height: 3em; -webkit-appearance: none; border: grey 1px solid;}');
injectStyles( '#full > form > table:nth-child(32) > tbody > tr:nth-child(2) > td:nth-child(2) > input[type="radio"]:checked{background: red;}');
injectStyles( '#full > form > table:nth-child(32) > tbody > tr:nth-child(2) > td:nth-child(3) > input[type="radio"]:checked{background: #FFFF33;}');
injectStyles( '#full > form > table:nth-child(32) > tbody > tr:nth-child(2) > td:nth-child(4) > input[type="radio"]:checked{background: #00CC00;}');
injectStyles( '#full > form > table:nth-child(32) > tbody > tr:nth-child(2) > td:nth-child(5) > input[type="radio"]:checked{background: grey;}');


//Checkboxes
injectStyles( 'input[id="checkboxStudents"] { width: 100%; height: 56px;margin: 0px 0px 0px 0px; -webkit-appearance: none; border: #aaaaaa 2px solid;}' );
injectStyles( 'input[id="checkboxStudents"]:checked{background: #cccccc;}' );
injectStyles( 'input[id="checkboxAllStudents"] { width: 100%; height: 56px;margin: 0px 0px 0px 0px; -webkit-appearance: none; border: #aaaaaa 2px solid;}' );
injectStyles( 'input[id="checkboxAllStudents"]:checked{background: #cccccc;}' );

//injectStyles( 'input[type="checkbox"] { width: 1.5em; height: 1.5em;}' );