v3 — ввод нарушения → ссылка на НПА на adilet.zan.kz
This commit is contained in:
parent
ff839c10a2
commit
aa2ea6e50a
115
index.html
115
index.html
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Нарушения законодательства РК — справочник</title>
|
||||
<title>Нарушения законодательства РК — поиск по НПА</title>
|
||||
<style>
|
||||
:root {
|
||||
--ink: #0F1218;
|
||||
@ -45,15 +45,16 @@ body {
|
||||
padding: 100px 0 80px;
|
||||
}
|
||||
.hero h1 {
|
||||
font-size: 48px; font-weight: 800; line-height: 1.1;
|
||||
font-size: 48px; font-weight: 800; line-height: 1.15;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.hero p {
|
||||
font-size: 20px; color: #9aa3b2;
|
||||
max-width: 600px; margin-bottom: 40px;
|
||||
max-width: 680px; margin-bottom: 40px;
|
||||
}
|
||||
.search-layout { max-width: 700px; }
|
||||
.search-box {
|
||||
display: flex; gap: 12px; max-width: 700px;
|
||||
display: flex; gap: 12px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
border: 2px solid rgba(255,255,255,0.15);
|
||||
border-radius: 12px; padding: 8px;
|
||||
@ -68,9 +69,31 @@ body {
|
||||
background: var(--cyan); color: var(--ink);
|
||||
border: none; padding: 12px 28px; border-radius: 8px;
|
||||
font-size: 16px; font-weight: 700; cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.search-box button:hover { background: #1be5ff; }
|
||||
|
||||
.adilet-bar {
|
||||
margin-top: 24px;
|
||||
display: none;
|
||||
background: rgba(0,229,255,0.1);
|
||||
border: 1.5px solid rgba(0,229,255,0.3);
|
||||
border-radius: 10px; padding: 18px 22px;
|
||||
align-items: center; gap: 14px; flex-wrap: wrap;
|
||||
}
|
||||
.adilet-bar.active { display: flex; }
|
||||
.adilet-bar .icon-text { flex: 1; min-width: 200px; }
|
||||
.adilet-bar .label { font-size: 13px; color: #9aa3b2; margin-bottom: 2px; }
|
||||
.adilet-bar .query-text { font-size: 16px; font-weight: 600; color: var(--cyan); word-break: break-all; }
|
||||
.adilet-bar a {
|
||||
display: inline-flex; align-items: center; gap: 6px;
|
||||
background: var(--cyan); color: var(--ink);
|
||||
padding: 10px 22px; border-radius: 8px;
|
||||
font-weight: 700; font-size: 15px; text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.adilet-bar a:hover { background: #1be5ff; }
|
||||
|
||||
.results-section { padding: 64px 0 80px; }
|
||||
.stats-bar {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
@ -100,14 +123,12 @@ body {
|
||||
.filter-btn.code-zakon.active { background: var(--indigo); border-color: var(--indigo); }
|
||||
.filter-btn.code-pravila.active { background: var(--amber); border-color: var(--amber); }
|
||||
|
||||
.results-grid {
|
||||
display: grid; gap: 16px;
|
||||
}
|
||||
.results-grid { display: grid; gap: 16px; }
|
||||
.violation-card {
|
||||
border: 1px solid var(--gray-100); border-radius: 12px;
|
||||
padding: 28px 32px; display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
gap: 16px 24px; align-items: start;
|
||||
gap: 12px 24px; align-items: start;
|
||||
transition: box-shadow 0.15s, transform 0.15s;
|
||||
}
|
||||
.violation-card:hover {
|
||||
@ -122,10 +143,10 @@ body {
|
||||
font-size: 15px; color: var(--gray-500); line-height: 1.55;
|
||||
}
|
||||
.violation-card .article {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
display: flex; flex-direction: column; align-items: center; gap: 8px;
|
||||
padding: 10px 18px; border-radius: 8px;
|
||||
font-weight: 700; font-size: 14px; white-space: nowrap;
|
||||
text-align: center; flex-shrink: 0;
|
||||
font-weight: 700; font-size: 14px; text-align: center; flex-shrink: 0;
|
||||
min-width: 120px;
|
||||
}
|
||||
.article.koap { background: #E3F2FD; color: #1565C0; }
|
||||
.article.uk { background: var(--red-light); color: var(--red); }
|
||||
@ -142,11 +163,17 @@ body {
|
||||
.violation-card .penalty {
|
||||
grid-column: 1 / -1; font-size: 14px; color: var(--gray-500);
|
||||
padding-top: 12px; border-top: 1px solid var(--gray-100);
|
||||
display: flex; gap: 6px; align-items: baseline;
|
||||
display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline;
|
||||
}
|
||||
.penalty-label {
|
||||
font-weight: 600; color: var(--ink); white-space: nowrap;
|
||||
}
|
||||
.adilet-link {
|
||||
display: inline-flex; align-items: center; gap: 4px;
|
||||
font-size: 13px; color: var(--cyan); text-decoration: none;
|
||||
font-weight: 600; margin-left: auto;
|
||||
}
|
||||
.adilet-link:hover { text-decoration: underline; }
|
||||
|
||||
.empty-state {
|
||||
text-align: center; padding: 80px 20px; color: var(--gray-500);
|
||||
@ -167,8 +194,10 @@ footer a { color: var(--cyan); text-decoration: none; }
|
||||
.hero p { font-size: 17px; }
|
||||
.search-box { flex-direction: column; gap: 8px; }
|
||||
.search-box button { width: 100%; }
|
||||
.adilet-bar { flex-direction: column; align-items: stretch; text-align: center; }
|
||||
.adilet-bar a { justify-content: center; }
|
||||
.violation-card { grid-template-columns: 1fr; padding: 20px; }
|
||||
.violation-card .article { justify-self: start; }
|
||||
.violation-card .article { flex-direction: row; justify-self: start; min-width: auto; gap: 8px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -176,11 +205,20 @@ footer a { color: var(--cyan); text-decoration: none; }
|
||||
|
||||
<section class="hero">
|
||||
<div class="container">
|
||||
<h1>📜 Нарушения законодательства РК</h1>
|
||||
<p>Опишите ситуацию или введите ключевые слова — найдём соответствующие статьи кодексов, законов и правил РК.</p>
|
||||
<div class="search-box">
|
||||
<input type="text" id="search" placeholder="Например: драка, шум ночью, кража, без прав за рулём..." autofocus>
|
||||
<button onclick="search()">Найти</button>
|
||||
<h1>📜 Поиск по НПА Республики Казахстан</h1>
|
||||
<p>Опишите нарушение — получите ссылку на нормативный правовой акт и подборку статей из базы.</p>
|
||||
<div class="search-layout">
|
||||
<div class="search-box">
|
||||
<input type="text" id="search" placeholder="Например: шум ночью, драка, кража, без прав за рулём..." autofocus>
|
||||
<button onclick="search()">Найти</button>
|
||||
</div>
|
||||
<div class="adilet-bar" id="adiletBar">
|
||||
<div class="icon-text">
|
||||
<div class="label">Поиск по вашему запросу на adilet.zan.kz:</div>
|
||||
<div class="query-text" id="adiletQuery"></div>
|
||||
</div>
|
||||
<a id="adiletBtn" href="#" target="_blank">🔗 Открыть НПА</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -214,7 +252,7 @@ footer a { color: var(--cyan); text-decoration: none; }
|
||||
|
||||
<footer>
|
||||
<div class="container">
|
||||
Справочник носит ознакомительный характер. Точные формулировки — см. официальные тексты кодексов на <a href="https://adilet.zan.kz" target="_blank">adilet.zan.kz</a>
|
||||
Справочник носит ознакомительный характер. Точные формулировки — см. официальные тексты на <a href="https://adilet.zan.kz" target="_blank">adilet.zan.kz</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@ -332,6 +370,25 @@ function matchesQuery(v, query) {
|
||||
);
|
||||
}
|
||||
|
||||
function adiletSearchUrl(query) {
|
||||
const src = query || currentQuery;
|
||||
return "https://adilet.zan.kz/rus/search/all?q=" + encodeURIComponent(src.trim());
|
||||
}
|
||||
|
||||
function updateAdiletBar() {
|
||||
const bar = document.getElementById("adiletBar");
|
||||
const queryEl = document.getElementById("adiletQuery");
|
||||
const btn = document.getElementById("adiletBtn");
|
||||
const q = currentQuery.trim();
|
||||
if (q.length > 0) {
|
||||
bar.classList.add("active");
|
||||
queryEl.textContent = q;
|
||||
btn.href = adiletSearchUrl(q);
|
||||
} else {
|
||||
bar.classList.remove("active");
|
||||
}
|
||||
}
|
||||
|
||||
function render(results, query) {
|
||||
const grid = document.getElementById("results");
|
||||
const empty = document.getElementById("empty");
|
||||
@ -347,8 +404,9 @@ function render(results, query) {
|
||||
return;
|
||||
}
|
||||
empty.style.display = "none";
|
||||
grid.innerHTML = results.map(v => `
|
||||
<div class="violation-card">
|
||||
grid.innerHTML = results.map(v => {
|
||||
const searchQ = encodeURIComponent(v.article + " " + v.desc.split(" —")[0]);
|
||||
return `<div class="violation-card">
|
||||
<div class="info">
|
||||
<h3>${highlight(v.desc, query)}</h3>
|
||||
</div>
|
||||
@ -358,9 +416,10 @@ function render(results, query) {
|
||||
<div class="penalty">
|
||||
<span class="penalty-label">Наказание:</span>
|
||||
<span>${v.penalty}</span>
|
||||
<a class="adilet-link" href="https://adilet.zan.kz/rus/search/all?q=${searchQ}" target="_blank">🔗 Открыть на adilet.zan.kz</a>
|
||||
</div>
|
||||
</div>
|
||||
`).join("");
|
||||
</div>`;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function filterAndSearch() {
|
||||
@ -372,6 +431,7 @@ function filterAndSearch() {
|
||||
results = results.filter(v => matchesQuery(v, currentQuery));
|
||||
}
|
||||
render(results, currentQuery);
|
||||
updateAdiletBar();
|
||||
}
|
||||
|
||||
function search() {
|
||||
@ -388,7 +448,14 @@ function setFilter(code, btn) {
|
||||
|
||||
document.getElementById("search").addEventListener("input", search);
|
||||
document.getElementById("search").addEventListener("keydown", function(e) {
|
||||
if (e.key === "Enter") search();
|
||||
if (e.key === "Enter") {
|
||||
currentQuery = this.value;
|
||||
filterAndSearch();
|
||||
updateAdiletBar();
|
||||
if (currentQuery.trim()) {
|
||||
window.open(adiletSearchUrl(currentQuery.trim()), "_blank");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
filterAndSearch();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user