diff options
-rw-r--r-- | Zotlabs/Daemon/Cron_daily.php | 2 | ||||
-rw-r--r-- | Zotlabs/Web/WebServer.php | 2 | ||||
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | view/js/main.js | 57 | ||||
-rw-r--r-- | view/theme/redbasic/php/theme.php | 2 |
5 files changed, 31 insertions, 34 deletions
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 3bc267f08..debc5571e 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -95,7 +95,7 @@ class Cron_daily { // expire any expired accounts downgrade_accounts(); - Master::Summon(array('Expire')); + // Master::Summon(array('Expire')); Master::Summon(array('Cli_suggest')); remove_obsolete_hublocs(); diff --git a/Zotlabs/Web/WebServer.php b/Zotlabs/Web/WebServer.php index 19f14ee8a..d59effc88 100644 --- a/Zotlabs/Web/WebServer.php +++ b/Zotlabs/Web/WebServer.php @@ -61,7 +61,7 @@ class WebServer { if (x($_GET,'zid') && $installed) { \App::$query_string = strip_zids(\App::$query_string); if(! local_channel()) { - if (!isset($_SESSION['my_address']) || $_SESSION['my_address'] != $_GET['zid']) { + if (!isset($_SESSION['my_address'])) { $_SESSION['my_address'] = Text::escape_tags($_GET['zid']); $_SESSION['authenticated'] = 0; } @@ -66,7 +66,7 @@ require_once('include/security.php'); define('PLATFORM_NAME', 'hubzilla'); -define('STD_VERSION', '10.0.1'); +define('STD_VERSION', '10.1.8'); define('ZOT_REVISION', '6.0'); define('DB_UPDATE_VERSION', 1263); diff --git a/view/js/main.js b/view/js/main.js index 4ef924731..f20b3590d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -793,48 +793,51 @@ function imagesLoaded(elements, callback) { let loadedCount = 0; let totalImages = 0; let timeoutId; - let timeout = 10000; - let processed = []; + const timeout = 10000; + const processed = new Set(); // Use a Set for efficient lookup // Helper function to extract img elements from an HTML string function extractImagesFromHtml(htmlString) { - let tempDiv = document.createElement('div'); + const tempDiv = document.createElement('div'); tempDiv.innerHTML = htmlString; return tempDiv.querySelectorAll('.wall-item-body img, .wall-photo-item img'); } function checkComplete(src) { - // Track processed images to not count images multiple times if load event is emited from multiple sources - if (processed.includes(src)) { - return; - } + // Skip processing if image has already been processed + if (processed.has(src)) return; - processed.push(src); + processed.add(src); loadedCount++; - document.getElementById('image_counter').innerHTML = Math.round((loadedCount * 100) / totalImages) + '%'; + // Update progress + const progress = Math.round((loadedCount * 100) / totalImages); + document.getElementById('image_counter').innerText = `${progress}%`; + + // If all images are loaded, trigger the callback if (loadedCount === totalImages) { - document.getElementById('image_counter').innerHTML = ''; + document.getElementById('image_counter').innerText = ''; clearTimeout(timeoutId); callback(); } } - // If the elements is an HTML string, convert it to img elements + // Convert HTML string to img elements if necessary if (typeof elements === 'string') { elements = extractImagesFromHtml(elements); } - // If elements is not a valid array-like object, or is empty, exit early + // Exit early if there are no images to load if (!elements || elements.length === 0) { - callback(); // No images to load, immediately call the callback + callback(); return; } - let images = Array.from(elements) - .filter(element => element.tagName && element.tagName.toLowerCase() === 'img' && element.src) + // Filter valid image elements (only img with src attribute) + const images = Array.from(elements) + .filter((element) => element.tagName.toLowerCase() === 'img' && element.src) .filter((element, index, self) => - index === self.findIndex(e => e.src === element.src) + index === self.findIndex(e => e.src === element.src) // Avoid duplicates ); // If no images are found, call the callback immediately @@ -843,29 +846,24 @@ function imagesLoaded(elements, callback) { return; } - // Set timeout + totalImages = images.length; + + // Set timeout for the loading process timeoutId = setTimeout(() => { console.warn(`Image loading timed out after ${timeout}ms`); callback(false); }, timeout); - totalImages = images.length; - + // Iterate through images to add load and error event listeners images.forEach((img) => { - // Otherwise it will not load until visible - img.loading = 'eager'; + img.loading = 'eager'; // Preload the image - if (img.complete && img.naturalHeight !== 0) { - // Image is already loaded successfully - //console.log(`Image cached: ${img.src}`); + if (img.complete && img.naturalHeight > 0) { + // Image is already loaded, handle immediately checkComplete(img.src); } else { // Add event listeners for load and error events - img.addEventListener('load', () => { - //console.log(`Image loaded: ${img.src}`); - checkComplete(img.src); - }); - + img.addEventListener('load', () => checkComplete(img.src)); img.addEventListener('error', () => { console.log(`Image failed to load: ${img.src}`); checkComplete(img.src); @@ -874,7 +872,6 @@ function imagesLoaded(elements, callback) { }); } - function updateRelativeTime(selector) { // Get all elements with the given selector const timeElements = document.querySelectorAll(selector); diff --git a/view/theme/redbasic/php/theme.php b/view/theme/redbasic/php/theme.php index 1f682634e..dcbe8c3da 100644 --- a/view/theme/redbasic/php/theme.php +++ b/view/theme/redbasic/php/theme.php @@ -5,7 +5,7 @@ * * Description: Hubzilla standard theme * * Version: 2.2 * * MinVersion: 8.9 - * * MaxVersion: 10.0 + * * MaxVersion: 11.0 * * Author: Fabrixxm * * Maintainer: Mike Macgirvin * * Maintainer: Mario Vavti |