In the modern world,
User:Enterprisey/sync-template-sandbox.js has been a topic of constant debate and a central point of interest for millions of people around the world. From its emergence on the public scene to its impact on society,
User:Enterprisey/sync-template-sandbox.js has captured the attention and interest of academics, activists, political leaders, and everyday people alike. Its influence extends across different spheres of life, from popular culture to the global economy, and its meaning and relevance continue to evolve as we enter this new millennium. In this article, we will fully explore the impact and importance of
User:Enterprisey/sync-template-sandbox.js in today's world, analyzing its history, its repercussions, and its potential to shape the future.
$( function() {
// 10 is "Template:" and 828 is "Module:"
if ( ( mw.config.get( "wgNamespaceNumber" ) === 10 || mw.config.get( "wgNamespaceNumber" ) === 828 ) && mw.config.get( "wgPageName" ).includes( "/sandbox" ) ) {
var link = mw.util.addPortletLink(
"p-cactions",
"#",
"Sync with main",
"ca-sync",
"Overwrite the sandbox code with the code from the main template"
);
mw.loader.using( "mediawiki.api", function () {
link.addEventListener( "click", function () {
var api = new mw.Api();
api.get( {
prop: 'revisions',
rvprop: 'content',
rvlimit: 1,
titles: mw.config.get( "wgPageName" ).replace( "/sandbox", "" )
} ).done( function ( data ) {
if ( !data.query || !data.query.pages ) return;
var pageid = Object.getOwnPropertyNames( data.query.pages ),
text = data.query.pages.revisions;
api.postWithEditToken( {
action: "edit",
title: mw.config.get( "wgPageName" ),
summary: "Syncing sandbox code with main template (])",
text: text
} ).done ( function ( data ) {
if ( data && data.edit && data.edit.result && data.edit.result == 'Success' ) {
mw.notify( "Synced successfully! Reloading in 5 seconds..." );
window.setTimeout( function () {
document.location.reload( true );
}, 5000 );
}
} );
} );
} );
} );
}
} );