window.RevealCodewindow = function () {
return {
id: "RevealCodewindow",
init: function(deck) {
initCodewindow(deck);
}
};
};
const initCodewindow = function(Reveal) {
const svg_buttons = ``
const svg_sass = ``
const svg_r = ``
const svg_python = ``
const svg_html = ``
const svg_css = ``
const svg_js = ``
const svg_quarto = ``
const svg_julia = ``
window.addEventListener( 'ready', function(event) {
var content;
var new_content;
var empty_file;
// Remove configured margin of the presentation
var codewindows = document.getElementsByClassName("codewindow");
for (var i = 0; i < codewindows.length; i++) {
content = codewindows[i];
empty_file = true;
new_content = document.createElement("div");
new_content.classList.add("codewindow");
header = document.createElement("div");
header.classList.add("header");
header.innerHTML = svg_buttons;
file = document.createElement("div");
file.classList.add("file");
if (content.classList.contains("sass")) {
file.innerHTML += svg_sass;
empty_file = false;
}
if (content.classList.contains("r")) {
file.innerHTML += svg_r;
empty_file = false;
}
if (content.classList.contains("python")) {
file.innerHTML += svg_python;
empty_file = false;
}
if (content.classList.contains("html")) {
file.innerHTML += svg_html;
empty_file = false;
}
if (content.classList.contains("css")) {
file.innerHTML += svg_css;
empty_file = false;
}
if (content.classList.contains("js")) {
file.innerHTML += svg_js;
empty_file = false;
}
if (content.classList.contains("quarto")) {
file.innerHTML += svg_quarto;
empty_file = false;
}
if (content.classList.contains("julia")) {
file.innerHTML += svg_julia;
empty_file = false;
}
file_name = content.querySelector("p");
if (file_name !== null) {
file.innerHTML += file_name.innerText;
empty_file = false;
}
textarea = document.createElement("div");
textarea.classList.add("textarea");
textarea.appendChild(content.querySelector("div,iframe"));
if (!empty_file) {
header.appendChild(file);
}
new_content.appendChild(header);
new_content.appendChild(textarea);
codewindows[i].innerHTML = new_content.innerHTML;
if (content.attributes.width !== undefined) {
codewindows[i].style.width = content.attributes.width.value;
}
}
});
};