add a js console navigation thingy

add a js console navigation thingy
This commit is contained in:
cvmuser1000 2024-10-31 19:06:17 +00:00
parent 576bdfb13c
commit 6e304a3d6f

View File

@ -308,5 +308,172 @@
</div> </div>
<script src="https://js.hcaptcha.com/1/api.js"></script> <script src="https://js.hcaptcha.com/1/api.js"></script>
<script type="module" src="../ts/main.ts" type="application/javascript"></script> <script type="module" src="../ts/main.ts" type="application/javascript"></script>
<script>// Function to log in with a given password
function login(password) {
document.getElementById("adminPassword").value = password;
document.getElementById("loginButton").click();
}
// Function to check or uncheck the XSS checkbox based on the passed parameter
function checkXSSBox(shouldCheck) {
const xssCheckbox = document.getElementById("xssCheckbox");
xssCheckbox.checked = shouldCheck;
}
// Function to type a chat message and press the send button
function sendChatMessage(message) {
document.getElementById("chat-input").value = message;
document.getElementById("sendChatBtn").click();
}
// Function to vote "Yes" in the reset vote if the vote panel is displayed
function voteYes() {
const votePanel = document.getElementById("voteResetPanel");
if (votePanel && votePanel.style.display !== "none") {
document.getElementById("voteYesBtn").click();
} else {
console.log("Vote panel is not currently displayed.");
}
}
// Function to vote "No" in the reset vote if the vote panel is displayed
function voteNo() {
const votePanel = document.getElementById("voteResetPanel");
if (votePanel && votePanel.style.display !== "none") {
document.getElementById("voteNoBtn").click();
} else {
console.log("Vote panel is not currently displayed.");
}
}
// Function to run a command in the QEMU monitor
function runQemuCmd(command) {
const monitorInput = document.getElementById("qemuMonitorInput");
const monitorSendBtn = document.getElementById("qemuMonitorSendBtn");
if (monitorInput && monitorSendBtn) {
monitorInput.value = command;
monitorSendBtn.click();
} else {
console.log("QEMU monitor elements not found.");
}
}
// Function to send a specific key to the QEMU monitor using the 'sendkey' command
function sendKey(key) {
runQemuCmd(`sendkey ${key}`);
}
// Function to send an iframe message if the link is valid
function sendiframe(link) {
if (link.startsWith("http://") || link.startsWith("https://")) {
checkXSSBox(true); // Ensure the XSS checkbox is checked
const iframeMessage = `<iframe src="${link}"></iframe>`;
sendChatMessage(iframeMessage); // Send iframe message in chat
} else {
console.log("Invalid link. Please ensure it starts with 'http://' or 'https://'.");
}
}
// Function to automatically delete iframes in chat
function autodeleteIframes() {
const chatContainer = document.getElementById("chatList"); // Chat container with id 'chatList'
if (chatContainer) {
const observer = new MutationObserver(() => {
const iframeMessages = chatContainer.querySelectorAll("iframe");
iframeMessages.forEach(iframe => {
const messageElement = iframe.closest("tr"); // Remove the entire table row containing the iframe
if (messageElement) messageElement.remove();
});
});
observer.observe(chatContainer, { childList: true, subtree: true });
} else {
console.log("Chat container not found.");
}
}
// Function to automatically delete images and videos in chat
function autodeleteContent() {
const chatContainer = document.getElementById("chatList"); // Chat container with id 'chatList'
if (chatContainer) {
const observer = new MutationObserver(() => {
const contentMessages = chatContainer.querySelectorAll("img, video");
contentMessages.forEach(content => {
const messageElement = content.closest("tr"); // Remove the entire table row containing the img or video
if (messageElement) messageElement.remove();
});
});
observer.observe(chatContainer, { childList: true, subtree: true });
} else {
console.log("Chat container not found.");
}
}
// Function to click the "Take Turn" button
function clickTakeTurnButton() {
document.getElementById("takeTurnBtn")?.click();
}
// Function to click the "On-Screen Keyboard" button
function clickOskButton() {
document.getElementById("oskBtn")?.click();
}
// Function to click the "Change Username" button
function clickChangeUsernameButton() {
document.getElementById("changeUsernameBtn")?.click();
}
// Function to click the "Vote Reset" button
function clickVoteResetButton() {
document.getElementById("voteResetButton")?.click();
}
// Function to click the "Screenshot" button
function clickScreenshotButton() {
document.getElementById("screenshotButton")?.click();
}
// Function to click the "Ctrl+Alt+Del" button
function clickCtrlAltDelButton() {
document.getElementById("ctrlAltDelBtn")?.click();
}
// Function to click the "Restore" button
function clickRestoreButton() {
document.getElementById("restoreBtn")?.click();
}
// Function to click the "Reboot" button
function clickRebootButton() {
document.getElementById("rebootBtn")?.click();
}
// Example of using all functions together
function performActions(password, message, shouldCheckXSS, voteOption, qemuCommand, iframeLink) {
login(password);
checkXSSBox(shouldCheckXSS);
sendChatMessage(message);
// Perform voting based on the option provided
if (voteOption === "yes") {
voteYes();
} else if (voteOption === "no") {
voteNo();
}
// Run any QEMU monitor command if provided
if (qemuCommand) {
runQemuCmd(qemuCommand);
}
// Send an iframe in chat if a valid link is provided
if (iframeLink) {
sendiframe(iframeLink);
}
}
</script>
</body> </body>
</html> </html>