Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
/* Quick purge function */ | /* Quick purge function */ | ||
if (mw.config.get(' | if (mw.config.get('wgNamespaceNumber') >= 0 && mw.config.get('wgUserName') != null) { | ||
purgeUri = window.location.href + '?action=purge'; | purgeUri = window.location.href + '?action=purge'; | ||
purgeShell = document.createElement('a'); | purgeShell = document.createElement('a'); | ||
purgeShell.innerHTML='Purge'; | purgeShell.innerHTML='Purge'; | ||
purgeShell.setAttribute('href', purgeUri); | purgeShell.setAttribute('href', purgeUri); | ||
moreOptions = document.getElementById('p-cactions'); | moreOptions = document.getElementById('p-cactions'); | ||
moreOptions = moreOptions.getElementsByClassName('vector-menu-content-list'); | moreOptions = moreOptions.getElementsByClassName('vector-menu-content-list'); | ||
newChild = document.createElement('li'); | newChild = document.createElement('li'); | ||
newChild.setAttribute('id', 'ca-purge'); | newChild.setAttribute('id', 'ca-purge'); | ||
newChild.appendChild(purgeShell); | newChild.appendChild(purgeShell); | ||
moreOptions[0].appendChild(newChild); | moreOptions[0].appendChild(newChild); | ||
} | } |
Latest revision as of 18:44, 1 December 2021
/* Any JavaScript here will be loaded for all users on every page load. */
/* Quick purge function */
if (mw.config.get('wgNamespaceNumber') >= 0 && mw.config.get('wgUserName') != null) {
purgeUri = window.location.href + '?action=purge';
purgeShell = document.createElement('a');
purgeShell.innerHTML='Purge';
purgeShell.setAttribute('href', purgeUri);
moreOptions = document.getElementById('p-cactions');
moreOptions = moreOptions.getElementsByClassName('vector-menu-content-list');
newChild = document.createElement('li');
newChild.setAttribute('id', 'ca-purge');
newChild.appendChild(purgeShell);
moreOptions[0].appendChild(newChild);
}