User:Allstarecho/unsigned2.js

if (unsigned2AddText == null) var unsigned2AddText = '{'+'{subst:Unsigned2|?|?}'+'}\n\n'; if (unsigned2Summary == null) var unsigned2Summary = 'Add Template:Unsigned2 to unsigned comment'; function addunsigned2Text { var box = document.getElementById('wpTextbox1'); var content = box.value; content = unsigned2AddText + content; box.value = content; var sumBox = document.getElementById('wpSummary'); sumBox.value = unsigned2Summary; } function goTounsigned2 { var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + wgPageName + '&action=edit&addunsigned2=true'; window.location = url; } function attachunsigned2Link { var unsigned2Link = new wa_element('li'); unsigned2Link.ele_obj.id = 't-unsigned2'; unsigned2Link.ele_obj.innerHTML = 'Add unsigned2 tag'; unsigned2Link.addScriptEvent('click', function { goTounsigned2; }); unsigned2Link.attach(document.getElementById('pt-userpage'), 'before'); } importScript('User:Ale_jrb/Scripts/waLib.js'); hookEvent('load', attachunsigned2Link); if (window.location.href.indexOf('&addunsigned2=true') > -1) { hookEvent('load', addunsigned2Text); }