ios fix
parent
c3b30dd59f
commit
94c7078134
52
izberi.html
52
izberi.html
|
@ -96,6 +96,8 @@
|
||||||
<div class="loading-spinner" style="display: none;" id="loader"></div>
|
<div class="loading-spinner" style="display: none;" id="loader"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<a id="dlGumb" href="" style="font-size: 1.2rem; color: white; float: right;" target="_blank" download>Vzemi</a>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var gumb = document.getElementById("gumb");
|
var gumb = document.getElementById("gumb");
|
||||||
var stel = document.getElementById("stevilo");
|
var stel = document.getElementById("stevilo");
|
||||||
|
@ -103,26 +105,36 @@
|
||||||
var loader = document.getElementById("loader");
|
var loader = document.getElementById("loader");
|
||||||
var st = 0;
|
var st = 0;
|
||||||
|
|
||||||
|
// je iOS naprava?
|
||||||
|
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
||||||
|
|
||||||
var loading = null;
|
var loading = null;
|
||||||
|
|
||||||
function pridobiPosnetek() {
|
function pridobiPosnetek() {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.open("GET", "/nepovednik/nepoved/" + st, true);
|
xhttp.open("GET", "/nepovednik/nepoved/" + st, true);
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
var resp = this.responseText;
|
var resp = this.responseText;
|
||||||
|
|
||||||
if (resp === "zacetek" || resp === "cakaj") {
|
if (resp === "zacetek" || resp === "cakaj") {
|
||||||
loading = setTimeout(pridobiPosnetek, 3000);
|
loading = setTimeout(pridobiPosnetek, 3000);
|
||||||
} else {
|
} else {
|
||||||
loader.style.display = "none";
|
loader.style.display = "none";
|
||||||
tv.src = '/nepovednik' + resp;
|
|
||||||
tv.play();
|
if (iOS) {
|
||||||
loading = null;
|
resp = "/apple" + resp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
document.getElementById("dlGumb").href = '/nepovednik' + resp;
|
||||||
xhttp.send();
|
|
||||||
|
tv.src = '/nepovednik' + resp;
|
||||||
|
tv.play();
|
||||||
|
loading = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
gumb.onclick = proziPosnetek;
|
gumb.onclick = proziPosnetek;
|
||||||
|
@ -138,13 +150,13 @@
|
||||||
loader.style.display = "block";
|
loader.style.display = "block";
|
||||||
tv.pause();
|
tv.pause();
|
||||||
pridobiPosnetek();
|
pridobiPosnetek();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function klik(e) {
|
function klik(e) {
|
||||||
if (e.keyCode == 13) {
|
if (e.keyCode == 13) {
|
||||||
proziPosnetek();
|
proziPosnetek();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stel.onkeypress = klik;
|
stel.onkeypress = klik;
|
||||||
|
|
12
server.js
12
server.js
|
@ -7,6 +7,18 @@ app.get('/nepovednik', function(req, res) {
|
||||||
res.sendFile(__dirname + '/izberi.html');
|
res.sendFile(__dirname + '/izberi.html');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/nepovednik/apple/nepovid/:id', function (req, res) {
|
||||||
|
let st = parseInt(req.params.id);
|
||||||
|
if (st < 1 || st > 1000) {
|
||||||
|
res.status(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
let nejm = 'nepovedi/' + st + '.mp4';
|
||||||
|
if (fs.existsSync(nejm)) {
|
||||||
|
res.sendFile(__dirname + '/' + nejm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/nepovednik/nepovid/:id', function (req, res) {
|
app.get('/nepovednik/nepovid/:id', function (req, res) {
|
||||||
let st = parseInt(req.params.id);
|
let st = parseInt(req.params.id);
|
||||||
if (st < 1 || st > 1000) {
|
if (st < 1 || st > 1000) {
|
||||||
|
|
Loading…
Reference in New Issue