From 669c43c02cd6df92426065063d15c3fc38df0bf5 Mon Sep 17 00:00:00 2001 From: butaixianran Date: Wed, 6 Mar 2024 14:59:38 +0800 Subject: [PATCH] bring back the green refresh button --- README.md | 3 +++ javascript/civitai_helper.js | 21 +++++++++++++++++++++ scripts/ch_lib/util.py | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a7bc731..3ed45a7 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,9 @@ Since v1.5.5, we've already optimized the SHA256 function to the top. So the onl # Change Log3 +## v1.10.2 +* Bring back this addon's green refresh button to SD webui v1.8.x + ## v1.10.1 * Handle model path cases for linux diff --git a/javascript/civitai_helper.js b/javascript/civitai_helper.js index 3887843..c7c4a65 100644 --- a/javascript/civitai_helper.js +++ b/javascript/civitai_helper.js @@ -1145,11 +1145,32 @@ onUiLoaded(() => { refresh_btn.onclick = function(event){ console.log("run refresh button on click"); //official's refresh function + //it will send msg to python to reload card list and won't wait for that. extraNetworksControlRefreshOnClick(event, prefix, js_model_type); + //this will not get card list if cards need to be reloaded from python side. + //user need to click refresh button again, after card list is reloaded. + //which does not feel right by user. + //so, this addon's green refresh button is still needed. update_card_for_civitai_with_sd1_8(); }; + // add refresh button to toolbar + let ch_refresh = document.createElement("button"); + ch_refresh.innerHTML = "🔁"; + ch_refresh.title = "Refresh Civitai Helper's additional buttons"; + ch_refresh.className = "extra-network-control--refresh"; + ch_refresh.style.fontSize = "150%"; + ch_refresh.onclick = update_card_for_civitai_with_sd1_8; + + //extra_toolbar now is displayed as grid + //also grid-template-columns is set to: minmax(0, auto) repeat(4, min-content) + //which only allow 4 buttons + //so here we modify it into 5 to add another refresh button for this addon + extra_toolbar.style.gridTemplateColumns = "minmax(0, auto) repeat(5, min-content)"; + + extra_toolbar.appendChild(ch_refresh); + } diff --git a/scripts/ch_lib/util.py b/scripts/ch_lib/util.py index 5fc86c5..0a34f9c 100644 --- a/scripts/ch_lib/util.py +++ b/scripts/ch_lib/util.py @@ -6,7 +6,7 @@ import requests import shutil -version = "1.10.1" +version = "1.10.2" def_headers = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148', "Authorization": ""}