Commit db19c46d authored by AUTOMATIC1111's avatar AUTOMATIC1111

lint

parent 1466daea
...@@ -56,7 +56,7 @@ function setupTokenCounting(id, id_counter, id_button) { ...@@ -56,7 +56,7 @@ function setupTokenCounting(id, id_counter, id_button) {
prompt.parentElement.style.position = "relative"; prompt.parentElement.style.position = "relative";
var func = onEdit(id, textarea, 800, function() { var func = onEdit(id, textarea, 800, function() {
if(counter.classList.contains("token-counter-visible")){ if (counter.classList.contains("token-counter-visible")) {
gradioApp().getElementById(id_button)?.click(); gradioApp().getElementById(id_button)?.click();
} }
}); });
...@@ -68,20 +68,20 @@ function toggleTokenCountingVisibility(id, id_counter, id_button) { ...@@ -68,20 +68,20 @@ function toggleTokenCountingVisibility(id, id_counter, id_button) {
var counter = gradioApp().getElementById(id_counter); var counter = gradioApp().getElementById(id_counter);
counter.style.display = opts.disable_token_counters ? "none" : "block"; counter.style.display = opts.disable_token_counters ? "none" : "block";
counter.classList.toggle("token-counter-visible", ! opts.disable_token_counters); counter.classList.toggle("token-counter-visible", !opts.disable_token_counters);
} }
function runCodeForTokenCounters(fun){ function runCodeForTokenCounters(fun) {
fun('txt2img_prompt', 'txt2img_token_counter', 'txt2img_token_button'); fun('txt2img_prompt', 'txt2img_token_counter', 'txt2img_token_button');
fun('txt2img_neg_prompt', 'txt2img_negative_token_counter', 'txt2img_negative_token_button'); fun('txt2img_neg_prompt', 'txt2img_negative_token_counter', 'txt2img_negative_token_button');
fun('img2img_prompt', 'img2img_token_counter', 'img2img_token_button'); fun('img2img_prompt', 'img2img_token_counter', 'img2img_token_button');
fun('img2img_neg_prompt', 'img2img_negative_token_counter', 'img2img_negative_token_button'); fun('img2img_neg_prompt', 'img2img_negative_token_counter', 'img2img_negative_token_button');
} }
onUiLoaded(function(){ onUiLoaded(function() {
runCodeForTokenCounters(setupTokenCounting); runCodeForTokenCounters(setupTokenCounting);
}); });
onOptionsChanged(function(){ onOptionsChanged(function() {
runCodeForTokenCounters(toggleTokenCountingVisibility); runCodeForTokenCounters(toggleTokenCountingVisibility);
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment