splash.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. $(() => {
  2. const skip = localStorage.getItem('skip-splash');
  3. if (skip && skip == 'true') {
  4. unsplash();
  5. } else {
  6. if (skip == null) {
  7. localStorage.setItem('skip-splash', true);
  8. }
  9. $('#splash-logo').removeClass('hide');
  10. const loaderInterval = loader();
  11. setTimeout(() => {
  12. $('#splash-loader').removeClass('hide');
  13. }, 200);
  14. $('#splash-line-1').removeClass('hide').addClass('anim-typewriter');
  15. $('#splash-line-1').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function() {
  16. $('#splash-line-2').removeClass('hide').addClass('anim-typewriter');
  17. });
  18. $('#splash-line-2').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function() {
  19. $('#splash-line-3').removeClass('hide').addClass('anim-typewriter');
  20. });
  21. $('#splash-line-3').one('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function() {
  22. clearInterval(loaderInterval);
  23. unsplash();
  24. });
  25. }
  26. });
  27. const spinner = {
  28. interval:80,
  29. frames:[
  30. "[        ]",
  31. "[=       ]",
  32. "[==      ]",
  33. "[===     ]",
  34. "[====    ]",
  35. "[=====   ]",
  36. "[ =====  ]",
  37. "[  ===== ]",
  38. "[   =====]",
  39. "[    ====]",
  40. "[     ===]",
  41. "[      ==]",
  42. "[       =]",
  43. "[        ]",
  44. "[       =]",
  45. "[      ==]",
  46. "[     ===]",
  47. "[    ====]",
  48. "[   =====]",
  49. "[  ===== ]",
  50. "[ =====  ]",
  51. "[=====   ]",
  52. "[====    ]",
  53. "[===     ]",
  54. "[==      ]",
  55. "[=       ]"]
  56. }
  57. function loader() {
  58. const grid = document.getElementById('splash-loader')
  59. const spin = document.createElement('div');
  60. spin.innerText = spinner.frames[0];
  61. grid.appendChild(spin);
  62. let i = 0;
  63. return setInterval(() => {
  64. requestAnimationFrame(() => {
  65. spin.innerHTML = spinner.frames[++i % spinner.frames.length];
  66. });
  67. }, spinner.interval);
  68. }
  69. function unsplash() {
  70. const showPage = localStorage.getItem('show-page');
  71. if (showPage && showPage == 'true') {
  72. $('#splash').addClass('none');
  73. } else {
  74. if (showPage == null) {
  75. localStorage.setItem('show-page', false);
  76. }
  77. fullscreen(false);
  78. setTimeout(() => {
  79. $('#splash').addClass('none');
  80. $('#close-fs').toggleClass('hide');
  81. }, 200);
  82. }
  83. }