aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHeshan <heshan@heidisoft.com>2011-03-18 00:13:45 +0530
committerHeshan <heshan@heidisoft.com>2011-03-18 00:13:45 +0530
commit69927fc15c744bd3602fe7d404af6a80130a1ce9 (patch)
tree5d4f042539bf1090359d9ea8a515904544add469 /js
parent51c7e284ec5976d5918e506265154f34d32e9a48 (diff)
downloadvideo-69927fc15c744bd3602fe7d404af6a80130a1ce9.tar.gz
video-69927fc15c744bd3602fe7d404af6a80130a1ce9.tar.bz2
Fixed the JS issues and Select players and trasncoders
Diffstat (limited to 'js')
-rw-r--r--js/video.js182
1 files changed, 84 insertions, 98 deletions
diff --git a/js/video.js b/js/video.js
index 4a23b53..fc2fa7f 100644
--- a/js/video.js
+++ b/js/video.js
@@ -5,119 +5,105 @@
*
*/
(function($){
-
- $(document).ready(function() {
- //lets see if we have any jmedia movies
- if($.fn.media) {
- $('.jmedia').media();
- }
+ Drupal.behaviors.video = {
+ attach: function (context, settings) {
+ //lets see if we have any jmedia movies
+ if($.fn.media) {
+ $('.jmedia').media();
+ }
- video_hide_all_options();
- $("input[name='video_convertor']").change(function() {
video_hide_all_options();
- });
+ $("input[name='video_convertor']").change(function() {
+ video_hide_all_options();
+ });
- // change metadata options
- video_hide_all__metadata_options();
- $("input[name='video_metadata']").change(function() {
+ // change metadata options
video_hide_all__metadata_options();
- });
-
- // change metadata options
- video_hide_all__filesystem_options();
- $("input[name='video_filesystem']").change(function() {
- video_hide_all__filesystem_options();
- });
+ $("input[name='video_metadata']").change(function() {
+ video_hide_all__metadata_options();
+ });
- $('.video_select').each(function() {
- var ext = $(this).attr('rel');
- $('select', this).change(function() {
- if($(this).val() == 'video_play_flv') {
+ $('.video_select').each(function() {
+ var ext = $(this).attr('rel');
+ $('select', this).change(function() {
+ if($(this).val() == 'video_play_flv') {
+ $('#flv_player_'+ext).show();
+ } else {
+ $('#flv_player_'+ext).hide();
+ }
+ });
+ if($('select', this).val() == 'video_play_flv') {
$('#flv_player_'+ext).show();
- } else {
- $('#flv_player_'+ext).hide();
}
});
- if($('select', this).val() == 'video_play_flv') {
- $('#flv_player_'+ext).show();
- }
- });
- if(Drupal.settings.video) {
- $.fn.media.defaults.flvPlayer = Drupal.settings.video.flvplayer;
+ if(settings.video) {
+ $.fn.media.defaults.flvPlayer = settings.video.flvplayer;
- }
+ }
- //lets setup our colorbox videos
- $('.video-box').each(function() {
- var url = $(this).attr('href');
- var data = $(this).metadata();
- var width = data.width;
- var height= data.height;
- var player = Drupal.settings.video.player; //player can be either jwplayer or flowplayer.
- $(this).colorbox({
- html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>',
- onComplete:function() {
- if(player == 'flowplayer') {
- flowplayer("video-overlay", Drupal.settings.video.flvplayer, {
- clip: {
- autoPlay: Drupal.settings.video.autoplay,
- autoBuffering: Drupal.settings.video.autobuffer
- }
- });
- } else {
- $('#video-overlay').media({
- flashvars: {
- autostart: Drupal.settings.video.autoplay
- },
- width:width,
- height:height
- });
+ //lets setup our colorbox videos
+ $('.video-box').each(function() {
+ var url = $(this).attr('href');
+ var data = $(this).metadata();
+ var width = data.width;
+ var height= data.height;
+ var player = settings.video.player; //player can be either jwplayer or flowplayer.
+ $(this).colorbox({
+ html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>',
+ onComplete:function() {
+ if(player == 'flowplayer') {
+ flowplayer("video-overlay", settings.video.flvplayer, {
+ clip: {
+ autoPlay: settings.video.autoplay,
+ autoBuffering: settings.video.autobuffer
+ }
+ });
+ } else {
+ $('#video-overlay').media({
+ flashvars: {
+ autostart: settings.video.autoplay
+ },
+ width:width,
+ height:height
+ });
+ }
}
- }
+ });
});
- });
- });
-})(jQuery);
-
-function video_hide_all_options() {
- $("input[name='video_convertor']").each(function() {
- var id = $(this).val();
- $('#'+id).hide();
- if ($(this).is(':checked')) {
- $('#' + id).show();
}
- });
-}
+ };
-function videoftp_thumbnail_change() {
- // Add handlers for the video thumbnail radio buttons to update the large thumbnail onchange.
- $(".video-thumbnails input").each(function() {
- var path = $(this).val();
- if($(this).is(':checked')) {
- var holder = $(this).attr('rel');
- $('.'+holder+' img').attr('src', Drupal.settings.basePath + path);
- }
- });
-}
+ function video_hide_all_options() {
+ $("input[name='video_convertor']").each(function() {
+ var id = $(this).val();
+ $('#'+id).hide();
+ if ($(this).is(':checked')) {
+ $('#' + id).show();
+ }
+ });
+ }
+
+ function videoftp_thumbnail_change() {
+ // Add handlers for the video thumbnail radio buttons to update the large thumbnail onchange.
+ $(".video-thumbnails input").each(function() {
+ var path = $(this).val();
+ if($(this).is(':checked')) {
+ var holder = $(this).attr('rel');
+ $('.'+holder+' img').attr('src', settings.basePath + path);
+ }
+ });
-function video_hide_all__metadata_options() {
- $("input[name='video_metadata']").each(function() {
- var id = $(this).val();
- $('#'+id).hide();
- if ($(this).is(':checked')) {
- $('#' + id).show();
- }
- });
-}
+ }
-function video_hide_all__filesystem_options() {
- $("input[name='video_filesystem']").each(function() {
- var id = $(this).val();
- $('#'+id).hide();
- if ($(this).is(':checked')) {
- $('#' + id).show();
- }
- });
-}
+ function video_hide_all__metadata_options() {
+ $("input[name='video_metadata']").each(function() {
+ var id = $(this).val();
+ $('#'+id).hide();
+ if ($(this).is(':checked')) {
+ $('#' + id).show();
+ }
+ });
+ }
+})(jQuery); \ No newline at end of file