diff --git a/css/level2.css b/css/level2.css index e3b86ad..f69b9d2 100644 --- a/css/level2.css +++ b/css/level2.css @@ -25,6 +25,7 @@ body:after { box-shadow: 0px 1px 0px 0px rgba(0,0,0,0.25); padding: 0.2em 1em 1em 1em; color: #777; + margin-bottom: 15px; } h1, h2, h3, h4, h5, h6 { diff --git a/index.html b/index.html index 6df9fa6..d6a9652 100644 --- a/index.html +++ b/index.html @@ -52,7 +52,7 @@
-
+
diff --git a/js/level2.js b/js/level2.js index 3311f2a..f963c43 100644 --- a/js/level2.js +++ b/js/level2.js @@ -24,6 +24,12 @@ l2status(); }, 60000); + l2events(); + + setInterval( function() { + l2events(); + }, 3600000); + }); @@ -213,3 +219,36 @@ function l2status() { console.log( moment().format('YYYY.MM.DD - HH:mm:ss') + ' updated Level2 status' ); } + +function l2events() { + + var request = $.ajax({ + type: 'get', + url: 'http://getcontents.herokuapp.com/?url=https%3A%2F%2Fwiki.hackerspace.lu%2Fwiki%2FSpecial%3AAsk%2F-5B-5BCategory%3AEvent-5D-5D-20-5B-5BStartDate%3A%3A-3E' + moment().format('YYYY') + '-2D' + moment().format('MM') + '-2D' + moment().format('DD') + '-5D-5D-20-3Cq-3E-5B-5BHas-20organizer%3A%3AOrganisation%3ASyn2cat-5D-5D-20OR-20-5B-5BIs-20External%3A%3Ano-5D-5D-3C-2Fq-3E-20-5B-5BDo-20Announce%3A%3Ayes-5D-5D%2F-3FStartDate%2F-3FEndDate%2F-3FHas-20subtitle%2F-3FHas-20description%2F-3FIs-20Event-20of-20Type%253DIs-20type%2F-3FHas-20location%2F-3FHas-20picture%2F-3FHas-20cost%2F-3FCategory%2Fformat%253Djson%2Fsort%253DStartDate%2Forder%253Dascending%2Fsearchlabel%253DJSON-20(Internal%2C-20announceable-20events-20only%2C-20only-20upcoming-20events)', + complete: function( response ) { + + var events = JSON.parse( response.responseText ); + + var output = ''; + + $.each( events.items , function( nr, l2event ) { + + console.log( l2event ); + + output += '
' + + '

' + l2event.label + ' ' + + moment( l2event.startdate, "YYYY-MM-DD HH:mm:ss").format( 'dddd, Do \of MMMM' ) + + '

' + + l2event.has_subtitle + + '
'; + + }); + + $('.events').html('').append( output ); + + } + }); + + console.log( moment().format('YYYY.MM.DD - HH:mm:ss') + ' updated Level2 events' ); + +}