-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcodiguito.js
More file actions
52 lines (44 loc) · 945 Bytes
/
codiguito.js
File metadata and controls
52 lines (44 loc) · 945 Bytes
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
var nodo;
$(document).on("ready", iniciar);
function iniciar()
{
delete localStorage.nombre;
transicion();
$("#formulario").on("submit", guardar);
}
function guardar(ev)
{
ev.preventDefault();
var n = $("#nombre").val();
localStorage.nombre = n;
transicion();
//console.debug(ev);
}
function transicion()
{
if(localStorage.nombre)
{
$("#nombre").hide();
$("#enviar").css("display", "none");
$("#historia").slideUp();
$("#formulario label").text("Pura vida " + localStorage.nombre);
conectar(localStorage.nombre);
}
}
function conectar(nom)
{
nodo = io.connect("http://10.255.0.79:6969");
nodo.emit("ingresoUsuario", nom);
nodo.on("notificacionServer", saludo);
}
function saludo(serverNombre)
{
$("#formulario label").text(serverNombre + " es tuanis!");
$("#formulario label").fadeOut().fadeIn();
}
// $(document).ready(
// function ()
// {
// alert("Aprendí! (╯°□°)╯︵ ┻━┻");
// }
// );