-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-key.html
134 lines (132 loc) · 4.78 KB
/
test-key.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
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="en">
<head>
<title>test api key</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" crossorigin="anonymous">
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script>
$(function() {
$("#submit").click(function() {
$('.result').hide();
$(".loading").show();
let key = $('#hash').val();
$.getJSON(`https://runkit.io/nicoschmitt/api-version/2.0.1/testkey/${key}?format=jsonp&callback=?`)
.done(data => {
console.log(data);
if (data.valid) {
$('.result').text(data.rpm + ' rpm key valid for ' + moment.utc(+data.expiration * 1000).toNow(true));
} else {
$('.result').text('invalid');
}
$('.loading').hide();
$('.result').show();
});
});
});
</script>
<style>
html, body {
background-color: #333;
color: #eee;
font-family: Roboto;
margin: 0;
}
.main {
margin-top: 10em;
text-align: center;
}
.info {
margin-top: 1em;
}
.loading {
font-size: 2em;
}
.result {
font-size: 1.5em;
}
</style>
<style type="text/css">
input[type=text],
input[type=date],
input[type=datetime],
input[type=number],
input[type=search],
input[type=time],
input[type=url],
input[type=email],
textarea,
select{
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
border:1px solid #BEBEBE;
padding: 7px;
margin:0px;
transition: all 0.30s ease-in-out;
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
outline: none;
}
input[type=text]:focus,
input[type=date]:focus,
input[type=datetime]:focus,
input[type=number]:focus,
input[type=search]:focus,
input[type=time]:focus,
input[type=url]:focus,
input[type=email]:focus,
textarea:focus,
select:focus{
-moz-box-shadow: 0 0 8px #88D5E9;
-webkit-box-shadow: 0 0 8px #88D5E9;
box-shadow: 0 0 8px #88D5E9;
border: 1px solid #88D5E9;
}
.field-divided{
width: 49%;
}
.field-long{
width: 100%;
}
.field-select{
width: 100%;
}
.field-textarea{
height: 100px;
}
input[type=submit], input[type=button]{
background: #4B99AD;
padding: 8px 15px 8px 15px;
border: none;
color: #fff;
}
input[type=submit]:hover, input[type=button]:hover{
background: #4691A4;
box-shadow:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
}
</style>
</head>
<body>
<div class="container main">
<div class="row align-items-center align-self-center">
<div class="col col-sm-12 align-self-center">
<input type="text" placeholder="hash key" id="hash" name="hash" class="field-divided" />
<input type="submit" id="submit" value="Submit" />
<div class="info">
<div class="loading" style="display:none">loading...</div>
<div class="result" style="display:none">
</div>
</div>
</div>
</div>
</div>
</body>
</html>