MediaWiki:ToggleDebugMode/code.js

/* * Toggle debug mode using a link in the toolbar * * @author Cqm  * @version 0.1 * * @todo support monobook */

/*global jQuery, mediaWiki */

/*jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, es3:false, forin:true, immed:true, indent:4, latedef:true, newcap:true, noarg:true, noempty:true, nonew:true, plusplus:true, quotmark:single, undef:true, unused:true, strict:true, trailing:true, browser:true, devel:false, jquery:true, onevar:true

'use strict';
 * (function ($, mw) {

/*    *     */    var conf = mw.config.get([        'debug'    ]);

/*    *     */    function init { var href = mw.util.wikiGetlink + location.search;

if (conf.debug) { href += location.hash; } else { href = (location.search ? '&' : '?') + 'debug=1' + location.hash; }

$('#WikiaBarWrapper .tools').append(           $('')                .addClass('dev-debugmode')                .append( $('') .attr({                           href: href,                            id: 'dev-debugmode-toggle'                        }) .css('cursor', 'pointer') .text(                           conf.debug ?                                 'Disable debug mode' :                                'Enable debug mode'                        ) )       );    }

window.dev = window.dev || {}; window.dev.debugmode = debugmode;

$(init);

}(jQuery, mediaWiki));