Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $iframe = $('.html_photoset iframe');
- $iframe.ready(function() {
- tryChange = setInterval(function() {
- $contents = $iframe.contents();
- $rows = $contents.find('.photoset_row');
- if ($rows.length) {
- clearInterval(tryChange);
- } else {
- return;
- }
- $rows.width('540px').each(function() {
- $row = $(this);
- height = $row.height();
- $(this).height(height / 700 * 540);
- $images = $row.find('img');
- if ($images.length == 1) $images.width('540px');
- if ($images.length == 2) $images.width('268px');
- if ($images.length == 3) $images.width('177px').eq(1).width(
- '178px');
- $links = $row.find('a');
- if ($links.length > 2) $links.css('margin-left', '4px').eq(
- 0).css('margin-left', '0px');
- }).css('margin-top', '4px').eq(0).css('margin-top', '0px');
- setTimeout(function() {
- finalHeight = $contents.find('body').height();
- $iframe.attr('height', finalHeight);
- }, 1000);
- }, 100);
- });
- $iframe.ready(function() {
- var fixZoom = setInterval(function() {
- var $contents = $iframe.contents();
- var $photoset = $contents.find('.photoset');
- var zoom = $photoset.css('zoom');
- var transform = $photoset.css('transform');
- var $rows = $photoset.find('.photoset_row');
- var zoomSet = zoom != null && zoom != "" && zoom < 1;
- var transformSet = transform != null && transform != "" &&
- transform != "none";
- $photoset.css('zoom', '').css('transform', '');
- // Also fix retina.
- var $body = $contents.find('body');
- $body.prepend(
- "<style>\
- img, canvas {\
- image-rendering: optimizeSpeed;\
- image-rendering: -moz-crisp-edges;\
- image-rendering: -o-crisp-edges;\
- image-rendering: -webkit-optimize-contrast;\
- image-rendering: pixelated;\
- image-rendering: optimize-contrast;\
- -ms-interpolation-mode: nearest-neighbor\
- }</style>"
- );
- if (zoomSet || transformSet) clearInterval(fixZoom);
- }, 100);
- });
Advertisement
Add Comment
Please, Sign In to add comment