* archive.org duration query is currently broken (added checks and fallbacks)
authorMichael Dale <dale@users.mediawiki.org>
Sat, 7 Nov 2009 15:59:45 +0000 (15:59 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Sat, 7 Nov 2009 15:59:45 +0000 (15:59 +0000)
* added source page linkback

js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
js2/mwEmbed/libClipEdit/mvClipEdit.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/skins/ctrlBuilder.js

index 2285d16..e8fe90a 100644 (file)
@@ -87,7 +87,7 @@ archiveOrgSearch.prototype = {
                do_api_req( {
                        'data':{'avinfo':1},
                        'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'                      
-               },function(data){                                                               
+               },function(data){                                                                                       
                        if(data['length'])
                                rObj.duration = data['length'];
                        if(data['width'])
@@ -103,7 +103,11 @@ archiveOrgSearch.prototype = {
                if(!options)
                        options ={};
                var id_attr = (options['id'])?' id = "' + options['id'] +'" ': '';
-               var src = rObj.src + '?t=0:0:0/'+ seconds2npt( rObj.duration );
+               if( rObj.duration ){
+                       var src = rObj.src + '?t=0:0:0/'+ seconds2npt( rObj.duration );
+               }else{
+                       var src = rObj.src;
+               }
                if(rObj.mime == 'application/ogg' || rObj.mime == 'audio/ogg' || rObj.mime=='video/ogg'){
                        return '<video ' + id_attr + ' src="' + src + '" poster="' + rObj.poster + '" type="video/ogg"></video>';
                }
index 87ce225..d3cd5ac 100644 (file)
@@ -1,7 +1,7 @@
 /*
-       hanndles clip edit controls
+       handles clip edit controls
        'inoutpoints':0,        //should let you set the in and out points of clip
-       'panzoom':0,             //should allow setting keyframes and tweenning modes
+       'panzoom':0,             //should allow setting keyframes and tweening modes
        'overlays':0,            //should allow setting "locked to clip" overlay tracks
        'audio':0                       //should allow controlling the audio volume (with keyframes)
 */
@@ -135,14 +135,16 @@ mvClipEdit.prototype = {
                                var start_ntp = (_this.rObj.embed.start_ntp) ? _this.rObj.embed.start_ntp : seconds2npt( 0 );
                                if(!start_ntp)
                                        seconds2npt( 0 );
-
-                               $j(target).html(
-                                       _this.getSetInOutHtml({
-                                               'start_ntp'     : start_ntp,
-                                               'end_ntp'       : end_ntp
-                                       })
-                               );
-                               _this.setInOutBindings();
+                               //make sure we have an end time                         
+                               if( end_ntp ){                          
+                                       $j(target).html(
+                                               _this.getSetInOutHtml({
+                                                       'start_ntp'     : start_ntp,
+                                                       'end_ntp'       : end_ntp
+                                               })
+                                       );
+                                       _this.setInOutBindings();
+                               }
                        }
                },
                'fileopts':{
@@ -378,13 +380,15 @@ mvClipEdit.prototype = {
                eb.preview_mode = true;
                $j('#'+this.control_ct).html('<h3>' + gM('mwe-edit-video-tools') + '</h3>');
                if( eb.supportsURLTimeEncoding() ){
-                       $j('#'+this.control_ct).append(
-                               _this.getSetInOutHtml({
-                                       'start_ntp'     : eb.start_ntp,
-                                       'end_ntp'       : eb.end_ntp
-                               })
-                       );
-                       _this.setInOutBindings();
+                       if(eb.end_ntp){
+                               $j('#'+this.control_ct).append(
+                                       _this.getSetInOutHtml({
+                                               'start_ntp'     : eb.start_ntp,
+                                               'end_ntp'       : eb.end_ntp
+                                       })
+                               );
+                               _this.setInOutBindings();
+                       }
                }
                //if in a sequence we have no need for insertDesc
                if( !_this.p_seqObj){
index d7aeb75..1b119a1 100644 (file)
@@ -1665,17 +1665,19 @@ embedVideo.prototype = {
        doLinkBack:function(){
                if(this.roe && this.media_element.addedROEData==false){
                        var _this = this;
-                       this.displayHTML(gM('mwe-loading_txt'));
+                       this.displayHTML( gM('mwe-loading_txt') );
                        do_request(this.roe, function(data)
                           {
                                  _this.media_element.addROE(data);                                                      
                                  _this.doLinkBack();
                           });                     
                }else{
-                       if(this.media_element.linkback){                        
+                       if( this.linkback){
+                               window.location = this.linkback;
+                       }else if(this.media_element.linkback){                  
                                window.location = this.media_element.linkback;
                        }else{
-                               this.displayHTML(gM('mwe-could_not_find_linkback'));
+                               this.displayHTML( gM('mwe-could_not_find_linkback') );
                        }
                }          
        },
@@ -1703,6 +1705,7 @@ embedVideo.prototype = {
                $cpTxt.click(function(){
                        $j(this).get(0).select();
                });
+               
                //add copy binding: 
                $cpBtn.click(function(){                                                
                        $cpTxt.focus().get(0).select();                 
index 592f969..e877452 100644 (file)
@@ -364,7 +364,7 @@ ctrlBuilder.prototype = {
                                                '<p class="short_match vo_showcode"><a href="#"><span>'+gM('mwe-share')+'</span></a></p>';
 
                                        //link to the stream page if we are not already there:
-                                       if( ctrlObj.embedObj.roe && typeof mv_stream_interface == 'undefined' )
+                                       if( ( ctrlObj.embedObj.roe || ctrlObj.embedObj.linkback ) && typeof mv_stream_interface == 'undefined' )
                                                o+='<p class="short_match"><a href="javascript:$j(\'#'+ctrlObj.id+'\').get(0).doLinkBack()"><span><strong>Source Page</strong></span></a></p>';
 
                                o+='</div>'+