Misplaced Pages

MediaWiki:Gadget-oldeditor.js: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content added
Revision as of 00:31, 4 July 2013 view sourceJalexander-WMF (talk | contribs)Extended confirmed users1,284 edits update← Previous edit Revision as of 00:58, 4 July 2013 view source Krinkle (talk | contribs)Extended confirmed users, Pending changes reviewers, Rollbackers5,481 editsm Clean upNext edit →
Line 9: Line 9:


/*global $, mw */ /*global $, mw */
$(document).ready(function(){ $(document).ready(function (){
var state = mw.loader.getState('ext.visualEditor.viewPageTarget.init'); var state = mw.loader.getState('ext.visualEditor.viewPageTarget.init');
if(state && state != 'registered') { // 'registered' actually means 'not loading' if (state != 'registered') { // 'registered' actually means 'not loading'
mw.loader.using('ext.visualEditor.viewPageTarget.init', function() { mw.loader.using('ext.visualEditor.viewPageTarget.init', function () {
// kill the tab // Kill the tab
var caEdit = $('#ca-edit a'); var caEdit = $('#ca-edit a');
$('#ca-editsource a') $('#ca-editsource a')
Line 21: Line 21:
$('#ca-editsource').attr('id', 'ca-edit'); $('#ca-editsource').attr('id', 'ca-edit');


// kill the section edit links // Kill the section edit links
$('.mw-editsection-link-secondary') $('.mw-editsection-link-secondary')
.text( $('.mw-editsection-link-primary').eq(0).text() ) .text( $('.mw-editsection-link-primary').eq(0).text() )

Revision as of 00:58, 4 July 2013

// This script fully hides the VisualEditor tool, leaving it's functionality inaccessible.
// It does not entirely undo the changes, but does restore old look and user-facing behavior.

// It's bound to break on the slightest changes to VE itself, and might not cooperate
// with other scripts which poke around the article tabs or section edit links.

// Use at your own risk, and pester the VE team to restore the option to disable VisualEditor
// if you believe it is necessary.

/*global $, mw */
$(document).ready(function (){
	var state = mw.loader.getState('ext.visualEditor.viewPageTarget.init');
	if (state != 'registered') { // 'registered' actually means 'not loading'
		mw.loader.using('ext.visualEditor.viewPageTarget.init', function () {
			// Kill the tab
			var caEdit = $('#ca-edit a');
			$('#ca-editsource a')
				.text(caEdit.text())
				.attr('title', caEdit.attr('title'));
			$('#ca-edit').remove();
			$('#ca-editsource').attr('id', 'ca-edit');

			// Kill the section edit links
			$('.mw-editsection-link-secondary')
				.text( $('.mw-editsection-link-primary').eq(0).text() )
				.off('focus blur');
			$('.mw-editsection-divider, .mw-editsection-link-primary').remove();
			$('.mw-editsection-bracket:not(:first-of-type):not(:last-of-type)').remove();
			$('.mw-editsection-bracket, .mw-editsection-link-secondary').css('visibility', '');
			$('h1, h2, h3, h4, h5, h6').off('mouseenter mouseleave');
		});
	}
});