Update FStackMonkey.ps1

This commit is contained in:
2025-06-29 04:43:16 -04:00
parent 6c24bda864
commit 833d7f6e9d

View File

@@ -857,7 +857,7 @@ function Invoke-ScriptMonkey {
# 1) Inline your full original CSS here
#
$style = @'
<style>
<style>
:root {
/* Cool Palette */
--background-color: rgba(18, 18, 18, 1);
@@ -1012,17 +1012,17 @@ $style = @'
.container { flex-direction:column; }
.sidebar { width:100%; }
}
</style>
</style>
'@
$script = @'
<script>
// =======================================================================
// Tab Navigation
// =======================================================================
const tabButtons = document.querySelectorAll(".tab-button");
const tabContents = document.querySelectorAll(".tab-content");
tabButtons.forEach(btn => {
// =======================================================================
// Tab Navigation
// =======================================================================
const tabButtons = document.querySelectorAll(".tab-button");
const tabContents = document.querySelectorAll(".tab-content");
tabButtons.forEach(btn => {
btn.addEventListener("click", () => {
// clear active state
tabButtons.forEach(b => b.classList.remove("active"));
@@ -1031,22 +1031,22 @@ $script = @'
btn.classList.add("active");
document.getElementById(btn.dataset.tab).classList.add("active");
});
});
// initialize default tab on load
document.querySelector(".tab-button[data-tab='{{defaultPage}}Tab']").classList.add("active");
document.getElementById("{{defaultPage}}Tab").classList.add("active");
});
// initialize default tab on load
document.querySelector(".tab-button[data-tab='{{defaultPage}}Tab']").classList.add("active");
document.getElementById("{{defaultPage}}Tab").classList.add("active");
// =======================================================================
// Task Trigger
// =======================================================================
const tasks = [
// =======================================================================
// Task Trigger
// =======================================================================
const tasks = [
{{tasksJsAll}}
];
];
// =======================================================================
// Column Select All toggling for On-Boarding
// =======================================================================
function toggleColumn(col) {
// =======================================================================
// Column Select All toggling for On-Boarding
// =======================================================================
function toggleColumn(col) {
const master = document.getElementById(`selectAll${col[0].toUpperCase() + col.slice(1)}Checkbox`);
const children = document.querySelectorAll(`#onboardTab input[type=checkbox][data-column=${col}]`);
@@ -1060,7 +1060,7 @@ $script = @'
cb.dispatchEvent(new Event('change'));
});
}, 0);
}
}
// =======================================================================
@@ -1104,16 +1104,16 @@ $script = @'
// Fetch Sites Handler
// =======================================================================
async function fetchSites() {
const pwd = document.getElementById("Password").value;
if (!pwd) {
const pwd = document.getElementById("Password").value;
if (!pwd) {
alert("Please enter the password.");
return;
}
}
const dropdown = document.getElementById("dattoDropdown");
dropdown.innerHTML = '<option disabled selected>Loading sites...</option>';
const dropdown = document.getElementById("dattoDropdown");
dropdown.innerHTML = '<option disabled selected>Loading sites...</option>';
try {
try {
const resp = await fetch("/getpw", {
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -1133,12 +1133,12 @@ async function fetchSites() {
});
document.getElementById("dattoRmmContainer").style.display = "block";
}
catch (e) {
}
catch (e) {
console.error(e);
dropdown.innerHTML = '<option disabled selected>Error loading sites</option>';
alert("Failed to fetch sites. Check password and try again.");
}
}
}
@@ -1146,7 +1146,7 @@ async function fetchSites() {
async function triggerInstall() {
async function triggerInstall() {
// disable the button so you can't double-click while work is in flight
const runBtn = document.querySelector('.run-button');
runBtn.disabled = true;
@@ -1183,25 +1183,25 @@ async function fetchSites() {
// always re-enable, even if an error occurred
runBtn.disabled = false;
}
}
}
// =======================================================================
// Shutdown Handler
// =======================================================================
function endSession() {
// =======================================================================
// Shutdown Handler
// =======================================================================
function endSession() {
fetch("/quit", { method: "GET" })
.finally(() => window.close());
}
}
// =======================================================================
// Sub-Options Auto-Toggle for Tasks
// =======================================================================
// =======================================================================
// Sub-Options Auto-Toggle for Tasks
// =======================================================================
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('DOMContentLoaded', function () {
// Auto-handle visibility and checking for tasks with sub-options
const tasksWithSubOptions = document.querySelectorAll('[id$="OptionsContainer"]');
@@ -1228,14 +1228,14 @@ async function fetchSites() {
masterCheckbox.addEventListener('change', updateVisibility);
updateVisibility(); // call once on load
});
});
});
// ===========================================
// rotating tagline
// ===========================================
document.addEventListener('DOMContentLoaded', () => {
const taglines = [
const taglines = [
"Fast deployments, no monkey business.",
"Bananas for better builds.",
"Deploy without flinging code.",
@@ -1248,22 +1248,22 @@ document.addEventListener('DOMContentLoaded', () => {
"Why throw code when the monkey's got it?",
"Deployments so easy, a monkey could do it. Ours does.",
"Monkey in the stack, not on your back."
];
];
const el = document.getElementById("tagline");
let idx = Math.floor(Math.random() * taglines.length);
el.textContent = taglines[idx];
const el = document.getElementById("tagline");
let idx = Math.floor(Math.random() * taglines.length);
el.textContent = taglines[idx];
setInterval(() => {
setInterval(() => {
idx = (idx + 1) % taglines.length;
el.textContent = taglines[idx];
}, 10_000);
}, 10_000);
});
// when the browser window is closed (X), notify the server to quit
window.addEventListener('beforeunload', () => {
// keepalive: true ensures the request is sent even as the page unloads
fetch('/quit', { method: 'GET', keepalive: true });
// keepalive: true ensures the request is sent even as the page unloads
fetch('/quit', { method: 'GET', keepalive: true });
});
</script>