13,782
edits
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all skins on both desktop and mobile */ | /* Any JavaScript here will be loaded for all skins on both desktop and mobile */ | ||
/* Add autocollapse support to mw-collapsible */ | /* Add autocollapse support to mw-collapsible */ | ||
Line 19: | Line 11: | ||
} | } | ||
mw.hook('wikipage.collapsibleContent').add(mwCollapsibleSetup); | mw.hook('wikipage.collapsibleContent').add(mwCollapsibleSetup); | ||
/* Gallery videos */ | |||
$(function() { | |||
$('.gallery').each(function(i, gallery) { | |||
var videos = $(gallery).find('.gallerybox video'); | |||
if (!videos.length) | |||
return; | |||
var boxes = $(gallery).find('.gallerybox'); | |||
var onlyVideos = videos.length == boxes.length ? true : false; | |||
videos.each(function(ii, video) { | |||
if (!onlyVideos) | |||
$(video).css('max-height', 0); | |||
$(video).parent().css({'width': '100%', 'min-width': '125px', 'max-width': 'calc(100% - 30px)', 'margin': 'auto'}); | |||
}); | |||
var timeOut = onlyVideos ? 500 : 0; | |||
setTimeout(function() { | |||
var height = 0; | |||
$(gallery).find('.gallerybox .thumb').each(function(ii, thumb) { | |||
if ($(thumb).innerHeight() > height) | |||
height = $(thumb).innerHeight(); | |||
}); | |||
videos.each(function(ii, video) { | |||
maxHeight = height - 30; | |||
$(video).css('max-height', maxHeight); | |||
$(video).parent().parent().css({'height': height, 'display': 'flex'}); | |||
}); | |||
}, timeOut); | |||
}); | |||
}); | |||
/* SocialProfile: Point social talk tabs to user talk */ | /* SocialProfile: Point social talk tabs to user talk */ |