TVJR/views/TV.ejs

118 lines
3.5 KiB
Plaintext
Executable File

<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--Import materialize.css-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Page TV</title>
<style>
.heading { color: black; }
</style>
<script src="/socket.io/socket.io.js"></script>
<script>
$(function () {
var socket = io();
socket.on('Communication', function(msg){
var CommunicationJSON = JSON.parse(msg);
console.debug(CommunicationJSON)
CommunicationJSON.ListeCom.forEach(function(Communication){
switch (Communication.level) {
case "1":
$("#lvl1").append('<li class="caption center-align" data-idPub="'+Communication.IDPub+'\">'+Communication.html+'</li>')
break;
case "2":
$("#lvl2").append('<li class="caption center-align" data-idPub="'+Communication.IDPub+'\">'+Communication.html+'</li>')
break;
case "3":
$("#lvl3").append('<li class="caption center-align" data-idPub="'+Communication.IDPub+'\">'+Communication.html+'</li>')
break;
default:
}
})
});
<% if(typeof zone != 'undefined') { %>
socket.emit("JoinZone", "<%= zone %>");
<% } %>
$("#btnJoin").click(function(){
socket.close().connect();
socket.emit("JoinZone", $("#zone").val());
})
});
</script>
</head>
<body>
<!--<div class="row">-->
<div class="slider">
<ul class="slides" id="lvl1">
</ul>
</div>
<div class="slider" >
<ul class="slides" id="lvl2">
</ul>
</div>
<div class="slider" >
<ul class="slides" id="lvl3">
</ul>
</div>
<!-- Section slider pour M3-->
<!--</div>-->
<!--JavaScript at end of body for optimized loading-->
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
// Slider
$(document).ready(function(){
$('.slider').slider({indicators: false})
});
</script>
<script>
<% if(typeof pub != 'undefined') {
for(var i=0;i<pub.length;i++){ %>
var x = "<%= pub[i].Type%>";
console.debug(x);
<%
switch (pub[i].Type) {
case 1: %>
$("#lvl1").append('<li class="caption center-align" data-idPub="<%=pub[i].ID_Com%>"\><%=pub[i].Texte%></li>')
<%break;
case 2: %>
$("#lvl2").append('<li class="caption center-align" data-idPub="<%=pub[i].ID_Com%>"\><%=pub[i].Texte%></li>')
<%break;
case 3: %>
$("#lvl3").append('<li class="caption center-align" data-idPub="<%=pub[i].ID_Com%>"\><%=pub[i].Texte%></li>')
<%break;%>
<% } %>
<% } %>
var x = "<%= pub.length%>";
console.debug(x);
<% } %>
</script>
</body>
</html>