User:Allstarecho/wpms.js

if (wpmsAddText == null) var wpmsAddText = '{'+'{WikiProject Mississippi|class=?|importance=?|needs-infobox=?|needs-photo=?|listas=?, ?}'+'}\n\n';

if (wpmsSummary == null) var wpmsSummary = 'Add WP:MS project tag';

function addwpmsText() {

var box = document.getElementById('wpTextbox1');

var content = box.value;

content = wpmsAddText + content;

box.value = content;

var sumBox = document.getElementById('wpSummary');

sumBox.value = wpmsSummary;

}

function goTowpms() {

var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + wgPageName + '&action=edit&addwpms=true';

window.location = url;

}

function attachwpmsLink() {

var wpmsLink = new wa_element('li');

wpmsLink.ele_obj.id = 't-wpms';

wpmsLink.ele_obj.innerHTML = 'Add WPMS tag';

wpmsLink.addScriptEvent('click', function() { goTowpms(); });

wpmsLink.attach(document.getElementById('pt-userpage'), 'before');

}

importScript('User:Ale_jrb/Scripts/waLib.js');

hookEvent('load', attachwpmsLink);

if (window.location.href.indexOf('&addwpms=true') > -1) { hookEvent('load', addwpmsText); }