Skip to content

Commit 37b74ec

Browse files
committed
embed flash, dont load in iframe so wmode is set
Change-Id: I07dbdbdda9a5e53bb47ed91d15af4d665081af03 fixes: #3541 "Flash file blocks Feedback window" Reviewed-on: https://gerrit.instructure.com/2209 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Brian Whitmer <brian@instructure.com>
1 parent 148e66a commit 37b74ec

1 file changed

Lines changed: 34 additions & 19 deletions

File tree

app/views/files/show.html.erb

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,22 @@
1313
<% end %>
1414
</div>
1515
<% else %>
16-
<% if @attachment.inline_content? %>
16+
<% if @attachment.content_type == "application/x-shockwave-flash" %>
17+
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="500">
18+
<param name="movie" value="<%= safe_domain_file_url(@attachment) %>" />
19+
<param name="wmode" value="transparent" />
20+
<param name="allowscriptaccess" value="never" />
21+
<!--[if !IE]>-->
22+
<object type="application/x-shockwave-flash" data="<%= safe_domain_file_url(@attachment) %>" width="100%" height="500">
23+
<param name="wmode" value="transparent" />
24+
<param name="allowscriptaccess" value="never" />
25+
<!--<![endif]-->
26+
<!--[if !IE]>-->
27+
</object>
28+
<!--<![endif]-->
29+
</object>
30+
<a style="display:block;" href="<%= safe_domain_file_url(@attachment) %>">Download <%= @attachment.display_name %></a>
31+
<% elsif @attachment.inline_content? %>
1732
<% jammit_js :file_inline %>
1833
<iframe id="file_content" src="<%= safe_domain_file_url(@attachment) %>" style="width: 100%; height: 400px;"></iframe>
1934
<% elsif @attachment.content_type && @attachment.content_type.match(/\Aimage\//) %>
@@ -26,25 +41,25 @@
2641
</span> (<%= @attachment.readable_size %>)
2742
<% if @attachment.scribdable? && @attachment.scribd_doc %>
2843
<div id="scribd_preview" data-doc-id="<%= @attachment.scribd_doc.doc_id %>" data-access-key="<%= @attachment.scribd_doc.access_key %>"></div>
44+
<% js_block do %>
45+
<script>
46+
$(function() {
47+
$('#scribd_preview').ifExists(function($preview){
48+
var sd = scribd.Document.getDoc( $preview.data('doc-id'), $preview.data('access-key') );
49+
$.each({
50+
'jsapi_version': 1,
51+
'disable_related_docs': true,
52+
'height' : '400px'
53+
}, function(key, value){
54+
sd.addParam(key, value);
55+
});
56+
sd.write('scribd_preview');
57+
});
58+
});
59+
</script>
60+
<% end %>
2961
<% end %>
3062
<% end %>
3163
<% end %>
3264
<%= render :partial => 'shared/sequence_footer', :locals => {:asset => @attachment} %>
33-
<% js_block do %>
34-
<script>
35-
$(document).ready(function() {
36-
var $preview = $("#scribd_preview");
37-
if($preview.length) {
38-
var sd = scribd.Document.getDoc( $preview.attr('data-doc-id'), $preview.attr('data-access-key'));
39-
$.each({
40-
'jsapi_version': 1,
41-
'disable_related_docs': true,
42-
'height' : '400px'
43-
}, function(key, value){
44-
sd.addParam(key, value);
45-
});
46-
sd.write($preview.attr('id'));
47-
}
48-
});
49-
</script>
50-
<% end %>
65+

0 commit comments

Comments
 (0)