User:DannyS712 test/view.js

// VIEW SOURCE $(function {  if (location.href.indexOf('viewsource=1') !== -1) {  	var elements = ['wpSummaryLabel', 'wpSummary', 'mw-editpage-minoredit', 'mw-editpage-watch', 'editpage-copywarn', 'wpSaveWidget', 'wpPreviewWidget', 'wpDiffWidget'];    //sl = document.getElementById('wpSummaryLabel'); sl.parentNode.removeChild(sl);    //ed = document.getElementById('wpSummary').parentNode; ed.parentNode.removeChild(ed);    //ed = document.getElementById('wpSummary').parentNode.parentNode; ed.parentNode.removeChild(ed);    elements.forEach(function (item){ selected = document.getElementById(item); selected.parentNode.removeChild(selected); });   return;  }  editbutton = document.getElementById('ca-edit');  if (editbutton && location.href.indexOf('action=edit') === -1 && location.href.indexOf('&veaction=editsource') === -1) {  	var to_link = mw.config.get( 'wgPageName' ).replace(/_/g, ' ');  	editlink = mw.config.get( 'wgArticlePath' ).replace('$1', to_link) + '?action=submit&viewsource=1';    na = document.createElement('a');    na.href = editlink; na.appendChild(document.createTextNode('View source'));    s = document.createElement('span');    s.appendChild( na );    li = document.createElement('li'); li.id = 'ca-viewsource'; $(li).addClass('collapsible'); li.appendChild(s);    views = document.getElementById('p-views').getElementsByTagName('ul')[0];    views.insertBefore(li,editbutton);  } });