src/js/ui.js
branchrequire-js
changeset 238 6008172a0592
parent 72 c4a36ea700d4
equal deleted inserted replaced
237:8f99b0df3278 238:6008172a0592
     1 /* ui.js - ui related functions */
     1 /* ui.js - ui related functions */
       
     2 define("ui.js", function() {
       
     3   /* FIXME: use an sharing library */
       
     4   IriSP.LdtShareTool = IriSP.share_template; /* the contents come from share.html */
     2 
     5 
     3 /* FIXME: use an sharing library */
     6   IriSP.createPlayerChrome = function(){
     4 IriSP.LdtShareTool = IriSP.share_template; /* the contents come from share.html */
     7     var width = IriSP.config.gui.width;
       
     8     var height = IriSP.config.gui.height;
       
     9     var heightS = IriSP.config.gui.height-20;
       
    10     
       
    11     // AUDIO  */
       
    12     // PB dans le html : ; 
       
    13     IriSP.trace( "__IriSP.createMyHtml",IriSP.config.gui.container );
     5 
    14 
     6 IriSP.createPlayerChrome = function(){
    15     
     7 	var width = IriSP.config.gui.width;
    16     /* FIXME : factor this in another file */
     8 	var height = IriSP.config.gui.height;
    17     if( IriSP.config.gui.mode=="radio" ){
     9 	var heightS = IriSP.config.gui.height-20;
       
    10 	
       
    11 	// AUDIO  */
       
    12 	// PB dans le html : ; 
       
    13 	IriSP.trace( "__IriSP.createMyHtml",IriSP.config.gui.container );
       
    14 
    18 
    15 	
    19       IriSP.jQuery( "#"+IriSP.config.gui.container ).before(IriSP.search_template);
    16 	/* FIXME : factor this in another file */
    20       var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template});
    17 	if( IriSP.config.gui.mode=="radio" ){
    21       IriSP.jQuery(radioPlayer).appendTo("#"+IriSP.config.gui.container);
    18 
    22 
    19 		IriSP.jQuery( "#"+IriSP.config.gui.container ).before(IriSP.search_template);
    23       // special tricks for IE 7
    20 		var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template});
    24       if (IriSP.jQuery.browser.msie==true && IriSP.jQuery.browser.version=="7.0"){
    21 		IriSP.jQuery(radioPlayer).appendTo("#"+IriSP.config.gui.container);
    25         //LdtSearchContainer
       
    26         //__IriSP.jQuery("#LdtPlayer").attr("margin-top","50px");
       
    27         IriSP.jQuery("#Ldt-Root").css("padding-top","25px");
       
    28         IriSP.trace("__IriSP.createHtml","IE7 SPECIAL ");
       
    29       }
       
    30     } else if(IriSP.config.gui.mode=="video") {
       
    31     
       
    32       var videoPlayer = Mustache.to_html(IriSP.video_template, {"share_template" : IriSP.share_template, "heightS" : heightS});
       
    33       IriSP.jQuery(videoPlayer).appendTo("#"+IriSP.config.gui.container);
       
    34     }
       
    35     
       
    36     IriSP.jQuery("#Ldt-Annotations").width(width-(75*2));
       
    37     IriSP.jQuery("#Ldt-Show-Arrow-container").width(width-(75*2));
       
    38     IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10);
       
    39     IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10);
       
    40     IriSP.jQuery("#Ldt-SaKeyword").width(width-10);
       
    41     IriSP.jQuery("#Ldt-controler").width(width-10);
       
    42     IriSP.jQuery("#Ldt-Control").attr("z-index","100");
       
    43     IriSP.jQuery("#Ldt-controler").hide();
       
    44     
       
    45     IriSP.jQuery(IriSP.annotation_loading_template).appendTo("#Ldt-ShowAnnotation-audio");
    22 
    46 
    23 		// special tricks for IE 7
    47     if(IriSP.config.gui.mode=='radio'){
    24 		if (IriSP.jQuery.browser.msie==true && IriSP.jQuery.browser.version=="7.0"){
    48       IriSP.jQuery("#Ldt-load-container").attr("width",IriSP.config.gui.width);
    25 			//LdtSearchContainer
    49     }
    26 			//__IriSP.jQuery("#LdtPlayer").attr("margin-top","50px");
    50     // Show or not the output
    27 			IriSP.jQuery("#Ldt-Root").css("padding-top","25px");
    51     if(IriSP.config.gui.debug===true){
    28 			IriSP.trace("__IriSP.createHtml","IE7 SPECIAL ");
    52       IriSP.jQuery("#Ldt-output").show();
    29 		}
    53     } else {
    30 	} else if(IriSP.config.gui.mode=="video") {
    54       IriSP.jQuery("#Ldt-output").hide();
    31 	
    55     }
    32 		var videoPlayer = Mustache.to_html(IriSP.video_template, {"share_template" : IriSP.share_template, "heightS" : heightS});
    56     
    33 		IriSP.jQuery(videoPlayer).appendTo("#"+IriSP.config.gui.container);
    57   };
    34 	}
       
    35 	
       
    36 	IriSP.jQuery("#Ldt-Annotations").width(width-(75*2));
       
    37 	IriSP.jQuery("#Ldt-Show-Arrow-container").width(width-(75*2));
       
    38 	IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10);
       
    39 	IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10);
       
    40 	IriSP.jQuery("#Ldt-SaKeyword").width(width-10);
       
    41 	IriSP.jQuery("#Ldt-controler").width(width-10);
       
    42 	IriSP.jQuery("#Ldt-Control").attr("z-index","100");
       
    43 	IriSP.jQuery("#Ldt-controler").hide();
       
    44 	
       
    45 	IriSP.jQuery(IriSP.annotation_loading_template).appendTo("#Ldt-ShowAnnotation-audio");
       
    46 
       
    47 	if(IriSP.config.gui.mode=='radio'){
       
    48 		IriSP.jQuery("#Ldt-load-container").attr("width",IriSP.config.gui.width);
       
    49 	}
       
    50 	// Show or not the output
       
    51 	if(IriSP.config.gui.debug===true){
       
    52 		IriSP.jQuery("#Ldt-output").show();
       
    53 	} else {
       
    54 		IriSP.jQuery("#Ldt-output").hide();
       
    55 	}
       
    56 	
       
    57 };
       
    58 
    58 
    59 
    59 
    60 /* create the buttons and the slider   */
    60   /* create the buttons and the slider   */
    61 IriSP.createInterface = function( width, height, duration ) {
    61   IriSP.createInterface = function( width, height, duration ) {
    62 		
    62       
    63 		IriSP.jQuery( "#Ldt-controler" ).show();
    63       IriSP.jQuery( "#Ldt-controler" ).show();
    64 		//__IriSP.jQuery("#Ldt-Root").css('display','visible');
    64       //__IriSP.jQuery("#Ldt-Root").css('display','visible');
    65 		IriSP.trace( "__IriSP.createInterface" , width+","+height+","+duration+"," );
    65       IriSP.trace( "__IriSP.createInterface" , width+","+height+","+duration+"," );
    66 		
    66       
    67 		IriSP.jQuery( "#Ldt-ShowAnnotation").click( function () { 
    67       IriSP.jQuery( "#Ldt-ShowAnnotation").click( function () { 
    68 			 //__IriSP.jQuery(this).slideUp(); 
    68          //__IriSP.jQuery(this).slideUp(); 
    69 		} );
    69       } );
    70 
    70 
    71 		var LdtpPlayerY = IriSP.jQuery("#Ldt-PlaceHolder").attr("top");
    71       var LdtpPlayerY = IriSP.jQuery("#Ldt-PlaceHolder").attr("top");
    72 		var LdtpPlayerX = IriSP.jQuery("#Ldt-PlaceHolder").attr("left");
    72       var LdtpPlayerX = IriSP.jQuery("#Ldt-PlaceHolder").attr("left");
    73 		
    73       
    74 		IriSP.jQuery( "#slider-range-min" ).slider( { //range: "min",
    74       IriSP.jQuery( "#slider-range-min" ).slider( { //range: "min",
    75 			value: 0,
    75         value: 0,
    76 			min: 1,
    76         min: 1,
    77 			max: duration/1000,//1:54:52.66 = 3600+3240+
    77         max: duration/1000,//1:54:52.66 = 3600+3240+
    78 			step: 0.1,
    78         step: 0.1,
    79 			slide: function(event, ui) {
    79         slide: function(event, ui) {
    80 				
    80           
    81 				//__IriSP.jQuery("#amount").val(ui.value+" s");
    81           //__IriSP.jQuery("#amount").val(ui.value+" s");
    82 				//player.sendEvent('SEEK', ui.value)
    82           //player.sendEvent('SEEK', ui.value)
    83 				IriSP.MyApiPlayer.seek(ui.value);
    83           IriSP.MyApiPlayer.seek(ui.value);
    84 				//changePageUrlOffset(ui.value);
    84           //changePageUrlOffset(ui.value);
    85 				//player.sendEvent('PAUSE')
    85           //player.sendEvent('PAUSE')
    86 			}
    86         }
    87 		} );
    87       } );
    88 		
    88       
    89 		IriSP.trace("__IriSP.createInterface","ICI");
    89       IriSP.trace("__IriSP.createInterface","ICI");
    90 		IriSP.jQuery("#amount").val(IriSP.jQuery("#slider-range-min").slider("value")+" s");
    90       IriSP.jQuery("#amount").val(IriSP.jQuery("#slider-range-min").slider("value")+" s");
    91 		IriSP.jQuery(".Ldt-Control1 button:first").button({
    91       IriSP.jQuery(".Ldt-Control1 button:first").button({
    92 			icons: {
    92         icons: {
    93 				primary: 'ui-icon-play'
    93           primary: 'ui-icon-play'
    94 			},
    94         },
    95 			text: false
    95         text: false
    96 		}).next().button({
    96       }).next().button({
    97 			icons: {
    97         icons: {
    98 				primary: 'ui-icon-seek-next'
    98           primary: 'ui-icon-seek-next'
    99 			},
    99         },
   100 			 text: false
   100          text: false
   101 		});
   101       });
   102 		IriSP.jQuery(".Ldt-Control2 button:first").button({
   102       IriSP.jQuery(".Ldt-Control2 button:first").button({
   103 			icons: {
   103         icons: {
   104 				primary: 'ui-icon-search'//,
   104           primary: 'ui-icon-search'//,
   105 				//secondary: 'ui-icon-volume-off'
   105           //secondary: 'ui-icon-volume-off'
   106 			},
   106         },
   107 			text: false
   107         text: false
   108 		}).next().button({
   108       }).next().button({
   109 			icons: {
   109         icons: {
   110 				primary: 'ui-icon-volume-on'
   110           primary: 'ui-icon-volume-on'
   111 			},
   111         },
   112 			 text: false
   112          text: false
   113 		});
   113       });
   114 
   114 
   115 		// /!\ PB A MODIFIER 
   115       // /!\ PB A MODIFIER 
   116 		//__IriSP.MyTags.draw();
   116       //__IriSP.MyTags.draw();
   117 		IriSP.trace("__IriSP.createInterface","ICI2");
   117       IriSP.trace("__IriSP.createInterface","ICI2");
   118 		IriSP.jQuery( "#ldt-CtrlPlay" ).attr( "style", "background-color:#CD21C24;" );
   118       IriSP.jQuery( "#ldt-CtrlPlay" ).attr( "style", "background-color:#CD21C24;" );
   119 		
   119       
   120 		IriSP.jQuery( "#Ldt-load-container" ).hide();
   120       IriSP.jQuery( "#Ldt-load-container" ).hide();
   121 		
   121       
   122 		if( IriSP.config.gui.mode=="radio" & IriSP.jQuery.browser.msie != true ) {
   122       if( IriSP.config.gui.mode=="radio" & IriSP.jQuery.browser.msie != true ) {
   123 			IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" );
   123         IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" );
   124 		}
   124       }
   125 		IriSP.trace( "__IriSP.createInterface" , "3" );
   125       IriSP.trace( "__IriSP.createInterface" , "3" );
   126 
   126 
   127 		IriSP.trace( "__IriSP.createInterface", "END" );
   127       IriSP.trace( "__IriSP.createInterface", "END" );
   128 		
   128       
   129 	};
   129     };
       
   130 });