MediaWiki:Mobile.js

A BÍBLIA, PELA PRÓPRIA BÍBLIA
Ir para navegação Ir para pesquisar

Nota: Após publicar, 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/Edge: PressioneCtrl enquanto clica Recarregar, ou Pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
/* Todo o JavaScript aqui será carregado para usuários do site mobile */




 mw.hook( 'wikipage.content' ).add( function ( $content ) {

    var $target = $content.find( 'blockquote' );


    if ( $target.length ) {

    
		
      $target.each(function( index ) {

          //Tornando as tags 'blockquote' colapsáveis.

          /* Encontra o endereço da base bíblica neste blockquote.
           * interface HTMLElement : Element { ...  [CEReactions] attribute
           * [LegacyNullToEmptyString] DOMString innerText; ...}
           * (ECMA-262 - 16a Ed - 2025 - 22.1.3.1e String.prototype.match ( regexp ))  */

          var texto_bq = $( this ).text();
          var padrao_base_bib = /\d?\s*[A-Za-záâãÊêéíõôóúç]+\s*(\d{1,3}:?[0-9-,;]*)+\s*-?\s*[A-Z]{3}/;
          var end_base_bib = texto_bq.match( padrao_base_bib )
          
          //Cria botão da base bíblica.
          var bt_base_biblica = $("<button class='mw-customtoggle-blockquote" + ( index + 1 ) + " botao_base_biblica'>" + end_base_bib[0] + "</button>");

          // Insere os atributos do blockquote
          $( this )
            .removeClass()
            .addClass( "mw-collapsible" )
            .addClass( "mw-collapsed" )
            .attr( "id", "mw-customcollapsible-blockquote" + ( index + 1 ) );

          // Insere o botão antes do blockquote.
          $( this ).before( bt_base_biblica );

      }); // 'Fim do .each(function( index )'



    // Incluindo evento (ícone no botão)

   
    $( document ).off('click', '.botao_base_biblica');
    
    
    $( document ).on('click', '.botao_base_biblica', function() {

     $( this ).toggleClass("active");
  
      /*
      if ( $( this ).next().css('display') === 'block') {

       $( this ).next().css('display', 'none');

      } else {

       $( this ).next().css('display', 'block');

      }

      */
    
    });
    

    //Incluindo os blockquotes no módulo makeCollapsible do ResourceLoader (core)
    var $botoes = $("button[class*='mw-customtoggle-blockquote']");
    var $colapsed = true;

    mw.loader.using( 'jquery.makeCollapsible' ).then( function () {
         $( 'blockquote' ).makeCollapsible($colapsed,$botoes );
    } );
             
  
    } /* Fim do  if ( $target.length ) */

    


   // Only perform some operations when it is #mw-content-text in the argument
    if ( $content.is( '#mw-content-text' ) ) {
    } // Fim do 'if ( $content.is( '#mw-content-text' ) )'

   


 }); //Fim de mw.hook( 'wikipage.content' )

$(function() {

 

});