Cleanup and lower timing delay

This commit is contained in:
Kevin F 2022-02-20 18:17:10 -06:00
parent e39251cafc
commit 922a0bdbd1
3 changed files with 9 additions and 9 deletions

View File

@ -36,8 +36,8 @@ let appCode = function (){
document.selection.empty() document.selection.empty()
} }
} }
let minValue = 75 let minValue = 50
let maxValue = 150 let maxValue = 75
let time = 0 let time = 0
let last = null let last = null
@ -100,9 +100,8 @@ let appCode = function (){
function pausecomp(millis) function pausecomp(millis)
{ {
// Yes i know this wastes cpu. i don't like it either, but it seems a blocking // Yes i know this wastes cpu. i don't like it either, but it is the only way
// approach is needed to prevent spying event listeners from reading key events in *real time* // i know of to have real page keypress events that aren't trackable
// Might use an off-page buffer solution in the future
var date = new Date(); var date = new Date();
var curDate = null; var curDate = null;
do { curDate = new Date(); } do { curDate = new Date(); }

View File

@ -9,9 +9,10 @@
</head> </head>
<body> <body>
<header id="siteDomain"></header> <header id="siteDomain"></header>
<button id="toggleSite">Disable Keyboard Privacy</button> <button id="toggleSite">Disable Slow Typing</button>
<p id="reloadPage">Refresh the page to apply</p> <p id="reloadPage">Refresh the page to apply</p>
<br>
<br> <br>
<textarea tabindex="0" id="keyBuffer" cols="20" rows="10" placeholder="Text typed here will be sent to active input/textarea elements. Breaks on many sites, but is faster than typing directly on the page"></textarea> <textarea tabindex="0" id="keyBuffer" cols="20" rows="10" placeholder="Text typed here will be sent to active input/textarea elements. Breaks on many sites, but is faster than typing directly on the page"></textarea>
</body> </body>

View File

@ -33,7 +33,7 @@ browser.storage.sync.get("keyboardprivacywhitelist")
let hostname = extractHostname(tabVal[0].url).replace('www.', '') let hostname = extractHostname(tabVal[0].url).replace('www.', '')
document.getElementById('siteDomain').innerText = hostname document.getElementById('siteDomain').innerText = hostname
if (val.keyboardprivacywhitelist.includes(hostname)) { if (val.keyboardprivacywhitelist.includes(hostname)) {
document.getElementById('toggleSite').innerText = 'Enable Keyboard Privacy' document.getElementById('toggleSite').innerText = 'Enable Slow Typing'
} }
}) })
.catch(reportError); .catch(reportError);
@ -104,11 +104,11 @@ document.getElementById('toggleSite').onclick = async function(){
} }
document.getElementById('toggleSite').setAttribute('disabled', true) document.getElementById('toggleSite').setAttribute('disabled', true)
if (document.getElementById('toggleSite').innerText.startsWith('Disable')){ if (document.getElementById('toggleSite').innerText.startsWith('Disable')){
document.getElementById('toggleSite').innerText = 'Enable Keyboard Privacy' document.getElementById('toggleSite').innerText = 'Enable Slow Typing'
changeWhitelist(document.getElementById('siteDomain').innerText, true) changeWhitelist(document.getElementById('siteDomain').innerText, true)
} }
else if (document.getElementById('toggleSite').innerText.startsWith('Enable')){ else if (document.getElementById('toggleSite').innerText.startsWith('Enable')){
document.getElementById('toggleSite').innerText = 'Disable Keyboard Privacy' document.getElementById('toggleSite').innerText = 'Disable Slow Typing'
changeWhitelist(document.getElementById('siteDomain').innerText, false) changeWhitelist(document.getElementById('siteDomain').innerText, false)
} }
setTimeout(function(){fixDuplicateCommas()}, 1000) setTimeout(function(){fixDuplicateCommas()}, 1000)