Commit 0d90064e authored by AUTOMATIC1111's avatar AUTOMATIC1111

eslint

parent 9158d0fd
...@@ -107,33 +107,28 @@ function processNode(node) { ...@@ -107,33 +107,28 @@ function processNode(node) {
}); });
} }
function localizeWholePage(){ function localizeWholePage() {
processNode(gradioApp()); processNode(gradioApp());
function elem(comp) { function elem(comp) {
if(comp.props.elem_id) { var elem_id = comp.props.elem_id ? comp.props.elem_id : "component-" + comp.id;
elem_id = comp.props.elem_id;
} else{
elem_id = "component-" + comp.id;
}
return gradioApp().getElementById(elem_id); return gradioApp().getElementById(elem_id);
} }
for(comp of window.gradio_config.components) { for (var comp of window.gradio_config.components) {
if(comp.props.webui_tooltip) { if (comp.props.webui_tooltip) {
var e = elem(comp); let e = elem(comp);
var tl = e ? getTranslation(e.title) : undefined; let tl = e ? getTranslation(e.title) : undefined;
if (tl !== undefined) { if (tl !== undefined) {
e.title = tl; e.title = tl;
} }
} }
if(comp.props.placeholder) { if (comp.props.placeholder) {
var e = elem(comp); let e = elem(comp);
var textbox = e ? e.querySelector('[placeholder]') : null; let textbox = e ? e.querySelector('[placeholder]') : null;
var tl = textbox ? getTranslation(textbox.placeholder) : undefined; let tl = textbox ? getTranslation(textbox.placeholder) : undefined;
if (tl !== undefined) { if (tl !== undefined) {
textbox.placeholder = tl; textbox.placeholder = tl;
} }
......
...@@ -82,7 +82,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre ...@@ -82,7 +82,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
var livePreview = null; var livePreview = null;
var removeProgressBar = function() { var removeProgressBar = function() {
if(! divProgress) return; if (!divProgress) return;
setTitle(""); setTitle("");
parentProgressbar.removeChild(divProgress); parentProgressbar.removeChild(divProgress);
...@@ -153,7 +153,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre ...@@ -153,7 +153,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
var img = new Image(); var img = new Image();
img.onload = function() { img.onload = function() {
if(!livePreview){ if (!livePreview) {
livePreview = document.createElement('div'); livePreview = document.createElement('div');
livePreview.className = 'livePreview'; livePreview.className = 'livePreview';
gallery.insertBefore(livePreview, gallery.firstElementChild); gallery.insertBefore(livePreview, gallery.firstElementChild);
...@@ -177,7 +177,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre ...@@ -177,7 +177,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
funProgress(id_task, 0); funProgress(id_task, 0);
if(gallery){ if (gallery) {
funLivePreview(id_task, 0); funLivePreview(id_task, 0);
} }
......
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