fixed 打赏卡片逻辑修复
This commit is contained in:
1 parent
1577beda42
commit
761d9024e7
4 files changed
+113
-66
No files matched your search
@@ -36,8 +36,8 @@
|
||||
if (entry.isIntersecting) {
|
||||
var img = entry.target;
|
||||
|
||||
// Add to queue instead of loading immediately
|
||||
addToQueue(img);
|
||||
// Load immediately without queue
|
||||
loadImage(img);
|
||||
|
||||
// Stop observing this image once it's triggered
|
||||
self.unobserve(img);
|
||||
@@ -51,29 +51,7 @@
|
||||
observeImages();
|
||||
}
|
||||
|
||||
function addToQueue(img) {
|
||||
// Avoid duplicates
|
||||
if (!imageQueue.includes(img)) {
|
||||
imageQueue.push(img);
|
||||
processQueue();
|
||||
}
|
||||
}
|
||||
|
||||
function processQueue() {
|
||||
if (isProcessingQueue) return;
|
||||
if (imageQueue.length === 0) return;
|
||||
|
||||
isProcessingQueue = true;
|
||||
|
||||
var img = imageQueue.shift();
|
||||
loadImage(img, function() {
|
||||
// After this image starts showing (or fails), process next after delay
|
||||
setTimeout(function() {
|
||||
isProcessingQueue = false;
|
||||
processQueue();
|
||||
}, defaults.queueInterval);
|
||||
});
|
||||
}
|
||||
// Removed addToQueue and processQueue functions as we want instant loading
|
||||
|
||||
function observeImages() {
|
||||
var images = document.querySelectorAll('img.lazyload, .post-content img:not(.lazy-loaded)');
|
||||
|
||||
Reference in new issue
Block a user