Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var quizIDs = '43',
- numRecords = '10',
- autoUpdate = true,
- reloadInterval = '3000';
- $(function(){
- showLeaderboard();
- if (autoUpdate != false) {
- window.setInterval(function(){
- updateLeaderboard();
- }, reloadInterval);
- }
- });
- function updateLeaderboard() {
- numRecords;
- quizIDs;
- $.webMethod({
- url: 'http://staging.cmdapp.com/Services/Poll.asmx/LeaderboardGetTopScores',
- data: '{quizIDs:"'+quizIDs+'",numRecords:"'+numRecords+'"}',
- beforeSend: function () { },
- success: function (ret) {
- ret = $.parseJSON(ret.d);
- $.each(ret.leaderboard,function(i){
- pos = i + 1;
- str = '<li data-id="'+pos+'">' + ret.leaderboard[i].first_name + ' ' + ret.leaderboard[i].last_name + '</li>';
- });
- $('.webbies').quicksand( str, { adjustHeight: 'dynamic' } );
- console.log(str);
- },
- error: function (response) { console.log(response.responseText); }
- });
- }
- function __show() {
- }
- function showLeaderboard() {
- updateLeaderboard();
- }
- function convertTime(time) {
- var millis= time % 1000;
- time = parseInt(time/1000);
- var seconds = time % 60;
- time = parseInt(time/60);
- var minutes = time % 60;
- time = parseInt(time/60);
- var hours = time % 24;
- var out = "";
- if(hours && hours > 0) out += hours + " " + ((hours == 1)?"Hour":"Hours") + " ";
- if(minutes && minutes > 0) out += minutes + " " + ((minutes == 1)?"minute":"minutes and") + " ";
- if(seconds && seconds > 0) out += seconds + " " + ((seconds == 1)?"second":"seconds") + " ";
- return out.trim();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement