Skip to content

Commit

Permalink
Added keyboard controls to tasbih
Browse files Browse the repository at this point in the history
  • Loading branch information
DBChoco committed Apr 23, 2022
1 parent 5eedaf7 commit 81e0340
Show file tree
Hide file tree
Showing 2 changed files with 3,971 additions and 3,956 deletions.
18 changes: 14 additions & 4 deletions src/main/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,16 +589,26 @@ function setupTasbih(){
let tasbih = 0
let countdown;
document.getElementById('title').addEventListener("click", function(){
startTasbih()}
)

document.addEventListener('keydown', function(key){
if (key.key == "Enter" || key.key == " ") startTasbih()
else if (key.key == "Escape" || key.key == "Backspace" || key.key == "Delete") resetTasbih()
})

document.getElementById('title').addEventListener("contextmenu", function(){
resetTasbih()
})

function startTasbih(){
tasbih ++
document.getElementById('tasbih').innerHTML = ' | ' + '<i class="fa-solid fa-star-and-crescent"></i> ' + tasbih
if (countdown != undefined) clearTimeout(countdown)
countdown = setTimeout(function(){
resetTasbih()
}, 10000)
})
document.getElementById('title').addEventListener("contextmenu", function(){
resetTasbih()
})
}

function resetTasbih(){
tasbih = 0
Expand Down
Loading

0 comments on commit 81e0340

Please sign in to comment.