Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_xspf.xml |
— | — | @@ -11,24 +11,24 @@ |
12 | 12 | knobs in there, you've got sand. in. and try to. do a picture. on. etch-a-sketch |
13 | 13 | gone gone to. china. I mean, they're all gone |
14 | 14 | </annotation> |
15 | | - <location>http://metavid.ucsc.edu/media/senate_11-14-05.ogg.anx?t=0:42:14/0:42:56</location> |
16 | | - <image>http://metavid.ucsc.edu/image_media/senate_11-14-05?t=0:42:14&size=320x240</image> |
| 15 | + <location>http://128.114.20.64/media/senate_11-14-05.ogg?t=0:42:14/0:42:56</location> |
| 16 | + <image>http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_id=14&t=0:42:00&size=400x300</image> |
17 | 17 | <info>http://metavid.ucsc.edu/overlay/video_player/webview?stream_name=senate_11-14-05&t=0:42:14/0:42:56</info> |
18 | 18 | </track> |
19 | 19 | <track> |
20 | 20 | <title>we know better</title> |
21 | 21 | <annotation><b>Byran Dorgan:</b>that 1.4 trillion in combined debut we know better than that we know what to do |
22 | 22 | </annotation> |
23 | | - <location>http://metavid.ucsc.edu/media/senate_proceeding_02-10-06.ogg.HQ.anx?t=01:30:59/01:31:24</location> |
24 | | - <image>http://metavid.ucsc.edu/image_media/senate_proceeding_02-10-06?t=01:30:59&size=320x240</image> |
| 23 | + <location>http://128.114.20.64/media/senate_proceeding_02-10-06.ogg?t=01:30:59/01:31:24</location> |
| 24 | + <image>http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_name=senate_proceeding_02-10-06&t=1:30:59&size=400x300</image> |
25 | 25 | <info>http://metavid.ucsc.edu/overlay/video_player/webview?stream_name=senate_proceeding_02-10-06&t=01:30:59/01:31:24</info> |
26 | 26 | </track> |
27 | 27 | <track> |
28 | 28 | <title>random clip</title> |
29 | 29 | <annotation>example annotation |
30 | 30 | </annotation> |
31 | | - <location>http://metavid.ucsc.edu/media/senate_11-14-05.ogg.anx?t=0:44:14/0:45:56</location> |
32 | | - <image>http://metavid.ucsc.edu/image_media/senate_proceeding_06-08-06?t=0:44:14&size=320x240</image> |
| 31 | + <location>http://128.114.20.64/media/senate_11-14-05.ogg?t=0:44:14/0:45:56</location> |
| 32 | + <image>http://metavid.org/w/index.php?action=ajax&rs=mv_frame_server&stream_name=senate_proceeding_06-08-06&t=0:44:14&size=400x300</image> |
33 | 33 | <info>http://metavid.ucsc.edu/overlay/video_player/webview?stream_name=senate_proceeding_06-08-06&t=0:44:14/0:45:56</info> |
34 | 34 | </track> |
35 | 35 | </trackList> |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_playlists.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | <html> |
10 | 10 | <head> |
11 | 11 | <title>sample playlist usage</title> |
12 | | - <script type="text/javascript" src="<?php echo htmlspecialchars( $mv_path ) ?>mv_embed.js"></script> |
| 12 | + <script type="text/javascript" src="<?php echo htmlspecialchars( $mv_path ) ?>mv_embed.js?<?php echo time()?>"></script> |
13 | 13 | </head> |
14 | 14 | <body> |
15 | 15 | <h3> Sample Playlists</h3> |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | ?> |
61 | 61 | <table border="1" cellpadding="6" width="600"> |
62 | 62 | <? foreach ( $sample_embed as $key => $aval ) { |
63 | | - // $key!=8 |
| 63 | + // && |
64 | 64 | if ( $key != 9 && $key != 8)continue; |
65 | 65 | ?> |
66 | 66 | <tr> |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_clipedit.js |
— | — | @@ -52,10 +52,10 @@ |
53 | 53 | var eb = $j('#embed_vid').get(0); |
54 | 54 | //turn on preview to avoid onDone actions |
55 | 55 | eb.preview_mode = true; |
56 | | - |
57 | | - $j('#'+this.control_ct).html( |
58 | | - '<h3>Edit Video Tools:</h3>' + |
59 | | - '<strong>Set in-out points</strong>'+ |
| 56 | + $j('#'+this.control_ct).html('<h3>Edit Video Tools:</h3>'); |
| 57 | + if( eb.supportsURLTimeEncoding() ){ |
| 58 | + js_log("SUPPORTS supports_url_time_encoding do start end"); |
| 59 | + $j('#'+this.control_ct).append('<strong>Set in-out points</strong>'+ |
60 | 60 | '<table border="0" style="background: transparent; width:94%;height:50px;">'+ |
61 | 61 | '<tr>' + |
62 | 62 | '<td style="width:50px">'+ |
— | — | @@ -89,22 +89,22 @@ |
90 | 90 | '<input name="mv_end_hr_rsd" id="mv_end_hr_rsd" value="' + eb.end_ntp + '" maxlength="8" size="8" class="mv_adj_hr"/>'+ |
91 | 91 | '</span>'+ |
92 | 92 | '<div style="clear: both;"/>'+ |
93 | | - '<input id="mv_preview_clip" type="button" value="Preview/Play In-out points">'+ |
94 | | - this.getInsertControl() |
95 | | - ); |
96 | | - //setup bindings: |
97 | | - add_adjust_hooks('rsd'); |
| 93 | + '<input id="mv_preview_clip" type="button" value="Preview/Play In-out points">'); |
| 94 | + |
| 95 | + //setup bindings for adjust / preview: |
| 96 | + add_adjust_hooks('rsd'); |
| 97 | + $j('#mv_preview_clip').click(function(){ |
| 98 | + $j('#embed_vid').get(0).stop(); |
| 99 | + $j('#embed_vid').get(0).play(); |
| 100 | + }); |
| 101 | + } |
| 102 | + $j('#'+this.control_ct).append( this.getInsertControl() ); |
98 | 103 | |
99 | | - $j('#mv_preview_clip').click(function(){ |
100 | | - $j('#embed_vid').get(0).stop(); |
101 | | - $j('#embed_vid').get(0).play(); |
102 | | - }); |
103 | | - |
104 | 104 | this.applyInsertControlBindings(); |
105 | 105 | }, |
106 | 106 | getInsertControl:function(){ |
107 | 107 | return '<h3>Inline Description</h3>' + |
108 | | - '(you can copy and paste from the transcript by clicking on the cc button below the video)'+ |
| 108 | + '(you can copy and paste from the transcript by clicking on the cc button below the video)<br>'+ |
109 | 109 | '<textarea style="width:300px;" id="mv_inline_img_desc" rows="4" cols="30"></textarea><br>'+ |
110 | 110 | '<h3>Actions</h3>'+ |
111 | 111 | '<input type="button" class="mv_insert_image_page" value="' + getMsg('mv_insert_image_page') + '"> '+ |
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | $j('.mv_insert_image_page').click(function(){ |
125 | 125 | _this.applyEdit(); |
126 | 126 | //copy over the desc text to the resource object |
127 | | - rObj['inlineDesc']= $j('#mv_inline_img_desc').val(); |
| 127 | + _this.rObj['inlineDesc']= $j('#mv_inline_img_desc').val(); |
128 | 128 | _this.p_rsdObj.insertResource( _this.rObj ); |
129 | 129 | }); |
130 | 130 | $j('.mv_preview_insert').click(function(){ |
— | — | @@ -150,10 +150,10 @@ |
151 | 151 | '<div class="mv_edit_button mv_scale_button_base" id="mv_scale_button" alt="crop" title="'+getMsg('mv_scale')+'"></div>'+ |
152 | 152 | '<a href="#" class="mv_scale_msg">' + getMsg('mv_scale') + '</a><br>'+ |
153 | 153 | '<a href="#" style="display:none" class="mv_apply_scale">' + getMsg('mv_apply_scale') + '</a> '+ |
154 | | - '<a href="#" style="display:none" class="mv_rest_scale">' + getMsg('mv_reset_scale') + '</a> '+ |
| 154 | + '<a href="#" style="display:none" class="mv_rest_scale">' + getMsg('mv_reset_scale') + '</a><br> '+ |
155 | 155 | _this.getInsertControl() |
156 | 156 | ); |
157 | | - //add bidings: |
| 157 | + //add bindings: |
158 | 158 | $j('#mv_crop_button,.mv_crop_msg,.mv_apply_crop').click(function(){ |
159 | 159 | js_log('click:mv_crop_button: base width: ' + _this.rObj.width + ' bh: ' + _this.rObj.height); |
160 | 160 | if($j('#mv_crop_button').hasClass('mv_crop_button_selected')){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mv_playlist.js |
— | — | @@ -1191,7 +1191,7 @@ |
1192 | 1192 | //js_log('do xsfp parse: '+ this.data.innerHTML); |
1193 | 1193 | var properties = { title:'title', linkback:'info', |
1194 | 1194 | author:'creator',desc:'annotation', |
1195 | | - img:'image', date:'date' }; |
| 1195 | + poster:'image', date:'date' }; |
1196 | 1196 | var tmpElm = null; |
1197 | 1197 | //get the first instance of any of the meta tags (ok that may be the meta on the first clip) |
1198 | 1198 | //js_log('do loop on properties:' + properties); |
— | — | @@ -1210,7 +1210,7 @@ |
1211 | 1211 | //add any clip specific properties |
1212 | 1212 | properties.src = 'location'; |
1213 | 1213 | for (var i=0;i<clips.length;i++){ |
1214 | | - var cur_clip = new mvClip({type:'srcClip',id:'p_'+this.id+'_c_'+i,pp:this,order:i}); |
| 1214 | + var cur_clip = new mvClip({id:'p_'+this.id+'_c_'+i,pp:this,order:i}); |
1215 | 1215 | //js_log('cur clip:'+ cur_clip.id); |
1216 | 1216 | for(var j in properties){ |
1217 | 1217 | tmpElm = clips[i].getElementsByTagName( properties[j] )[0]; |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/styles.css |
— | — | @@ -386,8 +386,8 @@ |
387 | 387 | margin: 10px 0; |
388 | 388 | padding: 0 20px; |
389 | 389 | } |
390 | | -.videoOptionsBox div.block ul a {text-decoration: none;} |
391 | | -.videoOptionsBox div.block ul li {margin: 7px 0;} |
| 390 | +.videoOptionsBox div.block ul a { text-decoration: none;} |
| 391 | +.videoOptionsBox div.block ul li { margin: 7px 0;} |
392 | 392 | .videoOptionsBox div.block ul li ul {margin: 0;} |
393 | 393 | .videoOptionsBox div.block ul li ul li a {color: #df5c01;} |
394 | 394 | .videoOptionsBox div.block ul li ul li a:hover {color: #ffa02f;} |
— | — | @@ -507,9 +507,8 @@ |
508 | 508 | ul.rsd_cp_tabs li.rsd_selected { |
509 | 509 | background:#FFFFFF none repeat scroll 0 0; |
510 | 510 | border-bottom:0; |
511 | | - padding-bottom:7px; |
512 | | - padding-top:12px; |
513 | | - top:40px; |
| 511 | + padding-bottom:11px; |
| 512 | + padding-top:12px; |
514 | 513 | } |
515 | 514 | ul.rsd_cp_tabs li { |
516 | 515 | display:inline; |
— | — | @@ -517,7 +516,7 @@ |
518 | 517 | padding:10px 0 0; |
519 | 518 | background:#F7F7F7 url(remote_search/tab-bg.png) repeat-x scroll left bottom; |
520 | 519 | border:1px solid #777; |
521 | | - padding-bottom:6px; |
| 520 | + padding-bottom:10px; |
522 | 521 | margin-left:7px; |
523 | 522 | cursor:pointer; |
524 | 523 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -1236,13 +1236,18 @@ |
1237 | 1237 | init : function(element) |
1238 | 1238 | { |
1239 | 1239 | //js_log('adding mediaSource: ' + element); |
1240 | | - this.src = $j(element).attr('src'); |
| 1240 | + this.src = $j(element).attr('src'); |
1241 | 1241 | this.marked_default = false; |
1242 | 1242 | if ( element.tagName.toLowerCase() == 'video') |
1243 | 1243 | this.marked_default = true; |
1244 | 1244 | |
1245 | | - //set default timeFormat: |
1246 | | - this['timeFormat']='anx'; |
| 1245 | + //set default timeFormat if we have a time url: |
| 1246 | + //not ideal way to discover if content is on an oggz_chop server. |
| 1247 | + //should check some other way. |
| 1248 | + var pUrl = parseUri ( this.src ); |
| 1249 | + if(typeof pUrl['queryKey']['t'] != 'undefined'){ |
| 1250 | + this['timeFormat']='anx'; |
| 1251 | + } |
1247 | 1252 | |
1248 | 1253 | for(var i=0; i < mv_default_source_attr.length; i++){ //for in loop oky on object |
1249 | 1254 | var attr = mv_default_source_attr[ i ]; |
— | — | @@ -1261,10 +1266,7 @@ |
1262 | 1267 | |
1263 | 1268 | //set the title if unset: |
1264 | 1269 | if( !this.title ){ |
1265 | | - var parts = this.mime_type.split("/",2); |
1266 | | - parts[0]=parts[0].replace('video', 'stream'); |
1267 | | - parts[1]=parts[1].replace('x-flv', 'flash'); |
1268 | | - this.title = parts[1] + ' ' + parts[0]; |
| 1270 | + this.title = this.mime_type; |
1269 | 1271 | } |
1270 | 1272 | this.parseURLDuration(); |
1271 | 1273 | }, |
— | — | @@ -1406,10 +1408,12 @@ |
1407 | 1409 | //we can issue a HEAD request and read the mime type of the media... |
1408 | 1410 | // (this will detect media mime type independently of the url name) |
1409 | 1411 | //http://www.jibbering.com/2002/4/httprequest.html (this should be done by extending jquery's ajax objects) |
1410 | | - switch(uri.substr(uri.lastIndexOf('.'),4)){ |
| 1412 | + var end_inx = (uri.indexOf('?')!=-1)? uri.indexOf('?') : uri.length; |
| 1413 | + var no_param_uri = uri.substr(0, end_inx); |
| 1414 | + switch( no_param_uri.substr(no_param_uri.lastIndexOf('.'),4) ){ |
1411 | 1415 | case '.flv':return 'video/x-flv';break; |
1412 | 1416 | case '.ogg':return 'video/ogg';break; |
1413 | | - case '.anx':return 'video/annodex';break; |
| 1417 | + case '.anx':return 'video/ogg';break; |
1414 | 1418 | } |
1415 | 1419 | } |
1416 | 1420 | }; |
— | — | @@ -1921,14 +1925,14 @@ |
1922 | 1926 | // first check if seek can be done on locally downloaded content. |
1923 | 1927 | doSeek : function( perc ){ |
1924 | 1928 | js_log('f:mv_embed:doSeek:'+perc); |
1925 | | - if( this.media_element.selected_source.supports_url_time_encoding ){ |
| 1929 | + if( this.supportsURLTimeEncoding() ){ |
1926 | 1930 | js_log('Seeking to ' + this.seek_time_sec + ' (local copy of clip not loaded at' + perc + '%)'); |
1927 | 1931 | this.stop(); |
1928 | 1932 | //this.seek_time_sec = 0; |
1929 | 1933 | } |
1930 | 1934 | //do play in 100ms (give things time to clear) |
1931 | 1935 | setTimeout('$j(\'#' + this.id + '\').get(0).play()',100); |
1932 | | - }, |
| 1936 | + }, |
1933 | 1937 | doEmbedHTML:function() |
1934 | 1938 | { |
1935 | 1939 | js_log('f:doEmbedHTML'); |
— | — | @@ -2769,13 +2773,17 @@ |
2770 | 2774 | return document.embeds[this.pid]; |
2771 | 2775 | } |
2772 | 2776 | return null; |
2773 | | - }, |
| 2777 | + }, |
| 2778 | + //HELPER Functions for selected source |
2774 | 2779 | /* |
2775 | 2780 | * returns the selected source url for players to play |
2776 | 2781 | */ |
2777 | 2782 | getURI : function(seek_time_sec){ |
2778 | 2783 | return this.media_element.selected_source.getURI( this.seek_time_sec ); |
2779 | 2784 | }, |
| 2785 | + supportsURLTimeEncoding: function(){ |
| 2786 | + return this.media_element.selected_source.supports_url_time_encoding; |
| 2787 | + }, |
2780 | 2788 | setSliderValue: function(perc, hide_progress){ |
2781 | 2789 | |
2782 | 2790 | //js_log('setSliderValue:'+perc+' ct:'+ this.currentTime); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_flashEmbed.js |
— | — | @@ -1720,7 +1720,7 @@ |
1721 | 1721 | $f().getPlugin('screen').css({'opacity':'1.0'}); |
1722 | 1722 | } |
1723 | 1723 | /* to support local seeks */ |
1724 | | - if(this.currentTime > 1 && this.seek_time_sec != 0 && !this.media_element.selected_source.supports_url_time_encoding) |
| 1724 | + if(this.currentTime > 1 && this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() ) |
1725 | 1725 | { |
1726 | 1726 | js_log('flashEmbed: _local_ Seeking to ' + this.seek_time_sec); |
1727 | 1727 | this.fla.seek( this.seek_time_sec ); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_vlcEmbed.js |
— | — | @@ -182,7 +182,7 @@ |
183 | 183 | }, |
184 | 184 | liveFeedRoll: 0, |
185 | 185 | onPlaying: function(){ |
186 | | - if(this.seek_time_sec != 0 && !this.media_element.selected_source.supports_url_time_encoding) |
| 186 | + if(this.seek_time_sec != 0 && !this.supportsURLTimeEncoding() ) |
187 | 187 | { |
188 | 188 | // VLC seems to have a problem seeking into the future this way |
189 | 189 | var ms_difference = this.seek_time_sec * 1000 - this.vlc.input.time; |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libRemoteMediaSearch/mv_remote_media_search.js |
— | — | @@ -280,7 +280,7 @@ |
281 | 281 | drawTabs: function(){ |
282 | 282 | var _this = this; |
283 | 283 | //add the tabs to the rsd_results container: |
284 | | - var o='<div class="rsd_tabs_container" style="position:absolute;top:53px;width:100%;left:12px;">'; |
| 284 | + var o='<div class="rsd_tabs_container" style="position:absolute;top:49px;width:100%;left:12px;height:25px;">'; |
285 | 285 | 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 |
286 | 286 | o+='<li id="rsd_tab_combined" ><img src="' + mv_embed_path + 'skins/'+mv_skin_name+ '/remote_search/combined_tab.png"></li>'; |
287 | 287 | for(var cp_id in this.content_providers){ |
— | — | @@ -366,7 +366,6 @@ |
367 | 367 | var rObj = _this.getResourceFromId( this.id ); |
368 | 368 | //remove any existing resource edit interface: |
369 | 369 | $j('#rsd_resource_edit').remove(); |
370 | | - |
371 | 370 | //set the media type: |
372 | 371 | if(rObj.mime.indexOf('image')!=-1){ |
373 | 372 | //set width to default image_edit_width |
— | — | @@ -418,6 +417,7 @@ |
419 | 418 | 'width': maxWidth + 'px', |
420 | 419 | 'height': parseInt( tRatio * maxWidth) + 'px' |
421 | 420 | }, "slow"); // do it slow to give it a chance to finish loading the HQ version |
| 421 | + |
422 | 422 | _this.loadHQImg(rObj, {'width':maxWidth}, 'rsd_edit_img', function(){ |
423 | 423 | $j('.mv_img_loader').remove(); |
424 | 424 | }); |
— | — | @@ -487,7 +487,7 @@ |
488 | 488 | }); |
489 | 489 | } |
490 | 490 | if( mediaType == 'video'){ |
491 | | - |
| 491 | + js_log('append html: ' + rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) ); |
492 | 492 | $j('#clip_edit_disp').append( |
493 | 493 | rObj.pSobj.getEmbedHTML( rObj, {id:'embed_vid'}) |
494 | 494 | ); |
— | — | @@ -495,7 +495,7 @@ |
496 | 496 | rewrite_by_id('embed_vid',function(){ |
497 | 497 | //grab any information that we got from the ROE xml or parsed from the media file |
498 | 498 | rObj = rObj.pSobj.getEmbedObjParsedInfo(rObj, 'embed_vid'); |
499 | | - //add the resizable to the doLoad request: |
| 499 | + //add the re-sizable to the doLoad request: |
500 | 500 | loadLibs['$j.ui.resizable'] = 'jquery/jquery.ui-1.5.2/ui/minified/ui.resizable.min.js', |
501 | 501 | loadLibs['$j.fn.hoverIntent'] = 'jquery/plugins/jquery.hoverIntent.js'; |
502 | 502 | mvJsLoader.doLoad( loadLibs,function(){ |
— | — | @@ -724,14 +724,10 @@ |
725 | 725 | '<input type="button" id="preview_do_insert" value="Do Insert">' + |
726 | 726 | '<a href="#" id="preview_close">Do More Modification</a>' + |
727 | 727 | '</div>' + |
728 | | - '</div>'); |
729 | | - //do a page preview given the original page text, insert point |
730 | | - js_log('insert at: ' + _this.caret_pos.s + "\n" + rObj.pSobj.getEmbedWikiText( rObj ) ); |
| 728 | + '</div>'); |
| 729 | + //update the preview_wtext |
| 730 | + _this.updatePreviewText( rObj ); |
731 | 731 | |
732 | | - //update the preview_wtext |
733 | | - _this.preview_wtext = _this.caret_pos.text.substring(0, _this.caret_pos.s) + |
734 | | - rObj.pSobj.getEmbedWikiText( rObj ) + |
735 | | - _this.caret_pos.text.substring( _this.caret_pos.s ); |
736 | 732 | |
737 | 733 | _this.getParsedWikiText(_this.preview_wtext, _this.target_title, |
738 | 734 | function(phtml){ |
— | — | @@ -747,6 +743,15 @@ |
748 | 744 | }); |
749 | 745 | }); |
750 | 746 | }, |
| 747 | + updatePreviewText:function( rObj ){ |
| 748 | + var _this = this; |
| 749 | + //insert at start if textInput cursor has not been set (ie == length) |
| 750 | + if( _this.caret_pos.text.length == _this.caret_pos.s) |
| 751 | + _this.caret_pos.s=0; |
| 752 | + _this.preview_wtext = _this.caret_pos.text.substring(0, _this.caret_pos.s) + |
| 753 | + rObj.pSobj.getEmbedWikiText( rObj ) + |
| 754 | + _this.caret_pos.text.substring( _this.caret_pos.s ); |
| 755 | + }, |
751 | 756 | getParsedWikiText:function( wikitext, title, callback ){ |
752 | 757 | var reqObj = { |
753 | 758 | 'action':'parse', |
— | — | @@ -757,6 +762,7 @@ |
758 | 763 | }); |
759 | 764 | }, |
760 | 765 | insertResource:function( rObj){ |
| 766 | + this.updatePreviewText( rObj ); |
761 | 767 | $j('#'+this.target_textbox).val( this.preview_wtext ); |
762 | 768 | this.closeAll(); |
763 | 769 | }, |
— | — | @@ -925,6 +931,9 @@ |
926 | 932 | getImageObj:function( rObj, size, callback){ |
927 | 933 | callback( {'url':rObj.poster} ); |
928 | 934 | }, |
| 935 | + getEmbedObjParsedInfo:function(rObj, eb_id){ |
| 936 | + return rObj; |
| 937 | + }, |
929 | 938 | getEmbedWikiText:function(rObj){ |
930 | 939 | var layout = ( rObj.layout)? rObj.layout:"right" |
931 | 940 | var o= '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|'+layout; |
— | — | @@ -1116,7 +1125,7 @@ |
1117 | 1126 | 'thumbwidth':page.imageinfo[0].thumbwidth, |
1118 | 1127 | 'thumbheight':page.imageinfo[0].thumbheight, |
1119 | 1128 | 'mime':page.imageinfo[0].mime, |
1120 | | - 'src':page.imageinfo.url, |
| 1129 | + 'src':page.imageinfo[0].url, |
1121 | 1130 | 'desc':page.revisions[0]['*'], |
1122 | 1131 | //add pointer to parent serach obj: |
1123 | 1132 | 'pSobj':_this, |
— | — | @@ -1124,9 +1133,9 @@ |
1125 | 1134 | 'categories':page.categories |
1126 | 1135 | } |
1127 | 1136 | } |
1128 | | - for(var i in this.resultsObj[page_id]){ |
1129 | | - //js_log('added '+ i +' '+ this.resultsObj[page_id][i]); |
1130 | | - } |
| 1137 | + //for(var i in this.resultsObj[page_id]){ |
| 1138 | + // js_log('added '+ i +' '+ this.resultsObj[page_id][i]); |
| 1139 | + //} |
1131 | 1140 | } |
1132 | 1141 | }else{ |
1133 | 1142 | js_log('no results:' + data); |
— | — | @@ -1141,6 +1150,9 @@ |
1142 | 1151 | } |
1143 | 1152 | }, |
1144 | 1153 | getImageObj:function( rObj, size, callback ){ |
| 1154 | + if( rObj.mime=='application/ogg' ) |
| 1155 | + return callback( {'url':rObj.src, 'poster' : rObj.url } ); |
| 1156 | + |
1145 | 1157 | //build the query to get the req size image: |
1146 | 1158 | var reqObj = { |
1147 | 1159 | 'action':'query', |
— | — | @@ -1155,7 +1167,7 @@ |
1156 | 1168 | do_api_req( reqObj, this.cp.api_url , function(data){ |
1157 | 1169 | var imObj = {}; |
1158 | 1170 | for(var page_id in data.query.pages){ |
1159 | | - var iminfo = data.query.pages[ page_id ].imageinfo[0]; |
| 1171 | + var iminfo = data.query.pages[ page_id ].imageinfo[0]; |
1160 | 1172 | //check if thumb size > than image size and is jpeg or png (it will not scale well above its max res) |
1161 | 1173 | if( ( iminfo.mime=='image/jpeg' || iminfo=='image/png' ) && |
1162 | 1174 | iminfo.thumbwidth > iminfo.width ){ |
— | — | @@ -1163,7 +1175,7 @@ |
1164 | 1176 | imObj['width'] = iminfo.width; |
1165 | 1177 | imObj['height'] = iminfo.height; |
1166 | 1178 | }else{ |
1167 | | - imObj['url'] = iminfo.thumburl; |
| 1179 | + imObj['url'] = iminfo.thumburl; |
1168 | 1180 | imObj['width'] = iminfo.thumbwidth; |
1169 | 1181 | imObj['height'] = iminfo.thumbheight; |
1170 | 1182 | } |
— | — | @@ -1179,14 +1191,25 @@ |
1180 | 1192 | }, |
1181 | 1193 | getEmbedHTML: function( rObj , options) { |
1182 | 1194 | //set up the output var with the default values: |
1183 | | - var outOpt = { 'width': rObj.width, 'height': rObj.height, 'src' : rObj.url}; |
1184 | | - if( options.max_height ){ |
| 1195 | + var outOpt = { 'width': rObj.width, 'height': rObj.height}; |
| 1196 | + if( options['max_height'] ){ |
1185 | 1197 | outOpt.height = (options.max_height > rObj.height) ? rObj.height : options.max_height; |
1186 | | - outOpt.width = (rObj.width / rObj.height) *outOpt.height; |
1187 | | - } |
| 1198 | + outOpt.width = (rObj.width / rObj.height) *outOpt.height; |
| 1199 | + } |
| 1200 | + var style_attr = 'style="width:' + outOpt.width + 'px;height:' + outOpt.height +'px"'; |
| 1201 | + var id_attr = (options['id'])?' id = "' + options['id'] +'" ': ''; |
| 1202 | + |
| 1203 | + //return the html type: |
1188 | 1204 | if(rObj.mime.indexOf('image')!=-1){ |
1189 | | - return '<img src="' + outOpt.src + '" style="width:' + outOpt.width + 'px;height:' + outOpt.height +'px">'; |
| 1205 | + return '<img ' + id_attr + ' src="' + rObj.url + '"' + style_attr + ' >'; |
1190 | 1206 | } |
| 1207 | + if(rObj.mime.indexOf('application/ogg')!=-1){ |
| 1208 | + return '<video ' + id_attr + |
| 1209 | + ' src="' + rObj.src + '" ' + |
| 1210 | + style_attr + |
| 1211 | + ' poster="'+ outOpt.url + '" '+ |
| 1212 | + ' ></video>'; |
| 1213 | + } |
1191 | 1214 | js_log('ERROR:unsupored mime type: ' + rObj.mime); |
1192 | 1215 | }, |
1193 | 1216 | //returns the inline wikitext for insertion (template based crops for now) |
— | — | @@ -1195,8 +1218,7 @@ |
1196 | 1219 | var layout = ( rObj.layout)? rObj.layout:"right" |
1197 | 1220 | //if crop is null do base output: |
1198 | 1221 | if( rObj.crop == null) |
1199 | | - return this.parent_getEmbedWikiText( rObj ); |
1200 | | - |
| 1222 | + return this.parent_getEmbedWikiText( rObj ); |
1201 | 1223 | //using the preview crop template: http://en.wikipedia.org/wiki/Template:Preview_Crop |
1202 | 1224 | //@@todo should be replaced with server side cropping |
1203 | 1225 | return '{{Preview Crop ' + "\n" + |