Spaces:
Running
Running
Update index.html
Browse files- index.html +61 -62
index.html
CHANGED
|
@@ -27,7 +27,9 @@
|
|
| 27 |
</script>
|
| 28 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 29 |
<style>
|
| 30 |
-
body { font-family: 'Inter', sans-serif; background-color: #0f0f0f; color: #f1f1f1; overflow: hidden; }
|
|
|
|
|
|
|
| 31 |
.custom-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
|
| 32 |
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
|
| 33 |
.custom-scroll::-webkit-scrollbar-thumb { background: #71717a; border-radius: 10px; border: 2px solid #0f0f0f; }
|
|
@@ -73,8 +75,28 @@
|
|
| 73 |
.flex-item-min-width { min-width: 0; }
|
| 74 |
.mention { color: #60a5fa; cursor: pointer; font-weight: 500; }
|
| 75 |
.mention:hover { text-decoration: underline; }
|
|
|
|
| 76 |
.close-mobile-fullscreen { position: absolute; top: 10px; right: 10px; z-index: 10000; color: white; background: rgba(0,0,0,0.6); border-radius: 50%; width: 36px; height: 36px; display: none; align-items: center; justify-content: center; }
|
| 77 |
.mobile-fullscreen .close-mobile-fullscreen { display: flex; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
</style>
|
| 79 |
</head>
|
| 80 |
<body class="antialiased flex h-screen w-screen relative select-none">
|
|
@@ -203,6 +225,22 @@
|
|
| 203 |
return user?.displayName || username;
|
| 204 |
};
|
| 205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
window.showToast = (msg) => {
|
| 207 |
const toast = document.getElementById('toast');
|
| 208 |
document.getElementById('toastMsg').innerText = msg;
|
|
@@ -437,7 +475,7 @@
|
|
| 437 |
if (window.globalDB.users[u].password === p) success = true;
|
| 438 |
else window.showToast("Неверный пароль");
|
| 439 |
} else {
|
| 440 |
-
window.globalDB.users[u] = { password: p, avatar: '', banner: '', description: '', subs: [], followers: [], notifications: [], links: [], savedVideos: [], displayName: u };
|
| 441 |
if (await window.saveGlobalDB([], "New User")) {
|
| 442 |
success = true; window.showToast("Канал успешно создан!");
|
| 443 |
}
|
|
@@ -799,7 +837,7 @@
|
|
| 799 |
<div class="shrink-0 cursor-pointer mt-0.5" onclick="event.stopPropagation(); window.navigate('channel/${v.author}')">${avatar}</div>
|
| 800 |
<div class="flex flex-col overflow-hidden flex-item-min-width">
|
| 801 |
<h3 class="text-sm font-semibold text-white line-clamp-2 leading-tight mb-1 group-hover:text-blue-400 transition-colors">${window.renderWithMentions(v.title)}</h3>
|
| 802 |
-
<span class="text-[13px] text-yt-subtext hover:text-white transition-colors cursor-pointer" onclick="event.stopPropagation(); window.navigate('channel/${v.author}')">${window.sanitizeHTML(
|
| 803 |
<span class="text-[13px] text-yt-subtext">${window.formatViews(v.views)} • ${window.formatDate(v.timestamp)}</span>
|
| 804 |
</div>
|
| 805 |
</div>
|
|
@@ -814,7 +852,7 @@
|
|
| 814 |
<div class="cursor-pointer bg-yt-surface rounded-xl p-4 flex items-center gap-4 hover:bg-yt-hover transition-colors" onclick="window.navigate('channel/${username}')">
|
| 815 |
${avatar}
|
| 816 |
<div class="flex-item-min-width">
|
| 817 |
-
<h3 class="font-bold text-white">${window.renderWithMentions(
|
| 818 |
<p class="text-sm text-yt-subtext">${userData.followers ? userData.followers.length : 0} подписчиков</p>
|
| 819 |
${userData.description ? `<p class="text-xs text-gray-400 mt-1 line-clamp-2 comment-text">${window.renderWithMentions(userData.description)}</p>` : ''}
|
| 820 |
</div>
|
|
@@ -895,7 +933,7 @@
|
|
| 895 |
${avatarHtml}
|
| 896 |
</div>
|
| 897 |
<div class="flex-item-min-width">
|
| 898 |
-
<h3 class="font-bold text-white cursor-pointer hover:text-gray-300" onclick="window.navigate('channel/${encodeURIComponent(video.author)}')">${window.sanitizeHTML(
|
| 899 |
<p class="text-xs text-yt-subtext">${author.followers ? author.followers.length : 0} подписчиков</p>
|
| 900 |
</div>
|
| 901 |
${window.currentUser && video.author !== window.currentUser ? `
|
|
@@ -982,12 +1020,14 @@
|
|
| 982 |
const av = u.avatar ? `<img src="${u.avatar}" class="w-full h-full object-cover">` : authorDisplayName.charAt(0).toUpperCase();
|
| 983 |
const isPinned = c.id === video.pinnedCommentId;
|
| 984 |
const canEditDelete = window.currentUser === c.author;
|
|
|
|
| 985 |
return `
|
| 986 |
<div class="flex gap-4 ${isPinned ? 'border-l-4 border-blue-500 pl-3' : ''}" id="comment-${c.id}">
|
| 987 |
<div class="w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center shrink-0 font-bold text-white overflow-hidden text-sm">${av}</div>
|
| 988 |
<div class="flex-1 flex-item-min-width">
|
| 989 |
<div class="flex items-baseline gap-2 mb-1 flex-wrap">
|
| 990 |
<span class="font-bold text-white text-sm cursor-pointer hover:underline" onclick="window.navigate('channel/${c.author}')">@${authorDisplayName}</span>
|
|
|
|
| 991 |
<span class="text-xs text-gray-500">${window.formatDate(c.timestamp)}</span>
|
| 992 |
${isPinned ? '<span class="text-xs text-blue-400 font-semibold">📌 Закреплено</span>' : ''}
|
| 993 |
</div>
|
|
@@ -1021,7 +1061,7 @@
|
|
| 1021 |
</div>
|
| 1022 |
${c.replies && c.replies.length > 0 ? `
|
| 1023 |
<div class="ml-8 space-y-4 border-l-2 border-gray-800 pl-4 mt-2">
|
| 1024 |
-
${window.renderRepliesHTML(c.replies, videoId, c.id
|
| 1025 |
</div>
|
| 1026 |
` : ''}
|
| 1027 |
</div>
|
|
@@ -1030,19 +1070,21 @@
|
|
| 1030 |
}).join('');
|
| 1031 |
};
|
| 1032 |
|
| 1033 |
-
|
|
|
|
| 1034 |
return replies.map(r => {
|
| 1035 |
const ru = window.globalDB.users[r.author] || {};
|
| 1036 |
const authorDisplayName = window.getUserDisplayName(r.author);
|
| 1037 |
const rav = ru.avatar ? `<img src="${ru.avatar}" class="w-full h-full object-cover">` : authorDisplayName.charAt(0).toUpperCase();
|
| 1038 |
const canEditDelete = window.currentUser === r.author;
|
| 1039 |
-
const
|
| 1040 |
return `
|
| 1041 |
-
<div class="flex gap-3">
|
| 1042 |
<div class="w-7 h-7 rounded-full bg-gray-700 flex items-center justify-center shrink-0 font-bold text-white text-xs overflow-hidden">${rav}</div>
|
| 1043 |
<div class="flex-1 flex-item-min-width">
|
| 1044 |
<div class="flex items-baseline gap-2 mb-0.5 flex-wrap">
|
| 1045 |
<span class="font-bold text-white text-[13px]">@${authorDisplayName}</span>
|
|
|
|
| 1046 |
<span class="text-[11px] text-gray-500">${window.formatDate(r.timestamp)}</span>
|
| 1047 |
</div>
|
| 1048 |
<div id="replyText_${r.id}">
|
|
@@ -1066,17 +1108,8 @@
|
|
| 1066 |
<svg class="w-4 h-4" fill="${(r.likes||[]).includes(window.currentUser)?'currentColor':'none'}" stroke="currentColor" viewBox="0 0 24 24"><path d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5"/></svg>
|
| 1067 |
<span>${r.likes?r.likes.length:0}</span>
|
| 1068 |
</button>
|
| 1069 |
-
|
| 1070 |
</div>
|
| 1071 |
-
${canReply ? `
|
| 1072 |
-
<div id="replyBox_${r.id}" class="hidden flex gap-2 mt-1">
|
| 1073 |
-
<input type="text" id="replyInput_${r.id}" class="flex-1 bg-transparent border-b border-gray-600 text-white text-xs outline-none focus:border-blue-500 comment-text" placeholder="Ответить...">
|
| 1074 |
-
<button onclick="window.postReplyToReply('${videoId}','${parentCommentId}','${r.id}')" class="bg-blue-600 hover:bg-blue-500 text-white px-2 py-0.5 rounded-full text-[10px] font-bold">Отправить</button>
|
| 1075 |
-
</div>` : ''}
|
| 1076 |
-
${r.replies && r.replies.length > 0 ? `
|
| 1077 |
-
<div class="ml-6 mt-2 space-y-3 border-l-2 border-gray-800 pl-3">
|
| 1078 |
-
${window.renderRepliesHTML(r.replies, videoId, parentCommentId, depth + 1)}
|
| 1079 |
-
</div>` : ''}
|
| 1080 |
</div>
|
| 1081 |
</div>
|
| 1082 |
`;
|
|
@@ -1108,42 +1141,21 @@
|
|
| 1108 |
const comment = video.comments.find(c => c.id === commentId);
|
| 1109 |
if(!comment) return;
|
| 1110 |
if(!comment.replies) comment.replies = [];
|
| 1111 |
-
const reply = { id: window.generateUUID(), author: window.currentUser, text, timestamp: Date.now(), likes: [], replies: []
|
| 1112 |
comment.replies.push(reply);
|
| 1113 |
|
| 1114 |
document.getElementById('commentsList').innerHTML = window.renderCommentsHTML(video, videoId);
|
| 1115 |
window.saveGlobalDB([], "Post Reply to Comment");
|
| 1116 |
};
|
| 1117 |
|
| 1118 |
-
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
const text = input.value.trim();
|
| 1122 |
-
if(!text) return;
|
| 1123 |
-
const video = window.globalDB.videos[videoId];
|
| 1124 |
-
const comment = video.comments.find(c => c.id === commentId);
|
| 1125 |
-
if(!comment) return;
|
| 1126 |
-
const parentReply = findReply(comment.replies, replyId);
|
| 1127 |
-
if(!parentReply) return;
|
| 1128 |
-
if(parentReply.depth >= 2) {
|
| 1129 |
-
window.showToast("Достигнута максимальная глубина ответов (2 уровня)");
|
| 1130 |
-
return;
|
| 1131 |
-
}
|
| 1132 |
-
if(!parentReply.replies) parentReply.replies = [];
|
| 1133 |
-
const newReply = { id: window.generateUUID(), author: window.currentUser, text, timestamp: Date.now(), likes: [], replies: [], depth: parentReply.depth + 1 };
|
| 1134 |
-
parentReply.replies.push(newReply);
|
| 1135 |
-
|
| 1136 |
-
document.getElementById('commentsList').innerHTML = window.renderCommentsHTML(video, videoId);
|
| 1137 |
-
window.saveGlobalDB([], "Post Reply to Reply");
|
| 1138 |
};
|
| 1139 |
|
| 1140 |
function findReply(replies, id) {
|
| 1141 |
for (let r of replies) {
|
| 1142 |
if (r.id === id) return r;
|
| 1143 |
-
if (r.replies && r.replies.length > 0) {
|
| 1144 |
-
const found = findReply(r.replies, id);
|
| 1145 |
-
if (found) return found;
|
| 1146 |
-
}
|
| 1147 |
}
|
| 1148 |
return null;
|
| 1149 |
}
|
|
@@ -1210,22 +1222,11 @@
|
|
| 1210 |
const video = window.globalDB.videos[videoId];
|
| 1211 |
const comment = video.comments.find(c => c.id === parentCommentId);
|
| 1212 |
if(!comment) return;
|
| 1213 |
-
|
| 1214 |
document.getElementById('commentsList').innerHTML = window.renderCommentsHTML(video, videoId);
|
| 1215 |
window.saveGlobalDB([], "Delete Reply");
|
| 1216 |
};
|
| 1217 |
|
| 1218 |
-
function deleteReplyRecursive(replies, id) {
|
| 1219 |
-
for (let i = 0; i < replies.length; i++) {
|
| 1220 |
-
if (replies[i].id === id) {
|
| 1221 |
-
replies.splice(i, 1);
|
| 1222 |
-
return true;
|
| 1223 |
-
}
|
| 1224 |
-
if (replies[i].replies && deleteReplyRecursive(replies[i].replies, id)) return true;
|
| 1225 |
-
}
|
| 1226 |
-
return false;
|
| 1227 |
-
}
|
| 1228 |
-
|
| 1229 |
window.actionComment = async (videoId, commentId, action) => {
|
| 1230 |
if (!window.currentUser) { window.showToast("Войдите, чтобы оценить комментарий"); return; }
|
| 1231 |
const video = window.globalDB.videos[videoId];
|
|
@@ -2052,7 +2053,7 @@
|
|
| 2052 |
<div class="flex flex-col sm:flex-row gap-6 items-start sm:items-center px-4 mb-8">
|
| 2053 |
<div class="w-24 h-24 sm:w-32 sm:h-32 rounded-full bg-gray-700 flex items-center justify-center shrink-0 overflow-hidden shadow-xl border-4 border-yt-bg -mt-16 sm:mt-0 relative z-10">${avatarHtml}</div>
|
| 2054 |
<div class="flex-1 flex-item-min-width">
|
| 2055 |
-
<h1 class="text-3xl font-bold text-white mb-2">${window.renderWithMentions(
|
| 2056 |
<div class="text-yt-subtext text-sm flex gap-2 items-center mb-2"><span>@${username}</span> • <span>${user.followers?user.followers.length:0} подписчиков</span> • <span>${userVideos.length} видео</span></div>
|
| 2057 |
${user.description ? `<p class="text-sm text-gray-300 max-w-2xl line-clamp-2 comment-text">${window.renderWithMentions(user.description)}</p>` : ''}
|
| 2058 |
${linksHtml ? `<div class="mt-2 text-sm flex flex-wrap gap-3">${linksHtml}</div>` : ''}
|
|
@@ -2199,9 +2200,7 @@
|
|
| 2199 |
<div class="ml-6 mt-2 space-y-2">
|
| 2200 |
${c.replies.map(r => `
|
| 2201 |
<div class="flex items-start justify-between gap-2">
|
| 2202 |
-
<div class="text-sm text-gray-400 flex-item-min-width"><span class="font-bold text-white">@${window.getUserDisplayName(r.author)}</span> ${window.renderWithMentions(r.text)}
|
| 2203 |
-
${r.replies && r.replies.length > 0 ? `<div class="ml-4 mt-1 space-y-1">${r.replies.map(rr => `<div class="text-xs text-gray-500"><span class="font-bold">@${window.getUserDisplayName(rr.author)}</span> ${window.renderWithMentions(rr.text)}</div>`).join('')}</div>` : ''}
|
| 2204 |
-
</div>
|
| 2205 |
<button class="text-red-500 hover:text-red-400 text-xs" onclick="window.analyticsDeleteReply('${c.videoId}','${c.id}','${r.id}')">Удалить</button>
|
| 2206 |
</div>
|
| 2207 |
`).join('')}
|
|
@@ -2364,7 +2363,7 @@
|
|
| 2364 |
const comment = video.comments.find(c => c.id === commentId);
|
| 2365 |
if(!comment) return;
|
| 2366 |
if(!comment.replies) comment.replies = [];
|
| 2367 |
-
comment.replies.push({ id: window.generateUUID(), author: window.currentUser, text, timestamp: Date.now(), likes: [], replies: []
|
| 2368 |
await window.saveGlobalDB([], "Analytics Reply");
|
| 2369 |
window.renderAnalytics();
|
| 2370 |
};
|
|
@@ -2381,7 +2380,7 @@
|
|
| 2381 |
if(!video) return;
|
| 2382 |
const comment = video.comments.find(c => c.id === commentId);
|
| 2383 |
if(!comment) return;
|
| 2384 |
-
|
| 2385 |
await window.saveGlobalDB([], "Analytics Delete Reply");
|
| 2386 |
window.renderAnalytics();
|
| 2387 |
};
|
|
|
|
| 27 |
</script>
|
| 28 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 29 |
<style>
|
| 30 |
+
body { font-family: 'Inter', sans-serif; background-color: #0f0f0f; color: #f1f1f1; overflow: hidden; user-select: none; }
|
| 31 |
+
input, textarea, [contenteditable="true"] { user-select: text; }
|
| 32 |
+
img, a, button, div { -webkit-user-drag: none; -khtml-user-drag: none; -moz-user-drag: none; -o-user-drag: none; user-drag: none; }
|
| 33 |
.custom-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
|
| 34 |
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
|
| 35 |
.custom-scroll::-webkit-scrollbar-thumb { background: #71717a; border-radius: 10px; border: 2px solid #0f0f0f; }
|
|
|
|
| 75 |
.flex-item-min-width { min-width: 0; }
|
| 76 |
.mention { color: #60a5fa; cursor: pointer; font-weight: 500; }
|
| 77 |
.mention:hover { text-decoration: underline; }
|
| 78 |
+
.verified-badge { color: #3b82f6; cursor: help; margin-left: 2px; font-size: 0.9em; }
|
| 79 |
.close-mobile-fullscreen { position: absolute; top: 10px; right: 10px; z-index: 10000; color: white; background: rgba(0,0,0,0.6); border-radius: 50%; width: 36px; height: 36px; display: none; align-items: center; justify-content: center; }
|
| 80 |
.mobile-fullscreen .close-mobile-fullscreen { display: flex; }
|
| 81 |
+
|
| 82 |
+
/* Фикс горизонтального режима на телефонах */
|
| 83 |
+
@media screen and (orientation: landscape) and (max-device-width: 900px) {
|
| 84 |
+
html, body {
|
| 85 |
+
width: 100vh !important;
|
| 86 |
+
height: 100vw !important;
|
| 87 |
+
transform: rotate(-90deg) !important;
|
| 88 |
+
transform-origin: top left !important;
|
| 89 |
+
position: absolute !important;
|
| 90 |
+
top: 100% !important;
|
| 91 |
+
left: 0 !important;
|
| 92 |
+
overflow-x: hidden !important;
|
| 93 |
+
}
|
| 94 |
+
.video-container.mobile-fullscreen .close-mobile-fullscreen { display: none; }
|
| 95 |
+
.video-container.mobile-fullscreen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; }
|
| 96 |
+
}
|
| 97 |
+
@media screen and (orientation: portrait) and (max-device-width: 900px) {
|
| 98 |
+
.video-container.mobile-fullscreen .close-mobile-fullscreen { display: flex; }
|
| 99 |
+
}
|
| 100 |
</style>
|
| 101 |
</head>
|
| 102 |
<body class="antialiased flex h-screen w-screen relative select-none">
|
|
|
|
| 225 |
return user?.displayName || username;
|
| 226 |
};
|
| 227 |
|
| 228 |
+
// Функция для получения значка верификации
|
| 229 |
+
window.getVerifiedBadge = (username) => {
|
| 230 |
+
const user = window.globalDB.users[username];
|
| 231 |
+
if (user && user.verified) {
|
| 232 |
+
return `<span class="verified-badge" title="Верифицированный канал">✔</span>`;
|
| 233 |
+
}
|
| 234 |
+
return '';
|
| 235 |
+
};
|
| 236 |
+
|
| 237 |
+
// Функция для рендера имени с галочкой
|
| 238 |
+
window.renderUserName = (username) => {
|
| 239 |
+
const displayName = window.getUserDisplayName(username);
|
| 240 |
+
const badge = window.getVerifiedBadge(username);
|
| 241 |
+
return `${displayName} ${badge}`;
|
| 242 |
+
};
|
| 243 |
+
|
| 244 |
window.showToast = (msg) => {
|
| 245 |
const toast = document.getElementById('toast');
|
| 246 |
document.getElementById('toastMsg').innerText = msg;
|
|
|
|
| 475 |
if (window.globalDB.users[u].password === p) success = true;
|
| 476 |
else window.showToast("Неверный пароль");
|
| 477 |
} else {
|
| 478 |
+
window.globalDB.users[u] = { password: p, avatar: '', banner: '', description: '', subs: [], followers: [], notifications: [], links: [], savedVideos: [], displayName: u, verified: false };
|
| 479 |
if (await window.saveGlobalDB([], "New User")) {
|
| 480 |
success = true; window.showToast("Канал успешно создан!");
|
| 481 |
}
|
|
|
|
| 837 |
<div class="shrink-0 cursor-pointer mt-0.5" onclick="event.stopPropagation(); window.navigate('channel/${v.author}')">${avatar}</div>
|
| 838 |
<div class="flex flex-col overflow-hidden flex-item-min-width">
|
| 839 |
<h3 class="text-sm font-semibold text-white line-clamp-2 leading-tight mb-1 group-hover:text-blue-400 transition-colors">${window.renderWithMentions(v.title)}</h3>
|
| 840 |
+
<span class="text-[13px] text-yt-subtext hover:text-white transition-colors cursor-pointer" onclick="event.stopPropagation(); window.navigate('channel/${v.author}')">${window.sanitizeHTML(window.renderUserName(v.author))}</span>
|
| 841 |
<span class="text-[13px] text-yt-subtext">${window.formatViews(v.views)} • ${window.formatDate(v.timestamp)}</span>
|
| 842 |
</div>
|
| 843 |
</div>
|
|
|
|
| 852 |
<div class="cursor-pointer bg-yt-surface rounded-xl p-4 flex items-center gap-4 hover:bg-yt-hover transition-colors" onclick="window.navigate('channel/${username}')">
|
| 853 |
${avatar}
|
| 854 |
<div class="flex-item-min-width">
|
| 855 |
+
<h3 class="font-bold text-white">${window.renderWithMentions(window.renderUserName(username))}</h3>
|
| 856 |
<p class="text-sm text-yt-subtext">${userData.followers ? userData.followers.length : 0} подписчиков</p>
|
| 857 |
${userData.description ? `<p class="text-xs text-gray-400 mt-1 line-clamp-2 comment-text">${window.renderWithMentions(userData.description)}</p>` : ''}
|
| 858 |
</div>
|
|
|
|
| 933 |
${avatarHtml}
|
| 934 |
</div>
|
| 935 |
<div class="flex-item-min-width">
|
| 936 |
+
<h3 class="font-bold text-white cursor-pointer hover:text-gray-300" onclick="window.navigate('channel/${encodeURIComponent(video.author)}')">${window.sanitizeHTML(window.renderUserName(video.author))}</h3>
|
| 937 |
<p class="text-xs text-yt-subtext">${author.followers ? author.followers.length : 0} подписчиков</p>
|
| 938 |
</div>
|
| 939 |
${window.currentUser && video.author !== window.currentUser ? `
|
|
|
|
| 1020 |
const av = u.avatar ? `<img src="${u.avatar}" class="w-full h-full object-cover">` : authorDisplayName.charAt(0).toUpperCase();
|
| 1021 |
const isPinned = c.id === video.pinnedCommentId;
|
| 1022 |
const canEditDelete = window.currentUser === c.author;
|
| 1023 |
+
const isVerified = u.verified;
|
| 1024 |
return `
|
| 1025 |
<div class="flex gap-4 ${isPinned ? 'border-l-4 border-blue-500 pl-3' : ''}" id="comment-${c.id}">
|
| 1026 |
<div class="w-10 h-10 rounded-full bg-gray-700 flex items-center justify-center shrink-0 font-bold text-white overflow-hidden text-sm">${av}</div>
|
| 1027 |
<div class="flex-1 flex-item-min-width">
|
| 1028 |
<div class="flex items-baseline gap-2 mb-1 flex-wrap">
|
| 1029 |
<span class="font-bold text-white text-sm cursor-pointer hover:underline" onclick="window.navigate('channel/${c.author}')">@${authorDisplayName}</span>
|
| 1030 |
+
${isVerified ? `<span class="verified-badge" title="Верифицированный канал">✔</span>` : ''}
|
| 1031 |
<span class="text-xs text-gray-500">${window.formatDate(c.timestamp)}</span>
|
| 1032 |
${isPinned ? '<span class="text-xs text-blue-400 font-semibold">📌 Закреплено</span>' : ''}
|
| 1033 |
</div>
|
|
|
|
| 1061 |
</div>
|
| 1062 |
${c.replies && c.replies.length > 0 ? `
|
| 1063 |
<div class="ml-8 space-y-4 border-l-2 border-gray-800 pl-4 mt-2">
|
| 1064 |
+
${window.renderRepliesHTML(c.replies, videoId, c.id)}
|
| 1065 |
</div>
|
| 1066 |
` : ''}
|
| 1067 |
</div>
|
|
|
|
| 1070 |
}).join('');
|
| 1071 |
};
|
| 1072 |
|
| 1073 |
+
// Упрощаем рендер ответов: только один уровень, без вложенности
|
| 1074 |
+
window.renderRepliesHTML = (replies, videoId, parentCommentId) => {
|
| 1075 |
return replies.map(r => {
|
| 1076 |
const ru = window.globalDB.users[r.author] || {};
|
| 1077 |
const authorDisplayName = window.getUserDisplayName(r.author);
|
| 1078 |
const rav = ru.avatar ? `<img src="${ru.avatar}" class="w-full h-full object-cover">` : authorDisplayName.charAt(0).toUpperCase();
|
| 1079 |
const canEditDelete = window.currentUser === r.author;
|
| 1080 |
+
const isVerified = ru.verified;
|
| 1081 |
return `
|
| 1082 |
+
<div class="flex gap-3" id="reply-${r.id}">
|
| 1083 |
<div class="w-7 h-7 rounded-full bg-gray-700 flex items-center justify-center shrink-0 font-bold text-white text-xs overflow-hidden">${rav}</div>
|
| 1084 |
<div class="flex-1 flex-item-min-width">
|
| 1085 |
<div class="flex items-baseline gap-2 mb-0.5 flex-wrap">
|
| 1086 |
<span class="font-bold text-white text-[13px]">@${authorDisplayName}</span>
|
| 1087 |
+
${isVerified ? `<span class="verified-badge" title="Верифицированный канал">✔</span>` : ''}
|
| 1088 |
<span class="text-[11px] text-gray-500">${window.formatDate(r.timestamp)}</span>
|
| 1089 |
</div>
|
| 1090 |
<div id="replyText_${r.id}">
|
|
|
|
| 1108 |
<svg class="w-4 h-4" fill="${(r.likes||[]).includes(window.currentUser)?'currentColor':'none'}" stroke="currentColor" viewBox="0 0 24 24"><path d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5"/></svg>
|
| 1109 |
<span>${r.likes?r.likes.length:0}</span>
|
| 1110 |
</button>
|
| 1111 |
+
<!-- Ответы на ответы недоступны -->
|
| 1112 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1113 |
</div>
|
| 1114 |
</div>
|
| 1115 |
`;
|
|
|
|
| 1141 |
const comment = video.comments.find(c => c.id === commentId);
|
| 1142 |
if(!comment) return;
|
| 1143 |
if(!comment.replies) comment.replies = [];
|
| 1144 |
+
const reply = { id: window.generateUUID(), author: window.currentUser, text, timestamp: Date.now(), likes: [], replies: [] };
|
| 1145 |
comment.replies.push(reply);
|
| 1146 |
|
| 1147 |
document.getElementById('commentsList').innerHTML = window.renderCommentsHTML(video, videoId);
|
| 1148 |
window.saveGlobalDB([], "Post Reply to Comment");
|
| 1149 |
};
|
| 1150 |
|
| 1151 |
+
// Удаляем postReplyToReply, так как ответы на ответы запрещены
|
| 1152 |
+
window.postReplyToReply = () => {
|
| 1153 |
+
window.showToast("Ответы на ответы недоступны");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1154 |
};
|
| 1155 |
|
| 1156 |
function findReply(replies, id) {
|
| 1157 |
for (let r of replies) {
|
| 1158 |
if (r.id === id) return r;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1159 |
}
|
| 1160 |
return null;
|
| 1161 |
}
|
|
|
|
| 1222 |
const video = window.globalDB.videos[videoId];
|
| 1223 |
const comment = video.comments.find(c => c.id === parentCommentId);
|
| 1224 |
if(!comment) return;
|
| 1225 |
+
comment.replies = comment.replies.filter(r => r.id !== replyId);
|
| 1226 |
document.getElementById('commentsList').innerHTML = window.renderCommentsHTML(video, videoId);
|
| 1227 |
window.saveGlobalDB([], "Delete Reply");
|
| 1228 |
};
|
| 1229 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1230 |
window.actionComment = async (videoId, commentId, action) => {
|
| 1231 |
if (!window.currentUser) { window.showToast("Войдите, чтобы оценить комментарий"); return; }
|
| 1232 |
const video = window.globalDB.videos[videoId];
|
|
|
|
| 2053 |
<div class="flex flex-col sm:flex-row gap-6 items-start sm:items-center px-4 mb-8">
|
| 2054 |
<div class="w-24 h-24 sm:w-32 sm:h-32 rounded-full bg-gray-700 flex items-center justify-center shrink-0 overflow-hidden shadow-xl border-4 border-yt-bg -mt-16 sm:mt-0 relative z-10">${avatarHtml}</div>
|
| 2055 |
<div class="flex-1 flex-item-min-width">
|
| 2056 |
+
<h1 class="text-3xl font-bold text-white mb-2">${window.renderWithMentions(window.renderUserName(username))}</h1>
|
| 2057 |
<div class="text-yt-subtext text-sm flex gap-2 items-center mb-2"><span>@${username}</span> • <span>${user.followers?user.followers.length:0} подписчиков</span> • <span>${userVideos.length} видео</span></div>
|
| 2058 |
${user.description ? `<p class="text-sm text-gray-300 max-w-2xl line-clamp-2 comment-text">${window.renderWithMentions(user.description)}</p>` : ''}
|
| 2059 |
${linksHtml ? `<div class="mt-2 text-sm flex flex-wrap gap-3">${linksHtml}</div>` : ''}
|
|
|
|
| 2200 |
<div class="ml-6 mt-2 space-y-2">
|
| 2201 |
${c.replies.map(r => `
|
| 2202 |
<div class="flex items-start justify-between gap-2">
|
| 2203 |
+
<div class="text-sm text-gray-400 flex-item-min-width"><span class="font-bold text-white">@${window.getUserDisplayName(r.author)}</span> ${window.renderWithMentions(r.text)}</div>
|
|
|
|
|
|
|
| 2204 |
<button class="text-red-500 hover:text-red-400 text-xs" onclick="window.analyticsDeleteReply('${c.videoId}','${c.id}','${r.id}')">Удалить</button>
|
| 2205 |
</div>
|
| 2206 |
`).join('')}
|
|
|
|
| 2363 |
const comment = video.comments.find(c => c.id === commentId);
|
| 2364 |
if(!comment) return;
|
| 2365 |
if(!comment.replies) comment.replies = [];
|
| 2366 |
+
comment.replies.push({ id: window.generateUUID(), author: window.currentUser, text, timestamp: Date.now(), likes: [], replies: [] });
|
| 2367 |
await window.saveGlobalDB([], "Analytics Reply");
|
| 2368 |
window.renderAnalytics();
|
| 2369 |
};
|
|
|
|
| 2380 |
if(!video) return;
|
| 2381 |
const comment = video.comments.find(c => c.id === commentId);
|
| 2382 |
if(!comment) return;
|
| 2383 |
+
comment.replies = comment.replies.filter(r => r.id !== replyId);
|
| 2384 |
await window.saveGlobalDB([], "Analytics Delete Reply");
|
| 2385 |
window.renderAnalytics();
|
| 2386 |
};
|