SHOW:
|
|
- or go back to the newest paste.
1 | var te = []; | |
2 | var curPage = 1; | |
3 | ||
4 | var nextPage = $(".pagination").children()[1]; | |
5 | var topN = 30; // CHANGE THIS IF YOU WANT MORE/LESS ENTRIES | |
6 | ||
7 | function populateEntries() { | |
8 | - | nextPage = $(".pagination").children()[7]; |
8 | + | nextPage = $(".pagination").children()[7]; |
9 | - | var entries = $("ul.ss_voting_entry_list").children(); |
9 | + | var entries = $("ul.ss_voting_entry_list").children(); |
10 | - | for (var index = 0; index < entries.length; index++) { |
10 | + | for (var index = 0; index < entries.length; index++) { |
11 | - | var entry = $(entries[index]); |
11 | + | var entry = $(entries[index]); |
12 | - | var name = entry.find(".entry_title").find("h4").html(); |
12 | + | var name = entry.find(".entry_title").find("h4").html(); |
13 | - | var count = entry.find(".entry_votes").find(".votes").html(); |
13 | + | var count = entry.find(".entry_votes").find(".votes").html(); |
14 | - | var pic = entry.find(".entry_photo").find("li").html(); |
14 | + | var pic = entry.find(".entry_photo").find("li").html(); |
15 | - | te.push({ |
15 | + | te.push({ |
16 | - | 'name': name, |
16 | + | 'name': name, |
17 | - | 'count': count, |
17 | + | 'count': count, |
18 | - | 'pic': pic |
18 | + | 'pic': pic |
19 | - | }); |
19 | + | }); |
20 | - | } |
20 | + | } |
21 | - | if (curPage < 6) { |
21 | + | if (curPage < 6) { |
22 | - | nextPage.click(); |
22 | + | nextPage.click(); |
23 | - | curPage++; |
23 | + | curPage++; |
24 | - | setTimeout(populateEntries,1000); |
24 | + | setTimeout(populateEntries,1000); |
25 | - | } else { |
25 | + | } else { |
26 | - | te.sort(function(a,b) { |
26 | + | te.sort(function(a,b) { |
27 | - | return b.count - a.count; |
27 | + | return b.count - a.count; |
28 | - | }); |
28 | + | }); |
29 | - | var newHTML = '<ol><div class="ss_box"><h2>'; |
29 | + | var newHTML = '<ol><div class="ss_box"><h2>'; |
30 | - | for (var top = 0; top < topN; top++) { |
30 | + | for (var top = 0; top < topN; top++) { |
31 | - | console.log((top+1) + ":" + te[top].name + ": " + te[top].count + ": " + te[top].pic ); |
31 | + | var thisName = te[top].name; |
32 | - | newHTML += "<li>" + te[top].pic + " #" + (top+1) + " (" + te[top].count + " votes) " + te[top].name + "</li>"; |
32 | + | var thisID = thisName.substring(1,thisName.indexOf(']')); |
33 | - | }; |
33 | + | console.log((top+1) + ":" + thisName + ": " + te[top].count + ": " + te[top].pic ); |
34 | - | newHTML += "</h2></div></ol>"; |
34 | + | newHTML += "<li>" + '<a target="_blank" href="http://puzzledragonx.com/en/monster.asp?n=' + thisID + '">' + te[top].pic + "</a> #" + (top+1) + " (" + te[top].count + " votes) " + te[top].name + "</li>"; |
35 | - | $('#wrapper').html(newHTML); |
35 | + | }; |
36 | - | $('img').css('maxWidth', 60); |
36 | + | newHTML += "</h2></div></ol>"; |
37 | - | } |
37 | + | $('#wrapper').html(newHTML); |
38 | $('img').css('maxWidth', 60); | |
39 | } | |
40 | } | |
41 | ||
42 | nextPage.click(); | |
43 | setTimeout(populateEntries,1000); |