Skip to content

Super simple timer bookmarklet that you can dynamically add to any webpage.

License

Notifications You must be signed in to change notification settings

jon32446/simple-timer-bookmarklet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-timer-bookmarklet

Demo

Timer bookmarklet demo

Add the bookmarklet to your browser

  1. Create a new bookmark (best if it's on your bookmark toolbar).
  2. Set the "location" of the bookmark to the following text (copy, paste) javascript:(function(){var%20counter,count,max_count%3Bfunction%20start_timer()%7Bnull!%3Dcounter%26%26clearInterval(counter)%3Bvar%20t%3Dtimer_input.value.split(%22%3A%22),e%3DparseInt(t%5B0%5D),r%3DparseInt(t%5B1%5D)%3Bmax_count%3Dcount%3D60*e+r,timer_text.style.color%3D%22black%22,rad_timer.style.backgroundColor%3D%22white%22,timer_progress_bar.style.width%3D%220%25%22,counter%3DsetInterval(timer,1e3)%7Dfunction%20timer()%7B--count,timer_progress_bar.style.width%3D100-count%2Fmax_count*100+%22%25%22%3Bvar%20t%3DMath.floor(count%2F60),e%3D%22%22+count%2560,r%3D.25*max_count%3Bcount%3C.1*max_count%3Frad_timer.style.backgroundColor%3D%22red%22%3Acount%3Cr%26%26(rad_timer.style.backgroundColor%3D%22yellow%22),count%3C%3D0%3F(timer_text.textContent%3D%22Time's%20Up!%22,timer_text.style.color%3D%22red%22,rad_timer.style.backgroundColor%3D%22white%22,clearInterval(counter))%3Atimer_text.textContent%3Dt+%22%3A%22+e.padStart(2,%220%22)%7Dfunction%20dragElement(e)%7Bvar%20r%3D0,o%3D0,n%3D0,i%3D0%3Bfunction%20t(t)%7B(t%3Dt%7C%7Cwindow.event).preventDefault(),n%3Dt.clientX,i%3Dt.clientY,document.onmouseup%3Dd,document.onmousemove%3Dm%7Dfunction%20m(t)%7B(t%3Dt%7C%7Cwindow.event).preventDefault(),r%3Dn-t.clientX,o%3Di-t.clientY,n%3Dt.clientX,i%3Dt.clientY,e.style.top%3De.offsetTop-o+%22px%22,e.style.left%3De.offsetLeft-r+%22px%22%7Dfunction%20d()%7Bdocument.onmouseup%3Dnull,document.onmousemove%3Dnull%7Ddocument.getElementById(e.id+%22header%22)%3Fdocument.getElementById(e.id+%22header%22).onmousedown%3Dt%3Ae.onmousedown%3Dt%7Drad_timer%3Ddocument.createElement(%22div%22),rad_timer.id%3D%22rad_timer%22,rad_timer.style%3D%22position%3Aabsolute%3Bleft%3A100px%3Btop%3A100px%3Bz-index%3A1000000%3Bbackground%3Awhite%3Bpadding%3A5px%3Bborder-radius%3A3px%3Bborder%3A1px%20solid%20black%3B%22,timer_text%3Ddocument.createElement(%22div%22),timer_text.id%3D%22rad_timerheader%22,timer_text.style%3D%22width%3Aauto%3B%22,timer_text.textContent%3D%22Time's%20Up!%22,timer_text.style.cursor%3D%22move%22,timer_input%3Ddocument.createElement(%22input%22),timer_input.id%3D%22timer_input%22,timer_input.style%3D%22width%3A100px%3B%22,timer_input.value%3D%220%3A30%22,timer_button%3Ddocument.createElement(%22button%22),timer_button.id%3D%22timer_button%22,timer_button.style%3D%22%22,timer_button.textContent%3D%22Go!%22,timer_button.onclick%3Dstart_timer,timer_close%3Ddocument.createElement(%22div%22),timer_close.id%3D%22timer_close%22,timer_close.style%3D%22position%3Aabsolute%3Bright%3A5px%3Btop%3A0%3Bcursor%3Apointer%3B%22,timer_close.textContent%3D%22%E2%98%92%22,timer_close.onclick%3Dfunction()%7Bdocument.body.removeChild(rad_timer),null!%3Dcounter%26%26clearInterval(counter)%7D,timer_progress_bar%3Ddocument.createElement(%22span%22),timer_progress_bar.id%3D%22timer_progress_bar%22,timer_progress_bar.style%3D%22width%3A100%25%3Bheight%3A100%25%3Bbackground-color%3Ablack%3Bdisplay%3Ablock%3B%22,timer_progress%3Ddocument.createElement(%22div%22),timer_progress.id%3D%22timer_progress%22,timer_progress.style%3D%22width%3A100%25%3Bheight%3A5px%3Bbackground-color%3Abeige%3Bmargin-top%3A3px%3B%22,timer_progress.appendChild(timer_progress_bar),rad_timer.appendChild(timer_text),rad_timer.appendChild(timer_input),rad_timer.appendChild(timer_button),rad_timer.appendChild(timer_close),rad_timer.appendChild(timer_progress),document.body.appendChild(rad_timer),timer_button.onclick%3Dstart_timer,dragElement(document.getElementById(%22rad_timer%22))%3B})();

About

Super simple timer bookmarklet that you can dynamically add to any webpage.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published