Дискусии » Заявки за създаване

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

§
Публикуван на: 07.02.2015
Редактиран на: 14.12.2015

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Мод
§
Публикуван на: 07.02.2015
Редактиран на: 14.12.2015

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;
  }
}
§
Публикуван на: 07.02.2015
Редактиран на: 07.02.2015

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Мод
§
Публикуван на: 07.02.2015

Yup, easily! See the updated post above.

§
Публикуван на: 07.02.2015
Редактиран на: 07.02.2015

Thank you!!!

Публикувайте отговор

Влезте, за да публикувате отговор.