Explorar el Código

Add config.js

master
The Dod hace 1 día
padre
commit
a82e3feff1
Se han modificado 3 ficheros con 7 adiciones y 7 borrados
  1. 4
    0
      static/js/config.js
  2. 1
    4
      templates/index.html
  3. 2
    3
      templates/progbar.html

+ 4
- 0
static/js/config.js Ver fichero

@@ -0,0 +1,4 @@
1
+const MAX_DIST = 3500;
2
+const MIN_DIST = 500;
3
+const VID_BLUR_FACTOR = MAX_DIST/16.0; // float
4
+const TICKER_BLUR_FACTOR = MAX_DIST/32.0; // float

+ 1
- 4
templates/index.html Ver fichero

@@ -24,6 +24,7 @@
24 24
       </div>
25 25
     </div>
26 26
   </div>
27
+  <script src="/static/js/config.js"></script>
27 28
   <script src="/static/js/jquery-3.7.1.min.js"></script>
28 29
   <script src="/static/js/jquery.marquee.min.js"></script>
29 30
   <script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
@@ -44,10 +45,6 @@
44 45
       return 0;
45 46
     }
46 47
   };
47
-  const MAX_DIST = 2000;
48
-  const MIN_DIST = 300;
49
-  const VID_BLUR_FACTOR = MAX_DIST/16.0; // float
50
-  const TICKER_BLUR_FACTOR = MAX_DIST/32.0; // float
51 48
   async function updateDistance() {
52 49
     var dist = await getDistance();
53 50
     var vidblur = 0; tickerblur = 0;

+ 2
- 3
templates/progbar.html Ver fichero

@@ -19,9 +19,8 @@
19 19
       </div>
20 20
     </div>
21 21
   </div>
22
+  <script src="/static/js/config.js"></script>
22 23
   <script src="/static/js/jquery-3.7.1.min.js"></script>
23
-  <script src="/static/js/jquery.marquee.min.js"></script>
24
-  <script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
25 24
   <script>
26 25
     async function getDistance() {
27 26
       try {
@@ -35,7 +34,7 @@
35 34
     async function updateDistance() {
36 35
       var dist = await getDistance();
37 36
       var bar = document.getElementById("distance-bar");
38
-      var percentage = dist>2000 ? 100 : parseInt((100.0*dist)/2000.0);
37
+      var percentage = dist>2000 ? 100 : parseInt((100.0*dist)/MAX_DISTANCE);
39 38
       bar.style.width=`${percentage}%`;
40 39
       bar.textContent = dist;
41 40
     }

Loading…
Cancelar
Guardar