From 1d096ed1456c9b9b662477839853621848705e68 Mon Sep 17 00:00:00 2001 From: missionfloyd Date: Tue, 21 Mar 2023 16:07:24 -0600 Subject: [PATCH 1/2] Lazy load extra network images --- html/extra-networks-card.html | 6 +++--- modules/ui_extra_networks.py | 2 +- style.css | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/html/extra-networks-card.html b/html/extra-networks-card.html index 1bf3fc30..8348135b 100644 --- a/html/extra-networks-card.html +++ b/html/extra-networks-card.html @@ -1,6 +1,6 @@ -
- {metadata_button} - +
+ {preview_html} + {metadata_button}
    diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index cdfd6f2a..1963f6a6 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -131,7 +131,7 @@ class ExtraNetworksPage: metadata_button = f"" args = { - "preview_html": "style='background-image: url(\"" + html.escape(preview) + "\")'" if preview else '', + "preview_html": f'' if preview else '', "prompt": item.get("prompt", None), "tabname": json.dumps(tabname), "local_preview": json.dumps(item["local_preview"]), diff --git a/style.css b/style.css index 3eac2b17..710e9a75 100644 --- a/style.css +++ b/style.css @@ -1026,6 +1026,13 @@ footer { color: red; } +.extra-network-cards .card .preview{ + position: absolute; + object-fit: cover; + width: 100%; + height:100%; +} + [id*='_prompt_container'] > div { margin: 0!important; } From cb8c447f0d37b5ee9df9a7ee3e9d32b7966dabee Mon Sep 17 00:00:00 2001 From: missionfloyd Date: Sun, 26 Mar 2023 21:47:48 -0600 Subject: [PATCH 2/2] Update extra-networks-card.html --- html/extra-networks-card.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/extra-networks-card.html b/html/extra-networks-card.html index fe90b028..7ea467c1 100644 --- a/html/extra-networks-card.html +++ b/html/extra-networks-card.html @@ -1,4 +1,4 @@ -
    +
    {background_image} {metadata_button}