function copyTextToClipboard(text) { var textArea = document.createElement("textarea");…
- User
function copyTextToClipboard(text) { var textArea = document.createElement("textarea"); textArea.value = text; document.body.appendChild(textArea); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); var feedbackMessage = document.getElementById("feedbackMessage"); feedbackMessage.style.display = "block"; setTimeout(function() { feedbackMessage.style.display = "none"; }, 3000); } document.addEventListener("mousemove", function() { setTimeout(function() { document.getElementById("loading-screen").style.display = "flex"; }, 00);
codesetTimeout(function() { document.getElementById("new-box").style.display = "block"; }, 1500); window.onload = function() { document.getElementById("loading-screen").style.display = "none"; document.getElementById("content").style.filter = "none"; document.body.style.overflow = "auto"; } });adjust this so that the program runs automatically without waiting for the mouse to move.
- Assistant
To make the program run automatically without waiting for the mouse to move, you can remove the event listener for "mousemove" and directly call the functions inside the "window.onload" event. Here is the adjusted code:
javascriptfunction copyTextToClipboard(text) { var textArea = document.createElement("textarea"); textArea.value = text; document.body.appendChild(textArea); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); var feedbackMessage = document.getElementById("feedbackMessage"); feedbackMessage.style.display = "block"; setTimeout(function() { feedbackMessage.style.display = "none"; }, 3000); } window.onload = function() { setTimeout(function() { document.getElementById("loading-screen").style.display = "flex"; }, 0); setTimeout(function() { document.getElementById("new-box").style.display = "block"; }, 1500); document.getElementById("loading-screen").style.display = "none"; document.getElementById("content").style.filter = "none"; document.body.style.overflow = "auto"; } - User
perfect, now adjust it so that it prints out if the user is on mobile or desktop in a javascript alert box.
- Assistant
To determine if the user is on a mobile device or desktop and display the information in a JavaScript alert box, you can use the
navigator.userAgentproperty to access information about the user's browser and operating system. Here is the adjusted code with the addition of the logic to check for mobile or desktop:javascript