major v7: Standardiser l'organisation du projet
This commit is contained in:
parent
7c4e8d8227
commit
6cdc40926b
17 changed files with 72 additions and 66 deletions
79
ui/css/style.css
Normal file
79
ui/css/style.css
Normal file
|
@ -0,0 +1,79 @@
|
|||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
embed {
|
||||
max-width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
#contenu {
|
||||
background-color: black;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
#bar {
|
||||
width: 100%;
|
||||
background-image: linear-gradient(to right, #033ead, #3093d1);
|
||||
color: white;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 75px;
|
||||
}
|
||||
|
||||
img#bar-bg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
#time {
|
||||
font-size: 300%;
|
||||
height: 53px;
|
||||
}
|
||||
|
||||
#text-content {
|
||||
white-space: nowrap;
|
||||
z-index: 1;
|
||||
display: block;
|
||||
height: 100%;
|
||||
padding-top: 55px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#text-container {
|
||||
height: 100%;
|
||||
background-image: linear-gradient(to right, #033ead, #3093d1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 20px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
#text-content div {
|
||||
display: block;
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#date-time {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-color: #033ead;
|
||||
z-index: 1;
|
||||
width: 225px;
|
||||
}
|
18
ui/embed.go
Normal file
18
ui/embed.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package ui
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed html/*
|
||||
var htmlFS embed.FS
|
||||
|
||||
func HTMLFS() embed.FS { return htmlFS }
|
||||
|
||||
//go:embed css/*
|
||||
var cssFS embed.FS
|
||||
|
||||
func CSSFS() embed.FS { return cssFS }
|
||||
|
||||
//go:embed js/*
|
||||
var jsFS embed.FS
|
||||
|
||||
func JSFS() embed.FS { return jsFS }
|
43
ui/html/index.html
Normal file
43
ui/html/index.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>AGECEM | slider</title>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||||
|
||||
<script src="/public/js/slider.js"></script>
|
||||
|
||||
<!-- BROKEN, brise slider.js quand inclu
|
||||
<script src="text.js"></script>
|
||||
!-->
|
||||
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p id="debug"></p>
|
||||
|
||||
<div id="contenu">
|
||||
<embed id="image"/>
|
||||
</div>
|
||||
|
||||
<!-- BROKEN
|
||||
<div id="bar">
|
||||
|
||||
<div id="date-time">
|
||||
<div id="time"></div>
|
||||
<div id="date"></div>
|
||||
</div>
|
||||
|
||||
<div id="text-container">
|
||||
<div id="text-content">
|
||||
<div>Ce texte sera remplacé par jQuery!</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
--!>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
45
ui/js/slider.js
Normal file
45
ui/js/slider.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
var images = [];
|
||||
var indexImages = 0;
|
||||
|
||||
function afficherIndex() {
|
||||
$('#debug').text(indexImages);
|
||||
}
|
||||
|
||||
function afficherImage() {
|
||||
$('#image').attr('src', "/api/contenu/"+images[indexImages]);
|
||||
}
|
||||
|
||||
function augmenterIndex() {
|
||||
if (indexImages >= images.length - 1) {
|
||||
indexImages = 0;
|
||||
} else {
|
||||
indexImages ++;
|
||||
}
|
||||
}
|
||||
|
||||
function executionLoop(){
|
||||
//afficherIndex();
|
||||
afficherImage();
|
||||
augmenterIndex();
|
||||
}
|
||||
|
||||
function obtenirContenu(){
|
||||
var response = '';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: window.location.origin + "/api/contenu",
|
||||
async: false,
|
||||
success: function(text) {
|
||||
response = text;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(response);
|
||||
images = response.split(';');
|
||||
console.log(images);
|
||||
}
|
||||
|
||||
$(function(){
|
||||
obtenirContenu();
|
||||
var executionInterval = setInterval(executionLoop, 10000);
|
||||
});
|
65
ui/js/text.js
Normal file
65
ui/js/text.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
// VARS
|
||||
// Vitesses
|
||||
var vitesseTexte = 4000; // En millisecondes
|
||||
|
||||
// Coordonnées
|
||||
var pointInitial = '100%';
|
||||
var pointDestination = '-=2000px';
|
||||
|
||||
// Messages
|
||||
var messageDiv = '#text-content div'
|
||||
var messages = [];
|
||||
var indexMessages = 0;
|
||||
|
||||
var fontSize;
|
||||
var fontSizeLength;
|
||||
|
||||
// FUNCS
|
||||
function animerTexte(){
|
||||
// Diriger le texte vers la droite jusqu'à `pointDestination'.
|
||||
// Récursivement reset la position du texte.
|
||||
$(messageDiv).animate({left: pointDestination}, vitesseTexte, 'linear', resetTexte);
|
||||
}
|
||||
|
||||
function resetTexte(){
|
||||
// Remettre le texte au point initial
|
||||
$(messageDiv).css('left', pointInitial);
|
||||
|
||||
// Récursivement animer le texte
|
||||
animerTexte();
|
||||
}
|
||||
|
||||
function updateTexte(){
|
||||
var message = messages[indexMessages];
|
||||
|
||||
$(messageDiv).text(message);
|
||||
|
||||
augmenterIndex();
|
||||
}
|
||||
|
||||
function augmenterIndex() {
|
||||
if (indexMessages >= messages.length - 1) {
|
||||
indexMessages = 0;
|
||||
} else {
|
||||
indexMessages ++;
|
||||
}
|
||||
}
|
||||
|
||||
function initialiserMessages(){
|
||||
fontSize = $(messageDiv).css('fontSize');
|
||||
fontSizeLength = fontSize.length;
|
||||
|
||||
// TODO Importer messages
|
||||
messages = ['hello, world!'];
|
||||
|
||||
|
||||
// TODO pointDestination = -1 * longueurMessage
|
||||
//pointDestination = messages[0].width * fontSize.substring(fontSize.length-2);
|
||||
pointDestination = messages[indexMessages].width;
|
||||
}
|
||||
|
||||
// EXEC
|
||||
$(function(){
|
||||
//initialiserMessages();
|
||||
resetTexte();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue