LZTHideCopyButton

Расширение позволяет копировать соддержимое хайда по кнопке

当前为 2023-05-23 提交的版本,查看 最新版本

// ==UserScript==
// @name         LZTHideCopyButton
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Расширение позволяет копировать соддержимое хайда по кнопке
// @author       MeloniuM
// @license MIT
// @match        *://zelenka.guru/threads/*
// @match        *://lzt.market/threads/*
// @match        *://lolz.guru/threads/*
// @match        *://lolz.live/threads/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function addButton(elem) {
        if (!(elem instanceof HTMLElement)) return;
        let i = document.createElement('i')
        i.setAttribute('class', 'fa fa-copy HideCopy')
        i.setAttribute('aria-hidden', 'true')
        i.style.marginLeft = '5px'
        elem.appendChild(i)
    }
    $( document ).ready(function() {//при загрузке
        $('.bbCodeBlock.bbCodeQuote.bbCodeHide').each(function( index ) {
            addButton($( this ).find('.attribution.type')[0])
        });
    });

    $('.messageList').on('DOMNodeInserted', function(event) {//при добавлении сообщения
        $(event.target).find('.bbCodeBlock.bbCodeQuote.bbCodeHide').each(function( index ) {
            addButton($( this ).find('.attribution.type')[0])
        });
    });
    $('.bbCodeBlock.bbCodeQuote.bbCodeHide .attribution.type .HideCopy').on('click', function(event) {//при клике
        let quote = $(event.target).closest('.bbCodeBlock.bbCodeQuote.bbCodeHide').find('.quote')[0]
        var range = document.createRange();
        range.selectNode(quote);
        window.getSelection().removeAllRanges();
        window.getSelection().addRange(range);
        document.execCommand('copy');
    })
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址