master
Jure Podgoršek 2017-12-06 02:31:02 +01:00
parent c3b30dd59f
commit 94c7078134
2 changed files with 44 additions and 20 deletions

View File

@ -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,6 +105,9 @@
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() {
@ -116,6 +121,13 @@
loading = setTimeout(pridobiPosnetek, 3000); loading = setTimeout(pridobiPosnetek, 3000);
} else { } else {
loader.style.display = "none"; loader.style.display = "none";
if (iOS) {
resp = "/apple" + resp;
}
document.getElementById("dlGumb").href = '/nepovednik' + resp;
tv.src = '/nepovednik' + resp; tv.src = '/nepovednik' + resp;
tv.play(); tv.play();
loading = null; loading = null;

View File

@ -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) {