diff --git a/html/image_galleries.html b/html/image_galleries.html index 2af3880..26f38b3 100644 --- a/html/image_galleries.html +++ b/html/image_galleries.html @@ -21,11 +21,15 @@ padding: 10px; } - #loaded_counter_row { + th, td { + text-align: center; + } + + .loaded_counter_col { color: Green; } - #failed_counter_row { + .failed_counter_col { color: Red; } @@ -53,6 +57,8 @@ const default_blur_radius = 16; // 16px + const statistics_help = 'L - Loaded\nF - Failed\nT - Total\nLR - Loaded Rate\n\nG - Gallery\nA - All'; + if (is_mobile()) { var current_blur_radius = 16; } @@ -108,6 +114,8 @@ function handle_loaded_image(img_num, search_option) { document.images[img_num].style.border = '1px solid Black'; get_image_size(img_num); + document.getElementById('output').getElementsByTagName('p')[img_num].getElementsByTagName('br')[0].hidden = false; + document.getElementById('output').getElementsByTagName('p')[img_num].getElementsByTagName('br')[1].hidden = false; document.getElementsByClassName('open_image_button')[img_num].hidden = false; document.getElementsByClassName('copy_image_url_button')[img_num].hidden = false; @@ -122,11 +130,13 @@ function search_image(img_url, search_engine) { if (search_engine == 'google') { - window.open(`https://lens.google.com/uploadbyurl?url=${img_url}`, '_blank'); + var search_url = `https://lens.google.com/uploadbyurl?url=${img_url}`; } else if (search_engine == 'yandex') { - window.open(`https://ya.ru/images/search?rpt=imageview&url=${img_url}`, '_blank'); + var search_url = `https://ya.ru/images/search?rpt=imageview&url=${img_url}`; } + + window.open(search_url, '_blank'); } function blur_image(image, radius) { @@ -155,6 +165,29 @@ } } + function update_loaded_rate_color() { + // Gallery + if (loaded_rate_gallery.innerText == '100') { + loaded_rate_gallery.parentNode.style.color = 'Green'; + } + else if (loaded_rate_gallery.innerText == '0') { + loaded_rate_gallery.parentNode.style.color = 'Red'; + } + + // All + if (loaded_rate_all.innerText == '100') { + loaded_rate_all.parentNode.style.color = 'Green'; + } + else if (loaded_rate_all.innerText == '0') { + loaded_rate_all.parentNode.style.color = 'Red'; + } + } + + function reset_loaded_rate_color() { + loaded_rate_gallery.parentNode.style.color = 'Black'; + loaded_rate_all.parentNode.style.color = 'Black'; + } + function load_gallery() { if (document.getElementById('base_link').value != '' && document.getElementById('images_amount').value != '' && is_any_radio_checked('file_format')) { var image_id = ''; @@ -234,9 +267,12 @@ var loaded_rate_all = document.getElementById('loaded_rate_all'); var galleries_counter = document.getElementById('galleries_counter'); + var average_counter = document.getElementById('average_counter'); total_counter_gallery.innerText = images_amount; total_counter_all.innerText = parseInt(total_counter_all.innerText, 10) + parseInt(total_counter_gallery.innerText, 10); + + reset_loaded_rate_color(); } clear_output(); @@ -247,9 +283,10 @@ image_item = `

image${image_id} -
- + + +

`; @@ -270,6 +307,8 @@ // Loading progress loading_progress.innerText = Math.floor((parseInt(loaded_counter_gallery.innerText, 10) + parseInt(failed_counter_gallery.innerText, 10)) / images_amount * 100); + + update_loaded_rate_color(); }; img_test.onerror = function() { // Gallery @@ -280,6 +319,8 @@ // Loading progress loading_progress.innerText = Math.floor((parseInt(loaded_counter_gallery.innerText, 10) + parseInt(failed_counter_gallery.innerText, 10)) / images_amount * 100); + + update_loaded_rate_color(); }; img_test.src = image_url; } @@ -287,6 +328,7 @@ if (show_statistics) { galleries_counter.innerText = parseInt(galleries_counter.innerText, 10) + 1; + average_counter.innerText = Math.floor(parseInt(total_counter_all.innerText, 10) / parseInt(galleries_counter.innerText, 10)); } } else { @@ -302,23 +344,37 @@ document.getElementById('output').innerHTML = ''; } - function reset_statistics(reset_scope) { - document.getElementById('loading_progress_value').innerText = 0; + function reset_statistics_gallery() { + document.getElementById('loaded_counter_gallery').innerText = 0; + document.getElementById('failed_counter_gallery').innerText = 0; + document.getElementById('total_counter_gallery').innerText = 0; + document.getElementById('loaded_rate_gallery').innerText = 0; + } + + function reset_statistics_all() { + document.getElementById('loaded_counter_all').innerText = 0; + document.getElementById('failed_counter_all').innerText = 0; + document.getElementById('total_counter_all').innerText = 0; + document.getElementById('loaded_rate_all').innerText = 0; + + document.getElementById('galleries_counter').innerText = 0; + document.getElementById('average_counter').innerText = 0; + } + function reset_statistics(reset_scope) { if (reset_scope == 'gallery') { - document.getElementById('loaded_counter_gallery').innerText = 0; - document.getElementById('failed_counter_gallery').innerText = 0; - document.getElementById('total_counter_gallery').innerText = 0; - document.getElementById('loaded_rate_gallery').innerText = 0; + document.getElementById('loading_progress_value').innerText = 0; + reset_statistics_gallery(); } else if (reset_scope == 'all') { - document.getElementById('loaded_counter_all').innerText = 0; - document.getElementById('failed_counter_all').innerText = 0; - document.getElementById('total_counter_all').innerText = 0; - document.getElementById('loaded_rate_all').innerText = 0; - - document.getElementById('galleries_counter').innerText = 0; + reset_statistics_all(); + } + else { + reset_statistics_gallery(); + reset_statistics_all(); } + + reset_loaded_rate_color(); } function clear_input() { @@ -408,32 +464,33 @@
- - - - - - - - - - - - - + + + + + - + + + - + - - + + + +
GalleryAll
Loaded0
Failed0LFTLR
TotalG 00%
Loaded rate0%A000 0%

Galleries loaded: 0

+

Average images per gallery: 0

+

+ + +