* some style updates to add-media-wizard
authorMichael Dale <dale@users.mediawiki.org>
Thu, 10 Sep 2009 21:06:51 +0000 (21:06 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 10 Sep 2009 21:06:51 +0000 (21:06 +0000)
* minor js code style cleanup

js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js
js2/mwEmbed/libClipEdit/mvClipEdit.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/libSequencer/mvFirefoggRender.js

index c684151..3384abb 100644 (file)
@@ -443,7 +443,7 @@ remoteSearchDriver.prototype = {
                var _this = this;
                //add the parent target_container if not provided or missing
                if(!_this.target_container || $j(_this.target_container).length==0){
-                       $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:30px;left:0px;bottom:33px;right:0px;" title="' + gM('mwe-add_media_wizard') + '" ></div>');
+                       $j('body').append('<div id="rsd_modal_target" style="position:absolute;top:3em;left:0px;bottom:3em;right:0px;" title="' + gM('mwe-add_media_wizard') + '" ></div>');
                        _this.target_container = '#rsd_modal_target';
                        //js_log('appended: #rsd_modal_target' + $j(_this.target_container).attr('id'));
                        //js_log('added target id:' + $j(_this.target_container).attr('id'));
@@ -1074,7 +1074,7 @@ remoteSearchDriver.prototype = {
                $j( _this.target_container ).find('#rsd_resource_edit').remove();
                //add the edit layout window with loading place holders
                $j( _this.target_container ).append('<div id="rsd_resource_edit" '+
-                       'style="position:absolute;top:0px;left:0px;bottom:5px;right:4px;background-color:#FFF;">' +
+                       'style="position:absolute;top:0px;left:0px;bottom:0px;right:4px;background-color:#FFF;">' +
                                '<div id="clip_edit_disp" style="position:absolute;' + overflow_style + 'width:100%;height:100%;padding:5px;'+
                                        'width:' + (maxWidth) + 'px;" >' +
                                                mv_get_loading_img('position:absolute;top:30px;left:30px') +
@@ -1123,18 +1123,14 @@ remoteSearchDriver.prototype = {
                        'cursor':'default',
                        'opacity':0
                });
-
-
-               //try and keep aspect ratio for the thumbnail that we clicked:
-               var rh = $j('#rsd_edit_img').height();
-               var rw = $j('#rsd_edit_img').width(); 
                
-               var tRatio = rh / rw;
+               //try and keep aspect ratio for the thumbnail that we clicked:                          
+               var tRatio = rObj.orgheight / rObj.orgwidth;
 
                if(     ! tRatio )
                        var tRatio = 1; //set ratio to 1 if tRatio did not work. 
 
-               //js_log('set from ' +  $j('#rsd_edit_img').width() + 'x' + $j('#rsd_edit_img').height() + ' to init thumbimage to ' + maxWidth + ' x ' + parseInt( tRatio * maxWidth) );
+               //js_log('set from ' +  tRatio + ' to init thumbimage to ' + maxWidth + ' x ' + parseInt( tRatio * maxWidth) );
                //scale up image and to swap with high res version
                $j('#rsd_edit_img').animate({
                        'opacity':1,
index 83d2111..2829c55 100644 (file)
@@ -1,5 +1,5 @@
 //archive.org uses solr engine: 
-//more about solr here: 
+//more about solr here:  
 //http://lucene.apache.org/solr/
 
 var archiveOrgSearch = function ( iObj){
@@ -72,7 +72,7 @@ archiveOrgSearch.prototype = {
                                        'desc'           : resource.description,
                                        'src'             : _this.dnUrl + resource.identifier+'/format=Ogg+video',
                                        'mime'            : 'application/ogg',
-                                       //set the licence: (rsd is a pointer to the parent remoteSearchDriver )          
+                                       //set the license: (rsd is a pointer to the parent remoteSearchDriver )          
                                        'license'         : this.rsd.getLicenceFromUrl( resource.licenseurl ),
                                        'pSobj'          :_this                         
                                        
index b1c14ad..d9c537d 100644 (file)
@@ -52,8 +52,8 @@ mediaWikiSearch.prototype = {
                        'url':this.cp.api_url
                },function(data){                       
                        var titleSet = {};
-                       var titleStr=''
-                       var pound='';
+                       var titleStr = ''
+                       var pound = '';
                        //loop over the data and group by title
                        if(data.query && data.query.recentchanges){     
                                for(var i in data.query.recentchanges){
@@ -65,13 +65,14 @@ mediaWikiSearch.prototype = {
                                        }
                                }
                        }                                       
-                       //now run the actual query ( too bad we cant use recentchanges as a gennerator
+                       //now run the actual query ( too bad we can't use recentchanges as a generator )
+                       //bug 20563
                        do_api_req({
                                'data' : {
-                                       'action':'query',
-                                       'titles':titleStr,      
-                                       'prop':'imageinfo|revisions|categories',
-                                       'iiprop':'url|mime|size',
+                                       'action'        : 'query',
+                                       'titles'        : titleStr,     
+                                       'prop'          : 'imageinfo|revisions|categories',
+                                       'iiprop'        : 'url|mime|size',
                                        'iiurlwidth': parseInt( _this.rsd.thumb_width ),
                                        'rvprop':'content'      
                                },
@@ -124,7 +125,7 @@ mediaWikiSearch.prototype = {
                                _this.loading = false;
                });                     
        },      
-       //same as below but returns your rObj for convience
+       //same as below but returns your rObj for convenience 
        addSingleResult:function( data ){       
                return this.addResults(data, true);
        },
@@ -174,7 +175,7 @@ mediaWikiSearch.prototype = {
                                                'categories':page.categories
                                        }
                                };                      
-                               //attempt to parse out some stuff from the teplate: 
+                               //attempt to parse out some stuff from the template: 
                                var desc = rObj.desc.match(/\|Description=(([^\n]*\n)*)\|Source=/)
                                if( desc && desc[1] ){                                  
                                        rObj.desc = $j.trim( desc[1] );
@@ -227,7 +228,7 @@ mediaWikiSearch.prototype = {
                                return false;
                        }                       
                }
-               //assuming svg or size is in range: give them requeted size
+               //assuming svg or size is in range: give them requested size
                callback({ 
                                'url'   : baseImgUrl + '?f=' + rObj.titleKey + '&w='+ size.width,
                                'width' : size.width,
@@ -331,8 +332,8 @@ mediaWikiSearch.prototype = {
                        return desc;     
                }
                //else return the title since we could not find the desc:
-               js_log('we could not find the Description tag in :' + desc );
-               return rObj.title;
+               js_log('Error: No Description Tag, Using::' + desc );
+               return desc;
        },
        parseWikiTemplate: function( text ){
                //@@todo parse wiki Template return object with properties and values
index 2d994a6..90d73e2 100644 (file)
@@ -1,5 +1,5 @@
 /*the sequence remote search driver
-        extends the base remote search driver with sequence specific stuff.             could seperate this out into seperate lib.
+        extends the base remote search driver with sequence specific stuff
 */
 
 var seqRemoteSearchDriver = function(iObj){
@@ -95,7 +95,7 @@ seqRemoteSearchDriver.prototype = {
                        if(tClip)
                                var target_order = tClip.order;
                }
-               //@@todo show watting of sorts.
+               //@@todo show wating of sorts.
 
                //get target order:
                var cat = rObj;
index 788f954..ced5f6d 100644 (file)
@@ -27,7 +27,7 @@ loadGM({
        "mwe-set_in_out_points" : "Set in-out points",
        "mwe-start_time" : "Start time",
        "mwe-end_time" : "End time",
-       "mwe-preview_inout" : "Preview\/play in-out points"
+       "mwe-preview_inout" : "Preview in-out points"
 });
 
 var default_clipedit_values = {
index 8690411..885e185 100644 (file)
@@ -5,8 +5,7 @@
 loadGM({
        "mwe-loading_plugin" : "loading plugin <blink>...<\/blink>",
        "mwe-select_playback" : "Set playback preference",
-       "mwe-link_back" : "Link back",
-       "mwe-error_load_lib" : "Error: JavaScript $1 was not retrievable or does not define $2",
+       "mwe-link_back" : "Link back",  
        "mwe-error_swap_vid" : "Error: mv_embed was unable to swap the video tag for the mv_embed interface",
        "mwe-add_to_end_of_sequence" : "Add to end of sequence",
        "mwe-missing_video_stream" : "The video file for this stream is missing",
@@ -2154,7 +2153,7 @@ embedVideo.prototype = {
                return this.media_element.selected_source.URLTimeEncoding;
        },
        setSliderValue: function(perc, hide_progress){          
-               if(this.controls){              
+               if(this.controls && $j('#mv_play_head_'+this_id).length != 0){          
                        var this_id = (this.pc)?this.pc.pp.id:this.id;
                        var val = parseInt( perc*1000 ); 
                        $j('#mv_play_head_'+this_id).slider('value', val);
index 2f5fd2d..cd6c0da 100644 (file)
@@ -52,7 +52,7 @@ mvFirefoggRender.prototype = {
                                this.renderOptions[ i ] = default_render_options[i];
                        }
                }
-               //setup the application options (with defaults) 
+               //Setup the application options (with defaults) 
                for(var i in default_FirefoggRender_options ){
                        if( iObj[ i ] ){
                                this[ i ] = iObj[ i ];
@@ -60,8 +60,7 @@ mvFirefoggRender.prototype = {
                                this[ i ] = default_FirefoggRender_options[i];
                        }
                }
-               //set up targets and local vars
-               
+               //Set up targets and local vars         
                if( iObj.target_startRender ){
                        $j(iObj.target_startRender).click(function(){
                                js_log("Start render");