Дата: Среда, 04.03.2026, 00:43 | Сообщение # 1 |
|
Написал: Узнаваемый
Автор темы
Мурчанн
не в сети
Сообщений: 211
Эта версия стала более стабильной и получила новые функции. Добавлено всплывающее окно, стилизованное под стиль ВКонтакте, а также аватар, ник и тип сообщения для получателя. В поле «Написать сообщение» появился небольшой блок со смайлами справа. Стрелка при открытии списка сообщений была убрана, так как она никуда не вела и была лишней функцией. После открытия мессенджера основная кнопка его запуска теперь скрывается. В будущем планируется изменить саму кнопку: лучше добавить сбоку справа закладку, которая будет выдвигаться при наведении , это будет выглядеть современно.На данный момент не удаётся объединить принятые и отправленные сообщения, вероятно, это невозможно. Плавающий помощник сообщений Мини-мессенджер для uCoz: новая эра личных сообщений V1.0 Код
<?if($USER_LOGGED_IN$)?> <style> /* Кнопка FAB */ .vk-btn { position: fixed; right: 20px; /* чуть ближе к краю или дальше по вкусу */ bottom: 22px; /* ← вот здесь поднимаем/опускаем выше/ниже */ width: 46px; /* вернул классический размер Material Design */ height: 46px; background: #2a5885; border-radius: 50%; box-shadow: 0 4px 18px rgba(42,88,133,0.35); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10002; transition: all 0.22s; } .vk-btn:hover { transform: translateY(5px); box-shadow: 0 8px 24px rgba(42,88,133,0.45); } .vk-btn.behind { z-index: 9998 !important; /* ниже панели */ opacity: 0; /* полностью скрываем */ pointer-events: none; /* отключаем клики */ transform: scale(0.7); /* визуально уменьшаем (опционально) */ } .vk-btn-inner { width: 40px; height: 40px; background: white; border-radius: 5%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 20px; color: #2a5885; } /* Бейджик */ .vk-badge { position: absolute; top: -6px; right: -2px; min-width: 20px; height: 20px; background: #e64646; color: white; font-size: 11px; font-weight: bold; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(230, 70, 70, 0.4); border: 2px solid #fff; } @keyframes pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } } .vk-badge.pop { animation: pop 0.4s ease; } /* Панель чата — ВАЖНО: z-index выше кнопки */ .vk-panel { position: fixed; right: 5px; bottom: 10px; width: 380px; height: 560px; background: #fff; border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,0.22); overflow: hidden; display: none; flex-direction: column; z-index: 10003; /* выше кнопки (10003 > 10002) */ transform: scale(0.92) translateY(20px); opacity: 0; transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1.2); } .vk-panel.show { display: flex; transform: none; opacity: 1; } /* Заголовок панели */ .vk-header { background: #2a5885; color: white; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; } .vk-header-back { background: none; border: none; color: white; font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 8px 4px 0; } .vk-header-ava { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.4); } .vk-header-name { flex: 1; font-size: 17px; font-weight: 600; } .vk-toggle { background: none; border: none; color: white; font-size: 26px; cursor: pointer; padding: 4px 8px; } /* Основная область */ .vk-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #f0f2f5; } .vk-msg-list { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; } /* Элемент списка чатов */ .vk-msg-item { display: flex; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: background 0.14s; } .vk-msg-item:hover { background: #e8f0fe; } .vk-msg-item img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; } .vk-msg-title { font-weight: 600; font-size: 15.5px; color: #000; } .vk-msg-text { font-size: 13.5px; color: #444; line-height: 1.38; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 1px; } .vk-msg-time { font-size: 12px; color: #888; margin-top: 4px; } .vk-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 15px; text-align: center; padding: 0 40px; } /* Сообщения */ .msg-row { display: flex; align-items: flex-start; margin-bottom: 14px; max-width: 82%; } .msg-row.in { justify-content: flex-start; } .msg-row.out { justify-content: flex-end; flex-direction: row-reverse; } .msg-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; margin-top: 4px; } .msg-row.in .msg-avatar { margin-right: 10px; } .msg-row.out .msg-avatar { margin-left: 10px; } .msg { padding: 9px 14px; border-radius: 18px; font-size: 15.5px; line-height: 1.42; word-break: break-word; box-shadow: 0 1px 3px rgba(0,0,0,0.08); max-width: 100%; } .msg.in { background: white; border-bottom-left-radius: 6px; } .msg.out { background: #d0e4ff; border-bottom-right-radius: 6px; } .msg-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-weight: 600; font-size: 14px; gap: 12px; } .msg-user { color: #000; } .msg-time { font-size: 0.82em; color: #777; white-space: nowrap; opacity: 0.85; } .msg-body { white-space: pre-wrap; word-break: break-word; } .chat-input-wrap { display: none; /* JS управляет */ position: relative !important; /* ← ключевой фикс: контейнер relative */ flex-direction: row; align-items: center; padding: 12px 16px; background: white; border-top: 1px solid #e0e4e8; gap: 12px; flex-shrink: 0; box-sizing: border-box; width: 100%; min-height: 68px; } .chat-input { flex: 1 1 auto; width: 81%; min-width: 0; padding: 11px 35px 11px 16px; /* добавляем padding-right = ширина emoji-btn + отступ */ border: none; border-radius: 24px; background: #f0f2f5; font-size: 15.5px; line-height: 1.4; color: #000; outline: none; box-sizing: border-box; min-height: 44px; max-height: 120px; resize: vertical; overflow-y: auto; } .chat-send { position: absolute !important; /* ← кнопка абсолютная — не зависит от flex */ right: 16px !important; /* отступ от правого края */ top: 50% !important; transform: translateY(-50%) !important; /* центрируем по вертикали */ width: 48px !important; height: 48px !important; border: none !important; border-radius: 50% !important; background: #2a5885 !important; color: white !important; font-size: 22px !important; cursor: pointer !important; display: flex !important; align-items: center !important; justify-content: center !important; transition: all 0.18s ease !important; z-index: 2 !important; /* поверх всего */ margin: 0 !important; } .chat-send:hover { transform: translateY(-50%) scale(1.08) !important; background: #3b6ea3 !important; box-shadow: 0 4px 12px rgba(42,88,133,0.3) !important; } /* ===== VK ALERT MODERN ===== */ #vk-custom-alert { position: fixed !important; inset: 0 !important; background: rgba(0,0,0,0.65) !important; display: flex !important; justify-content: center !important; align-items: center !important; z-index: 9999999 !important; } /* Карточка */ #vk-custom-alert .vk-alert-card { width: 460px !important; max-width: 95% !important; background: #2a5885 !important; /* темно-синий фон, как ВК */ border-radius: 22px !important; box-shadow: 0 25px 70px rgba(0,0,0,0.45) !important; overflow: hidden !important; animation: vkFadeInForce .25s ease forwards !important; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important; transform: scale(1) !important; opacity: 1 !important; color: #ffffff !important; /* общий цвет текста */ } /* Анимация */ @keyframes vkFadeInForce { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } } /* Шапка */ #vk-custom-alert .vk-alert-header { background: #5181b8 !important; color: #ffffff !important; padding: 20px 24px !important; font-size: 17px !important; font-weight: 700 !important; display: flex !important; justify-content: space-between !important; align-items: center !important; text-shadow: 0 1px 2px rgba(0,0,0,0.4) !important; } /* Крестик */ #vk-custom-alert .vk-alert-close { cursor: pointer !important; font-size: 22px !important; color: #ffffff !important; } /* Контент */ #vk-custom-alert .vk-alert-content { display: flex !important; gap: 20px !important; padding: 28px !important; align-items: center !important; } /* Аватар */ #vk-custom-alert .vk-alert-avatar { width: 75px !important; height: 75px !important; border-radius: 50% !important; object-fit: cover !important; display: block !important; border: 2px solid #fff !important; } /* Текст */ #vk-custom-alert .vk-alert-text { flex: 1 !important; } #vk-custom-alert .vk-alert-username { font-weight: 700 !important; font-size: 16px !important; color: #ffffff !important; /* белый */ margin-bottom: 6px !important; } #vk-custom-alert .vk-alert-details { color: #d0d6e0 !important; /* светло-серый */ font-size: 13px !important; } /* Футер */ #vk-custom-alert .vk-alert-footer { background: #3b5998 !important; /* чуть темнее */ padding: 18px 24px !important; text-align: right !important; border-top: 1px solid rgba(255,255,255,0.2) !important; } /* Кнопка */ #vk-custom-alert .vk-alert-btn { background: #00aced !important; /* голубой стиль ВК */ border: none !important; color: #ffffff !important; padding: 10px 22px !important; border-radius: 12px !important; cursor: pointer !important; font-size: 14px !important; font-weight: 600 !important; display: inline-block !important; transition: 0.2s all ease !important; } #vk-custom-alert .vk-alert-btn:hover { background: #0084b4 !important; transform: translateY(-1px) !important; } #vk-custom-alert .vk-alert-message { color: #ffffff !important; /* белый текст */ font-size: 15px !important; margin-bottom: 6px !important; line-height: 1.5 !important; } #vk-custom-alert .vk-alert-title { color: #ffffff !important; /* белый текст */ font-size: 17px !important; font-weight: 600 !important; } /* Кнопка смайлов */ .emoji-btn { position: absolute; right: 75px; /* слева от кнопки отправки */ top: 50%; transform: translateY(-50%); width: 59px; height: 59px; background: #; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; z-index: 3; transition: 0.2s all ease; } .emoji-btn:hover { background: #; transform: translateY(-50%) scale(1.1); } /* Панель со смайлами */ .emoji-picker { position: absolute; bottom: 60px; /* над полем ввода */ right: 16px; width: 220px; max-height: 200px; background: #2a5885; /* темно-синий фон */ border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,0.25); padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; overflow-y: auto; z-index: 10004; } /* Смайлы белые */ .emoji-picker .emoji { font-size: 22px; cursor: pointer; transition: 0.15s transform ease; color: #ffffff; /* белый цвет */ } .emoji-picker .emoji:hover { transform: scale(1.3); filter: brightness(1.3); } </style> <div class="vk-btn" id="vkBtn"> <div class="vk-btn-inner">PM</div> <div class="vk-badge" id="vkBadge" style="display:none">0</div> </div> <div class="vk-panel" id="vkPanel"> <div class="vk-header"> <button class="vk-header-back" id="btnBack">←</button> <img class="vk-header-ava" id="chatAva" src="" alt="" style="display:none"> <span class="vk-header-name" id="chatName">Чаты</span> <button class="vk-toggle" id="vkToggle">×</button> </div> <div class="vk-body"> <div class="vk-msg-list" id="msgList"> <div class="vk-empty">Нет сообщений</div> </div> <div class="chat-input-wrap" id="chatInputWrap" style="display:none"> <input class="chat-input" id="chatInp" placeholder="Напишите сообщение..." autocomplete="off"> <!-- Кнопка смайлов --> <div class="emoji-btn" id="emojiBtn"> <img src="https://bro.usite.pro/icon/removebg.png" alt="смайлы" style="width:20px;height:20px;"> </div> <!-- Окно со смайлами --> <div class="emoji-picker" id="emojiPicker" style="display:none;"> <!-- Пример смайлов --> <span class="emoji">😀</span> <span class="emoji">😂</span> <span class="emoji">😍</span> <span class="emoji">😎</span> <span class="emoji">👍</span> <span class="emoji">🎉</span> <span class="emoji">❤️</span> <span class="emoji">😢</span> <span class="emoji">🤔</span> <span class="emoji">😜</span> <span class="emoji">😇</span> <span class="emoji">🥳</span> <span class="emoji">😱</span> <span class="emoji">💖</span> <span class="emoji">🔥</span> <span class="emoji">🙌</span> <span class="emoji">👏</span> <span class="emoji">😴</span> </div> <button class="chat-send" id="chatSend">➤</button> </div> </div> </div> <script> // элементы const emojiBtn = document.getElementById('emojiBtn'); const emojiPicker = document.getElementById('emojiPicker'); const chatInput = document.getElementById('chatInp'); // открытие/закрытие окна со смайлами emojiBtn.addEventListener('click', () => { emojiPicker.style.display = emojiPicker.style.display === 'flex' ? 'none' : 'flex'; }); // вставка смайла в поле ввода emojiPicker.querySelectorAll('.emoji').forEach(el => { el.addEventListener('click', () => { const start = chatInput.selectionStart; const end = chatInput.selectionEnd; const text = chatInput.value; chatInput.value = text.slice(0, start) + el.textContent + text.slice(end); chatInput.focus(); chatInput.selectionStart = chatInput.selectionEnd = start + el.textContent.length; }); }); // закрываем окно кликом вне document.addEventListener('click', e => { if (!emojiPicker.contains(e.target) && e.target !== emojiBtn) { emojiPicker.style.display = 'none'; } }); </script> <!-- Скрытый список онлайн-пользователей от uCoz --> <div id="uc-online-list" style="display:none;"> $ONLINE_USERS_LIST$ </div> <!-- Скрытый iframe --> <iframe id="hiddenPMFrame" style="display:none; width:0; height:0; border:0; position:absolute; top:-9999px;" src="about:blank"></iframe> <script src="https://bro.usite.pro/js/vk-messenger.js?v=1.0"></script> <?else?> <!-- Гости ничего не видят --> <?endif?>
Признаюсь, не знаю почему, но глядя на звезды мне всегда хочется мечтать.