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