function lint_queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.___location)) {
try {
return decodeURI(matches[1]);
} catch (e) { }
}
return null;
}
//Add a 'tabletidy edit' tab
if(mw.config.get('wgArticleId') != 0 ) {
$( function tabletidyEditButton() {
mw.util.addPortletLink('p-cactions',
mw.util.getUrl(null,{action:'edit',tabletidyedit:true}),
'tabletidy',
'p-lint',
'tabletidy edit');
}
)}
if(mw.config.get('wgAction') == 'edit' && lint_queryString('tabletidyedit') == 'true') {
$(function tabletidy() {
var myContent = document.getElementById('wpTextbox1').value;
/*
myContent = myContent.replace(/\{\| *border\=\"\d\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *border\=\"\d\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *border\=\"\d\" *cellpadding\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *border\=\"\d\" *cellspacing\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellpadding\=\"\d*\" *cellspacing\=\"\d*\" *border\=\"\d\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellspacing\=\"\d*\" *cellpadding\=\"\d*\" *border\=\"\d\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellpadding\=\"\d*\" *cellspacing\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellspacing\=\"\d*\" *cellpadding\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellspacing\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellpadding\=\"\d*\" *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable sortable\" border\=\"\d\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\"\d\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\"\d\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\"\d\" *cellpadding\=\"\d*\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\"\d\" *cellspacing\=\"\d*\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\" *border\=\"\d\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\" *border\=\"\d\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\"/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\"\d\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\"\d\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\"\d\" *cellpadding\=\"\d*\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\"\d\" *cellspacing\=\"\d*\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\" *border\=\"\d\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\" *border\=\"\d\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellpadding\=\"\d*\" *cellspacing\=\"\d*\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellspacing\=\"\d*\" *cellpadding\=\"\d*\"/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *border\=\d *cellpadding\=\d* *cellspacing\=\d* *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *border\=\d *cellspacing\=\d* *cellpadding\=\d* *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellspacing\=\d* *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *cellpadding\=\d* *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\d *cellpadding\=\d* *cellspacing\=\d*/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\d *cellspacing\=\d* *cellpadding\=\d*/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\d *cellpadding\=\d*/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *border\=\d *cellspacing\=\d*/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellpadding\=\d* *cellspacing\=\d* *border\=\d/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellspacing\=\d* *cellpadding\=\d* *border\=\d/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellpadding\=\d* *cellspacing\=\d*/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable sortable\" *cellspacing\=\d* *cellpadding\=\d*/g,'{| class="wikitable sortable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\"\d\" *cellpadding\=\d* *cellspacing\=\d*/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\d *cellpadding\=\d* *cellspacing\=\d*/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\d *cellspacing\=\d* *cellpadding\=\d*/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\d *cellpadding\=\d*/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *border\=\d *cellspacing\=\d*/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellpadding\=\d* *cellspacing\=\d* *border\=\d/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellspacing\=\d* *cellpadding\=\d* *border\=\d/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellpadding\=\d* *cellspacing\=\d*/g,'{| class="wikitable"');
myContent = myContent.replace(/\{\| *class\=\"wikitable\" *cellspacing\=\d* *cellpadding\=\d*/g,'{| class="wikitable"');
*/
myContent = myContent.replace(/\{\| *(border|cellpadding|cellspacing)\=\"?\d*\"? *(border|cellpadding|cellspacing)\=\"?\d*\"? *(border|cellpadding|cellspacing)\=\"?\d*\"? *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *(border|cellpadding|cellspacing)\=\"?\d*\"? *(border|cellpadding|cellspacing)\=\"?\d*\"? *class\=\"wikitable/g,'{| class="wikitable');
myContent = myContent.replace(/\{\| *(border|cellpadding|cellspacing)\=\"?\d*\"? *class\=\"wikitable/g,'{| class="wikitable');
if(document.getElementById('wpTextbox1').value != myContent) {
if(document.getElementById('wpTextbox1').value != myContent) {
document.getElementById('wpTextbox1').value=myContent;
document.getElementById('wpSummary').value='remove un-needed options from tables';
document.getElementById('wpMinoredit').checked = true;
}
}
}
)}