1/** 2 * @file 3 * Adds some show/hide to the admin form to make the UXP easier. 4 */ 5(function($){ 6 Drupal.behaviors.video = { 7 attach: function (context, settings) { 8 //lets see if we have any jmedia movies 9 if($.fn.media) { 10 $('.jmedia').media(); 11 } 12 13 if(settings.video) { 14 $.fn.media.defaults.flvPlayer = settings.video.flvplayer; 15 } 16 17 //lets setup our colorbox videos 18 $('.video-box').each(function() { 19 var url = $(this).attr('href'); 20 var data = $(this).metadata(); 21 var width = data.width; 22 var height= data.height; 23 var player = settings.video.player; //player can be either jwplayer or flowplayer. 24 $(this).colorbox({ 25 html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>', 26 onComplete:function() { 27 if(player == 'flowplayer') { 28 flowplayer("video-overlay", settings.video.flvplayer, { 29 clip: { 30 autoPlay: settings.video.autoplay, 31 autoBuffering: settings.video.autobuffer 32 } 33 }); 34 } else { 35 $('#video-overlay').media({ 36 flashvars: { 37 autostart: settings.video.autoplay 38 }, 39 width:width, 40 height:height 41 }); 42 } 43 } 44 }); 45 }); 46 } 47 }; 48 49 // On change of the thumbnails when edit. 50 Drupal.behaviors.videoEdit = { 51 attach : function(context, settings) { 52 function setThumbnail(widget, type) { 53 var thumbnails = widget.find('.video-thumbnails input'); 54 var defaultthumbnail = widget.find('.video-use-default-video-thumb'); 55 var largeimage = widget.find('.video-preview img'); 56 57 var activeThumbnail = thumbnails.filter(':checked'); 58 if (activeThumbnail.length > 0 && type != 'default') { 59 var smallimage = activeThumbnail.next('label.option').find('img'); 60 largeimage.attr('src', smallimage.attr('src')); 61 defaultthumbnail.attr('checked', false); 62 } 63 else if(defaultthumbnail.is(':checked')) { 64 thumbnails.attr('checked', false); 65 largeimage.attr('src', defaultthumbnail.data('defaultimage')); 66 } 67 else { 68 // try to select the first thumbnail. 69 if (thumbnails.length > 0) { 70 thumbnails.first().attr('checked', 'checked'); 71 setThumbnail(widget, 'thumb'); 72 } 73 } 74 } 75 76 $('.video-thumbnails input', context).change(function() { 77 setThumbnail($(this).parents('.video-widget'), 'thumb'); 78 }); 79 80 $('.video-use-default-video-thumb', context).change(function() { 81 setThumbnail($(this).parents('.video-widget'), 'default'); 82 }); 83 84 $('.video-widget', context).each(function() { 85 setThumbnail($(this), 'both'); 86 }); 87 } 88 } 89})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.