User:Kaganer/monobook.js

//**********************************************// // This will add an [edit] link // at the top of all pages except preview pages //**********************************************// //[edit] zero section // by ru:MediaWiki:Common.js

function editZeroSection{ var body = document.getElementById('bodyContent') if (!body || window.disable_zero_section) return var h2s = body.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 zero = span.cloneNode(true) body.insertBefore(zero, body.firstChild) var a = zero.getElementsByTagName('a')[0] a.title = a.title.replace(/:.*$/,': 0') a.setAttribute('href', a.href.replace(/&section=1/,'&section=0')) }