Greasy Fork is available in English.

讨论 » 创建请求

A userscript to make that slideshow display the smaller images as 1:1, not fit-to-screen

§
发表于:2015-02-07
编辑于:2015-12-14

A userscript to make that slideshow display the smaller images as 1:1, not fit-to-screen

It's about this site (somedomain.com)

Clicking on an image starts a lightbox-like slideshow.
The problem is that it stretches even the smaller images
to fit in the browser window (not only the large ones)

I've examined the page javascript code in Firefox debugger (the somedomain.js file)
and I've noticed that whenever you click on an image(and so, the slideshow starts)
the function SlideShow(e, gitem) gets called,
which in terms calls the function SlideShow_Zoom(imgdiv, obj, zoom).

The latter examines the image's dimensions and the browser window's size
and accordingly creates an inline CSS rule for the image height (and width),
eg: (for my 1920x1200 display)

element {
    width: auto;
    height: 1084px;
}

or

element {
    width: 1543px;
    height: auto;
}

which effectively makes the image be displayed as resized.

So, what I'm asking is a script
that would make the slideshow display only the large images as fit-to-screen
(the smaller images to appear as they are, 1:1 )

woxxom管理员
§
发表于:2015-02-07
编辑于:2015-12-14

Seems like an easy task for Stylish using this userstyle if you don't mind:

v2:

@-moz-document domain("somedomain.com") {
  body > div[style*="fixed"] > div[style*="center"] > img {
    width: auto!important;
    height: auto!important;
    max-width: 100%;
    max-height: 100%;
    margin:auto!important;
    left:0!important; right:0!important; top:0!important; bottom:0!important;
    position:absolute;
  }
}
§
发表于:2015-02-07
编辑于:2015-02-07

Thank you very much for trying to help!

Two notes, please:
1. It doesn't seem to work for some small images
eg. 1593446 or 1575888 appear resized.
2. It makes even the large images be displayed as 1:1, eg 1564118.
Could this be avoided?

woxxom管理员
§
发表于:2015-02-07

Yup, easily! See the updated post above.

§
发表于:2015-02-07
编辑于:2015-02-07

Thank you!!!

发表回复

登录以发表回复。