<script>
function populateDropdown() {
const input = document.getElementById("batchInput").value;
const appIds = input.split('\n').filter(id => id.trim() !== "");
const uniqueAppIds = [...new Set(appIds)];
const dropdown = document.getElementById("appSelect");
dropdown.innerHTML = ""; // Clear existing options
uniqueAppIds.forEach(appId => {
const option = document.createElement("option");
option.value = appId.trim();
option.text = appId.trim();
dropdown.add(option);
});
document.getElementById("batchInput").value = ""; // Clear input after adding to dropdown
viewApp(); // Display first app immediately
}
function viewApp() {
const dropdown = document.getElementById("appSelect");
if (dropdown.options.length > 0) {
const appId = dropdown.value;
const iframe = document.getElementById("appFrame");
iframe.src = "https://www.literallyanything.io/iterate?id=" + appId;
dropdown.remove(dropdown.selectedIndex); // Remove selected option after view
}
}
document.addEventListener('keydown', function(event) {
const dropdown = document.getElementById("appSelect");
if (dropdown.options.length > 0) {
if (event.key === "ArrowRight") {
dropdown.selectedIndex = (dropdown.selectedIndex + 1) % dropdown.options.length;
viewApp();
} else if (event.key === "ArrowLeft") {
dropdown.selectedIndex = (dropdown.selectedIndex - 1 + dropdown.options.length) % dropdown.options.length;
viewApp();
}
}
});
</script>
Shared snapshot