if (namespace === -1 || namespace === 8) {
var page = mw.config.get('wgPageName');
// addLink('the Meta Weird GloopRuneScape Wiki', ' metarsw', page); ▼
addDiscordLink();
// addLink('the RuneScape Classic Wiki', 'rswclassicrsw', page);
// addLink('the RuneScapeMeta Weird ClassicGloop Wiki', 'classicrswmeta', page);
▲ // addLink('the Meta Weird Gloop Wiki', 'meta', page);
} else {
// make this work when "Show preview without reloading the page" is checked
});
}
function addDiscordLink(page) {
var url = 'https://www.runerealm.org/discord';
var title = 'Join our Discord to talk about wiki content or becoming an editor.';
//function addLink(wikiname, interwiki, page) { ▼
// var url = mw.util.getUrl(interwiki + ':' + page); ▼
// var title = wikiname + ' also has an article on ' + page + '.'; ▼
// // wikipedia links aren't forwarded - see [[Special:Interwiki]] ▼
// if (interwiki === 'wikipedia') { ▼
// url = '//en.wikipedia.org/wiki/' + encodeURIComponent(page); ▼
// // Special and MediaWiki namespaces ▼
// if (namespace === -1 || namespace === 8) { ▼
// url += window.location.search; // include url parameters ▼
// title = 'Open this page on ' + wikiname + '.'; ▼
var link = mw.util.addPortletLink('p-namespaces', url, '',
// no text - use background-image instead
'gadget-external-discord' + interwiki,
// button id
title // title text shown on hover
$(link).addClass('gadget-external-icon');
}
//function addDiscordLink() {
// var url = mw.util.getUrl('discord:' + page);
// var title = 'Discord also has an article on ' + page + '.';
▲ // // Special and MediaWiki namespaces
▲ // if (namespace === -1 || namespace === 8) {
▲ // url += window.location.search; // include url parameters
// title = 'Open this page on Discord.';
// var link = mw.util.addPortletLink('p-namespaces', url, '',
// // no text - use background-image instead
// 'gadget-external-discord',
// // button id
// title // title text shown on hover
// );
// // for styling all links at once - addPortletLink only sets an id
// $(link).addClass('gadget-external-icon');
//}
▲ //function addLink(wikiname, interwiki, page) {
▲ // var url = mw.util.getUrl(interwiki + ':' + page);
▲ // var title = wikiname + ' also has an article on ' + page + '.';
▲ // // wikipedia links aren't forwarded - see [[Special:Interwiki]]
▲ // if (interwiki === 'wikipedia') {
▲ // url = '//en.wikipedia.org/wiki/' + encodeURIComponent(page);
// // Special and MediaWiki namespaces
// if (namespace === -1 || namespace === 8) {
// url += window.location.search; // include url parameters
▲ // title = 'Open this page on ' + wikiname + '.';
// }
// var link = mw.util.addPortletLink('p-namespaces', url, '',
// // no text - use background-image instead
// 'gadget-external-' + interwiki,
// // button id
// title // title text shown on hover
// );
// // for styling all links at once - addPortletLink only sets an id
// $(link).addClass('gadget-external-icon');
//}
})(jQuery, mediaWiki);
|