List Randomizer
// Function to randomize a list of items
function randomizeList() {
const inputList = document.getElementById("inputList").value;
const items = inputList.split('\n').filter(item => item.trim() !== '');
const randomizedItems = [...items].sort(() => Math.random() - 0.5);
document.getElementById("result").value = randomizedItems.join('\n');
}
// Listen for input changes in the text input field
const inputList = document.getElementById("inputList");
const randomizeButton = document.getElementById("randomizeButton");
const copyButton = document.getElementById("copyButton");
inputList.addEventListener("input", randomizeList);
// Randomize list and copy result to clipboard when the "Randomize List" button is clicked
randomizeButton.addEventListener("click", () => {
randomizeList();
});
copyButton.addEventListener("click", () => {
const resultTextarea = document.getElementById("result");
resultTextarea.select();
document.execCommand("copy");
alert("Randomized list copied to clipboard!");
});