forked from jimting/AREEAnswer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
82 lines (76 loc) · 1.92 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
---
title: IRM/REC過不了嗎?
layout: home
---
<!DOCTYPE html>
<html>
<head>
<style>
body
{
font-size:50px;
}
#footer
{
position: fixed;
bottom: 8px;
right: 8px;
}
</style>
<script>
var datas;
var data_json = [];
{% if site.github.owner_name == "jimting" %}
var repo_url = "jimting/AREEAnswer";
{% else %}
var repo_url = "{{ site.github.repository_nwo }}";
var branch = "{{ site.github.source.branch }}";
{% endif %}
var answer_url = "https://raw.githubusercontent.com/"+`${repo_url}`+"/master/answer.json";
function init()
{
//拿取資料
$.get(answer_url, function(data, status)
{
datas = JSON.parse(data);
$( "#result" ).text("拿取題庫完成,請輸入關鍵字查詢題庫。");
});
}
function checkQuestion()
{
//清空result區資料
$( "#result" ).text("");
data_json = [];
var input = $("#input").val();
console.log(datas.length);
for(var i = 0; i < datas.length;i++)
{
var str = JSON.stringify(datas[i]);
if(str.includes(input))
{
prtQ(i);
}
}
}
function prtQ(number)
{
var result = "===<br>("+number+") 題目:<br>"+datas[number].name+"<br>";
result += "選項與答案:<br>";
for(var i = 0;i < datas[number].options.length;i++)
result += datas[number].options[i]+"<br>";
$( "#result" ).append(result);
}
</script>
</head>
<body onload=init()>
<h1>The project is called {{ site.title }}</h1>
<div class="form-group">
<label for="input">輸入題目關鍵字</label>
<input type="text" class="form-control" id="input">
</div>
<button type="button" class="btn btn-primary btn-lg btn-block" onclick=checkQuestion()>查詢題目資料</button>
<div id="result">
</div>
<div id="footer">Github:<a href="https://github.com/{{ site.github.owner_name }}">{{ site.github.owner_name }}</a></div>
</body>
</html>