Gebruiker:MakiBoy/common.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 62: | Regel 62: | ||
label: 'Blokverzoek', | label: 'Blokverzoek', | ||
tooltip: 'Naar blokverzoeken', | tooltip: 'Naar blokverzoeken', | ||
+ | }, | ||
+ | { | ||
+ | url: 'Wikikids:Clubhuis', | ||
+ | label: 'Clubhuis', | ||
+ | tooltip: 'Naar het clubhuis' | ||
}]; | }]; | ||
Versie van 14 dec 2022 23:15
/**
* Gebruiker:MakiBoy/common.js
*
* Credits: https://www.mediawiki.org/wiki/Snippets/MySandbox
* Made by [[User:MakiBoy]]
*/
function getEditCount(mw) {
var username = 'MakiBoy';
var api = new mw.Api();
return api.get({
action: 'query',
list: 'users',
usprop: 'editcount',
ususers: username,
}).then(function (data) {
return data.query.users[0].editcount;
});
}
function addLink(mw, page) {
var title = new mw.Title(page.url);
var url = new mw.Uri(title.getUrl());
url.extend({
action: 'edit',
redlink: 1,
});
mw.util.addPortletLink(
'p-personal',
url,
page.label,
'pt-page-' + title.getMainText().replace(/ /g, '_'),
page.tooltip,
null,
'#pt-preferences'
);
}
(function (mw, $) {
$(function () {
getEditCount(mw).then(function (editCount) {
var pages = [{
url: 'Gebruiker:MakiBoy/Kladblok',
label: 'Kladblok',
tooltip: 'Naar mijn kladblok',
},
{
url: 'Gebruiker:MakiBoy/aantal/bewerkingen',
label: 'Aantal bewerkingen: ' + editCount || 0,
tooltip: 'Naar mijn aantal bewerkingen',
},
{
url: 'Speciaal:Logboeken/newusers',
label: 'Logboek nieuwe gebruikers',
tooltip: 'Naar het logboek nieuwe gebruikers',
},
{
url: 'Wikikids:Blokverzoek',
label: 'Blokverzoek',
tooltip: 'Naar blokverzoeken',
},
{
url: 'Wikikids:Clubhuis',
label: 'Clubhuis',
tooltip: 'Naar het clubhuis'
}];
$.each(pages, function (i, page) {
addLink(mw, page);
});
});
});
}(mediaWiki, jQuery));