-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeyboard.html
More file actions
134 lines (125 loc) · 5.53 KB
/
Copy pathkeyboard.html
File metadata and controls
134 lines (125 loc) · 5.53 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
127
128
129
130
131
132
133
134
<!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="number" 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 avec le clavier ci-dessous :</label>
<div class="row form-control-static text-center">
<span class="col-xs-4"><a id="keypad_0" class="btn btn-default text-center" href="#" role="button">0</a></span>
<span class="col-xs-4"><a id="keypad_1" class="btn btn-default text-center" href="#" role="button">1</a></span>
<span class="col-xs-4"><a id="keypad_2" class="btn btn-default text-center" href="#" role="button">2</a></span>
<span class="col-xs-12" style="height: 15px"></span>
<span class="col-xs-4"><a id="keypad_3" class="btn btn-default text-center" href="#" role="button">3</a></span>
<span class="col-xs-4"><a id="keypad_4" class="btn btn-default text-center" href="#" role="button">4</a></span>
<span class="col-xs-4 "><a id="keypad_5" class="btn btn-default text-center" href="#" role="button">5</a></span>
<span class="col-xs-12" style="height: 15px"></span>
<span class="col-xs-4"><a id="keypad_6" class="btn btn-default text-center" href="#" role="button">6</a></span>
<span class="col-xs-4"><a id="keypad_7" class="btn btn-default text-center" href="#" role="button">7</a></span>
<span class="col-xs-4"><a id="keypad_8" class="btn btn-default text-center" href="#" role="button">8</a></span>
<span class="col-xs-12" style="height: 15px"></span>
<span class="col-xs-offset-4 col-xs-4"><a id="keypad_9" class="btn btn-default text-center" href="#" role="button">9</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')
var keypads = [];
// Handle digits
function shuffleKeypads() {
var currentIndex = 10, temporaryValue, randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = keypads[currentIndex].text();
keypads[currentIndex].text(keypads[randomIndex].text());
keypads[randomIndex].text(temporaryValue);
}
}
function createCallback(digit){
return function(event) {
var value = phoneNumberInput.val();
phoneNumberInput.val(value + $(event.target).text());
shuffleKeypads();
}
}
for (var i = 0; i < 10; i++) {
var keypad = $('#keypad_' + i);
keypads.push(keypad);
keypad.click(createCallback(i));
}
// 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('');
for (var i = 0; i < 10; i++) {
keypads[randomIndex].text(i);
}
event.preventDefault();
return false;
});
</script>
</body>
</html>