n/programu/chendaye · 2025-04-15
注册 登录
n/program · 2025-04-15 · 614 次浏览
u/chendaye白银

【油猴脚本】白嫖NL装饰

趁着NL切换到Discourse之前送一波福利

[clip mp4="https://i.imgur.com/7A4y6oP.mp4"]
将脚本内的~~</s>userName<e>值改为自己的</s>用户名<e>,一定注意是</s>用户名<e>而不是</s>昵称<e>

// ==UserScript==
// @name         白嫖NodeLoc装饰
// @namespace    QQ:94575594
// @version      1.0
// @description  免费使用装饰店的头像边框与用户名颜色特效
// @author       chendaye
// @grant        GM_addStyle
// @match        [https://3fr3h3j3w3w33gh3.pages.dev/](/)*
// @run-at       document-end
// @license MIT
// @downloadURL https://update.greasyfork.org/scripts/531714/%E7%99%BD%E5%AB%96NodeLoc%E8%A3%85%E9%A5%B0.user.js
// @updateURL https://update.greasyfork.org/scripts/531714/%E7%99%BD%E5%AB%96NodeLoc%E8%A3%85%E9%A5%B0.meta.js
// ==/UserScript==

(function () {

    const config = {
        userName: 'chendaye',
        delay: 500
    }


    const debounce = (func, delay) =&gt; {
        let timeout;
        return (...args) =&gt; {
            clearTimeout(timeout);
            timeout = setTimeout(() =&gt; func.apply(this, args), delay);
        };
    };

    const replaceUserName = (node) =&gt; {
        if (node == null)
            document.querySelectorAll(`[username="${config.userName}"]`).forEach(item =&gt; replaceUserName(item));
        else {
            let lable = node.parentNode.querySelector(".username")
            if (!lable) {
                replaceUserName(node.parentNode)
            } else {
                if (lable.querySelector(localStorage.userNameStyle)) {
                    return
                }
                lable.className = 'username ' + localStorage.userNameStyle
            }
        }
    }

    const insertBtn = () =&gt; {
        document.querySelectorAll('.DecorationStoreLabel').forEach(label =&gt; {
            if (label.querySelector('.btnPiao')) return;

            if (label.previousElementSibling.querySelector(".DecorationItemAvatarImage")) {
                const btn = Object.assign(document.createElement('button'), {
                    className: 'btnPiao DecorationItemLabel',
                    innerHTML: '白嫖头像边框',
                    onclick: (e) =&gt; handleImageStorage(label, e)
                });

                label.appendChild(btn);
            }
            else if (label.previousElementSibling.querySelector(".decorationItemUsernameColorStyle")) {
                const btn = Object.assign(document.createElement('button'), {
                    className: 'btnPiao DecorationItemLabel',
                    innerHTML: '白嫖用户名颜色',
                    onclick: (e) =&gt; handleUserNameStyle(label, e)
                });

                label.appendChild(btn);
            }
        });
    }

    const handleUserNameStyle = (label, event) =&gt; {
        try {
            // 阻止事件冒泡
            if (event.stopPropagation) {
                event.stopPropagation();
            } else {
                event.cancelBubble = true;
            }
            const container = label.closest('.DecorationStoreContainer');
            const style = container?.querySelector('.decorationItemUsernameColorStyle div');
            localStorage.userNameStyle = style.className

        } catch (e) {
            console.error('白嫖失败:', e);
        }
        replaceUserName();
    }

    const handleImageStorage = (label, event) =&gt; {
        try {
            // 阻止事件冒泡
            if (event.stopPropagation) {
                event.stopPropagation();
            } else {
                event.cancelBubble = true;
            }
            const container = label.closest('.DecorationStoreContainer');
            const img = container?.querySelector('.DecorationItemAvatarImage');

            if (img?.src) {
                localStorage.avatarUrl = img.src
            }
        } catch (e) {
            console.error('白嫖失败:', e);
        }
        replaceAvatar();
    };

    const replaceAvatar = () =&gt; {
        const storedSrc = localStorage.avatarUrl;
        if (!storedSrc) return;

        document.querySelectorAll(`[username="${config.userName}"]`).forEach(userContainer =&gt; {
            const images = userContainer.querySelectorAll('img');
            images.forEach(img =&gt; {
                if (img.src !== storedSrc) {
                    img.src = storedSrc;
                }
            });
        });
    };

    const begin = () =&gt; {
        replaceAvatar();
        replaceUserName();
        insertBtn();
    }

    const observer = new MutationObserver(debounce((mutationsList =&gt; {
        mutationsList.forEach(mutation =&gt; {
            if (mutation.type === 'childList') {
                mutation.addedNodes.forEach(node =&gt; {
                    begin()
                });
            }
        });
    }), config.delay));

    observer.observe(document.body, {
        childList: true,
        subtree: true
    })

    begin();



    GM_addStyle(`
        @keyframes slideIn {
            from { transform: translateX(100%); }
            to { transform: translateX(0); }
        }
        .btnPiao {
            background: #4834d4;
            border: none;
            color: white !important;
            cursor: pointer;
            transition: all 0.3s;
            margin-left: 5px;
        }
        .btnPiao:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px #4834d4;
        }
    `);
})();
<e>```</e></r>
1
22
登录后参与讨论。
海外原生IP VPS,稳定访问全球网络

还在为IP不纯、平台风控、频繁验证而烦恼? 丽萨主机海外原生IP VPS,双ISP住宅IP,覆盖美国、香港、日本、新加坡、台湾、德国、越南、英国等热门地区,适合跨境电商、社媒运营、AI工具、流媒体及海外业务使用。

lisahost.com 了解更多

22 条回复

排序
  1. LuckyFixate 黄金 不离不弃 2025-04-15

    好帖,感谢op分享!

    0
  2. CoolMan 钻石 3 YEARS 2025-04-15

    感谢大佬,这个只能自己看见吧

    0
  3. chendaye 白银 楼主 2025-04-15

    @"CoolMan"#p296182 对

    0
  4. LOUISTANG 钻石 2 YEARS 2025-04-15

    厉害了

    0
  5. azhaoyihao 荣耀 水王 2025-04-15

    6 还能这样 谢佬分享

    0
  6. xiaozx 💤 黄金 3 YEARS 2025-04-15

    感谢很赞!自己看看过瘾:huaji02:

    0
  7. XMOhost1014 😗 白银 不离不弃 2025-04-15

    慢慢攢NL 先過過乾癮
    謝謝大佬

    0
  8. a13719481124 黄金 端午安康 2025-04-15

    谢佬分享 先自娱自乐一下 看看能不能用

    0
  9. chendaye 白银 楼主 2025-04-15

    @"xinlan"#p296254 记得改</s>用户名<e>

    0
  10. kvsn4p9mtz 钻石 3 YEARS 2025-04-15

    如果不是自娱自乐,会不会被站长打屁股,哈哈

    0
  11. kissbye 钻石 2025-04-15

    好家伙,人才呀

    0
  12. chendaye 白银 楼主 2025-04-15

    @"Vsmile"#p296307 之前的签到脚本不就被kill了吗

    0
  13. CoffeeWithoutSugar 黄金 2025-04-15

    牛牪犇啊

    0
  14. gzonlin 白银 2025-04-15

    自慰版?

    0
  15. chendaye 白银 楼主 2025-04-15

    @"GLin"#p296418 对

    0
  16. meihang 白银 2025-04-15

    牛逼:xhj06:

    0
  17. lanse8899 白银 2025-04-15

    这个非诚不错

    0
  18. justDoit 黄金 不离不弃 2025-04-15

    自己骗下自己就很舒服了

    0
  19. haru001 黄金 2025-04-15

    学习了 感谢分享

    0
  20. chendaye 白银 楼主 2025-04-16

    脚本已更新
    新增白嫖用户卡背景图片

    ```javascript
    // ==UserScript==
    // @name 白嫖NodeLoc装饰
    // @namespace QQ:94575594
    // @version 1.2
    // @description 免费使用装饰店的头像边框、用户名颜色特效、用户卡背景图片
    // @Author chendaye
    // @grant GM_addStyle
    // @match https://3fr3h3j3w3w33gh3.pages.dev/*
    // @run-at document-end
    // @license MIT
    // @downloadURL https://update.greasyfork.org/scripts/531714/%E7%99%BD%E5%AB%96NodeLoc%E8%A3%85%E9%A5%B0.user.js
    // @updateURL https://update.greasyfork.org/scripts/531714/%E7%99%BD%E5%AB%96NodeLoc%E8%A3%85%E9%A5%B0.meta.js
    // ==/UserScript==

    (function() {

    const config = {
    userName: '替换为自己的用户名',
    delay: 500
    }

    const debounce = (func, delay) => {
    let timeout
    return (...args) => {
    clearTimeout(timeout)
    timeout = setTimeout(() => func.apply(this, args), delay)
    }
    }

    const replaceUserName = (node) => {
    if (node == null)
    document.querySelectorAll([username="${config.userName}"]).forEach(item => replaceUserName(item))
    else {
    let lable = node.parentNode.querySelector('.username')
    if (!lable) {
    replaceUserName(node.parentNode)
    } else {
    if (lable.querySelector(localStorage.userNameStyle)) {
    return
    }
    lable.className = 'username ' + localStorage.userNameStyle
    }
    }
    }

    const insertBtn = () => {
    document.querySelectorAll('.DecorationStoreLabel').forEach(label => {
    if (label.querySelector('.btnPiao')) return

      if (label.previousElementSibling.querySelector('.DecorationItemAvatarImage')) {
        const btn = Object.assign(document.createElement('button'), {
          className: 'btnPiao DecorationItemLabel',
          innerHTML: '白嫖头像边框',
          onclick: (e) =&gt; handleImageStorage(label, e)
        })
    
        label.appendChild(btn)
      } else if (label.previousElementSibling.querySelector('.decorationItemUsernameColorStyle')) {
        const btn = Object.assign(document.createElement('button'), {
          className: 'btnPiao DecorationItemLabel',
          innerHTML: '白嫖用户名颜色',
          onclick: (e) =&gt; handleUserNameStyle(label, e)
        })
    
        label.appendChild(btn)
      } else if (label.previousElementSibling.querySelector('.DecorationItemProfileBackgroundImage')) {
        const btn = Object.assign(document.createElement('button'), {
          className: 'btnPiao DecorationItemLabel',
          innerHTML: '白嫖用户卡背景',
          onclick: (e) =&gt; handleUserBackGroundImg(label, e)
        })
    
        label.appendChild(btn)
      } else if (label.previousElementSibling.querySelector('.DecorationItemProfileBackgroundVideo')) {
        const btn = Object.assign(document.createElement('button'), {
          className: 'btnPiao DecorationItemLabel',
          innerHTML: '白嫖用户卡背景',
          onclick: (e) =&gt; handleUserBackGroundVideo(label, e)
        })
    
        label.appendChild(btn)
      }
    })
    

    }

    const handleUserNameStyle = (label, event) => {
    try {
    // 阻止事件冒泡
    if (event.stopPropagation) {
    event.stopPropagation()
    } else {
    event.cancelBubble = true
    }
    const container = label.closest('.DecorationStoreContainer')
    const style = container?.querySelector('.decorationItemUsernameColorStyle div')
    localStorage.userNameStyle = style.className

    } catch (e) {
      console.error('白嫖失败:', e)
    }
    replaceUserName()
    

    }

    const handleImageStorage = (label, event) => {
    try {
    // 阻止事件冒泡
    if (event.stopPropagation) {
    event.stopPropagation()
    } else {
    event.cancelBubble = true
    }
    const container = label.closest('.DecorationStoreContainer')
    const img = container?.querySelector('.DecorationItemAvatarImage')

      if (img?.src) {
        localStorage.avatarUrl = img.src
      }
    } catch (e) {
      console.error('白嫖失败:', e)
    }
    replaceAvatar()
    

    }

    const handleUserBackGroundImg = (label, event) => {
    try {
    // 阻止事件冒泡
    if (event.stopPropagation) {
    event.stopPropagation()
    } else {
    event.cancelBubble = true
    }
    let container
    let imgSrc = ''
    if (label.previousElementSibling.childNodes.length && label.previousElementSibling.childNodes[0].className === 'DecorationItemProfileBackgroundImage') {
    container = label.previousElementSibling.childNodes[0]
    if (container) {
    imgSrc = container?.style.backgroundImage
    }
    }
    localStorage.backgroundImgUrl = imgSrc
    } catch (e) {
    console.error('白嫖失败:', e)
    }
    replaceBgImg()
    }

    const handleUserBackGroundVideo = (label, event) => {
    try {
    // 阻止事件冒泡
    if (event.stopPropagation) {
    event.stopPropagation()
    } else {
    event.cancelBubble = true
    }
    let container
    let imgSrc = ''
    if (label.previousElementSibling.childNodes.length && label.previousElementSibling.childNodes[0].className === 'DecorationItemProfileBackgroundVideo') {
    container = label.previousElementSibling.childNodes[0].childNodes[0]
    if (container) {
    imgSrc = container.src
    }
    }
    localStorage.backgroundImgUrl = imgSrc
    } catch (e) {
    console.error('白嫖失败:', e)
    }
    replaceBgImg()
    }

    const replaceAvatar = () => {
    const storedSrc = localStorage.avatarUrl
    if (!storedSrc) return

    document.querySelectorAll(`[username="${config.userName}"]`).forEach(userContainer =&gt; {
      const images = userContainer.querySelectorAll('img')
      images.forEach(img =&gt; {
        if (img.src !== storedSrc) {
          img.src = storedSrc
        }
      })
    })
    

    }

    const replaceBgImg = () => {
    const storedSrc = localStorage.backgroundImgUrl
    if (!storedSrc) return
    console.log(storedSrc)
    document.getElementsByClassName('username').textContent = ''
    document.querySelectorAll([username="${config.userName}"]).forEach(userContainer => {
    console.log(userContainer.closest('.UserCard'))
    let cardElement = userContainer.closest('.UserCard')
    if (cardElement && !cardElement.querySelector('video')) {
    if (cardElement) {
    if (storedSrc.includes('mp4')) {
    cardElement.style.background = 'transparent'
    cardElement.style.overflow = 'hidden'
    const video = document.createElement('video')
    video.src = storedSrc
    video.autoplay = true
    video.loop = true
    video.muted = true
    video.playsinline = true
    video.controls = false
    video.style.position = 'absolute'
    video.style.top = '0'
    video.style.left = '0'
    video.style.width = '100%'
    video.style.zIndex = '-1'
    if (cardElement.className.includes('UserHero')) {
    cardElement.style.position = 'relative'
    video.style.transform = 'translateY(-50%)'
    }
    cardElement.appendChild(video)
    } else {
    cardElement.style.backgroundImage = storedSrc
    cardElement.style = background-image: ${storedSrc}; background-size: cover; background-position: center;
    }
    }
    }
    })
    }
    const begin = () => {
    replaceAvatar()
    replaceUserName()
    replaceBgImg()
    insertBtn()
    }
    const observer = new MutationObserver(debounce((mutationsList => {
    mutationsList.forEach(mutation => {
    if (mutation.type === 'childList') {
    mutation.addedNodes.forEach(node => {
    begin()
    })
    }
    })
    }), config.delay))

    observer.observe(document.body, {
    childList: true,
    subtree: true
    })

    begin()

    GM_addStyle(@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } } .btnPiao { background: #4834d4; border: none; color: white !important; cursor: pointer; transition: all 0.3s; margin-left: 5px; } .btnPiao:hover { transform: translateY(-1px); box-shadow: 0 4px 12px #4834d4; })
    })()

    ```

    0
  21. ClassmateShen ⭐️ 王者 MANAGER 2025-04-17

    NL会不会切换到discourse不好说

    0
  22. chendaye 白银 楼主 2025-04-17

    @"叫我沈同学"#p297489 :xhj23:

    0