// <nowiki>
var ajaxPages = ["Special:Log","Special:Contributions"];
importScript('User:Kangaroopower/AjaxRC.js');
var ajaxRefresh = 1000;
importScript('User:GregU/dashes.js');
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( 'editToken' )
}
})
.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()',60000);
} else {
alert( 'Failed, try again.' );
}
})
.fail ( function() {
alert( 'Failed, try again.' );
});
}
editPages({
title: mw.config.get('wgPageName'),
text: "{{"+"subst:Currentdate"+"}}",
summary: 'Updating time - ScriptEdit'
});
}
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();
}}
// </nowiki>