Batch lock: reload list instead of the whole page
After performing the batch lock action, two buttons are presented: one
for reloading the page and another one to close the dialog. This change
unifies them, which force reloads the thread list without having to
reload the entire page.
Fixed: twpowertools:7
Change-Id: I319ddd9af3e7133406aece4d92ee0a81f28873c9
diff --git a/src/contentScripts/communityConsole/batchLock.js b/src/contentScripts/communityConsole/batchLock.js
index 3b414b5..ce14d80 100644
--- a/src/contentScripts/communityConsole/batchLock.js
+++ b/src/contentScripts/communityConsole/batchLock.js
@@ -42,7 +42,7 @@
dialog.append(header, main);
- var footers = [['lock', 'unlock', 'cancel'], ['reload', 'close']];
+ var footers = [['lock', 'unlock', 'cancel'], ['close']];
for (var i = 0; i < footers.length; ++i) {
var footer = document.createElement('footer');
@@ -71,22 +71,19 @@
});
break;
- case 'cancel':
case 'close':
btn.addEventListener('click', _ => {
if (btn.classList.contains('is-disabled')) return;
+ var refreshButton = document.querySelector('.app-title-button');
+ if (refreshButton == null)
+ window.location.reload();
+ else
+ refreshButton.click();
modal.classList.remove('visible');
modal.style.display = 'none';
removeChildNodes(modal);
});
break;
-
- case 'reload':
- btn.addEventListener('click', _ => {
- if (btn.classList.contains('is-disabled')) return;
- window.location.reload()
- });
- break;
}
var content = document.createElement('div');