Update app.py
Browse files
app.py
CHANGED
|
@@ -245,10 +245,10 @@ html_template = '''
|
|
| 245 |
|
| 246 |
const inputTelegram = document.createElement('input');
|
| 247 |
inputTelegram.type = 'text';
|
| 248 |
-
inputTelegram.placeholder = '
|
| 249 |
|
| 250 |
const button = document.createElement('button');
|
| 251 |
-
button.
|
| 252 |
button.onclick = function() {
|
| 253 |
if (inputName.value && inputDescription.value && inputTelegram.value) {
|
| 254 |
addMarker(inputName.value, inputDescription.value, inputTelegram.value, e.latlng);
|
|
@@ -280,7 +280,7 @@ html_template = '''
|
|
| 280 |
|
| 281 |
// Функция для поиска меток
|
| 282 |
function searchMarkers(query) {
|
| 283 |
-
fetch(`/search_markers?query=${query}`)
|
| 284 |
.then(response => response.json())
|
| 285 |
.then(data => {
|
| 286 |
const resultsDiv = document.getElementById('search-results');
|
|
@@ -301,7 +301,7 @@ html_template = '''
|
|
| 301 |
// Обработчик события для кнопки поиска
|
| 302 |
document.getElementById('search-button').onclick = function() {
|
| 303 |
const query = document.getElementById('search-input').value;
|
| 304 |
-
searchMarkers(query
|
| 305 |
};
|
| 306 |
|
| 307 |
// Функция для показа метки на карте
|
|
@@ -366,7 +366,7 @@ def search_markers():
|
|
| 366 |
conn = sqlite3.connect('markers.db')
|
| 367 |
cursor = conn.cursor()
|
| 368 |
cursor.execute('''SELECT id, name, description, telegram_link, latitude, longitude FROM markers
|
| 369 |
-
WHERE
|
| 370 |
(f'%{query}%', f'%{query}%'))
|
| 371 |
markers = cursor.fetchall()
|
| 372 |
conn.close()
|
|
|
|
| 245 |
|
| 246 |
const inputTelegram = document.createElement('input');
|
| 247 |
inputTelegram.type = 'text';
|
| 248 |
+
inputTelegram.placeholder = 'Telegram ссылка (без @)';
|
| 249 |
|
| 250 |
const button = document.createElement('button');
|
| 251 |
+
button.innerText = 'Добавить метку';
|
| 252 |
button.onclick = function() {
|
| 253 |
if (inputName.value && inputDescription.value && inputTelegram.value) {
|
| 254 |
addMarker(inputName.value, inputDescription.value, inputTelegram.value, e.latlng);
|
|
|
|
| 280 |
|
| 281 |
// Функция для поиска меток
|
| 282 |
function searchMarkers(query) {
|
| 283 |
+
fetch(`/search_markers?query=${encodeURIComponent(query)}`)
|
| 284 |
.then(response => response.json())
|
| 285 |
.then(data => {
|
| 286 |
const resultsDiv = document.getElementById('search-results');
|
|
|
|
| 301 |
// Обработчик события для кнопки поиска
|
| 302 |
document.getElementById('search-button').onclick = function() {
|
| 303 |
const query = document.getElementById('search-input').value;
|
| 304 |
+
searchMarkers(query); // Убираем приведение к нижнему регистру
|
| 305 |
};
|
| 306 |
|
| 307 |
// Функция для показа метки на карте
|
|
|
|
| 366 |
conn = sqlite3.connect('markers.db')
|
| 367 |
cursor = conn.cursor()
|
| 368 |
cursor.execute('''SELECT id, name, description, telegram_link, latitude, longitude FROM markers
|
| 369 |
+
WHERE name LIKE ? OR description LIKE ?''',
|
| 370 |
(f'%{query}%', f'%{query}%'))
|
| 371 |
markers = cursor.fetchall()
|
| 372 |
conn.close()
|