From d4157dfc3c074f4b5b986f1e2ec1fca66dbe5a4e Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 15 Mar 2014 17:08:39 +0100 Subject: ermögliche das Finden des VPlans durch RE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'js') diff --git a/js/index.js b/js/index.js index c4af8db..0be25f9 100644 --- a/js/index.js +++ b/js/index.js @@ -16,10 +16,10 @@ * along with this program. If not, see . */ -function get_overview(){ +function get_overview(link){ var request = $.ajax({ type: "GET", - url: "http://***REMOVED***/moodle/course/view.php?id=2" + url: link }); request.done(function(msg){ @@ -48,9 +48,13 @@ function login(){ url: "https://***REMOVED***/moodle/login/index.php", data: {username: username, password: password} }); - request.done(function(msg){ - console.log('Login-Request erfolgreich'); - get_overview(); + request.done(function(result){ + var vertretungs_re = new RegExp("title=\"Vertretungsplan\" href=\"(http://***REMOVED***\\.de/moodle/course/view\\.php\\?id=\\d+)"); + var link = vertretungs_re.exec(result)[1]; + + console.log('Login-Request erfolgreich: ' + link); + + get_overview(link); }); request.fail(function(jqXHR, textStatus){ -- cgit v1.3.1