* some js2 cleanup and refactoring for upload support
authorMichael Dale <dale@users.mediawiki.org>
Thu, 27 Aug 2009 18:26:51 +0000 (18:26 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 27 Aug 2009 18:26:51 +0000 (18:26 +0000)
* some minor work needed to finish cleaning up inline add media wizard upload across all upload modes (firefogg / normal http post)

js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
js2/mwEmbed/libAddMedia/mvFirefogg.js
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/simpleUploadForm.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/mv_embed.js
js2/uploadPage.js

index 63c2bf8..ada2edd 100644 (file)
@@ -39,8 +39,8 @@ var default_bui_options = {
        'done_upload_cb': null,
        'target_edit_from':null,
 
-       //upload_mode can be 'post', 'api' or 'autodetect'. (autodetect issues an api call)
-       'upload_mode': 'autodetect'
+       //default upload mode is 'api' but if no api_url will try tp post
+       'upload_mode': 'api'
 
 }
 var mvBaseUploadInterface = function( iObj ){
@@ -72,13 +72,19 @@ mvBaseUploadInterface.prototype = {
                //set up the local pointer to the edit form:
                _this.editForm = _this.getEditForm();
                if( _this.editForm ){
+                                       
+                       //if in api re-map the upload form to api: (we have to do this BEFORE the users selects a file) 
+                       if(_this.upload_mode == 'api'){
+                               _this.doRemapFormToApi();
+                       }
+                       
                        //set up the org_onsubmit if not set:
                        if( typeof( _this.org_onsubmit ) == 'undefined' &&  _this.editForm.onsubmit )
                                _this.org_onsubmit = _this.editForm.onsubmit;
 
                        //set up the submit action:
                        $j( _this.editForm ).submit( function(){
-                               js_log('j.onSubmit');
+                               js_log('setupForm.onSubmit:');
                                //run the original onsubmit (if not run yet set flag to avoid excessive chaining )
                                if( typeof( _this.org_onsubmit ) == 'function' ){
                                        if( ! _this.org_onsubmit() ){
@@ -92,6 +98,7 @@ mvBaseUploadInterface.prototype = {
                                        return true;
                                }
                                //get the input form data in flat json:
+                               js_log('update formData::');
                                var tmpAryData = $j( _this.editForm ).serializeArray();
                                for(var i=0; i < tmpAryData.length; i++){
                                        if( tmpAryData[i]['name'] )
@@ -105,10 +112,10 @@ mvBaseUploadInterface.prototype = {
                                        //for some unknown reason we have to drop down the #p-search z-index:
                                        $j('#p-search').css('z-index', 1);
 
-                                       //select upload mode:
+                                       //select upload mode:                                   
                                        _this.detectUploadMode();
                                }catch(e){
-
+                                       js_log('::error in dispProgressOverlay or detectUploadMode');
                                }
 
                                //don't submit the form we will do the post in ajax
@@ -119,14 +126,15 @@ mvBaseUploadInterface.prototype = {
        },
        detectUploadMode:function( callback ){
                var _this = this;
+               js_log('detectUploadMode::' +  _this.upload_mode);
                //check the upload mode:
                if( _this.upload_mode == 'autodetect' ){
                        js_log('detectUploadMode::' + _this.upload_mode + ' api:' + _this.api_url);
                        if( ! _this.api_url )
                                return js_error( 'Error: can\'t autodetect mode without api url' );
                        do_api_req( {
-                               'data':{ 'action':'paraminfo','modules':'upload' },
-                               'url' :_this.api_url
+                               'data': { 'action' : 'paraminfo', 'modules' : 'upload' },
+                               'url' : _this.api_url
                        }, function(data){
                                if( typeof data.paraminfo == 'undefined' || typeof data.paraminfo.modules == 'undefined' )
                                        return js_error( 'Error: bad api results' );
@@ -153,6 +161,37 @@ mvBaseUploadInterface.prototype = {
                        _this.doUploadSwitch();
                }
        },
+       //@@NOTE this could probably be depricated to just have a special:upload page that uses api keys? 
+       // or maybe its usefull to seperate js and non-js submits
+       doRemapFormToApi:function(){
+               var _this = this;
+               if( !_this.api_url )
+                       return false;
+                       
+               //add the action api 
+               $j(_this.editForm).attr('action', _this.api_url);
+               
+               //add api url 
+               //add api action:
+               if( $j(_this.editForm).find("[name='action']").length == 0)
+                       $j(_this.editForm).append('<input type="hidden" name="action" value="upload">');
+
+               //add json format
+               if( $j(_this.editForm).find("[name='format']").length == 0)
+                       $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">');
+
+               //map a new hidden form
+               $j(_this.editForm).find("[name='wpUploadFile']").attr('name', 'file');
+               $j(_this.editForm).find("[name='wpDestFile']").attr('name', 'filename');
+               $j(_this.editForm).find("[name='wpUploadDescription']").attr('name', 'comment');
+               $j(_this.editForm).find("[name='wpEditToken']").attr('name', 'token');
+               $j(_this.editForm).find("[name='wpIgnoreWarning']").attr('name', 'ignorewarnings');
+               $j(_this.editForm).find("[name='wpWatchthis']").attr('name', 'watch');
+
+               //update the status to 100% progress bar (no status in iframe submit)
+               $j('#up-progressbar' ).progressbar( 'value', parseInt( 100 ) );
+               $j('#up-status-container').html( gM('mwe-upload-in-progress') );                
+       },
        doUploadSwitch:function(){
                var _this = this;
                js_log('mvUPload:doUploadSwitch():' + _this.upload_mode);
@@ -165,60 +204,45 @@ mvBaseUploadInterface.prototype = {
                        );
                        //do normal post
                        _this.form_post_override = true;
+                       js_log('doUploadSwitch:: submit call');
                        //do the submit :
                        _this.editForm.submit();
                }else if(
-                       _this.upload_mode=='api' &&
+                       _this.upload_mode == 'api' &&
                        ( $j('#wpSourceTypeFile').length ==  0 || $j('#wpSourceTypeFile').get(0).checked )
                ){
                        //@@TODO check for sendAsBinnary to support firefox 3.5 progress
 
-                       //set the form target to iframe target:
-                       _this.iframeId = 'f_' + ($j('iframe').length + 1);
-                       $j(_this.editForm).attr('target', _this.iframeId);
-
+                       //set the form target to iframe target: 
+                       _this.iframeId = 'f_' + ($j('iframe').length + 1);                                      
                        //add the iframe
                        $j("body").append('<iframe src="javascript:false;" id="' + _this.iframeId + '" ' +
-                               'name="' + _this.iframeId + '" style="display:none;" ></iframe>');
+                               'name="' + _this.iframeId + '" style="display:none;" ></iframe>');      
+                       $j(_this.editForm).attr('target', _this.iframeId);
 
                        //set up the done binding
                        $j('#' + _this.iframeId).load(function(){
                                _this.proccessIframeResult(  $j(this).get(0) );
                        });
-
-                       //set the editForm iframe target
-                       //$j(_this.editForm).attr('target', id);
-
                        //set the action to the api url:
                        $j(_this.editForm).attr('action', _this.api_url );
-                       //add api action:
-                       if( $j(_this.editForm).find("[name='action']").length == 0)
-                               $j(_this.editForm).append('<input type="hidden" name="action" value="upload">');
-
-                       //add json format
-                       if( $j(_this.editForm).find("[name='format']").length == 0)
-                               $j(_this.editForm).append('<input type="hidden" name="format" value="jsonfm">');
-
-                       //map the form vars to api vars:
-                       $j(_this.editForm).find("[name='wpUploadFile']").attr('name', 'file');
-                       $j(_this.editForm).find("[name='wpDestFile']").attr('name', 'filename');
-                       $j(_this.editForm).find("[name='wpUploadDescription']").attr('name', 'comment');
-                       $j(_this.editForm).find("[name='wpEditToken']").attr('name', 'token');
-                       $j(_this.editForm).find("[name='wpIgnoreWarning']").attr('name', 'ignorewarnings');
-                       $j(_this.editForm).find("[name='wpWatchthis']").attr('name', 'watch');
-
-                       //update the status to 100% progress bar (no status in iframe submit)
-                       $j('#up-progressbar' ).progressbar('value', parseInt( 100 ) );
-                       $j('#up-status-container').html( gM('mwe-upload-in-progress') );
-
-                       js_log('do iframe form submit to: ' +  $j(_this.editForm).attr('target'));
-
+                       
+                       js_log('do iframe form submit to: ' +  $j(_this.editForm).attr('target') 
+                                       + ' destName:' + $j(_this.editForm).find("[name='filename']").val() );                                  
+                       
+                       
                        //do post override
                        _this.form_post_override = true;
                        //reset the done with action flag:
                        _this.action_done = false;
-
-                       _this.editForm.submit();
+                       
+                       js_log('run editForm submit()');
+                       var tmpAryData = $j('#mw-upload-form' ).serializeArray();
+                       for(var i=0; i < tmpAryData.length; i++){
+                               if( tmpAryData[i]['name'] )
+                                       js_log('name: ' + tmpAryData[i]['name'] + ' = ' + tmpAryData[i]['value']);
+                       }
+                       $j('#mw-upload-form').submit();
 
                        return false;
                }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){
@@ -263,6 +287,7 @@ mvBaseUploadInterface.prototype = {
                } else if (doc.body){
                        // get the json str:
                        json_str = $j(doc.body).find('pre').html();
+                       js_log('iframe:json::' + json_str + "\nbody:" + $j(doc.body).html() );
                        //htmlentties
                        if (json_str) {
                                response = window["eval"]("(" +json_str + ")");
@@ -329,14 +354,14 @@ mvBaseUploadInterface.prototype = {
                });
        },
        doAjaxUploadStatus:function() {
-               var _this = this;
-
+               var _this = this;       
+               
                //set up the progress display for status updates:
                _this.dispProgressOverlay();
                var req = {
-                                       'action'         : 'upload',
-                                       'httpstatus' : 'true',
-                                       'sessionkey' : _this.upload_session_key
+                       'action'         : 'upload',
+                       'httpstatus' : 'true',
+                       'sessionkey' : _this.upload_session_key
                };
                //add token if present:
                if(this.etoken)
@@ -540,6 +565,7 @@ mvBaseUploadInterface.prototype = {
                                _this.warnings_sessionkey = apiRes.upload.warnings.sessionkey;
                        var bObj = {};
                        bObj[ gM('mwe-ignorewarning') ] =       function() {
+                               js_log('ignorewarning req:')
                                //re-inciate the upload proccess
                                $j('#wpIgnoreWarning').attr('checked', true);
                                $j( '#mw-upload-form' ).submit();
@@ -556,7 +582,7 @@ mvBaseUploadInterface.prototype = {
        },
        processApiResult: function( apiRes ){
                var _this = this;
-               js_log('processApiResult::');
+               js_log('processApiResult::');           
                //check for upload api error:
                // {"upload":{"result":"Failure","error":"unknown-error","code":{"status":5,"filtered":"NGC2207%2BIC2163.jpg"}}}
                if( _this.apiUpdateErrorCheck(apiRes) === false){
@@ -637,6 +663,7 @@ mvBaseUploadInterface.prototype = {
        /*update to jQuery.ui progress display type */
        dispProgressOverlay:function(){
          var _this = this;
+         
          //remove old instance:
          if($j('#upProgressDialog').length!=0){
                 $j('#upProgressDialog').dialog( 'destroy' ).remove();
@@ -706,25 +733,27 @@ mvBaseUploadInterface.prototype = {
         */
        $.fn.doDestCheck = function( opt ){
                var _this = this;
-               var destFile = this.selector;
+               js_log('doDestCheck::' + _this.selector);
+
                //set up option defaults;
                if(!opt.warn_target)
                        opt.warn_target = '#wpDestFile-warning';
 
                //empty target warn:
-               $j(opt.warn_target).empty();
-
-               //show loading
-               $j(destFile).after('<img id = "mw-spinner-wpDestFile" src ="'+ stylepath + '/common/images/spinner.gif" />');
+               $j( opt.warn_target ).empty();
+               
+               //show loading          
+               $j( _this.selector ).append('<img id="mw-spinner-wpDestFile" src ="'+ stylepath + '/common/images/spinner.gif" />');
+               
                //try and get a thumb of the current file (check its destination)
                do_api_req({
                        'data':{
-                               'titles': 'File:' + $j(destFile).val(),//@@todo we may need a more clever way to get a the filename
+                               'titles': 'File:' + $j(_this.selector).val(),//@@todo we may need a more clever way to get a the filename
                                'prop':  'imageinfo',
                                'iiprop':'url|mime|size',
                                'iiurlwidth': 150
                        }
-               },function(data){
+               },function(data){       
                        //remove spinner:
                        $j('#mw-spinner-wpDestFile').remove();
                        if(data && data.query && data.query.pages){
index 0665eef..1add3c5 100644 (file)
@@ -442,7 +442,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                //check what mode to use firefogg in:
                if( _this.upload_mode == 'post' ){
                        _this.doEncode();
-               }else if( _this.upload_mode == 'api' && _this.chunks_supported){ //if api mode and chunks supported do chunkUpload
+               }else if( _this.upload_mode == 'api' ){ //if api mode and chunks supported do chunkUpload
                        _this.doChunkUpload();
                }else{
                        js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
@@ -450,36 +450,38 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        },
        //doChunkUpload does both uploading and encoding at the same time and uploads one meg chunks as they are ready
        doChunkUpload : function(){
-               js_log('doChunkUpload::');
+               js_log('firefogg::doChunkUpload');
                var _this = this;
                _this.action_done = false;
+               
                //extension should already be ogg but since its user editable,
                //check again
                //we are transcoding so we know it will be an ogg
                //(should not be done for passthrough mode)
-               var sf = _this.formData['wpDestFile'];
+               var sf = _this.formData['filename'];
                var ext = '';
                if(     sf.lastIndexOf('.') != -1){
                        ext = sf.substring( sf.lastIndexOf('.') ).toLowerCase();
                }
-               if(!_this.encoder_settings['passthrough'] && $j.inArray(ext.substr(1), _this.ogg_extensions) == -1 ){
+               if( !_this.encoder_settings['passthrough'] && $j.inArray(ext.substr(1), _this.ogg_extensions) == -1 ){
                        var extreg = new RegExp(ext + '$', 'i');
-                       _this.formData['wpDestFile'] = sf.replace(extreg, '.ogg');
+                       _this.formData['filename'] = sf.replace(extreg, '.ogg');
                }
                //add chunk response hook to build the resultURL when uploading chunks
 
                //check for editToken:
                if(!this.etoken){
-                       if( _this.formData['wpEditToken']){
-                               _this.etoken = _this.formData['wpEditToken'];
+                       js_log('missing token try ' + _this.formData['token']);
+                       if( _this.formData['token']){
+                               _this.etoken = _this.formData['token'];
                                _this.doChunkWithFormData();
                        }else{
                                get_mw_token(
-                                       'File:'+ _this.formData['wpDestFile'],
+                                       'File:'+ _this.formData['filename'],
                                        _this.api_url,
                                        function( eToken ){
                                                if( !eToken || eToken == '+\\' ){
-                                                       _this.updateProgressWin(gM('fogg-badtoken'), gM('fogg-badtoken'));
+                                                       _this.updateProgressWin( gM('fogg-badtoken'), gM('fogg-badtoken') );
                                                        return false;
                                                }
                                                _this.etoken = eToken;
@@ -488,29 +490,30 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                );
                        }
                }else{
+                       js_log('we already have token: ' + this.etoken);
                        _this.doChunkWithFormData();
                }
        },
        doChunkWithFormData:function(){
                var _this = this;
-               js_log("doChunkWithFormData::"  + _this.etoken);
+               js_log("firefogg::doChunkWithFormData"  + _this.etoken);
                //build the api url:
                var aReq ={
                        'action': 'upload',
                        'format': 'json',
-                       'filename': _this.formData['wpDestFile'],
-                       'comment': _this.formData['wpUploadDescription'],
+                       'filename': _this.formData['filename'],
+                       'comment': _this.formData['comment'],
                        'enablechunks': 'true'
                };
 
                if( _this.etoken )
                        aReq['token'] = this.etoken;
 
-               if( _this.formData['wpWatchthis'] )
-                       aReq['watch'] =  _this.formData['wpWatchthis'];
+               if( _this.formData['watch'] )
+                       aReq['watch'] =  _this.formData['watch'];
 
-               if(  _this.formData['wpIgnoreWarning'] )
-                       aReq['ignorewarnings'] = _this.formData['wpIgnoreWarning'];
+               if(  _this.formData['ignorewarnings'] )
+                       aReq['ignorewarnings'] = _this.formData['ignorewarnings'];
 
                js_log('do fogg upload/encode call: '+ _this.api_url + ' :: ' + JSON.stringify( aReq ) );
                js_log('foggEncode: '+ JSON.stringify( _this.encoder_settings ) );
@@ -562,7 +565,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        _this.formData[ 'wpSourceType' ] = 'upload';
                        _this.formData[ 'action' ]               = 'submit';
                        //wpUploadFile is set by firefogg
-                       delete _this.formData[ 'wpUploadFile' ];
+                       delete _this.formData[ 'file' ];
 
                        _this.fogg.post( _this.editForm.action, 'wpUploadFile', JSON.stringify( _this.formData ) );
                        //update upload status:
@@ -606,7 +609,7 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                                var apiResult = eval( response_text );
                                        }catch(e){
                                                var apiResult = null;
-                                       }
+                                       }                                       
                                }
                                if(apiResult && _this.apiUpdateErrorCheck( apiResult ) === false){
                                        //stop status update we have an error
@@ -621,14 +624,13 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                        //loop to get new status if still uploading (could also be encoding if we are in chunk upload mode)
                        if( _this.fogg.state == 'encoding' || _this.fogg.state == 'uploading') {
                                setTimeout(uploadStatus, 100);
-
                        }//check upload state
                        else if( _this.fogg.state == 'upload done' ||
                                                 _this.fogg.state == 'done' ||
                                                 _this.fogg.state == 'encoding done' ) {
                                   //if in "post" upload mode read the html response (should be depricated):
                                   if( _this.upload_mode == 'api' ){
-                                          if( apiResult.resultUrl ){
+                                          if( apiResult && apiResult.resultUrl ){
                                                        var buttons ={};
                                                        buttons[gM('mwe-go-to-resource')] =  function(){
                                                                window.location = apiResult.resultUrl;
@@ -686,10 +688,10 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
        procPageResponse:function( result_page ){
                var _this = this;
                js_log('f:procPageResponse');
-               var sstring = 'var wgTitle = "' + this.formData['wpDestFile'].replace('_',' ');
+               var sstring = 'var wgTitle = "' + this.formData['filename'].replace('_',' ');
 
                if(wgArticlePath){
-                       var result_txt = gM('mwe-upload_done', wgArticlePath.replace(/\$1/, 'File:' + _this.formData['wpDestFile'] ) );
+                       var result_txt = gM('mwe-upload_done', wgArticlePath.replace(/\$1/, 'File:' + _this.formData['filename'] ) );
                }else{
                        result_txt = 'File has uploaded but api "done" URL was provided. Check the log for result page output';
                }
index 0c6d322..c546627 100644 (file)
@@ -34,10 +34,8 @@ loadGM({
        "mwe-results_from" : "Results from <a href=\"$1\" target=\"_new\" >$2<\/a>",
        "mwe-missing_desc_see_source" : "This asset is missing a description. Please see the [$1 orginal source] and help describe it.",
        "rsd_config_error" : "Add media wizard configuration error: $1",
-
        "mwe-your_recent_uploads" : "Your recent uploads",
        "mwe-upload_a_file" : "Upload a new file",
-
        "mwe-resource_page_desc" : "Resource page description:",
        "mwe-edit_resource_desc" : "Edit wiki text resource description:",
        "mwe-local_resource_title" : "Local resource title:",
index 6a00a0e..00d9237 100644 (file)
@@ -55,10 +55,10 @@ var default_form_options = {
                        
                                                //form name set:
                                                '<label for="wpUploadFile">' + gM('mwe-select_file') + '</label><br>'+
-                                               '<input type="file" style="display: inline;" name="wpUploadFile" size="15"/><br>' +
+                                               '<input id="wpUploadFile" type="file" style="display: inline;" name="wpUploadFile" size="15"/><br>' +
                        
                                                '<label for="wpDestFile">' +gM('mwe-destfilename') + '</label><br>'+
-                                               '<input type="text" name="wpDestFile" size="30" /><br>'+
+                                               '<input type="text" id="wpDestFile" name="wpDestFile" size="30" /><br>'+
                        
                                                '<label for="wpUploadDescription">' + gM('mwe-summary') + ':</label><br>' +
                                                '<textarea cols="30" rows="3" name="wpUploadDescription" tabindex="3"/><br>'+
@@ -124,7 +124,7 @@ var default_form_options = {
 
                        //set up the binding per the config
                        if( opt.enable_fogg ){
-                               $j("#suf-upload [name='wpUploadFile']").firefogg({
+                               $j("#wpUploadFile").firefogg({
                                        //an api url (we won't submit directly to action of the form)
                                        'api_url' : opt.api_target,
                                        'form_rewrite': true,
index a1ffb0b..b522031 100644 (file)
@@ -45,11 +45,11 @@ loadGM({
        "mwe-ogg-player-selected" : "(selected)",
        "mwe-ogg-player-omtkplayer" : "OMTK Flash Vorbis",
        "mwe-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>",
-       "mwe-for_best_experience" : "For a better video playback experience we recommend: <b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
+       "mwe-for_best_experience" : "For a better video playback experience we recommend:<br \/><b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
        "mwe-do_not_warn_again" : "Dissmiss for now.",
        "mwe-playerselect" : "Players",
        "mwe-read_before_embed" : "Please <a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read This<\/a> before embeding!",
-       "mwe-embed_site_or_blog" : "Embed on your site or blog",
+       "mwe-embed_site_or_blog" : "Embed on your site or blog", 
        "mwe_related_videos" : "Related Videos"
 });
 
@@ -1094,14 +1094,14 @@ embedVideo.prototype = {
                var _this = this;                   
                js_log('switch video Relational'  );            
                var reqObj = {
-                       'action':'query',                        
-                       'titles':  this.wikiTitleKey,
-                   'generator':'categories'
+                       'action'        :       'query',                         
+                       'titles'        :       this.wikiTitleKey,
+                   'generator' :       'categories'
                };                              
                var req_categories= new Array();                                                
            do_api_req( {
-                       'data':reqObj, 
-                       'url': commons_api_url
+                       'data'  : reqObj, 
+                       'url'   : commons_api_url
            },  function(data){ 
                        req_categories = Array();
                        if(data.query && data.query.pages){
@@ -1133,8 +1133,6 @@ embedVideo.prototype = {
                        },  function(data){                         
                            //empty the videos:                     
                            $j('#dc_'+ _this.id + ' .related_vids ul').html(' ');
-                           var leyenda="";
-                           var titule="";      
                                                                   
                                        for(var j in data.query.pages){         
                                                //setup poster default:                                         
@@ -1152,17 +1150,15 @@ embedVideo.prototype = {
                                                                var liout = '<li>' +
                                                                                '<a href="' + descriptionurl + '" >' +
                                                                                        '<img src="' + local_poster + '">' +
-                                                                               '</a>' +
-                                                                               '<div>' +
-                                                                                       '<a title="' + title_str + '" target="_blank" ' +
-                                                                                               'href="'+ descriptionurl +'">' + title_str + '</a>' +
-                                                                               '</div>' +
+                                                                               '</a>' +                                                                                
+                                                                                       ' <a title="' + title_str + '" target="_blank" ' +
+                                                                                               'href="'+ descriptionurl +'">' + title_str + '</a>' +                                                   
                                                                        '</li>';                                                
                                                                $j('#dc_'+ _this.id + ' .related_vids ul').append(liout) ;                                                              
                                                        }
                                                 }
                                        };
-                                       js_log( 'content: ' + $j('#dc_'+ _this.id + ' .related_vids ul').html() );
+                                       //js_log( 'content: ' + $j('#dc_'+ _this.id + ' .related_vids ul').html() );
                                }); //end do_api_req
                };
        },
@@ -1378,7 +1374,7 @@ embedVideo.prototype = {
                                                                time_req + '\'); return false; "';                              
                                        }
                                        html+=' title="' + title_msg + '">' + 
-                                                gM(link_type+'_clip_msg') +                              
+                                                gM('mwe-' + link_type+'_clip_msg') +                             
                                        '</a><br><span style="font-size:small">'+ title_msg +'<span></p>';
                                }                                                       
                        }
index 5c4372d..9fb5584 100644 (file)
@@ -842,7 +842,7 @@ function mv_jqueryBindings(){
                        var sElm = $j(this.selector).get(0);
                        if(sElm['firefogg']){
                                if(sElm['firefogg']=='loading'){
-                                       js_log("Error: called firefogg operations on Firefogg selector that is not done loading");
+                                       js_log("Error: called firefogg operations on Firefogg selector that is not done loading");                                      
                                        return false;
                                }
                                //update properties:
@@ -887,7 +887,7 @@ function mv_jqueryBindings(){
                                        }else{
                                                var myFogg = new mvFirefogg( iObj );
                                        }
-                                       if(myFogg){
+                                       if(myFogg){                                             
                                                myFogg.doRewrite( callback );
                                                var selectorElement = $j( iObj.selector ).get(0);
                                                selectorElement['firefogg']=myFogg;
index b32e00b..205ca13 100644 (file)
@@ -7,8 +7,7 @@ js2AddOnloadHook( function(){
 });
 var mwUploadFormTarget = '#mw-upload-form';
 //set up the upoload form bindings once all dom manipluation is done
-var mwUploadHelper = {
-       firefogg_installed:false,
+var mwUploadHelper = { 
        init:function(){
                var _this = this;
                //if not boolean false set to true:
@@ -23,21 +22,13 @@ var mwUploadHelper = {
                                'form_rewrite': true,
                                'target_edit_from' : mwUploadFormTarget,
                                'new_source_cb' : function( orgFilename, oggName ){
-                                       if($j('#wpDestFile').val() == "")
-                                                   $j('#wpDestFile').val( oggName );
-                                               $j('#wpDestFile').doDestCheck({
-                                                       'warn_target':'#wpDestFile-warning'
-                                               });
-                               },
-                               'detect_cb':function( fogg_installed ){
-                                       if(fogg_installed){
-                                               _this.firefogg_installed=true;
-                                       }else{
-                                               _this.firefogg_installed=false;
-                                       }
-                               }
-                       });
-
+                               if($j('#wpDestFile').val() == "")
+                                           $j('#wpDestFile').val( oggName );
+                                       $j('#wpDestFile').doDestCheck({
+                                               'warn_target':'#wpDestFile-warning'
+                                       });
+                               }                               
+                       });                     
                }else{
                        //Add basic upload profile support ( http status monitoring, progress box for browsers that support it etc.)
                        if($j('#wpUploadFileURL').length != 0){
@@ -51,7 +42,7 @@ var mwUploadHelper = {
                if( wgAjaxUploadDestCheck ){
                        //do destination check:
                        $j('#wpDestFile').change(function(){
-                               $j(this).doDestCheck({
+                               $j('#wpDestFile').doDestCheck({
                                        'warn_target':'#wpDestFile-warning'
                                });
                        });