-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
90 lines (86 loc) · 2.81 KB
/
sketch.js
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
var skin = "nazi";
var metaServerUrl = "https://localhost";
$('#Login').on('click', function() {
// $( ".cover-container" ).append( "<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>");
console.log("click!");
});
console.log("connected");
var selected = "King of the Hill";
$(function() {
$('div.product-chooser').not('.disabled').find('div.product-chooser-item').on('click', function() {
$(this).parent().parent().find('div.product-chooser-item').removeClass('selected');
$(this).addClass('selected');
$(this).find('input[type="radio"]').prop("checked", true);
selected = $(this).attr('id');
console.log(selected);
});
$('#nazi').on('click', function(){
skin = "nazi";
});
$('#ninja').on('click', function(){
skin = "ninja";
});
});
var redirect = function(location) {
window.location = location;
}
$(function() {
$('#Login').on('click', function() {
var pseudo = $('#Pseudo').val();
socket = io.connect(metaServerUrl);
if (pseudo != "") {
socket.emit('User', selected);
socket.on('id', function(data) {
var id = data.id;
var url = data.url;
var data = {
pseudo: pseudo,
id: id,
url: url,
skin: skin
};
document.cookie = "id=" + data.id.toString();
socket.emit('dataPlayer', data);
setTimeout(function() {
redirect(url);
}, 3000);
});
} else {
alert("please enter a pseudo");
}
});
});
$(function() {
// Nav Tab stuff
$('.nav-tabs > li > a').click(function() {
if ($(this).hasClass('disabled')) {
return false;
} else {
var linkIndex = $(this).parent().index() - 1;
$('.nav-tabs > li').each(function(index, item) {
$(item).attr('rel-index', index - linkIndex);
});
}
});
$('#step-1-next').click(function() {
// Check values here
var isValid = true;
if (isValid) {
$('.nav-tabs > li:nth-of-type(2) > a').removeClass('disabled').click();
}
});
$('#step-2-next').click(function() {
// Check values here
var isValid = true;
if (isValid) {
$('.nav-tabs > li:nth-of-type(3) > a').removeClass('disabled').click();
}
});
$('#step-3-next').click(function() {
// Check values here
var isValid = true;
if (isValid) {
$('.nav-tabs > li:nth-of-type(4) > a').removeClass('disabled').click();
}
});
});