User:Plasticspork/spork.js

// SporkSpork function SporkSpork { document.forms.editform.wpSummary.value = "Wikify";

var txt = document.forms.editform.wpTextbox1;

txt.value = txt.value.replace(/\|[ ]*(Position|Name|Team|Played|Wins|Loss|GB|Home|Person|ERA|HR|Losses|Saves|AVG|Award|RBI|Win[ ]*%)/gim, '! $1'); txt.value = txt.value.replace(/(\|-[ ]*[\r\n])\|[ ]*([^'\r\n]*)[ ]*([\r\n]\|-)/gim, '$1|+ $2$3'); document.forms.editform.wpMinoredit.checked = true; document.forms.editform.wpDiff.click; // document.forms.editform.wpPreview.click; // document.forms.editform.wpSave.click; } //Allows URI to be properly decoded for view mode (see WP:AutoEd) function SporkSpork_QueryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } } return null; }

$(function { if( SporkSpork_QueryString('SporkSpork1') ) {  SporkSpork; } if (document.forms.editform) {  mw.util.addPortletLink('p-views', 'javascript:SporkSpork', 'Spork', 'ca-sporkspork', 'Spork', 'z', document.getElementById('ca-history')); } else if ( (wgAction == "view") && wgIsArticle) {   var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit';   mw.util.addPortletLink('p-views', url + '&SporkSpork1=true', 'Spork', 'ca-sporkspork', 'Spork', 'z', document.getElementById('ca-history')); } });