* js_log msgs striped from non-debug output (smaller size no console.log calls)
authorMichael Dale <dale@users.mediawiki.org>
Mon, 9 Nov 2009 00:19:06 +0000 (00:19 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Mon, 9 Nov 2009 00:19:06 +0000 (00:19 +0000)
* fixed height for captions for small videos / audio

includes/DefaultSettings.php
js2/mwEmbed/jsScriptLoader.php
js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/skins/ctrlBuilder.js
js2/remoteMwEmbed.js

index 7728a30..277b364 100644 (file)
@@ -1610,7 +1610,7 @@ $wgCacheEpoch = '20030516000000';
  * to ensure that client-side caches do not keep obsolete copies of global
  * styles.
  */
-$wgStyleVersion = '252';
+$wgStyleVersion = '253';
 
 
 # Server-side caching:
index a8e60cc..e195e20 100644 (file)
@@ -44,7 +44,7 @@ class jsScriptLoader {
 
        function doScriptLoader() {
                global  $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $IP,
-                               $wgEnableScriptMinify, $wgUseFileCache, $wgExtensionMessagesFiles;
+               $wgEnableScriptMinify, $wgUseFileCache, $wgExtensionMessagesFiles;
 
                //load the ExtensionMessagesFiles
                $wgExtensionMessagesFiles['mwEmbed'] = realpath( dirname( __FILE__ ) ) . '/php/languages/mwEmbed.i18n.php';
@@ -83,7 +83,7 @@ class jsScriptLoader {
                if ( $wgUseFileCache && !$this->debug ) {
                        $status = $this->sFileCache->saveToFileCache( $this->jsout );
                        if ( $status !== true )
-                               $this->error_msg .= $status;
+                       $this->error_msg .= $status;
                }
                // Check for an error msg
                if ( $this->error_msg != '' ) {
@@ -120,7 +120,7 @@ class jsScriptLoader {
                                if ( in_array( strtolower( $skin ), $skinNames ) ) {
                                        // If in debug mode, add a comment with wiki title and rev:
                                        if ( $this->debug )
-                                               $jsout .= "\n/**\n* GenerateUserJs: \n*/\n";
+                                       $jsout .= "\n/**\n* GenerateUserJs: \n*/\n";
                                        return $jsout . $sk->generateUserJs( $skin ) . "\n";
                                }
                        } else {
@@ -136,7 +136,7 @@ class jsScriptLoader {
                                if ( $a->getID() !== 0 ) {
                                        // If in debug mode, add a comment with wiki title and rev:
                                        if ( $this->debug )
-                                               $jsout .= "\n/**\n* WikiJSPage: " . htmlspecialchars( $title_block ) . " rev: " . $a->getID() . " \n*/\n";
+                                       $jsout .= "\n/**\n* WikiJSPage: " . htmlspecialchars( $title_block ) . " rev: " . $a->getID() . " \n*/\n";
 
                                        return $jsout . $a->getContent() . "\n";
                                }
@@ -156,7 +156,7 @@ class jsScriptLoader {
 
                        if ( trim( $file_name ) != '' ) {
                                if ( $this->debug )
-                                       $jsout .= "\n/**\n* File: " . htmlspecialchars( $file_name ) . "\n*/\n";
+                               $jsout .= "\n/**\n* File: " . htmlspecialchars( $file_name ) . "\n*/\n";
 
                                $jsFileStr = $this->doGetJsFile( $file_name ) . "\n";
                                if( $jsFileStr ){
@@ -167,7 +167,7 @@ class jsScriptLoader {
                                }
                        }
                }
-                               //if we did not return some js
+               //if we did not return some js
                $this->error_msg .= "\nUnknown error\n";
                return false;
        }
@@ -200,10 +200,10 @@ class jsScriptLoader {
                $m = array();
                if( preg_match(
                        '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
-                       $_SERVER['HTTP_ACCEPT_ENCODING'],
-                       $m ) ) {
+               $_SERVER['HTTP_ACCEPT_ENCODING'],
+               $m ) ) {
                        if( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) )
-                               return false;
+                       return false;
                        //no gzip support found
                        return true;
                }
@@ -259,9 +259,9 @@ class jsScriptLoader {
                                                                //make sure its a valid wikipage before doing processing
                                                                $t = Title::newFromDBkey( substr( $reqClass, 3) );
                                                                if( $t->exists()
-                                                                       && ( $t->getNamespace() == NS_MEDIAWIKI
-                                                                       || $t->getNamespace() == NS_USER ) ){
-                                                                               $doAddWT = true;
+                                                               && ( $t->getNamespace() == NS_MEDIAWIKI
+                                                               || $t->getNamespace() == NS_USER ) ){
+                                                                       $doAddWT = true;
                                                                }
                                                        }
                                                }
@@ -384,8 +384,8 @@ class jsScriptLoader {
        function doProcessJs( $str ){
                global $wgEnableScriptLocalization;
                // Strip out js_log debug lines. Not much luck with this regExp yet:
-               // if( !$this->debug )
-               //       $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
+               if( !$this->debug )
+                        $str = preg_replace('/\n\s*js_log\(([^\)]*\))*\s*[\;\n]/U', "\n", $str);
 
                // Do language swap by index:
                if ( $wgEnableScriptLocalization ){
@@ -422,16 +422,16 @@ class jsScriptLoader {
                                switch( $char ) {
                                        case '"':
                                                $inquote = !$inquote;
-                                       break;
+                                               break;
                                        case '}':
                                                if( ! $inquote){
                                                        $returnIndex['e'] =$i;
                                                        return $returnIndex;
                                                }
-                                       break;
+                                               break;
                                        case '\\':
                                                if ( $inquote ) $ignorenext = true;
-                                       break;
+                                               break;
                                }
                        }
                }
@@ -453,14 +453,14 @@ class jsScriptLoader {
 
                $inx = self::getLoadGmIndex( $str );
                if(!$inx)
-                       return '';
+               return '';
                return FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true);
        }
 
        static public function getMsgKeys(& $jmsg, $langCode = false){
                global $wgContLanguageCode;
                if(!$langCode)
-                       $langCode = $wgContLanguageCode;
+               $langCode = $wgContLanguageCode;
                //get the msg keys for the a json array
                foreach ( $jmsg as $msgKey => $default_en_value ) {
                        $jmsg[$msgKey] = wfMsgGetKey( $msgKey, true, $langCode, false );
@@ -514,7 +514,7 @@ class simpleFileCache {
 
                // Check for defined files::
                if( is_file( $this->filename ) )
-                       return $this->filename;
+               return $this->filename;
 
                if( is_file(  $this->filename .'.gz') ){
                        $this->filename.='.gz';
@@ -522,7 +522,7 @@ class simpleFileCache {
                }
                //check the update the name based on the $wgUseGzip config var
                if ( isset($wgUseGzip) && $wgUseGzip )
-                       $this->filename.='.gz';
+               $this->filename.='.gz';
        }
 
        public function isFileCached() {
@@ -547,10 +547,10 @@ class simpleFileCache {
                $m = array();
                if ( preg_match(
                        '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
-                       $_SERVER['HTTP_ACCEPT_ENCODING'],
-                       $m ) ) {
+               $_SERVER['HTTP_ACCEPT_ENCODING'],
+               $m ) ) {
                        if ( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) )
-                               return false;
+                       return false;
 
                        return true;
                }
@@ -562,7 +562,7 @@ class simpleFileCache {
                        return 'Error: Called saveToFileCache with $wgUseFileCache off';
                }
                if ( strcmp( $text, '' ) == 0 )
-                       return 'saveToFileCache: empty output file';
+               return 'saveToFileCache: empty output file';
 
                if ( $wgUseGzip ) {
                        $outputText = gzencode( trim( $text ) );
@@ -574,7 +574,7 @@ class simpleFileCache {
                $status = $this->checkCacheDirs();
 
                if ( $status !== true )
-                       return $status;
+               return $status;
                $f = fopen( $this->filename, 'w' );
                if ( $f ) {
                        fwrite( $f, $outputText );
index 7943fbe..79800b1 100644 (file)
@@ -224,8 +224,8 @@ mvBaseUploadInterface.prototype = {
                        //set the action to the api url:
                        $j(_this.editForm).attr('action', _this.api_url );
                        
-                       js_log('do iframe form submit to: ' +  $j(_this.editForm).attr('target') 
-                                       + ' destName:' + $j(_this.editForm).find("[name='filename']").val() );                                  
+                       js_log('do iframe form submit to: ' +  $j(_this.editForm).attr('target') );
+                       js_log(' destName:' + $j(_this.editForm).find("[name='filename']").val() );                                     
                        
                        
                        //do post override
index 6045ce1..e0e90d5 100644 (file)
@@ -1726,10 +1726,11 @@ embedVideo.prototype = {
                //@@todo support position config
                var loc = $j(this).position();                  
                if($j('#metaBox_'+this.id).length==0){
+                       var theight =  (parseInt( this.height ) < 200) ? 200 : this.height;
                        $j(this).after('<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;'+
                                                'top:' + (loc.top) + 'px;' +
-                                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 )+'px;' +
-                                               'height:'+ parseInt( this.height )+'px;width:400px;' +                                          
+                                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 ) + 'px;' +
+                                               'height:' + theight + 'px;width:400px;' +                                               
                                                'display:none;" ' +
                                                'id="metaBox_' + this.id + '">'+
                                                        mv_get_loading_img() +
index e877452..3f7908d 100644 (file)
@@ -23,7 +23,7 @@ ctrlBuilder.prototype = {
 
                //check for skin overrides for ctrlBuilder
                if( _global[ embedObj.skin_name + 'Config'] ){
-                       //clone as to not overide prototype:    
+                       //clone as to not override prototype:   
                        var _this = $j.extend(true, {}, this, _global[ embedObj.skin_name + 'Config']);
                        return _this;
                }
@@ -119,8 +119,9 @@ ctrlBuilder.prototype = {
                        $j('#dc_'+ embedObj.id).hover(
                                function(){
                                        if($j('#gnp_' + embedObj.id).length==0){
+                                               var toppos = ( embedObj.instanceOf == 'mvPlayList')?25:10;
                                                $j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
-                                                       'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;">' +
+                                                       'style="position:absolute;display:none;background:#FFF;top:'+toppos+'px;left:10px;right:10px;">' +
                                                        gM('mwe-for_best_experience') +
                                                '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
                                                        gM('mwe-do_not_warn_again') +
@@ -128,7 +129,7 @@ ctrlBuilder.prototype = {
                                                $j('#ffwarn_'+embedObj.id).click(function(){
                                                        if( $j(this).is(':checked') ){
                                                                //set up a cookie for 7 days:
-                                                               $j.cookie('dismissNativeWarn', true, { expires: 5 });
+                                                               $j.cookie('dismissNativeWarn', true, { expires: 7 });
                                                                //set the current instance
                                                                _global['dismissNativeWarn'] = true;
                                                                $j('#gnp_' + embedObj.id).fadeOut('slow');
@@ -170,7 +171,7 @@ ctrlBuilder.prototype = {
                        $j('#' +embedObj.id).get(0).fullscreen();
                });
 
-               js_log(" should add slider binding: " + $tp.find('.play_head').length) ;
+               js_log(" should add slider binding: " + $tp.find('.play_head').length);
                $tp.find('.play_head').slider({
                        range: "min",
                        value: 0,
index 78b473c..a1fd0eb 100644 (file)
@@ -5,7 +5,7 @@
  
 var urlparts = getRemoteEmbedPath();
 var mwEmbedHostPath = urlparts[0];
-var mwRemoteVersion = 58776;
+var mwRemoteVersion = '1.0';
 
 reqArguments = urlparts[1];
 
@@ -139,7 +139,7 @@ function rewrite_for_OggHandler( vidIdList ){
                        if( vidIdList.length != 0 ){
                                setTimeout( function(){
                                        procVidId( vidIdList.pop() )
-                               }, 1);
+                               }, 10);
                        }
                });
        };