Advertisement
Nexon

Мониторинг в реальном времени (JS)

Sep 4th, 2012
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <style type='text/css'>
  2. .progress-bar {
  3.         padding:1px;
  4.         background: url('https://dl.dropbox.com/u/61851995/v9q01urq.png') no-repeat;
  5.         background-size: 100% 100%;
  6.             vertical-align: middle;
  7.             line-height: 100%;
  8.             margin-top: 5px;
  9.             background-color: #1a1a1a;
  10.             height: 25px;
  11.             width: 100%;           
  12.             -moz-border-radius: 15px;
  13.         -webkit-border-radius: 15px;
  14.         border-radius: 15px;
  15. }
  16.        
  17. .progress-bar span {
  18.             z-index: 1;
  19.             vertical-align: middle;
  20.             line-height: 100%;
  21.             float: right;
  22.             margin: 1px;
  23.             display: inline-block;
  24.             height: 90%;
  25.             font-size: 18px;
  26.         background: url('https://dl.dropbox.com/u/61851995/v9q01urq.png');
  27.         background-size: 100% 100%;
  28.             -moz-border-radius: 15px;
  29.             -webkit-border-radius: 15px;
  30.             border-radius: 15px;
  31.             -webkit-transition: width 4s ease-in-out;
  32.             -moz-transition: width 4s ease-in-out;
  33.             -ms-transition: width 4s ease-in-out;
  34.             -o-transition: width 4s ease-in-out;
  35.             transition: width 4s ease-in-out;      
  36. }  
  37.  
  38. .progress-bar sdf {
  39.             z-index: 2;
  40.             float: right;
  41.             margin: 1px;
  42.             display: inline-block;
  43.             height: 23px;
  44.             width: 65%;
  45.         background: url('https://dl.dropbox.com/u/61851995/v9q01urq.png');
  46.         background-size: 100% 100%;
  47.             -moz-border-radius: 15px;
  48.             -webkit-border-radius: 15px;
  49.             border-radius: 15px;   
  50. }
  51.  
  52. .progress-bar dfg {
  53.             margin: 5px;   
  54.             line-height: 180%;
  55. }
  56. </style>
  57. <script type="text/javascript">
  58. var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
  59. if (!mobile) {
  60. jQuery.getJSON("mon/online.json", {}, function(json){
  61.     for (var item in json) {
  62.                        jQuery("mon").append("<div id='mon'><div class='progress-bar' id='onlinebar_" + item + "'><b><dfg>" + item + "</dfg></b><span style='min-width: 10%;width: 10%;max-width: 75%;'><b id='onlinebarin_" + item + "'><center>" + json[item].players + "</center></b></span>    </div>");
  63.     }
  64. });
  65. setInterval(function() {
  66. jQuery.getJSON("mon/online.json", {}, function(json){
  67.     for (var item in json) {
  68.                          if (json[item].status == 1 && json[item].maxplayers >= 1) {                      
  69.                        jQuery('#onlinebar_' + item).children('span').animate({width: json[item].players + '%' }, 500 );
  70.                        jQuery('#onlinebar_' + item).css('background-image','url(http://world4play.com/public/style_images/nacht/online.png)');
  71.                        jQuery('#onlinebarin_' + item).html('');
  72.                        jQuery('#onlinebarin_' + item).append('<center>' + json[item].players + '</center>');
  73.                        }                    
  74.                  if (json[item].status == 0) {                      
  75.                jQuery('#onlinebar_' + item).children('span').animate({width: '100%' }, 500 );
  76.                        jQuery('#onlinebar_' + item).css('background-image','url(http://world4play.com/public/style_images/nacht/offline.png)');
  77.                        jQuery('#onlinebarin_' + item).html('');
  78.                        jQuery('#onlinebarin_' + item).append('<center>Отключен</center>');
  79.                        }                    
  80.              if (json[item].status == 1 && json[item].maxplayers == 0) {                      
  81.                jQuery('#onlinebar_' + item).children('span').animate({width: '100%' }, 500 );
  82.                        jQuery('#onlinebar_' + item).css('background-image','url(http://world4play.com/public/style_images/nacht/work.png)');
  83.                        jQuery('#onlinebarin_' + item).html('');
  84.                        jQuery('#onlinebarin_' + item).append('<center>Профилактика</center>');
  85.                        }    
  86.     }
  87. });
  88. }, 2500);
  89. }
  90. </script>
  91. <mon></mon>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement