function escapeHTML(source) {
return source.replace(/&/g, "&").replace(//g, ">").replace(/[\r\n]/g, "
");
}
function decodeHTML(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html.replace(/
/g,"\n");
return txt.value;
}
var tabs = [
{
name: "GNU/Linux",
command: "curl -fsSL https://downloads.svrjs.org/installer/svr.js.installer.linux.20240509.sh > /tmp/installer.sh && sudo bash /tmp/installer.sh",
uaRegex: /\b(?:GNU\/)?Linux\b/gi
},
{
name: "Docker",
command: "docker pull svrjs/svrjs\ndocker run --name mysvrjs -d -p 80:80 --restart=always svrjs/svrjs"
}
];
if (tabs.length > 0) {
var otherTab = document.getElementById("command-tab-other");
var otherTabOuterHTML = otherTab.outerHTML;
var tabsHTML = "";
var tabToClick = tabs.length;
for (var i = 0; i <= tabs.length; i++) {
tabsHTML += "";
if (i == tabs.length) {
tabsHTML += "Manually";
} else {
tabsHTML += escapeHTML(tabs[i].name);
}
tabsHTML += "";
if (tabToClick == tabs.length && i != tabs.length && tabs[i].uaRegex && navigator.userAgent.match(tabs[i].uaRegex)) tabToClick = i;
}
otherTab.outerHTML = "
" + escapeHTML(tabs[i].command) + "
";
document.getElementById("command-tab-copy").onclick = copyHandler;
}
}
}
document.getElementById("command-tab-" + tabToClick).click();
}