User:Theopolisme/delsortonoff.js

mw.util.addPortletLink ('p-cactions', 'javascript:disable', 'Disable', 'pt-delsortd', 'Disable delsort'); mw.util.addPortletLink ('p-cactions', 'javascript:enable', 'Enable', 'pt-delsorte', 'Enable delsort');

// Disable delsort.js

//First, get the content $.post('http://en.wikipedia.org/w/api.php', {action:'query', format:'json', prop:'revisions', rvprop:'content', rvlimit:'1', titles:'User:Theopolisme/common.js'}, function disable(data){ $.each(data.query.pages, function(i,v){ window.editContent = v.revisions[0]['*'].replace("importScript('User:Fox_Wilson/delsort.js');", '// do not clear this line';   } ); var editData = { action: "edit", format: "json", token: etoken, summary: "Disabling delsort.js", title: 'User:Theopolisme/common.js', text: window.editContent }; $.each(editData, function(i,v){console.log(i,"=",v);}); $.post('http://en.wikipedia.org/w/api.php', editData, function(data){jQuery.each(data, function( index, value ) { console.log( "index", index, "value", value );});}); alert('Aannddd it\'s off.'); } ); }   }  } }

$.post('http://en.wikipedia.org/w/api.php', {action:'query', format:'json', prop:'revisions', rvprop:'content', rvlimit:'1', titles:'User:Theopolisme/common.js'},

function enable(data){ $.each(data.query.pages,    function(i,v){      window.editContent = v.revisions[0]['*'].replace("// do not clear this line", "importScript('User:Fox_Wilson/delsort.js');"; } ); var editData = {                                 action: "edit",                  format: "json",                  token: etoken,                  summary: "Enabling delsort.js",                  title: 'User:Theopolisme/common.js',                  text: window.editContent  };  $.each(editData, function(i,v){console.log(i,"=",v);});  $.post('http://en.wikipedia.org/w/api.php', editData, function(data){jQuery.each(data, function( index, value ) {  console.log( "index", index, "value", value );});});  alert('Aannddd it\'s on.');  } ); }   }  } }