bb68bbaf9e12cbc96de12cfd46b30cd1ee70bd97
2 * this file exposes some of the functionality of mwEmbed to wikis
3 * that are not yet running the new-upload branch
7 var urlparts
= getRemoteEmbedPath();
8 var mwEmbedHostPath
= urlparts
[0];
9 var reqAguments
= urlparts
[1];
11 // Check if mvEmbed is already loaded (ie the js2 branch is active) in which case do nothing
12 if( typeof MV_EMBED_VERSION
== 'undefined' ) {
13 doPageSpecificRewrite();
16 function doPageSpecificRewrite() {
18 if( wgAction
== 'edit' || wgAction
== 'submit' ) {
19 load_mv_embed( function() {
20 importScriptURI( mwEmbedHostPath
+ '/editPage.js' + reqAguments
);
24 // Firefogg integration
25 if( wgPageName
== "Special:Upload" ){
26 load_mv_embed( function() {
27 importScriptURI( mwEmbedHostPath
+ '/uploadPage.js' + reqAguments
);
33 var divs
= document
.getElementsByTagName( 'div' );
34 for( var i
= 0; i
< divs
.length
; i
++ ) {
35 if( divs
[i
].id
&& divs
[i
].id
.substring( 0, 11 ) == 'ogg_player_' ) {
36 vidIdList
.push( divs
[i
].getAttribute( "id" ) );
39 if( vidIdList
.length
> 0 ) {
40 load_mv_embed( function() {
41 mvJsLoader
.embedVideoCheck( function() {
42 // Do utilty rewrite of OggHandler content:
43 rewrite_for_OggHandler( vidIdList
);
48 function getRemoteEmbedPath() {
49 for( var i
= 0; i
< document
.getElementsByTagName( 'script' ).length
; i
++ ) {
50 var s
= document
.getElementsByTagName( 'script' )[i
];
51 if( s
.src
.indexOf( 'remoteMwEmbed.js' ) != -1 ) {
54 if( s
.src
.indexOf( '?' ) != -1) {
55 reqStr
= s
.src
.substr( s
.src
.indexOf( '?' ) );
56 scriptPath
= s
.src
.substr( 0, s
.src
.indexOf( '?' ) ).replace( 'remoteMwEmbed.js', '' );
58 scriptPath
= s
.src
.replace( 'remoteMwEmbed.js', '' )
60 // Use the external_media_wizard path:
61 return [scriptPath
, reqStr
];
66 function load_mv_embed( callback
) {
67 // Inject mv_embed if needed
68 if( typeof mvEmbed
== 'undefined' ) {
69 importScriptURI( mwEmbedHostPath
+ '/mwEmbed/mv_embed.js' + reqAguments
);
70 check_for_mv_embed( callback
);
72 check_for_mv_embed( callback
);
75 function check_for_mv_embed( callback
) {
76 if( typeof MV_EMBED_VERSION
== 'undefined' ) {
77 setTimeout( 'check_for_mv_embed( ' + callback
+ ');', 25 );