MediaWiki:Gadget-Site.js

From Official Temtem Wiki
Jump to navigation Jump to search

In other languages: EspañolFrançais


CSS and Javascript changes must comply with the wiki design rules.


Note: After saving, 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)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* 
 * Any JavaScript here will be loaded for all users (both desktop and mobile) on every page load.
 * 
 * Desktop-only scripts should go in [[MediaWiki:Common.js]]
 * Mobile-only scripts should go in [[MediaWiki:Mobile.js]].
 */

( function() {
    "use strict";
    
    /* Keep variables in one namespace to prevent from creating new variable that may interfere with the global space */
    var ttw = window.ttw = {};
    
    /* Fired whenever wiki content is added. (#mw-content-text, live preview, load page, etc.) */
    mw.hook( "wikipage.content" ).add( function( $wikipageContent ) {
        /* Basic Dropdown */
        $( ".js-dropdown" ).click( function() {
            $( this ).toggleClass( "active" );
        });

        $( document ).click( function(e) {
            const $target = $(e.target);
            if (!$target.is('.js-dropdown') || $target.parents().is('.js-dropdown')) {
            $('.js-dropdown').removeClass( "active" );
            }
        });
        /* End Dropdown */
            
    })
    /* End wiki content hook */    

    /* Fires when DOM is ready */
    $( function() {
        
    });
    /* End of DOM */
    
}());