Skip to content

Commit e66cd44

Browse files
authored
fix: Вывод бейджа для пакетов без найденных репозиториев (#36)
1 parent afa15cd commit e66cd44

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/web/view/index.html

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,8 @@ <h1>Litros</br>Library Tracker for OneScript</h1>
420420
} else if (data.error) {
421421
throw new Error(data.error);
422422
} else {
423-
resultsDiv.innerHTML = `
424-
<div class="empty">
425-
${
426-
data.message
427-
? `<h3>${data.message.replace(/\.(\s|$)/g, ".</br>")}</h3>`
428-
: `<h3>Репозитории не найдены</strong></h3>`
429-
}
430-
</div>
431-
`;
423+
displayBadge(packageName);
424+
displayNotFound(data.message);
432425
}
433426
} catch (error) {
434427
resultsDiv.innerHTML = `
@@ -559,6 +552,19 @@ <h2>Используется в репозиториях GitHub: ${allRepositori
559552
displayResults();
560553
}
561554

555+
function displayNotFound(message) {
556+
const resultsDiv = document.getElementById('results');
557+
resultsDiv.innerHTML = `
558+
<div class="empty">
559+
${
560+
message
561+
? `<h3>${message.replace(/\.(\s|$)/g, ".</br>")}</h3>`
562+
: `<h3>Репозитории не найдены</strong></h3>`
563+
}
564+
</div>
565+
`;
566+
}
567+
562568
document.getElementById('packageInput').addEventListener('keypress', function(e) {
563569
if (e.key === 'Enter') {
564570
searchDependents();

0 commit comments

Comments
 (0)