Jump to content

User:PrimeHunter/Deleted contribs.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PrimeHunter (talk | contribs) at 11:18, 16 August 2024 (Create script to add "Deleted contribs" link under Tools in userspace). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Add a "Deleted contribs" link under "Tools" in userspace.
   The link only works for admins.
   To use the script, add the following line to Special:MyPage/common.js:
 
importScript('User:PrimeHunter/Deleted contribs.js'); // Linkback: [[User:PrimeHunter/Deleted contribs.js]]

*/

addOnloadHook(function () {
if (mw.config.get('wgNamespaceNumber') != "2" && mw.config.get('wgNamespaceNumber') != "3")
  return;  // restrict to User and User talk

mw.loader.using(['mediawiki.util'], function () {
  mw.util.addPortletLink(
    'p-tb',
    'https://en.wikipedia.org/w/index.php?title=Special:DeletedContributions&target=' +
    encodeURIComponent(mw.config.get('wgTitle').split('/')[0]),
    'Deleted contribs',
     'pt-deletedcontribs',
    'Deleted user contributions',
    null,
    '#t-contributions'
  );
});
})