User:WOSlinker/issn.js

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

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

myContent = myContent.replace(/\|id\=\{\{ISSN\|(\d\d\d\d\d\d\d[\dX])\}\}/g,'|issn=$1'); myContent = myContent.replace(/\|id\=\{\{ISSN\|(\d\d\d\d\-\d\d\d[\dX])\}\}/g,'|issn=$1');

if(document.getElementById('wpTextbox1').value != myContent) { document.getElementById('wpTextbox1').value=myContent; document.getElementById('wpSummary').value='use issn= instead of id= in cite'; }   } )}