//<syntaxhighlight>
importScript('User:Ohconfucius/script/EngvarB.js'); //<nowiki>[[User:Ohconfucius/script/EngvarB.js]]</nowiki>
importScript('User:Shubinator/DYKcheck.js'); //DYKcheck tool
addOnloadHook(function() {
mw.util.addPortletLink('p-cactions','http://translate.google.co.uk/translate_t','Translate','ca-translate');
});
addOnloadHook(function() {
mw.util.addPortletLink('p-cactions','http://books.google.com//','GB','ca-gb');
});
addOnloadHook(function() {
mw.util.addPortletLink('p-cactions','http://reftag.appspot.com/','GB ref','ca-gb ref');
});
function edit(){
function editPages( info ) {
$.ajax({
url: mw.util.wikiScript( 'api' ),
type: 'POST',
dataType: 'json',
data: {
format: 'json',
action: 'edit',
title: info.title,
text: info.text,
summary: info.summary,
token: mw.user.tokens.get( 'csrfToken' )
}
})
.done (function( data ) {
if ( data && data.edit && data.edit.result && data.edit.result == 'Success' ) {
// mw.notify( 'Updated' );
// mw.notify( 'Re updating in 1 min' );
setTimeout('edit()',10);
} else {
alert( 'Stopped, restart please.' );
}
})
.fail ( function() {
alert( 'Stopped, restart please.' );
});
}
var count= Math.floor((Math.random() * 10) + 1);
editPages({
title: mw.config.get('wgPageName'),
text: "{{"+"subst:Currentdate"+"}}<span style='display:none'>"+count+"</span>",
summary: ' '
});
}
addOnloadHook(function() {
if (document.editform) {
mw.util.addPortletLink("p-cactions", "javascript:edits()", "run");
}
});
function edits(){
if (confirm('Replace whole content with current date and time?')){
edit();
}}
//</syntaxhighlight>