Skip to content

Commit ed921a6

Browse files
valerionewlorossi
and
lorossi
authored
Now has progress bar (MicrosoftStreamURLExtractor#3)
* Aggiunta progressbar * aggiunto ringraziamento * Corretto css * centrata progrressbar * aggiustati allineamenti vari Co-authored-by: lorossi <[email protected]>
1 parent 7de8846 commit ed921a6

File tree

3 files changed

+49
-9
lines changed

3 files changed

+49
-9
lines changed

index.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<meta charset="utf-8">
1414
<title>Microsoft Stream url extractor</title>
1515
<script
16-
src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
17-
integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="
16+
src="https://code.jquery.com/jquery-3.5.1.min.js"
17+
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
1818
crossorigin="anonymous"></script>
1919
<script src="script.js"></script>
2020
<link rel="stylesheet" type="text/css" href="style.css">
@@ -60,6 +60,9 @@ <h3>Ma i tempi duri sono finiti</h3>
6060
</label>
6161
</a>
6262
</div>
63+
<div class="progressbar">
64+
<div id="inner"></div>
65+
</div>
6366
<div class="output-container">
6467
<p class="summary">
6568
Carica un file per iniziare.
@@ -79,7 +82,7 @@ <h3>Ma i tempi duri sono finiti</h3>
7982
finita la sessione ricordatemi di cercare un convertitore da markdown a html col mio css. <br>
8083
</p>
8184

82-
85+
<div class="donationcontainer">
8386
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
8487
<input type="hidden" name="cmd" value="_donations" />
8588
<input type="hidden" name="business" value="NE5B3MM8GEAXA" />
@@ -89,7 +92,12 @@ <h3>Ma i tempi duri sono finiti</h3>
8992
</label>
9093
<input type="image" style="display:none" id="nobodydonates" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
9194
</form>
92-
95+
</div>
96+
<hr>
97+
<p class="endpage">
98+
Un ringraziamento speciale a <a href="https://twitter.com/sunflowaer?s=09">giorgia</a>, nostra
99+
patron, investor e benefattrice, che per prima ha creduto nel progetto e fatto una donazione
100+
</p>
93101
<!-- https://github.com/dobarkod/cookie-banner -->
94102
<!--<script type="text/javascript" id="cookiebanner"
95103
src="https://cdn.jsdelivr.net/gh/dobarkod/[email protected]/dist/cookiebanner.min.js"></script>-->

script.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,31 @@ $(document).on("change", ".file-container #file", function() {
44
let output_element = $(".output-container .linklist"); // list of links
55
let summary_element = $(".output-container .summary"); // how many links have been found
66
let download_file = $(".file-container a#filedownload") // download link
7+
let bar = $(".progressbar") // loading bar
78
let filename;
89

910
reader = new FileReader();
1011
reader.onload = function() {
12+
// clean urls containers in page
13+
cleanUrls(output_element, download_file, summary_element);
14+
15+
$(bar).css({"display": "block"});
16+
$(bar).children(":first").css({"width": "0"});
17+
$(bar).children(":first").animate({"width": "100%", "display": "inline"}, 700, function() {
18+
$(bar).css({"display": "none"});
1119
// extract the base64 encoded content of the file
1220
input_encoded = reader.result;
1321
// decode from base64 and skip the first part, comma separated, containing infos about the file
1422
input_decoded = atob(input_encoded.split(",")[1]);
1523
// extract urls
1624
urls = extractUrls(input_decoded, prefix);
17-
// clean urls containers in page
18-
cleanUrls(output_element, download_file, summary_element);
1925
// show urls on container
2026
showUrls(urls, output_element, summary_element);
2127
if (urls.length > 0) {
2228
// if we found any urls, format all the links
2329
attachDownload(urls, download_file, filename);
2430
}
31+
})
2532
};
2633

2734
// extract file from file container
@@ -38,7 +45,7 @@ function cleanUrls(element, download, summary) {
3845
$(element).text("");
3946

4047
// p containing the number of found links
41-
$(summary).text("");
48+
$(summary).text("Ricerca in corso...");
4249

4350
// download button
4451
$(download).attr({
@@ -79,7 +86,7 @@ function showUrls(urls, element, summary) {
7986
// shows url list in output
8087
if (urls.length > 0) {
8188
if (urls.length > 1) {
82-
$(summary).append(`Sono stati trovati ${urls.length} link nel file:`);
89+
$(summary).text(`Sono stati trovati ${urls.length} link nel file:`);
8390
} else {
8491
$(summary).text(`È stato trovato 1 link nel file:`);
8592
}
@@ -88,7 +95,7 @@ function showUrls(urls, element, summary) {
8895
$(element).append(`<span id="link"><a href="${item}">${item}</a></span><br>`);
8996
});
9097
} else {
91-
$(summary).append('Non sono stati trovati link nel file!');
98+
$(summary).text('Non sono stati trovati link nel file!');
9299
}
93100
}
94101

style.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ input[type="file"] {
4545
cursor: pointer;
4646
color: #fafafa;
4747
font-family: sans-serif;
48+
width: 96%;
4849
}
4950

5051
[active|="false"] {
@@ -62,6 +63,12 @@ a {
6263

6364
div.file-container {
6465
margin: auto;
66+
text-align: center;
67+
}
68+
69+
div.donationcontainer{
70+
margin: auto;
71+
text-align: center;
6572
}
6673

6774
p.endpage {
@@ -85,3 +92,21 @@ pre.linklist{
8592
overflow-x: auto;
8693
padding: 20px;
8794
}
95+
96+
.progressbar {
97+
margin-block-start: 1em;
98+
margin-block-end: 1em;
99+
margin-inline-start: 0px;
100+
margin-inline-end: 0px;
101+
width: 100%;
102+
background-color: #bbb;
103+
border-radius: 3px;
104+
display: none;
105+
}
106+
107+
.progressbar > #inner {
108+
width: 0%;
109+
border-radius: 3px;
110+
height: 30px;
111+
background-color: hotpink;
112+
}

0 commit comments

Comments
 (0)