User:Misza13/Scripts/View source
From Wikipedia, the free encyclopedia
< User:Misza13 | Scripts
This module, when added to your monobook.js will create a new button called [view source] to the left of the [edit this page] button (unless you're already editing a page or the page is protected). Technically, it takes you to editing the page, but removes the interface (edit summary box, minor edit and watch checkboxes, save/preview/show changes buttons) below the editing box. This will prevent you from accidentaly saving the page if you were just playing with the content.
//
// VIEW SOURCE addOnloadHook(function () { if (location.href.indexOf('viewsource=1') != -1) { sl = document.getElementById('wpSummaryLabel'); sl.parentNode.removeChild(sl); ed = document.getElementById('wpSummary').parentNode; ed.parentNode.removeChild(ed); return; } editbutton = document.getElementById('ca-edit'); if (editbutton && location.href.indexOf('action=edit')==-1) { editlink = editbutton.getElementsByTagName('a')[0].href + '&viewsource=1'; tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; na = document.createElement('a'); na.href = editlink; na.appendChild(document.createTextNode('view source')); li = document.createElement('li'); li.id = 'ca-viewsource'; li.appendChild(na); tabs.insertBefore(li,editbutton); } }); //