Jump to content

User:D'SuperHero/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if (archiverAddText == null) var archiverAddText = '{'+'{talkheader}'+'}\n{{User:MiszaBot/config\n|archiveheader = {{Talkarchivenav}}\n|maxarchivesize = 80K\n|counter = 1\n|minthreadsleft = 1\n|minthreadstoarchive = 1\n|algo = old(15d)\n|archive = Talk:PAGE NAME/Archive %(counter)d\n}'+'}\n';
if (archiverSummary == null) var archiverSummary = 'Set up of [[User:MiszaBot|MiszaBot]] auto archiving using [[User:Allstarecho/AutoArchive|AutoArchive]]';
 
function addArchiverText() {
  var box = document.getElementById('wpTextbox1');
  var content = box.value;
  content = archiverAddText + content;
  box.value = content;
 
  var sumBox = document.getElementById('wpSummary');
  sumBox.value = archiverSummary;
}
 
function goToArchiver() {
  var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + mw.config.get('wgPageName') + '&action=edit&addarchive=true'; 
  window.location = url;
}
 
function attachArchiverLink() {
  var archiverLink = new wa_element('li');
  archiverLink.ele_obj.id = 't-archiver';
  archiverLink.ele_obj.innerHTML = '<a href="#" title="Add MiszaBot auto archive template">Auto-Archive</a>';
  archiverLink.addScriptEvent('click', function() { goToArchiver(); });
 
  archiverLink.attach(document.getElementById('pt-userpage'), 'before');
}

importScript('User:Ale_jrb/Scripts/waLib.js'); 
hookEvent('load', attachArchiverLink);
if (window.location.href.indexOf('&addarchive=true') > -1) { hookEvent('load', addArchiverText); }