-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
216 lines (201 loc) · 8.93 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!-- Written by Roman Dreyer [email protected] -->
<html dir="rtl" lang="he">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<!-- Google Tag Manager -->
<script>(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start':
new Date().getTime(), event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-WKJKMLL');</script>
<!-- End Google Tag Manager -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-9397182FCN"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'G-9397182FCN');
</script>
<style>
table, th, td {
border: 1px solid black;
font-family: "Arial", "Courier New", monospace;
}
.seltbl {
border: 0
}
.title {
font-family: "Arial", "Courier New", monospace;
font-weight: bold
}
</style>
<title>שיעורי בית</title>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WKJKMLL"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->
<form action="index.html" method="get">
<table class="seltbl">
<tr class="seltbl">
<td class="seltbl">
<label for="scl">בית ספר:</label>
</td>
<td class="seltbl">
<select id="scl" name="scl">
<option value="614370">אופק</option>
<option value="670331">אורט ימי</option>
<option value="611368">אחדות</option>
<option value="620070">אילנות</option>
<option value="614040">אמירים</option>
<option value="613208">ארזים</option>
<option value="614313">אשכול</option>
<option value="620468">בי"ח אסותא</option>
<option value="610097">גאולים</option>
<option value="620252">גוונים</option>
<option value="620187">גלים</option>
<option value="614503">היובל</option>
<option value="611962">המגינים</option>
<option value="612283">הראל</option>
<option value="613703">חופית</option>
<option value="623975">חנ"מ חדש</option>
<option value="612960">יח"ד</option>
<option value="614875">יצחק רבין</option>
<option value="640128">מקיף א כללי</option>
<option value="770461">מקיף ג' ע"ש רוגוזין</option>
<option value="640482">מקיף ד'</option>
<option value="640672">מקיף ה' כללי</option>
<option value="644310">מקיף ו'</option>
<option value="644377">מקיף ז'</option>
<option value="644484">מקיף ח'</option>
<option value="644583">מקיף חדש ט'</option>
<option value="620005">מקיף חדש רובע יז</option>
<option value="630764">מרכז נוער ע"ש משה קו</option>
<option value="613596">נוף ים</option>
<option value="620526">ניר</option>
<option value="644146">עלומים</option>
<option value="613000">צמח א'</option>
<option value="612911">צפרירים</option>
<option value="614958">קשת</option>
<option value="610485">רימונים</option>
<option value="612747">רננים</option>
<option value="612333">רעים</option>
<option value="614156">רתמים</option>
<option value="612556">שז"ר</option>
<option value="641449">שחקים</option>
<option value="615237">שירת הים</option>
<option value="614115">שקד</option>
</select>
</td>
</tr>
<tr class="seltbl">
<td class="seltbl">
<label for="cls">שכבה:</label>
</td>
<td class="seltbl">
<select id="cls" name="cls">
<option value="א">א</option>
<option value="ב">ב</option>
<option value="ג">ג</option>
<option value="ד">ד</option>
<option value="ה">ה</option>
<option value="ו">ו</option>
<option value="ז">ז</option>
<option value="ח">ח</option>
<option value="ט">ט</option>
<option value="י">י</option>
<option value="יא">יא</option>
<option value="יב">יב</option>
<option value="יג">יג</option>
<option value="יד">יד</option>
</select>
</td>
</tr>
<tr>
<td style="border: 0">
<label for="clsn">כיתה:</label>
</td>
<td style="border: 0">
<select id="clsn" name="clsn">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</td>
</tr>
<tr>
<td style="border: 0">
<input type="submit" value="הצג"/>
</tr>
</table>
</form>
<div id="title" class="title"></div>
<br>
<table id="hw_tbl"></table>
<script>
const urlParams = new URLSearchParams(window.location.search);
const cls = urlParams.get('cls');
const clsn = urlParams.get('clsn');
const scl = urlParams.get('scl');
document.getElementById("cls").value = cls;
document.getElementById("clsn").value = clsn;
document.getElementById("scl").value = scl;
//var url = 'https://safe.mashov.info/rss/rsshomework.aspx?semel=612960&classcode=%D7%91&classnum=2';
const enc_url = encodeURIComponent("https://safe.mashov.info/rss/rsshomework.aspx?semel=" + scl + "&classcode=" + cls + "&classnum=" + clsn);
//const myList = document.getElementById("hw_tbl");
//const myRequest = new Request(url);
console.log("cls: ",cls);
console.log("clsn: ",clsn);
console.log("scl: ",scl);
if (cls !== null && clsn !== null && scl !== null) {console.log("fetching https://api.allorigins.win/get?url=",enc_url);
fetch("https://api.allorigins.win/get?url=" + enc_url)
.then(response => {
if (response.ok) return response.json()
throw new Error('Network response was not ok.')
})
.then(data => myFunction(data))
.catch((error) => {console.error('Error: ', error);});
}
function myFunction(xml) {
var i;
console.log(xml.status.http_code);
console.log(xml.contents);
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xml.contents.trim(),"text/xml");
console.log(xmlDoc);
var table="<tr><th>Date</th><th>Subject</th><th>Description</th></tr>";
var x = xmlDoc.getElementsByTagName("item");
for (i = 0; i <x.length; i++) {
table +=
"<tr><td>" + x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue.split(" - ")[1] +
"</td><td>" + x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue.split(" - ")[0] +
"</td><td>" + x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue.replace("נושא השיעור:", "<b>נושא השיעור:</b>").replace("ש.ב.:", "<b>ש.ב.:</b>").replaceAll('\n', '<br/>') +
"</td></tr>";
}
document.getElementById("hw_tbl").innerHTML = table;
}
</script>
</body>
</html>