Difference between revisions of "MediaWiki:Common.js"

From LQ's wiki
Jump to: navigation, search
Line 12: Line 12:
 
     printButton.click(function() {
 
     printButton.click(function() {
 
         if(isPrintMode === true) {
 
         if(isPrintMode === true) {
             printButton.html('Print preview');
+
             printButton.html('Preview');
 
             printButton.removeClass('print-mode');
 
             printButton.removeClass('print-mode');
 
             body.removeClass(CLASS);
 
             body.removeClass(CLASS);
 
             isPrintMode = false;
 
             isPrintMode = false;
 
         } else {
 
         } else {
             printButton.html('Edit mode');
+
             printButton.html('Edit');
 
             printButton.addClass('print-mode');
 
             printButton.addClass('print-mode');
 
             body.addClass(CLASS);
 
             body.addClass(CLASS);

Revision as of 14:46, 23 January 2014

/* Any JavaScript here will be loaded for all users on every page load. */
 
(function() {
 
    var CLASS = 'custom-print';
    var isPrintMode = false;
    var printButton = $('<span class="custom-print-toggle">Normal</span>');
    var body = $('body');
 
    $('#firstHeading').append(printButton);
 
    printButton.click(function() {
        if(isPrintMode === true) {
            printButton.html('Preview');
            printButton.removeClass('print-mode');
            body.removeClass(CLASS);
            isPrintMode = false;
        } else {
            printButton.html('Edit');
            printButton.addClass('print-mode');
            body.addClass(CLASS);
            isPrintMode = true;
        }
 
    });
 
}());