MediaWiki:Timeless.js: mudanças entre as edições

De RubinOT Wiki
Sem resumo de edição
Sem resumo de edição
Linha 1: Linha 1:
function adjustOverlayHeight() {
function adjustOverlayHeight() {
   var mwContent = document.getElementById('mw-content');
   var mwWrapper = document.getElementById('mw-wrapper');
   var bodyBefore = document.createElement('style');
   var bodyBefore = document.createElement('style');
   bodyBefore.innerHTML = `body::before { height: ${mwContent.offsetHeight}px; }`;
   bodyBefore.innerHTML = `body::before { height: ${mwWrapper.offsetHeight}px; }`;
   document.head.appendChild(bodyBefore);
   document.head.appendChild(bodyBefore);
}
}
Linha 25: Linha 25:
// Ajusta a altura quando a janela é redimensionada
// Ajusta a altura quando a janela é redimensionada
$(window).resize(adjustOverlayHeight);
$(window).resize(adjustOverlayHeight);


mw.loader.using('jquery', function() {
mw.loader.using('jquery', function() {

Edição das 03h51min de 27 de julho de 2024

function adjustOverlayHeight() {
  var mwWrapper = document.getElementById('mw-wrapper');
  var bodyBefore = document.createElement('style');
  bodyBefore.innerHTML = `body::before { height: ${mwWrapper.offsetHeight}px; }`;
  document.head.appendChild(bodyBefore);
}

function loadContent() {
  $.ajax({
    url: 'path/to/your/content.html', // Altere para o caminho do seu arquivo
    method: 'GET',
    success: function(data) {
      $('#mw-content').html(data);
      adjustOverlayHeight();
    },
    error: function(jqXHR, textStatus, errorThrown) {
      console.error('Error loading content:', textStatus, errorThrown);
    }
  });
}

// Carrega o conteúdo via AJAX quando a página carrega
$(document).ready(loadContent);

// Ajusta a altura quando a janela é redimensionada
$(window).resize(adjustOverlayHeight);

mw.loader.using('jquery', function() {
    $(document).ready(function() {
        console.log('Document is ready, calling fetchData...');
        fetchData();
        fetchData1();

    });
});

function fetchData() {
    console.log('fetchData function called');
    var url = 'https://rubinot.com.br/webservices/worlds.php';

    $.ajax({
        url: url,
        method: 'GET',
        dataType: 'json',
        success: function(data) {
            console.log(data); // Exibe o conteúdo no console
            insertPlayerWorlds(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.error('There has been a problem with your fetch operation:', textStatus, errorThrown);
        }
    });
}

function insertPlayerWorlds(worlds) {
    // Assuming you have specific container elements for each world
    $('#world1').text(worlds[0].players);
    $('#world2').text(worlds[1].players);
    $('#world3').text(worlds[2].players);
    $('#world4').text(worlds[3].playesr);
    $('#world5').text(worlds[4].playesr);
$('#world6').text(worlds[5].playesr);
}


mw.loader.using('jquery', function() {
    $(document).ready(function() {
        console.log('Document is ready, calling fetchData...');
        fetchData();
        fetchData1();
    });
});

function fetchData() {
    console.log('fetchData function called');
    var url = 'https://rubinot.com.br/webservices/worlds.php';

    $.ajax({
        url: url,
        method: 'GET',
        dataType: 'json',
        success: function(data) {
            console.log(data); // Exibe o conteúdo no console
            insertPlayerWorlds(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.error('There has been a problem with your fetch operation:', textStatus, errorThrown);
        }
    });
}

function insertPlayerWorlds(worlds) {
    // Assuming you have specific container elements for each world
    $('#world1').text(worlds[0].players);
    $('#world2').text(worlds[1].players);
    $('#world3').text(worlds[2].players);
    $('#world4').text(worlds[3].players);
    $('#world5').text(worlds[4].players);
$('#world6').text(worlds[5].players);
}

function fetchData1() {
    console.log('fetchData1 function called');
    var urla = 'https://rubinot.net/webservices/worlds.php';

    $.ajax({
        url: urla,
        method: 'GET',
        dataType: 'json',
        success: function(data) {
            console.log(data); // Exibe o conteúdo no console
            insertPlayerWorlds1(data);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.error('There has been a problem with your fetch operation:', textStatus, errorThrown);
        }
    });
}

function insertPlayerWorlds1(worlds) {
    // Assuming you have a specific container element for the second world data
    $('#worldgringo').text(worlds[0].players);
}