JSFiddle - React, Tailwind, and code Playground
javascript timer
by abubelinha
HTML
<body>
<div style="border:1px solid red;max-height:100px;overflow:scroll;" id="divhora" onclick="this.innerHTML='';timer();">
...
</div>
<div style="border:1px solid red;height:50px;overflow:scroll;" id="fileurl" onclick="cargafile();">https://drive.google.com/uc?export=download&id=1ROPs4eIP4uV1zZFIsrhcZhFC9dcKeu_t</div>
</body>
<div style="border:1px solid red;height:100px;overflow:scroll;" id="filecontents" onclick="">aquí os contidos</div>
</body>
<div style="border:1px solid red;height:200px;overflow:scroll;" id="subtitles" onclick="">aquí os subtítulos</div>
</body>
JavaScript
function merda() {
alert("merda");
}
function timer() {
var start = Date.now();
ShowTime(start);
}
function ShowTime(start) {
var dt = new Date();
//documen t.write(dt.toTimeString() + '<br>');
document.getElementById("divhora").innerHTML
= '<br>'+dt.toTimeString()
+'<br>'+(dt-start);
// var elem = document.getElementById("divElem");
// elem.textContent = dt.toTimeString();
window.setTimeout("ShowTime("+start+");", 5000);
}
// https://www.labnol.org/internet/direct-links-for-google-drive/28356/
var url="https://drive.google.com/uc?export=download&id=1ROPs4eIP4uV1zZFIsrhcZhFC9dcKeu_t";
/** http://www.twodee.org/blog/?p=3647
Loading a remote file in JavaScript:
Callback for when jQuery has my file loaded. Places the
content in the filecontents div.
@param data File contents
*/
function handleFile(data) {
jQuery('#filecontents').html(data);
}
function cargafile(){
// SÓ VAI FUNCIONAR SE A URL que pasa a jQuery.get() é no mesmo dominio (neste caso, jsfiddle.net)
// Issue a request to load test_file as text (don't eval it, jQuery!).
jQuery.get(document.getElementById('fileurl').innerHTML + "&callback=?" ,
handleFile,
'text');
//documen t. write('<div id="filecontents"></div>');
}
/*
var texto="
1
00:00:12,560 --> 00:00:14,710
<i>Le vent souffle.</i>
2
00:00:15,080 --> 00:00:27,788
---
3
00:00:28,160 --> 00:00:29,149
Allez !
4
00:00:31,560 --> 00:00:35,235
Les 4 blondes, elles vont
en priorité dans le camion.
5
00:00:37,440 --> 00:00:38,316
Allez !
";
*/