Skip to content

Commit e234233

Browse files
committed
duźo
poprawione title poprawione wyszukiwanie drobne zmiany w html i css dodane słowa spacjowane
1 parent e8ccb40 commit e234233

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

css/index.css

+21-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ body
55
{
66
margin: 0 auto;
77
display: flex;
8-
display: flex;
98
flex-direction: column;
109
align-items: center;
1110
background-image: url("../imgs/landing.webp");
@@ -38,22 +37,22 @@ main > div, header
3837
margin: 10px;
3938
padding: 15px;
4039
}
41-
div#lists
40+
section#lists
4241
{
4342
display: flex;
4443
justify-content: center;
4544
border-bottom-left-radius: 10px;
4645
border-bottom-right-radius: 10px;
4746
}
48-
div#lists > div:not(div.in_between)
47+
section#lists > div:not(div.in_between)
4948
{
5049
width: 50%;
5150
padding: 5px;
5251
display: flex;
5352
flex-direction: column;
5453
align-items: center;
5554
}
56-
div#lists > div:not(div.in_between) > h3
55+
section#lists > div:not(div.in_between) > h3
5756
{
5857
color: #76ABAE;
5958
}
@@ -71,7 +70,8 @@ li
7170
a
7271
{
7372
text-decoration: none;
74-
&&:hover
73+
74+
&:hover
7575
{
7676
text-decoration: underline;
7777
}
@@ -82,7 +82,7 @@ h1
8282
color: #76ABAE;
8383
font-size: 2.5em;
8484
}
85-
div#container
85+
section#container
8686
{
8787
display: flex;
8888
align-items: center;
@@ -110,11 +110,11 @@ input#search-input
110110
outline: none;
111111
transition: box-shadow 0.15s ease-in-out;
112112

113-
&&::placeholder
113+
&::placeholder
114114
{
115115
color: #888888;
116116
}
117-
&&:focus
117+
&:focus
118118
{
119119
box-shadow: 0 0 0 3px #76ABAE;
120120
}
@@ -139,15 +139,17 @@ button#search-button
139139
font-weight: bold;
140140
border-radius: 5px;
141141

142-
&&:hover
142+
&:hover
143143
{
144144
cursor: pointer;
145145
}
146146
}
147+
147148
a
148149
{
149150
color: #EEEEEE;
150-
&&:visited
151+
152+
&:visited
151153
{
152154
color: whitesmoke;
153155
}
@@ -170,4 +172,13 @@ a
170172
display: flex;
171173
justify-content: center;
172174
align-items: center;
175+
}
176+
177+
@media (max-width: 600px)
178+
{
179+
div#app
180+
{
181+
width: 90vw;
182+
min-width: unset;
183+
}
173184
}

index.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1>Plany ulubionych<br>nauczycieli ZSK</h1>
1515
</header>
1616

1717
<main>
18-
<div id="container">
18+
<section id="container">
1919
<div id="searching-container">
2020
<div id="search-field-container">
2121
<input type="text" id="search-input" placeholder="Szukaj nauczyciela">
@@ -26,13 +26,13 @@ <h1>Plany ulubionych<br>nauczycieli ZSK</h1>
2626
</div>
2727
<button id="search-button">Szukaj</button>
2828
</div>
29-
</div>
29+
</section>
3030

31-
<div id="lists">
31+
<section id="lists">
3232
<div id="o_list"><h3>KLASY</h3></div>
3333
<div class="in_between"></div>
3434
<div id="s_list"><h3>SALE</h3></div>
35-
</div>
35+
</section>
3636

3737
</main>
3838
</div>

js/plan_script.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,31 @@ else if (title.textContent.startsWith("Plan lekcji sali"))
1515
{
1616
let regex2 = /^\d{2}$/;
1717
if (header.textContent.match(regex2))
18+
{
1819
header.textContent = 's' + header.textContent;
20+
let firstNumberIndex = title.textContent.search(/\d/);
21+
title.textContent = `${title.textContent.slice(0, firstNumberIndex)} s${title.textContent.slice(firstNumberIndex)}`;
22+
}
1923
}
2024
else
2125
{
2226
header.textContent = `${header.textContent.slice(0, 2)} ${header.textContent.slice(2)}`;
27+
title.textContent = `${title.textContent.slice(0, title.textContent.indexOf('.') + 1)} ${title.textContent.slice(title.textContent.indexOf('.') + 1)}`;
2328
}
2429

25-
const wordsToAddSpace = ['Język', 'Pracownia', 'Tworzenie', 'aplikacji', 'Biznes', 'Zajęcia', 'Systemy', 'Wychowanie', 'Programowanie', 'baz', 'programowania', 'Projektowanie', 'Eksploatacja', 'handlowa', 'Działalność', 'usługowa', 'Testowanie', 'dokumentowanie', 'Technika', 'ruchu', 'projektowania', 'danych', 'Historia', 'fizyczne', 'internetowych', 'Informatyka', 'obiektowego','angielski', 'Podstawy', 'hiszpański', 'niemiecki', 'Elektrotechnika', 'Urządzenia', 'instalacje', 'urządzeń', 'montażu', 'Układy', 'elektryczne', 'elektryczna', 'Bezpieczeństwo', 'higiena', 'techniki', 'systemów', 'sieci', 'witryn', 'Edukacja', 'dla', 'podstaw', 'utrzymania', 'Pomiary', 'Sieci', 'podstacje', 'trakcyjne', 'elektroniczne', 'instalacji', 'Maszyny', 'urządzenia', 'testowania', 'dokumentowania'];
30+
const wordsToAddSpace = ['Język', 'Pracownia', 'Tworzenie', 'aplikacji', 'Biznes', 'Zajęcia', 'Systemy', 'Wychowanie', 'Programowanie', 'baz', 'programowania', 'Projektowanie', 'Eksploatacja', 'handlowa', 'Działalność', 'usługowa', 'Testowanie', 'dokumentowanie', 'Technika', 'ruchu', 'projektowania', 'danych', 'Historia', 'fizyczne', 'internetowych', 'Informatyka', 'obiektowego','angielski', 'Podstawy', 'hiszpański', 'niemiecki', 'Elektrotechnika', 'Urządzenia', 'instalacje', 'urządzeń', 'montażu', 'Układy', 'elektryczne', 'elektryczna', 'Bezpieczeństwo', 'higiena', 'techniki', 'systemów', 'sieci', 'witryn', 'Edukacja', 'dla', 'podstaw', 'utrzymania', 'Pomiary', 'Sieci', 'podstacje', 'trakcyjne', 'elektroniczne', 'instalacji', 'Maszyny', 'urządzenia', 'testowania', 'dokumentowania', 'Kompetencje'];
2631
const wordsToAddSpaceAfterFirstCharacter = ['zwychowawcą', 'izarządzanie', 'iurządzeń', 'idokumentowanie', 'ielektronika', 'ielektroniczna', 'iinstalacje', 'ihigiena', 'ielektroniczne', 'iutrzymania', 'ipodstacje', 'iurządzenia', 'idokumentowania']
2732

2833
let tdElements = document.querySelectorAll('td span.p');
2934
tdElements.forEach(td =>
3035
{
31-
wordsToAddSpace.forEach(word => {
36+
wordsToAddSpace.forEach(word =>
37+
{
3238
const regex = new RegExp(`(${word})(?=\\S)`, 'g');
3339
td.textContent = td.textContent.replace(regex, `$1 `);
3440
});
35-
wordsToAddSpaceAfterFirstCharacter.forEach(word => {
41+
wordsToAddSpaceAfterFirstCharacter.forEach(word =>
42+
{
3643
const regex = new RegExp(`(${word.charAt(0)})((${word.substring(1)}))`, 'g');
3744
td.textContent = td.textContent.replace(regex, `$1 $2`);
3845
});

js/script.js

+8-23
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function getDisplayName(filename)
3232

3333
function searchSchedules()
3434
{
35-
if(container.querySelector('div.search_results'))
35+
if (container.querySelector('div.search_results'))
3636
container.removeChild(container.querySelector('div.search_results'));
3737

3838
const searchTerm = search_input.value.toLowerCase();
@@ -41,7 +41,7 @@ function searchSchedules()
4141
resultsContainer.innerHTML = '';
4242

4343
const filteredSchedules = nspanTexts.filter(schedule =>
44-
schedule.toLowerCase().includes(searchTerm)
44+
schedule.toLowerCase().trim().slice(3).startsWith(searchTerm)
4545
);
4646

4747
filteredSchedules.forEach(schedule =>
@@ -52,45 +52,30 @@ function searchSchedules()
5252
resultsContainer.appendChild(a);
5353
});
5454

55-
if (filteredSchedules.length === 0)
55+
if (filteredSchedules.length === 0)
5656
resultsContainer.innerHTML = '<h2>Nie znaleziono.</h2>';
5757

5858
container.appendChild(resultsContainer);
5959
}
6060

6161
document.addEventListener('keydown', function(event)
6262
{
63-
if (event.ctrlKey && event.key === 'f') {
63+
if (event.ctrlKey && event.key === 'f')
64+
{
6465
event.preventDefault();
6566
search_input.focus();
6667
}
6768
});
68-
/*
69-
document.addEventListener('click', function(event)
70-
{
71-
if (event.target.tagName === 'a')
72-
{
73-
if (event.target.href.includes('dane/o'))
74-
{
75-
76-
}
77-
else if (event.target.href.includes('dane/s'))
78-
{
7969

80-
}
81-
else
82-
{
83-
84-
}
85-
}
86-
});*/
8770

8871
generateList(ospanTexts, ofilenames, o_list);
8972
generateList(sspanTexts, sfilenames, s_list);
9073

9174
search_button.addEventListener('click', searchSchedules);
9275
search_input.addEventListener('keyup', function(event)
9376
{
94-
if (event.key === 'Enter')
77+
if (search_input.value.length > 0)
9578
searchSchedules();
79+
else
80+
container.removeChild(container.querySelector('div.search_results'));
9681
});

0 commit comments

Comments
 (0)