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