v3 — ввод нарушения → ссылка на НПА на adilet.zan.kz

This commit is contained in:
samruk_1 2026-06-01 05:20:39 +00:00
parent ff839c10a2
commit aa2ea6e50a

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="viewport" content="width=device-width,initial-scale=1">
<title>Нарушения законодательства РКсправочник</title> <title>Нарушения законодательства РК — поиск по НПА</title>
<style> <style>
:root { :root {
--ink: #0F1218; --ink: #0F1218;
@ -45,15 +45,16 @@ body {
padding: 100px 0 80px; padding: 100px 0 80px;
} }
.hero h1 { .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; margin-bottom: 16px;
} }
.hero p { .hero p {
font-size: 20px; color: #9aa3b2; font-size: 20px; color: #9aa3b2;
max-width: 600px; margin-bottom: 40px; max-width: 680px; margin-bottom: 40px;
} }
.search-layout { max-width: 700px; }
.search-box { .search-box {
display: flex; gap: 12px; max-width: 700px; display: flex; gap: 12px;
background: rgba(255,255,255,0.08); background: rgba(255,255,255,0.08);
border: 2px solid rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.15);
border-radius: 12px; padding: 8px; border-radius: 12px; padding: 8px;
@ -68,9 +69,31 @@ body {
background: var(--cyan); color: var(--ink); background: var(--cyan); color: var(--ink);
border: none; padding: 12px 28px; border-radius: 8px; border: none; padding: 12px 28px; border-radius: 8px;
font-size: 16px; font-weight: 700; cursor: pointer; font-size: 16px; font-weight: 700; cursor: pointer;
white-space: nowrap;
} }
.search-box button:hover { background: #1be5ff; } .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; } .results-section { padding: 64px 0 80px; }
.stats-bar { .stats-bar {
display: flex; align-items: center; justify-content: space-between; 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-zakon.active { background: var(--indigo); border-color: var(--indigo); }
.filter-btn.code-pravila.active { background: var(--amber); border-color: var(--amber); } .filter-btn.code-pravila.active { background: var(--amber); border-color: var(--amber); }
.results-grid { .results-grid { display: grid; gap: 16px; }
display: grid; gap: 16px;
}
.violation-card { .violation-card {
border: 1px solid var(--gray-100); border-radius: 12px; border: 1px solid var(--gray-100); border-radius: 12px;
padding: 28px 32px; display: grid; padding: 28px 32px; display: grid;
grid-template-columns: 1fr auto; 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; transition: box-shadow 0.15s, transform 0.15s;
} }
.violation-card:hover { .violation-card:hover {
@ -122,10 +143,10 @@ body {
font-size: 15px; color: var(--gray-500); line-height: 1.55; font-size: 15px; color: var(--gray-500); line-height: 1.55;
} }
.violation-card .article { .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; padding: 10px 18px; border-radius: 8px;
font-weight: 700; font-size: 14px; white-space: nowrap; font-weight: 700; font-size: 14px; text-align: center; flex-shrink: 0;
text-align: center; flex-shrink: 0; min-width: 120px;
} }
.article.koap { background: #E3F2FD; color: #1565C0; } .article.koap { background: #E3F2FD; color: #1565C0; }
.article.uk { background: var(--red-light); color: var(--red); } .article.uk { background: var(--red-light); color: var(--red); }
@ -142,11 +163,17 @@ body {
.violation-card .penalty { .violation-card .penalty {
grid-column: 1 / -1; font-size: 14px; color: var(--gray-500); grid-column: 1 / -1; font-size: 14px; color: var(--gray-500);
padding-top: 12px; border-top: 1px solid var(--gray-100); 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 { .penalty-label {
font-weight: 600; color: var(--ink); white-space: nowrap; 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 { .empty-state {
text-align: center; padding: 80px 20px; color: var(--gray-500); 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; } .hero p { font-size: 17px; }
.search-box { flex-direction: column; gap: 8px; } .search-box { flex-direction: column; gap: 8px; }
.search-box button { width: 100%; } .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 { 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> </style>
</head> </head>
@ -176,11 +205,20 @@ footer a { color: var(--cyan); text-decoration: none; }
<section class="hero"> <section class="hero">
<div class="container"> <div class="container">
<h1>&#x1F4DC; Нарушения законодательства РК</h1> <h1>&#x1F4DC; Поиск по НПА Республики Казахстан</h1>
<p>Опишите ситуацию или введите ключевые слова — найдём соответствующие статьи кодексов, законов и правил РК.</p> <p>Опишите нарушение — получите ссылку на нормативный правовой акт и подборку статей из базы.</p>
<div class="search-box"> <div class="search-layout">
<input type="text" id="search" placeholder="Например: драка, шум ночью, кража, без прав за рулём..." autofocus> <div class="search-box">
<button onclick="search()">Найти</button> <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">&#x1F517; Открыть НПА</a>
</div>
</div> </div>
</div> </div>
</section> </section>
@ -214,7 +252,7 @@ footer a { color: var(--cyan); text-decoration: none; }
<footer> <footer>
<div class="container"> <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> </div>
</footer> </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) { function render(results, query) {
const grid = document.getElementById("results"); const grid = document.getElementById("results");
const empty = document.getElementById("empty"); const empty = document.getElementById("empty");
@ -347,8 +404,9 @@ function render(results, query) {
return; return;
} }
empty.style.display = "none"; empty.style.display = "none";
grid.innerHTML = results.map(v => ` grid.innerHTML = results.map(v => {
<div class="violation-card"> const searchQ = encodeURIComponent(v.article + " " + v.desc.split(" —")[0]);
return `<div class="violation-card">
<div class="info"> <div class="info">
<h3>${highlight(v.desc, query)}</h3> <h3>${highlight(v.desc, query)}</h3>
</div> </div>
@ -358,9 +416,10 @@ function render(results, query) {
<div class="penalty"> <div class="penalty">
<span class="penalty-label">Наказание:</span> <span class="penalty-label">Наказание:</span>
<span>${v.penalty}</span> <span>${v.penalty}</span>
<a class="adilet-link" href="https://adilet.zan.kz/rus/search/all?q=${searchQ}" target="_blank">&#x1F517; Открыть на adilet.zan.kz</a>
</div> </div>
</div> </div>`;
`).join(""); }).join("");
} }
function filterAndSearch() { function filterAndSearch() {
@ -372,6 +431,7 @@ function filterAndSearch() {
results = results.filter(v => matchesQuery(v, currentQuery)); results = results.filter(v => matchesQuery(v, currentQuery));
} }
render(results, currentQuery); render(results, currentQuery);
updateAdiletBar();
} }
function search() { function search() {
@ -388,7 +448,14 @@ function setFilter(code, btn) {
document.getElementById("search").addEventListener("input", search); document.getElementById("search").addEventListener("input", search);
document.getElementById("search").addEventListener("keydown", function(e) { 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(); filterAndSearch();