Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 94a646e

Browse files
committed
add icons for github and sharing; filter invalid chars from filename
1 parent c152665 commit 94a646e

5 files changed

Lines changed: 42 additions & 3 deletions

File tree

assets/github120.png

4.17 KB
Loading

css/style.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
padding: .2rem .5rem;
55
border: 1px solid rgba(0,0,0,.2);
66
border-radius: .25rem;
7-
}
7+
}
8+
9+
#shareLink {
10+
display: inline-flex;
11+
vertical-align: middle;
12+
float: right;
13+
padding-top: 1%;
14+
color: black;
15+
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "Moodle Downloader",
55
"description": "A chrome extension for downloading Moodle resources",
6-
"version": "1.4.6",
6+
"version": "1.4.7",
77
"icons": {
88
"16": "assets/icon16.png",
99
"24": "assets/icon24.png",

src/popup.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,25 @@ <h2 class="mdl-card__title-text">moodleDownloader 📚</h2>
4040
<input type="checkbox" id="organize" class="mdl-checkbox__input" checked>
4141
<span style="font-size:75%;" class="mdl-checkbox__label">Organize into folder (experimental)</span>
4242
</label>
43+
<label for="resourcesSection" >
44+
<br>
45+
<!-- <br> -->
46+
<span style="font-size:75%;">Hint: Head to the Resouces to download all resources at once!</span>
47+
<!-- <br> -->
48+
</label>
49+
<br>
50+
<br>
4351
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored" id="downloadResources">Download</button>
52+
<a href="">
53+
<div id="shareLink" class="icon material-icons">share</div>
54+
</a>
55+
<div style="display: inline;">
56+
<a id="sourceCode" href="https://github.com/harsilspatel/moodleDownloader">
57+
<img src="../assets/github120.png" alt="Souce code" align="right" style="width: 9%; padding-right: 2%;">
58+
</a>
59+
</div>
4460
</div>
61+
4562
<div hidden='hidden' id=feedbackDiv>
4663
<br>
4764
<small id=feedbackPrompt>You just downloaded 50th file using this tool! 🎉 <br/> <br/> I have spent more than <b>30 hours</b> to learn & develop this extension, could you please rate my efforts? 😬</small>

src/popup.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ function main() {
2121
downloadResources()
2222
});
2323

24+
document.getElementById("shareLink").addEventListener("click", () => {
25+
var copyFrom = document.createElement("textarea");
26+
copyFrom.textContent = "https://chrome.google.com/webstore/detail/geckodm/pgkfjobhhfckamidemkddfnnkknomobe";
27+
document.body.appendChild(copyFrom);
28+
copyFrom.select();
29+
document.execCommand('copy');
30+
copyFrom.blur();
31+
document.body.removeChild(copyFrom);
32+
})
33+
34+
document.getElementById("sourceCode").addEventListener("click", () => {
35+
chrome.tabs.create({url: 'https:github.com/harsilspatel/moodleDownloader'})
36+
})
37+
2438
// filter resources on input
2539
const searchField = document.getElementById("search");
2640
searchField.addEventListener("input", () => {
@@ -133,7 +147,7 @@ function suggestFilename(downloadItem, suggest) {
133147
item = resourcesList.filter(r => r.url==downloadItem.url)[0],
134148
console.log(downloadItem),
135149
console.log(resourcesList),
136-
suggest({filename: item.course + '/' + item.section + '/' + downloadItem.filename})
150+
suggest({filename: `${item.course}/${item.section}/${downloadItem.filename}`.replace(/[^\w.]+/g," ")})
137151
}
138152

139153
function downloadResources() {

0 commit comments

Comments
 (0)