User:Þjarkur/Permalink to section.js

/* Adds a link to copy a permalink pointing to a section right after the "[ edit | edit source ]" buttons (function {  if(mw.config.get('wgNamespaceNumber') === 0) return; // Ignore in article space  var revision = mw.config.get('wgRevisionId')  $('.mw-headline').each(function{ var anchor = $(this).attr('id') var URL = 'Special:Permalink/'+revision+'#'+anchor var link = 'permalink' if($(this).next.hasClass('mw-editsection')){ $(this).next.children.last.before('  | '+link) } else { $(this).parent.append(' [ '+link+' ]  ') } }) })