Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/**
* EditcountTag.js
*
* Adds editcount tags to the masthead
* @author: [[w:User:Slyst]]
*/
(function() {
if (!mw.config.get('profileUserName') || window.EditcountTagLoaded) {
return;
}
window.EditcountTagLoaded = true;
function findContainer() {
var promise = $.Deferred(),
interval = setInterval(function() {
var $element = $('#userProfileApp .user-identity-header__attributes, #UserProfileMasthead hgroup');
if ($element.length) {
clearInterval(interval);
promise.resolve($element);
}
}, 300);
return promise;
}
function init(text, $container) {
var username = mw.config.get('profileUserName') ||
$('.masthead-info h1').text();
$('<a>', {
'class': 'tag user-identity-header__tag',
'css': {
float: 'right',
color: 'inherit',
marginTop: '15px',
marginRight: '-15px'
},
'href': mw.util.getUrl('Special:Editcount/' + username),
'text': text
}).appendTo($container);
}
mw.hook('dev.fetch').add(function(fetch) {
$.when(fetch('editcount'), findContainer())
.then(init);
});
importArticle({
type: 'script',
article: 'u:dev:MediaWiki:Fetch.js'
});
})();