From cb75c3babbb0328097fa448549dfa53bb94bd192 Mon Sep 17 00:00:00 2001 From: amanbind898 Date: Tue, 12 Sep 2023 20:18:36 +0530 Subject: [PATCH] audio updated --- click-21156.mp3 | Bin 0 -> 7523 bytes index.html | 2 +- main.js | 32 ++++++++++++---------- office-calculator-single-button-press.mp3 | Bin 5017 -> 0 bytes 4 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 click-21156.mp3 delete mode 100644 office-calculator-single-button-press.mp3 diff --git a/click-21156.mp3 b/click-21156.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..8b9808d8b2f91cd849143a680e8b87effa84015f GIT binary patch literal 7523 zcmeI0=Tp;bw}yX#03ifOp%I9emM8HHM5>s_pE!aSu+pyWSR)j$5Y&fd0{Fu9y)d6 z%;KHsz%MA~wLHdK;_C|zcc%fs#AgBvN397@2-7h?44C6L+2D2_Fr?2!a{2&;})M zm8S(_HDiTPohRQkf&>6KCKiq<3=4rt=fh+SwD8jcI;yI$Lf5S8`I?X^V$1p%=DT|d zAV_97jBwnTxcX~!74d=$0?~l-wa5S@dU<(D3=aI4n3vxjUi;a=g}7&2h0xJ4N-xU_ zOGL3hRN?)*L*6SLO55*qmYx)x&}sP6nN|8%EvLrjp#mL?lTY|wr0m|W(kAKi(cn$~ zgG~^C9WNyaKxhCMYVnQ&MCszSi+w&4p_tLuvSc_bO@3lQbYgzLLkhEReiXq0fm!G) zgIsXC6UH^8)zt7tNhP%s?CIv}MShWy|+v#g7bl3!^E+-uTvnKpl#UX5k3 zN_oahGU#$w{DIjWsz_JvIxA_D3J=wdkj_Ryp2a^Krfc`D|E)CS7hT|v4?9Y}%gCrV zZ}axp@m}4{laGzB`D;Rvn-#WzrnQ%mm~PS9ub0VEt8L|OiB?2++c;Wub?%_TNUKYK zrlSN%$`=4-RCQff+e5Uf%qT|YG(4xewcwE`HEqI@ee&Ye<7WG}qEo&hg4;kAh5?&ok zW1);6CW%SHh0LRf2hLDXzm71iqW&pv`g3k4;{F_mtE(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Xqv34#lutXj?^pWj|Ax9KXf)iZK4;(; zUxP{A&2^MVTtk>tYeW^Su|J?BzGvL#Y1lxsMWgk7_AX|UhnTJ@(@dD^jq~kmNm8GE zP1!Oxv?)2#?l5#*y)nYS-?=4PL^lpMTK>T>4lAxpNOI`#rB)eWFW;W4ES&FAryCfk zX-E+0)Hd-nTd{F7by%&XQjc3ppq{3V%p+283r$0)I=g|Up|+B&g1o%>zpQ^40$BIh z05Yuu0HGnn0Z#w~0H7)W00aO)nf&+fm3j}hu;YJW*1v4>-~HkL@8;h diff --git a/main.js b/main.js index cb4b301..b9530a9 100644 --- a/main.js +++ b/main.js @@ -3,11 +3,22 @@ document.addEventListener('DOMContentLoaded', function () { let buttons = document.querySelectorAll('.button'); let inputField = document.querySelector('.input'); let keypressSound = document.getElementById('keypressSound'); + + // Preload the audio file + keypressSound.preload = 'auto'; + buttons.forEach((button) => { button.addEventListener('click', (e) => { let buttonText = e.target.innerHTML; -if(buttonText==='X') -buttonText='*' + + // Play the keypress sound immediately + keypressSound.currentTime = 0; + keypressSound.play(); + + if (buttonText === 'X') { + buttonText = '*'; + } + if (buttonText === '=') { try { string = eval(string); @@ -15,27 +26,20 @@ buttonText='*' } catch (error) { inputField.value = 'Error'; } - } - else if(buttonText === 'DEL') - { - string=string.substring(0,string.length-1); - inputField.value=string; - } - else if (buttonText === 'AC') { + } else if (buttonText === 'DEL') { + string = string.substring(0, string.length - 1); + inputField.value = string; + } else if (buttonText === 'AC') { string = '0'; // Set the input to '0' on All Clear inputField.value = string; } else { if (string === '0') { string = buttonText; // Replace '0' with the new button value - } - - else { + } else { string = string + buttonText; } inputField.value = string; } - // Play the keypress sound - keypressSound.play(); }); }); }); diff --git a/office-calculator-single-button-press.mp3 b/office-calculator-single-button-press.mp3 deleted file mode 100644 index 0e1272936132c6076365b06acd641e764ff84751..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5017 zcmdUzc{r5c-^cGUc4LXLi&0~;j4?CziiWX`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