From f0ba7e05a864d25c2ff614cd3a9f827c3c448a43 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 16 Jan 2013 13:58:11 +0100 Subject: [PATCH] Die Termine werden jetzt am ende auch ausgegeben, damit man sieht das was geht :) --- termine.js | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/termine.js b/termine.js index 8f0f945..d602be2 100644 --- a/termine.js +++ b/termine.js @@ -7,35 +7,33 @@ var data = ''; function parseData() { jsdom.env( - data, - ["http://code.jquery.com/jquery.js"], - function (errors, window) { - var wiki_text = window.$("#wiki__text").val(); - var re = /\s\* (\d{4})\-(\d{2})\-(\d{2}) (\d{2})\:(\d{2}) - (\d{2})\:(\d{2}) (.*)/g; - var match = null; - var events = []; - while (match = re.exec(wiki_text)) { - var event = { - startdate : new Date(match[1], match[2], match[3], match[4], match[5]) - ,enddate : new Date(match[1], match[2], match[3], match[6], match[7]) - ,text : match[8] - }; - events.push(event); - } - - //var matches = wiki_text.match(); - //console.log(matches); - } + data, + ["http://code.jquery.com/jquery.js"], + function (errors, window) { + var wiki_text = window.$("#wiki__text").val(); + var re = /\s\* (\d{4})\-(\d{2})\-(\d{2}) (\d{2})\:(\d{2}) - (\d{2})\:(\d{2}) (.*)/g; + var match = null; + var events = []; + while (match = re.exec(wiki_text)) { + var event = { + startdate : new Date(match[1], match[2], match[3], match[4], match[5]) + ,enddate : new Date(match[1], match[2], match[3], match[6], match[7]) + ,text : match[8] + }; + events.push(event); + } + console.log(events); + } ); } function processResponse(res) { if (res.statusCode == 200) { - res.on('data', function(d) { - data = data + d; - }); + res.on('data', function(d) { + data = data + d; + }); - res.on('end',parseData); + res.on('end',parseData); } }