Hey, me again. I noticed you changed your script to monitor mouse events and this kind of broke my script's compatibility with yours in a way that I can't fix from my end. I think it also would fix a potential bug with multiple pages being open.
Basically, you only call localstorage on page load, and when my script makes changes to the localstorage, your script can write over them with the old value. The fix would be to call localstorage each time before writing to it. If you add the line
vis = JSON.parse(localStorage.getItem(storageName));
before each line
vis.data[c] = Date.now();
which is 3 times in the current script, it would fix it.
This would also fix instances where you have two pages open and clicking on links from both: right now, each page would overwrite using an outdated copy of localstorage from when it was opened. I think in general, calling the localstorage afresh each time before you write to it is a good idea.
Can you add a few lines?
Hey, me again. I noticed you changed your script to monitor mouse events and this kind of broke my script's compatibility with yours in a way that I can't fix from my end. I think it also would fix a potential bug with multiple pages being open.
Basically, you only call localstorage on page load, and when my script makes changes to the localstorage, your script can write over them with the old value. The fix would be to call localstorage each time before writing to it. If you add the line
vis = JSON.parse(localStorage.getItem(storageName));
before each line vis.data[c] = Date.now();
which is 3 times in the current script, it would fix it.
This would also fix instances where you have two pages open and clicking on links from both: right now, each page would overwrite using an outdated copy of localstorage from when it was opened. I think in general, calling the localstorage afresh each time before you write to it is a good idea.