szurubooru/public_html/templates/post-content.tpl

56 lines
1.6 KiB
Smarty
Raw Normal View History

<% var postContentUrl = '/data/posts/' + post.name + '?x=' + Math.random() /* reset gif animations */ %>
2014-09-21 10:56:37 +02:00
<div class="post-content post-type-<%= post.contentType %>">
2014-10-25 15:02:46 +02:00
<div class="post-notes-target">
</div>
2014-09-21 10:56:37 +02:00
2014-10-09 09:45:06 +02:00
<% if (post.contentType === 'image') { %>
2014-09-21 10:56:37 +02:00
<div
class="object-wrapper"
data-width="<%= post.imageWidth %>"
data-height="<%= post.imageWidth %>"
style="max-width: <%= post.imageWidth %>px">
2014-10-26 11:09:29 +01:00
<img alt="<%= post.name %>" src="<%= postContentUrl %>"/>
<div class="padding-fix" style="padding-bottom: calc(100% * <%= post.imageHeight %> / <%= post.imageWidth %>)"></div>
2014-10-26 11:09:29 +01:00
</div>
2014-09-21 10:56:37 +02:00
2014-10-09 09:45:06 +02:00
<% } else if (post.contentType === 'youtube') { %>
2014-09-21 10:56:37 +02:00
<div class="object-wrapper">
<iframe src="//www.youtube.com/embed/<%= post.contentChecksum %>?wmode=opaque" allowfullscreen></iframe>
<div class="padding-fix"></div>
</div>
2014-09-21 10:56:37 +02:00
2014-10-09 09:45:06 +02:00
<% } else if (post.contentType === 'flash') { %>
2014-09-21 10:56:37 +02:00
<div class="object-wrapper">
<object
type="<%= post.contentMimeType %>"
width="<%= post.imageWidth %>"
height="<%= post.imageHeight %>"
data="<%= postContentUrl %>">
<param name="wmode" value="opaque"/>
<param name="movie" value="<%= postContentUrl %>"/>
</object>
</div>
2014-09-21 10:56:37 +02:00
2014-10-09 09:45:06 +02:00
<% } else if (post.contentType === 'video') { %>
2014-09-21 10:56:37 +02:00
<div class="object-wrapper">
<% if (post.flags.loop) { %>
<video id="video" controls loop="loop">
<% } else { %>
<video id="video" controls>
<% } %>
2014-09-21 10:56:37 +02:00
<source type="<%= post.contentMimeType %>" src="<%= postContentUrl %>"/>
Your browser doesn't support HTML5 videos.
</video>
</div>
2014-09-21 10:56:37 +02:00
<% } else { console.log(new Error('Unknown post type')) } %>
</div>