From c714300265919e325ae1340459c4866541940687 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 30 Apr 2023 22:15:59 +0300 Subject: [PATCH] Use substring instead of deprecated substr --- javascript/contextMenus.js | 2 +- javascript/extensions.js | 6 +++--- javascript/ui.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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){ diff --git a/javascript/extensions.js b/javascript/extensions.js index cb68344b..2a2d2f8e 100644 --- a/javascript/extensions.js +++ b/javascript/extensions.js @@ -5,10 +5,10 @@ function extensions_apply(_disabled_list, _update_list, disable_all){ gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){ if(x.name.startsWith("enable_") && ! x.checked) - disable.push(x.name.substr(7)) + disable.push(x.name.substring(7)) if(x.name.startsWith("update_") && x.checked) - update.push(x.name.substr(7)) + update.push(x.name.substring(7)) }) restart_reload() @@ -21,7 +21,7 @@ function extensions_check(){ gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach(function(x){ if(x.name.startsWith("enable_") && ! x.checked) - disable.push(x.name.substr(7)) + disable.push(x.name.substring(7)) }) gradioApp().querySelectorAll('#extensions .extension_status').forEach(function(x){ diff --git a/javascript/ui.js b/javascript/ui.js index aa440bf6..e2b9bfe4 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -351,7 +351,7 @@ onUiUpdate(function(){ onOptionsChanged(function(){ var elem = gradioApp().getElementById('sd_checkpoint_hash') var sd_checkpoint_hash = opts.sd_checkpoint_hash || "" - var shorthash = sd_checkpoint_hash.substr(0,10) + var shorthash = sd_checkpoint_hash.substring(0,10) if(elem && elem.textContent != shorthash){ elem.textContent = shorthash