<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Salman Khan (@beingsalmankhan) • Instagram profile</title>
<!-- Tailwind CSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- FontAwesome for Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Google Fonts Inter -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #fafafa;
color: #262626;
overflow-x: hidden;
-webkit-tap-highlight-color: transparent;
/* Disable user selection, saving, zooming */
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
touch-action: pan-x pan-y;
}
/* Prevent image dragging and saving */
img {
-webkit-user-drag: none;
user-drag: none;
pointer-events: none;
}
.interactive-img {
pointer-events: auto;
}
::-webkit-scrollbar {
width: 4px;
height: 4px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #c7c7c7;
border-radius: 2px;
}
@keyframes fadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
.modal-anim {
animation: fadeIn 0.2s ease-out forwards;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.spinner {
animation: spin 1s linear infinite;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen flex flex-col justify-between" oncontextmenu="return false;">
<br>
<main class="max-w-6xl mx-auto px-3 sm:px-6 pt-4 sm:pt-8 pb-12 w-full flex-grow">
<!-- Profile Top Section -->
<div class="flex flex-col md:flex-row items-center md:items-start pb-6 sm:pb-8 border-b border-gray-300">
<!-- Profile Picture with Story Ring Handler -->
<div class="mb-4 md:mb-0 md:mr-16 flex-shrink-0">
<div id="profileRingContainer" class="w-24 h-24 sm:w-32 sm:h-32 md:w-36 md:h-36 rounded-full p-1 cursor-pointer transition transform hover:scale-105 bg-gradient-to-tr from-yellow-400 via-red-500 to-purple-600" onclick="openStoryModal()">
<img src="https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=400" alt="Salman Khan" class="w-full h-full object-cover rounded-full border-2 border-white bg-white interactive-img">
</div>
</div>
<!-- Profile Meta & Info -->
<div class="flex-grow text-center md:text-left w-full">
<!-- Username & Actions -->
<div class="flex flex-col sm:flex-row items-center justify-center md:justify-start space-y-3 sm:space-y-0 sm:space-x-4 mb-4">
<div class="flex items-center space-x-1.5">
<h1 class="text-lg sm:text-xl md:text-2xl font-normal text-gray-900">beingsalmankhan</h1>
<i class="fa-solid fa-circle-check text-blue-500 text-sm sm:text-lg" title="Verified"></i>
</div>
<div class="flex space-x-2 w-full sm:w-auto justify-center">
<button id="followBtn" onclick="toggleFollow()" class="flex-1 sm:flex-none bg-blue-500 hover:bg-blue-600 text-white font-semibold px-6 py-1.5 rounded-lg text-xs sm:text-sm transition shadow-sm">Follow</button>
<button onclick="openMessageModal()" class="flex-1 sm:flex-none bg-gray-200 hover:bg-gray-300 text-gray-900 font-semibold px-5 py-1.5 rounded-lg text-xs sm:text-sm transition">Message</button>
</div>
</div>
<!-- Stats Desktop (Following removed as requested) -->
<div class="hidden md:flex space-x-10 mb-5 text-gray-800">
<div><span class="font-semibold text-gray-900">1,616</span> posts</div>
<div class="cursor-pointer"><span class="font-semibold text-gray-900">72.6M</span> followers</div>
</div>
<!-- Bio Details -->
<div class="text-xs sm:text-sm px-2 md:px-0">
<div class="font-semibold text-gray-900 mb-0.5">Salman Khan</div>
<div class="text-gray-600 mb-1">Artist | Humanitarian</div>
<p class="text-gray-800 leading-relaxed whitespace-pre-line">Welcome to the official Instagram account of Salman Khan. Spread love and positivity.</p>
</div>
</div>
</div>
<!-- Stats Mobile (Following removed) -->
<div class="flex md:hidden justify-around py-3 border-b border-gray-300 text-center text-xs sm:text-sm text-gray-700 bg-white">
<div><span class="font-semibold block text-gray-900">1,616</span> posts</div>
<div><span class="font-semibold block text-gray-900">72.6M</span> followers</div>
</div>
<div class="border-t border-gray-300 flex justify-center space-x-16 text-xs font-semibold tracking-wider text-gray-500 bg-white">
<button onclick="switchTab('books')" id="tab-books" class="flex items-center space-x-2 py-4 border-t-2 border-black text-black transition">
<i class="fa-solid fa-book text-sm"></i> <span>BOOKS</span>
</button>
<button onclick="switchTab('quotes')" id="tab-quotes" class="flex items-center space-x-2 py-4 border-t-2 border-transparent hover:text-gray-800 transition">
<i class="fa-solid fa-quote-left text-sm"></i> <span>QUOTES</span>
</button>
</div>
<!-- Gallery Grid (Desktop: 4 per row, Mobile: 2 per row, spanning full edge width) -->
<div id="gallery-grid" class="grid grid-cols-2 md:grid-cols-4 gap-3 sm:gap-5 mt-4">
<!-- Dynamically rendered via JS -->
</div>
</main>
<footer class="bg-white border-t border-gray-200 py-6 text-center text-xs text-gray-500">
<div class="max-w-6xl mx-auto px-4 flex flex-col sm:flex-row items-center justify-between space-y-3 sm:space-y-0">
<div class="flex flex-wrap justify-center space-x-4">
<a href="#" class="hover:underline">Meta</a>
<a href="#" class="hover:underline">About</a>
<a href="#" class="hover:underline">Blog</a>
<a href="#" class="hover:underline">Jobs</a>
<a href="#" class="hover:underline">Help</a>
<a href="#" class="hover:underline">API</a>
<a href="#" class="hover:underline">Privacy</a>
<a href="#" class="hover:underline">Terms</a>
</div>
<div>© 2026 Instagram from Meta</div>
</div>
</footer>
<div id="storyModal" class="fixed inset-0 bg-black/90 z-50 hidden flex items-center justify-center p-2">
<div class="relative w-full max-w-sm h-[85vh] bg-neutral-900 rounded-2xl overflow-hidden shadow-2xl flex flex-col justify-between">
<div id="storyProgressBars" class="absolute top-3 left-3 right-3 z-30 flex space-x-1.5"></div>
<div class="absolute top-6 left-4 right-4 z-30 flex items-center justify-between text-white">
<div class="flex items-center space-x-2">
<img src="https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=150" class="w-8 h-8 rounded-full object-cover border border-white">
<span class="text-xs font-semibold">beingsalmankhan</span>
<span class="text-[10px] text-gray-300" id="storyTimeAgo">2h</span>
</div>
<button onclick="closeStoryModal()" class="text-white text-xl font-bold px-2">×</button>
</div>
<div class="w-full h-full flex items-center justify-center relative cursor-pointer" onclick="nextStory()">
<img id="storyImage" src="" class="w-full h-full object-cover" alt="Story">
</div>
</div>
</div>
<div id="spinnerModal" class="fixed inset-0 bg-black/80 z-50 hidden flex flex-col items-center justify-center">
<div class="w-16 h-16 border-4 border-white/20 border-t-blue-500 rounded-full spinner mb-4"></div>
<div class="text-white font-medium text-sm tracking-wider">Redirecting to external link...</div>
</div>
<div id="quoteModal" class="fixed inset-0 bg-black/60 z-50 hidden flex items-center justify-center p-3" onclick="checkCloseQuoteModal(event)">
<div id="quoteDialog" class="bg-white w-full max-w-lg rounded-2xl shadow-2xl p-6 sm:p-8 flex flex-col justify-between modal-anim relative border border-gray-100">
<button onclick="closeQuoteModal()" class="absolute top-3 right-3 text-gray-400 hover:text-black text-xl px-2">×</button>
<div class="text-gray-400 text-xl mb-4"><i class="fa-solid fa-quote-left"></i></div>
<p id="quoteModalText" class="text-base sm:text-lg font-medium text-gray-900 leading-relaxed italic mb-6 text-center"></p>
<div class="flex items-center justify-between pt-4 border-t border-gray-100">
<span id="quoteModalLikes" class="text-xs font-semibold text-gray-500 flex items-center space-x-1">
<i class="fa-solid fa-heart text-red-500"></i><span id="quoteLikesVal"></span>
</span>
<img id="quoteModalSig" src="" class="w-20 h-8 object-contain opacity-80" alt="Signature">
</div>
</div>
</div>
<div id="messageModal" class="fixed inset-0 bg-black/60 z-50 hidden flex items-center justify-center p-3" onclick="checkCloseMessage(event)">
<div id="messageDialog" class="bg-white w-full max-w-md h-[550px] rounded-2xl shadow-2xl flex flex-col overflow-hidden modal-anim">
<!-- Chat Header -->
<div class="bg-white border-b border-gray-200 p-3.5 flex items-center justify-between">
<div class="flex items-center space-x-3">
<img src="https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=150" class="w-10 h-10 rounded-full object-cover">
<div>
<h3 class="font-semibold text-sm text-gray-900">Salman Khan</h3>
<p class="text-[11px] text-gray-500" id="lastSeenText">Active 10m ago</p>
</div>
</div>
<button onclick="closeMessageModal()" class="text-gray-500 hover:text-black text-lg p-2"><i class="fa-solid fa-xmark"></i></button>
</div>
<!-- Chat Messages Container -->
<div id="chatMessages" class="flex-grow p-4 overflow-y-auto space-y-3 bg-gray-50"></div>
<!-- Chat Input Footer -->
<div class="p-3 bg-white border-t border-gray-200 flex items-center space-x-2">
<input type="text" id="chatInput" placeholder="Message..." class="flex-grow bg-gray-100 text-sm px-4 py-2.5 rounded-full focus:outline-none border border-gray-200" onkeypress="handleChatKey(event)">
<button onclick="sendChatMessage()" class="bg-blue-500 hover:bg-blue-600 text-white font-semibold px-4 py-2 rounded-full text-sm transition">Send</button>
</div>
</div>
</div>
<script>
// --- 1. SECURITY & ANTI-COPY ENFORCEMENT ---
document.addEventListener('keydown', function(e) {
// Block Ctrl+C, Ctrl+X, Ctrl+S, Ctrl+U, Ctrl+A
if (e.ctrlKey && (e.key === 'c' || e.key === 'x' || e.key === 's' || e.key === 'u' || e.key === 'a')) {
e.preventDefault();
return false;
}
});
// --- 2. STORIES CONFIGURATION & EXPIRY LOGIC (24 hours) ---
let storiesData = [
{
id: 1,
img: 'https://images.unsplash.com/photo-1511671782779-c97d3d27a1d4?w=600',
time: '2h ago',
timestamp: Date.now() - (2 * 3600 * 1000)
},
{
id: 2,
img: 'https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?w=600',
time: '5h ago',
timestamp: Date.now() - (5 * 3600 * 1000)
}
];
let currentStoryIndex = 0;
let storyTimer = null;
function checkStoriesValidity() {
const ONE_DAY = 24 * 3600 * 1000;
const now = Date.now();
storiesData = storiesData.filter(s => (now - s.timestamp) < ONE_DAY);
const ringContainer = document.getElementById('profileRingContainer');
const viewedStories = localStorage.getItem('salman_stories_seen') === 'true';
if (storiesData.length === 0) {
ringContainer.className = "w-24 h-24 sm:w-32 sm:h-32 md:w-36 md:h-36 rounded-full p-0 cursor-pointer";
ringContainer.onclick = null;
} else {
if (viewedStories) {
ringContainer.className = "w-24 h-24 sm:w-32 sm:h-32 md:w-36 md:h-36 rounded-full p-1 cursor-pointer transition transform hover:scale-105 bg-gray-400";
} else {
ringContainer.className = "w-24 h-24 sm:w-32 sm:h-32 md:w-36 md:h-36 rounded-full p-1 cursor-pointer transition transform hover:scale-105 bg-gradient-to-tr from-yellow-400 via-red-500 to-purple-600";
}
ringContainer.onclick = openStoryModal;
}
}
function openStoryModal() {
if (storiesData.length === 0) return;
currentStoryIndex = 0;
document.getElementById('storyModal').classList.remove('hidden');
renderStory();
}
function renderStory() {
if (currentStoryIndex >= storiesData.length) {
closeStoryModal();
localStorage.setItem('salman_stories_seen', 'true');
checkStoriesValidity();
return;
}
const story = storiesData[currentStoryIndex];
document.getElementById('storyImage').src = story.img;
document.getElementById('storyTimeAgo').innerText = story.time;
const pbContainer = document.getElementById('storyProgressBars');
pbContainer.innerHTML = '';
storiesData.forEach((_, idx) => {
const bar = document.createElement('div');
bar.className = "h-1 flex-grow bg-white/40 rounded-full overflow-hidden";
if (idx < currentStoryIndex) {
bar.innerHTML = '<div class="h-full bg-white w-full"></div>';
} else if (idx === currentStoryIndex) {
bar.innerHTML = '<div class="h-full bg-white w-full transition-all duration-[10000ms] linear" style="width: 100%"></div>';
}
pbContainer.appendChild(bar);
});
if (storyTimer) clearTimeout(storyTimer);
storyTimer = setTimeout(() => {
currentStoryIndex++;
renderStory();
}, 10000); // 10 seconds reel/story duration as requested
}
function closeStoryModal() {
document.getElementById('storyModal').classList.add('hidden');
if (storyTimer) clearTimeout(storyTimer);
localStorage.setItem('salman_stories_seen', 'true');
checkStoriesValidity();
}
function nextStory() {
if (storyTimer) clearTimeout(storyTimer);
currentStoryIndex++;
renderStory();
}
// --- 3. BOOKS & QUOTES DATA & TABS ---
const booksData = [
{ id: 1, title: 'Tiger 3 Action Diary', description: 'Behind the scenes from the sets of Tiger 3.', likes: '(78K)', img: 'https://images.unsplash.com/photo-1536440136628-849c177e76a1?w=600', link: 'https://instagram.com' },
{ id: 2, title: 'Dabangg World Tour', description: 'Unforgettable moments with incredible fans.', likes: '(8K)', img: 'https://images.unsplash.com/photo-1514525253161-7a46d19cd819?w=600', link: 'https://instagram.com' },
{ id: 3, title: 'Panvel Farmhouse Fitness', description: 'Fitness is feeling healthy and strong everyday.', likes: '(870)', img: 'https://images.unsplash.com/photo-1534438327276-14e5300c3a48?w=600', link: 'https://instagram.com' },
{ id: 4, title: 'Monochrome Portraits', description: 'Simplicity is the ultimate sophistication.', likes: '(76)', img: 'https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=600', link: 'https://instagram.com' },
{ id: 5, title: 'Being Human Foundation', description: 'Empowering children and supporting education.', likes: '(45K)', img: 'https://images.unsplash.com/photo-1488521787991-ed7bbaae773c?w=600', link: 'https://instagram.com' },
{ id: 6, title: 'Sultan Wrestling Ring', description: 'Hard work beats talent when talent fails.', likes: '(120K)', img: 'https://images.unsplash.com/photo-1517838277536-f5f99be501cd?w=600', link: 'https://instagram.com' },
{ id: 7, title: 'Candid Moments on Set', description: 'Laughter with the entire crew.', likes: '(32K)', img: 'https://images.unsplash.com/photo-1511671782779-c97d3d27a1d4?w=600', link: 'https://instagram.com' },
{ id: 8, title: 'Studio Recording Sessions', description: 'Music connects souls and rhythms.', likes: '(19K)', img: 'https://images.unsplash.com/photo-1514525253161-7a46d19cd819?w=600', link: 'https://instagram.com' },
{ id: 9, title: 'Charcoal & Acrylic Art', description: 'Canvas is where thoughts turn into colors.', likes: '(54K)', img: 'https://images.unsplash.com/photo-1579783902614-a3fb3927b675?w=600', link: 'https://instagram.com' },
{ id: 10, title: 'Golden Hour Waves', description: 'Peaceful evening reflecting on life journeys.', likes: '(91K)', img: 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600', link: 'https://instagram.com' },
{ id: 11, title: 'Scenic Bike Trails', description: 'The open road and freedom on two wheels.', likes: '(63K)', img: 'https://images.unsplash.com/photo-1558981403-c5f9899a28bc?w=600', link: 'https://instagram.com' },
{ id: 12, title: 'Milestones Celebration', description: 'Gratitude for every single fan.', likes: '(150K)', img: 'https://images.unsplash.com/photo-1511988617509-a57c8a288659?w=600', link: 'https://instagram.com' }
];
const quotesData = [
{ id: 1, quote: "Being good is good, but being true is everything.", likes: '(34K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 2, quote: "Do what your heart says, but keep your mind along.", likes: '(49K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 3, quote: "Fitness is a journey, not a destination.", likes: '(88K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 4, quote: "Spread love, keep smiling, and stay grounded.", likes: '(112K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 5, quote: "Action speaks louder than words ever could.", likes: '(65K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 6, quote: "Humility is the greatest ornament an artist can wear.", likes: '(92K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 7, quote: "Every sunset brings the promise of a new dawn.", likes: '(41K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' },
{ id: 8, quote: "Live life king size with honesty and purpose.", likes: '(73K)', signature: 'https://api.iconify.design/lucide:signature.svg?color=%23333' }
];
function switchTab(tab) {
const bookTab = document.getElementById('tab-books');
const quoteTab = document.getElementById('tab-quotes');
if (tab === 'books') {
bookTab.className = "flex items-center space-x-2 py-4 border-t-2 border-black text-black transition";
quoteTab.className = "flex items-center space-x-2 py-4 border-t-2 border-transparent hover:text-gray-800 transition text-gray-500";
renderBooksGrid();
} else {
quoteTab.className = "flex items-center space-x-2 py-4 border-t-2 border-black text-black transition";
bookTab.className = "flex items-center space-x-2 py-4 border-t-2 border-transparent hover:text-gray-800 transition text-gray-500";
renderQuotesGrid();
}
}
function renderBooksGrid() {
const grid = document.getElementById('gallery-grid');
grid.innerHTML = '';
booksData.forEach(item => {
const div = document.createElement('div');
div.className = "relative aspect-[4/5] bg-gray-200 group cursor-pointer overflow-hidden rounded-md shadow-sm";
div.onclick = () => handleBookRedirect(item.link);
div.innerHTML = `
<img src="${item.img}" class="w-full h-full object-cover group-hover:scale-105 transition duration-300 interactive-img" alt="${item.title}">
<div class="absolute inset-0 bg-black/40 opacity-0 md:group-hover:opacity-100 transition flex items-center justify-center space-x-4 text-white font-semibold text-sm">
<div class="flex items-center space-x-1"><i class="fa-solid fa-heart"></i><span>${item.likes}</span></div>
</div>
<div class="absolute bottom-2 right-2 md:hidden bg-black/60 text-white text-[10px] px-2 py-0.5 rounded-full flex items-center space-x-1">
<i class="fa-solid fa-heart text-red-400"></i><span>${item.likes}</span>
</div>
`;
grid.appendChild(div);
});
}
function handleBookRedirect(url) {
document.getElementById('spinnerModal').classList.remove('hidden');
setTimeout(() => {
window.location.href = url;
}, 2000);
}
window.addEventListener('pageshow', function(event) {
document.getElementById('spinnerModal').classList.add('hidden');
});
function renderQuotesGrid() {
const grid = document.getElementById('gallery-grid');
grid.innerHTML = '';
quotesData.forEach(item => {
const div = document.createElement('div');
div.className = "relative aspect-square bg-gradient-to-br from-gray-900 to-gray-800 text-white p-4 sm:p-6 rounded-md shadow-md flex flex-col justify-between group cursor-pointer";
div.onclick = () => openQuoteModal(item);
div.innerHTML = `
<div class="text-gray-400 text-sm"><i class="fa-solid fa-quote-left text-lg"></i></div>
<p class="text-xs sm:text-sm font-medium leading-snug italic text-center text-gray-100">"${item.quote}"</p>
<div class="flex items-center justify-between pt-2 border-t border-gray-700/50">
<span class="text-[10px] text-gray-400 flex items-center space-x-1"><i class="fa-solid fa-heart text-red-500"></i><span>${item.likes}</span></span>
<img src="${item.signature}" class="w-12 h-6 object-contain opacity-70 filter invert interactive-img" alt="Signature">
</div>
`;
grid.appendChild(div);
});
}
function openQuoteModal(item) {
document.getElementById('quoteModalText').innerText = `"${item.quote}"`;
document.getElementById('quoteLikesVal').innerText = item.likes;
document.getElementById('quoteModalSig').src = item.signature;
document.getElementById('quoteModal').classList.remove('hidden');
}
function closeQuoteModal() {
document.getElementById('quoteModal').classList.add('hidden');
}
function checkCloseQuoteModal(e) {
if (e.target.id === 'quoteModal') {
closeQuoteModal();
}
}
// --- 4. PERSISTENT FOLLOW / FOLLOWING BUTTON ---
function updateFollowButtonUI(isFollowing) {
const btn = document.getElementById('followBtn');
if (isFollowing) {
btn.innerText = 'Following';
btn.className = "flex-1 sm:flex-none bg-gray-200 hover:bg-gray-300 text-gray-900 font-semibold px-6 py-1.5 rounded-lg text-xs sm:text-sm transition shadow-sm";
} else {
btn.innerText = 'Follow';
btn.className = "flex-1 sm:flex-none bg-blue-500 hover:bg-blue-600 text-white font-semibold px-6 py-1.5 rounded-lg text-xs sm:text-sm transition shadow-sm";
}
}
function toggleFollow() {
const current = localStorage.getItem('salman_is_following') === 'true';
const nextState = !current;
localStorage.setItem('salman_is_following', nextState);
updateFollowButtonUI(nextState);
}
// --- 5. PERSISTENT CHAT / MESSAGE MODAL (Empty by default) ---
let chatMessages = JSON.parse(localStorage.getItem('salman_chat_messages')) || [];
function openMessageModal() {
document.getElementById('messageModal').classList.remove('hidden');
renderChatMessages();
}
function closeMessageModal() {
document.getElementById('messageModal').classList.add('hidden');
}
function checkCloseMessage(e) {
if (e.target.id === 'messageModal') {
closeMessageModal();
}
}
function renderChatMessages() {
const container = document.getElementById('chatMessages');
container.innerHTML = '';
chatMessages.forEach(msg => {
const div = document.createElement('div');
div.className = `flex ${msg.sender === 'me' ? 'justify-end' : 'justify-start'} items-center space-x-2`;
const bubble = document.createElement('div');
bubble.className = `max-w-[75%] px-3.5 py-2 rounded-2xl text-xs sm:text-sm relative group ${msg.sender === 'me' ? 'bg-blue-500 text-white' : 'bg-white text-gray-800 border border-gray-200'}`;
bubble.innerText = msg.text;
if (msg.sender === 'me') {
const delBtn = document.createElement('button');
delBtn.innerHTML = '×';
delBtn.className = "absolute -left-5 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-red-500 hover:text-white text-gray-600 rounded-full w-4 h-4 text-[10px] flex items-center justify-center opacity-0 group-hover:opacity-100 transition";
delBtn.title = "Unsend message";
delBtn.onclick = () => deleteChatMessage(msg.id);
div.appendChild(delBtn);
}
div.appendChild(bubble);
container.appendChild(div);
});
container.scrollTop = container.scrollHeight;
}
function sendChatMessage() {
const input = document.getElementById('chatInput');
const text = input.value.trim();
if (!text) return;
chatMessages.push({ id: Date.now(), sender: 'me', text: text });
localStorage.setItem('salman_chat_messages', JSON.stringify(chatMessages));
input.value = '';
renderChatMessages();
}
function deleteChatMessage(id) {
chatMessages = chatMessages.filter(m => m.id !== id);
localStorage.setItem('salman_chat_messages', JSON.stringify(chatMessages));
renderChatMessages();
}
function handleChatKey(e) {
if (e.key === 'Enter') sendChatMessage();
}
// --- INITIALIZATION ON LOAD ---
window.onload = function() {
checkStoriesValidity();
const isFollowing = localStorage.getItem('salman_is_following') === 'true';
updateFollowButtonUI(isFollowing);
renderBooksGrid();
};
</script>
</body>
</html>