so I was making an extension for firefox where it calculates and displays a user’s Karma. Now the extension works perfectly fine when you paste in your profile and go there, or if you refresh your profile. but if you go to the main menu of Lemmy, then back to your profile by clicking on your profile, the extension simply doesn’t work.

  • Yoru@lemmy.mlOP
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I ended up going primitive and used intervals to check if a particular div was visible: function refreshExtension() { console.log("checking ", shown); const targetNode = document.getElementsByClassName("person-details")[0]; if (!shown && targetNode) { main(); } if (!targetNode) { shown = false; } } setInterval(refreshExtension, 200);

    will it affect performance?

    • kopper [they/them]
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      That’s quite inefficient. It will impact performance but I’m not sure on how significant that impact would be.