r86417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86416‎ | r86417 | r86418 >
Date:17:51, 19 April 2011
Author:dale
Status:deferred
Tags:
Comment:
basic working stand alone tests via mwEmbedLoader.php testing bootstrap support.
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/EmbedPlayer.loader.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Audio.html (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Seek.html (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_ServerSeek.html (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Sources.html (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Themable.html (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/tests/Player_Timed_Text.html (modified) (history)
  • /trunk/extensions/TimedMediaHandler/mwEmbedLoader.php (added) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/mwEmbedLoader.php
@@ -0,0 +1,26 @@
 2+<?php
 3+// This is a stub entry point to load.php This is need to support valid paths for the stand alone
 4+// mwEmbed module html test files.
 5+
 6+// This is useful for running stand alone test of mwEmbed components in the TimedMediaHandler
 7+// extension. ( ie MwEmbedModules/EmbedPlayer/tests/*.html files )
 8+
 9+$_GET['modules'] = 'startup';
 10+$_GET['only'] = 'scripts';
 11+
 12+// NOTE this won't work so well with symbolic links
 13+$loaderPath = dirname(__FILE__) . '/../../load.php';
 14+if( is_file( $loaderPath ) ){
 15+ chdir( dirname( $loaderPath ) );
 16+ include_once( $loaderPath );
 17+} else {
 18+ print "if( console && typeof console.log == 'function' ){ console.log('Error can't find load.php for stand alone tests' ) }";
 19+}
 20+// Bootstrap some js code to make the "loader" work in stand alone tests:
 21+// Note this has to be wrapped in a document.write to run after other document.writes
 22+$pageStartupScript = Html::inlineScript(
 23+ ResourceLoader::makeLoaderConditionalScript(
 24+ Xml::encodeJsCall( 'mw.loader.go', array() )
 25+ )
 26+);
 27+echo Xml::encodeJsCall( 'document.write', array( $pageStartupScript ) );
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/tests/Player_Timed_Text.html
@@ -4,7 +4,7 @@
55 <head>
66 <title>sample mv embed</title>
77
8 - <script type="text/javascript" src="../../../load.php?modules=startup&only=scripts"></script>
 8+ <script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
99
1010 <script type="text/javascript">
1111 $( document ).ready(function(){
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Audio.html
@@ -2,14 +2,12 @@
33 <html>
44 <head>
55 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6 - <!-- <script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed&&debug=true"></script> -->
7 -
8 - <script type="text/javascript" src="../../../load.php?modules=startup&only=scripts"></script>
 6+ <script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
97
108 <title>Audio Player sample</title>
119 </head>
1210 <body>
13 -<h3> Audio Player </h3>
14 -<audio class="kskin" src="http://upload.wikimedia.org/wikipedia/commons/4/4c/Faurepiece.ogg" data-durationhint="164"></audio>
 11+ <h3> Audio Player </h3>
 12+ <audio class="kskin" src="http://upload.wikimedia.org/wikipedia/commons/4/4c/Faurepiece.ogg" data-durationhint="164"></audio>
1513 </body>
1614 </html>
\ No newline at end of file
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Themable.html
@@ -8,7 +8,7 @@
99 <script type="text/javascript" src="../../../ResourceLoader.php?debug=true&class=mwEmbed"></script>
1010 -->
1111
12 - <script type="text/javascript" src="../../../load.php?modules=startup&only=scripts"></script>
 12+ <script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
1313 </head>
1414 <script type="text/javascript">
1515 mediaWiki.loader.go();
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Sources.html
@@ -3,7 +3,7 @@
44 <head>
55 <title>Player sources</title>
66
7 -<script type="text/javascript" src="../../../load.php?modules=startup&only=scripts"></script>
 7+<script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
88 </head>
99 <body>
1010
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_Seek.html
@@ -1,7 +1,7 @@
22 <html>
33 <head>
44
5 -<script type="text/javascript" src="../../../load.php?modules=startup&only=scripts"></script>
 5+<script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
66 </head>
77 <body>
88 <h2>mwEmbed / archive.org server side seek</h2>
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/tests/Player_ServerSeek.html
@@ -1,6 +1,6 @@
22 <html>
33 <head>
4 - <script type="text/javascript" src="../../../load.php?modules=startup&only=scripts"></script>
 4+ <script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
55 </head>
66 <body>
77 <h2>mwEmbed / archive.org server side seek</h2>
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/EmbedPlayer.loader.js
@@ -1,7 +1,6 @@
22 /**
33 * EmbedPlayer loader
44 */
5 -
65 ( function( mw, $ ) {
76
87 /**
@@ -11,20 +10,11 @@
1211 * work after the 'IntefacesReady' event
1312 */
1413 $( mw ).bind( 'SetupInterface', function( event, callback ){
15 - // Allow modules to extend EmbedPlayerRewritePlayerTags rewrites as well:
16 - var doModuleTagRewrites = function(){
17 - $( mw ).triggerQueueCallback( 'EmbedPlayerRewritePlayerTags', callback );
18 - };
19 -
2014 // Check if we have tags to rewrite:
2115 if( $( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).length ) {
22 - var rewriteElementCount = 0;
23 -
24 - // Rewrite the embedPlayer EmbedPlayer.RewriteTags :
 16+ // Rewrite the embedPlayer EmbedPlayer.RewriteTags and run callback once ready:
2517 $( mw.getConfig( 'EmbedPlayer.RewriteTags' ) )
26 - .embedPlayer( doModuleTagRewrites );
27 - } else {
28 - doModuleTagRewrites();
 18+ .embedPlayer( callback );
2919 }
3020 });
3121
@@ -40,6 +30,7 @@
4131 var playerSelect = this;
4232 }
4333 mw.log( 'jQuery.fn.embedPlayer :: ' + playerSelect );
 34+
4435 // Hide videonojs class
4536 $( '.videonojs' ).hide();
4637
@@ -62,7 +53,6 @@
6354 if( document.createElement('video').canPlayType && !$.browser.safari) {
6455 $.merge( dependencySet, ['mw.EmbedPlayerNative'] )
6556 }
66 -
6757
6858 // Check if the iFrame player api is enabled and we have a parent iframe url:
6959 // TODO we might want to move the iframe api to a separate module
@@ -108,6 +98,7 @@
10999 });
110100 // Remove any duplicates in the dependencySet:
111101 dependencySet = $.unique( dependencySet );
 102+
112103 // Do the request and process the playerElements with updated dependency set
113104 mediaWiki.loader.using( dependencySet, function(){
114105 mw.processEmbedPlayers( playerSelect, readyCallback );

Status & tagging log