Upload 18 files
Browse files- instance/users.db +0 -0
- static/css/style.css +278 -0
- static/js/main.js +149 -0
- static/uploads/default-avatar.jpg +0 -0
- templates/artical.html +635 -0
- templates/base.html +27 -0
- templates/create_post.html +293 -0
- templates/create_post_iframe.html +263 -0
- templates/dashboard.html +2997 -0
- templates/forgot_password.html +16 -0
- templates/login.html +44 -0
- templates/messages.html +639 -0
- templates/post_detail.html +37 -0
- templates/profile.html +1827 -0
- templates/public_profile.html +1984 -0
- templates/register.html +195 -0
- templates/reset_password.html +67 -0
- templates/videos.html +1855 -0
instance/users.db
ADDED
Binary file (45.1 kB). View file
|
|
static/css/style.css
ADDED
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
:root {
|
2 |
+
--primary-color: #4CAF50;
|
3 |
+
--error-color: #f44336;
|
4 |
+
--success-color: #4CAF50;
|
5 |
+
--text-color: #333;
|
6 |
+
--background-color: #f5f5f5;
|
7 |
+
}
|
8 |
+
|
9 |
+
* {
|
10 |
+
margin: 0;
|
11 |
+
padding: 0;
|
12 |
+
box-sizing: border-box;
|
13 |
+
font-family: 'Arial', sans-serif;
|
14 |
+
}
|
15 |
+
|
16 |
+
body {
|
17 |
+
background-color: var(--background-color);
|
18 |
+
color: var(--text-color);
|
19 |
+
line-height: 1.6;
|
20 |
+
}
|
21 |
+
|
22 |
+
.container {
|
23 |
+
max-width: 1200px;
|
24 |
+
margin: 0 auto;
|
25 |
+
/* padding: 20px; */
|
26 |
+
}
|
27 |
+
|
28 |
+
.auth-container {
|
29 |
+
max-width: 500px;
|
30 |
+
margin: 40px auto;
|
31 |
+
padding: 30px;
|
32 |
+
background: #fff;
|
33 |
+
border-radius: 8px;
|
34 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
35 |
+
}
|
36 |
+
|
37 |
+
h2 {
|
38 |
+
text-align: center;
|
39 |
+
color: var(--text-color);
|
40 |
+
margin-bottom: 30px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.form-group {
|
44 |
+
margin-bottom: 20px;
|
45 |
+
}
|
46 |
+
|
47 |
+
label {
|
48 |
+
display: block;
|
49 |
+
margin-bottom: 8px;
|
50 |
+
font-weight: bold;
|
51 |
+
}
|
52 |
+
|
53 |
+
input[type="text"],
|
54 |
+
input[type="email"],
|
55 |
+
input[type="password"],
|
56 |
+
select {
|
57 |
+
width: 100%;
|
58 |
+
padding: 12px;
|
59 |
+
border: 1px solid #ddd;
|
60 |
+
border-radius: 4px;
|
61 |
+
font-size: 16px;
|
62 |
+
}
|
63 |
+
|
64 |
+
input:focus,
|
65 |
+
select:focus {
|
66 |
+
outline: none;
|
67 |
+
border-color: var(--primary-color);
|
68 |
+
box-shadow: 0 0 5px rgba(76, 175, 80, 0.2);
|
69 |
+
}
|
70 |
+
|
71 |
+
.submit-btn {
|
72 |
+
width: 100%;
|
73 |
+
padding: 12px;
|
74 |
+
background-color: var(--primary-color);
|
75 |
+
color: white;
|
76 |
+
border: none;
|
77 |
+
border-radius: 4px;
|
78 |
+
font-size: 16px;
|
79 |
+
cursor: pointer;
|
80 |
+
transition: background-color 0.3s;
|
81 |
+
}
|
82 |
+
|
83 |
+
.submit-btn:hover {
|
84 |
+
background-color: #45a049;
|
85 |
+
}
|
86 |
+
|
87 |
+
.auth-links {
|
88 |
+
text-align: center;
|
89 |
+
margin-top: 20px;
|
90 |
+
}
|
91 |
+
|
92 |
+
.auth-links a {
|
93 |
+
color: var(--primary-color);
|
94 |
+
text-decoration: none;
|
95 |
+
}
|
96 |
+
|
97 |
+
.auth-links a:hover {
|
98 |
+
text-decoration: underline;
|
99 |
+
}
|
100 |
+
|
101 |
+
.alert {
|
102 |
+
padding: 15px;
|
103 |
+
margin-bottom: 20px;
|
104 |
+
border-radius: 4px;
|
105 |
+
text-align: center;
|
106 |
+
}
|
107 |
+
|
108 |
+
.alert-error {
|
109 |
+
background-color: #ffebee;
|
110 |
+
color: var(--error-color);
|
111 |
+
border: 1px solid #ffcdd2;
|
112 |
+
}
|
113 |
+
|
114 |
+
.alert-success {
|
115 |
+
background-color: #e8f5e9;
|
116 |
+
color: var(--success-color);
|
117 |
+
border: 1px solid #c8e6c9;
|
118 |
+
}
|
119 |
+
|
120 |
+
.skill-input {
|
121 |
+
display: flex;
|
122 |
+
gap: 10px;
|
123 |
+
margin-bottom: 10px;
|
124 |
+
}
|
125 |
+
|
126 |
+
.skill-input input {
|
127 |
+
flex: 1;
|
128 |
+
}
|
129 |
+
|
130 |
+
.add-skill,
|
131 |
+
.remove-skill {
|
132 |
+
padding: 0 15px;
|
133 |
+
background-color: var(--primary-color);
|
134 |
+
color: white;
|
135 |
+
border: none;
|
136 |
+
border-radius: 4px;
|
137 |
+
cursor: pointer;
|
138 |
+
font-size: 18px;
|
139 |
+
}
|
140 |
+
|
141 |
+
.remove-skill {
|
142 |
+
background-color: var(--error-color);
|
143 |
+
}
|
144 |
+
|
145 |
+
#email-validation-message,
|
146 |
+
#password-match-message {
|
147 |
+
display: block;
|
148 |
+
margin-top: 5px;
|
149 |
+
font-size: 14px;
|
150 |
+
}
|
151 |
+
|
152 |
+
.error {
|
153 |
+
color: var(--error-color);
|
154 |
+
}
|
155 |
+
|
156 |
+
.success {
|
157 |
+
color: var(--success-color);
|
158 |
+
}
|
159 |
+
|
160 |
+
/* Password strength meter */
|
161 |
+
.strength-meter {
|
162 |
+
margin-top: 5px;
|
163 |
+
padding: 5px;
|
164 |
+
border-radius: 4px;
|
165 |
+
font-size: 14px;
|
166 |
+
text-align: center;
|
167 |
+
}
|
168 |
+
|
169 |
+
.weak {
|
170 |
+
background-color: #ffebee;
|
171 |
+
color: #d32f2f;
|
172 |
+
}
|
173 |
+
|
174 |
+
.medium {
|
175 |
+
background-color: #fff3e0;
|
176 |
+
color: #f57c00;
|
177 |
+
}
|
178 |
+
|
179 |
+
.strong {
|
180 |
+
background-color: #e8f5e9;
|
181 |
+
color: #388e3c;
|
182 |
+
}
|
183 |
+
|
184 |
+
.form-text {
|
185 |
+
display: block;
|
186 |
+
margin-top: 5px;
|
187 |
+
color: #666;
|
188 |
+
font-size: 14px;
|
189 |
+
}
|
190 |
+
|
191 |
+
/* RTL specific styles */
|
192 |
+
body {
|
193 |
+
direction: rtl;
|
194 |
+
}
|
195 |
+
|
196 |
+
.skill-input {
|
197 |
+
flex-direction: row-reverse;
|
198 |
+
}
|
199 |
+
|
200 |
+
.auth-container {
|
201 |
+
text-align: right;
|
202 |
+
}
|
203 |
+
|
204 |
+
/* Dashboard styles */
|
205 |
+
.dashboard-container {
|
206 |
+
max-width: 800px;
|
207 |
+
margin: 40px auto;
|
208 |
+
padding: 30px;
|
209 |
+
background: #fff;
|
210 |
+
border-radius: 8px;
|
211 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
212 |
+
}
|
213 |
+
|
214 |
+
.user-info {
|
215 |
+
margin: 30px 0;
|
216 |
+
}
|
217 |
+
|
218 |
+
.info-card {
|
219 |
+
background: #f8f9fa;
|
220 |
+
padding: 20px;
|
221 |
+
border-radius: 8px;
|
222 |
+
margin-top: 15px;
|
223 |
+
}
|
224 |
+
|
225 |
+
.info-card p {
|
226 |
+
margin: 10px 0;
|
227 |
+
}
|
228 |
+
|
229 |
+
.skills-list {
|
230 |
+
list-style: none;
|
231 |
+
padding: 0;
|
232 |
+
margin: 10px 0;
|
233 |
+
display: flex;
|
234 |
+
flex-wrap: wrap;
|
235 |
+
gap: 10px;
|
236 |
+
}
|
237 |
+
|
238 |
+
.skills-list li {
|
239 |
+
background: var(--primary-color);
|
240 |
+
color: white;
|
241 |
+
padding: 5px 15px;
|
242 |
+
border-radius: 20px;
|
243 |
+
font-size: 14px;
|
244 |
+
}
|
245 |
+
|
246 |
+
.logout-btn {
|
247 |
+
display: inline-block;
|
248 |
+
padding: 10px 20px;
|
249 |
+
background-color: #dc3545;
|
250 |
+
color: white;
|
251 |
+
text-decoration: none;
|
252 |
+
border-radius: 4px;
|
253 |
+
transition: background-color 0.3s;
|
254 |
+
}
|
255 |
+
|
256 |
+
.logout-btn:hover {
|
257 |
+
background-color: #c82333;
|
258 |
+
}
|
259 |
+
|
260 |
+
.dashboard-container h2 {
|
261 |
+
color: var(--primary-color);
|
262 |
+
border-bottom: 2px solid #eee;
|
263 |
+
padding-bottom: 10px;
|
264 |
+
}
|
265 |
+
|
266 |
+
.dashboard-container h3 {
|
267 |
+
color: var(--text-color);
|
268 |
+
margin: 20px 0 10px;
|
269 |
+
}
|
270 |
+
|
271 |
+
.actions {
|
272 |
+
margin-top: 30px;
|
273 |
+
text-align: center;
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
|
278 |
+
|
static/js/main.js
ADDED
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Email validation function
|
2 |
+
function validateEmail(email) {
|
3 |
+
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
4 |
+
return re.test(email);
|
5 |
+
}
|
6 |
+
|
7 |
+
// Password strength validation
|
8 |
+
function checkPasswordStrength(password) {
|
9 |
+
let strength = 0;
|
10 |
+
|
11 |
+
// Length check
|
12 |
+
if (password.length >= 8) strength += 1;
|
13 |
+
|
14 |
+
// Contains number
|
15 |
+
if (/\d/.test(password)) strength += 1;
|
16 |
+
|
17 |
+
// Contains lowercase
|
18 |
+
if (/[a-z]/.test(password)) strength += 1;
|
19 |
+
|
20 |
+
// Contains uppercase
|
21 |
+
if (/[A-Z]/.test(password)) strength += 1;
|
22 |
+
|
23 |
+
// Contains special character
|
24 |
+
if (/[^A-Za-z0-9]/.test(password)) strength += 1;
|
25 |
+
|
26 |
+
return {
|
27 |
+
score: strength,
|
28 |
+
message: getStrengthMessage(strength)
|
29 |
+
};
|
30 |
+
}
|
31 |
+
|
32 |
+
function getStrengthMessage(strength) {
|
33 |
+
switch(strength) {
|
34 |
+
case 0:
|
35 |
+
case 1:
|
36 |
+
return 'ضعيف جداً';
|
37 |
+
case 2:
|
38 |
+
return 'ضعيف';
|
39 |
+
case 3:
|
40 |
+
return 'متوسط';
|
41 |
+
case 4:
|
42 |
+
return 'قوي';
|
43 |
+
case 5:
|
44 |
+
return 'قوي جداً';
|
45 |
+
default:
|
46 |
+
return '';
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
// Initialize all tooltips
|
51 |
+
function initTooltips() {
|
52 |
+
const tooltips = document.querySelectorAll('[data-tooltip]');
|
53 |
+
tooltips.forEach(tooltip => {
|
54 |
+
tooltip.addEventListener('mouseover', showTooltip);
|
55 |
+
tooltip.addEventListener('mouseout', hideTooltip);
|
56 |
+
});
|
57 |
+
}
|
58 |
+
|
59 |
+
function showTooltip(e) {
|
60 |
+
const tooltip = document.createElement('div');
|
61 |
+
tooltip.className = 'tooltip';
|
62 |
+
tooltip.textContent = this.dataset.tooltip;
|
63 |
+
document.body.appendChild(tooltip);
|
64 |
+
|
65 |
+
const rect = this.getBoundingClientRect();
|
66 |
+
tooltip.style.top = rect.bottom + 5 + 'px';
|
67 |
+
tooltip.style.left = rect.left + (rect.width - tooltip.offsetWidth) / 2 + 'px';
|
68 |
+
}
|
69 |
+
|
70 |
+
function hideTooltip() {
|
71 |
+
const tooltips = document.querySelectorAll('.tooltip');
|
72 |
+
tooltips.forEach(tooltip => tooltip.remove());
|
73 |
+
}
|
74 |
+
|
75 |
+
// Form validation
|
76 |
+
document.addEventListener('DOMContentLoaded', function() {
|
77 |
+
const registerForm = document.getElementById('registerForm');
|
78 |
+
const loginForm = document.getElementById('loginForm');
|
79 |
+
|
80 |
+
if (registerForm) {
|
81 |
+
registerForm.addEventListener('submit', function(e) {
|
82 |
+
const password = document.getElementById('password').value;
|
83 |
+
const confirmPassword = document.getElementById('confirm_password').value;
|
84 |
+
const email = document.getElementById('email').value;
|
85 |
+
|
86 |
+
if (!validateEmail(email)) {
|
87 |
+
e.preventDefault();
|
88 |
+
alert('الرجاء إدخال بريد إلكتروني صحيح');
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
if (password !== confirmPassword) {
|
93 |
+
e.preventDefault();
|
94 |
+
alert('كلمات المرور غير متطابقة');
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
|
98 |
+
const passwordStrength = checkPasswordStrength(password);
|
99 |
+
if (passwordStrength.score < 3) {
|
100 |
+
if (!confirm('كلمة المرور ضعيفة. هل تريد المتابعة؟')) {
|
101 |
+
e.preventDefault();
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
});
|
106 |
+
|
107 |
+
// Real-time password strength indicator
|
108 |
+
const passwordInput = document.getElementById('password');
|
109 |
+
if (passwordInput) {
|
110 |
+
const strengthIndicator = document.createElement('div');
|
111 |
+
strengthIndicator.className = 'password-strength';
|
112 |
+
passwordInput.parentNode.appendChild(strengthIndicator);
|
113 |
+
|
114 |
+
passwordInput.addEventListener('input', function() {
|
115 |
+
const strength = checkPasswordStrength(this.value);
|
116 |
+
strengthIndicator.textContent = 'قوة كلمة المرور: ' + strength.message;
|
117 |
+
strengthIndicator.className = 'password-strength strength-' + strength.score;
|
118 |
+
});
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
// Initialize tooltips
|
123 |
+
initTooltips();
|
124 |
+
});
|
125 |
+
|
126 |
+
// Skills management
|
127 |
+
document.addEventListener('DOMContentLoaded', function() {
|
128 |
+
const skillsContainer = document.getElementById('skills-container');
|
129 |
+
|
130 |
+
if (skillsContainer) {
|
131 |
+
// Add new skill field
|
132 |
+
document.querySelector('.add-skill').addEventListener('click', function() {
|
133 |
+
const skillInput = document.createElement('div');
|
134 |
+
skillInput.className = 'skill-input';
|
135 |
+
skillInput.innerHTML = `
|
136 |
+
<input type="text" name="skill" class="skill-field">
|
137 |
+
<button type="button" class="remove-skill">-</button>
|
138 |
+
`;
|
139 |
+
skillsContainer.appendChild(skillInput);
|
140 |
+
});
|
141 |
+
|
142 |
+
// Remove skill field
|
143 |
+
skillsContainer.addEventListener('click', function(e) {
|
144 |
+
if (e.target.classList.contains('remove-skill')) {
|
145 |
+
e.target.parentElement.remove();
|
146 |
+
}
|
147 |
+
});
|
148 |
+
}
|
149 |
+
});
|
static/uploads/default-avatar.jpg
ADDED
![]() |
templates/artical.html
ADDED
@@ -0,0 +1,635 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="ar">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>مولد مقالات AI</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: 'Cairo', sans-serif;
|
10 |
+
margin: 20px;
|
11 |
+
padding: 0;
|
12 |
+
background-color: #f9f9f9;
|
13 |
+
direction: rtl;
|
14 |
+
}
|
15 |
+
|
16 |
+
h1 {
|
17 |
+
font-size: 28px;
|
18 |
+
color: #333;
|
19 |
+
text-align: center;
|
20 |
+
margin-bottom: 30px;
|
21 |
+
}
|
22 |
+
|
23 |
+
.container {
|
24 |
+
max-width: 800px;
|
25 |
+
margin: 0 auto;
|
26 |
+
}
|
27 |
+
|
28 |
+
input[type="text"] {
|
29 |
+
width: 100%;
|
30 |
+
padding: 12px;
|
31 |
+
font-size: 16px;
|
32 |
+
border: 1px solid #ccc;
|
33 |
+
border-radius: 5px;
|
34 |
+
margin-bottom: 15px;
|
35 |
+
box-sizing: border-box;
|
36 |
+
}
|
37 |
+
|
38 |
+
.btn {
|
39 |
+
width: 100%;
|
40 |
+
padding: 12px;
|
41 |
+
font-size: 16px;
|
42 |
+
background-color: #007bff;
|
43 |
+
color: #fff;
|
44 |
+
border: none;
|
45 |
+
border-radius: 5px;
|
46 |
+
cursor: pointer;
|
47 |
+
margin-bottom: 30px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.article-box {
|
51 |
+
background-color: #fff;
|
52 |
+
border: 1px solid #e0e0e0;
|
53 |
+
border-radius: 12px;
|
54 |
+
padding: 20px;
|
55 |
+
margin-bottom: 20px;
|
56 |
+
cursor: pointer;
|
57 |
+
transition: all 0.3s ease;
|
58 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* ظل خفيف */
|
59 |
+
position: relative;
|
60 |
+
overflow: hidden;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
.article-title {
|
66 |
+
font-size: 20px;
|
67 |
+
font-weight: bold;
|
68 |
+
color: #333;
|
69 |
+
margin: 0 0 10px 0;
|
70 |
+
}
|
71 |
+
|
72 |
+
.article-meta {
|
73 |
+
font-size: 14px;
|
74 |
+
color: #777;
|
75 |
+
margin: 0 0 10px 0;
|
76 |
+
}
|
77 |
+
|
78 |
+
/* النافذة المنبثقة (المودال) */
|
79 |
+
.article-content {
|
80 |
+
display: none;
|
81 |
+
position: fixed;
|
82 |
+
top: 100%;
|
83 |
+
left: 50%;
|
84 |
+
width: 100%;
|
85 |
+
max-width: 600px;
|
86 |
+
height: 100%;
|
87 |
+
transform: translateX(-50%);
|
88 |
+
background-color: #fff;
|
89 |
+
border: none;
|
90 |
+
border-radius: 10px;
|
91 |
+
/* padding: 20px; */
|
92 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
93 |
+
z-index: 1000;
|
94 |
+
overflow-y: auto;
|
95 |
+
opacity: 0;
|
96 |
+
transition: opacity 0.3s ease-in-out, top 0.3s ease-in-out;
|
97 |
+
overflow-x: hidden;
|
98 |
+
}
|
99 |
+
|
100 |
+
.article-content.show {
|
101 |
+
top: 50%;
|
102 |
+
opacity: 1;
|
103 |
+
transform: translate(-50%, -50%);
|
104 |
+
}
|
105 |
+
|
106 |
+
.overlay {
|
107 |
+
display: none;
|
108 |
+
position: fixed;
|
109 |
+
top: 0;
|
110 |
+
left: 0;
|
111 |
+
width: 100%;
|
112 |
+
height: 100%;
|
113 |
+
background-color: rgba(0, 0, 0, 0.5);
|
114 |
+
z-index: 999;
|
115 |
+
opacity: 0;
|
116 |
+
transition: opacity 0.3s ease-in-out;
|
117 |
+
}
|
118 |
+
|
119 |
+
.overlay.show {
|
120 |
+
opacity: 1;
|
121 |
+
}
|
122 |
+
|
123 |
+
.close-btn {
|
124 |
+
position: sticky;
|
125 |
+
top: 10px;
|
126 |
+
right: 10px;
|
127 |
+
font-size: 24px;
|
128 |
+
cursor: pointer;
|
129 |
+
color: #333;
|
130 |
+
background-color: #fff;
|
131 |
+
border: 2px solid #ccc;
|
132 |
+
border-radius: 50%; /* جعل الزر دائريًا */
|
133 |
+
width: 40px;
|
134 |
+
height: 40px;
|
135 |
+
display: flex;
|
136 |
+
align-items: center;
|
137 |
+
justify-content: center;
|
138 |
+
z-index: 20;
|
139 |
+
transition: all 0.3s ease; /* إضافة تأثير سلس */
|
140 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* إضافة ظل خفيف */
|
141 |
+
}
|
142 |
+
|
143 |
+
.close-btn:hover {
|
144 |
+
color: #fff;
|
145 |
+
background-color: #ff4d4d; /* لون أحمر عند التمرير */
|
146 |
+
border-color: #ff4d4d;
|
147 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* زيادة الظل عند التمرير */
|
148 |
+
}
|
149 |
+
|
150 |
+
.close-btn:active {
|
151 |
+
transform: scale(0.9); /* تصغير الزر قليلاً عند النقر */
|
152 |
+
}
|
153 |
+
|
154 |
+
.close-btn:hover {
|
155 |
+
color: #000;
|
156 |
+
}
|
157 |
+
|
158 |
+
.modal-header {
|
159 |
+
font-size: 20px;
|
160 |
+
font-weight: bold;
|
161 |
+
color: #333;
|
162 |
+
text-align: center;
|
163 |
+
width: 100%;
|
164 |
+
white-space: nowrap; /* منع النص من الانتقال إلى سطر جديد */
|
165 |
+
overflow: hidden; /* إخفاء النص الذي يتجاوز العرض */
|
166 |
+
text-overflow: ellipsis; /* إضافة ... إذا تجاوز النص العرض */
|
167 |
+
padding: 0 10px; /* إضافة بعض المساحة الداخلية */
|
168 |
+
box-sizing: border-box; /* التأكد من أن الحشو لا يزيد العرض */
|
169 |
+
}
|
170 |
+
|
171 |
+
.article-body {
|
172 |
+
font-size: 16px;
|
173 |
+
color: #555;
|
174 |
+
line-height: 1.6;
|
175 |
+
padding: 20px;
|
176 |
+
}
|
177 |
+
|
178 |
+
.modal-footer {
|
179 |
+
font-size: 14px;
|
180 |
+
color: #777;
|
181 |
+
margin-top: 20px;
|
182 |
+
text-align: center;
|
183 |
+
}
|
184 |
+
|
185 |
+
.skeleton {
|
186 |
+
width: 100%;
|
187 |
+
height: 200px;
|
188 |
+
background: #f0f0f0;
|
189 |
+
animation: pulse 1.5s infinite ease-in-out;
|
190 |
+
border-radius: 5px;
|
191 |
+
}
|
192 |
+
|
193 |
+
@keyframes pulse {
|
194 |
+
0% {
|
195 |
+
background-color: #f0f0f0;
|
196 |
+
}
|
197 |
+
50% {
|
198 |
+
background-color: #e0e0e0;
|
199 |
+
}
|
200 |
+
100% {
|
201 |
+
background-color: #f0f0f0;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/* مربع البحث */
|
206 |
+
.search-box {
|
207 |
+
margin-bottom: 20px;
|
208 |
+
}
|
209 |
+
|
210 |
+
.search-box input {
|
211 |
+
width: 100%;
|
212 |
+
padding: 10px;
|
213 |
+
font-size: 16px;
|
214 |
+
border: 1px solid #ccc;
|
215 |
+
border-radius: 5px;
|
216 |
+
}
|
217 |
+
|
218 |
+
code{
|
219 |
+
color: #fff;
|
220 |
+
background-color: #000;
|
221 |
+
padding: 5px;
|
222 |
+
border-radius: 3px;
|
223 |
+
}
|
224 |
+
|
225 |
+
.modal-footer {
|
226 |
+
display: flex;
|
227 |
+
justify-content: space-between;
|
228 |
+
align-items: center;
|
229 |
+
padding: 10px;
|
230 |
+
background-color: #f8f9fa;
|
231 |
+
border-top: 1px solid #e9ecef;
|
232 |
+
font-size: 14px;
|
233 |
+
color: #6c757d;
|
234 |
+
}
|
235 |
+
|
236 |
+
.user-info {
|
237 |
+
font-weight: bold;
|
238 |
+
color: #007bff;
|
239 |
+
width: 23%;
|
240 |
+
}
|
241 |
+
|
242 |
+
.date {
|
243 |
+
font-style: italic;
|
244 |
+
color: #6c757d;
|
245 |
+
}
|
246 |
+
|
247 |
+
.time {
|
248 |
+
font-weight: bold;
|
249 |
+
color: #28a745; /* لون مختلف للوقت */
|
250 |
+
}
|
251 |
+
|
252 |
+
code{
|
253 |
+
color: #fff;
|
254 |
+
background-color: #000;
|
255 |
+
padding: 5px;
|
256 |
+
border-radius: 3px;
|
257 |
+
}
|
258 |
+
|
259 |
+
.modal-footer {
|
260 |
+
display: flex;
|
261 |
+
justify-content: space-between;
|
262 |
+
align-items: center;
|
263 |
+
padding: 10px;
|
264 |
+
background-color: #f8f9fa;
|
265 |
+
border-top: 1px solid #e9ecef;
|
266 |
+
font-size: 14px;
|
267 |
+
color: #6c757d;
|
268 |
+
}
|
269 |
+
|
270 |
+
.user-info {
|
271 |
+
font-weight: bold;
|
272 |
+
color: #007bff;
|
273 |
+
}
|
274 |
+
|
275 |
+
.date {
|
276 |
+
font-style: italic;
|
277 |
+
color: #6c757d;
|
278 |
+
}
|
279 |
+
|
280 |
+
.time {
|
281 |
+
font-weight: bold;
|
282 |
+
color: #28a745; /* لون مختلف للوقت */
|
283 |
+
}
|
284 |
+
|
285 |
+
code{
|
286 |
+
color: #fff;
|
287 |
+
background-color: #000;
|
288 |
+
padding: 5px;
|
289 |
+
border-radius: 3px;
|
290 |
+
}
|
291 |
+
.modal-footer {
|
292 |
+
display: flex;
|
293 |
+
justify-content: space-between;
|
294 |
+
align-items: center;
|
295 |
+
padding: 10px;
|
296 |
+
background-color: #f8f9fa;
|
297 |
+
border-top: 1px solid #e9ecef;
|
298 |
+
font-size: 14px;
|
299 |
+
color: #6c757d;
|
300 |
+
}
|
301 |
+
|
302 |
+
.user-info {
|
303 |
+
font-weight: bold;
|
304 |
+
color: #007bff;
|
305 |
+
}
|
306 |
+
|
307 |
+
.date {
|
308 |
+
font-style: italic;
|
309 |
+
color: #6c757d;
|
310 |
+
}
|
311 |
+
|
312 |
+
.time {
|
313 |
+
font-weight: bold;
|
314 |
+
color: #28a745; /* لون مختلف للوقت */
|
315 |
+
margin-right: 10px;
|
316 |
+
}
|
317 |
+
|
318 |
+
.user-photo {
|
319 |
+
margin-left: 10px; /* مسافة بين الصورة والعناصر الأخرى */
|
320 |
+
}
|
321 |
+
|
322 |
+
.photo_user {
|
323 |
+
width: 40px; /* حجم الصورة */
|
324 |
+
height: 40px;
|
325 |
+
border-radius: 50%; /* جعل الصورة دائرية */
|
326 |
+
object-fit: cover; /* تأكد من أن الصورة تملأ المساحة دون تشويه */
|
327 |
+
border: 2px solid #007bff; /* إطار حول الصورة */
|
328 |
+
}
|
329 |
+
|
330 |
+
.article-title {
|
331 |
+
font-size: 20px;
|
332 |
+
font-weight: bold;
|
333 |
+
color: #333;
|
334 |
+
margin: 0 0 10px 0;
|
335 |
+
position: sticky;
|
336 |
+
top: 0;
|
337 |
+
background-color: #fff;
|
338 |
+
padding: 10px 0;
|
339 |
+
z-index: 10;
|
340 |
+
border-bottom: 1px solid #ddd;
|
341 |
+
}
|
342 |
+
|
343 |
+
.close-btn {
|
344 |
+
/* position: sticky; */
|
345 |
+
/* top: 0;
|
346 |
+
right: 0; */
|
347 |
+
font-size: 30px;
|
348 |
+
cursor: pointer;
|
349 |
+
color: #333;
|
350 |
+
/* background: none;
|
351 |
+
border: none;
|
352 |
+
z-index: 20;
|
353 |
+
margin-left: auto; */
|
354 |
+
padding: 10px;
|
355 |
+
/* background-color: #fff; */
|
356 |
+
|
357 |
+
}
|
358 |
+
|
359 |
+
.controls{
|
360 |
+
position: sticky;
|
361 |
+
top: 0;
|
362 |
+
right: 0;
|
363 |
+
font-size: 30px;
|
364 |
+
cursor: pointer;
|
365 |
+
color: #333;
|
366 |
+
background: none;
|
367 |
+
border: none;
|
368 |
+
z-index: 20;
|
369 |
+
margin-left: auto;
|
370 |
+
padding: 5px 10px;
|
371 |
+
width: 100%;
|
372 |
+
background-color: #fff;
|
373 |
+
display: flex;
|
374 |
+
align-items: center;
|
375 |
+
justify-content: space-between;
|
376 |
+
background-color: #007bff;
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
+
|
381 |
+
</style>
|
382 |
+
<!-- إضافة Prism CSS -->
|
383 |
+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/themes/prism.css" rel="stylesheet"/>
|
384 |
+
|
385 |
+
<!-- إضافة Prism JS -->
|
386 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/prism.js"></script>
|
387 |
+
|
388 |
+
<script>
|
389 |
+
let overlay = null;
|
390 |
+
// فتح النافذة
|
391 |
+
function toggleContent(element) {
|
392 |
+
const content = element.querySelector('.article-content');
|
393 |
+
|
394 |
+
if (content.style.display === 'none' || content.style.display === '') {
|
395 |
+
content.style.display = 'block';
|
396 |
+
setTimeout(() => {
|
397 |
+
content.classList.add('show');
|
398 |
+
}, 10);
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
// إغلاق النافذة
|
403 |
+
// إغلاق المقالة عند الضغط على زر "إغلاق"
|
404 |
+
function closeContent(button) {
|
405 |
+
const content = button.closest('.article-content'); // الوصول إلى العنصر الأب (الـ article-content)
|
406 |
+
content.classList.remove('show'); // إزالة الفئة التي تعرض النافذة
|
407 |
+
setTimeout(() => {
|
408 |
+
content.style.display = 'none'; // إخفاء النافذة تمامًا بعد وقت قصير (500ms)
|
409 |
+
}, 500);
|
410 |
+
}
|
411 |
+
let isCreating = false; // متغير لتتبع حالة إنشاء المقالة
|
412 |
+
|
413 |
+
// إنشاء المقالة
|
414 |
+
async function createArticle() {
|
415 |
+
if (isCreating) {
|
416 |
+
// إذا كانت العملية جارية، عرض رسالة تذكير
|
417 |
+
const message = document.createElement('div');
|
418 |
+
message.id = 'creation-message';
|
419 |
+
message.textContent = 'انتظر لم ننتهي بعد';
|
420 |
+
message.style.color = 'red';
|
421 |
+
message.style.position = 'fixed';
|
422 |
+
message.style.top = '10px';
|
423 |
+
message.style.left = '50%';
|
424 |
+
message.style.transform = 'translateX(-50%)';
|
425 |
+
message.style.padding = '10px';
|
426 |
+
message.style.backgroundColor = 'white';
|
427 |
+
message.style.border = '1px solid red';
|
428 |
+
message.style.borderRadius = '5px';
|
429 |
+
message.style.zIndex = '1000';
|
430 |
+
document.body.appendChild(message);
|
431 |
+
|
432 |
+
// إخفاء الرسالة بعد 3 ثوانٍ
|
433 |
+
setTimeout(() => {
|
434 |
+
document.body.removeChild(message);
|
435 |
+
}, 3000);
|
436 |
+
|
437 |
+
return; // إيقاف التنفيذ إذا كانت العملية جارية
|
438 |
+
}
|
439 |
+
|
440 |
+
const title = document.getElementById('title').value; // جلب العنوان من الـ input
|
441 |
+
if (!title) {
|
442 |
+
alert('يرجى إدخال عنوان المقال.');
|
443 |
+
return;
|
444 |
+
}
|
445 |
+
|
446 |
+
isCreating = true; // تعيين حالة العملية إلى "جارية"
|
447 |
+
document.getElementById('loading-text').style.display = 'block'; // عرض النص "جاري التحميل"
|
448 |
+
|
449 |
+
const articleSection = document.getElementById('articles'); // الحصول على قسم المقالات
|
450 |
+
const loadingSkeleton = document.createElement('div'); // إنشاء عنصر جديد للتحميل
|
451 |
+
loadingSkeleton.classList.add('skeleton'); // إضافة الفئة التي تنشئ تأثير التحميل
|
452 |
+
articleSection.prepend(loadingSkeleton); // إضافة عنصر التحميل في البداية
|
453 |
+
|
454 |
+
try {
|
455 |
+
// إرسال طلب إلى السيرفر لإنشاء المقال
|
456 |
+
const response = await fetch('/create', {
|
457 |
+
method: 'POST',
|
458 |
+
headers: { 'Content-Type': 'application/json' },
|
459 |
+
body: JSON.stringify({ title }) // إرسال العنوان فقط
|
460 |
+
});
|
461 |
+
|
462 |
+
if (!response.ok) {
|
463 |
+
throw new Error('حدث خطأ أثناء إنشاء المقال.');
|
464 |
+
}
|
465 |
+
|
466 |
+
const data = await response.json(); // تحويل الاستجابة إلى JSON
|
467 |
+
|
468 |
+
// إنشاء المقال الجديد وعرضه
|
469 |
+
const newArticle = document.createElement('div');
|
470 |
+
newArticle.classList.add('article-box');
|
471 |
+
newArticle.setAttribute("data-idUser" , `${data.id_user}`)
|
472 |
+
newArticle.setAttribute('onclick', 'toggleContent(this)');
|
473 |
+
newArticle.innerHTML = `
|
474 |
+
<h3 class="article-title">${data.title}</h3>
|
475 |
+
<p class="article-meta">By: ${data.user} - ${new Date(data.created_at).toLocaleString()}</p>
|
476 |
+
<div class="article-content">
|
477 |
+
<div class="controls">
|
478 |
+
<button class="close-btn" onclick="closeContent(this)">×</button>
|
479 |
+
<div class="modal-header">${data.title}</div>
|
480 |
+
</div>
|
481 |
+
<div class="article-body">${data.content}</div>
|
482 |
+
<div class="modal-footer">
|
483 |
+
<img class="photo_user" src="${data.photo_user}" alt="User Photo">
|
484 |
+
<span class="user-info">By: ${data.user}</span>
|
485 |
+
<span class="date">${new Date(data.created_at).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}</span>
|
486 |
+
<span class="time">${new Date(data.created_at).toLocaleTimeString()}</span>
|
487 |
+
</div>
|
488 |
+
</div>
|
489 |
+
`;
|
490 |
+
|
491 |
+
// إزالة عنصر التحميل وعرض المقال الجديد
|
492 |
+
articleSection.removeChild(loadingSkeleton);
|
493 |
+
articleSection.prepend(newArticle); // إضافة المقال الجديد في أعلى القسم
|
494 |
+
|
495 |
+
} catch (error) {
|
496 |
+
console.error(error);
|
497 |
+
alert('حدث خطأ أثناء إنشاء المقال.');
|
498 |
+
articleSection.removeChild(loadingSkeleton); // إزالة عنصر التحميل في حال حدوث خطأ
|
499 |
+
} finally {
|
500 |
+
isCreating = false; // تعيين حالة العملية إلى "غير جارية"
|
501 |
+
document.getElementById('loading-text').style.display = 'none'; // إخفاء النص "جاري التحميل" عند الانتهاء
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
|
506 |
+
function searchArticles() {
|
507 |
+
const searchTerm = document.getElementById('search').value.toLowerCase();
|
508 |
+
const articles = document.querySelectorAll('.article-box');
|
509 |
+
articles.forEach(article => {
|
510 |
+
const title = article.querySelector('.article-title').textContent.toLowerCase();
|
511 |
+
if (title.includes(searchTerm)) {
|
512 |
+
article.style.display = 'block';
|
513 |
+
} else {
|
514 |
+
article.style.display = 'none';
|
515 |
+
}
|
516 |
+
});
|
517 |
+
}
|
518 |
+
|
519 |
+
|
520 |
+
|
521 |
+
document.addEventListener('DOMContentLoaded', () => {
|
522 |
+
// ربط الدالة بحدث النقر على زر "عرض مقالاتي"
|
523 |
+
const showMyArticlesButton = document.getElementById('showMyArticles');
|
524 |
+
if (showMyArticlesButton) {
|
525 |
+
showMyArticlesButton.addEventListener('click', async () => {
|
526 |
+
const currentUserId = await getCurrentUserId(); // جلب id المستخدم الحالي
|
527 |
+
|
528 |
+
if (currentUserId) {
|
529 |
+
console.log('ID المستخدم الحالي:', currentUserId);
|
530 |
+
|
531 |
+
// تصفية المقالات بناءً على id المستخدم
|
532 |
+
const articles = document.querySelectorAll('.article-box');
|
533 |
+
articles.forEach(article => {
|
534 |
+
const articleUserId = article.getAttribute('data-iduser'); // جلب id المستخدم من المقالة
|
535 |
+
if (articleUserId == currentUserId) {
|
536 |
+
article.style.display = 'block'; // عرض المقالة إذا كانت للمستخدم الحالي
|
537 |
+
} else {
|
538 |
+
article.style.display = 'none'; // إخفاء المقالة إذا لم تكن للمستخدم الحالي
|
539 |
+
}
|
540 |
+
});
|
541 |
+
} else {
|
542 |
+
console.log('لم يتم العثور على id المستخدم.');
|
543 |
+
alert('يجب تسجيل الدخول لعرض مقالاتك.');
|
544 |
+
}
|
545 |
+
});
|
546 |
+
} else {
|
547 |
+
console.error('الزر "عرض مقالاتي" غير موجود في الصفحة.');
|
548 |
+
}
|
549 |
+
|
550 |
+
// ربط الدالة بحدث النقر على زر "عرض كل المقالات"
|
551 |
+
const showAllArticlesButton = document.getElementById('showAllArticles');
|
552 |
+
if (showAllArticlesButton) {
|
553 |
+
showAllArticlesButton.addEventListener('click', () => {
|
554 |
+
// عرض جميع المقالات
|
555 |
+
const articles = document.querySelectorAll('.article-box');
|
556 |
+
articles.forEach(article => {
|
557 |
+
article.style.display = 'block'; // إظهار جميع المقالات
|
558 |
+
});
|
559 |
+
});
|
560 |
+
} else {
|
561 |
+
console.error('الزر "عرض كل المقالات" غير موجود في الصفحة.');
|
562 |
+
}
|
563 |
+
});
|
564 |
+
|
565 |
+
// دالة لجلب id المستخدم الحالي
|
566 |
+
async function getCurrentUserId() {
|
567 |
+
try {
|
568 |
+
const response = await fetch('/current_user_id', {
|
569 |
+
method: 'GET',
|
570 |
+
headers: {
|
571 |
+
'Content-Type': 'application/json'
|
572 |
+
}
|
573 |
+
});
|
574 |
+
|
575 |
+
if (!response.ok) {
|
576 |
+
throw new Error('فشل في جلب بيانات المستخدم');
|
577 |
+
}
|
578 |
+
|
579 |
+
const data = await response.json(); // تحويل الاستجابة إلى JSON
|
580 |
+
return data.id; // إرجاع id المستخدم
|
581 |
+
} catch (error) {
|
582 |
+
console.error('حدث خطأ:', error);
|
583 |
+
return null; // إرجاع null في حالة حدوث خطأ
|
584 |
+
}
|
585 |
+
}
|
586 |
+
|
587 |
+
</script>
|
588 |
+
</head>
|
589 |
+
<body>
|
590 |
+
|
591 |
+
<div id="loading-text" style="text-align: center; margin-top: 20px; display: none;">
|
592 |
+
<p>جاري الإنشاء...</p>
|
593 |
+
</div>
|
594 |
+
|
595 |
+
|
596 |
+
<div class="container">
|
597 |
+
<h1>مولد مقالات AI</h1>
|
598 |
+
|
599 |
+
<!-- مربع البحث -->
|
600 |
+
<div class="search-box">
|
601 |
+
<input type="text" id="search" oninput="searchArticles()" placeholder="بحث عن مقال...">
|
602 |
+
</div>
|
603 |
+
|
604 |
+
<input type="text" id="title" placeholder="أدخل عنوان المقال">
|
605 |
+
<button class="btn" onclick="createArticle()">أنشئ مقال</button>
|
606 |
+
<button id="showMyArticles">عرض مقالاتي</button>
|
607 |
+
<button id="showAllArticles">عرض كل المقالات</button>
|
608 |
+
|
609 |
+
<div id="articles">
|
610 |
+
<!-- عرض المقالات الموجودة -->
|
611 |
+
{% for article in articles %}
|
612 |
+
<div class="article-box" data-idUser="{{ article.id_user }}" onclick="toggleContent(this)">
|
613 |
+
<h3 class="article-title">{{ article.title }}</h3>
|
614 |
+
<p class="article-meta">By: {{ article.user }} - {{ article.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</p>
|
615 |
+
<div class="article-content">
|
616 |
+
<div class="controls">
|
617 |
+
<button class="close-btn" onclick="closeContent(this)">×</button>
|
618 |
+
<div class="modal-header ">{{ article.title }}</div>
|
619 |
+
</div>
|
620 |
+
<div class="article-body">{{ article.content | safe }}</div>
|
621 |
+
<div class="modal-footer">
|
622 |
+
<img class="photo_user" src="{{ url_for('static', filename=article.photo_user) }}" alt="User Photo">
|
623 |
+
<span class="user-info">By: {{ article.user }}</span>
|
624 |
+
<span class="date">{{ article.created_at.strftime('%A, %Y-%m-%d') }}</span>
|
625 |
+
<span class="time">{{ article.created_at.strftime('%H:%M') }}</span>
|
626 |
+
<div class="user-photo">
|
627 |
+
</div> </div>
|
628 |
+
</div> <!-- إغلاق article-content -->
|
629 |
+
</div> <!-- إغلاق article-box -->
|
630 |
+
{% endfor %}
|
631 |
+
</div> <!-- إغلاق articles -->
|
632 |
+
|
633 |
+
|
634 |
+
</body>
|
635 |
+
</html>
|
templates/base.html
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
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>{% block title %}{% endblock %}</title>
|
7 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
8 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
10 |
+
|
11 |
+
</head>
|
12 |
+
<body>
|
13 |
+
<div class="container">
|
14 |
+
{% with messages = get_flashed_messages(with_categories=true) %}
|
15 |
+
{% if messages %}
|
16 |
+
{% for category, message in messages %}
|
17 |
+
<div class="alert alert-{{ category }}">{{ message }}</div>
|
18 |
+
{% endfor %}
|
19 |
+
{% endif %}
|
20 |
+
{% endwith %}
|
21 |
+
|
22 |
+
{% block content %}{% endblock %}
|
23 |
+
</div>
|
24 |
+
|
25 |
+
{% block scripts %}{% endblock %}
|
26 |
+
</body>
|
27 |
+
</html>
|
templates/create_post.html
ADDED
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}إنشاء منشور{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="post-creation-container">
|
7 |
+
<!-- User Profile Section -->
|
8 |
+
<div class="user-profile">
|
9 |
+
<div class="profile-circle">
|
10 |
+
<img src="{{ url_for('static', filename='uploads/default-avatar.jpg') }}" alt="Profile Picture" class="profile-pic">
|
11 |
+
</div>
|
12 |
+
<span class="username">{{ current_user.username }}</span>
|
13 |
+
</div>
|
14 |
+
|
15 |
+
<!-- Post Creation Form -->
|
16 |
+
<form class="post-form" method="POST" enctype="multipart/form-data">
|
17 |
+
<div class="post-type-selector">
|
18 |
+
<button type="button" class="type-btn active" data-type="text">
|
19 |
+
<i class="fas fa-font"></i> نص
|
20 |
+
</button>
|
21 |
+
<button type="button" class="type-btn" data-type="media">
|
22 |
+
<i class="fas fa-image"></i> صورة/فيديو
|
23 |
+
</button>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div class="text-post-section">
|
27 |
+
<textarea name="content" placeholder="بماذا تفكر؟" class="form-control"></textarea>
|
28 |
+
|
29 |
+
<div class="background-colors">
|
30 |
+
<button type="button" class="color-btn active" data-color="#ffffff" style="background-color: #ffffff">
|
31 |
+
<i class="fas fa-font"></i>
|
32 |
+
</button>
|
33 |
+
<button type="button" class="color-btn" data-color="#ffafcc" style="background-color: #ffafcc">
|
34 |
+
<i class="fas fa-font"></i>
|
35 |
+
</button>
|
36 |
+
<button type="button" class="color-btn" data-color="#a2d2ff" style="background-color: #a2d2ff">
|
37 |
+
<i class="fas fa-font"></i>
|
38 |
+
</button>
|
39 |
+
<button type="button" class="color-btn" data-color="#caffbf" style="background-color: #caffbf">
|
40 |
+
<i class="fas fa-font"></i>
|
41 |
+
</button>
|
42 |
+
<button type="button" class="color-btn" data-color="#ffd6a5" style="background-color: #ffd6a5">
|
43 |
+
<i class="fas fa-font"></i>
|
44 |
+
</button>
|
45 |
+
</div>
|
46 |
+
<input type="hidden" name="background_color" id="background_color" value="#ffffff">
|
47 |
+
</div>
|
48 |
+
|
49 |
+
<div class="media-post-section" style="display: none;">
|
50 |
+
<textarea name="media_content" placeholder="اكتب شيئاً عن هذه الصورة/الفيديو..." class="form-control"></textarea>
|
51 |
+
<div class="media-upload">
|
52 |
+
<input type="file" name="media" id="media-input" accept="image/*,video/*">
|
53 |
+
<label for="media-input" class="upload-label">
|
54 |
+
<i class="fas fa-cloud-upload-alt"></i> اختر صورة أو فيديو
|
55 |
+
</label>
|
56 |
+
<div id="media-preview"></div>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div class="form-actions">
|
61 |
+
<button type="submit" class="btn btn-primary">نشر</button>
|
62 |
+
</div>
|
63 |
+
</form>
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<style>
|
67 |
+
.post-creation-container {
|
68 |
+
max-width: 600px;
|
69 |
+
margin: 20px auto;
|
70 |
+
background: #fff;
|
71 |
+
border-radius: 8px;
|
72 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
73 |
+
padding: 20px;
|
74 |
+
}
|
75 |
+
|
76 |
+
.user-profile {
|
77 |
+
display: flex;
|
78 |
+
align-items: center;
|
79 |
+
margin-bottom: 20px;
|
80 |
+
}
|
81 |
+
|
82 |
+
.profile-circle {
|
83 |
+
width: 40px;
|
84 |
+
height: 40px;
|
85 |
+
border-radius: 50%;
|
86 |
+
overflow: hidden;
|
87 |
+
margin-left: 10px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.profile-circle img {
|
91 |
+
width: 100%;
|
92 |
+
height: 100%;
|
93 |
+
object-fit: cover;
|
94 |
+
}
|
95 |
+
|
96 |
+
.username {
|
97 |
+
font-weight: bold;
|
98 |
+
color: #1a1a1a;
|
99 |
+
}
|
100 |
+
|
101 |
+
.post-type-selector {
|
102 |
+
display: flex;
|
103 |
+
gap: 10px;
|
104 |
+
margin-bottom: 15px;
|
105 |
+
border-bottom: 1px solid #ddd;
|
106 |
+
padding-bottom: 10px;
|
107 |
+
}
|
108 |
+
|
109 |
+
.type-btn {
|
110 |
+
flex: 1;
|
111 |
+
padding: 8px;
|
112 |
+
border: none;
|
113 |
+
background: none;
|
114 |
+
cursor: pointer;
|
115 |
+
border-radius: 4px;
|
116 |
+
color: #65676b;
|
117 |
+
}
|
118 |
+
|
119 |
+
.type-btn.active {
|
120 |
+
background-color: #e7f3ff;
|
121 |
+
color: #1877f2;
|
122 |
+
}
|
123 |
+
|
124 |
+
.form-control {
|
125 |
+
width: 100%;
|
126 |
+
padding: 12px;
|
127 |
+
border: 1px solid #ddd;
|
128 |
+
border-radius: 8px;
|
129 |
+
font-size: 16px;
|
130 |
+
margin-bottom: 15px;
|
131 |
+
box-sizing: border-box;
|
132 |
+
}
|
133 |
+
|
134 |
+
textarea.form-control {
|
135 |
+
min-height: 100px;
|
136 |
+
resize: vertical;
|
137 |
+
white-space: pre-wrap;
|
138 |
+
direction: rtl;
|
139 |
+
}
|
140 |
+
|
141 |
+
.background-colors {
|
142 |
+
display: flex;
|
143 |
+
gap: 10px;
|
144 |
+
margin-bottom: 15px;
|
145 |
+
padding: 10px;
|
146 |
+
border-radius: 8px;
|
147 |
+
background: #f0f2f5;
|
148 |
+
}
|
149 |
+
|
150 |
+
.color-btn {
|
151 |
+
width: 40px;
|
152 |
+
height: 40px;
|
153 |
+
border: none;
|
154 |
+
border-radius: 50%;
|
155 |
+
cursor: pointer;
|
156 |
+
display: flex;
|
157 |
+
align-items: center;
|
158 |
+
justify-content: center;
|
159 |
+
color: #1a1a1a;
|
160 |
+
}
|
161 |
+
|
162 |
+
.color-btn.active {
|
163 |
+
border: 2px solid #1877f2;
|
164 |
+
}
|
165 |
+
|
166 |
+
.media-upload {
|
167 |
+
margin: 15px 0;
|
168 |
+
}
|
169 |
+
|
170 |
+
.upload-label {
|
171 |
+
display: inline-block;
|
172 |
+
padding: 10px 20px;
|
173 |
+
background: #f0f2f5;
|
174 |
+
border-radius: 8px;
|
175 |
+
cursor: pointer;
|
176 |
+
color: #1877f2;
|
177 |
+
}
|
178 |
+
|
179 |
+
.upload-label i {
|
180 |
+
margin-left: 8px;
|
181 |
+
}
|
182 |
+
|
183 |
+
#media-input {
|
184 |
+
display: none;
|
185 |
+
}
|
186 |
+
|
187 |
+
#media-preview {
|
188 |
+
margin-top: 15px;
|
189 |
+
}
|
190 |
+
|
191 |
+
#media-preview img,
|
192 |
+
#media-preview video {
|
193 |
+
max-width: 100%;
|
194 |
+
border-radius: 8px;
|
195 |
+
}
|
196 |
+
|
197 |
+
.btn {
|
198 |
+
padding: 8px 20px;
|
199 |
+
border: none;
|
200 |
+
border-radius: 6px;
|
201 |
+
cursor: pointer;
|
202 |
+
font-weight: bold;
|
203 |
+
font-size: 14px;
|
204 |
+
}
|
205 |
+
|
206 |
+
.btn-primary {
|
207 |
+
background: #1877f2;
|
208 |
+
color: white;
|
209 |
+
}
|
210 |
+
|
211 |
+
.form-actions {
|
212 |
+
display: flex;
|
213 |
+
justify-content: flex-end;
|
214 |
+
margin-top: 15px;
|
215 |
+
}
|
216 |
+
</style>
|
217 |
+
|
218 |
+
<script>
|
219 |
+
document.addEventListener('DOMContentLoaded', function() {
|
220 |
+
const form = document.querySelector('.post-form');
|
221 |
+
const typeButtons = document.querySelectorAll('.type-btn');
|
222 |
+
const textSection = document.querySelector('.text-post-section');
|
223 |
+
const mediaSection = document.querySelector('.media-post-section');
|
224 |
+
const colorButtons = document.querySelectorAll('.color-btn');
|
225 |
+
const backgroundColorInput = document.getElementById('background_color');
|
226 |
+
const mediaInput = document.getElementById('media-input');
|
227 |
+
const mediaPreview = document.getElementById('media-preview');
|
228 |
+
const contentTextarea = document.querySelector('textarea[name="content"]');
|
229 |
+
|
230 |
+
// Post Type Selection
|
231 |
+
typeButtons.forEach(btn => {
|
232 |
+
btn.addEventListener('click', () => {
|
233 |
+
typeButtons.forEach(b => b.classList.remove('active'));
|
234 |
+
btn.classList.add('active');
|
235 |
+
|
236 |
+
if (btn.dataset.type === 'text') {
|
237 |
+
textSection.style.display = 'block';
|
238 |
+
mediaSection.style.display = 'none';
|
239 |
+
} else {
|
240 |
+
textSection.style.display = 'none';
|
241 |
+
mediaSection.style.display = 'block';
|
242 |
+
}
|
243 |
+
});
|
244 |
+
});
|
245 |
+
|
246 |
+
// Background Color Selection
|
247 |
+
colorButtons.forEach(btn => {
|
248 |
+
btn.addEventListener('click', () => {
|
249 |
+
colorButtons.forEach(b => b.classList.remove('active'));
|
250 |
+
btn.classList.add('active');
|
251 |
+
const color = btn.dataset.color;
|
252 |
+
backgroundColorInput.value = color;
|
253 |
+
contentTextarea.style.backgroundColor = color;
|
254 |
+
});
|
255 |
+
});
|
256 |
+
|
257 |
+
// Media Preview
|
258 |
+
mediaInput.addEventListener('change', function() {
|
259 |
+
const file = this.files[0];
|
260 |
+
if (file) {
|
261 |
+
const reader = new FileReader();
|
262 |
+
reader.onload = function(e) {
|
263 |
+
mediaPreview.innerHTML = '';
|
264 |
+
if (file.type.startsWith('image/')) {
|
265 |
+
const img = document.createElement('img');
|
266 |
+
img.src = e.target.result;
|
267 |
+
mediaPreview.appendChild(img);
|
268 |
+
} else if (file.type.startsWith('video/')) {
|
269 |
+
const video = document.createElement('video');
|
270 |
+
video.src = e.target.result;
|
271 |
+
video.controls = true;
|
272 |
+
mediaPreview.appendChild(video);
|
273 |
+
}
|
274 |
+
};
|
275 |
+
reader.readAsDataURL(file);
|
276 |
+
}
|
277 |
+
});
|
278 |
+
|
279 |
+
// Form Submission
|
280 |
+
form.addEventListener('submit', function(e) {
|
281 |
+
const activeType = document.querySelector('.type-btn.active').dataset.type;
|
282 |
+
if (activeType === 'media') {
|
283 |
+
const mediaContent = document.querySelector('textarea[name="media_content"]').value;
|
284 |
+
document.querySelector('textarea[name="content"]').value = mediaContent;
|
285 |
+
}
|
286 |
+
|
287 |
+
// Add line breaks for text content
|
288 |
+
const contentTextarea = document.querySelector('textarea[name="content"]');
|
289 |
+
contentTextarea.value = contentTextarea.value.replace(/\n/g, '\n');
|
290 |
+
});
|
291 |
+
});
|
292 |
+
</script>
|
293 |
+
{% endblock %}
|
templates/create_post_iframe.html
ADDED
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="ar">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>إنشاء منشور جديد</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
8 |
+
<style>
|
9 |
+
body {
|
10 |
+
margin: 0;
|
11 |
+
padding: 20px;
|
12 |
+
font-family: 'Arial', sans-serif;
|
13 |
+
background-color: #fff;
|
14 |
+
direction: rtl;
|
15 |
+
}
|
16 |
+
|
17 |
+
.post-form {
|
18 |
+
max-width: 100%;
|
19 |
+
}
|
20 |
+
|
21 |
+
.user-info {
|
22 |
+
display: flex;
|
23 |
+
align-items: center;
|
24 |
+
margin-bottom: 20px;
|
25 |
+
}
|
26 |
+
|
27 |
+
.profile-circle {
|
28 |
+
width: 40px;
|
29 |
+
height: 40px;
|
30 |
+
border-radius: 50%;
|
31 |
+
overflow: hidden;
|
32 |
+
margin-left: 10px;
|
33 |
+
}
|
34 |
+
|
35 |
+
.profile-circle img {
|
36 |
+
width: 100%;
|
37 |
+
height: 100%;
|
38 |
+
object-fit: cover;
|
39 |
+
}
|
40 |
+
|
41 |
+
.username {
|
42 |
+
font-weight: bold;
|
43 |
+
color: #1a1a1a;
|
44 |
+
}
|
45 |
+
|
46 |
+
.form-group {
|
47 |
+
margin-bottom: 15px;
|
48 |
+
}
|
49 |
+
|
50 |
+
input[type="text"],
|
51 |
+
textarea {
|
52 |
+
width: 100%;
|
53 |
+
padding: 12px;
|
54 |
+
border: 1px solid #ddd;
|
55 |
+
border-radius: 8px;
|
56 |
+
box-sizing: border-box;
|
57 |
+
font-size: 16px;
|
58 |
+
direction: rtl;
|
59 |
+
}
|
60 |
+
|
61 |
+
textarea {
|
62 |
+
min-height: 150px;
|
63 |
+
resize: vertical;
|
64 |
+
}
|
65 |
+
|
66 |
+
.media-upload {
|
67 |
+
display: flex;
|
68 |
+
gap: 10px;
|
69 |
+
margin-top: 20px;
|
70 |
+
padding: 15px;
|
71 |
+
border-top: 1px solid #ddd;
|
72 |
+
}
|
73 |
+
|
74 |
+
.upload-btn {
|
75 |
+
display: flex;
|
76 |
+
align-items: center;
|
77 |
+
gap: 8px;
|
78 |
+
padding: 8px 16px;
|
79 |
+
border: none;
|
80 |
+
border-radius: 20px;
|
81 |
+
background-color: #f0f2f5;
|
82 |
+
color: #1a1a1a;
|
83 |
+
cursor: pointer;
|
84 |
+
font-size: 14px;
|
85 |
+
transition: background-color 0.2s;
|
86 |
+
}
|
87 |
+
|
88 |
+
.upload-btn:hover {
|
89 |
+
background-color: #e4e6eb;
|
90 |
+
}
|
91 |
+
|
92 |
+
.submit-btn {
|
93 |
+
width: 100%;
|
94 |
+
padding: 12px;
|
95 |
+
background-color: #4CAF50;
|
96 |
+
color: white;
|
97 |
+
border: none;
|
98 |
+
border-radius: 8px;
|
99 |
+
font-size: 16px;
|
100 |
+
cursor: pointer;
|
101 |
+
transition: background-color 0.2s;
|
102 |
+
margin-top: 20px;
|
103 |
+
}
|
104 |
+
|
105 |
+
.submit-btn:hover {
|
106 |
+
background-color: #45a049;
|
107 |
+
}
|
108 |
+
|
109 |
+
.submit-btn:disabled {
|
110 |
+
background-color: #cccccc;
|
111 |
+
cursor: not-allowed;
|
112 |
+
}
|
113 |
+
|
114 |
+
#preview {
|
115 |
+
margin-top: 15px;
|
116 |
+
max-width: 100%;
|
117 |
+
border-radius: 8px;
|
118 |
+
display: none;
|
119 |
+
}
|
120 |
+
|
121 |
+
#preview img,
|
122 |
+
#preview video {
|
123 |
+
max-width: 100%;
|
124 |
+
border-radius: 8px;
|
125 |
+
}
|
126 |
+
|
127 |
+
.preview-container {
|
128 |
+
position: relative;
|
129 |
+
display: inline-block;
|
130 |
+
margin-top: 15px;
|
131 |
+
width: 100%;
|
132 |
+
}
|
133 |
+
|
134 |
+
.remove-preview {
|
135 |
+
position: absolute;
|
136 |
+
top: 10px;
|
137 |
+
right: 10px;
|
138 |
+
background: rgba(0, 0, 0, 0.5);
|
139 |
+
color: white;
|
140 |
+
border: none;
|
141 |
+
border-radius: 50%;
|
142 |
+
width: 30px;
|
143 |
+
height: 30px;
|
144 |
+
cursor: pointer;
|
145 |
+
display: flex;
|
146 |
+
align-items: center;
|
147 |
+
justify-content: center;
|
148 |
+
font-size: 18px;
|
149 |
+
}
|
150 |
+
|
151 |
+
.remove-preview:hover {
|
152 |
+
background: rgba(0, 0, 0, 0.7);
|
153 |
+
}
|
154 |
+
|
155 |
+
.media-preview {
|
156 |
+
width: 100%;
|
157 |
+
border-radius: 8px;
|
158 |
+
overflow: hidden;
|
159 |
+
background: #f0f2f5;
|
160 |
+
margin-top: 15px;
|
161 |
+
display: none;
|
162 |
+
}
|
163 |
+
|
164 |
+
.media-preview img {
|
165 |
+
width: 100%;
|
166 |
+
display: block;
|
167 |
+
}
|
168 |
+
|
169 |
+
.media-preview video {
|
170 |
+
width: 100%;
|
171 |
+
display: block;
|
172 |
+
}
|
173 |
+
</style>
|
174 |
+
</head>
|
175 |
+
<body>
|
176 |
+
<form class="post-form" method="POST" enctype="multipart/form-data">
|
177 |
+
<div class="user-info">
|
178 |
+
<div class="profile-circle">
|
179 |
+
<img src="{{ url_for('static', filename='uploads/default-avatar.jpg') }}" alt="صورة الملف الشخصي">
|
180 |
+
</div>
|
181 |
+
<span class="username">{{ current_user.username }}</span>
|
182 |
+
</div>
|
183 |
+
|
184 |
+
<div class="form-group">
|
185 |
+
<input type="text" name="title" placeholder="عنوان المنشور" required>
|
186 |
+
</div>
|
187 |
+
|
188 |
+
<div class="form-group">
|
189 |
+
<textarea name="content" placeholder="ماذا يدور في ذهنك؟" required></textarea>
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<div class="media-preview" id="mediaPreview"></div>
|
193 |
+
|
194 |
+
<div class="media-upload">
|
195 |
+
<input type="file" id="imageInput" name="media" accept="image/*" style="display: none">
|
196 |
+
<button type="button" class="upload-btn" onclick="document.getElementById('imageInput').click()">
|
197 |
+
<i class="fas fa-image"></i>
|
198 |
+
صورة
|
199 |
+
</button>
|
200 |
+
|
201 |
+
<input type="file" id="videoInput" name="media" accept="video/*" style="display: none">
|
202 |
+
<button type="button" class="upload-btn" onclick="document.getElementById('videoInput').click()">
|
203 |
+
<i class="fas fa-video"></i>
|
204 |
+
فيديو
|
205 |
+
</button>
|
206 |
+
</div>
|
207 |
+
|
208 |
+
<button type="submit" class="submit-btn">نشر</button>
|
209 |
+
</form>
|
210 |
+
|
211 |
+
<script>
|
212 |
+
const imageInput = document.getElementById('imageInput');
|
213 |
+
const videoInput = document.getElementById('videoInput');
|
214 |
+
const mediaPreview = document.getElementById('mediaPreview');
|
215 |
+
let currentFile = null;
|
216 |
+
|
217 |
+
function showPreview(file, type) {
|
218 |
+
if (currentFile) {
|
219 |
+
URL.revokeObjectURL(currentFile);
|
220 |
+
}
|
221 |
+
|
222 |
+
const previewUrl = URL.createObjectURL(file);
|
223 |
+
currentFile = previewUrl;
|
224 |
+
|
225 |
+
mediaPreview.innerHTML = `
|
226 |
+
<div class="preview-container">
|
227 |
+
${type === 'image'
|
228 |
+
? `<img src="${previewUrl}" alt="معاينة">`
|
229 |
+
: `<video src="${previewUrl}" controls></video>`
|
230 |
+
}
|
231 |
+
<button type="button" class="remove-preview" onclick="removePreview()">×</button>
|
232 |
+
</div>
|
233 |
+
`;
|
234 |
+
mediaPreview.style.display = 'block';
|
235 |
+
}
|
236 |
+
|
237 |
+
function removePreview() {
|
238 |
+
if (currentFile) {
|
239 |
+
URL.revokeObjectURL(currentFile);
|
240 |
+
currentFile = null;
|
241 |
+
}
|
242 |
+
mediaPreview.innerHTML = '';
|
243 |
+
mediaPreview.style.display = 'none';
|
244 |
+
imageInput.value = '';
|
245 |
+
videoInput.value = '';
|
246 |
+
}
|
247 |
+
|
248 |
+
imageInput.addEventListener('change', (e) => {
|
249 |
+
if (e.target.files[0]) {
|
250 |
+
showPreview(e.target.files[0], 'image');
|
251 |
+
videoInput.value = '';
|
252 |
+
}
|
253 |
+
});
|
254 |
+
|
255 |
+
videoInput.addEventListener('change', (e) => {
|
256 |
+
if (e.target.files[0]) {
|
257 |
+
showPreview(e.target.files[0], 'video');
|
258 |
+
imageInput.value = '';
|
259 |
+
}
|
260 |
+
});
|
261 |
+
</script>
|
262 |
+
</body>
|
263 |
+
</html>
|
templates/dashboard.html
ADDED
@@ -0,0 +1,2997 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="ar">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
+
<title>لوحة التحكم</title>
|
7 |
+
|
8 |
+
<!-- استدعاء مكتبة Font Awesome -->
|
9 |
+
<link
|
10 |
+
rel="stylesheet"
|
11 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
|
12 |
+
/>
|
13 |
+
<!-- استدعاء مكتبة jQuery -->
|
14 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
15 |
+
|
16 |
+
<style>
|
17 |
+
/* إعدادات عامة للجوال */
|
18 |
+
body {
|
19 |
+
margin: 0;
|
20 |
+
padding: 0;
|
21 |
+
font-family: "Arial", sans-serif;
|
22 |
+
background-color: #f0f2f5;
|
23 |
+
}
|
24 |
+
|
25 |
+
.top-bar {
|
26 |
+
display: flex;
|
27 |
+
justify-content: space-between;
|
28 |
+
align-items: center;
|
29 |
+
background-color: #4caf50;
|
30 |
+
padding: 15px;
|
31 |
+
position: fixed;
|
32 |
+
top: 0;
|
33 |
+
left: 0;
|
34 |
+
width: 100%;
|
35 |
+
z-index: 100;
|
36 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
37 |
+
height: 50px;
|
38 |
+
padding: 10px 20px;
|
39 |
+
}
|
40 |
+
|
41 |
+
/* الدائرة */
|
42 |
+
.profile-circle {
|
43 |
+
position: relative;
|
44 |
+
display: inline-block;
|
45 |
+
cursor: pointer;
|
46 |
+
width: 40px;
|
47 |
+
height: 40px;
|
48 |
+
}
|
49 |
+
.profile-circle img {
|
50 |
+
object-fit: cover;
|
51 |
+
}
|
52 |
+
#profileCircle img {
|
53 |
+
border-radius: 50%;
|
54 |
+
}
|
55 |
+
|
56 |
+
/* الدائرة */
|
57 |
+
.profile-circle {
|
58 |
+
position: relative;
|
59 |
+
display: inline-block;
|
60 |
+
cursor: pointer;
|
61 |
+
|
62 |
+
border-radius: 50%;
|
63 |
+
flex-shrink: 0;
|
64 |
+
}
|
65 |
+
.profile-circle img {
|
66 |
+
width: 100%;
|
67 |
+
height: 100%;
|
68 |
+
border-radius: 50%;
|
69 |
+
}
|
70 |
+
#profileCircle {
|
71 |
+
margin-right: 27px;
|
72 |
+
}
|
73 |
+
|
74 |
+
/* القائمة المنسدلة */
|
75 |
+
.dropdown-menu {
|
76 |
+
display: none; /* إخفاء القائمة بشكل افتراضي */
|
77 |
+
position: absolute;
|
78 |
+
top: 48px;
|
79 |
+
right: -8px;
|
80 |
+
background-color: #fff;
|
81 |
+
border-radius: 8px;
|
82 |
+
box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2),
|
83 |
+
0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
84 |
+
z-index: 1100;
|
85 |
+
min-width: 220px;
|
86 |
+
box-sizing: border-box;
|
87 |
+
overflow: hidden;
|
88 |
+
padding: 8px 0;
|
89 |
+
}
|
90 |
+
|
91 |
+
/* السهم الذي يشير إلى القائمة */
|
92 |
+
.dropdown-menu::before {
|
93 |
+
content: "";
|
94 |
+
position: absolute;
|
95 |
+
top: -8px;
|
96 |
+
right: 20px;
|
97 |
+
width: 16px;
|
98 |
+
height: 16px;
|
99 |
+
background: #fff;
|
100 |
+
transform: rotate(45deg);
|
101 |
+
box-shadow: -2px -2px 3px rgba(0, 0, 0, 0.08);
|
102 |
+
}
|
103 |
+
|
104 |
+
/* تصميم الروابط داخل القائمة */
|
105 |
+
.dropdown-menu a {
|
106 |
+
display: block;
|
107 |
+
padding: 12px 16px;
|
108 |
+
text-decoration: none;
|
109 |
+
color: #050505;
|
110 |
+
font-size: 15px;
|
111 |
+
text-align: right;
|
112 |
+
font-weight: 500;
|
113 |
+
transition: background-color 0.2s ease;
|
114 |
+
}
|
115 |
+
|
116 |
+
/* تأثير التمرير على الروابط */
|
117 |
+
.dropdown-menu a:hover {
|
118 |
+
background-color: #f2f2f2;
|
119 |
+
}
|
120 |
+
|
121 |
+
/* فاصل بين العناصر */
|
122 |
+
.dropdown-menu a:not(:last-child) {
|
123 |
+
border-bottom: 1px solid #e4e6eb;
|
124 |
+
}
|
125 |
+
|
126 |
+
/* نافذة عرض بيانات الحساب */
|
127 |
+
.fullscreen-container {
|
128 |
+
display: none; /* إخفاء النافذة بشكل افتراضي */
|
129 |
+
position: fixed;
|
130 |
+
top: 0;
|
131 |
+
left: 0;
|
132 |
+
right: 0;
|
133 |
+
bottom: 0;
|
134 |
+
background: rgba(0, 0, 0, 0.6); /* خلفية مظللة */
|
135 |
+
z-index: 1200;
|
136 |
+
padding: 50px;
|
137 |
+
background-color: #fff;
|
138 |
+
}
|
139 |
+
|
140 |
+
.content {
|
141 |
+
background: #fff;
|
142 |
+
padding: 20px;
|
143 |
+
border-radius: 8px;
|
144 |
+
max-width: 600px;
|
145 |
+
margin: auto;
|
146 |
+
}
|
147 |
+
|
148 |
+
.close-btn {
|
149 |
+
position: absolute;
|
150 |
+
top: 10px;
|
151 |
+
right: 10px;
|
152 |
+
font-size: 30px;
|
153 |
+
cursor: pointer;
|
154 |
+
}
|
155 |
+
|
156 |
+
.fullscreen-container h2 {
|
157 |
+
text-align: center;
|
158 |
+
margin-bottom: 20px;
|
159 |
+
}
|
160 |
+
|
161 |
+
.fullscreen-container p,
|
162 |
+
.fullscreen-container ul {
|
163 |
+
margin: 10px 0;
|
164 |
+
line-height: 1.6;
|
165 |
+
}
|
166 |
+
</style>
|
167 |
+
</head>
|
168 |
+
|
169 |
+
<body>
|
170 |
+
|
171 |
+
|
172 |
+
<div class="top-bar">
|
173 |
+
<!-- زر إنشاء منشور جديد -->
|
174 |
+
<button class="create-post-btn" id="createPostBtn">
|
175 |
+
<i class="fas fa-plus"></i> إنشاء منشور
|
176 |
+
</button>
|
177 |
+
<button class="chat-button">💬</button>
|
178 |
+
|
179 |
+
<div id="notifications">
|
180 |
+
<button id="notification-btn">
|
181 |
+
<span id="notification-count">0</span>
|
182 |
+
</button>
|
183 |
+
<a href="#" style="text-decoration: none;">
|
184 |
+
<button id="artical-open-btn">AI</button>
|
185 |
+
</a>
|
186 |
+
|
187 |
+
<!-- <a href="/videos" style="text-decoration: none;"> -->
|
188 |
+
<button class="video_page" >V</button>
|
189 |
+
<!-- </a> -->
|
190 |
+
<div id="notification-list">
|
191 |
+
<!-- الإشعارات ستظهر هنا -->
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
<button class="search-btn" id="openSearchModalBtn">بحث عن مستخدم</button>
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
<!-- زر فتح نافذة الشات -->
|
199 |
+
|
200 |
+
<!-- نافذة الشات -->
|
201 |
+
<div class="chat-window" id="chatWindow" style="display: none;">
|
202 |
+
<div class="chat-header">المحادثات <button class="close-main-chat">Close</button></div>
|
203 |
+
<div id="chatList" class="chat-list">
|
204 |
+
<!-- قائمة المستخدمين سيتم تعبئتها ديناميكيًا هنا -->
|
205 |
+
</div>
|
206 |
+
</div>
|
207 |
+
|
208 |
+
|
209 |
+
<!-- Container للـ iframe -->
|
210 |
+
<div id="artical-iframe-container">
|
211 |
+
<button id="artical-close-btn">إغلاق</button>
|
212 |
+
<iframe id="artical-iframe" src=""></iframe>
|
213 |
+
</div>
|
214 |
+
|
215 |
+
<!-- دائرة الملف الشخصي -->
|
216 |
+
<div class="profile-circle" id="profileCircle">
|
217 |
+
<img
|
218 |
+
src="{{ url_for('static', filename=current_user.profile_photo) }}"
|
219 |
+
alt="صورة الملف الشخصي"
|
220 |
+
/>
|
221 |
+
<div class="dropdown-menu" id="dropdownMenu">
|
222 |
+
<a href="{{ url_for('profile') }}" id="profile-link">الملف الشخصي</a>
|
223 |
+
<a href="{{ url_for('logout') }}">تسجيل الخروج</a>
|
224 |
+
</div>
|
225 |
+
</div>
|
226 |
+
</div>
|
227 |
+
|
228 |
+
|
229 |
+
<!-- حاوية الملف الشخصي -->
|
230 |
+
<div id="profile-container">
|
231 |
+
<div id="profile-header">
|
232 |
+
<button id="close-profile-btn">✕</button>
|
233 |
+
</div>
|
234 |
+
<iframe id="profile-iframe"></iframe>
|
235 |
+
</div>
|
236 |
+
<!-- موديل البحث -->
|
237 |
+
<div class="modal-search" id="searchModal">
|
238 |
+
<div class="modal-search-content">
|
239 |
+
<span class="close-search-modal" id="closeSearchModalBtn">×</span>
|
240 |
+
<input type="text" class="search-input" id="searchInput" placeholder="ابحث عن مستخدم..." onkeyup="searchUsers()" />
|
241 |
+
<div class="search-results" id="searchResults"></div>
|
242 |
+
</div>
|
243 |
+
</div>
|
244 |
+
|
245 |
+
<button id="closeChatFrame">إغلاق</button>
|
246 |
+
<iframe id="chatFrame" src="">
|
247 |
+
</iframe>
|
248 |
+
|
249 |
+
<script>
|
250 |
+
document.addEventListener("DOMContentLoaded", function () {
|
251 |
+
const profileCircle = document.getElementById("profileCircle");
|
252 |
+
const dropdownMenu = document.getElementById("dropdownMenu");
|
253 |
+
|
254 |
+
// دالة لتبديل عرض القائمة المنسدلة
|
255 |
+
function toggleDropdown(e) {
|
256 |
+
e.stopPropagation(); // منع الحدث من الانتقال إلى العناصر الأخرى
|
257 |
+
|
258 |
+
// إذا كانت القائمة مخفية، فإظهارها
|
259 |
+
if (
|
260 |
+
dropdownMenu.style.display === "none" ||
|
261 |
+
dropdownMenu.style.display === ""
|
262 |
+
) {
|
263 |
+
dropdownMenu.style.display = "block";
|
264 |
+
} else {
|
265 |
+
// إذا كانت القائمة ظاهرة، فإخفاؤها
|
266 |
+
dropdownMenu.style.display = "none";
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
// إضافة حدث عند النقر على دائرة الملف الشخصي
|
271 |
+
profileCircle.addEventListener("click", toggleDropdown);
|
272 |
+
|
273 |
+
// إغلاق القائمة عند النقر في أي مكان آخر
|
274 |
+
document.addEventListener("click", (e) => {
|
275 |
+
if (
|
276 |
+
!profileCircle.contains(e.target) &&
|
277 |
+
dropdownMenu.style.display === "block"
|
278 |
+
) {
|
279 |
+
dropdownMenu.style.display = "none"; // إخفاء القائمة
|
280 |
+
}
|
281 |
+
});
|
282 |
+
|
283 |
+
// منع إغلاق القائمة عند النقر داخلها
|
284 |
+
dropdownMenu.addEventListener("click", (e) => {
|
285 |
+
e.stopPropagation(); // منع الحدث من الانتقال إلى العناصر الأخرى
|
286 |
+
});
|
287 |
+
});
|
288 |
+
</script>
|
289 |
+
|
290 |
+
<!-- إطار إنشاء المنشور -->
|
291 |
+
<div class="post-modal" id="postModal">
|
292 |
+
<div class="modal-overlay"></div>
|
293 |
+
<div class="modal-content">
|
294 |
+
<div class="modal-header">
|
295 |
+
<span class="close-modal">×</span>
|
296 |
+
<h3>إنشاء منشور جديد</h3>
|
297 |
+
</div>
|
298 |
+
<iframe src="{{ url_for('create_post') }}" frameborder="0"></iframe>
|
299 |
+
</div>
|
300 |
+
</div>
|
301 |
+
|
302 |
+
<!-- Comments Fixed Container -->
|
303 |
+
<div class="comments-overlay" id="commentsOverlay"></div>
|
304 |
+
<div class="comments-fixed-container" id="commentsFixedContainer">
|
305 |
+
<div class="comments-content">
|
306 |
+
<div class="comments-header">
|
307 |
+
<h3>التعليقات</h3>
|
308 |
+
<span class="close-comments">×</span>
|
309 |
+
</div>
|
310 |
+
<div class="comments-list-container">
|
311 |
+
<div class="comments-list"></div>
|
312 |
+
</div>
|
313 |
+
<div class="comment-input-container">
|
314 |
+
<textarea
|
315 |
+
class="comment-input"
|
316 |
+
placeholder="اكتب تعليقك ��نا..."
|
317 |
+
rows="1"
|
318 |
+
></textarea>
|
319 |
+
<button class="send-comment-btn">
|
320 |
+
<i class="fas fa-paper-plane"></i>
|
321 |
+
</button>
|
322 |
+
</div>
|
323 |
+
</div>
|
324 |
+
</div>
|
325 |
+
|
326 |
+
<div class="reply-overlay" id="replyOverlay"></div>
|
327 |
+
<div class="reply-fixed-container" id="replyFixedContainer">
|
328 |
+
<div class="reply-content">
|
329 |
+
<div class="reply-header">
|
330 |
+
<h3>الرد</h3>
|
331 |
+
<span class="close-reply">×</span>
|
332 |
+
</div>
|
333 |
+
<div class="reply-input-container">
|
334 |
+
<textarea
|
335 |
+
class="reply-input"
|
336 |
+
placeholder="اكتب ردك هنا..."
|
337 |
+
rows="1"
|
338 |
+
></textarea>
|
339 |
+
<button class="send-reply-btn">
|
340 |
+
<i class="fas fa-paper-plane"></i>
|
341 |
+
</button>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
|
346 |
+
|
347 |
+
<style>
|
348 |
+
/* Comments Fixed Container Styles */
|
349 |
+
/* Comments Fixed Container Styles */
|
350 |
+
.comments-overlay {
|
351 |
+
display: none;
|
352 |
+
position: fixed;
|
353 |
+
top: 0;
|
354 |
+
left: 0;
|
355 |
+
right: 0;
|
356 |
+
bottom: 0;
|
357 |
+
background-color: rgba(0, 0, 0, 0.5);
|
358 |
+
z-index: 1999;
|
359 |
+
}
|
360 |
+
|
361 |
+
.comments-fixed-container {
|
362 |
+
display: none;
|
363 |
+
position: fixed;
|
364 |
+
bottom: 0;
|
365 |
+
left: 0;
|
366 |
+
right: 0;
|
367 |
+
height: 80%;
|
368 |
+
background: white;
|
369 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
370 |
+
z-index: 2000;
|
371 |
+
transform: translateY(100%);
|
372 |
+
transition: transform 0.3s ease-out;
|
373 |
+
}
|
374 |
+
|
375 |
+
.comments-fixed-container.active {
|
376 |
+
transform: translateY(0);
|
377 |
+
}
|
378 |
+
|
379 |
+
.comments-content {
|
380 |
+
height: 100%;
|
381 |
+
display: flex;
|
382 |
+
flex-direction: column;
|
383 |
+
}
|
384 |
+
|
385 |
+
.comments-header {
|
386 |
+
padding: 16px;
|
387 |
+
border-bottom: 1px solid #ddd;
|
388 |
+
display: flex;
|
389 |
+
justify-content: space-between;
|
390 |
+
align-items: center;
|
391 |
+
}
|
392 |
+
|
393 |
+
.comments-header h3 {
|
394 |
+
margin: 0;
|
395 |
+
text-align: center;
|
396 |
+
flex-grow: 1;
|
397 |
+
}
|
398 |
+
|
399 |
+
.close-comments {
|
400 |
+
font-size: 24px;
|
401 |
+
cursor: pointer;
|
402 |
+
color: #666;
|
403 |
+
padding: 8px;
|
404 |
+
}
|
405 |
+
|
406 |
+
.comments-list-container {
|
407 |
+
flex-grow: 1;
|
408 |
+
overflow-y: auto;
|
409 |
+
padding: 16px;
|
410 |
+
}
|
411 |
+
|
412 |
+
.comments-container {
|
413 |
+
flex-grow: 1;
|
414 |
+
overflow-y: auto;
|
415 |
+
padding: 16px;
|
416 |
+
}
|
417 |
+
|
418 |
+
.comment-input-container {
|
419 |
+
padding: 12px;
|
420 |
+
border-top: 1px solid #ddd;
|
421 |
+
background: white;
|
422 |
+
display: flex;
|
423 |
+
gap: 8px;
|
424 |
+
align-items: flex-start;
|
425 |
+
}
|
426 |
+
|
427 |
+
.comment-input {
|
428 |
+
flex: 1;
|
429 |
+
padding: 12px;
|
430 |
+
border: 1px solid #ddd;
|
431 |
+
border-radius: 20px;
|
432 |
+
resize: none;
|
433 |
+
font-size: 14px;
|
434 |
+
direction: rtl;
|
435 |
+
}
|
436 |
+
|
437 |
+
.send-comment-btn {
|
438 |
+
background: #4caf50;
|
439 |
+
color: white;
|
440 |
+
border: none;
|
441 |
+
width: 36px;
|
442 |
+
height: 36px;
|
443 |
+
border-radius: 50%;
|
444 |
+
display: flex;
|
445 |
+
align-items: center;
|
446 |
+
justify-content: center;
|
447 |
+
cursor: pointer;
|
448 |
+
}
|
449 |
+
|
450 |
+
.send-comment-btn:hover {
|
451 |
+
background: #45a049;
|
452 |
+
}
|
453 |
+
|
454 |
+
.comments-list {
|
455 |
+
display: flex;
|
456 |
+
flex-direction: column;
|
457 |
+
gap: 12px;
|
458 |
+
direction: rtl;
|
459 |
+
}
|
460 |
+
|
461 |
+
.comment-item {
|
462 |
+
display: flex;
|
463 |
+
gap: 8px;
|
464 |
+
margin-bottom: 12px;
|
465 |
+
align-items: flex-start;
|
466 |
+
padding: 0 8px;
|
467 |
+
}
|
468 |
+
|
469 |
+
.comment-user-avatar {
|
470 |
+
width: 45px;
|
471 |
+
height: 45px;
|
472 |
+
flex-shrink: 0;
|
473 |
+
margin-left: 8px;
|
474 |
+
}
|
475 |
+
|
476 |
+
.comment-user-avatar img {
|
477 |
+
width: 100%;
|
478 |
+
height: 100%;
|
479 |
+
border-radius: 50%;
|
480 |
+
object-fit: cover;
|
481 |
+
}
|
482 |
+
|
483 |
+
.comment-bubble {
|
484 |
+
background: #f0f2f5;
|
485 |
+
border-radius: 18px;
|
486 |
+
padding: 8px 12px;
|
487 |
+
flex-grow: 1;
|
488 |
+
}
|
489 |
+
|
490 |
+
.comment-header {
|
491 |
+
margin-bottom: 4px;
|
492 |
+
}
|
493 |
+
|
494 |
+
.comment-username {
|
495 |
+
font-weight: 600;
|
496 |
+
color: #050505;
|
497 |
+
font-size: 13px;
|
498 |
+
}
|
499 |
+
|
500 |
+
.comment-content {
|
501 |
+
color: #050505;
|
502 |
+
font-size: 14px;
|
503 |
+
line-height: 1.4;
|
504 |
+
word-wrap: break-word;
|
505 |
+
}
|
506 |
+
|
507 |
+
.comment-time {
|
508 |
+
font-size: 11px;
|
509 |
+
color: #65676b;
|
510 |
+
margin-top: 4px;
|
511 |
+
}
|
512 |
+
|
513 |
+
.nested-comments {
|
514 |
+
margin-left: 20px;
|
515 |
+
}
|
516 |
+
|
517 |
+
.reply-input-container {
|
518 |
+
margin-top: 10px;
|
519 |
+
}
|
520 |
+
|
521 |
+
.reply-text {
|
522 |
+
width: 100%;
|
523 |
+
padding: 12px;
|
524 |
+
border: 1px solid #ddd;
|
525 |
+
border-radius: 20px;
|
526 |
+
resize: none;
|
527 |
+
font-size: 14px;
|
528 |
+
direction: rtl;
|
529 |
+
}
|
530 |
+
|
531 |
+
.send-reply-btn {
|
532 |
+
margin-top: 5px;
|
533 |
+
color: white;
|
534 |
+
background-color: blue;
|
535 |
+
border: none;
|
536 |
+
padding: 5px 10px;
|
537 |
+
cursor: pointer;
|
538 |
+
}
|
539 |
+
|
540 |
+
/* Reply Modal Styles */
|
541 |
+
.reply-overlay {
|
542 |
+
display: none;
|
543 |
+
position: fixed;
|
544 |
+
top: 0;
|
545 |
+
left: 0;
|
546 |
+
right: 0;
|
547 |
+
bottom: 0;
|
548 |
+
background-color: rgba(0, 0, 0, 0.5);
|
549 |
+
z-index: 2001;
|
550 |
+
}
|
551 |
+
|
552 |
+
.reply-fixed-container {
|
553 |
+
display: none;
|
554 |
+
position: fixed;
|
555 |
+
bottom: 0;
|
556 |
+
left: 0;
|
557 |
+
right: 0;
|
558 |
+
height: 30%;
|
559 |
+
background: white;
|
560 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
561 |
+
z-index: 2002;
|
562 |
+
transform: translateY(100%);
|
563 |
+
transition: transform 0.3s ease-out;
|
564 |
+
}
|
565 |
+
|
566 |
+
.reply-fixed-container.active {
|
567 |
+
transform: translateY(0);
|
568 |
+
}
|
569 |
+
|
570 |
+
.reply-content {
|
571 |
+
height: 100%;
|
572 |
+
display: flex;
|
573 |
+
flex-direction: column;
|
574 |
+
}
|
575 |
+
|
576 |
+
.reply-header {
|
577 |
+
padding: 16px;
|
578 |
+
border-bottom: 1px solid #ddd;
|
579 |
+
display: flex;
|
580 |
+
justify-content: space-between;
|
581 |
+
align-items: center;
|
582 |
+
}
|
583 |
+
|
584 |
+
.reply-header h3 {
|
585 |
+
margin: 0;
|
586 |
+
text-align: center;
|
587 |
+
flex-grow: 1;
|
588 |
+
}
|
589 |
+
|
590 |
+
.close-reply {
|
591 |
+
font-size: 24px;
|
592 |
+
cursor: pointer;
|
593 |
+
color: #666;
|
594 |
+
padding: 8px;
|
595 |
+
}
|
596 |
+
|
597 |
+
.reply-input-container {
|
598 |
+
padding: 12px;
|
599 |
+
border-top: 1px solid #ddd;
|
600 |
+
background: white;
|
601 |
+
display: flex;
|
602 |
+
gap: 8px;
|
603 |
+
align-items: flex-start;
|
604 |
+
}
|
605 |
+
|
606 |
+
.reply-input {
|
607 |
+
flex: 1;
|
608 |
+
padding: 12px;
|
609 |
+
border: 1px solid #ddd;
|
610 |
+
border-radius: 20px;
|
611 |
+
resize: none;
|
612 |
+
font-size: 14px;
|
613 |
+
direction: rtl;
|
614 |
+
}
|
615 |
+
|
616 |
+
.send-reply-btn {
|
617 |
+
background: #4caf50;
|
618 |
+
color: white;
|
619 |
+
border: none;
|
620 |
+
width: 36px;
|
621 |
+
height: 36px;
|
622 |
+
border-radius: 50%;
|
623 |
+
display: flex;
|
624 |
+
align-items: center;
|
625 |
+
justify-content: center;
|
626 |
+
cursor: pointer;
|
627 |
+
|
628 |
+
}
|
629 |
+
.reply-btn{
|
630 |
+
color: blue;
|
631 |
+
cursor: pointer;
|
632 |
+
margin-right: 82%;
|
633 |
+
transform: translate(0%, -18px);
|
634 |
+
}
|
635 |
+
|
636 |
+
.send-reply-btn:hover {
|
637 |
+
background: #45a049;
|
638 |
+
}
|
639 |
+
|
640 |
+
/* أزرار جديدة */
|
641 |
+
.create-post-btn {
|
642 |
+
background-color: #fff;
|
643 |
+
color: #4caf50;
|
644 |
+
border: none;
|
645 |
+
padding: 8px 16px;
|
646 |
+
border-radius: 20px;
|
647 |
+
cursor: pointer;
|
648 |
+
font-size: 14px;
|
649 |
+
display: flex;
|
650 |
+
align-items: center;
|
651 |
+
gap: 8px;
|
652 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
653 |
+
}
|
654 |
+
|
655 |
+
.create-post-btn:hover {
|
656 |
+
background-color: #f0f2f5;
|
657 |
+
}
|
658 |
+
|
659 |
+
/* نافذة المنشور */
|
660 |
+
.post-modal {
|
661 |
+
display: none;
|
662 |
+
position: fixed;
|
663 |
+
top: 0;
|
664 |
+
left: 0;
|
665 |
+
width: 100%;
|
666 |
+
height: 100%;
|
667 |
+
z-index: 1000;
|
668 |
+
}
|
669 |
+
|
670 |
+
.modal-overlay {
|
671 |
+
position: absolute;
|
672 |
+
width: 100%;
|
673 |
+
height: 100%;
|
674 |
+
background-color: rgba(0, 0, 0, 0.5);
|
675 |
+
}
|
676 |
+
/*
|
677 |
+
.modal-content {
|
678 |
+
position: relative;
|
679 |
+
width: 90%;
|
680 |
+
max-width: 700px;
|
681 |
+
height: 80%;
|
682 |
+
background: white;
|
683 |
+
margin: 50px auto;
|
684 |
+
border-radius: 8px;
|
685 |
+
overflow: hidden;
|
686 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
687 |
+
} */
|
688 |
+
|
689 |
+
.modal-header {
|
690 |
+
padding: 15px;
|
691 |
+
border-bottom: 1px solid #ddd;
|
692 |
+
display: flex;
|
693 |
+
justify-content: space-between;
|
694 |
+
align-items: center;
|
695 |
+
}
|
696 |
+
|
697 |
+
.close-modal {
|
698 |
+
font-size: 24px;
|
699 |
+
cursor: pointer;
|
700 |
+
color: #666;
|
701 |
+
}
|
702 |
+
|
703 |
+
.modal-content iframe {
|
704 |
+
width: 100%;
|
705 |
+
height: calc(100% - 60px);
|
706 |
+
border: none;
|
707 |
+
}
|
708 |
+
|
709 |
+
.modal-header h3 {
|
710 |
+
margin: 0;
|
711 |
+
text-align: center;
|
712 |
+
flex-grow: 1;
|
713 |
+
}
|
714 |
+
|
715 |
+
/* إعدادات عامة للـ iframe */
|
716 |
+
#chatFrame {
|
717 |
+
position: fixed; /* يجعل الـ iframe في مكان ثابت فوق الصفحة */
|
718 |
+
top: 0;
|
719 |
+
left: 0;
|
720 |
+
width: 100%;
|
721 |
+
height: 100%;
|
722 |
+
background-color: white; /* يمكنك تعديل اللون أو وضع صورة خلفية */
|
723 |
+
border: none; /* إزالة الحدود حول الـ iframe */
|
724 |
+
z-index: 9999; /* تعيين z-index عالٍ لجعل الـ iframe يظهر فوق كل العناصر الأخرى */
|
725 |
+
display: none; /* إخفاء الـ iframe في البداية */
|
726 |
+
}
|
727 |
+
|
728 |
+
/* زر الإغلاق */
|
729 |
+
#closeChatFrame {
|
730 |
+
position: absolute;
|
731 |
+
top: 10px;
|
732 |
+
right: 10px;
|
733 |
+
background-color: red;
|
734 |
+
color: white;
|
735 |
+
padding: 10px;
|
736 |
+
border: none;
|
737 |
+
cursor: pointer;
|
738 |
+
z-index: 10000; /* يجب أن يكون الزر فوق الـ iframe */
|
739 |
+
font-size: 16px;
|
740 |
+
display: none;
|
741 |
+
}
|
742 |
+
|
743 |
+
#closeChatFrame:hover {
|
744 |
+
background-color: darkred;
|
745 |
+
|
746 |
+
}
|
747 |
+
|
748 |
+
</style>
|
749 |
+
|
750 |
+
<script>
|
751 |
+
// إضافة كود جافا سكريبت للنافذة المنبثقة
|
752 |
+
const createPostBtn = document.getElementById("createPostBtn");
|
753 |
+
const postModal = document.getElementById("postModal");
|
754 |
+
const closeModal = document.querySelector(".close-modal");
|
755 |
+
const modalOverlay = document.querySelector(".modal-overlay");
|
756 |
+
|
757 |
+
createPostBtn.addEventListener("click", () => {
|
758 |
+
postModal.style.display = "block";
|
759 |
+
document.body.style.overflow = "hidden"; // منع التمرير في الخلفية
|
760 |
+
});
|
761 |
+
|
762 |
+
function closePostModal() {
|
763 |
+
postModal.style.display = "none";
|
764 |
+
document.body.style.overflow = "auto"; // إعادة تمكين التمرير
|
765 |
+
}
|
766 |
+
|
767 |
+
closeModal.addEventListener("click", closePostModal);
|
768 |
+
modalOverlay.addEventListener("click", closePostModal);
|
769 |
+
</script>
|
770 |
+
|
771 |
+
<!-- عرض المنشورات -->
|
772 |
+
<div class="posts-container">
|
773 |
+
{% for post in posts %}
|
774 |
+
<div class="post-card">
|
775 |
+
<div class="post-header">
|
776 |
+
<div class="profile-circle">
|
777 |
+
<a href="{{ url_for('public_profile', user_email=post.user_email) }}" class="public-profile-link">
|
778 |
+
<img src="{{ url_for('static', filename=post_authors[post.user_email]) }}" alt="صورة الملف الشخصي" />
|
779 |
+
</a>
|
780 |
+
</div>
|
781 |
+
|
782 |
+
<div class="user-info">
|
783 |
+
<span class="username">{{ post.user_email.split('@')[0] }}</span>
|
784 |
+
<span class="profession">{{ post.user_profession }}</span>
|
785 |
+
<span class="timestamp">{{ post.created_at|format_datetime }}</span>
|
786 |
+
</div>
|
787 |
+
{% if post.user_email == current_user.email %}
|
788 |
+
<div class="post-menu">
|
789 |
+
<i class="fas fa-ellipsis-v menu-dots"></i>
|
790 |
+
</div>
|
791 |
+
{% endif %}
|
792 |
+
</div>
|
793 |
+
|
794 |
+
<div
|
795 |
+
class="post-content"
|
796 |
+
{%
|
797 |
+
if
|
798 |
+
post.background_color
|
799 |
+
and
|
800 |
+
not
|
801 |
+
post.image_url
|
802 |
+
%}style="background-color: {{ post.background_color }}; border-radius: 8px; text-align: center; font-size: 24px;"
|
803 |
+
{%
|
804 |
+
endif
|
805 |
+
%}
|
806 |
+
>
|
807 |
+
{% if post.title %}
|
808 |
+
<h3 class="post-title">{{ post.title }}</h3>
|
809 |
+
{% endif %} {% if post.content %}
|
810 |
+
<div class="post-text-container">
|
811 |
+
<p
|
812 |
+
class="post-text collapsed"
|
813 |
+
{%
|
814 |
+
if
|
815 |
+
post.background_color
|
816 |
+
and
|
817 |
+
not
|
818 |
+
post.image_url
|
819 |
+
%}style="color: {% if post.background_color == '#ffffff' %}#1a1a1a{% else %}#000000{% endif %};"
|
820 |
+
{%
|
821 |
+
endif
|
822 |
+
%}
|
823 |
+
>
|
824 |
+
{{ post.content }}
|
825 |
+
</p>
|
826 |
+
<button class="see-more-btn">إظهار المزيد</button>
|
827 |
+
</div>
|
828 |
+
{% endif %} {% if post.image_url %}
|
829 |
+
<div class="post-media">
|
830 |
+
<img
|
831 |
+
src="{{ url_for('static', filename=post.image_url) }}"
|
832 |
+
alt="صورة المنشور"
|
833 |
+
/>
|
834 |
+
</div>
|
835 |
+
{% endif %} {% if post.video_url %}
|
836 |
+
<div class="post-media video-container">
|
837 |
+
<video
|
838 |
+
src="{{ url_for('static', filename=post.video_url) }}"
|
839 |
+
controls
|
840 |
+
></video>
|
841 |
+
</div>
|
842 |
+
{% endif %}
|
843 |
+
</div>
|
844 |
+
|
845 |
+
<div class="post-actions">
|
846 |
+
<button class="action-btn comment-btn" data-post-id="{{ post.id }}">
|
847 |
+
<i class="fas fa-comment"></i> تعليق
|
848 |
+
</button>
|
849 |
+
<button class="action-btn share-btn" data-post-id="{{ post.id }}">
|
850 |
+
<i class="fas fa-share"></i> مشاركة
|
851 |
+
</button>
|
852 |
+
</div>
|
853 |
+
|
854 |
+
<!-- قسم التعليقات -->
|
855 |
+
<div
|
856 |
+
class="comments-section"
|
857 |
+
data-post-id="{{ post.id }}"
|
858 |
+
style="display: none"
|
859 |
+
>
|
860 |
+
<div class="comment-input-container">
|
861 |
+
<textarea
|
862 |
+
class="comment-input"
|
863 |
+
placeholder="اكتب تعليقك هنا..."
|
864 |
+
rows="1"
|
865 |
+
></textarea>
|
866 |
+
<button class="send-comment-btn">
|
867 |
+
<i class="fas fa-paper-plane"></i>
|
868 |
+
</button>
|
869 |
+
</div>
|
870 |
+
<div class="comments-list"></div>
|
871 |
+
</div>
|
872 |
+
</div>
|
873 |
+
{% endfor %}
|
874 |
+
</div>
|
875 |
+
|
876 |
+
|
877 |
+
|
878 |
+
<!-- Modal لعرض المنشور -->
|
879 |
+
<div class="post-view-modal" id="postViewModal" style="{% if show_post_modal %}display: block;{% else %}display: none;{% endif %}">
|
880 |
+
<div class="modal-overlay"></div>
|
881 |
+
<div class="modal-content">
|
882 |
+
<div class="modal-header">
|
883 |
+
<span class="close-modal">×</span>
|
884 |
+
<h3>عرض المنشور</h3>
|
885 |
+
</div>
|
886 |
+
<div class="post-content">
|
887 |
+
{% if post %}
|
888 |
+
<div class="post-header">
|
889 |
+
<div class="profile-circle">
|
890 |
+
<a href="{{ url_for('public_profile', user_email=post.user_email) }}">
|
891 |
+
<img src="{{ url_for('static', filename=post_authors[post.user_email]) }}" alt="صورة الملف الشخصي" />
|
892 |
+
</a>
|
893 |
+
</div>
|
894 |
+
<div class="user-info">
|
895 |
+
<span class="username">{{ post.user_email.split('@')[0] }}</span>
|
896 |
+
<span class="profession">{{ post.user_profession }}</span>
|
897 |
+
<span class="timestamp">{{ post.created_at|format_datetime }}</span>
|
898 |
+
</div>
|
899 |
+
{% if post.user_email == current_user.email %}
|
900 |
+
<div class="post-menu">
|
901 |
+
<i class="fas fa-ellipsis-v menu-dots"></i>
|
902 |
+
<div class="menu-options" style="display: none;">
|
903 |
+
<div class="menu-option edit-post" data-post-id="{{ post.id }}">
|
904 |
+
<i class="fas fa-edit"></i> تعديل المنشور
|
905 |
+
</div>
|
906 |
+
<div class="menu-option delete-post" data-post-id="{{ post.id }}">
|
907 |
+
<i class="fas fa-trash"></i> حذف المنشور
|
908 |
+
</div>
|
909 |
+
</div>
|
910 |
+
</div>
|
911 |
+
{% endif %}
|
912 |
+
</div>
|
913 |
+
|
914 |
+
<div
|
915 |
+
class="post-content-box"
|
916 |
+
{% if post.background_color and not post.image_url %}
|
917 |
+
style="background-color: {{ post.background_color }}; border-radius: 8px; text-align: center; font-size: 24px;"
|
918 |
+
{% endif %}
|
919 |
+
>
|
920 |
+
<div class="post-text-container">
|
921 |
+
<p
|
922 |
+
class="post-text collapsed"
|
923 |
+
{% if post.background_color and not post.image_url %}
|
924 |
+
style="color: {% if post.background_color == '#ffffff' %}#1a1a1a{% else %}#000000{% endif %};"
|
925 |
+
{% endif %}
|
926 |
+
>
|
927 |
+
{{ post.content }}
|
928 |
+
</p>
|
929 |
+
<button class="see-more-btn">إظهار المزيد</button>
|
930 |
+
</div>
|
931 |
+
</div>
|
932 |
+
|
933 |
+
{% if post.image_url %}
|
934 |
+
<div class="post-media">
|
935 |
+
<img src="{{ url_for('static', filename=post.image_url) }}" alt="صورة المنشور">
|
936 |
+
</div>
|
937 |
+
{% endif %}
|
938 |
+
|
939 |
+
{% if post.video_url %}
|
940 |
+
<div class="post-media video-container">
|
941 |
+
<video src="{{ url_for('static', filename=post.video_url) }}" controls></video>
|
942 |
+
</div>
|
943 |
+
{% endif %}
|
944 |
+
|
945 |
+
<!-- أزرار الإجراءات -->
|
946 |
+
<div class="post-actions">
|
947 |
+
<button class="action-btn comment-btn" data-post-id="{{ post.id }}">
|
948 |
+
<i class="fas fa-comment"></i> تعليق
|
949 |
+
</button>
|
950 |
+
<button class="action-btn share-btn" data-post-id="{{ post.id }}">
|
951 |
+
<i class="fas fa-share"></i> مشاركة
|
952 |
+
</button>
|
953 |
+
</div>
|
954 |
+
|
955 |
+
<!-- قسم التعليقات -->
|
956 |
+
<div class="comments-section" data-post-id="{{ post.id }}" style="display: none">
|
957 |
+
<div class="comment-input-container">
|
958 |
+
<textarea class="comment-input" placeholder="اكتب تعليقك هنا..." rows="1"></textarea>
|
959 |
+
<button class="send-comment-btn">
|
960 |
+
<i class="fas fa-paper-plane"></i>
|
961 |
+
</button>
|
962 |
+
</div>
|
963 |
+
<div class="comments-list"></div>
|
964 |
+
</div>
|
965 |
+
{% endif %}
|
966 |
+
</div>
|
967 |
+
</div>
|
968 |
+
</div>
|
969 |
+
|
970 |
+
|
971 |
+
<!-- Modal لتعديل المنشور -->
|
972 |
+
<div class="edit-modal" id="editModal" style="display: none;">
|
973 |
+
<div class="edit-modal-content">
|
974 |
+
<h3>تعديل المنشور</h3>
|
975 |
+
<textarea id="editContentInput" placeholder="أدخل محتوى المنشور" rows="5"></textarea>
|
976 |
+
<div class="edit-modal-buttons">
|
977 |
+
<button class="save-btn" id="saveEditBtn">حفظ</button>
|
978 |
+
<button class="cancel-btn" id="cancelEditBtn">إلغاء</button>
|
979 |
+
</div>
|
980 |
+
</div>
|
981 |
+
</div>
|
982 |
+
|
983 |
+
|
984 |
+
<!-- Modal لحذف المنشور -->
|
985 |
+
<div class="delete-modal" id="deleteModal" style="display: none;">
|
986 |
+
<div class="delete-modal-content">
|
987 |
+
<h3>تأكيد الحذف</h3>
|
988 |
+
<p>هل أنت متأكد من حذف هذا المنشور؟</p>
|
989 |
+
<div class="delete-modal-buttons">
|
990 |
+
<button class="confirm-delete" id="confirmDeleteBtn">حذف</button>
|
991 |
+
<button class="cancel-delete" id="cancelDeleteBtn">إلغاء</button>
|
992 |
+
</div>
|
993 |
+
</div>
|
994 |
+
</div>
|
995 |
+
|
996 |
+
|
997 |
+
|
998 |
+
<!-- حاوية الملف الشخصي العام -->
|
999 |
+
<div id="public-profile-container">
|
1000 |
+
<div id="public-profile-header">
|
1001 |
+
<button id="close-public-profile-btn">✕</button>
|
1002 |
+
</div>
|
1003 |
+
<iframe id="public-profile-iframe"></iframe>
|
1004 |
+
</div>
|
1005 |
+
|
1006 |
+
|
1007 |
+
<style>
|
1008 |
+
.posts-container {
|
1009 |
+
max-width: 600px;
|
1010 |
+
margin: 80px auto 20px;
|
1011 |
+
padding: 0 15px;
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
.post-card {
|
1015 |
+
background: #fff;
|
1016 |
+
border-radius: 8px;
|
1017 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
1018 |
+
margin-bottom: 20px;
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
.post-header {
|
1022 |
+
display: flex;
|
1023 |
+
align-items: center;
|
1024 |
+
padding: 12px;
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
.post-content {
|
1028 |
+
padding: 12px;
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
.post-title {
|
1032 |
+
margin: 0 0 8px 0;
|
1033 |
+
font-size: 18px;
|
1034 |
+
text-align: right;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
.post-text-container {
|
1038 |
+
position: relative;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
.post-content-box {
|
1042 |
+
background: #f8f9fa;
|
1043 |
+
border-radius: 8px;
|
1044 |
+
padding: 12px;
|
1045 |
+
margin-bottom: 10px;
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
.post-text {
|
1049 |
+
margin: 0;
|
1050 |
+
color: #1a1a1a;
|
1051 |
+
line-height: 1.6;
|
1052 |
+
text-align: right;
|
1053 |
+
word-wrap: break-word;
|
1054 |
+
position: relative;
|
1055 |
+
direction: rtl;
|
1056 |
+
font-size: 16px;
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
.post-text p {
|
1060 |
+
margin: 0;
|
1061 |
+
padding: 8px 0;
|
1062 |
+
line-height: inherit;
|
1063 |
+
white-space: pre-wrap;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
.post-text.collapsed {
|
1067 |
+
display: -webkit-box;
|
1068 |
+
-webkit-line-clamp: 4;
|
1069 |
+
-webkit-box-orient: vertical;
|
1070 |
+
overflow: hidden;
|
1071 |
+
max-height: calc(1.6em * 4); /* 4 lines maximum height */
|
1072 |
+
position: relative;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
.post-text.expanded {
|
1076 |
+
display: block;
|
1077 |
+
max-height: none;
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
.post-text p:first-child {
|
1081 |
+
padding-top: 0;
|
1082 |
+
}
|
1083 |
+
|
1084 |
+
.post-text p:last-child {
|
1085 |
+
padding-bottom: 0;
|
1086 |
+
}
|
1087 |
+
|
1088 |
+
.post-text p:empty {
|
1089 |
+
min-height: 1.6em;
|
1090 |
+
display: block;
|
1091 |
+
margin: 4px 0;
|
1092 |
+
}
|
1093 |
+
|
1094 |
+
.see-more-btn {
|
1095 |
+
color: #1877f2;
|
1096 |
+
cursor: pointer;
|
1097 |
+
font-weight: 500;
|
1098 |
+
margin-top: 8px;
|
1099 |
+
display: none;
|
1100 |
+
background: none;
|
1101 |
+
border: none;
|
1102 |
+
padding: 0;
|
1103 |
+
text-align: right;
|
1104 |
+
width: 100%;
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
.post-media {
|
1108 |
+
margin-top: 10px;
|
1109 |
+
border-radius: 8px;
|
1110 |
+
overflow: hidden;
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
.post-media img {
|
1114 |
+
/* width: 400px; */
|
1115 |
+
/* height: 400px; */
|
1116 |
+
max-width: 100%;
|
1117 |
+
display: block;
|
1118 |
+
/* border-radius: 50%; */
|
1119 |
+
object-fit: cover;
|
1120 |
+
margin: 0 auto;
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
.video-container {
|
1124 |
+
position: relative;
|
1125 |
+
padding-bottom: 56.25%; /* 16:9 نسبة العرض للفيديو */
|
1126 |
+
height: 0;
|
1127 |
+
overflow: hidden;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
.video-container video {
|
1131 |
+
position: absolute;
|
1132 |
+
top: 0;
|
1133 |
+
right: 0;
|
1134 |
+
width: 100%;
|
1135 |
+
height: 100%;
|
1136 |
+
object-fit: cover;
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
.post-actions {
|
1140 |
+
display: flex;
|
1141 |
+
justify-content: space-around;
|
1142 |
+
padding: 8px;
|
1143 |
+
border-top: 1px solid #ddd;
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
.action-btn {
|
1147 |
+
background: none;
|
1148 |
+
border: none;
|
1149 |
+
padding: 8px;
|
1150 |
+
color: #65676b;
|
1151 |
+
cursor: pointer;
|
1152 |
+
font-size: 14px;
|
1153 |
+
display: flex;
|
1154 |
+
align-items: center;
|
1155 |
+
gap: 5px;
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
.action-btn:hover {
|
1159 |
+
background: #f0f2f5;
|
1160 |
+
border-radius: 4px;
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
.action-btn i {
|
1164 |
+
font-size: 16px;
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
.user-info {
|
1168 |
+
display: flex;
|
1169 |
+
flex-direction: column;
|
1170 |
+
margin-right: 10px;
|
1171 |
+
margin-left: 10px;
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
.timestamp {
|
1175 |
+
font-size: 12px;
|
1176 |
+
color: #65676b;
|
1177 |
+
margin-top: 2px;
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
.profession {
|
1181 |
+
font-size: 12px;
|
1182 |
+
color: #4caf50;
|
1183 |
+
margin-top: 2px;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
/* Post Menu Styles */
|
1187 |
+
.post-menu {
|
1188 |
+
position: relative;
|
1189 |
+
margin-right: auto;
|
1190 |
+
padding: 8px;
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
.menu-dots {
|
1194 |
+
cursor: pointer;
|
1195 |
+
color: #65676b;
|
1196 |
+
padding: 8px;
|
1197 |
+
border-radius: 50%;
|
1198 |
+
width: 32px;
|
1199 |
+
height: 32px;
|
1200 |
+
display: flex;
|
1201 |
+
align-items: center;
|
1202 |
+
justify-content: center;
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
.menu-dots:hover {
|
1206 |
+
background-color: #f0f2f5;
|
1207 |
+
}
|
1208 |
+
|
1209 |
+
.post-menu-modal {
|
1210 |
+
display: none;
|
1211 |
+
position: fixed;
|
1212 |
+
top: 0;
|
1213 |
+
left: 0;
|
1214 |
+
right: 0;
|
1215 |
+
bottom: 0;
|
1216 |
+
background-color: rgba(0, 0, 0, 0.5);
|
1217 |
+
z-index: 2000;
|
1218 |
+
display: flex;
|
1219 |
+
justify-content: center;
|
1220 |
+
align-items: center;
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
.menu-options {
|
1224 |
+
background: white;
|
1225 |
+
border-radius: 8px;
|
1226 |
+
width: 90%;
|
1227 |
+
max-width: 300px;
|
1228 |
+
overflow: hidden;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
.menu-option {
|
1232 |
+
padding: 16px;
|
1233 |
+
cursor: pointer;
|
1234 |
+
color: #050505;
|
1235 |
+
display: flex;
|
1236 |
+
align-items: center;
|
1237 |
+
gap: 8px;
|
1238 |
+
transition: background-color 0.2s;
|
1239 |
+
font-size: 16px;
|
1240 |
+
justify-content: center;
|
1241 |
+
border-bottom: 1px solid #eee;
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
.menu-option:last-child {
|
1245 |
+
border-bottom: none;
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
.menu-option:hover {
|
1249 |
+
background-color: #f0f2f5;
|
1250 |
+
}
|
1251 |
+
|
1252 |
+
.menu-option i {
|
1253 |
+
font-size: 18px;
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
.delete-post {
|
1257 |
+
color: #dc3545;
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
.post-header {
|
1261 |
+
position: relative;
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
.replies-toggle {
|
1265 |
+
margin-top: 5px;
|
1266 |
+
font-size: 14px;
|
1267 |
+
display: flex;
|
1268 |
+
align-items: center;
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
.replies-toggle i {
|
1272 |
+
margin-right: 5px;
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
.nested-comments {
|
1276 |
+
margin-left: 20px;
|
1277 |
+
border-left: 1px solid #ddd;
|
1278 |
+
padding-left: 10px;
|
1279 |
+
}
|
1280 |
+
|
1281 |
+
|
1282 |
+
|
1283 |
+
/* Post View Modal Styles */
|
1284 |
+
.post-view-modal {
|
1285 |
+
display: none;
|
1286 |
+
position: fixed;
|
1287 |
+
top: 0;
|
1288 |
+
left: 0;
|
1289 |
+
width: 100%;
|
1290 |
+
height: 100%;
|
1291 |
+
z-index: 1000;
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
.modal-overlay {
|
1295 |
+
position: absolute;
|
1296 |
+
width: 100%;
|
1297 |
+
height: 100%;
|
1298 |
+
background-color: rgba(0, 0, 0, 0.5);
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
.modal-content {
|
1302 |
+
position: relative;
|
1303 |
+
width: 90%;
|
1304 |
+
max-width: 700px;
|
1305 |
+
height: 80%;
|
1306 |
+
background: white;
|
1307 |
+
margin: 50px auto;
|
1308 |
+
border-radius: 8px;
|
1309 |
+
overflow-y: auto;
|
1310 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
.modal-header {
|
1314 |
+
padding: 15px;
|
1315 |
+
border-bottom: 1px solid #ddd;
|
1316 |
+
display: flex;
|
1317 |
+
justify-content: space-between;
|
1318 |
+
align-items: center;
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
.close-modal {
|
1322 |
+
font-size: 24px;
|
1323 |
+
cursor: pointer;
|
1324 |
+
color: #666;
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
.post-content {
|
1328 |
+
padding: 15px;
|
1329 |
+
}
|
1330 |
+
|
1331 |
+
|
1332 |
+
|
1333 |
+
/* تنسيقات modal التعديل */
|
1334 |
+
.edit-modal {
|
1335 |
+
display: none; /* مخفي بشكل افتراضي */
|
1336 |
+
position: fixed;
|
1337 |
+
top: 50%;
|
1338 |
+
left: 50%;
|
1339 |
+
transform: translate(-50%, -50%);
|
1340 |
+
background-color: white;
|
1341 |
+
padding: 20px;
|
1342 |
+
border-radius: 8px;
|
1343 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
1344 |
+
z-index: 2000; /* أعلى من modal عرض المنشور */
|
1345 |
+
width: 90%;
|
1346 |
+
max-width: 500px;
|
1347 |
+
}
|
1348 |
+
|
1349 |
+
.edit-modal-content {
|
1350 |
+
display: flex;
|
1351 |
+
flex-direction: column;
|
1352 |
+
gap: 15px;
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
.edit-modal textarea {
|
1356 |
+
width: 100%;
|
1357 |
+
padding: 10px;
|
1358 |
+
border: 1px solid #ddd;
|
1359 |
+
border-radius: 4px;
|
1360 |
+
resize: vertical;
|
1361 |
+
min-height: 150px;
|
1362 |
+
font-size: 16px;
|
1363 |
+
direction: rtl;
|
1364 |
+
}
|
1365 |
+
|
1366 |
+
.edit-modal-buttons {
|
1367 |
+
display: flex;
|
1368 |
+
justify-content: flex-end;
|
1369 |
+
gap: 10px;
|
1370 |
+
}
|
1371 |
+
|
1372 |
+
.edit-modal-buttons button {
|
1373 |
+
padding: 8px 16px;
|
1374 |
+
border: none;
|
1375 |
+
border-radius: 4px;
|
1376 |
+
cursor: pointer;
|
1377 |
+
font-size: 14px;
|
1378 |
+
}
|
1379 |
+
|
1380 |
+
.edit-modal-buttons .save-btn {
|
1381 |
+
background-color: #4caf50;
|
1382 |
+
color: white;
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
.edit-modal-buttons .cancel-btn {
|
1386 |
+
background-color: #f44336;
|
1387 |
+
color: white;
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
/* Post Menu Styles */
|
1391 |
+
.post-menu {
|
1392 |
+
position: relative;
|
1393 |
+
margin-right: auto;
|
1394 |
+
padding: 8px;
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
.menu-dots {
|
1398 |
+
cursor: pointer;
|
1399 |
+
color: #65676b;
|
1400 |
+
padding: 8px;
|
1401 |
+
border-radius: 50%;
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
.menu-dots:hover {
|
1405 |
+
background-color: #f0f2f5;
|
1406 |
+
}
|
1407 |
+
|
1408 |
+
.menu-options {
|
1409 |
+
display: none;
|
1410 |
+
position: absolute;
|
1411 |
+
left: 0;
|
1412 |
+
top: 100%;
|
1413 |
+
background: white;
|
1414 |
+
border-radius: 8px;
|
1415 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
1416 |
+
z-index: 1000;
|
1417 |
+
min-width: 150px;
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
.menu-option {
|
1421 |
+
padding: 8px 16px;
|
1422 |
+
cursor: pointer;
|
1423 |
+
color: #050505;
|
1424 |
+
display: flex;
|
1425 |
+
align-items: center;
|
1426 |
+
gap: 8px;
|
1427 |
+
}
|
1428 |
+
|
1429 |
+
.menu-option:hover {
|
1430 |
+
background-color: #f0f2f5;
|
1431 |
+
}
|
1432 |
+
|
1433 |
+
.menu-option i {
|
1434 |
+
font-size: 16px;
|
1435 |
+
width: 20px;
|
1436 |
+
}
|
1437 |
+
|
1438 |
+
.delete-post {
|
1439 |
+
color: #dc3545;
|
1440 |
+
}
|
1441 |
+
|
1442 |
+
|
1443 |
+
/* تنسيقات modal الحذف */
|
1444 |
+
.delete-modal {
|
1445 |
+
display: none; /* مخفي بشكل افتراضي */
|
1446 |
+
position: fixed;
|
1447 |
+
top: 50%;
|
1448 |
+
left: 50%;
|
1449 |
+
transform: translate(-50%, -50%);
|
1450 |
+
background-color: white;
|
1451 |
+
padding: 20px;
|
1452 |
+
border-radius: 8px;
|
1453 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
1454 |
+
z-index: 2000; /* أعلى من modal عرض المنشور */
|
1455 |
+
width: 90%;
|
1456 |
+
max-width: 500px;
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
.delete-modal-content {
|
1460 |
+
display: flex;
|
1461 |
+
flex-direction: column;
|
1462 |
+
gap: 15px;
|
1463 |
+
}
|
1464 |
+
|
1465 |
+
.delete-modal-buttons {
|
1466 |
+
display: flex;
|
1467 |
+
justify-content: flex-end;
|
1468 |
+
gap: 10px;
|
1469 |
+
}
|
1470 |
+
|
1471 |
+
.delete-modal-buttons button {
|
1472 |
+
padding: 8px 16px;
|
1473 |
+
border: none;
|
1474 |
+
border-radius: 4px;
|
1475 |
+
cursor: pointer;
|
1476 |
+
font-size: 14px;
|
1477 |
+
}
|
1478 |
+
|
1479 |
+
.delete-modal-buttons .confirm-delete {
|
1480 |
+
background-color: #dc3545;
|
1481 |
+
color: white;
|
1482 |
+
}
|
1483 |
+
|
1484 |
+
.delete-modal-buttons .cancel-delete {
|
1485 |
+
background-color: #f0f2f5;
|
1486 |
+
color: #050505;
|
1487 |
+
}
|
1488 |
+
|
1489 |
+
.modal-content{
|
1490 |
+
position: relative;
|
1491 |
+
width: 100% !important;
|
1492 |
+
max-width: 700px;
|
1493 |
+
height: 100%;
|
1494 |
+
background: white;
|
1495 |
+
margin: 0px auto;
|
1496 |
+
border-radius: 0px !important;
|
1497 |
+
overflow-y: auto;
|
1498 |
+
top: 0;
|
1499 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
1500 |
+
|
1501 |
+
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
|
1505 |
+
|
1506 |
+
/* تصميم زر الإشعارات */
|
1507 |
+
#notification-btn {
|
1508 |
+
background-color: #0078ff;
|
1509 |
+
color: white;
|
1510 |
+
border: none;
|
1511 |
+
padding: 10px 15px;
|
1512 |
+
border-radius: 5px;
|
1513 |
+
cursor: pointer;
|
1514 |
+
font-size: 16px;
|
1515 |
+
}
|
1516 |
+
|
1517 |
+
/* تصميم العداد */
|
1518 |
+
#notification-count {
|
1519 |
+
background-color: red;
|
1520 |
+
color: white;
|
1521 |
+
border-radius: 50%;
|
1522 |
+
padding: 2px 6px;
|
1523 |
+
font-size: 12px;
|
1524 |
+
margin-left: 5px;
|
1525 |
+
}
|
1526 |
+
|
1527 |
+
/* تصميم قائمة الإشعارات */
|
1528 |
+
#notification-list {
|
1529 |
+
display: none;
|
1530 |
+
position: absolute;
|
1531 |
+
left: 0;
|
1532 |
+
right: 0;
|
1533 |
+
top: 100%;
|
1534 |
+
background-color: white;
|
1535 |
+
border: 1px solid #ddd;
|
1536 |
+
border-radius: 5px;
|
1537 |
+
padding: 10px;
|
1538 |
+
width: 87%;
|
1539 |
+
height: 100%;
|
1540 |
+
overflow-y: auto;
|
1541 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
.no-notifications{
|
1545 |
+
text-align: center;
|
1546 |
+
}
|
1547 |
+
|
1548 |
+
/* تصميم عنصر الإشعار */
|
1549 |
+
.notification-item {
|
1550 |
+
display: flex;
|
1551 |
+
align-items: center;
|
1552 |
+
padding: 10px;
|
1553 |
+
border-bottom: 1px solid #ddd;
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
.notification-item img {
|
1557 |
+
width: 40px;
|
1558 |
+
height: 40px;
|
1559 |
+
border-radius: 50%;
|
1560 |
+
margin-right: 10px;
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
.notification-item div {
|
1564 |
+
flex: 1;
|
1565 |
+
}
|
1566 |
+
|
1567 |
+
.notification-item strong {
|
1568 |
+
font-size: 14px;
|
1569 |
+
}
|
1570 |
+
|
1571 |
+
.notification-item p {
|
1572 |
+
font-size: 12px;
|
1573 |
+
margin: 5px 0;
|
1574 |
+
}
|
1575 |
+
|
1576 |
+
.notification-item small {
|
1577 |
+
font-size: 10px;
|
1578 |
+
color: #666;
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
|
1582 |
+
/* تنسيق زر الشات */
|
1583 |
+
/* .chat-button {
|
1584 |
+
position: fixed;
|
1585 |
+
bottom: 20px;
|
1586 |
+
right: 20px;
|
1587 |
+
background-color: #007bff;
|
1588 |
+
color: white;
|
1589 |
+
border: none;
|
1590 |
+
border-radius: 50%;
|
1591 |
+
width: 60px;
|
1592 |
+
height: 60px;
|
1593 |
+
font-size: 24px;
|
1594 |
+
cursor: pointer;
|
1595 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
1596 |
+
} */
|
1597 |
+
|
1598 |
+
/* تنسيق نافذة الشات */
|
1599 |
+
.chat-window {
|
1600 |
+
position: fixed;
|
1601 |
+
right: 0;
|
1602 |
+
left: 0;
|
1603 |
+
height: 100%;
|
1604 |
+
bottom: 0;
|
1605 |
+
background-color: #fff;
|
1606 |
+
border: 1px solid #ddd;
|
1607 |
+
border-radius: 10px;
|
1608 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
1609 |
+
overflow-y: auto;
|
1610 |
+
z-index: 1000;
|
1611 |
+
display: none;
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
.chat-window .chat-header {
|
1615 |
+
padding: 10px;
|
1616 |
+
background-color: #007bff;
|
1617 |
+
color: white;
|
1618 |
+
font-size: 18px;
|
1619 |
+
font-weight: bold;
|
1620 |
+
text-align: center;
|
1621 |
+
border-top-left-radius: 10px;
|
1622 |
+
border-top-right-radius: 10px;
|
1623 |
+
}
|
1624 |
+
|
1625 |
+
.chat-window .chat-item {
|
1626 |
+
display: flex;
|
1627 |
+
align-items: center;
|
1628 |
+
padding: 10px;
|
1629 |
+
border-bottom: 1px solid #ddd;
|
1630 |
+
cursor: pointer;
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
.chat-window .chat-item img {
|
1634 |
+
width: 40px;
|
1635 |
+
height: 40px;
|
1636 |
+
border-radius: 50%;
|
1637 |
+
margin-right: 10px;
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
.chat-window .chat-item:hover {
|
1641 |
+
background-color: #f1f1f1;
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
.no-chats {
|
1645 |
+
padding: 10px;
|
1646 |
+
text-align: center;
|
1647 |
+
color: #666;
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
.close-main-chat{
|
1651 |
+
position: absolute;
|
1652 |
+
right: 5px;
|
1653 |
+
}
|
1654 |
+
|
1655 |
+
|
1656 |
+
|
1657 |
+
/* الأسلوب العام للموديل */
|
1658 |
+
.modal-search {
|
1659 |
+
display: none; /* الموديل مخفي بشكل افتراضي */
|
1660 |
+
position: fixed;
|
1661 |
+
z-index: 1;
|
1662 |
+
left: 0;
|
1663 |
+
top: 0;
|
1664 |
+
width: 100%;
|
1665 |
+
height: 100%;
|
1666 |
+
overflow: auto;
|
1667 |
+
background-color: rgba(0,0,0,0.4);
|
1668 |
+
}
|
1669 |
+
|
1670 |
+
/* محتوى الموديل */
|
1671 |
+
.modal-search-content {
|
1672 |
+
background-color: #fefefe;
|
1673 |
+
margin: 15% auto;
|
1674 |
+
padding: 20px;
|
1675 |
+
border: 1px solid #888;
|
1676 |
+
width: 80%;
|
1677 |
+
max-width: 500px;
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
/* زر إغلاق الموديل */
|
1681 |
+
.close-search-modal {
|
1682 |
+
color: #aaa;
|
1683 |
+
float: right;
|
1684 |
+
font-size: 28px;
|
1685 |
+
font-weight: bold;
|
1686 |
+
}
|
1687 |
+
|
1688 |
+
.close-search-modal:hover,
|
1689 |
+
.close-search-modal:focus {
|
1690 |
+
color: black;
|
1691 |
+
text-decoration: none;
|
1692 |
+
cursor: pointer;
|
1693 |
+
}
|
1694 |
+
|
1695 |
+
/* تنسيق نتائج البحث */
|
1696 |
+
.search-results {
|
1697 |
+
margin-top: 10px;
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
.search-result {
|
1701 |
+
padding: 8px;
|
1702 |
+
margin: 5px;
|
1703 |
+
cursor: pointer;
|
1704 |
+
}
|
1705 |
+
|
1706 |
+
.search-result:hover {
|
1707 |
+
background-color: #f0f0f0;
|
1708 |
+
}
|
1709 |
+
|
1710 |
+
.profile-img {
|
1711 |
+
width: 30px;
|
1712 |
+
height: 30px;
|
1713 |
+
border-radius: 50%;
|
1714 |
+
margin-right: 10px;
|
1715 |
+
}
|
1716 |
+
|
1717 |
+
.search-btn {
|
1718 |
+
padding: 8px 12px;
|
1719 |
+
background-color: #007BFF;
|
1720 |
+
color: white;
|
1721 |
+
border: none;
|
1722 |
+
cursor: pointer;
|
1723 |
+
}
|
1724 |
+
|
1725 |
+
.search-btn:hover {
|
1726 |
+
background-color: #0056b3;
|
1727 |
+
}
|
1728 |
+
|
1729 |
+
.search-input {
|
1730 |
+
width: 100%;
|
1731 |
+
padding: 10px;
|
1732 |
+
margin: 10px 0;
|
1733 |
+
border: 1px solid #ccc;
|
1734 |
+
border-radius: 4px;
|
1735 |
+
}
|
1736 |
+
|
1737 |
+
/* النمط الأساسي لـ profile-container */
|
1738 |
+
#profile-container {
|
1739 |
+
display: none; /* مخفي في البداية */
|
1740 |
+
position: fixed;
|
1741 |
+
top: 0;
|
1742 |
+
left: 0;
|
1743 |
+
width: 100%;
|
1744 |
+
height: 100%;
|
1745 |
+
background-color: rgba(0, 0, 0, 0.5); /* خلفية شفافة */
|
1746 |
+
z-index: 1000;
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
/* محتوى iframe */
|
1750 |
+
#profile-iframe {
|
1751 |
+
width: 100%;
|
1752 |
+
height: 100%;
|
1753 |
+
border: none;
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
/* رأس الحاوية مع زر الإغلاق */
|
1757 |
+
#profile-header {
|
1758 |
+
position: absolute;
|
1759 |
+
top: 0;
|
1760 |
+
right: 0;
|
1761 |
+
width: fit-content;
|
1762 |
+
background-color: #f1f1f1;
|
1763 |
+
padding: 10px;
|
1764 |
+
box-sizing: border-box;
|
1765 |
+
z-index: 1001;
|
1766 |
+
}
|
1767 |
+
|
1768 |
+
#close-profile-btn {
|
1769 |
+
background-color: transparent;
|
1770 |
+
border: none;
|
1771 |
+
font-size: 24px;
|
1772 |
+
cursor: pointer;
|
1773 |
+
float: left;
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
/* الأنيميشن */
|
1777 |
+
@keyframes fadeIn {
|
1778 |
+
from { opacity: 0; }
|
1779 |
+
to { opacity: 1; }
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
@keyframes slideIn {
|
1783 |
+
from { transform: translateY(100%); }
|
1784 |
+
to { transform: translateY(0); }
|
1785 |
+
}
|
1786 |
+
|
1787 |
+
@keyframes fadeOut {
|
1788 |
+
from { opacity: 1; }
|
1789 |
+
to { opacity: 0; }
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
@keyframes slideOut {
|
1793 |
+
from { transform: translateY(0); }
|
1794 |
+
to { transform: translateY(100%); }
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
#profile-container.show {
|
1798 |
+
display: block;
|
1799 |
+
animation: fadeIn 0.5s, slideIn 0.5s;
|
1800 |
+
}
|
1801 |
+
|
1802 |
+
#profile-container.hide {
|
1803 |
+
animation: fadeOut 0.5s, slideOut 0.5s;
|
1804 |
+
}
|
1805 |
+
|
1806 |
+
|
1807 |
+
|
1808 |
+
|
1809 |
+
|
1810 |
+
/* النمط الأساسي لـ public-profile-container */
|
1811 |
+
#public-profile-container {
|
1812 |
+
display: none; /* مخفي في البداية */
|
1813 |
+
position: fixed;
|
1814 |
+
top: 0;
|
1815 |
+
left: 0;
|
1816 |
+
width: 100%;
|
1817 |
+
height: 100%;
|
1818 |
+
background-color: rgba(0, 0, 0, 0.5); /* خلفية شفافة */
|
1819 |
+
z-index: 1000;
|
1820 |
+
}
|
1821 |
+
|
1822 |
+
/* محتوى iframe */
|
1823 |
+
#public-profile-iframe {
|
1824 |
+
width: 100%;
|
1825 |
+
height: 100%;
|
1826 |
+
border: none;
|
1827 |
+
}
|
1828 |
+
|
1829 |
+
/* رأس الحاوية مع زر الإغلاق */
|
1830 |
+
#public-profile-header {
|
1831 |
+
position: absolute;
|
1832 |
+
top: 0;
|
1833 |
+
left: 0;
|
1834 |
+
width: fit-content;
|
1835 |
+
background-color: #f1f1f1;
|
1836 |
+
padding: 10px;
|
1837 |
+
box-sizing: border-box;
|
1838 |
+
z-index: 1001;
|
1839 |
+
}
|
1840 |
+
|
1841 |
+
#close-public-profile-btn {
|
1842 |
+
background-color: transparent;
|
1843 |
+
border: none;
|
1844 |
+
font-size: 24px;
|
1845 |
+
cursor: pointer;
|
1846 |
+
float: left;
|
1847 |
+
}
|
1848 |
+
|
1849 |
+
/* الأنيميشن */
|
1850 |
+
@keyframes fadeIn {
|
1851 |
+
from { opacity: 0; }
|
1852 |
+
to { opacity: 1; }
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
@keyframes slideIn {
|
1856 |
+
from { transform: translateY(100%); }
|
1857 |
+
to { transform: translateY(0); }
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
@keyframes fadeOut {
|
1861 |
+
from { opacity: 1; }
|
1862 |
+
to { opacity: 0; }
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
@keyframes slideOut {
|
1866 |
+
from { transform: translateY(0); }
|
1867 |
+
to { transform: translateY(100%); }
|
1868 |
+
}
|
1869 |
+
|
1870 |
+
#public-profile-container.show {
|
1871 |
+
display: block;
|
1872 |
+
animation: fadeIn 0.5s, slideIn 0.5s;
|
1873 |
+
}
|
1874 |
+
|
1875 |
+
#public-profile-container.hide {
|
1876 |
+
animation: fadeOut 0.5s, slideOut 0.5s;
|
1877 |
+
}
|
1878 |
+
|
1879 |
+
|
1880 |
+
|
1881 |
+
/* الأنيميشن فتح المقالات*/
|
1882 |
+
@keyframes articalFadeIn {
|
1883 |
+
from { opacity: 0; }
|
1884 |
+
to { opacity: 1; }
|
1885 |
+
}
|
1886 |
+
|
1887 |
+
@keyframes articalSlideIn {
|
1888 |
+
from { transform: translateY(100%); }
|
1889 |
+
to { transform: translateY(0); }
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
@keyframes articalFadeOut {
|
1893 |
+
from { opacity: 1; }
|
1894 |
+
to { opacity: 0; }
|
1895 |
+
}
|
1896 |
+
|
1897 |
+
@keyframes articalSlideOut {
|
1898 |
+
from { transform: translateY(0); }
|
1899 |
+
to { transform: translateY(100%); }
|
1900 |
+
}
|
1901 |
+
|
1902 |
+
/* إعدادات iframe */
|
1903 |
+
#artical-iframe-container {
|
1904 |
+
display: none;
|
1905 |
+
position: fixed;
|
1906 |
+
bottom: 0;
|
1907 |
+
left: 0;
|
1908 |
+
width: 100%;
|
1909 |
+
height: 100%;
|
1910 |
+
background: white;
|
1911 |
+
box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.2);
|
1912 |
+
z-index: 1000;
|
1913 |
+
}
|
1914 |
+
|
1915 |
+
#artical-iframe-container.show {
|
1916 |
+
display: block;
|
1917 |
+
animation: articalFadeIn 0.5s, articalSlideIn 0.5s;
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
#artical-iframe-container.hide {
|
1921 |
+
animation: articalFadeOut 0.5s, articalSlideOut 0.5s;
|
1922 |
+
}
|
1923 |
+
|
1924 |
+
/* iframe */
|
1925 |
+
#artical-iframe {
|
1926 |
+
width: 100%;
|
1927 |
+
height: 100%;
|
1928 |
+
border: none;
|
1929 |
+
}
|
1930 |
+
|
1931 |
+
/* زر الإغلاق */
|
1932 |
+
#artical-close-btn {
|
1933 |
+
position: absolute;
|
1934 |
+
top: 10px;
|
1935 |
+
left: 10px;
|
1936 |
+
background: red;
|
1937 |
+
color: white;
|
1938 |
+
border: none;
|
1939 |
+
border-radius: 5px;
|
1940 |
+
padding: 5px 10px;
|
1941 |
+
cursor: pointer;
|
1942 |
+
}
|
1943 |
+
|
1944 |
+
</style>
|
1945 |
+
|
1946 |
+
<script>
|
1947 |
+
// Comments Functionality
|
1948 |
+
// Comments Functionality
|
1949 |
+
$(document).ready(function () {
|
1950 |
+
const commentsContainer = $("#commentsFixedContainer");
|
1951 |
+
const commentsOverlay = $("#commentsOverlay");
|
1952 |
+
const closeComments = $(".close-comments");
|
1953 |
+
let currentPostId = null;
|
1954 |
+
|
1955 |
+
// Reply Modal Elements
|
1956 |
+
const replyContainer = $("#replyFixedContainer");
|
1957 |
+
const replyOverlay = $("#replyOverlay");
|
1958 |
+
const closeReply = $(".close-reply");
|
1959 |
+
let currentCommentId = null;
|
1960 |
+
|
1961 |
+
// تحميل التعليقات عند النقر على زر التعليق
|
1962 |
+
$(".comment-btn").click(function () {
|
1963 |
+
const postId = $(this).data("post-id");
|
1964 |
+
currentPostId = postId;
|
1965 |
+
|
1966 |
+
// تحميل التعليقات
|
1967 |
+
loadComments(postId);
|
1968 |
+
|
1969 |
+
// عرض الخلفية والحاوية
|
1970 |
+
commentsOverlay.css("display", "block");
|
1971 |
+
commentsContainer.css("display", "block");
|
1972 |
+
document.body.style.overflow = "hidden"; // منع السكرول في الصفحة الرئيسية
|
1973 |
+
setTimeout(() => {
|
1974 |
+
commentsContainer.addClass("active");
|
1975 |
+
}, 10);
|
1976 |
+
});
|
1977 |
+
|
1978 |
+
// إغلاق التعليقات عند النقر خارج الحاوية
|
1979 |
+
commentsOverlay.click(function () {
|
1980 |
+
closeCommentsContainer();
|
1981 |
+
});
|
1982 |
+
|
1983 |
+
// إغلاق حاوية التعليقات
|
1984 |
+
closeComments.click(function () {
|
1985 |
+
closeCommentsContainer();
|
1986 |
+
});
|
1987 |
+
|
1988 |
+
// دالة إغلاق حاوية التعليقات
|
1989 |
+
function closeCommentsContainer() {
|
1990 |
+
commentsContainer.removeClass("active");
|
1991 |
+
document.body.style.overflow = "auto"; // إعادة تفعيل السكرول في الصفحة الرئيسية
|
1992 |
+
setTimeout(() => {
|
1993 |
+
commentsContainer.css("display", "none");
|
1994 |
+
commentsOverlay.css("display", "none");
|
1995 |
+
}, 300);
|
1996 |
+
}
|
1997 |
+
|
1998 |
+
// إرسال التعليق
|
1999 |
+
$(".send-comment-btn").click(function () {
|
2000 |
+
const input = commentsContainer.find(".comment-input");
|
2001 |
+
const content = input.val().trim();
|
2002 |
+
|
2003 |
+
if (content && currentPostId) {
|
2004 |
+
$.ajax({
|
2005 |
+
url: "/add_comment",
|
2006 |
+
method: "POST",
|
2007 |
+
data: {
|
2008 |
+
post_id: currentPostId,
|
2009 |
+
content: content,
|
2010 |
+
parent_id: null, // Root comment
|
2011 |
+
},
|
2012 |
+
success: function (response) {
|
2013 |
+
if (response.success) {
|
2014 |
+
input.val("");
|
2015 |
+
loadComments(currentPostId);
|
2016 |
+
}
|
2017 |
+
},
|
2018 |
+
});
|
2019 |
+
}
|
2020 |
+
});
|
2021 |
+
|
2022 |
+
// تحميل التعليقات
|
2023 |
+
function loadComments(postId) {
|
2024 |
+
$.get(`/get_comments/${postId}`, function (comments) {
|
2025 |
+
const commentsList = commentsContainer.find(".comments-list");
|
2026 |
+
commentsList.empty();
|
2027 |
+
|
2028 |
+
comments.forEach(function (comment) {
|
2029 |
+
const commentHtml = generateCommentHtml(comment);
|
2030 |
+
commentsList.append(commentHtml);
|
2031 |
+
});
|
2032 |
+
});
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
// دالة لتوليد HTML للتعليقات والردود
|
2036 |
+
function generateCommentHtml(comment) {
|
2037 |
+
const hasReplies = comment.replies && comment.replies.length > 0;
|
2038 |
+
const repliesCount = hasReplies
|
2039 |
+
? `${comment.replies.length} رداً`
|
2040 |
+
: "";
|
2041 |
+
|
2042 |
+
const repliesHtml = hasReplies
|
2043 |
+
? comment.replies
|
2044 |
+
.map((reply) => generateReplyHtml(reply))
|
2045 |
+
.join("")
|
2046 |
+
: "";
|
2047 |
+
|
2048 |
+
return `
|
2049 |
+
<div class="comment-item">
|
2050 |
+
<div class="comment-user-avatar">
|
2051 |
+
<img src="/static/${
|
2052 |
+
comment.profile_photo
|
2053 |
+
}" alt="${comment.username}">
|
2054 |
+
</div>
|
2055 |
+
<div class="comment-bubble">
|
2056 |
+
<div class="comment-header">
|
2057 |
+
<span class="comment-username">${comment.username}</span>
|
2058 |
+
</div>
|
2059 |
+
<div class="comment-content">${comment.content}</div>
|
2060 |
+
<div class="comment-time">${comment.created_at}</div>
|
2061 |
+
|
2062 |
+
<!-- عرض زر الردود المخفية إذا كان هناك ردود -->
|
2063 |
+
${
|
2064 |
+
hasReplies
|
2065 |
+
? `
|
2066 |
+
<div class="replies-toggle" data-comment-id="${comment.id}">
|
2067 |
+
<span class="replies-toggle-text" style="color: blue; cursor: pointer;">
|
2068 |
+
<i class="fas fa-chevron-down"></i> ${repliesCount}
|
2069 |
+
</span>
|
2070 |
+
</div>
|
2071 |
+
`
|
2072 |
+
: ""
|
2073 |
+
}
|
2074 |
+
|
2075 |
+
<!-- زر الرد -->
|
2076 |
+
<button class="reply-btn" data-comment-id="${
|
2077 |
+
comment.id
|
2078 |
+
}" style="color: blue; cursor: pointer;">رد</button>
|
2079 |
+
|
2080 |
+
<!-- عرض الردود أسفل التعليق الرئيسي -->
|
2081 |
+
<div class="replies-container" style="display: ${
|
2082 |
+
hasReplies ? "none" : "none"
|
2083 |
+
};">
|
2084 |
+
${repliesHtml}
|
2085 |
+
</div>
|
2086 |
+
</div>
|
2087 |
+
</div>
|
2088 |
+
`;
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
// دالة لتوليد HTML للردود
|
2092 |
+
function generateReplyHtml(reply) {
|
2093 |
+
return `
|
2094 |
+
<div class="comment-item nested-comment" style=" border-bottom: 1px solid;">
|
2095 |
+
<div class="comment-user-avatar">
|
2096 |
+
<img src="/static/${
|
2097 |
+
reply.profile_photo
|
2098 |
+
}" alt="${reply.username}">
|
2099 |
+
</div>
|
2100 |
+
<div class="comment-bubble">
|
2101 |
+
<div class="comment-header">
|
2102 |
+
<span class="comment-username">${reply.username}</span>
|
2103 |
+
</div>
|
2104 |
+
<div class="comment-content">${reply.content}</div>
|
2105 |
+
<div class="comment-time">${reply.created_at}</div>
|
2106 |
+
</div>
|
2107 |
+
</div>
|
2108 |
+
`;
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
// إظهار حقل الرد عند النقر على زر الرد
|
2112 |
+
$(document).on("click", ".reply-btn", function () {
|
2113 |
+
currentCommentId = $(this).data("comment-id");
|
2114 |
+
replyOverlay.css("display", "block");
|
2115 |
+
replyContainer.css("display", "block");
|
2116 |
+
setTimeout(() => {
|
2117 |
+
replyContainer.addClass("active");
|
2118 |
+
}, 10);
|
2119 |
+
});
|
2120 |
+
|
2121 |
+
// إغلاق الرد عند النقر خارج الحاوية
|
2122 |
+
replyOverlay.click(function () {
|
2123 |
+
closeReplyContainer();
|
2124 |
+
});
|
2125 |
+
|
2126 |
+
// إغلاق حاوية الرد
|
2127 |
+
closeReply.click(function () {
|
2128 |
+
closeReplyContainer();
|
2129 |
+
});
|
2130 |
+
|
2131 |
+
// دالة إغلاق حاوية الرد
|
2132 |
+
function closeReplyContainer() {
|
2133 |
+
replyContainer.removeClass("active");
|
2134 |
+
setTimeout(() => {
|
2135 |
+
replyContainer.css("display", "none");
|
2136 |
+
replyOverlay.css("display", "none");
|
2137 |
+
}, 300);
|
2138 |
+
}
|
2139 |
+
|
2140 |
+
// إرسال الرد على تعليق
|
2141 |
+
$(".send-reply-btn").click(function () {
|
2142 |
+
const input = replyContainer.find(".reply-input");
|
2143 |
+
const content = input.val().trim();
|
2144 |
+
|
2145 |
+
if (content && currentPostId && currentCommentId) {
|
2146 |
+
$.ajax({
|
2147 |
+
url: "/add_comment",
|
2148 |
+
method: "POST",
|
2149 |
+
data: {
|
2150 |
+
post_id: currentPostId,
|
2151 |
+
content: content,
|
2152 |
+
parent_id: currentCommentId, // Associate reply with parent
|
2153 |
+
},
|
2154 |
+
success: function (response) {
|
2155 |
+
if (response.success) {
|
2156 |
+
input.val("");
|
2157 |
+
closeReplyContainer();
|
2158 |
+
loadComments(currentPostId);
|
2159 |
+
}
|
2160 |
+
},
|
2161 |
+
});
|
2162 |
+
}
|
2163 |
+
});
|
2164 |
+
|
2165 |
+
// إظهار أو إخفاء الردود عند النقر على زر "12 رداً" أو ما يعادله
|
2166 |
+
$(document).on("click", ".replies-toggle-text", function () {
|
2167 |
+
const toggle = $(this).closest(".replies-toggle");
|
2168 |
+
const repliesContainer = toggle.siblings(".replies-container");
|
2169 |
+
const icon = toggle.find("i");
|
2170 |
+
|
2171 |
+
if (repliesContainer.is(":visible")) {
|
2172 |
+
repliesContainer.slideUp();
|
2173 |
+
icon.removeClass("fa-chevron-up").addClass("fa-chevron-down");
|
2174 |
+
} else {
|
2175 |
+
repliesContainer.slideDown();
|
2176 |
+
icon.removeClass("fa-chevron-down").addClass("fa-chevron-up");
|
2177 |
+
}
|
2178 |
+
});
|
2179 |
+
});
|
2180 |
+
|
2181 |
+
|
2182 |
+
// تفعيل زر إظهار المزيد
|
2183 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2184 |
+
// تحديد النصوص الطويلة وإضافة زر إظهار المزيد
|
2185 |
+
document.querySelectorAll(".post-text").forEach(function ($text) {
|
2186 |
+
const $btn = $text.nextElementSibling;
|
2187 |
+
|
2188 |
+
// التحقق من وجود العنصر التالي (زر إظهار المزيد)
|
2189 |
+
if ($btn && $btn.classList.contains("see-more-btn")) {
|
2190 |
+
// إضافة collapsed class مبدئياً
|
2191 |
+
$text.classList.add("collapsed");
|
2192 |
+
|
2193 |
+
// حساب ارتفاع النص الكامل والنص المقتطع
|
2194 |
+
const originalHeight = $text.scrollHeight;
|
2195 |
+
const lineHeight = parseFloat(
|
2196 |
+
window.getComputedStyle($text).lineHeight
|
2197 |
+
);
|
2198 |
+
const maxHeight = lineHeight * 4; // ارتفاع 4 أسطر
|
2199 |
+
|
2200 |
+
// إظهار الزر فقط إذا كان النص أطول من 4 أسطر
|
2201 |
+
if (originalHeight > maxHeight) {
|
2202 |
+
$btn.style.display = "block";
|
2203 |
+
$btn.textContent = "إظهار المزيد";
|
2204 |
+
} else {
|
2205 |
+
$btn.style.display = "none";
|
2206 |
+
$text.classList.remove("collapsed");
|
2207 |
+
}
|
2208 |
+
}
|
2209 |
+
});
|
2210 |
+
|
2211 |
+
// تفعيل زر إظهار المزيد/أقل
|
2212 |
+
document.querySelectorAll(".see-more-btn").forEach(function ($btn) {
|
2213 |
+
$btn.addEventListener("click", function () {
|
2214 |
+
const $text = this.previousElementSibling;
|
2215 |
+
|
2216 |
+
if ($text.classList.contains("collapsed")) {
|
2217 |
+
$text.classList.remove("collapsed");
|
2218 |
+
$text.classList.add("expanded");
|
2219 |
+
this.textContent = "إظهار أقل";
|
2220 |
+
} else {
|
2221 |
+
$text.classList.remove("expanded");
|
2222 |
+
$text.classList.add("collapsed");
|
2223 |
+
this.textContent = "إظهار المزيد";
|
2224 |
+
}
|
2225 |
+
});
|
2226 |
+
});
|
2227 |
+
|
2228 |
+
// تفعيل قائمة النقاط الثلاث للمنشورات
|
2229 |
+
document.querySelectorAll(".menu-dots").forEach(function ($dots) {
|
2230 |
+
$dots.addEventListener("click", function (e) {
|
2231 |
+
e.stopPropagation();
|
2232 |
+
const $menu = this.nextElementSibling;
|
2233 |
+
$(".menu-options").not($menu).hide();
|
2234 |
+
$menu.style.display =
|
2235 |
+
$menu.style.display === "block" ? "none" : "block";
|
2236 |
+
});
|
2237 |
+
});
|
2238 |
+
|
2239 |
+
// إغلاق قوائم المنشورات عند النقر في أي مكان آخر
|
2240 |
+
document.addEventListener("click", function () {
|
2241 |
+
document.querySelectorAll(".menu-options").forEach(function ($menu) {
|
2242 |
+
$menu.style.display = "none";
|
2243 |
+
});
|
2244 |
+
});
|
2245 |
+
|
2246 |
+
// منع إغلاق القائمة عند النقر داخلها
|
2247 |
+
document.querySelectorAll(".menu-options").forEach(function ($menu) {
|
2248 |
+
$menu.addEventListener("click", function (e) {
|
2249 |
+
e.stopPropagation();
|
2250 |
+
});
|
2251 |
+
});
|
2252 |
+
|
2253 |
+
|
2254 |
+
|
2255 |
+
|
2256 |
+
|
2257 |
+
|
2258 |
+
// دالة لإغلاق modal
|
2259 |
+
function closePostModal() {
|
2260 |
+
const postModal = document.getElementById("postViewModal");
|
2261 |
+
console.log("hi")
|
2262 |
+
// إغلاق modal
|
2263 |
+
postModal.style.display = "none";
|
2264 |
+
document.body.style.overflow = "auto"; // إعادة تمكين التمرير
|
2265 |
+
}
|
2266 |
+
|
2267 |
+
// إضافة أحداث لإغلاق modal
|
2268 |
+
document.querySelector(".close-modal").addEventListener("click", closePostModal);
|
2269 |
+
document.querySelector(".modal-overlay").addEventListener("click", closePostModal);
|
2270 |
+
|
2271 |
+
|
2272 |
+
|
2273 |
+
|
2274 |
+
|
2275 |
+
|
2276 |
+
|
2277 |
+
|
2278 |
+
// تفعيل زر تعديل المنشور
|
2279 |
+
document.querySelectorAll(".edit-post").forEach(function ($editBtn) {
|
2280 |
+
$editBtn.addEventListener("click", function () {
|
2281 |
+
const postId = this.dataset.postId;
|
2282 |
+
const $postCard = this.closest(".post-card");
|
2283 |
+
const $postText = postCard.querySelector(".post-text");
|
2284 |
+
const currentContent = $postText.textContent.trim();
|
2285 |
+
|
2286 |
+
// إنشاء مربع حوار للتعديل
|
2287 |
+
const newContent = prompt("تعديل المنشور:", currentContent);
|
2288 |
+
|
2289 |
+
if (newContent !== null && newContent !== currentContent) {
|
2290 |
+
// إرسال طلب التعديل
|
2291 |
+
fetch("/edit_post_content", {
|
2292 |
+
method: "POST",
|
2293 |
+
headers: {
|
2294 |
+
"Content-Type": "application/x-www-form-urlencoded",
|
2295 |
+
},
|
2296 |
+
body: `post_id=${postId}&new_content=${encodeURIComponent(
|
2297 |
+
newContent
|
2298 |
+
)}`,
|
2299 |
+
})
|
2300 |
+
.then((response) => response.json())
|
2301 |
+
.then((data) => {
|
2302 |
+
if (data.success) {
|
2303 |
+
location.reload();
|
2304 |
+
}
|
2305 |
+
});
|
2306 |
+
}
|
2307 |
+
});
|
2308 |
+
});
|
2309 |
+
|
2310 |
+
// تفعيل زر حذف المنشور
|
2311 |
+
document
|
2312 |
+
.querySelectorAll(".delete-post")
|
2313 |
+
.forEach(function ($deleteBtn) {
|
2314 |
+
$deleteBtn.addEventListener("click", function () {
|
2315 |
+
const postId = this.dataset.postId;
|
2316 |
+
|
2317 |
+
// عرض الموديل بدلاً من confirm
|
2318 |
+
const deleteModal = document.getElementById("deleteModal");
|
2319 |
+
deleteModal.style.display = "block"; // عرض الموديل
|
2320 |
+
|
2321 |
+
// حدث عند الضغط على زر الحذف
|
2322 |
+
const confirmDeleteBtn = document.getElementById("confirmDeleteBtn");
|
2323 |
+
confirmDeleteBtn.onclick = function () {
|
2324 |
+
fetch("/delete_post", {
|
2325 |
+
method: "POST",
|
2326 |
+
headers: {
|
2327 |
+
"Content-Type": "application/x-www-form-urlencoded",
|
2328 |
+
},
|
2329 |
+
body: `post_id=${postId}`,
|
2330 |
+
})
|
2331 |
+
.then((response) => response.json())
|
2332 |
+
.then((data) => {
|
2333 |
+
if (data.success) {
|
2334 |
+
location.reload(); // إعادة تحميل الصفحة بعد الحذف
|
2335 |
+
}
|
2336 |
+
});
|
2337 |
+
deleteModal.style.display = "none"; // إغلاق الموديل بعد الحذف
|
2338 |
+
};
|
2339 |
+
|
2340 |
+
// حدث عند الضغط على زر الإلغاء
|
2341 |
+
const cancelDeleteBtn = document.getElementById("cancelDeleteBtn");
|
2342 |
+
cancelDeleteBtn.onclick = function () {
|
2343 |
+
deleteModal.style.display = "none"; // إغلاق الموديل دون حذف
|
2344 |
+
};
|
2345 |
+
});
|
2346 |
+
});
|
2347 |
+
|
2348 |
+
});
|
2349 |
+
|
2350 |
+
// تفعيل زر تعديل المنشور في modal
|
2351 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2352 |
+
const editPostBtn = document.querySelector("#postViewModal .edit-post");
|
2353 |
+
|
2354 |
+
if (editPostBtn) {
|
2355 |
+
editPostBtn.addEventListener("click", function () {
|
2356 |
+
const postId = this.dataset.postId;
|
2357 |
+
const postText = document.querySelector("#postViewModal .post-text");
|
2358 |
+
const editModal = document.getElementById("editModal");
|
2359 |
+
const editContentInput = document.getElementById("editContentInput");
|
2360 |
+
|
2361 |
+
editModal.style.display = "block";
|
2362 |
+
editContentInput.value = postText.textContent.trim();
|
2363 |
+
|
2364 |
+
// إضافة أحداث لإغلاق modal
|
2365 |
+
const cancelEditBtn = document.getElementById("cancelEditBtn");
|
2366 |
+
cancelEditBtn.addEventListener("click", function () {
|
2367 |
+
editModal.style.display = "none";
|
2368 |
+
});
|
2369 |
+
|
2370 |
+
// إضافة أحداث لحفظ التغييرات
|
2371 |
+
const saveEditBtn = document.getElementById("saveEditBtn");
|
2372 |
+
saveEditBtn.addEventListener("click", function () {
|
2373 |
+
const newContent = editContentInput.value.trim();
|
2374 |
+
|
2375 |
+
if (newContent !== postText.textContent.trim()) {
|
2376 |
+
fetch("/edit_post_content", {
|
2377 |
+
method: "POST",
|
2378 |
+
headers: {
|
2379 |
+
"Content-Type": "application/x-www-form-urlencoded",
|
2380 |
+
},
|
2381 |
+
body: `post_id=${postId}&new_content=${encodeURIComponent(newContent)}`,
|
2382 |
+
})
|
2383 |
+
.then((response) => response.json())
|
2384 |
+
.then((data) => {
|
2385 |
+
if (data.success) {
|
2386 |
+
location.reload();
|
2387 |
+
}
|
2388 |
+
});
|
2389 |
+
}
|
2390 |
+
|
2391 |
+
editModal.style.display = "none";
|
2392 |
+
});
|
2393 |
+
});
|
2394 |
+
}
|
2395 |
+
});
|
2396 |
+
|
2397 |
+
// إضافة حدث لإغلاق الموديل عند الضغط على الزر الذي يحمل الكلاس 'close-modal'
|
2398 |
+
document.querySelectorAll(".close-modal").forEach(function ($closeBtn) {
|
2399 |
+
$closeBtn.addEventListener("click", function () {
|
2400 |
+
// إخفاء الموديل عن طريق تعيين display: none
|
2401 |
+
const postViewModal = document.getElementById("postViewModal");
|
2402 |
+
postViewModal.style.display = "none";
|
2403 |
+
|
2404 |
+
// إزالة جزء الرابط الحالي (مثل post/6) دون إعادة تحميل الصفحة
|
2405 |
+
const currentUrl = window.location.href; // الحصول على الرابط الحالي
|
2406 |
+
const baseUrl = currentUrl.split("/post/")[0]; // إزالة جزء post/6 من الرابط
|
2407 |
+
history.pushState(null, "", baseUrl); // تحديث الرابط في شريط العنوان
|
2408 |
+
});
|
2409 |
+
});
|
2410 |
+
|
2411 |
+
|
2412 |
+
|
2413 |
+
document.addEventListener("DOMContentLoaded", function () {
|
2414 |
+
document.querySelectorAll(".share-btn").forEach(function (button) {
|
2415 |
+
button.addEventListener("click", function () {
|
2416 |
+
const postId = this.dataset.postId;
|
2417 |
+
const shareUrl = `${window.location.origin}/post/${postId}`;
|
2418 |
+
|
2419 |
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
2420 |
+
navigator.clipboard.writeText(shareUrl).then(function () {
|
2421 |
+
showPopup("تم نسخ الرابط");
|
2422 |
+
}).catch(function (err) {
|
2423 |
+
console.error("فشل نسخ الرابط: ", err);
|
2424 |
+
});
|
2425 |
+
} else {
|
2426 |
+
const tempInput = document.createElement("input");
|
2427 |
+
tempInput.value = shareUrl;
|
2428 |
+
document.body.appendChild(tempInput);
|
2429 |
+
tempInput.select();
|
2430 |
+
try {
|
2431 |
+
document.execCommand("copy");
|
2432 |
+
showPopup("تم نسخ الرابط ");
|
2433 |
+
} catch (err) {
|
2434 |
+
console.error("فشل نسخ الرابط باستخدام الطريقة البديلة: ", err);
|
2435 |
+
}
|
2436 |
+
document.body.removeChild(tempInput);
|
2437 |
+
}
|
2438 |
+
|
2439 |
+
function showPopup(message) {
|
2440 |
+
const modal = document.createElement("div");
|
2441 |
+
modal.style.position = "fixed";
|
2442 |
+
modal.style.bottom = "20%";
|
2443 |
+
modal.style.left = "50%";
|
2444 |
+
modal.style.transform = "translateX(-50%)";
|
2445 |
+
modal.style.backgroundColor = "#333";
|
2446 |
+
modal.style.color = "#fff";
|
2447 |
+
modal.style.padding = "15px 20px";
|
2448 |
+
modal.style.borderRadius = "8px";
|
2449 |
+
modal.style.boxShadow = "0 4px 6px rgba(0, 0, 0, 0.1)";
|
2450 |
+
modal.style.opacity = "0";
|
2451 |
+
modal.style.transition = "opacity 0.4s ease, bottom 0.4s ease";
|
2452 |
+
modal.style.zIndex = "1000";
|
2453 |
+
modal.textContent = message;
|
2454 |
+
|
2455 |
+
document.body.appendChild(modal);
|
2456 |
+
|
2457 |
+
setTimeout(() => {
|
2458 |
+
modal.style.opacity = "1";
|
2459 |
+
modal.style.bottom = "25%";
|
2460 |
+
}, 10);
|
2461 |
+
|
2462 |
+
setTimeout(() => {
|
2463 |
+
modal.style.opacity = "0";
|
2464 |
+
modal.style.bottom = "20%";
|
2465 |
+
setTimeout(() => {
|
2466 |
+
modal.remove();
|
2467 |
+
}, 400);
|
2468 |
+
}, 3000);
|
2469 |
+
}
|
2470 |
+
});
|
2471 |
+
});
|
2472 |
+
});
|
2473 |
+
|
2474 |
+
document.addEventListener('DOMContentLoaded', function () {
|
2475 |
+
const notificationBtn = document.getElementById('notification-btn');
|
2476 |
+
const notificationCount = document.getElementById('notification-count');
|
2477 |
+
const notificationList = document.getElementById('notification-list');
|
2478 |
+
|
2479 |
+
let eventSource; // تعريف متغير EventSource خارج الوظيفة
|
2480 |
+
|
2481 |
+
// تحميل عدد الرسائل غير المقروءة
|
2482 |
+
function loadUnreadCount() {
|
2483 |
+
fetch('/get_unread_count')
|
2484 |
+
.then(response => response.json())
|
2485 |
+
.then(data => {
|
2486 |
+
notificationCount.textContent = data.unread_count; // تحديث العداد
|
2487 |
+
})
|
2488 |
+
.catch(error => console.error('Error loading unread count:', error));
|
2489 |
+
}
|
2490 |
+
// تحميل الإشعارات
|
2491 |
+
function loadNotifications() {
|
2492 |
+
fetch('/get_notifications')
|
2493 |
+
.then(response => response.json())
|
2494 |
+
.then(notifications => {
|
2495 |
+
notificationList.innerHTML = ''; // تفريغ القائمة القديمة
|
2496 |
+
|
2497 |
+
// فلترة الإشعارات غير المقروءة فقط
|
2498 |
+
const unreadNotifications = notifications.filter(notification =>
|
2499 |
+
(notification.is_received && !notification.watched_by_receiver) ||
|
2500 |
+
(!notification.is_received && !notification.watched_by_sender)
|
2501 |
+
);
|
2502 |
+
|
2503 |
+
// إذا كانت القائمة فارغة
|
2504 |
+
if (unreadNotifications.length === 0) {
|
2505 |
+
notificationList.innerHTML = '<div class="no-notifications">لا توجد إشعارات جديدة</div>';
|
2506 |
+
} else {
|
2507 |
+
unreadNotifications.forEach(notification => {
|
2508 |
+
const item = document.createElement('div');
|
2509 |
+
item.className = 'notification-item';
|
2510 |
+
item.dataset.messageId = notification.id;
|
2511 |
+
|
2512 |
+
const user = notification.is_received ? notification.sender_name : notification.receiver_name;
|
2513 |
+
const userPhoto = notification.is_received ? notification.sender_photo : notification.receiver_photo;
|
2514 |
+
const userEmail = notification.is_received ? notification.sender_email : notification.receiver_email;
|
2515 |
+
|
2516 |
+
// تحديد المحتوى مع الإيموجي حسب نوع الملف
|
2517 |
+
let contentPreview = '';
|
2518 |
+
if (notification.file_type === 'image') {
|
2519 |
+
contentPreview = '🖼️ صورة';
|
2520 |
+
} else if (notification.file_type === 'video') {
|
2521 |
+
contentPreview = '🎥 فيديو';
|
2522 |
+
} else {
|
2523 |
+
contentPreview = notification.content; // النص العادي
|
2524 |
+
}
|
2525 |
+
|
2526 |
+
item.innerHTML = `
|
2527 |
+
<img src="${userPhoto}" alt="${user}" class="sender-photo" data-user-email="${userEmail}">
|
2528 |
+
<div>
|
2529 |
+
<strong>${user}</strong>
|
2530 |
+
<p>${contentPreview}</p>
|
2531 |
+
<small>${notification.created_at}</small>
|
2532 |
+
</div>
|
2533 |
+
`;
|
2534 |
+
|
2535 |
+
notificationList.appendChild(item);
|
2536 |
+
});
|
2537 |
+
}
|
2538 |
+
|
2539 |
+
// إضافة حدث النقر على الصور
|
2540 |
+
document.querySelectorAll('.sender-photo').forEach(img => {
|
2541 |
+
img.addEventListener('click', function (event) {
|
2542 |
+
event.stopPropagation(); // منع انتشار الحدث إلى العنصر الأب
|
2543 |
+
const userEmail = this.dataset.userEmail; // الحصول على البريد الإلكتروني للمستخدم
|
2544 |
+
|
2545 |
+
if (userEmail) {
|
2546 |
+
// فتح الرابط داخل iframe
|
2547 |
+
const chatFrame = document.querySelector('#chatFrame');
|
2548 |
+
if (chatFrame) {
|
2549 |
+
chatFrame.src = `/messages/${userEmail}`; // تحميل الصفحة داخل iframe
|
2550 |
+
chatFrame.style.display = 'block'; // إظهار iframe
|
2551 |
+
const closeChatFrameButton = document.querySelector('#closeChatFrame');
|
2552 |
+
if (closeChatFrameButton) {
|
2553 |
+
closeChatFrameButton.style.display = 'block'; // إظهار زر الإغلاق
|
2554 |
+
}
|
2555 |
+
document.body.style.overflow = 'hidden'; // منع التمرير في الصفحة الرئيسية
|
2556 |
+
|
2557 |
+
// تفعيل دالة join_chat
|
2558 |
+
fetch('/join_chat', {
|
2559 |
+
method: 'POST',
|
2560 |
+
headers: {
|
2561 |
+
'Content-Type': 'application/json',
|
2562 |
+
},
|
2563 |
+
body: JSON.stringify({}),
|
2564 |
+
})
|
2565 |
+
.then(response => response.json())
|
2566 |
+
.then(data => {
|
2567 |
+
if (data.success) {
|
2568 |
+
console.log('User joined the chat successfully');
|
2569 |
+
} else {
|
2570 |
+
console.error('Failed to join the chat');
|
2571 |
+
}
|
2572 |
+
})
|
2573 |
+
.catch(error => console.error('Error joining chat:', error));
|
2574 |
+
} else {
|
2575 |
+
console.error('iframe not found');
|
2576 |
+
}
|
2577 |
+
} else {
|
2578 |
+
console.error('User email is undefined');
|
2579 |
+
}
|
2580 |
+
});
|
2581 |
+
});
|
2582 |
+
})
|
2583 |
+
.catch(error => console.error('Error loading notifications:', error));
|
2584 |
+
}
|
2585 |
+
|
2586 |
+
// تحديث جميع الرسائل غير المقروءة إلى "مقروءة"
|
2587 |
+
function markAllAsRead() {
|
2588 |
+
fetch('/mark_all_as_read', {
|
2589 |
+
method: 'POST',
|
2590 |
+
headers: {
|
2591 |
+
'Content-Type': 'application/json',
|
2592 |
+
},
|
2593 |
+
})
|
2594 |
+
.then(response => response.json())
|
2595 |
+
.then(data => {
|
2596 |
+
if (data.success) {
|
2597 |
+
loadNotifications(); // إعادة تحميل الإشعارات بعد التحديث
|
2598 |
+
loadUnreadCount(); // تحديث عدد الرسائل غير المقروءة
|
2599 |
+
}
|
2600 |
+
})
|
2601 |
+
.catch(error => console.error('Error marking all as read:', error));
|
2602 |
+
}
|
2603 |
+
|
2604 |
+
// عرض/إخفاء قائمة الإشعارات
|
2605 |
+
notificationBtn.addEventListener('click', function () {
|
2606 |
+
// التحقق من حالة عرض القائمة
|
2607 |
+
if (notificationList.style.display === 'none' || notificationList.style.display === '') {
|
2608 |
+
notificationList.style.display = 'block'; // عرض قائمة الإشعارات
|
2609 |
+
|
2610 |
+
// تحميل الإشعارات عند الضغط الأول
|
2611 |
+
loadNotifications(); // تحميل الإشعارات
|
2612 |
+
markAllAsRead(); // تحديث جميع الرسائل غير المقروءة إلى "مقروءة"
|
2613 |
+
} else {
|
2614 |
+
notificationList.style.display = 'none'; // إخفاء قائمة الإشعارات
|
2615 |
+
}
|
2616 |
+
});
|
2617 |
+
|
2618 |
+
// عند النقر على إشعار
|
2619 |
+
notificationList.addEventListener('click', function (event) {
|
2620 |
+
const notificationItem = event.target.closest('.notification-item');
|
2621 |
+
if (notificationItem) {
|
2622 |
+
const messageId = notificationItem.dataset.messageId;
|
2623 |
+
|
2624 |
+
// تحديث حالة الرسالة إلى "مقروءة"
|
2625 |
+
fetch(`/mark_as_read/${messageId}`)
|
2626 |
+
.then(() => {
|
2627 |
+
// إعادة تحميل الإشعارات بعد تحديث حالة الرسالة
|
2628 |
+
loadNotifications();
|
2629 |
+
loadUnreadCount(); // تحديث عدد الرسائل غير المقروءة
|
2630 |
+
})
|
2631 |
+
.catch(error => console.error('Error marking message as read:', error));
|
2632 |
+
}
|
2633 |
+
});
|
2634 |
+
|
2635 |
+
|
2636 |
+
// الاستماع إلى التحديثات الفورية لعدد الرسائل غير المق��وءة
|
2637 |
+
eventSource = new EventSource('/stream_unread_count');
|
2638 |
+
eventSource.onmessage = function (event) {
|
2639 |
+
// التحقق مما إذا كان المستخدم الحالي في صفحة messages.html
|
2640 |
+
const isInChatPage = window.location.pathname.startsWith('/messages/');
|
2641 |
+
|
2642 |
+
// تحديث العداد فقط إذا لم يكن في صفحة messages.html
|
2643 |
+
if (!isInChatPage) {
|
2644 |
+
const data = JSON.parse(event.data);
|
2645 |
+
notificationCount.textContent = data.unread_count; // تحديث العداد
|
2646 |
+
}
|
2647 |
+
};
|
2648 |
+
|
2649 |
+
// إغلاق EventSource عند مغادرة المستخدم للصفحة
|
2650 |
+
window.addEventListener('beforeunload', function () {
|
2651 |
+
if (eventSource) {
|
2652 |
+
eventSource.close();
|
2653 |
+
}
|
2654 |
+
});
|
2655 |
+
|
2656 |
+
// تحميل عدد الرسائل غير المقروءة عند فتح الصفحة
|
2657 |
+
loadUnreadCount();
|
2658 |
+
});
|
2659 |
+
|
2660 |
+
|
2661 |
+
// تحديد عناصر DOM
|
2662 |
+
const chatButton = document.querySelector('.chat-button');
|
2663 |
+
const chatWindow = document.querySelector('#chatWindow');
|
2664 |
+
let closeManiChat = document.querySelector(".close-main-chat")
|
2665 |
+
|
2666 |
+
const chatList = document.querySelector('#chatList');
|
2667 |
+
const chatFrame = document.querySelector('#chatFrame'); // الإشارة إلى iframe
|
2668 |
+
const closeChatFrameButton = document.querySelector('#closeChatFrame'); // الزر لإغلاق الـ iframe
|
2669 |
+
|
2670 |
+
// إظهار/إخفاء نافذة الشات عند الضغط على الزر
|
2671 |
+
chatButton.addEventListener('click', () => {
|
2672 |
+
|
2673 |
+
chatWindow.style.display = chatWindow.style.display === 'none' || chatWindow.style.display === '' ? 'block' : 'none';
|
2674 |
+
if (chatWindow.style.display === 'block') {
|
2675 |
+
loadChatList(); // تحميل قائمة الشات عند الفتح
|
2676 |
+
}
|
2677 |
+
});
|
2678 |
+
function loadChatList() {
|
2679 |
+
fetch('/getchat') // الاتصال بـ API الذي أنشأناه
|
2680 |
+
.then(response => response.json())
|
2681 |
+
.then(chats => {
|
2682 |
+
console.log(chats);
|
2683 |
+
chatList.innerHTML = ''; // تفريغ القائمة القديمة
|
2684 |
+
|
2685 |
+
if (chats.length === 0) {
|
2686 |
+
chatList.innerHTML = '<div class="no-chats">لا توجد محادثات</div>';
|
2687 |
+
return;
|
2688 |
+
}
|
2689 |
+
|
2690 |
+
// إضافة العناصر إلى القائمة
|
2691 |
+
chats.forEach(chat => {
|
2692 |
+
const chatItem = document.createElement('div');
|
2693 |
+
chatItem.className = 'chat-item';
|
2694 |
+
chatItem.dataset.userEmail = chat.user_email;
|
2695 |
+
|
2696 |
+
// تحديد نص الرسالة بناءً على المحتوى
|
2697 |
+
let lastMessageHtml = '';
|
2698 |
+
let messagePrefix = chat.is_sender ? 'انت :' : ``;
|
2699 |
+
|
2700 |
+
if (chat.message_type === 'text') {
|
2701 |
+
lastMessageHtml = `<p>${messagePrefix} ${chat.last_message}</p>`; // عرض النص
|
2702 |
+
}
|
2703 |
+
else if (chat.message_type === 'image') {
|
2704 |
+
lastMessageHtml = `<span class="emoji-image">🖼️</span>`; // إيموجي صورة
|
2705 |
+
}
|
2706 |
+
else if (chat.message_type === 'video') {
|
2707 |
+
lastMessageHtml = `<span class="emoji-video">📹</span>`; // إيموجي فيديو
|
2708 |
+
}
|
2709 |
+
else if (chat.message_type === 'audio') {
|
2710 |
+
lastMessageHtml = `<span class="emoji-audio">🎵</span>`; // إيموجي صوت
|
2711 |
+
}
|
2712 |
+
|
2713 |
+
// إضافة عدد الرسائل غير المقروءة إذا كان أكبر من 0
|
2714 |
+
let unreadCountHtml = '';
|
2715 |
+
if (chat.unread_count >= 2) {
|
2716 |
+
unreadCountHtml = `<span class="unread-count">${chat.unread_count}</span>`;
|
2717 |
+
}
|
2718 |
+
|
2719 |
+
chatItem.innerHTML = `
|
2720 |
+
<img src="${chat.user_photo}" alt="${chat.user_name}">
|
2721 |
+
<div>
|
2722 |
+
<strong>${chat.user_name}</strong>
|
2723 |
+
<div>${lastMessageHtml}</div> <!-- عرض المحتوى داخل div -->
|
2724 |
+
<small>${chat.last_updated}</small>
|
2725 |
+
</div>
|
2726 |
+
${unreadCountHtml} <!-- عرض عدد الرسائل غير المقروءة إذا كان أكبر من أو يساوي 2 -->
|
2727 |
+
`;
|
2728 |
+
|
2729 |
+
// حدث النقر لفتح نافذة الشات داخل iframe
|
2730 |
+
chatItem.addEventListener('click', () => {
|
2731 |
+
// تغيير مصدر iframe إلى صفحة الرسائل الخاصة بالمستخدم
|
2732 |
+
chatFrame.src = `/messages/${chatItem.dataset.userEmail}`;
|
2733 |
+
chatFrame.style.display = 'block'; // عرض الـ iframe
|
2734 |
+
chatWindow.style.display = 'none'; // إخفاء نافذة الشات
|
2735 |
+
const closeChatFrameButton = document.querySelector('#closeChatFrame');
|
2736 |
+
closeChatFrameButton.style.display = 'block'; // إظهار زر الإغلاق
|
2737 |
+
document.body.style.overflow = 'hidden'; // منع التمرير في الصفحة الرئيسية
|
2738 |
+
});
|
2739 |
+
|
2740 |
+
chatList.appendChild(chatItem);
|
2741 |
+
});
|
2742 |
+
})
|
2743 |
+
.catch(error => console.error('Error loading chat list:', error));
|
2744 |
+
}
|
2745 |
+
|
2746 |
+
|
2747 |
+
document.addEventListener('DOMContentLoaded', () => {
|
2748 |
+
// الآن يمكن إضافة listeners بعد تحميل جميع العناصر
|
2749 |
+
const closeChatFrameButton = document.querySelector('#closeChatFrame');
|
2750 |
+
const chatFrame = document.querySelector('#chatFrame'); // الحصول على iframe
|
2751 |
+
|
2752 |
+
if (closeChatFrameButton && chatFrame) {
|
2753 |
+
closeChatFrameButton.addEventListener('click', () => {
|
2754 |
+
chatFrame.style.display = 'none'; // إخفاء الـ iframe
|
2755 |
+
chatFrame.src = ''; // إزالة src من iframe
|
2756 |
+
closeChatFrameButton.style.display = 'none'; // إخفاء زر الإغلاق
|
2757 |
+
chatWindow.style.display = 'block'; // إعادة عرض نافذة الشات
|
2758 |
+
document.body.style.overflow = 'auto'; // إعادة التمرير في الصفحة الرئيسية
|
2759 |
+
loadChatList()
|
2760 |
+
// تفعيل دالة leave_chat
|
2761 |
+
fetch('/leave_chat', {
|
2762 |
+
method: 'POST',
|
2763 |
+
headers: {
|
2764 |
+
'Content-Type': 'application/json',
|
2765 |
+
},
|
2766 |
+
body: JSON.stringify({}),
|
2767 |
+
})
|
2768 |
+
.then(response => response.json())
|
2769 |
+
.then(data => {
|
2770 |
+
if (data.success) {
|
2771 |
+
console.log('User left the chat successfully');
|
2772 |
+
} else {
|
2773 |
+
console.error('Failed to leave the chat');
|
2774 |
+
}
|
2775 |
+
})
|
2776 |
+
.catch(error => console.error('Error leaving chat:', error));
|
2777 |
+
});
|
2778 |
+
}
|
2779 |
+
});
|
2780 |
+
|
2781 |
+
|
2782 |
+
|
2783 |
+
closeManiChat.addEventListener("click" , () =>{
|
2784 |
+
chatWindow.style.display = 'none'; // إخفاء الـ iframe
|
2785 |
+
})
|
2786 |
+
|
2787 |
+
|
2788 |
+
|
2789 |
+
|
2790 |
+
// فتح الموديل عند الضغط على زر البحث
|
2791 |
+
const openModalBtn = document.getElementById('openSearchModalBtn');
|
2792 |
+
const closeModalBtn = document.getElementById('closeSearchModalBtn');
|
2793 |
+
const searchModal = document.getElementById('searchModal');
|
2794 |
+
|
2795 |
+
// عند الضغط على زر "بحث عن مستخدم"، يتم فتح الموديل
|
2796 |
+
openModalBtn.onclick = function() {
|
2797 |
+
searchModal.style.display = 'block';
|
2798 |
+
}
|
2799 |
+
|
2800 |
+
// عند الضغط على "×" يتم إغلاق الموديل
|
2801 |
+
closeModalBtn.onclick = function() {
|
2802 |
+
searchModal.style.display = 'none';
|
2803 |
+
}
|
2804 |
+
|
2805 |
+
|
2806 |
+
// وظيفة البحث التلقائي
|
2807 |
+
function searchUsers() {
|
2808 |
+
const searchQuery = document.getElementById('searchInput').value;
|
2809 |
+
if (searchQuery.length > 0) {
|
2810 |
+
// إرسال استعلام AJAX إلى السيرفر
|
2811 |
+
fetch(`/search_users?q=${searchQuery}`)
|
2812 |
+
.then(response => response.json())
|
2813 |
+
.then(data => {
|
2814 |
+
// عرض النتائج
|
2815 |
+
const resultsContainer = document.getElementById('searchResults');
|
2816 |
+
resultsContainer.innerHTML = ''; // مسح النتائج القديمة
|
2817 |
+
if (data.length > 0) {
|
2818 |
+
data.forEach(user => {
|
2819 |
+
const userDiv = document.createElement('div');
|
2820 |
+
userDiv.classList.add('search-result');
|
2821 |
+
userDiv.innerHTML = `
|
2822 |
+
<img src="static/${user.profile_photo}" alt="Profile Image" class="profile-img" />
|
2823 |
+
<span>${user.username}</span>
|
2824 |
+
`;
|
2825 |
+
// إزالة المسافات من اسم المستخدم
|
2826 |
+
const userEmail = user.username.replace(/\s+/g, '') + "@moltka.eg"; // إزالة المسافات
|
2827 |
+
|
2828 |
+
// إضافة مستمع حدث على العنصر بأكمله لفتح الملف الشخصي داخل الـ iframe
|
2829 |
+
userDiv.addEventListener('click', function(event) {
|
2830 |
+
event.preventDefault(); // منع الانتقال إلى الصفحة الجديدة
|
2831 |
+
openPublicProfile(`/profile/${userEmail}`); // فتح الملف الشخصي داخل الـ iframe
|
2832 |
+
});
|
2833 |
+
|
2834 |
+
resultsContainer.appendChild(userDiv);
|
2835 |
+
});
|
2836 |
+
} else {
|
2837 |
+
resultsContainer.innerHTML = '<span>لا توجد نتائج</span>';
|
2838 |
+
}
|
2839 |
+
});
|
2840 |
+
} else {
|
2841 |
+
document.getElementById('searchResults').innerHTML = '';
|
2842 |
+
}
|
2843 |
+
}
|
2844 |
+
|
2845 |
+
// دالة لفتح الملف الشخصي داخل iframe
|
2846 |
+
function openProfile() {
|
2847 |
+
var container = document.getElementById('profile-container');
|
2848 |
+
var iframe = document.getElementById('profile-iframe');
|
2849 |
+
|
2850 |
+
if (container && iframe) {
|
2851 |
+
// إظهار الحاوية
|
2852 |
+
container.style.display = 'block';
|
2853 |
+
container.classList.remove('hide'); // إزالة فئة الإخفاء
|
2854 |
+
container.classList.add('show'); // إضافة فئة العرض
|
2855 |
+
|
2856 |
+
// تحميل صفحة الملف الشخصي داخل الـ iframe
|
2857 |
+
iframe.src = "{{ url_for('profile') }}";
|
2858 |
+
|
2859 |
+
// منع التمرير في الصفحة الرئيسية
|
2860 |
+
document.body.style.overflow = 'hidden';
|
2861 |
+
}
|
2862 |
+
}
|
2863 |
+
|
2864 |
+
// دالة لإغلاق الملف الشخصي
|
2865 |
+
function closeProfile() {
|
2866 |
+
var container = document.getElementById('profile-container');
|
2867 |
+
if (container) {
|
2868 |
+
// إضافة كلاس hide لتشغيل أنيميشن الإغلاق
|
2869 |
+
container.classList.remove('show'); // إزالة فئة العرض
|
2870 |
+
container.classList.add('hide'); // إضافة فئة الإخفاء
|
2871 |
+
|
2872 |
+
// الانتظار حتى يكتمل الأنيميشن قبل إخفاء العنصر
|
2873 |
+
setTimeout(function() {
|
2874 |
+
container.style.display = 'none';
|
2875 |
+
|
2876 |
+
// إعادة التمرير في الصفحة الرئيسية
|
2877 |
+
document.body.style.overflow = 'auto';
|
2878 |
+
}, 300); // الانتظار لمدة 0.5 ثانية (مدة الأنيميشن)
|
2879 |
+
}
|
2880 |
+
}
|
2881 |
+
|
2882 |
+
// إضافة مستمع الحدث لزر الإغلاق
|
2883 |
+
var closeBtn = document.getElementById("close-profile-btn");
|
2884 |
+
if (closeBtn) {
|
2885 |
+
closeBtn.addEventListener("click", function () {
|
2886 |
+
console.log("تم النقر على زر الإغلاق");
|
2887 |
+
closeProfile(); // استدعاء دالة الإغلاق
|
2888 |
+
});
|
2889 |
+
}
|
2890 |
+
|
2891 |
+
// إضافة مستمع حدث لرابط الملف الشخصي
|
2892 |
+
var profileLink = document.getElementById("profile-link");
|
2893 |
+
if (profileLink) {
|
2894 |
+
profileLink.addEventListener('click', function(event) {
|
2895 |
+
event.preventDefault(); // منع الانتقال إلى الصفحة الجديدة
|
2896 |
+
openProfile(); // فتح الملف الشخصي داخل الـ iframe
|
2897 |
+
});
|
2898 |
+
}
|
2899 |
+
|
2900 |
+
|
2901 |
+
// دالة لفتح الملف الشخصي العام داخل iframe
|
2902 |
+
function openPublicProfile(url) {
|
2903 |
+
var container = document.getElementById('public-profile-container');
|
2904 |
+
var iframe = document.getElementById('public-profile-iframe');
|
2905 |
+
|
2906 |
+
if (container && iframe) {
|
2907 |
+
// إظهار الحاوية
|
2908 |
+
container.style.display = 'block';
|
2909 |
+
container.classList.remove('hide'); // إزالة فئة الإخفاء
|
2910 |
+
container.classList.add('show'); // إضافة فئة العرض
|
2911 |
+
|
2912 |
+
// تحميل صفحة الملف الشخصي العام داخل الـ iframe
|
2913 |
+
iframe.src = url;
|
2914 |
+
|
2915 |
+
// منع التمرير في الصفحة الرئيسية
|
2916 |
+
document.body.style.overflow = 'hidden';
|
2917 |
+
}
|
2918 |
+
}
|
2919 |
+
|
2920 |
+
// دالة لإغلاق الملف الشخصي العام
|
2921 |
+
function closePublicProfile() {
|
2922 |
+
var container = document.getElementById('public-profile-container');
|
2923 |
+
if (container) {
|
2924 |
+
// إضافة كلاس hide لتشغيل أنيميشن الإغلاق
|
2925 |
+
container.classList.remove('show'); // إزالة فئة العرض
|
2926 |
+
container.classList.add('hide'); // إضافة فئة الإخفاء
|
2927 |
+
|
2928 |
+
// الانتظار حتى يكتمل الأنيميشن قبل إخفاء العنصر
|
2929 |
+
setTimeout(function() {
|
2930 |
+
container.style.display = 'none';
|
2931 |
+
|
2932 |
+
// إعادة التمرير في الصفحة الرئيسية
|
2933 |
+
document.body.style.overflow = 'auto';
|
2934 |
+
}, 300); // الانتظار لمدة 0.5 ثانية (مدة الأنيميشن)
|
2935 |
+
}
|
2936 |
+
}
|
2937 |
+
|
2938 |
+
// إضافة مستمع الحدث لزر الإغلاق
|
2939 |
+
var closeBtn = document.getElementById("close-public-profile-btn");
|
2940 |
+
if (closeBtn) {
|
2941 |
+
closeBtn.addEventListener("click", function () {
|
2942 |
+
console.log("تم النقر على زر الإغلاق");
|
2943 |
+
closePublicProfile(); // استدعاء دالة الإغلاق
|
2944 |
+
});
|
2945 |
+
}
|
2946 |
+
|
2947 |
+
// إضافة مستمع حدث للروابط التي تفتح داخل الـ iframe
|
2948 |
+
document.querySelectorAll('.public-profile-link').forEach(function(link) {
|
2949 |
+
link.addEventListener('click', function(event) {
|
2950 |
+
event.preventDefault(); // منع الانتقال إلى الصفحة الجديدة
|
2951 |
+
var url = this.getAttribute('href'); // الحصول على الرابط
|
2952 |
+
openPublicProfile(url); // فتح الرابط داخل الـ iframe
|
2953 |
+
});
|
2954 |
+
});
|
2955 |
+
|
2956 |
+
|
2957 |
+
// جلب العناصر
|
2958 |
+
// العناصر
|
2959 |
+
const openBtnArtical = document.getElementById('artical-open-btn');
|
2960 |
+
const closeBtnArtical = document.getElementById('artical-close-btn');
|
2961 |
+
const iframeContainer = document.getElementById('artical-iframe-container');
|
2962 |
+
const iframe = document.getElementById('artical-iframe');
|
2963 |
+
const videoBtn = document.querySelector('.video_page'); // الزر الخاص بفتح الفيديو
|
2964 |
+
|
2965 |
+
// فتح الـ iframe مع تحميل المقال
|
2966 |
+
openBtnArtical.addEventListener('click', (e) => {
|
2967 |
+
e.preventDefault();
|
2968 |
+
iframe.src = 'artical'; // تحميل الصفحة الخاصة بالمقال داخل الـ iframe
|
2969 |
+
iframeContainer.style.display = 'block'; // إظهار iframe container
|
2970 |
+
iframeContainer.classList.add('show');
|
2971 |
+
iframeContainer.classList.remove('hide');
|
2972 |
+
});
|
2973 |
+
|
2974 |
+
// فتح الـ iframe مع تحميل الفيديو
|
2975 |
+
videoBtn.addEventListener('click', (e) => {
|
2976 |
+
e.preventDefault();
|
2977 |
+
iframe.src = 'videos'; // تحميل الصفحة الخاصة بالفيديو داخل الـ iframe
|
2978 |
+
iframeContainer.style.display = 'block'; // إظهار iframe container
|
2979 |
+
iframeContainer.classList.add('show');
|
2980 |
+
iframeContainer.classList.remove('hide');
|
2981 |
+
});
|
2982 |
+
|
2983 |
+
// إغلاق الـ iframe
|
2984 |
+
closeBtnArtical.addEventListener('click', () => {
|
2985 |
+
iframeContainer.classList.add('hide');
|
2986 |
+
iframeContainer.classList.remove('show');
|
2987 |
+
setTimeout(() => {
|
2988 |
+
iframeContainer.style.display = 'none'; // إخفاء العنصر بعد الأنيميشن
|
2989 |
+
iframe.src = ''; // إفراغ الـ iframe بعد الإغلاق
|
2990 |
+
}, 300); // زمن الأنيميشن
|
2991 |
+
});
|
2992 |
+
|
2993 |
+
|
2994 |
+
|
2995 |
+
</script>
|
2996 |
+
</body>
|
2997 |
+
</html>
|
templates/forgot_password.html
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}نسيت كلمة السر{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="auth-container">
|
7 |
+
<h2>نسيت كلمة السر</h2>
|
8 |
+
<form id="forgotPasswordForm" method="POST" action="{{ url_for('forgot_password') }}">
|
9 |
+
<div class="form-group">
|
10 |
+
<label for="email">البريد الإلكتروني</label>
|
11 |
+
<input type="email" id="email" name="email" required>
|
12 |
+
</div>
|
13 |
+
<button type="submit" class="submit-btn">إرسال</button>
|
14 |
+
</form>
|
15 |
+
</div>
|
16 |
+
{% endblock %}
|
templates/login.html
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}تسجيل الدخول{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="auth-container">
|
7 |
+
<h2>تسجيل الدخول</h2>
|
8 |
+
<form id="loginForm" method="POST" action="{{ url_for('login') }}">
|
9 |
+
<div class="form-group">
|
10 |
+
<label for="username">اسم المستخدم</label>
|
11 |
+
<input type="text" id="username" name="username" required>
|
12 |
+
<small class="form-text">سيتم إضافة @moltka.eg تلقائياً</small>
|
13 |
+
</div>
|
14 |
+
|
15 |
+
<div class="form-group">
|
16 |
+
<label for="password">كلمة المرور</label>
|
17 |
+
<input type="password" id="password" name="password" required>
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<button type="submit" class="submit-btn">تسجيل الدخول</button>
|
21 |
+
</form>
|
22 |
+
|
23 |
+
<div class="auth-links">
|
24 |
+
<p><a href="{{ url_for('forgot_password') }}">نسيت كلمة السر؟</a></p>
|
25 |
+
<p>ليس لديك حساب؟ <a href="{{ url_for('register') }}">إنشاء حساب جديد</a></p>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
{% endblock %}
|
29 |
+
|
30 |
+
{% block scripts %}
|
31 |
+
<script>
|
32 |
+
$(document).ready(function() {
|
33 |
+
$('#loginForm').on('submit', function(e) {
|
34 |
+
const username = $('#username').val().trim();
|
35 |
+
const password = $('#password').val();
|
36 |
+
|
37 |
+
if (!username || !password) {
|
38 |
+
e.preventDefault();
|
39 |
+
alert('الرجاء ملء جميع الحقول المطلوبة');
|
40 |
+
}
|
41 |
+
});
|
42 |
+
});
|
43 |
+
</script>
|
44 |
+
{% endblock %}
|
templates/messages.html
ADDED
@@ -0,0 +1,639 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}{{ user.username }} - الرسائل{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
|
7 |
+
<style>
|
8 |
+
/* تصميم الحاوية */
|
9 |
+
.messages-container {
|
10 |
+
max-width: 600px;
|
11 |
+
margin: 20px auto;
|
12 |
+
padding: 10px;
|
13 |
+
border: 1px solid #ddd;
|
14 |
+
border-radius: 10px;
|
15 |
+
background-color: #f9f9f9;
|
16 |
+
font-family: Arial, sans-serif;
|
17 |
+
}
|
18 |
+
|
19 |
+
/* معلومات المستخدم */
|
20 |
+
.user-info {
|
21 |
+
display: flex;
|
22 |
+
align-items: center;
|
23 |
+
margin-bottom: 15px;
|
24 |
+
padding: 10px;
|
25 |
+
background-color: #ffffff;
|
26 |
+
border-bottom: 1px solid #ddd;
|
27 |
+
}
|
28 |
+
|
29 |
+
.profile-photo {
|
30 |
+
width: 50px;
|
31 |
+
height: 50px;
|
32 |
+
border-radius: 50%;
|
33 |
+
margin-right: 10px;
|
34 |
+
}
|
35 |
+
|
36 |
+
.username {
|
37 |
+
font-size: 18px;
|
38 |
+
font-weight: bold;
|
39 |
+
}
|
40 |
+
|
41 |
+
/* قائمة الرسائل */
|
42 |
+
.messages-list {
|
43 |
+
display: flex;
|
44 |
+
flex-direction: column;
|
45 |
+
max-height: 400px;
|
46 |
+
overflow-y: auto;
|
47 |
+
padding: 10px;
|
48 |
+
background-color: #ffffff;
|
49 |
+
border-radius: 5px;
|
50 |
+
margin-bottom: 15px;
|
51 |
+
}
|
52 |
+
|
53 |
+
/* الرسائل */
|
54 |
+
.message-item {
|
55 |
+
margin: 5px 0;
|
56 |
+
padding: 10px;
|
57 |
+
border-radius: 15px;
|
58 |
+
max-width: 75%;
|
59 |
+
word-wrap: break-word;
|
60 |
+
font-size: 14px;
|
61 |
+
}
|
62 |
+
|
63 |
+
/* الرسائل المرسلة */
|
64 |
+
.message-item.sent {
|
65 |
+
background-color: #0078ff;
|
66 |
+
color: #ffffff;
|
67 |
+
align-self: flex-end;
|
68 |
+
text-align: right;
|
69 |
+
}
|
70 |
+
|
71 |
+
/* الرسائل المستلمة */
|
72 |
+
.message-item.received {
|
73 |
+
background-color: #f1f0f0;
|
74 |
+
color: #000000;
|
75 |
+
align-self: flex-start;
|
76 |
+
text-align: left;
|
77 |
+
}
|
78 |
+
|
79 |
+
/* الطابع الزمني */
|
80 |
+
.message-timestamp {
|
81 |
+
font-size: 10px;
|
82 |
+
color: #666;
|
83 |
+
margin-top: 5px;
|
84 |
+
display: block;
|
85 |
+
}
|
86 |
+
|
87 |
+
/* إدخال الرسائل */
|
88 |
+
.message-input {
|
89 |
+
/* display: flex; */
|
90 |
+
align-items: center;
|
91 |
+
gap: 10px;
|
92 |
+
}
|
93 |
+
|
94 |
+
textarea#message-input {
|
95 |
+
width: 100%;
|
96 |
+
height: 50px;
|
97 |
+
padding: 10px;
|
98 |
+
border: 1px solid #ddd;
|
99 |
+
border-radius: 5px;
|
100 |
+
resize: none;
|
101 |
+
font-size: 14px;
|
102 |
+
}
|
103 |
+
|
104 |
+
button#send-message-btn {
|
105 |
+
background-color: #0078ff;
|
106 |
+
color: #ffffff;
|
107 |
+
border: none;
|
108 |
+
padding: 10px 15px;
|
109 |
+
border-radius: 5px;
|
110 |
+
font-size: 14px;
|
111 |
+
cursor: pointer;
|
112 |
+
transition: background-color 0.3s;
|
113 |
+
}
|
114 |
+
|
115 |
+
button#send-message-btn:hover {
|
116 |
+
background-color: #005bb5;
|
117 |
+
}
|
118 |
+
|
119 |
+
.received .seen-status{
|
120 |
+
display: none;
|
121 |
+
}
|
122 |
+
img{
|
123 |
+
max-width: 100%;
|
124 |
+
}
|
125 |
+
|
126 |
+
video{
|
127 |
+
max-width: 100%;
|
128 |
+
}
|
129 |
+
|
130 |
+
.input-group{
|
131 |
+
display: flex;
|
132 |
+
flex-direction: row-reverse;
|
133 |
+
align-items: center;
|
134 |
+
position: fixed;
|
135 |
+
bottom: 10px;
|
136 |
+
width: calc(100vw - 16.8px);
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
.file-upload-btn{
|
141 |
+
font-size: 25px;
|
142 |
+
margin-top: 5px;
|
143 |
+
}
|
144 |
+
|
145 |
+
/* دائرة التحميل */
|
146 |
+
.loading-circle {
|
147 |
+
display: inline-block;
|
148 |
+
width: 40px; /* زيادة الحجم ليكون أكثر وضوحًا */
|
149 |
+
height: 40px;
|
150 |
+
border: 4px solid #0078ff; /* اللون الأزرق الزاهي */
|
151 |
+
border-top: 4px solid transparent; /* الجزء العلوي شفاف لإعطاء التأثير الدوار */
|
152 |
+
border-radius: 50%; /* جعلها دائرية */
|
153 |
+
animation: spin 0.8s linear infinite; /* سرعة التدوير أصبحت أسرع (0.8 ثانية) */
|
154 |
+
margin: 10px auto; /* ضبط المسافة بين الدائرة والرسائل */
|
155 |
+
box-shadow: 0px 0px 10px rgba(0, 120, 255, 0.5); /* إضافة ظل خفيف لإعطاء تأثير العمق */
|
156 |
+
}
|
157 |
+
|
158 |
+
/* التأثير الذي يجعل الدائرة تدور */
|
159 |
+
@keyframes spin {
|
160 |
+
0% { transform: rotate(0deg); }
|
161 |
+
100% { transform: rotate(360deg); }
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
|
166 |
+
/* تنسيق نافذة المعاينة المنبثقة */
|
167 |
+
.modal {
|
168 |
+
display: none;
|
169 |
+
position: fixed;
|
170 |
+
top: 0;
|
171 |
+
left: 0;
|
172 |
+
width: 100%;
|
173 |
+
height: 100%;
|
174 |
+
background: rgba(0, 0, 0, 0.8);
|
175 |
+
justify-content: center;
|
176 |
+
align-items: center;
|
177 |
+
z-index: 1000;
|
178 |
+
}
|
179 |
+
|
180 |
+
.modal-content {
|
181 |
+
background: white;
|
182 |
+
padding: 20px;
|
183 |
+
border-radius: 10px;
|
184 |
+
text-align: center;
|
185 |
+
position: relative;
|
186 |
+
max-width: 90%;
|
187 |
+
max-height: 90%;
|
188 |
+
margin-left: auto;
|
189 |
+
top: 50%;
|
190 |
+
margin-right: auto;
|
191 |
+
transform: translate(0, -50%);
|
192 |
+
}
|
193 |
+
|
194 |
+
#closeModal {
|
195 |
+
position: absolute;
|
196 |
+
top: 10px;
|
197 |
+
right: 10px;
|
198 |
+
background: red;
|
199 |
+
color: white;
|
200 |
+
border: none;
|
201 |
+
border-radius: 50%;
|
202 |
+
width: 30px;
|
203 |
+
height: 30px;
|
204 |
+
cursor: pointer;
|
205 |
+
}
|
206 |
+
|
207 |
+
.send-button {
|
208 |
+
background: #007bff;
|
209 |
+
color: white;
|
210 |
+
border: none;
|
211 |
+
padding: 10px 20px;
|
212 |
+
border-radius: 5px;
|
213 |
+
cursor: pointer;
|
214 |
+
margin-top: 10px;
|
215 |
+
}
|
216 |
+
|
217 |
+
.send-button:hover {
|
218 |
+
background: #0056b3;
|
219 |
+
}
|
220 |
+
|
221 |
+
#file-preview img,
|
222 |
+
#file-preview video {
|
223 |
+
max-width: 100px;
|
224 |
+
max-height: 100px;
|
225 |
+
border-radius: 5px;
|
226 |
+
margin-top: 10px;
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
/* تنسيق دائرة التحميل */
|
231 |
+
.loading-spinner {
|
232 |
+
display: flex;
|
233 |
+
justify-content: center;
|
234 |
+
align-items: center;
|
235 |
+
padding: 10px;
|
236 |
+
font-size: 14px;
|
237 |
+
color: #007bff;
|
238 |
+
background-color: #f1f1f1;
|
239 |
+
border-radius: 5px;
|
240 |
+
margin: 10px auto;
|
241 |
+
width: fit-content;
|
242 |
+
}
|
243 |
+
|
244 |
+
.loading-spinner::before {
|
245 |
+
content: "";
|
246 |
+
border: 3px solid #f3f3f3;
|
247 |
+
border-top: 3px solid #007bff;
|
248 |
+
border-radius: 50%;
|
249 |
+
width: 20px;
|
250 |
+
height: 20px;
|
251 |
+
animation: spin 1s linear infinite;
|
252 |
+
margin-right: 10px;
|
253 |
+
}
|
254 |
+
|
255 |
+
@keyframes spin {
|
256 |
+
0% { transform: rotate(0deg); }
|
257 |
+
100% { transform: rotate(360deg); }
|
258 |
+
}
|
259 |
+
|
260 |
+
/* تنسيق دائرة التحميل */
|
261 |
+
.loading-container {
|
262 |
+
display: flex;
|
263 |
+
flex-direction: column;
|
264 |
+
align-items: center;
|
265 |
+
padding: 10px;
|
266 |
+
background-color: #f1f1f1;
|
267 |
+
border-radius: 5px;
|
268 |
+
margin: 10px auto;
|
269 |
+
width: fit-content;
|
270 |
+
}
|
271 |
+
|
272 |
+
.loading-spinner {
|
273 |
+
font-size: 14px;
|
274 |
+
color: #007bff;
|
275 |
+
margin-bottom: 10px;
|
276 |
+
}
|
277 |
+
|
278 |
+
/* تنسيق شريط التقدم */
|
279 |
+
.progress-bar {
|
280 |
+
width: 200px;
|
281 |
+
height: 10px;
|
282 |
+
background-color: #e0e0e0;
|
283 |
+
border-radius: 5px;
|
284 |
+
overflow: hidden;
|
285 |
+
}
|
286 |
+
|
287 |
+
.progress {
|
288 |
+
height: 100%;
|
289 |
+
background-color: #007bff;
|
290 |
+
width: 0%;
|
291 |
+
transition: width 0.3s ease;
|
292 |
+
}
|
293 |
+
</style>
|
294 |
+
<div class="messages-container">
|
295 |
+
<!-- معلومات المستخدم -->
|
296 |
+
<div class="user-info">
|
297 |
+
<img src="{{ url_for('static', filename=user.profile_photo) }}" alt="صورة المستخدم" class="profile-photo">
|
298 |
+
<span class="username">{{ user.username }}</span>
|
299 |
+
</div>
|
300 |
+
|
301 |
+
<!-- قائمة الرسائل -->
|
302 |
+
<div class="messages-list" id="messages-list">
|
303 |
+
<div id="loading-container" style="display: none;">
|
304 |
+
<div class="loading-circle"></div>
|
305 |
+
</div>
|
306 |
+
</div>
|
307 |
+
|
308 |
+
<!-- إدخال الرسائل -->
|
309 |
+
<div class="message-input">
|
310 |
+
<form id="messageForm" enctype="multipart/form-data">
|
311 |
+
<div class="input-group">
|
312 |
+
<label for="file-input" class="file-upload-btn">
|
313 |
+
📎
|
314 |
+
<input type="file" id="file-input" name="file" accept="image/*, video/*" hidden>
|
315 |
+
</label>
|
316 |
+
<textarea id="message-input" placeholder="اكتب رسالتك هنا..."></textarea>
|
317 |
+
|
318 |
+
<button type="submit" id="send-message-btn">ارسال</button>
|
319 |
+
</div>
|
320 |
+
<div id="file-preview"></div>
|
321 |
+
</form>
|
322 |
+
</div>
|
323 |
+
</div>
|
324 |
+
|
325 |
+
<!-- نافذة المعاينة المنبثقة -->
|
326 |
+
<div id="previewModal" class="modal">
|
327 |
+
<div class="modal-content">
|
328 |
+
<button id="closeModal">×</button>
|
329 |
+
<div id="modalPreview"></div>
|
330 |
+
<button id="sendFromModal" class="send-button">إرسال</button>
|
331 |
+
</div>
|
332 |
+
</div>
|
333 |
+
|
334 |
+
<script>
|
335 |
+
$(document).ready(async function () {
|
336 |
+
const messageList = $('#messages-list');
|
337 |
+
const receiverId = {{ user.id }};
|
338 |
+
let selectedFile = null;
|
339 |
+
|
340 |
+
// إرسال طلب لتحديث حالة المستخدم إلى "داخل المحادثة"
|
341 |
+
await fetch('/join_chat', {
|
342 |
+
method: 'POST',
|
343 |
+
headers: {
|
344 |
+
'Content-Type': 'application/json',
|
345 |
+
},
|
346 |
+
});
|
347 |
+
|
348 |
+
// تحديث جميع الرسائل إلى "مقروءة" عند فتح المحادثة
|
349 |
+
await fetch('/mark_all_as_seen', {
|
350 |
+
method: 'POST',
|
351 |
+
headers: {
|
352 |
+
'Content-Type': 'application/json',
|
353 |
+
},
|
354 |
+
body: JSON.stringify({ receiver_id: receiverId }),
|
355 |
+
});
|
356 |
+
|
357 |
+
// معالجة اختيار الملف
|
358 |
+
$('#file-input').change(function(e) {
|
359 |
+
const file = e.target.files[0];
|
360 |
+
if (file) {
|
361 |
+
selectedFile = file;
|
362 |
+
showFilePreview(file);
|
363 |
+
}
|
364 |
+
});
|
365 |
+
|
366 |
+
function showFilePreview(file) {
|
367 |
+
const preview = $('#file-preview');
|
368 |
+
preview.empty();
|
369 |
+
|
370 |
+
if (file.type.startsWith('image/')) {
|
371 |
+
preview.append(`<img src="${URL.createObjectURL(file)}" class="preview-image">`);
|
372 |
+
} else if (file.type.startsWith('video/')) {
|
373 |
+
preview.append(`
|
374 |
+
<video controls class="preview-video">
|
375 |
+
<source src="${URL.createObjectURL(file)}" type="${file.type}">
|
376 |
+
</video>
|
377 |
+
`);
|
378 |
+
}
|
379 |
+
|
380 |
+
preview.append(`
|
381 |
+
<div class="file-info">
|
382 |
+
<span>${file.name}</span>
|
383 |
+
<button type="button" class="remove-file-btn">×</button>
|
384 |
+
</div>
|
385 |
+
`);
|
386 |
+
|
387 |
+
$('.remove-file-btn').click(() => {
|
388 |
+
selectedFile = null;
|
389 |
+
preview.empty();
|
390 |
+
$('#file-input').val('');
|
391 |
+
});
|
392 |
+
}
|
393 |
+
async function loadMessages() {
|
394 |
+
try {
|
395 |
+
const response = await fetch(`/get_messages/${receiverId}`);
|
396 |
+
const messages = await response.json();
|
397 |
+
|
398 |
+
if (!Array.isArray(messages)) {
|
399 |
+
console.error('الرد ليس مصفوفة:', messages);
|
400 |
+
return;
|
401 |
+
}
|
402 |
+
|
403 |
+
messageList.empty();
|
404 |
+
messages.forEach(message => {
|
405 |
+
const messageItem = $('<div>')
|
406 |
+
.addClass('message-item')
|
407 |
+
.attr('data-message-id', message.id);
|
408 |
+
|
409 |
+
// تحديد إذا كانت الرسالة مرسلة أو مستقبلة
|
410 |
+
if (message.sender_id === {{ current_user.id }}) {
|
411 |
+
messageItem.addClass('sent');
|
412 |
+
|
413 |
+
// إضافة حالة المشاهدة للمرسل
|
414 |
+
if (message.watched_by_receiver) {
|
415 |
+
messageItem.append('<span class="seen-status">✓✓</span>'); // المستقبل شاهد الرسالة
|
416 |
+
} else {
|
417 |
+
messageItem.append('<span class="seen-status">✓</span>'); // الرسالة مرسلة، ولكن المستقبل لم يشاهدها بعد
|
418 |
+
}
|
419 |
+
} else {
|
420 |
+
messageItem.addClass('received');
|
421 |
+
// لا تظهر أي علامة للمستقبل
|
422 |
+
}
|
423 |
+
|
424 |
+
const contentContainer = $('<div>').addClass('message-content');
|
425 |
+
|
426 |
+
// عرض الوسائط (صور أو فيديوهات) إذا كانت موجودة
|
427 |
+
if (message.file_url) {
|
428 |
+
if (message.file_type.startsWith('image/')) {
|
429 |
+
// إذا كانت صورة
|
430 |
+
contentContainer.append(`<img src="/${message.file_url}" class="message-media">`);
|
431 |
+
} else if (message.file_type.startsWith('video/')) {
|
432 |
+
// إذا كان فيديو
|
433 |
+
contentContainer.append(`
|
434 |
+
<video controls class="message-media">
|
435 |
+
<source src="/${message.file_url}" type="${message.file_type}">
|
436 |
+
</video>
|
437 |
+
`);
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
+
// إضافة النصوص إذا كانت موجودة
|
442 |
+
if (message.content) {
|
443 |
+
contentContainer.append(`<span>${message.content}</span>`);
|
444 |
+
}
|
445 |
+
|
446 |
+
// إضافة الطابع الزمني
|
447 |
+
const timestamp = $('<span>')
|
448 |
+
.addClass('message-timestamp')
|
449 |
+
.text(message.created_at);
|
450 |
+
|
451 |
+
// إضافة جميع العناصر إلى الرسالة
|
452 |
+
messageItem.append(contentContainer).append(timestamp);
|
453 |
+
messageList.append(messageItem);
|
454 |
+
});
|
455 |
+
|
456 |
+
// تمرير التمرير لأسفل لرؤية آخر الرسائل
|
457 |
+
messageList.scrollTop(messageList.prop('scrollHeight'));
|
458 |
+
} catch (error) {
|
459 |
+
console.error('حدث خطأ أثناء تحميل الرسائل:', error);
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
|
464 |
+
|
465 |
+
// SSE لتحديث حالة المشاهدة
|
466 |
+
const updateEventSource = new EventSource(`/stream_message_updates/${receiverId}`);
|
467 |
+
updateEventSource.onmessage = function (event) {
|
468 |
+
const data = JSON.parse(event.data);
|
469 |
+
const messageId = data.message_id;
|
470 |
+
const isSender = data.sender_id === {{ current_user.id }};
|
471 |
+
|
472 |
+
// إذا كان المستخدم الحالي هو المرسل
|
473 |
+
if (isSender) {
|
474 |
+
const seenStatus = $(`.message-item[data-message-id="${messageId}"] .seen-status`);
|
475 |
+
if (data.watched_by_receiver) {
|
476 |
+
seenStatus.text('✓✓'); // المستقبل شاهد الرسالة
|
477 |
+
} else {
|
478 |
+
seenStatus.text('✓'); // الرسالة مرسلة، ولكن المستقبل لم يشاهدها بعد
|
479 |
+
}
|
480 |
+
}
|
481 |
+
};
|
482 |
+
|
483 |
+
updateEventSource.onerror = function () {
|
484 |
+
console.log('SSE error. Reconnecting...');
|
485 |
+
setTimeout(() => {
|
486 |
+
new EventSource(`/stream_message_updates/${receiverId}`);
|
487 |
+
}, 3000);
|
488 |
+
};
|
489 |
+
|
490 |
+
// SSE للرسائل الجديدة
|
491 |
+
const eventSource = new EventSource(`/stream_messages/${receiverId}`);
|
492 |
+
eventSource.onmessage = function (event) {
|
493 |
+
loadMessages();
|
494 |
+
};
|
495 |
+
|
496 |
+
// إرسال الرسالة
|
497 |
+
|
498 |
+
|
499 |
+
// عند اختيار ملف
|
500 |
+
|
501 |
+
// عند اختيار ملف
|
502 |
+
$('#file-input').change(function(e) {
|
503 |
+
const file = e.target.files[0];
|
504 |
+
if (file) {
|
505 |
+
selectedFile = file;
|
506 |
+
showFilePreview(file); // عرض معاينة الملف
|
507 |
+
}
|
508 |
+
});
|
509 |
+
|
510 |
+
// عرض معاينة الملف في نافذة منبثقة
|
511 |
+
function showFilePreview(file) {
|
512 |
+
const previewModal = $('#previewModal');
|
513 |
+
const modalPreview = $('#modalPreview');
|
514 |
+
|
515 |
+
// تنظيف المحتوى السابق
|
516 |
+
modalPreview.empty();
|
517 |
+
|
518 |
+
if (file.type.startsWith('image')) {
|
519 |
+
// عرض الصورة
|
520 |
+
const img = $('<img>').attr('src', URL.createObjectURL(file)).css({ maxWidth: '100%', maxHeight: '80vh' });
|
521 |
+
modalPreview.append(img);
|
522 |
+
} else if (file.type.startsWith('video')) {
|
523 |
+
// عرض الفيديو
|
524 |
+
const video = $('<video>').attr('src', URL.createObjectURL(file)).attr('controls', true).css({ maxWidth: '100%', maxHeight: '80vh' });
|
525 |
+
modalPreview.append(video);
|
526 |
+
}
|
527 |
+
|
528 |
+
// إظهار نافذة المعاينة
|
529 |
+
previewModal.show();
|
530 |
+
}
|
531 |
+
|
532 |
+
// إغلاق نافذة المعاينة
|
533 |
+
$('#closeModal').click(function() {
|
534 |
+
$('#previewModal').hide();
|
535 |
+
});
|
536 |
+
|
537 |
+
// إرسال الملف من نافذة المعاينة
|
538 |
+
$('#sendFromModal').click(function() {
|
539 |
+
$('#previewModal').hide();
|
540 |
+
$('#messageForm').submit();
|
541 |
+
});
|
542 |
+
|
543 |
+
// إرسال النموذج
|
544 |
+
$('#messageForm').submit(async function(e) {
|
545 |
+
e.preventDefault();
|
546 |
+
const messageContent = $('#message-input').val().trim();
|
547 |
+
const formData = new FormData();
|
548 |
+
formData.append('content', messageContent);
|
549 |
+
formData.append('receiver_id', receiverId);
|
550 |
+
|
551 |
+
if (selectedFile) {
|
552 |
+
formData.append('file', selectedFile);
|
553 |
+
|
554 |
+
// إظهار دائرة التحميل وشريط التقدم في مكان الرسائل
|
555 |
+
$('#messages-list').append(`
|
556 |
+
<div class="loading-container">
|
557 |
+
<div class="loading-spinner">جاري التحميل...</div>
|
558 |
+
<div class="progress-bar">
|
559 |
+
<div class="progress"></div>
|
560 |
+
</div>
|
561 |
+
</div>
|
562 |
+
`);
|
563 |
+
}
|
564 |
+
|
565 |
+
if (!messageContent && !selectedFile) return;
|
566 |
+
|
567 |
+
try {
|
568 |
+
const isReceiverActive = await fetch(`/is_user_active/${receiverId}`).then(res => res.json());
|
569 |
+
|
570 |
+
// استخدام XMLHttpRequest لتتبع تقدم الرفع
|
571 |
+
const xhr = new XMLHttpRequest();
|
572 |
+
xhr.open('POST', '/send_message', true);
|
573 |
+
|
574 |
+
// تحديث شريط التقدم أثناء الرفع
|
575 |
+
xhr.upload.onprogress = function(event) {
|
576 |
+
if (event.lengthComputable) {
|
577 |
+
const percentComplete = (event.loaded / event.total) * 100;
|
578 |
+
$('.progress').css('width', percentComplete + '%');
|
579 |
+
}
|
580 |
+
};
|
581 |
+
|
582 |
+
xhr.onload = function() {
|
583 |
+
if (xhr.status === 200) {
|
584 |
+
$('#message-input').val('');
|
585 |
+
$('#file-preview').empty();
|
586 |
+
selectedFile = null;
|
587 |
+
$('#file-input').val('');
|
588 |
+
|
589 |
+
if (isReceiverActive.active) {
|
590 |
+
const messageId = JSON.parse(xhr.responseText).message_id;
|
591 |
+
fetch(`/mark_message_as_seen/${messageId}`, {
|
592 |
+
method: 'POST',
|
593 |
+
headers: {
|
594 |
+
'Content-Type': 'application/json',
|
595 |
+
},
|
596 |
+
});
|
597 |
+
}
|
598 |
+
|
599 |
+
// إخفاء دائرة التحميل وشريط التقدم بعد اكتمال الإرسال
|
600 |
+
$('.loading-container').remove();
|
601 |
+
loadMessages();
|
602 |
+
} else {
|
603 |
+
console.error('حدث خطأ أثناء إرسال الرسالة:', xhr.statusText);
|
604 |
+
$('.loading-container').remove();
|
605 |
+
}
|
606 |
+
};
|
607 |
+
|
608 |
+
xhr.onerror = function() {
|
609 |
+
console.error('حدث خطأ أثناء إرسال الرسالة:', xhr.statusText);
|
610 |
+
$('.loading-container').remove();
|
611 |
+
};
|
612 |
+
|
613 |
+
xhr.send(formData);
|
614 |
+
} catch (error) {
|
615 |
+
console.error('حدث خطأ أثناء إرسال الرسالة:', error);
|
616 |
+
// إخفاء دائرة التحميل وشريط التقدم في حالة حدوث خطأ
|
617 |
+
$('.loading-container').remove();
|
618 |
+
}
|
619 |
+
});
|
620 |
+
|
621 |
+
|
622 |
+
await loadMessages();
|
623 |
+
});
|
624 |
+
|
625 |
+
window.addEventListener('beforeunload', async function () {
|
626 |
+
await fetch('/leave_chat', {
|
627 |
+
method: 'POST',
|
628 |
+
headers: {
|
629 |
+
'Content-Type': 'application/json',
|
630 |
+
},
|
631 |
+
});
|
632 |
+
|
633 |
+
if (updateEventSource) updateEventSource.close();
|
634 |
+
if (eventSource) eventSource.close();
|
635 |
+
});
|
636 |
+
</script>
|
637 |
+
|
638 |
+
|
639 |
+
{% endblock %}
|
templates/post_detail.html
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="post-header">
|
2 |
+
<!-- صورة المستخدم الذي نشر المنشور -->
|
3 |
+
<div class="profile-circle">
|
4 |
+
<img src="{{ url_for('static', filename=current_user.profile_photo) }}" alt="الصورة الشخصية">
|
5 |
+
</div>
|
6 |
+
<div class="user-info">
|
7 |
+
<span class="username">{{ user.username }}</span> <!-- اسم المستخدم -->
|
8 |
+
<span class="profession">{{ user.profession }}</span> <!-- تخصص المستخدم -->
|
9 |
+
<span class="timestamp">{{ post.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</span> <!-- وقت نشر المنشور -->
|
10 |
+
</div>
|
11 |
+
</div>
|
12 |
+
|
13 |
+
<!-- محتوى المنشور -->
|
14 |
+
<div class="post-content">
|
15 |
+
<!-- <h2>{{ post.title }}</h2> -->
|
16 |
+
<p>{{ post.content }}</p>
|
17 |
+
{% if post.image_url %}
|
18 |
+
<img src="{{ url_for('static', filename=post.image_url) }}" alt="Post Image"> <!-- صورة المنشور -->
|
19 |
+
{% endif %}
|
20 |
+
</div>
|
21 |
+
|
22 |
+
<!-- رابط المشاركة -->
|
23 |
+
<div class="share">
|
24 |
+
<label>شارك هذا المنشور:</label>
|
25 |
+
<input type="text" value="{{ url_for('view_post', post_id=post.id, _external=True) }}" readonly>
|
26 |
+
<button onclick="copyToClipboard()">نسخ الرابط</button>
|
27 |
+
</div>
|
28 |
+
|
29 |
+
<script>
|
30 |
+
function copyToClipboard() {
|
31 |
+
var copyText = document.querySelector('.share input');
|
32 |
+
copyText.select();
|
33 |
+
copyText.setSelectionRange(0, 99999); // لنسخ النص في الأجهزة المحمولة
|
34 |
+
document.execCommand('copy');
|
35 |
+
alert('تم نسخ الرابط!');
|
36 |
+
}
|
37 |
+
</script>
|
templates/profile.html
ADDED
@@ -0,0 +1,1827 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}{{ current_user.username }} - الملف الشخصي{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="profile-container">
|
7 |
+
<!-- قسم معلومات الملف الشخصي -->
|
8 |
+
<div class="profile-header">
|
9 |
+
<div class="cover-photo"></div>
|
10 |
+
<div class="profile-info">
|
11 |
+
<div class="profile-photo">
|
12 |
+
<img src="{{ url_for('static', filename=current_user.profile_photo) }}" alt="الصورة الشخصية">
|
13 |
+
</div>
|
14 |
+
<h1 class="profile-name">{{ current_user.username }}</h1>
|
15 |
+
<div class="profile-details">
|
16 |
+
<div class="detail-item">
|
17 |
+
<i class="fas fa-envelope"></i>
|
18 |
+
<span>{{ current_user.email }}</span>
|
19 |
+
</div>
|
20 |
+
<div class="detail-item">
|
21 |
+
<i class="fas fa-briefcase"></i>
|
22 |
+
<span>{{ current_user.profession }}</span>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<div class="skills-section">
|
26 |
+
<h3>المهارات</h3>
|
27 |
+
<div class="skills-list">
|
28 |
+
{% for skill in current_user.skills|from_json %}
|
29 |
+
<span class="skill-tag">{{ skill }}</span>
|
30 |
+
{% endfor %}
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<button id="editProfileBtn" class="edit-btn">
|
34 |
+
<i class="fas fa-edit"></i>
|
35 |
+
تعديل الملف الشخصي
|
36 |
+
</button>
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
<div class="filter-buttons">
|
41 |
+
<button id="filterAll" class="filter-btn active">الكل</button>
|
42 |
+
<button id="filterImages" class="filter-btn">الصور</button>
|
43 |
+
<button id="filterVideos" class="filter-btn">الفيديوهات</button>
|
44 |
+
<button id="filterText" class="filter-btn">النص</button>
|
45 |
+
</div>
|
46 |
+
|
47 |
+
<div id="noPostsMessage" style="display: none; text-align: center; margin-top: 20px; color: #666;">
|
48 |
+
لا توجد منشورات تطابق الفلتر المحدد.
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<!-- نموذج تعديل الملف الشخصي -->
|
52 |
+
<div id="editProfileForm" class="edit-form" style="display: none;">
|
53 |
+
<h2>تعديل الملف الشخصي</h2>
|
54 |
+
<form id="profileForm" method="POST" action="{{ url_for('update_profile') }}" enctype="multipart/form-data">
|
55 |
+
<div class="form-group">
|
56 |
+
<label>الصورة الشخصية</label>
|
57 |
+
<div class="profile-photo-upload">
|
58 |
+
<input type="file" id="avatar" name="avatar" accept="image/*" class="avatar-input">
|
59 |
+
<label for="avatar" class="upload-btn">
|
60 |
+
<i class="fas fa-camera"></i>
|
61 |
+
تغيير الصورة
|
62 |
+
</label>
|
63 |
+
<button type="button" class="remove-photo-btn" id="removePhotoBtn">
|
64 |
+
<i class="fas fa-times"></i>
|
65 |
+
إزالة الصورة
|
66 |
+
</button>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<div class="form-group">
|
70 |
+
<label for="username">اسم المستخدم</label>
|
71 |
+
<input type="text" id="username" name="username" value="{{ current_user.username }}" required>
|
72 |
+
<small class="form-text">@moltka.eg</small>
|
73 |
+
<span id="username-validation-message"></span>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<div class="form-group">
|
77 |
+
<label for="profession">المجال المهني</label>
|
78 |
+
<select id="profession" name="profession" required>
|
79 |
+
<option value="">اختر المجال المهني</option>
|
80 |
+
<option value="مطور ويب" {% if current_user.profession == "مطور ويب" %}selected{% endif %}>مطور ويب</option>
|
81 |
+
<option value="مطور واجهة خلفية" {% if current_user.profession == "مطور واجهة خلفية" %}selected{% endif %}>مطور واجهة خلفية</option>
|
82 |
+
<option value="برمجة" {% if current_user.profession == "برمجة" %}selected{% endif %}>برمجة</option>
|
83 |
+
<option value="مطور ألعاب" {% if current_user.profession == "مطور ألعاب" %}selected{% endif %}>مطور ألعاب</option>
|
84 |
+
<option value="مطور أندرويد" {% if current_user.profession == "مطور أندرويد" %}selected{% endif %}>مطور أندرويد</option>
|
85 |
+
<option value="مطور iOS" {% if current_user.profession == "مطور iOS" %}selected{% endif %}>مطور iOS</option>
|
86 |
+
<option value="مهندس" {% if current_user.profession == "مهندس" %}selected{% endif %}>مهندس</option>
|
87 |
+
<option value="طبيب" {% if current_user.profession == "طبيب" %}selected{% endif %}>طبيب</option>
|
88 |
+
<option value="علوم اجتماعية" {% if current_user.profession == "علوم اجتماعية" %}selected{% endif %}>علوم اجتماعية</option>
|
89 |
+
<option value="معلم" {% if current_user.profession == "معلم" %}selected{% endif %}>معلم</option>
|
90 |
+
<option value="محاسب" {% if current_user.profession == "محاسب" %}selected{% endif %}>محاسب</option>
|
91 |
+
<option value="صحفي" {% if current_user.profession == "صحفي" %}selected{% endif %}>صحفي</option>
|
92 |
+
<option value="محامي" {% if current_user.profession == "محامي" %}selected{% endif %}>محامي</option>
|
93 |
+
<option value="مصمم جرافيكي" {% if current_user.profession == "مصمم جرافيكي" %}selected{% endif %}>مصمم جرافيكي</option>
|
94 |
+
<option value="مصور" {% if current_user.profession == "مصور" %}selected{% endif %}>مصور</option>
|
95 |
+
<option value="كاتب" {% if current_user.profession == "كاتب" %}selected{% endif %}>كاتب</option>
|
96 |
+
<option value="مدرب رياضي" {% if current_user.profession == "مدرب رياضي" %}selected{% endif %}>مدرب رياضي</option>
|
97 |
+
<option value="طاهي" {% if current_user.profession == "طاهي" %}selected{% endif %}>طاهي</option>
|
98 |
+
<option value="ديني" {% if current_user.profession == "ديني" %}selected{% endif %}>ديني</option>
|
99 |
+
<option value="شاعر" {% if current_user.profession == "شاعر" %}selected{% endif %}>شاعر</option>
|
100 |
+
<option value="رسام" {% if current_user.profession == "رسام" %}selected{% endif %}>رسام</option>
|
101 |
+
<option value="محلل مالي" {% if current_user.profession == "محلل مالي" %}selected{% endif %}>محلل مالي</option>
|
102 |
+
<option value="فني صيانة" {% if current_user.profession == "فني صيانة" %}selected{% endif %}>فني صيانة</option>
|
103 |
+
<option value="باحث" {% if current_user.profession == "باحث" %}selected{% endif %}>باحث</option>
|
104 |
+
<option value="IT" {% if current_user.profession == "IT" %}selected{% endif %}>IT</option>
|
105 |
+
</select>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<div class="form-group">
|
109 |
+
<label>المهارات</label>
|
110 |
+
<div id="skills-container">
|
111 |
+
{% for skill in current_user.skills|from_json %}
|
112 |
+
<div class="skill-input">
|
113 |
+
<input type="text" name="skill" class="skill-field" value="{{ skill }}">
|
114 |
+
<button type="button" class="remove-skill">-</button>
|
115 |
+
</div>
|
116 |
+
{% endfor %}
|
117 |
+
<div class="skill-input">
|
118 |
+
<input type="text" name="skill" class="skill-field">
|
119 |
+
<button type="button" class="add-skill">+</button>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<input type="hidden" id="skills" name="skills">
|
123 |
+
</div>
|
124 |
+
|
125 |
+
<div class="form-actions">
|
126 |
+
<button type="submit" class="save-btn">حفظ التغييرات</button>
|
127 |
+
<button type="button" class="cancel-btn" id="cancelEdit">إلغاء</button>
|
128 |
+
</div>
|
129 |
+
</form>
|
130 |
+
</div>
|
131 |
+
|
132 |
+
<!-- قسم المنشورات -->
|
133 |
+
<div class="posts-section">
|
134 |
+
<h2>المنشورات</h2>
|
135 |
+
<div class="posts-container">
|
136 |
+
{% for post in posts %}
|
137 |
+
<div class="post-card">
|
138 |
+
<div class="post-header">
|
139 |
+
<div class="profile-circle">
|
140 |
+
<img src="{{ url_for('static', filename=current_user.profile_photo) }}" alt="صورة الملف الشخصي">
|
141 |
+
</div>
|
142 |
+
<div class="user-info">
|
143 |
+
<span class="username">{{ current_user.username }}</span>
|
144 |
+
<span class="profession">{{ post.user_profession }}</span>
|
145 |
+
<span class="timestamp">{{ post.created_at|format_datetime }}</span>
|
146 |
+
</div>
|
147 |
+
<div class="post-menu">
|
148 |
+
<i class="fas fa-ellipsis-v menu-dots"></i>
|
149 |
+
<div class="menu-options">
|
150 |
+
<div class="menu-option edit-post" data-post-id="{{ post.id }}">
|
151 |
+
<i class="fas fa-edit"></i> تعديل المنشور
|
152 |
+
</div>
|
153 |
+
<div class="menu-option delete-post" data-post-id="{{ post.id }}">
|
154 |
+
<i class="fas fa-trash"></i> حذف المنشور
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
|
160 |
+
<div class="post-content" {% if post.background_color and not post.image_url %}style="background-color: {{ post.background_color }}; border-radius: 8px; text-align: center; font-size: 24px;"{% endif %}>
|
161 |
+
{% if post.title %}
|
162 |
+
<h3 class="post-title">{{ post.title }}</h3>
|
163 |
+
{% endif %}
|
164 |
+
{% if post.content %}
|
165 |
+
<div class="post-text-container">
|
166 |
+
<div class="post-content-box">
|
167 |
+
<div class="post-text collapsed" {% if post.background_color and not post.image_url %}style="color: {% if post.background_color == '#ffffff' %}#1a1a1a{% else %}#000000{% endif %};"{% endif %}>
|
168 |
+
{% for line in post.content.split('\n') %}
|
169 |
+
{% if line.strip() %}
|
170 |
+
<p>{{ line }}</p>
|
171 |
+
{% else %}
|
172 |
+
<p> </p>
|
173 |
+
{% endif %}
|
174 |
+
{% endfor %}
|
175 |
+
</div>
|
176 |
+
<button class="see-more-btn" style="display: none;">إظهار المزيد</button>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
{% endif %}
|
180 |
+
{% if post.image_url %}
|
181 |
+
<div class="post-media">
|
182 |
+
<img src="{{ url_for('static', filename=post.image_url) }}" alt="صورة المنشور">
|
183 |
+
</div>
|
184 |
+
{% endif %}
|
185 |
+
{% if post.video_url %}
|
186 |
+
<div class="post-media video-container">
|
187 |
+
<video src="{{ url_for('static', filename=post.video_url) }}" controls></video>
|
188 |
+
</div>
|
189 |
+
{% endif %}
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<div class="post-actions">
|
193 |
+
<button class="action-btn comment-btn" data-post-id="{{ post.id }}">
|
194 |
+
<i class="fas fa-comment"></i> تعليق
|
195 |
+
</button>
|
196 |
+
<button class="action-btn share-btn" data-post-id="{{ post.id }}">
|
197 |
+
<i class="fas fa-share"></i> مشاركة
|
198 |
+
</button>
|
199 |
+
</div>
|
200 |
+
</div>
|
201 |
+
{% endfor %}
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
|
205 |
+
|
206 |
+
|
207 |
+
<!-- Comments Fixed Container -->
|
208 |
+
<div class="comments-overlay" id="commentsOverlay"></div>
|
209 |
+
<div class="comments-fixed-container" id="commentsFixedContainer">
|
210 |
+
<div class="comments-content">
|
211 |
+
<div class="comments-header">
|
212 |
+
<h3>التعليقات</h3>
|
213 |
+
<span class="close-comments">×</span>
|
214 |
+
</div>
|
215 |
+
<div class="comments-list-container">
|
216 |
+
<div class="comments-list"></div>
|
217 |
+
</div>
|
218 |
+
<div class="comment-input-container">
|
219 |
+
<textarea
|
220 |
+
class="comment-input"
|
221 |
+
placeholder="اكتب تعليقك هنا..."
|
222 |
+
rows="1"
|
223 |
+
></textarea>
|
224 |
+
<button class="send-comment-btn">
|
225 |
+
<i class="fas fa-paper-plane"></i>
|
226 |
+
</button>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
|
231 |
+
<div class="reply-overlay" id="replyOverlay"></div>
|
232 |
+
<div class="reply-fixed-container" id="replyFixedContainer">
|
233 |
+
<div class="reply-content">
|
234 |
+
<div class="reply-header">
|
235 |
+
<h3>الرد</h3>
|
236 |
+
<span class="close-reply">×</span>
|
237 |
+
</div>
|
238 |
+
<div class="reply-input-container">
|
239 |
+
<textarea
|
240 |
+
class="reply-input"
|
241 |
+
placeholder="اكتب ردك هنا..."
|
242 |
+
rows="1"
|
243 |
+
></textarea>
|
244 |
+
<button class="send-reply-btn">
|
245 |
+
<i class="fas fa-paper-plane"></i>
|
246 |
+
</button>
|
247 |
+
</div>
|
248 |
+
</div>
|
249 |
+
</div>
|
250 |
+
|
251 |
+
|
252 |
+
<!-- زر العودة للصفحة الرئيسية -->
|
253 |
+
<!-- <a href="{{ url_for('dashboard') }}" class="back-btn">
|
254 |
+
<i class="fas fa-arrow-left"></i>
|
255 |
+
العودة للرئيسية
|
256 |
+
</a> -->
|
257 |
+
|
258 |
+
<style>
|
259 |
+
/* Comments Fixed Container Styles */
|
260 |
+
.comments-overlay {
|
261 |
+
display: none;
|
262 |
+
position: fixed;
|
263 |
+
top: 0;
|
264 |
+
left: 0;
|
265 |
+
right: 0;
|
266 |
+
bottom: 0;
|
267 |
+
background-color: rgba(0, 0, 0, 0.5);
|
268 |
+
z-index: 1999;
|
269 |
+
}
|
270 |
+
|
271 |
+
.comments-fixed-container {
|
272 |
+
display: none;
|
273 |
+
position: fixed;
|
274 |
+
bottom: 0;
|
275 |
+
left: 0;
|
276 |
+
right: 0;
|
277 |
+
height: 80%;
|
278 |
+
background: white;
|
279 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
280 |
+
z-index: 2000;
|
281 |
+
transform: translateY(100%);
|
282 |
+
transition: transform 0.3s ease-out;
|
283 |
+
}
|
284 |
+
|
285 |
+
.comments-fixed-container.active {
|
286 |
+
transform: translateY(0);
|
287 |
+
}
|
288 |
+
|
289 |
+
.comments-content {
|
290 |
+
height: 100%;
|
291 |
+
display: flex;
|
292 |
+
flex-direction: column;
|
293 |
+
}
|
294 |
+
|
295 |
+
.comments-header {
|
296 |
+
padding: 16px;
|
297 |
+
border-bottom: 1px solid #ddd;
|
298 |
+
display: flex;
|
299 |
+
justify-content: space-between;
|
300 |
+
align-items: center;
|
301 |
+
}
|
302 |
+
|
303 |
+
.comments-header h3 {
|
304 |
+
margin: 0;
|
305 |
+
text-align: center;
|
306 |
+
flex-grow: 1;
|
307 |
+
}
|
308 |
+
|
309 |
+
.close-comments {
|
310 |
+
font-size: 24px;
|
311 |
+
cursor: pointer;
|
312 |
+
color: #666;
|
313 |
+
padding: 8px;
|
314 |
+
}
|
315 |
+
|
316 |
+
.comments-list-container {
|
317 |
+
flex-grow: 1;
|
318 |
+
overflow-y: auto;
|
319 |
+
padding: 16px;
|
320 |
+
}
|
321 |
+
|
322 |
+
.comments-container {
|
323 |
+
flex-grow: 1;
|
324 |
+
overflow-y: auto;
|
325 |
+
padding: 16px;
|
326 |
+
}
|
327 |
+
|
328 |
+
.comment-input-container {
|
329 |
+
padding: 12px;
|
330 |
+
border-top: 1px solid #ddd;
|
331 |
+
background: white;
|
332 |
+
display: flex;
|
333 |
+
gap: 8px;
|
334 |
+
align-items: flex-start;
|
335 |
+
}
|
336 |
+
|
337 |
+
.comment-input {
|
338 |
+
flex: 1;
|
339 |
+
padding: 12px;
|
340 |
+
border: 1px solid #ddd;
|
341 |
+
border-radius: 20px;
|
342 |
+
resize: none;
|
343 |
+
font-size: 14px;
|
344 |
+
direction: rtl;
|
345 |
+
}
|
346 |
+
|
347 |
+
.send-comment-btn {
|
348 |
+
background: #4caf50;
|
349 |
+
color: white;
|
350 |
+
border: none;
|
351 |
+
width: 36px;
|
352 |
+
height: 36px;
|
353 |
+
border-radius: 50%;
|
354 |
+
display: flex;
|
355 |
+
align-items: center;
|
356 |
+
justify-content: center;
|
357 |
+
cursor: pointer;
|
358 |
+
}
|
359 |
+
|
360 |
+
.send-comment-btn:hover {
|
361 |
+
background: #45a049;
|
362 |
+
}
|
363 |
+
|
364 |
+
.comments-list {
|
365 |
+
display: flex;
|
366 |
+
flex-direction: column;
|
367 |
+
gap: 12px;
|
368 |
+
direction: rtl;
|
369 |
+
}
|
370 |
+
|
371 |
+
.comment-item {
|
372 |
+
display: flex;
|
373 |
+
gap: 8px;
|
374 |
+
margin-bottom: 12px;
|
375 |
+
align-items: flex-start;
|
376 |
+
padding: 0 8px;
|
377 |
+
}
|
378 |
+
|
379 |
+
.comment-user-avatar {
|
380 |
+
width: 45px;
|
381 |
+
height: 45px;
|
382 |
+
flex-shrink: 0;
|
383 |
+
margin-left: 8px;
|
384 |
+
}
|
385 |
+
|
386 |
+
.comment-user-avatar img {
|
387 |
+
width: 100%;
|
388 |
+
height: 100%;
|
389 |
+
border-radius: 50%;
|
390 |
+
object-fit: cover;
|
391 |
+
}
|
392 |
+
|
393 |
+
.comment-bubble {
|
394 |
+
background: #f0f2f5;
|
395 |
+
border-radius: 18px;
|
396 |
+
padding: 8px 12px;
|
397 |
+
flex-grow: 1;
|
398 |
+
}
|
399 |
+
|
400 |
+
.comment-header {
|
401 |
+
margin-bottom: 4px;
|
402 |
+
}
|
403 |
+
|
404 |
+
.comment-username {
|
405 |
+
font-weight: 600;
|
406 |
+
color: #050505;
|
407 |
+
font-size: 13px;
|
408 |
+
}
|
409 |
+
|
410 |
+
.comment-content {
|
411 |
+
color: #050505;
|
412 |
+
font-size: 14px;
|
413 |
+
line-height: 1.4;
|
414 |
+
word-wrap: break-word;
|
415 |
+
}
|
416 |
+
|
417 |
+
.comment-time {
|
418 |
+
font-size: 11px;
|
419 |
+
color: #65676b;
|
420 |
+
margin-top: 4px;
|
421 |
+
}
|
422 |
+
|
423 |
+
.nested-comments {
|
424 |
+
margin-left: 20px;
|
425 |
+
}
|
426 |
+
|
427 |
+
.reply-input-container {
|
428 |
+
margin-top: 10px;
|
429 |
+
}
|
430 |
+
|
431 |
+
.reply-text {
|
432 |
+
width: 100%;
|
433 |
+
padding: 12px;
|
434 |
+
border: 1px solid #ddd;
|
435 |
+
border-radius: 20px;
|
436 |
+
resize: none;
|
437 |
+
font-size: 14px;
|
438 |
+
direction: rtl;
|
439 |
+
}
|
440 |
+
|
441 |
+
.send-reply-btn {
|
442 |
+
margin-top: 5px;
|
443 |
+
color: white;
|
444 |
+
background-color: blue;
|
445 |
+
border: none;
|
446 |
+
padding: 5px 10px;
|
447 |
+
cursor: pointer;
|
448 |
+
}
|
449 |
+
|
450 |
+
/* Reply Modal Styles */
|
451 |
+
.reply-overlay {
|
452 |
+
display: none;
|
453 |
+
position: fixed;
|
454 |
+
top: 0;
|
455 |
+
left: 0;
|
456 |
+
right: 0;
|
457 |
+
bottom: 0;
|
458 |
+
background-color: rgba(0, 0, 0, 0.5);
|
459 |
+
z-index: 2001;
|
460 |
+
}
|
461 |
+
|
462 |
+
.reply-fixed-container {
|
463 |
+
display: none;
|
464 |
+
position: fixed;
|
465 |
+
bottom: 0;
|
466 |
+
left: 0;
|
467 |
+
right: 0;
|
468 |
+
height: 30%;
|
469 |
+
background: white;
|
470 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
471 |
+
z-index: 2002;
|
472 |
+
transform: translateY(100%);
|
473 |
+
transition: transform 0.3s ease-out;
|
474 |
+
}
|
475 |
+
|
476 |
+
.reply-fixed-container.active {
|
477 |
+
transform: translateY(0);
|
478 |
+
}
|
479 |
+
|
480 |
+
.reply-content {
|
481 |
+
height: 100%;
|
482 |
+
display: flex;
|
483 |
+
flex-direction: column;
|
484 |
+
}
|
485 |
+
|
486 |
+
.reply-header {
|
487 |
+
padding: 16px;
|
488 |
+
border-bottom: 1px solid #ddd;
|
489 |
+
display: flex;
|
490 |
+
justify-content: space-between;
|
491 |
+
align-items: center;
|
492 |
+
}
|
493 |
+
|
494 |
+
.reply-header h3 {
|
495 |
+
margin: 0;
|
496 |
+
text-align: center;
|
497 |
+
flex-grow: 1;
|
498 |
+
}
|
499 |
+
|
500 |
+
.close-reply {
|
501 |
+
font-size: 24px;
|
502 |
+
cursor: pointer;
|
503 |
+
color: #666;
|
504 |
+
padding: 8px;
|
505 |
+
}
|
506 |
+
|
507 |
+
.reply-input-container {
|
508 |
+
padding: 12px;
|
509 |
+
border-top: 1px solid #ddd;
|
510 |
+
background: white;
|
511 |
+
display: flex;
|
512 |
+
gap: 8px;
|
513 |
+
align-items: flex-start;
|
514 |
+
}
|
515 |
+
|
516 |
+
.reply-input {
|
517 |
+
flex: 1;
|
518 |
+
padding: 12px;
|
519 |
+
border: 1px solid #ddd;
|
520 |
+
border-radius: 20px;
|
521 |
+
resize: none;
|
522 |
+
font-size: 14px;
|
523 |
+
direction: rtl;
|
524 |
+
}
|
525 |
+
|
526 |
+
.send-reply-btn {
|
527 |
+
background: #4caf50;
|
528 |
+
color: white;
|
529 |
+
border: none;
|
530 |
+
width: 36px;
|
531 |
+
height: 36px;
|
532 |
+
border-radius: 50%;
|
533 |
+
display: flex;
|
534 |
+
align-items: center;
|
535 |
+
justify-content: center;
|
536 |
+
cursor: pointer;
|
537 |
+
|
538 |
+
}
|
539 |
+
.reply-btn{
|
540 |
+
color: blue;
|
541 |
+
cursor: pointer;
|
542 |
+
margin-right: 82%;
|
543 |
+
transform: translate(0%, -18px);
|
544 |
+
}
|
545 |
+
|
546 |
+
.send-reply-btn:hover {
|
547 |
+
background: #45a049;
|
548 |
+
}
|
549 |
+
|
550 |
+
|
551 |
+
/* أنماط زر التعديل */
|
552 |
+
|
553 |
+
|
554 |
+
.edit-btn {
|
555 |
+
background: #4CAF50;
|
556 |
+
color: white;
|
557 |
+
border: none;
|
558 |
+
padding: 8px 16px;
|
559 |
+
border-radius: 20px;
|
560 |
+
cursor: pointer;
|
561 |
+
font-size: 14px;
|
562 |
+
display: flex;
|
563 |
+
align-items: center;
|
564 |
+
gap: 8px;
|
565 |
+
margin: 20px auto 0;
|
566 |
+
}
|
567 |
+
|
568 |
+
.edit-btn:hover {
|
569 |
+
background: #45a049;
|
570 |
+
}
|
571 |
+
|
572 |
+
/* Profile Photo Upload Styles */
|
573 |
+
.profile-photo-upload {
|
574 |
+
display: flex;
|
575 |
+
gap: 10px;
|
576 |
+
justify-content: center;
|
577 |
+
margin-bottom: 20px;
|
578 |
+
}
|
579 |
+
|
580 |
+
.avatar-input {
|
581 |
+
display: none;
|
582 |
+
}
|
583 |
+
|
584 |
+
.upload-btn {
|
585 |
+
background: #4CAF50;
|
586 |
+
color: white;
|
587 |
+
padding: 8px 16px;
|
588 |
+
border-radius: 20px;
|
589 |
+
cursor: pointer;
|
590 |
+
font-size: 14px;
|
591 |
+
display: flex;
|
592 |
+
align-items: center;
|
593 |
+
gap: 8px;
|
594 |
+
}
|
595 |
+
|
596 |
+
.upload-btn:hover {
|
597 |
+
background: #45a049;
|
598 |
+
}
|
599 |
+
|
600 |
+
.remove-photo-btn {
|
601 |
+
background: #f44336;
|
602 |
+
color: white;
|
603 |
+
padding: 8px 16px;
|
604 |
+
border-radius: 20px;
|
605 |
+
border: none;
|
606 |
+
cursor: pointer;
|
607 |
+
font-size: 14px;
|
608 |
+
display: flex;
|
609 |
+
align-items: center;
|
610 |
+
gap: 8px;
|
611 |
+
}
|
612 |
+
|
613 |
+
.remove-photo-btn:hover {
|
614 |
+
background: #d32f2f;
|
615 |
+
}
|
616 |
+
|
617 |
+
/* أنماط نموذج التعديل */
|
618 |
+
.edit-form {
|
619 |
+
background: white;
|
620 |
+
padding: 20px;
|
621 |
+
border-radius: 8px;
|
622 |
+
margin: 20px 0;
|
623 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
624 |
+
}
|
625 |
+
|
626 |
+
.edit-form h2 {
|
627 |
+
text-align: center;
|
628 |
+
margin-bottom: 20px;
|
629 |
+
color: #1a1a1a;
|
630 |
+
}
|
631 |
+
|
632 |
+
.form-group {
|
633 |
+
margin-bottom: 15px;
|
634 |
+
}
|
635 |
+
|
636 |
+
.form-group label {
|
637 |
+
display: block;
|
638 |
+
margin-bottom: 5px;
|
639 |
+
color: #1a1a1a;
|
640 |
+
}
|
641 |
+
|
642 |
+
.form-group input,
|
643 |
+
.form-group select {
|
644 |
+
width: 100%;
|
645 |
+
padding: 8px;
|
646 |
+
border: 1px solid #ddd;
|
647 |
+
border-radius: 4px;
|
648 |
+
font-size: 14px;
|
649 |
+
}
|
650 |
+
|
651 |
+
.skill-input {
|
652 |
+
display: flex;
|
653 |
+
gap: 8px;
|
654 |
+
margin-bottom: 8px;
|
655 |
+
}
|
656 |
+
|
657 |
+
.add-skill,
|
658 |
+
.remove-skill {
|
659 |
+
background: #4CAF50;
|
660 |
+
color: white;
|
661 |
+
border: none;
|
662 |
+
width: 30px;
|
663 |
+
height: 30px;
|
664 |
+
border-radius: 15px;
|
665 |
+
cursor: pointer;
|
666 |
+
display: flex;
|
667 |
+
align-items: center;
|
668 |
+
justify-content: center;
|
669 |
+
font-size: 18px;
|
670 |
+
}
|
671 |
+
|
672 |
+
.remove-skill {
|
673 |
+
background: #f44336;
|
674 |
+
}
|
675 |
+
|
676 |
+
.form-actions {
|
677 |
+
display: flex;
|
678 |
+
gap: 10px;
|
679 |
+
justify-content: flex-end;
|
680 |
+
margin-top: 20px;
|
681 |
+
}
|
682 |
+
|
683 |
+
.save-btn,
|
684 |
+
.cancel-btn {
|
685 |
+
padding: 8px 16px;
|
686 |
+
border: none;
|
687 |
+
border-radius: 4px;
|
688 |
+
cursor: pointer;
|
689 |
+
font-size: 14px;
|
690 |
+
}
|
691 |
+
|
692 |
+
.save-btn {
|
693 |
+
background: #4CAF50;
|
694 |
+
color: white;
|
695 |
+
}
|
696 |
+
|
697 |
+
.cancel-btn {
|
698 |
+
background: #f44336;
|
699 |
+
color: white;
|
700 |
+
}
|
701 |
+
|
702 |
+
/* أنماط الصفحة الرئيسية */
|
703 |
+
.back-btn {
|
704 |
+
position: fixed;
|
705 |
+
top: 20px;
|
706 |
+
left: 20px;
|
707 |
+
background: #fff;
|
708 |
+
color: #4CAF50;
|
709 |
+
border: none;
|
710 |
+
padding: 8px 16px;
|
711 |
+
border-radius: 20px;
|
712 |
+
cursor: pointer;
|
713 |
+
font-size: 14px;
|
714 |
+
display: flex;
|
715 |
+
align-items: center;
|
716 |
+
gap: 8px;
|
717 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
718 |
+
z-index: 100;
|
719 |
+
text-decoration: none;
|
720 |
+
}
|
721 |
+
|
722 |
+
.back-btn:hover {
|
723 |
+
background-color: #f0f2f5;
|
724 |
+
}
|
725 |
+
|
726 |
+
.profile-container {
|
727 |
+
max-width: 600px;
|
728 |
+
margin: 0 auto;
|
729 |
+
/* padding: 0 15px; */
|
730 |
+
}
|
731 |
+
|
732 |
+
.profile-header {
|
733 |
+
background: #fff;
|
734 |
+
border-radius: 0 0 8px 8px;
|
735 |
+
margin-bottom: 20px;
|
736 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
737 |
+
overflow: hidden;
|
738 |
+
/* margin-top: 20px; */
|
739 |
+
}
|
740 |
+
|
741 |
+
.cover-photo {
|
742 |
+
height: 150px;
|
743 |
+
background-color: #4CAF50;
|
744 |
+
position: relative;
|
745 |
+
}
|
746 |
+
|
747 |
+
.profile-info {
|
748 |
+
padding: 0 20px 20px;
|
749 |
+
text-align: center;
|
750 |
+
position: relative;
|
751 |
+
}
|
752 |
+
|
753 |
+
.profile-photo {
|
754 |
+
width: 120px;
|
755 |
+
height: 120px;
|
756 |
+
border-radius: 50%;
|
757 |
+
border: 4px solid #fff;
|
758 |
+
margin: -60px auto 10px;
|
759 |
+
overflow: hidden;
|
760 |
+
position: relative;
|
761 |
+
background: #fff;
|
762 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
763 |
+
}
|
764 |
+
|
765 |
+
.profile-photo img {
|
766 |
+
width: 100%;
|
767 |
+
height: 100%;
|
768 |
+
object-fit: cover;
|
769 |
+
}
|
770 |
+
|
771 |
+
.profile-name {
|
772 |
+
font-size: 24px;
|
773 |
+
margin: 10px 0;
|
774 |
+
color: #1a1a1a;
|
775 |
+
}
|
776 |
+
|
777 |
+
.profile-details {
|
778 |
+
display: flex;
|
779 |
+
flex-direction: column;
|
780 |
+
gap: 10px;
|
781 |
+
margin: 15px 0;
|
782 |
+
}
|
783 |
+
|
784 |
+
.detail-item {
|
785 |
+
display: flex;
|
786 |
+
align-items: center;
|
787 |
+
justify-content: center;
|
788 |
+
gap: 8px;
|
789 |
+
color: #65676b;
|
790 |
+
}
|
791 |
+
|
792 |
+
.detail-item i {
|
793 |
+
color: #4CAF50;
|
794 |
+
}
|
795 |
+
|
796 |
+
.skills-section {
|
797 |
+
margin-top: 20px;
|
798 |
+
padding-top: 20px;
|
799 |
+
border-top: 1px solid #e4e6eb;
|
800 |
+
}
|
801 |
+
|
802 |
+
.skills-section h3 {
|
803 |
+
color: #1a1a1a;
|
804 |
+
margin-bottom: 15px;
|
805 |
+
}
|
806 |
+
|
807 |
+
.skills-list {
|
808 |
+
display: flex;
|
809 |
+
flex-wrap: wrap;
|
810 |
+
gap: 8px;
|
811 |
+
justify-content: center;
|
812 |
+
}
|
813 |
+
|
814 |
+
.skill-tag {
|
815 |
+
background: #e4e6eb;
|
816 |
+
padding: 6px 12px;
|
817 |
+
border-radius: 16px;
|
818 |
+
font-size: 14px;
|
819 |
+
color: #050505;
|
820 |
+
}
|
821 |
+
|
822 |
+
/* أنماط المنشورات */
|
823 |
+
.posts-section {
|
824 |
+
margin-top: 20px;
|
825 |
+
}
|
826 |
+
|
827 |
+
.posts-section h2 {
|
828 |
+
color: #1a1a1a;
|
829 |
+
margin-bottom: 15px;
|
830 |
+
text-align: center;
|
831 |
+
}
|
832 |
+
|
833 |
+
.posts-container {
|
834 |
+
margin-top: 20px;
|
835 |
+
}
|
836 |
+
|
837 |
+
.post-card {
|
838 |
+
background: #fff;
|
839 |
+
border-radius: 8px;
|
840 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
841 |
+
margin-bottom: 20px;
|
842 |
+
}
|
843 |
+
|
844 |
+
.post-header {
|
845 |
+
display: flex;
|
846 |
+
align-items: center;
|
847 |
+
padding: 12px;
|
848 |
+
}
|
849 |
+
|
850 |
+
.post-content {
|
851 |
+
padding: 12px;
|
852 |
+
}
|
853 |
+
|
854 |
+
.post-title {
|
855 |
+
margin: 0 0 8px 0;
|
856 |
+
font-size: 18px;
|
857 |
+
text-align: right;
|
858 |
+
}
|
859 |
+
|
860 |
+
.post-content-box {
|
861 |
+
border-radius: 8px;
|
862 |
+
padding: 12px;
|
863 |
+
margin-bottom: 10px;
|
864 |
+
}
|
865 |
+
|
866 |
+
.post-text {
|
867 |
+
margin: 0;
|
868 |
+
color: #1a1a1a;
|
869 |
+
line-height: 1.6;
|
870 |
+
text-align: right;
|
871 |
+
word-wrap: break-word;
|
872 |
+
position: relative;
|
873 |
+
direction: rtl;
|
874 |
+
font-size: 16px;
|
875 |
+
}
|
876 |
+
|
877 |
+
.post-text p {
|
878 |
+
margin: 0;
|
879 |
+
padding: 4px 0;
|
880 |
+
line-height: 1.6;
|
881 |
+
}
|
882 |
+
|
883 |
+
.post-text.collapsed {
|
884 |
+
display: -webkit-box;
|
885 |
+
-webkit-line-clamp: 4;
|
886 |
+
-webkit-box-orient: vertical;
|
887 |
+
overflow: hidden;
|
888 |
+
}
|
889 |
+
|
890 |
+
.post-text.expanded {
|
891 |
+
display: block;
|
892 |
+
}
|
893 |
+
|
894 |
+
.post-text.expanded p {
|
895 |
+
white-space: pre-wrap;
|
896 |
+
padding: 2px 0;
|
897 |
+
}
|
898 |
+
|
899 |
+
.post-text p:first-child {
|
900 |
+
padding-top: 0;
|
901 |
+
}
|
902 |
+
|
903 |
+
.post-text p:last-child {
|
904 |
+
padding-bottom: 0;
|
905 |
+
}
|
906 |
+
|
907 |
+
.post-text p:empty {
|
908 |
+
min-height: 1em;
|
909 |
+
display: block;
|
910 |
+
}
|
911 |
+
|
912 |
+
.see-more-btn {
|
913 |
+
color: #1877f2;
|
914 |
+
cursor: pointer;
|
915 |
+
font-weight: 500;
|
916 |
+
margin-top: 8px;
|
917 |
+
display: none;
|
918 |
+
background: none;
|
919 |
+
border: none;
|
920 |
+
padding: 0;
|
921 |
+
text-align: right;
|
922 |
+
width: 100%;
|
923 |
+
}
|
924 |
+
|
925 |
+
.post-text-container {
|
926 |
+
position: relative;
|
927 |
+
}
|
928 |
+
|
929 |
+
.post-media {
|
930 |
+
margin-top: 10px;
|
931 |
+
border-radius: 8px;
|
932 |
+
overflow: hidden;
|
933 |
+
}
|
934 |
+
|
935 |
+
.post-media img {
|
936 |
+
width: 400px;
|
937 |
+
height: 400px;
|
938 |
+
display: block;
|
939 |
+
object-fit: cover;
|
940 |
+
margin: 0 auto;
|
941 |
+
}
|
942 |
+
|
943 |
+
.video-container {
|
944 |
+
position: relative;
|
945 |
+
padding-bottom: 56.25%;
|
946 |
+
height: 0;
|
947 |
+
overflow: hidden;
|
948 |
+
}
|
949 |
+
|
950 |
+
.video-container video {
|
951 |
+
position: absolute;
|
952 |
+
top: 0;
|
953 |
+
right: 0;
|
954 |
+
width: 100%;
|
955 |
+
height: 100%;
|
956 |
+
object-fit: cover;
|
957 |
+
}
|
958 |
+
|
959 |
+
.post-actions {
|
960 |
+
display: flex;
|
961 |
+
justify-content: space-around;
|
962 |
+
padding: 8px;
|
963 |
+
border-top: 1px solid #ddd;
|
964 |
+
}
|
965 |
+
|
966 |
+
.action-btn {
|
967 |
+
background: none;
|
968 |
+
border: none;
|
969 |
+
padding: 8px;
|
970 |
+
color: #65676b;
|
971 |
+
cursor: pointer;
|
972 |
+
font-size: 14px;
|
973 |
+
display: flex;
|
974 |
+
align-items: center;
|
975 |
+
gap: 5px;
|
976 |
+
}
|
977 |
+
|
978 |
+
.action-btn:hover {
|
979 |
+
background: #f0f2f5;
|
980 |
+
border-radius: 4px;
|
981 |
+
}
|
982 |
+
|
983 |
+
.action-btn i {
|
984 |
+
font-size: 16px;
|
985 |
+
}
|
986 |
+
|
987 |
+
.user-info {
|
988 |
+
display: flex;
|
989 |
+
flex-direction: column;
|
990 |
+
margin-right: 10px;
|
991 |
+
}
|
992 |
+
|
993 |
+
.timestamp {
|
994 |
+
font-size: 12px;
|
995 |
+
color: #65676b;
|
996 |
+
margin-top: 2px;
|
997 |
+
}
|
998 |
+
|
999 |
+
.profession {
|
1000 |
+
font-size: 12px;
|
1001 |
+
color: #4CAF50;
|
1002 |
+
margin-top: 2px;
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
.profile-circle {
|
1006 |
+
width: 40px;
|
1007 |
+
height: 40px;
|
1008 |
+
border-radius: 50%;
|
1009 |
+
overflow: hidden;
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
.profile-circle img {
|
1013 |
+
width: 100%;
|
1014 |
+
height: 100%;
|
1015 |
+
object-fit: cover;
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
/* Post Menu Styles */
|
1019 |
+
.post-menu {
|
1020 |
+
position: relative;
|
1021 |
+
margin-right: auto;
|
1022 |
+
padding: 8px;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
.menu-dots {
|
1026 |
+
cursor: pointer;
|
1027 |
+
color: #65676b;
|
1028 |
+
padding: 8px;
|
1029 |
+
border-radius: 50%;
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
.menu-dots:hover {
|
1033 |
+
background-color: #f0f2f5;
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
.menu-options {
|
1037 |
+
display: none;
|
1038 |
+
position: absolute;
|
1039 |
+
left: 0;
|
1040 |
+
top: 100%;
|
1041 |
+
background: white;
|
1042 |
+
border-radius: 8px;
|
1043 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
1044 |
+
z-index: 1000;
|
1045 |
+
min-width: 150px;
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
.menu-option {
|
1049 |
+
padding: 8px 16px;
|
1050 |
+
cursor: pointer;
|
1051 |
+
color: #050505;
|
1052 |
+
display: flex;
|
1053 |
+
align-items: center;
|
1054 |
+
gap: 8px;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
.menu-option:hover {
|
1058 |
+
background-color: #f0f2f5;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
.menu-option i {
|
1062 |
+
font-size: 16px;
|
1063 |
+
width: 20px;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
.delete-post {
|
1067 |
+
color: #dc3545;
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
/* Edit Title Modal */
|
1071 |
+
.edit-modal {
|
1072 |
+
display: none;
|
1073 |
+
position: fixed;
|
1074 |
+
top: 0;
|
1075 |
+
left: 0;
|
1076 |
+
width: 100%;
|
1077 |
+
height: 100%;
|
1078 |
+
background-color: rgba(0,0,0,0.5);
|
1079 |
+
z-index: 2000;
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
.edit-modal-content {
|
1083 |
+
position: relative;
|
1084 |
+
background: white;
|
1085 |
+
padding: 20px;
|
1086 |
+
border-radius: 8px;
|
1087 |
+
width: 90%;
|
1088 |
+
max-width: 500px;
|
1089 |
+
margin: 50px auto;
|
1090 |
+
}
|
1091 |
+
|
1092 |
+
.edit-modal textarea {
|
1093 |
+
width: 100%;
|
1094 |
+
padding: 12px;
|
1095 |
+
margin: 10px 0;
|
1096 |
+
border: 1px solid #ddd;
|
1097 |
+
border-radius: 4px;
|
1098 |
+
font-size: 16px;
|
1099 |
+
resize: vertical;
|
1100 |
+
min-height: 120px;
|
1101 |
+
text-align: right;
|
1102 |
+
direction: rtl;
|
1103 |
+
white-space: pre-wrap;
|
1104 |
+
line-height: 1.6;
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
.edit-modal-buttons {
|
1108 |
+
display: flex;
|
1109 |
+
justify-content: flex-end;
|
1110 |
+
gap: 10px;
|
1111 |
+
margin-top: 20px;
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
.edit-modal-buttons button {
|
1115 |
+
padding: 8px 16px;
|
1116 |
+
border: none;
|
1117 |
+
border-radius: 4px;
|
1118 |
+
cursor: pointer;
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
.edit-modal-buttons .save-btn {
|
1122 |
+
background-color: #4CAF50;
|
1123 |
+
color: white;
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
.edit-modal-buttons .cancel-btn {
|
1127 |
+
background-color: #f0f2f5;
|
1128 |
+
color: #050505;
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
/* Delete Confirmation Modal */
|
1132 |
+
.delete-modal {
|
1133 |
+
display: none;
|
1134 |
+
position: fixed;
|
1135 |
+
top: 0;
|
1136 |
+
left: 0;
|
1137 |
+
width: 100%;
|
1138 |
+
height: 100%;
|
1139 |
+
background-color: rgba(0,0,0,0.5);
|
1140 |
+
z-index: 2000;
|
1141 |
+
}
|
1142 |
+
|
1143 |
+
.delete-modal-content {
|
1144 |
+
position: relative;
|
1145 |
+
background: white;
|
1146 |
+
padding: 20px;
|
1147 |
+
border-radius: 8px;
|
1148 |
+
width: 90%;
|
1149 |
+
max-width: 500px;
|
1150 |
+
margin: 50px auto;
|
1151 |
+
text-align: center;
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
.delete-modal-buttons {
|
1155 |
+
display: flex;
|
1156 |
+
justify-content: center;
|
1157 |
+
gap: 10px;
|
1158 |
+
margin-top: 20px;
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
.delete-modal-buttons button {
|
1162 |
+
padding: 8px 16px;
|
1163 |
+
border: none;
|
1164 |
+
border-radius: 4px;
|
1165 |
+
cursor: pointer;
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
.delete-modal-buttons .confirm-delete {
|
1169 |
+
background-color: #dc3545;
|
1170 |
+
color: white;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
.delete-modal-buttons .cancel-delete {
|
1174 |
+
background-color: #f0f2f5;
|
1175 |
+
color: #050505;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
|
1179 |
+
.replies-toggle {
|
1180 |
+
margin-top: 5px;
|
1181 |
+
font-size: 14px;
|
1182 |
+
display: flex;
|
1183 |
+
align-items: center;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
.replies-toggle i {
|
1187 |
+
margin-right: 5px;
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
.nested-comments {
|
1191 |
+
margin-left: 20px;
|
1192 |
+
border-left: 1px solid #ddd;
|
1193 |
+
padding-left: 10px;
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
|
1197 |
+
.filter-buttons {
|
1198 |
+
display: flex;
|
1199 |
+
justify-content: center;
|
1200 |
+
gap: 10px;
|
1201 |
+
margin-bottom: 20px;
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
.filter-btn {
|
1205 |
+
padding: 8px 16px;
|
1206 |
+
border: none;
|
1207 |
+
border-radius: 20px;
|
1208 |
+
background-color: #f0f2f5;
|
1209 |
+
color: #1a1a1a;
|
1210 |
+
cursor: pointer;
|
1211 |
+
font-size: 14px;
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
.filter-btn.active {
|
1215 |
+
background-color: #4CAF50;
|
1216 |
+
color: white;
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
</style>
|
1220 |
+
|
1221 |
+
<!-- Edit Post Modal -->
|
1222 |
+
<div class="edit-modal" id="editModal">
|
1223 |
+
<div class="edit-modal-content">
|
1224 |
+
<h3>تعديل المنشور</h3>
|
1225 |
+
<textarea id="editContentInput" placeholder="أدخل محتوى المنشور" rows="5"></textarea>
|
1226 |
+
<div class="edit-modal-buttons">
|
1227 |
+
<button class="save-btn" id="saveEditBtn">حفظ</button>
|
1228 |
+
<button class="cancel-btn" id="cancelEditBtn">إلغاء</button>
|
1229 |
+
</div>
|
1230 |
+
</div>
|
1231 |
+
</div>
|
1232 |
+
|
1233 |
+
<!-- Delete Confirmation Modal -->
|
1234 |
+
<div class="delete-modal" id="deleteModal">
|
1235 |
+
<div class="delete-modal-content">
|
1236 |
+
<h3>تأكيد الحذف</h3>
|
1237 |
+
<p>هل أنت متأكد من حذف هذا المنشور؟</p>
|
1238 |
+
<div class="delete-modal-buttons">
|
1239 |
+
<button class="confirm-delete" id="confirmDeleteBtn">حذف</button>
|
1240 |
+
<button class="cancel-delete" id="cancelDeleteBtn">إلغاء</button>
|
1241 |
+
</div>
|
1242 |
+
</div>
|
1243 |
+
</div>
|
1244 |
+
|
1245 |
+
|
1246 |
+
|
1247 |
+
|
1248 |
+
|
1249 |
+
{% endblock %}
|
1250 |
+
|
1251 |
+
{% block scripts %}
|
1252 |
+
<script>
|
1253 |
+
// Comments Functionality
|
1254 |
+
// Comments Functionality
|
1255 |
+
$(document).ready(function () {
|
1256 |
+
const commentsContainer = $("#commentsFixedContainer");
|
1257 |
+
const commentsOverlay = $("#commentsOverlay");
|
1258 |
+
const closeComments = $(".close-comments");
|
1259 |
+
let currentPostId = null;
|
1260 |
+
|
1261 |
+
// Reply Modal Elements
|
1262 |
+
const replyContainer = $("#replyFixedContainer");
|
1263 |
+
const replyOverlay = $("#replyOverlay");
|
1264 |
+
const closeReply = $(".close-reply");
|
1265 |
+
let currentCommentId = null;
|
1266 |
+
|
1267 |
+
// تحميل التعليقات عند النقر على زر التعليق
|
1268 |
+
$(".comment-btn").click(function () {
|
1269 |
+
const postId = $(this).data("post-id");
|
1270 |
+
currentPostId = postId;
|
1271 |
+
|
1272 |
+
// تحميل التعليقات
|
1273 |
+
loadComments(postId);
|
1274 |
+
|
1275 |
+
// عرض الخلفية والحاوية
|
1276 |
+
commentsOverlay.css("display", "block");
|
1277 |
+
commentsContainer.css("display", "block");
|
1278 |
+
document.body.style.overflow = "hidden"; // منع السكرول في الصفحة الرئيسية
|
1279 |
+
setTimeout(() => {
|
1280 |
+
commentsContainer.addClass("active");
|
1281 |
+
}, 10);
|
1282 |
+
});
|
1283 |
+
|
1284 |
+
// إغلاق التعليقات عند النقر خارج الحاوية
|
1285 |
+
commentsOverlay.click(function () {
|
1286 |
+
closeCommentsContainer();
|
1287 |
+
});
|
1288 |
+
|
1289 |
+
// إغلاق حاوية التعليقات
|
1290 |
+
closeComments.click(function () {
|
1291 |
+
closeCommentsContainer();
|
1292 |
+
});
|
1293 |
+
|
1294 |
+
// دالة إغلاق حاوية التعليقات
|
1295 |
+
function closeCommentsContainer() {
|
1296 |
+
commentsContainer.removeClass("active");
|
1297 |
+
document.body.style.overflow = "auto"; // إعادة تفعيل السكرول في الصفحة الرئيسية
|
1298 |
+
setTimeout(() => {
|
1299 |
+
commentsContainer.css("display", "none");
|
1300 |
+
commentsOverlay.css("display", "none");
|
1301 |
+
}, 300);
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
// إرسال التعليق
|
1305 |
+
$(".send-comment-btn").click(function () {
|
1306 |
+
const input = commentsContainer.find(".comment-input");
|
1307 |
+
const content = input.val().trim();
|
1308 |
+
|
1309 |
+
if (content && currentPostId) {
|
1310 |
+
$.ajax({
|
1311 |
+
url: "/add_comment",
|
1312 |
+
method: "POST",
|
1313 |
+
data: {
|
1314 |
+
post_id: currentPostId,
|
1315 |
+
content: content,
|
1316 |
+
parent_id: null, // Root comment
|
1317 |
+
},
|
1318 |
+
success: function (response) {
|
1319 |
+
if (response.success) {
|
1320 |
+
input.val("");
|
1321 |
+
loadComments(currentPostId);
|
1322 |
+
}
|
1323 |
+
},
|
1324 |
+
});
|
1325 |
+
}
|
1326 |
+
});
|
1327 |
+
|
1328 |
+
// تحميل التعليقات
|
1329 |
+
function loadComments(postId) {
|
1330 |
+
$.get(`/get_comments/${postId}`, function (comments) {
|
1331 |
+
const commentsList = commentsContainer.find(".comments-list");
|
1332 |
+
commentsList.empty();
|
1333 |
+
|
1334 |
+
comments.forEach(function (comment) {
|
1335 |
+
const commentHtml = generateCommentHtml(comment);
|
1336 |
+
commentsList.append(commentHtml);
|
1337 |
+
});
|
1338 |
+
});
|
1339 |
+
}
|
1340 |
+
|
1341 |
+
// دالة لتوليد HTML للتعليقات والردود
|
1342 |
+
function generateCommentHtml(comment) {
|
1343 |
+
const hasReplies = comment.replies && comment.replies.length > 0;
|
1344 |
+
const repliesCount = hasReplies
|
1345 |
+
? `${comment.replies.length} رداً`
|
1346 |
+
: "";
|
1347 |
+
|
1348 |
+
const repliesHtml = hasReplies
|
1349 |
+
? comment.replies
|
1350 |
+
.map((reply) => generateReplyHtml(reply))
|
1351 |
+
.join("")
|
1352 |
+
: "";
|
1353 |
+
|
1354 |
+
return `
|
1355 |
+
<div class="comment-item">
|
1356 |
+
<div class="comment-user-avatar">
|
1357 |
+
<img src="/static/${
|
1358 |
+
comment.profile_photo
|
1359 |
+
}" alt="${comment.username}">
|
1360 |
+
</div>
|
1361 |
+
<div class="comment-bubble">
|
1362 |
+
<div class="comment-header">
|
1363 |
+
<span class="comment-username">${comment.username}</span>
|
1364 |
+
</div>
|
1365 |
+
<div class="comment-content">${comment.content}</div>
|
1366 |
+
<div class="comment-time">${comment.created_at}</div>
|
1367 |
+
|
1368 |
+
<!-- عرض زر الردود المخفية إذا كان هناك ردود -->
|
1369 |
+
${
|
1370 |
+
hasReplies
|
1371 |
+
? `
|
1372 |
+
<div class="replies-toggle" data-comment-id="${comment.id}">
|
1373 |
+
<span class="replies-toggle-text" style="color: blue; cursor: pointer;">
|
1374 |
+
<i class="fas fa-chevron-down"></i> ${repliesCount}
|
1375 |
+
</span>
|
1376 |
+
</div>
|
1377 |
+
`
|
1378 |
+
: ""
|
1379 |
+
}
|
1380 |
+
|
1381 |
+
<!-- زر الرد -->
|
1382 |
+
<button class="reply-btn" data-comment-id="${
|
1383 |
+
comment.id
|
1384 |
+
}" style="color: blue; cursor: pointer;">رد</button>
|
1385 |
+
|
1386 |
+
<!-- عرض الردود أسفل التعليق الرئيسي -->
|
1387 |
+
<div class="replies-container" style="display: ${
|
1388 |
+
hasReplies ? "block" : "none"
|
1389 |
+
};">
|
1390 |
+
${repliesHtml}
|
1391 |
+
</div>
|
1392 |
+
</div>
|
1393 |
+
</div>
|
1394 |
+
`;
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
// دالة لتوليد HTML للردود
|
1398 |
+
function generateReplyHtml(reply) {
|
1399 |
+
return `
|
1400 |
+
<div class="comment-item nested-comment">
|
1401 |
+
<div class="comment-user-avatar">
|
1402 |
+
<img src="/static/${
|
1403 |
+
reply.profile_photo
|
1404 |
+
}" alt="${reply.username}">
|
1405 |
+
</div>
|
1406 |
+
<div class="comment-bubble">
|
1407 |
+
<div class="comment-header">
|
1408 |
+
<span class="comment-username">${reply.username}</span>
|
1409 |
+
</div>
|
1410 |
+
<div class="comment-content">${reply.content}</div>
|
1411 |
+
<div class="comment-time">${reply.created_at}</div>
|
1412 |
+
</div>
|
1413 |
+
</div>
|
1414 |
+
`;
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
// إظهار حقل الرد عند النقر على زر الرد
|
1418 |
+
$(document).on("click", ".reply-btn", function () {
|
1419 |
+
currentCommentId = $(this).data("comment-id");
|
1420 |
+
replyOverlay.css("display", "block");
|
1421 |
+
replyContainer.css("display", "block");
|
1422 |
+
setTimeout(() => {
|
1423 |
+
replyContainer.addClass("active");
|
1424 |
+
}, 10);
|
1425 |
+
});
|
1426 |
+
|
1427 |
+
// إغلاق الرد عند النقر خارج الحاوية
|
1428 |
+
replyOverlay.click(function () {
|
1429 |
+
closeReplyContainer();
|
1430 |
+
});
|
1431 |
+
|
1432 |
+
// إغلاق حاوية الرد
|
1433 |
+
closeReply.click(function () {
|
1434 |
+
closeReplyContainer();
|
1435 |
+
});
|
1436 |
+
|
1437 |
+
// دالة إغلاق حاوية الرد
|
1438 |
+
function closeReplyContainer() {
|
1439 |
+
replyContainer.removeClass("active");
|
1440 |
+
setTimeout(() => {
|
1441 |
+
replyContainer.css("display", "none");
|
1442 |
+
replyOverlay.css("display", "none");
|
1443 |
+
}, 300);
|
1444 |
+
}
|
1445 |
+
|
1446 |
+
// إرسال الرد على تعليق
|
1447 |
+
$(".send-reply-btn").click(function () {
|
1448 |
+
const input = replyContainer.find(".reply-input");
|
1449 |
+
const content = input.val().trim();
|
1450 |
+
|
1451 |
+
if (content && currentPostId && currentCommentId) {
|
1452 |
+
$.ajax({
|
1453 |
+
url: "/add_comment",
|
1454 |
+
method: "POST",
|
1455 |
+
data: {
|
1456 |
+
post_id: currentPostId,
|
1457 |
+
content: content,
|
1458 |
+
parent_id: currentCommentId, // Associate reply with parent
|
1459 |
+
},
|
1460 |
+
success: function (response) {
|
1461 |
+
if (response.success) {
|
1462 |
+
input.val("");
|
1463 |
+
closeReplyContainer();
|
1464 |
+
loadComments(currentPostId);
|
1465 |
+
}
|
1466 |
+
},
|
1467 |
+
});
|
1468 |
+
}
|
1469 |
+
});
|
1470 |
+
|
1471 |
+
// إظهار أو إخفاء الردود عند النقر على زر "12 رداً" أو ما يعادله
|
1472 |
+
$(document).on("click", ".replies-toggle-text", function () {
|
1473 |
+
const toggle = $(this).closest(".replies-toggle");
|
1474 |
+
const repliesContainer = toggle.siblings(".replies-container");
|
1475 |
+
const icon = toggle.find("i");
|
1476 |
+
|
1477 |
+
if (repliesContainer.is(":visible")) {
|
1478 |
+
repliesContainer.slideUp();
|
1479 |
+
icon.removeClass("fa-chevron-up").addClass("fa-chevron-down");
|
1480 |
+
} else {
|
1481 |
+
repliesContainer.slideDown();
|
1482 |
+
icon.removeClass("fa-chevron-down").addClass("fa-chevron-up");
|
1483 |
+
}
|
1484 |
+
});
|
1485 |
+
});
|
1486 |
+
|
1487 |
+
|
1488 |
+
|
1489 |
+
</script>
|
1490 |
+
|
1491 |
+
<script>
|
1492 |
+
$(document).ready(function() {
|
1493 |
+
// تبديل عرض نموذج التعديل
|
1494 |
+
$('#editProfileBtn').click(function() {
|
1495 |
+
$('#editProfileForm').slideDown();
|
1496 |
+
});
|
1497 |
+
|
1498 |
+
$('#cancelEdit').click(function() {
|
1499 |
+
$('#editProfileForm').slideUp();
|
1500 |
+
});
|
1501 |
+
|
1502 |
+
// إدارة المهارات
|
1503 |
+
$('.add-skill').click(function() {
|
1504 |
+
const skillValue = $(this).siblings('.skill-field').val();
|
1505 |
+
if (skillValue.trim() !== "") {
|
1506 |
+
const skillInput = `
|
1507 |
+
<div class="skill-input">
|
1508 |
+
<input type="text" name="skill" class="skill-field" value="${skillValue}">
|
1509 |
+
<button type="button" class="remove-skill">-</button>
|
1510 |
+
</div>
|
1511 |
+
`;
|
1512 |
+
$(this).parent().before(skillInput);
|
1513 |
+
$(this).siblings('.skill-field').val("");
|
1514 |
+
}
|
1515 |
+
});
|
1516 |
+
|
1517 |
+
$(document).on('click', '.remove-skill', function() {
|
1518 |
+
$(this).parent().remove();
|
1519 |
+
});
|
1520 |
+
|
1521 |
+
// تقديم النموذج
|
1522 |
+
$('#profileForm').on('submit', function(e) {
|
1523 |
+
const skills = [];
|
1524 |
+
$('.skill-field').each(function() {
|
1525 |
+
const skill = $(this).val().trim();
|
1526 |
+
if (skill) {
|
1527 |
+
skills.push(skill);
|
1528 |
+
}
|
1529 |
+
});
|
1530 |
+
$('#skills').val(JSON.stringify(skills));
|
1531 |
+
});
|
1532 |
+
|
1533 |
+
// التحقق من اسم المستخدم
|
1534 |
+
$('#username').on('input', function() {
|
1535 |
+
const username = $(this).val();
|
1536 |
+
if (username && username !== '{{ current_user.username }}') {
|
1537 |
+
$.get('/validate-username', { username: username }, function(data) {
|
1538 |
+
if (data.exists) {
|
1539 |
+
$('#username-validation-message').text('اسم المستخدم مستخدم بالفعل').addClass('error').removeClass('success');
|
1540 |
+
} else {
|
1541 |
+
$('#username-validation-message').text('اسم المستخدم متاح').addClass('success').removeClass('error');
|
1542 |
+
}
|
1543 |
+
});
|
1544 |
+
} else {
|
1545 |
+
$('#username-validation-message').text('');
|
1546 |
+
}
|
1547 |
+
});
|
1548 |
+
|
1549 |
+
// تفعيل قائمة النقاط الثلاث
|
1550 |
+
$('.menu-dots').click(function(e) {
|
1551 |
+
e.stopPropagation();
|
1552 |
+
const menuOptions = $(this).siblings('.menu-options');
|
1553 |
+
$('.menu-options').not(menuOptions).hide();
|
1554 |
+
menuOptions.toggle();
|
1555 |
+
});
|
1556 |
+
|
1557 |
+
// إغلاق القائمة عند النقر في أي مكان آخر
|
1558 |
+
$(document).click(function() {
|
1559 |
+
$('.menu-options').hide();
|
1560 |
+
});
|
1561 |
+
|
1562 |
+
// منع إغلاق القائمة عند النقر داخلها
|
1563 |
+
$('.menu-options').click(function(e) {
|
1564 |
+
e.stopPropagation();
|
1565 |
+
});
|
1566 |
+
|
1567 |
+
let currentPostId = null;
|
1568 |
+
|
1569 |
+
// تفعيل زر تعديل المنشور
|
1570 |
+
$('.edit-post').click(function() {
|
1571 |
+
currentPostId = $(this).data('post-id');
|
1572 |
+
const $text = $(this).closest('.post-card').find('.post-text');
|
1573 |
+
const paragraphs = [];
|
1574 |
+
$text.find('p').each(function() {
|
1575 |
+
const content = $(this).text();
|
1576 |
+
if (content === '\u00A0') { //
|
1577 |
+
paragraphs.push('');
|
1578 |
+
} else {
|
1579 |
+
paragraphs.push(content);
|
1580 |
+
}
|
1581 |
+
});
|
1582 |
+
$('#editContentInput').val(paragraphs.join('\n'));
|
1583 |
+
$('#editModal').show();
|
1584 |
+
});
|
1585 |
+
|
1586 |
+
// إغلاق نافذة التعديل
|
1587 |
+
$('#cancelEditBtn').click(function() {
|
1588 |
+
$('#editModal').hide();
|
1589 |
+
});
|
1590 |
+
|
1591 |
+
// حفظ التعديل
|
1592 |
+
$('#saveEditBtn').click(function() {
|
1593 |
+
const newContent = $('#editContentInput').val();
|
1594 |
+
if (currentPostId && newContent.trim()) {
|
1595 |
+
$.ajax({
|
1596 |
+
url: '/edit_post_content',
|
1597 |
+
method: 'POST',
|
1598 |
+
data: {
|
1599 |
+
post_id: currentPostId,
|
1600 |
+
new_content: newContent
|
1601 |
+
},
|
1602 |
+
success: function(response) {
|
1603 |
+
if (response.success) {
|
1604 |
+
location.reload();
|
1605 |
+
}
|
1606 |
+
}
|
1607 |
+
});
|
1608 |
+
}
|
1609 |
+
$('#editModal').hide();
|
1610 |
+
});
|
1611 |
+
|
1612 |
+
// تفعيل زر حذف المنشور
|
1613 |
+
$('.delete-post').click(function() {
|
1614 |
+
currentPostId = $(this).data('post-id');
|
1615 |
+
$('#deleteModal').show();
|
1616 |
+
});
|
1617 |
+
|
1618 |
+
// إغلاق نافذة تأكيد الحذف
|
1619 |
+
$('#cancelDeleteBtn').click(function() {
|
1620 |
+
$('#deleteModal').hide();
|
1621 |
+
});
|
1622 |
+
|
1623 |
+
// تأكيد الحذف
|
1624 |
+
$('#confirmDeleteBtn').click(function() {
|
1625 |
+
if (currentPostId) {
|
1626 |
+
$.ajax({
|
1627 |
+
url: '/delete_post',
|
1628 |
+
method: 'POST',
|
1629 |
+
data: {
|
1630 |
+
post_id: currentPostId
|
1631 |
+
},
|
1632 |
+
success: function(response) {
|
1633 |
+
if (response.success) {
|
1634 |
+
location.reload();
|
1635 |
+
}
|
1636 |
+
}
|
1637 |
+
});
|
1638 |
+
}
|
1639 |
+
$('#deleteModal').hide();
|
1640 |
+
});
|
1641 |
+
|
1642 |
+
// تفعيل زر إظهار المزيد
|
1643 |
+
$('.post-text').each(function() {
|
1644 |
+
const $text = $(this);
|
1645 |
+
const $btn = $text.closest('.post-content-box').find('.see-more-btn');
|
1646 |
+
|
1647 |
+
// Get the original content
|
1648 |
+
const content = $text.html();
|
1649 |
+
|
1650 |
+
// Calculate line height and text height
|
1651 |
+
const lineHeight = parseInt(window.getComputedStyle($text[0]).lineHeight);
|
1652 |
+
const textHeight = $text[0].scrollHeight;
|
1653 |
+
const numLines = Math.floor(textHeight / lineHeight);
|
1654 |
+
|
1655 |
+
// Show button only if text has more than 4 lines
|
1656 |
+
if (numLines > 4) {
|
1657 |
+
$btn.show();
|
1658 |
+
$text.addClass('has-more');
|
1659 |
+
}
|
1660 |
+
});
|
1661 |
+
|
1662 |
+
$('.see-more-btn').click(function() {
|
1663 |
+
const $btn = $(this);
|
1664 |
+
const $text = $btn.closest('.post-content-box').find('.post-text');
|
1665 |
+
|
1666 |
+
if ($text.hasClass('collapsed')) {
|
1667 |
+
$text.removeClass('collapsed').addClass('expanded');
|
1668 |
+
$btn.text('إظهار أقل');
|
1669 |
+
} else {
|
1670 |
+
$text.removeClass('expanded').addClass('collapsed');
|
1671 |
+
$btn.text('إظهار المزيد');
|
1672 |
+
}
|
1673 |
+
});
|
1674 |
+
|
1675 |
+
// Profile Photo Upload Functionality
|
1676 |
+
$('#avatar').change(function(e) {
|
1677 |
+
if (this.files && this.files[0]) {
|
1678 |
+
const reader = new FileReader();
|
1679 |
+
reader.onload = function(e) {
|
1680 |
+
$('.profile-photo img').attr('src', e.target.result);
|
1681 |
+
}
|
1682 |
+
reader.readAsDataURL(this.files[0]);
|
1683 |
+
}
|
1684 |
+
});
|
1685 |
+
|
1686 |
+
// Remove Photo Functionality
|
1687 |
+
$('#removePhotoBtn').click(function() {
|
1688 |
+
$('.profile-photo img').attr('src', "{{ url_for('static', filename='uploads/default-avatar.jpg') }}");
|
1689 |
+
$('#avatar').val('');
|
1690 |
+
// Add a hidden input to signal photo removal
|
1691 |
+
if (!$('#remove_photo').length) {
|
1692 |
+
$('<input>').attr({
|
1693 |
+
type: 'hidden',
|
1694 |
+
id: 'remove_photo',
|
1695 |
+
name: 'remove_photo',
|
1696 |
+
value: 'true'
|
1697 |
+
}).appendTo('#profileForm');
|
1698 |
+
}
|
1699 |
+
});
|
1700 |
+
});
|
1701 |
+
|
1702 |
+
|
1703 |
+
|
1704 |
+
|
1705 |
+
document.addEventListener("DOMContentLoaded", function () {
|
1706 |
+
document.querySelectorAll(".share-btn").forEach(function (button) {
|
1707 |
+
button.addEventListener("click", function () {
|
1708 |
+
const postId = this.dataset.postId;
|
1709 |
+
const shareUrl = `${window.location.origin}/post/${postId}`;
|
1710 |
+
|
1711 |
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
1712 |
+
navigator.clipboard.writeText(shareUrl).then(function () {
|
1713 |
+
showPopup("تم نسخ الرابط");
|
1714 |
+
}).catch(function (err) {
|
1715 |
+
console.error("فشل نسخ الرابط: ", err);
|
1716 |
+
});
|
1717 |
+
} else {
|
1718 |
+
const tempInput = document.createElement("input");
|
1719 |
+
tempInput.value = shareUrl;
|
1720 |
+
document.body.appendChild(tempInput);
|
1721 |
+
tempInput.select();
|
1722 |
+
try {
|
1723 |
+
document.execCommand("copy");
|
1724 |
+
showPopup("تم نسخ الرابط ");
|
1725 |
+
} catch (err) {
|
1726 |
+
console.error("فشل نسخ الرابط باستخدام الطريقة البديلة: ", err);
|
1727 |
+
}
|
1728 |
+
document.body.removeChild(tempInput);
|
1729 |
+
}
|
1730 |
+
|
1731 |
+
function showPopup(message) {
|
1732 |
+
const modal = document.createElement("div");
|
1733 |
+
modal.style.position = "fixed";
|
1734 |
+
modal.style.bottom = "20%";
|
1735 |
+
modal.style.left = "50%";
|
1736 |
+
modal.style.transform = "translateX(-50%)";
|
1737 |
+
modal.style.backgroundColor = "#333";
|
1738 |
+
modal.style.color = "#fff";
|
1739 |
+
modal.style.padding = "15px 20px";
|
1740 |
+
modal.style.borderRadius = "8px";
|
1741 |
+
modal.style.boxShadow = "0 4px 6px rgba(0, 0, 0, 0.1)";
|
1742 |
+
modal.style.opacity = "0";
|
1743 |
+
modal.style.transition = "opacity 0.4s ease, bottom 0.4s ease";
|
1744 |
+
modal.style.zIndex = "1000";
|
1745 |
+
modal.textContent = message;
|
1746 |
+
|
1747 |
+
document.body.appendChild(modal);
|
1748 |
+
|
1749 |
+
setTimeout(() => {
|
1750 |
+
modal.style.opacity = "1";
|
1751 |
+
modal.style.bottom = "25%";
|
1752 |
+
}, 10);
|
1753 |
+
|
1754 |
+
setTimeout(() => {
|
1755 |
+
modal.style.opacity = "0";
|
1756 |
+
modal.style.bottom = "20%";
|
1757 |
+
setTimeout(() => {
|
1758 |
+
modal.remove();
|
1759 |
+
}, 400);
|
1760 |
+
}, 3000);
|
1761 |
+
}
|
1762 |
+
});
|
1763 |
+
});
|
1764 |
+
});
|
1765 |
+
|
1766 |
+
|
1767 |
+
|
1768 |
+
$(document).ready(function () {
|
1769 |
+
// تفعيل الفلترات
|
1770 |
+
$('.filter-btn').click(function () {
|
1771 |
+
// إزالة النشط من جميع الأزرار
|
1772 |
+
$('.filter-btn').removeClass('active');
|
1773 |
+
// إضافة النشط للزر المحدد
|
1774 |
+
$(this).addClass('active');
|
1775 |
+
|
1776 |
+
const filterType = $(this).attr('id'); // الحصول على نوع الفلتر
|
1777 |
+
let hasPosts = false; // متغير لتتبع وجود منشورات مطابقة
|
1778 |
+
|
1779 |
+
// إخفاء جميع المنشورات
|
1780 |
+
$('.post-card').hide();
|
1781 |
+
|
1782 |
+
if (filterType === 'filterAll') {
|
1783 |
+
// عرض جميع المنشورات
|
1784 |
+
$('.post-card').show();
|
1785 |
+
hasPosts = $('.post-card').length > 0; // تحقق إذا كان هناك منشورات
|
1786 |
+
} else if (filterType === 'filterImages') {
|
1787 |
+
// عرض المنشورات التي تحتوي على صور فقط
|
1788 |
+
$('.post-card').each(function () {
|
1789 |
+
if ($(this).find('.post-media img').length > 0) {
|
1790 |
+
$(this).show();
|
1791 |
+
hasPosts = true; // يوجد منشورات مطابقة
|
1792 |
+
}
|
1793 |
+
});
|
1794 |
+
} else if (filterType === 'filterVideos') {
|
1795 |
+
// عرض المنشورات التي تحتوي على فيديوهات فقط
|
1796 |
+
$('.post-card').each(function () {
|
1797 |
+
if ($(this).find('.post-media video').length > 0) {
|
1798 |
+
$(this).show();
|
1799 |
+
hasPosts = true; // يوجد منشورات مطابقة
|
1800 |
+
}
|
1801 |
+
});
|
1802 |
+
} else if (filterType === 'filterText') {
|
1803 |
+
// عرض المنشورات التي تحتوي على نص فقط
|
1804 |
+
$('.post-card').each(function () {
|
1805 |
+
if ($(this).find('.post-text').length > 0 && $(this).find('.post-media').length === 0) {
|
1806 |
+
$(this).show();
|
1807 |
+
hasPosts = true; // يوجد منشورات مطابقة
|
1808 |
+
}
|
1809 |
+
});
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
// إظهار أو إخفاء الرسالة بناءً على وجود منشورات مطابقة
|
1813 |
+
if (hasPosts) {
|
1814 |
+
$('#noPostsMessage').hide(); // إخفاء الرسالة إذا كانت هناك منشورات
|
1815 |
+
} else {
|
1816 |
+
$('#noPostsMessage').show(); // إظهار الرسالة إذا لم تكن هناك منشورات
|
1817 |
+
}
|
1818 |
+
});
|
1819 |
+
});
|
1820 |
+
|
1821 |
+
// فكرة بحيث يظهر مشاركة عبر
|
1822 |
+
|
1823 |
+
|
1824 |
+
|
1825 |
+
|
1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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}{{ user.username }} - الملف الشخصي{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="profile-container">
|
7 |
+
<!-- قسم معلومات الملف الشخصي -->
|
8 |
+
<div class="profile-header">
|
9 |
+
<div class="cover-photo"></div>
|
10 |
+
<div class="profile-info">
|
11 |
+
<div class="profile-photo">
|
12 |
+
<img src="{{ url_for('static', filename=user.profile_photo) }}" alt="الصورة الشخصية">
|
13 |
+
</div>
|
14 |
+
<h1 class="profile-name">{{ user.username }}</h1>
|
15 |
+
<div class="profile-details">
|
16 |
+
<div class="detail-item">
|
17 |
+
<i class="fas fa-envelope"></i>
|
18 |
+
<span>{{ user.email }}</span>
|
19 |
+
</div>
|
20 |
+
<div class="detail-item">
|
21 |
+
<i class="fas fa-briefcase"></i>
|
22 |
+
<span>{{ user.profession }}</span>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<div class="skills-section">
|
26 |
+
<h3>المهارات</h3>
|
27 |
+
<div class="skills-list">
|
28 |
+
{% for skill in user.skills|from_json %}
|
29 |
+
<span class="skill-tag">{{ skill }}</span>
|
30 |
+
{% endfor %}
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<!-- <button id="editProfileBtn" class="edit-btn">
|
34 |
+
<i class="fas fa-edit"></i>
|
35 |
+
تعديل الملف الشخصي
|
36 |
+
</button> -->
|
37 |
+
</div>
|
38 |
+
</div>
|
39 |
+
|
40 |
+
</button>
|
41 |
+
<!-- زر المراسلة -->
|
42 |
+
<a href="#" class="message-btn" onclick="openMessage()">
|
43 |
+
<i class="fas fa-envelope"></i>
|
44 |
+
مراسلة
|
45 |
+
</a>
|
46 |
+
|
47 |
+
<!-- الحاوية الأساسية للرسالة (بدون iframe مسبقًا) -->
|
48 |
+
<div id="message-container" class="show" style="display: none;">
|
49 |
+
<div id="message-header">
|
50 |
+
<!-- <button id="close-btn">×</button> -->
|
51 |
+
</div>
|
52 |
+
<!-- سيتم إضافة iframe هنا ديناميكيًا -->
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<div class="filter-buttons">
|
56 |
+
<button id="filterAll" class="filter-btn active">الكل</button>
|
57 |
+
<button id="filterImages" class="filter-btn">الصور</button>
|
58 |
+
<button id="filterVideos" class="filter-btn">الفيديوهات</button>
|
59 |
+
<button id="filterText" class="filter-btn">النص</button>
|
60 |
+
</div>
|
61 |
+
|
62 |
+
<div id="noPostsMessage" style="display: none; text-align: center; margin-top: 20px; color: #666;">
|
63 |
+
لا توجد منشورات تطابق الفلتر المحدد.
|
64 |
+
</div>
|
65 |
+
|
66 |
+
<!-- نموذج تعديل الملف الشخصي -->
|
67 |
+
<div id="editProfileForm" class="edit-form" style="display: none;">
|
68 |
+
<h2>تعديل الملف الشخصي</h2>
|
69 |
+
<form id="profileForm" method="POST" action="{{ url_for('update_profile') }}" enctype="multipart/form-data">
|
70 |
+
<div class="form-group">
|
71 |
+
<label>الصورة الشخصية</label>
|
72 |
+
<div class="profile-photo-upload">
|
73 |
+
<input type="file" id="avatar" name="avatar" accept="image/*" class="avatar-input">
|
74 |
+
<label for="avatar" class="upload-btn">
|
75 |
+
<i class="fas fa-camera"></i>
|
76 |
+
تغيير الصورة
|
77 |
+
</label>
|
78 |
+
<button type="button" class="remove-photo-btn" id="removePhotoBtn">
|
79 |
+
<i class="fas fa-times"></i>
|
80 |
+
إزالة الصورة
|
81 |
+
</button>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
<div class="form-group">
|
85 |
+
<label for="username">اسم المستخدم</label>
|
86 |
+
<input type="text" id="username" name="username" value="{{ user.username }}" required>
|
87 |
+
<small class="form-text">@moltka.eg</small>
|
88 |
+
<span id="username-validation-message"></span>
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<div class="form-group">
|
92 |
+
<label for="profession">المجال المهني</label>
|
93 |
+
<select id="profession" name="profession" required>
|
94 |
+
<option value="">اختر المجال المهني</option>
|
95 |
+
<option value="مطور ويب" {% if user.profession == "مطور ويب" %}selected{% endif %}>مطور ويب</option>
|
96 |
+
<option value="مطور واجهة خلفية" {% if user.profession == "مطور واجهة خلفية" %}selected{% endif %}>مطور واجهة خلفية</option>
|
97 |
+
<option value="برمجة" {% if user.profession == "برمجة" %}selected{% endif %}>برمجة</option>
|
98 |
+
<option value="مطور ألعاب" {% if user.profession == "مطور ألعاب" %}selected{% endif %}>مطور ألعاب</option>
|
99 |
+
<option value="مطور أندرويد" {% if user.profession == "مطور أندرويد" %}selected{% endif %}>مطور أندرويد</option>
|
100 |
+
<option value="مطور iOS" {% if user.profession == "مطور iOS" %}selected{% endif %}>مطور iOS</option>
|
101 |
+
<option value="مهندس" {% if user.profession == "مهندس" %}selected{% endif %}>مهندس</option>
|
102 |
+
<option value="طبيب" {% if user.profession == "طبيب" %}selected{% endif %}>طبيب</option>
|
103 |
+
<option value="علوم اجتماعية" {% if user.profession == "علوم اجتماعية" %}selected{% endif %}>علوم اجتماعية</option>
|
104 |
+
<option value="معلم" {% if user.profession == "معلم" %}selected{% endif %}>معلم</option>
|
105 |
+
<option value="محاسب" {% if user.profession == "محاسب" %}selected{% endif %}>محاسب</option>
|
106 |
+
<option value="صحفي" {% if user.profession == "صحفي" %}selected{% endif %}>صحفي</option>
|
107 |
+
<option value="محامي" {% if user.profession == "محامي" %}selected{% endif %}>محامي</option>
|
108 |
+
<option value="مصمم جرافيكي" {% if user.profession == "مصمم جرافيكي" %}selected{% endif %}>مصمم جرافيكي</option>
|
109 |
+
<option value="مصور" {% if user.profession == "مصور" %}selected{% endif %}>مصور</option>
|
110 |
+
<option value="كاتب" {% if user.profession == "كاتب" %}selected{% endif %}>كاتب</option>
|
111 |
+
<option value="مدرب رياضي" {% if user.profession == "مدرب رياضي" %}selected{% endif %}>مدرب رياضي</option>
|
112 |
+
<option value="طاهي" {% if user.profession == "طاهي" %}selected{% endif %}>طاهي</option>
|
113 |
+
<option value="ديني" {% if user.profession == "ديني" %}selected{% endif %}>ديني</option>
|
114 |
+
<option value="شاعر" {% if user.profession == "شاعر" %}selected{% endif %}>شاعر</option>
|
115 |
+
<option value="رسام" {% if user.profession == "رسام" %}selected{% endif %}>رسام</option>
|
116 |
+
<option value="محلل مالي" {% if user.profession == "محلل مالي" %}selected{% endif %}>محلل مالي</option>
|
117 |
+
<option value="فني صيانة" {% if user.profession == "فني صيانة" %}selected{% endif %}>فني صيانة</option>
|
118 |
+
<option value="باحث" {% if user.profession == "باحث" %}selected{% endif %}>باحث</option>
|
119 |
+
<option value="IT" {% if user.profession == "IT" %}selected{% endif %}>IT</option>
|
120 |
+
</select>
|
121 |
+
</div>
|
122 |
+
|
123 |
+
<div class="form-group">
|
124 |
+
<label>المهارات</label>
|
125 |
+
<div id="skills-container">
|
126 |
+
{% for skill in user.skills|from_json %}
|
127 |
+
<div class="skill-input">
|
128 |
+
<input type="text" name="skill" class="skill-field" value="{{ skill }}">
|
129 |
+
<button type="button" class="remove-skill">-</button>
|
130 |
+
</div>
|
131 |
+
{% endfor %}
|
132 |
+
<div class="skill-input">
|
133 |
+
<input type="text" name="skill" class="skill-field">
|
134 |
+
<button type="button" class="add-skill">+</button>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
<input type="hidden" id="skills" name="skills">
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<div class="form-actions">
|
141 |
+
<button type="submit" class="save-btn">حفظ التغييرات</button>
|
142 |
+
<button type="button" class="cancel-btn" id="cancelEdit">إلغاء</button>
|
143 |
+
</div>
|
144 |
+
</form>
|
145 |
+
</div>
|
146 |
+
|
147 |
+
<!-- قسم المنشورات -->
|
148 |
+
<div class="posts-section">
|
149 |
+
<h2>المنشورات</h2>
|
150 |
+
<div class="posts-container">
|
151 |
+
{% for post in posts %}
|
152 |
+
<div class="post-card">
|
153 |
+
<div class="post-header">
|
154 |
+
<div class="profile-circle">
|
155 |
+
<img src="{{ url_for('static', filename=user.profile_photo) }}" alt="صورة الملف الشخصي">
|
156 |
+
</div>
|
157 |
+
<div class="user-info">
|
158 |
+
<span class="username">{{ user.username }}</span>
|
159 |
+
<span class="profession">{{ post.user_profession }}</span>
|
160 |
+
<span class="timestamp">{{ post.created_at|format_datetime }}</span>
|
161 |
+
</div>
|
162 |
+
<div class="post-menu">
|
163 |
+
<!-- <i class="fas fa-ellipsis-v menu-dots"></i> -->
|
164 |
+
<div class="menu-options">
|
165 |
+
<div class="menu-option edit-post" data-post-id="{{ post.id }}">
|
166 |
+
<i class="fas fa-edit"></i> تعديل المنشور
|
167 |
+
</div>
|
168 |
+
<div class="menu-option delete-post" data-post-id="{{ post.id }}">
|
169 |
+
<i class="fas fa-trash"></i> حذف المنشور
|
170 |
+
</div>
|
171 |
+
</div>
|
172 |
+
</div>
|
173 |
+
</div>
|
174 |
+
|
175 |
+
<div class="post-content" {% if post.background_color and not post.image_url %}style="background-color: {{ post.background_color }}; border-radius: 8px; text-align: center; font-size: 24px;"{% endif %}>
|
176 |
+
{% if post.title %}
|
177 |
+
<h3 class="post-title">{{ post.title }}</h3>
|
178 |
+
{% endif %}
|
179 |
+
{% if post.content %}
|
180 |
+
<div class="post-text-container">
|
181 |
+
<div class="post-content-box">
|
182 |
+
<div class="post-text collapsed" {% if post.background_color and not post.image_url %}style="color: {% if post.background_color == '#ffffff' %}#1a1a1a{% else %}#000000{% endif %};"{% endif %}>
|
183 |
+
{% for line in post.content.split('\n') %}
|
184 |
+
{% if line.strip() %}
|
185 |
+
<p>{{ line }}</p>
|
186 |
+
{% else %}
|
187 |
+
<p> </p>
|
188 |
+
{% endif %}
|
189 |
+
{% endfor %}
|
190 |
+
</div>
|
191 |
+
<button class="see-more-btn" style="display: none;">إظهار المزيد</button>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
{% endif %}
|
195 |
+
{% if post.image_url %}
|
196 |
+
<div class="post-media">
|
197 |
+
<img src="{{ url_for('static', filename=post.image_url) }}" alt="صورة المنشور">
|
198 |
+
</div>
|
199 |
+
{% endif %}
|
200 |
+
{% if post.video_url %}
|
201 |
+
<div class="post-media video-container">
|
202 |
+
<video src="{{ url_for('static', filename=post.video_url) }}" controls></video>
|
203 |
+
</div>
|
204 |
+
{% endif %}
|
205 |
+
</div>
|
206 |
+
|
207 |
+
<div class="post-actions">
|
208 |
+
<button class="action-btn comment-btn" data-post-id="{{ post.id }}">
|
209 |
+
<i class="fas fa-comment"></i> تعليق
|
210 |
+
</button>
|
211 |
+
<button class="action-btn share-btn" data-post-id="{{ post.id }}">
|
212 |
+
<i class="fas fa-share"></i> مشاركة
|
213 |
+
</button>
|
214 |
+
</div>
|
215 |
+
</div>
|
216 |
+
{% endfor %}
|
217 |
+
</div>
|
218 |
+
</div>
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
<!-- Comments Fixed Container -->
|
223 |
+
<div class="comments-overlay" id="commentsOverlay"></div>
|
224 |
+
<div class="comments-fixed-container" id="commentsFixedContainer">
|
225 |
+
<div class="comments-content">
|
226 |
+
<div class="comments-header">
|
227 |
+
<h3>التعليقات</h3>
|
228 |
+
<span class="close-comments">×</span>
|
229 |
+
</div>
|
230 |
+
<div class="comments-list-container">
|
231 |
+
<div class="comments-list"></div>
|
232 |
+
</div>
|
233 |
+
<div class="comment-input-container">
|
234 |
+
<textarea
|
235 |
+
class="comment-input"
|
236 |
+
placeholder="اكتب تعليقك هنا..."
|
237 |
+
rows="1"
|
238 |
+
></textarea>
|
239 |
+
<button class="send-comment-btn">
|
240 |
+
<i class="fas fa-paper-plane"></i>
|
241 |
+
</button>
|
242 |
+
</div>
|
243 |
+
</div>
|
244 |
+
</div>
|
245 |
+
|
246 |
+
<div class="reply-overlay" id="replyOverlay"></div>
|
247 |
+
<div class="reply-fixed-container" id="replyFixedContainer">
|
248 |
+
<div class="reply-content">
|
249 |
+
<div class="reply-header">
|
250 |
+
<h3>الرد</h3>
|
251 |
+
<span class="close-reply">×</span>
|
252 |
+
</div>
|
253 |
+
<div class="reply-input-container">
|
254 |
+
<textarea
|
255 |
+
class="reply-input"
|
256 |
+
placeholder="اكتب ردك هنا..."
|
257 |
+
rows="1"
|
258 |
+
></textarea>
|
259 |
+
<button class="send-reply-btn">
|
260 |
+
<i class="fas fa-paper-plane"></i>
|
261 |
+
</button>
|
262 |
+
</div>
|
263 |
+
</div>
|
264 |
+
</div>
|
265 |
+
|
266 |
+
<!-- زر العودة للصفحة الرئيسية -->
|
267 |
+
<!-- <a href="{{ url_for('dashboard') }}" class="back-btn">
|
268 |
+
<i class="fas fa-arrow-left"></i>
|
269 |
+
العودة للرئيسية
|
270 |
+
</a> -->
|
271 |
+
|
272 |
+
<style>
|
273 |
+
/* Comments Fixed Container Styles */
|
274 |
+
.comments-overlay {
|
275 |
+
display: none;
|
276 |
+
position: fixed;
|
277 |
+
top: 0;
|
278 |
+
left: 0;
|
279 |
+
right: 0;
|
280 |
+
bottom: 0;
|
281 |
+
background-color: rgba(0, 0, 0, 0.5);
|
282 |
+
z-index: 1999;
|
283 |
+
}
|
284 |
+
|
285 |
+
.comments-fixed-container {
|
286 |
+
display: none;
|
287 |
+
position: fixed;
|
288 |
+
bottom: 0;
|
289 |
+
left: 0;
|
290 |
+
right: 0;
|
291 |
+
height: 80%;
|
292 |
+
background: white;
|
293 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
294 |
+
z-index: 2000;
|
295 |
+
transform: translateY(100%);
|
296 |
+
transition: transform 0.3s ease-out;
|
297 |
+
}
|
298 |
+
|
299 |
+
.comments-fixed-container.active {
|
300 |
+
transform: translateY(0);
|
301 |
+
}
|
302 |
+
|
303 |
+
.comments-content {
|
304 |
+
height: 100%;
|
305 |
+
display: flex;
|
306 |
+
flex-direction: column;
|
307 |
+
}
|
308 |
+
|
309 |
+
.comments-header {
|
310 |
+
padding: 16px;
|
311 |
+
border-bottom: 1px solid #ddd;
|
312 |
+
display: flex;
|
313 |
+
justify-content: space-between;
|
314 |
+
align-items: center;
|
315 |
+
}
|
316 |
+
|
317 |
+
.comments-header h3 {
|
318 |
+
margin: 0;
|
319 |
+
text-align: center;
|
320 |
+
flex-grow: 1;
|
321 |
+
}
|
322 |
+
|
323 |
+
.close-comments {
|
324 |
+
font-size: 24px;
|
325 |
+
cursor: pointer;
|
326 |
+
color: #666;
|
327 |
+
padding: 8px;
|
328 |
+
}
|
329 |
+
|
330 |
+
.comments-list-container {
|
331 |
+
flex-grow: 1;
|
332 |
+
overflow-y: auto;
|
333 |
+
padding: 16px;
|
334 |
+
}
|
335 |
+
|
336 |
+
.comments-container {
|
337 |
+
flex-grow: 1;
|
338 |
+
overflow-y: auto;
|
339 |
+
padding: 16px;
|
340 |
+
}
|
341 |
+
|
342 |
+
.comment-input-container {
|
343 |
+
padding: 12px;
|
344 |
+
border-top: 1px solid #ddd;
|
345 |
+
background: white;
|
346 |
+
display: flex;
|
347 |
+
gap: 8px;
|
348 |
+
align-items: flex-start;
|
349 |
+
}
|
350 |
+
|
351 |
+
.comment-input {
|
352 |
+
flex: 1;
|
353 |
+
padding: 12px;
|
354 |
+
border: 1px solid #ddd;
|
355 |
+
border-radius: 20px;
|
356 |
+
resize: none;
|
357 |
+
font-size: 14px;
|
358 |
+
direction: rtl;
|
359 |
+
}
|
360 |
+
|
361 |
+
.send-comment-btn {
|
362 |
+
background: #4caf50;
|
363 |
+
color: white;
|
364 |
+
border: none;
|
365 |
+
width: 36px;
|
366 |
+
height: 36px;
|
367 |
+
border-radius: 50%;
|
368 |
+
display: flex;
|
369 |
+
align-items: center;
|
370 |
+
justify-content: center;
|
371 |
+
cursor: pointer;
|
372 |
+
}
|
373 |
+
|
374 |
+
.send-comment-btn:hover {
|
375 |
+
background: #45a049;
|
376 |
+
}
|
377 |
+
|
378 |
+
.comments-list {
|
379 |
+
display: flex;
|
380 |
+
flex-direction: column;
|
381 |
+
gap: 12px;
|
382 |
+
direction: rtl;
|
383 |
+
}
|
384 |
+
|
385 |
+
.comment-item {
|
386 |
+
display: flex;
|
387 |
+
gap: 8px;
|
388 |
+
margin-bottom: 12px;
|
389 |
+
align-items: flex-start;
|
390 |
+
padding: 0 8px;
|
391 |
+
}
|
392 |
+
|
393 |
+
.comment-user-avatar {
|
394 |
+
width: 45px;
|
395 |
+
height: 45px;
|
396 |
+
flex-shrink: 0;
|
397 |
+
margin-left: 8px;
|
398 |
+
}
|
399 |
+
|
400 |
+
.comment-user-avatar img {
|
401 |
+
width: 100%;
|
402 |
+
height: 100%;
|
403 |
+
border-radius: 50%;
|
404 |
+
object-fit: cover;
|
405 |
+
}
|
406 |
+
|
407 |
+
.comment-bubble {
|
408 |
+
background: #f0f2f5;
|
409 |
+
border-radius: 18px;
|
410 |
+
padding: 8px 12px;
|
411 |
+
flex-grow: 1;
|
412 |
+
}
|
413 |
+
|
414 |
+
.comment-header {
|
415 |
+
margin-bottom: 4px;
|
416 |
+
}
|
417 |
+
|
418 |
+
.comment-username {
|
419 |
+
font-weight: 600;
|
420 |
+
color: #050505;
|
421 |
+
font-size: 13px;
|
422 |
+
}
|
423 |
+
|
424 |
+
.comment-content {
|
425 |
+
color: #050505;
|
426 |
+
font-size: 14px;
|
427 |
+
line-height: 1.4;
|
428 |
+
word-wrap: break-word;
|
429 |
+
}
|
430 |
+
|
431 |
+
.comment-time {
|
432 |
+
font-size: 11px;
|
433 |
+
color: #65676b;
|
434 |
+
margin-top: 4px;
|
435 |
+
}
|
436 |
+
|
437 |
+
.nested-comments {
|
438 |
+
margin-left: 20px;
|
439 |
+
}
|
440 |
+
|
441 |
+
.reply-input-container {
|
442 |
+
margin-top: 10px;
|
443 |
+
}
|
444 |
+
|
445 |
+
.reply-text {
|
446 |
+
width: 100%;
|
447 |
+
padding: 12px;
|
448 |
+
border: 1px solid #ddd;
|
449 |
+
border-radius: 20px;
|
450 |
+
resize: none;
|
451 |
+
font-size: 14px;
|
452 |
+
direction: rtl;
|
453 |
+
}
|
454 |
+
|
455 |
+
.send-reply-btn {
|
456 |
+
margin-top: 5px;
|
457 |
+
color: white;
|
458 |
+
background-color: blue;
|
459 |
+
border: none;
|
460 |
+
padding: 5px 10px;
|
461 |
+
cursor: pointer;
|
462 |
+
}
|
463 |
+
|
464 |
+
/* Reply Modal Styles */
|
465 |
+
.reply-overlay {
|
466 |
+
display: none;
|
467 |
+
position: fixed;
|
468 |
+
top: 0;
|
469 |
+
left: 0;
|
470 |
+
right: 0;
|
471 |
+
bottom: 0;
|
472 |
+
background-color: rgba(0, 0, 0, 0.5);
|
473 |
+
z-index: 2001;
|
474 |
+
}
|
475 |
+
|
476 |
+
.reply-fixed-container {
|
477 |
+
display: none;
|
478 |
+
position: fixed;
|
479 |
+
bottom: 0;
|
480 |
+
left: 0;
|
481 |
+
right: 0;
|
482 |
+
height: 30%;
|
483 |
+
background: white;
|
484 |
+
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
485 |
+
z-index: 2002;
|
486 |
+
transform: translateY(100%);
|
487 |
+
transition: transform 0.3s ease-out;
|
488 |
+
}
|
489 |
+
|
490 |
+
.reply-fixed-container.active {
|
491 |
+
transform: translateY(0);
|
492 |
+
}
|
493 |
+
|
494 |
+
.reply-content {
|
495 |
+
height: 100%;
|
496 |
+
display: flex;
|
497 |
+
flex-direction: column;
|
498 |
+
}
|
499 |
+
|
500 |
+
.reply-header {
|
501 |
+
padding: 16px;
|
502 |
+
border-bottom: 1px solid #ddd;
|
503 |
+
display: flex;
|
504 |
+
justify-content: space-between;
|
505 |
+
align-items: center;
|
506 |
+
}
|
507 |
+
|
508 |
+
.reply-header h3 {
|
509 |
+
margin: 0;
|
510 |
+
text-align: center;
|
511 |
+
flex-grow: 1;
|
512 |
+
}
|
513 |
+
|
514 |
+
.close-reply {
|
515 |
+
font-size: 24px;
|
516 |
+
cursor: pointer;
|
517 |
+
color: #666;
|
518 |
+
padding: 8px;
|
519 |
+
}
|
520 |
+
|
521 |
+
.reply-input-container {
|
522 |
+
padding: 12px;
|
523 |
+
border-top: 1px solid #ddd;
|
524 |
+
background: white;
|
525 |
+
display: flex;
|
526 |
+
gap: 8px;
|
527 |
+
align-items: flex-start;
|
528 |
+
}
|
529 |
+
|
530 |
+
.reply-input {
|
531 |
+
flex: 1;
|
532 |
+
padding: 12px;
|
533 |
+
border: 1px solid #ddd;
|
534 |
+
border-radius: 20px;
|
535 |
+
resize: none;
|
536 |
+
font-size: 14px;
|
537 |
+
direction: rtl;
|
538 |
+
}
|
539 |
+
|
540 |
+
.send-reply-btn {
|
541 |
+
background: #4caf50;
|
542 |
+
color: white;
|
543 |
+
border: none;
|
544 |
+
width: 36px;
|
545 |
+
height: 36px;
|
546 |
+
border-radius: 50%;
|
547 |
+
display: flex;
|
548 |
+
align-items: center;
|
549 |
+
justify-content: center;
|
550 |
+
cursor: pointer;
|
551 |
+
|
552 |
+
}
|
553 |
+
.reply-btn{
|
554 |
+
color: blue;
|
555 |
+
cursor: pointer;
|
556 |
+
margin-right: 82%;
|
557 |
+
transform: translate(0%, -18px);
|
558 |
+
}
|
559 |
+
|
560 |
+
.send-reply-btn:hover {
|
561 |
+
background: #45a049;
|
562 |
+
}
|
563 |
+
|
564 |
+
|
565 |
+
/* أنماط زر التعديل */
|
566 |
+
|
567 |
+
|
568 |
+
.edit-btn {
|
569 |
+
background: #4CAF50;
|
570 |
+
color: white;
|
571 |
+
border: none;
|
572 |
+
padding: 8px 16px;
|
573 |
+
border-radius: 20px;
|
574 |
+
cursor: pointer;
|
575 |
+
font-size: 14px;
|
576 |
+
display: flex;
|
577 |
+
align-items: center;
|
578 |
+
gap: 8px;
|
579 |
+
margin: 20px auto 0;
|
580 |
+
}
|
581 |
+
|
582 |
+
.edit-btn:hover {
|
583 |
+
background: #45a049;
|
584 |
+
}
|
585 |
+
|
586 |
+
/* Profile Photo Upload Styles */
|
587 |
+
.profile-photo-upload {
|
588 |
+
display: flex;
|
589 |
+
gap: 10px;
|
590 |
+
justify-content: center;
|
591 |
+
margin-bottom: 20px;
|
592 |
+
}
|
593 |
+
|
594 |
+
.avatar-input {
|
595 |
+
display: none;
|
596 |
+
}
|
597 |
+
|
598 |
+
.upload-btn {
|
599 |
+
background: #4CAF50;
|
600 |
+
color: white;
|
601 |
+
padding: 8px 16px;
|
602 |
+
border-radius: 20px;
|
603 |
+
cursor: pointer;
|
604 |
+
font-size: 14px;
|
605 |
+
display: flex;
|
606 |
+
align-items: center;
|
607 |
+
gap: 8px;
|
608 |
+
}
|
609 |
+
|
610 |
+
.upload-btn:hover {
|
611 |
+
background: #45a049;
|
612 |
+
}
|
613 |
+
|
614 |
+
.remove-photo-btn {
|
615 |
+
background: #f44336;
|
616 |
+
color: white;
|
617 |
+
padding: 8px 16px;
|
618 |
+
border-radius: 20px;
|
619 |
+
border: none;
|
620 |
+
cursor: pointer;
|
621 |
+
font-size: 14px;
|
622 |
+
display: flex;
|
623 |
+
align-items: center;
|
624 |
+
gap: 8px;
|
625 |
+
}
|
626 |
+
|
627 |
+
.remove-photo-btn:hover {
|
628 |
+
background: #d32f2f;
|
629 |
+
}
|
630 |
+
|
631 |
+
/* أنماط نموذج التعديل */
|
632 |
+
.edit-form {
|
633 |
+
background: white;
|
634 |
+
padding: 20px;
|
635 |
+
border-radius: 8px;
|
636 |
+
margin: 20px 0;
|
637 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
638 |
+
}
|
639 |
+
|
640 |
+
.edit-form h2 {
|
641 |
+
text-align: center;
|
642 |
+
margin-bottom: 20px;
|
643 |
+
color: #1a1a1a;
|
644 |
+
}
|
645 |
+
|
646 |
+
.form-group {
|
647 |
+
margin-bottom: 15px;
|
648 |
+
}
|
649 |
+
|
650 |
+
.form-group label {
|
651 |
+
display: block;
|
652 |
+
margin-bottom: 5px;
|
653 |
+
color: #1a1a1a;
|
654 |
+
}
|
655 |
+
|
656 |
+
.form-group input,
|
657 |
+
.form-group select {
|
658 |
+
width: 100%;
|
659 |
+
padding: 8px;
|
660 |
+
border: 1px solid #ddd;
|
661 |
+
border-radius: 4px;
|
662 |
+
font-size: 14px;
|
663 |
+
}
|
664 |
+
|
665 |
+
.skill-input {
|
666 |
+
display: flex;
|
667 |
+
gap: 8px;
|
668 |
+
margin-bottom: 8px;
|
669 |
+
}
|
670 |
+
|
671 |
+
.add-skill,
|
672 |
+
.remove-skill {
|
673 |
+
background: #4CAF50;
|
674 |
+
color: white;
|
675 |
+
border: none;
|
676 |
+
width: 30px;
|
677 |
+
height: 30px;
|
678 |
+
border-radius: 15px;
|
679 |
+
cursor: pointer;
|
680 |
+
display: flex;
|
681 |
+
align-items: center;
|
682 |
+
justify-content: center;
|
683 |
+
font-size: 18px;
|
684 |
+
}
|
685 |
+
|
686 |
+
.remove-skill {
|
687 |
+
background: #f44336;
|
688 |
+
}
|
689 |
+
|
690 |
+
.form-actions {
|
691 |
+
display: flex;
|
692 |
+
gap: 10px;
|
693 |
+
justify-content: flex-end;
|
694 |
+
margin-top: 20px;
|
695 |
+
}
|
696 |
+
|
697 |
+
.save-btn,
|
698 |
+
.cancel-btn {
|
699 |
+
padding: 8px 16px;
|
700 |
+
border: none;
|
701 |
+
border-radius: 4px;
|
702 |
+
cursor: pointer;
|
703 |
+
font-size: 14px;
|
704 |
+
}
|
705 |
+
|
706 |
+
.save-btn {
|
707 |
+
background: #4CAF50;
|
708 |
+
color: white;
|
709 |
+
}
|
710 |
+
|
711 |
+
.cancel-btn {
|
712 |
+
background: #f44336;
|
713 |
+
color: white;
|
714 |
+
}
|
715 |
+
|
716 |
+
/* أنماط الصفحة الرئيسية */
|
717 |
+
.back-btn {
|
718 |
+
position: fixed;
|
719 |
+
top: 20px;
|
720 |
+
left: 20px;
|
721 |
+
background: #fff;
|
722 |
+
color: #4CAF50;
|
723 |
+
border: none;
|
724 |
+
padding: 8px 16px;
|
725 |
+
border-radius: 20px;
|
726 |
+
cursor: pointer;
|
727 |
+
font-size: 14px;
|
728 |
+
display: flex;
|
729 |
+
align-items: center;
|
730 |
+
gap: 8px;
|
731 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
732 |
+
z-index: 100;
|
733 |
+
text-decoration: none;
|
734 |
+
}
|
735 |
+
|
736 |
+
.back-btn:hover {
|
737 |
+
background-color: #f0f2f5;
|
738 |
+
}
|
739 |
+
|
740 |
+
.profile-container {
|
741 |
+
max-width: 600px;
|
742 |
+
margin: 0 auto;
|
743 |
+
/* padding: 0 15px; */
|
744 |
+
}
|
745 |
+
|
746 |
+
.profile-header {
|
747 |
+
background: #fff;
|
748 |
+
border-radius: 0 0 8px 8px;
|
749 |
+
margin-bottom: 20px;
|
750 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
751 |
+
overflow: hidden;
|
752 |
+
/* margin-top: 20px; */
|
753 |
+
}
|
754 |
+
|
755 |
+
.cover-photo {
|
756 |
+
height: 150px;
|
757 |
+
background-color: #4CAF50;
|
758 |
+
position: relative;
|
759 |
+
}
|
760 |
+
|
761 |
+
.profile-info {
|
762 |
+
padding: 0 20px 20px;
|
763 |
+
text-align: center;
|
764 |
+
position: relative;
|
765 |
+
}
|
766 |
+
|
767 |
+
.profile-photo {
|
768 |
+
width: 120px;
|
769 |
+
height: 120px;
|
770 |
+
border-radius: 50%;
|
771 |
+
border: 4px solid #fff;
|
772 |
+
margin: -60px auto 10px;
|
773 |
+
overflow: hidden;
|
774 |
+
position: relative;
|
775 |
+
background: #fff;
|
776 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
777 |
+
}
|
778 |
+
|
779 |
+
.profile-photo img {
|
780 |
+
width: 100%;
|
781 |
+
height: 100%;
|
782 |
+
object-fit: cover;
|
783 |
+
}
|
784 |
+
|
785 |
+
.profile-name {
|
786 |
+
font-size: 24px;
|
787 |
+
margin: 10px 0;
|
788 |
+
color: #1a1a1a;
|
789 |
+
}
|
790 |
+
|
791 |
+
.profile-details {
|
792 |
+
display: flex;
|
793 |
+
flex-direction: column;
|
794 |
+
gap: 10px;
|
795 |
+
margin: 15px 0;
|
796 |
+
}
|
797 |
+
|
798 |
+
.detail-item {
|
799 |
+
display: flex;
|
800 |
+
align-items: center;
|
801 |
+
justify-content: center;
|
802 |
+
gap: 8px;
|
803 |
+
color: #65676b;
|
804 |
+
}
|
805 |
+
|
806 |
+
.detail-item i {
|
807 |
+
color: #4CAF50;
|
808 |
+
}
|
809 |
+
|
810 |
+
.skills-section {
|
811 |
+
margin-top: 20px;
|
812 |
+
padding-top: 20px;
|
813 |
+
border-top: 1px solid #e4e6eb;
|
814 |
+
}
|
815 |
+
|
816 |
+
.skills-section h3 {
|
817 |
+
color: #1a1a1a;
|
818 |
+
margin-bottom: 15px;
|
819 |
+
}
|
820 |
+
|
821 |
+
.skills-list {
|
822 |
+
display: flex;
|
823 |
+
flex-wrap: wrap;
|
824 |
+
gap: 8px;
|
825 |
+
justify-content: center;
|
826 |
+
}
|
827 |
+
|
828 |
+
.skill-tag {
|
829 |
+
background: #e4e6eb;
|
830 |
+
padding: 6px 12px;
|
831 |
+
border-radius: 16px;
|
832 |
+
font-size: 14px;
|
833 |
+
color: #050505;
|
834 |
+
}
|
835 |
+
|
836 |
+
/* أنماط المنشورات */
|
837 |
+
.posts-section {
|
838 |
+
margin-top: 20px;
|
839 |
+
}
|
840 |
+
|
841 |
+
.posts-section h2 {
|
842 |
+
color: #1a1a1a;
|
843 |
+
margin-bottom: 15px;
|
844 |
+
text-align: center;
|
845 |
+
}
|
846 |
+
|
847 |
+
.posts-container {
|
848 |
+
margin-top: 20px;
|
849 |
+
}
|
850 |
+
|
851 |
+
.post-card {
|
852 |
+
background: #fff;
|
853 |
+
border-radius: 8px;
|
854 |
+
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
|
855 |
+
margin-bottom: 20px;
|
856 |
+
}
|
857 |
+
|
858 |
+
.post-header {
|
859 |
+
display: flex;
|
860 |
+
align-items: center;
|
861 |
+
padding: 12px;
|
862 |
+
}
|
863 |
+
|
864 |
+
.post-content {
|
865 |
+
padding: 12px;
|
866 |
+
}
|
867 |
+
|
868 |
+
.post-title {
|
869 |
+
margin: 0 0 8px 0;
|
870 |
+
font-size: 18px;
|
871 |
+
text-align: right;
|
872 |
+
}
|
873 |
+
|
874 |
+
.post-content-box {
|
875 |
+
border-radius: 8px;
|
876 |
+
padding: 12px;
|
877 |
+
margin-bottom: 10px;
|
878 |
+
}
|
879 |
+
|
880 |
+
.post-text {
|
881 |
+
margin: 0;
|
882 |
+
color: #1a1a1a;
|
883 |
+
line-height: 1.6;
|
884 |
+
text-align: right;
|
885 |
+
word-wrap: break-word;
|
886 |
+
position: relative;
|
887 |
+
direction: rtl;
|
888 |
+
font-size: 16px;
|
889 |
+
}
|
890 |
+
|
891 |
+
.post-text p {
|
892 |
+
margin: 0;
|
893 |
+
padding: 4px 0;
|
894 |
+
line-height: 1.6;
|
895 |
+
}
|
896 |
+
|
897 |
+
.post-text.collapsed {
|
898 |
+
display: -webkit-box;
|
899 |
+
-webkit-line-clamp: 4;
|
900 |
+
-webkit-box-orient: vertical;
|
901 |
+
overflow: hidden;
|
902 |
+
}
|
903 |
+
|
904 |
+
.post-text.expanded {
|
905 |
+
display: block;
|
906 |
+
}
|
907 |
+
|
908 |
+
.post-text.expanded p {
|
909 |
+
white-space: pre-wrap;
|
910 |
+
padding: 2px 0;
|
911 |
+
}
|
912 |
+
|
913 |
+
.post-text p:first-child {
|
914 |
+
padding-top: 0;
|
915 |
+
}
|
916 |
+
|
917 |
+
.post-text p:last-child {
|
918 |
+
padding-bottom: 0;
|
919 |
+
}
|
920 |
+
|
921 |
+
.post-text p:empty {
|
922 |
+
min-height: 1em;
|
923 |
+
display: block;
|
924 |
+
}
|
925 |
+
|
926 |
+
.see-more-btn {
|
927 |
+
color: #1877f2;
|
928 |
+
cursor: pointer;
|
929 |
+
font-weight: 500;
|
930 |
+
margin-top: 8px;
|
931 |
+
display: none;
|
932 |
+
background: none;
|
933 |
+
border: none;
|
934 |
+
padding: 0;
|
935 |
+
text-align: right;
|
936 |
+
width: 100%;
|
937 |
+
}
|
938 |
+
|
939 |
+
.post-text-container {
|
940 |
+
position: relative;
|
941 |
+
}
|
942 |
+
|
943 |
+
.post-media {
|
944 |
+
margin-top: 10px;
|
945 |
+
border-radius: 8px;
|
946 |
+
overflow: hidden;
|
947 |
+
}
|
948 |
+
|
949 |
+
.post-media img {
|
950 |
+
width: 400px;
|
951 |
+
height: 400px;
|
952 |
+
display: block;
|
953 |
+
object-fit: cover;
|
954 |
+
margin: 0 auto;
|
955 |
+
}
|
956 |
+
|
957 |
+
.video-container {
|
958 |
+
position: relative;
|
959 |
+
padding-bottom: 56.25%;
|
960 |
+
height: 0;
|
961 |
+
overflow: hidden;
|
962 |
+
}
|
963 |
+
|
964 |
+
.video-container video {
|
965 |
+
position: absolute;
|
966 |
+
top: 0;
|
967 |
+
right: 0;
|
968 |
+
width: 100%;
|
969 |
+
height: 100%;
|
970 |
+
object-fit: cover;
|
971 |
+
}
|
972 |
+
|
973 |
+
.post-actions {
|
974 |
+
display: flex;
|
975 |
+
justify-content: space-around;
|
976 |
+
padding: 8px;
|
977 |
+
border-top: 1px solid #ddd;
|
978 |
+
}
|
979 |
+
|
980 |
+
.action-btn {
|
981 |
+
background: none;
|
982 |
+
border: none;
|
983 |
+
padding: 8px;
|
984 |
+
color: #65676b;
|
985 |
+
cursor: pointer;
|
986 |
+
font-size: 14px;
|
987 |
+
display: flex;
|
988 |
+
align-items: center;
|
989 |
+
gap: 5px;
|
990 |
+
}
|
991 |
+
|
992 |
+
.action-btn:hover {
|
993 |
+
background: #f0f2f5;
|
994 |
+
border-radius: 4px;
|
995 |
+
}
|
996 |
+
|
997 |
+
.action-btn i {
|
998 |
+
font-size: 16px;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
.user-info {
|
1002 |
+
display: flex;
|
1003 |
+
flex-direction: column;
|
1004 |
+
margin-right: 10px;
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
.timestamp {
|
1008 |
+
font-size: 12px;
|
1009 |
+
color: #65676b;
|
1010 |
+
margin-top: 2px;
|
1011 |
+
}
|
1012 |
+
|
1013 |
+
.profession {
|
1014 |
+
font-size: 12px;
|
1015 |
+
color: #4CAF50;
|
1016 |
+
margin-top: 2px;
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
.profile-circle {
|
1020 |
+
width: 40px;
|
1021 |
+
height: 40px;
|
1022 |
+
border-radius: 50%;
|
1023 |
+
overflow: hidden;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
.profile-circle img {
|
1027 |
+
width: 100%;
|
1028 |
+
height: 100%;
|
1029 |
+
object-fit: cover;
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
/* Post Menu Styles */
|
1033 |
+
.post-menu {
|
1034 |
+
position: relative;
|
1035 |
+
margin-right: auto;
|
1036 |
+
padding: 8px;
|
1037 |
+
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
.menu-dots {
|
1041 |
+
cursor: pointer;
|
1042 |
+
color: #65676b;
|
1043 |
+
padding: 8px;
|
1044 |
+
border-radius: 50%;
|
1045 |
+
|
1046 |
+
}
|
1047 |
+
|
1048 |
+
.menu-dots:hover {
|
1049 |
+
background-color: #f0f2f5;
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
.menu-options {
|
1053 |
+
display: none;
|
1054 |
+
position: absolute;
|
1055 |
+
left: 0;
|
1056 |
+
top: 100%;
|
1057 |
+
background: white;
|
1058 |
+
border-radius: 8px;
|
1059 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
1060 |
+
z-index: 1000;
|
1061 |
+
min-width: 150px;
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
.menu-option {
|
1065 |
+
padding: 8px 16px;
|
1066 |
+
cursor: pointer;
|
1067 |
+
color: #050505;
|
1068 |
+
display: flex;
|
1069 |
+
align-items: center;
|
1070 |
+
gap: 8px;
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
.menu-option:hover {
|
1074 |
+
background-color: #f0f2f5;
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
.menu-option i {
|
1078 |
+
font-size: 16px;
|
1079 |
+
width: 20px;
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
.delete-post {
|
1083 |
+
color: #dc3545;
|
1084 |
+
}
|
1085 |
+
|
1086 |
+
/* Edit Title Modal */
|
1087 |
+
.edit-modal {
|
1088 |
+
display: none;
|
1089 |
+
position: fixed;
|
1090 |
+
top: 0;
|
1091 |
+
left: 0;
|
1092 |
+
width: 100%;
|
1093 |
+
height: 100%;
|
1094 |
+
background-color: rgba(0,0,0,0.5);
|
1095 |
+
z-index: 2000;
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
.edit-modal-content {
|
1099 |
+
position: relative;
|
1100 |
+
background: white;
|
1101 |
+
padding: 20px;
|
1102 |
+
border-radius: 8px;
|
1103 |
+
width: 90%;
|
1104 |
+
max-width: 500px;
|
1105 |
+
margin: 50px auto;
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
.edit-modal textarea {
|
1109 |
+
width: 100%;
|
1110 |
+
padding: 12px;
|
1111 |
+
margin: 10px 0;
|
1112 |
+
border: 1px solid #ddd;
|
1113 |
+
border-radius: 4px;
|
1114 |
+
font-size: 16px;
|
1115 |
+
resize: vertical;
|
1116 |
+
min-height: 120px;
|
1117 |
+
text-align: right;
|
1118 |
+
direction: rtl;
|
1119 |
+
white-space: pre-wrap;
|
1120 |
+
line-height: 1.6;
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
.edit-modal-buttons {
|
1124 |
+
display: flex;
|
1125 |
+
justify-content: flex-end;
|
1126 |
+
gap: 10px;
|
1127 |
+
margin-top: 20px;
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
.edit-modal-buttons button {
|
1131 |
+
padding: 8px 16px;
|
1132 |
+
border: none;
|
1133 |
+
border-radius: 4px;
|
1134 |
+
cursor: pointer;
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
.edit-modal-buttons .save-btn {
|
1138 |
+
background-color: #4CAF50;
|
1139 |
+
color: white;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
.edit-modal-buttons .cancel-btn {
|
1143 |
+
background-color: #f0f2f5;
|
1144 |
+
color: #050505;
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
/* Delete Confirmation Modal */
|
1148 |
+
.delete-modal {
|
1149 |
+
display: none;
|
1150 |
+
position: fixed;
|
1151 |
+
top: 0;
|
1152 |
+
left: 0;
|
1153 |
+
width: 100%;
|
1154 |
+
height: 100%;
|
1155 |
+
background-color: rgba(0,0,0,0.5);
|
1156 |
+
z-index: 2000;
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
.delete-modal-content {
|
1160 |
+
position: relative;
|
1161 |
+
background: white;
|
1162 |
+
padding: 20px;
|
1163 |
+
border-radius: 8px;
|
1164 |
+
width: 90%;
|
1165 |
+
max-width: 500px;
|
1166 |
+
margin: 50px auto;
|
1167 |
+
text-align: center;
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
.delete-modal-buttons {
|
1171 |
+
display: flex;
|
1172 |
+
justify-content: center;
|
1173 |
+
gap: 10px;
|
1174 |
+
margin-top: 20px;
|
1175 |
+
}
|
1176 |
+
|
1177 |
+
.delete-modal-buttons button {
|
1178 |
+
padding: 8px 16px;
|
1179 |
+
border: none;
|
1180 |
+
border-radius: 4px;
|
1181 |
+
cursor: pointer;
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
.delete-modal-buttons .confirm-delete {
|
1185 |
+
background-color: #dc3545;
|
1186 |
+
color: white;
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
.delete-modal-buttons .cancel-delete {
|
1190 |
+
background-color: #f0f2f5;
|
1191 |
+
color: #050505;
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
|
1195 |
+
.replies-toggle {
|
1196 |
+
margin-top: 5px;
|
1197 |
+
font-size: 14px;
|
1198 |
+
display: flex;
|
1199 |
+
align-items: center;
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
.replies-toggle i {
|
1203 |
+
margin-right: 5px;
|
1204 |
+
}
|
1205 |
+
|
1206 |
+
.nested-comments {
|
1207 |
+
margin-left: 20px;
|
1208 |
+
border-left: 1px solid #ddd;
|
1209 |
+
padding-left: 10px;
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
|
1213 |
+
.filter-buttons {
|
1214 |
+
display: flex;
|
1215 |
+
justify-content: center;
|
1216 |
+
gap: 10px;
|
1217 |
+
margin-bottom: 20px;
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
.filter-btn {
|
1221 |
+
padding: 8px 16px;
|
1222 |
+
border: none;
|
1223 |
+
border-radius: 20px;
|
1224 |
+
background-color: #f0f2f5;
|
1225 |
+
color: #1a1a1a;
|
1226 |
+
cursor: pointer;
|
1227 |
+
font-size: 14px;
|
1228 |
+
}
|
1229 |
+
|
1230 |
+
.filter-btn.active {
|
1231 |
+
background-color: #4CAF50;
|
1232 |
+
color: white;
|
1233 |
+
}
|
1234 |
+
|
1235 |
+
/* النمط الأساسي لـ iframe-container */
|
1236 |
+
#message-container {
|
1237 |
+
display: none; /* مخفي في البداية */
|
1238 |
+
position: fixed;
|
1239 |
+
top: 0;
|
1240 |
+
left: 0;
|
1241 |
+
width: 100%;
|
1242 |
+
height: 100%;
|
1243 |
+
background-color: rgba(0, 0, 0, 0.5); /* خلفية شفافة */
|
1244 |
+
z-index: 1000;
|
1245 |
+
animation: fadeIn 0.5s;
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
/* محتوى iframe */
|
1249 |
+
#message-iframe {
|
1250 |
+
width: 100%;
|
1251 |
+
height: 100%;
|
1252 |
+
border: none;
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
/* رأس الحاوية مع زر الإغلاق */
|
1256 |
+
#message-header {
|
1257 |
+
position: absolute;
|
1258 |
+
top: 0;
|
1259 |
+
left: 0;
|
1260 |
+
width: 100%;
|
1261 |
+
background-color: #f1f1f1;
|
1262 |
+
padding: 10px;
|
1263 |
+
box-sizing: border-box;
|
1264 |
+
z-index: 1001;
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
#close-btn {
|
1268 |
+
background-color: transparent;
|
1269 |
+
border: none;
|
1270 |
+
font-size: 24px;
|
1271 |
+
cursor: pointer;
|
1272 |
+
float: left;
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
/* الأنيميشن */
|
1276 |
+
@keyframes fadeIn {
|
1277 |
+
from { opacity: 0; }
|
1278 |
+
to { opacity: 1; }
|
1279 |
+
}
|
1280 |
+
|
1281 |
+
@keyframes slideIn {
|
1282 |
+
from { transform: translateY(100%); }
|
1283 |
+
to { transform: translateY(0); }
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
@keyframes fadeOut {
|
1287 |
+
from { opacity: 1; }
|
1288 |
+
to { opacity: 0; }
|
1289 |
+
}
|
1290 |
+
|
1291 |
+
@keyframes slideOut {
|
1292 |
+
from { transform: translateY(0); }
|
1293 |
+
to { transform: translateY(100%); }
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
#message-container.show {
|
1297 |
+
display: block;
|
1298 |
+
animation: fadeIn 0.5s;
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
#message-container iframe {
|
1302 |
+
animation: slideIn 0.5s;
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
#message-container.hide {
|
1306 |
+
animation: fadeOut 0.5s, slideOut 0.5s;
|
1307 |
+
opacity: 0;
|
1308 |
+
}
|
1309 |
+
</style>
|
1310 |
+
|
1311 |
+
<!-- Edit Post Modal -->
|
1312 |
+
<div class="edit-modal" id="editModal">
|
1313 |
+
<div class="edit-modal-content">
|
1314 |
+
<h3>تعديل المنشور</h3>
|
1315 |
+
<textarea id="editContentInput" placeholder="أدخل محتوى المنشور" rows="5"></textarea>
|
1316 |
+
<div class="edit-modal-buttons">
|
1317 |
+
<button class="save-btn" id="saveEditBtn">حفظ</button>
|
1318 |
+
<button class="cancel-btn" id="cancelEditBtn">إلغاء</button>
|
1319 |
+
</div>
|
1320 |
+
</div>
|
1321 |
+
</div>
|
1322 |
+
|
1323 |
+
<!-- Delete Confirmation Modal -->
|
1324 |
+
<div class="delete-modal" id="deleteModal">
|
1325 |
+
<div class="delete-modal-content">
|
1326 |
+
<h3>تأكيد الحذف</h3>
|
1327 |
+
<p>هل أنت متأكد من حذف هذا المنشور؟</p>
|
1328 |
+
<div class="delete-modal-buttons">
|
1329 |
+
<button class="confirm-delete" id="confirmDeleteBtn">حذف</button>
|
1330 |
+
<button class="cancel-delete" id="cancelDeleteBtn">إلغاء</button>
|
1331 |
+
</div>
|
1332 |
+
</div>
|
1333 |
+
</div>
|
1334 |
+
|
1335 |
+
|
1336 |
+
|
1337 |
+
|
1338 |
+
|
1339 |
+
{% endblock %}
|
1340 |
+
|
1341 |
+
{% block scripts %}
|
1342 |
+
<script>
|
1343 |
+
// Comments Functionality
|
1344 |
+
// Comments Functionality
|
1345 |
+
$(document).ready(function () {
|
1346 |
+
const commentsContainer = $("#commentsFixedContainer");
|
1347 |
+
const commentsOverlay = $("#commentsOverlay");
|
1348 |
+
const closeComments = $(".close-comments");
|
1349 |
+
let currentPostId = null;
|
1350 |
+
|
1351 |
+
// Reply Modal Elements
|
1352 |
+
const replyContainer = $("#replyFixedContainer");
|
1353 |
+
const replyOverlay = $("#replyOverlay");
|
1354 |
+
const closeReply = $(".close-reply");
|
1355 |
+
let currentCommentId = null;
|
1356 |
+
|
1357 |
+
// تحميل التعليقات عند النقر على زر التعليق
|
1358 |
+
$(".comment-btn").click(function () {
|
1359 |
+
const postId = $(this).data("post-id");
|
1360 |
+
currentPostId = postId;
|
1361 |
+
|
1362 |
+
// تحميل التعليقات
|
1363 |
+
loadComments(postId);
|
1364 |
+
|
1365 |
+
// عرض الخلفية والحاوية
|
1366 |
+
commentsOverlay.css("display", "block");
|
1367 |
+
commentsContainer.css("display", "block");
|
1368 |
+
document.body.style.overflow = "hidden"; // منع السكرول في الصفحة الرئيسية
|
1369 |
+
setTimeout(() => {
|
1370 |
+
commentsContainer.addClass("active");
|
1371 |
+
}, 10);
|
1372 |
+
});
|
1373 |
+
|
1374 |
+
// إغلاق التعليقات عند النقر خارج الحاوية
|
1375 |
+
commentsOverlay.click(function () {
|
1376 |
+
closeCommentsContainer();
|
1377 |
+
});
|
1378 |
+
|
1379 |
+
// إغلاق حاوية التعليقات
|
1380 |
+
closeComments.click(function () {
|
1381 |
+
closeCommentsContainer();
|
1382 |
+
});
|
1383 |
+
|
1384 |
+
// دالة إغلاق حاوية التعليقات
|
1385 |
+
function closeCommentsContainer() {
|
1386 |
+
commentsContainer.removeClass("active");
|
1387 |
+
document.body.style.overflow = "auto"; // إعادة تفعيل السكرول في الصفحة الرئيسية
|
1388 |
+
setTimeout(() => {
|
1389 |
+
commentsContainer.css("display", "none");
|
1390 |
+
commentsOverlay.css("display", "none");
|
1391 |
+
}, 300);
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
// إرسال التعليق
|
1395 |
+
$(".send-comment-btn").click(function () {
|
1396 |
+
const input = commentsContainer.find(".comment-input");
|
1397 |
+
const content = input.val().trim();
|
1398 |
+
|
1399 |
+
if (content && currentPostId) {
|
1400 |
+
$.ajax({
|
1401 |
+
url: "/add_comment",
|
1402 |
+
method: "POST",
|
1403 |
+
data: {
|
1404 |
+
post_id: currentPostId,
|
1405 |
+
content: content,
|
1406 |
+
parent_id: null, // Root comment
|
1407 |
+
},
|
1408 |
+
success: function (response) {
|
1409 |
+
if (response.success) {
|
1410 |
+
input.val("");
|
1411 |
+
loadComments(currentPostId);
|
1412 |
+
}
|
1413 |
+
},
|
1414 |
+
});
|
1415 |
+
}
|
1416 |
+
});
|
1417 |
+
|
1418 |
+
// تحميل التعليقات
|
1419 |
+
function loadComments(postId) {
|
1420 |
+
$.get(`/get_comments/${postId}`, function (comments) {
|
1421 |
+
const commentsList = commentsContainer.find(".comments-list");
|
1422 |
+
commentsList.empty();
|
1423 |
+
|
1424 |
+
comments.forEach(function (comment) {
|
1425 |
+
const commentHtml = generateCommentHtml(comment);
|
1426 |
+
commentsList.append(commentHtml);
|
1427 |
+
});
|
1428 |
+
});
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
// دالة لتوليد HTML للتعليقات والردود
|
1432 |
+
function generateCommentHtml(comment) {
|
1433 |
+
const hasReplies = comment.replies && comment.replies.length > 0;
|
1434 |
+
const repliesCount = hasReplies
|
1435 |
+
? `${comment.replies.length} رداً`
|
1436 |
+
: "";
|
1437 |
+
|
1438 |
+
const repliesHtml = hasReplies
|
1439 |
+
? comment.replies
|
1440 |
+
.map((reply) => generateReplyHtml(reply))
|
1441 |
+
.join("")
|
1442 |
+
: "";
|
1443 |
+
|
1444 |
+
return `
|
1445 |
+
<div class="comment-item">
|
1446 |
+
<div class="comment-user-avatar">
|
1447 |
+
<img src="/static/${
|
1448 |
+
comment.profile_photo
|
1449 |
+
}" alt="${comment.username}">
|
1450 |
+
</div>
|
1451 |
+
<div class="comment-bubble">
|
1452 |
+
<div class="comment-header">
|
1453 |
+
<span class="comment-username">${comment.username}</span>
|
1454 |
+
</div>
|
1455 |
+
<div class="comment-content">${comment.content}</div>
|
1456 |
+
<div class="comment-time">${comment.created_at}</div>
|
1457 |
+
|
1458 |
+
<!-- عرض زر الردود المخفية إذا كان هناك ردود -->
|
1459 |
+
${
|
1460 |
+
hasReplies
|
1461 |
+
? `
|
1462 |
+
<div class="replies-toggle" data-comment-id="${comment.id}">
|
1463 |
+
<span class="replies-toggle-text" style="color: blue; cursor: pointer;">
|
1464 |
+
<i class="fas fa-chevron-down"></i> ${repliesCount}
|
1465 |
+
</span>
|
1466 |
+
</div>
|
1467 |
+
`
|
1468 |
+
: ""
|
1469 |
+
}
|
1470 |
+
|
1471 |
+
<!-- زر الرد -->
|
1472 |
+
<button class="reply-btn" data-comment-id="${
|
1473 |
+
comment.id
|
1474 |
+
}" style="color: blue; cursor: pointer;">رد</button>
|
1475 |
+
|
1476 |
+
<!-- عرض الردود أسفل التعليق الرئيسي -->
|
1477 |
+
<div class="replies-container" style="display: ${
|
1478 |
+
hasReplies ? "block" : "none"
|
1479 |
+
};">
|
1480 |
+
${repliesHtml}
|
1481 |
+
</div>
|
1482 |
+
</div>
|
1483 |
+
</div>
|
1484 |
+
`;
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
// دالة لتوليد HTML للردود
|
1488 |
+
function generateReplyHtml(reply) {
|
1489 |
+
return `
|
1490 |
+
<div class="comment-item nested-comment">
|
1491 |
+
<div class="comment-user-avatar">
|
1492 |
+
<img src="/static/${
|
1493 |
+
reply.profile_photo
|
1494 |
+
}" alt="${reply.username}">
|
1495 |
+
</div>
|
1496 |
+
<div class="comment-bubble">
|
1497 |
+
<div class="comment-header">
|
1498 |
+
<span class="comment-username">${reply.username}</span>
|
1499 |
+
</div>
|
1500 |
+
<div class="comment-content">${reply.content}</div>
|
1501 |
+
<div class="comment-time">${reply.created_at}</div>
|
1502 |
+
</div>
|
1503 |
+
</div>
|
1504 |
+
`;
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
// إظهار حقل الرد عند النقر على زر الرد
|
1508 |
+
$(document).on("click", ".reply-btn", function () {
|
1509 |
+
currentCommentId = $(this).data("comment-id");
|
1510 |
+
replyOverlay.css("display", "block");
|
1511 |
+
replyContainer.css("display", "block");
|
1512 |
+
setTimeout(() => {
|
1513 |
+
replyContainer.addClass("active");
|
1514 |
+
}, 10);
|
1515 |
+
});
|
1516 |
+
|
1517 |
+
// إغلاق الرد عند النقر خارج الحاوية
|
1518 |
+
replyOverlay.click(function () {
|
1519 |
+
closeReplyContainer();
|
1520 |
+
});
|
1521 |
+
|
1522 |
+
// إغلاق حاوية الرد
|
1523 |
+
closeReply.click(function () {
|
1524 |
+
closeReplyContainer();
|
1525 |
+
});
|
1526 |
+
|
1527 |
+
// دالة إغلاق حاوية الرد
|
1528 |
+
function closeReplyContainer() {
|
1529 |
+
replyContainer.removeClass("active");
|
1530 |
+
setTimeout(() => {
|
1531 |
+
replyContainer.css("display", "none");
|
1532 |
+
replyOverlay.css("display", "none");
|
1533 |
+
}, 300);
|
1534 |
+
}
|
1535 |
+
|
1536 |
+
// إرسال الرد على تعليق
|
1537 |
+
$(".send-reply-btn").click(function () {
|
1538 |
+
const input = replyContainer.find(".reply-input");
|
1539 |
+
const content = input.val().trim();
|
1540 |
+
|
1541 |
+
if (content && currentPostId && currentCommentId) {
|
1542 |
+
$.ajax({
|
1543 |
+
url: "/add_comment",
|
1544 |
+
method: "POST",
|
1545 |
+
data: {
|
1546 |
+
post_id: currentPostId,
|
1547 |
+
content: content,
|
1548 |
+
parent_id: currentCommentId, // Associate reply with parent
|
1549 |
+
},
|
1550 |
+
success: function (response) {
|
1551 |
+
if (response.success) {
|
1552 |
+
input.val("");
|
1553 |
+
closeReplyContainer();
|
1554 |
+
loadComments(currentPostId);
|
1555 |
+
}
|
1556 |
+
},
|
1557 |
+
});
|
1558 |
+
}
|
1559 |
+
});
|
1560 |
+
|
1561 |
+
// إظهار أو إخفاء الردود عند النقر على زر "12 رداً" أو ما يعادله
|
1562 |
+
$(document).on("click", ".replies-toggle-text", function () {
|
1563 |
+
const toggle = $(this).closest(".replies-toggle");
|
1564 |
+
const repliesContainer = toggle.siblings(".replies-container");
|
1565 |
+
const icon = toggle.find("i");
|
1566 |
+
|
1567 |
+
if (repliesContainer.is(":visible")) {
|
1568 |
+
repliesContainer.slideUp();
|
1569 |
+
icon.removeClass("fa-chevron-up").addClass("fa-chevron-down");
|
1570 |
+
} else {
|
1571 |
+
repliesContainer.slideDown();
|
1572 |
+
icon.removeClass("fa-chevron-down").addClass("fa-chevron-up");
|
1573 |
+
}
|
1574 |
+
});
|
1575 |
+
});
|
1576 |
+
|
1577 |
+
|
1578 |
+
</script>
|
1579 |
+
|
1580 |
+
<script>
|
1581 |
+
$(document).ready(function() {
|
1582 |
+
// تبديل عرض نموذج التعديل
|
1583 |
+
$('#editProfileBtn').click(function() {
|
1584 |
+
$('#editProfileForm').slideDown();
|
1585 |
+
});
|
1586 |
+
|
1587 |
+
$('#cancelEdit').click(function() {
|
1588 |
+
$('#editProfileForm').slideUp();
|
1589 |
+
});
|
1590 |
+
|
1591 |
+
// إدارة المهارات
|
1592 |
+
$('.add-skill').click(function() {
|
1593 |
+
const skillValue = $(this).siblings('.skill-field').val();
|
1594 |
+
if (skillValue.trim() !== "") {
|
1595 |
+
const skillInput = `
|
1596 |
+
<div class="skill-input">
|
1597 |
+
<input type="text" name="skill" class="skill-field" value="${skillValue}">
|
1598 |
+
<button type="button" class="remove-skill">-</button>
|
1599 |
+
</div>
|
1600 |
+
`;
|
1601 |
+
$(this).parent().before(skillInput);
|
1602 |
+
$(this).siblings('.skill-field').val("");
|
1603 |
+
}
|
1604 |
+
});
|
1605 |
+
|
1606 |
+
$(document).on('click', '.remove-skill', function() {
|
1607 |
+
$(this).parent().remove();
|
1608 |
+
});
|
1609 |
+
|
1610 |
+
// تقديم النموذج
|
1611 |
+
$('#profileForm').on('submit', function(e) {
|
1612 |
+
const skills = [];
|
1613 |
+
$('.skill-field').each(function() {
|
1614 |
+
const skill = $(this).val().trim();
|
1615 |
+
if (skill) {
|
1616 |
+
skills.push(skill);
|
1617 |
+
}
|
1618 |
+
});
|
1619 |
+
$('#skills').val(JSON.stringify(skills));
|
1620 |
+
});
|
1621 |
+
|
1622 |
+
// التحقق من اسم المستخدم
|
1623 |
+
$('#username').on('input', function() {
|
1624 |
+
const username = $(this).val();
|
1625 |
+
if (username && username !== '{{ user.username }}') {
|
1626 |
+
$.get('/validate-username', { username: username }, function(data) {
|
1627 |
+
if (data.exists) {
|
1628 |
+
$('#username-validation-message').text('اسم المستخدم مستخدم بالفعل').addClass('error').removeClass('success');
|
1629 |
+
} else {
|
1630 |
+
$('#username-validation-message').text('اسم المستخدم متاح').addClass('success').removeClass('error');
|
1631 |
+
}
|
1632 |
+
});
|
1633 |
+
} else {
|
1634 |
+
$('#username-validation-message').text('');
|
1635 |
+
}
|
1636 |
+
});
|
1637 |
+
|
1638 |
+
// تفعيل قائمة النقاط الثلاث
|
1639 |
+
$('.menu-dots').click(function(e) {
|
1640 |
+
e.stopPropagation();
|
1641 |
+
const menuOptions = $(this).siblings('.menu-options');
|
1642 |
+
$('.menu-options').not(menuOptions).hide();
|
1643 |
+
menuOptions.toggle();
|
1644 |
+
});
|
1645 |
+
|
1646 |
+
// إغلاق القائمة عند النقر في أي مكان آخر
|
1647 |
+
$(document).click(function() {
|
1648 |
+
$('.menu-options').hide();
|
1649 |
+
});
|
1650 |
+
|
1651 |
+
// منع إغلاق القائمة عند النقر داخلها
|
1652 |
+
$('.menu-options').click(function(e) {
|
1653 |
+
e.stopPropagation();
|
1654 |
+
});
|
1655 |
+
|
1656 |
+
let currentPostId = null;
|
1657 |
+
|
1658 |
+
// تفعيل زر تعديل المنشور
|
1659 |
+
$('.edit-post').click(function() {
|
1660 |
+
currentPostId = $(this).data('post-id');
|
1661 |
+
const $text = $(this).closest('.post-card').find('.post-text');
|
1662 |
+
const paragraphs = [];
|
1663 |
+
$text.find('p').each(function() {
|
1664 |
+
const content = $(this).text();
|
1665 |
+
if (content === '\u00A0') { //
|
1666 |
+
paragraphs.push('');
|
1667 |
+
} else {
|
1668 |
+
paragraphs.push(content);
|
1669 |
+
}
|
1670 |
+
});
|
1671 |
+
$('#editContentInput').val(paragraphs.join('\n'));
|
1672 |
+
$('#editModal').show();
|
1673 |
+
});
|
1674 |
+
|
1675 |
+
// إغلاق نافذة التعديل
|
1676 |
+
$('#cancelEditBtn').click(function() {
|
1677 |
+
$('#editModal').hide();
|
1678 |
+
});
|
1679 |
+
|
1680 |
+
// حفظ التعديل
|
1681 |
+
$('#saveEditBtn').click(function() {
|
1682 |
+
const newContent = $('#editContentInput').val();
|
1683 |
+
if (currentPostId && newContent.trim()) {
|
1684 |
+
$.ajax({
|
1685 |
+
url: '/edit_post_content',
|
1686 |
+
method: 'POST',
|
1687 |
+
data: {
|
1688 |
+
post_id: currentPostId,
|
1689 |
+
new_content: newContent
|
1690 |
+
},
|
1691 |
+
success: function(response) {
|
1692 |
+
if (response.success) {
|
1693 |
+
location.reload();
|
1694 |
+
}
|
1695 |
+
}
|
1696 |
+
});
|
1697 |
+
}
|
1698 |
+
$('#editModal').hide();
|
1699 |
+
});
|
1700 |
+
|
1701 |
+
// تفعيل زر حذف المنشور
|
1702 |
+
$('.delete-post').click(function() {
|
1703 |
+
currentPostId = $(this).data('post-id');
|
1704 |
+
$('#deleteModal').show();
|
1705 |
+
});
|
1706 |
+
|
1707 |
+
// إغلاق نافذة تأكيد الحذف
|
1708 |
+
$('#cancelDeleteBtn').click(function() {
|
1709 |
+
$('#deleteModal').hide();
|
1710 |
+
});
|
1711 |
+
|
1712 |
+
// تأكيد الحذف
|
1713 |
+
$('#confirmDeleteBtn').click(function() {
|
1714 |
+
if (currentPostId) {
|
1715 |
+
$.ajax({
|
1716 |
+
url: '/delete_post',
|
1717 |
+
method: 'POST',
|
1718 |
+
data: {
|
1719 |
+
post_id: currentPostId
|
1720 |
+
},
|
1721 |
+
success: function(response) {
|
1722 |
+
if (response.success) {
|
1723 |
+
location.reload();
|
1724 |
+
}
|
1725 |
+
}
|
1726 |
+
});
|
1727 |
+
}
|
1728 |
+
$('#deleteModal').hide();
|
1729 |
+
});
|
1730 |
+
|
1731 |
+
// تفعيل زر إظهار المزيد
|
1732 |
+
$('.post-text').each(function() {
|
1733 |
+
const $text = $(this);
|
1734 |
+
const $btn = $text.closest('.post-content-box').find('.see-more-btn');
|
1735 |
+
|
1736 |
+
// Get the original content
|
1737 |
+
const content = $text.html();
|
1738 |
+
|
1739 |
+
// Calculate line height and text height
|
1740 |
+
const lineHeight = parseInt(window.getComputedStyle($text[0]).lineHeight);
|
1741 |
+
const textHeight = $text[0].scrollHeight;
|
1742 |
+
const numLines = Math.floor(textHeight / lineHeight);
|
1743 |
+
|
1744 |
+
// Show button only if text has more than 4 lines
|
1745 |
+
if (numLines > 4) {
|
1746 |
+
$btn.show();
|
1747 |
+
$text.addClass('has-more');
|
1748 |
+
}
|
1749 |
+
});
|
1750 |
+
|
1751 |
+
$('.see-more-btn').click(function() {
|
1752 |
+
const $btn = $(this);
|
1753 |
+
const $text = $btn.closest('.post-content-box').find('.post-text');
|
1754 |
+
|
1755 |
+
if ($text.hasClass('collapsed')) {
|
1756 |
+
$text.removeClass('collapsed').addClass('expanded');
|
1757 |
+
$btn.text('إظهار أقل');
|
1758 |
+
} else {
|
1759 |
+
$text.removeClass('expanded').addClass('collapsed');
|
1760 |
+
$btn.text('إظهار المزيد');
|
1761 |
+
}
|
1762 |
+
});
|
1763 |
+
|
1764 |
+
// Profile Photo Upload Functionality
|
1765 |
+
$('#avatar').change(function(e) {
|
1766 |
+
if (this.files && this.files[0]) {
|
1767 |
+
const reader = new FileReader();
|
1768 |
+
reader.onload = function(e) {
|
1769 |
+
$('.profile-photo img').attr('src', e.target.result);
|
1770 |
+
}
|
1771 |
+
reader.readAsDataURL(this.files[0]);
|
1772 |
+
}
|
1773 |
+
});
|
1774 |
+
|
1775 |
+
// Remove Photo Functionality
|
1776 |
+
$('#removePhotoBtn').click(function() {
|
1777 |
+
$('.profile-photo img').attr('src', "{{ url_for('static', filename='uploads/default-avatar.jpg') }}");
|
1778 |
+
$('#avatar').val('');
|
1779 |
+
// Add a hidden input to signal photo removal
|
1780 |
+
if (!$('#remove_photo').length) {
|
1781 |
+
$('<input>').attr({
|
1782 |
+
type: 'hidden',
|
1783 |
+
id: 'remove_photo',
|
1784 |
+
name: 'remove_photo',
|
1785 |
+
value: 'true'
|
1786 |
+
}).appendTo('#profileForm');
|
1787 |
+
}
|
1788 |
+
});
|
1789 |
+
});
|
1790 |
+
|
1791 |
+
|
1792 |
+
|
1793 |
+
|
1794 |
+
document.addEventListener("DOMContentLoaded", function () {
|
1795 |
+
document.querySelectorAll(".share-btn").forEach(function (button) {
|
1796 |
+
button.addEventListener("click", function () {
|
1797 |
+
const postId = this.dataset.postId;
|
1798 |
+
const shareUrl = `${window.location.origin}/post/${postId}`;
|
1799 |
+
|
1800 |
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
1801 |
+
navigator.clipboard.writeText(shareUrl).then(function () {
|
1802 |
+
showPopup("تم نسخ الرابط");
|
1803 |
+
}).catch(function (err) {
|
1804 |
+
console.error("فشل نسخ الرابط: ", err);
|
1805 |
+
});
|
1806 |
+
} else {
|
1807 |
+
const tempInput = document.createElement("input");
|
1808 |
+
tempInput.value = shareUrl;
|
1809 |
+
document.body.appendChild(tempInput);
|
1810 |
+
tempInput.select();
|
1811 |
+
try {
|
1812 |
+
document.execCommand("copy");
|
1813 |
+
showPopup("تم نسخ الرابط ");
|
1814 |
+
} catch (err) {
|
1815 |
+
console.error("فشل نسخ الرابط باستخدام الطريقة البديلة: ", err);
|
1816 |
+
}
|
1817 |
+
document.body.removeChild(tempInput);
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
function showPopup(message) {
|
1821 |
+
const modal = document.createElement("div");
|
1822 |
+
modal.style.position = "fixed";
|
1823 |
+
modal.style.bottom = "20%";
|
1824 |
+
modal.style.left = "50%";
|
1825 |
+
modal.style.transform = "translateX(-50%)";
|
1826 |
+
modal.style.backgroundColor = "#333";
|
1827 |
+
modal.style.color = "#fff";
|
1828 |
+
modal.style.padding = "15px 20px";
|
1829 |
+
modal.style.borderRadius = "8px";
|
1830 |
+
modal.style.boxShadow = "0 4px 6px rgba(0, 0, 0, 0.1)";
|
1831 |
+
modal.style.opacity = "0";
|
1832 |
+
modal.style.transition = "opacity 0.4s ease, bottom 0.4s ease";
|
1833 |
+
modal.style.zIndex = "1000";
|
1834 |
+
modal.textContent = message;
|
1835 |
+
|
1836 |
+
document.body.appendChild(modal);
|
1837 |
+
|
1838 |
+
setTimeout(() => {
|
1839 |
+
modal.style.opacity = "1";
|
1840 |
+
modal.style.bottom = "25%";
|
1841 |
+
}, 10);
|
1842 |
+
|
1843 |
+
setTimeout(() => {
|
1844 |
+
modal.style.opacity = "0";
|
1845 |
+
modal.style.bottom = "20%";
|
1846 |
+
setTimeout(() => {
|
1847 |
+
modal.remove();
|
1848 |
+
}, 400);
|
1849 |
+
}, 3000);
|
1850 |
+
}
|
1851 |
+
});
|
1852 |
+
});
|
1853 |
+
});
|
1854 |
+
|
1855 |
+
|
1856 |
+
|
1857 |
+
$(document).ready(function () {
|
1858 |
+
// تفعيل الفلترات
|
1859 |
+
$('.filter-btn').click(function () {
|
1860 |
+
// إزالة النشط من جميع الأزرار
|
1861 |
+
$('.filter-btn').removeClass('active');
|
1862 |
+
// إضافة النشط للزر المحدد
|
1863 |
+
$(this).addClass('active');
|
1864 |
+
|
1865 |
+
const filterType = $(this).attr('id'); // الحصول على نوع الفلتر
|
1866 |
+
let hasPosts = false; // متغير لتتبع وجود منشورات مطابقة
|
1867 |
+
|
1868 |
+
// إخفاء جميع المنشورات
|
1869 |
+
$('.post-card').hide();
|
1870 |
+
|
1871 |
+
if (filterType === 'filterAll') {
|
1872 |
+
// عرض جميع المنشورات
|
1873 |
+
$('.post-card').show();
|
1874 |
+
hasPosts = $('.post-card').length > 0; // تحقق إذا كان هناك منشورات
|
1875 |
+
} else if (filterType === 'filterImages') {
|
1876 |
+
// عرض المنشورات التي تحتوي على صور فقط
|
1877 |
+
$('.post-card').each(function () {
|
1878 |
+
if ($(this).find('.post-media img').length > 0) {
|
1879 |
+
$(this).show();
|
1880 |
+
hasPosts = true; // يوجد منشورات مطابقة
|
1881 |
+
}
|
1882 |
+
});
|
1883 |
+
} else if (filterType === 'filterVideos') {
|
1884 |
+
// عرض المنشورات التي تحتوي على فيديوهات فقط
|
1885 |
+
$('.post-card').each(function () {
|
1886 |
+
if ($(this).find('.post-media video').length > 0) {
|
1887 |
+
$(this).show();
|
1888 |
+
hasPosts = true; // يوجد منشورات مطابقة
|
1889 |
+
}
|
1890 |
+
});
|
1891 |
+
} else if (filterType === 'filterText') {
|
1892 |
+
// عرض المنشورات التي تحتوي على نص فقط
|
1893 |
+
$('.post-card').each(function () {
|
1894 |
+
if ($(this).find('.post-text').length > 0 && $(this).find('.post-media').length === 0) {
|
1895 |
+
$(this).show();
|
1896 |
+
hasPosts = true; // يوجد منشورات مطابقة
|
1897 |
+
}
|
1898 |
+
});
|
1899 |
+
}
|
1900 |
+
|
1901 |
+
// إظهار أو إخفاء الرسالة بناءً على وجود منشورات مطابقة
|
1902 |
+
if (hasPosts) {
|
1903 |
+
$('#noPostsMessage').hide(); // إخفاء الرسالة إذا كانت هناك منشورات
|
1904 |
+
} else {
|
1905 |
+
$('#noPostsMessage').show(); // إظهار الرسالة إذا لم تكن هناك منشورات
|
1906 |
+
}
|
1907 |
+
});
|
1908 |
+
});
|
1909 |
+
|
1910 |
+
// فكرة بحيث يظهر مشاركة عبر
|
1911 |
+
|
1912 |
+
|
1913 |
+
// دالة لفتح الرسالة
|
1914 |
+
function openMessage() {
|
1915 |
+
var container = document.getElementById('message-container');
|
1916 |
+
if (container) {
|
1917 |
+
// إظهار الحاوية
|
1918 |
+
container.style.display = 'block';
|
1919 |
+
container.classList.remove('hide'); // إزالة فئة الإخفاء
|
1920 |
+
container.classList.add('show'); // إضافة فئة العرض
|
1921 |
+
|
1922 |
+
// تحقق مما إذا كان الـ iframe موجودًا بالفعل
|
1923 |
+
var existingIframe = document.getElementById('message-iframe');
|
1924 |
+
if (!existingIframe) {
|
1925 |
+
// إنشاء iframe جديد إذا لم يكن موجودًا
|
1926 |
+
var iframe = document.createElement('iframe');
|
1927 |
+
iframe.id = 'message-iframe';
|
1928 |
+
iframe.src = "{{ url_for('messages', user_email=user.email) }}"; // مسار الرسالة
|
1929 |
+
container.appendChild(iframe); // إضافة iframe إلى الحاوية
|
1930 |
+
}
|
1931 |
+
}
|
1932 |
+
}
|
1933 |
+
|
1934 |
+
// دالة لإغلاق الرسالة (حذف iframe نهائيًا وإعلام الخادم)
|
1935 |
+
function closeMessage() {
|
1936 |
+
var container = document.getElementById('message-container');
|
1937 |
+
if (container) {
|
1938 |
+
// إضافة كلاس hide لتشغيل أنيميشن الإغلاق
|
1939 |
+
container.classList.remove('show'); // إزالة فئة العرض
|
1940 |
+
container.classList.add('hide'); // إضافة فئة الإخفاء
|
1941 |
+
|
1942 |
+
// الانتظار حتى يكتمل الأنيميشن قبل إخفاء العنصر
|
1943 |
+
setTimeout(function() {
|
1944 |
+
container.style.display = 'none';
|
1945 |
+
|
1946 |
+
// حذف الـ iframe نهائيًا
|
1947 |
+
var iframe = document.getElementById('message-iframe');
|
1948 |
+
if (iframe) {
|
1949 |
+
iframe.remove(); // إزالة iframe من DOM
|
1950 |
+
}
|
1951 |
+
|
1952 |
+
// إرسال طلب إلى الخادم لإعلامه بأن المستخدم قد غادر الدردشة
|
1953 |
+
fetch('/leave_chat', {
|
1954 |
+
method: 'POST',
|
1955 |
+
headers: {
|
1956 |
+
'Content-Type': 'application/json' // نوع المحتوى
|
1957 |
+
},
|
1958 |
+
credentials: 'include' // لإرسال الكوكيز إذا لزم الأمر
|
1959 |
+
})
|
1960 |
+
.then(response => response.json())
|
1961 |
+
.then(data => {
|
1962 |
+
if (data.success) {
|
1963 |
+
console.log("تم إعلام الخادم بأن المستخدم قد غادر الدردشة.");
|
1964 |
+
} else {
|
1965 |
+
console.error("فشل في إعلام الخادم.");
|
1966 |
+
}
|
1967 |
+
})
|
1968 |
+
.catch(error => {
|
1969 |
+
console.error("حدث خطأ أثناء إرسال الطلب:", error);
|
1970 |
+
});
|
1971 |
+
}, 500); // الانتظار لمدة 0.5 ثانية (مدة الأنيميشن)
|
1972 |
+
}
|
1973 |
+
}
|
1974 |
+
|
1975 |
+
// إضافة مستمع الحدث لزر الإغلاق
|
1976 |
+
var closeBtn = document.getElementById("close-btn");
|
1977 |
+
if (closeBtn) {
|
1978 |
+
closeBtn.addEventListener("click", function () {
|
1979 |
+
console.log("تم النقر على زر الإغلاق");
|
1980 |
+
closeMessage(); // استدعاء دالة الإغلاق
|
1981 |
+
});
|
1982 |
+
}
|
1983 |
+
</script>
|
1984 |
+
{% endblock %}
|
templates/register.html
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}إنشاء حساب{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="auth-container">
|
7 |
+
<h2>إنشاء حساب جديد</h2>
|
8 |
+
<form id="registerForm" method="POST" action="{{ url_for('register') }}">
|
9 |
+
<div class="form-group">
|
10 |
+
<label for="username">اسم المستخدم</label>
|
11 |
+
<input type="text" id="username" name="username" required>
|
12 |
+
<small class="form-text">سيتم إضافة @moltka.eg تلقائياً</small>
|
13 |
+
<span id="username-validation-message"></span>
|
14 |
+
</div>
|
15 |
+
|
16 |
+
<div class="form-group">
|
17 |
+
<label for="password">كلمة المرور</label>
|
18 |
+
<input type="password" id="password" name="password" required>
|
19 |
+
<div id="password-strength" class="strength-meter"></div>
|
20 |
+
</div>
|
21 |
+
|
22 |
+
<div class="form-group">
|
23 |
+
<label for="confirm_password">تأكيد كلمة المرور</label>
|
24 |
+
<input type="password" id="confirm_password" name="confirm_password" required>
|
25 |
+
<span id="password-match-message"></span>
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<div class="form-group">
|
29 |
+
<label for="profession">المجال المهني</label>
|
30 |
+
<select id="profession" name="profession" required>
|
31 |
+
<option value="">اختر المجال المهني</option>
|
32 |
+
<option value="مطور ويب">مطور ويب</option>
|
33 |
+
<option value="مطور واجهة خلفية">مطور واجهة خلفية</option>
|
34 |
+
<option value="برمجة">برمجة</option>
|
35 |
+
<option value="مطور ألعاب">مطور ألعاب</option>
|
36 |
+
<option value="مطور أندرويد">مطور أندرويد</option>
|
37 |
+
<option value="مطور iOS">مطور iOS</option>
|
38 |
+
<option value="مهندس">مهندس</option>
|
39 |
+
<option value="طبيب">طبيب</option>
|
40 |
+
<option value="علوم اجتماعية">علوم اجتماعية</option>
|
41 |
+
<option value="معلم">معلم</option>
|
42 |
+
<option value="محاسب">محاسب</option>
|
43 |
+
<option value="صحفي">صحفي</option>
|
44 |
+
<option value="محامي">محامي</option>
|
45 |
+
<option value="مصمم جرافيكي">مصمم جرافيكي</option>
|
46 |
+
<option value="مصور">مصور</option>
|
47 |
+
<option value="كاتب">كاتب</option>
|
48 |
+
<option value="مدرب رياضي">مدرب رياضي</option>
|
49 |
+
<option value="طاهي">طاهي</option>
|
50 |
+
<option value="ديني">ديني</option>
|
51 |
+
<option value="شاعر">شاعر</option>
|
52 |
+
<option value="رسام">رسام</option>
|
53 |
+
<option value="محلل مالي">محلل مالي</option>
|
54 |
+
<option value="فني صيانة">فني صيانة</option>
|
55 |
+
<option value="باحث">باحث</option>
|
56 |
+
<option value="IT">IT</option>
|
57 |
+
</select>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<div class="form-group">
|
61 |
+
<label>المهارات</label>
|
62 |
+
<div id="skills-container">
|
63 |
+
<div class="skill-input">
|
64 |
+
<input type="text" name="skill" class="skill-field">
|
65 |
+
<button type="button" class="add-skill">+</button>
|
66 |
+
</div>
|
67 |
+
</div>
|
68 |
+
<input type="hidden" id="skills" name="skills">
|
69 |
+
</div>
|
70 |
+
|
71 |
+
<div class="form-group">
|
72 |
+
<label for="security_question">سؤال الأمان</label>
|
73 |
+
<select id="security_question" name="security_question" required>
|
74 |
+
<option value="">اختر سؤال الأمان</option>
|
75 |
+
<option value="ما اسم مدرستك الأولى؟">ما اسم مدرستك الأولى؟</option>
|
76 |
+
<option value="ما اسم حيوانك الأليف الأول؟">ما اسم حيوانك الأليف الأول؟</option>
|
77 |
+
<option value="ما هي مدينتك المفضلة؟">ما هي مدينتك المفضلة؟</option>
|
78 |
+
<option value="ما اسم أفضل صديق في طفولتك؟">ما اسم أفضل صديق في طفولتك؟</option>
|
79 |
+
</select>
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<div class="form-group">
|
83 |
+
<label for="security_answer">إجابة سؤال الأمان</label>
|
84 |
+
<input type="text" id="security_answer" name="security_answer" required>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<button type="submit" class="submit-btn">إنشاء الحساب</button>
|
88 |
+
</form>
|
89 |
+
<div class="auth-links">
|
90 |
+
<p>لديك حساب بالفعل؟ <a href="{{ url_for('login') }}">تسجيل الدخول</a></p>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
{% endblock %}
|
94 |
+
|
95 |
+
{% block scripts %}
|
96 |
+
<script>
|
97 |
+
$(document).ready(function() {
|
98 |
+
// Username validation
|
99 |
+
$('#username').on('input', function() {
|
100 |
+
const username = $(this).val();
|
101 |
+
if (username) {
|
102 |
+
$.get('/validate-username', { username: username }, function(data) {
|
103 |
+
if (data.exists) {
|
104 |
+
$('#username-validation-message').text('اسم المستخدم مستخدم بالفعل').addClass('error').removeClass('success');
|
105 |
+
} else {
|
106 |
+
$('#username-validation-message').text('اسم المستخدم متاح').addClass('success').removeClass('error');
|
107 |
+
}
|
108 |
+
});
|
109 |
+
}
|
110 |
+
});
|
111 |
+
|
112 |
+
// Password matching validation
|
113 |
+
$('#confirm_password').on('input', function() {
|
114 |
+
const password = $('#password').val();
|
115 |
+
const confirmPassword = $(this).val();
|
116 |
+
|
117 |
+
if (password === confirmPassword) {
|
118 |
+
$('#password-match-message').text('كلمات المرور متطابقة').addClass('success').removeClass('error');
|
119 |
+
} else {
|
120 |
+
$('#password-match-message').text('كلمات المرور غير متطابقة').addClass('error').removeClass('success');
|
121 |
+
}
|
122 |
+
});
|
123 |
+
|
124 |
+
// Password strength
|
125 |
+
$('#password').on('input', function() {
|
126 |
+
const password = $(this).val();
|
127 |
+
let strength = 0;
|
128 |
+
|
129 |
+
if (password.length >= 8) strength++;
|
130 |
+
if (/[A-Z]/.test(password)) strength++;
|
131 |
+
if (/[a-z]/.test(password)) strength++;
|
132 |
+
if (/[0-9]/.test(password)) strength++;
|
133 |
+
if (/[^A-Za-z0-9]/.test(password)) strength++;
|
134 |
+
|
135 |
+
const strengthMeter = $('#password-strength');
|
136 |
+
strengthMeter.removeClass('weak medium strong');
|
137 |
+
|
138 |
+
if (strength <= 2) {
|
139 |
+
strengthMeter.text('ضعيف').addClass('weak');
|
140 |
+
} else if (strength <= 4) {
|
141 |
+
strengthMeter.text('متوسط').addClass('medium');
|
142 |
+
} else {
|
143 |
+
strengthMeter.text('قوي').addClass('strong');
|
144 |
+
}
|
145 |
+
});
|
146 |
+
|
147 |
+
// Skills management
|
148 |
+
$('.add-skill').click(function() {
|
149 |
+
const skillValue = $(this).siblings('.skill-field').val(); // Get the current skill value
|
150 |
+
if (skillValue.trim() !== "") {
|
151 |
+
const skillInput = `
|
152 |
+
<div class="skill-input">
|
153 |
+
<input type="text" name="skill" class="skill-field" value="${skillValue}">
|
154 |
+
<button type="button" class="remove-skill">-</button>
|
155 |
+
</div>
|
156 |
+
`;
|
157 |
+
$('#skills-container').append(skillInput);
|
158 |
+
$(this).siblings('.skill-field').val(""); // Clear the input field
|
159 |
+
}
|
160 |
+
});
|
161 |
+
|
162 |
+
$(document).on('click', '.remove-skill', function() {
|
163 |
+
$(this).parent().remove();
|
164 |
+
});
|
165 |
+
|
166 |
+
// Form submission
|
167 |
+
$('#registerForm').on('submit', function(e) {
|
168 |
+
const skills = [];
|
169 |
+
$('.skill-field').each(function() {
|
170 |
+
const skill = $(this).val().trim();
|
171 |
+
if (skill) {
|
172 |
+
skills.push(skill);
|
173 |
+
}
|
174 |
+
});
|
175 |
+
$('#skills').val(JSON.stringify(skills));
|
176 |
+
|
177 |
+
const password = $('#password').val();
|
178 |
+
const confirmPassword = $('#confirm_password').val();
|
179 |
+
|
180 |
+
if (password !== confirmPassword) {
|
181 |
+
e.preventDefault();
|
182 |
+
alert('كلمات المرور غير متطابقة');
|
183 |
+
return;
|
184 |
+
}
|
185 |
+
|
186 |
+
const username = $('#username').val().trim();
|
187 |
+
if (!username) {
|
188 |
+
e.preventDefault();
|
189 |
+
alert('الرجاء إدخال اسم المستخدم');
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
});
|
193 |
+
});
|
194 |
+
</script>
|
195 |
+
{% endblock %}
|
templates/reset_password.html
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% extends "base.html" %}
|
2 |
+
|
3 |
+
{% block title %}إعادة تعيين كلمة السر{% endblock %}
|
4 |
+
|
5 |
+
{% block content %}
|
6 |
+
<div class="auth-container">
|
7 |
+
<h2>إعادة تعيين كلمة السر</h2>
|
8 |
+
<form id="resetPasswordForm" method="POST" action="{{ url_for('reset_password') }}">
|
9 |
+
<input type="hidden" name="email" value="{{ email }}">
|
10 |
+
<div class="form-group">
|
11 |
+
<label for="security_answer">إجابة سؤال الأمان</label>
|
12 |
+
<input type="text" id="security_answer" name="security_answer" required>
|
13 |
+
<span id="security-answer-message"></span>
|
14 |
+
</div>
|
15 |
+
<div class="form-group">
|
16 |
+
<label for="new_password">كلمة المرور الجديدة</label>
|
17 |
+
<input type="password" id="new_password" name="new_password" required>
|
18 |
+
</div>
|
19 |
+
<div class="form-group">
|
20 |
+
<label for="confirm_password">تأكيد كلمة المرور</label>
|
21 |
+
<input type="password" id="confirm_password" name="confirm_password" required>
|
22 |
+
</div>
|
23 |
+
<button type="submit" class="submit-btn" id="resetPasswordBtn" disabled>إعادة تعيين كلمة السر</button>
|
24 |
+
</form>
|
25 |
+
</div>
|
26 |
+
{% endblock %}
|
27 |
+
|
28 |
+
{% block scripts %}
|
29 |
+
<script>
|
30 |
+
$(document).ready(function() {
|
31 |
+
$('#security_answer').on('input', function() {
|
32 |
+
const email = '{{ email }}';
|
33 |
+
const security_answer = $(this).val();
|
34 |
+
|
35 |
+
$.ajax({
|
36 |
+
url: '/validate_security_answer',
|
37 |
+
type: 'POST',
|
38 |
+
contentType: 'application/json',
|
39 |
+
data: JSON.stringify({ email: email, security_answer: security_answer }),
|
40 |
+
success: function(data) {
|
41 |
+
const messageElement = $('#security-answer-message');
|
42 |
+
if (data.valid) {
|
43 |
+
messageElement.text('صحيح').css('color', 'green');
|
44 |
+
$('#resetPasswordBtn').prop('disabled', false);
|
45 |
+
} else {
|
46 |
+
messageElement.text('خطأ').css('color', 'red');
|
47 |
+
$('#resetPasswordBtn').prop('disabled', true);
|
48 |
+
}
|
49 |
+
},
|
50 |
+
error: function() {
|
51 |
+
$('#security-answer-message').text('حدث خطأ أثناء التحقق من إجابة سؤال الأمان').css('color', 'red');
|
52 |
+
}
|
53 |
+
});
|
54 |
+
});
|
55 |
+
|
56 |
+
$('#resetPasswordForm').on('submit', function(e) {
|
57 |
+
const new_password = $('#new_password').val();
|
58 |
+
const confirm_password = $('#confirm_password').val();
|
59 |
+
|
60 |
+
if (new_password !== confirm_password) {
|
61 |
+
e.preventDefault();
|
62 |
+
alert('كلمات المرور غير متطابقة');
|
63 |
+
}
|
64 |
+
});
|
65 |
+
});
|
66 |
+
</script>
|
67 |
+
{% endblock %}
|
templates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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8" />
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6 |
+
<title>Videos</title>
|
7 |
+
<!-- إضافة مكتبة FontAwesome -->
|
8 |
+
<link
|
9 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
|
10 |
+
rel="stylesheet"
|
11 |
+
/>
|
12 |
+
|
13 |
+
<style>
|
14 |
+
/* Skeleton Loading */
|
15 |
+
.skeleton {
|
16 |
+
background-color: #ddd;
|
17 |
+
animation: pulse 1.5s infinite;
|
18 |
+
}
|
19 |
+
|
20 |
+
@keyframes pulse {
|
21 |
+
0% {
|
22 |
+
opacity: 1;
|
23 |
+
}
|
24 |
+
50% {
|
25 |
+
opacity: 0.5;
|
26 |
+
}
|
27 |
+
100% {
|
28 |
+
opacity: 1;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
/* تنسيق الصفحة */
|
33 |
+
body {
|
34 |
+
font-family: Arial, sans-serif;
|
35 |
+
margin: 20px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.upload-form {
|
39 |
+
margin-bottom: 30px;
|
40 |
+
padding: 15px;
|
41 |
+
border: 1px solid #ccc;
|
42 |
+
border-radius: 8px;
|
43 |
+
background-color: #f9f9f9;
|
44 |
+
}
|
45 |
+
|
46 |
+
.video-container {
|
47 |
+
display: flex;
|
48 |
+
flex-wrap: wrap;
|
49 |
+
gap: 15px;
|
50 |
+
}
|
51 |
+
|
52 |
+
.video-card {
|
53 |
+
border: 1px solid #ccc;
|
54 |
+
border-radius: 8px;
|
55 |
+
padding: 10px;
|
56 |
+
width: 300px;
|
57 |
+
background-color: #fff;
|
58 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
59 |
+
cursor: pointer;
|
60 |
+
}
|
61 |
+
|
62 |
+
.video-card img {
|
63 |
+
width: 100%;
|
64 |
+
/* border-radius: 8px; */
|
65 |
+
}
|
66 |
+
|
67 |
+
.video-card h4,
|
68 |
+
.video-card p {
|
69 |
+
margin: 5px 0;
|
70 |
+
}
|
71 |
+
|
72 |
+
.skeleton-card {
|
73 |
+
width: 300px;
|
74 |
+
height: 200px;
|
75 |
+
border-radius: 8px;
|
76 |
+
margin-bottom: 10px;
|
77 |
+
}
|
78 |
+
|
79 |
+
.empty-message {
|
80 |
+
font-size: 18px;
|
81 |
+
color: #555;
|
82 |
+
margin-top: 20px;
|
83 |
+
}
|
84 |
+
|
85 |
+
.uploader_image {
|
86 |
+
width: 30px !important;
|
87 |
+
border-radius: 50% !important;
|
88 |
+
}
|
89 |
+
|
90 |
+
/* النافذة المنبثقة (Modal) */
|
91 |
+
.modal {
|
92 |
+
display: none; /* مخفية بشكل افتراضي */
|
93 |
+
position: fixed; /* ثابتة في مكانها */
|
94 |
+
z-index: 1000; /* تكون فوق كل العناصر */
|
95 |
+
left: 0;
|
96 |
+
top: 0;
|
97 |
+
width: 100%; /* عرض كامل */
|
98 |
+
height: 100%; /* ارتفاع كامل */
|
99 |
+
background-color: rgba(0, 0, 0, 0.9); /* خلفية داكنة مع شفافية */
|
100 |
+
overflow: auto; /* تمكين التمرير إذا لزم الأمر */
|
101 |
+
animation: modalFadeIn 0.3s ease-out forwards; /* إضافة أنيميشن عند فتح المودال */
|
102 |
+
}
|
103 |
+
|
104 |
+
/* محتوى النافذة المنبثقة */
|
105 |
+
.modal-content {
|
106 |
+
background-color: #fff;
|
107 |
+
margin: 0%;
|
108 |
+
/* padding: 20px; */
|
109 |
+
width: 99.4%;
|
110 |
+
height: 100%;
|
111 |
+
text-align: center;
|
112 |
+
overflow: hidden;
|
113 |
+
/* border-radius: 10px; */
|
114 |
+
}
|
115 |
+
|
116 |
+
/* زر الإغلاق */
|
117 |
+
.close {
|
118 |
+
color: #aaa;
|
119 |
+
position: fixed;
|
120 |
+
bottom: 0;
|
121 |
+
right: 50%;
|
122 |
+
transform: translate(50%, 0);
|
123 |
+
overflow: hidden;
|
124 |
+
font-size: 24px;
|
125 |
+
font-weight: bold;
|
126 |
+
cursor: pointer;
|
127 |
+
background-color: brown;
|
128 |
+
padding: 5px;
|
129 |
+
height: 30px;
|
130 |
+
width: 30px;
|
131 |
+
border-radius: 50%;
|
132 |
+
text-align: center;
|
133 |
+
margin-bottom: 10px;
|
134 |
+
margin-top: 10px;
|
135 |
+
}
|
136 |
+
|
137 |
+
.close:hover,
|
138 |
+
.close:focus {
|
139 |
+
color: #000;
|
140 |
+
text-decoration: none;
|
141 |
+
}
|
142 |
+
|
143 |
+
/* الفيديو */
|
144 |
+
video {
|
145 |
+
width: 100%;
|
146 |
+
height: auto;
|
147 |
+
max-width: 100%;
|
148 |
+
max-height: 400px;
|
149 |
+
background-color: black;
|
150 |
+
}
|
151 |
+
|
152 |
+
/* معلومات الفيديو */
|
153 |
+
#videoInfo {
|
154 |
+
margin-top: 15px;
|
155 |
+
padding: 5px 20px;
|
156 |
+
text-align: left;
|
157 |
+
}
|
158 |
+
|
159 |
+
#videoTitle {
|
160 |
+
font-size: 20px; /* حجم خط مناسب للجوال */
|
161 |
+
margin-bottom: 10px;
|
162 |
+
color: #333;
|
163 |
+
}
|
164 |
+
|
165 |
+
#videoCategory,
|
166 |
+
#uploadTime {
|
167 |
+
font-size: 14px; /* حجم خط أصغر */
|
168 |
+
color: #666;
|
169 |
+
margin-bottom: 10px;
|
170 |
+
}
|
171 |
+
|
172 |
+
/* معلومات المُحمِّل */
|
173 |
+
#uploaderInfo {
|
174 |
+
display: flex;
|
175 |
+
justify-content: left;
|
176 |
+
margin-top: 15px;
|
177 |
+
}
|
178 |
+
|
179 |
+
#uploaderName {
|
180 |
+
font-size: 16px; /* حجم خط مناسب للجوال */
|
181 |
+
color: #333;
|
182 |
+
margin-left: 10px;
|
183 |
+
}
|
184 |
+
|
185 |
+
/* الأنيميشن لفتح المودال */
|
186 |
+
@keyframes modalFadeIn {
|
187 |
+
0% {
|
188 |
+
transform: scale(0.8);
|
189 |
+
opacity: 0;
|
190 |
+
}
|
191 |
+
100% {
|
192 |
+
transform: scale(1);
|
193 |
+
opacity: 1;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
/* الأنيميشن لإغلاق المودال */
|
198 |
+
@keyframes modalFadeOut {
|
199 |
+
0% {
|
200 |
+
transform: scale(1);
|
201 |
+
opacity: 1;
|
202 |
+
}
|
203 |
+
100% {
|
204 |
+
transform: scale(0.8);
|
205 |
+
opacity: 0;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/* لتقليص المودال عند الإغلاق */
|
210 |
+
.modal.close-animation {
|
211 |
+
animation: modalFadeOut 0.3s ease-out forwards;
|
212 |
+
}
|
213 |
+
|
214 |
+
/* تنسيق الفيديوهات */
|
215 |
+
.video-card {
|
216 |
+
border: 1px solid #ccc;
|
217 |
+
padding: 15px;
|
218 |
+
margin: 10px;
|
219 |
+
border-radius: 5px;
|
220 |
+
width: 300px;
|
221 |
+
display: inline-block;
|
222 |
+
vertical-align: top;
|
223 |
+
}
|
224 |
+
|
225 |
+
.video-card img {
|
226 |
+
width: 100%;
|
227 |
+
border-radius: 5px;
|
228 |
+
}
|
229 |
+
|
230 |
+
.video-card h4 {
|
231 |
+
margin: 10px 0;
|
232 |
+
}
|
233 |
+
|
234 |
+
.video-card p {
|
235 |
+
margin: 5px 0;
|
236 |
+
}
|
237 |
+
|
238 |
+
.uploader_image {
|
239 |
+
border-radius: 50%;
|
240 |
+
width: 30px;
|
241 |
+
height: 30px;
|
242 |
+
margin-top: 10px;
|
243 |
+
margin-left: 10px;
|
244 |
+
}
|
245 |
+
|
246 |
+
/* تنسيق الأزرار */
|
247 |
+
.video-actions {
|
248 |
+
margin-top: 10px;
|
249 |
+
}
|
250 |
+
|
251 |
+
.video-actions button {
|
252 |
+
margin-right: 10px;
|
253 |
+
padding: 5px 10px;
|
254 |
+
background-color: #007bff;
|
255 |
+
color: white;
|
256 |
+
border: none;
|
257 |
+
border-radius: 5px;
|
258 |
+
cursor: pointer;
|
259 |
+
}
|
260 |
+
|
261 |
+
.video-actions button:hover {
|
262 |
+
background-color: #0056b3;
|
263 |
+
}
|
264 |
+
|
265 |
+
/* تنسيق الـ Modals */
|
266 |
+
.modal {
|
267 |
+
display: none;
|
268 |
+
position: fixed;
|
269 |
+
z-index: 1000;
|
270 |
+
left: 0;
|
271 |
+
top: 0;
|
272 |
+
width: 100%;
|
273 |
+
height: 100%;
|
274 |
+
background-color: rgba(0, 0, 0, 0.5);
|
275 |
+
}
|
276 |
+
|
277 |
+
.close-edit,
|
278 |
+
.close-delete {
|
279 |
+
float: right;
|
280 |
+
cursor: pointer;
|
281 |
+
font-size: 24px;
|
282 |
+
}
|
283 |
+
|
284 |
+
.close-edit:hover,
|
285 |
+
.close-delete:hover {
|
286 |
+
color: #000;
|
287 |
+
}
|
288 |
+
|
289 |
+
/* تنسيق عام لـ Modals */
|
290 |
+
.custom-modal {
|
291 |
+
display: none; /* يتم إخفاء الـ Modal بشكل افتراضي */
|
292 |
+
position: fixed;
|
293 |
+
z-index: 1000;
|
294 |
+
left: 0;
|
295 |
+
top: 0;
|
296 |
+
width: 100%;
|
297 |
+
height: 100%;
|
298 |
+
background-color: rgba(0, 0, 0, 0.6); /* خلفية شبه شفافة داكنة */
|
299 |
+
backdrop-filter: blur(5px); /* تأثير ضبابي */
|
300 |
+
overflow: auto;
|
301 |
+
}
|
302 |
+
|
303 |
+
/* تنسيق محتوى الـ Modal */
|
304 |
+
.custom-modal-content {
|
305 |
+
position: absolute;
|
306 |
+
top: 50%;
|
307 |
+
transform: translate(0, -50%);
|
308 |
+
background-color: #fff;
|
309 |
+
margin: 0%;
|
310 |
+
padding: 10px 0px;
|
311 |
+
/* border-radius: 12px; */
|
312 |
+
width: 100%;
|
313 |
+
max-width: 500px;
|
314 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
315 |
+
/* animation: fadeIn 0.3s ease-in-out; */
|
316 |
+
height: fit-content;
|
317 |
+
}
|
318 |
+
|
319 |
+
.custom-modal-content-delete {
|
320 |
+
background-color: #fff;
|
321 |
+
margin: 0%;
|
322 |
+
padding: 25px;
|
323 |
+
/* border-radius: 12px; */
|
324 |
+
width: 90%;
|
325 |
+
max-width: 500px;
|
326 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
327 |
+
animation: fadeInDelete 0.3s ease-in-out;
|
328 |
+
}
|
329 |
+
|
330 |
+
@keyframes fadeIn {
|
331 |
+
from {
|
332 |
+
opacity: 0;
|
333 |
+
/* transform: translateY(-20px); */
|
334 |
+
}
|
335 |
+
to {
|
336 |
+
opacity: 1;
|
337 |
+
/* transform: translateY(0); */
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
@keyframes fadeInDelete {
|
342 |
+
from {
|
343 |
+
opacity: 0;
|
344 |
+
transform: translateY(-20px);
|
345 |
+
}
|
346 |
+
to {
|
347 |
+
opacity: 1;
|
348 |
+
transform: translateY(0);
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
/* تنسيق عنوان الـ Modal */
|
353 |
+
.modal-title {
|
354 |
+
font-size: 1.5rem;
|
355 |
+
color: #333;
|
356 |
+
margin-bottom: 20px;
|
357 |
+
text-align: center;
|
358 |
+
}
|
359 |
+
|
360 |
+
/* تنسيق حقل الإدخال */
|
361 |
+
.modal-input {
|
362 |
+
width: 80%;
|
363 |
+
padding: 10px 3px;
|
364 |
+
margin-bottom: 20px;
|
365 |
+
border: 1px solid #ddd;
|
366 |
+
border-radius: 8px;
|
367 |
+
font-size: 1rem;
|
368 |
+
outline: none;
|
369 |
+
transition: border-color 0.3s ease;
|
370 |
+
}
|
371 |
+
|
372 |
+
.modal-input:focus {
|
373 |
+
border-color: #007bff;
|
374 |
+
}
|
375 |
+
|
376 |
+
/* تنسيق الأزرار */
|
377 |
+
.modal-button {
|
378 |
+
padding: 10px 20px;
|
379 |
+
border: none;
|
380 |
+
border-radius: 8px;
|
381 |
+
font-size: 1rem;
|
382 |
+
cursor: pointer;
|
383 |
+
transition: background-color 0.3s ease, transform 0.2s ease;
|
384 |
+
}
|
385 |
+
|
386 |
+
.modal-button:hover {
|
387 |
+
transform: scale(1.05);
|
388 |
+
}
|
389 |
+
|
390 |
+
.modal-button:active {
|
391 |
+
transform: scale(0.95);
|
392 |
+
}
|
393 |
+
|
394 |
+
.modal-button-save {
|
395 |
+
background-color: #007bff;
|
396 |
+
color: #fff;
|
397 |
+
width: 80%;
|
398 |
+
}
|
399 |
+
|
400 |
+
.modal-button-save:hover {
|
401 |
+
background-color: #0056b3;
|
402 |
+
}
|
403 |
+
|
404 |
+
.modal-button-delete {
|
405 |
+
background-color: #ff4d4d;
|
406 |
+
color: #fff;
|
407 |
+
}
|
408 |
+
|
409 |
+
.modal-button-delete:hover {
|
410 |
+
background-color: #cc0000;
|
411 |
+
}
|
412 |
+
|
413 |
+
.modal-button-cancel {
|
414 |
+
background-color: #f1f1f1;
|
415 |
+
color: #333;
|
416 |
+
}
|
417 |
+
|
418 |
+
.modal-button-cancel:hover {
|
419 |
+
background-color: #ddd;
|
420 |
+
}
|
421 |
+
|
422 |
+
/* تنسيق زر الإغلاق */
|
423 |
+
.custom-close {
|
424 |
+
position: absolute;
|
425 |
+
top: 15px;
|
426 |
+
right: 15px;
|
427 |
+
font-size: 1.5rem;
|
428 |
+
color: #888;
|
429 |
+
cursor: pointer;
|
430 |
+
transition: color 0.3s ease;
|
431 |
+
}
|
432 |
+
|
433 |
+
.custom-close:hover {
|
434 |
+
color: #333;
|
435 |
+
}
|
436 |
+
|
437 |
+
/* تنسيق أزرار التأكيد والإلغاء */
|
438 |
+
.modal-buttons {
|
439 |
+
display: flex;
|
440 |
+
justify-content: space-between;
|
441 |
+
gap: 10px;
|
442 |
+
margin-top: 20px;
|
443 |
+
}
|
444 |
+
|
445 |
+
/* تأثير الظهور */
|
446 |
+
@keyframes fadeIn {
|
447 |
+
0% {
|
448 |
+
opacity: 0;
|
449 |
+
transform: scale(0.8);
|
450 |
+
}
|
451 |
+
100% {
|
452 |
+
opacity: 1;
|
453 |
+
transform: scale(1);
|
454 |
+
}
|
455 |
+
}
|
456 |
+
|
457 |
+
/* أسلوب المودال */
|
458 |
+
.modal-message {
|
459 |
+
display: none;
|
460 |
+
position: fixed;
|
461 |
+
top: 0;
|
462 |
+
left: 0;
|
463 |
+
width: 100%;
|
464 |
+
height: 100%;
|
465 |
+
background-color: rgba(0, 0, 0, 0.5); /* خلفية مظللة */
|
466 |
+
justify-content: center;
|
467 |
+
align-items: center;
|
468 |
+
z-index: 1000;
|
469 |
+
animation: fadeIn 0.3s ease-in-out; /* تطبيق الأنيميشن عند الظهور */
|
470 |
+
}
|
471 |
+
|
472 |
+
/* محتوى المودال */
|
473 |
+
.modal-content-main {
|
474 |
+
background-color: white;
|
475 |
+
padding: 25px;
|
476 |
+
border-radius: 8px;
|
477 |
+
text-align: center;
|
478 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
479 |
+
max-width: 400px;
|
480 |
+
width: 100%;
|
481 |
+
}
|
482 |
+
|
483 |
+
/* أيقونة النجاح */
|
484 |
+
.modal-icon {
|
485 |
+
font-size: 50px;
|
486 |
+
color: #4caf50;
|
487 |
+
margin-bottom: 15px;
|
488 |
+
animation: bounce 1s infinite; /* تأثير اهتزاز */
|
489 |
+
}
|
490 |
+
|
491 |
+
/* تأثير الاهتزاز */
|
492 |
+
@keyframes bounce {
|
493 |
+
0%,
|
494 |
+
100% {
|
495 |
+
transform: translateY(0);
|
496 |
+
}
|
497 |
+
50% {
|
498 |
+
transform: translateY(-10px);
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
/* إغلاق المودال */
|
503 |
+
.close-message {
|
504 |
+
position: absolute;
|
505 |
+
top: 10px;
|
506 |
+
right: 10px;
|
507 |
+
font-size: 25px;
|
508 |
+
cursor: pointer;
|
509 |
+
color: #888;
|
510 |
+
transition: color 0.3s ease;
|
511 |
+
}
|
512 |
+
|
513 |
+
/* تغيير اللون عند التمرير */
|
514 |
+
.close-message:hover {
|
515 |
+
color: #333;
|
516 |
+
}
|
517 |
+
|
518 |
+
/* رسالة النص */
|
519 |
+
#message-content {
|
520 |
+
font-size: 1.2rem;
|
521 |
+
margin-top: 10px;
|
522 |
+
color: #333;
|
523 |
+
}
|
524 |
+
|
525 |
+
/* إضافة الأنيميشن عند التفاعل مع الأزرار */
|
526 |
+
.modal-buttons {
|
527 |
+
display: flex;
|
528 |
+
justify-content: space-between;
|
529 |
+
gap: 10px;
|
530 |
+
margin-top: 20px;
|
531 |
+
}
|
532 |
+
|
533 |
+
/* تنسيق Modal قوائم التشغيل */
|
534 |
+
/* تنسيق Modal قوائم التشغيل */
|
535 |
+
#playlistModal {
|
536 |
+
display: none;
|
537 |
+
position: fixed;
|
538 |
+
z-index: 1000;
|
539 |
+
left: 0;
|
540 |
+
top: 0;
|
541 |
+
width: 100%;
|
542 |
+
height: 100%;
|
543 |
+
background-color: rgba(0, 0, 0, 0.5);
|
544 |
+
}
|
545 |
+
|
546 |
+
.modal-content-playlist {
|
547 |
+
background-color: #fff;
|
548 |
+
margin: 10% auto;
|
549 |
+
padding: 20px;
|
550 |
+
border-radius: 10px;
|
551 |
+
width: 80%;
|
552 |
+
max-width: 500px;
|
553 |
+
}
|
554 |
+
|
555 |
+
.close-playlist {
|
556 |
+
float: right;
|
557 |
+
font-size: 24px;
|
558 |
+
cursor: pointer;
|
559 |
+
}
|
560 |
+
|
561 |
+
.create-playlist {
|
562 |
+
margin-bottom: 20px;
|
563 |
+
}
|
564 |
+
|
565 |
+
.create-playlist input,
|
566 |
+
.create-playlist select {
|
567 |
+
width: 100%;
|
568 |
+
padding: 10px;
|
569 |
+
margin-bottom: 10px;
|
570 |
+
border: 1px solid #ddd;
|
571 |
+
border-radius: 5px;
|
572 |
+
}
|
573 |
+
|
574 |
+
.create-playlist button {
|
575 |
+
width: 100%;
|
576 |
+
padding: 10px;
|
577 |
+
background-color: #007bff;
|
578 |
+
color: #fff;
|
579 |
+
border: none;
|
580 |
+
border-radius: 5px;
|
581 |
+
cursor: pointer;
|
582 |
+
}
|
583 |
+
|
584 |
+
.existing-playlists ul {
|
585 |
+
list-style-type: none;
|
586 |
+
padding: 0;
|
587 |
+
}
|
588 |
+
|
589 |
+
.existing-playlists li {
|
590 |
+
margin-bottom: 10px;
|
591 |
+
}
|
592 |
+
|
593 |
+
.existing-playlists label {
|
594 |
+
display: flex;
|
595 |
+
align-items: center;
|
596 |
+
}
|
597 |
+
|
598 |
+
.existing-playlists input[type="checkbox"] {
|
599 |
+
margin-right: 10px;
|
600 |
+
}
|
601 |
+
|
602 |
+
#addToSelectedPlaylists {
|
603 |
+
width: 100%;
|
604 |
+
padding: 10px;
|
605 |
+
background-color: #28a745;
|
606 |
+
color: #fff;
|
607 |
+
border: none;
|
608 |
+
border-radius: 5px;
|
609 |
+
cursor: pointer;
|
610 |
+
margin-top: 20px;
|
611 |
+
}
|
612 |
+
|
613 |
+
.delete-playlist {
|
614 |
+
background-color: #ff4d4d;
|
615 |
+
color: white;
|
616 |
+
border: none;
|
617 |
+
padding: 5px 10px;
|
618 |
+
border-radius: 5px;
|
619 |
+
cursor: pointer;
|
620 |
+
margin-left: 10px;
|
621 |
+
}
|
622 |
+
|
623 |
+
.delete-playlist:hover {
|
624 |
+
background-color: #cc0000;
|
625 |
+
}
|
626 |
+
|
627 |
+
|
628 |
+
|
629 |
+
/* أنماط النماذج (Modals) */
|
630 |
+
.modal-unique {
|
631 |
+
display: none;
|
632 |
+
position: fixed;
|
633 |
+
top: 0;
|
634 |
+
left: 0;
|
635 |
+
width: 100%;
|
636 |
+
height: 100%;
|
637 |
+
background: rgba(0, 0, 0, 0.5);
|
638 |
+
justify-content: center;
|
639 |
+
align-items: center;
|
640 |
+
overflow: scroll;
|
641 |
+
}
|
642 |
+
.modal-content-unique {
|
643 |
+
position: absolute;
|
644 |
+
top: 50%;
|
645 |
+
transform: translate(0, -50%);
|
646 |
+
background-color: #fff;
|
647 |
+
margin: 0%;
|
648 |
+
padding: 10px 0px;
|
649 |
+
/* border-radius: 12px; */
|
650 |
+
width: 100%;
|
651 |
+
max-width: 500px;
|
652 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
653 |
+
/* animation: fadeIn 0.3s ease-in-out; */
|
654 |
+
height: 100%;
|
655 |
+
/* overflow: hidden; */
|
656 |
+
}
|
657 |
+
|
658 |
+
|
659 |
+
|
660 |
+
.close-unique {
|
661 |
+
/* position: absolute; */
|
662 |
+
|
663 |
+
|
664 |
+
font-size: 20px;
|
665 |
+
cursor: pointer;
|
666 |
+
}
|
667 |
+
|
668 |
+
/* أنماط قائمة التشغيل */
|
669 |
+
.playlist-item-unique {
|
670 |
+
padding: 10px;
|
671 |
+
border-bottom: 1px solid #ddd;
|
672 |
+
cursor: pointer;
|
673 |
+
}
|
674 |
+
.playlist-item-unique:hover {
|
675 |
+
background: #f1f1f1;
|
676 |
+
}
|
677 |
+
|
678 |
+
|
679 |
+
.video-list-unique {
|
680 |
+
margin-top: 20px;
|
681 |
+
}
|
682 |
+
.video-item-unique {
|
683 |
+
display: flex;
|
684 |
+
align-items: center;
|
685 |
+
/* margin-bottom: 10px; */
|
686 |
+
background-color: #bdb8b8;
|
687 |
+
cursor: pointer;
|
688 |
+
}
|
689 |
+
.video-item-unique img {
|
690 |
+
width: 120px;
|
691 |
+
height: 90px;
|
692 |
+
margin-right: 10px;
|
693 |
+
}
|
694 |
+
|
695 |
+
|
696 |
+
.video-item-unique.active {
|
697 |
+
background-color: #f0f0f0; /* تغيير خلفية الفيديو النشط */
|
698 |
+
border: 2px solid #007bff; /* إضافة حدود للفيديو النشط */
|
699 |
+
}
|
700 |
+
|
701 |
+
#videosModal{
|
702 |
+
/* overflow: hidden; */
|
703 |
+
}
|
704 |
+
|
705 |
+
#videosList{
|
706 |
+
overflow: scroll;
|
707 |
+
}
|
708 |
+
|
709 |
+
|
710 |
+
/* anmation loading vidoes to upload */
|
711 |
+
|
712 |
+
:root {
|
713 |
+
--bg: hsl(90,90%,20%);
|
714 |
+
--fg: hsl(223,10%,10%);
|
715 |
+
font-size: calc(16px + (24 - 16) * (100vw - 320px) / (1280 - 320));
|
716 |
+
}
|
717 |
+
|
718 |
+
.wheel-and-hamster {
|
719 |
+
--dur: 1s;
|
720 |
+
position: relative;
|
721 |
+
width: 12em;
|
722 |
+
height: 12em;
|
723 |
+
}
|
724 |
+
.wheel,
|
725 |
+
.hamster,
|
726 |
+
.hamster div,
|
727 |
+
.spoke {
|
728 |
+
position: absolute;
|
729 |
+
}
|
730 |
+
.wheel,
|
731 |
+
.spoke {
|
732 |
+
border-radius: 50%;
|
733 |
+
top: 0;
|
734 |
+
left: 0;
|
735 |
+
width: 100%;
|
736 |
+
height: 100%;
|
737 |
+
}
|
738 |
+
.wheel {
|
739 |
+
background: radial-gradient(100% 100% at center,hsla(0,0%,60%,0) 47.8%,hsl(0,0%,60%) 48%);
|
740 |
+
z-index: 2;
|
741 |
+
}
|
742 |
+
.hamster {
|
743 |
+
animation: hamster var(--dur) ease-in-out infinite;
|
744 |
+
top: 50%;
|
745 |
+
left: calc(50% - 3.5em);
|
746 |
+
width: 7em;
|
747 |
+
height: 3.75em;
|
748 |
+
transform: rotate(4deg) translate(-0.8em,1.85em);
|
749 |
+
transform-origin: 50% 0;
|
750 |
+
z-index: 1;
|
751 |
+
}
|
752 |
+
.hamster__head {
|
753 |
+
animation: hamsterHead var(--dur) ease-in-out infinite;
|
754 |
+
background: hsl(30,90%,55%);
|
755 |
+
border-radius: 70% 30% 0 100% / 40% 25% 25% 60%;
|
756 |
+
box-shadow:
|
757 |
+
0 -0.25em 0 hsl(30,90%,80%) inset,
|
758 |
+
0.75em -1.55em 0 hsl(30,90%,90%) inset;
|
759 |
+
top: 0;
|
760 |
+
left: -2em;
|
761 |
+
width: 2.75em;
|
762 |
+
height: 2.5em;
|
763 |
+
transform-origin: 100% 50%;
|
764 |
+
}
|
765 |
+
.hamster__ear {
|
766 |
+
animation: hamsterEar var(--dur) ease-in-out infinite;
|
767 |
+
background: hsl(0,90%,85%);
|
768 |
+
border-radius: 50%;
|
769 |
+
box-shadow: -0.25em 0 hsl(30,90%,55%) inset;
|
770 |
+
top: -0.25em;
|
771 |
+
right: -0.25em;
|
772 |
+
width: 0.75em;
|
773 |
+
height: 0.75em;
|
774 |
+
transform-origin: 50% 75%;
|
775 |
+
}
|
776 |
+
.hamster__eye {
|
777 |
+
animation: hamsterEye var(--dur) linear infinite;
|
778 |
+
background-color: hsl(0,0%,0%);
|
779 |
+
border-radius: 50%;
|
780 |
+
top: 0.375em;
|
781 |
+
left: 1.25em;
|
782 |
+
width: 0.5em;
|
783 |
+
height: 0.5em;
|
784 |
+
}
|
785 |
+
.hamster__nose {
|
786 |
+
background: hsl(0,90%,75%);
|
787 |
+
border-radius: 35% 65% 85% 15% / 70% 50% 50% 30%;
|
788 |
+
top: 0.75em;
|
789 |
+
left: 0;
|
790 |
+
width: 0.2em;
|
791 |
+
height: 0.25em;
|
792 |
+
}
|
793 |
+
.hamster__body {
|
794 |
+
animation: hamsterBody var(--dur) ease-in-out infinite;
|
795 |
+
background: hsl(30,90%,90%);
|
796 |
+
border-radius: 50% 30% 50% 30% / 15% 60% 40% 40%;
|
797 |
+
box-shadow:
|
798 |
+
0.1em 0.75em 0 hsl(30,90%,55%) inset,
|
799 |
+
0.15em -0.5em 0 hsl(30,90%,80%) inset;
|
800 |
+
top: 0.25em;
|
801 |
+
left: 2em;
|
802 |
+
width: 4.5em;
|
803 |
+
height: 3em;
|
804 |
+
transform-origin: 17% 50%;
|
805 |
+
transform-style: preserve-3d;
|
806 |
+
}
|
807 |
+
.hamster__limb--fr,
|
808 |
+
.hamster__limb--fl {
|
809 |
+
clip-path: polygon(0 0,100% 0,70% 80%,60% 100%,0% 100%,40% 80%);
|
810 |
+
top: 2em;
|
811 |
+
left: 0.5em;
|
812 |
+
width: 1em;
|
813 |
+
height: 1.5em;
|
814 |
+
transform-origin: 50% 0;
|
815 |
+
}
|
816 |
+
.hamster__limb--fr {
|
817 |
+
animation: hamsterFRLimb var(--dur) linear infinite;
|
818 |
+
background: linear-gradient(hsl(30,90%,80%) 80%,hsl(0,90%,75%) 80%);
|
819 |
+
transform: rotate(15deg) translateZ(-1px);
|
820 |
+
}
|
821 |
+
.hamster__limb--fl {
|
822 |
+
animation: hamsterFLLimb var(--dur) linear infinite;
|
823 |
+
background: linear-gradient(hsl(30,90%,90%) 80%,hsl(0,90%,85%) 80%);
|
824 |
+
transform: rotate(15deg);
|
825 |
+
}
|
826 |
+
.hamster__limb--br,
|
827 |
+
.hamster__limb--bl {
|
828 |
+
border-radius: 0.75em 0.75em 0 0;
|
829 |
+
clip-path: polygon(0 0,100% 0,100% 30%,70% 90%,70% 100%,30% 100%,40% 90%,0% 30%);
|
830 |
+
top: 1em;
|
831 |
+
left: 2.8em;
|
832 |
+
width: 1.5em;
|
833 |
+
height: 2.5em;
|
834 |
+
transform-origin: 50% 30%;
|
835 |
+
}
|
836 |
+
.hamster__limb--br {
|
837 |
+
animation: hamsterBRLimb var(--dur) linear infinite;
|
838 |
+
background: linear-gradient(hsl(30,90%,80%) 90%,hsl(0,90%,75%) 90%);
|
839 |
+
transform: rotate(-25deg) translateZ(-1px);
|
840 |
+
}
|
841 |
+
.hamster__limb--bl {
|
842 |
+
animation: hamsterBLLimb var(--dur) linear infinite;
|
843 |
+
background: linear-gradient(hsl(30,90%,90%) 90%,hsl(0,90%,85%) 90%);
|
844 |
+
transform: rotate(-25deg);
|
845 |
+
}
|
846 |
+
.hamster__tail {
|
847 |
+
animation: hamsterTail var(--dur) linear infinite;
|
848 |
+
background: hsl(0,90%,85%);
|
849 |
+
border-radius: 0.25em 50% 50% 0.25em;
|
850 |
+
box-shadow: 0 -0.2em 0 hsl(0,90%,75%) inset;
|
851 |
+
top: 1.5em;
|
852 |
+
right: -0.5em;
|
853 |
+
width: 1em;
|
854 |
+
height: 0.5em;
|
855 |
+
transform: rotate(30deg) translateZ(-1px);
|
856 |
+
transform-origin: 0.25em 0.25em;
|
857 |
+
}
|
858 |
+
.spoke {
|
859 |
+
animation: spoke var(--dur) linear infinite;
|
860 |
+
background:
|
861 |
+
radial-gradient(100% 100% at center,hsl(0,0%,60%) 4.8%,hsla(0,0%,60%,0) 5%),
|
862 |
+
linear-gradient(hsla(0,0%,55%,0) 46.9%,hsl(0,0%,65%) 47% 52.9%,hsla(0,0%,65%,0) 53%) 50% 50% / 99% 99% no-repeat;
|
863 |
+
}
|
864 |
+
|
865 |
+
/* Animations */
|
866 |
+
@keyframes hamster {
|
867 |
+
from, to { transform: rotate(4deg) translate(-0.8em,1.85em); }
|
868 |
+
50% { transform: rotate(0) translate(-0.8em,1.85em); }
|
869 |
+
}
|
870 |
+
@keyframes hamsterHead {
|
871 |
+
from, 25%, 50%, 75%, to { transform: rotate(0); }
|
872 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(8deg); }
|
873 |
+
}
|
874 |
+
@keyframes hamsterEye {
|
875 |
+
from, 90%, to { transform: scaleY(1); }
|
876 |
+
95% { transform: scaleY(0); }
|
877 |
+
}
|
878 |
+
@keyframes hamsterEar {
|
879 |
+
from, 25%, 50%, 75%, to { transform: rotate(0); }
|
880 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(12deg); }
|
881 |
+
}
|
882 |
+
@keyframes hamsterBody {
|
883 |
+
from, 25%, 50%, 75%, to { transform: rotate(0); }
|
884 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(-2deg); }
|
885 |
+
}
|
886 |
+
@keyframes hamsterFRLimb {
|
887 |
+
from, 25%, 50%, 75%, to { transform: rotate(50deg) translateZ(-1px); }
|
888 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(-30deg) translateZ(-1px); }
|
889 |
+
}
|
890 |
+
@keyframes hamsterFLLimb {
|
891 |
+
from, 25%, 50%, 75%, to { transform: rotate(-30deg); }
|
892 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(50deg); }
|
893 |
+
}
|
894 |
+
@keyframes hamsterBRLimb {
|
895 |
+
from, 25%, 50%, 75%, to { transform: rotate(-60deg) translateZ(-1px); }
|
896 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(20deg) translateZ(-1px); }
|
897 |
+
}
|
898 |
+
@keyframes hamsterBLLimb {
|
899 |
+
from, 25%, 50%, 75%, to { transform: rotate(20deg); }
|
900 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(-60deg); }
|
901 |
+
}
|
902 |
+
@keyframes hamsterTail {
|
903 |
+
from, 25%, 50%, 75%, to { transform: rotate(30deg) translateZ(-1px); }
|
904 |
+
12.5%, 37.5%, 62.5%, 87.5% { transform: rotate(10deg) translateZ(-1px); }
|
905 |
+
}
|
906 |
+
@keyframes spoke {
|
907 |
+
from { transform: rotate(0); }
|
908 |
+
to { transform: rotate(-1turn); }
|
909 |
+
}
|
910 |
+
|
911 |
+
.main-anmi-loading{
|
912 |
+
background: var(--bg);
|
913 |
+
color: var(--fg);
|
914 |
+
font: 1em / 1.5 sans-serif;
|
915 |
+
height: 100vh;
|
916 |
+
display: grid;
|
917 |
+
place-items: center;
|
918 |
+
position: fixed;
|
919 |
+
left: 0;
|
920 |
+
right: 0;
|
921 |
+
top: 0;
|
922 |
+
display: none;
|
923 |
+
}
|
924 |
+
|
925 |
+
</style>
|
926 |
+
</head>
|
927 |
+
<body>
|
928 |
+
<div class="main-anmi-loading">
|
929 |
+
|
930 |
+
<div class="wheel-and-hamster" role="img" aria-label="Orange and tan hamster running in a metal wheel">
|
931 |
+
<div class="wheel"></div>
|
932 |
+
<div class="hamster">
|
933 |
+
<div class="hamster__body">
|
934 |
+
<div class="hamster__head">
|
935 |
+
<div class="hamster__ear"></div>
|
936 |
+
<div class="hamster__eye"></div>
|
937 |
+
<div class="hamster__nose"></div>
|
938 |
+
</div>
|
939 |
+
<div class="hamster__limb hamster__limb--fr"></div>
|
940 |
+
<div class="hamster__limb hamster__limb--fl"></div>
|
941 |
+
<div class="hamster__limb hamster__limb--br"></div>
|
942 |
+
<div class="hamster__limb hamster__limb--bl"></div>
|
943 |
+
<div class="hamster__tail"></div>
|
944 |
+
</div>
|
945 |
+
</div>
|
946 |
+
<div class="spoke"></div>
|
947 |
+
</div>
|
948 |
+
|
949 |
+
|
950 |
+
</div>
|
951 |
+
<!-- Video Modal -->
|
952 |
+
<!-- Video Modal -->
|
953 |
+
<div id="videoModal" class="modal">
|
954 |
+
<div class="modal-content">
|
955 |
+
<span class="close">×</span>
|
956 |
+
<video autoplay id="videoPlayer" controls>
|
957 |
+
<source id="videoSource" type="video/mp4" />
|
958 |
+
Your browser does not support the video tag.
|
959 |
+
</video>
|
960 |
+
<div id="videoInfo">
|
961 |
+
<h3 id="videoTitle"></h3>
|
962 |
+
<p id="videoCategory"></p>
|
963 |
+
<p id="uploadTime"></p>
|
964 |
+
<div id="uploaderInfo">
|
965 |
+
<p>Uploaded by: <span id="uploaderName"></span></p>
|
966 |
+
<img
|
967 |
+
id="uploaderImage"
|
968 |
+
src=""
|
969 |
+
alt="Uploader Image"
|
970 |
+
class="uploader_image"
|
971 |
+
/>
|
972 |
+
</div>
|
973 |
+
</div>
|
974 |
+
</div>
|
975 |
+
</div>
|
976 |
+
|
977 |
+
<!-- نموذج رفع الفيديو -->
|
978 |
+
<div class="upload-form">
|
979 |
+
<!-- حقل البحث -->
|
980 |
+
<input type="text" id="searchInput" placeholder="ابحث عن الفيديوهات..." />
|
981 |
+
<br>
|
982 |
+
<br>
|
983 |
+
|
984 |
+
<!-- زر لعرض قوائم التشغيل العامة -->
|
985 |
+
<button id="showPlaylistsBtn">عرض القوائم العامة</button>
|
986 |
+
|
987 |
+
<!-- زر لعرض قوائم التشغيل الخاصة بالمستخدم الحالي -->
|
988 |
+
<!-- زر جديد لعرض قوائم التشغيل الخاصة بالمستخدم -->
|
989 |
+
<button id="showUserPlaylistsBtn">عرض قوائم التشغيل الخاصة بي</button>
|
990 |
+
|
991 |
+
<div class="loading_model" id="loading_upload_model" style="display: none;">
|
992 |
+
<div class="progress-circle" id="progress-circle">
|
993 |
+
<span id="progress-percentage">0%</span>
|
994 |
+
</div>
|
995 |
+
</div>
|
996 |
+
<h3>Upload a Video</h3>
|
997 |
+
<form id="upload-form" action="/videos" method="POST" enctype="multipart/form-data">
|
998 |
+
<label for="title">Video Title:</label>
|
999 |
+
<input type="text" name="title" id="title" required />
|
1000 |
+
<br /><br />
|
1001 |
+
<label for="video">Select Video:</label>
|
1002 |
+
<input type="file" name="video" id="video" required />
|
1003 |
+
<br /><br />
|
1004 |
+
<label for="thumbnail">Select Thumbnail (optional):</label>
|
1005 |
+
<input type="file" name="thumbnail" id="thumbnail" />
|
1006 |
+
<br /><br />
|
1007 |
+
<button type="submit">Upload</button>
|
1008 |
+
</form>
|
1009 |
+
|
1010 |
+
<!-- عرض الفيديوهات -->
|
1011 |
+
<p id="no-results-message" style="display: none;">لا توجد نتائج للبحث</p>
|
1012 |
+
<div id="video-container" class="video-container">
|
1013 |
+
|
1014 |
+
<!-- Skeleton Loading -->
|
1015 |
+
{% for _ in range(5) %}
|
1016 |
+
<div class="skeleton skeleton-card"></div>
|
1017 |
+
{% endfor %}
|
1018 |
+
</div>
|
1019 |
+
|
1020 |
+
<!-- رسالة عند عدم وجود فيديوهات -->
|
1021 |
+
<div id="empty-message" class="empty-message" style="display: none">
|
1022 |
+
No videos found.
|
1023 |
+
</div>
|
1024 |
+
|
1025 |
+
<!-- Modal لتعديل الفيديو -->
|
1026 |
+
<div id="editModal" class="modal custom-modal">
|
1027 |
+
<div class="modal-content custom-modal-content">
|
1028 |
+
<span class="close-edit custom-close">×</span>
|
1029 |
+
<h2 class="modal-title">تعديل عنوان الفيديو</h2>
|
1030 |
+
<input
|
1031 |
+
type="text"
|
1032 |
+
id="editTitle"
|
1033 |
+
class="modal-input"
|
1034 |
+
placeholder="العنوان الجديد"
|
1035 |
+
/>
|
1036 |
+
<button id="saveEdit" class="modal-button modal-button-save">
|
1037 |
+
حفظ
|
1038 |
+
</button>
|
1039 |
+
</div>
|
1040 |
+
</div>
|
1041 |
+
|
1042 |
+
<!-- Modal لتأكيد الحذف -->
|
1043 |
+
<div id="deleteModal" class="custom-modal">
|
1044 |
+
<div class="custom-modal-content-delete">
|
1045 |
+
<span class="close-delete custom-close">×</span>
|
1046 |
+
<h2 class="modal-title">هل أنت متأكد من حذف الفيديو؟</h2>
|
1047 |
+
<div class="modal-buttons">
|
1048 |
+
<button id="confirmDelete" class="modal-button modal-button-delete">
|
1049 |
+
نعم، احذف
|
1050 |
+
</button>
|
1051 |
+
<button id="cancelDelete" class="modal-button modal-button-cancel">
|
1052 |
+
إلغاء
|
1053 |
+
</button>
|
1054 |
+
</div>
|
1055 |
+
</div>
|
1056 |
+
</div>
|
1057 |
+
|
1058 |
+
<!-- Modal Message -->
|
1059 |
+
<!-- Modal Message -->
|
1060 |
+
<div id="model-message-success" class="modal-message">
|
1061 |
+
<div class="modal-content-main">
|
1062 |
+
<span class="close-message">×</span>
|
1063 |
+
<!-- أيقونة الصح مع الرسالة -->
|
1064 |
+
<div class="modal-icon">
|
1065 |
+
<i class="fas fa-check-circle success-icon"></i>
|
1066 |
+
</div>
|
1067 |
+
<p id="message-content"></p>
|
1068 |
+
</div>
|
1069 |
+
</div>
|
1070 |
+
|
1071 |
+
<!-- Modal لإضافة الفيديو إلى قائمة التشغيل -->
|
1072 |
+
<div id="playlistModal" class="modal">
|
1073 |
+
<div class="modal-content-playlist">
|
1074 |
+
<span class="close-playlist">×</span>
|
1075 |
+
<h2>إضافة إلى قائمة التشغيل</h2>
|
1076 |
+
|
1077 |
+
<!-- إنشاء قائمة تشغيل جديدة -->
|
1078 |
+
<div class="create-playlist">
|
1079 |
+
<input type="text" id="newPlaylistName" placeholder="اسم قائمة التشغيل الجديدة" />
|
1080 |
+
<select id="playlistVisibility">
|
1081 |
+
<option value="public">عامة</option>
|
1082 |
+
<option value="private">خاصة</option>
|
1083 |
+
</select>
|
1084 |
+
<button id="createPlaylist">إنشاء قائمة</button>
|
1085 |
+
</div>
|
1086 |
+
|
1087 |
+
<!-- قوائم التشغيل الحالية -->
|
1088 |
+
<div class="existing-playlists">
|
1089 |
+
<h3>قوائم التشغيل الحالية</h3>
|
1090 |
+
<ul id="playlistList"></ul>
|
1091 |
+
</div>
|
1092 |
+
</div>
|
1093 |
+
</div>
|
1094 |
+
|
1095 |
+
|
1096 |
+
|
1097 |
+
<!-- Modal لقوائم التشغيل -->
|
1098 |
+
<div id="playlistsModal" class="modal-unique">
|
1099 |
+
<div class="modal-content-unique">
|
1100 |
+
<h2>Playlists</h2>
|
1101 |
+
<button class="close-unique" onclick="closeModalUnique('playlistsModal')">×</button>
|
1102 |
+
|
1103 |
+
<!-- حقل البحث -->
|
1104 |
+
<input
|
1105 |
+
type="text"
|
1106 |
+
id="searchPlaylistsInput"
|
1107 |
+
placeholder="ابحث عن قائمة تشغيل..."
|
1108 |
+
style="width: 100%; margin-bottom: 10px; padding: 8px; border: 1px solid #ccc; border-radius: 5px;">
|
1109 |
+
<ul id="playlistsList"></ul>
|
1110 |
+
</div>
|
1111 |
+
</div>
|
1112 |
+
|
1113 |
+
<!-- Modal للفيديوهات -->
|
1114 |
+
<!-- نافذة الـ Modal الخاصة بالفيديوهات -->
|
1115 |
+
<div id="videosModal" class="modal-unique">
|
1116 |
+
|
1117 |
+
<div class="modal-content-unique">
|
1118 |
+
|
1119 |
+
<div id="videoPlayerContainer">
|
1120 |
+
<!-- محتوى الفيديو هنا -->
|
1121 |
+
|
1122 |
+
<video id="videoPlayer2" class="video-player-unique" controls></video>
|
1123 |
+
<button class="close-unique" onclick="closeModalUnique('videosModal')">×</button>
|
1124 |
+
|
1125 |
+
<div id="videoDetails" class="mt-3"></div>
|
1126 |
+
</div>
|
1127 |
+
|
1128 |
+
<div id="videosList" class="video-list-unique"></div>
|
1129 |
+
</div>
|
1130 |
+
</div>
|
1131 |
+
|
1132 |
+
|
1133 |
+
<script>
|
1134 |
+
document.addEventListener("DOMContentLoaded", function () {
|
1135 |
+
// جلب الفيديوهات باستخدام AJAX بعد تحميل الصفحة
|
1136 |
+
fetch("/get_videos")
|
1137 |
+
.then((response) => response.json())
|
1138 |
+
.then((data) => {
|
1139 |
+
console.log("Fetched videos data:", data); // تحقق من البيانات هنا
|
1140 |
+
const videoContainer = document.getElementById("video-container");
|
1141 |
+
const emptyMessage = document.getElementById("empty-message");
|
1142 |
+
const noResultsMessage = document.getElementById("no-results-message");
|
1143 |
+
|
1144 |
+
// إزالة السكلتون إذا كانت هناك فيديوهات
|
1145 |
+
if (data.length > 0) {
|
1146 |
+
videoContainer.innerHTML = ""; // مسح السكلتون
|
1147 |
+
data.forEach((video) => {
|
1148 |
+
console.log("Video data:", video); // تحقق من كل فيديو
|
1149 |
+
const videoCard = document.createElement("div");
|
1150 |
+
videoCard.classList.add("video-card");
|
1151 |
+
videoCard.innerHTML = `
|
1152 |
+
<img src="${video.thumbnail}" alt="Thumbnail">
|
1153 |
+
<h4>${video.uploader_name}</h4>
|
1154 |
+
<p><strong>Title:</strong> ${video.title}</p>
|
1155 |
+
<p><strong>Category:</strong> ${video.category}</p>
|
1156 |
+
<p>${video.upload_time}</p>
|
1157 |
+
<img class="uploader_image" src="${video.uploader_image}" alt="User Image" width="50">
|
1158 |
+
|
1159 |
+
<!-- الأزرار -->
|
1160 |
+
<div class="video-actions">
|
1161 |
+
${
|
1162 |
+
video.is_owner
|
1163 |
+
? `
|
1164 |
+
<button class="edit-video" data-video-id="${video.id}">تعديل</button>
|
1165 |
+
<button class="delete-video" data-video-id="${video.id}">حذف</button>
|
1166 |
+
`
|
1167 |
+
: ""
|
1168 |
+
}
|
1169 |
+
<button class="add-to-playlist" data-video-id="${video.id}">إضافة إلى قائمة التشغيل</button>
|
1170 |
+
</div>
|
1171 |
+
`;
|
1172 |
+
videoContainer.appendChild(videoCard);
|
1173 |
+
|
1174 |
+
// إضافة أحداث للأزرار
|
1175 |
+
if (video.is_owner) {
|
1176 |
+
const editButton = videoCard.querySelector(".edit-video");
|
1177 |
+
const deleteButton = videoCard.querySelector(".delete-video");
|
1178 |
+
|
1179 |
+
editButton.addEventListener("click", function (e) {
|
1180 |
+
e.stopPropagation(); // منع انتشار الحدث إلى الفيديو
|
1181 |
+
openEditModal(video);
|
1182 |
+
});
|
1183 |
+
|
1184 |
+
deleteButton.addEventListener("click", function (e) {
|
1185 |
+
e.stopPropagation(); // منع انتشار الحدث إلى الفيديو
|
1186 |
+
openDeleteModal(video);
|
1187 |
+
});
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
const addToPlaylistButton = videoCard.querySelector(".add-to-playlist");
|
1191 |
+
addToPlaylistButton.addEventListener("click", function (e) {
|
1192 |
+
e.stopPropagation(); // منع انتشار الحدث إلى الفيديو
|
1193 |
+
addToPlaylist(video); // فتح Modal قوائم التشغيل
|
1194 |
+
});
|
1195 |
+
|
1196 |
+
// إضافة حدث عند النقر على الفيديو لفتح الـ Modal
|
1197 |
+
videoCard.addEventListener("click", function () {
|
1198 |
+
openModal(video);
|
1199 |
+
});
|
1200 |
+
|
1201 |
+
// إضافة خصائص مميزة لكل فيديو
|
1202 |
+
videoCard.dataset.title = video.title.toLowerCase(); // حفظ العنوان داخل الـ dataset
|
1203 |
+
videoCard.dataset.category = video.category.toLowerCase(); // حفظ الفئة داخل الـ dataset
|
1204 |
+
});
|
1205 |
+
|
1206 |
+
// إضافة حدث البحث على النص المدخل
|
1207 |
+
const searchInput = document.getElementById("searchInput");
|
1208 |
+
searchInput.addEventListener("input", function () {
|
1209 |
+
const searchTerm = searchInput.value.trim().toLowerCase(); // النص المدخل
|
1210 |
+
let resultsFound = false; // متغير لتتبع ما إذا كانت هناك نتائج أم لا
|
1211 |
+
|
1212 |
+
// إخفاء الفيديوهات التي لا تتطابق مع النص المدخل
|
1213 |
+
const videoCards = videoContainer.querySelectorAll(".video-card");
|
1214 |
+
videoCards.forEach((videoCard) => {
|
1215 |
+
const title = videoCard.dataset.title; // الحصول على العنوان المخزن
|
1216 |
+
const category = videoCard.dataset.category; // الحصول على الفئة المخزنة
|
1217 |
+
|
1218 |
+
// إذا كان هناك تطابق مع النص المدخل، إظهار الفيديو
|
1219 |
+
if (title.includes(searchTerm) || category.includes(searchTerm)) {
|
1220 |
+
videoCard.style.display = "block"; // إظهار الفيديو إذا كان متوافقًا مع البحث
|
1221 |
+
resultsFound = true; // هناك نتائج
|
1222 |
+
} else {
|
1223 |
+
videoCard.style.display = "none"; // إخفاء الفيديو إذا لم يتوافق مع البحث
|
1224 |
+
}
|
1225 |
+
});
|
1226 |
+
|
1227 |
+
// إظهار أو إخفاء رسالة "لا توجد نتائج"
|
1228 |
+
if (resultsFound) {
|
1229 |
+
noResultsMessage.style.display = "none"; // إخفاء الرسالة إذا كانت هناك نتائج
|
1230 |
+
} else {
|
1231 |
+
noResultsMessage.style.display = "block"; // إظهار الرسالة إذا لم توجد نتائج
|
1232 |
+
}
|
1233 |
+
});
|
1234 |
+
} else {
|
1235 |
+
// إذا لم توجد فيديوهات، إظهار رسالة فارغة
|
1236 |
+
setTimeout(() => {
|
1237 |
+
videoContainer.innerHTML = ""; // مسح السكلتون
|
1238 |
+
emptyMessage.style.display = "block"; // عرض الرسالة
|
1239 |
+
}, 1000); // تأخير 1 ثانية
|
1240 |
+
}
|
1241 |
+
})
|
1242 |
+
.catch((error) => {
|
1243 |
+
console.error("Error fetching videos:", error);
|
1244 |
+
const videoContainer = document.getElementById("video-container");
|
1245 |
+
videoContainer.innerHTML = ""; // مسح السكلتون في حالة حدوث خطأ
|
1246 |
+
const emptyMessage = document.getElementById("empty-message");
|
1247 |
+
emptyMessage.textContent =
|
1248 |
+
"Failed to load videos. Please try again later.";
|
1249 |
+
emptyMessage.style.display = "block";
|
1250 |
+
});
|
1251 |
+
});
|
1252 |
+
|
1253 |
+
|
1254 |
+
// وظيفة البحث داخل قوائم التشغيل
|
1255 |
+
document.getElementById('searchPlaylistsInput').addEventListener('input', function() {
|
1256 |
+
const searchTerm = this.value.toLowerCase();
|
1257 |
+
const items = document.querySelectorAll('.playlist-item-unique');
|
1258 |
+
|
1259 |
+
items.forEach(item => {
|
1260 |
+
const playlistName = item.textContent.toLowerCase();
|
1261 |
+
if (playlistName.includes(searchTerm)) {
|
1262 |
+
item.style.display = 'list-item';
|
1263 |
+
} else {
|
1264 |
+
item.style.display = 'none';
|
1265 |
+
}
|
1266 |
+
});
|
1267 |
+
});
|
1268 |
+
|
1269 |
+
// دالة لفتح الـ Modal عند النقر على الفيديو
|
1270 |
+
function openModal(video) {
|
1271 |
+
const modal = document.getElementById("videoModal");
|
1272 |
+
const videoPlayer = document.getElementById("videoPlayer");
|
1273 |
+
const videoTitle = document.getElementById("videoTitle");
|
1274 |
+
const videoCategory = document.getElementById("videoCategory");
|
1275 |
+
const uploadTime = document.getElementById("uploadTime");
|
1276 |
+
const uploaderName = document.getElementById("uploaderName");
|
1277 |
+
const uploaderImage = document.getElementById("uploaderImage");
|
1278 |
+
const videoSource = document.getElementById("videoSource");
|
1279 |
+
|
1280 |
+
// عرض الـ Modal مع أنيميشن
|
1281 |
+
modal.style.display = "block";
|
1282 |
+
modal.classList.remove("close-animation"); // إزالة التأثير عند الإغلاق
|
1283 |
+
|
1284 |
+
// تحديث البيانات فقط بعد عرض المودال
|
1285 |
+
setTimeout(() => {
|
1286 |
+
// تحديث مصدر الفيديو بشكل غير متزامن
|
1287 |
+
videoSource.src = video.video_path;
|
1288 |
+
videoPlayer.load(); // إعادة تحميل الفيديو (يبدأ التحميل)
|
1289 |
+
|
1290 |
+
// تحديث النصوص التفصيلية
|
1291 |
+
videoTitle.textContent = video.title;
|
1292 |
+
videoCategory.textContent = `Category: ${video.category}`;
|
1293 |
+
uploadTime.textContent = `Uploaded on: ${video.upload_time}`;
|
1294 |
+
uploaderName.textContent = video.uploader_name;
|
1295 |
+
uploaderImage.src = video.uploader_image;
|
1296 |
+
}, 50); // إضافة تأخير بسيط لكي يظهر المودال بسرعة قبل تحميل الفيديو
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
// غلق الـ Modal عند النقر على زر الإغلاق
|
1300 |
+
document.querySelector(".close").addEventListener("click", function () {
|
1301 |
+
const modal = document.getElementById("videoModal");
|
1302 |
+
modal.classList.add("close-animation"); // إضافة التأثير عند الإغلاق
|
1303 |
+
|
1304 |
+
const videoSource = document.getElementById("videoSource");
|
1305 |
+
const videoPlayer = document.getElementById("videoPlayer");
|
1306 |
+
|
1307 |
+
// إزالة مصدر الفيديو لعدم تحميله في الخلفية
|
1308 |
+
videoSource.src = "";
|
1309 |
+
videoPlayer.load(); // إيقاف تحميل الفيديو
|
1310 |
+
|
1311 |
+
// تأخير إخفاء المودال حتى تنتهي الأنيميشن
|
1312 |
+
setTimeout(() => {
|
1313 |
+
modal.style.display = "none";
|
1314 |
+
}, 200); // تأخير يتناسب مع مدة الأنيميشن (0.3 ثانية)
|
1315 |
+
});
|
1316 |
+
|
1317 |
+
function showMessage(message, isSuccess) {
|
1318 |
+
const modal = document.getElementById("model-message-success");
|
1319 |
+
const messageContent = document.getElementById("message-content");
|
1320 |
+
const closeButton = document.querySelector(".close-message");
|
1321 |
+
const successIcon = document.querySelector(".success-icon");
|
1322 |
+
|
1323 |
+
// تغيير محتوى الرسالة بناءً على النجاح أو الفشل
|
1324 |
+
messageContent.textContent = message;
|
1325 |
+
|
1326 |
+
// تغيير الأيقونة بناءً على النجاح أو الفشل
|
1327 |
+
if (isSuccess) {
|
1328 |
+
successIcon.classList.remove("fa-times-circle");
|
1329 |
+
successIcon.classList.add("fa-check-circle");
|
1330 |
+
successIcon.style.color = "#4CAF50"; // الأخضر للنجاح
|
1331 |
+
} else {
|
1332 |
+
successIcon.classList.remove("fa-check-circle");
|
1333 |
+
successIcon.classList.add("fa-times-circle");
|
1334 |
+
successIcon.style.color = "#F44336"; // الأحمر للفشل
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
// إظهار المودال
|
1338 |
+
modal.style.display = "flex";
|
1339 |
+
|
1340 |
+
// إغلاق المودال عند الضغط على زر الإغلاق
|
1341 |
+
closeButton.onclick = function () {
|
1342 |
+
modal.style.display = "none";
|
1343 |
+
};
|
1344 |
+
|
1345 |
+
// إغلاق المودال بعد 3 ثواني
|
1346 |
+
setTimeout(function () {
|
1347 |
+
modal.style.display = "none";
|
1348 |
+
}, 1000);
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
// دالة لفتح Modal التعديل
|
1352 |
+
function openEditModal(video) {
|
1353 |
+
const editModal = document.getElementById("editModal");
|
1354 |
+
const editTitleInput = document.getElementById("editTitle");
|
1355 |
+
editTitleInput.value = video.title; // تعبئة العنوان الحالي
|
1356 |
+
editModal.style.display = "block";
|
1357 |
+
|
1358 |
+
// إغلاق Modal التعديل عند النقر على زر الإغلاق
|
1359 |
+
const closeEditButton = document.querySelector(".close-edit");
|
1360 |
+
closeEditButton.addEventListener("click", function () {
|
1361 |
+
editModal.style.display = "none";
|
1362 |
+
});
|
1363 |
+
|
1364 |
+
// حفظ التعديلات
|
1365 |
+
const saveEditButton = document.getElementById("saveEdit");
|
1366 |
+
saveEditButton.onclick = function () {
|
1367 |
+
const newTitle = editTitleInput.value;
|
1368 |
+
if (newTitle) {
|
1369 |
+
fetch(`/edit_video/${video.id}`, {
|
1370 |
+
method: "POST",
|
1371 |
+
headers: {
|
1372 |
+
"Content-Type": "application/json",
|
1373 |
+
},
|
1374 |
+
body: JSON.stringify({ title: newTitle }),
|
1375 |
+
})
|
1376 |
+
.then((response) => response.json())
|
1377 |
+
.then((data) => {
|
1378 |
+
if (data.success) {
|
1379 |
+
showMessage("تم تعديل العنوان بنجاح", true); // عرض رسالة النجاح
|
1380 |
+
editModal.style.display = "none";
|
1381 |
+
location.reload(); // إعادة تحميل الصفحة لتحديث البيانات
|
1382 |
+
} else {
|
1383 |
+
showMessage("حدث خطأ أثناء تعديل العنوان", false); // عرض رسالة الفشل
|
1384 |
+
}
|
1385 |
+
});
|
1386 |
+
}
|
1387 |
+
};
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
// دالة لفتح Modal الحذف
|
1391 |
+
function openDeleteModal(video) {
|
1392 |
+
const deleteModal = document.getElementById("deleteModal");
|
1393 |
+
deleteModal.style.display = "block";
|
1394 |
+
|
1395 |
+
// إغلاق Modal الحذف عند النقر على زر الإغلاق
|
1396 |
+
const closeDeleteButton = document.querySelector(".close-delete");
|
1397 |
+
closeDeleteButton.addEventListener("click", function () {
|
1398 |
+
deleteModal.style.display = "none";
|
1399 |
+
});
|
1400 |
+
|
1401 |
+
// تأكيد الحذف
|
1402 |
+
const confirmDeleteButton = document.getElementById("confirmDelete");
|
1403 |
+
confirmDeleteButton.onclick = function () {
|
1404 |
+
fetch(`/delete_video/${video.id}`, {
|
1405 |
+
method: "DELETE",
|
1406 |
+
})
|
1407 |
+
.then((response) => response.json())
|
1408 |
+
.then((data) => {
|
1409 |
+
if (data.success) {
|
1410 |
+
showMessage("تم الحذف بنجاح", true); // عرض رسالة النجاح
|
1411 |
+
deleteModal.style.display = "none";
|
1412 |
+
location.reload(); // إعادة تحميل الصفحة لتحديث البيانات
|
1413 |
+
}
|
1414 |
+
});
|
1415 |
+
};
|
1416 |
+
|
1417 |
+
// إلغاء الحذف
|
1418 |
+
const cancelDeleteButton = document.getElementById("cancelDelete");
|
1419 |
+
cancelDeleteButton.onclick = function () {
|
1420 |
+
deleteModal.style.display = "none";
|
1421 |
+
};
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
|
1425 |
+
|
1426 |
+
|
1427 |
+
// دالة لفتح Modal قوائم التشغيل
|
1428 |
+
// دالة لفتح Modal قوائم التشغيل
|
1429 |
+
function openPlaylistModal(video) {
|
1430 |
+
const modal = document.getElementById("playlistModal");
|
1431 |
+
modal.style.display = "block";
|
1432 |
+
|
1433 |
+
// إغلاق Modal عند النقر على زر الإغلاق
|
1434 |
+
const closeButton = document.querySelector(".close-playlist");
|
1435 |
+
closeButton.onclick = function () {
|
1436 |
+
modal.style.display = "none";
|
1437 |
+
};
|
1438 |
+
|
1439 |
+
// دالة لتحديث قوائم التشغيل في الواجهة
|
1440 |
+
function updatePlaylists() {
|
1441 |
+
fetch(`/get_playlists_with_video_status/${video.id}`)
|
1442 |
+
.then((response) => response.json())
|
1443 |
+
.then((data) => {
|
1444 |
+
const playlistList = document.getElementById("playlistList");
|
1445 |
+
playlistList.innerHTML = ""; // مسح القوائم القديمة
|
1446 |
+
|
1447 |
+
data.forEach((playlist) => {
|
1448 |
+
const listItem = document.createElement("li");
|
1449 |
+
listItem.innerHTML = `
|
1450 |
+
<label>
|
1451 |
+
<input type="checkbox" class="playlist-checkbox"
|
1452 |
+
data-playlist-id="${playlist.id}"
|
1453 |
+
${playlist.video_exists ? "checked" : ""}>
|
1454 |
+
${playlist.name} (${playlist.is_public ? "عامة" : "خاصة"})
|
1455 |
+
</label>
|
1456 |
+
<button class="delete-playlist" data-playlist-id="${playlist.id}">حذف</button>
|
1457 |
+
`;
|
1458 |
+
playlistList.appendChild(listItem);
|
1459 |
+
|
1460 |
+
// إضافة حدث تغيير الـ Checkbox
|
1461 |
+
const checkbox = listItem.querySelector(".playlist-checkbox");
|
1462 |
+
checkbox.addEventListener("change", function (e) {
|
1463 |
+
const playlistId = checkbox.getAttribute("data-playlist-id");
|
1464 |
+
const isChecked = checkbox.checked;
|
1465 |
+
|
1466 |
+
if (isChecked) {
|
1467 |
+
// إضافة الفيديو إلى القائمة
|
1468 |
+
fetch(`/add_video_to_playlist/${playlistId}/${video.id}`, {
|
1469 |
+
method: "POST",
|
1470 |
+
})
|
1471 |
+
.then((response) => response.json())
|
1472 |
+
.then((data) => {
|
1473 |
+
if (data.success) {
|
1474 |
+
console.log(`تمت إضافة الفيديو إلى القائمة ${playlistId}`);
|
1475 |
+
}
|
1476 |
+
});
|
1477 |
+
} else {
|
1478 |
+
// إزالة الفيديو من القائمة
|
1479 |
+
fetch(`/remove_video_from_playlist/${playlistId}/${video.id}`, {
|
1480 |
+
method: "DELETE",
|
1481 |
+
})
|
1482 |
+
.then((response) => response.json())
|
1483 |
+
.then((data) => {
|
1484 |
+
if (data.success) {
|
1485 |
+
console.log(`تمت إزالة الفيديو من القائمة ${playlistId}`);
|
1486 |
+
}
|
1487 |
+
});
|
1488 |
+
}
|
1489 |
+
});
|
1490 |
+
|
1491 |
+
// إضافة حدث حذف قائمة التشغيل
|
1492 |
+
const deleteButton = listItem.querySelector(".delete-playlist");
|
1493 |
+
deleteButton.addEventListener("click", function (e) {
|
1494 |
+
e.stopPropagation(); // منع انتشار الحدث
|
1495 |
+
const playlistId = deleteButton.getAttribute("data-playlist-id");
|
1496 |
+
deletePlaylist(playlistId, video); // تمرير video كمعامل
|
1497 |
+
});
|
1498 |
+
});
|
1499 |
+
});
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
// تحديث قوائم التشغيل عند فتح الـ Modal
|
1503 |
+
updatePlaylists();
|
1504 |
+
|
1505 |
+
// إنشاء قائمة تشغيل جديدة
|
1506 |
+
const createPlaylistButton = document.getElementById("createPlaylist");
|
1507 |
+
createPlaylistButton.onclick = function () {
|
1508 |
+
const newPlaylistName = document.getElementById("newPlaylistName").value;
|
1509 |
+
const isPublic = document.getElementById("playlistVisibility").value === "public";
|
1510 |
+
|
1511 |
+
if (newPlaylistName) {
|
1512 |
+
fetch("/create_playlist", {
|
1513 |
+
method: "POST",
|
1514 |
+
headers: {
|
1515 |
+
"Content-Type": "application/json",
|
1516 |
+
},
|
1517 |
+
body: JSON.stringify({
|
1518 |
+
name: newPlaylistName,
|
1519 |
+
is_public: isPublic,
|
1520 |
+
}),
|
1521 |
+
})
|
1522 |
+
.then((response) => response.json())
|
1523 |
+
.then((data) => {
|
1524 |
+
if (data.success) {
|
1525 |
+
updatePlaylists(); // تحديث قوائم التشغيل بعد الإنشاء
|
1526 |
+
}
|
1527 |
+
});
|
1528 |
+
}
|
1529 |
+
};
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
// دالة لحذف قائمة التشغيل
|
1533 |
+
function deletePlaylist(playlistId, video) {
|
1534 |
+
if (confirm("هل أنت متأكد من حذف هذه القائ��ة؟")) {
|
1535 |
+
fetch(`/delete_playlist/${playlistId}`, {
|
1536 |
+
method: "DELETE",
|
1537 |
+
})
|
1538 |
+
.then((response) => response.json())
|
1539 |
+
.then((data) => {
|
1540 |
+
if (data.success) {
|
1541 |
+
// alert("تم حذف القائمة بنجاح");
|
1542 |
+
openPlaylistModal(video); // إعادة تحميل قوائم التشغيل بعد الحذف
|
1543 |
+
} else {
|
1544 |
+
alert("حدث خطأ أثناء حذف القائمة");
|
1545 |
+
}
|
1546 |
+
});
|
1547 |
+
}
|
1548 |
+
}
|
1549 |
+
// دالة لإضافة الفيديو إلى قائمة التشغيل
|
1550 |
+
function addToPlaylist(video) {
|
1551 |
+
openPlaylistModal(video); // فتح Modal قوائم التشغيل
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
|
1555 |
+
|
1556 |
+
// وظيفة لفتح النماذج
|
1557 |
+
function openModalUnique(modalId) {
|
1558 |
+
const modal = document.getElementById(modalId);
|
1559 |
+
if (modal) {
|
1560 |
+
modal.style.display = 'flex';
|
1561 |
+
let videoPlayer2 =document.getElementById("videoPlayer2").style.display = "flex"
|
1562 |
+
|
1563 |
+
}
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
// وظيفة لإغلاق النماذج
|
1567 |
+
function closeModalUnique(modalId) {
|
1568 |
+
const modal = document.getElementById(modalId);
|
1569 |
+
if (modal) {
|
1570 |
+
modal.style.display = 'none';
|
1571 |
+
let videoPlayer2 = document.getElementById("videoPlayer2").load();;
|
1572 |
+
|
1573 |
+
}
|
1574 |
+
}
|
1575 |
+
// جلب قوائم التشغيل وعرضها
|
1576 |
+
document.getElementById('showPlaylistsBtn').addEventListener('click', async () => {
|
1577 |
+
try {
|
1578 |
+
const response = await fetch('/get_playlists');
|
1579 |
+
if (!response.ok) {
|
1580 |
+
throw new Error(`فشل تحميل قوائم التشغيل: ${response.statusText}`);
|
1581 |
+
}
|
1582 |
+
|
1583 |
+
const playlists = await response.json();
|
1584 |
+
const playlistsList = document.getElementById('playlistsList');
|
1585 |
+
if (playlists.length === 0) {
|
1586 |
+
playlistsList.innerHTML = '<li>No playlists available</li>';
|
1587 |
+
} else {
|
1588 |
+
playlistsList.innerHTML = playlists.map(playlist => `
|
1589 |
+
<li class="playlist-item-unique" data-playlist-id="${playlist.id}">
|
1590 |
+
${playlist.name}
|
1591 |
+
</li>
|
1592 |
+
`).join('');
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
openModalUnique('playlistsModal'); // فتح Modal قوائم التشغيل
|
1596 |
+
|
1597 |
+
// إضافة حدث النقر على عنصر قائمة التشغيل
|
1598 |
+
document.querySelectorAll('.playlist-item-unique').forEach(item => {
|
1599 |
+
item.addEventListener('click', async () => {
|
1600 |
+
const playlistId = item.getAttribute('data-playlist-id');
|
1601 |
+
try {
|
1602 |
+
const response = await fetch(`/get_playlist_videos/${playlistId}`);
|
1603 |
+
if (!response.ok) {
|
1604 |
+
throw new Error(`فشل تحميل الفيديوهات لقائمة التشغيل: ${response.statusText}`);
|
1605 |
+
}
|
1606 |
+
|
1607 |
+
const videos = await response.json();
|
1608 |
+
const videosList = document.getElementById('videosList');
|
1609 |
+
if (videos.length === 0) {
|
1610 |
+
const videoPlayer2 = document.getElementById("videoPlayer2").style.display = "none"
|
1611 |
+
const videoDetails = document.getElementById("videoDetails")
|
1612 |
+
videoDetails.innerHTML = '<div>No videos available</div>';
|
1613 |
+
} else {
|
1614 |
+
let videoPlayer2 = document.getElementById('videoPlayer2')
|
1615 |
+
videoPlayer2.style.display = "flex"
|
1616 |
+
videosList.innerHTML = videos.map(video => `
|
1617 |
+
<div class="video-item-unique" data-video-id="${video.id}">
|
1618 |
+
<img src="${video.thumbnail_path}" alt="${video.title}">
|
1619 |
+
<div>
|
1620 |
+
<h6>${video.title}</h6>
|
1621 |
+
<small>${video.uploader_name}</small>
|
1622 |
+
<!-- زر حذف الفيديو يظهر فقط إذا كان المستخدم هو المالك -->
|
1623 |
+
${video.is_owner ? `<button class="delete-video-btn" data-video-id="${video.id}" data-playlist-id="${playlistId}">حذف</button>` : ''}
|
1624 |
+
</div>
|
1625 |
+
</div>
|
1626 |
+
`).join('');
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
openModalUnique('videosModal'); // فتح الـ Modal الخاص بالفيديوهات
|
1630 |
+
} catch (error) {
|
1631 |
+
console.error(error.message);
|
1632 |
+
}
|
1633 |
+
});
|
1634 |
+
});
|
1635 |
+
} catch (error) {
|
1636 |
+
console.error(error.message);
|
1637 |
+
}
|
1638 |
+
});
|
1639 |
+
|
1640 |
+
|
1641 |
+
|
1642 |
+
// جلب قوائم التشغيل الخاصة بالمستخدم الحالي وعرضها
|
1643 |
+
document.getElementById('showUserPlaylistsBtn').addEventListener('click', async () => {
|
1644 |
+
try {
|
1645 |
+
const response = await fetch('/get_user_playlists');
|
1646 |
+
if (!response.ok) {
|
1647 |
+
throw new Error(`فشل تحميل قوائم التشغيل الخاصة بالمستخدم: ${response.statusText}`);
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
const userPlaylists = await response.json();
|
1651 |
+
const playlistsList = document.getElementById('playlistsList');
|
1652 |
+
if (userPlaylists.length === 0) {
|
1653 |
+
playlistsList.innerHTML = '<li>لا توجد قوائم تشغيل خاصة بك</li>';
|
1654 |
+
} else {
|
1655 |
+
playlistsList.innerHTML = userPlaylists.map(playlist => `
|
1656 |
+
<li class="playlist-item-unique" data-playlist-id="${playlist.id}">
|
1657 |
+
${playlist.name}
|
1658 |
+
</li>
|
1659 |
+
`).join('');
|
1660 |
+
}
|
1661 |
+
|
1662 |
+
openModalUnique('playlistsModal'); // فتح Modal قوائم التشغيل
|
1663 |
+
|
1664 |
+
// إضافة حدث النقر على عنصر قائمة التشغيل
|
1665 |
+
document.querySelectorAll('.playlist-item-unique').forEach(item => {
|
1666 |
+
item.addEventListener('click', async () => {
|
1667 |
+
const playlistId = item.getAttribute('data-playlist-id');
|
1668 |
+
try {
|
1669 |
+
const response = await fetch(`/get_playlist_videos/${playlistId}`);
|
1670 |
+
if (!response.ok) {
|
1671 |
+
throw new Error(`فشل تحميل الفيديوهات لقائمة التشغيل: ${response.statusText}`);
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
const videos = await response.json();
|
1675 |
+
const videosList = document.getElementById('videosList');
|
1676 |
+
if (videos.length === 0) {
|
1677 |
+
const videoPlayer2 = document.getElementById("videoPlayer2").style.display = "none"
|
1678 |
+
const videoDetails = document.getElementById("videoDetails")
|
1679 |
+
videoDetails.innerHTML = '<div>No videos available</div>';
|
1680 |
+
} else {
|
1681 |
+
let videoPlayer2 = document.getElementById('videoPlayer2')
|
1682 |
+
videoPlayer2.style.display = "flex"
|
1683 |
+
videosList.innerHTML = videos.map(video => `
|
1684 |
+
<div class="video-item-unique" data-video-id="${video.id}">
|
1685 |
+
<img src="${video.thumbnail_path}" alt="${video.title}">
|
1686 |
+
<div>
|
1687 |
+
<h6>${video.title}</h6>
|
1688 |
+
<small>${video.uploader_name}</small>
|
1689 |
+
<!-- زر حذف الفيديو يظهر فقط إذا كان المستخدم هو المالك -->
|
1690 |
+
${video.is_owner ? `<button class="delete-video-btn" data-video-id="${video.id}" data-playlist-id="${playlistId}">حذف</button>` : ''}
|
1691 |
+
</div>
|
1692 |
+
</div>
|
1693 |
+
`).join('');
|
1694 |
+
}
|
1695 |
+
|
1696 |
+
openModalUnique('videosModal'); // فتح الـ Modal الخاص بالفيديوهات
|
1697 |
+
|
1698 |
+
|
1699 |
+
// إضافة حدث النقر على زر حذف الفيديو
|
1700 |
+
document.querySelectorAll('.delete-video-btn').forEach(deleteBtn => {
|
1701 |
+
deleteBtn.addEventListener('click', async (e) => {
|
1702 |
+
const videoId = deleteBtn.getAttribute('data-video-id');
|
1703 |
+
const playlistId = deleteBtn.getAttribute('data-playlist-id');
|
1704 |
+
|
1705 |
+
try {
|
1706 |
+
// إرسال طلب الحذف إلى الخادم
|
1707 |
+
const response = await fetch('/delete_video_from_playlist', {
|
1708 |
+
method: 'POST',
|
1709 |
+
headers: {
|
1710 |
+
'Content-Type': 'application/json'
|
1711 |
+
},
|
1712 |
+
body: JSON.stringify({
|
1713 |
+
video_id: videoId,
|
1714 |
+
playlist_id: playlistId
|
1715 |
+
})
|
1716 |
+
});
|
1717 |
+
|
1718 |
+
if (!response.ok) {
|
1719 |
+
throw new Error("فشل حذف الفيديو من قائمة التشغيل");
|
1720 |
+
}
|
1721 |
+
|
1722 |
+
// تحديد قائمة الفيديوهات والفهرس الحالي
|
1723 |
+
const videoItem = deleteBtn.closest('.video-item-unique');
|
1724 |
+
const videos = Array.from(document.querySelectorAll('.video-item-unique')); // تحويل القائمة إلى مصفوفة
|
1725 |
+
const currentVideoIndex = videos.findIndex(item => item.classList.contains('active')); // العثور على الفهرس الحالي
|
1726 |
+
|
1727 |
+
// حذف الفيديو من الواجهة
|
1728 |
+
videoItem.remove();
|
1729 |
+
|
1730 |
+
showMessage("تم الحذف الفديو من قائمة التشغيل", true); // عرض رسالة النجاح
|
1731 |
+
|
1732 |
+
// تحديث قائمة الفيديوهات المتبقية
|
1733 |
+
const remainingVideos = document.querySelectorAll('.video-item-unique');
|
1734 |
+
const videoPlayer2 = document.getElementById('videoPlayer2');
|
1735 |
+
|
1736 |
+
if (remainingVideos.length === 0) {
|
1737 |
+
// إذا لم يتبقَ أي فيديوهات
|
1738 |
+
videoPlayer2.src = ''; // إيقاف الفيديو
|
1739 |
+
videoPlayer2.style.display = "none"
|
1740 |
+
let videoDetails = document.getElementById("videoDetails").innerHTML = "<div>No videos available</div>"
|
1741 |
+
} else {
|
1742 |
+
// إذا كانت هناك فيديوهات
|
1743 |
+
if (currentVideoIndex > 0) {
|
1744 |
+
// تشغيل الفيديو السابق إذا كان موجودًا
|
1745 |
+
const previousVideoItem = videos[currentVideoIndex - 1];
|
1746 |
+
previousVideoItem.click();
|
1747 |
+
} else if (currentVideoIndex === 0 && videos.length > 1) {
|
1748 |
+
// إذا كان الفيديو الأول قد تم حذفه وكان هناك فيديوهات أخرى
|
1749 |
+
const nextVideoItem = videos[1];
|
1750 |
+
nextVideoItem.click();
|
1751 |
+
} else {
|
1752 |
+
// إذا لم يكن هناك فيديو نشط، تشغيل أول فيديو متبقٍ
|
1753 |
+
const firstRemainingVideo = remainingVideos[0];
|
1754 |
+
firstRemainingVideo.click();
|
1755 |
+
}
|
1756 |
+
}
|
1757 |
+
} catch (error) {
|
1758 |
+
console.error(error);
|
1759 |
+
alert("حدث خطأ أثناء حذف الفيديو");
|
1760 |
+
}
|
1761 |
+
});
|
1762 |
+
});
|
1763 |
+
|
1764 |
+
|
1765 |
+
|
1766 |
+
// تشغيل أول فيديو بعد تحميل الفيديوهات مباشرة
|
1767 |
+
setTimeout(() => {
|
1768 |
+
const firstVideoItem = document.querySelector('.video-item-unique');
|
1769 |
+
if (firstVideoItem) {
|
1770 |
+
firstVideoItem.click(); // نقوم بمحاكاة الضغط على أول فيديو
|
1771 |
+
}
|
1772 |
+
}, 100); // تأخير بسيط لانتظار تحميل المحتويات
|
1773 |
+
|
1774 |
+
let currentVideoIndex = 0; // متغير لتتبع الفيديو الحالي
|
1775 |
+
|
1776 |
+
// إضافة حدث النقر على عنصر الفيديو
|
1777 |
+
document.querySelectorAll('.video-item-unique').forEach((videoItem, index) => {
|
1778 |
+
videoItem.addEventListener('click', async () => {
|
1779 |
+
// إزالة الفئة active من جميع العناصر
|
1780 |
+
document.querySelectorAll('.video-item-unique').forEach(item => {
|
1781 |
+
item.classList.remove('active');
|
1782 |
+
});
|
1783 |
+
|
1784 |
+
// إضافة الفئة active للفيديو الذي يتم النقر عليه
|
1785 |
+
videoItem.classList.add('active');
|
1786 |
+
|
1787 |
+
const videoId = videoItem.getAttribute('data-video-id');
|
1788 |
+
try {
|
1789 |
+
const response = await fetch(`/get_video/${videoId}`);
|
1790 |
+
if (!response.ok) {
|
1791 |
+
throw new Error(`فشل تحميل الفيديو: ${response.statusText}`);
|
1792 |
+
}
|
1793 |
+
|
1794 |
+
const video = await response.json();
|
1795 |
+
const videoPlayer2 = document.getElementById('videoPlayer2');
|
1796 |
+
videoPlayer2.src = video.video_path;
|
1797 |
+
videoPlayer2.play();
|
1798 |
+
|
1799 |
+
const videoDetails = document.getElementById('videoDetails');
|
1800 |
+
videoDetails.innerHTML = `
|
1801 |
+
<h4>${video.title}</h4>
|
1802 |
+
<p>Uploaded by: ${video.uploader_name}</p>
|
1803 |
+
<p>Uploaded on: ${video.upload_time}</p>
|
1804 |
+
<img src="static/${video.uploader_image}" alt="${video.uploader_name}" width="50">
|
1805 |
+
`;
|
1806 |
+
|
1807 |
+
currentVideoIndex = index; // تحديث الفهرس عند النقر على الفيديو
|
1808 |
+
} catch (error) {
|
1809 |
+
console.error("Error fetching video:", error);
|
1810 |
+
alert("حدث خطأ أثناء تحميل الفيديو.");
|
1811 |
+
}
|
1812 |
+
});
|
1813 |
+
});
|
1814 |
+
|
1815 |
+
// إضافة حدث عند انتهاء الفيديو لتشغيل الفيديو التالي
|
1816 |
+
const videoPlayer2 = document.getElementById('videoPlayer2');
|
1817 |
+
videoPlayer2.addEventListener('ended', () => {
|
1818 |
+
if (currentVideoIndex < videos.length - 1) {
|
1819 |
+
const nextVideoItem = document.querySelectorAll('.video-item-unique')[currentVideoIndex + 1];
|
1820 |
+
nextVideoItem.click(); // نقوم بمحاكاة الضغط على الفيديو التالي
|
1821 |
+
}
|
1822 |
+
});
|
1823 |
+
|
1824 |
+
} catch (error) {
|
1825 |
+
console.error("Error fetching playlist videos:", error);
|
1826 |
+
alert("حدث خطأ أثناء تحميل الفيديوهات لقائمة التشغيل.");
|
1827 |
+
}
|
1828 |
+
});
|
1829 |
+
});
|
1830 |
+
|
1831 |
+
} catch (error) {
|
1832 |
+
console.error("Error fetching playlists:", error);
|
1833 |
+
alert("حدث خطأ أثناء تحميل قوائم التشغيل.");
|
1834 |
+
}
|
1835 |
+
});
|
1836 |
+
|
1837 |
+
|
1838 |
+
|
1839 |
+
|
1840 |
+
|
1841 |
+
|
1842 |
+
|
1843 |
+
const uploadForm = document.getElementById('upload-form');
|
1844 |
+
|
1845 |
+
|
1846 |
+
uploadForm.addEventListener('submit', function (e) {
|
1847 |
+
// e.preventDefault(); // منع الإرسال التلقائي للنموذج
|
1848 |
+
let animation = document.querySelector(".main-anmi-loading").style.display = "grid"
|
1849 |
+
})
|
1850 |
+
|
1851 |
+
|
1852 |
+
|
1853 |
+
</script>
|
1854 |
+
</body>
|
1855 |
+
</html>
|