From 6ac04b35da50ee4778d1df4402b6e6149dce18e1 Mon Sep 17 00:00:00 2001 From: Carpinteiro Date: Sat, 2 Nov 2019 22:53:14 +0000 Subject: [PATCH] add notification when download ends --- assets/js/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/assets/js/app.js b/assets/js/app.js index 03c509ff..4fd4b87c 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -579,6 +579,7 @@ var chapter_name = sanitize((chapterindex+1)+'. '+coursedata['chapters'][chapter function downloadLecture(chapterindex,lectureindex,num_lectures,chapter_name){ if(downloaded==toDownload){ resetCourse($course.find('.download-success')); + sendNotification(course_name); return; }else if(lectureindex==num_lectures){ downloadChapter(++chapterindex,0); @@ -822,6 +823,15 @@ function resetCourse($elem){ } +// The purpose here is to have a notification sent, so the user can understand that the download ended +// The title of the notification should be translated but since the translate function is in index.html and to avoid code duplication +// I would like to have your feedback in this +function sendNotification(course_name){ + var downloadFinishedNotif = new Notification('Download finished', { + body: course_name + }); +} + $('.courses-sidebar').click(function(){ $('.content .ui.section').hide(); $('.content .ui.courses.section').show();