Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTOMATIC1111 committed Aug 22, 2023
1 parent 9158d0f commit 0d90064
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
25 changes: 10 additions & 15 deletions javascript/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions javascript/progressbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -177,7 +177,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre

funProgress(id_task, 0);

if(gallery){
if (gallery) {
funLivePreview(id_task, 0);
}

Expand Down

0 comments on commit 0d90064

Please sign in to comment.