From 28e96e693e60e03f04e6eac92c15f34c4140c4a0 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Sat, 7 Nov 2009 15:59:45 +0000 Subject: [PATCH] * archive.org duration query is currently broken (added checks and fallbacks) * added source page linkback --- .../searchLibs/archiveOrgSearch.js | 8 +++- js2/mwEmbed/libClipEdit/mvClipEdit.js | 38 ++++++++++--------- js2/mwEmbed/libEmbedVideo/embedVideo.js | 9 +++-- js2/mwEmbed/skins/ctrlBuilder.js | 2 +- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js b/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js index 2285d16b23..e8fe90aca8 100644 --- a/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js +++ b/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js @@ -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 ''; } diff --git a/js2/mwEmbed/libClipEdit/mvClipEdit.js b/js2/mwEmbed/libClipEdit/mvClipEdit.js index 87ce2255f4..d3cd5ac13d 100644 --- a/js2/mwEmbed/libClipEdit/mvClipEdit.js +++ b/js2/mwEmbed/libClipEdit/mvClipEdit.js @@ -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('

' + gM('mwe-edit-video-tools') + '

'); 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){ diff --git a/js2/mwEmbed/libEmbedVideo/embedVideo.js b/js2/mwEmbed/libEmbedVideo/embedVideo.js index d7aeb7562c..1b119a190d 100644 --- a/js2/mwEmbed/libEmbedVideo/embedVideo.js +++ b/js2/mwEmbed/libEmbedVideo/embedVideo.js @@ -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(); diff --git a/js2/mwEmbed/skins/ctrlBuilder.js b/js2/mwEmbed/skins/ctrlBuilder.js index 592f969cb7..e877452d76 100644 --- a/js2/mwEmbed/skins/ctrlBuilder.js +++ b/js2/mwEmbed/skins/ctrlBuilder.js @@ -364,7 +364,7 @@ ctrlBuilder.prototype = { '

'+gM('mwe-share')+'

'; //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+='

Source Page

'; o+=''+ -- 2.20.1