Загрузка...

UI
Bringing back old pings

Thread in Extentions created by Патруль Oct 8, 2025. (bumped Oct 31, 2025) 535 views

  1. Патруль
    Патруль Topic starter Oct 8, 2025 saint peter and hail mary
    Представляю вашему вниманию скрипт, который возвращает привычный старый вид пингов на лолз. Мне как и многим пользователям форума не очень зашел новый стиль с иконкой и аватаркой, поэтому держите
    скрипт полностью написан чудесным человеком avatarнеудачник :love2:
    [IMG]
    Для работы скрипта понадобится tampermonkey
    С некоторыми униками может багаться, однако таких очень мало
    [IMG]
    JS
    // ==UserScript==
    // @name Lolz Classic Mentions
    // @namespace http://tampermonkey.net/
    // @version 3.3
    // @description Классический вид упоминаний
    // @author afericto
    // @match https://lolz.live/*
    // @match https://zelenka.guru/*
    // @grant none
    // @run-at document-end
    // ==/UserScript==

    (function() {
    'use strict';

    function cleanMentions() {
    const mentions = document.querySelectorAll('a.username.mention:not([data-cleaned])');
    mentions.forEach(mention => {
    let username = '';
    let userColor = '';
    let gradient = '';
    let textShadow = '';
    let isBanned = false;

    const strike = mention.querySelector('s');
    if (strike) isBanned = true;

    const innerStyled = mention.querySelector('span, strong, b, font, s');
    const target = innerStyled || mention;
    const style = window.getComputedStyle(target);

    userColor = style.color;
    gradient = style.backgroundImage;
    textShadow = style.textShadow;

    if ((!gradient || gradient === 'none') && innerStyled) {
    const allChildren = mention.querySelectorAll('*');
    for (let child of allChildren) {
    const childStyle = window.getComputedStyle(child);
    if (childStyle.backgroundImage && childStyle.backgroundImage !== 'none' && childStyle.backgroundImage.includes('gradient')) {
    gradient = childStyle.backgroundImage;
    textShadow = childStyle.textShadow;
    break;
    }
    }
    }

    if ((!textShadow || textShadow === 'none') && innerStyled) {
    const allChildren = mention.querySelectorAll('*');
    for (let child of allChildren) {
    const childStyle = window.getComputedStyle(child);
    if (childStyle.textShadow && childStyle.textShadow !== 'none') {
    textShadow = childStyle.textShadow;
    break;
    }
    }
    }

    if (!userColor || userColor === 'rgb(0, 0, 0)' || userColor === 'inherit') {
    const parentStyle = window.getComputedStyle(mention);
    userColor = parentStyle.color;
    }

    if (mention.href) {
    const hrefDotMatch = mention.href.match(/members\/\d+\.(\w+)/);
    if (hrefDotMatch) {
    username = hrefDotMatch[1];
    } else {
    const hrefPlainMatch = mention.href.match(/members\/(\d+)/);
    if (hrefPlainMatch) {
    const text = mention.textContent.trim().replace(/^@+/, '');
    if (text && text.length < 50 && !/^\d+$/.test(text)) username = text;
    }
    }
    }

    if (!username && mention.hasAttribute('data-user')) {
    username = mention.getAttribute('data-user');
    }
    if (!username) {
    const text = mention.textContent.trim().replace(/^@+/, '');
    if (text && text.length < 50 && !/^\d+$/.test(text)) username = text;
    }

    username = username.trim().replace(/^@+/, '');
    const finalNick = '' + username;
    mention.innerHTML = isBanned ? `<s>${finalNick}</s>` : finalNick;

    if (gradient && gradient !== 'none' && gradient.includes('gradient')) {
    mention.style.backgroundImage = gradient;
    mention.style.webkitBackgroundClip = 'text';
    mention.style.webkitTextFillColor = 'transparent';
    mention.style.color = 'transparent';
    mention.style.textShadow = textShadow || 'none';
    } else {
    mention.style.color = userColor;
    mention.style.backgroundImage = 'none';
    mention.style.textShadow = textShadow && textShadow !== 'none' ? textShadow : 'none';
    }

    mention.style.padding = '0';
    mention.style.backgroundColor = 'transparent';
    mention.setAttribute('data-cleaned', 'true');
    });
    }

    cleanMentions();

    let timeout;
    const observer = new MutationObserver(() => {
    clearTimeout(timeout);
    timeout = setTimeout(cleanMentions, 120);
    });
    observer.observe(document.body, { childList: true, subtree: true });

    window.addEventListener('load', cleanMentions);
    })();
     
    This article was useful for you?
    You can thank the author of the topic by transferring funds to your balance
    Thank the author
  2. MeloniuM
    JS

    // ==UserScript==
    // @name Lolz Classic Mentions
    // @namespace http://tampermonkey.net/
    // @version 1.0
    // @description Классический вид упоминаний
    // @author MeloniuM
    // @match https://lolz.live/*
    // @match https://zelenka.guru/*
    // @grant none
    // @run-at document-start
    // ==/UserScript==

    (function() {
    const style = document.createElement('style');
    style.textContent =`
    .username.mention > span:before {
    content: "@";
    }
    .username .avatar {
    display: none;
    }
    a.mention {
    background-color: transparent !important;
    }
    `;
    document.head.appendChild(style);
    })();
     
    1. View previous comments (16)
    2. Патруль Topic starter
      avatarMeloniuM , я не знаю почему, но именно у меня ваще 0 изменений, слышал что тампер на фаерфоксе хреново работает с некоторыми скриптами
    3. MeloniuM
      avatarПатруль , тут нет вещей, которые ломаются в лисе.. проверь включено ли дополнение. Мб в консоли есть ошибки. В DevTools во вкладке Источники(Sources) можно глянуть подгружает ли дополнение.
      [IMG]
    4. Патруль Topic starter
      avatarMeloniuM , чет тыкнул и все заработало
    5. View the next comments (1)
  3. КРИПКРИПОЧЕК
    А собаку убрать можно? без неё же раньше было
     
    1. View previous comments (1)
    2. Патруль Topic starter
    3. Патруль Topic starter
  4. ЦарьОффтопа
    как будто новые зачёт, но стоило бы переработать, и всем понравятся, но а так, годный скрипт )
     
Loading...