稿定设计去水印

这是一个搞定设计去水印的功能插件

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         稿定设计去水印
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  这是一个搞定设计去水印的功能插件
// @author       zyt
// @match        https://www.focodesign.com/editor/design?id=*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
   window.onload = function() {
       var removeWater = document.createElement("div");
       removeWater.id = 'removeWater';
       removeWater.style.zIndex = '9999';
       removeWater.style.width = '80px';
       removeWater.style.height = '30px';
       removeWater.style.lineHeight = '30px';
       removeWater.style.textAlign = 'center';
       removeWater.style.borderRadius = '10px';
       removeWater.style.background = 'rgb(249 235 183)';
       removeWater.style.color = '#68afe3';
       removeWater.style.position = 'fixed';
       removeWater.style.top = '20px';
       removeWater.style.left = '1070px';
       removeWater.style.cursor = 'pointer';
       removeWater.innerHTML = '去除水印';
       document.body.appendChild(removeWater);
       removeWater.addEventListener('click', function() {
           // 获取要监听的元素
             const elements = document.querySelectorAll('.editor-watermark');
             for (let i = 0; i < elements.length - 1; i++) {
                 let element = elements[i]
                 // 创建一个观察器实例,并传入回调函数
                 const observer = new MutationObserver(function(mutations) {
                     // 遍历每个变化
                     for (const mutation of mutations) {
                         // 如果变化是属性变化,并且是背景色属性
                         if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
                             // 获取新的背景色值
                             const backgroundImage = element.style.backgroundImage;
                             //console.log(i, backgroundImage)
                             if (backgroundImage) {
                                 element.style.backgroundImage = ''
                             }
                         }
                     }
                 });

                 // 开始观察,传入选择器和一个配置对象
                 observer.observe(element, { attributes: true, attributeFilter: ['style'] });
                 element.style.backgroundImage = ''
             }
       });
   };
})();