Skip to content

Instantly share code, notes, and snippets.

@cocoademon
Created July 7, 2020 11:36

Revisions

  1. cocoademon created this gist Jul 7, 2020.
    107 changes: 107 additions & 0 deletions moodle_grading_fix.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,107 @@
    // ==UserScript==
    // @name Cam's Moodle Grading Fix
    // @version 1
    // @grant none
    // @include https://moodle.federation.edu.au/mod/*
    // ==/UserScript==


    let s = `
    .path-mod-assign [data-region="review-panel"].collapsed + [data-region="grade-panel"] [data-region="grade"],
    .path-mod-assign [data-region="grade-panel"].fullwidth [data-region="grade"]
    {
    max-width: none;
    }
    .path-mod-assign [data-region="grade-panel"] .gradingform_rubric {
    width: 100% !important;
    }
    .path-mod-assign [data-region="grade-panel"].fullwidth {
    left: 0 !important;
    width:100% !important;
    }
    .gradingform_rubric .criteria {
    width: 100%;
    }
    .gradingform_rubric .criteria tbody {
    width: 100%;
    }
    .path-mod-assign [data-region="grade-panel"] .gradingform_rubric .criterion .description {
    min-width: 220px;
    }
    .path-mod-assign [data-region="grade-panel"] .gradingform_rubric .criterion .remark textarea {
    min-width: 22em;
    }
    .path-mod-assign [data-region="grade-panel"] .gradingform_rubric .criterion .levels .level.checked {
    background-color: #99ff99;
    }
    .path-mod-assign [data-region="grade-panel"] .gradingform_rubric .criterion .levels {
    width: 99%;
    }
    .submissionstatustable {
    display: grid;
    grid-template-columns: repeat(5,auto);
    justify-items: stretch;
    align-items: center;
    margin: 0;
    gap: 0.5rem;
    }
    .submissionstatustable h3 { display: none; }
    .assignsubmission_comments {
    grid-column: 1/6;
    }
    .assignsubmission_comments > div {
    padding: 0 !important;
    }
    .path-mod-assign [data-region="grade-panel"] div.submissionstatustable {
    margin-bottom: 0;
    }
    /* Quiz review */
    .path-mod-quiz #mod_quiz_navblock .qn_buttons a.thispage {
    font-size: 200%;
    }
    .path-mod-quiz .qnbutton.correct .trafficlight {
    border-bottom: 8px solid #080;
    }
    .path-mod-quiz .qnbutton.notanswered .trafficlight, .path-mod-quiz .qnbutton.incorrect .trafficlight {
    border-top: 8px solid #800;
    }
    .path-mod-quiz .qnbutton.partiallycorrect .trafficlight {
    border-top: 8px solid #ee2;
    }
    `;


    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);
    }

    addGlobalStyle(s);