Store neko position across pages
Basically what it says, it's just a solution for #10 using local storage
I like this! If you'd like some more stuff to do, make the localStorage entry only change on page beforeUnload. If not i'll merge it once I have the time to implement that
I might also wanna see if i can make this configurable with like data-neko-localstorage-pos or something with a better name on the script element
Thank you for your PR c:
Thank you! Oh true, I didn't even think of that. I'll try after work if I get a chance
And do you mean like as a bool or the key name or something else? I should be able to do that too c:
i meant like, on the script tag you can have <script data-asdf="true" src="./neko.js"> and access it in js from document.currentScript.dataset["asdf"]
if "asdf" is true then persist data across navigation, else dont save or read localStorage
you could call it "data-persist-position" or something
Ohh cool okay
Btw working on this I noticed beforeUnload not getting called, and it turns out the event isn't fired when there isn't interaction, or at least I can't get it to fire on Firefox, so I don't think that method will work on a lot of websites/browsers
It is kinda cursed just calling it after every frame but I'm not really sure if there's a better way to do it if we need user interaction so :/
Going to work on the data attribute now though
It can be set based on data-persist-position now c:
I've set the default to true as well but it's just a bool so easy to change that
What about a dark mode oneko or maybe a gray one? like with a CSS style or something similar.
Ohh cool okay Btw working on this I noticed
beforeUnloadnot getting called, and it turns out the event isn't fired when there isn't interaction, or at least I can't get it to fire on Firefox, so I don't think that method will work on a lot of websites/browsers It is kinda cursed just calling it after every frame but I'm not really sure if there's a better way to do it if we need user interaction so :/ Going to work on the data attribute now though
what about
window.navigation.addEventListener("navigate", (event) => {
console.log('location changed!');
})
That specifically didn't work but I just got data to store with both unload and beforeunload even though it was the same as I used before? So going to see if I can make that work again
would be cool too to add an option to set oneko size via style like
nekoEl.style.transform = 'scale(1.8)';
Turns out I did a stupid and tried to add the event to document at first and just never realised, but I think it only works for window So it works now lol
would be cool too to add an option to set oneko size via style like
nekoEl.style.transform = 'scale(1.8)';
please make issues for feature requests rather than making requests in an unrelated pull request
would be cool too to add an option to set oneko size via style like
nekoEl.style.transform = 'scale(1.8)';please make issues for feature requests rather than making requests in an unrelated pull request
okay :C