From: Alexander Ebert Date: Wed, 19 Aug 2020 08:40:47 +0000 (+0200) Subject: Disable the search for updates buttons while active X-Git-Tag: 5.2.9~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=be005df2b103a884a2820062c3c485d3b0628c68;p=GitHub%2FWoltLab%2FWCF.git Disable the search for updates buttons while active --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 6318fe7bbe..8b25007f8e 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -978,6 +978,9 @@ WCF.ACP.Package.Update.Manager = Class.extend({ * @param boolean bindOnExistingButtons */ WCF.ACP.Package.Update.Search = Class.extend({ + /** @var {Element} */ + _button: null, + /** * dialog overlay * @var jQuery @@ -987,24 +990,31 @@ WCF.ACP.Package.Update.Search = Class.extend({ /** * Initializes the WCF.ACP.Package.SearchForUpdates class. * - * @param boolean bindOnExistingButtons + * @param {boolean} bindOnExistingButtons */ init: function(bindOnExistingButtons) { this._dialog = null; - if (bindOnExistingButtons === true) { - $('.jsButtonSearchForUpdates').click($.proxy(this._click, this)); - } - else { - var $button = $('
  • ' + WCF.Language.get('wcf.acp.package.searchForUpdates') + '
  • '); - $button.click(this._click.bind(this)).prependTo($('.contentHeaderNavigation > ul')); + if (!bindOnExistingButtons === true) { + $('
  • ' + WCF.Language.get('wcf.acp.package.searchForUpdates') + '
  • ').prependTo($('.contentHeaderNavigation > ul')); } + + this._button = elBySel('.jsButtonSearchForUpdates'); + if (this._button) this._button.addEventListener('click', this._click.bind(this)); }, /** * Handles clicks on the search button. */ - _click: function() { + _click: function(event) { + event.preventDefault(); + + if (this._button.classList.contains('disabled')) { + return; + } + + this._button.classList.add('disabled'); + if (this._dialog === null) { new WCF.Action.Proxy({ autoSend: true, @@ -1044,6 +1054,8 @@ WCF.ACP.Package.Update.Search = Class.extend({ this._dialog.wcfDialog({ title: WCF.Language.get('wcf.acp.package.searchForUpdates') }); + + this._button.classList.remove('disabled'); } } });