New Userscript

Turns your grades on Jupiter Ed to A's.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Turns your grades on Jupiter Ed to A's.
// @author       Tobe O
// @match        https://*.jupitered.com/*
// @require      https://code.jquery.com/jquery-3.1.1.slim.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.0/mousetrap.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    
    function loadScript(src) {
        var s = document.createElement('script');
        s.src = src;
        document.body.appendChild(s);
    }

    function changeGrades() {
        $('#showpage > tbody > tr > td > div.colwidth.lineheight > table > tbody > tr > td:nth-child(3) > span').each(function() {
            var $span = $(this);
            var text = $span.text();
            
            if (text.indexOf('A') === -1) {
                var grade = (90 + Math.random() * 10).toFixed(1);
                text = '' + grade + '   A';
                
                if (grade < 93)
                    text += '-';
                else if (grade >= 100)
                    text += '+';
                
                $span.html(text);
            }
        });
    }
    
    
    if (!window.jQuery)
        loadScript('https://code.jquery.com/jquery-3.1.1.slim.min.js');
    if (!window.Mousetrap)
        loadScript('https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.6.0/mousetrap.min.js');
    
    $(document).ready(changeGrades);
    
    Mousetrap.bind(['ctrl+shift+y', 'command+shift+y'], changeGrades);
})();