-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
104 lines (103 loc) · 4.19 KB
/
index.html
File metadata and controls
104 lines (103 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE HTML>
<html lang="es">
<head>
<title>MainU</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<link rel="stylesheet" href="assets/css/main.css"/>
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<noscript>
<link rel="stylesheet" href="assets/css/noscript.css"/>
</noscript>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
function bocadillos() {
fetch('https://api.mainu.eus/bocadillos', {mode: 'cors'})
.then(res => res.json())
.then(function (bocadillos) {
console.log(bocadillos);
let lista = "";
for (const bocadillo of bocadillos) {
lista = lista + "<a >" + bocadillo.nombre + " <b>" + bocadillo.precio + "</b></a><br/>";
}
document.getElementById("lista-bocadillos").innerHTML = lista;
document.getElementById("menu").style.display = "none";
document.getElementById("bocadillos").style.display = "block";
})
.catch(function (error) {
console.log("Error: " + error.message);
});
}
function menu_del_dia() {
fetch('https://api.mainu.eus/menu', {mode: 'cors'})
.then(res => res.json())
.then(function (menu) {
console.log(menu);
let primeros = "";
let segundos = "";
let postre = "";
for (const plato of menu.primeros) {
primeros = primeros + "<a >" + plato.nombre + "</a><br/>";
}
for (const plato of menu.segundos) {
segundos = segundos + "<a >" + plato.nombre + "</a><br/>";
}
for (const plato of menu.postre) {
postre = postre + "<a >" + plato.nombre + "</a> ";
}
document.getElementById("primeros").innerHTML = primeros;
document.getElementById("segundos").innerHTML = segundos;
document.getElementById("postre").innerHTML = postre;
document.getElementById("bocadillos").style.display = "none";
document.getElementById("menu").style.display = "block";
})
.catch(function (error) {
console.log("Error: " + error.message);
});
}
</script>
</head>
<body class="is-preload">
<div id="wrapper">
<header id="header">
<h1>MainU</h1>
<p>Versión web
<small><sup>BETA</sup></small>
</p>
</header>
<div align="center" id="main">
<section id="content" class="main">
<a class="button" onclick="menu_del_dia()">Menú del día</a>
<a class="button" onclick="bocadillos()">Bocadillos</a>
</section>
<section id="menu" class="main" style="display: none;">
<h2>Primeros</h2>
<div id="primeros"></div>
<br/>
<h2>Segundos</h2>
<div id="segundos"></div>
<br/>
<h2>Postre</h2>
<div id="postre"></div>
</section>
<section id="bocadillos" class="main" style="display: none;">
<h2>Listado de bocadillos</h2>
<div id="lista-bocadillos"></div>
</section>
<nav id="nav">
<ul>
<li><a style="color:#333333" href="https://github.com/mainu4u">Ir a Github</a></li>
<li><a href="https://mainu.eus">Ir a mainu.eus</a></li>
</ul>
</nav>
</div>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.scrollex.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>