Greasy Fork

来自缓存

Greasy Fork is available in English.

Photopea adds remover

Remove ads from photopea (works on mobile)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Photopea adds remover
// @namespace    https://www.photopea.com/
// @version      2025-09-22
// @description  Remove ads from photopea (works on mobile)
// @author       pooiod7
// @match        https://*.photopea.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=photopea.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function addCustomEvent() {
        // mobile devices get adds on the bottom
        if (window.screen.width < 750 && /Mobile|Android|iPhone|iPad/i.test(navigator.userAgent)) {
            document.addEventListener('resizecanvas', () => {
                // push the ads container outside of the viewport
                window.innerHeight = document.documentElement.clientHeight + (100);
                document.body.style.overflow = "hidden";
            });
        } else {
            const observer=new MutationObserver(m=>{m.forEach(r=>{r.addedNodes.forEach(n=>{if(n.nodeType===1&&n.matches('.contextpanel'))n.style.transform='translateX(180px)';})})});
            observer.observe(document.body,{childList:true,subtree:true});
            const ADS_WIDTH = window.screen.width < 1180 ? 180 : 320;
            document.addEventListener('resizecanvas', () => {
                // push the ads container outside of the viewport
                window.innerWidth = document.documentElement.clientWidth + (ADS_WIDTH);
                document.body.style.marginLeft = "-180px";
            });
        }
    }
    // inject our custom event listener into the "main world"
    document.documentElement.setAttribute('onreset', `(${addCustomEvent})()`);
    document.documentElement.dispatchEvent(new CustomEvent('reset'));
    document.documentElement.removeAttribute('onreset');
    function resize(event = {}) {
        if (!event.skip) {
            document.dispatchEvent(new CustomEvent('resizecanvas'));
            // trigger another resize event to update any listeners with the new window.innerWidth
            const resizeEvent = new Event('resize');
            resizeEvent.skip = true;
            window.dispatchEvent(resizeEvent);
        }
    }
    let debounce;
    window.addEventListener('resize', event => {
        clearTimeout(debounce);
        debounce = setTimeout(() => resize(event), 100);
    });
    resize();
})();