From 1ff2dd7a195f31a9c6132d30e4293e69ef3c4aa1 Mon Sep 17 00:00:00 2001 From: David Walluck Date: Wed, 28 Aug 2024 11:22:18 -0400 Subject: [PATCH] Add some JavaScript fixes (#683) --- .../resources/META-INF/resources/index.html | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/resources/META-INF/resources/index.html b/src/main/resources/META-INF/resources/index.html index 99dd3ef2..f7acdf4c 100644 --- a/src/main/resources/META-INF/resources/index.html +++ b/src/main/resources/META-INF/resources/index.html @@ -94,7 +94,7 @@ }); // XXX - var table = null; + let table = null; const builds = $('#builds'); const input = $('#url'); @@ -104,9 +104,9 @@ const urlAlert = $('#urlAlert'); const urlAlertMessage = $('#urlAlertMessage'); const form = $('#analyzeForm'); - const progress = $('#progress'); + //const progress = $('#progress'); - var intervalID; + let intervalID; form.submit(function(event) { event.preventDefault(); @@ -124,7 +124,7 @@ const url = input.val(); - if (url == null || url.trim().length == 0) { + if (url == null || url.trim().length === 0) { urlAlertMessage.html('URL cannot be empty'); urlAlert.show().alert(); @@ -144,7 +144,7 @@ const protocol = u.protocol; - if (protocol != 'http:' && protocol != 'https:') { + if (protocol !== 'http:' && protocol !== 'https:') { urlAlertMessage.html('Invalid URL protocol: ' + protocol) urlAlert.show().alert(); @@ -152,7 +152,7 @@ } const progressbar = $('#progressbar'); - var percent = 0; + let percent = 0; progressbar.css('width', '0%').attr('aria-valuenow', 0); progressbar.html(percent + '%'); @@ -182,7 +182,7 @@ const id = location.split('/').pop(); const max = 3600000 - 10000; const interval = 1000; - var t = 0; + let t = 0; intervalID = setInterval(function() { $.getJSON('/api/analyze/statuses/' + id, function(data) { @@ -206,7 +206,7 @@ handle(config, data); - if (percent != 100) { + if (percent !== 100) { percent = 100; progressbar.css('width', percent + '%').attr('aria-valuenow', percent); progressbar.html(percent + '%'); @@ -318,10 +318,12 @@ { data: 'artifacts', render: function(data, type) { + let a; + if (type === 'display') { let text = '