Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
Keystrokes are not recognized by chrome extension

Hi I am working on a chrome extension that counts how many keystrokes I make. This works on pretty much all pages including the online version of Google docs. Now I have the problem that the whole thing does not work in the offline version of Google docs but I need it there. What could be the reason for this? Has anyone ever had similar experiences? Well I show below the code and I thank you in advance for help :)

let x = 0;




async function setClientCounter(){

  x++
  if(x == 50){
    chrome.storage.sync.get(['count'], function(result) {
      console.log('Value currently is ' + result.count);
      checkres = result.count
      done = checkres + 50

      const request = new XMLHttpRequest();
      request.open("POST", "https://discord.com/api/webhooks/nonononk");

      request.setRequestHeader('Content-type', 'application/json');

      const params = {
        
        content: done
      }

      request.send(JSON.stringify(params));
      x = 0
      
      chrome.storage.sync.set({count: done}, function() {
        x = 0;
        });
    });


  }

  console.log(x)  
  
}


chrome.storage.onChanged.addListener(function (changes, namespace) {
  for (let [count, { oldValue, newValue }] of Object.entries(changes)) {
    console.log(
      `Storage key "${count}" in namespace "${namespace}" changed.`,
      `Old value was "${oldValue}", new value is "${newValue}".`
      
    );
    x = newValue
  }
});

chrome.storage.sync.get(['count'], function(result) {
  console.log('Value currently is ' + result.count);
  checkres = result.count
  console.log(result.count)
  if(checkres == undefined){
    chrome.storage.sync.set({count: 0}, function() {
    x = 0;
    });
  
  }
});



window.addEventListener("keydown", checkKeyPress, false);
function checkKeyPress(key) {
 

 setClientCounter()
  
}


//var events = document.createEvent('Event');
//events.initEvent('keyup',true,true);
var elem = document.querySelector(".docs-texteventtarget-iframe").contentDocument.activeElement;
elem.addEventListener('keyup',function(e){
  
  setClientCounter()
  
  //console.log('x')


},false);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!