Yukuro / hugo-theme-shell

Hugo Shell theme : Terminal-like theme with selectable color schemes.
https://hugo-theme-shell-example.vercel.app/
MIT License
327 stars 109 forks source link

How can I only play the main page terminal animation once on the user's first visit. #29

Closed supertsumu closed 2 years ago

supertsumu commented 2 years ago

Question is stated as above. Sorry if this isnt the place to post questions.

Yukuro commented 2 years ago

Thanks for the question.


How can I only play the main page terminal animation once on the user's first visit.

Does that mean disabling typing animations when a user visits?

If so, you can disable them by setting config.toml as follows

supertsumu commented 2 years ago

I was thinking when the user visits the home page for the first time, the typing animation plays, but once the user loads the home page again it doesnt play. I think I can try to implement your above solutions with some cookies maybe that will work. Thanks!

prochac commented 1 year ago

I did following change to partials/typeIndex.html

let commandDelay = parseDelay("{{ .commanddelay }}"); // line 54

if (sessionStorage.getItem("typeEffect")) {
    commandDelay = 0;
};
sessionStorage.setItem("typeEffect", true);

const typeeffetct = async () => {

~The sessionStorage clears if the tab is closed.~ It just lives and dies with its tab. Two tabs don't share the sessionStorage values. In my case, it's requested behaviour. Possibly, you may want to use localStorage instead.