Remove trailing whitespace from some JS2 files. These are just the worst offenders
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 11 Oct 2009 19:39:18 +0000 (19:39 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 11 Oct 2009 19:39:18 +0000 (19:39 +0000)
js2/editPage.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/skins/ctrlBuilder.js
js2/remoteMwEmbed.js

index 364f9b2..290589d 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * JS2-style replacement for MediaWiki edit.js
- * (right now it just supports the toolbar) 
+ * (right now it just supports the toolbar)
  */
 
-// Setup configuration vars (if not set already) 
+// Setup configuration vars (if not set already)
 if( !mwAddMediaConfig )
        var mwAddMediaConfig = {};
 
@@ -15,28 +15,28 @@ var defaultAddMediaConfig = {
                'default_query': wgTitle,
                'target_title': wgPageName,
                // Here we can setup the content provider overrides
-               'enabled_cps':['wiki_commons'],   
+               'enabled_cps':['wiki_commons'],
                // The local wiki API URL:
                'local_wiki_api_url': wgServer + wgScriptPath + '/api.php'
 };
-               
+
 
 js2AddOnloadHook( function() {
        var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig );
        // kind of tricky, it would be nice to use run on ready "loader" call here
        if( typeof $j.wikiEditor != 'undefined' ) {
-               setTimeout( function() {                                
+               setTimeout( function() {
                        $j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz(
                                amwConf
                        );
                }, 100 );
        }
-       //add to the old-toolbar all the time:                  
+       //add to the old-toolbar all the time:
        if( $j('#btn-add-media-wiz').length == 0 ){
                $j( '#toolbar' ).append( '<img style="cursor:pointer" id="btn-add-media-wiz" src="' +
                        mv_skin_img_path + 'Button_add_media.png">' );
                $j( '#btn-add-media-wiz' ).addMediaWiz(
                        amwConf
                );
-       }               
+       }
 });
index fd2af28..41242e4 100644 (file)
@@ -19,12 +19,12 @@ var MV_DO_INIT=true;
 if( MV_EMBED_VERSION ){
        MV_DO_INIT=false;
 }
-// Used to grab fresh copies of scripts. 
+// Used to grab fresh copies of scripts.
 var MV_EMBED_VERSION = '1.0r20';
 
 /*
  * Configuration variables should be set by extending mwConfigOptions
- * here is the default config: 
+ * here is the default config:
  */
 var mwDefaultConfig = {
        'skin_name': 'mvpcf',
@@ -70,10 +70,10 @@ parseUri.options = {
 // For use when mv_embed with script-loader is in the root MediaWiki path
 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
 
-var _global = this; // Global obj (depreciate use window) 
+var _global = this; // Global obj (depreciate use window)
 
 /*
-* setup the empty global $mw object 
+* setup the empty global $mw object
 * will ensure all our functions are properly namespaced
 */
 if(!window['$mw']){
@@ -94,35 +94,35 @@ if( !mv_embed_path ) {
 * wrap the global $mw object here:
 *
 * Any global functions/classes that are not jQuery plugins should make
-* there way into the $mw namespace 
+* there way into the $mw namespace
 */
 (function( $ ) {
        /*
        * Language classes $mw.lang
-       * 
+       *
        * Localized Language support attempts to mirror the functionality of Language.php in MediaWiki
        * It contains methods for loading and transforming msg text
-       * 
+       *
        */
        $.lang = {};
        /**
        * Setup the lang object
        */
        var gMsg = {};
-       var gRuleSet = {};              
-               
+       var gRuleSet = {};
+
        /**
        * loadGM function
-       * Loads a set of json messages into the lng object. 
+       * Loads a set of json messages into the lng object.
        *
-       * @param json msgSet The set of msgs to be loaded 
+       * @param json msgSet The set of msgs to be loaded
        */
        $.lang.loadGM = function( msgSet ){
                for( var i in msgSet ) {
                        gMsg[ i ] = msgSet[i];
                }
        },
-       
+
        /**
        * loadRS function
        * Loads a ruleset by given template key ie PLURAL : { //ruleSetObj }
@@ -134,55 +134,55 @@ if( !mv_embed_path ) {
                        gRuleSet[ i ] = ruleSet[ i ];
                }
        }
-       
+
        /**
         * Returns a transformed msg string
         *
         * it take a msg key and array of replacement values of form
-        * $1, $2 and does relevant msgkey transformation returning 
-        * the user msg. 
+        * $1, $2 and does relevant msgkey transformation returning
+        * the user msg.
         *
         * @param string key The msg key as set by loadGm
         * @param [mixed] args  An array of replacement strings
-        * @return string 
+        * @return string
         */
-       $.lang.gM = function( key , args ) {                                            
+       $.lang.gM = function( key , args ) {
                if(! gMsg[ key ])
                        return '&lt;' + key + '&gt;';// Missing key placeholder
-               
+
                //swap in the arg values
-               var ms =  $.lang.gMsgSwap( key, args) ;         
-                
+               var ms =  $.lang.gMsgSwap( key, args) ;
+
                //a quick check to see if we need to send the msg via the 'parser'
                //(we can add more detailed check once we support more wiki syntax)
                if(ms.indexOf('{{')==-1){
                        return ms;
                        //return ms;
                }
-                                       
-               //make sure we have the lagMagic setup: 
+
+               //make sure we have the lagMagic setup:
                $.lang.magicSetup();
-               //send the msg key through the parser  
+               //send the msg key through the parser
                pObj = $.parser.pNew( ms );
                //return the transformed msg
-               return pObj.getHTML();          
+               return pObj.getHTML();
        }
        /**
        * gMsgSwap
-       * 
+       *
        * @param string key The msg key as set by loadGm
        * @param [mixed] args  An array or string to be replaced
-       * @return string 
+       * @return string
        */
        $.lang.gMsgSwap = function( key , args ){
                if(! gMsg[ key ])
                        return '&lt;' + key + '&gt;';// Missing key placeholder
                //get the messege string:
                var ms = gMsg[ key ];
-               
-               //replace values 
+
+               //replace values
                if( typeof args == 'object' || typeof args == 'array' ) {
-                       for( var v in args ) { 
+                       for( var v in args ) {
                                // Message test replace arguments start at 1 instead of zero:
                                var rep = new RegExp('\\$'+ ( parseInt(v) + 1 ), 'g');
                                ms = ms.replace( rep, args[v] );
@@ -192,70 +192,70 @@ if( !mv_embed_path ) {
                }
                return ms;
        }
-        
+
        /**
        * gMsgNoTrans
-       * 
+       *
        * @returns string The msg key without transforming it
        */
        $.lang.gMsgNoTrans = function( key ){
                if( gMsg[ key ] )
                        return gMsg[ key ]
-       
+
                // Missing key placeholder
                return '&lt;' + key + '&gt;';
        }
        /**
-       * Add Supported Magic Words to parser 
+       * Add Supported Magic Words to parser
        */
        //set the setupflag to false:
-       $.lang.doneSetup=false; 
+       $.lang.doneSetup=false;
        $.lang.magicSetup = function(){
                if(!$.lang.doneSetup){
                        $.parser.addMagic ( {
                                'PLURAL' : $.lang.procPLURAL
                        })
-                       
+
                        $.lang.doneSetup = true;
                }
-                       
+
        }
        /**
        * Process the PLURAL special language template key:
        */
        $.lang.procPLURAL = function( tObj ){
-               //setup shortcuts 
+               //setup shortcuts
                // (gRuleSet is loaded from script-loader to contains local ruleset)
-               var rs = gRuleSet['PLURAL'];    
-               
+               var rs = gRuleSet['PLURAL'];
+
                /*
                 * Plural matchRuleTest
                 */
                function matchRuleTest(cRule, val){
                        js_log("matchRuleTest:: " + typeof cRule + ' ' + cRule + ' == ' + val );
-                       
+
                        function checkValue(compare, val){
                                if(typeof compare == 'string'){
-                                       range = compare.split('-');     
+                                       range = compare.split('-');
                                        if( range.length >= 1 ){
                                                if( val >= range[0] &&  val <= range[1] )
-                                                       return true; 
+                                                       return true;
                                        }
                                }
                                //else do a direct compare
                                if(compare == val){
-                                       return true; 
+                                       return true;
                                }
                                return false;
-                       }                       
+                       }
                        //check for simple cRule type:
-                       if( typeof cRule == 'number'){                                  
-                               return ( parseInt( val ) == parseInt( cRule) );                                 
+                       if( typeof cRule == 'number'){
+                               return ( parseInt( val ) == parseInt( cRule) );
                        }else if( typeof cRule == 'object' ){
-                               var cmatch = {};                
+                               var cmatch = {};
                                //if a list we need to match all for rule match
                                for(var i in  cRule){
-                                       var cr = cRule[i];                                      
+                                       var cr = cRule[i];
                                        //set cr type
                                        var crType =  '';
                                        for( var j in cr ){
@@ -264,9 +264,9 @@ if( !mv_embed_path ) {
                                        }
                                        switch(crType){
                                                case 'mod':
-                                                       if( cr ['is'] ){        
+                                                       if( cr ['is'] ){
                                                                if( checkValue( val % cr['mod'], cr ['is'] ) )
-                                                                       cmatch[i] = true;                                                                                                                                                                                               
+                                                                       cmatch[i] = true;
                                                        }else if( cr['not']){
                                                                if( ! checkValue( val % cr['mod'], cr ['not'] ) )
                                                                        cmatch[i] = true;
@@ -274,46 +274,46 @@ if( !mv_embed_path ) {
                                                break;
                                        }
                                }
-                               //check all the matches (taking into consideration "or" order) 
-                               for(var i in cRule){                                    
+                               //check all the matches (taking into consideration "or" order)
+                               for(var i in cRule){
                                        if( ! cmatch[i] )
-                                               return false; 
+                                               return false;
                                }
                                return true;
-                               
+
                        }
                }
                /**
                 * Maps a given rule Index to template params:
-                * 
+                *
                 * if index is out of range return last param
-                * @param 
-                */ 
-               function getTempParamFromRuleInx(tObj, ruleInx ){                                       
+                * @param
+                */
+               function getTempParamFromRuleInx(tObj, ruleInx ){
                        //js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
                        if( ruleInx     >= tObj.param.length )
                                return  tObj.param[  tObj.param.length -1 ];
                        //else return the requested index:
                        return tObj.param[ ruleInx ];
-               }                                               
+               }
                var rCount=0
-               //run the actual rule lookup:           
+               //run the actual rule lookup:
                for(var ruleInx in rs){
-                       cRule = rs[ruleInx];                    
+                       cRule = rs[ruleInx];
                        if( matchRuleTest( cRule, tObj.arg ) ){
-                               js_log("matched rule: " + ruleInx );                            
-                               return getTempParamFromRuleInx(tObj, rCount );                                  
+                               js_log("matched rule: " + ruleInx );
+                               return getTempParamFromRuleInx(tObj, rCount );
                        }
                        rCount ++;
-               }                       
+               }
                js_log('no match found for: ' + tObj.arg + ' using last/other : ' +  tObj.param [ tObj.param.length -1 ] );
-               //return the last /"other" template param 
-               return tObj.param [ tObj.param.length -1 ];                                     
-       }               
-       
+               //return the last /"other" template param
+               return tObj.param [ tObj.param.length -1 ];
+       }
+
        /**
         * gMsgLoadRemote loads remote msg strings
-        * 
+        *
         * @param mixed msgSet the set of msg to load remotely
         * @param function callback  the callback to issue once string is ready
         */
@@ -327,7 +327,7 @@ if( !mv_embed_path ) {
                        ammessages += msgSet;
                }
                if( ammessages == '' ) {
-                       js_log( 'gMsgLoadRemote: no message set requested' );           
+                       js_log( 'gMsgLoadRemote: no message set requested' );
                        return false;
                }
                do_api_req({
@@ -382,95 +382,95 @@ if( !mv_embed_path ) {
                //@@todo we need a formatNum and we need to request some special packaged info to deal with that case.
                return gM( msg , size );
        };
-       
-       
+
+
        /**
        * MediaWiki wikitext "Parser"
        *
-       * This is not feature complete but we need a way to get at template properties 
-       *       
-       *  
+       * This is not feature complete but we need a way to get at template properties
+       *
+       *
        * @param wikiText the wikitext to be parsed
-       * @return parserObj returns a parser object that has methods for getting at 
-       * things you would want 
-       */      
+       * @return parserObj returns a parser object that has methods for getting at
+       * things you would want
+       */
        $.parser = {};
        var pMagicSet = {};
        /**
-        * parser addMagic 
-        * 
+        * parser addMagic
+        *
         * lets you add a set of magic keys and associated callback funcions
-        * callback: @param ( Object Template ) 
+        * callback: @param ( Object Template )
         * callback: @return the transformed template output
-        * 
+        *
         * @param object magicSet key:callback
         */
        $.parser.addMagic = function( magicSet ){
                for(var i in magicSet)
                        pMagicSet[ i ] = magicSet[i];
        }
-       
+
        //actual parse call (returns parser object)
        $.parser.pNew = function( wikiText, opt ){
                var parseObj = function( wikiText, opt){
                        return this.init( wikiText, opt )
-               }               
+               }
                parseObj.prototype = {
                        //the wikiText "DOM"... stores the parsed wikiText structure
                        //wtDOM : {}, (not yet supported )
-                        
-                       pOut : '', //the parser output string container 
+
+                       pOut : '', //the parser output string container
                        init  :function( wikiText ){
-                               this.wikiText = wikiText;                               
+                               this.wikiText = wikiText;
                        },
                        updateText : function( wikiText ){
                                this.wikiText = wikiText;
-                               //invalidate the output (will force a reparse) 
-                               this.pOut = '';                         
+                               //invalidate the output (will force a reparse)
+                               this.pOut = '';
                        },
-                       parse : function(){                     
+                       parse : function(){
                                this.pObj = {};
                                this.pObj.tmpl = new Array();
-                               
-                               //refrences for swap key                        
+
+                               //refrences for swap key
                                this.pObj.tmpl_text = new Array();
-                               this.pObj.tmpl_key = new Array();                                                                               
-                               this.pObj.tmpl_ns = '' ; // wikiText with place-holder                                                                          
-                               
+                               this.pObj.tmpl_key = new Array();
+                               this.pObj.tmpl_ns = '' ; // wikiText with place-holder
+
                                //get templates losly based on Magnus_Manske/tmpl.js code:
                                var tcnt = 0 ;
-                               var ts = '' ;                           
+                               var ts = '' ;
                                var curt = 0 ;
-                               var schar = 0;                          
-                               
-                               
+                               var schar = 0;
+
+
                                //build out nested template holders:
                                var depth = 0;
-                               var tKey = 0;                                   
-                               var ns = '';                                                                    
-                                                       
+                               var tKey = 0;
+                               var ns = '';
+
                                /*
                                 * quickly recursive / parse out templates with top down recurse decent
-                                */ 
-                               
+                                */
+
                                // ~ probably a better algorithm out there / should mirror php parser flow ~
-                               // ... but I am having fun with recursion so here it is...                                                                                              
-                               function rdpp ( txt ){                                                                          
+                               // ... but I am having fun with recursion so here it is...
+                               function rdpp ( txt ){
                                        var node = {};
                                        //if we should output node text
-                                       var ont = true;                                 
-                                       //inspect each char                                     
-                                       for(var a=0; a < txt.length; a++){                                      
+                                       var ont = true;
+                                       //inspect each char
+                                       for(var a=0; a < txt.length; a++){
                                                if( txt[a] == '{' && txt[a+1] == '{' ){
                                                        a=a+2;
-                                                       node['p'] = node;                                                       
+                                                       node['p'] = node;
                                                        if(!node['c'])
                                                                node['c'] = new Array();
-                                                                                                                               
-                                                       node['c'].push( rdpp( txt.substr( a ) ) );                                                              
-                                                       ont=true;                                                                                                                                                                                                                                                                                       
+
+                                                       node['c'].push( rdpp( txt.substr( a ) ) );
+                                                       ont=true;
                                                }else if( txt[a] == '}' && txt[a+1] == '}'){
-                                                       if( !node['p'] ){                                                       
+                                                       if( !node['p'] ){
                                                                return node;
                                                        }
                                                        node = node['p'];
@@ -484,37 +484,37 @@ if( !mv_embed_path ) {
                                                                node['t']+=txt[a];
                                        }
                                        return node;
-                               }                                                                       
+                               }
                                /**
                                 * parse template text as template name and named params
                                 */
                                function parseTmplTxt( ts ){
                                        var tObj = {};
-                                       //Get template name: 
+                                       //Get template name:
                                        tname = ts.split('\|').shift() ;
-                                       tname = tname.split('\{').shift() ;                                                     
-                                       tname = tname.replace( /^\s+|\s+$/g, "" ); //trim 
-                                                                                       
-                                       //check for arguments:                  
-                                       if( tname.split(':').length == 1 ){                             
+                                       tname = tname.split('\{').shift() ;
+                                       tname = tname.replace( /^\s+|\s+$/g, "" ); //trim
+
+                                       //check for arguments:
+                                       if( tname.split(':').length == 1 ){
                                                tObj["name"] = tname;
                                        }else{
                                                tObj["name"] = tname.split(':').shift();
                                                tObj["arg"] = tname.split(':').pop();
                                        }
-                                       
-                                       js_log("TNAME::" + tObj["arg"] + ' from:: ' + ts);      
-                                       
+
+                                       js_log("TNAME::" + tObj["arg"] + ' from:: ' + ts);
+
                                        var pSet = ts.split('\|');
-                                       pSet.splice(0,1);                                                               
-                                       if( pSet.length ){                                                              
+                                       pSet.splice(0,1);
+                                       if( pSet.length ){
                                                tObj.param = new Array();
                                                for(var pInx in pSet){
                                                        var tStr = pSet[ pInx ];
                                                        for(var b=0 ; b < tStr.length ; b++){
                                                                if(tStr[b] == '=' && b>0 && b<tStr.length && tStr[b-1]!='\\'){
                                                                        //named param
-                                                                       tObj.param[ tStr.split('=').shift() ] = tStr.split('=').pop();                                                                  
+                                                                       tObj.param[ tStr.split('=').shift() ] = tStr.split('=').pop();
                                                                }else{
                                                                        //indexed param
                                                                        tObj.param[ pInx ] = tStr;
@@ -527,84 +527,84 @@ if( !mv_embed_path ) {
                                function getMagicTxtFromTempNode( node ){
                                        node.tObj = parseTmplTxt ( node.t );
                                        //do magic swap if templet key found in pMagicSet
-                                       if( node.tObj.name in pMagicSet){                                                       
-                                               var nt = pMagicSet[ node.tObj.name ]( node.tObj );                                              
+                                       if( node.tObj.name in pMagicSet){
+                                               var nt = pMagicSet[ node.tObj.name ]( node.tObj );
                                                return nt;
                                        }else{
                                                //don't swap just return text
                                                return node.t;
-                                       }                       
+                                       }
                                }
                                /**
                                 * recurse_magic_swap
-                                * 
-                                * go last child first swap upward: (could probably be integrated above somehow) 
-                                */                     
-                               var pNode = null;       
-                               function recurse_magic_swap( node ){                                    
+                                *
+                                * go last child first swap upward: (could probably be integrated above somehow)
+                                */
+                               var pNode = null;
+                               function recurse_magic_swap( node ){
                                        if( !pNode )
-                                               pNode = node;                   
-                                                                                                                                               
-                                       if( node['c'] ){                                                
-                                               //swap all the kids:                                    
-                                               for(var i in node['c']){                                                                
-                                                       var nt = recurse_magic_swap( node['c'][i] );                                                                    
+                                               pNode = node;
+
+                                       if( node['c'] ){
+                                               //swap all the kids:
+                                               for(var i in node['c']){
+                                                       var nt = recurse_magic_swap( node['c'][i] );
                                                        //swap it into current
-                                                       if( node.t ){                                                   
-                                                               node.t = node.t.replace( node['c'][i].t, nt);                                                           
-                                                       }       
+                                                       if( node.t ){
+                                                               node.t = node.t.replace( node['c'][i].t, nt);
+                                                       }
                                                        //swap into parent
-                                                       pNode.t  = pNode.t.replace( node['c'][i].t, nt);                                                                                        
+                                                       pNode.t  = pNode.t.replace( node['c'][i].t, nt);
                                                }
-                                               //do the current node:                                          
-                                               var nt = getMagicTxtFromTempNode( node );                                                                                                               
-                                               pNode.t = pNode.t.replace(node.t , nt);                                                                                         
-                                               //run the swap for the outer most node                                          
+                                               //do the current node:
+                                               var nt = getMagicTxtFromTempNode( node );
+                                               pNode.t = pNode.t.replace(node.t , nt);
+                                               //run the swap for the outer most node
                                                return node.t;
-                                       }else{                                  
-                                               //node.t = getMagicFromTempObj( node.t )                
+                                       }else{
+                                               //node.t = getMagicFromTempObj( node.t )
                                                return getMagicTxtFromTempNode( node );
                                        }
-                               }               
-                               //get text node system: 
-                               var node = rdpp ( this.wikiText );                      
-                               //debugger;     
-                               //parse out stuff: 
-                               
-                               this.pOut = recurse_magic_swap( node);                                                                                                          
-                                                                                                                       
+                               }
+                               //get text node system:
+                               var node = rdpp ( this.wikiText );
+                               //debugger;
+                               //parse out stuff:
+
+                               this.pOut = recurse_magic_swap( node);
+
                        },
                        /**
                         * Returns the transformed wikitext
-                        * 
-                        * Build output from swapable index 
-                        *              (all transforms must be expanded in parse stage and linerarly rebuilt)  
-                        * Alternativly we could build output using a placeholder & replace system 
+                        *
+                        * Build output from swapable index
+                        *              (all transforms must be expanded in parse stage and linerarly rebuilt)
+                        * Alternativly we could build output using a placeholder & replace system
                         *              (this lets us be slightly more slopty with ordering and indexes, but probably slower)
-                        * 
-                        * Ideal: we build a 'wiki DOM' 
+                        *
+                        * Ideal: we build a 'wiki DOM'
                         *              When editing you update the data structure directly
-                        *              Then in output time you just go DOM->html-ish output without re-parsing anything                           
+                        *              Then in output time you just go DOM->html-ish output without re-parsing anything
                         */
                        getHTML : function(){
                                //wikiText updates should invalidate pOut
                                if( this.pOut == ''){
                                        this.parse();
                                }
-                               return this.pOut;                                                                                               
+                               return this.pOut;
                        }
                };
                //return the parserObj
                return new parseObj( wikiText, opt) ;
-       }       
-       
+       }
+
 })(window.$mw);
-//setup legacy global shortcuts: 
+//setup legacy global shortcuts:
 var loadGM = $mw.lang.loadGM;
 var loadRS = $mw.lang.loadRS;
 var gM = $mw.lang.gM;
 
-//if some no-js2 script defined and loaded gMsg in global space: 
+//if some no-js2 script defined and loaded gMsg in global space:
 if( _global['gMsg'] ){
        loadGM( _global['gMsg'] );
 }
@@ -838,11 +838,11 @@ var mvJsLoader = {
                                                coma = ',';
                                        }
                                }
-                               //Build the url to the scriptServer striping its request paramaters: 
+                               //Build the url to the scriptServer striping its request paramaters:
                                var puri = parseUri( getMvEmbedURL() );
                                if( ( getMvEmbedURL().indexOf('://') != -1 )
                                        && puri.host != parseUri( document.URL ).host )
-                               {                                       
+                               {
                                        var scriptPath = puri.protocol + '://' + puri.authority + puri.path;
                                }else{
                                        var scriptPath = puri.path;
@@ -870,10 +870,10 @@ var mvJsLoader = {
                        this.callbacks.push( callback );
                }
                if( this.checkLoading() ) {
-                       //@@todo we should check the <script> Element .onLoad property to 
-                       //make sure its just not a very slow connection or we can run the callback 
-                       //(even though the class is not loaded) 
-                        
+                       //@@todo we should check the <script> Element .onLoad property to
+                       //make sure its just not a very slow connection or we can run the callback
+                       //(even though the class is not loaded)
+
                        if( this.load_time++ > 4000 ){ // Time out after ~80 seconds
                                js_log( gM('mwe-error_load_lib', [mvGetClassPath(this.missing_path),  this.missing_path]) );
                                this.load_error = true;
@@ -952,7 +952,7 @@ var mvJsLoader = {
                        cur_path = (cur_path == '') ? cur_path + objPath[p] : cur_path + '.' + objPath[p];
                        eval( 'var ptest = typeof ( '+ cur_path + ' ); ');
                        if( ptest == 'undefined' ) {
-                               this.missing_path = cur_path;                           
+                               this.missing_path = cur_path;
                                return false;
                        }
                }
@@ -966,39 +966,39 @@ var mvJsLoader = {
                //js_log( 'jQueryCheck::' );
                // Skip stuff if $j is already loaded:
                if( _global['$j'] && callback )
-                       callback();                                     
+                       callback();
                var _this = this;
                // Load jQuery
                _this.doLoad([
                        'window.jQuery'
                ], function() {
-                       //only do the $j setup once: 
+                       //only do the $j setup once:
                        if(!_global['$j']){
                                _global['$j'] = jQuery.noConflict();
                        }
                        if( _this.jQuerySetupFlag == false){
                                js_log('setup mv_embed jQuery bindings');
-                               //setup our global settings using the (jQuery helper) 
-                               mwConfig = $j.extend( mwDefaultConfig, mwConfig);                                                               
-                               
+                               //setup our global settings using the (jQuery helper)
+                               mwConfig = $j.extend( mwDefaultConfig, mwConfig);
+
                                // Set up the skin path
                                _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' +mwConfig['jui_skin'] + '/';
                                _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/images/';
                                _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg';
-                               
-                               //setup skin dependent dependencies 
-                               lcCssPath({'embedVideo' : 'skins/' + mwConfig['skin_name'] + '/playerSkin.css'});                               
-                               
+
+                               //setup skin dependent dependencies
+                               lcCssPath({'embedVideo' : 'skins/' + mwConfig['skin_name'] + '/playerSkin.css'});
+
                                // Make sure the skin/style sheets are always available:
                                loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
                                loadExternalCss( mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/styles.css' );
-                               
+
                                // Set up AJAX to not send dynamic URLs for loading scripts (we control that with
                                // the scriptLoader)
                                $j.ajaxSetup({
                                        cache: true
                                });
-                               
+
                                js_log( 'jQuery loaded into $j' );
                                // Set up mvEmbed jQuery bindings and config based dependencies
                                mv_jqueryBindings();
@@ -1012,32 +1012,32 @@ var mvJsLoader = {
        },
        embedVideoCheck:function( callback ) {
                var _this = this;
-               js_log( 'embedVideoCheck:' );                           
+               js_log( 'embedVideoCheck:' );
                // Make sure we have jQuery
                _this.jQueryCheck( function() {
                        //set class videonojs to hidden
                        $j('.videonojs').html( gM('mwe-loading_txt') );
-                       //Set up the embed video player class request: (include the skin js as well)  
+                       //Set up the embed video player class request: (include the skin js as well)
                        var depReq = [
                                [
                                        '$j.ui',
                                        'embedVideo',
                                        'ctrlBuilder',
-                                       '$j.cookie'                                     
+                                       '$j.cookie'
                                ],
                                [
                                        '$j.ui.slider'
                                ]
-                       ];                                      
-                       //add skin if set: 
+                       ];
+                       //add skin if set:
                        if( mwConfig['skin_name'] )
                                depReq[0].push( mwConfig['skin_name'] + 'Config' );
-                       
+
                        // Add PNG fix if needed:
                        if( $j.browser.msie || $j.browser.version < 7 )
                                depReq[0].push( '$j.fn.pngFix' );
-                       
-                       //load the video libs: 
+
+                       //load the video libs:
                        _this.doLoadDepMode( depReq, function() {
                                embedTypes.init();
                                callback();
@@ -1052,7 +1052,7 @@ var mvJsLoader = {
        // unless js2AddOnloadHook was used or there is video on the page.
        runQueuedFunctions: function() {
                var _this = this;
-               this.doneReadyEvents = true;            
+               this.doneReadyEvents = true;
                this.jQueryCheck( function() {
                        _this.runReadyEvents();
                });
@@ -1114,7 +1114,7 @@ function setSwappableToLoading( e ) {
        //}
 }
 //js2AddOnloadHook: ensure jQuery and the DOM are ready
-function js2AddOnloadHook( func ) {    
+function js2AddOnloadHook( func ) {
        // If we have already run the DOM-ready function, just run the function directly:
        if( mvJsLoader.doneReadyEvents ) {
                // Make sure jQuery is there:
@@ -1154,7 +1154,7 @@ if ( document.addEventListener ) {
  */
 function mv_write_modal( content, speed ) {
        $j( '#modalbox,#mv_overlay' ).remove();
-       $j( 'body' ).append( 
+       $j( 'body' ).append(
                '<div id="modalbox" style="background:#DDD;border:3px solid #666666;font-size:115%;' +
                'top:30px;left:20px;right:20px;bottom:30px;position:fixed;z-index:100;">' +
                content +
@@ -1218,7 +1218,7 @@ function mv_jqueryBindings() {
                        // Issue a request to get the CSS file (if not already included):
                        loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
                        loadExternalCss( mv_embed_path + 'skins/' + mwConfig['skin_name'] + '/mv_sequence.css' );
-                       // Make sure we have the required mv_embed libs (they are not loaded when no video 
+                       // Make sure we have the required mv_embed libs (they are not loaded when no video
                        // element is on the page)
                        mvJsLoader.embedVideoCheck( function() {
                                // Load the playlist object and then the jQuery UI stuff:
@@ -1243,7 +1243,7 @@ function mv_jqueryBindings() {
                                        ]
                                ], function() {
                                        js_log( 'calling new mvSequencer' );
-                                       // Initialise the sequence object (it will take over from there) 
+                                       // Initialise the sequence object (it will take over from there)
                                        // No more than one mvSeq obj for now:
                                        if( !_global['mvSeq'] ) {
                                                _global['mvSeq'] = new mvSequencer( iObj );
@@ -1264,12 +1264,12 @@ function mv_jqueryBindings() {
                        loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
                        loadExternalCss( mv_embed_path + 'skins/'+mwConfig['skin_name'] + '/styles.css' );
 
-                       // Check if we already have Firefogg loaded (the call just updates the element's 
+                       // Check if we already have Firefogg loaded (the call just updates the element's
                        // properties)
                        var sElm = $j( this.selector ).get( 0 );
                        if( sElm['firefogg'] ) {
                                if( sElm['firefogg'] == 'loading' ) {
-                                       js_log( "Error: called firefogg operations on Firefogg selector that is " + 
+                                       js_log( "Error: called firefogg operations on Firefogg selector that is " +
                                                "not done loading" );
                                        return false;
                                }
@@ -1310,7 +1310,7 @@ function mv_jqueryBindings() {
                        // Make sure we have everything loaded that we need:
                        mvJsLoader.doLoadDepMode( loadSet, function() {
                                        js_log( 'firefogg libs loaded. target select:' + iObj.selector );
-                                       // Select interface provider based on whether we want to include the 
+                                       // Select interface provider based on whether we want to include the
                                        // encoder interface or not
                                        if( iObj.encoder_interface ) {
                                                var myFogg = new mvAdvFirefogg( iObj );
@@ -1371,15 +1371,15 @@ function mv_jqueryBindings() {
                        var href = (opt.href) ? opt.href : '#';
                        var target_attr = (opt.target) ? ' target="' + opt.target + '" ' : '';
                        var style_attr = (opt.style) ? ' style="' + opt.style + '" ' : '';
-                       return '<a href="' + href + '" ' + target_attr + style_attr + 
+                       return '<a href="' + href + '" ' + target_attr + style_attr +
                                ' class="ui-state-default ui-corner-all ui-icon_link ' +
                                className + '"><span class="ui-icon ui-icon-' + iconId + '" />' +
                                '<span class="btnText">'+ msg +'<span></a>';
                }
                // Shortcut to bind hover state
-               $.fn.btnBind = function() {             
+               $.fn.btnBind = function() {
                        $j( this ).hover(
-                               function() {                                    
+                               function() {
                                        $j( this ).addClass( 'ui-state-hover' );
                                },
                                function() {
@@ -1390,28 +1390,28 @@ function mv_jqueryBindings() {
                }
                /**
                * addLoaderDialog
-               *  small helper for putting a loading dialog box on top of everything 
+               *  small helper for putting a loading dialog box on top of everything
                * (helps block for request that
-               * 
+               *
                * @param msg text text of the loader msg
                */
-               $.addLoaderDialog = function( msg_txt ){                        
+               $.addLoaderDialog = function( msg_txt ){
                        if( $('#mwe_tmp_loader').length != 0 )
                                $('#mwe_tmp_loader').remove();
-                       
-                       $('body').append('<div id="mwe_tmp_loader" title="' + msg_txt + '" >' +                         
-                                       gM('mwe-checking-resource') + '<br>' + 
+
+                       $('body').append('<div id="mwe_tmp_loader" title="' + msg_txt + '" >' +
+                                       gM('mwe-checking-resource') + '<br>' +
                                        mv_get_loading_img() +
                        '</div>');
-                       
+
                        mvJsLoader.doLoadDepMode([
-                               [                                       
+                               [
                                        '$j.ui'
                                ],
                                [
                                        '$j.ui.dialog'
                                ]
-                       ], function() {                         
+                       ], function() {
                                $('#mwe_tmp_loader').dialog({
                                        bgiframe: true,
                                        height: 140,
@@ -1649,7 +1649,7 @@ function do_request( req_url, callback ) {
        } else {
                // Get data via DOM injection with callback
                global_req_cb.push( callback );
-               // Prepend json_ to feed_format if not already requesting json format (metavid specific) 
+               // Prepend json_ to feed_format if not already requesting json format (metavid specific)
                if( req_url.indexOf( "feed_format=" ) != -1 && req_url.indexOf( "feed_format=json" ) == -1 )
                        req_url = req_url.replace( /feed_format=/, 'feed_format=json_' );
                loadExternalJs( req_url + '&cb=mv_jsdata_cb&cb_inx=' + (global_req_cb.length - 1) );
@@ -1803,7 +1803,7 @@ function getMvEmbedPath() {
                mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mv_embed.js' ) );
        } else if( mv_embed_url.indexOf( 'mwScriptLoader.php' ) !== -1 ) {
                // Script loader is in the root of MediaWiki, so include the default mv_embed extension path
-               mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mwScriptLoader.php' ) ) 
+               mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'mwScriptLoader.php' ) )
                        + mediaWiki_mvEmbed_path;
        } else {
                mv_embed_path = mv_embed_url.substr( 0, mv_embed_url.indexOf( 'jsScriptLoader.php' ) );
index f4b2744..3ebf09b 100644 (file)
@@ -5,7 +5,7 @@ _global['dismissNativeWarn'] = false;
 * Msg text is inherited from embedVideo (we should move it here (although can't load ctrlBuilder without parent EmbedVideo obj)
 /
 
-/** 
+/**
 * base ctrlBuilder object
 *      @param the embedVideo element we are targeting
 */
@@ -13,104 +13,104 @@ var ctrlBuilder = function( embedObj ) {
        return this.init( embedObj );
 };
 
-/* 
+/*
  * controlsBuilder prototype:
  */
 ctrlBuilder.prototype = {
        init:function( embedObj, opt ){
-               this.embedObj = embedObj;                               
-               
+               this.embedObj = embedObj;
+
                //check for skin overrides for ctrlBuilder
                if( _global[ embedObj.skin_name + 'Config'] )
                        $j.extend(this, _global[ embedObj.skin_name + 'Config']);
-                       
+
        },
        pClass:'videoPlayer',
        height:29,
        supports:{
-                 'options':true,                                
-                 'borders':true                           
-       },      
-       getControls:function(){ 
+                 'options':true,
+                 'borders':true
+       },
+       getControls:function(){
                //set up local pointer to the embedObj
                var embedObj = this.embedObj;
                //set up loadl ctrlBuilder ref
                var _this = this;
-               
-               js_log('f:controlsBuilder:: opt:' + this.options);              
+
+               js_log('f:controlsBuilder:: opt:' + this.options);
                this.id = (embedObj.pc)?embedObj.pc.pp.id:embedObj.id;
                this.available_width = embedObj.playerPixelWidth();
                //make pointer to the embedObj
                this.embedObj =embedObj;
-               var _this = this;               
-               for(var i in embedObj.supports){                        
+               var _this = this;
+               for(var i in embedObj.supports){
                        _this.supports[i] = embedObj.supports[i];
                };
-                                       
-               //special case vars: 
-               if( ( embedObj.roe || 
-                               (embedObj.media_element.timedTextSources && 
-                               embedObj.media_element.timedTextSources() ) 
+
+               //special case vars:
+               if( ( embedObj.roe ||
+                               (embedObj.media_element.timedTextSources &&
+                               embedObj.media_element.timedTextSources() )
                        )  && embedObj.show_meta_link  )
-                       this.supports['closed_captions']=true;   
-               
-                       
+                       this.supports['closed_captions']=true;
+
+
                //append options to body (if not already there)
                if($j('#mv_vid_options_' + this.id).length==0)
-                       $j('body').append( this.components['mv_embedded_options'].o( this ) );          
-                                       
-               var o='';       
+                       $j('body').append( this.components['mv_embedded_options'].o( this ) );
+
+               var o='';
                for( var i in this.components ){
                        if( this.supports[i] ){
                                if( this.available_width > this.components[i].w ){
                                        //special case with playhead don't add unless we have 60px
                                        if( i == 'play_head' && this.available_width < 60 )
-                                               continue;                                               
+                                               continue;
                                        o+=this.components[i].o( this  );
                                        this.available_width -= this.components[i].w;
                                }else{
                                        js_log('not enough space for control component:' + i);
                                }
                        }
-               }               
+               }
                return o;
        },
         /*
         * addControlHooks
         * to be run once controls are attached to the dom
         */
-       addControlHooks:function(){             
+       addControlHooks:function(){
                //set up local pointer to the embedObj
-               var embedObj = this.embedObj;   
-               var _this = this;                                       
-               //add in drag/seek hooks: 
+               var embedObj = this.embedObj;
+               var _this = this;
+               //add in drag/seek hooks:
                if(!embedObj.base_seeker_slider_offset &&  $j('#mv_seeker_slider_'+embedObj.id).get(0))
-                       embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft;                      
-               
+                       embedObj.base_seeker_slider_offset = $j('#mv_seeker_slider_'+embedObj.id).get(0).offsetLeft;
+
                //js_log('looking for: #mv_seeker_slider_'+embedObj.id + "\n " +
                //              'start sec: '+embedObj.start_time_sec + ' base offset: '+embedObj.base_seeker_slider_offset);
-               
-               //add play hook: 
+
+               //add play hook:
                $j('#mv_play_pause_button_' + embedObj.id ).unbind().btnBind().click(function(){
                        $j('#' + embedObj.id).get(0).play();
-               })      
-               
-               //do play-btn-large binding: 
+               })
+
+               //do play-btn-large binding:
                $j('#' + embedObj.id + ' .play-btn-large' ).unbind().btnBind().click(function(){
                        $j('#' + embedObj.id).get(0).play();
-               });             
-               
+               });
+
                //add recommend firefox if non-native playback:
-               if( embedObj.doNativeWarningCheck() ){                                                                                                                  
+               if( embedObj.doNativeWarningCheck() ){
                        $j('#dc_'+ embedObj.id).hover(
-                               function(){                                                                             
+                               function(){
                                        if($j('#gnp_' + embedObj.id).length==0){
                                                $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;">' +
-                                                       gM('mwe-for_best_experience') + 
-                                               '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' + 
-                                                       gM('mwe-do_not_warn_again') + 
-                                               '</div>');                                                      
+                                                       gM('mwe-for_best_experience') +
+                                               '<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
+                                                       gM('mwe-do_not_warn_again') +
+                                               '</div>');
                                                $j('#ffwarn_'+embedObj.id).click(function(){
                                                        if( $j(this).is(':checked') ){
                                                                //set up a cookie for 7 days:
@@ -122,9 +122,9 @@ ctrlBuilder.prototype = {
                                                                _global['adismissNativeWarn'] = false;
                                                                $j.cookie('dismissNativeWarn', false);
                                                        }
-                                                       
-                                               });     
-                                       }                                       
+
+                                               });
+                                       }
                                        if( ($j.cookie('dismissNativeWarn') !== true) &&
                                                _global['dismissNativeWarn'] === false  ){
                                                $j('#gnp_' + embedObj.id).fadeIn('slow');
@@ -135,27 +135,27 @@ ctrlBuilder.prototype = {
                                }
                        );
                }
-               
-               if( $j.browser.msie  &&  $j.browser.version <= 6){                      
+
+               if( $j.browser.msie  &&  $j.browser.version <= 6){
                        $j( embedObj.id + ' .play-btn-large' ).pngFix();
                }
-               
-               
+
+
                //captions binding:
                $j('#timed_text_'  + embedObj.id).unbind().btnBind().click(function(){
                        $j('#' + embedObj.id).get(0).showTextInterface();
                });
-               
-               //options binding: 
+
+               //options binding:
                $j('#options_button_' + embedObj.id).unbind().btnBind().click(function(){
                        $j('#' +embedObj.id).get(0).doOptionsHTML();
                });
-                               
-               //fullscreen binding: 
+
+               //fullscreen binding:
                $j('#fullscreen_'+embedObj.id).unbind().btnBind().click(function(){
                        $j('#' +embedObj.id).get(0).fullscreen();
-               });                             
-               
+               });
+
                js_log(" should add slider binding: " + $j('#mv_play_head_'+embedObj.id).length) ;
                $j('#mv_play_head_'+embedObj.id).slider({
                        range: "min",
@@ -168,42 +168,42 @@ ctrlBuilder.prototype = {
                                $j(id + ' .play-btn-large').fadeOut('fast');
                                //if playlist always start at 0
                                embedObj.start_time_sec = (embedObj.instanceOf == 'mvPlayList')?0:
-                                                               npt2seconds(embedObj.getTimeReq().split('/')[0]);        
+                                                               npt2seconds(embedObj.getTimeReq().split('/')[0]);
                        },
-                       slide: function(event, ui) {                                                                    
-                               var perc = ui.value/1000;                                                                                                                                                                                                                                                                                       
-                               embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);   
+                       slide: function(event, ui) {
+                               var perc = ui.value/1000;
+                               embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
                                //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+  this.jump_time);
-                               embedObj.setStatus( gM('mwe-seek_to')+' '+embedObj.jump_time ); 
-                               //update the thumbnail / frame 
+                               embedObj.setStatus( gM('mwe-seek_to')+' '+embedObj.jump_time );
+                               //update the thumbnail / frame
                                if(embedObj.isPlaying==false){
                                        embedObj.updateThumbPerc( perc );
                                }
                        },
                        change:function(event, ui){
-                               //only run the onChange event if done by a user slide: 
+                               //only run the onChange event if done by a user slide:
                                if(embedObj.userSlide){
                                        embedObj.userSlide=false;
                                        embedObj.seeking=true;
                                        //stop the monitor timer (if we can)
-                                       if(embedObj.stopMonitor)                                 
-                                               embedObj.stopMonitor();                 
-                                                       
-                                       var perc = ui.value/1000;                                                                                                                 
-                                       //set seek time (in case we have to do a url seek)                              
-                                       embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true );   
-                                       js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec);                                                          
+                                       if(embedObj.stopMonitor)
+                                               embedObj.stopMonitor();
+
+                                       var perc = ui.value/1000;
+                                       //set seek time (in case we have to do a url seek)
+                                       embedObj.seek_time_sec = npt2seconds( embedObj.jump_time, true );
+                                       js_log('do jump to: '+embedObj.jump_time + ' perc:' +perc + ' sts:' + embedObj.seek_time_sec);
                                        embedObj.doSeek(perc);
                                }
-                       }                 
+                       }
                });
-               //up the z-index of the default status indicator: 
+               //up the z-index of the default status indicator:
                $j('#mv_play_head_'+embedObj.id + ' .ui-slider-handle').css('z-index', 4);
                $j('#mv_play_head_'+embedObj.id + ' .ui-slider-range').addClass('ui-corner-all').css('z-index', 2);
-               //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter) 
+               //extended class list for jQuery ui themeing (we can probably refactor this with custom buffering highliter)
                $j('#mv_play_head_'+embedObj.id).append( this.getMvBufferHtml() );
-                               
-               //videoOptions: 
+
+               //videoOptions:
                $j('#mv_vid_options_' + this.id + ' .vo_selection').click(function(){
                        embedObj.selectPlaybackMethod();
                        $j('#mv_vid_options_' + embedObj.id).hide();
@@ -213,73 +213,73 @@ ctrlBuilder.prototype = {
                        embedObj.showVideoDownload();
                        $j('#mv_vid_options_'+embedObj.id).hide();
                        return false;
-               })              
+               })
                $j('#mv_vid_options_'+ctrlBuilder.id+' .vo_showcode').click(function(){
                        embedObj.showEmbedCode();
                        $j('#mv_vid_options_'+embedObj.id).hide();
                        return false;
-               });             
-                       
+               });
+
                //volume binding:
                var hoverOverDelay=false;
                $j('#volume_control_'+embedObj.id).unbind().btnBind().click(function(){
                        $j('#' +embedObj.id).get(0).toggleMute();
                }).hover(
-                       function(){                     
+                       function(){
                                $j('#vol_container_' + embedObj.id).addClass('vol_container_top');
                                //set to "below" if playing and embedType != native
                                if(embedObj && embedObj.isPlaying && embedObj.isPlaying() && !embedObj.supports['overlays']){
                                        $j('#vol_container_' + embedObj.id).removeClass('vol_container_top').addClass('vol_container_below');
                                }
-                               
+
                                $j('#vol_container_' + embedObj.id).fadeIn('fast');
                                hoverOverDelay = true;
                        },
-                       function(){             
-                               hoverOverDelay= false;          
+                       function(){
+                               hoverOverDelay= false;
                                setTimeout(function doHideVolume(){
                                        if(!hoverOverDelay){
                                                $j('#vol_container_' + embedObj.id).fadeOut('fast');
                                        }
-                               }, 500);        
+                               }, 500);
                        }
                );
                //Volumen Slider
                $j('#volume_bar_'+embedObj.id).slider({
-                       orientation: "vertical",                        
+                       orientation: "vertical",
                        range: "min",
                        value: 80,
                        min: 0,
-                       max: 100,                       
-                       slide: function(event, ui) {                                                                    
-                               var perc = ui.value/100;                
+                       max: 100,
+                       slide: function(event, ui) {
+                               var perc = ui.value/100;
                                //js_log('update volume:' + perc);
-                               embedObj.updateVolumen(perc);                                                           
+                               embedObj.updateVolumen(perc);
                        },
                        change:function(event, ui){
-                               var perc = ui.value/100;        
+                               var perc = ui.value/100;
                                if (perc==0) {
-                                       $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');                                                           
-                               }else{                                  
+                                       $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
+                               }else{
                                        $j('#volume_control_'+embedObj.id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
                                }
-                               //only run the onChange event if done by a user slide: 
+                               //only run the onChange event if done by a user slide:
                                if(embedObj.userSlide){
                                        embedObj.userSlide=false;
-                                       embedObj.seeking=true;                                                  
-                                       var perc = ui.value/100;                                                                                                                  
-                                       embedObj.updateVolumen(perc);                                   
+                                       embedObj.seeking=true;
+                                       var perc = ui.value/100;
+                                       embedObj.updateVolumen(perc);
                                }
-                       }                 
-               });                                     
-               
-       },      
+                       }
+               });
+
+       },
        getMvBufferHtml:function(){
                return '<div class="ui-slider-range ui-slider-range-min ui-widget-header ' +
                                'ui-state-highlight ui-corner-all '+
                                'mv_buffer" style="width:0px;height:100%;z-index:1;top:0px" />';
        },
-       getComponent:function( component ) {                            
+       getComponent:function( component ) {
                if( this.components[ component ] ){
                        return this.components[ component ].o( this );
                }else{
@@ -287,7 +287,7 @@ ctrlBuilder.prototype = {
                }
        },
        /*
-       * components take in the embedObj and return some html for the given component. 
+       * components take in the embedObj and return some html for the given component.
        * components can be overwritten by skin javascript
        */
        components:{
@@ -300,8 +300,8 @@ ctrlBuilder.prototype = {
                'play-btn-large':{
                        'w' : 130,
                        'h' : 96,
-                       'o':function( ctrlObj ){                                                
-                               //get dynamic position for big play button (@@todo maybe use margin:auto ? ) 
+                       'o':function( ctrlObj ){
+                               //get dynamic position for big play button (@@todo maybe use margin:auto ? )
                                return $j('<div/>').attr({
                                                                'title' : gM('mwe-play_clip'),
                                                                'class' : "ui-state-default play-btn-large",
@@ -310,8 +310,8 @@ ctrlBuilder.prototype = {
                                                                'left'  : ((ctrlObj.embedObj.playerPixelWidth() - this.w)/2),
                                                                'top'   : ((ctrlObj.embedObj.playerPixelHeight() - this.h)/2)
                                                        })
-                                                       //quick and dirty way to get at jquery html (might be a short cut I am missing?) 
-                                                       .wrap('<div/>').parent().html();                                                
+                                                       //quick and dirty way to get at jquery html (might be a short cut I am missing?)
+                                                       .wrap('<div/>').parent().html();
                        }
                },
                'mv_embedded_options':{
@@ -327,14 +327,14 @@ ctrlBuilder.prototype = {
                                                '<p class="short_match vo_selection"><a href="#"><span>'+gM('mwe-chose_player')+'</span></a></p>'+
                                                '<p class="short_match vo_download"><a href="#"><span>'+gM('mwe-download')+'</span></a></p>'+
                                                '<p class="short_match vo_showcode"><a href="#"><span>'+gM('mwe-share')+'</span></a></p>';
-                                       
-                                       //link to the stream page if we are not already there: 
+
+                                       //link to the stream page if we are not already there:
                                        if( ctrlObj.embedObj.roe && typeof mv_stream_interface == 'undefined' )
                                                o+='<p class="short_match"><a href="javascript:$j(\'#'+ctrlObj.id+'\').get(0).doLinkBack()"><span><strong>Source Page</strong></span></a></p>';
-                                                                                       
-                               o+='</div>'+  
-                               '</div><!--videoOptionsInner-->' +   
-                                       '<div class="videoOptionsBot"></div>' +   
+
+                               o+='</div>'+
+                               '</div><!--videoOptionsInner-->' +
+                                       '<div class="videoOptionsBot"></div>' +
                                '</div><!--videoOptions-->';
                                return o;
                        }
@@ -348,7 +348,7 @@ ctrlBuilder.prototype = {
                'options':{
                        'w':26,
                        'o':function( ctrlObj ){
-                               return '<div title="'+ gM('mwe-player_options') + '" id="options_button_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton"><span class="ui-icon ui-icon-wrench"></span></div>';                                                 
+                               return '<div title="'+ gM('mwe-player_options') + '" id="options_button_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton"><span class="ui-icon ui-icon-wrench"></span></div>';
                        }
                },
                'pause':{
@@ -361,7 +361,7 @@ ctrlBuilder.prototype = {
                        'w':23,
                        'o':function( ctrlObj ){
                                return '<div title="' + gM('mwe-closed_captions') + '" id="timed_text_'+ctrlObj.id+'" class="ui-state-default ui-corner-all ui-icon_link rButton"><span class="ui-icon ui-icon-comment"></span></div>'
-                       }                       
+                       }
                },
                'volume_control':{
                        'w':23,
@@ -371,7 +371,7 @@ ctrlBuilder.prototype = {
                                                                '<div style="position:absolute;display:none;" id="vol_container_'+ctrlObj.id+'" class="vol_container ui-corner-all">' +
                                                                        '<div class="volume_bar" id="volume_bar_' + ctrlObj.id + '"></div>' +
                                                                '</div>'+
-                                                       '</div>';                                                                                                               
+                                                       '</div>';
                        }
                },
                'time_display':{
@@ -381,10 +381,10 @@ ctrlBuilder.prototype = {
                        }
                },
                'play_head':{
-                       'w':0, //special case (takes up remaining space) 
+                       'w':0, //special case (takes up remaining space)
                        'o':function( ctrlObj ){
                                return '<div class="play_head" id="mv_play_head_' + ctrlObj.id + '" style="width: ' + ( ctrlObj.available_width - 30 ) + 'px;"></div>';
                        }
-               }                                                                               
-       }       
+               }
+       }
 };
index 7f7422d..b4d90b0 100644 (file)
@@ -2,19 +2,19 @@
  * this file exposes some of the functionality of mwEmbed to wikis
  * that do not yet have js2 enabled
  */
+
 var urlparts = getRemoteEmbedPath();
 var mwEmbedHostPath = urlparts[0];
 var reqAguments = urlparts[1];
 
-addOnloadHook( function(){     
+addOnloadHook( function(){
        //only do rewrites if MV_EMBED / js2 is "off"
        if( typeof MV_EMBED_VERSION == 'undefined' ) {
                doPageSpecificRewrite();
        }
 });
 
-function doPageSpecificRewrite() {     
+function doPageSpecificRewrite() {
        // Add media wizard
        if( wgAction == 'edit' || wgAction == 'submit' ) {
                load_mv_embed( function() {
@@ -23,23 +23,23 @@ function doPageSpecificRewrite() {
        }
 
        // Firefogg integration
-       if( wgPageName == "Special:Upload" ){           
+       if( wgPageName == "Special:Upload" ){
                load_mv_embed( function() {
                        importScriptURI( mwEmbedHostPath + '/uploadPage.js' + reqAguments );
                } );
-       }       
-       
+       }
+
        // OggHandler rewrite for view pages:
        var vidIdList = [];
        var divs = document.getElementsByTagName( 'div' );
        for( var i = 0; i < divs.length; i++ ) {
                if( divs[i].id && divs[i].id.substring( 0, 11 ) == 'ogg_player_' ) {
-                       vidIdList.push( divs[i].getAttribute( "id" ) );                 
+                       vidIdList.push( divs[i].getAttribute( "id" ) );
                }
-       }       
+       }
        if( vidIdList.length > 0 ) {
                load_mv_embed( function() {
-                       mvJsLoader.embedVideoCheck( function() {                                
+                       mvJsLoader.embedVideoCheck( function() {
                                // Do utility rewrite of OggHandler content:
                                rewrite_for_OggHandler( vidIdList );
                        } );
@@ -49,7 +49,7 @@ function doPageSpecificRewrite() {
 // will be deprecated in favor of updates to OggHandler
 function rewrite_for_OggHandler( vidIdList ){
        for( var i = 0; i < vidIdList.length; i++ ) {
-               var vidId = vidIdList[i];                       
+               var vidId = vidIdList[i];
                // Grab the thumbnail and src of the video
                var pimg = $j( '#' + vidId + ' img' );
                var poster_attr = 'poster = "' + pimg.attr( 'src' ) + '" ';
@@ -69,7 +69,7 @@ function rewrite_for_OggHandler( vidIdList ){
                // Parsed values:
                var src = '';
                var duration = '';
-       
+
                var re = new RegExp( /videoUrl(&quot;:?\s*)*([^&]*)/ );
                src = re.exec( $j( '#'+vidId).html() )[2];
 
@@ -80,8 +80,8 @@ function rewrite_for_OggHandler( vidIdList ){
                offset = re.exec( $j( '#'+vidId).html() )[2];
                var offset_attr = offset ? 'startOffset="' + offset + '"' : '';
 
-               // Rewrite that video id (do async calls to avoid locking)              
-               if( src ) {                             
+               // Rewrite that video id (do async calls to avoid locking)
+               if( src ) {
                        // Replace the top div with the mv_embed based player:
                        var vid_html = '<video id="vid_' + i +'" '+
                                        'src="' + src + '" ' +
@@ -91,13 +91,13 @@ function rewrite_for_OggHandler( vidIdList ){
                                        'duration="' + duration + '" ' +
                                        'style="width:' + pwidth + 'px;height:' +
                                                pheight + 'px;"></video>';
-                       //set the video tag inner html and update the height                            
+                       //set the video tag inner html and update the height
                        $j( '#' + vidId ).html( vid_html )
                                .css('height', pheight + 30);
-                       
+
                }
-               
-               rewrite_by_id( 'vid_' + i );            
+
+               rewrite_by_id( 'vid_' + i );
        }
 }