Список пользователей

1
Админ
Постов: 101
2
Элита
Постов: 34
3
Элита
Постов: 28
4
VIP
Постов: 26
5
Дизайнер
Постов: 25
6
Пользователи
Постов: 25
7
Пользователи
Постов: 24
8
Проверенные
Постов: 21

  • Страница 1 из 1
  • 1
iPad rendering logic -комментарии с подсветкой групп UCOZ V1
Дата: Суббота, 01.11.2025, 16:02 | Сообщение # 1 | | Написал: Начинающий
Автор темы
Мурчанн не в сети
        Сообщений:101
         Регистрация:20.10.2016

Немного переработал iPad rendering logic, внес изменения в CSS-стили и добавил поддержку групп пользователей. Теперь информер корректно распознает, какие комментарии оставлены администратором, модератором или проверенными пользователями. Форма сообщений также была слегка переработана — они стали более объёмными и визуально выделенными. Считаю, что эта опция очень важна, поскольку позволяет пользователям сразу понимать, что комментарий оставлен не обычным участником, а представителем определённой группы. В остальном внешние атрибуты практически не изменились, а прогресс iPad rendering logic идёт достаточно быстро.

Информер

Код
<div class="askolenada $CLASS$"
     data-group="<?if($USER_GROUP$)?>$USER_GROUP$<?else?>user<?endif?>"
     onclick="window.location='$ENTRY_URL$';">
  <div class="keeping">
    <div class="img">
      <img src="<?if($USER_AVATAR_URL$)?>$USER_AVATAR_URL$<?else?>/post/noavatar.png<?endif?>" alt="" />
    </div>
    <div class="text-wrapper">
      <div class="nickname" data-profile-url="$PROFILE_URL$">$USERNAME$</div>
      <div class="comment">$MESSAGE$</div>
    </div>
  </div>
  <a href="$ENTRY_URL$" class="next-btn">Далее</a>
</div>


Глобальный блок

Код
<!-- iPad контейнер -->
<div class="ipad-mockup">

<div class="real-pencil">
<div class="pencil-tip"></div>
<div class="pencil-body">
<span class="pencil-label">Apple Pencil</span>

</div>
<div class="pencil-top"></div>

<span class="pencil-label">
<span class="apple-icon">🍏</span>
</span>

</div>

<div class="ipad-screen">

<!-- Основной контент внутри экрана -->
<div class="acesories">

<!-- Вывод комментарии через информер -->

$MYINF_5$

<!-- Комментарии -->

</div>
</div>

<div class="ipad-label">iPad</div>
</div>

<style>

/* Яркие и контрастные фоны для всего блока комментария — HSL для точного различия */
.askolenada.comment-admin      { background-color: hsl(0, 90%, 60%); color: #fff; }       /* админ - ярко-красный */
.askolenada.comment-moder      { background-color: hsl(0, 0%, 10%); color: #fff; }       /* модератор - почти черный */
.askolenada.comment-designer   { background-color: hsl(210, 90%, 55%); color: #fff; }    /* дизайнер - насыщенный синий */
.askolenada.comment-vip        { background-color: hsl(45, 100%, 50%); color: #000; }     /* VIP - чистый желтый */
.askolenada.comment-elite      { background-color: hsl(285, 80%, 45%); color: #fff; }     /* элита - насыщенный фиолетовый */
.askolenada.comment-verified   { background-color: hsl(180, 80%, 50%); color: #000; }     /* проверенные - ярко-голубой */
.askolenada.comment-user       { background-color: hsl(0, 0%, 95%); color: #000; }       /* обычные пользователи - очень светло-серый */
.askolenada.comment-blocked    { background-color: hsl(0, 0%, 45%); color: #fff; }       /* заблокированные - темно-серый */

/* Внутренние элементы для корректного отображения */
.askolenada .keeping {
  display: flex;
  align-items: flex-start;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.askolenada .text-wrapper {
  margin-left: -40px;
  word-wrap: break-word;
}

.askolenada .nickname {
  font-weight: bold;
  margin-bottom: 5px;
}

.askolenada .comment img {
  vertical-align: middle;
}

/* Ромбовидный стилус */
.real-pencil {
position: absolute;
left: -50px;
top: 50px;
width: 25px;
height: 600px;
display: flex;
flex-direction: column;
align-items: center;
transform: rotate(-8deg);
z-index: 10;
animation: sway 6s infinite ease-in-out;
}

.pencil-label {
writing-mode: vertical-rl;
font-size: 11px;
color: #555;
font-family: "Segoe UI", sans-serif;
font-weight: bold;
text-shadow: 0 0 1px rgba(0,0,0,0.3);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(180deg);
display: flex;
align-items: center;
gap: 2px;
}

.apple-icon {
display: inline-block;
transform: rotate(90deg);
font-size: 12px;
margin-bottom: 80px; /* сдвигаем вниз/назад относительно текста */
}

/* Основной корпус с гранями */
.pencil-body {
flex: 1;
width: 24px;
background: linear-gradient(180deg, #fefefe 0%, #e6e6e6 100%);
clip-path: polygon(
50% 0%, /* верхний центр */
95% 10%, /* верхний правый угол */
95% 90%, /* нижний правый угол */
50% 100%, /* низ центр */
5% 90%, /* нижний левый угол */
5% 10% /* верхний левый угол */
);
box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 0 6px rgba(255,255,255,0.2);
position: relative;
display: flex;
justify-content: center;
align-items: center;
margin-top: -2px;
}

/* Надпись на корпусе с символом Apple */
.pencil-label {
writing-mode: vertical-rl;
transform: rotate(180deg);
font-size: 11px;
color: #555;
font-family: "Segoe UI", sans-serif;
font-weight: bold;
text-shadow: 0 0 1px rgba(0,0,0,0.3);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(180deg);
}

/* Добавляем сам текст с символом Apple через ::before */
.pencil-label::before {
content: " ";
font-size: 12px; /* немного больше, чтобы был заметен */
display: inline-block;
margin-bottom: 2px; /* подгоняем под вертикальный текст */
}

/* Верхняя часть */
.pencil-top {
width: 8px;
height: 8px;
background: #dcdcdc;
border-radius: 50%;
margin-top: -2px;
box-shadow: 0 1px 5px rgba(0,0,0,0.3), inset 0 1px 3px rgba(255,255,255,0.4);
}

/* Анимация лёгкого колебания */
@keyframes sway {
0%,100% { transform: rotate(-1deg); }
50% { transform: rotate(-0deg); }
}

/* iPad блок */

.ipad-mockup {
width: 768px;
max-width: 90vw;
height: 880px;
background: #1c1c1c;
border-radius: 40px;
box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 0 4px rgba(255,255,255,0.1);
position: relative;
margin: 40px auto;
font-family: "Segoe UI", sans-serif;

/* Настраиваем внутренние отступы отдельно */
padding-top: 20px;
padding-left: 20px;
padding-right: 20px;
padding-bottom: 40px; /* <- увеличена нижняя рамка для надписи iPad */

display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}

/* Ограничиваем фон и шрифт только для iPad */
.ipad-mockup {
background: radial-gradient(circle at top left, #0b0614, #11081f 80%);
font-family: "Segoe UI", sans-serif;
color: #fff;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
min-height: 980px; /* или 100% родителя */
padding: 0;
margin: 40px auto;
border-radius: 40px;
box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 0 4px rgba(255,255,255,0.1);
}

.next-btn {
text-decoration: none;
padding: 12px 20px;
border-radius: 25px;
color: #fff;
background: linear-gradient(135deg, #875bc7 0%, #54a4f3 100%);
font-weight: 600;
font-size: 14px;
transition: all 0.25s ease;
}

.next-btn:hover {
transform: scale(1.05);
box-shadow: 0 0 20px rgba(162, 77, 252, 0.5);
}

.comment {
display: -webkit-box;
-webkit-line-clamp: 3; /* показываем максимум 3 строки */
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}

/* Вырез под камеру/динамик сверху с отступом */
.ipad-mockup::before {
content: "";
position: absolute;
top: 8px; /* увеличен отступ сверху, был 12px */
left: 50%;
transform: translateX(-50%);
width: 60px;
height: 6px;
background: #333;
border-radius: 3px;
}

/* Экран планшета */
.ipad-screen {
width: 100%;
height: 100%;
background: radial-gradient(circle at top left, #0b0614, #11081f 80%);
border-radius: 30px;
overflow: hidden;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}

/* Надпись iPad снизу с настраиваемым отступом */
:root {
--ipad-label-bottom: 8px; /* изменяем это значение, чтобы регулировать позицию */
}

.ipad-label {
position: absolute;
bottom: var(--ipad-label-bottom);
width: 100%;
text-align: center;
font-family: "Segoe UI", sans-serif;
font-weight: 600;
font-size: 20px;
color: #bbb;
letter-spacing: 1px;
text-shadow: 0 0 4px rgba(0,0,0,0.6);
}

/* Контейнер по центру с прокруткой*/
.acesories {
position: relative;
width: 780px;
height: 970px;
display: flex;
flex-direction: column; /* вертикальный поток комментариев */
justify-content: flex-start; /* прижимаем к верху */
align-items: stretch; /* растягиваем комментарии по ширине */

background: radial-gradient(circle at top left, #1a0826, #0c0713 80%);
border-radius: 12px;
box-shadow: 0 0 30px rgba(120, 40, 180, 0.4);

overflow-y: auto; /* включаем вертикальный скролл */
padding: 20px; /* немного меньше, чем было 60px */
margin: 10px auto;
}

/* Отступы между комментариями */
:root {
--comment-gap: 5px;
}

/* Комментарий */
.askolenada {
width: 93%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 28px 16px 160px;
background: linear-gradient(135deg, rgba(40, 20, 60, 0.9), rgba(30, 10, 50, 0.9));
border-radius: 100px 30px 30px 100px;
box-shadow: 0 8px 25px rgba(150, 70, 255, 0.25);
color: #fff;
font-size: 16px;
opacity: 0;
transform: translateY(50px);
position: relative;
margin-top: var(--comment-gap, 22px);
transition: transform 0.8s ease, opacity 0.8s ease;
animation: slideUp 1s ease forwards;
}

/* Анимация появления */
@keyframes slideUp {
from { opacity: 0; transform: translateY(60px); }
to { opacity: 1; transform: translateY(0); }
}

/* Задержки для упорядоченности */
.askolenada:nth-child(1) { animation-delay: 0.2s; }
.askolenada:nth-child(2) { animation-delay: 0.5s; }
.askolenada:nth-child(3) { animation-delay: 0.8s; }
.askolenada:nth-child(4) { animation-delay: 1.1s; }
.askolenada:nth-child(5) { animation-delay: 1.4s; }

/* Контейнер текста */
.text-wrapper {
display: flex;
flex-direction: column;
justify-content: flex-start;
text-align: left;
margin-left: calc(var(--text-left, -50px));
margin-top: calc(var(--text-top, 0px));
}

/* Ник */
.nickname {
font-weight: 700;
font-size: 18px;
color: #d4b9ff;
text-shadow: 0 0 8px rgba(180, 90, 255, 0.5);

/* Отступы */
margin-top: -8px; /* сверху */
margin-bottom: 0px; /* снизу */

}

/* Комментарий */
.comment {
font-size: 15px;
color: #f4f4f4;
line-height: 1.4;
text-shadow: 0 0 6px rgba(180, 120, 255, 0.25);
}

/* Аватар */
.askolenada .img {
height: 85px;
width: 85px;
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
background: linear-gradient(145deg, #9a4dff, #692ac7);
border-radius: 50%;
padding: 5px;
box-shadow: 0 0 15px rgba(150, 70, 255, 0.5);

/* Отступы */
margin-top: 0px; /* сверху */
margin-bottom: 0px; /* снизу */
margin-left: -14px; /* слева */
}

.askolenada .img img {
height: 100%;
width: 100%;
border-radius: 50%;
object-fit: cover;
border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Кнопка */
.askolenada a {
text-decoration: none;
padding: 14px 22px;
border-radius: 25px;
color: #fff;
background: linear-gradient(135deg, #a24dfc 0%, #5c26e0 100%);
font-weight: 600;
font-size: 15px;
transition: all 0.25s ease;
box-shadow: 0 0 12px rgba(162, 77, 252, 0.4);
}

.askolenada a:hover {
transform: scale(1.05);
box-shadow: 0 0 20px rgba(162, 77, 252, 0.7);
}

/* Эффект свечения */
.askolenada::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
background: radial-gradient(circle at 80% 50%, rgba(200, 100, 255, 0.3), transparent 70%);
opacity: 0;
transition: opacity 0.5s ease;
}

.askolenada.active::after {
opacity: 1;
animation: glowTrail 1.8s ease-out;
}

@keyframes glowTrail {
0% { opacity: 1; filter: blur(6px); }
100% { opacity: 0; filter: blur(20px); }
}
</style>

<script>
const comments = document.querySelectorAll('.askolenada');
const visibleSlots = 4;
let queue = [...comments];
let active = [];

function showNext() {
if (queue.length === 0) return;
const comment = queue.shift();
active.push(comment);

comment.style.opacity = '1';
comment.style.transform = `translateY(${active.indexOf(comment) * 85}px)`;
comment.classList.add('active');

if (active.length === visibleSlots) {
setTimeout(() => hideFirst(), 10000);
} else {
setTimeout(showNext, 800);
}
}

function hideFirst() {
const first = active.shift();
first.style.opacity = '0';
first.style.transform = `translateY(-100%)`;

if (queue.length > 0) {
showNext();
} else {
queue.push(first);
setTimeout(showNext, 500);
}
}

showNext();

const commentGap = 85 + 8;
setInterval(() => {
active.forEach((c, i) => {
c.style.transform = `translateY(${i * commentGap}px)`;
});
}, 300);
</script>


Скрипт необходимо вставлять в самый низ каталога файлов или любого другого модуля, непосредственно перед закрывающими тегами:



Скрипт

Код
<script>
document.addEventListener('DOMContentLoaded', () => {
  const comments = document.querySelectorAll('.askolenada');

  comments.forEach(comment => {
    const nicknameEl = comment.querySelector('.nickname');
    const profileUrl = nicknameEl?.dataset.profileUrl;
    if (!profileUrl) return;

    fetch(profileUrl)
      .then(res => res.text())
      .then(html => {
        const parser = new DOMParser();
        const doc = parser.parseFromString(html, 'text/html');
        const groupEl = doc.querySelector('.group-name');
        if (!groupEl) return;

        const groupName = groupEl.textContent.trim().toLowerCase();

        switch(groupName) {
          case 'админ':
            comment.classList.add('comment-admin');
            break;
          case 'модераторы':
            comment.classList.add('comment-moder');
            break;
          case 'дизайнер':
            comment.classList.add('comment-designer');
            break;
          case 'vip':
            comment.classList.add('comment-vip');
            break;
          case 'элита':
            comment.classList.add('comment-elite');
            break;
          case 'проверенные':
            comment.classList.add('comment-verified');
            break;
          case 'пользователи':
            comment.classList.add('comment-user');
            break;
          case 'заблокированные':
            comment.classList.add('comment-blocked');
            break;
          default:
            comment.classList.add('comment-user');
        }
      })
      .catch(err => console.error('Ошибка при получении профиля:', err));
  });
});
</script>


Скрин в действии

Мурчанн

Признаюсь, не знаю почему, но глядя на звезды мне всегда хочется мечтать.
  • Страница 1 из 1
  • 1
Поиск: