From 33365f15bf667dc421bd844c372987cf58008daf Mon Sep 17 00:00:00 2001 From: TFWol <9045213+TFWol@users.noreply.github.com> Date: Wed, 19 Apr 2023 14:23:46 -0700 Subject: Remove old code roll random artists Removed context menu entry that used to be for rolling artists from the now removed artists.csv. It was probably meant to be removed at commit 6d805b6. --- javascript/contextMenus.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'javascript/contextMenus.js') diff --git a/javascript/contextMenus.js b/javascript/contextMenus.js index 06f505b0..9468c107 100644 --- a/javascript/contextMenus.js +++ b/javascript/contextMenus.js @@ -161,14 +161,6 @@ addContextMenuEventListener = initResponse[2]; appendContextMenuOption('#img2img_interrupt','Cancel generate forever',cancelGenerateForever) appendContextMenuOption('#img2img_generate', 'Cancel generate forever',cancelGenerateForever) - appendContextMenuOption('#roll','Roll three', - function(){ - let rollbutton = get_uiCurrentTabContent().querySelector('#roll'); - setTimeout(function(){rollbutton.click()},100) - setTimeout(function(){rollbutton.click()},200) - setTimeout(function(){rollbutton.click()},300) - } - ) })(); //End example Context Menu Items -- cgit v1.2.3 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/contextMenus.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'javascript/contextMenus.js') diff --git a/javascript/contextMenus.js b/javascript/contextMenus.js index 9468c107..5107e524 100644 --- a/javascript/contextMenus.js +++ b/javascript/contextMenus.js @@ -16,8 +16,7 @@ contextMenuInit = function(){ oldMenu.remove() } - let tabButton = uiCurrentTab - let baseStyle = window.getComputedStyle(tabButton) + let baseStyle = window.getComputedStyle(uiCurrentTab) const contextMenu = document.createElement('nav') contextMenu.id = "context-menu" @@ -63,7 +62,7 @@ contextMenuInit = function(){ function appendContextMenuOption(targetElementSelector,entryName,entryFunction){ - currentItems = menuSpecs.get(targetElementSelector) + var currentItems = menuSpecs.get(targetElementSelector) if(!currentItems){ currentItems = [] -- cgit v1.2.3 From f6a40a2ffacaba63915f11c47e77e84a06ed073c Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:12:24 +0300 Subject: Fix unused variables --- javascript/contextMenus.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'javascript/contextMenus.js') diff --git a/javascript/contextMenus.js b/javascript/contextMenus.js index 5107e524..ec7960e1 100644 --- a/javascript/contextMenus.js +++ b/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){ -- cgit v1.2.3 From 4bb441bb08aa3692bdd7d347016b4d70e9cdf365 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:15:11 +0300 Subject: Remove redundant return --- javascript/contextMenus.js | 1 - 1 file changed, 1 deletion(-) (limited to 'javascript/contextMenus.js') diff --git a/javascript/contextMenus.js b/javascript/contextMenus.js index ec7960e1..1f682c74 100644 --- a/javascript/contextMenus.js +++ b/javascript/contextMenus.js @@ -111,7 +111,6 @@ contextMenuInit = function(){ if(e.composedPath()[0].matches(k)){ showContextMenu(e,e.composedPath()[0],v) e.preventDefault() - return } }) }); -- cgit v1.2.3 From c714300265919e325ae1340459c4866541940687 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:15:59 +0300 Subject: Use substring instead of deprecated substr --- javascript/contextMenus.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'javascript/contextMenus.js') diff --git a/javascript/contextMenus.js b/javascript/contextMenus.js index 1f682c74..42f301ab 100644 --- a/javascript/contextMenus.js +++ b/javascript/contextMenus.js @@ -4,7 +4,7 @@ contextMenuInit = function(){ let menuSpecs = new Map(); const uid = function(){ - return Date.now().toString(36) + Math.random().toString(36).substr(2); + return Date.now().toString(36) + Math.random().toString(36).substring(2); } function showContextMenu(event,element,menuEntries){ -- cgit v1.2.3