Skip to content

Commit

Permalink
Edited image_galleries.html
Browse files Browse the repository at this point in the history
  • Loading branch information
zurg3 committed Aug 23, 2024
1 parent 1c5f254 commit 9b455c2
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions html/image_galleries.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
var image_url = '';
var image_item = '';

document.getElementById('statistics').hidden = false;
document.getElementById('scale_control').hidden = false;
document.getElementById('output').hidden = false;

Expand All @@ -149,6 +148,7 @@
var id_step = document.getElementById('id_step').value;
var hide_failed_images = document.getElementsByName('hide_failed_images')[0].checked;
var blur_images = document.getElementsByName('blur_images')[0].checked;
var show_statistics = document.getElementsByName('show_statistics')[0].checked;

var final_id = images_amount;

Expand Down Expand Up @@ -188,7 +188,14 @@
}

reset_statistics();
document.getElementById('total_counter').innerText = images_amount;

if (show_statistics) {
document.getElementById('statistics').hidden = false;
document.getElementById('total_counter').innerText = images_amount;
}
else {
document.getElementById('statistics').hidden = true;
}

clear_output();

Expand All @@ -207,15 +214,17 @@
document.getElementById('output').innerHTML += image_item;

// Statistics
var img_test = new Image();
img_test.onload = function() {
document.getElementById('loaded_counter').innerText = parseInt(document.getElementById('loaded_counter').innerText, 10) + 1;
document.getElementById('loaded_rate').innerText = Math.floor(parseInt(document.getElementById('loaded_counter').innerText, 10) / images_amount * 100);
};
img_test.onerror = function() {
document.getElementById('failed_counter').innerText = parseInt(document.getElementById('failed_counter').innerText, 10) + 1;
};
img_test.src = image_url;
if (show_statistics) {
var img_test = new Image();
img_test.onload = function() {
document.getElementById('loaded_counter').innerText = parseInt(document.getElementById('loaded_counter').innerText, 10) + 1;
document.getElementById('loaded_rate').innerText = Math.floor(parseInt(document.getElementById('loaded_counter').innerText, 10) / images_amount * 100);
};
img_test.onerror = function() {
document.getElementById('failed_counter').innerText = parseInt(document.getElementById('failed_counter').innerText, 10) + 1;
};
img_test.src = image_url;
}
}
}
else {
Expand Down Expand Up @@ -304,6 +313,10 @@
<input type="checkbox" name="blur_images">
<label for="blur_images">Blur images</label>
</p>
<p>
<input type="checkbox" name="show_statistics">
<label for="show_statistics">Show statistics</label>
</p>
</fieldset>
<p>
<input type="button" value="Load images" onclick="load_gallery()">
Expand Down

0 comments on commit 9b455c2

Please sign in to comment.