MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
1,425 bytes added ,  20:38, 13 October 2020
add Caves of Qud image-to-gif swapper
imported>Kittymmeow
No edit summary
(add Caves of Qud image-to-gif swapper)
Line 36: Line 36:
$( this ).find( '.animated' ).toggleClass( 'animated-paused', e.type === 'mouseenter' );
$( this ).find( '.animated' ).toggleClass( 'animated-paused', e.type === 'mouseenter' );
} );
} );
/************************************
/* Qud infobox image-to-gif swapper *
/************************************/
// Author:  egocarib
// Date:    2020-Oct
// License: CC-BY 3.0
// Designed for use in infoboxes on the Caves of Qud wiki.
// Powers an infobox template (Template:Infobox_image_and_gif) that
// allows users to swap from a static image to preview an animated gif
var qudInfoboxImageToggler = qudInfoboxImageToggler || {
  initialize: function () {
    $(".qud-toggler > .qud-toggler-initial").show();
    $(".qud-toggler > .qud-toggler-button").show();
    $(".qud-toggler > .qud-toggler-final").hide();
    $(".qud-toggler > .qud-toggler-button").click(function () {
      window.qudInfoboxImageToggler.toggle();
    });
    $(".qud-html-details .qud-html-summary").click(function () {
      window.qudInfoboxImageToggler.summaryClick();
    });
  },
  toggle: function () {
    $(".qud-toggler > .qud-toggler-initial").hide();
    $(".qud-toggler > .qud-toggler-button").hide();
    $(".qud-toggler > .qud-toggler-final").show();
  },
  summaryClick: function () {
    $(".qud-html-details .qud-html-summary").toggleClass(
      "qud-html-summary-open"
    );
  }
};
window.qudInfoboxImageToggler = qudInfoboxImageToggler;
$(document).ready(qudInfoboxImageToggler.initialize);
/****************************************
/* End Qud infobox image-to-gif swapper *
/****************************************/

Navigation menu