From d6b10f9d7f2a8634921a5909aec639b2ae644751 Mon Sep 17 00:00:00 2001 From: Thierry Degeling Date: Wed, 23 Jul 2014 17:39:10 +0100 Subject: [PATCH] Added cfl news under the bus arrivals fixes #3 --- index.html | 1 + js/level2.js | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index cad7693..a53bb5a 100644 --- a/index.html +++ b/index.html @@ -53,6 +53,7 @@
+
diff --git a/js/level2.js b/js/level2.js index 7a9287e..d227c0c 100644 --- a/js/level2.js +++ b/js/level2.js @@ -36,6 +36,12 @@ wortLuNews(); }, 900000); + cflNews(); + + setInterval( function() { + cflNews(); + }, 900000); + }); @@ -267,8 +273,6 @@ function wortLuNews() { var articles = response.responseJSON.articles; - console.log( articles ) - var output = ''; for ( var ArticleNR = 0; ArticleNR < 5; ArticleNR++ ) { @@ -290,3 +294,34 @@ function wortLuNews() { console.log( moment().format('YYYY.MM.DD - HH:mm:ss') + ' updated WortLu News' ); } + +function cflNews() { + + var request = $.ajax({ + type: 'get', + url: 'http://getcontents.herokuapp.com/?url=http%3A%2F%2Fmobile.cfl.lu%2Fbin%2Fhelp.exe%2Fenl%3Ftpl%3Drss_feed_global', + complete: function( response ) { + + var cfl = response.responseText; + + var output = ''; + + $( $.parseXML( cfl ) ) + .find("item") + .each( function() { + + output += '
' + + '

' + $(this).find("title").text() + '

' + + $(this).find("description").text() + + '
'; + + }); + + $('.cfl').html('').append( output ); + + } + }); + + console.log( moment().format('YYYY.MM.DD - HH:mm:ss') + ' updated cfl News' ); + +}