Skip to content

Commit

Permalink
image expansion;
Browse files Browse the repository at this point in the history
  • Loading branch information
cc-d committed Oct 20, 2019
1 parent 97fbcf8 commit 3b45ebe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions static/expand-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ $(document).ready(function() {
if (maxWidth <= widthBreak) {
maxWidth = maxWidth + 80; // thumbnail will be hidden on expansion, it is 80px
}
$("<style type='text/css'> .expanded-post-image { max-width: 100%; max-width: -webkit-fill-available;'" +
" max-width: -moz-avaliable;max-height: " +
(maxWidth) + "px; } </style>").appendTo("body");
$("<style type='text/css'> .expanded-post-image {max-height: " + (maxWidth) + "px; } </style>").appendTo("body");

pe = $('#is-pre-expanded');
if (pe != undefined) {
Expand Down Expand Up @@ -75,6 +73,7 @@ function expandPost(pid, ptype, vid) {

if (vid == false) {
realsource = $('#expand-src-' + pid);
realsource.attr('max-width', '100%');
src = realsource.attr('realsrc');
realsource.attr('src', src);
realsource.html(realsource);
Expand Down
2 changes: 1 addition & 1 deletion templates/sub_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
{% if post.video %}
<iframe id='vid-{{ post.id }}' style='display: none;' class='vidembed' width="420" height="315" realsrc="{{ post.video }}"></iframe>
{% elif post.remote_image_url %}
<a href="{{ post.remote_image_url }}"><img class='expanded-post-image rounded' id='expand-src-{{ post.id }}' realsrc="{{ post.remote_image_url }}" ></a>
<a href="{{ post.remote_image_url }}"><img style='max-width: 100%;' class='expanded-post-image rounded' id='expand-src-{{ post.id }}' realsrc="{{ post.remote_image_url }}" ></a>
{% else %}
<div class='expanded-selftext rounded'>
<div class='inner-selftext-wrapper'>
Expand Down

0 comments on commit 3b45ebe

Please sign in to comment.