MediaWiki: Common.js

De WikiAjuda
Revisão de 16h31min de 9 de maio de 2020 por Anton (discussão | contribs)
Ir para: navegação, pesquisa

Nota: Após salvar, você pode ter que limpar o "cache" do seu navegador para ver as alterações.

  • Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
  • Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
  • Internet Explorer: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
  • Opera: Vá para Menu → Configurações (Opera → Preferencias no Mac) e depois para Privacidade e Segurança → Limpar dados de navegação → Imagens e arquivos em cache.
$(document).ready(function () {
    $(window).on("resize", function (e) {
        checkScreenSize();
    });

    checkScreenSize();

    if(mw.config.get( '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');
}