浏览代码

Add config.js

master
The Dod 1 天前
父节点
当前提交
a82e3feff1
共有 3 个文件被更改,包括 7 次插入7 次删除
  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 查看文件

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 查看文件

24
       </div>
24
       </div>
25
     </div>
25
     </div>
26
   </div>
26
   </div>
27
+  <script src="/static/js/config.js"></script>
27
   <script src="/static/js/jquery-3.7.1.min.js"></script>
28
   <script src="/static/js/jquery-3.7.1.min.js"></script>
28
   <script src="/static/js/jquery.marquee.min.js"></script>
29
   <script src="/static/js/jquery.marquee.min.js"></script>
29
   <script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
30
   <script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
44
       return 0;
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
   async function updateDistance() {
48
   async function updateDistance() {
52
     var dist = await getDistance();
49
     var dist = await getDistance();
53
     var vidblur = 0; tickerblur = 0;
50
     var vidblur = 0; tickerblur = 0;

+ 2
- 3
templates/progbar.html 查看文件

19
       </div>
19
       </div>
20
     </div>
20
     </div>
21
   </div>
21
   </div>
22
+  <script src="/static/js/config.js"></script>
22
   <script src="/static/js/jquery-3.7.1.min.js"></script>
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
   <script>
24
   <script>
26
     async function getDistance() {
25
     async function getDistance() {
27
       try {
26
       try {
35
     async function updateDistance() {
34
     async function updateDistance() {
36
       var dist = await getDistance();
35
       var dist = await getDistance();
37
       var bar = document.getElementById("distance-bar");
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
       bar.style.width=`${percentage}%`;
38
       bar.style.width=`${percentage}%`;
40
       bar.textContent = dist;
39
       bar.textContent = dist;
41
     }
40
     }

正在加载...
取消
保存