Gebruiker:Rots61/common.js: verschil tussen versies

Uit Wikikids
Naar navigatie springen Naar zoeken springen
 
(62 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 1: Regel 1:
 
mw.loader.using('mediawiki.util', function() {
 
mw.loader.using('mediawiki.util', function() {
 +
if (!/(bewerken|geschiedenis|overleg|:)/g.test(firstHeading.innerHTML) && mw.config.get('wgNamespaceNumber') === 0 && mw.config.get('wgAction') === 'view') {
 +
firstHeading.innerHTML = '<a href="https://wikikids.nl/index.php?search=' + firstHeading.innerHTML + '&title=Speciaal%3AZoeken&profile=default&fulltext=1">' +  firstHeading.innerHTML + '</a>';
 +
}
 
mw.util.addPortletLink('p-tb',  
 
mw.util.addPortletLink('p-tb',  
 
'https://nl.wikipedia.org/wiki/' + encodeURIComponent(mw.config.get('wgPageName')),  
 
'https://nl.wikipedia.org/wiki/' + encodeURIComponent(mw.config.get('wgPageName')),  
 
'Wikipedia ', '#wikipedialink', mw.config.get('wgPageName') + " op Wikipedia ");
 
'Wikipedia ', '#wikipedialink', mw.config.get('wgPageName') + " op Wikipedia ");
});
 
 
mw.loader.using('mediawiki.util', function() {
 
 
mw.util.addPortletLink('p-tb',  
 
mw.util.addPortletLink('p-tb',  
 
'https://www.google.nl/search?q=' + encodeURIComponent(mw.config.get('wgPageName')),  
 
'https://www.google.nl/search?q=' + encodeURIComponent(mw.config.get('wgPageName')),  
Regel 11: Regel 11:
 
});
 
});
  
mw.loader.using('mediawiki.util', function() {
 
mw.util.addPortletLink('p-tb',
 
'https://wikikids.nl/Speciaal:AllePaginas?hideredirects=1&from=' + encodeURIComponent(mw.config.get('wgPageName')),
 
'Alles ', '#alles', " alles");
 
});
 
// Redirecten
 
 
var mpTitle = "Wikikids:Visuele tekstverwerker";
 
var isMainPage = wgPageName == mpTitle
 
if (isMainPage)
 
{window.location="https://wikikids.nl/";}
 
 
  mw.loader.load('//es.wikipedia.org/w/index.php?title=Usuario:Qwertyytrewqqwerty/DisamAssist.js&action=raw&ctype=text/javascript');
 
 
 
'https://wikikids.nl/Speciaal:AllePaginas?hideredirects=1&from=' + encodeURIComponent(mw.config.get('wgPageName')),
 
 
/**
 
* Add a "My sandbox" link to the personal portlet menu.
 
*
 
* Required modules: mediawiki.util, mediawiki.Title, mediawiki.Uri
 
*
 
* @source https://www.mediawiki.org/wiki/Snippets/MySandbox
 
* @version 2014-07-16
 
*/
 
( function ( mw, $ ) {
 
$( function () {
 
var conf, title, url;
 
  
// Customize/Translate this to your needs
+
if (document.getElementById('beginnetje')) { //oranje: FF5733 //'blauw': #23819C
conf = {
+
var beg = '<center><span style="color:gray">(Dit artikel is een beginnetje)</span></center>';
subpageName: 'sandbox',
+
document.getElementById('beginnetje').style.display = "none";
portletLabel: 'Sandbox',
+
$('#footer-places').before(beg);
portletTooltip: 'Go to your sandbox',
+
}
editintroPagename: 'Template:User_sandbox',
 
preloadPagename: 'Template:User_sandbox/preload'
 
};
 
// Don't alter the code below
 
  
// Use Special:MyPage (as opposed to mw.user.getName()) so that it
+
mw.loader.load('//wikikids.nl/index.php?title=Gebruiker:Rots61/GevraagdePaginas.js&action=raw&ctype=text/javascript');
// works for logged-out users as well.
 
title = new mw.Title( 'Special:MyPage/' + conf.subpageName );
 
  
url = new mw.Uri( title.getUrl() );
+
if (document.getElementsByClassName('patrollink')[0]) {
url.extend( {
+
    var rcid = document.getElementsByClassName('patrollink')[0].getElementsByTagName('a')[0].href.split("rcid=").pop();
action: 'edit',
+
mw.util.addPortletLink('p-namespaces',
redlink: 1,
+
'javascript:patrolR61(' + rcid + ')',  
editintro: new mw.Title( conf.editintroPagename ),
+
'Patrol ', 'ca-patrollinkr61', " Controleer " + mw.config.get('wgPageName'), 'a');
preload: new mw.Title( conf.preloadPagename )
+
}
} );
 
  
mw.util.addPortletLink(
+
function patrolR61(rcid){
'p-personal',
+
    api.get({
url,
+
        action: 'query',
conf.portletLabel,
+
        meta: 'tokens',
'pt-sandbox',
+
        type: 'patrol',
conf.portletTooltip,
+
    }).done(
null,
+
        function (data) {
'#pt-preferences'
+
            console.log(data);
);
+
            edit_token = data.query.tokens.patroltoken;
} );
+
        }).done(function (data) {
}( mediaWiki, jQuery ) );
+
        api.post({
 +
            'action': 'patrol',
 +
            'rcid': rcid,
 +
            'token': edit_token,
 +
        }).done(
 +
            function (data) {
 +
                console.log(data);
 +
                mw.notify('Gecontroleerd');
 +
                document.getElementById('ca-patrollinkr61').innerHTML = '';
 +
            });
 +
    });
 +
}

Huidige versie van 29 jul 2025 om 23:22

mw.loader.using('mediawiki.util', function() {
	if (!/(bewerken|geschiedenis|overleg|:)/g.test(firstHeading.innerHTML) && mw.config.get('wgNamespaceNumber') === 0 && mw.config.get('wgAction') === 'view') {
		firstHeading.innerHTML = '<a href="https://wikikids.nl/index.php?search=' + firstHeading.innerHTML + '&title=Speciaal%3AZoeken&profile=default&fulltext=1">' +  firstHeading.innerHTML + '</a>';
	}
	mw.util.addPortletLink('p-tb', 
		'https://nl.wikipedia.org/wiki/' + encodeURIComponent(mw.config.get('wgPageName')), 
		'Wikipedia ', '#wikipedialink', mw.config.get('wgPageName') + " op Wikipedia ");
	mw.util.addPortletLink('p-tb', 
		'https://www.google.nl/search?q=' + encodeURIComponent(mw.config.get('wgPageName')), 
		'Google ', '#googlelink', mw.config.get('wgPageName') + " op Google ");
});


if (document.getElementById('beginnetje')) { //oranje: FF5733 //'blauw': #23819C 
	var beg = '<center><span style="color:gray">(Dit artikel is een beginnetje)</span></center>';
	document.getElementById('beginnetje').style.display = "none";
	$('#footer-places').before(beg);
}

mw.loader.load('//wikikids.nl/index.php?title=Gebruiker:Rots61/GevraagdePaginas.js&action=raw&ctype=text/javascript');

if (document.getElementsByClassName('patrollink')[0]) {
    var rcid = document.getElementsByClassName('patrollink')[0].getElementsByTagName('a')[0].href.split("rcid=").pop();
	mw.util.addPortletLink('p-namespaces', 
		'javascript:patrolR61(' + rcid + ')', 
		'Patrol ', 'ca-patrollinkr61', " Controleer " + mw.config.get('wgPageName'), 'a');
}

function patrolR61(rcid){
    api.get({
        action: 'query',
        meta: 'tokens',
        type: 'patrol',
    }).done(
        function (data) {
            console.log(data);
            edit_token = data.query.tokens.patroltoken;
        }).done(function (data) {
        api.post({
            'action': 'patrol',
            'rcid': rcid,
            'token': edit_token,
        }).done(
            function (data) {
                console.log(data);
                mw.notify('Gecontroleerd');
                document.getElementById('ca-patrollinkr61').innerHTML = '';
            });
    });
}
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=Gebruiker:Rots61/common.js&oldid=958186"