fisken / SAM learning 2.2

// ==UserScript==
// @grant GM_xmlhttpRequest
// @name           SAM learning 2.2
// @namespace      https://discord.gg/2t5uYwQ
// @description    Adds an extra button called "I'm lazy" to SAM learning exercises, clicking it will complete the exercise 100%
// @include        *platform.samlearning.com/*
// @license MIT
// @version        2.2.1
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @connect https://platform.samlearning.com
// @author fisken
// ==/UserScript==


waitForKeyElements (
    "#node-1",
    galSomFisken
);

waitForKeyElements (
    "#accordionContent",
    fiskenWasHere
);

function galSomFisken (jNode) {
//    jNode.css ("color", "white");
    var patt=new RegExp("[0-9]{2,15}$");
    var id = patt.exec(document.URL);
    if (id === null) {
        var directlink = document.getElementsByClassName("ui-dialog-titlebar-directlink")[0].getAttribute("data-directlink");
        id = patt.exec(directlink);
    }
    var cont = "activityId=" + id + "&score=100";
    var x = document.getElementsByClassName("bottomPrev");
    x[0].outerHTML = '<div class="bottomPrev" id="btnSendReq"><a class="step">I\'m lazy</a></div>';
    var btnEl = document.getElementById('btnSendReq');
    x = document.getElementsByClassName("bottomNext")[0];
    x.addEventListener('click', galSomFisken);
    btnEl.addEventListener('click', function sendRequest () {
        GM_xmlhttpRequest ({method: "POST",
                            url: "https://platform.samlearning.com/content/html-revise/ajax-score",
                            headers: {
                                "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
                                "Accept": "application/json, text/javascript, */*; q=0.01",
                                "X-Requested-With": "XMLHttpRequest"
                            },
                            data: cont,
                           });
        var elmDeleted = document.getElementById("exercisePopup");
        elmDeleted.parentNode.removeChild(elmDeleted);
        elmDeleted = document.getElementsByClassName("full-overlay")[0];
        elmDeleted.outerHTML = '';

    }, false);
    x = document.getElementsByClassName("rightPanelTop")[0];
    x.outerHTML = '<div class="rightPanelTop" id="come pay me a visit at https://discord.gg/2t5uYwQ --- le poisson <3"><img src="https://image.ibb.co/mS48E6/let_s_get_goin.jpg" ></div>';
    x = document.getElementById('come pay me a visit at https://discord.gg/2t5uYwQ --- le poisson <3');
    x.style.border = 'none';
    x.style.borderRadius = 'none';
    x.style.background = 'none';
    x = document.getElementsByClassName("screenPreview")[0];
    x.style.border = 'none';
    x.style.backgroundColor = 'transparent';
    x = document.getElementsByClassName("actContainer")[0];
    x.style.backgroundImage = 'url( "https://preview.ibb.co/dLEtz6/fucking_retard_who_uploaded_this.jpg" )';
    x = document.getElementsByClassName("BackGroundComponent")[0];
    if (x !== undefined) {
        x.parentNode.removeChild(x);
    }
    // xoxo <3 ;)
    console.log("I'm glad you came looking here, maybe you should check the source code out a lil bit <3 -- fisken");
    // Thank you <3 -- den gale fisken
}

function fiskenWasHere (jNode) {
    console.log("http://bit.ly/2bew50A"); //<------- click
}