Index: trunk/phase3/js2/mwEmbed/example_usage/Player_Themable.html |
— | — | @@ -12,23 +12,22 @@ |
13 | 13 | To play with dynamic Themes install <a href="http://jqueryui.com/themeroller/developertool/">Themeroller</a><p><p> |
14 | 14 | |
15 | 15 | <div style="width:450px;float:left"> |
16 | | -<video src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Okapia_johnstoni5.ogg" |
17 | | - poster="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Okapia_johnstoni5.ogg/mid-Okapia_johnstoni5.ogg.jpg" durationHint="15"></video> |
| 16 | +<video src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" |
| 17 | + poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"></video> |
18 | 18 | <b>Source Code used:</b><br> |
19 | | -<textarea cols="50" rows="7"><video style="width:400px;height:288px" poster="http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_id=71&t=1:23:16&size=400x300" |
20 | | -src="http://metavidstorage01.ucsc.edu/media/house_proceeding_07-18-06_00.ogg?t=1:23:16/1:23:44"></video></textarea> |
| 19 | +<textarea cols="50" rows="7"><video style="width:400px;height:288px" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
| 20 | +src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea> |
21 | 21 | </div> |
22 | 22 | |
23 | | - |
24 | 23 | <div style="width:450px;float:left"> |
25 | | -<video skin_name="kskin" src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Okapia_johnstoni5.ogg" |
26 | | - poster="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Okapia_johnstoni5.ogg/mid-Okapia_johnstoni5.ogg.jpg" durationHint="15"></video> |
27 | | -<b>(ksin) Embed Code used:</b><br> |
28 | | -<textarea cols="50" rows="7"><video skin_name="kskin" src="http://upload.wikimedia.org/wikipedia/commons/d/d3/Okapia_johnstoni5.ogg" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Okapia_johnstoni5.ogg/mid-Okapia_johnstoni5.ogg.jpg" durationHint="15"></video></textarea> |
| 24 | +<video skin_name="kskin" src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg" |
| 25 | + poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"></video> |
| 26 | +<b>(ksin) Source Code used:</b><br> |
| 27 | +<textarea cols="50" rows="7"><video style="width:400px;height:288px" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" |
| 28 | +src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight_to_Brussels.ogg"></video></textarea> |
29 | 29 | </div> |
30 | 30 | |
31 | 31 | |
32 | | - |
33 | 32 | </body> |
34 | 33 | </html> |
35 | 34 | |
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -240,31 +240,8 @@ |
241 | 241 | }, |
242 | 242 | getImageObj:function( rObj, size, callback ){ |
243 | 243 | if( rObj.mime=='application/ogg' ) |
244 | | - return callback( {'url':rObj.src, 'poster' : rObj.url } ); |
| 244 | + return callback( {'url':rObj.src, 'poster' : rObj.url } ); |
245 | 245 | |
246 | | - //we can just use direct request urls |
247 | | - //@@todo thumb.php has some issues (cant serve the full image size, has poor erro handling etc) |
248 | | - /*var baseImgUrl = this.cp.api_url.replace('api.php', 'thumb.php'); |
249 | | - if ( rObj.mime=='image/jpeg' || rObj.mime=='image/png' ){ |
250 | | - //if requested size is greater than org size return reduced size obj: |
251 | | - if( size.width > rObj.orgwidth){ |
252 | | - callback({ |
253 | | - 'url' : baseImgUrl + '?f=' + rObj.titleKey.replace(/\s/g, '_') + '&w='+ rObj.orgwidth, |
254 | | - 'width' : rObj.orgwidth, |
255 | | - 'height': rObj.orgheight |
256 | | - }); |
257 | | - return false; |
258 | | - } |
259 | | - } |
260 | | - //assuming svg or size is in range: give them requested size |
261 | | - callback({ |
262 | | - 'url' : baseImgUrl + '?f=' + rObj.titleKey + '&w='+ size.width, |
263 | | - 'width' : size.width, |
264 | | - 'height': Math.round( ( rObj.orgheight / rObj.orgwidth)*size.width ) |
265 | | - }); |
266 | | - return false; |
267 | | - */ |
268 | | - |
269 | 246 | //his could be depreciated if thumb.php improves |
270 | 247 | var reqObj = { |
271 | 248 | 'action':'query', |
Property changes on: trunk/phase3/js2/mwEmbed/php/script-cache |
___________________________________________________________________ |
Name: svn:ignore |
272 | 249 | + 0 |
1 |
2 |
3 |
4 |
5 |
6 |
8 |
9 |
a |
c |
d |
e |
f |
Index: trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php |
— | — | @@ -355,6 +355,7 @@ |
356 | 356 | 'mwe-embed_site_or_blog' => 'Embed on your site or blog', |
357 | 357 | 'mwe-related_videos' => 'Related videos', |
358 | 358 | 'mwe-seeking' => 'seeking', |
| 359 | + "mwe-copy-code" => "Copy code", |
359 | 360 | ); |
360 | 361 | |
361 | 362 | /** Message documentation (Message documentation) |
Index: trunk/phase3/js2/mwEmbed/skins/kskin/playerSkin.css |
— | — | @@ -179,3 +179,57 @@ |
180 | 180 | .k-menu-screens li a.active, .k-menu-screens li a:hover.active { background-position: -85px -247px;} |
181 | 181 | .k-menu-screens li a:hover { background-position: -85px -260px;} |
182 | 182 | .k-menu-screens a { color:#BBBBBB; } |
| 183 | + |
| 184 | + |
| 185 | +.k-menu textarea { |
| 186 | + background:none repeat scroll 0 0 transparent; |
| 187 | + border-color:#000000 -moz-use-text-color -moz-use-text-color #000000; |
| 188 | + border-style:solid none none solid; |
| 189 | + border-width:2px medium medium 2px; |
| 190 | + color:#CCCCCC; |
| 191 | + font:11px arial,sans-serif; |
| 192 | + height:15px; |
| 193 | + overflow:hidden; |
| 194 | + padding-left:2px; |
| 195 | + width:100%; |
| 196 | +} |
| 197 | +.menu-screen.menu-share button { |
| 198 | + background:url("images/ksprite.png") no-repeat scroll 0 -81px #D4D4D4; |
| 199 | + border:1px solid #000000; |
| 200 | + color:#000000; |
| 201 | + float:right; |
| 202 | + height:24px; |
| 203 | + padding:0 5px 3px; |
| 204 | + width:84px; |
| 205 | + font-size:1em; |
| 206 | +} |
| 207 | +.k-player .menu-screen.menu-share div.ui-state-highlight { |
| 208 | + background:none repeat scroll 0 0 transparent; |
| 209 | + border-color:#554926; |
| 210 | + color:#FFE96E; |
| 211 | + float:left; |
| 212 | + padding:2px 5px; |
| 213 | +} |
| 214 | +.k-player .menu-screen.menu-share div.ui-state-highlight a { |
| 215 | + color:#FFE96E; |
| 216 | + font-weight:bold; |
| 217 | +} |
| 218 | + |
| 219 | +.k-player .volume-slide { |
| 220 | + width:38px !important; |
| 221 | +} |
| 222 | +.k-player .volume-slider .ui-slider-range { |
| 223 | + -moz-border-radius:0 0 0 0; |
| 224 | + background:url("images/ksprite.png") repeat-x scroll -66px -306px transparent; |
| 225 | + height:17px; |
| 226 | + position:absolute; |
| 227 | +} |
| 228 | +.k-player .volume-slider a.ui-slider-handle { |
| 229 | + background:none repeat scroll 0 0 transparent; |
| 230 | + border:medium none; |
| 231 | + display:block; |
| 232 | + height:18px; |
| 233 | + margin:-3px 5px 0 -1px; |
| 234 | + position:absolute; |
| 235 | + width:8px; |
| 236 | +} |
\ No newline at end of file |
Index: trunk/phase3/js2/mwEmbed/skins/kskin/kskin.js |
— | — | @@ -7,6 +7,7 @@ |
8 | 8 | //display time progres |
9 | 9 | long_time_disp: false, |
10 | 10 | body_options: false, |
| 11 | + volume_layout: 'horizontal', |
11 | 12 | components:{ |
12 | 13 | 'play-btn-large' : { |
13 | 14 | 'h' : 55 |
— | — | @@ -18,6 +19,9 @@ |
19 | 20 | '<span>' + gM('mwe-menu_btn') + '</span>' + |
20 | 21 | '</div>' |
21 | 22 | } |
| 23 | + }, |
| 24 | + 'time_display':{ |
| 25 | + 'w':70 |
22 | 26 | }, |
23 | 27 | 'mv_embedded_options':{ |
24 | 28 | 'w':0, |
— | — | @@ -107,6 +111,32 @@ |
108 | 112 | $tp.find('.play-btn-large').fadeOut('fast'); |
109 | 113 | } |
110 | 114 | }); |
| 115 | + |
| 116 | + //slider: |
| 117 | + $tp.find('.volume-slider').slider({ |
| 118 | + range: "min", |
| 119 | + value: 80, |
| 120 | + min: 0, |
| 121 | + max: 100, |
| 122 | + slide: function(event, ui) { |
| 123 | + embedObj.updateVolumen(ui.value/100); |
| 124 | + }, |
| 125 | + change: function(event, ui){ |
| 126 | + var level = ui.value/100; |
| 127 | + if (level==0) { |
| 128 | + $tp.find('.k-volume span').addClass('ui-icon-volume-off'); |
| 129 | + }else{ |
| 130 | + $tp.find('.k-volume span').removeClass('ui-icon-volume-off'); |
| 131 | + } |
| 132 | + //only run the onChange event if done by a user slide: |
| 133 | + if(embedObj.userSlide){ |
| 134 | + embedObj.userSlide=false; |
| 135 | + embedObj.seeking=true; |
| 136 | +// var perc = ui.value/100; |
| 137 | + embedObj.updateVolumen(level); |
| 138 | + } |
| 139 | + } |
| 140 | + }); |
111 | 141 | |
112 | 142 | } |
113 | 143 | } |
\ No newline at end of file |
Index: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js |
— | — | @@ -32,6 +32,8 @@ |
33 | 33 | pClass : 'mv-player', |
34 | 34 | long_time_disp: true, |
35 | 35 | body_options : true, |
| 36 | + //default volume layout is "vertical" |
| 37 | + volume_layout : 'vertical', |
36 | 38 | height:29, |
37 | 39 | supports:{ |
38 | 40 | 'options':true, |
— | — | @@ -187,7 +189,11 @@ |
188 | 190 | var perc = ui.value/1000; |
189 | 191 | embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec); |
190 | 192 | //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time); |
191 | | - embedObj.setStatus( gM('mwe-seek_to', embedObj.jump_time ) ); |
| 193 | + if( _this.long_time_disp ){ |
| 194 | + embedObj.setStatus( gM('mwe-seek_to', embedObj.jump_time ) ); |
| 195 | + }else{ |
| 196 | + embedObj.setStatus( embedObj.jump_time ); |
| 197 | + } |
192 | 198 | //update the thumbnail / frame |
193 | 199 | if(embedObj.isPlaying==false){ |
194 | 200 | embedObj.updateThumbPerc( perc ); |
— | — | @@ -231,13 +237,23 @@ |
232 | 238 | $opt.hide(); |
233 | 239 | return false; |
234 | 240 | }) |
235 | | - $opt.find('.vo_showcode').click(function(){ |
236 | | - embedObj.showEmbedCode(); |
| 241 | + $opt.find('.vo_showcode').click(function(){ |
| 242 | + embedObj.displayHTML(); |
| 243 | + embedObj.showShare( $tp.find('.videoOptionsComplete') ); |
237 | 244 | $opt.hide(); |
238 | 245 | return false; |
239 | 246 | }); |
240 | | - |
241 | | - //volume binding: |
| 247 | + this.doVolumeBinding(); |
| 248 | + |
| 249 | + //check if we have any custom skin hooks to run (only one per skin) |
| 250 | + if( this.addSkinControlHooks && typeof( this.addSkinControlHooks) == 'function') |
| 251 | + this.addSkinControlHooks(); |
| 252 | + }, |
| 253 | + doVolumeBinding:function(){ |
| 254 | + var embedObj = this.embedObj; |
| 255 | + var _this = this; |
| 256 | + var $tp=$j('#' + embedObj.id); |
| 257 | + //default volume binding: |
242 | 258 | var hoverOverDelay=false; |
243 | 259 | $tp.find('.volume_control').unbind().btnBind().click(function(){ |
244 | 260 | $j('#' +embedObj.id).get(0).toggleMute(); |
— | — | @@ -289,10 +305,6 @@ |
290 | 306 | } |
291 | 307 | } |
292 | 308 | }); |
293 | | - |
294 | | - //check if we have any custom skin hooks to run (only one per skin) |
295 | | - if( this.addSkinControlHooks && typeof( this.addSkinControlHooks) == 'function') |
296 | | - this.addSkinControlHooks(); |
297 | 309 | }, |
298 | 310 | getMvBufferHtml:function(){ |
299 | 311 | return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' + |
— | — | @@ -392,13 +404,21 @@ |
393 | 405 | }, |
394 | 406 | 'volume_control':{ |
395 | 407 | 'w':23, |
396 | | - 'o':function( ctrlObj ){ |
397 | | - return '<div title="' + gM('mwe-volume_control') + '" class="ui-state-default ui-corner-all ui-icon_link rButton volume_control">' + |
398 | | - '<span class="ui-icon ui-icon-volume-on"></span>' + |
399 | | - '<div style="position:absolute;display:none;" id="vol_container_'+ctrlObj.id+'" class="vol_container ui-corner-all">' + |
400 | | - '<div class="volume_bar" id="volume_bar_' + ctrlObj.id + '"></div>' + |
401 | | - '</div>'+ |
402 | | - '</div>'; |
| 408 | + 'o':function( ctrlObj ){ |
| 409 | + var o=''; |
| 410 | + if ( ctrlObj.volume_layout == 'horizontal' ) |
| 411 | + o+='<div class="ui-slider ui-slider-horizontal rButton volume-slider"></div>'; |
| 412 | + |
| 413 | + o+= '<div title="' + gM('mwe-volume_control') + '" class="ui-state-default ui-corner-all ui-icon_link rButton volume_control">' + |
| 414 | + '<span class="ui-icon ui-icon-volume-on"></span>'; |
| 415 | + |
| 416 | + if( ctrlObj.volume_layout == 'vertical'){ |
| 417 | + o+='<div style="position:absolute;display:none;" id="vol_container_'+ctrlObj.id+'" class="vol_container ui-corner-all">' + |
| 418 | + '<div class="volume_bar" id="volume_bar_' + ctrlObj.id + '"></div>' + |
| 419 | + '</div>'; |
| 420 | + } |
| 421 | + o+= '</div>'; |
| 422 | + return o; |
403 | 423 | } |
404 | 424 | }, |
405 | 425 | 'time_display':{ |
Index: trunk/phase3/js2/mwEmbed/skins/mvpcf/playerSkin.css |
— | — | @@ -127,4 +127,39 @@ |
128 | 128 | .inOutSlider .ui-slider-handle{ |
129 | 129 | width:8px; |
130 | 130 | cusror: move; |
131 | | -} |
\ No newline at end of file |
| 131 | +} |
| 132 | + |
| 133 | + |
| 134 | +.videoOptionsComplete textarea { |
| 135 | + background:none repeat scroll 0 0 transparent; |
| 136 | + border-color:#333 -moz-use-text-color -moz-use-text-color #333; |
| 137 | + border-style:solid none none solid; |
| 138 | + border-width:2px medium medium 2px; |
| 139 | + color:#CCCCCC; |
| 140 | + font:11px arial,sans-serif; |
| 141 | + height:15px; |
| 142 | + overflow:hidden; |
| 143 | + padding-left:2px; |
| 144 | + width:100%; |
| 145 | +} |
| 146 | +.videoOptionsComplete .copycode { |
| 147 | + background:url("images/ksprite.png") no-repeat scroll 0 -81px #D4D4D4; |
| 148 | + border:1px solid #000000; |
| 149 | + color:#000000; |
| 150 | + float:right; |
| 151 | + height:24px; |
| 152 | + padding:0 5px 3px; |
| 153 | + width:84px; |
| 154 | + font-size:1em; |
| 155 | +} |
| 156 | +.videoOptionsComplete div.ui-state-highlight { |
| 157 | + background:none repeat scroll 0 0 transparent; |
| 158 | + border-color:#554926; |
| 159 | + color:#FFE96E; |
| 160 | + float:left; |
| 161 | + padding:2px 5px; |
| 162 | +} |
| 163 | +.videoOptionsComplete div.ui-state-highlight a { |
| 164 | + color:#FFE96E; |
| 165 | + font-weight:bold; |
| 166 | +} |
Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -14,16 +14,8 @@ |
15 | 15 | * (in cases where media will be hosted in a different place than the embedding page) |
16 | 16 | * |
17 | 17 | */ |
18 | | -// Fix multiple instances of mv_embed (i.e. include twice from two different servers) |
19 | | -var MV_DO_INIT=true; |
20 | | -if( MV_EMBED_VERSION ){ |
21 | | - MV_DO_INIT=false; |
22 | | -} |
23 | | -// Used to grab fresh copies of scripts. |
24 | | -var MV_EMBED_VERSION = '1.0r20'; |
25 | 18 | |
26 | 19 | |
27 | | - |
28 | 20 | /** |
29 | 21 | * AutoLoader paths |
30 | 22 | * @path The path to the file (or set of files) with ending slash |
— | — | @@ -194,7 +186,8 @@ |
195 | 187 | // For use when mv_embed with script-loader is in the root MediaWiki path |
196 | 188 | var mediaWiki_mvEmbed_path = 'js2/mwEmbed/'; |
197 | 189 | |
198 | | -var _global = this; // Global obj (depreciate use window) |
| 190 | +//The global scope: will be depreciated once we get everything into $mw |
| 191 | +var _global = this; |
199 | 192 | |
200 | 193 | /* |
201 | 194 | * setup the empty global $mw object |
— | — | @@ -206,9 +199,6 @@ |
207 | 200 | } |
208 | 201 | |
209 | 202 | //@@todo move these into $mw |
210 | | -var mv_init_done = false; |
211 | | -var global_cb_count = 0; |
212 | | -var global_player_list = new Array(); // The global player list per page |
213 | 203 | var global_req_cb = new Array(); // The global request callback array |
214 | 204 | |
215 | 205 | // Get the mv_embed location if it has not been set |
— | — | @@ -230,17 +220,17 @@ |
231 | 221 | 'jui_skin' : 'redmond', |
232 | 222 | 'video_size' : '400x300' |
233 | 223 | } |
| 224 | + // the version of mwEmbed |
| 225 | + $.version = '1.0r21'; |
234 | 226 | |
235 | 227 | /* |
236 | | - * global flags |
| 228 | + * some global containers flags |
237 | 229 | */ |
238 | | - $.g = { |
239 | | - 'skin_list' : new Array(), |
240 | | - 'mv_init_done' : false, |
241 | | - 'global_cb_count' : 0, |
242 | | - 'global_player_list' : new Array(), // The global player list per page |
243 | | - 'global_req_cb' : new Array() // The global request callback array |
244 | | - } |
| 230 | + $.skin_list = new Array(); |
| 231 | + $.init_done = false; |
| 232 | + $.cb_count = 0; |
| 233 | + $.player_list = new Array(), // The global player list per page |
| 234 | + $.req_cb = new Array() // The global request callback array |
245 | 235 | |
246 | 236 | /* |
247 | 237 | * Language classes $mw.lang |
— | — | @@ -1066,9 +1056,9 @@ |
1067 | 1057 | ]; |
1068 | 1058 | |
1069 | 1059 | //add any requested skins (suports multiple skins per single page) |
1070 | | - if( $mw.g['skin_list'] ){ |
1071 | | - for(var i in $mw.g['skin_list'] ){ |
1072 | | - depReq[0].push( $mw.g['skin_list'][i] + 'Config' ); |
| 1060 | + if( $mw.skin_list ){ |
| 1061 | + for(var i in $mw.skin_list ){ |
| 1062 | + depReq[0].push( $mw.skin_list[i] + 'Config' ); |
1073 | 1063 | } |
1074 | 1064 | } |
1075 | 1065 | |
— | — | @@ -1125,14 +1115,14 @@ |
1126 | 1116 | * $j(document).ready( function(){ */ |
1127 | 1117 | function mwdomReady( force ) { |
1128 | 1118 | js_log( 'f:mwdomReady:' ); |
1129 | | - if( !force && mv_init_done ) { |
1130 | | - js_log( "mv_init_done already done, do nothing..." ); |
| 1119 | + if( !force && $mw.init_done ) { |
| 1120 | + js_log( "mw done, do nothing..." ); |
1131 | 1121 | return false; |
1132 | 1122 | } |
1133 | | - mv_init_done = true; |
| 1123 | + $mw.init_done = true; |
1134 | 1124 | // Handle the execution of queued functions with jQuery "ready" |
1135 | 1125 | |
1136 | | - // Check if this page has a video or playlist |
| 1126 | + // Check if this page has a video, audio or playlist tag |
1137 | 1127 | var e = [ |
1138 | 1128 | document.getElementsByTagName( "video" ), |
1139 | 1129 | document.getElementsByTagName( "audio" ), |
— | — | @@ -1145,7 +1135,7 @@ |
1146 | 1136 | if(e[j][k] && typeof( e[j][k]) == 'object'){ |
1147 | 1137 | var sn = e[j][k].getAttribute('skin_name') |
1148 | 1138 | if( sn && sn != ''){ |
1149 | | - $mw.g.skin_list.push( sn ); |
| 1139 | + $mw.skin_list.push( sn ); |
1150 | 1140 | } |
1151 | 1141 | } |
1152 | 1142 | } |
— | — | @@ -1205,7 +1195,7 @@ |
1206 | 1196 | window.onload = function () { |
1207 | 1197 | if( temp_f ) |
1208 | 1198 | temp_f(); |
1209 | | - mwdomReady(); |
| 1199 | + mwdomReady(); |
1210 | 1200 | } |
1211 | 1201 | |
1212 | 1202 | /* |
— | — | @@ -1314,6 +1304,9 @@ |
1315 | 1305 | }); |
1316 | 1306 | }); |
1317 | 1307 | } |
| 1308 | + /* |
| 1309 | + * Sequencer loader |
| 1310 | + */ |
1318 | 1311 | $.fn.sequencer = function( iObj, callback ) { |
1319 | 1312 | // Debugger |
1320 | 1313 | iObj['target_sequence_container'] = this.selector; |
— | — | @@ -1690,7 +1683,7 @@ |
1691 | 1684 | options.data['format'] = 'json'; |
1692 | 1685 | |
1693 | 1686 | // If action is not set, assume query |
1694 | | - if( !options.data['action'] ) |
| 1687 | + if( ! options.data['action'] ) |
1695 | 1688 | options.data['action'] = 'query'; |
1696 | 1689 | |
1697 | 1690 | // js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) ); |
— | — | @@ -1726,7 +1719,7 @@ |
1727 | 1720 | req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] ); |
1728 | 1721 | paramAnd = '&'; |
1729 | 1722 | } |
1730 | | - var fname = 'mycpfn_' + ( global_cb_count++ ); |
| 1723 | + var fname = 'mycpfn_' + ( $mw.cb_count++ ); |
1731 | 1724 | _global[ fname ] = callback; |
1732 | 1725 | req_url += '&' + options.jsonCB + '=' + fname; |
1733 | 1726 | loadExternalJs( req_url ); |
— | — | @@ -1898,7 +1891,7 @@ |
1899 | 1892 | return urid; |
1900 | 1893 | } |
1901 | 1894 | // Otherwise, just return the mv_embed version |
1902 | | - return MV_EMBED_VERSION; |
| 1895 | + return $mw.version; |
1903 | 1896 | } |
1904 | 1897 | /* |
1905 | 1898 | * Set the global mv_embed path based on the script's location |
— | — | @@ -1955,7 +1948,7 @@ |
1956 | 1949 | * Utility functions |
1957 | 1950 | */ |
1958 | 1951 | function js_log( string ) { |
1959 | | - ///add any prepend debug strings if nessesary |
| 1952 | + ///add any prepend debug strings if nessesary (used for cross browser) |
1960 | 1953 | if( $mw.conf['debug_pre'] ) |
1961 | 1954 | string = $mw.conf['debug_pre']+ string; |
1962 | 1955 | |
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js |
— | — | @@ -18,11 +18,11 @@ |
19 | 19 | "mwe-next_clip_msg" : "Play next clip", |
20 | 20 | "mwe-prev_clip_msg" : "Play previous clip", |
21 | 21 | "mwe-current_clip_msg" : "Continue playing this clip", |
22 | | - "mwe-seek_to" : "Seek to $1", |
| 22 | + "mwe-seek_to" : "Seek $1", |
23 | 23 | "mwe-paused" : "paused", |
24 | 24 | "mwe-download_segment" : "Download selection:", |
25 | 25 | "mwe-download_full" : "Download full video file:", |
26 | | - "mwe-download_right_click" : "To download, right click and select <i>Save target as...<\/i>", |
| 26 | + "mwe-download_right_click" : "To download, right click and select <i>Save link as...<\/i>", |
27 | 27 | "mwe-download_clip" : "Download video", |
28 | 28 | "mwe-download_text" : "Download text (<a style=\"color:white\" title=\"cmml\" href=\"http:\/\/wiki.xiph.org\/index.php\/CMML\">CMML<\/a> xml):", |
29 | 29 | "mwe-download" : "Download", |
— | — | @@ -51,7 +51,8 @@ |
52 | 52 | "mwe-read_before_embed" : "<a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read this<\/a> before embedding.", |
53 | 53 | "mwe-embed_site_or_blog" : "Embed on your site or blog", |
54 | 54 | "mwe-related_videos" : "Related videos", |
55 | | - "mwe-seeking" : "seeking" |
| 55 | + "mwe-seeking" : "seeking", |
| 56 | + "mwe-copy-code" : "Copy code" |
56 | 57 | }); |
57 | 58 | |
58 | 59 | //set the globals: |
— | — | @@ -132,7 +133,7 @@ |
133 | 134 | mvEmbed.flist.push( swap_done_callback ); |
134 | 135 | |
135 | 136 | //get mv_embed location if it has not been set |
136 | | - js_log('mv_video_embed:: ' + MV_EMBED_VERSION); |
| 137 | + js_log('mv_video_embed:: ' + $mw.version); |
137 | 138 | |
138 | 139 | var loadPlaylistLib=false; |
139 | 140 | |
— | — | @@ -140,10 +141,10 @@ |
141 | 142 | js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() ); |
142 | 143 | |
143 | 144 | if( $j(this_elm).attr("id") == '' ){ |
144 | | - $j(this_elm).attr("id", 'v'+ global_player_list.length); |
| 145 | + $j(this_elm).attr("id", 'v'+ $mw.player_list.length); |
145 | 146 | } |
146 | 147 | //store a global reference to the id |
147 | | - global_player_list.push( $j(this_elm).attr("id") ); |
| 148 | + $mw.player_list.push( $j(this_elm).attr("id") ); |
148 | 149 | |
149 | 150 | //if video doSwap |
150 | 151 | switch( this_elm.tagName.toLowerCase()){ |
— | — | @@ -247,16 +248,16 @@ |
248 | 249 | $j('#'+embed_video.id).get(0).init_with_sources_loaded(); |
249 | 250 | } |
250 | 251 | |
251 | | - js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length); |
| 252 | + js_log('done with child: ' + embed_video.id + ' len:' + $mw.player_list.length); |
252 | 253 | return true; |
253 | 254 | }, |
254 | 255 | //this should not be needed. |
255 | 256 | checkClipsReady : function(){ |
256 | 257 | //js_log('checkClipsReady'); |
257 | 258 | var is_ready=true; |
258 | | - for(var i=0; i < global_player_list.length; i++){ |
259 | | - if( $j('#'+global_player_list[i]).length !=0){ |
260 | | - var cur_vid = $j('#'+global_player_list[i]).get(0); |
| 259 | + for(var i=0; i < $mw.player_list.length; i++){ |
| 260 | + if( $j('#'+$mw.player_list[i]).length !=0){ |
| 261 | + var cur_vid = $j('#'+$mw.player_list[i]).get(0); |
261 | 262 | is_ready = ( cur_vid.ready_to_play ) ? is_ready : false; |
262 | 263 | if( !is_ready && cur_vid.load_error ){ |
263 | 264 | is_ready=true; |
— | — | @@ -1664,35 +1665,39 @@ |
1665 | 1666 | } |
1666 | 1667 | } |
1667 | 1668 | }, |
1668 | | - //display the code to remotely embed this video: |
1669 | | - showEmbedCode : function(embed_code){ |
1670 | | - if(!embed_code) |
1671 | | - embed_code = this.getEmbeddingHTML(); |
1672 | | - var o=''; |
1673 | | - if(this.linkback){ |
1674 | | - o+='<a class="email" href="'+this.linkback+'">Share Clip via Link</a> '+ |
1675 | | - '<p>or</p> '; |
1676 | | - } |
1677 | | - o+='<div>' + |
1678 | | - '<span style="color:#FFF;font-size:14px;">Embed Clip in Blog or Site</span><br>'+ |
1679 | | - '<span class="readthis" style="color:#FFF;font-size:12px;">' + gM('mwe-read_before_embed') + |
1680 | | - '<div class="embed_code"> '+ |
1681 | | - '<textarea onClick="this.select();" id="embedding_user_html_'+this.id+'" name="embed">' + |
1682 | | - embed_code+ |
1683 | | - '</textarea> '+ |
1684 | | - '<button onClick="$j(\'#'+this.id+'\').get(0).copyText(); return false;" class="copy_to_clipboard">Copy to Clipboard</button> '+ |
1685 | | - '</div> '+ |
1686 | | - '</div>'; |
1687 | | - this.displayHTML(o); |
1688 | | - $j('#'+ this.id + ' .readthis a').css('font-color', 'red'); |
| 1669 | + showShare:function($target){ |
| 1670 | + var embed_code = this.getEmbeddingHTML(); |
| 1671 | + var o = ''; |
| 1672 | + var _this = this; |
| 1673 | + //@todo: hook events to two a's for swapping in and out code for link vs. embed; |
| 1674 | + // hook events for changing active class of li based on a. |
| 1675 | + o+= '<h2>' + gM('mwe-share_this_video') + '</h2>\n' + |
| 1676 | + ' <ul>\n' + |
| 1677 | + ' <li><a href="#" class="active">'+gM('mwe-embed_site_or_blog')+'</a></li>\n'; |
| 1678 | + if(this.linkback) { |
| 1679 | + o+= ' <li><a href="#" id="k-share-link">' + this.linkback + '</a></li>\n'; |
| 1680 | + } |
| 1681 | + o+= '</ul>' + |
| 1682 | + '<div class="source_wrap"><textarea>' + embed_code + '</textarea></div>' + |
| 1683 | + '<button class="ui-state-default ui-corner-all copycode">' + gM('mwe-copy-code') + '</button>' + |
| 1684 | + '<div class="ui-state-highlight ui-corner-all">' + gM('mwe-read_before_embed') + '</div>' + |
| 1685 | + '</div>' |
| 1686 | + $target.html(o); |
| 1687 | + $cpBtn = $j( '#' + this.id + ' .copycode'); |
| 1688 | + $cpTxt = $j( '#' + this.id + ' .source_wrap textarea'); |
| 1689 | + |
| 1690 | + $cpTxt.click(function(){ |
| 1691 | + $j(this).get(0).select(); |
| 1692 | + }); |
| 1693 | + //add copy binding: |
| 1694 | + $cpBtn.click(function(){ |
| 1695 | + $cpTxt.focus().get(0).select(); |
| 1696 | + if(document.selection){ |
| 1697 | + CopiedTxt = document.selection.createRange(); |
| 1698 | + CopiedTxt.execCommand("Copy"); |
| 1699 | + } |
| 1700 | + }); |
1689 | 1701 | }, |
1690 | | - copyText:function(){ |
1691 | | - $j('#embedding_user_html_'+this.id).focus().select(); |
1692 | | - if(document.selection){ |
1693 | | - CopiedTxt = document.selection.createRange(); |
1694 | | - CopiedTxt.execCommand("Copy"); |
1695 | | - } |
1696 | | - }, |
1697 | 1702 | showTextInterface:function(){ |
1698 | 1703 | var _this = this; |
1699 | 1704 | //display the text container with loading text: |
— | — | @@ -2045,8 +2050,8 @@ |
2046 | 2051 | }, |
2047 | 2052 | //do common monitor code like update the playhead and play status |
2048 | 2053 | //plugin objects are responsible for updating currentTime |
2049 | | - monitor:function(){ |
2050 | | - //js_log(' us: ' + this.userSlide + ' is seek: ' + this.seeking ); |
| 2054 | + monitor:function(){ |
| 2055 | + js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 ) + ' is seek: ' + this.seeking ); |
2051 | 2056 | if( this.currentTime && this.currentTime > 0 && this.duration){ |
2052 | 2057 | if( !this.userSlide && !this.seeking ){ |
2053 | 2058 | if( this.start_offset ){ |
— | — | @@ -2057,9 +2062,14 @@ |
2058 | 2063 | }else{ |
2059 | 2064 | this.setSliderValue( this.currentTime / this.duration ); |
2060 | 2065 | var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.duration ):''; |
2061 | | - this.setStatus( seconds2npt( this.currentTime ) + et); |
| 2066 | + this.setStatus( seconds2npt( this.currentTime ) + et); |
2062 | 2067 | } |
2063 | 2068 | } |
| 2069 | + //check if we are "done" |
| 2070 | + if( this.currentTime > ( parseInt(this.duration) + 1 ) ){ |
| 2071 | + js_log("should run clip done"); |
| 2072 | + this.onClipDone(); |
| 2073 | + } |
2064 | 2074 | }else{ |
2065 | 2075 | //media lacks duration just show end time |
2066 | 2076 | //js_log(' ct:' + this.currentTime + ' dur: ' + this.duration); |
— | — | @@ -2398,9 +2408,9 @@ |
2399 | 2409 | } |
2400 | 2410 | if( selected_player ) |
2401 | 2411 | { |
2402 | | - for(var i=0; i < global_player_list.length; i++) |
| 2412 | + for(var i=0; i < $mw.player_list.length; i++) |
2403 | 2413 | { |
2404 | | - var embed = $j('#'+global_player_list[i]).get(0); |
| 2414 | + var embed = $j('#'+$mw.player_list[i]).get(0); |
2405 | 2415 | if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type)) |
2406 | 2416 | { |
2407 | 2417 | embed.selectPlayer(selected_player); |