From c950abfc57492281d70c7cb6e06b6b8471d45221 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 26 Dec 2021 13:12:36 +0300 Subject: [PATCH] deduplicate usage of #help-popup id --- edit/beautify.js | 4 ++-- edit/util.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/edit/beautify.js b/edit/beautify.js index 20917bc9..44c4895a 100644 --- a/edit/beautify.js +++ b/edit/beautify.js @@ -65,7 +65,7 @@ function beautifyEditor(cm, options, ui) { window.scrollTo(scrollX, scrollY); cm.beautifyChange[cm.changeGeneration()] = true; if (ui) { - $('#help-popup button[role="close"]').disabled = false; + $('button[role="close"]', helpPopup.div).disabled = false; } } } @@ -87,7 +87,7 @@ function createBeautifyUI(scope, options) { $create('span', t('styleBeautifyHint') + '\u00A0'), createHotkeyInput('editor.beautify.hotkey', { buttons: false, - onDone: () => moveFocus($('#help-popup'), 0), + onDone: () => moveFocus(helpPopup.div, 0), }), ]), $create('.buttons', [ diff --git a/edit/util.js b/edit/util.js index 28bd67b6..ddc5f30f 100644 --- a/edit/util.js +++ b/edit/util.js @@ -28,6 +28,7 @@ const helpPopup = { window.on('keydown', helpPopup.close, true); div.style.display = 'block'; helpPopup.originalFocus = document.activeElement; + helpPopup.div = div; return div; }, @@ -44,7 +45,7 @@ const helpPopup = { ) ) ); - const div = $('#help-popup'); + const {div} = helpPopup; if (!canClose || !div) { return; }