User:Ale jrb/Scripts/allstarArchiver.js

if (archiverAddText == null) var archiverAddText = '{'+'{User:MiszaBot/config\n|archiveheader = \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\n'; if (archiverSummary == null) var archiverSummary = 'Set up of auto archiving';

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=' + 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 = 'Add archive template'; archiverLink.addScriptEvent('click', function { goToArchiver; }); archiverLink.attach(document.getElementById('t-whatlinkshere'), 'before'); }

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