From 0d90064e9e00612b1e065eba4e7b394e7892af34 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Tue, 22 Aug 2023 13:57:05 +0300 Subject: [PATCH] eslint --- javascript/localization.js | 25 ++++++++++--------------- javascript/progressbar.js | 6 +++--- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/javascript/localization.js b/javascript/localization.js index 26f21bcf2..8f00c1868 100644 --- a/javascript/localization.js +++ b/javascript/localization.js @@ -107,33 +107,28 @@ function processNode(node) { }); } -function localizeWholePage(){ +function localizeWholePage() { processNode(gradioApp()); function elem(comp) { - if(comp.props.elem_id) { - elem_id = comp.props.elem_id; - } else{ - elem_id = "component-" + comp.id; - } - + var elem_id = comp.props.elem_id ? comp.props.elem_id : "component-" + comp.id; return gradioApp().getElementById(elem_id); } - for(comp of window.gradio_config.components) { - if(comp.props.webui_tooltip) { - var e = elem(comp); + for (var comp of window.gradio_config.components) { + if (comp.props.webui_tooltip) { + let e = elem(comp); - var tl = e ? getTranslation(e.title) : undefined; + let tl = e ? getTranslation(e.title) : undefined; if (tl !== undefined) { e.title = tl; } } - if(comp.props.placeholder) { - var e = elem(comp); - var textbox = e ? e.querySelector('[placeholder]') : null; + if (comp.props.placeholder) { + let e = elem(comp); + let textbox = e ? e.querySelector('[placeholder]') : null; - var tl = textbox ? getTranslation(textbox.placeholder) : undefined; + let tl = textbox ? getTranslation(textbox.placeholder) : undefined; if (tl !== undefined) { textbox.placeholder = tl; } diff --git a/javascript/progressbar.js b/javascript/progressbar.js index 160813fcc..531ac831f 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -82,7 +82,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre var livePreview = null; var removeProgressBar = function() { - if(! divProgress) return; + if (!divProgress) return; setTitle(""); parentProgressbar.removeChild(divProgress); @@ -153,7 +153,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre var img = new Image(); img.onload = function() { - if(!livePreview){ + if (!livePreview) { livePreview = document.createElement('div'); livePreview.className = 'livePreview'; gallery.insertBefore(livePreview, gallery.firstElementChild); @@ -177,7 +177,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre funProgress(id_task, 0); - if(gallery){ + if (gallery) { funLivePreview(id_task, 0); }