58 lines
2.2 KiB
Plaintext
58 lines
2.2 KiB
Plaintext
<%
|
|
autoplay_video = false
|
|
hide_video_tools = false
|
|
snapshot_url = @video_image.get_snapshot_url
|
|
@is_frontend = true
|
|
video_scale = (@video_image.scale ? @video_image.scale : 56.25)
|
|
%>
|
|
<style>
|
|
.video_box_wrap{
|
|
height: 0;
|
|
padding-bottom: <%=video_scale%>%;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
.video_box{
|
|
width: 100%;
|
|
height: 100%;
|
|
position: absolute;
|
|
}
|
|
.video_yt_box iframe{
|
|
width: 100%;
|
|
height: 100%;
|
|
position: absolute;
|
|
}
|
|
</style>
|
|
<% if @video_image.is_youtube %>
|
|
<div class="video_yt_box video_box_wrap">
|
|
<iframe id="muteYouTubeVideoPlayer" frameborder="0" allowfullscreen="1"src="<%= @video_image.embed_url %>"></iframe>
|
|
</div>
|
|
<% else %>
|
|
<%= stylesheet_link_tag("video_pro/jplayer.blue.monday.min.css") %>
|
|
<%= javascript_include_tag("video_pro/jquery.jplayer.min.js") %>
|
|
<div class="video_box_wrap" data-auto-height="true">
|
|
<div class="video_box jplayer_slide">
|
|
<%= render partial: "admin/video_pros/jplayer", locals:{i: "video_file",file_name: @video_image.title,file_url: @video_image.video_file.url,file_webm_url: @video_image.video_file_webm.url,:@autoplay_video=> autoplay_video,:@apply_autoplay_script=>true,:@hide_video_tools=> hide_video_tools,:@is_frontend=>true,:@file_poster=> snapshot_url,:@bind_autoheight_callback=>'window.fix_video_modal_width'} %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<script type="text/javascript">
|
|
window.fix_video_modal_width = function(){
|
|
var modal = $('.video_box_wrap').parents('.modal');
|
|
var $window = $(window);
|
|
if(modal.length != 0){
|
|
var modal_dialog = modal.find('.modal-dialog');
|
|
var font_size = parseFloat(modal_dialog.css('font-size'));
|
|
modal_dialog.css('width', '');
|
|
modal_dialog.width(Math.min(1.0 * $window.height() / (modal_dialog.height() + font_size * 7.5) * modal_dialog.width(), $window.width() - 20));
|
|
$window.resize(function(){
|
|
modal_dialog.css('width', '');
|
|
var font_size = parseFloat(modal_dialog.css('font-size'));
|
|
modal_dialog.width(Math.min(1.0 * $window.height() / (modal_dialog.height() + font_size * 7.5) * modal_dialog.width(), $window.width() - 20));
|
|
})
|
|
}
|
|
}
|
|
$(document).ready(function(){
|
|
window.fix_video_modal_width();
|
|
})
|
|
</script> |