Greasy Fork

来自缓存

Greasy Fork is available in English.

LZTLinkPreview

Add preview overlay to more links in the Zelenka.guru

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         LZTLinkPreview
// @namespace    MeloniuM/LZT
// @version      1.1
// @description  Add preview overlay to more links in the Zelenka.guru
// @author       MeloniuM
// @license      MIT
// @match        http*://zelenka.guru/*
// @match        http*://lolz.live/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const selectors = [
        '.forum_list .text_Ads',//в рекламе спика раздела
        '.thread_view',//в темах
        '.ImViewContent, .conversationMessages',//в диалогах
        '.profilePage .messageSimpleList',//в профиле
    ];

    function addPreview(elem){
        $(elem).addClass('PreviewTooltip');
        const url = new URL(elem.href);
        $(elem).attr('data-previewurl', url.pathname.slice(1, -1) + '/preview');
        XenForo.PreviewTooltip($(elem));
    }

    $(document).ready(function(){
        if (!$('div#PreviewTooltip').length){
            $('.pageContent').append($('<div id="PreviewTooltip"><div class="previewContent"><span class="PreviewContents">Загрузка...</span></div></div>'));
        }

        $(selectors.join()).find('a[href$="/"]:not(.PreviewTooltip, [href*="?"])').filter('[href^="/threads/"], [href^="https://zelenka.guru/threads/"], [href^="https://lolz.live/threads/"]').each(function(index){
            addPreview(this);
        });
    });

    $(selectors.join()).on('DOMNodeInserted', function(event) {//при добавлении сообщения //.find('a[href^="https://zelenka.guru/threads/"], a[href^="https://lolz.live/threads/]"').filter('a[href$="/"]:not(.PreviewTooltip)')
        $(event.target).find('a[href$="/"]:not(.PreviewTooltip, [href*="?"])').filter('[href^="https://zelenka.guru/threads/"], [href^="https://lolz.live/threads/"]').each(function( index ) {
            if ($(this).closest('.chat2-inputBox, .LolzteamEditorSimple').length) return;
            addPreview(this);
        });
    });
})();