File size: 1,584 Bytes
2f4cc31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
58
59
class LoadingScreen extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        #site_loader_overlay {
          background: white;
          opacity: 1;
          position: fixed;
          top: 0;
          left: 0;
          width: 100%;
          height: 100vh;
          z-index: 99999;
          display: flex;
          justify-content: center;
          align-items: center;
        }
        
        #site_loader_logo_inner {
          text-align: center;
        }
        
        .loading-animation {
          width: 60px;
          height: 60px;
          border: 5px solid #f3f3f3;
          border-top: 5px solid var(--primary);
          border-radius: 50%;
          animation: spin 1s linear infinite;
          margin: 0 auto 20px;
        }
        
        @keyframes spin {
          0% { transform: rotate(0deg); }
          100% { transform: rotate(360deg); }
        }
      </style>
      
      <div id="site_loader_overlay">
        <div id="site_loader_logo">
          <div id="site_loader_logo_inner">
            <div class="loading-animation"></div>
            <p>Loading...</p>
          </div>
        </div>
      </div>
    `;
    
    window.addEventListener('load', () => {
      setTimeout(() => {
        this.shadowRoot.getElementById('site_loader_overlay').style.opacity = '0';
        this.shadowRoot.getElementById('site_loader_overlay').style.pointerEvents = 'none';
      }, 500);
    });
  }
}

customElements.define('loading-screen', LoadingScreen);