Skip to content

Instantly share code, notes, and snippets.

@BananaAcid
Last active September 27, 2022 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BananaAcid/920a0af587367101a95a30c546d0162d to your computer and use it in GitHub Desktop.
Save BananaAcid/920a0af587367101a95a30c546d0162d to your computer and use it in GitHub Desktop.

What it basically does:

window.addEventListener('resize', _ => window.innerWidth = window.outerWidth + 300);

Just pasting it into the Developer Tools console does not update it, just jiggle the border to trigger the recalc.

// ==UserScript==
// @name PhotoPea full width
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Use full width - move the ad outside the viewport
// @author BananaAcid
// @match https://www.photopea.com/
// @icon https://www.google.com/s2/favicons?sz=64&domain=photopea.com
// @updateURL https://gist.github.com/BananaAcid/920a0af587367101a95a30c546d0162d/raw/PhotoPea%2520full%2520width.user.js
// @downloadURL https://gist.github.com/BananaAcid/920a0af587367101a95a30c546d0162d/raw/PhotoPea%2520full%2520width.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
function addGlobalStyle(css = '') {
let target = (document.getElementsByTagName('head') || document.getElementsByTagName('body'))[0];
let style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = (css || arguments.length ? arguments[0][0] : '').replaceAll(';', ' !important;');
target.appendChild(style);
}
let fn = _ => {window.innerWidth = window.outerWidth + 300};
window.addEventListener('resize', fn); // worse because of app script being faster: , _ => requestAnimationFrame(fn));
fn(); // initial = on page load
addGlobalStyle`
.topbar > button.fitem.bbtn {
position: relative;
top: -3em;
}
`;
})();
@BananaAcid
Copy link
Author

To use or "install":

  1. you need to have the Tempermonkey plugin installed in your browser
  2. then click on the "Raw" button.

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