Jump to content

User:Volcanooo456/timer.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
(function() {





'use strict';





// Add a link to the "tools" section of Wikipedia





var toolsSection = document.getElementById('p-tb');





var link = document.createElement('a');





link.href = '#';





link.textContent = 'Start Timer';





link.addEventListener('click', function(event) {





event.preventDefault();





var time = prompt('Enter the time for the timer (in seconds):');





if (time) {





setTimeout(function() {





alert('Timer finished!');





}, time * 1000);





}





});





toolsSection.appendChild(link);





})();