From 9dff311e81748932e4eed58ce7c227a22e04909f Mon Sep 17 00:00:00 2001 From: Simon Sassi Date: Mon, 15 Apr 2019 16:48:18 +0200 Subject: [PATCH] Closes #2204 --- Inject-JavaScript-Code.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Inject-JavaScript-Code.md b/Inject-JavaScript-Code.md index 02a812d..6f0adef 100644 --- a/Inject-JavaScript-Code.md +++ b/Inject-JavaScript-Code.md @@ -4,4 +4,22 @@ For example, some users want to make an Auto Refresh every X time because the se ```javascript setInterval(function(){location.reload();}, 600000); -``` \ No newline at end of file +``` + +An other example is injecting custom CSS (user styles). +This can be done with following snippet: + +```javascript +(()=>{ let css=` +/* START OF STYLE */ + +* { + color: red; +} + +/* END OF STYLE */ +`; + +var ss = document.createElement("style"); +ss.type = "text/css"; ss.innerHTML = css; +document.getElementsByTagName("head")[0].appendChild(ss); })();``` \ No newline at end of file