MediaWiki:Common.js

From PotterCraft MC Wiki
Revision as of 01:33, 23 August 2026 by Curtis73 (talk | contribs) (Updated page content)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* ==========================================================================
   PotterCraft Wiki — Site-Wide JavaScript
   ========================================================================== */

$( function() {
    // Direct Visual Editor Page Creation
    $( document ).on( 'click', '.create-page-trigger a, a.create-page-trigger', function( e ) {
        e.preventDefault();
        var title = prompt( 'Enter the title of the article you would like to create:' );
        if ( title && title.trim().length > 0 ) {
            var formatted = title.trim().replace( /\s+/g, '_' );
            window.location.href = mw.util.getUrl( formatted, { veaction: 'edit' } );
        }
    } );
} );