mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
Refactor core application and recipe manager: remove lazy loading functionality and clean up imports in uiHelpers.
This commit is contained in:
@@ -6,7 +6,7 @@ import { updateService } from './managers/UpdateService.js';
|
||||
import { HeaderManager } from './components/Header.js';
|
||||
import { settingsManager } from './managers/SettingsManager.js';
|
||||
import { exampleImagesManager } from './managers/ExampleImagesManager.js';
|
||||
import { showToast, initTheme, initBackToTop, lazyLoadImages } from './utils/uiHelpers.js';
|
||||
import { showToast, initTheme, initBackToTop } from './utils/uiHelpers.js';
|
||||
import { initializeInfiniteScroll } from './utils/infiniteScroll.js';
|
||||
import { migrateStorageItems } from './utils/storageHelpers.js';
|
||||
import { setupLoraCardEventDelegation } from './components/LoraCard.js';
|
||||
@@ -61,9 +61,6 @@ export class AppCore {
|
||||
initializePageFeatures() {
|
||||
const pageType = this.getPageType();
|
||||
|
||||
// Initialize lazy loading for images on all pages
|
||||
lazyLoadImages();
|
||||
|
||||
// Setup event delegation for lora cards if on the loras page
|
||||
if (pageType === 'loras') {
|
||||
setupLoraCardEventDelegation();
|
||||
@@ -84,7 +81,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
});
|
||||
|
||||
// Create and export a singleton instance
|
||||
export const appCore = new AppCore();
|
||||
|
||||
// Export common utilities for global use
|
||||
export { showToast, lazyLoadImages, initializeInfiniteScroll };
|
||||
export const appCore = new AppCore();
|
||||
@@ -6,8 +6,8 @@ import { getCurrentPageState, state } from './state/index.js';
|
||||
import { getSessionItem, removeSessionItem } from './utils/storageHelpers.js';
|
||||
import { RecipeContextMenu } from './components/ContextMenu/index.js';
|
||||
import { DuplicatesManager } from './components/DuplicatesManager.js';
|
||||
import { initializeInfiniteScroll, refreshVirtualScroll } from './utils/infiniteScroll.js';
|
||||
import { resetAndReload, refreshRecipes } from './api/recipeApi.js';
|
||||
import { refreshVirtualScroll } from './utils/infiniteScroll.js';
|
||||
import { refreshRecipes } from './api/recipeApi.js';
|
||||
|
||||
class RecipeManager {
|
||||
constructor() {
|
||||
@@ -228,11 +228,6 @@ class RecipeManager {
|
||||
}
|
||||
|
||||
this.duplicatesManager.exitDuplicateMode();
|
||||
|
||||
// Use a small delay before initializing to ensure DOM is ready
|
||||
setTimeout(() => {
|
||||
initializeInfiniteScroll('recipes');
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,19 +91,6 @@ export function showToast(message, type = 'info') {
|
||||
});
|
||||
}
|
||||
|
||||
export function lazyLoadImages() {
|
||||
const observer = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting && entry.target.dataset.src) {
|
||||
entry.target.src = entry.target.dataset.src;
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('img[data-src]').forEach(img => observer.observe(img));
|
||||
}
|
||||
|
||||
export function restoreFolderFilter() {
|
||||
const activeFolder = getStorageItem('activeFolder');
|
||||
const folderTag = activeFolder && document.querySelector(`.tag[data-folder="${activeFolder}"]`);
|
||||
|
||||
Reference in New Issue
Block a user