Skip to content

Commit

Permalink
Have a better button position and say if there is no output
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Feb 14, 2025
1 parent d97d64a commit df92b9c
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions js/interactive-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@ function generateExampleOutputTitle(phpVersion) {
function createOutput(output) {
const container = document.createElement("div");
container.classList.add("screen", "example-contents");

if (output != "") {
const title = document.createElement("p");
title.innerText = generateExampleOutputTitle(PHP.version);
container.appendChild(title);
const div = document.createElement("div");
div.classList.add("examplescode");
container.appendChild(div);
const pre = document.createElement("pre");
pre.classList.add("examplescode");
pre.innerText = output;
div.appendChild(pre);
return container;
}

const title = document.createElement("p");
title.innerText = generateExampleOutputTitle(PHP.version);
title.innerText = "This example did not produce any output."
container.appendChild(title);
const div = document.createElement("div");
div.classList.add("examplescode");
container.appendChild(div);
const pre = document.createElement("pre");
pre.classList.add("examplescode");
pre.innerText = output;
div.appendChild(pre);
return container;
}

Expand Down Expand Up @@ -91,7 +99,7 @@ async function main() {
PHP.buffer.length = 0;
};

phpcode.before(button);
phpcode.after(button);
});
}

Expand Down

0 comments on commit df92b9c

Please sign in to comment.