2020-10-03 17:44:16 +01:00
|
|
|
<!doctype HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>twitch.tforgione.fr</title>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2020-11-05 16:23:42 +00:00
|
|
|
<link rel="icon" type="image/ico" href="/favicon.ico"/>
|
2020-10-04 15:37:01 +01:00
|
|
|
<link href="css/video-js.css" rel="stylesheet">
|
2020-10-04 20:09:13 +01:00
|
|
|
<link href="css/spinner.css" rel="stylesheet">
|
2020-10-03 17:44:16 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="container"></div>
|
2020-10-04 15:37:01 +01:00
|
|
|
<script src="js/vd.js"></script>
|
2020-10-03 17:44:16 +01:00
|
|
|
<script src="js/main.js"></script>
|
|
|
|
<script>
|
2021-04-03 22:33:01 +01:00
|
|
|
function isDarkMode(e) {
|
|
|
|
var darkMode = JSON.parse(localStorage.getItem('darkMode'));
|
|
|
|
|
|
|
|
if (darkMode === null) {
|
|
|
|
if (e === undefined) {
|
|
|
|
e = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');
|
|
|
|
}
|
|
|
|
|
|
|
|
darkMode = e.matches === true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return darkMode;
|
|
|
|
}
|
|
|
|
|
2020-10-04 15:37:01 +01:00
|
|
|
var app = Elm.Main.init({
|
2020-10-04 19:20:16 +01:00
|
|
|
node: document.getElementById('container'),
|
2021-04-03 22:33:01 +01:00
|
|
|
flags: {
|
|
|
|
width: window.innerWidth,
|
|
|
|
height: window.innerHeight,
|
|
|
|
darkMode: isDarkMode(),
|
|
|
|
darkSetting: JSON.parse(localStorage.getItem('darkMode'))
|
|
|
|
}
|
2020-10-03 17:44:16 +01:00
|
|
|
});
|
2020-10-04 15:37:01 +01:00
|
|
|
|
2020-10-04 20:31:16 +01:00
|
|
|
var lastId, player;
|
|
|
|
|
2021-04-03 22:33:01 +01:00
|
|
|
if (app.ports !== undefined) {
|
|
|
|
if (app.ports.registerVideo !== undefined) {
|
|
|
|
app.ports.registerVideo.subscribe(function(args) {
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
var time = vd.parseTime(args[2]) || undefined;
|
|
|
|
|
|
|
|
requestAnimationFrame(function() {
|
|
|
|
if (args[0] !== lastId) {
|
|
|
|
lastId = args[0];
|
|
|
|
|
|
|
|
player = vd.setup(args[0], {
|
|
|
|
v: args[1] + "/manifest.m3u8",
|
|
|
|
t: time,
|
|
|
|
focus: true
|
|
|
|
});
|
|
|
|
} else if (time !== undefined ){
|
|
|
|
player.currentTime(time);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (app.ports.setDarkMode !== undefined) {
|
|
|
|
app.ports.setDarkMode.subscribe(function(arg) {
|
|
|
|
if (arg === null) {
|
|
|
|
localStorage.removeItem('darkMode');
|
|
|
|
} else {
|
|
|
|
localStorage.setItem('darkMode', arg);
|
2020-10-04 22:03:38 +01:00
|
|
|
}
|
2021-04-03 22:33:01 +01:00
|
|
|
app.ports.darkMode.send(isDarkMode());
|
2020-10-04 22:03:38 +01:00
|
|
|
});
|
2021-04-03 22:33:01 +01:00
|
|
|
}
|
2020-10-04 22:03:38 +01:00
|
|
|
}
|
2020-10-05 10:26:11 +01:00
|
|
|
|
2021-04-03 22:33:01 +01:00
|
|
|
if (app.ports !== undefined) {
|
|
|
|
if (app.ports.eraseVideo !== undefined) {
|
|
|
|
app.ports.eraseVideo.subscribe(function() {
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
lastId = undefined;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function(e) {
|
|
|
|
app.ports.darkMode.send(isDarkMode(e));
|
2020-10-05 10:26:11 +01:00
|
|
|
});
|
|
|
|
}
|
2021-04-03 22:33:01 +01:00
|
|
|
|
2020-10-03 17:44:16 +01:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|