-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
105 lines (96 loc) · 2.86 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Randomizer</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<style>
.result-container
{
padding-top: 5em;
}
#resultNumber
{
font-size: 300px;
color: green;
}
.glyphicon-refresh-animate {
-animation: spin .7s infinite linear;
-webkit-animation: spin2 .7s infinite linear;
}
@-webkit-keyframes spin2 {
from { -webkit-transform: rotate(0deg);}
to { -webkit-transform: rotate(360deg);}
}
@keyframes spin {
from { transform: scale(1) rotate(0deg);}
to { transform: scale(1) rotate(360deg);}
}
#spinner
{
font-size: 200px;
display: none;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<form action="">
<div class="panel panel-success">
<div class="panel-heading">
<h1>Parameters</h1>
</div><!-- panel-heading -->
<div class="panel-body">
<form action="">
<div class="form-group">
<label for="min">Min:</label>
<input id="min" type="text" class="form-control" placeholder="Minimum Value Here" value="1">
</div><!-- form-group -->
<div class="form-group">
<label for="max">Max:</label>
<input id="max" type="text" class="form-control" placeholder="Maximum Value Here" value="300">
</div><!-- form-group -->
</form><!-- form -->
</div><!-- panel-body -->
<div class="panel-footer">
<div class="input-group">
<div class="input-group-addon"><span class="glyphicon glyphicon-search"></span></div><input class="btn btn-success" type="button" id="trigger" value="Here goes!">
</div><!-- panel-footer -->
</div>
</div><!-- panel -->
</div><!-- col-sm-4 -->
<div class="col-sm-8">
<div class="result-container">
<h1 id="resultNumber"></h1>
<img id="spinner" src="img/preloader.gif" />
</div><!-- result-container -->
</div><!-- col-sm-8 -->
</div><!-- row -->
</div>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
function vn(string)
{
var val = string.replace(',','');
return Number(val);
}
function getRandomNumber(min, max){
return _.random(min,max);
}
$('#trigger').click(function(){
$('#resultNumber').text('').hide("100", function(){
$('#spinner').show();
});
var min, max, result;
min = vn($('#min').val());
max = vn($('#max').val());
result = getRandomNumber(min,max);
$('#resultNumber').text(result).delay(3000).show(500, function(){ $('#spinner').hide() });
})
</script>
</body>
</html>