szurubooru/public_html/templates/post-content.tpl

41 lines
1.1 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-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
<img alt="<%= post.name %>" src="<%= postContentUrl %>"/>
2014-10-09 09:45:06 +02:00
<% } else if (post.contentType === 'youtube') { %>
2014-09-21 10:56:37 +02:00
<iframe src="//www.youtube.com/embed/<%= post.contentChecksum %>?wmode=opaque" allowfullscreen></iframe>
2014-10-09 09:45:06 +02:00
<% } else if (post.contentType === 'flash') { %>
2014-09-21 10:56:37 +02:00
<object
type="<%= post.contentMimeType %>"
width="<%= post.imageWidth %>"
height="<%= post.imageHeight %>"
data="<%= postContentUrl %>">
<param name="wmode" value="opaque"/>
<param name="movie" value="<%= postContentUrl %>"/>
</object>
2014-10-09 09:45:06 +02:00
<% } else if (post.contentType === 'video') { %>
<% 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>
<% } else { console.log(new Error('Unknown post type')) } %>
</div>