-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcd.html
More file actions
126 lines (116 loc) · 4.37 KB
/
Copy pathbcd.html
File metadata and controls
126 lines (116 loc) · 4.37 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset=utf-8 />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nous contacter | Satan Technology</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
</head>
<body>
<!-- Main container -->
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Satan Technology <small>Votre malheur est notre bonheur</small></h1>
<div class="panel panel-default">
<div class="panel-heading">Remplissez le formulaire ci-dessous pour obtenir notre brochure gratuite !</div>
<div class="panel-body">
<!-- Phone number form -->
<form id="hellform">
<div class="form-group">
<label for="phoneNumber">Numéro de téléphone :</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-earphone" aria-hidden="true"></span></span>
<input disabled="true" type="email" class="form-control" id="phoneNumber" placeholder="Numéro de téléphone">
</div>
</div>
<div class="form-group">
<label class="control-label">Saisissez chaque chiffre de votre numéro en entrant une valeur en
<a href="https://fr.wikipedia.org/wiki/D%C3%A9cimal_cod%C3%A9_binaire">Décimal Codé Binaire</a> puis en cliquant sur le bouton "Suivant" :</label>
<div class="row form-control-static">
<span class="col-xs-8 col-sm-offset-4 col-sm-3"><input type="number" class="form-control" id="bcdNumber" placeholder="0000"></span>
<span class="col-xs-1 col-sm-1"><a id="nextDigitButton" class="btn btn-default text-center" href="#" role="button">Suivant</a></span>
</div>
</div>
<button id="submit" class="btn btn-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Valider</button>
<button id="cancel" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Annuler</button>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Third-Party JavaScript -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Third-Party JavaScript -->
<script>
// Avoid submit when pressing enter key (hell patent pending)
$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
// Retrieve all instances
form = $('#hellform')
phoneNumberInput = $('#phoneNumber')
submitButton = $('#submit')
cancelButton = $('#cancel')
bcdNumber = $('#bcdNumber')
nextDigitButton = $('#nextDigitButton')
// BCD Look-Up-Table
var bcd_lut = {
'0000': 0,
'0001': 1,
'0010': 2,
'0011': 3,
'0100': 4,
'0101': 5,
'0110': 6,
'0111': 7,
'1000': 8,
'1001': 9,
}
// Handle digit saving
nextDigitButton.click(function(event) {
var bcd = bcdNumber.val();
if (!(bcd in bcd_lut)) {
alert("Chiffre invalide. Veuillez réessayer.");
bcdNumber.val('');
return;
}
var value = phoneNumberInput.val();
phoneNumberInput.val(value + bcd_lut[bcd].toString());
bcdNumber.val('');
});
// Handle submit button
submitButton.click(function(event) {
var regex = new RegExp("^(0[1-9][0-9]{8})$");
if (regex.test(phoneNumberInput.val())) {
console.log('Rick Rolled');
form.replaceWith('<div class="embed-responsive embed-responsive-16by9">' +
'<iframe class="embed-responsive-item" width="560" height="315" ' +
'src="https://www.youtube.com/embed/DLzxrzFCyOs?autoplay=1" frameborder="0" allowfullscreen></iframe></div>');
} else {
alert("Numéro de téléphone invalide. Veuillez réessayer.");
phoneNumberInput.val(''); // Pure evil and hate
}
event.preventDefault();
return false;
});
// Handle cancel button
cancelButton.click(function(event) {
phoneNumberInput.val('');
bcdNumber.val('');
event.preventDefault();
return false;
});
</script>
</body>
</html>