Codewars helper

Removes unlock solution buttons and AD under the kata description

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name Codewars helper
// @author Murka
// @description Removes unlock solution buttons and AD under the kata description
// @icon https://i.imgur.com/LKAcLYO.png
// @version 0.2
// @match *://www.codewars.com/*
// @run-at document-end
// @grant none
// @license MIT
// @namespace https://greasyfork.org/users/919633
// ==/UserScript==
/* jshint esversion:6 */

/*
    Author: Murka
    Github: https://github.com/Murka007
    Discord: https://discord.gg/cPRFdcZkeD
    Greasyfork: https://greasyfork.org/en/users/919633
*/

(function() {
    "use strict";

    // Removes unlock solution button, right under sample tests
    const HIDE_SOLUTION_TRAIN = true;

    // Removes unlock solution button in the kata preview
    const HIDE_SOLUTION_PREVIEW = false;

    // Removes AD banner under kata description
    const HIDE_DESCRIPTION_BANNER = true;

    const styles = [];

    if (HIDE_SOLUTION_TRAIN) {
        styles.push(`
            #view_solutions, #surrender_btn {
                display: none!important;
            }
        `)
    }

    if (HIDE_SOLUTION_PREVIEW) {
        styles.push(`
            .w-full.mt-2:not(.clear-both) > * > ul.flex.flex-row.justify-center.items-center.space-x-2.px-0.border-0.h-10 > li:nth-child(2) {
                display: none!important;
            }
        `)
    }

    if (HIDE_DESCRIPTION_BANNER) {
        styles.push(`
            .description.h-full {
                height: auto!important;
            }

            .description.h-full > .description-footer {
                display: none!important;
            }
        `)
    }

    const style = document.createElement("style");
    style.innerHTML = styles.join("\n");
    document.head.appendChild(style);

})();