The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Ranking Table

View previous topic View next topic Go down

Ranking Table

Post by Dex♥ on December 2nd 2012, 5:00 am

Hey, I'm interested in getting a ranking table that you can use to collect and rank information collected from a div.

I need something similar to this: http://www.duelacademy.net/h23-da-league-s2
but not as complex.

the url for my forum is http://www.toonworldacademy.net

Dex♥
Forumember

Posts : 138
Reputation : 6
Language : Calgary

http://www.toonworldacademy.net

Back to top Go down

Re: Ranking Table

Post by Dex♥ on December 2nd 2012, 7:56 am

Rideem3 wrote:This requires an external server. Wink

That's not how the person at Duelacademy did it.

Dex♥
Forumember

Posts : 138
Reputation : 6
Language : Calgary

http://www.toonworldacademy.net

Back to top Go down

Re: Ranking Table

Post by Kaizer Lee on December 2nd 2012, 9:52 am

Well, since you're the owner, the thing suggested to be done by Amy could be done by you since the difference between you and her is that she's just an ordinary admin while you're the owner of your own, please refer to this topic:

http://help.forumotion.com/t103586-how-to-get-certain-custom-profile-field-value-from-all-members#674827

Kaizer Lee
Active Poster

Female Posts : 1064
Reputation : 54
Language : English, Tagalog, Spanish and Chinese
Location : Philippines

http://www.medievalchaos.net/forum

Back to top Go down

Re: Ranking Table

Post by Dex♥ on December 4th 2012, 2:26 pm

What about bubblesort?
I know little about javascript, this is why I'm having problems.

Code:


function bubbleSort(a)
{
    var swapped;
    do {
        swapped = false;
        for (var i=0; i < a.length-1; i++) {
            if (eval(a[i][5]) < eval(a[i+1][5])) {
                var temp = a[i];
                a[i] = a[i+1];
                a[i+1] = temp;
                swapped = true;
            }
         if (eval(a[i][5]) == eval(a[i+1][5])) {
            if (eval(a[i][3]) > eval(a[i+1][3])) {
               var temp = a[i];
               a[i] = a[i+1];
               a[i+1] = temp;
               swapped = true;
            }
            }
        }
    } while (swapped);
}

function insertpodloga(){

document.getElementById('loading').style.display='none';

var myIFrame= document.getElementById('podloga').contentWindow.document.getElementById('rankings').innerHTML;
var lista=new Array();
var konacnalista= new Array();
lista= myIFrame.split("<br>");
var i=0;
for(i=0; i<lista.length-1;i++){
konacnalista.push(lista[i].split(","));
}

konacnalista.splice(0,1);

for(var j=0; j<konacnalista.length;j++){
konacnalista[j][3]=eval(konacnalista[j][1])+eval(konacnalista[j][2]);
var pts=eval(konacnalista[j][1])-eval(konacnalista[j][2]);
konacnalista[j][5]=pts;
if(pts<0){pts=0;}
konacnalista[j][4]=pts;
}
bubbleSort(konacnalista);

row=new Array();
cell=new Array();

row_num=konacnalista.length; //edit this value to suit
cell_num=6; //edit this value to suit

tab=document.createElement('table');
tab.setAttribute('id','rounded-corner');

tbo=document.createElement('tbody');

rownula_naslov0=document.createElement('tr');
rownula_naslov0.setAttribute('style', 'font-weight:bold; font-size:20px; text-align:center; color:white;');
cellnula0_naslov0=document.createElement('td');
contnula_naslov0=document.createTextNode("DA LEAGUE - SEASON 7");
cellnula0_naslov0.setAttribute('colspan','6');
cellnula0_naslov0.setAttribute('style', 'background: #003568; color: #141414;');
cellnula0_naslov0.appendChild(contnula_naslov0);
rownula_naslov0.appendChild(cellnula0_naslov0);

rownula=document.createElement('tr');
rownula.setAttribute('style', 'font-weight:bold');

cellnula0=document.createElement('td');
contnula=document.createTextNode("NO.");
cellnula0.setAttribute('style', 'background: #003568; color: #141414;');
cellnula0.appendChild(contnula);
rownula.appendChild(cellnula0);

cellnula1=document.createElement('td');
contnula1=document.createTextNode("DUELIST");
cellnula1.setAttribute('style', 'background: #003568; color: #141414;');
cellnula1.appendChild(contnula1);
rownula.appendChild(cellnula1);

cellnula2=document.createElement('td');
contnula2=document.createTextNode("WON");
cellnula2.setAttribute('style', 'background: #003568; color: #141414;');
cellnula2.appendChild(contnula2);
rownula.appendChild(cellnula2);

cellnula3=document.createElement('td');
contnula3=document.createTextNode("LOST");
cellnula3.setAttribute('style', 'background: #003568; color: #141414;');
cellnula3.appendChild(contnula3);
rownula.appendChild(cellnula3);

cellnula4=document.createElement('td');
contnula4=document.createTextNode("PLAYED");
cellnula4.setAttribute('style', 'background: #003568; color: #141414;');
cellnula4.appendChild(contnula4);
rownula.appendChild(cellnula4);

cellnula5=document.createElement('td');
contnula5=document.createTextNode("PTS");
cellnula5.setAttribute('style', 'background: #003568; color: #FFFFFF;');
cellnula5.appendChild(contnula5);
rownula.appendChild(cellnula5);

tbo.appendChild(rownula_naslov0);
tbo.appendChild(rownula);

for(c=0;c<row_num;c++){
row[c]=document.createElement('tr');
cell[0]=document.createElement('td');
cont2=document.createTextNode(c+1);
cell[0].appendChild(cont2);
row[c].appendChild(cell[0]);
for(k=1;k<cell_num;k++) {
cell[k]=document.createElement('td');
cont=document.createTextNode(konacnalista[c][k-1]);
cell[k].appendChild(cont);
row[c].appendChild(cell[k]);
}
tbo.appendChild(row[c]);
}

tab.appendChild(tbo);
document.getElementById('mytable').appendChild(tab);
}

That is the jscript from Duel Academy.

Dex♥
Forumember

Posts : 138
Reputation : 6
Language : Calgary

http://www.toonworldacademy.net

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum