Advertisement
illpastethat

vtrelay countdown

Apr 7th, 2014
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.65 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  5.         <meta name="description" content="Virginia Tech Relay For Life statistics and countdown."/>
  6.         <!-- Original from http://www.jbmarket.net/demos/countdown/ Modified by Adam Bloom-->
  7.         <meta name="viewport" content="width=device-width">
  8.         <title>VT Relay Dashboard</title>
  9.         <link rel="stylesheet" href="/jbclock.css" type="text/css" media="all" />
  10.         <script type="text/javascript" src="/jquery-1.8.0.min.js"></script>
  11.         <script type="text/javascript" src="/jbclock.js"></script>
  12.                 <script type="text/javascript">
  13.                 var d = new Date();
  14.                 var n = d.getTime()/1000;
  15.             $(document).ready(function(){
  16.                 JBCountDown({
  17.                     secondsColor : "#FFF",
  18.                     secondsGlow  : "none",
  19.                    
  20.                     minutesColor : "#590075",
  21.                     minutesGlow  : "none",
  22.                    
  23.                     hoursColor   : "#e14e06",
  24.                     hoursGlow    : "none",
  25.                    
  26.                     daysColor    : "#860037",
  27.                     daysGlow     : "none",
  28.                    
  29.                     startDate   : "1375478529",
  30.                     endDate     : "1398463200",
  31.                    
  32.                     now         : n,
  33.                 });
  34.             });
  35.         </script>
  36.     </head>
  37.     <body>
  38.         <div class="wrapper">
  39.         <h1><a href="http://vtrelay.org" target="_blank" style="color:#e14e06">Virginia Tech Relay For Life!</a></h1>
  40.         <h4>
  41.         <?php
  42.             libxml_use_internal_errors(true);
  43.             $doc = new DOMDocument();
  44.             $doc->loadHTMLFile("http://main.acsevents.org/site/TR/RelayForLife/RFLCY14SA?pg=entry&fr_id=60186");
  45.  
  46.             $xpath = new DOMXPath($doc);
  47.  
  48.             $teams = $xpath->query("//*[@id='tr-greeting-eventStats']/p/a[1]");
  49.  
  50.             $teams = str_replace("teams",$null,$teams->item(0)->nodeValue);
  51.  
  52.             $participants = $xpath->query("//*[@id='tr-greeting-eventStats']/p/a[2]");
  53.  
  54.             $participants = str_replace("participants",$null,$participants->item(0)->nodeValue);
  55.  
  56.             $money = $xpath->query("//*[@id='tr-greeting-eventStats']/p/span[@id='tr-greeting-fundraisingStats']");
  57.  
  58.             $money = str_replace("$",$null,$money->item(0)->nodeValue);
  59.  
  60.             $teams = str_replace(",",$null,$teams);
  61.             $participants = str_replace(",",$null,$participants);
  62.             $money = str_replace(",",$null,$money);
  63.  
  64.             $previous = explode(" ",file_get_contents("Changes.txt"));
  65.  
  66.             //Check to make sure the numbers didn't go down...
  67.             if ($previous[0] > $teams) {
  68.                 $teams = $previous[0];
  69.                 }
  70.                
  71.             if ($previous[1] > $participants) {
  72.                 $participants = $previous[1];
  73.                 }
  74.                
  75.             if ($previous[2] > $money) {
  76.                 $money = $previous[2];
  77.                 }
  78.                
  79.             $string = str_replace(",",$null,$teams.$participants.$money);
  80.             if (count(explode(' ', $string)) > 2) {
  81.                 file_put_contents("Changes.txt",$string);
  82.                 }
  83.  
  84.             //Adding commas and decimals
  85.             $money = number_format(floatval($money), 2, '.', ',');
  86.             $participants = number_format(floatval($participants));
  87.             $teams = number_format(floatval($teams));
  88.                    
  89.                     echo '<a href="http://main.acsevents.org/site/TR?fr_id=60186&amp;pg=teamlist" style="color:#e14e06" target="_blank">'.$teams.
  90.                     ' teams</a> and <a href="http://main.acsevents.org/site/TR?fr_id=60186&amp;pg=topparticipantlist" style="color:#e14e06" target="_blank">'.$participants.
  91.                     ' participants</a> have raised <strong>$'.$money.'</strong>';
  92.         ?>
  93.         </h4>
  94.         <div class="clock">
  95.             <!-- Days -->
  96.             <div class="clock_days">
  97.                 <div class="bgLayer">
  98.                     <div class="topLayer"></div>
  99.                     <canvas id="canvas_days" width="188" height="188">
  100.                     </canvas>
  101.                     <div class="text">
  102.                         <p class="val">0</p>
  103.                         <p class="type_days">Days</p>
  104.                     </div>
  105.                 </div>
  106.             </div>
  107.             <!-- Days -->
  108.             <!-- Hours -->
  109.             <div class="clock_hours">
  110.                 <div class="bgLayer">
  111.                     <div class="topLayer"></div>
  112.                     <canvas id="canvas_hours" width="188" height="188">
  113.                     </canvas>
  114.                     <div class="text">
  115.                         <p class="val">0</p>
  116.                         <p class="type_hours">Hours</p>
  117.                     </div>
  118.                 </div>
  119.             </div>
  120.             <!-- Hours -->
  121.             <!-- Minutes -->
  122.             <div class="clock_minutes">
  123.                 <div class="bgLayer">
  124.                     <div class="topLayer"></div>
  125.                     <canvas id="canvas_minutes" width="188" height="188">
  126.                     </canvas>
  127.                     <div class="text">
  128.                         <p class="val">0</p>
  129.                         <p class="type_minutes">Minutes</p>
  130.                     </div>
  131.                 </div>
  132.             </div>
  133.             <!-- Minutes -->
  134.             <!-- Seconds -->
  135.             <div class="clock_seconds">
  136.                 <div class="bgLayer">
  137.                     <div class="topLayer"></div>
  138.                     <canvas id="canvas_seconds" width="188" height="188">
  139.                     </canvas>
  140.                     <div class="text">
  141.                         <p class="val">0</p>
  142.                         <p class="type_seconds">Seconds</p>
  143.                     </div>
  144.                 </div>
  145.             </div>
  146.             <!-- Seconds -->
  147.         </div>
  148.         <div class="divider">
  149.           <p>In the meantime, why not <strong>follow</strong> us on <a href="http://twitter.com/VTRelay" target="_blank"><strong>Twitter</strong></a>
  150.           and <strong>like</strong> us on <a href="http://facebook.com/VTRelay" target="_blank"><strong>Facebook!</strong></a>  You can also find us on <a href="http://instagram.com/VTRelay" target="_blank"><strong>Instagram</strong></a> and <a href="http://pinterest.com/VTRelay" target="_blank"><strong>Pinterest</strong></a></p>
  151.         </div>
  152.         </div><!--/wrapper-->
  153.     </body>
  154. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement