mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-23 03:37:53 +01:00
add optimaztion for code :3
This commit is contained in:
parent
79440e44d9
commit
7b0927060b
1 changed files with 11 additions and 3 deletions
|
@ -1634,14 +1634,22 @@ if (timer) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a new timer to refresh the page after 1 hour
|
// Check if it's the first time the user visits the page
|
||||||
|
const isFirstLoad = localStorage.getItem(userlocalStorageKey) === null;
|
||||||
|
|
||||||
|
// Set a new timer to refresh the page after 1 hour or on the first visit
|
||||||
const newTimer = setTimeout(() => {
|
const newTimer = setTimeout(() => {
|
||||||
refreshPage();
|
refreshPage();
|
||||||
}, 60 * 60 * 1000); // 1 hour in milliseconds
|
}, isFirstLoad ? 0 : 60 * 60 * 1000); // 1 hour in milliseconds
|
||||||
|
|
||||||
// Save the new timer in localStorage
|
// Save the new timer in localStorage
|
||||||
localStorage.setItem('refreshTimer', newTimer);
|
localStorage.setItem('refreshTimer', newTimer);
|
||||||
|
|
||||||
|
// Save the first load flag in localStorage if it's the first visit
|
||||||
|
if (isFirstLoad) {
|
||||||
|
localStorage.setItem(userlocalStorageKey, 'visited');
|
||||||
|
}
|
||||||
|
|
||||||
</script><!-- bundled app.js --><script src="/static/app.js?ver=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + k.Video.Recommendations.Video[0].id ) %>">
|
</script><!-- bundled app.js --><script src="/static/app.js?ver=<%-btoa("1f739d935676111cfff4b4693e3816e664797050" + k.Video.Recommendations.Video[0].id ) %>">
|
||||||
</script> <!-- themes --> <script src="/static/custom-css.js"> </script><!-- twemoji --><script src="/static/emojis.js"></script><style> img.emoji {height: 1em;width: 1em;margin: 0 .05em 0 .1em;vertical-align: -0.1em;}</style>
|
</script> <!-- themes --> <script src="/static/custom-css.js"> </script><!-- twemoji --><script src="/static/emojis.js"></script><style> img.emoji {height: 1em;width: 1em;margin: 0 .05em 0 .1em;vertical-align: -0.1em;}</style>
|
||||||
<script>twemoji.parse(document.body,{ base: 'https://cdn.zptr.cc/twemoji/' })</script><script>
|
<script>twemoji.parse(document.body,{ base: 'https://cdn.zptr.cc/twemoji/' })</script><script>
|
||||||
|
|
Loading…
Reference in a new issue