25 lines
696 B
TypeScript
25 lines
696 B
TypeScript
import $ from "jquery";
|
|
|
|
const initUserScripts = () => {
|
|
const userCSS = localStorage.getItem("user_css") || "";
|
|
const userJS = localStorage.getItem("user_js") || "";
|
|
|
|
$("head").append(`<style>${userCSS}</style>`);
|
|
$("body").append(`<script>${userJS}</script>`);
|
|
|
|
const uconfigCSS = $("#uconfig-css");
|
|
const uconfigJS = $("#uconfig-js");
|
|
const uconfigSave = $("#save-uconfig");
|
|
|
|
uconfigCSS.text(userCSS);
|
|
uconfigJS.text(userJS);
|
|
|
|
uconfigSave.on("click", function () {
|
|
localStorage.setItem("user_css", uconfigCSS.val() as string);
|
|
localStorage.setItem("user_js", uconfigJS.val() as string);
|
|
alert("Nastavení bylo uloženo.");
|
|
});
|
|
};
|
|
|
|
export { initUserScripts };
|