Skip to content

Commit

Permalink
chore(PurgePageCache): remove unused code and event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoruaFox committed Jun 2, 2024
1 parent 87c55c5 commit 3c9572a
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/PurgePageCache/PurgePageCache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {getBody} from 'ext.gadget.Util';
import {getMessage} from './modules/i18n';
import {purge} from './modules/purge';

void getBody().then(function purgePageCache($body: JQuery<HTMLBodyElement>): void {
Expand All @@ -9,21 +8,6 @@ void getBody().then(function purgePageCache($body: JQuery<HTMLBodyElement>): voi
return;
}

const portletId: 'p-cactions' | 'p-tb' = $body.find('#p-cactions').length ? 'p-cactions' : 'p-tb';
const portletElement: HTMLLIElement | null = mw.util.addPortletLink(
portletId,
getMessage('Purge'),
getMessage('PurgeFromServer')
);
if (!portletElement) {
return;
}

(portletElement.querySelector('a') as HTMLAnchorElement).addEventListener('click', (event: MouseEvent): void => {
event.preventDefault();
void purge(wgPageName);
});

for (const element of $body.find<HTMLAnchorElement>('a[href*="action=purge"]')) {
const title: string = mw.util.getParamValue('title', element.href) || wgPageName;
element.addEventListener('click', (event: MouseEvent): void => {
Expand Down

0 comments on commit 3c9572a

Please sign in to comment.