From 34a6ad80d5a3d6670a9e89089558e724d8c9f8bd Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 14:45:56 +0300 Subject: Use classList.toggle wherever possible --- javascript/hires_fix.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'javascript/hires_fix.js') 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') -- cgit v1.2.1 From 8ccc27127bd5abcba05f30f8a72fc37025b588ac Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:08:52 +0300 Subject: Fix a whole bunch of implicit globals --- javascript/hires_fix.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'javascript/hires_fix.js') diff --git a/javascript/hires_fix.js b/javascript/hires_fix.js index ba175301..48196be4 100644 --- a/javascript/hires_fix.js +++ b/javascript/hires_fix.js @@ -4,9 +4,9 @@ function onCalcResolutionHires(enable, width, height, hr_scale, hr_resize_x, hr_ elem.classList.toggle('inactive', !!inactive) } - hrUpscaleBy = gradioApp().getElementById('txt2img_hr_scale') - hrResizeX = gradioApp().getElementById('txt2img_hr_resize_x') - hrResizeY = gradioApp().getElementById('txt2img_hr_resize_y') + var hrUpscaleBy = gradioApp().getElementById('txt2img_hr_scale') + var hrResizeX = gradioApp().getElementById('txt2img_hr_resize_x') + var hrResizeY = gradioApp().getElementById('txt2img_hr_resize_y') gradioApp().getElementById('txt2img_hires_fix_row2').style.display = opts.use_old_hires_fix_width_height ? "none" : "" -- cgit v1.2.1