Jump to content

MediaWiki:Common.js

From Continuum Universes Wiki
Revision as of 15:15, 3 March 2025 by Cdjensen94 (talk | contribs)

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.
mw.loader.load('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js');
mw.loader.load('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.css', 'text/css');
mw.loader.load('https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.css', 'text/css');
mw.loader.load('/extensions/JavascriptSlideshow/js/slideshow.js');



$(document).ready(function() {
    var counter = 1;

    $('.slideshow').each(function() {
        var $this = $(this);
        if (!$this.attr('id')) {
            // Assign an auto id if missing
            var newId = 'slideshow-auto-' + (counter++);
            $this.attr('id', newId);

            // Add the missing spacer
            if ($('#' + newId + '-spacer').length === 0) {
                $('<div>')
                    .attr('id', newId + '-spacer')
                    .insertAfter($this);
            }

            // Force JavascriptSlideshow to initialize this slideshow
            startSlideshow(newId);
        }
    });
});