diff --git a/pad.css b/pad.css index 4ef87c2..ac0d3f1 100644 --- a/pad.css +++ b/pad.css @@ -100,6 +100,15 @@ } } +#editbar { + transition: linear 1s opacity; +} + +#editbar[hidden]{ + opacity: 0 !important; + transition: unset; +} + .toolbar ul li { margin: 0; } diff --git a/pad.js b/pad.js index e69de29..607c20e 100644 --- a/pad.js +++ b/pad.js @@ -0,0 +1,30 @@ +const TOOLBAR = document.getElementById("editbar") + +if(TOOLBAR){ + TOOLBAR.hidden = true + + function init(){ + const DOC = document.querySelector(`iframe[name="ace_outer"]`)?.contentDocument + .querySelector(`iframe[name="ace_inner"]`)?.contentDocument + ?.getElementById("innerdocbody"); + + if(!DOC){ + return setTimeout(init, 100); + } + + console.log("Initialized toolbar hiding") + + DOC.addEventListener("input", () => { + TOOLBAR.hidden = false + }) + + TOOLBAR.addEventListener("pointerenter", () => { + TOOLBAR.hidden = false + }) + + TOOLBAR.addEventListener("focusin", () => { + TOOLBAR.hidden = false + }) + } + init() +} \ No newline at end of file