瀏覽代碼

Fix unused variables

Aarni Koskela 2 年之前
父節點
當前提交
f6a40a2ffa

+ 3 - 8
javascript/aspectRatioOverlay.js

@@ -55,19 +55,14 @@ function dimensionChange(e, is_width, is_height){
 		var cleintRectCentreY = cleintRectTop  + (targetElement.clientHeight/2)
 		var cleintRectCentreX = cleintRectLeft + (targetElement.clientWidth/2)
 
-		var viewRectTop    = cleintRectCentreY-(scaledy/2)  // TODO: unused?
-		var viewRectLeft   = cleintRectCentreX-(scaledx/2)  // TODO: unused?
-		var arRectWidth  = scaledx
-		var arRectHeight = scaledy
-
-		var arscale = Math.min(  arRectWidth/currentWidth, arRectHeight/currentHeight )
+		var arscale = Math.min(  scaledx/currentWidth, scaledy/currentHeight )
 		var arscaledx = currentWidth*arscale
 		var arscaledy = currentHeight*arscale
 
 		var arRectTop    = cleintRectCentreY-(arscaledy/2)
 		var arRectLeft   = cleintRectCentreX-(arscaledx/2)
-		arRectWidth  = arscaledx
-		arRectHeight = arscaledy
+		var arRectWidth  = arscaledx
+		var arRectHeight = arscaledy
 
 	    arPreviewRect.style.top  = arRectTop+'px';
 	    arPreviewRect.style.left = arRectLeft+'px';

+ 2 - 2
javascript/contextMenus.js

@@ -35,7 +35,7 @@ contextMenuInit = function(){
     menuEntries.forEach(function(entry){
       let contextMenuEntry = document.createElement('a')
       contextMenuEntry.innerHTML = entry['name']
-      contextMenuEntry.addEventListener("click", function(e) {
+      contextMenuEntry.addEventListener("click", function() {
         entry['func']();
       })
       contextMenuList.append(contextMenuEntry);
@@ -78,7 +78,7 @@ contextMenuInit = function(){
   }
 
   function removeContextMenuOption(uid){
-    menuSpecs.forEach(function(v,k) {
+    menuSpecs.forEach(function(v) {
       let index = -1
       v.forEach(function(e,ei){if(e['id']==uid){index=ei}})
       if(index>=0){

+ 2 - 2
javascript/extensions.js

@@ -1,5 +1,5 @@
 
-function extensions_apply(_, _, disable_all){
+function extensions_apply(_disabled_list, _update_list, disable_all){
     var disable = []
     var update = []
 
@@ -16,7 +16,7 @@ function extensions_apply(_, _, disable_all){
     return [JSON.stringify(disable), JSON.stringify(update), disable_all]
 }
 
-function extensions_check(_, _){
+function extensions_check(){
     var disable = []
 
     gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){

+ 2 - 2
javascript/extraNetworks.js

@@ -10,7 +10,7 @@ function setupExtraNetworksForTab(tabname){
     tabs.appendChild(search)
     tabs.appendChild(refresh)
 
-    search.addEventListener("input", function(evt){
+    search.addEventListener("input", function(){
         var searchTerm = search.value.toLowerCase()
 
         gradioApp().querySelectorAll('#'+tabname+'_extra_tabs div.card').forEach(function(elem){
@@ -55,7 +55,7 @@ function tryToRemoveExtraNetworkFromPrompt(textarea, text){
 
     var partToSearch = m[1]
     var replaced = false
-    var newTextareaText = textarea.value.replaceAll(re_extranet_g, function(found, index){
+    var newTextareaText = textarea.value.replaceAll(re_extranet_g, function(found){
         m = found.match(re_extranet);
         if(m[1] == partToSearch){
             replaced = true;

+ 0 - 1
javascript/imageMaskFix.js

@@ -23,7 +23,6 @@ function imageMaskResize() {
     const nw = previewImage.naturalWidth;
     const nh = previewImage.naturalHeight;
     const portrait = nh > nw;
-    const factor = portrait;
 
     const wW = Math.min(w, portrait ? h/nh*nw : w/nw*nw);
     const wH = Math.min(h, portrait ? h/nh*nh : w/nw*nh);

+ 0 - 1
javascript/imageParams.js

@@ -1,7 +1,6 @@
 window.onload = (function(){
     window.addEventListener('drop', e => {
         const target = e.composedPath()[0];
-        const idx = selected_gallery_index();
         if (target.placeholder.indexOf("Prompt") == -1) return;
 
         let prompt_target = get_tab_index('tabs') == 1 ? "img2img_prompt_image" : "txt2img_prompt_image";

+ 1 - 1
javascript/notification.js

@@ -9,7 +9,7 @@ onUiUpdate(function(){
         notificationButton = gradioApp().getElementById('request_notifications')
 
         if(notificationButton != null){
-            notificationButton.addEventListener('click', function (evt) {
+            notificationButton.addEventListener('click', () => {
                 Notification.requestPermission();
             },true);
         }

+ 2 - 2
javascript/progressbar.js

@@ -1,10 +1,10 @@
 // code related to showing and updating progressbar shown as the image is being made
 
-function rememberGallerySelection(id_gallery){
+function rememberGallerySelection(){
 
 }
 
-function getGallerySelectedIndex(id_gallery){
+function getGallerySelectedIndex(){
 
 }
 

+ 2 - 2
javascript/ui.js

@@ -207,7 +207,7 @@ function submit_img2img(){
     return res
 }
 
-function restoreProgressTxt2img(x){
+function restoreProgressTxt2img(){
     var id = localStorage.getItem("txt2img_task_id")
 
     if(id) {
@@ -218,7 +218,7 @@ function restoreProgressTxt2img(x){
 
     return [id]
 }
-function restoreProgressImg2img(x){
+function restoreProgressImg2img(){
     var id = localStorage.getItem("img2img_task_id")
 
     if(id) {