User:ØM/links.js
< User:ØM
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.
mw.loader.using('mediawiki.util').then(function () {
var _config = mw.config.get( ['wgNamespaceNumber', 'wgPageName', 'wgScript'] );
var _links = {
'Журналы' : {
'uri' : '?title=Special:Log&page=%%PAGE%%',
'id' : 'linkmenu-logs',
'tooltip' : 'Просмотреть журнал страницы',
'exists' : 0
},
'Подстраницы' : {
'uri' : '?title=Special:Prefixindex/%%PAGE%%/',
'id' : 'linkmenu-subpages',
'tooltip' : 'Просмотреть список подстраниц',
'exists' : 0
}
};
var addLinks = function() {
if( _config.wgNamespaceNumber < 0 ) {
return;
}
var title, item, uri;
for ( title in _links) {
item = _links[title];
uri = item.uri.replace( '%%PAGE%%', encodeURIComponent( _config.wgPageName ) );
if( uri.substr( 0, 1 ) === '?' ) {
uri = _config.wgScript + uri;
}
mw.util.addPortletLink( 'p-tb', uri, title, item.id, item.tooltip );
}
};
$( addLinks );
} );