User:WOSlinker/comment listings.js

function check_queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }   return null; }

if(mw.config.get('wgNamespaceNumber') == 2) { $( function flagEditButton {       mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'edit',commentlistings:true}), 'comment listings', 'p-commentlistings', 'commentlistings edit'); }) } if(mw.config.get('wgAction') == 'edit' && check_queryString('commentlistings') == 'true') { var myContent = document.getElementById('wpTextbox1').value; myContent = myContent.replace(/(hours|directions|price|checkin|checkout|content)\=([^\|\{\}]*) \|/g,'$1\= \|'); myContent = myContent.replace(/(hours|directions|price|checkin|checkout|content)\=([^\|\{\}]*)\n\|/g,'$1\=\n\|'); myContent = myContent.replace(/(hours|directions|price|checkin|checkout|content)\=([^\|\{\}]*)\}\}/g,'$1\=\n\}\}'); myContent = myContent.replace(/\<\!\-\- *\-\-\>/g,'');

if (myContent != document.getElementById('wpTextbox1').value) { document.getElementById('wpTextbox1').value=myContent; document.getElementById('wpSummary').value='comment out listings for translation'; } }