aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-04-30 11:45:56 +0000
committerAarni Koskela <akx@iki.fi>2023-04-30 11:48:02 +0000
commit34a6ad80d5a3d6670a9e89089558e724d8c9f8bd (patch)
tree6af5083b3f8825c1a5f725e01b3af7245903133a
parentee973dcf1d1de44a248dc3a1b7043c9b8ebdc25a (diff)
downloadstable-diffusion-webui-gfx803-34a6ad80d5a3d6670a9e89089558e724d8c9f8bd.tar.gz
stable-diffusion-webui-gfx803-34a6ad80d5a3d6670a9e89089558e724d8c9f8bd.tar.bz2
stable-diffusion-webui-gfx803-34a6ad80d5a3d6670a9e89089558e724d8c9f8bd.zip
Use classList.toggle wherever possible
-rw-r--r--javascript/hires_fix.js10
-rw-r--r--javascript/imageviewer.js6
2 files changed, 4 insertions, 12 deletions
diff --git a/javascript/hires_fix.js b/javascript/hires_fix.js
index 0629475f..ba175301 100644
--- a/javascript/hires_fix.js
+++ b/javascript/hires_fix.js
@@ -1,13 +1,9 @@
-function setInactive(elem, inactive){
- if(inactive){
- elem.classList.add('inactive')
- } else{
- elem.classList.remove('inactive')
+function onCalcResolutionHires(enable, width, height, hr_scale, hr_resize_x, hr_resize_y){
+ function setInactive(elem, inactive){
+ elem.classList.toggle('inactive', !!inactive)
}
-}
-function onCalcResolutionHires(enable, width, height, hr_scale, hr_resize_x, hr_resize_y){
hrUpscaleBy = gradioApp().getElementById('txt2img_hr_scale')
hrResizeX = gradioApp().getElementById('txt2img_hr_resize_x')
hrResizeY = gradioApp().getElementById('txt2img_hr_resize_y')
diff --git a/javascript/imageviewer.js b/javascript/imageviewer.js
index 3deffa9b..f364a2a1 100644
--- a/javascript/imageviewer.js
+++ b/javascript/imageviewer.js
@@ -144,11 +144,7 @@ function setupImageForLightbox(e) {
}
function modalZoomSet(modalImage, enable) {
- if (enable) {
- modalImage.classList.add('modalImageFullscreen');
- } else {
- modalImage.classList.remove('modalImageFullscreen');
- }
+ if(modalImage) modalImage.classList.toggle('modalImageFullscreen', !!enable);
}
function modalZoomToggle(event) {