Code
<!DOCTYPE html>
<html lang="ka">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial, sans-serif;
}
/* =========================
ჩაბნელებული ფონი
========================= */
.copy-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.55);
display: none;
align-items: center;
justify-content: center;
z-index: 999999;
}
.copy-overlay.show {
display: flex;
}
/* =========================
POPUP
========================= */
.copy-popup {
width: 430px;
max-width: calc(100% - 30px);
background: #fff;
border-radius: 6px;
overflow: hidden;
box-shadow: 0 15px 45px rgba(0,0,0,.45);
animation: popupOpen .18s ease;
}
@keyframes popupOpen {
from {
opacity: 0;
transform: scale(.88);
}
to {
opacity: 1;
transform: scale(1);
}
}
/* =========================
HEADER
========================= */
.copy-header {
height: 62px;
display: flex;
align-items: center;
justify-content: space-between;
padding-left: 20px;
color: #fff;
font-size: 18px;
font-weight: bold;
}
.header-title {
display: flex;
align-items: center;
gap: 10px;
}
.warning-icon {
font-size: 25px;
}
/* X ღილაკი */
.header-close {
width: 62px;
height: 62px;
border: 0;
color: #fff;
background: rgba(0,0,0,.15);
font-size: 30px;
font-weight: bold;
cursor: pointer;
}
.header-close:hover {
background: rgba(0,0,0,.3);
}
/* =========================
CONTENT
========================= */
.copy-content {
padding: 25px 20px 18px;
text-align: center;
}
/* დიდი X */
.big-x {
width: 80px;
height: 80px;
margin: 0 auto 18px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: #ffe5e5;
color: #ed1717;
font-size: 55px;
font-weight: bold;
}
/* ტექსტი */
.copy-message {
color: #e50909;
font-size: 23px;
font-weight: bold;
padding-bottom: 20px;
border-bottom: 1px dashed #aaa;
}
/* =========================
ღილაკი
========================= */
.copy-footer {
padding: 17px;
text-align: center;
}
.ok-button {
min-width: 190px;
border: 0;
border-radius: 6px;
padding: 12px 25px;
color: #fff;
font-size: 16px;
font-weight: bold;
cursor: pointer;
}
.ok-button:hover {
opacity: .88;
}
/* =========================
4 ფერის ვარიანტი
========================= */
/* 🔴 წითელი */
.theme-red .copy-header,
.theme-red .ok-button {
background: #ef1010;
}
/* ⚫ შავი */
.theme-black .copy-header {
background: #050505;
}
.theme-black .ok-button {
background: #ef1010;
}
/* 🔵 ლურჯი */
.theme-blue .copy-header,
.theme-blue .ok-button {
background: #0874d1;
}
.theme-blue .big-x {
background: #e1efff;
color: #0874d1;
}
/* 🔴 მუქი წითელი */
.theme-darkred .copy-header,
.theme-darkred .ok-button {
background: #c90000;
}
</style>
</head>
<body>
<h2>ჩემი საიტი</h2>
<p>
მონიშნე ეს ტექსტი და სცადე Ctrl+C ან მარჯვენა კლიკი.
</p>
<!-- ==================================
POPUP
აი აქ შეცვალე ფერი:
theme-red
theme-black
theme-blue
theme-darkred
=================================== -->
<div class="copy-overlay" id="copyWarning">
<div class="copy-popup theme-black">
<!-- HEADER -->
<div class="copy-header">
<div class="header-title">
<span class="warning-icon">⚠</span>
გაფრთხილება
</div>
<button
class="header-close"
onclick="closeCopyWarning()">
×
</button>
</div>
<!-- CONTENT -->
<div class="copy-content">
<div class="big-x">
×
</div>
<div class="copy-message">
დაკოპირება არ შეიძლება
</div>
</div>
<!-- BUTTON -->
<div class="copy-footer">
<button
class="ok-button"
onclick="closeCopyWarning()">
გასაგებია
</button>
</div>
</div>
</div>
<script>
const copyWarning =
document.getElementById("copyWarning");
/* popup გახსნა */
function showCopyWarning() {
copyWarning.classList.add("show");
}
/* popup დახურვა */
function closeCopyWarning() {
copyWarning.classList.remove("show");
}
/* =========================
COPY აკრძალვა
========================= */
document.addEventListener("copy", function(event) {
event.preventDefault();
showCopyWarning();
});
/* =========================
მარჯვენა კლიკი
========================= */
document.addEventListener("contextmenu", function(event) {
event.preventDefault();
showCopyWarning();
});
/* =========================
CTRL + C / CMD + C
========================= */
document.addEventListener("keydown", function(event) {
if (
(event.ctrlKey || event.metaKey) &&
event.key.toLowerCase() === "c"
) {
event.preventDefault();
showCopyWarning();
}
});
/* ESC-ით დახურვა */
document.addEventListener("keydown", function(event) {
if (event.key === "Escape") {
closeCopyWarning();
}
});
</script>
</body>
</html>