User:WOSlinker/common.js

function hlist_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 'hlist edit' tab if(mw.config.get('wgArticleId') != 0 ) { $( function hlistEditButton {       mw.util.addPortletLink('p-cactions', mw.util.getUrl(null,{action:'edit',hlist:true}), 'hlist', 'p-hlist', 'hlist edit');   } )}

if(mw.config.get('wgAction') == 'edit' && hlist_queryString('hlist') == 'true') { $(function hlist {       var myContent = document.getElementById('wpTextbox1').value;

myContent = myContent.replace(/\{\{·\}\} *\n/gi,'\n* '); myContent = myContent.replace(/\]\] *\{\{·\}\} *\[\[/gi,']]\n* [[');

myContent = myContent.replace(/(list\d* *\= *)\n\\n/gi,'$1\n* '); myContent = myContent.replace(/\n\<\/div\>\n/gi,'\n'); if(document.getElementById('wpTextbox1').value != myContent) { document.getElementById('wpTextbox1').value=myContent; document.getElementById('wpSummary').value='use hlist'; }   } )}