diff options
Diffstat (limited to 'js')
| -rw-r--r-- | js/index.js | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/js/index.js b/js/index.js index ebb5b0c..5a06d7b 100644 --- a/js/index.js +++ b/js/index.js @@ -70,7 +70,7 @@ function renderPage(div, pdf, pageNumber, callback){ } function render_pdf(viewerstr){ - console.log("Rendere PDF: " + $(viewerstr).attr('data-plan-url') + " (" + viewerstr + ")"); + console.log('Rendere PDF: ' + $(viewerstr).attr('data-plan-url') + ' (' + viewerstr + ')'); PDFJS.getDocument($(viewerstr).attr('data-plan-url')).then(function(pdf){ var viewer = document.getElementById(viewerstr.replace(/#/, '')); @@ -85,9 +85,9 @@ function render_pdf(viewerstr){ } function fail(text){ - $('#error_noconn').show("fast"); - $('#loader').hide("slow"); - console.log("Fehler: " + text.toString()); + $('#error_noconn').show('fast'); + $('#loader').hide('slow'); + console.log('Fehler: ' + text.toString()); } function download_pdf(link, id){ @@ -99,8 +99,8 @@ function download_pdf(link, id){ fileSystem.root.getFile( filename, {create: true, exclusive: false}, function gotFileEntry(fileEntry){ - var sPath = "/storage/sdcard0" + fileEntry.fullPath; // !!! TODO Unterstützung anderer Geräte - console.log("Pfad: " + sPath); + var sPath = '/storage/sdcard0' + fileEntry.fullPath; // !!! TODO Unterstützung anderer Geräte + console.log('Pfad: ' + sPath); var fileTransfer = new FileTransfer(); fileEntry.remove(); @@ -108,16 +108,16 @@ function download_pdf(link, id){ link, sPath, function(theFile){ - console.log("Download fertig: " + theFile.toURL()); + console.log('Download fertig: ' + theFile.toURL()); $('#pdf-' + id).attr('data-plan-url', theFile.toURL()); - if(location.href.indexOf("page-") == -1){ - $('#loader').hide("fast"); - $.mobile.changePage("#page-vplan-" + id); + if(location.href.indexOf('page-') == -1){ + $('#loader').hide('fast'); + $.mobile.changePage('#page-vplan-' + id); } }, function(error){ - console.log("Fehler: " + error.source + " - "+ error.target + " - " + error.code); + console.log('Fehler: ' + error.source + ' - '+ error.target + ' - ' + error.code); } ); }, @@ -128,12 +128,12 @@ function download_pdf(link, id){ function get_plan(link, id){ var request = $.ajax({ - type: "GET", + type: 'GET', url: link }); request.done(function(result){ - var pdf_re = new RegExp("(http://***REMOVED***\\.de/moodle/pluginfile\\.php/\\d+/mod_resource/content/\\d+.*?\\.pdf)"); + var pdf_re = new RegExp('(http://***REMOVED***\\.de/moodle/pluginfile\\.php/\\d+/mod_resource/content/\\d+.*?\\.pdf)'); var pdflink = pdf_re.exec(result)[1]; console.log('Plan gefunden: ' + pdflink); @@ -146,12 +146,12 @@ function get_plan(link, id){ function get_overview(link){ var request = $.ajax({ - type: "GET", + type: 'GET', url: link }); request.done(function(result){ - var plans_re = new RegExp("window\\.open\\('(http://***REMOVED***\\.de/moodle/mod/resource/view\\.php\\?id=\\d+)&redirect=1'\\)", "g"); + var plans_re = new RegExp('window\\.open\\('(http://***REMOVED***\\.de/moodle/mod/resource/view\\.php\\?id=\\d+)&redirect=1'\\)', 'g'); var link; // Pages für Vertretungsplände erstellen und pageshow-Events festlegen @@ -173,15 +173,15 @@ function get_overview(link){ if(j + 1 < resultl){ $('#page-vplan-' + j).on('swipeleft', function(event){ - console.log("Wisch links"); - $.mobile.changePage("#page-vplan-" + (parseInt($('.ui-page-active').attr('id').match(/\d+/)[0]) + 1)); + console.log('Wisch links'); + $.mobile.changePage('#page-vplan-' + (parseInt($('.ui-page-active').attr('id').match(/\d+/)[0]) + 1)); }); } if(j - 1 >= 0){ $('#page-vplan-' + j).on('swiperight', function(event){ - console.log("Wisch rechts"); - $.mobile.changePage("#page-vplan-" + (parseInt($('.ui-page-active').attr('id').match(/\d+/)[0]) - 1)); + console.log('Wisch rechts'); + $.mobile.changePage('#page-vplan-' + (parseInt($('.ui-page-active').attr('id').match(/\d+/)[0]) - 1)); }); } @@ -206,20 +206,20 @@ function get_overview(link){ } function login(){ - var username = encodeURIComponent($("#username").val()); - var password = encodeURIComponent($("#password").val()); - var params = "username=" + username + "&password=" + password; + var username = encodeURIComponent($('#username').val()); + var password = encodeURIComponent($('#password').val()); + var params = 'username=' + username + '&password=' + password; var request = $.ajax({ - type: "POST", - url: "https://***REMOVED***/moodle/login/index.php", + type: 'POST', + url: 'https://***REMOVED***/moodle/login/index.php', data: {username: username, password: password} }); - $('#loader').show("fast"); + $('#loader').show('fast'); request.done(function(result){ - var vertretungs_re = new RegExp("title=\"Vertretungsplan\" href=\"(http://***REMOVED***\\.de/moodle/course/view\\.php\\?id=\\d+)"); + 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); |
