Результаты поиска
div на одно универсальное поле.<div class="mt-5 mb-4">
<button id="generateNosy" type="button" class="btn btn-primary w-100 p-2 shadow-sm">
Сформировать конфигурацию
</button>
<!-- Одно поле для статусов и результатов -->
<div id="status-container" class="mt-4 alert hidden" role="alert">
<div id="status-icon" class="me-2"></div>
<div id="status-content"></div>
</div>
<!-- Скрытое поле для системных данных -->
<input type="hidden" value="" id="outpost">
<? if($_SESSION['id'] > 5): ?>
<div id="detailedResult" class="mt-4 p-3 border rounded bg-light hidden">
<h6 class="fw-bold border-bottom pb-2 mb-2">Детальный разбор:</h6>
<div id="sectionsDetail" class="small text-muted"></div>
</div>
<? endif; ?>
</div>
$('#generateNosy').on('click', function (e) {
e.preventDefault();
const configData = collectFormData();
const resultArray = configData.result_array || [];
const resultString = configData.result_string || resultArray.join('-');
const $statusBox = $('#status-container');
const $statusContent = $('#status-content');
// Функция-помощник для отображения статуса
function showStatus(message, type = 'info') {
$statusBox.removeClass('hidden alert-success alert-danger alert-info alert-warning')
.addClass(`alert-${type} d-flex align-items-center`)
.fadeIn();
$statusContent.html(message);
}
// Проверка перед отправкой
if (resultString === '0-0-0-0-0-0-0-0-0-0-0-0-12') {
showStatus('<strong>Внимание!</strong> Выберите параметры конфигурации.', 'warning');
return;
}
if (resultString.length > 26) {
const formDataObj = new FormData(document.getElementById('form'));
formDataObj.append('nosy', resultArray);
formDataObj.append('nosy_string', resultString);
formDataObj.append('nosy_structured', JSON.stringify(configData.sections));
formDataObj.append('API_nosy', true);
fetch('../nosy/save_form.php', { method: 'POST', body: formDataObj })
.then(res => res.json())
.then(data => {
if (data.error) {
// Если пришла ошибка от сервера
showStatus(`<strong>Ошибка:</strong> ${data.error}`, 'danger');
} else {
// Успешное выполнение
showStatus(`<strong>Успешно!</strong> Конфигурация сохранена: ${data.APItext || resultString}`, 'success');
$('#outpost').val(data.APItext);
$('#search-query').val(data.APItext);
// Если есть детальные данные
if (configData.sections) {
$('#sectionsDetail').html(JSON.stringify(configData.sections, null, 2));
$('#detailedResult').removeClass('hidden');
}
}
})
.catch(err => {
showStatus('Произошла ошибка при соединении с сервером.', 'danger');
console.error(err);
});
}
});
- Типографика Bootstrap: Использованы классы
alert-success(зеленый) для удачи,alert-danger(красный) для ошибок иalert-warning(желтый) для пустых полей. - Лаконичность: Вместо трех разных
div(#result,#result-error,#htmlret) теперь работает один контейнер, который меняет цвет. - Юзабилити: Добавлена анимация
.fadeIn()и четкие жирные акценты через<strong>. - Чистота: Скрипт стал легче читать за счет выноса логики отображения в функцию
showStatus.
Turn on your Visual Search History?
Google uses its visual recognition technologies to process the images you use to search, like when you search with Google Lens. If you turn on your Visual Search History, Google will save these images from eligible Google services to your Web & App Activity when you’re signed in to your Google Account. You can learn more about this setting and which Google services save images to it at g.co/Search/VisualSearchHistory.
How visual search history is used
Your Visual Search History may be used to improve your experience on Google services, like letting you revisit your past visual searches. It may be used to develop and improve Google’s visual recognition and search technologies, as well as the Google services that use them.
When visual search history is off
If you turn this setting off, any previous Visual Search History may still be kept and used to improve Google’s visual recognition and search technologies, unless you delete it from your Web & App Activity.
Visual Search History doesn’t affect images saved by other settings, like Gemini Apps Activity.
How to manage your Visual Search History
You can view, delete, or manage your Visual Search History at activity.google.com. To download your Visual Search History, visit takeout.google.com. Images will be deleted in accordance with your Web & App Activity auto-delete settings, although some types of images may be deleted sooner.
Google uses and saves data in accordance with Google Privacy Policy.
