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