Skip to content

Instantly share code, notes, and snippets.

@dimmuboy
Last active September 24, 2023 01:14
Show Gist options
  • Save dimmuboy/9cabde3d0da76a77b6568670094d2be9 to your computer and use it in GitHub Desktop.
Save dimmuboy/9cabde3d0da76a77b6568670094d2be9 to your computer and use it in GitHub Desktop.
Photopea without ads
// ==UserScript==
// @name Photopea
// @namespace www.photopea.com
// @description Photopea without ads
// @include https://www.photopea.com/
// @version 1.2
// @run-at document-end
// ==/UserScript==
function removeAds(){
// remove ads bar
var adsBar = document.getElementsByClassName('rightmost');
for (var l = 0; l < adsBar.length; l++) {
var ads = adsBar[l];
console.log(ads);
ads.remove();
}
// expand document area
var mainblock = document.getElementsByClassName('mainblock');
mainblock[0].style.width = '100%';
var panelhead = document.getElementsByClassName('panelhead');
panelhead[0].style.maxWidth = '100%';
panelhead[0].nextSibling.style.width = '100%';
// unify color for links
var account = document.getElementsByClassName('fitem bbtn');
account[0].remove();
var panelmainblock = document.getElementsByClassName('panelblock mainblock');
panelmainblock[0].style.width = '100%';
var topbar = document.getElementsByClassName('topbar')[0].parentNode;
topbar.style.width = '100%';
var topbar2 = document.getElementsByClassName('topbar')[0].parentNode.parentNode;
topbar2.style.width = '100%';
var mainblockNew = document.getElementsByClassName('flexrow app')[0].firstElementChild;
mainblockNew.style.width = '100%';
var rightblockNew = document.getElementsByClassName('flexrow app')[0].lastElementChild;
rightblockNew.remove();
var links = document.getElementsByClassName('topfloat');
for (var i = 0; i < links.length; i++) {
var a = links[i].getElementsByTagName('a');
for (var j = 0; j < a.length; j++) {
var elem = a[j];
elem.style.backgroundColor = 'var(--bg-bbtn)';
}
}
}
(function () {
'use strict';
setTimeout(removeAds, 1000);
})();
@PmE8HW0KRfqa
Copy link

How do you run this?

@dimmuboy
Copy link
Author

It's script for Tampermonkey but I don't use it long time so I don't know if it still works. Your feedback is welcome :)

@Ademking
Copy link

Ademking commented Nov 4, 2021

It doesn't work

@dimmuboy
Copy link
Author

dimmuboy commented Nov 7, 2021

It doesn't work

You can try it now but there is still issue when you open canvas because this is calculated automatically

@e-t-l
Copy link

e-t-l commented Sep 24, 2023

Hilariously, when I ran this script, it completely hid the UI and maximized the ads. Guessing the Photopea dev found this gist and didn't take too kindly to it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment