-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtable.html
131 lines (120 loc) · 6.57 KB
/
table.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
<!doctype html>
<html>
<head>
<!-- Project ChulaDirect: Chulalongkorn University Direct Entrance Score Calculator -->
<!-- Copyright (C) 2018-2021 Siwat Techavoranant -->
<!-- github.com/keenthekeen/ChulaDirect -->
<meta charset="UTF-8"/>
<title>ดูภาพรวม รับตรงจุฬา 2564</title>
<meta name="google" content="notranslate"/>
<meta name="robots" content="noindex, nofollow"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#3f51b5"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" integrity="sha256-OweaP/Ic6rsV+lysfyS4h+LM6sRwuO3euTYfr6M124g=" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link href="app.css" rel="stylesheet"/>
<style>
.container {
min-width: 500px;
}
</style>
</head>
<body>
<nav class="indigo" role="navigation">
<div class="nav-wrapper container">
<a id="logo-container" href="/" class="brand-logo th">
คำนวณคะแนนรับตรงจุฬาฯ 2564
</a>
<ul class="right hide-on-med-and-down">
<li class="active"><a href="index.html">หน้าแรก</a></li>
</ul>
</div>
</nav>
<main class="container">
<a href="index.html" class="blue-text" style="margin-top:2rem"><i class="small material-icons">arrow_back</i> กลับ</a>
<h5 class="center-align" style="font-weight: bold">ดูคณะทั้งหมด</h5>
<table id="compareTable">
<tr>
<td>กำลังโหลด...</td>
</tr>
</table>
<p class="grey-text" style="font-size:0.85rem">หมายเหตุ: ไม่แสดงคณะที่มีคะแนนสอบไม่ครบ, N/A หมายถึง ไม่มีข้อมูล, โปรดศึกษาเกณฑ์ขั้นต่ำและเงื่อนไขของแต่ละคณะด้วยตนเอง, คะแนนปี 2561 อิงจากรอบ 3/1</p>
</main>
<footer class="page-footer indigo">
<div class="footer-copyright">
<div class="container">
<a href="index.html">กลับไปยังหน้าแรก</a>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js" integrity="sha256-U/cHDMTIHCeMcvehBv1xQ052bPSbJtbuiw4QA9cTKz0=" crossorigin="anonymous"></script>
<script type="text/javascript">
var list;
$(function () {
if (localStorage.getItem('gat') || localStorage.getItem('bsoc') || localStorage.getItem('pat1')) {
fetch('chula.json').then(function (response) {
return response.json();
}).then(function (data) {
list = data;
var tableCode = '<tr><th>คณะ</th><th>คะแนนที่ได้</th><th>ต่ำสุดปี 64</th><th>ต่ำสุดปี 63</th><th>ต่ำสุดปี 62</th><th>ต่ำสุดปี 61</th><th>ต่ำสุดปี 60</th><th>ต่ำสุดปี 59</th><th>ต่ำสุดปี 58</th><th>จำนวนรับ (คน)</th></tr>';
// Loop through faculties
for (var i in list) {
// Calculate Score
var facultyCal = list[i]["calculate"];
var score = 0;
var scoreNotFound = false;
// Loop through each test
for (var m in facultyCal) {
if (localStorage.getItem(m)) {
score += localStorage.getItem(m) * facultyCal[m];
if (localStorage.getItem(m) <= 0) {
scoreNotFound = true;
}
} else {
scoreNotFound = true;
}
}
if (!scoreNotFound) {
tableCode += '<tr><td>' + list[i].name + '</td><td>' + score.toLocaleString('en-US') + '</td>';
var fPrevious = list[i]["previous"];
if (fPrevious === undefined) {
tableCode += '<td class="grey-text">N/A</td><td class="grey-text">N/A</td><td class="grey-text">N/A</td><td class="grey-text">N/A</td><td class="grey-text">N/A</td><td class="grey-text">N/A</td><td class="grey-text">N/A</td>';
} else {
var year = 2564;
while (year >= 2558) {
if (fPrevious[year.toString()] === undefined) {
tableCode += '<td>-</td>';
} else {
tableCode += '<td>' + fPrevious[year.toString()].toLocaleString('en-US');
var diff = (score - fPrevious[year.toString()]).toFixed(2);
if (diff >= 0) {
tableCode += "<br />(<span class='green-text'>+" + diff.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "</span>)</td>";
} else {
tableCode += "<br />(<span class='red-text'>" + diff.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + "</span>)</td>";
}
}
year--;
}
}
tableCode += '<td>' + ((list[i].acceptance === undefined) ? '<span class="grey-text">N/A</span>' : list[i].acceptance) + '</td></tr>';
}
}
$("#compareTable").html(tableCode);
});
} else {
document.write('ไม่มีข้อมูลคะแนนสอบ <a href="index.html">กลับหน้าแรก</a>');
}
});
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-40738950-5"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-40738950-5');
</script>
</body>
</html>