diff --git a/src/app.html b/src/app.html index 750b237..670ca5e 100644 --- a/src/app.html +++ b/src/app.html @@ -17,6 +17,7 @@ } body { color: black; + overflow-x: hidden; } body.dark { color: white; @@ -116,7 +117,7 @@

EaglerForge Builder is currently in development, some project files may break due to code changing all the time.

@@ -127,7 +128,7 @@ // if localhost, get rid of the alert const isLocalHost = location.hostname === 'localhost'; - if (isLocalHost) { + if (isLocalHost || localStorage.getItem('alert_closed')) { const alert = document.getElementById('Zm5BSEgzQW5HeW9yZkFkNEhpbGJiamtpZmdoOGNDc2lMR29JSzF0K2JnPT0='); alert.remove(); } @@ -186,6 +187,14 @@ prismStyles[styleId] = styleCode; } styleElement.innerHTML = styleCode; + if (document.getElementById('docIframe')) { + const docIframe = document.getElementById('docIframe').contentWindow.document.body + if (mode === 'dark') { + docIframe.setAttribute("class", "dark"); + } else { + docIframe.setAttribute("class", "light"); + } + } }; if (location.hash === "#fullscreen"){ @@ -201,6 +210,36 @@ } }; updateTheme(); + + window.openDoc = function(blockID){ + let docDiv = document.getElementById('documentation'); + let iframe = document.createElement("iframe"); + const mode = localStorage.getItem('tb:theme'); + iframe.setAttribute("src", `${window.location.origin}/help/blocks?block=${blockID}&theme=${mode}`); + iframe.style.width = "100%"; + iframe.style.height = "100%"; + iframe.style.border = "none"; + iframe.id = "docIframe"; + if (document.getElementById('docIframe')) { + docDiv.replaceChild(iframe, document.getElementById('docIframe')); + } else { + docDiv.appendChild(iframe); + } + docDiv.setAttribute('opened', 'true'); + document.getElementById('closeDocButton').setAttribute('opened', 'true'); + } + + window.closeDoc = function(){ + let docDiv = document.getElementById('documentation'); + document.createElement("iframe").remove(); + document.getElementById('closeDocButton').setAttribute('opened', 'false'); + docDiv.setAttribute('opened', 'false'); + } + + function closeAlert() { + document.getElementById('Zm5BSEgzQW5HeW9yZkFkNEhpbGJiamtpZmdoOGNDc2lMR29JSzF0K2JnPT0=').remove() + localStorage.setItem('alert_closed', 'true') + }
%sveltekit.body%
diff --git a/src/lib/Documentation/Documentation.svelte b/src/lib/Documentation/Documentation.svelte new file mode 100644 index 0000000..43202f9 --- /dev/null +++ b/src/lib/Documentation/Documentation.svelte @@ -0,0 +1,74 @@ + +
+ +
+ + \ No newline at end of file diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2aa9422..518bd96 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -11,8 +11,8 @@ import StopButton from "$lib/ControlBar/StopButton.svelte"; import OpenButton from "$lib/ControlBar/OpenButton.svelte"; import FullscreenButton from "$lib/ControlBar/FullscreenButton.svelte"; - import EaglerCraft from "$lib/EaglerCraft/EaglerCraft.svelte" - + import EaglerCraft from "$lib/EaglerCraft/EaglerCraft.svelte"; + import Documentation from "$lib/Documentation/Documentation.svelte"; // Modals import ExtensionColorsModal from "$lib/MenuModals/ExtensionColors.svelte"; @@ -74,6 +74,10 @@ import registerDisplay from "../resources/blocks/display.js"; import registerinterface from "../resources/blocks/interface.js"; + Blockly.BlockSvg.prototype.showHelp_ = function ( ) { + alert('test') + }; + registerCore(); registerControl(); registerEvents(); @@ -553,6 +557,7 @@ +

Mod Code

diff --git a/static/help/blocks/index.html b/static/help/blocks/index.html new file mode 100644 index 0000000..92aa533 --- /dev/null +++ b/static/help/blocks/index.html @@ -0,0 +1,36 @@ + + + + + + +
+

Documentation

+

Some blocks are documented here

+
+
+

Every ticks

+ + every in game ticks do + +

This block is called every in-game tick, which means that if the player is not currently in a world, the block will not be run.

+
+ + + \ No newline at end of file diff --git a/static/help/blocks/style.css b/static/help/blocks/style.css new file mode 100644 index 0000000..36b1c62 --- /dev/null +++ b/static/help/blocks/style.css @@ -0,0 +1,33 @@ +body { + color: #111111; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 20px; +} +body.dark { + color: #f9f9f9; +} + +section > h2,h1 { + text-align: center; +} + +/* Blockly SVG blocks */ +block { + height: auto; + display: flex; + align-items: center; + justify-content: center; +} + +.blocklyText { + fill: #ffffff; + font-family: monospace; + font-weight: bold; + font-size: 1rem; +} + +.blocklySvg { + user-select: none; + width: auto; +} +