MediaWiki:Common.js

From Mor Afgin Website
Revision as of 16:20, 21 October 2024 by Mor Afgin (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: // Load Fancybox from CDN mw.loader.using(['jquery', 'mediawiki.util'], function () { $.getScript('https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js', function () { // Initialize Fancybox on all images with class 'fancybox' $('a.image').attr('data-fancybox', 'gallery').fancybox({ buttons: [ 'zoom', 's...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

// Load Fancybox from CDN
mw.loader.using(['jquery', 'mediawiki.util'], function () {
    $.getScript('https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js', function () {
        // Initialize Fancybox on all images with class 'fancybox'
        $('a.image').attr('data-fancybox', 'gallery').fancybox({
            buttons: [
                'zoom',
                'slideShow',
                'fullScreen',
                'thumbs',
                'close'
            ],
            protect: true, // Prevents image download by right-click
            loop: true,    // Allows cycling through images
            background: 'rgba(255, 255, 255, 0.9)' // White background
        });
    });
});