threepipe
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

1234567891011121314151617181920212223242526272829
  1. function run () {
  2. if (document.body.classList.contains('_testStarted')) return
  3. const div = document.createElement('div');
  4. const colorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
  5. Object.assign(div.style, {
  6. position: 'fixed', top: 0, left: 0, bottom: 0, right: 0, width: 'auto', height: 'max-content',
  7. display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column',
  8. background: 'transparent', pointerEvents: 'none',
  9. zIndex: '49', // loading screen is 50
  10. transition: 'opacity 0.5s ease',
  11. color: colorScheme !== 'dark' ? '#eee' : '#222',
  12. fontSize: '1.25rem',
  13. margin: 'auto',
  14. });
  15. div.innerHTML = '<div style="width:32px;height:32px;border:4px solid #ccc;border-top:4px solid #333;border-radius:50%;animation:spin 1s linear infinite;margin:auto"></div><div style="text-align:center;margin-top:8px;font-family:sans-serif">Loading...</div><style>@keyframes spin{100%{transform:rotate(360deg)}}</style>';
  16. document.body.appendChild(div);
  17. let removed = false
  18. function remove () {
  19. if (removed) return
  20. removed = true
  21. div.style.opacity = '0';
  22. setTimeout(() => div.remove(), 600);
  23. }
  24. window.addEventListener('threepipe-test-started', remove)
  25. setTimeout(remove, 8000); // remove after 5 seconds if not removed
  26. }
  27. run()