Greasy Fork

解除知识星球选择内容及复制限制

支持星球首页、搜索结果页、文章页

当前为 2023-02-12 提交的版本,查看 最新版本

// ==UserScript==
// @name         解除知识星球选择内容及复制限制
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  支持星球首页、搜索结果页、文章页
// @author       vimcaw
// @match        *://*.zsxq.com/*
// @icon         https://www.google.com/s2/favicons?domain=zsxq.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function removeLimitation() {
        const disabledCopyElements = document.querySelectorAll('.disabled-copy, .js-disable-copy');
        if (disabledCopyElements) {
            disabledCopyElements.forEach(element => {
                element.classList.remove('disabled-copy');
                element.classList.remove('js-disable-copy');
            });
        }
        const watermarkElements = document.querySelectorAll('[watermark]');
        if (watermarkElements) {
            watermarkElements.forEach(element => {
                element.setAttribute('style', 'padding: 10px;')
            });
        }
    }

    // Create an observer instance linked to the callback function
    const observer = new MutationObserver(removeLimitation);

    // Start observing the target node for configured mutations
    observer.observe(document.body, { childList: true, subtree: true });
    removeLimitation();
})();