MediaWiki:Common.js: Difference between revisions
(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...") |
No edit summary |
||
(23 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/ | // Initialize PhotoSwipe | ||
mw.loader.using(['ext.photoSwipe'], function() { | |||
var config = mw.config.get('wgPhotoSwipeConfig'); | |||
mw.loader.using([' | if (!config) { | ||
// Default configuration if none exists | |||
// | config = { | ||
mode: 'recommended', | |||
options: { | |||
gallery: 'table.gallery', | |||
' | children: 'a.img', | ||
' | thumbSelector: 'a.img', | ||
' | allowPanToNext: false, | ||
wheelToZoom: true | |||
} | |||
}; | |||
mw.config.set('wgPhotoSwipeConfig', config); | |||
} | |||
}); | |||
} | |||
}); | }); |
Latest revision as of 19:05, 28 October 2024
// Initialize PhotoSwipe
mw.loader.using(['ext.photoSwipe'], function() {
var config = mw.config.get('wgPhotoSwipeConfig');
if (!config) {
// Default configuration if none exists
config = {
mode: 'recommended',
options: {
gallery: 'table.gallery',
children: 'a.img',
thumbSelector: 'a.img',
allowPanToNext: false,
wheelToZoom: true
}
};
mw.config.set('wgPhotoSwipeConfig', config);
}
});