Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Staging newResourceLoader work ( non working state )

and 
Merge branch 'develop' of git@github.com:kaltura/mwEmbed.git into
newResourceLoader

Conflicts:
	modules/EmbedPlayer/mw.EmbedPlayer.js
	modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
  • Loading branch information...
commit 4dbee7abdfce717de40b04cecfa43df8870c8496 2 parents 7ec2b02 + e546a05
@mdale mdale authored
View
1  includes/MwEmbedAutoLoader.php
@@ -24,6 +24,7 @@
'CSSJanus' => 'includes/libs/CSSJanus.php',
'CSSMin' => 'includes/libs/CSSMin.php',
'JavaScriptDistiller' => 'includes/libs/JavaScriptDistiller.php',
+ 'JavaScriptMinifier' => 'includes/libs/JavaScriptMinifier.php',
# MwEmbed files ( that get autoloaded ):
'MwEmbedResourceLoaderContext' => 'includes/MwEmbedResourceLoaderContext.php',
View
2  includes/MwEmbedMediaWikiGlobalFunctions.php
@@ -280,7 +280,7 @@ function mweSaveFileToCache ( $key, $data){
$filePath = mweGetFilePathFromKey( $key );
$path = dirname( $filePath );
if( !is_dir($path ) ){
- $ok = mkdir( $path, 0777, true ); // PHP5 <3
+ $ok = @mkdir( $path, 0777, true ); // PHP5 <3
if( !$ok ){
return false;
}
View
9 includes/MwEmbedResourceLoaderFileModule.php
@@ -33,7 +33,7 @@ public function getRemotePath($file){
return $wgServer . $path;
}
-/**
+ /**
* Gets all styles for a given context concatenated together.
*
* @param $context ResourceLoaderContext: Context in which to generate styles
@@ -42,11 +42,18 @@ public function getRemotePath($file){
public function getStyles( ResourceLoaderContext $context ) {
// Merge general styles and skin specific styles, retaining media type collation
$styles = $this->readStyleFiles( $this->styles, $this->getFlip( $context ) );
+
+ print "SKIN STYPES:::\n";
+ print_r( $this->styles );
+
$skinStyles = $this->readStyleFiles(
self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ),
$this->getFlip( $context )
);
+
+ print_r ( $skinStyles );
+
foreach ( $skinStyles as $media => $style ) {
if ( isset( $styles[$media] ) ) {
$styles[$media] .= $style;
View
12 includes/MwEmbedWebStartSetup.php
@@ -71,8 +71,9 @@
require_once( "$IP/includes/DefaultSettings.php" );
-if ( !defined('MW_CONFIG_FILE') )
+if ( !defined('MW_CONFIG_FILE') ){
define('MW_CONFIG_FILE', "$IP/LocalSettings.php");
+}
# LocalSettings.php is the per site customization file. If it does not exist
# error out
@@ -85,6 +86,15 @@
# Include utility files:
require_once( "$IP/includes/Hooks.php");
+/**
+ * Legay mappings for mwEmbed config
+ */
+if( isset( $wgEnableScriptDebug ) ){
+ $wgResourceLoaderDebug = $wgEnableScriptDebug;
+}
+
+
+
# Create the wgRequest global:
$wgRequest = new WebRequest;
View
23 includes/resourceloader/ResourceLoader.php
@@ -157,10 +157,11 @@ protected function filter( $filter, $data ) {
try {
switch ( $filter ) {
case 'minify-js':
- $result = JavaScriptMinifier::minify( $data,
+ $result = $data;
+ /*$result = JavaScriptMinifier::minify( $data,
$wgResourceLoaderMinifierStatementsOnOwnLine,
$wgResourceLoaderMinifierMaxLineLength
- );
+ );*/
$result .= "\n\n/* cache key: $key */\n";
break;
case 'minify-css':
@@ -190,6 +191,7 @@ public function __construct() {
global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript, $wgEnableJavaScriptTest;
wfProfileIn( __METHOD__ );
+
// Add 'local' source first
$this->addSource( 'local', array( 'loadScript' => $wgLoadScript, 'apiScript' => wfScript( 'api' ) ) );
@@ -206,6 +208,7 @@ public function __construct() {
$this->registerTestModules();
}
+
wfProfileOut( __METHOD__ );
}
@@ -213,7 +216,7 @@ public function __construct() {
* Registers a module with the ResourceLoader system.
*
* @param $name Mixed: Name of module as a string or List of name/object pairs as an array
- * @param $info Module info array. For backwards compatibility with 1.17alpha,
+ * @param $info array Module info array. For backwards compatibility with 1.17alpha,
* this may also be a ResourceLoaderModule object. Optional when using
* multiple-registration calling style.
* @throws MWException: If a duplicate module registration is attempted
@@ -224,6 +227,7 @@ public function __construct() {
*/
public function register( $name, $info = null ) {
wfProfileIn( __METHOD__ );
+
// Allow multiple modules to be registered in one call
$registrations = is_array( $name ) ? $name : array( $name => $info );
foreach ( $registrations as $name => $info ) {
@@ -351,6 +355,7 @@ public function getModuleNames() {
* @return Array
*/
public function getTestModuleNames( $framework = 'all' ) {
+ /// @TODO: api siteinfo prop testmodulenames modulenames
if ( $framework == 'all' ) {
return $this->testModuleNames;
} elseif ( isset( $this->testModuleNames[$framework] ) && is_array( $this->testModuleNames[$framework] ) ) {
@@ -744,6 +749,9 @@ public function makeModuleResponse( ResourceLoaderContext $context,
}
}
}
+ print "on $name\n";
+ print_r( $styles );
+
$out .= self::makeLoaderImplementScript( $name, $scripts, $styles,
new XmlJsCode( $messagesBlob ) );
break;
@@ -813,6 +821,11 @@ public static function makeLoaderImplementScript( $name, $scripts, $styles, $mes
array(
$name,
$scripts,
+ // Force objects. mw.loader.implement requires them to be javascript objects.
+ // Although these variables are associative arrays, which become javascript
+ // objects through json_encode. In many cases they will be empty arrays, and
+ // PHP/json_encode() consider empty arrays to be numerical arrays and
+ // output javascript "[]" instead of "{}". This fixes that.
(object)$styles,
(object)$messages
) );
@@ -898,7 +911,7 @@ public static function makeLoaderStateScript( $name, $state = null ) {
public static function makeCustomLoaderScript( $name, $version, $dependencies, $group, $source, $script ) {
$script = str_replace( "\n", "\n\t", trim( $script ) );
return Xml::encodeJsCall(
- "( function( name, version, dependencies, group, source ) {\n\t$script\n} )",
+ "( function ( name, version, dependencies, group, source ) {\n\t$script\n} )",
array( $name, $version, $dependencies, $group, $source ) );
}
@@ -971,7 +984,7 @@ public static function makeLoaderSourcesScript( $id, $properties = null ) {
* @return string
*/
public static function makeLoaderConditionalScript( $script ) {
- return "if(window.mw){\n".trim( $script )."\n}";
+ return "if(window.mw){\n" . trim( $script ) . "\n}";
}
/**
View
12 modules/EmbedPlayer/resources/mw.EmbedPlayer.js
@@ -178,6 +178,7 @@ mw.mergeConfig( 'EmbedPlayer.SourceAttributes', [
] );
+
/**
* Base embedPlayer object
*
@@ -264,9 +265,10 @@ mw.EmbedPlayer.prototype = {
*/
init: function( element ) {
var _this = this;
- mw.log('EmbedPlayer: initEmbedPlayer: ' + $(element).attr( 'id' ) );
+ mw.log('EmbedPlayer: initEmbedPlayer: ' + $(element).width() );
var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes' );
+
// Store the rewrite element tag type
this.rewriteElementTagName = element.tagName.toLowerCase();
@@ -837,17 +839,17 @@ mw.EmbedPlayer.prototype = {
* Get the player height
*/
getHeight: function() {
- return this.height;
+ return $( this ).height();
},
/**
* Get the player width
*/
getWidth: function(){
- if ( $.browser.mozilla && parseFloat($.browser.version) < 2 ) {
- return ( $(this).parent().parent().width() );
+ if ( $.browser.mozilla && parseFloat( $.browser.version ) < 2 ) {
+ return ( $( this ).parent().parent().width() );
}
- return this.width;
+ return $( this ).width();
},
/**
View
4 modules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
@@ -356,6 +356,10 @@ mw.PlayerControlBuilder.prototype = {
*/
getPlayButtonPosition: function( size ) {
var _this = this;
+ // Set the width to screen's width if in fullscreen
+ if( this.inFullScreen ) {
+ size.width = screen.width;
+ }
// Set the offset depending if controls are hidden or displayed:
var pheight = this.getComponentHeight( 'playButtonLarge' );
var topCompoentOffset = ( this.isOverlayControls() ) ? pheight : pheight / 2;
View
2  modules/EmbedPlayer/tests/Player_Audio.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- <script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed&&debug=true"></script> -->
- <script type="text/javascript" src="../../../mwEmbedLoader.php"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
<title>Audio Player sample</title>
</head>
<body>
View
2  modules/EmbedPlayer/tests/Player_DynamicEmbed.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
</head>
<body>
View
2  modules/EmbedPlayer/tests/Player_IncludeJQuery.html
@@ -5,7 +5,7 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7/jquery-ui.min.js" type="text/javascript"></script>
-<script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true"></script>
+<script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#test').text('jQuery $ supported' );
View
2  modules/EmbedPlayer/tests/Player_Native_Bindings.html
@@ -40,7 +40,7 @@
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
-<script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed&&debug=true"></script>
+<script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
<script type="text/javascript">
/*
Media Event Bindings
View
2  modules/EmbedPlayer/tests/Player_Seek.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
</head>
<body>
<h2>mwEmbed / archive.org server side seek</h2>
View
2  modules/EmbedPlayer/tests/Player_ServerSeek.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
</head>
<body>
<h2>mwEmbed / archive.org server side seek</h2>
View
2  modules/EmbedPlayer/tests/Player_ServerSideSeek.html
@@ -1,6 +1,6 @@
<html>
<head>
- <script type="text/javascript" src="http://html5.kaltura.org/js"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
</head>
<body>
<h2>mwEmbed / archive.org server side seek</h2>
View
2  modules/EmbedPlayer/tests/Player_Sources.html
@@ -3,7 +3,7 @@
<head>
<title>Player sources</title>
- <script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
<!-- <script type="text/javascript" src="http://html5.kaltura.org/js"></script>-->
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
View
2  modules/EmbedPlayer/tests/Player_Themable.html
@@ -5,7 +5,7 @@
<title> Sample Themed Player </title>
Pre-loading demo ( stuff ) likely needed for video display
<!-- <script type="text/javascript" src="../../../ResourceLoader.php?debug=true&class=mwEmbed"></script> -->
- <script type="text/javascript" src="../../../ResourceLoader.php?class=window.jQuery,mwEmbed&&debug=true"></script>
+ <script type="text/javascript" src="../../../mwEmbedStartup.php"></script>
</head>
<script type="text/javascript">
View
6 modules/KalturaSupport/mw.PlaylistHandlerKaltura.js 100755 → 100644
@@ -309,15 +309,19 @@ mw.PlaylistHandlerKaltura.prototype = {
$( embedPlayer).unbind( bindName ).bind( bindName, function(){
mw.log( 'mw.PlaylistHandlerKaltura:: onChangeMediaDone' );
_this.loadingEntry = false;
+ // Sync player size
+ embedPlayer.bindHelper( 'loadeddata', function() {
+ embedPlayer.controlBuilder.syncPlayerSize();
+ });
embedPlayer.play();
if( callback ){
callback();
}
});
mw.log("PlaylistHandlerKaltura::playClip::changeMedia entryId: " + this.getClip( clipIndex ).id);
-
// Use internal changeMedia call to issue all relevant events
embedPlayer.sendNotification( "changeMedia", { 'entryId' : this.getClip( clipIndex ).id } );
+
// Update the playlist data selectedIndex
embedPlayer.kalturaPlaylistData.selectedIndex = clipIndex;
},
View
1  modules/Playlist/mw.Playlist.js
@@ -488,6 +488,7 @@ mw.Playlist.prototype = {
mw.log("Error: Playlist:: playClip called with null embedPlayer ");
return ;
}
+
// trigger a playlist_playClip event:
embedPlayer.triggerHelper( 'Playlist_PlayClip', [ clipIndex, !!autoContinue ]);
View
33 mwEmbedLoader.php
@@ -1,33 +0,0 @@
-<?php
-/**
-* Kaltura entry point to resource loader framework
-*/
-// Set the request variables:
-$_GET['modules'] = 'startup';
-$_GET['only'] = 'scripts';
-
-// NOTE this won't work so well with symbolic links
-$loaderPath = 'load.php';
-if( is_file( $loaderPath ) ){
-chdir( dirname( $loaderPath ) );
- include_once( $loaderPath );
-} else {
- print "if( console && console.log ){ console.log( 'Error can't find load.php' ) }";
-}
-
-// Bootstrap some js code to make the "loader" work in stand alone mode
-// Note this has to be wrapped in a document.write to run after other document.writes
-$pageStartupScript = Html::inlineScript(
- ResourceLoader::makeLoaderConditionalScript(
- Xml::encodeJsCall( 'mw.loader.go', array() )
- )
-);
-echo Xml::encodeJsCall( 'document.write', array( $pageStartupScript ) );
-
-// Load the core mw.MwEmbedSupport library
-$pageMwEmbedScript = Html::inlineScript(
- ResourceLoader::makeLoaderConditionalScript(
- Xml::encodeJsCall( 'mw.loader.load', array( 'mw.MwEmbedSupport' ) )
- )
-);
-echo Xml::encodeJsCall( 'document.write', array( $pageMwEmbedScript ) );
View
9 resources/mediawiki/mediawiki.js
@@ -247,7 +247,7 @@ var mw = ( function ( $, undefined ) {
* Dummy function which in debug mode can be replaced with a function that
* emulates console.log in console-less environments.
*/
- log: function() { },
+ log: function( msg ) { console.log( msg ); },
/**
* @var constructor Make the Map constructor publicly available.
@@ -750,6 +750,7 @@ var mw = ( function ( $, undefined ) {
} ) );
}
} else if ( typeof style === 'string' ) {
+ debugger;
addInlineCSS( style );
}
}
@@ -759,7 +760,7 @@ var mw = ( function ( $, undefined ) {
mw.messages.set( registry[module].messages );
}
// Execute script
- try {
+ //try {
script = registry[module].script;
markModuleReady = function() {
registry[module].state = 'ready';
@@ -789,7 +790,7 @@ var mw = ( function ( $, undefined ) {
script();
markModuleReady();
}
- } catch ( e ) {
+ /*} catch ( e ) {
// This needs to NOT use mw.log because these errors are common in production mode
// and not in debug mode, such as when a symbol that should be global isn't exported
if ( window.console && typeof window.console.log === 'function' ) {
@@ -797,7 +798,7 @@ var mw = ( function ( $, undefined ) {
console.log( e );
}
registry[module].state = 'error';
- }
+ }*/
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.