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

De RubinOT Wiki
Sem resumo de edição
Etiqueta: Revertido
Sem resumo de edição
Etiqueta: Desfazer
Linha 27: Linha 27:


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


Linha 79: Linha 63:


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


function fetchData1() {
function fetchData1() {

Edição das 22h05min de 6 de junho de 2024

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);
}


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);
}

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);
}