src/js/ui.js
author hamidouk
Mon, 12 Sep 2011 17:26:15 +0200
changeset 38 94899a565089
parent 31 cbb1425bc769
child 72 c4a36ea700d4
permissions -rw-r--r--
moving ui-specific code from site.js to ui.js
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
	/* FIXME : move it elsewhere */
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    37
	IriSP.trace("__IriSP.createHtml",IriSP.jQuery.browser.msie+" "+IriSP.jQuery.browser.version);		
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    38
	IriSP.trace("__IriSP.createHtml","end");
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    39
	IriSP.jQuery("#Ldt-Annotations").width(width-(75*2));
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    40
	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
    41
	IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10);
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    42
	IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10);
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    43
	IriSP.jQuery("#Ldt-SaKeyword").width(width-10);
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    44
	IriSP.jQuery("#Ldt-controler").width(width-10);
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    45
	IriSP.jQuery("#Ldt-Control").attr("z-index","100");
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    46
	IriSP.jQuery("#Ldt-controler").hide();
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    47
	
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    48
	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
    49
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    50
	if(IriSP.config.gui.mode=='radio'){
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    51
		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
    52
	}
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    53
	// Show or not the output
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    54
	if(IriSP.config.gui.debug===true){
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    55
		IriSP.jQuery("#Ldt-output").show();
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    56
	} else {
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    57
		IriSP.jQuery("#Ldt-output").hide();
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
};
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    61
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    62
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    63
/* create the buttons and the slider   */
31
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    64
IriSP.createInterface = function( width, height, duration ) {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    65
		
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    66
		IriSP.jQuery( "#Ldt-controler" ).show();
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    67
		//__IriSP.jQuery("#Ldt-Root").css('display','visible');
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    68
		IriSP.trace( "__IriSP.createInterface" , width+","+height+","+duration+"," );
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
		IriSP.jQuery( "#Ldt-ShowAnnotation").click( function () { 
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    71
			 //__IriSP.jQuery(this).slideUp(); 
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    72
		} );
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
		var LdtpPlayerY = IriSP.jQuery("#Ldt-PlaceHolder").attr("top");
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    75
		var LdtpPlayerX = IriSP.jQuery("#Ldt-PlaceHolder").attr("left");
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    76
		
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    77
		IriSP.jQuery( "#slider-range-min" ).slider( { //range: "min",
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    78
			value: 0,
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    79
			min: 1,
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    80
			max: duration/1000,//1:54:52.66 = 3600+3240+
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    81
			step: 0.1,
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    82
			slide: function(event, ui) {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    83
				
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    84
				//__IriSP.jQuery("#amount").val(ui.value+" s");
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    85
				//player.sendEvent('SEEK', ui.value)
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    86
				IriSP.MyApiPlayer.seek(ui.value);
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    87
				//changePageUrlOffset(ui.value);
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    88
				//player.sendEvent('PAUSE')
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    89
			}
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    90
		} );
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    91
		
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    92
		IriSP.trace("__IriSP.createInterface","ICI");
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    93
		IriSP.jQuery("#amount").val(IriSP.jQuery("#slider-range-min").slider("value")+" s");
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    94
		IriSP.jQuery(".Ldt-Control1 button:first").button({
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    95
			icons: {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    96
				primary: 'ui-icon-play'
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    97
			},
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    98
			text: false
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    99
		}).next().button({
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   100
			icons: {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   101
				primary: 'ui-icon-seek-next'
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   102
			},
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   103
			 text: false
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   104
		});
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   105
		IriSP.jQuery(".Ldt-Control2 button:first").button({
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   106
			icons: {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   107
				primary: 'ui-icon-search'//,
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   108
				//secondary: 'ui-icon-volume-off'
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   109
			},
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   110
			text: false
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   111
		}).next().button({
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   112
			icons: {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   113
				primary: 'ui-icon-volume-on'
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
			 text: false
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   116
		});
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   117
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   118
		// /!\ PB A MODIFIER 
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   119
		//__IriSP.MyTags.draw();
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   120
		IriSP.trace("__IriSP.createInterface","ICI2");
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   121
		IriSP.jQuery( "#ldt-CtrlPlay" ).attr( "style", "background-color:#CD21C24;" );
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   122
		
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   123
		IriSP.jQuery( "#Ldt-load-container" ).hide();
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
		if( IriSP.config.gui.mode=="radio" & IriSP.jQuery.browser.msie != true ) {
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   126
			IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" );
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   127
		}
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   128
		IriSP.trace( "__IriSP.createInterface" , "3" );
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   129
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   130
		IriSP.trace( "__IriSP.createInterface", "END" );
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   131
		
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   132
	};