Index: trunk/extensions/MetavidWiki/skins/mv_allpages.js |
— | — | @@ -23,10 +23,12 @@ |
24 | 24 | _global['$j'] = jQuery.noConflict(); |
25 | 25 | js_log('allpage_ did jquery check'); |
26 | 26 | |
27 | | - //(@@todo genneralize to a script action taken by the php so its not language specifc) |
28 | | - if(wgCanonicalNamespace=='Sequence' && $j('#ca-edit').hasClass("selected")){ |
29 | | - mv_do_sequence_edit_swap('seq'); |
30 | | - } |
| 27 | + if(typeof wgCanonicalNamespace != 'undefined'){ |
| 28 | + //(@@todo genneralize to a script action taken by the php so its not language specifc) |
| 29 | + if(wgCanonicalNamespace=='Sequence' && $j('#ca-edit').hasClass("selected")){ |
| 30 | + mv_do_sequence_edit_swap('seq'); |
| 31 | + } |
| 32 | + } |
31 | 33 | |
32 | 34 | var reqLibs = {'$j.fn.autocomplete':'jquery/plugins/jquery.autocomplete.js', |
33 | 35 | '$j.fn.hoverIntent':'jquery/plugins/jquery.hoverIntent.js'}; |
Index: trunk/extensions/MetavidWiki/skins/external_media_wizard.js |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | //add media wizard integration for mediaWiki |
3 | 3 | |
4 | 4 | /* config */ |
5 | | -var mv_embed_url = 'http://localhost/wiki/extensions/MetavidWiki/skins/mv_embed/mv_embed.js'; |
6 | 5 | //Setup your content providers (see the remoteSearchDriver::content_providers for all options) |
7 | 6 | var wg_content_proivers_config = { |
8 | 7 | 'wiki_commons':{ |
— | — | @@ -14,6 +13,8 @@ |
15 | 14 | } |
16 | 15 | var wg_local_wiki_api_url = wgServer + wgScriptPath + '/api.php'; |
17 | 16 | |
| 17 | +//if mv_embed is hosted somewhere other than near by the external_media_wizzard you can define it here: |
| 18 | +var mv_embed_url = null; |
18 | 19 | |
19 | 20 | //*code should not have to modify anything below*/ |
20 | 21 | //check if we are on a edit page: |
— | — | @@ -47,7 +48,10 @@ |
48 | 49 | '<div id="mv_overlay" style="background:#000;cursor:wait;height:100%;left:0;position:fixed;'+ |
49 | 50 | 'top:0;width:100%;z-index:5;filter:alpha(opacity=60);-moz-opacity: 0.6;'+ |
50 | 51 | 'opacity: 0.6;"/>'; |
51 | | - |
| 52 | + //get mv_embed path from _this_ file location: |
| 53 | + if(!mv_embed_url) |
| 54 | + mv_embed_url = getMvEmbedUrl(); |
| 55 | + |
52 | 56 | //inject mv_embed |
53 | 57 | if( typeof MV_EMBED_VERSION == 'undefined'){ |
54 | 58 | var e = document.createElement("script"); |
— | — | @@ -81,6 +85,16 @@ |
82 | 86 | }); |
83 | 87 | } |
84 | 88 | } |
| 89 | +function getMvEmbedUrl(){ |
| 90 | + for(var i in document.getElementsByTagName('script')){ |
| 91 | + var s = document.getElementsByTagName('script')[i]; |
| 92 | + if( s.src.indexOf('external_media_wizard.js') != -1 ){ |
| 93 | + //use the path: |
| 94 | + return s.src= s.src.replace('external_media_wizard.js', '') + 'mv_embed/mv_embed.js'; |
| 95 | + } |
| 96 | + } |
| 97 | + alert('Error: could not find mv_embed path'); |
| 98 | +} |
85 | 99 | /*once we modify the dom we lose the text selection :( so here are some get pos functions */ |
86 | 100 | function getTextCusorStartPos(o){ |
87 | 101 | if (o.createTextRange) { |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js |
— | — | @@ -57,24 +57,28 @@ |
58 | 58 | '<h3>Edit Video Tools:</h3>' + |
59 | 59 | '<strong>Set in-out points</strong>'+ |
60 | 60 | '<table border="0" style="background: transparent; width:94%;height:50px;">'+ |
61 | | - '<tbody><tr><td width="40">'+ |
62 | | - '<span style="font-size: small;" id="track_time_start_rsd">' + eb.start_ntp +'</span>'+ |
63 | | - '</td><td><div style="border: 1px solid black; width: 100%; height: 5px; background-color: #888;" '+ |
64 | | - 'id="container_track_rsd">'+ |
65 | | - '<div id="resize_rsd" class="ui-resizable ui-draggable">'+ |
66 | | - |
67 | | - '<div class="ui-resizable-w ui-resizable-handle"'+ |
68 | | - ' id="handle1_rsd" unselectable="on"/>'+ |
69 | | - |
70 | | - '<div class="ui-resizable-e ui-resizable-handle" '+ |
71 | | - ' id="handle2_rsd" unselectable="on"/>'+ |
72 | | - |
73 | | - '<div class="ui-dragSpan" id="dragSpan_rsd" style="cursor: move;"/>'+ |
74 | | - '</div>'+ |
75 | | - '</div>'+ |
76 | | - '</td><td width="50">'+ |
77 | | - '<span style="font-size: small;" id="track_time_end_rsd">'+ eb.end_ntp +'</span>'+ |
78 | | - '</td></tr></tbody>'+ |
| 61 | + '<tr>' + |
| 62 | + '<td style="width:50px">'+ |
| 63 | + '<span style="font-size: small;" id="track_time_start_rsd">' + eb.start_ntp +'</span>'+ |
| 64 | + '</td>' + |
| 65 | + '<td>' + |
| 66 | + '<div style="border: 1px solid black; width: 100%; height: 5px; background-color: #888;" '+ |
| 67 | + 'id="container_track_rsd">'+ |
| 68 | + '<div id="resize_rsd" class="ui-resizable ui-draggable">'+ |
| 69 | + '<div class="ui-resizable-w ui-resizable-handle"'+ |
| 70 | + ' id="handle1_rsd" unselectable="on"/>'+ |
| 71 | + |
| 72 | + '<div class="ui-resizable-e ui-resizable-handle" '+ |
| 73 | + ' id="handle2_rsd" unselectable="on"/>'+ |
| 74 | + |
| 75 | + '<div class="ui-dragSpan" id="dragSpan_rsd" style="cursor: move;"/>'+ |
| 76 | + '</div>'+ |
| 77 | + '</div>'+ |
| 78 | + '</td>' + |
| 79 | + '<td style="width:50px">'+ |
| 80 | + '<span style="font-size: small;" id="track_time_end_rsd">'+ eb.end_ntp +'</span>'+ |
| 81 | + '</td>' + |
| 82 | + '</tr>' + |
79 | 83 | '</table>'+ |
80 | 84 | '<span style="float: left;">'+ |
81 | 85 | '<label class="mv_css_form" for="mv_start_hr_rsd"><i>Start time:</i></label>'+ |
— | — | @@ -85,7 +89,7 @@ |
86 | 90 | '<input name="mv_end_hr_rsd" id="mv_end_hr_rsd" value="' + eb.end_ntp + '" maxlength="8" size="8" class="mv_adj_hr"/>'+ |
87 | 91 | '</span>'+ |
88 | 92 | '<div style="clear: both;"/>'+ |
89 | | - '<input id="mv_preview_clip" type="button" value="Preview In-out points">'+ |
| 93 | + '<input id="mv_preview_clip" type="button" value="Preview/Play In-out points">'+ |
90 | 94 | this.getInsertControl() |
91 | 95 | ); |
92 | 96 | //setup bindings: |
— | — | @@ -99,7 +103,8 @@ |
100 | 104 | this.applyInsertControlBindings(); |
101 | 105 | }, |
102 | 106 | getInsertControl:function(){ |
103 | | - return '<h3>Inline Caption Description</h3>'+ |
| 107 | + return '<h3>Inline Description</h3>' + |
| 108 | + '(you can copy and paste from the transcript by clicking on the cc button below the video)'+ |
104 | 109 | '<textarea style="width:300px;" id="mv_inline_img_desc" rows="4" cols="30"></textarea><br>'+ |
105 | 110 | '<h3>Actions</h3>'+ |
106 | 111 | '<input type="button" class="mv_insert_image_page" value="' + getMsg('mv_insert_image_page') + '"> '+ |
— | — | @@ -170,9 +175,9 @@ |
171 | 176 | this.applyInsertControlBindings(); |
172 | 177 | }, |
173 | 178 | applyVideoAdj:function(){ |
174 | | - //update video related keys |
175 | | - _this.rObj['titleKey'] = 'Stream:'; |
176 | | - _this.rObj['start_time'] = ''; |
| 179 | + //update video related keys |
| 180 | + this.rObj['start_time'] = $j('#mv_start_hr_rsd').val(); |
| 181 | + this.rObj['end_time'] = $j('#mv_end_hr_rsd').val(); |
177 | 182 | }, |
178 | 183 | applyCrop:function(){ |
179 | 184 | var _this = this; |
— | — | @@ -361,8 +366,7 @@ |
362 | 367 | drag:function(e, ui){ |
363 | 368 | mv_slider_update_stats(mvd_id, true); |
364 | 369 | }, |
365 | | - stop:function(e,ui){ |
366 | | - $j('#resize_'+mvd_id).css('top', 0); |
| 370 | + stop:function(e,ui){ |
367 | 371 | do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
368 | 372 | } |
369 | 373 | }); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js |
— | — | @@ -1580,7 +1580,7 @@ |
1581 | 1581 | { |
1582 | 1582 | var _this = this; |
1583 | 1583 | js_log('embedFlow: uri:'+ _this.media_element.selected_source.getURI(this.seek_time_sec) |
1584 | | - +' '+ mv_embed_path + 'flowplayer/flowplayer-3.0.1.swf' ) ; |
| 1584 | + +"\n"+ mv_embed_path + 'flowplayer/flowplayer-3.0.1.swf' ) ; |
1585 | 1585 | var flowConfig = { |
1586 | 1586 | clip: { |
1587 | 1587 | url: _this.media_element.selected_source.getURI(this.seek_time_sec), |
— | — | @@ -1627,6 +1627,11 @@ |
1628 | 1628 | this.parent_play(); |
1629 | 1629 | if( this.fla ){ |
1630 | 1630 | this.fla.play(); |
| 1631 | + |
| 1632 | + //on a resume make sure volume and opacity are correct |
| 1633 | + this.fla.setVolume(90); |
| 1634 | + $f().getPlugin('screen').css({'opacity':'1.0'}); |
| 1635 | + |
1631 | 1636 | setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250); |
1632 | 1637 | } |
1633 | 1638 | }, |
— | — | @@ -1658,7 +1663,11 @@ |
1659 | 1664 | if( this.fla['pause'] ){ |
1660 | 1665 | if( ! this.fla.isPaused() ){ |
1661 | 1666 | js_log('calling plugin pause'); |
1662 | | - this.fla.pause(); |
| 1667 | + this.fla.pause(); |
| 1668 | + |
| 1669 | + //restore volume and opacity |
| 1670 | + this.fla.setVolume(90); |
| 1671 | + $f().getPlugin('screen').css({'opacity':'1.0'}); |
1663 | 1672 | } |
1664 | 1673 | } |
1665 | 1674 | } |
— | — | @@ -1681,7 +1690,11 @@ |
1682 | 1691 | if( typeof flash_state == 'undefined' ){ |
1683 | 1692 | var flash_state = { |
1684 | 1693 | "time" : this.fla.getTime() |
1685 | | - }; |
| 1694 | + }; |
| 1695 | + //we are not getting buffered data restore volume and opacity |
| 1696 | + this.fla.setVolume(90); |
| 1697 | + $f().getPlugin('screen').css({'opacity':'1.0'}); |
| 1698 | + |
1686 | 1699 | }else{ |
1687 | 1700 | //simplification of buffer state ... should move to support returning time rages like: |
1688 | 1701 | //http://www.whatwg.org/specs/web-apps/current-work/#normalized-timeranges-object |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libRemoteMediaSearch/mv_remote_media_search.js |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | 'wiki_commons':{ |
74 | 74 | 'enabled':1, |
75 | 75 | 'checked':1, |
76 | | - 'd' :0, |
| 76 | + 'd' :1, |
77 | 77 | 'title' :'Wikipedia Commons', |
78 | 78 | 'desc' : 'Wikimedia Commons is a media file repository making available public domain '+ |
79 | 79 | 'and freely-licensed educational media content (images, sound and video clips) to all.', |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | 'metavid':{ |
90 | 90 | 'enabled':1, |
91 | 91 | 'checked':1, |
92 | | - 'd' :1, |
| 92 | + 'd' :0, |
93 | 93 | 'title' :'Metavid.org', |
94 | 94 | 'homepage':'http://metavid.org', |
95 | 95 | 'desc' : 'Metavid hosts thousands of hours of US house and senate floor proceedings', |
— | — | @@ -97,8 +97,9 @@ |
98 | 98 | 'local' :false, //if local set to true we can use local |
99 | 99 | 'resource_prefix': 'MV_', //what prefix to use on imported resources |
100 | 100 | |
101 | | - 'local_copy': true //if local_copy set to true if we should download assets |
102 | | - //(else just remote embed copy) |
| 101 | + 'local_copy': true, //if local_copy set to true if we should download assets |
| 102 | + //(else just remote embed the metavid stream (recomended) ) |
| 103 | + 'target_source_id':'mv_ogg_low_quality' // the source id/name to import |
103 | 104 | }, |
104 | 105 | 'archive_org':{ |
105 | 106 | 'enabled':0, |
— | — | @@ -277,7 +278,8 @@ |
278 | 279 | drawTabs: function(){ |
279 | 280 | var _this = this; |
280 | 281 | //add the tabs to the rsd_results container: |
281 | | - var o= '<ul class="rsd_cp_tabs" style="margin: 1em 0 0 1em;position:absolute;top:42px;padding:0;">'; //no idea why margin does not overwrite from the css |
| 282 | + var o='<div class="rsd_tabs_container" style="position:absolute;top:53px;width:100%;left:12px;">'; |
| 283 | + o+= '<ul class="rsd_cp_tabs" style="margin: 0 0 0 0;position:absolute;top:0px;padding:0;">'; //no idea why margin does not overwrite from the css |
282 | 284 | o+='<li id="rsd_tab_combined" ><img src="' + mv_embed_path + 'skins/'+mv_skin_name+ '/remote_search/combined_tab.png"></li>'; |
283 | 285 | for(var cp_id in this.content_providers){ |
284 | 286 | var cp = this.content_providers[cp_id]; |
— | — | @@ -287,6 +289,7 @@ |
288 | 290 | } |
289 | 291 | } |
290 | 292 | o+='</ul>'; |
| 293 | + o+='</div>'; |
291 | 294 | //outout the resource results holder |
292 | 295 | o+='<div id="rsd_results" />'; |
293 | 296 | $j('#rsd_results_container').html(o); |
— | — | @@ -482,9 +485,13 @@ |
483 | 486 | }); |
484 | 487 | } |
485 | 488 | if( mediaType == 'video'){ |
486 | | - $j('#clip_edit_disp').append('<video id="embed_vid" roe="'+ rObj['roe_url']+'"></video>'); |
| 489 | + $j('#clip_edit_disp').append( |
| 490 | + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) |
| 491 | + ); |
487 | 492 | //rewrite by id hanldes getting any libs we are missing: |
488 | 493 | rewrite_by_id('embed_vid',function(){ |
| 494 | + //grab any information that we got from the ROE xml or parsed from the media file |
| 495 | + rObj = rObj.pSobj.getEmbedObjParsedInfo(rObj, 'embed_vid'); |
489 | 496 | //add the resizable to the doLoad request: |
490 | 497 | loadLibs['$j.ui.resizable'] = 'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js', |
491 | 498 | mvJsLoader.doLoad( loadLibs,function(){ |
— | — | @@ -505,9 +512,9 @@ |
506 | 513 | |
507 | 514 | //first check if the resource is not already on this wiki: |
508 | 515 | //@@todo get the File/Image namespace name: |
509 | | - rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,''); |
| 516 | + rObj.target_resource_title = cp.resource_prefix + rObj.titleKey.replace(/File:|Image:/,''); |
510 | 517 | |
511 | | - reqObj={'action':'query', titles: _this.cFileNS + ':' + rObj.target_resource_title + '|' + rObj.titleKey}; |
| 518 | + reqObj={'action':'query', titles: _this.cFileNS + ':' + rObj.target_resource_title}; |
512 | 519 | do_api_req( reqObj, this.local_wiki_api_url, function(data){ |
513 | 520 | var found_title = false; |
514 | 521 | for(var i in data.query.pages){ |
— | — | @@ -516,40 +523,51 @@ |
517 | 524 | found_title=data.query.pages[i]['title']; |
518 | 525 | } |
519 | 526 | } |
520 | | - if( found_title ){ |
| 527 | + if( found_title ){ |
521 | 528 | js_log("checkImportResource:found title:" + found_title); |
522 | 529 | //resource is already present (or resource with same name is already present) |
523 | | - rObj.target_resource_title = found_title.replace(/File:|Image:/,''); |
| 530 | + rObj.target_resource_title = found_title.replace(/File:|Image:/,''); |
| 531 | + //@@todo give user option to write over it |
524 | 532 | cir_callback( rObj ); |
525 | 533 | }else{ |
526 | 534 | js_log("resource not present: update:"+ _this.cFileNS + ':' + rObj.target_resource_title); |
527 | 535 | |
| 536 | + //update the rObj with import info |
| 537 | + rObj.pSobj.updateDataForImport( rObj ); |
| 538 | + |
528 | 539 | //setup the resource description from resource description: |
529 | 540 | var base_resource_desc = '{{Information '+"\n"+ |
530 | 541 | '|Description= ' + rObj.title + ' imported from ' + '[' + cp.homepage + |
531 | 542 | ' ' + cp.title+']' + "\n" + |
532 | | - '|Source=' + '[' + rObj.link +' Original Source]'+ "\n"; |
| 543 | + '|Source=' + '[' + rObj.link.replace(/^\s\s*/, '').replace(/\s\s*$/, '') +' Original Source]'+ "\n"; |
533 | 544 | |
534 | 545 | if( rObj.author ) |
535 | | - base_resource_desc+='|Author= US government' +"\n"; |
| 546 | + base_resource_desc+='|Author= ' + rObj.author +"\n"; |
536 | 547 | |
537 | 548 | if( rObj.date ) |
538 | | - base_resource_desc+='|Date= October 1st 2008' +"\n"; |
| 549 | + base_resource_desc+='|Date=' + rObj.date +"\n"; |
539 | 550 | |
540 | 551 | if( rObj.permission ) |
541 | | - base_resource_desc+='|Permission=' +"\n"; |
| 552 | + base_resource_desc+='|Permission='+ rObj.permission +"\n"; |
542 | 553 | |
543 | 554 | if( rObj.other_versions ) |
544 | | - base_resource_desc+='|other_versions=' +"\n"; |
| 555 | + base_resource_desc+='|Other_versions=' + rObj.other_versions + "\n"; |
545 | 556 | |
546 | 557 | base_resource_desc+='}}'; |
| 558 | + |
| 559 | + //add in licence template tag: |
| 560 | + if( rObj.licence_template_tag ) |
| 561 | + base_resource_desc += "\n" + |
| 562 | + '== [[Commons:Copyright tags|Licensing]]: ==' +"\n"+ |
| 563 | + '{{' + rObj.licence_template_tag + '}}'; |
| 564 | + |
547 | 565 | $j('#rsd_resource_import').remove();//remove any old resource imports |
548 | 566 | //@@ show user dialog to import the resource |
549 | 567 | $j( '#'+ _this.target_id ).append('<div id="rsd_resource_import" '+ |
550 | 568 | 'style="position:absolute;top:50px;left:50px;right:50px;bottom:50px;background-color:#FFF;border:solid thick red;z-index:3">' + |
551 | 569 | '<h3 style="color:red">Resource: <span style="color:black">' + rObj.title + '</span> needs to be imported</h3>'+ |
552 | 570 | '<div id="rsd_preview_import_container" style="position:absolute;width:50%;bottom:0px;left:0px;overflow:auto;top:30px;">' + |
553 | | - rObj.pSobj.getEmbedHTML( rObj, {'max_height':'200'} )+ //get embedHTML with small thumb: |
| 571 | + rObj.pSobj.getEmbedHTML( rObj, {'max_height':'200','only_poster':true} )+ //get embedHTML with small thumb: |
554 | 572 | '<br style="clear both">'+ |
555 | 573 | '<strong>Resource Page Description:</strong>'+ |
556 | 574 | '<div id="rsd_import_desc" syle="display:inline;">'+ |
— | — | @@ -561,7 +579,7 @@ |
562 | 580 | '<strong>Local Resource Title:</strong><br>'+ |
563 | 581 | '<input type="text" size="30" value="' + rObj.target_resource_title + '" readonly="true"><br>'+ |
564 | 582 | '<strong>Edit WikiText Resource Description:</strong>(will be replaced by forms soon)'+ |
565 | | - '<textarea id="rsd_import_ta" id="mv_img_desc" rows="8" cols="50">'+ |
| 583 | + '<textarea id="rsd_import_ta" id="mv_img_desc" style="width:90%;" rows="8" cols="50">'+ |
566 | 584 | base_resource_desc + |
567 | 585 | '</textarea><br>'+ |
568 | 586 | '<input type="checkbox" value="true" id="wpWatchthis" name="wpWatchthis" tabindex="7"/>'+ |
— | — | @@ -642,8 +660,18 @@ |
643 | 661 | cir_callback( rObj ); |
644 | 662 | }else{ |
645 | 663 | js_log("Error or warning: (did not find: \"" + sstring + ' in output' ); |
| 664 | + pos_etitle = '<h1 class="firstHeading">'; |
| 665 | + var error_txt=''; |
| 666 | + if(data.indexOf(pos_etitle)!=-1){ |
| 667 | + var sp = data.indexOf(pos_etitle) + pos_etitle.length; |
| 668 | + error_txt = data.substr(sp , |
| 669 | + (data.indexOf('</h1>',sp )-sp) |
| 670 | + ); |
| 671 | + } |
| 672 | + //var error_msg = |
646 | 673 | $j('#rsd_resource_import').html( |
647 | 674 | '<b>error importing asset (we should have better error handling soon)</b><br>'+ |
| 675 | + error_txt + '<br>'+ |
648 | 676 | '<a href="#" id="rsd_import_error" >Cancel import</a>' |
649 | 677 | ); |
650 | 678 | $j('#rsd_import_error').click(function(){ |
— | — | @@ -881,6 +909,22 @@ |
882 | 910 | //by default just return the existing image: |
883 | 911 | getImageObj:function( rObj, size, callback){ |
884 | 912 | callback( {'url':rObj.poster} ); |
| 913 | + }, |
| 914 | + getEmbedWikiText:function(rObj){ |
| 915 | + var layout = ( rObj.layout)? rObj.layout:"right" |
| 916 | + var o= '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|'+layout; |
| 917 | + |
| 918 | + if(rObj.target_width) |
| 919 | + o+='|' + rObj.target_width + 'px'; |
| 920 | + |
| 921 | + if( rObj.inlineDesc ) |
| 922 | + o+='|' + rObj.inlineDesc; |
| 923 | + |
| 924 | + o+=']]'; |
| 925 | + return o; |
| 926 | + }, |
| 927 | + updateDataForImport:function( rObj ){ |
| 928 | + return rObj; |
885 | 929 | } |
886 | 930 | } |
887 | 931 | /* |
— | — | @@ -911,7 +955,7 @@ |
912 | 956 | _this.loading= 1; |
913 | 957 | js_log('metavidSearch::getSearchResults()'); |
914 | 958 | //proccess all options |
915 | | - url = this.cp.api_url; |
| 959 | + var url = this.cp.api_url; |
916 | 960 | //add on the req_param |
917 | 961 | for(var i in this.reqObj){ |
918 | 962 | url += '&' + i + '=' + this.reqObj[i]; |
— | — | @@ -922,15 +966,65 @@ |
923 | 967 | do_request(url, function(data){ |
924 | 968 | //should have an xml rss data object: |
925 | 969 | _this.addRSSData( data , url ); |
926 | | - //do some metavid specific pos proccessing: |
| 970 | + //do some metavid specific pos proccessing on the rObj data: |
927 | 971 | for(var i in _this.resultsObj){ |
928 | | - var rObj = _this.resultsObj[i]; |
929 | | - } |
930 | | - |
| 972 | + var rObj = _this.resultsObj[i]; |
| 973 | + var proe = parseUri( rObj['roe_url'] ); |
| 974 | + rObj['start_time'] = proe.queryKey['t'].split('/')[0]; |
| 975 | + rObj['end_time'] = proe.queryKey['t'].split('/')[1]; |
| 976 | + //transform the title into a wiki_safe title: |
| 977 | + rObj['titleKey'] = proe.queryKey['stream_name'] + '_' + rObj['start_time'].replace(/:/g,'.') + '_' + rObj['end_time'].replace(/:/g,'.') + '.ogg'; |
| 978 | + } |
931 | 979 | //done loading: |
932 | 980 | _this.loading=0; |
933 | 981 | }); |
934 | | - } |
| 982 | + }, |
| 983 | + getEmbedWikiText:function(rObj, options){ |
| 984 | + //if we are using a local copy do the standard b: |
| 985 | + if( this.cp.local_copy == true) |
| 986 | + return this.parent_getEmbedWikiText(rObj, options); |
| 987 | + |
| 988 | + //if local_copy is false and embed metavid extension is enabled: |
| 989 | + |
| 990 | + return |
| 991 | + }, |
| 992 | + getEmbedHTML:function( rObj , options ){ |
| 993 | + var id_attr = (options['id'])?' id = "' + options['id'] +'" ': ''; |
| 994 | + var style_attr = (options['max_width'])?' style="width:'+options['max_width']+'px;"':''; |
| 995 | + if(options['only_poster']){ |
| 996 | + return '<img ' + id_attr + ' src="' + rObj['poster']+'" ' + style_attr + '>'; |
| 997 | + }else{ |
| 998 | + return '<video ' + id_attr + ' roe="' + rObj['roe_url'] + '"></video>'; |
| 999 | + } |
| 1000 | + }, |
| 1001 | + getEmbedObjParsedInfo:function(rObj, eb_id){ |
| 1002 | + var sources = $j('#'+eb_id).get(0).media_element.getSources(); |
| 1003 | + rObj.other_versions ='*[' + rObj['roe_url'] + ' XML of all Video Formats and Timed Text]'+"\n"; |
| 1004 | + for(var i in sources){ |
| 1005 | + var cur_source = sources[i]; |
| 1006 | + //rObj.other_versions += '*['+cur_source.getURI() +' ' + cur_source.title +']' + "\n"; |
| 1007 | + if( cur_source.id == this.cp.target_source_id) |
| 1008 | + rObj['url'] = cur_source.getURI(); |
| 1009 | + } |
| 1010 | + js_log('set url to: ' + rObj['url']); |
| 1011 | + return rObj; |
| 1012 | + }, |
| 1013 | + //update rObj for import: |
| 1014 | + updateDataForImport:function( rObj ){ |
| 1015 | + rObj['author']='US Government'; |
| 1016 | + //convert data to UTC type date: |
| 1017 | + var dateExp = new RegExp(/_([0-9]+)\-([0-9]+)\-([0-9]+)/); |
| 1018 | + var dParts = rObj.link.match (dateExp); |
| 1019 | + var d = new Date(); |
| 1020 | + var year_full = (dParts[3].length==2)?'20'+dParts[3].toString():dParts[3]; |
| 1021 | + d.setFullYear(year_full, dParts[1]-1, dParts[2]); |
| 1022 | + rObj['date'] = d.toDateString(); |
| 1023 | + rObj['licence_template_tag']='PD-USGov'; |
| 1024 | + |
| 1025 | + js_log('url is: '+rObj.url); |
| 1026 | + |
| 1027 | + return rObj; |
| 1028 | + } |
935 | 1029 | } |
936 | 1030 | |
937 | 1031 | var mediaWikiSearch = function( initObj ) { |
— | — | @@ -1078,21 +1172,12 @@ |
1079 | 1173 | getEmbedWikiText: function( rObj ){ |
1080 | 1174 | //set default layout to right justified |
1081 | 1175 | var layout = ( rObj.layout)? rObj.layout:"right" |
1082 | | - //if crop is null do simple output: |
1083 | | - if( rObj.crop == null){ |
1084 | | - var o= '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|'+layout; |
1085 | | - |
1086 | | - if(rObj.target_width) |
1087 | | - o+='|' + rObj.target_width + 'px'; |
1088 | | - |
1089 | | - if( rObj.inlineDesc ) |
1090 | | - o+='|' + rObj.inlineDesc; |
1091 | | - |
1092 | | - o+=']]'; |
1093 | | - return o; |
1094 | | - } |
| 1176 | + //if crop is null do base output: |
| 1177 | + if( rObj.crop == null) |
| 1178 | + return this.parent_getEmbedWikiText( rObj ); |
| 1179 | + |
1095 | 1180 | //using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop |
1096 | | - //should be replaced with server side cropping |
| 1181 | + //@@todo should be replaced with server side cropping |
1097 | 1182 | return '{{Preview Crop ' + "\n" + |
1098 | 1183 | '|Image = ' + rObj.target_resource_title + "\n" + |
1099 | 1184 | '|bSize = ' + rObj.width + "\n" + |