User:Lyrithya/edittop.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes.
- Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
- Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
- Opera, Konqueror and Safari users can just click the Reload button.
- Chrome: press Ctrl+F5 or Shift+F5
if ( document.getElementsByClassName('editsection') ) {
jQuery(document).ready(function() {
var h2s = document.getElementsByTagName( 'h2' );
var h2 = h2s[0];
if ( !h2 ) {
return;
}
if ( h2.parentNode.id == 'toctitle' ) {
h2 = h2s[1];
}
if ( !h2 ) {
return;
}
var span = h2.firstChild;
if ( !span || span.className != 'editsection' ) {
return;
}
var inna = document.createElement('a');
inna.href = wgServer + wgArticlePath.replace('$1', wgPageName) + '?action=edit§ion=0;
inna.appendChild(document.createTextNode('Edit'));
var outa = document.createElement('span');
outa.className = 'editsection';
if ( document.getElementById( 'featured-star' ) ) {
outa.style.marginRight = '25px';
}
var parent = document.getElementsByTagName( 'h1' )[0];
parent.insertBefore( outa, parent.firstChild );
});
}