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

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

  • Страница 1 из 1
  • 1
Последние темы RSS канал на UCOZ V1
Дата: Воскресенье, 12.10.2025, 02:34 | Сообщение # 1 | | Написал: Начинающий
Автор темы
Мурчанн не в сети
        Сообщений:101
         Регистрация:20.10.2016

Перебрал немного CSS в более светлые тона , сделаем упор на осветление . 2

Код
<script src="https://jordan.moy.su/js/last_avatar_widget.js"></script>

<!-- ::: Мини-виджет последних тем ::: -->
<div id="forum-comments-widget">
<div class="fcw-header">💬 Последние темы RSS</div>
<div id="fcw-loading">Загрузка...</div>
<div id="fcw-list"></div>
</div>

<style>

/* Скролл для виджета */
#fcw-list::-webkit-scrollbar {
  width: 8px;
}
#fcw-list::-webkit-scrollbar-track {
  background: #f7f5fa;
  border-radius: 6px;
}
#fcw-list::-webkit-scrollbar-thumb {
  background-color: #d47ce0;
  border-radius: 6px;
  border: 2px solid #f7f5fa;
}
#fcw-list::-webkit-scrollbar-thumb:hover {
  background-color: #e397ee;
}

/* Контейнер */
#forum-comments-widget {
  background: #ffffff;
  color: #333;
  padding: 8px;
  border-radius: 10px;
  font-family: Arial, sans-serif;
  font-size: 10px;
  max-width: 100%;
  width: auto;
  box-shadow: 0 0 10px rgba(212,124,224,0.2);
  transition: box-shadow 0.3s;
}
#forum-comments-widget:hover {
  box-shadow: 0 0 18px rgba(212,124,224,0.4);
}

/* Заголовок */
#forum-comments-widget .fcw-header {
  font-size: 12px;
  font-weight: bold;
  text-align: left;
  margin-bottom: 6px;
  color: #bb42cc;
  text-shadow: 0 0 5px rgba(212,124,224,0.3);
}

/* Список сообщений */
#fcw-list {
  max-height: 650px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Сообщение */
.fcw-item {
  display: flex;
  align-items: flex-start;
  background: rgba(220, 160, 255, 0.08);
  padding: 5px;
  border-radius: 5px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
}
.fcw-item:hover {
  background: rgba(220,160,255,0.2);
  transform: translateX(3px);
  box-shadow: 0 0 6px rgba(212,124,224,0.3);
}

/* Аватар */
.fcw-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid #d47ce0;
  box-shadow: 0 0 4px rgba(212,124,224,0.3);
  transition: transform 0.3s, box-shadow 0.3s;
}
.fcw-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Контент */
.fcw-content { flex: 1; min-width: 0; }
.fcw-author {
  color: #bb42cc;
  font-weight: bold;
  display: block;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fcw-text {
  color: #5c3c66;
  font-size: 9px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* Анимация появления */
@keyframes fadeIn {
  to { opacity: 1; }
}

</style>

</div>
</div>

<!-- ::: RSS-канал ::: -->


JS особо ничего делать не надо, но если неподлавливает аваторки , делаем списко в ручную 2

Код
// auto_rss_avatar_simple.js
(function(){
  'use strict';

  const widgetId = "forum-comments-widget";
  const rssProxy = "https://api.rss2json.com/v1/api.json?rss_url=https://jordan.moy.su/forum/rss";
  const maxItems = 13;
  const defaultAvatar = "/template/amg/images/img/noava.png";
  const checkDelay = 150;
  const cacheKey = 'autoAvatarRSSCache_simple';
  const cache = JSON.parse(localStorage.getItem(cacheKey) || '{}');

  const userMap = {
    "НАСТЯ": "#",
    "Юля": "#"
  };

  function saveCache() {
    localStorage.setItem(cacheKey, JSON.stringify(cache));
  }

  async function fetchAndFindAvatar(url){
    try{
      const res = await fetch(url, { cache: 'no-cache' });
      if(!res.ok) return null;
      const txt = await res.text();
      const parser = new DOMParser();
      const doc = parser.parseFromString(txt, 'text/html');
      const el = doc.querySelector('img[src*="/avatar/"], img[src*="/ava/"], .user_avatar img');
      return el ? new URL(el.src, location.href).href : null;
    }catch(e){
      return null;
    }
  }

  function buildProfileCandidates(username){
    if(!username) return [];
    const safe = encodeURIComponent(username.replace(/\s+/g,'-'));
    return [
      location.origin + '/index/8-0-' + safe,
      location.origin + '/index/8-0-' + username
    ];
  }

  async function getAvatar(username){
    if(!username) return defaultAvatar;
    if(cache[username]) return cache[username];
    if(userMap[username] && userMap[username]!=="#"){
      cache[username] = userMap[username];
      saveCache();
      return userMap[username];
    }
    const candidates = buildProfileCandidates(username);
    for(const c of candidates){
      const found = await fetchAndFindAvatar(c);
      if(found){
        cache[username] = found;
        saveCache();
        return found;
      }
      await new Promise(r => setTimeout(r, checkDelay));
    }
    cache[username] = defaultAvatar;
    saveCache();
    return defaultAvatar;
  }

  function createWidgetContainer(){
    if(document.getElementById(widgetId)) return;
    const container = document.createElement("div");
    container.id = widgetId;
    container.innerHTML = `
      <div class="fcw-header">💬 Последние сообщения</div>
      <div id="fcw-loading">Загрузка...</div>
      <div id="fcw-list"></div>
    `;
    document.body.appendChild(container);

    const style = document.createElement("style");
    style.innerHTML = `
      #${widgetId} { width: 90%; max-height: 700px; background: #111; color: #fff; padding:6px; border-radius:6px; font-family:Arial,sans-serif; box-sizing:border-box; }
      .fcw-header { font-size:12px; font-weight:bold; margin-bottom:6px; text-align:center; color:#4ec9b0; }
      #fcw-list { max-height:650px; overflow-y:auto; padding-right:4px; box-sizing:border-box; }
      .fcw-item { display:flex; align-items:flex-start; padding:4px; margin-bottom:4px; background:rgba(255,255,255,0.03); border-radius:4px; cursor:pointer; }
      .fcw-avatar { width:24px; height:24px; flex-shrink:0; border-radius:50%; margin-right:6px; overflow:hidden; }
      .fcw-avatar img { width:24px; height:24px; border-radius:50%; object-fit:cover; display:block; }
      .fcw-content { flex:1 1 auto; min-width:0; overflow:hidden; word-break:break-word; }
      .fcw-author { font-size:10px; font-weight:bold; color:#4ec9b0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; margin-bottom:1px; }
      .fcw-title { font-size:11px; font-weight:bold; color:#fff; text-decoration:underline; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; margin-bottom:1px; }
      .fcw-text { font-size:10px; color:#ccc; line-height:1.2; overflow:hidden; text-overflow:ellipsis; word-break:break-word; }`;
    document.head.appendChild(style);
  }

  function extractSnippet(html, length = 100){
    const div = document.createElement('div');
    div.innerHTML = html;
    const text = div.textContent || div.innerText || '';
    return text.trim().substring(0, length) + (text.length > length ? '…' : '');
  }

  async function loadRSS(){
    const list = document.querySelector("#fcw-list");
    const loading = document.querySelector("#fcw-loading");
    if(!list || !loading) return;

    try{
      const res = await fetch(rssProxy);
      const data = await res.json();
      if(!data.items || data.items.length===0){
        loading.textContent = "Нет сообщений для отображения.";
        return;
      }

      let html = "";
      for(let i=0; i<Math.min(maxItems, data.items.length); i++){
        const item = data.items[i];
        const authorMatch = item.description.match(/Автор темы:\s*([^<]+)/i);
        const author = authorMatch ? authorMatch[1].trim() : "Неизвестен";
        const avatarSrc = await getAvatar(author);
        const snippet = extractSnippet(item.content || item.description || '', 100);

        html += `<div class="fcw-item" onclick="window.open('${item.link}','_blank')">
                  <div class="fcw-avatar"><img src="${avatarSrc}" alt="avatar"></div>
                  <div class="fcw-content">
                    <span class="fcw-author">${author}</span>
                    <span class="fcw-title">${item.title || "Без названия"}</span>
                    <span class="fcw-text">${snippet}</span>
                  </div>
                </div>`;
      }

      loading.style.display = "none";
      list.innerHTML = html;

    }catch(e){
      console.error(e);
      loading.textContent = "Ошибка при загрузке сообщений.";
    }
  }

  function init(){
    createWidgetContainer();
    loadRSS();
  }

  if(document.readyState==="loading"){
    document.addEventListener("DOMContentLoaded", init);
  } else {
    init();
  }

})();


Список

Код
   const userMap = {
    "НАСТЯ": "ссылку на аву",
    "Юля": "ссылку на аву"    
     "НАСТЯ": "ссылку на аву",
     "Юля": "ссылку на аву"
     "НАСТЯ": "ссылку на аву",
     "Юля": "ссылку на аву"
     "НАСТЯ": "ссылку на аву",
     "Юля": "ссылку на аву"
  };

  function saveCache() {
    localStorage.setItem(cacheKey, JSON.stringify(cache));
  }


и за политики браузеров , многие настройки скролла не работают , кроме оперы. 13

Мурчанн

Признаюсь, не знаю почему, но глядя на звезды мне всегда хочется мечтать.
Дата: Воскресенье, 12.10.2025, 06:10 | Сообщение # 2 | | Написал: Начинающий
Автор темы
Мурчанн не в сети
        Сообщений:101
         Регистрация:20.10.2016

Мурчанн

Признаюсь, не знаю почему, но глядя на звезды мне всегда хочется мечтать.
Дата: Воскресенье, 12.10.2025, 08:58 | Сообщение # 3 | | Написал: Новичок
ZadNizza не в сети
        Сообщений:34
         Регистрация:30.03.2024
За хорошее поведение За преданность форуму За любовь народа

Любой у кого есть свой сайт сможет немного подправить CSS стили под свой проект , полностью готовый модуль 2

ZadNizza

Довёл себя до края? Не видишь смысла больше жить? Значит, ты уже близок... Близок к решению дойти до дна, чтобы оттолкнуться от него и навсегда решить быть счастливым... Так что не бойся дна — используй его....
  • Страница 1 из 1
  • 1
Поиск: