-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (106 loc) · 3.46 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
106
107
108
109
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Asap|Paytone+One" rel="stylesheet">
<style>
body, input[type="text"], input[type="submit"] {
font-family: 'Asap', sans-serif; font-size: 24px;
text-align: center;
}
body, html, #container {
width: 100%; height: 100%;
}
#container {
margin: 0 auto; position: absolute;
left: 50%; width: 800px; margin-left: -400px;
top: 50%; height: 500px; margin-top: -250px;
}
h1, h2 {
font-family: 'Paytone One', cursive; color: #555;
margin: 50px;
}
h1 { font-size: 32px; }
h2 { font-size: 24px; }
input {
margin: 0; padding: 2px 20px; border: 1px solid #999;
}
#yes, #no, #maybe, #error, #thinking, #askagain {
display:none;
}
#qecho { color: #000; }
#askagain { font-size: 18px; }
</style>
<title>IETF Status</title>
<script type="text/javascript">
function answer(v) {
document.getElementById("thinking").style.display = 'none';
var aa = document.getElementById("askagain");
aa.style.display = 'block';
aa.firstChild.href = window.location.href;
var e = document.getElementById(v);
if (!e) {
e = document.getElementById("error");
}
e.style.display = 'block';
}
function ask() {
document.getElementById("thinking").style.display = 'block';
var q = document.getElementById("q").value.trim();
document.getElementById("question").style.display = 'none';
var isrfc = /^rfc\s*(\d+)$/i;
var m = isrfc.exec(q);
var positive = 'yes';
var prefix = 'rfc';
if (!m) {
var isdraft = /^(draft-ietf-\D+)(?:-\d{2})?$/i;
m = isdraft.exec(q);
positive = 'maybe';
prefix = '';
}
if (m) {
q = prefix + m[1];
fetch('https://datatracker.ietf.org/doc/' + q + '/doc.json')
.then(response => response.body.json())
.then(status => {
console.log('status', status);
if (status.std_level === 'Proposed Standard' ||
status.std_level === 'Draft Standard' ||
status.std_level === 'Internet Standard') {
answer(positive);
} else {
answer('no');
}
})
.catch(err => {
console.log('error', err);
answer('error');
});
q = q.replace(/-/g, '\u2060-\u2060').replace(/^rfc/, 'RFC ');
} else {
answer('no');
}
document.getElementById("qecho").innerText = q;
return false;
}
</script>
</head>
<body>
<div id="container">
<h1>Does the IETF think <span id="qecho">this</span> is a good idea?</h1>
<form action="" method="GET" id="form" onSubmit="return ask();">
<div id="question">
<input type="text" name="question" id="q"><input type="submit" name="?" id="submit" value="Ask">
</div>
</form>
<h2 id="no">No. The IETF has no opinion on this topic.</h1>
<h2 id="yes">Yes. The IETF thinks that this is a good idea.</h1>
<h2 id="maybe">Maybe. The IETF thinks that this is might be a good idea, but it's still working on it.</h1>
<h2 id="error">No idea. We encountered an error.</h1>
<p id="thinking">Thinking...</p>
<p id="askagain"><a href=".">Ask about something else</a>.</p>
</div>
</body>
</html>