Help:Gadget-GallerySlideshow
This is the documentation for GallerySlideshow, a JavaScript gadget which can be enabled or disabled in your Preferences. The script itself is located at MediaWiki:Gadget-GallerySlideshow.js. |
If you need more help, please ask at the discussion page or at Commons:Help desk. Documentation: বাংলা ∙ Deutsch ∙ English ∙ español ∙ فارسی ∙ français ∙ မြန်မာဘာသာ ∙ português ∙ русский ∙ ไทย |
Gallery Slideshow is a gadget that provides JavaScript code to create a slideshow of the images within a category or in a gallery on a page in the Commons or (Gallery) namespaces. It is activated in your preferences by default.
Alternatively, you may continue to use the Media Viewer, to be set on Special:Preferences#mw-prefsection-rendering.
Keyboard navigation
- Space: next image
- End: last loaded image
- ←: previous image
- →: next image
- Break: play / pause (break) [Ctrl+C on Mac]
- Esc: hide slideshow (press again to show it)
URL parameters
URL-Parameter allows you to post links, which can start a customized slideshow.
Example of a URL's construction:
http://commons.wikimedia.org/wiki/Category:X?param1=value1&followingParam=value&followingParam=value
- List of parameters and possible values
gsAutoPlay
Possible values: 1 or 0 — automatically starts playing after opening the slideshow.gsDelay
Possible values: number >2500 — sets the delay to wait before loading a new image.gsDir
Possible values: asc, desc — (direction)- starts the slideshow from the beginning or end.gsContinue
Possible values: valid Key — starts the slideshow from this key.gsAutoStart
Possible values: 1 or 0 — automatically opens the slideshow after page-loading.gsReadFromScreen
Possible values: 1 or 0 — sorting like displayed on the page; only images in gallery-boxes; loads only visible images in categorieswithJS
Possible values: MediaWiki:Gadget-GallerySlideshow.js — load script code for the slideshow; this is not necessary if you have it enabled in your preferences.withCSS
Possible values: MediaWiki:Gadget-GallerySlideshow.css — load style code for the slideshow; this is not necessary if you have it enabled in your preferences.
Examples:
- Works for all users: Category:Featured images.
- Works for users with gadget activated only: Commons:Featured images of Flowers.
- Works for users with gadget activated only: Category:Featured images.
Custom settings
You can customize your slideshow in your common.js by adding the code below. Note that your settings can be overwritten by URL-parameters.
$(document).bind('slideshow', function(evt, st, x) {
if (!st || !x) return;
if ('starting' !== st) return;
// The following lines are just examples.
// You can remove a complete line to use the defaults or change the values
x.autoPlay = true; // same as gsAutoPlay but use only true or false
x.delay = 10000; // same as gsDelay
x.cmdir = 'desc'; // same as gsDir but use only 'asc' or 'desc', NOT 0 or 1
// number of days to save the position where you have left the slideshow
x.lastPositionExpiry = 1; // -1 to delete the cookie when you close your browser (session-cookie)
x.defaultTransitionDuration = 2000;
});
If you are a real hacker, you can search for var defaults = {
in MediaWiki:GallerySlideshow.js. There is a complete list of defaults you can customize.
If this is still not enough, GallerySlideshow fires a lot of events. Just search for $(document).triggerHandler('slideshow',
(also in MediaWiki:Gadget-GallerySlideshow.js) You can listen to them using the approach above.
Cookies
For convenience the slideshow stores some information in cookies:
- The image you've last seen.
- The delay you've last entered.
Cookies are often lost while logout or closing the browser. If so, don't blame me, look in your browser's settings.