Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var topic_id;
- var menuHomeTime;
- var current_votes_count;
- var current_votes_sum;
- function menuHome()
- {
- if(menuHomeTime > Math.floor((new Date()).getTime() / 1000))
- return;
- menuHomeTime = Math.floor((new Date()).getTime() / 1000) + 30;
- $.mobile.loading('show');
- clearInterval(refreshInterval);
- $.post("http://sarg.lt/app/server_status.php", {code: "0ay3j5as1Zua55f9T9s2upo"}, function( data ) {
- var value = parseINIString(data);
- if(value["status"])
- document.getElementById("serverStatus").innerHTML = '<span class="label label-success">Serveris įjungtas</span>';
- else
- document.getElementById("serverStatus").innerHTML = '<span class="label label-danger">Serveris išjungtas</span>';
- if(value["players"] != "")
- {
- output = 'Žaidėjai: ' + value["players"] + '/' + value["maxplayers"] + '<br>';
- output += 'Versija: ' + value["gamemode"] + '<br>';
- document.getElementById("serverInfo").innerHTML = output;
- document.getElementById("serverUpdate").innerHTML = value["lastupdate"];
- }
- else
- {
- menuHomeTime = 0;
- }
- if(topic_id != value["topic_id"])
- {
- topic_id = value["topic_id"];
- if(window.localStorage.getItem("score" + topic_id) > 0)
- {
- $.post("http://sarg.lt/app/get_rate.php", {code: "0ay3j5as1Zua55f9T9s2upo", topic_id: topic_id}, function( data )
- {
- var value = parseINIString(data);
- if(value["votes_count"] > 0 && current_votes_count != value["votes_count"])
- {
- current_votes_count = value["votes_count"];
- current_votes_sum = value["votes_sum"];
- $('#rate').raty({readOnly: true, score: Math.round(current_votes_sum/current_votes_count)});
- document.getElementById("rate_bottom_text").innerHTML = 'Balsavo: ' + current_votes_count;
- }
- $.mobile.loading('hide');
- }
- );
- document.getElementById("rate_top_text").innerHTML = 'Ačiū už įvertinimą';
- }
- else
- {
- $.mobile.loading('show');
- document.getElementById("rate_top_text").innerHTML = 'Įvertinkite atnaujinimą';
- $('#rate').raty({score: 0, click: function(score, evt)
- {
- $('#rate').raty({readOnly: true, score: 0});
- window.localStorage.setItem("score" + topic_id, score);
- document.getElementById("rate_top_text").innerHTML = 'Palaukite...';
- $.post("http://sarg.lt/app/rate.php", {uid: topic_id, rate: score, code: "0ay3j5as1Zua55f9T9s2upo"}, function( data )
- {
- $.mobile.loading('hide');
- var value = parseINIString(data);
- if(value["votes_count"] > 0)
- {
- current_votes_count = value["votes_count"];
- current_votes_sum = value["votes_sum"];
- $('#rate').raty({readOnly: true, score: Math.round(current_votes_sum/current_votes_count)});
- document.getElementById("rate_bottom_text").innerHTML = 'Balsavo: ' + current_votes_count;
- showMsg("Ačiū už įvertinimą");
- document.getElementById("rate_top_text").innerHTML = 'Ačiū už įvertinimą';
- }
- else
- {
- showMsg("Serveris neatsako");
- document.getElementById("rate_top_text").innerHTML = 'Pamėginkite vėliau';
- }
- }
- );
- }
- });
- }
- }
- else
- $.mobile.loading('hide');
- });
- }
Add Comment
Please, Sign In to add comment