client/player/src/js/LdtPlayer.js
author wakimd
Tue, 16 Nov 2010 14:15:07 +0100
changeset 9 22ab430e9b64
permissions -rw-r--r--
Corrections on models and general structure
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     1
/* 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     2
 * 	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     3
 *	Copyright 2010 Institut de recherche et d'innovation 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     4
 *	contributor(s) : Samuel Huron 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     5
 *	 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     6
 *	contact@iri.centrepompidou.fr
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     7
 *	http://www.iri.centrepompidou.fr 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     8
 *	 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
     9
 *	This software is a computer program whose purpose is to show and add annotations on a video .
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    10
 *	This software is governed by the CeCILL-C license under French law and
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    11
 *	abiding by the rules of distribution of free software. You can  use, 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    12
 *	modify and/ or redistribute the software under the terms of the CeCILL-C
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    13
 *	license as circulated by CEA, CNRS and INRIA at the following URL
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    14
 *	"http://www.cecill.info". 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    15
 *	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    16
 *	The fact that you are presently reading this means that you have had
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    17
 *	knowledge of the CeCILL-C license and that you accept its terms.
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    18
*/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    19
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    20
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    21
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    22
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    23
if(window.__IriSP === undefined ){ var __IriSP={};}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    24
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    25
// Player Configuration  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    26
__IriSP.config = {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    27
		metadata:{
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    28
			format:'cinelab',
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    29
			src:'http://exp.iri.centrepompidou.fr/franceculture/franceculture/ldt/cljson/id/ef4dcc2e-8d3b-11df-8a24-00145ea4a2be',
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    30
			load:'jsonp'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    31
		},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    32
		gui:{
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    33
			width:650,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    34
			height:0,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    35
			mode:'radio',
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    36
			container:'LdtPlayer',
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    37
			debug:false, 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    38
			css:'../src/css/LdtPlayer.css'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    39
		},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    40
		player:{
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    41
			type:'jwplayer',
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    42
			src:'../res/swf/player.swf'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    43
		},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    44
		module:null
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    45
	};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    46
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    47
__IriSP.lib = {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    48
			jQuery:"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    49
			jQueryUI:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    50
			jQueryToolTip:"http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    51
			swfObject:"http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    52
			cssjQueryUI:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    53
		};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    54
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    55
// Player Variable
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    56
__IriSP.LdtShareTool = ""+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    57
"\n<a onclick=\"__IriSP.MyApiPlayer.share('delicious');\" title='partager avec delicious'><span class='share shareDelicious'>&nbsp;</span></a>"+		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    58
"\n<a onclick=\"__IriSP.MyApiPlayer.share('facebook');\" title='partager avec facebook'> <span class='share shareFacebook'>&nbsp;</span></a>"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    59
"\n<a onclick=\"__IriSP.MyApiPlayer.share('twitter');\" title='partager avec twitter'>  <span class='share shareTwitter'>&nbsp;</span></a>"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    60
"\n<a onclick=\"__IriSP.MyApiPlayer.share('myspace');\" title='partager avec Myspace'>  <span class='share shareMySpace'>&nbsp;</span></a>"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    61
"\n<a onclick=\"__IriSP.MyApiPlayer.share('jamespot');\" title='partager avec JamesPot'>  <span class='share shareJamesPot'>&nbsp;</span></a>";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    62
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    63
// Official instance - to refactor ?
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    64
__IriSP.MyLdt 		= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    65
__IriSP.MyTags 		= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    66
__IriSP.MyApiPlayer	= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    67
__IriSP.player		= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    68
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    69
// genral var (old code) - to refactor 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    70
__IriSP.Durration		= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    71
__IriSP.playerLdtWidth= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    72
__IriSP.playerLdtHeight= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    73
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    74
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    75
 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    76
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    77
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    78
__IriSP.init = function (config){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    79
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    80
		__IriSP.config 			 = config;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    81
		var metadataSrc 		 = __IriSP.config.metadata.src;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    82
		var guiContainer		 = __IriSP.config.gui.container;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    83
		var guiMode				 = __IriSP.config.gui.mode;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    84
		var guiLdtShareTool		 = __IriSP.LdtShareTool;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    85
		// Localize jQuery variable
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    86
		__IriSP.jQuery = null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    87
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    88
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    89
		/******** Load jQuery if not present *********/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    90
		if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    91
			var script_tag = document.createElement('script');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    92
			script_tag.setAttribute("type","text/javascript");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    93
			script_tag.setAttribute("src",__IriSP.lib.jQuery);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    94
				//"http://cdn.jquerytools.org/1.2.4/full/jquery.tools.min.js");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    95
			script_tag.onload = scriptLibHandler;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    96
			script_tag.onreadystatechange = function () { // Same thing but for IE
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    97
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    98
					scriptLibHandler();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
    99
					
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   100
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   101
			};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   102
			// Try to find the head, otherwise default to the documentElement
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   103
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   104
		} else {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   105
			// The jQuery version on the window is the one we want to use
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   106
			 __IriSP.jQuery = window.jQuery;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   107
			scriptLibHandler();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   108
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   109
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   110
		/******** Called once jQuery has loaded ******/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   111
		function scriptLibHandler() {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   112
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   113
			var script_jqUi_tooltip = document.createElement('script');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   114
			script_jqUi_tooltip.setAttribute("type","text/javascript");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   115
			script_jqUi_tooltip.setAttribute("src",__IriSP.lib.jQueryToolTip);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   116
			script_jqUi_tooltip.onload = scriptLoadHandler;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   117
			script_jqUi_tooltip.onreadystatechange = function () { // Same thing but for IE
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   118
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   119
					scriptLoadHandler("jquery.tools.min.js loded");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   120
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   121
			};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   122
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   123
			var script_swfObj = document.createElement('script');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   124
			script_swfObj.setAttribute("type","text/javascript");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   125
			script_swfObj.setAttribute("src",__IriSP.lib.swfObject);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   126
			script_swfObj.onload = scriptLoadHandler;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   127
			script_swfObj.onreadystatechange = function () { // Same thing but for IE
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   128
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   129
					scriptLoadHandler("swfobject.js loded");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   130
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   131
			};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   132
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   133
			var script_jqUi = document.createElement('script');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   134
			script_jqUi.setAttribute("type","text/javascript");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   135
			script_jqUi.setAttribute("src",__IriSP.lib.jQueryUI);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   136
			script_jqUi.onload = scriptLoadHandler;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   137
			script_jqUi.onreadystatechange = function () { // Same thing but for IE
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   138
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   139
					scriptLoadHandler("jquery-ui.min.js loded");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   140
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   141
			};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   142
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   143
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   144
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   145
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   146
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_jqUi_tooltip);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   147
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_jqUi);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   148
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_swfObj);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   149
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   150
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   151
		};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   152
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   153
		/******** Called once all lib are loaded ******/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   154
		var loadLib = 0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   155
		function scriptLoadHandler(Mylib) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   156
			//alert(Mylib);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   157
			loadLib +=1;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   158
			if(loadLib===3){ 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   159
				main(); 			  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   160
			}else {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   161
				// __IriSP.jQuery('#'+__IriSP.config.gui.container).html("Loading library ...");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   162
			}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   163
		};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   164
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   165
		/******** Our main function ********/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   166
		function main() { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   167
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   168
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   169
			//  Make __IriSP.jQuery and restore window.jQuery 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   170
			__IriSP.jQuery = window.jQuery.noConflict(true);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   171
			// Call MY Jquery
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   172
			__IriSP.jQuery(document).ready(function($) { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   173
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   174
				/******* Load CSS *******/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   175
				var css_link_jquery = __IriSP.jQuery("<link>", { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   176
					rel: "stylesheet", 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   177
					type: "text/css", 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   178
					href: __IriSP.lib.cssjQueryUI,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   179
					'class': "dynamic_css"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   180
				});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   181
				var css_link_custom = __IriSP.jQuery("<link>", { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   182
					rel: "stylesheet", 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   183
					type: "text/css", 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   184
					href: __IriSP.config.gui.css,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   185
					'class': "dynamic_css"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   186
				});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   187
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   188
				css_link_jquery.appendTo('head');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   189
				css_link_custom.appendTo('head');   
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   190
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   191
				// to see dynamicly loaded css on IE
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   192
				if ($.browser.msie) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   193
					$('.dynamic_css').clone().appendTo('head');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   194
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   195
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   196
				//__IriSP.trace("main","ready createMyHtml");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   197
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   198
				__IriSP.createMyHtml();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   199
				//__IriSP.trace("main","end createMyHtml");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   200
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   201
				/******* Load Metadata *******/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   202
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   203
				__IriSP.jQuery.ajax({
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   204
					  dataType: 'jsonp',
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   205
					  url:metadataSrc,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   206
					  success : function(json){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   207
					  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   208
							__IriSP.trace("ajax","success");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   209
							
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   210
							// START PARSING ----------------------- 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   211
							if(json === ""){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   212
								alert("ERREUR DE CHARGEMENT JSON");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   213
							} else {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   214
							  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   215
							  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   216
								// # CREATE MEDIA  							//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   217
								// # JUSTE ONE PLAYER FOR THE MOMENT		//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   218
								//__IriSP.jQuery("<div></div>").appendTo("#output");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   219
								var MyMedia = new  __IriSP.Media(
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   220
																	json.medias[0].id,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   221
																	json.medias[0].href,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   222
																	json.medias[0]['meta']['dc:duration'],
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   223
																	json.medias[0]['dc:title'],
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   224
																	json.medias[0]['dc:description']);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   225
								
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   226
								__IriSP.trace("__IriSP.MyApiPlayer",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   227
																	__IriSP.config.gui.width+"   "
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   228
																	+ __IriSP.config.gui.height + " "
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   229
																	+ json.medias[0].href + " "
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   230
																	+ json.medias[0]['meta']['dc:duration'] + " "
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   231
																	+ json.medias[0]['meta']['item']['value']);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   232
								
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   233
								// Create APIplayer
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   234
								__IriSP.MyApiPlayer = new __IriSP.APIplayer(
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   235
																	__IriSP.config.gui.width,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   236
																	__IriSP.config.gui.height,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   237
																	json.medias[0].href,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   238
																	json.medias[0]['meta']['dc:duration'],
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   239
																	json.medias[0]['meta']['item']['value']);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   240
							
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   241
								// # CREATE THE FIRST LINE  				//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   242
								__IriSP.trace("__IriSP.init.main","__IriSP.Ligne");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   243
								__IriSP.MyLdt = new __IriSP.Ligne (
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   244
																	json['annotation-types'][0].id,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   245
																	json['annotation-types'][0]['dc:title'],
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   246
																	json['annotation-types'][0]['dc:description'],
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   247
																	json.medias[0]['meta']['dc:duration']);			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   248
								
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   249
								// CREATE THE TAG CLOUD 					//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   250
								__IriSP.trace("__IriSP.init.main","__IriSP.Tags");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   251
								__IriSP.MyTags =  new __IriSP.Tags (json.tags);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   252
							
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   253
								// CREATE THE ANNOTATIONS  				    //
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   254
								// JUSTE FOR THE FIRST TYPE   			 	//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   255
								__IriSP.jQuery.each(json.annotations, function(i,item) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   256
									if (item.meta['id-ref'] == __IriSP.MyLdt.id) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   257
										//__IriSP.trace("__IriSP.init.main","__IriSP.MyLdt.addAnnotation");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   258
										__IriSP.MyLdt.addAnnotation(
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   259
													item.id,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   260
													item.begin,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   261
													item.end,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   262
													item.media,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   263
													item.content.title,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   264
													item.content.description,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   265
													item.content.color,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   266
													item.tags);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   267
									}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   268
										//MyTags.addAnnotation(item);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   269
								});	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   270
								__IriSP.jQuery.each(json.lists, function(i,item) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   271
									__IriSP.trace("lists","");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   272
								});	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   273
								__IriSP.jQuery.each(json.views, function(i,item) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   274
									__IriSP.trace("views","");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   275
								});	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   276
							}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   277
							// END PARSING ----------------------- //  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   278
						
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   279
										
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   280
					},error : function(data){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   281
						  alert("ERROR : "+data);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   282
					}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   283
				  });	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   284
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   285
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   286
			});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   287
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   288
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   289
};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   290
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   291
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   292
__IriSP.createMyHtml = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   293
		var width = __IriSP.config.gui.width;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   294
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   295
		// AUDIO  */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   296
		// PB dans le html : ; 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   297
		__IriSP.jQuery(  "<div id='Ldt-Root'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   298
			"	<div id='Ldt-PlaceHolder'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   299
			"		<a href='http://www.adobe.com/go/getflashplayer'>Get flash</a> to see this player	\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   300
			"	</div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   301
			"	<div id='Ldt-controler' class='demo'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   302
			"		<div class='Ldt-Control1' >\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   303
			"			<button id='ldt-CtrlPlay' onclick='__IriSP.MyApiPlayer.play()'>Lecture / Pause </button>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   304
			"			<button id='ldt-CtrlNext' onclick='__IriSP.MyLdt.nextAnnotation()'>Suivant</button>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   305
			"		</div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   306
			"		<div id='Ldt-Annotations' class='ui-slider'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   307
			"			<div id='slider-range-min'></div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   308
			"	</div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   309
			"		<div class='Ldt-Control2'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   310
			"			<button id='ldt-CtrlLink'> Partager </button>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   311
			"			<button id='ldt-CtrlSound' onclick='__IriSP.MyApiPlayer.mute()'>Sound</button>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   312
			"		</div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   313
			"  <div class='cleaner'>&nbsp\;</div> \n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   314
			"  <div id='Ldt-Show-Arrow-container'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   315
			"  	<div id='Ldt-Show-Arrow'> </div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   316
			"  </div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   317
			"</div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   318
			"<div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   319
			" <div id='ldt-Show'> </div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   320
			"	<div id='Ldt-ShowAnnotation-audio' class='demo' >\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   321
			"		<div id='Ldt-SaTitle'></div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   322
			"		<div id='Ldt-SaDescription'></div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   323
			" 		<div class='cleaner'><!--&nbsp\;--></div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   324
			" </div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   325
			" <div id='Ldt-SaKeyword'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   326
			" <div id='Ldt-SaKeywordText'>  </div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   327
			" <div class='cleaner'></div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   328
			" <div id='Ldt-SaShareTools'>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   329
			" \n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   330
			" "+__IriSP.LdtShareTool+"\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   331
			" \n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   332
			"  </div>\n"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   333
			" <div class='cleaner'></div>"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   334
			"</div>  "+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   335
			//"<div id='Ldt-Tags'> Mots clefs : </div>"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   336
			"</div>"+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   337
			"<div id='Ldt-output'></div>").appendTo("#"+__IriSP.config.gui.container);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   338
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   339
		__IriSP.trace("__IriSP.createHtml","end");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   340
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   341
		__IriSP.jQuery("#Ldt-Annotations").width(width-(75*2));
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   342
		__IriSP.jQuery("#Ldt-Show-Arrow-container").width(width-(75*2));
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   343
		__IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   344
		__IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   345
		__IriSP.jQuery("#Ldt-SaKeyword").width(width-10);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   346
		__IriSP.jQuery("#Ldt-controler").width(width-10);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   347
		__IriSP.jQuery("#Ldt-Control").attr("z-index","100");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   348
		__IriSP.jQuery("#Ldt-controler").hide();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   349
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   350
		__IriSP.jQuery("<div id='Ldt-load-container'><div id='Ldt-loader'>&nbsp;</div> Chargement... </div>").appendTo("#Ldt-ShowAnnotation-audio");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   351
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   352
		if(__IriSP.config.gui.mode=='radio'){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   353
			__IriSP.jQuery("#Ldt-load-container").attr("width",__IriSP.config.gui.width);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   354
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   355
		// Show or not the output
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   356
		if(__IriSP.config.gui.debug===true){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   357
			__IriSP.jQuery("#Ldt-output").show();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   358
		} else {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   359
			__IriSP.jQuery("#Ldt-output").hide();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   360
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   361
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   362
};
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   363
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   364
__IriSP.Media = function (id,url,duration,title,description){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   365
		this.id 		 	= id;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   366
		this.url 		= url;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   367
		this.title 		= title;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   368
		this.description = description;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   369
		this.duration 	= duration;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   370
		this.lignes 	  	= new Array();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   371
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   372
		__IriSP.trace("__IriSP.Media","Media ID : "+id);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   373
		__IriSP.trace("__IriSP.Media","Media URL : "+url);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   374
		__IriSP.trace("__IriSP.Media","Media title : "+title);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   375
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   376
__IriSP.Media.prototype.createPlayerMedia = function (width,height,MyStreamer,MySwfPath){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   377
		__IriSP.MyApiPlayer = new __IriSP.APIplayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   378
		//createPlayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   379
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   380
__IriSP.Media.prototype.getMediaDuration = function (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   381
		return (this.duration);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   382
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   383
__IriSP.Media.prototype.getMediaTitle = function (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   384
		return (this.title);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   385
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   386
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   387
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   388
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   389
/* 	INTERFACE : SLIDER ( CONTROL BAR ) | BUTTON ()   */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   390
__IriSP.createInterface = function(width,height,duration){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   391
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   392
		__IriSP.jQuery("#Ldt-controler").show();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   393
		//__IriSP.jQuery("#Ldt-Root").css('display','visible');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   394
		__IriSP.trace("__IriSP.createInterface",width+","+height+","+duration+",");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   395
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   396
		 __IriSP.jQuery("#Ldt-ShowAnnotation").click(function () { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   397
			 //__IriSP.jQuery(this).slideUp(); 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   398
		});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   399
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   400
		var LdtpPlayerY = __IriSP.jQuery("#Ldt-PlaceHolder").attr("top");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   401
		var LdtpPlayerX = __IriSP.jQuery("#Ldt-PlaceHolder").attr("left");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   402
		__IriSP.jQuery("#slider-range-min").slider({ //range: "min",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   403
			value: 0,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   404
			min: 1,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   405
			max: duration/1000,//1:54:52.66 = 3600+3240+
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   406
			step: 0.1,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   407
			slide: function(event, ui) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   408
				
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   409
				//__IriSP.jQuery("#amount").val(ui.value+" s");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   410
				//player.sendEvent('SEEK', ui.value)
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   411
				__IriSP.MyApiPlayer.seek(ui.value);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   412
				//changePageUrlOffset(ui.value);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   413
				//player.sendEvent('PAUSE')
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   414
			}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   415
		});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   416
		__IriSP.trace("__IriSP.createInterface","ICI");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   417
		__IriSP.jQuery("#amount").val(__IriSP.jQuery("#slider-range-min").slider("value")+" s");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   418
		__IriSP.jQuery(".Ldt-Control1 button:first").button({
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   419
			icons: {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   420
				primary: 'ui-icon-play'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   421
			},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   422
			text: false
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   423
		}).next().button({
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   424
			icons: {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   425
				primary: 'ui-icon-seek-next'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   426
			},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   427
			 text: false
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   428
		});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   429
		__IriSP.jQuery(".Ldt-Control2 button:first").button({
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   430
			icons: {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   431
				primary: 'ui-icon-transferthick-e-w'//,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   432
				//secondary: 'ui-icon-volume-off'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   433
			},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   434
			text: false
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   435
		}).next().button({
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   436
			icons: {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   437
				primary: 'ui-icon-volume-on'
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   438
			},
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   439
			 text: false
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   440
		});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   441
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   442
		// /!\ PB A MODIFIER 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   443
		//__IriSP.MyTags.draw();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   444
		__IriSP.trace("__IriSP.createInterface","ICI2");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   445
		__IriSP.jQuery("#ldt-CtrlPlay").attr("style","background-color:#CD21C24;");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   446
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   447
		__IriSP.jQuery("#Ldt-load-container").hide();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   448
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   449
		if(__IriSP.config.gui.mode=="radio" & __IriSP.jQuery.browser.msie!=true){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   450
			__IriSP.jQuery("#Ldtplayer1").attr("height","0");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   451
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   452
		__IriSP.trace("__IriSP.createInterface","3");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   453
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   454
		__IriSP.trace("__IriSP.createInterface","END");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   455
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   456
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   457
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   458
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   459
/*  API player - work in progress ... need refactoring of code */ 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   460
__IriSP.APIplayer = function (width,height,url,duration,streamerPath,MySwfPath){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   461
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   462
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   463
		this.player 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   464
		this.hashchangeUpdate 	= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   465
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   466
		this.width				= width;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   467
		this.height				= height;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   468
		this.url				= url;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   469
		this.duration			= duration;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   470
		this.streamerPath		= streamerPath;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   471
		this.MySwfPath			= MySwfPath;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   472
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   473
		__IriSP.MyApiPlayer		= this;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   474
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   475
		__IriSP.createPlayer(width,height,this.url,this.duration,this.streamerPath,this.MySwfPath);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   476
		__IriSP.trace("__IriSP.APIplayer","__IriSP.createPlayer");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   477
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   478
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   479
__IriSP.APIplayer.prototype.ready = function(player){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   480
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   481
	//__IriSP.trace("__IriSP.APIplayer.prototype.APIpReady"," __IriSP.createInterface");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   482
	__IriSP.createInterface(this.width,this.height,this.duration);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   483
	__IriSP.trace("__IriSP.APIplayer.prototype.APIpReady","END  __IriSP.createInterface");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   484
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   485
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   486
	// hashchange EVENT
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   487
	if (window.addEventListener){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   488
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   489
	// pour FIREFOX  hashchange EVENT
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   490
		window.addEventListener("hashchange", function() {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   491
		  var url = window.location.href;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   492
		  var time = __IriSP.retrieveTimeFragment(url);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   493
		  __IriSP.trace("__IriSP.APIplayer.prototype.ready",time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   494
		  if(__IriSP.MyApiPlayer.hashchangeUpdate==null){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   495
			__IriSP.MyApiPlayer.seek(time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   496
		  }else{
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   497
			__IriSP.MyApiPlayer.hashchangeUpdate=null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   498
		  }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   499
		}, false);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   500
	 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   501
	} 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   502
	else if (window.attachEvent){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   503
	// FOR IE hashchange EVENT
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   504
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   505
		window.attachEvent("onhashchange", function() {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   506
		  __IriSP.trace("hashchange",time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   507
		  var url = window.location.href;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   508
		  var time = __IriSP.retrieveTimeFragment(url);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   509
		  if(__IriSP.MyApiPlayer.hashchangeUpdate==null){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   510
			__IriSP.MyApiPlayer.seek(time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   511
		  }else{
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   512
			__IriSP.MyApiPlayer.hashchangeUpdate=null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   513
		  }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   514
		}, false);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   515
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   516
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   517
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   518
__IriSP.APIplayer.prototype.pause = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   519
	this.hashchangeUpdate = true;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   520
	__IriSP.player.sendEvent('PAUSE');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   521
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   522
__IriSP.APIplayer.prototype.play  = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   523
	this.hashchangeUpdate = true;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   524
	__IriSP.player.sendEvent('PLAY');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   525
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   526
__IriSP.APIplayer.prototype.mute  = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   527
	__IriSP.player.sendEvent('MUTE');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   528
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   529
__IriSP.APIplayer.prototype.share = function(network){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   530
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   531
	var MyMessage = "Je regarde :";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   532
	var MyURLNow = window.location.href;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   533
	var shareURL;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   534
	//alert(network+" : "+MyURLNow);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   535
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   536
	if(network == "facebook"){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   537
			shareURL = "http://www.facebook.com/share.php?u=";			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   538
		}else if(network == "twitter"){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   539
			shareURL  = "http://twitter.com/home?status="+MyMessage;	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   540
		}else if(network == "myspace"){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   541
			shareURL ="http://www.myspace.com/Modules/PostTo/Pages/?u=";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   542
		}else if(network == "delicious"){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   543
			shareURL = "http://delicious.com/save?url=";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   544
		}else if(network == "JameSpot"){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   545
			shareURL = "http://www.jamespot.com/?action=spotit&u=";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   546
			//alert(network+" non actif pour l'instant : "+MyURLNow);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   547
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   548
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   549
	window.location.href = shareURL+encodeURIComponent(MyURLNow);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   550
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   551
__IriSP.APIplayer.prototype.seek  = function (time){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   552
	__IriSP.player.sendEvent('SEEK', time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   553
	this.changePageUrlOffset(time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   554
}	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   555
__IriSP.APIplayer.prototype.update = function (time){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   556
	this.hashchangeUpdate = true;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   557
	__IriSP.player.sendEvent('SEEK', time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   558
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   559
__IriSP.APIplayer.prototype.changePageUrlOffset = function (time) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   560
	//alert(time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   561
  __IriSP.trace("__IriSP.APIplayer.prototype.changePageUrlOffset","CHANGE URL "+time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   562
  window.location.hash = "#t=" + time;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   563
  window.location.href =  window.location.href;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   564
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   565
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   566
/* MEDIA FRAGMENT FUNCTION */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   567
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   568
__IriSP.jumpToTimeoffset = function (form) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   569
	var time = form.time.value;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   570
	__IriSP.MyApiPlayer.changePageUrlOffset(time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   571
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   572
__IriSP.retrieveTimeFragment = function (url) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   573
  var pageoffset = 0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   574
  var offsettime = 0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   575
  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   576
  if (url.split("#")[1] != null) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   577
	pageoffset = url.split("#")[1];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   578
		if (pageoffset.substring(2) != null) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   579
			offsettime = pageoffset.substring(2);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   580
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   581
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   582
	return offsettime;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   583
}  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   584
__IriSP.ignoreTimeFragment = function(url){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   585
 if (url.split("#")[1] != null) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   586
	var pageurl= url.split("#")[0];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   587
 }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   588
 return pageurl;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   589
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   590
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   591
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   592
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   593
/* CODE SPECIAL JW PLAYER  creation + listener */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   594
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   595
__IriSP.currentPosition 	= 0; 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   596
__IriSP.currentVolume   	= 50; 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   597
__IriSP.player 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   598
__IriSP.startPosition 	= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   599
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   600
__IriSP.createPlayer = function (width,height,url,duration,streamerPath,MySwfPath) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   601
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   602
	__IriSP.trace("__IriSP.createPlayer","start");			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   603
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   604
	__IriSP.myUrlFragment = url.split(streamerPath);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   605
	var file = __IriSP.myUrlFragment[1];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   606
	var streamer = streamerPath;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   607
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   608
	var flashvars = {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   609
		streamer:streamer,
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   610
		file:file, 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   611
		live:"true",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   612
		autostart:"true",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   613
		controlbar:"none",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   614
		playerready:"__IriSP.playerReady"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   615
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   616
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   617
	var params = {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   618
		allowfullscreen:"true", 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   619
		allowscriptaccess:"always",
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   620
		wmode:"transparent"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   621
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   622
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   623
	var attributes = {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   624
		id:"Ldtplayer1",  
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   625
		name:"Ldtplayer1"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   626
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   627
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   628
	__IriSP.trace("__IriSP.createPlayer","SWFOBJECT src:"+__IriSP.config.player.src+" " +width+" "+height);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   629
	swfobject.embedSWF(__IriSP.config.player.src, "Ldt-PlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   630
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   631
	// need a methode to 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   632
	// re execute if this swf call does'nt work 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   633
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   634
__IriSP.playerReady  = function (thePlayer) {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   635
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   636
	//__IriSP.trace("__IriSP.playerReady","PLAYER READY !!!!!!!!!!!!");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   637
	__IriSP.player = window.document[thePlayer.id];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   638
	//__IriSP.trace("__IriSP.playerReady","API CALL "+__IriSP.player);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   639
	__IriSP.MyApiPlayer.ready(__IriSP.player);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   640
	//__IriSP.trace("__IriSP.playerReady","API CALL END ");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   641
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   642
	var url = document.location.href;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   643
	var time = __IriSP.retrieveTimeFragment(url);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   644
	//__IriSP.trace("__IriSP.playerReady"," "+url+" "+time );
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   645
	__IriSP.startPosition = time;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   646
	//__IriSP.trace("__IriSP.playerReady"," LISTENER LAUCHER");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   647
	__IriSP.addListeners();	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   648
	//__IriSP.trace("__IriSP.playerReady"," LISTENER END");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   649
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   650
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   651
__IriSP.addListeners = function () {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   652
	if (__IriSP.player) { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   653
		__IriSP.trace("__IriSP.addListeners","ADD  Listener ");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   654
		__IriSP.player.addModelListener("TIME", "__IriSP.positionListener");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   655
		__IriSP.player.addControllerListener("VOLUME", "__IriSP.volumeListener");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   656
		__IriSP.player.addModelListener('STATE', '__IriSP.stateMonitor');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   657
	} else {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   658
		__IriSP.setTimeout("addListeners()",100);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   659
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   660
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   661
	// et changer les boutons
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   662
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   663
__IriSP.stateMonitor = function (obj) { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   664
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   665
	 if(obj.newstate == 'PAUSED')
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   666
    {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   667
		__IriSP.trace("__IriSP.stateMonitor","PAUSE");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   668
		__IriSP.MyApiPlayer.changePageUrlOffset(__IriSP.currentPosition);			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   669
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   670
	} else if (obj.newstate == 'PLAYING'){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   671
		// une fois la video prete a lire  la déplacer au bon timecode 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   672
		if(__IriSP.startPosition!=null){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   673
			__IriSP.MyApiPlayer.update(__IriSP.startPosition);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   674
			__IriSP.startPosition = null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   675
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   676
	} else if (obj.newstate == 'BUFFERING'){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   677
		__IriSP.trace("__IriSP.stateMonitor","BUFFERING : ");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   678
		//changePageUrlOffset(currentPosition);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   679
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   680
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   681
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   682
__IriSP.positionListener = function(obj) { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   683
	//__IriSP.trace("__IriSP.positionListener",obj.position);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   684
	__IriSP.currentPosition = obj.position; 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   685
	var tmp = document.getElementById("posit");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   686
	if (tmp) { tmp.innerHTML = "position: " + __IriSP.currentPosition; }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   687
	__IriSP.jQuery("#slider-range-min").slider("value", obj.position);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   688
	__IriSP.jQuery("#amount").val(obj.position+" s");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   689
	// afficher annotation 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   690
	__IriSP.MyLdt.checkTime(__IriSP.currentPosition);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   691
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   692
__IriSP.volumeListener   = function (obj) { 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   693
	__IriSP.currentVolume = obj.percentage; 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   694
	var tmp = document.getElementById("vol");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   695
	if (tmp) { tmp.innerHTML = "volume: " + __IriSP.currentVolume; }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   696
}	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   697
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   698
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   699
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   700
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   701
/* 	UTIL */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   702
// code from http://stackoverflow.com/questions/822452/strip-html-from-text-javascript
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   703
__IriSP.stripHtml = function(s){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   704
	return s.replace(/\\&/g, '&amp;').replace(/\\</g, '&lt;').replace(/\\>/g, '&gt;').replace(/\\t/g, '&nbsp;&nbsp;&nbsp;').replace(/\\n/g, '<br />').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   705
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   706
// conversion de couleur Decimal vers HexaDecimal || 000 si fff 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   707
__IriSP.DEC_HEXA_COLOR = function (dec){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   708
	 var hexa='0123456789ABCDEF',hex='';
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   709
	 var tmp;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   710
	 while (dec>15){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   711
		  tmp = dec-(Math.floor(dec/16))*16;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   712
		  hex = hexa.charAt(tmp)+hex;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   713
		  dec = Math.floor(dec/16);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   714
	 }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   715
	 hex = hexa.charAt(dec)+hex;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   716
	 if (hex == "FFCC00"){ hex="";/* by default color of Ldt annotation */ }
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   717
	 return(hex);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   718
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   719
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   720
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   721
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   722
/* CLASS Ligne (annotationType) 	*/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   723
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   724
__IriSP.LDTligne 	= null;		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   725
__IriSP.Ligne = function (id,title,description,duration){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   726
	this.id 		 = id;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   727
	this.title 		 = title;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   728
	this.description = description;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   729
	//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   730
	this.annotations = new Array();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   731
	this.duration = duration;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   732
	__IriSP.LDTligne = this;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   733
	__IriSP.trace("__IriSP.Ligne","CREATE "+__IriSP.LDTligne);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   734
}	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   735
__IriSP.Ligne.prototype.addAnnotation = function (id,begin,end,media,title,description,color,tags){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   736
	var myAnnotation = new __IriSP.Annotation(id,begin,end,media,title,description,color,tags,this.duration);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   737
	this.annotations.push(myAnnotation);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   738
	//__IriSP.trace("__IriSP.Ligne.prototype.addAnnotation  ","add annotation "+title);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   739
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   740
__IriSP.Ligne.prototype.onClickLigneAnnotation = function(id){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   741
	//changePageUrlOffset(currentPosition);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   742
	//player.sendEvent('SEEK', this.start);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   743
	//__IriSP.trace("SEEK",this.start);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   744
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   745
__IriSP.Ligne.prototype.searchLigneAnnotation = function(id){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   746
	/*for (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   747
	}*/
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   748
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   749
__IriSP.Ligne.prototype.listAnnotations = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   750
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   751
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   752
__IriSP.Ligne.prototype.nextAnnotation = function (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   753
	var annotationCibleNumber = this.numAnnotation(this.annotationOldRead)+1;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   754
	var annotationCible = this.annotations[annotationCibleNumber];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   755
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   756
	if(annotationCibleNumber<this.annotations.length-1){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   757
		annotationCible.begin
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   758
		__IriSP.player .sendEvent('SEEK', annotationCible.begin/1000);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   759
		__IriSP.trace("LIGNE  ","| next = "+annotationCibleNumber+" - "+this.annotations.length+" | seek :"+annotationCible.begin/1000);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   760
	}else{
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   761
		__IriSP.player .sendEvent('SEEK', this.annotations[0].begin/1000);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   762
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   763
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   764
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   765
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   766
__IriSP.Ligne.prototype.numAnnotation = function (annotationCible){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   767
	for (var i=0; i < this.annotations.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   768
		if(annotationCible == this.annotations[i]){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   769
			return i;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   770
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   771
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   772
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   773
__IriSP.Ligne.prototype.checkTime = function(time){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   774
	var annotationTempo = -1;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   775
	//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",time);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   776
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   777
	for (var i=0; i < this.annotations.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   778
		var annotationTempo = this.annotations[i];	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   779
		if (time>annotationTempo.begin/1000 && time<annotationTempo.end/1000){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   780
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   781
				// different form the previous
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   782
				if(annotationTempo!=this.annotationOldRead){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   783
					this.annotationOldRead = annotationTempo;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   784
					//__IriSP.trace("Check : ","annotation ici : "+i+" title "+annotationTempo.title);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   785
					//__IriSP.jQuery('#Ldt-ShowAnnotation').slideUp();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   786
					//http://api.jquery.com/delay/  -> 1.4
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   787
					//__IriSP.jQuery("#Ldt-SaTitle").delay(100).text(annotationTempo.title);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   788
					//__IriSP.jQuery("#Ldt-SaDescription").delay(100).text(annotationTempo.description);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   789
					//__IriSP.jQuery('#Ldt-ShowAnnotation').delay(100).slideDown();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   790
					//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",annotationTempo.title+" "+annotationTempo.description );
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   791
					__IriSP.jQuery("#Ldt-SaTitle").text(annotationTempo.title);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   792
					__IriSP.jQuery("#Ldt-SaDescription").text(annotationTempo.description);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   793
					
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   794
					__IriSP.jQuery("#Ldt-SaDescription").text(annotationTempo.description);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   795
					__IriSP.jQuery("#Ldt-SaKeywordText").html("Mots clefs : "+annotationTempo.htmlTags);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   796
					
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   797
					//__IriSP.jQuery('#Ldt-ShowAnnotation').slideDown();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   798
					var startPourcent 	= annotationTempo.timeToPourcent((annotationTempo.begin*1+(annotationTempo.end*1-annotationTempo.begin*1)/2),annotationTempo.duration*1); 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   799
					__IriSP.jQuery("#Ldt-Show-Arrow").animate({left:startPourcent+'%'},1000);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   800
					//alert(startPourcent);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   801
					var tempolinkurl  =  __IriSP.ignoreTimeFragment(window.location.href)+"#t="+(this.annotations[i].begin/1000);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   802
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   803
			break;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   804
		} 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   805
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   806
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   807
	// si il y en a pas : retractation du volet 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   808
	if( annotationTempo == -1){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   809
		if(annotationTempo!=this.annotationOldRead){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   810
			__IriSP.trace("Check : ","pas d'annotation ici ");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   811
			__IriSP.jQuery('#Ldt-ShowAnnotation').slideUp();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   812
			this.annotationOldRead = annotationTempo;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   813
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   814
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   815
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   816
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   817
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   818
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   819
/* CLASS Annotation */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   820
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   821
__IriSP.Annotation = function (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   822
	var id 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   823
	var begin 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   824
	var end 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   825
	var media 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   826
	var description	= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   827
	var title 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   828
	var color 			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   829
	var tags			= null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   830
	__IriSP.trace("annotation ","r�ussi")
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   831
}	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   832
__IriSP.Annotation = function(id,begin,end,media,title,description,color,tags,duration){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   833
	this.id 			= id;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   834
	this.begin 			= begin;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   835
	this.end 			= end;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   836
	this.media 			= media;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   837
	this.description 	= description;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   838
	this.title 			= title;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   839
	this.color 			= color;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   840
	this.tags			= tags;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   841
	this.htmlTags		= "";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   842
	this.duration		= duration;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   843
	// draw it 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   844
	this.draw();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   845
	this.drawTags();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   846
	//
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   847
	__IriSP.trace("Annotation created : ",id);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   848
}	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   849
__IriSP.Annotation.prototype.draw = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   850
	//alert (this.duration);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   851
	var startPourcent 	= this.timeToPourcent(this.begin,this.duration); // temps du media 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   852
	var endPourcent 	= this.timeToPourcent(this.end,this.duration)-startPourcent;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   853
	var titleForDiv		= this.title.substr(0,55);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   854
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   855
	__IriSP.jQueryAnnotationTemplate = "<div title='"+__IriSP.stripHtml(titleForDiv)+"' id='"+this.id+"'  class='ui-slider-range ui-slider-range-min ui-widget-header iri-chapter' width='100%' style=\"left:"+startPourcent+"%; width:"+endPourcent+"%; padding-top:15px; border-left:solid 1px #aaaaaa; border-right:solid 1px #aaaaaa; background:#"+__IriSP.DEC_HEXA_COLOR(this.color)+";\" onClick=\"__IriSP.MyApiPlayer.seek('"+Math.round(this.begin/1000)+"');__IriSP.jQuery('#Ldt-ShowAnnotation').slideDown();\"    ></div> ";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   856
	//alert(this.color+" : "+DEC_HEXA_COLOR(this.color));
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   857
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   858
	__IriSP.jQuerytoolTipTemplate = "<div class='Ldt-tooltip'>"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   859
						+"<div class='title'>"+__IriSP.stripHtml(this.title)+"</div>"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   860
						+"<div class='time'>"+this.begin+" : "+this.end+"</div>"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   861
						+"<div class='description'>"+__IriSP.stripHtml(this.description)+"</div>"
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   862
						+"</div>";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   863
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   864
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   865
	__IriSP.jQuery("<div>"+__IriSP.jQueryAnnotationTemplate+"</div>").appendTo("#Ldt-Annotations");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   866
	// TOOLTIP BUG ! 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   867
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   868
	__IriSP.jQuery("#"+this.id).tooltip({ effect: 'slide'});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   869
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   870
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   871
	__IriSP.jQuery("#"+this.id).fadeTo(0,0.3);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   872
	__IriSP.jQuery("#"+this.id).mouseover(function() {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   873
		__IriSP.jQuery("#"+this.id).animate({opacity: 0.6}, 5)
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   874
	}).mouseout(function(){		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   875
		__IriSP.jQuery("#"+this.id).animate({opacity: 0.3}, 5)
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   876
	});
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   877
	__IriSP.trace("__IriSP.Annotation.prototype.draw","ADD ANOTATION : "+this.begin+" "+this.end+" "+__IriSP.stripHtml(this.title)+" | "+startPourcent+" | "+endPourcent+" | duration = "+this.duration);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   878
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   879
}	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   880
__IriSP.Annotation.prototype.drawTags = function(){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   881
	var KeywordPattern = '<a href=\"\"> '+' </a>';
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   882
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   883
	//__IriSP.trace(" !? Tags : ",this.tags);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   884
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   885
	if (this.tags!=undefined){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   886
		for (var i = 0; i < this.tags.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   887
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   888
			//this.htmlTags += '<span onclick=\"ShowTag('+this.tags[i]['id-ref']+');\"  > '+MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   889
			this.htmlTags += '<span> '+__IriSP.MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   890
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   891
		}		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   892
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   893
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   894
__IriSP.Annotation.prototype.tootTipAnnotation = function() {
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   895
	// 1 chercher le div correspondant
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   896
	// 2 y mettre les information
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   897
	return this.color + ' ' + this.type + ' apple';
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   898
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   899
__IriSP.Annotation.prototype.onRollOverAnnotation = function (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   900
	this.tootTip();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   901
}		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   902
__IriSP.Annotation.prototype.timeToPourcent = function(time,timetotal){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   903
	return (parseInt(Math.round(time/timetotal*100)));
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   904
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   905
 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   906
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   907
/* CLASS Tags */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   908
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   909
__IriSP.Tags = function(object){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   910
	this.myTags 	=	object;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   911
	this.htmlTags 	= 	null;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   912
	this.weigthMax 	= 	0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   913
	//this.mySegments  = 	new array();
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   914
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   915
__IriSP.Tags.prototype.addAnnotation = function (annotation){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   916
	for (var i = 0; i < this.myTags.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   917
		this.myTags[i].mySegments = new Array(); 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   918
		if (annotation.tags!=null){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   919
			for (var j = 0; j < annotation.tags.length; ++j){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   920
				if (this.myTags[i]['id'] == annotation.tags[j]['id-ref']){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   921
					this.myTags[i].mySegments.push([annotation.begin,annotation.end,annotation.id]);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   922
					var weigthTempo = this.myTags[i].mySegments.length
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   923
					var tempo = this.myTags[i].mySegments[weigthTempo-1];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   924
					//__IriSP.trace ("__IriSP.Tags.prototype.addAnnotation ","  "+this.myTags[i]['meta']['dc:title']+" "+this.myTags[i]['id']+" : "+tempo[0]+" - "+tempo[1]);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   925
					
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   926
					if (this.weigthMax < weigthTempo ){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   927
						this.weigthMax = weigthTempo;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   928
					}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   929
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   930
			}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   931
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   932
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   933
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   934
__IriSP.Tags.prototype.getTitle = function (id){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   935
	for (var i = 0; i < this.myTags.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   936
		if(this.myTags[i]['id']==id){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   937
			return(this.myTags[i]['meta']['dc:title']);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   938
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   939
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   940
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   941
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   942
__IriSP.Tags.prototype.draw = function (){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   943
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   944
	__IriSP.trace("__IriSP.Tags.prototype.draw"," !!! WELL START " );
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   945
	for (var i = 0; i < this.myTags.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   946
		__IriSP.trace("__IriSP.Tags.prototype.draw"," ADD Tags : "+this.myTags[i]['id']);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   947
		if(this.myTags[i]['id']!=null){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   948
		this.htmlTags += '<span onclick=\"MyTags.show( \''+this.myTags[i]['id']
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   949
						+'\');\" style=\"font-size:'  +((this.myTags[i].mySegments.length/this.weigthMax*10)+8)
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   950
						+'px;\" alt=\"'+this.myTags[i].mySegments.length
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   951
						+'\"> '+this.myTags[i]['meta']['dc:title']+' </span>'+' , ';
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   952
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   953
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   954
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   955
	__IriSP.jQuery('#Ldt-Tags').html(this.htmlTags);
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   956
	__IriSP.trace("__IriSP.Tags.prototype.draw"," !!!!  END WMAX= "+this.weigthMax );
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   957
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   958
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   959
__IriSP.Tags.prototype.show = function (id){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   960
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   961
	var timeStartOffsetA	=	100000000000000000000;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   962
	var timeStartOffsetB	=	100000000000000000000;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   963
	var timeEndOffsetA		=	0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   964
	var timeEndOffsetB		=	0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   965
	var timeStartID;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   966
	var timeEndID;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   967
	var WidthPourCent;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   968
	var leftPourCent;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   969
	var timeStartOffset;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   970
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   971
	// case 1 : seul segment 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   972
	// case 2 : 2 ou X segments 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   973
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   974
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   975
	for (var i = 0; i < this.myTags.length; ++i){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   976
		if (this.myTags[i]['id']==id){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   977
			__IriSP.trace("######### TAG DRAWing : "," END" );		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   978
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   979
			for (var j = 0; j < this.myTags[i].mySegments.length; ++j){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   980
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   981
					timeStartOffsetA = this.myTags[i].mySegments[j][0];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   982
					timeStartOffsetB = this.myTags[i].mySegments[j][1];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   983
					timeStartID		 = this.myTags[i].mySegments[j][2]
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   984
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   985
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   986
					timeEndOffsetA  = this.myTags[i].mySegments[j][0];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   987
					timeEndOffsetB  = this.myTags[i].mySegments[j][1];
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   988
					timeEndID		= this.myTags[i].mySegments[j][2]
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   989
				}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   990
			}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   991
			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   992
		}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   993
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   994
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   995
	// -------------------------------------------------
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   996
	// 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   997
	// -------------------------------------------------
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   998
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
   999
	leftPourCent 	= __IriSP.timeToPourcent((timeStartOffsetA*1+(timeStartOffsetB-timeStartOffsetA)/2),__IriSP.MyLdt.duration); 
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1000
	WidthPourCent	= __IriSP.timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),__IriSP.MyLdt.duration)-leftPourCent; 			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1001
	//WidthPourCent	= timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),MyLdt.duration)-startPourcent; 			
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1002
	__IriSP.jQuery("#Ldt-Show-Tags").css('left',leftPourCent+'%');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1003
	__IriSP.jQuery("#Ldt-Show-Tags").css('width',WidthPourCent+'%');
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1004
	// like arrow script
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1005
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1006
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1007
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1008
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1009
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1010
		
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1011
/* CLASS TRACE */
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1012
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1013
__IriSP.traceNum=0;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1014
__IriSP.trace = function(msg,value){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1015
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1016
	if(__IriSP.config.gui.debug===true){
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1017
		__IriSP.traceNum += 1;
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1018
		__IriSP.jQuery("<div>"+__IriSP.traceNum+" - "+msg+" : "+value+"</div>").appendTo("#Ldt-output");
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1019
	}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1020
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1021
}
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1022
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1023
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1024
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1025
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1026
	
22ab430e9b64 Corrections on models and general structure
wakimd
parents:
diff changeset
  1027