r58177 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58176‎ | r58177 | r58178 >
Date:01:14, 27 October 2009
Author:dale
Status:deferred
Tags:
Comment:
* more skin refactoring
Modified paths:
  • /trunk/phase3/js2/mwEmbed/example_usage/Player_Themable.html (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/php/languages/mwEmbed.i18n.php (modified) (history)
  • /trunk/phase3/js2/mwEmbed/php/script-cache (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/kskin/kskin.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/kskin/playerSkin.css (modified) (history)
  • /trunk/phase3/js2/mwEmbed/skins/mvpcf/playerSkin.css (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/example_usage/Player_Themable.html
@@ -12,23 +12,22 @@
1313 To play with dynamic Themes install <a href="http://jqueryui.com/themeroller/developertool/">Themeroller</a><p><p>
1414
1515 <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>
1818 <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>
2121 </div>
2222
23 -
2423 <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>
2929 </div>
3030
3131
32 -
3332 </body>
3433 </html>
3534
Index: trunk/phase3/js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
@@ -240,31 +240,8 @@
241241 },
242242 getImageObj:function( rObj, size, callback ){
243243 if( rObj.mime=='application/ogg' )
244 - return callback( {'url':rObj.src, 'poster' : rObj.url } );
 244+ return callback( {'url':rObj.src, 'poster' : rObj.url } );
245245
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 -
269246 //his could be depreciated if thumb.php improves
270247 var reqObj = {
271248 'action':'query',
Property changes on: trunk/phase3/js2/mwEmbed/php/script-cache
___________________________________________________________________
Name: svn:ignore
272249 + 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 @@
356356 'mwe-embed_site_or_blog' => 'Embed on your site or blog',
357357 'mwe-related_videos' => 'Related videos',
358358 'mwe-seeking' => 'seeking',
 359+ "mwe-copy-code" => "Copy code",
359360 );
360361
361362 /** Message documentation (Message documentation)
Index: trunk/phase3/js2/mwEmbed/skins/kskin/playerSkin.css
@@ -179,3 +179,57 @@
180180 .k-menu-screens li a.active, .k-menu-screens li a:hover.active { background-position: -85px -247px;}
181181 .k-menu-screens li a:hover { background-position: -85px -260px;}
182182 .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 @@
88 //display time progres
99 long_time_disp: false,
1010 body_options: false,
 11+ volume_layout: 'horizontal',
1112 components:{
1213 'play-btn-large' : {
1314 'h' : 55
@@ -18,6 +19,9 @@
1920 '<span>' + gM('mwe-menu_btn') + '</span>' +
2021 '</div>'
2122 }
 23+ },
 24+ 'time_display':{
 25+ 'w':70
2226 },
2327 'mv_embedded_options':{
2428 'w':0,
@@ -107,6 +111,32 @@
108112 $tp.find('.play-btn-large').fadeOut('fast');
109113 }
110114 });
 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+ });
111141
112142 }
113143 }
\ No newline at end of file
Index: trunk/phase3/js2/mwEmbed/skins/ctrlBuilder.js
@@ -32,6 +32,8 @@
3333 pClass : 'mv-player',
3434 long_time_disp: true,
3535 body_options : true,
 36+ //default volume layout is "vertical"
 37+ volume_layout : 'vertical',
3638 height:29,
3739 supports:{
3840 'options':true,
@@ -187,7 +189,11 @@
188190 var perc = ui.value/1000;
189191 embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
190192 //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+ }
192198 //update the thumbnail / frame
193199 if(embedObj.isPlaying==false){
194200 embedObj.updateThumbPerc( perc );
@@ -231,13 +237,23 @@
232238 $opt.hide();
233239 return false;
234240 })
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') );
237244 $opt.hide();
238245 return false;
239246 });
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:
242258 var hoverOverDelay=false;
243259 $tp.find('.volume_control').unbind().btnBind().click(function(){
244260 $j('#' +embedObj.id).get(0).toggleMute();
@@ -289,10 +305,6 @@
290306 }
291307 }
292308 });
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();
297309 },
298310 getMvBufferHtml:function(){
299311 return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' +
@@ -392,13 +404,21 @@
393405 },
394406 'volume_control':{
395407 '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;
403423 }
404424 },
405425 'time_display':{
Index: trunk/phase3/js2/mwEmbed/skins/mvpcf/playerSkin.css
@@ -127,4 +127,39 @@
128128 .inOutSlider .ui-slider-handle{
129129 width:8px;
130130 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 @@
1515 * (in cases where media will be hosted in a different place than the embedding page)
1616 *
1717 */
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';
2518
2619
27 -
2820 /**
2921 * AutoLoader paths
3022 * @path The path to the file (or set of files) with ending slash
@@ -194,7 +186,8 @@
195187 // For use when mv_embed with script-loader is in the root MediaWiki path
196188 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
197189
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;
199192
200193 /*
201194 * setup the empty global $mw object
@@ -206,9 +199,6 @@
207200 }
208201
209202 //@@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
213203 var global_req_cb = new Array(); // The global request callback array
214204
215205 // Get the mv_embed location if it has not been set
@@ -230,17 +220,17 @@
231221 'jui_skin' : 'redmond',
232222 'video_size' : '400x300'
233223 }
 224+ // the version of mwEmbed
 225+ $.version = '1.0r21';
234226
235227 /*
236 - * global flags
 228+ * some global containers flags
237229 */
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
245235
246236 /*
247237 * Language classes $mw.lang
@@ -1066,9 +1056,9 @@
10671057 ];
10681058
10691059 //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' );
10731063 }
10741064 }
10751065
@@ -1125,14 +1115,14 @@
11261116 * $j(document).ready( function(){ */
11271117 function mwdomReady( force ) {
11281118 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..." );
11311121 return false;
11321122 }
1133 - mv_init_done = true;
 1123+ $mw.init_done = true;
11341124 // Handle the execution of queued functions with jQuery "ready"
11351125
1136 - // Check if this page has a video or playlist
 1126+ // Check if this page has a video, audio or playlist tag
11371127 var e = [
11381128 document.getElementsByTagName( "video" ),
11391129 document.getElementsByTagName( "audio" ),
@@ -1145,7 +1135,7 @@
11461136 if(e[j][k] && typeof( e[j][k]) == 'object'){
11471137 var sn = e[j][k].getAttribute('skin_name')
11481138 if( sn && sn != ''){
1149 - $mw.g.skin_list.push( sn );
 1139+ $mw.skin_list.push( sn );
11501140 }
11511141 }
11521142 }
@@ -1205,7 +1195,7 @@
12061196 window.onload = function () {
12071197 if( temp_f )
12081198 temp_f();
1209 - mwdomReady();
 1199+ mwdomReady();
12101200 }
12111201
12121202 /*
@@ -1314,6 +1304,9 @@
13151305 });
13161306 });
13171307 }
 1308+ /*
 1309+ * Sequencer loader
 1310+ */
13181311 $.fn.sequencer = function( iObj, callback ) {
13191312 // Debugger
13201313 iObj['target_sequence_container'] = this.selector;
@@ -1690,7 +1683,7 @@
16911684 options.data['format'] = 'json';
16921685
16931686 // If action is not set, assume query
1694 - if( !options.data['action'] )
 1687+ if( ! options.data['action'] )
16951688 options.data['action'] = 'query';
16961689
16971690 // js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );
@@ -1726,7 +1719,7 @@
17271720 req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] );
17281721 paramAnd = '&';
17291722 }
1730 - var fname = 'mycpfn_' + ( global_cb_count++ );
 1723+ var fname = 'mycpfn_' + ( $mw.cb_count++ );
17311724 _global[ fname ] = callback;
17321725 req_url += '&' + options.jsonCB + '=' + fname;
17331726 loadExternalJs( req_url );
@@ -1898,7 +1891,7 @@
18991892 return urid;
19001893 }
19011894 // Otherwise, just return the mv_embed version
1902 - return MV_EMBED_VERSION;
 1895+ return $mw.version;
19031896 }
19041897 /*
19051898 * Set the global mv_embed path based on the script's location
@@ -1955,7 +1948,7 @@
19561949 * Utility functions
19571950 */
19581951 function js_log( string ) {
1959 - ///add any prepend debug strings if nessesary
 1952+ ///add any prepend debug strings if nessesary (used for cross browser)
19601953 if( $mw.conf['debug_pre'] )
19611954 string = $mw.conf['debug_pre']+ string;
19621955
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -18,11 +18,11 @@
1919 "mwe-next_clip_msg" : "Play next clip",
2020 "mwe-prev_clip_msg" : "Play previous clip",
2121 "mwe-current_clip_msg" : "Continue playing this clip",
22 - "mwe-seek_to" : "Seek to $1",
 22+ "mwe-seek_to" : "Seek $1",
2323 "mwe-paused" : "paused",
2424 "mwe-download_segment" : "Download selection:",
2525 "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>",
2727 "mwe-download_clip" : "Download video",
2828 "mwe-download_text" : "Download text (<a style=\"color:white\" title=\"cmml\" href=\"http:\/\/wiki.xiph.org\/index.php\/CMML\">CMML<\/a> xml):",
2929 "mwe-download" : "Download",
@@ -51,7 +51,8 @@
5252 "mwe-read_before_embed" : "<a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read this<\/a> before embedding.",
5353 "mwe-embed_site_or_blog" : "Embed on your site or blog",
5454 "mwe-related_videos" : "Related videos",
55 - "mwe-seeking" : "seeking"
 55+ "mwe-seeking" : "seeking",
 56+ "mwe-copy-code" : "Copy code"
5657 });
5758
5859 //set the globals:
@@ -132,7 +133,7 @@
133134 mvEmbed.flist.push( swap_done_callback );
134135
135136 //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);
137138
138139 var loadPlaylistLib=false;
139140
@@ -140,10 +141,10 @@
141142 js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
142143
143144 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);
145146 }
146147 //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") );
148149
149150 //if video doSwap
150151 switch( this_elm.tagName.toLowerCase()){
@@ -247,16 +248,16 @@
248249 $j('#'+embed_video.id).get(0).init_with_sources_loaded();
249250 }
250251
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);
252253 return true;
253254 },
254255 //this should not be needed.
255256 checkClipsReady : function(){
256257 //js_log('checkClipsReady');
257258 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);
261262 is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
262263 if( !is_ready && cur_vid.load_error ){
263264 is_ready=true;
@@ -1664,35 +1665,39 @@
16651666 }
16661667 }
16671668 },
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+ });
16891701 },
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 - },
16971702 showTextInterface:function(){
16981703 var _this = this;
16991704 //display the text container with loading text:
@@ -2045,8 +2050,8 @@
20462051 },
20472052 //do common monitor code like update the playhead and play status
20482053 //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 );
20512056 if( this.currentTime && this.currentTime > 0 && this.duration){
20522057 if( !this.userSlide && !this.seeking ){
20532058 if( this.start_offset ){
@@ -2057,9 +2062,14 @@
20582063 }else{
20592064 this.setSliderValue( this.currentTime / this.duration );
20602065 var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.duration ):'';
2061 - this.setStatus( seconds2npt( this.currentTime ) + et);
 2066+ this.setStatus( seconds2npt( this.currentTime ) + et);
20622067 }
20632068 }
 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+ }
20642074 }else{
20652075 //media lacks duration just show end time
20662076 //js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
@@ -2398,9 +2408,9 @@
23992409 }
24002410 if( selected_player )
24012411 {
2402 - for(var i=0; i < global_player_list.length; i++)
 2412+ for(var i=0; i < $mw.player_list.length; i++)
24032413 {
2404 - var embed = $j('#'+global_player_list[i]).get(0);
 2414+ var embed = $j('#'+$mw.player_list[i]).get(0);
24052415 if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type))
24062416 {
24072417 embed.selectPlayer(selected_player);

Status & tagging log