diff options
| -rw-r--r-- | js/index.js | 14 |
1 files changed, 9 insertions, 5 deletions
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 <http://www.gnu.org/licenses/>. */ -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){ |
