rmilestone.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <!-- Polls the check_milestones route every three seconds. When a new milestone is reached,
  4. the alert is displayed for ten seconds. -->
  5. <head>
  6. <meta charset="UTF-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>Milestone Reached Alert</title>
  9. <style>
  10. body {
  11. background-color: transparent;
  12. position: relative; /* Ensure relative positioning for absolute children */
  13. width: 300;
  14. margin: 0 auto;
  15. text-align: center;
  16. }
  17. img {
  18. margin: 0 auto;
  19. }
  20. video {
  21. margin: 0 auto;
  22. }
  23. #alertVid {
  24. display: none;
  25. max-height: 100px;
  26. position: relative;
  27. z-index: 1; /* Ensure it's below nameBox */
  28. }
  29. #alertImg {
  30. display: none;
  31. max-height: 100px;
  32. position: relative;
  33. z-index: 1; /* Ensure it's below nameBox */
  34. }
  35. #nameBox {
  36. display: none;
  37. position: absolute;
  38. top: 20%; /* Adjust as needed */
  39. left: 50%; /* Center horizontally */
  40. transform: translateX(-50%); /* Center */
  41. color: black;
  42. z-index: 2; /* Ensure it appears above alertImg and alertVid */
  43. font-size: 20px; /* Adjust as needed */
  44. }
  45. </style>
  46. </head>
  47. <body>
  48. {% if not alert_name %}
  49. <div id="alertVid"></div>
  50. <div id="alertImg"></div>
  51. {% elif "webm" in alert_name %}
  52. <video id="alertVid" autoplay>
  53. <source src="{{ url_for('web_panels.alerts', alert_name=alert_name) }}" type="video/webm">
  54. </video>
  55. <div id="alertImg"></div>
  56. {% else %}
  57. <div id="alertVid"></div>
  58. <img id="alertImg" src="{{ url_for('web_panels.alerts', alert_name=alert_name) }}">
  59. {% endif %}
  60. <div id="nameBox"></div>
  61. <script>
  62. setInterval(function() {
  63. fetch('/checkMilestones')
  64. .then(response => response.json())
  65. .then(data => {
  66. if (data) {
  67. const alertVid = document.getElementById('alertVid');
  68. const alertImg = document.getElementById('alertImg');
  69. const nameBox = document.getElementById('nameBox');
  70. const alertName = data.name;
  71. nameBox.innerHTML = `
  72. ${alertName}
  73. `;
  74. nameBox.style.display = 'block';
  75. alertVid.style.display = 'block';
  76. alertImg.style.display = 'block';
  77. setTimeout(() => {
  78. alertVid.style.display = 'none';
  79. alertImg.style.display = 'none';
  80. nameBox.style.display = 'none';
  81. }, 10000); // Visible for 10 seconds
  82. }
  83. });
  84. }, 3000); // Check for new followers every 3 seconds
  85. </script>
  86. </body>
  87. </html>