JS and CSS on Feeder. V.2

It helps your life customizing Feeder.

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         JS and CSS on Feeder. V.2
// @version      2.0.0
// @description  It helps your life customizing Feeder.
// @author       はー / h /
// @match        *.x-feeder.info/*
// @grant        GM.setValue
// @grant        GM.getValue
// @namespace https://greasyfork.org/users/534841
// ==/UserScript==

// Remove Ads
$("#main_right div:first").remove();
$("#main_right div:last").remove();

// Load Saved Data
(async () => {
    let css_first = await GM.getValue("css_save");
    let js_first = await GM.getValue("js_save");

// Add JS Textarea
$("head").append(`<div id="scripts"><script>` + js_first + `</script></div>`)

$("#main_right").prepend(`<textarea id="js_code" style="width: 300px; height: 250px; margin-bottom: 8px;">` + js_first + `</textarea>`);

$(function() {
    $('textarea[id="js_code"]').keyup(function() {
        const js_code = $("#js_code").val();
        $("#scripts").append("<script>" + js_code + "</script>");
        $("#scripts").empty();
    });
});

// Add CSS Textarea
$("head").append(`<style type="text/css" id="css">` + css_first + `</style>`);

$("#main_right").prepend(`<textarea id="css_code" style="width: 300px; height: 250px; margin-bottom: 8px;">` + css_first + `</textarea>`);

$(function() {
    $('textarea[id="css_code"]').keyup(function() {
        const css_code = $("#css_code").val();
            $("#css")[0].innerHTML = css_code ;
    });
});

})();

// Add Description
$("#feeder_links_frame").after(`
<div id="about_this_script">
Save: Ctrl + S<br>
Load: Ctrl + L
</div>
`);

// Input It in CSS Textarea If You Want
/*
div#about_this_script{
    background-color: #FFFFFF;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 8px;
    dispray: block;
}
*/

// Save ( Ctrl + S )
$(window).keydown(function (e) {
    if (event.shiftKey) {
        if (e.keyCode === 83) {
            (async () => {
                await GM.setValue('css_save', $("#css_code").val());
                await GM.setValue('js_save', $("#js_code").val());
                alert("Your code is saved !");
            })();
        }
    }
});

// Load ( Ctrl + L )
$(window).keydown(function (e) {
    if (event.shiftKey) {
        if (e.keyCode === 76) {
            (async () => {
                let css_load = await GM.getValue('css_save');
                let js_load = await GM.getValue('js_save');
                $("#css_code").val(css_load);
                $("#js_code").val(js_load);
                alert("Loaded !")
            })();
        }
    }
});