User:GeorgeMoney/UserScripts/archive

From Wikipedia, the free encyclopedia

//

//AUTO ARCHIVE
//Written by GeorgeMoney
//The header to put on top of all archives (if the archive is in 'w' mode (modes explained below))
var archiveheader = '';
//Your talk page header for to use when archiving. Remember to keep the <noinclude> tags or else your archive will have your talk page header along with it.
var talkheader = '<noinclude>{{User:Mypage/header}}</noinclude>';
//Your talk page archive page. Insert "NUMBER" where the number of archive you are on goes. (Dont put a real number!! just put the text "NUMBER")
var archiveurl = "User_talk:GeorgeMoney/ArchiveNUMBER";
//The mode to archive your talk page. Making this value 'a' will make the script add your archive to the bottom of the current archive. 
//Making it 'w' will totally erase the contents of the current archive (usually you should set the current archive value to a new archive to avoid erasing old archives, 
//where as in append mode (a), you should set it to your current archive to append the contents)
var archivemode = 'w';
//
if(readCookie('archive1') == 'yes' && window.location.href.indexOf('archivestep') == -1) { (window.location.href) = wikiurl+mytalk+'?action=edit&archivestep=2'; }
function changearccontents() {
document.title = "Archival Script Manager";
document.getElementById('bodyContent').innerHTML = 
'<div class="dontshow" style="display: none !important;"></div>\n' +
'<h1 class="firstHeading" style="display:block;">Archive Script Manager</h1>\n' +
'Current archive number (the one that you haven\'t done yet (like if I want to archive to archive 2 then that is the next one not done)): <br> <input type="text" id="archnuminput" value="' + readCookie('archivenum') + '"  size="1" maxlength="4" /> <input type="button" value="save number" onclick="createCookie(\'archivenum\', document.getElementById(\'archnuminput\').value); document.getElementById(\'arclink\').href = wikiurl+archiveurl.replace(\'NUMBER\',readCookie(\'archivenum\'))+\'?action=edit&archivestep=1\';" /><br><br>\n'+
'<a href="'+wikiurl+archiveurl.replace('NUMBER',readCookie('archivenum'))+'?action=edit&archivestep=1" id="arclink" style="font-size: 2em; font-weight: bold;">Click here to begin the archive</a><br>\n' +
'';
document.write('<style type="text/css">.firstHeading, .editsection {display:none;} .dontshow { display: none !important; } #content {background: honeydew !important; border: 3px solid green;} #p-cactions {display: none;}</style>');
}

if(window.location.href.indexOf('archivemanage') != -1||window.location.href.indexOf('Archivemanage') != -1) {
addOnloadHook(function(){ changearccontents(); });
}
if (window.location.href.indexOf('archivestep=1') != -1 && window.location.href.indexOf('action=edit') != -1) {
addOnloadHook(function (){
  if(!readCookie('archivenum') != 'yes') { (window.location.href) = wikiurl+'User:GeorgeMoney/archivemanage' }
  if(archivemode == 'a') {
  document.getElementById('wpTextbox1').value += "\n{{sub"+"st:"+mytalk+"}}";
  } else {
  document.getElementById('wpTextbox1').value = archiveheader+"\n{{sub"+"st:"+mytalk+"}}";
  }
  document.getElementById('wpSummary').value = "JS: Copying talkpage to archive";
  createCookie('archive1', 'yes');
  document.getElementById('editform').submit();
});
}
if (window.location.href.indexOf('archivestep=2') != -1 && window.location.href.indexOf('action=edit') != -1) {
addOnloadHook(function (){
  if(readCookie('archive1') != 'yes') { alert("You shouldn't be at \"&archivestep=2\" because you haven't completed &archivestep=1. Please read the instructions on this archiving script. Redirecting to archive manager. "); (window.location.href) = wikiurl+'User:GeorgeMoney/archivemanage'; return; }
  createCookie('archive1', 'no');
  document.getElementById('wpTextbox1').value = talkheader;
  document.getElementById('wpSummary').value = "JS: Archiving talk page";
  document.getElementById('editform').submit();
});
}
//-------
//