Skip to content

Instantly share code, notes, and snippets.

@fivetanley
Created October 24, 2012 04:37
Show Gist options
  • Select an option

  • Save fivetanley/3943879 to your computer and use it in GitHub Desktop.

Select an option

Save fivetanley/3943879 to your computer and use it in GitHub Desktop.
require [
"jquery",
"media_comments",
"vendor/swfobject/swfobject",
"jqueryui/dialog",
"jquery.doc_previews",
], ($, _mediaComments, swfobject, _docPreviews ) ->
# Submission Preview for media recording links
$(".play_media_recording_link").click (event) ->
event.preventDefault()
$("#media_recording_box .box_content")
.mediaComment "show_inline",ENV.MEDIA_COMMENT_ID
$(this).remove()
$(".play_media_recording_link").mediaCommentThumbnail()
$("a.flash").click ->
swfobject.embedSWF(
$(this).attr('href'),
"main",
"100%",
"100%",
"9.0.0",
false,
null,
{ wmode: "opaque" },
null
)
false
# Submission Preview for file uploads/online_upload type
if $.filePreviewsEnabled
$('.modal_preview_link').on 'click', ->
# overflow:hidden because of some weird thing where the google doc
# preview gets double scrollbars
$('<div style="padding:0; overflow;hidden;">')
.dialog
title: "Preview of #{$(this).closest('a').text()}"
width: $(document).width() * .95
height: $(document).height() * .75
.loadDocPreview($.extend({height: '100%'}, $(this).data()))
false
# Submission Preview for text submission
$(".data_view").change(->
if $(this).val() is "paper"
$("#submission_preview").removeClass("plain_text").addClass "paper"
else
$("#submission_preview").removeClass("paper").addClass "plain_text"
).change()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment