Skip to content

Commit

Permalink
Merge pull request FaisalUmair#488 from MiKr13/master
Browse files Browse the repository at this point in the history
Open in Browser addition
  • Loading branch information
FaisalUmair committed Aug 11, 2020
2 parents b43d363 + e2580ff commit a370379
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
18 changes: 15 additions & 3 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var downloadTemplate = `
<button class="ui basic blue download button"><i class="download icon"></i></button>
<button class="ui disabled basic red pause button"><i class="pause icon"></i></button>
<button class="ui disabled basic green resume button"><i class="play icon"></i></button>
<button class="ui basic yellow browser button open-in-browser"><i class="desktop icon"></i></button>
</div>
<div class="ui horizontal divider"></div>
<div class="ui tiny indicating individual progress">
Expand Down Expand Up @@ -1462,13 +1463,13 @@ function handleResponse(response, keyword = "") {
if (response.results.length) {
$.each(response.results, function(index, course) {
$(".ui.dashboard .ui.courses.section .ui.courses.items").append(`
<div class="ui course item" course-id="${
<div class="ui course item course-item" course-id="${
course.id
}" course-url="${course.url}">
<div class="ui tiny label download-quality grey"></div>
<div class="ui tiny grey label download-speed"><span class="value">0</span> KB/s</div>
<div class="ui tiny image">
<img src="${course.image_240x135}">
<div class="ui tiny image" style="cursor: pointer;">
<img class="open-link" src="${course.image_240x135}" id="${course.url}">
</div>
<div class="content">
<span class="coursename">${course.title}</span>
Expand Down Expand Up @@ -1515,6 +1516,17 @@ function handleResponse(response, keyword = "") {
)}</div>`
);
}

$('.open-in-browser').click(function() {
let link = `https://www.udemy.com${$(this).parentsUntil(".course-item").parent().attr('course-url')}`;
shell.openExternal(link);
});

$('.open-link').click(function () {
let link = `https://www.udemy.com${$(this).attr('id')}`;
shell.openExternal(link);
});

}

function saveDownloads(quit) {
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a370379

Please sign in to comment.