-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.html
146 lines (127 loc) · 3.62 KB
/
search.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
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kamu Malı Arama Motoru Veri Tabanı - Public Domain Search Engine Database</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<style>
/* Genel stil */
body {
font-family: 'Roboto', sans-serif;
background-color: #f4f7fa;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
h1 {
color: #333;
margin-bottom: 20px;
font-weight: 500;
}
h2 {
color: #333;
margin-bottom: 20px;
font-weight: 500;
}
/* Arama kutusu stili */
#search-bar {
width: 100%;
max-width: 600px;
padding: 15px;
font-size: 16px;
border-radius: 25px;
border: 1px solid #ddd;
outline: none;
transition: border-color 0.3s ease-in-out;
}
#search-bar:focus {
border-color: #007bff;
}
/* Sonuç listesi */
#search-results {
list-style-type: none;
padding: 0;
width: 100%;
max-width: 600px;
margin-top: 20px;
}
#search-results li {
background-color: #fff;
margin: 10px 0;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
transition: box-shadow 0.3s ease-in-out;
}
#search-results li:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
#search-results a {
text-decoration: none;
color: #007bff;
font-weight: 500;
font-size: 18px;
transition: color 0.3s ease-in-out;
}
#search-results a:hover {
color: #0056b3;
}
#search-results p {
font-size: 14px;
color: #555;
margin-top: 5px;
}
</style>
</head>
<body>
<h1>Kamu Malı Arama Motoru Veri Tabanı</h1>
<h2>Public Domain Search Engine Database</h2>
<input type="text" id="search-bar" placeholder="Arama yap (Search)..." />
<ul id="search-results"></ul>
<script>
document.addEventListener('DOMContentLoaded', () => {
const searchBar = document.getElementById('search-bar');
const searchResults = document.getElementById('search-results');
let db = []; // Veri tabanını burada saklayacağız
// Veriyi Fetch ile çekme
fetch('https://oyuncunettv.github.io/public-domain-search-engine-db/database.json')
.then(response => response.json())
.then(data => {
db = data;
})
.catch(error => console.error('Veri çekilirken hata oluştu:', error));
// Arama fonksiyonu
function search(query) {
searchResults.innerHTML = ''; // Önceki sonuçları temizle
if (query === '') return; // Eğer arama boşsa hiç işlem yapma
const results = db.filter(item => {
return (
item.name.toLowerCase().includes(query.toLowerCase()) ||
item.category.toLowerCase().includes(query.toLowerCase()) ||
item.description.toLowerCase().includes(query.toLowerCase())
);
});
// Sonuçları gösterme
results.forEach(result => {
const li = document.createElement('li');
li.innerHTML = `
<strong><a href="${result.url}" target="_blank">${result.name}</a></strong> - ${result.category}
<p>${result.description}</p>
`;
searchResults.appendChild(li);
});
}
// Arama kutusundaki her değişiklikte arama yap
searchBar.addEventListener('input', (event) => {
const query = event.target.value;
search(query);
});
});
</script>
</body>
</html>