Mudanças entre as edições de "MediaWiki: Common.js"
De WikiAjuda
Linha 5: | Linha 5: | ||
checkScreenSize(); | checkScreenSize(); | ||
+ | |||
+ | if(mw.config(wgIsMainPage) === true) mainPageLayout(); | ||
+ | |||
}); | }); | ||
Linha 30: | Linha 33: | ||
function mainPageLayout() { | function mainPageLayout() { | ||
− | |||
$('.sidebar-wrapper').remove(); | $('.sidebar-wrapper').remove(); | ||
$('role=["main"]').toggleClass('col-md-9 col-md-12'); | $('role=["main"]').toggleClass('col-md-9 col-md-12'); | ||
− | |||
} | } |
Edição das 15h28min de 9 de maio de 2020
$(document).ready(function () {
$(window).on("resize", function (e) {
checkScreenSize();
});
checkScreenSize();
if(mw.config(wgIsMainPage) === true) mainPageLayout();
});
function checkScreenSize(){
var newWindowWidth = $(window).innerWidth();
// <!-- adjust mobile screen width here -->
if (newWindowWidth < 481) {
$('.newsection img').each(function() {
$(this).removeClass().addClass('img-responsive center-block').css('visibility','visible').fadeIn();
});
} else {
$('.newsection img').each(function() {
var width = $(this).width();
var height = $(this).height();
var ratio = height / width;
// <!-- adjust mobile screenshot ratio -->
if(ratio > 1.5) {
$(this).removeClass().addClass('img-mobile center-block').css('visibility','visible').fadeIn();
} else {
$(this).removeClass().addClass('img-responsive center-block').css('visibility','visible').fadeIn();
}
});
}
}
function mainPageLayout() {
$('.sidebar-wrapper').remove();
$('role=["main"]').toggleClass('col-md-9 col-md-12');
}