Index: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | * Adds a resource by its Title |
28 | 28 | * |
29 | 29 | * @param {String} title Title of the resource to be added |
30 | | - * @param {Function} callback Function called once title resource aquired |
| 30 | + * @param {Function} callback Function called once title resource acquired |
31 | 31 | */ |
32 | 32 | addByTitle:function( title , callback, redirect_count ) { |
33 | 33 | |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -1679,7 +1679,7 @@ |
1680 | 1680 | * @param {Function} callback Function to be called once playback-system has been inherited |
1681 | 1681 | */ |
1682 | 1682 | inheritEmbedPlayer: function( callback ) { |
1683 | | - mw.log( "inheritEmbedPlayer:duration is: " + this.getDuration() + ' p: ' + this.id); |
| 1683 | + mw.log( "inheritEmbedPlayer:duration is: " + this.getDuration() + ' p: ' + this.id ); |
1684 | 1684 | |
1685 | 1685 | // Clear out any non-base embedObj methods: |
1686 | 1686 | if ( this.instanceOf ) { |
Index: branches/MwEmbedStandAlone/mwEmbed.js |
— | — | @@ -1115,11 +1115,12 @@ |
1116 | 1116 | * Add a (temporary) dialog window: |
1117 | 1117 | * @param {String} title Title string for the dialog |
1118 | 1118 | * @param {String} dialogHtml String to be inserted in msg box |
1119 | | - * @param {Mixed} buttons A button object for the dialog |
1120 | | - * Can be 'ok' for oky button. |
| 1119 | + * @param {Mixed} buttonOption A button object for the dialog |
| 1120 | + * Can be a string for the close buton |
1121 | 1121 | */ |
1122 | 1122 | mw.addDialog = function ( title, dialogHtml, buttons ) { |
1123 | 1123 | $j( '#mwTempLoaderDialog' ).remove(); |
| 1124 | + |
1124 | 1125 | // Append the style free loader ontop: |
1125 | 1126 | $j( 'body' ).append( |
1126 | 1127 | $j('<div />') |
— | — | @@ -1130,13 +1131,16 @@ |
1131 | 1132 | .css('display', 'none') |
1132 | 1133 | .html( dialogHtml ) |
1133 | 1134 | ); |
| 1135 | + |
1134 | 1136 | // Special buttons == ok gives empty give a single "oky" -> "close" |
1135 | | - if ( buttons == 'ok' ) { |
| 1137 | + if ( typeof buttons == 'string' ) { |
| 1138 | + var buttonMsg = buttons; |
1136 | 1139 | buttons = { }; |
1137 | | - buttons[ gM( 'mwe-ok' ) ] = function() { |
1138 | | - $j( '#mwTempLoaderDialog' ).close(); |
| 1140 | + buttons[ buttonMsg ] = function() { |
| 1141 | + $j( '#mwTempLoaderDialog' ).dialog( 'close' ); |
1139 | 1142 | } |
1140 | | - } |
| 1143 | + } |
| 1144 | + |
1141 | 1145 | // Load the dialog classes |
1142 | 1146 | mw.load([ |
1143 | 1147 | [ |
— | — | @@ -2279,17 +2283,18 @@ |
2280 | 2284 | * |
2281 | 2285 | */ |
2282 | 2286 | mw.runTriggersCallback = function( targetObject, triggerName, callback ){ |
2283 | | - // on trigger calls with many binded functions. |
2284 | | - if( ! $j( targetObject ).data( 'events' )[ triggerName ] ) { |
| 2287 | + // If events are not present directly run callback |
| 2288 | + if( ! $j( targetObject ).data( 'events' ) || |
| 2289 | + ! $j( targetObject ).data( 'events' )[ triggerName ] ) { |
2285 | 2290 | callback(); |
2286 | | - } |
2287 | | - |
| 2291 | + } |
2288 | 2292 | var callbackCount = $j( targetObject ).data( 'events' )[ triggerName ].length; |
2289 | 2293 | if( !callbackCount ){ |
2290 | 2294 | // No events run the callback directly |
2291 | 2295 | callback(); |
2292 | 2296 | return ; |
2293 | | - } |
| 2297 | + } |
| 2298 | + |
2294 | 2299 | mw.log(" runTriggersCallback:: " + callbackCount ); |
2295 | 2300 | var callInx = 0; |
2296 | 2301 | $j( targetObject ).trigger( 'checkPlayerSourcesEvent', function() { |
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | window.console.log( 'mwEmbed:remote:' + mwRemoteVersion ); |
14 | 14 | } |
15 | 15 | |
| 16 | + |
16 | 17 | // Setup up request Params: |
17 | 18 | var reqParts = urlparts[1].substring( 1 ).split( '&' ); |
18 | 19 | var mwReqParam = { }; |
— | — | @@ -26,6 +27,7 @@ |
27 | 28 | if( mwReqParam['debug'] ) { |
28 | 29 | mwUseScriptLoader = false; |
29 | 30 | } |
| 31 | +mwUseScriptLoader = true; |
30 | 32 | |
31 | 33 | // Setup up some globals to wrap mwEmbed mw.ready and mw.setConfig functions |
32 | 34 | |
— | — | @@ -220,9 +222,10 @@ |
221 | 223 | * ( front-loaded to avoid extra requests ) |
222 | 224 | */ |
223 | 225 | function mwLoadPlayer( callback ){ |
224 | | - // the jsPlayerRequest includes both javascript and style sheets for the embedPlayer |
| 226 | + |
| 227 | + // The jsPlayerRequest includes both javascript and style sheets for the embedPlayer |
225 | 228 | var jsPlayerRequest = [ |
226 | | - |
| 229 | + 'mw.style.mwCommon', |
227 | 230 | 'mw.EmbedPlayer', |
228 | 231 | 'mw.style.EmbedPlayer', |
229 | 232 | '$j.ui', |
— | — | @@ -231,8 +234,10 @@ |
232 | 235 | '$j.cookie', |
233 | 236 | 'JSON', |
234 | 237 | '$j.ui.slider', |
235 | | - 'kskinConfig', |
236 | | - 'mw.style.kskin', |
| 238 | + |
| 239 | + 'mw.PlayerSkinKskin', |
| 240 | + 'mw.style.PlayerSkinKskin', |
| 241 | + |
237 | 242 | '$j.fn.menu', |
238 | 243 | 'mw.style.jquerymenu', |
239 | 244 | |
— | — | @@ -247,11 +252,11 @@ |
248 | 253 | // Quick sniff use java if IE and native if firefox |
249 | 254 | // ( other browsers will run detect and get on-demand ) |
250 | 255 | if (navigator.userAgent.indexOf("MSIE") != -1){ |
251 | | - jsPlayerRequest.push( 'mw.EmbedPlayeJava' ); |
| 256 | + jsPlayerRequest.push( 'mw.EmbedPlayerJava' ); |
252 | 257 | } |
253 | 258 | |
254 | 259 | if ( navigator.userAgent && navigator.userAgent.indexOf("Firefox") != -1 ){ |
255 | | - jsPlayerRequest.push( 'mw.EmbedPlayeNative' ); |
| 260 | + jsPlayerRequest.push( 'mw.EmbedPlayerNative' ); |
256 | 261 | } |
257 | 262 | |
258 | 263 | loadMwEmbed( jsPlayerRequest, function() { |
— | — | @@ -268,15 +273,15 @@ |
269 | 274 | // Don't process empty vids |
270 | 275 | if ( !vidId ){ |
271 | 276 | return ; |
272 | | - } |
273 | | - |
| 277 | + } |
274 | 278 | |
275 | 279 | tag_type = 'video'; |
276 | 280 | |
277 | 281 | // Check type: |
278 | 282 | var pwidth = $j( '#' + vidId ).width(); |
279 | | - var $pimg = $j( '#' + vidId + ' img:first' ); |
280 | | - if( $pimg.attr('src') && $pimg.attr('src').split('/').pop() == 'play.png'){ |
| 283 | + var $pimg = $j( '#' + vidId + ' img:first' ); |
| 284 | + var imgSring = $pimg.attr('src').split('/').pop(); |
| 285 | + if( $pimg.attr('src') && imgSring == 'play.png' || imgSring == 'fileicon-ogg.png' ){ |
281 | 286 | tag_type = 'audio'; |
282 | 287 | poster_attr = ''; |
283 | 288 | pheight = 0; |
— | — | @@ -313,6 +318,15 @@ |
314 | 319 | // Check if file is from commons and therefore should explicitly set apiProvider to commons: |
315 | 320 | var apiProviderAttr = ( src.indexOf( 'wikipedia\/commons' ) != -1 )?'apiProvider="commons" ': ''; |
316 | 321 | |
| 322 | + // If in a gallery box we will be displaying the video larger in a lightbox |
| 323 | + if( $j( '#' + vidId ).parents( '.gallerybox' ).length ){ |
| 324 | + // Update the width to 400 and keep scale |
| 325 | + pwidth = 400; |
| 326 | + if( pheight != 0 ) { |
| 327 | + pheight = pwidth * ( $j( '#' + vidId ).height() / $j( '#' + vidId ).width() ); |
| 328 | + } |
| 329 | + } |
| 330 | + |
317 | 331 | if ( src ) { |
318 | 332 | var html_out = ''; |
319 | 333 | |
— | — | @@ -336,19 +350,73 @@ |
337 | 351 | 'style="width:' + pwidth + 'px;height:' + pheight + 'px;">' + |
338 | 352 | '</video>'; |
339 | 353 | } |
340 | | - // Set the video tag inner html and update the height |
341 | | - $j( '#' + vidId ).after( html_out ).remove(); |
| 354 | + |
| 355 | + |
| 356 | + // If the video is part of a "gallery box" use light-box linker instead |
| 357 | + if( $j( '#' + vidId ).parents( '.gallerybox' ).length ){ |
| 358 | + $j( '#' + vidId ).after( |
| 359 | + $j( '<div />') |
| 360 | + .css( { |
| 361 | + 'width' : $pimg.attr('width' ), |
| 362 | + 'height' :$pimg.attr( 'height' ), |
| 363 | + 'position' : 'relative' |
| 364 | + }) |
| 365 | + .addClass( 'k-player' ) |
| 366 | + .append( |
| 367 | + // The poster image |
| 368 | + $j( '<img />' ) |
| 369 | + .css( { |
| 370 | + 'width' : '100%', |
| 371 | + 'height' : '100%' |
| 372 | + }) |
| 373 | + .attr( 'src', $pimg.attr('src') ), |
| 374 | + |
| 375 | + // A play button: |
| 376 | + $j( '<div />' ) |
| 377 | + .css( { |
| 378 | + 'position' : 'absolute', |
| 379 | + 'top' : ( parseInt( $pimg.attr( 'height' ) ) /2 ) -25, |
| 380 | + 'left' : ( parseInt( $pimg.attr( 'height' ) ) /2 ) - 45 |
| 381 | + }) |
| 382 | + .addClass( 'play-btn-large' ) |
| 383 | + .buttonHover() |
| 384 | + .click( function(){ |
| 385 | + var dialogHeight = ( $j( this ).data( 'playerHeight') == 0 )? 175 : |
| 386 | + ( $j( this ).data( 'playerHeight') - 75 ); |
| 387 | + mw.addDialog( |
| 388 | + decodeURIComponent( $j( this ).data( 'title' ).replace(/_/g, ' ') ), |
| 389 | + $j( this ).data( 'embedCode' ), |
| 390 | + gM( 'mwe-ok' ) |
| 391 | + ) |
| 392 | + // Dialog size setup is a bit strange: |
| 393 | + .css( { |
| 394 | + 'height' : dialogHeight + 'px' |
| 395 | + }) |
| 396 | + .parent().css( { |
| 397 | + // we hard code the default resolution to 400 above |
| 398 | + 'width' : '435px', |
| 399 | + } ) |
| 400 | + // Update the embed code to use the mwEmbed player: |
| 401 | + $j.embedPlayers(); |
| 402 | + }) |
| 403 | + .data( 'embedCode', html_out ) |
| 404 | + .data( 'title' , apiTitleKey ) |
| 405 | + .data( 'playerHeight', pheight ) |
| 406 | + ) |
| 407 | + ).remove(); |
| 408 | + |
| 409 | + } else { |
| 410 | + // Set the video tag inner html remove extra player |
| 411 | + $j( '#' + vidId ).after( html_out ).remove(); |
| 412 | + $j( '#mwe_' + vidId ).embedPlayer(); |
| 413 | + } |
342 | 414 | |
343 | | - // Do the actual rewrite |
344 | | - //mw.log("rewrite: "+ vidId ); |
345 | | - $j( '#mwe_' + vidId ).embedPlayer(); |
346 | 415 | // Issue an async request to rewrite the next clip |
347 | 416 | if ( vidIdList.length != 0 ) { |
348 | | - setTimeout( function() { |
| 417 | + setTimeout( function() { |
349 | 418 | procVidId( vidIdList.pop() ) |
350 | 419 | }, 1 ); |
351 | 420 | } |
352 | | - |
353 | 421 | } |
354 | 422 | }; |
355 | 423 | // Process current top item in vidIdList |