Author: tnachen
Date: Wed Jun 18 06:03:51 2014
New Revision: 1603359

URL: http://svn.apache.org/r1603359
Log:
Added javascript to show next hangout date (contributed by Yash)

Modified:
    incubator/drill/site/trunk/content/drill/index.html

Modified: incubator/drill/site/trunk/content/drill/index.html
URL: 
http://svn.apache.org/viewvc/incubator/drill/site/trunk/content/drill/index.html?rev=1603359&r1=1603358&r2=1603359&view=diff
==============================================================================
--- incubator/drill/site/trunk/content/drill/index.html (original)
+++ incubator/drill/site/trunk/content/drill/index.html Wed Jun 18 06:03:51 2014
@@ -412,7 +412,7 @@ background-image: -webkit-gradient(
       <div class="featurette" id="get_involved">  
         <h2 class="featurette-heading" >Get Involved!<span 
class="muted"></span></h2>
         <p class="lead"><a rel="nofollow" 
href="https://plus.google.com/hangouts/_/event/ci4rdiju8bv04a64efj5fedd0lc";>
-          Weekly Google Hangout - First Tuesday of each month 10:00am PDT 
</a></p>
+                       Weekly Google Hangout - First Tuesday of each month 
(<span id="hangout_date">Date</span>) 10:00am PDT </a></p>
         <p class="lead"><a rel="nofollow" 
href="https://builds.apache.org/job/drill-scm/lastSuccessfulBuild/artifact/distribution/target/apache-drill-1.0.0-m2-incubating-SNAPSHOT-binary-release.tar.gz";>Drill
 Nightly Build (unstable)</a></p>                 
         <p class="lead">Twitter: <a rel="nofollow" 
href="https://twitter.com/ApacheDrill";>@ApacheDrill</a></p>
         <p class="lead">Source Code: <a rel="nofollow" 
href="https://github.com/apache/incubator-drill"; rel="nofollow">Github</a></p>
@@ -537,5 +537,41 @@ endorsed by the ASF.
       }(window.jQuery)
     </script>
     <script src="js/holder/holder.js"></script>
+       <script type="text/javascript">
+      function getNextTuesday() {
+          months = new 
Array("January","February","March","April","May","June","July","August","September","October","November","December");
+          var d = new Date();
+          datetoday = d.getDate();
+          d.setDate(1);
+          while (d.getDay() !== 2) {
+            d.setDate(d.getDate() + 1);
+          }
+
+          if(datetoday == d.getDate()){
+                nexthangout =  new Date(d.getTime());
+                return "Today";
+          } else if(datetoday < d.getDate()){
+                nexthangout =  new Date(d.getTime());
+          } else {
+                month = d.getMonth() + 1;
+                d.setDate(1);
+                d.setMonth(d.getMonth() + 1);
+
+                while (d.getDay() !== 2) {
+                  d.setDate(d.getDate() + 1);
+                }
+                nexthangout =  new Date(d.getTime());
+          }
+
+          return "Next hangout: " + months[nexthangout.getMonth()] + " " + 
nexthangout.getDate() +  getSuffix(nexthangout.getDate());
+      }
+
+    function getSuffix(n) {
+      var d = (n|0)%100;
+      return d > 3 && d < 21 ? 'th' : ['th', 'st', 'nd', 'rd'][d%10] || 'th';
+    }; 
+               
+       document.getElementById("hangout_date").innerHTML = getNextTuesday();
+       </script>
   </body>
 </html>


Reply via email to