r53762 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53761‎ | r53762 | r53763 >
Date:20:05, 25 July 2009
Author:dale
Status:deferred
Tags:
Comment:
set local wiki to default in add media
Modified paths:
  • /branches/new-upload/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/README (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
@@ -10,7 +10,7 @@
1111 "fogg-installed" : "Firefogg is Installed",
1212 "fogg-for_improved_uplods" : "For Improved uploads: ",
1313 "fogg-please_install" : "<a href=\"$1\">Install Firefogg</a>. More <a href=\"http://commons.wikimedia.org/wiki/Commons:Firefogg\">about firefogg</a>",
14 - "fogg-use_latest_fox" : "Please first install <a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=firefogg\">Firefox 3.5</a>. <i>then revisit this page to install the <b>firefogg</b> extention</i>",
 14+ "fogg-use_latest_fox" : "Please first install <a href=\"http://www.mozilla.com/en-US/firefox/upgrade.html?from=firefogg\">Firefox 3.5</a> (or later). <i>then revisit this page to install the <b>firefogg</b> extention</i>",
1515 "fogg-passthrough_mode" : "Your selected file is already ogg or not a video file",
1616 "fogg-transcoding" : "Encoding Video to Ogg",
1717 "fogg-encoding-done" : "Encoding Done"
@@ -196,7 +196,7 @@
197197 _this.selectFogg();
198198 });
199199 //also setup the text file display on Click to select file:
200 - $j( this.target_input_file_name ).unbind().attr('readonly', 'readonly').click(function(){
 200+ $j(this.target_input_file_name).unbind().attr('readonly', 'readonly').click(function(){
201201 _this.selectFogg();
202202 })
203203
@@ -212,7 +212,7 @@
213213 }
214214 return ;
215215 }
216 - //if they have the right version of mozilla provide install link:
 216+ //they have the right version of mozilla provide install link:
217217 var os_link = false;
218218 if(navigator.oscpu){
219219 if(navigator.oscpu.search('Linux') >= 0)
@@ -224,7 +224,7 @@
225225 }
226226 //if rewriting form use upload msg text
227227 var upMsg = (_this.form_rewrite) ? gM('fogg-for_improved_uplods') : '';
228 - $j( _this.target_please_install ).html( upMsg + gM('fogg-please_install',os_link )).css('padding', '10px').show();
 228+ $j(_this.target_please_install).html( upMsg + gM('fogg-please_install',os_link )).css('padding', '10px').show();
229229 }
230230 //setup the target save local file bindins:
231231 $j( _this.target_btn_save_local_file ).unbind().click(function(){
@@ -243,7 +243,7 @@
244244 //assume input target
245245 setupForm: function(){
246246 js_log('firefogg::setupForm::');
247 - //to parent form setup if we want http updates
 247+ //to parent form setup if we want http updates
248248 if( this.form_rewrite ){
249249 //do parent form setup:
250250 this.pe_setupForm();
@@ -279,7 +279,7 @@
280280 inTag+= '/><span id="' + $j(this.selector).attr('name') + '_fogg-control"></span>';
281281
282282 js_log('set input: ' + inTag);
283 - $j( this.selector ).replaceWith( inTag );
 283+ $j(this.selector).replaceWith(inTag);
284284
285285 this.target_input_file_name = 'input[name=' + $j(this.selector).attr('name') + ']';
286286 //update the selector to the control target:
@@ -292,9 +292,6 @@
293293 this.doControlBindings();
294294 },
295295 getEditForm:function(){
296 - if( this.target_edit_from ){
297 - return this.pe_getEditForm();
298 - }
299296 js_log('get form: action=' + $j(this.selector).parents().find("form").attr('action'));
300297 return $j(this.selector).parents().find("form").get(0);
301298 },
@@ -407,7 +404,7 @@
408405 getProgressTitle:function(){
409406 js_log("fogg:getProgressTitle f:" + this.fogg_enabled + ' rw:' + this.form_rewrite);
410407 //return the parent if we don't have fogg turned on:
411 - if(! this.fogg_enabled )
 408+ if(! this.fogg_enabled || !this.firefogg_form_action )
412409 return this.pe_getProgressTitle();
413410 if( !this.form_rewrite )
414411 return gM('fogg-transcoding');
@@ -416,12 +413,12 @@
417414 },
418415 doUploadSwitch:function(){
419416 var _this = this;
420 - js_log( "firefogg: doUploadSwitch:: " + this.fogg_enabled );
 417+ js_log("firefogg: doUploadSwitch:: " + this.fogg_enabled);
421418 //make sure firefogg is enabled otherwise do parent UploadSwich:
422419 if( !this.fogg_enabled || !this.firefogg_form_action )
423420 return _this.pe_doUploadSwitch();
424421
425 - //check what mode to use firefogg in:
 422+ //check what mode to use firefogg in:
426423 if( _this.upload_mode == 'post' ){
427424 _this.doEncode();
428425 }else if( _this.upload_mode == 'api' && _this.chunks_supported){ //if api mode and chunks supported do chunkUpload
@@ -431,7 +428,7 @@
432429 }
433430 },
434431 //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready
435 - doChunkUpload : function(){
 432+ doChunkUpload : function(){
436433 var _this = this;
437434 _this.action_done = false;
438435
@@ -458,18 +455,17 @@
459456 'comment' : _this.formData['wpUploadDescription'],
460457 'enablechunks': true
461458 };
462 -
463459 //check for editToken:
464 - if( !this.etoken )
 460+ if(!this.etoken)
465461 this.etoken = _this.formData['wpEditToken'];
466462
467 - if( this.etoken )
 463+ if(this.etoken)
468464 aReq['token'] = this.etoken;
469465
470466 if( _this.formData['wpWatchthis'] )
471467 aReq['watch'] = _this.formData['wpWatchthis'];
472468
473 - if( _this.formData['wpIgnoreWarning'] )
 469+ if( _this.formData['wpIgnoreWarning'] )
474470 aReq['ignorewarnings'] = _this.formData['wpIgnoreWarning'];
475471
476472 js_log('do fogg upload/encode call: '+ _this.api_url + ' :: ' + JSON.stringify( aReq ) );
@@ -481,7 +477,6 @@
482478 },
483479 //doEncode and monitor progress:
484480 doEncode : function(){
485 - js_log('firefogg:doEncode');
486481 var _this = this;
487482 _this.action_done = false;
488483 _this.dispProgressOverlay();
@@ -602,7 +597,7 @@
603598 _this.updateProgressWin( gM('successfulupload'), gM( 'mv_upload_done', _this.fogg.resultUrl),buttons);
604599 }else{
605600 //done state with error? ..not really possible given how firefogg works
606 - js_log(" upload done, in chunks mode, but no resultUrl::" + response_text);
 601+ js_log(" upload done, in chunks mode, but no resultUrl!");
607602 }
608603 }
609604 }else{
Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -93,7 +93,7 @@
9494 * sets the default display item:
9595 * can be any content_providers key or 'all'
9696 */
97 - disp_item : 'wiki_commons',
 97+ disp_item : 'this_wiki',
9898 /** the default content providers list.
9999 *
100100 * (should be note that special tabs like "upload" and "combined" don't go into the content proviers list:
@@ -1131,7 +1131,7 @@
11321132 });
11331133 }
11341134 },
1135 - checkRepoLocal:function( cp ){
 1135+ checkRepoLocal:function( cp ){
11361136 if( cp.local ){
11371137 return true;
11381138 }else{
@@ -1145,8 +1145,7 @@
11461146 }
11471147 }
11481148 return false;
1149 - }
1150 -
 1149+ }
11511150 },
11521151 checkImportResource:function( rObj, cir_callback){
11531152 //@@todo get the localized File/Image namespace name or do a general {NS}:Title
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -73,7 +73,8 @@
7474
7575 //init the global Msg if not already
7676 if(!gMsg){var gMsg={};}
77 -//laguage loader:
 77+
 78+//laguage msg loader:
7879 function loadGM( msgSet ){
7980 for(var i in msgSet){
8081 gMsg[ i ] = msgSet[i];
@@ -98,7 +99,7 @@
99100 * @path the path to the file (or set of files) with ending slash
100101 * @gClasses the set of classes
101102 * if an array $j.className become jquery.className.js
102 - * if an asssociative objec then key => value paris are used
 103+ * if an asssociative object then key => value paris are used
103104 */
104105 if(typeof mvClassPaths == 'undefined')
105106 mvClassPaths = {};
@@ -112,7 +113,7 @@
113114 path = '';
114115 if(gClasses.length){
115116 //do array loop:
116 - for(var i=0; i<gClasses.length; i++){
 117+ for(var i=0; i < gClasses.length; i++){
117118 if(typeof gClasses[i] != 'undefined'){
118119 //setup normal replacement of j with jquery
119120 var jsName = ( gClasses[i].substr(0,3) == '$j.' ) ? opt['j_replace'] + gClasses[i].substr(3) : gClasses[i];
@@ -125,8 +126,7 @@
126127 //assume object with key:path:
127128 mvClassPaths[i] = path + gClasses[ i ];
128129 }
129 - }
130 - var cat = mvClassPaths;
 130+ }
131131 }
132132 function mvGetClassPath(k){
133133 if( mvClassPaths[k] ){
@@ -757,8 +757,7 @@
758758 */
759759 function mv_jqueryBindings(){
760760 js_log('mv_jqueryBindings');
761 - (function($) {
762 -
 761+ (function($) {
763762 $.fn.addMediaWiz = function( iObj, callback ){
764763 //first set the cursor for the button to "loading"
765764 $j(this.selector).css('cursor','wait').attr('title', gM('loading_title'));
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -114,15 +114,17 @@
115115 mvEmbed.init( swap_done_callback, force_id );
116116 }
117117 mvEmbed = {
 118+ //flist stores the set of functions to run after the video has been swaped in.
118119 flist:new Array(),
119120 init:function( swap_done_callback, force_id ){
 121+
120122 if(swap_done_callback)
121123 mvEmbed.flist.push( swap_done_callback );
 124+
122125 //get mv_embed location if it has not been set
123126 js_log('mv_embed ' + MV_EMBED_VERSION);
124127
125 - var loadPlaylistLib=false;
126 - //set up the jQuery selector:
 128+ var loadPlaylistLib=false;
127129
128130 var eAction = function(this_elm){
129131 js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
@@ -276,7 +278,7 @@
277279 getControls:function( embedObj ){
278280 js_log('f:controlsBuilder:: opt:' + this.options);
279281 this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id;
280 - this.avaliable_width=embedObj.playerPixelWidth();
 282+ this.available_width = embedObj.playerPixelWidth();
281283 //make pointer to the embedObj
282284 this.embedObj =embedObj;
283285 var _this = this;
@@ -297,14 +299,14 @@
298300 var o='';
299301 for( var i in this.components ){
300302 if( this.supports[i] ){
301 - if( this.avaliable_width > this.components[i].w ){
 303+ if( this.available_width > this.components[i].w ){
302304 //special case with playhead don't add unless we have 60px
303 - if( i=='play_head' && ctrlBuilder.avaliable_width < 60 )
 305+ if( i == 'play_head' && ctrlBuilder.available_width < 60 )
304306 continue;
305307 o+=this.components[i].o();
306 - this.avaliable_width -= this.components[i].w;
 308+ this.available_width -= this.components[i].w;
307309 }else{
308 - js_log('not enough space for control component:'+i);
 310+ js_log('not enough space for control component:' + i);
309311 }
310312 }
311313 }
@@ -581,7 +583,7 @@
582584 'play_head':{
583585 'w':0, //special case (takes up remaining space)
584586 'o':function(){
585 - return '<div class="play_head" id="mv_play_head_'+ctrlBuilder.id+'" style="width: ' + (ctrlBuilder.avaliable_width - 30) + 'px;"></div>';
 587+ return '<div class="play_head" id="mv_play_head_' + ctrlBuilder.id + '" style="width: ' + ( ctrlBuilder.available_width - 30 ) + 'px;"></div>';
586588 }
587589 }
588590 }
Index: trunk/phase3/js2/mwEmbed/README
@@ -2,7 +2,8 @@
33 *
44 * mwEmbed version 1.2
55 * for details see: http://www.mediawiki.org/wiki/MwEmbed
6 -* and this README
 6+* For an overview of all mwEmbed files see:
 7+* http://www.mediawiki.org/wiki/MwEmbed
78 *
89 * All Metavid Wiki code is Released under the GPL2
910 * for more info visit http:/metavid.ucsc.edu/code
Index: branches/new-upload/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js
@@ -1,12 +1,11 @@
22
33 loadGM({
4 -
54 "select_transcript_set" : "Select Layers",
65 "auto_scroll" : "auto scroll",
76 "close" : "close",
8 - "improve_transcript" : "Improve"
9 -
 7+ "improve_transcript" : "Improve",
108 })
 9+
1110 // text interface object (for inline display captions)
1211 var mvTextInterface = function( parentEmbed ){
1312 return this.init( parentEmbed );
@@ -181,7 +180,7 @@
182181 _this.pe.highlightPlaySection( {
183182 'start' : $j(this).parent().attr("start"),
184183 'end' : $j(this).parent().attr("end")
185 - });
 184+ });
186185 },
187186 out:function () {
188187 js_log('mvttseek: out');
@@ -288,12 +287,8 @@
289288 $j('#mmbody_'+this.pe.id +' .tt_scroll_highlight').removeClass('tt_scroll_highlight');
290289 }
291290 };
292 - /*js_log('search_for_range:'+search_for_range + ' for: '+ cur_time);*/
293 - if( search_for_range ){
294 - //search for current time: add tt_scroll_highlight to clip
295 - // optimize:
296 - // should do binnary search not iterative
297 - // avoid jquery function calls do native loops
 291+ if(search_for_range){
 292+ //search for current time: flash red border trascript
298293 $j('#mmbody_'+this.pe.id +' .mvtt').each(function(){
299294 if(npt2seconds($j(this).attr('start') ) < cur_time &&
300295 npt2seconds($j(this).attr('end') ) > cur_time){
@@ -302,7 +297,7 @@
303298 scrollTop: $j(this).get(0).offsetTop
304299 }, 'slow');
305300 $j(this).addClass('tt_scroll_highlight');
306 - //js_log('should add class to: ' + $j(this).attr('id'));
 301+ js_log('should add class to: ' + $j(this).attr('id'));
307302 //done with loop
308303 return false;
309304 }
@@ -517,4 +512,4 @@
518513 }
519514 }
520515 }
521 -};
 516+};
\ No newline at end of file

Status & tagging log