http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71779
Revision: 71779
Author: dale
Date: 2010-08-27 04:55:27 +0000 (Fri, 27 Aug 2010)
Log Message:
-----------
* stubs for sequencer AddByUrl support
* some minor usability fixes for editor 'edit clip' selection
* some clean up of remote search driver variables
* removed not used iScroll lib ref
Modified Paths:
--------------
branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
branches/MwEmbedStandAlone/modules/Playlist/loader.js
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
branches/MwEmbedStandAlone/modules/Sequencer/loader.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerConfig.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
branches/MwEmbedStandAlone/mwEmbed.js
Added Paths:
-----------
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
Removed Paths:
-------------
branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php
Modified: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -278,7 +278,10 @@
'this_wiki': {
'enabled': 1,
'apiUrl': ( wgServer && wgScriptPath ) ?
- wgServer + wgScriptPath + '/api.php' : null,
+ wgServer + wgScriptPath + '/api.php' : null,
+
+ 'detailsUrl' : wgServer + wgArticlePath,
+
'lib': 'mediaWiki',
'homepage' : ( wgServer && wgScript ) ?
wgServer + wgScript : null,
@@ -293,6 +296,8 @@
'enabled': 1,
'homepage': 'http://kaltura.com',
'apiUrl':
'http://kaldev.kaltura.com/michael/aggregator.php',
+
+ 'detailsUrl' : wgServer + wgArticlePath,
'lib': 'kaltura',
'resource_prefix' : '',
'tab_image':false
@@ -536,6 +541,8 @@
}
return this;
},
+
+
/**
* Get license icon html
@@ -936,40 +943,50 @@
// Setup base cancel button binding
this.onCancelResourceEdit();
},
+ /**
+ * public function to get enabled content providers
+ */
+ getEnabledProviders: function(){
+ var enabledProviders = {};
+ for ( var providerName in this.content_providers ) {
+ var content_providers = this.content_providers;
+ var provider = content_providers[ providerName ];
+ if ( provider.enabled && provider.apiUrl ) {
+ enabledProviders[providerName] = provider;
+ }
+ }
+ return enabledProviders;
+ },
createProviderSelection: function(){
var _this = this;
var $providerSelection = $j( '<ul />' )
.addClass( "ui-provider-selection" );
// Add enabled search providers.
- for ( var providerName in this.content_providers ) {
- var content_providers = this.content_providers;
- var provider = content_providers[ providerName ];
- if ( provider.enabled && provider.apiUrl ) {
- var $anchor = $j( '<div />' )
- .text( gM( 'rsd-' + providerName +
'-title' ) )
- .attr({
- name: providerName
- });
- if ( this.current_provider == providerName) {
- $anchor.addClass( 'ui-selected' );
- }
-
- $anchor.click( function() {
- $j( this ).parent().parent().find(
'.ui-selected' )
- .removeClass( 'ui-selected' );
- $j( this ).addClass( 'ui-selected' );
- _this.current_provider = $j( this
).attr( "name" );
- // Update the search results on
provider selection
- _this.updateResults(
_this.current_provider, true );
- return false;
+ $j.each( _this.getEnabledProviders(), function(providerName,
provider){
+ var $anchor = $j( '<div />' )
+ .text( gM( 'rsd-' + providerName + '-title' ) )
+ .attr({
+ name: providerName
});
-
- var $listItem = $j( '<li />' );
- $listItem.append( $anchor );
- $providerSelection.append( $listItem );
+ if ( _this.current_provider == providerName) {
+ $anchor.addClass( 'ui-selected' );
}
- }
+
+ $anchor.click( function() {
+ $j( this ).parent().parent().find(
'.ui-selected' )
+ .removeClass( 'ui-selected' );
+ $j( this ).addClass( 'ui-selected' );
+ _this.current_provider = $j( this ).attr(
"name" );
+ // Update the search results on provider
selection
+ _this.updateResults( _this.current_provider,
true );
+ return false;
+ });
+
+ var $listItem = $j( '<li />' );
+ $listItem.append( $anchor );
+ $providerSelection.append( $listItem );
+ });
return $providerSelection;
},
/**
@@ -3229,7 +3246,7 @@
},
/*
- * Sets the dispaly mode
+ * Sets the display mode
* @param {String} mode Either "box" or "list"
*/
setDisplayMode: function( mode ) {
Modified: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -16,7 +16,7 @@
this.init( options );
}
flickrSearch.prototype = {
- dtUrl : 'http://www.flickr.com/photos/',
+ detailsUrl : 'http://www.flickr.com/photos/',
// @@todo probably would be good to read the api-key from configuration
apikey : '2867787a545cc66c0bce6f2e57aca1d1',
// What license we are interested in
@@ -102,7 +102,7 @@
var resource = {
'titleKey' : flickrResource.title + '.jpg',
'resourceKey': flickrResource.id,
- 'link' : _this.dtUrl +
flickrResource.pathalias + '/' + flickrResource.id,
+ 'link' : _this.detailsUrl +
flickrResource.pathalias + '/' + flickrResource.id,
'title' : flickrResource.title,
'thumbwidth' : flickrResource.width_t,
'thumbheight': flickrResource.height_t,
Deleted: branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Playlist/MediaRss.i18n.php
2010-08-27 04:55:27 UTC (rev 71779)
@@ -1,12 +0,0 @@
-<?php
-/**
- * Internationalisation for SmilPlayer
- *
- * @file
- * @ingroup Extensions
- */
-
-$messages = array();
-$messages['en'] = array(
- 'mwe-mediarss-untitled' => 'Untitled media asset'
-);
Modified: branches/MwEmbedStandAlone/modules/Playlist/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/loader.js 2010-08-27
01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Playlist/loader.js 2010-08-27
04:55:27 UTC (rev 71779)
@@ -6,7 +6,6 @@
( function( mw ) {
mw.addResourcePaths( {
- "iScroll" : "iScroll.js",
"mw.Playlist" : "mw.Playlist.js",
"mw.PlaylistHandlerMediaRss" : "mw.PlaylistHandlerMediaRss.js"
});
@@ -32,10 +31,6 @@
// Module loader
mw.addModuleLoader( 'Playlist', function(){
var resourceList = ["mw.Playlist", "mw.PlaylistHandlerMediaRss"
]
- // xxx should detect touch support rather than mobile safari
check
- if( mw.isMobileSafari() ){
- resourceList.push( "iScroll" );
- }
return resourceList;
});
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
2010-08-27 01:38:09 UTC (rev 71778)
+++
branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -146,7 +146,7 @@
} else {
$dialog.empty().text(
gM('mwe-sequencer-already-published') )
var buttons = {};
- buttons[ gm('mwe-ok') ] = function(){
+ buttons[ gM('mwe-ok') ] = function(){
$j( this ).dialog( 'close' );
}
$dialog.dialog( 'option', 'buttons', buttons);
Modified: branches/MwEmbedStandAlone/modules/Sequencer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/loader.js 2010-08-27
01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Sequencer/loader.js 2010-08-27
04:55:27 UTC (rev 71779)
@@ -13,6 +13,7 @@
"mw.SequencerServer" : "mw.SequencerServer.js",
"mw.SequencerAddMedia" : "mw.SequencerAddMedia.js",
+ "mw.SequencerAddByUrl" : "mw.SequencerAddByUrl.js",
"mw.SequencerPlayer" : "mw.SequencerPlayer.js",
"mw.SequencerTimeline" : "mw.SequencerTimeline.js",
"mw.SequencerKeyBindings" : "mw.SequencerKeyBindings.js",
@@ -56,7 +57,8 @@
[
'$j.contextMenu',
- 'mw.SequencerServer',
+ 'mw.SequencerServer',
+ 'mw.SequencerAddByUrl',
'mw.SequencerAddMedia',
'mw.SequencerPlayer',
'mw.SequencerRender',
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -272,7 +272,7 @@
}
return this.timeline;
},
- getEditTools: function(){
+ getTools: function(){
if( !this.editTools ){
this.editTools = new mw.SequencerTools( this );
}
@@ -284,6 +284,12 @@
}
return this.addMedia;
},
+ getAddByUrl: function(){
+ if( ! this.addByUrl ){
+ this.addByUrl = new mw.SequencerAddByUrl( this );
+ }
+ return this.addByUrl
+ },
getKeyBindings:function(){
if( ! this.keyBindings ){
this.keyBindings = new mw.SequencerKeyBindings( this );
@@ -319,6 +325,7 @@
* Get the UI layout
*/
getUiLayout: function(){
+ var _this = this;
// xxx There is probably a cleaner way to generate a list of
jQuery objects than $j('new').children();
return $j('<div />').append(
$j('<div />')
@@ -346,7 +353,7 @@
.append(
$j('<div />')
.addClass( "ui-layout-center
mwseq-edit" )
- .html(
gM('mwe-sequencer-no_selected_resource') ),
+ .html(
_this.getTools().getDefaultText() ),
$j('<div />')
.addClass( "ui-layout-east
mwseq-player" )
.text(
gM('mwe-sequencer-loading-player') ),
Added: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
(rev 0)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -0,0 +1,42 @@
+/**
+* Sequencer add by url support ( ties into mwEmbed AddMedia remoteSearchDriver
module )
+*/
+
+//Wrap in mw closure
+( function( mw ) {
+
+mw.SequencerAddByUrl = function( sequencer ) {
+ return this.init( sequencer );
+};
+mw.SequencerAddByUrl.prototype = {
+ init: function( sequencer ){
+ this.sequencer = sequencer;
+ },
+
+ /**
+ * Does a basic parseUri check to see if a string is likely a url:
+ */
+ isUrl: function( inputString ){
+ return ( mw.parseUri( inputString ).authority != mw.parseUri(
inputString ).host ) ;
+ },
+
+ /**
+ * Try to add media via url and present a dialog if failed
+ * or user input is required
+ *
+ * Uses remoteSearchDriver to help in retrieving entry info
+ * @param {Object} remoteSearchDriver The remote search driver
+ */
+ addByUrlDialog: function( remoteSearchDriver, url ){
+ // see if the asset matches the key type of any enabled content
provider:
+ $j.each( remoteSearchDriver.getEnabledProviders(),
function(providerName, provider){
+
+ });
+
+ if( mw.getConfig( 'Sequencer.AddAssetByUrl' )){
+ // try directly adding the asset
+ }
+ }
+}
+
+} )( window.mw );
\ No newline at end of file
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -14,8 +14,49 @@
init: function( sequencer ){
this.sequencer = sequencer;
+ },
+ getDefaultSearchText: function(){
+ return gM( 'mwe-sequencer-url-or-search');
},
-
+ getSearchDriver: function( callback ){
+ var _this = this;
+ if( ! _this.remoteSearchDriver ){
+ // Get any sequencer configured options
+ var addMediaOptions =
_this.sequencer.getOption('AddMedia');
+ addMediaOptions = $j.extend( {
+ 'target_container' :
_this.sequencer.getEditToolTarget(),
+ 'target_search_input' :
_this.sequencer.getMenuTarget().find('input.searchMedia'),
+ 'displaySearchInput': false,
+ 'displayResourceInfoIcons' : false,
+ 'resourceSelectionCallback' : function(
resource ){
+ mw.addLoaderDialog( gM(
'mwe-sequencer-loading-asset' ) );
+ // Get convert resource to smilClip and
insert into the timeline
+ _this.getSmilClipFromResource(
resource, function( smilClip ) {
+
_this.sequencer.getTimeline().insertSmilClipEdit( smilClip );
+ mw.closeLoaderDialog();
+ });
+ return false;
+ },
+ 'displaySearchResultsCallback' : function(){
+ _this.addSearchResultsDrag();
+ }
+ }, addMediaOptions );
+
+ // Update the search value if has changed from the
default search text helper:
+ var inputValue =
_this.sequencer.getMenuTarget().find('input.searchMedia').val();
+ if( inputValue != _this.getDefaultSearchText() )
+ addMediaOptions.default_query = inputValue;
+
+
+ // set the tool target to loading
+ mw.load( 'AddMedia.addMediaWizard', function(){
+ _this.remoteSearchDriver = new
mw.RemoteSearchDriver( addMediaOptions );
+ callback( _this.remoteSearchDriver );
+ });
+ } else {
+ callback (_this.remoteSearchDriver )
+ }
+ },
// Get the menu widget that drives the search and upload tab selection
getMenuWidget: function(){
var _this = this;
@@ -26,7 +67,7 @@
$j('<input />')
.addClass( 'searchMedia')
.val(
- gM(
'mwe-sequencer-url-or-search')
+ _this.getDefaultSearchText()
)
.css({'color': '#888', 'zindex': 2})
.focus( function(){
@@ -61,7 +102,7 @@
'icon' : 'plus'
})
.click(function(){
- // only do the search if the user has
given the search input focus
+ // Only do the search if the user has
given the search input focus
if( widgetFocus ){
_this.proccessRequest();
}
@@ -72,43 +113,39 @@
},
proccessRequest: function(){
var _this = this;
- // get the input text
- var inputValue =
this.sequencer.getMenuTarget().find('input.searchMedia').val();
-
+
this.sequencer.getEditToolTarget()
.empty()
.loadingSpinner();
- if( ! _this.remoteSearchDriver ){
- // set the tool target to loading
- mw.load( 'AddMedia.addMediaWizard', function(){
- _this.remoteSearchDriver = new
mw.RemoteSearchDriver({
- 'target_container' :
_this.sequencer.getEditToolTarget(),
- 'target_search_input' :
_this.sequencer.getMenuTarget().find('input.searchMedia'),
- 'displaySearchInput': false,
- 'default_query' : inputValue,
- 'displayResourceInfoIcons' : false,
- 'resourceSelectionCallback' : function(
resource ){
- mw.addLoaderDialog( gM(
'mwe-sequencer-loading-asset' ) );
- // Get convert resource to
smilClip and insert into the timeline
- _this.getSmilClipFromResource(
resource, function( smilClip ) {
-
_this.sequencer.getTimeline().insertSmilClipEdit( smilClip );
- mw.closeLoaderDialog();
- });
- return false;
- },
- 'displaySearchResultsCallback' :
function(){
- _this.addSearchResultsDrag();
- }
- });
- // Create the search user interface:
- _this.remoteSearchDriver.createUI();
- });
- } else {
- this.remoteSearchDriver.createUI()
- }
+ this.getSearchDriver( function( remoteSearchDriver ){
+ // Check if input value can be handled by url
+ var inputValue =
_this.sequencer.getMenuTarget().find('input.searchMedia').val();
+ if( _this.sequencer.getAddByUrl().isUrl( inputValue) ){
+ _this.sequencer.addByUrlDialog().addByUrl(
remoteSearchDriver, inputValue );
+ } else {
+ // Else just use the remoteSearchDriver search
interface
+ remoteSearchDriver.createUI();
+ }
+ });
+ },
+ /**
+ * Handles url asset importing
+ * xxx should probably re factor into separate class
+ *
+ * Checks for commons ulr profile, future profiles could include
flickr, youtube etc.
+ * tries to ascertain content type by url and directly load the media
+ * @param {String} url to be imported to the sequence
+ */
+ proccessUrlRequest: function( url ){
+ // Check if its a local domain ( we can directly request the
"head" of the file to get its type )
+
+ // Check url type
+ var parsedUrl = mw.parseUri( url );
+ if( host == 'commons.wikimedia.org' ){
+ }
+ },
- },
/**
* Get the resource object from a provided asset
*/
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerConfig.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerConfig.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerConfig.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -21,8 +21,12 @@
"Sequencer.AddMediaImageDuration" : 2,
// Default image source width
- "Sequencer.AddMediaImageWidth" : 640,
+ "Sequencer.AddMediaImageWidth" : 640,
+ // If a asset can be directly added to the sequence by url
+ // ( if disabled only urls that are part addMedia can be added )
+ "Sequencer.AddAssetByUrl" : true,
+
// Default timeline clip timeline track height
"Sequencer.TimelineTrackHeight" : 100,
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -306,7 +306,7 @@
// get the smil element for the edit tool:
var smilClip = smil.$dom.find( '#' + $j( selectedClip
).data('smilId') );
var toolTarget = this.sequencer.getEditToolTarget();
- this.sequencer.getEditTools().drawClipEditTools( toolTarget,
smilClip );
+ this.sequencer.getTools().drawClipEditTools( toolTarget,
smilClip );
},
/**
@@ -453,7 +453,7 @@
},
/**
- * Handle multiple selections based on what clips was just "cliked"
+ * Handle multiple selections based on what clips was just selected
*/
handleMultiSelect: function( clickClip ){
var _this = this;
@@ -535,7 +535,7 @@
)
} else {
// A single clip is selected edit that clip
- _this.editClip( clickClip );
+ _this.editClip( clickClip );
}
// Register the edit tools update for undo
_this.sequencer.getActionsEdit().registerEdit();
@@ -593,8 +593,11 @@
.hide()
.buttonHover()
.click( function(){
+
_this.getTimelineContainer().find('.selectedClip').removeClass( 'selectedClip'
);
_this.editClip( $timelineClip )
$timelineClip.addClass( 'selectedClip' );
+ // Seek to the edit clip
+ _this.seekToStartOfClip( $timelineClip );
return false;
}),
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -92,7 +92,7 @@
// Close / empty the toolWindow
_this.sequencer.getEditToolTarget().html(
- _this.defaultText
+ _this.getDefaultText()
)
}
}
@@ -217,11 +217,13 @@
}
}
},
+ getDefaultText: function(){
+ return gM('mwe-sequencer-no_selected_resource');
+ },
getEditToolId: function( toolId, attributeName){
return 'editTool_' + toolId + '_' + attributeName;
- },
+ },
-
drawClipEditTools: function( $target, smilClip){
var toolId = '';
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-08-27 01:38:09 UTC (rev 71778)
+++
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -1,6 +1,6 @@
/**
* Stop-gap for php sequencer support does some transformations
-* to normal page views to support sequences edits
+* to page views to support sequence namespace
*
* Supports basic "sequencer" functionality as a javascript rewrite system.
*/
@@ -77,128 +77,128 @@
},
displayPlayerEmbed: function(){
var _this = this;
-
- // Check if the sequence has been flattened and is up to date:
- var request = {
- 'action': 'query',
- 'titles': _this.getSequenceFileKey( wgPageName ),
- 'prop': 'imageinfo|revisions',
- 'iiprop': 'url|metadata',
- 'iiurlwidth': '400',
- 'redirects' : true // automatically follow redirects
- };
- var $embedPlayer = $j('<div />');
- mw.getJSON( request, function( data ){
- if(!data.query || !data.query.pages ||
data.query.pages[-1]){
- // no flattened file found
- $embedPlayer.append(
- $j( '<div />').append(
-
gM('mwe-sequencer-not-published')
+ // load the embedPlayer module:
+ mw.load('EmbedPlayer', function(){
+ // Check if the sequence has been flattened and is up
to date:
+ var request = {
+ 'action': 'query',
+ 'titles': _this.getSequenceFileKey( wgPageName
),
+ 'prop': 'imageinfo|revisions',
+ 'iiprop': 'url|metadata',
+ 'iiurlwidth': '400',
+ 'redirects' : true // automatically follow
redirects
+ };
+ var $embedPlayer = $j('<div />');
+ mw.getJSON( request, function( data ){
+ if(!data.query || !data.query.pages ||
data.query.pages[-1]){
+ // no flattened file found
+ $embedPlayer.append(
+ $j( '<div />').append(
+
gM('mwe-sequencer-not-published')
+ )
+ .addClass( 'ui-state-highlight'
)
)
- .addClass( 'ui-state-highlight' )
- )
- return ;
- }
- for( var pageId in data.query.pages) {
- var page = data.query.pages[ pageId ];
-
- // Check that the file has a later revision
than the
- // page. ( up to date sequences always are
later than
- // the revision of the page saved ).
- if( page.revisions && page.revisions[0] ){
- if( page.revisions[0].revid <
wgCurRevisionId ){
- // flattened file out of date
- $embedPlayer.append(
- $j('<div />').append(
-
gM('mwe-sequencer-published-out-of-date')
- ).addClass(
'ui-state-highlight' )
- )
+ return ;
+ }
+ for( var pageId in data.query.pages) {
+ var page = data.query.pages[ pageId ];
+
+ // Check that the file has a later
revision than the
+ // page. ( up to date sequences always
are later than
+ // the revision of the page saved ).
+ if( page.revisions && page.revisions[0]
){
+ if( page.revisions[0].revid <
wgCurRevisionId ){
+ // flattened file out
of date
+ $embedPlayer.append(
+ $j('<div
/>').append(
+
gM('mwe-sequencer-published-out-of-date')
+ ).addClass(
'ui-state-highlight' )
+ )
+ }
}
- }
- if( page.imageinfo && page.imageinfo[0] ){
- var imageinfo = page.imageinfo[0];
- var duration = 0;
- for( var i=0;i<
imageinfo.metadata.length; i++){
- if( imageinfo.metadata[i].name
== 'length' ){
- duration = Math.round(
-
imageinfo.metadata[i].value * 1000
- ) / 1000;
+ if( page.imageinfo && page.imageinfo[0]
){
+ var imageinfo =
page.imageinfo[0];
+ var duration = 0;
+ for( var i=0;i<
imageinfo.metadata.length; i++){
+ if(
imageinfo.metadata[i].name == 'length' ){
+ duration =
Math.round(
+
imageinfo.metadata[i].value * 1000
+ ) / 1000;
+ }
}
+ // Append a player to the
embedPlayer target
+ // -- special title key
sequence name bound
+ $embedPlayer.append(
+ $j('<video />')
+ .attr({
+ 'id' :
'embedSequencePlayer',
+ 'poster' :
imageinfo.thumburl,
+ 'durationHint'
: duration,
+ 'apiTitleKey' :
page.title.replace('File:',''),
+ })
+ .addClass('kskin')
+ .css({
+ 'width':
imageinfo.thumbwidth,
+ 'height' :
imageinfo.thumbheight
+ })
+ .append(
+ // ogg source
+ $j('<source />')
+ .attr({
+ 'type':
'video/ogg',
+ 'src' :
imageinfo.url
+ })
+ )
+ )
}
- // Append a player to the embedPlayer
target
- // -- special title key sequence name
bound
- $embedPlayer.append(
- $j('<video />')
- .attr({
- 'poster' :
imageinfo.thumburl,
- 'durationHint' :
duration,
- 'apiTitleKey' :
page.title.replace('File:',''),
- })
- .addClass('kskin')
- .css({
- 'width':
imageinfo.thumbwidth,
- 'height' :
imageinfo.thumbheight
- })
- .append(
- // ogg source
- $j('<source />')
- .attr({
- 'type':
'video/ogg',
- 'src' :
imageinfo.url
- })
- )
+ }
+ // Display embed sequence
+ $j( _this.target ).empty().append(
+ $j('<div />')
+ .addClass( 'sequencer-player')
+ .css( {
+ 'float' : 'left',
+ 'width' : imageinfo.thumbwidth
+ })
+ .append(
+ $embedPlayer
)
- }
- }
- // Display embed sequence
- $j( _this.target ).empty().append(
- $j('<div />')
- .addClass( 'sequencer-player')
- .css( {
- 'float' : 'left',
- 'width' : imageinfo.thumbwidth
- })
- .append(
- $embedPlayer
- )
- ,
-
- // Embed player
- $j('<div />')
- .addClass( 'sequencer-embed-helper')
- .css({
- 'margin-left': '430px'
- })
-
- // Text embed code
- .append(
- $j('<h3 />')
- .text(
gM('mwe-sequencer-embed-sequence') )
,
- $j('<span />' )
- .text(
gM('mwe-sequencer-embed-sequence-desc') )
- ,
- $j('<br />'),
- $j('<textarea />')
+
+ // Embed player
+ $j('<div />')
+ .addClass( 'sequencer-embed-helper')
.css({
- 'width' : '100%',
- 'height' : '200px'
- }).focus(function(){
- $j(this).select();
+ 'margin-left': '430px'
})
+
+ // Text embed code
.append(
- _this.getSequenceEmbedCode()
- )
- ),
-
- // Add a clear both to give content body height
- $j('<div />').css({'clear': 'both'})
- )
-
- }); // load json player data
-
- mw.load('EmbedPlayer', function(){
- $j( _this.target ).find('video').embedPlayer();
+ $j('<h3 />')
+ .text(
gM('mwe-sequencer-embed-sequence') )
+ ,
+ $j('<span />' )
+ .text(
gM('mwe-sequencer-embed-sequence-desc') )
+ ,
+ $j('<br />'),
+ $j('<textarea />')
+ .css({
+ 'width' : '100%',
+ 'height' : '200px'
+ }).focus(function(){
+ $j(this).select();
+ })
+ .append(
+
_this.getSequenceEmbedCode()
+ )
+ ),
+
+ // Add a clear both to give content
body height
+ $j('<div />').css({'clear': 'both'})
+ )
+ // Rewrite the player
+ $j('#embedSequencePlayer').embedPlayer();
+ }); // load json player data
})
},
getSequenceEmbedCode: function(){
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
2010-08-27 01:38:09 UTC (rev 71778)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
2010-08-27 04:55:27 UTC (rev 71779)
@@ -386,12 +386,12 @@
var assetId = this.smil.getPageDomId( smilElement );
// Make sure the image is in the dom ( load it )
this.loadElement( smilElement );
- mw.log("loadImageCallback:: drwa img: " + assetId + $j( '#' +
assetId ).length );
+ mw.log( "loadImageCallback:: drwa img: " + assetId + $j( '#' +
assetId ).length );
// If we already have naturalHeight no need for loading
callback
- if( $j( '#' + assetId).get(0).naturalHeight ){
+ if( $j( '#' + assetId ).get(0).naturalHeight ){
callback();
- }else {
- $j( '#' + assetId).load( callback );
+ } else {
+ $j( '#' + assetId ).load( callback );
}
},
@@ -437,8 +437,12 @@
}
}
- // Issue the seek
- vid.currentTime = seekTime;
+ // Issue the seek if the vid still exists
+ try{
+ vid.currentTime = seekTime;
+ } catch ( e ){
+ mw.log( 'Error: in SmilBuffer could not set
currentTime' );
+ }
}
// Read the video state:
http://www.w3.org/TR/html5/video.html#dom-media-have_nothing
Modified: branches/MwEmbedStandAlone/mwEmbed.js
===================================================================
--- branches/MwEmbedStandAlone/mwEmbed.js 2010-08-27 01:38:09 UTC (rev
71778)
+++ branches/MwEmbedStandAlone/mwEmbed.js 2010-08-27 04:55:27 UTC (rev
71779)
@@ -1158,7 +1158,7 @@
* undefined
*/
mw.isset = function( objectPath ) {
- if ( !objectPath ) {
+ if ( !objectPath || typeof objectPath != 'string') {
return false;
}
var pathSet = objectPath.split( '.' );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs