Update index.html
Browse files- index.html +87 -43
index.html
CHANGED
|
@@ -2,84 +2,131 @@
|
|
| 2 |
<html lang="ar" dir="rtl">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>تهنئة رمضان</title>
|
| 7 |
-
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@700&display=swap" rel="stylesheet">
|
| 8 |
|
| 9 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
body {
|
| 11 |
font-family: 'Cairo', sans-serif;
|
| 12 |
-
background-color: #
|
| 13 |
text-align: center;
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
}
|
|
|
|
| 16 |
.container {
|
| 17 |
-
|
| 18 |
-
|
| 19 |
background: white;
|
| 20 |
-
padding: 20px;
|
| 21 |
-
border-radius:
|
| 22 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
input[type="text"] {
|
| 25 |
-
width:
|
| 26 |
-
padding:
|
| 27 |
-
margin: 15px
|
| 28 |
-
font-size:
|
|
|
|
| 29 |
font-family: 'Cairo', sans-serif;
|
| 30 |
-
border: 2px solid #
|
| 31 |
-
border-radius:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
}
|
|
|
|
| 33 |
button {
|
|
|
|
| 34 |
background-color: #2c3e50;
|
| 35 |
color: white;
|
| 36 |
border: none;
|
| 37 |
-
padding:
|
| 38 |
font-size: 18px;
|
|
|
|
| 39 |
font-family: 'Cairo', sans-serif;
|
| 40 |
-
border-radius:
|
| 41 |
cursor: pointer;
|
| 42 |
-
transition: 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
-
button:hover { background-color: #1a252f; }
|
| 45 |
|
| 46 |
#downloadBtn {
|
| 47 |
background-color: #27ae60;
|
| 48 |
-
display: none;
|
| 49 |
margin-top: 15px;
|
|
|
|
| 50 |
}
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
/* إخفاء الكانفاس لتجنب تشوه التصميم، سنعرضه فقط عند الحاجة */
|
| 54 |
canvas {
|
| 55 |
-
|
| 56 |
height: auto;
|
| 57 |
-
margin-top:
|
| 58 |
-
border-radius:
|
|
|
|
| 59 |
display: none;
|
| 60 |
}
|
|
|
|
| 61 |
.hint {
|
| 62 |
-
font-size:
|
| 63 |
-
color: #
|
| 64 |
-
margin-top:
|
| 65 |
display: none;
|
|
|
|
| 66 |
}
|
| 67 |
</style>
|
| 68 |
</head>
|
| 69 |
<body>
|
| 70 |
|
| 71 |
<div class="container">
|
| 72 |
-
<h2>
|
| 73 |
<p>أدخل اسمك لتظهر لك التهنئة المخصصة</p>
|
| 74 |
|
| 75 |
<input type="text" id="userName" placeholder="اكتب اسمك هنا...">
|
| 76 |
-
<br>
|
| 77 |
<button onclick="generateCard()">إنشاء البطاقة</button>
|
| 78 |
|
| 79 |
<canvas id="myCanvas"></canvas>
|
| 80 |
-
|
| 81 |
<button id="downloadBtn" onclick="downloadImage()">تحميل الصورة</button>
|
| 82 |
-
<p id="downloadHint" class="hint">ملاحظة: إذا لم يعمل زر التحميل، اضغط مطولاً على الصورة
|
| 83 |
</div>
|
| 84 |
|
| 85 |
<script>
|
|
@@ -87,10 +134,7 @@
|
|
| 87 |
const ctx = canvas.getContext('2d');
|
| 88 |
const image = new Image();
|
| 89 |
|
| 90 |
-
// حل مشكلة أمان المتصفحات للصور
|
| 91 |
image.crossOrigin = "Anonymous";
|
| 92 |
-
|
| 93 |
-
// اسم صورتك
|
| 94 |
image.src = 'template.jpg';
|
| 95 |
|
| 96 |
image.onload = function() {
|
|
@@ -108,25 +152,25 @@
|
|
| 108 |
|
| 109 |
ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
| 110 |
|
| 111 |
-
// 📍 هنا تعدل حجم الخط (غير الرقم 45)
|
| 112 |
ctx.font = "bold 80px 'Cairo'";
|
| 113 |
ctx.fillStyle = "#000000";
|
| 114 |
ctx.textAlign = "center";
|
| 115 |
|
| 116 |
const xPosition = canvas.width / 2;
|
| 117 |
-
|
| 118 |
-
// 📍 هنا تعدل الارتفاع والنزول (غير الرقم 135)
|
| 119 |
const yPosition = canvas.height - 350;
|
| 120 |
|
| 121 |
ctx.fillText(name, xPosition, yPosition);
|
| 122 |
|
| 123 |
-
// إظهار الصورة والزر والملاحظة
|
| 124 |
canvas.style.display = "block";
|
| 125 |
-
document.getElementById('downloadBtn').style.display = "
|
| 126 |
document.getElementById('downloadHint').style.display = "block";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
}
|
| 128 |
|
| 129 |
-
// دالة جديدة مخصصة للتحميل الإجباري
|
| 130 |
function downloadImage() {
|
| 131 |
try {
|
| 132 |
const dataUrl = canvas.toDataURL("image/png");
|
|
@@ -137,7 +181,7 @@
|
|
| 137 |
link.click();
|
| 138 |
document.body.removeChild(link);
|
| 139 |
} catch (error) {
|
| 140 |
-
alert("عذراً، متصفحك يمنع التحميل المباشر لحماية الأمان. يرجى الضغط مطولاً
|
| 141 |
}
|
| 142 |
}
|
| 143 |
</script>
|
|
|
|
| 2 |
<html lang="ar" dir="rtl">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 6 |
<title>تهنئة رمضان</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@600;700&display=swap" rel="stylesheet">
|
| 8 |
|
| 9 |
<style>
|
| 10 |
+
/* إعدادات أساسية لضبط المقاسات على الجوال */
|
| 11 |
+
* {
|
| 12 |
+
box-sizing: border-box;
|
| 13 |
+
-webkit-tap-highlight-color: transparent; /* إخفاء مربع التحديد الأزرق عند اللمس في الجوال */
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
body {
|
| 17 |
font-family: 'Cairo', sans-serif;
|
| 18 |
+
background-color: #eef2f5;
|
| 19 |
text-align: center;
|
| 20 |
+
margin: 0;
|
| 21 |
+
padding: 15px;
|
| 22 |
+
display: flex;
|
| 23 |
+
justify-content: center;
|
| 24 |
+
align-items: center;
|
| 25 |
+
min-height: 100vh;
|
| 26 |
}
|
| 27 |
+
|
| 28 |
.container {
|
| 29 |
+
width: 100%;
|
| 30 |
+
max-width: 400px; /* مقاس مثالي لشاشات الهواتف */
|
| 31 |
background: white;
|
| 32 |
+
padding: 30px 20px;
|
| 33 |
+
border-radius: 24px;
|
| 34 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.05);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
h2 {
|
| 38 |
+
font-size: 22px;
|
| 39 |
+
color: #2c3e50;
|
| 40 |
+
margin-top: 0;
|
| 41 |
+
margin-bottom: 5px;
|
| 42 |
+
line-height: 1.4;
|
| 43 |
}
|
| 44 |
+
|
| 45 |
+
p {
|
| 46 |
+
font-size: 14px;
|
| 47 |
+
color: #7f8c8d;
|
| 48 |
+
margin-bottom: 25px;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
input[type="text"] {
|
| 52 |
+
width: 100%;
|
| 53 |
+
padding: 15px;
|
| 54 |
+
margin-bottom: 15px;
|
| 55 |
+
font-size: 16px;
|
| 56 |
+
font-weight: 600;
|
| 57 |
font-family: 'Cairo', sans-serif;
|
| 58 |
+
border: 2px solid #e0e6ed;
|
| 59 |
+
border-radius: 14px;
|
| 60 |
+
text-align: center;
|
| 61 |
+
transition: 0.3s;
|
| 62 |
+
background-color: #f8fafc;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
input[type="text"]:focus {
|
| 66 |
+
border-color: #2c3e50;
|
| 67 |
+
background-color: #ffffff;
|
| 68 |
+
outline: none;
|
| 69 |
}
|
| 70 |
+
|
| 71 |
button {
|
| 72 |
+
width: 100%;
|
| 73 |
background-color: #2c3e50;
|
| 74 |
color: white;
|
| 75 |
border: none;
|
| 76 |
+
padding: 16px;
|
| 77 |
font-size: 18px;
|
| 78 |
+
font-weight: 700;
|
| 79 |
font-family: 'Cairo', sans-serif;
|
| 80 |
+
border-radius: 14px;
|
| 81 |
cursor: pointer;
|
| 82 |
+
transition: all 0.2s ease;
|
| 83 |
+
box-shadow: 0 4px 10px rgba(44, 62, 80, 0.2);
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
button:active {
|
| 87 |
+
transform: scale(0.96); /* تأثير تفاعلي عند الضغط بالاصبع */
|
| 88 |
+
box-shadow: 0 2px 5px rgba(44, 62, 80, 0.2);
|
| 89 |
}
|
|
|
|
| 90 |
|
| 91 |
#downloadBtn {
|
| 92 |
background-color: #27ae60;
|
| 93 |
+
display: none;
|
| 94 |
margin-top: 15px;
|
| 95 |
+
box-shadow: 0 4px 10px rgba(39, 174, 96, 0.2);
|
| 96 |
}
|
| 97 |
+
|
| 98 |
+
/* الكانفاس (الصورة المدمجة) */
|
|
|
|
| 99 |
canvas {
|
| 100 |
+
width: 100%;
|
| 101 |
height: auto;
|
| 102 |
+
margin-top: 25px;
|
| 103 |
+
border-radius: 16px;
|
| 104 |
+
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
|
| 105 |
display: none;
|
| 106 |
}
|
| 107 |
+
|
| 108 |
.hint {
|
| 109 |
+
font-size: 12px;
|
| 110 |
+
color: #95a5a6;
|
| 111 |
+
margin-top: 15px;
|
| 112 |
display: none;
|
| 113 |
+
line-height: 1.6;
|
| 114 |
}
|
| 115 |
</style>
|
| 116 |
</head>
|
| 117 |
<body>
|
| 118 |
|
| 119 |
<div class="container">
|
| 120 |
+
<h2>بطاقة تهنئة رمضان<br>لأسرة العصيل</h2>
|
| 121 |
<p>أدخل اسمك لتظهر لك التهنئة المخصصة</p>
|
| 122 |
|
| 123 |
<input type="text" id="userName" placeholder="اكتب اسمك هنا...">
|
|
|
|
| 124 |
<button onclick="generateCard()">إنشاء البطاقة</button>
|
| 125 |
|
| 126 |
<canvas id="myCanvas"></canvas>
|
| 127 |
+
|
| 128 |
<button id="downloadBtn" onclick="downloadImage()">تحميل الصورة</button>
|
| 129 |
+
<p id="downloadHint" class="hint">ملاحظة: إذا لم يعمل زر التحميل، اضغط مطولاً على الصورة واختر "حفظ الصورة".</p>
|
| 130 |
</div>
|
| 131 |
|
| 132 |
<script>
|
|
|
|
| 134 |
const ctx = canvas.getContext('2d');
|
| 135 |
const image = new Image();
|
| 136 |
|
|
|
|
| 137 |
image.crossOrigin = "Anonymous";
|
|
|
|
|
|
|
| 138 |
image.src = 'template.jpg';
|
| 139 |
|
| 140 |
image.onload = function() {
|
|
|
|
| 152 |
|
| 153 |
ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
| 154 |
|
|
|
|
| 155 |
ctx.font = "bold 80px 'Cairo'";
|
| 156 |
ctx.fillStyle = "#000000";
|
| 157 |
ctx.textAlign = "center";
|
| 158 |
|
| 159 |
const xPosition = canvas.width / 2;
|
|
|
|
|
|
|
| 160 |
const yPosition = canvas.height - 350;
|
| 161 |
|
| 162 |
ctx.fillText(name, xPosition, yPosition);
|
| 163 |
|
|
|
|
| 164 |
canvas.style.display = "block";
|
| 165 |
+
document.getElementById('downloadBtn').style.display = "block";
|
| 166 |
document.getElementById('downloadHint').style.display = "block";
|
| 167 |
+
|
| 168 |
+
// تمرير الشاشة تلقائياً للأسفل لرؤية الصورة وزر التحميل على الجوال
|
| 169 |
+
setTimeout(() => {
|
| 170 |
+
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
|
| 171 |
+
}, 100);
|
| 172 |
}
|
| 173 |
|
|
|
|
| 174 |
function downloadImage() {
|
| 175 |
try {
|
| 176 |
const dataUrl = canvas.toDataURL("image/png");
|
|
|
|
| 181 |
link.click();
|
| 182 |
document.body.removeChild(link);
|
| 183 |
} catch (error) {
|
| 184 |
+
alert("عذراً، متصفحك يمنع التحميل المباشر لحماية الأمان. يرجى الضغط مطولاً على الصورة واختيار 'حفظ الصورة'.");
|
| 185 |
}
|
| 186 |
}
|
| 187 |
</script>
|