diff --git a/public/javascripts/media_comments.js b/public/javascripts/media_comments.js index c0074ca5328..90223e653ba 100644 --- a/public/javascripts/media_comments.js +++ b/public/javascripts/media_comments.js @@ -17,14 +17,11 @@ */ define([ - 'swfobject', 'i18n!media_comments', 'underscore', 'vendor/jquery.ba-tinypubsub', 'jquery' /* $ */, 'str/htmlEscape', - 'jst/MediaComments', - 'compiled/media_comments/js_uploader', 'compiled/jquery/mediaComment' /* $.fn.mediaComment */, 'jquery.ajaxJSON' /* ajaxJSON */, 'jqueryui/dialog', @@ -32,7 +29,7 @@ define([ 'jquery.instructure_misc_plugins' /* .dim, /\.log\(/ */, 'jqueryui/progressbar' /* /\.progressbar/ */, 'jqueryui/tabs' /* /\.tabs/ */ -], function (swfobject, I18n, _, pubsub, $, htmlEscape, mediaCommentsTemplate, JsUploader) { +], function (I18n, _, pubsub, $, htmlEscape) { "use strict" var jsUploader @@ -264,6 +261,9 @@ define([ var reset_selectors = false; var lastInit = null; $.mediaComment.init = function(mediaType, opts) { + require.ensure([], function () { + var swfobject = require('swfobject'); + lastInit = lastInit || new Date(); mediaType = mediaType || "any"; opts = opts || {}; @@ -483,6 +483,7 @@ define([ // Do JS uploader is appropriate if (INST.kalturaSettings.js_uploader) { + var JsUploader = require('compiled/media_comments/js_uploader'); jsUploader = new JsUploader(mediaType, opts); jsUploader.onReady = mediaCommentReady; jsUploader.addEntry = addEntry; @@ -524,6 +525,7 @@ define([ // ********************************************************************** var checkForKS = function() { if($div.data('ks')) { + var mediaCommentsTemplate = require('jst/MediaComments'); $div.html(mediaCommentsTemplate()); $div.find("#media_record_tabs").tabs({activate: $.mediaComment.video_delegate.expectReady}); mediaCommentReady(); @@ -540,7 +542,9 @@ define([ // only call mediaCommentReady if we are not doing js uploader mediaCommentReady(); } + }, 'mediaCommentRecordAsyncChunk') } // End of init function + $(document).ready(function() { $(document).bind('reset_media_comment_forms', function() { $("#audio_record_holder_message,#video_record_holder_message").removeClass('saving') diff --git a/spec/selenium/helpers/submissions_common.rb b/spec/selenium/helpers/submissions_common.rb index fbb31b4ff80..3a060d55c88 100644 --- a/spec/selenium/helpers/submissions_common.rb +++ b/spec/selenium/helpers/submissions_common.rb @@ -37,7 +37,7 @@ module SubmissionsCommon def open_media_comment_dialog move_to_click('.media_comment_link') # swf and stuff loads, give it a sec to do its thing - sleep 0.5 + expect(f('#media_record_tabs')).to be_displayed end def submit_media_comment_1