Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Last active October 9, 2021 19:15
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 unitycoder/96d8168286c067c3e1b1dad9f2e0e1d0 to your computer and use it in GitHub Desktop.
Save unitycoder/96d8168286c067c3e1b1dad9f2e0e1d0 to your computer and use it in GitHub Desktop.
GreaseMonkey plugin : better pixel art image viewer for itch.io
// ==UserScript==
// @name itch.io full screen image viewer
// @namespace https://unitycoder.com
// @description better image viewer lightbox for pixel art images
// @version 1.0
// @include https://*.itch.io/*
// @grant none
// @run-at document-start
// ==/UserScript==
// http://greasemonkey.win-start.de/patterns/add-css.html
function addGlobalStyle(css)
{
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
// set custom styles for these elements
addGlobalStyle('#lightbox_container .lightbox.screenshot_lightbox.animated { width:100%; height:100%;}');
addGlobalStyle('.lightbox.screenshot_lightbox .screenshot_container { width:100%; height:100%;display: flex;}');
addGlobalStyle('.lightbox.screenshot_lightbox .screenshot_container .lb_screenshot { width:100%; height:auto; image-rendering: pixelated; image-rendering: -moz-crisp-edges; object-fit:contain;}');
addGlobalStyle('body.lightbox_open { overflow:auto; !important;}');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment