* replaced global $mw with mw ($ in front of a var should mean jQuery object)
authorMichael Dale <dale@users.mediawiki.org>
Thu, 12 Nov 2009 09:59:09 +0000 (09:59 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 12 Nov 2009 09:59:09 +0000 (09:59 +0000)
16 files changed:
js2/apiProxyPage.js
js2/mwEmbed/example_usage/Add_Media_Wizard.html
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
js2/mwEmbed/libAddMedia/searchLibs/flickrSearch.js
js2/mwEmbed/libAddMedia/searchLibs/mediaWikiSearch.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/libEmbedVideo/nativeEmbed.js
js2/mwEmbed/libMwApi/mw.proxy.js
js2/mwEmbed/libTimedText/mvTextInterface.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/skins/ctrlBuilder.js
js2/mwEmbed/skins/kskin/kskin.js
js2/mwEmbed/skins/mvpcf/styles.css
js2/mwEmbed/tests/testLang.js
js2/remoteMwEmbed.js

index 79590cc..7e37959 100644 (file)
@@ -8,7 +8,7 @@
  * Since this is proxy server set a pre-append debug flag to know which debug msgs are coming from where
  */
  
-$mw.conf['debug_pre'] = 'Proxy';
+mw.conf['debug_pre'] = 'Proxy';
  
 if( !mwApiProxyConfig )
        var mwApiProxyConfig = {};
index 5e9f893..05c4811 100644 (file)
@@ -14,7 +14,7 @@
        <script type="text/javascript" src="../mv_embed.js?debug=true"></script>         
        <!--<script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mv_embed,remoteSearchDriver,$j.ui,$j.ui.resizable,$j.ui.draggable,$j.ui.dialog,$j.ui.tabs,$j.ui.sortable,$j.cookie,baseRemoteSearch&urid=1257728132531&debug=true&uselang=en"></script> -->            
        <script type="text/javascript">
-       js2AddOnloadHook(function(){            
+       js2AddOnloadHook(function(){
                $j('#add_media_link').addMediaWiz( {
                        'profile':'html_edit',                  
                        'target_textbox': '#wpTextbox1',
index c20c4bf..e5ad36e 100644 (file)
@@ -449,8 +449,10 @@ remoteSearchDriver.prototype = {
                        break;
                }
                
-               if(typestr=='unk')
+               if(typestr=='unk'){
                        js_log("unkown ftype: " + mimetype );
+                       return '';
+               }               
                         
                return '<div class="rsd_file_type ui-corner-all ui-state-default ui-widget-content" title="' + gM('mwe-ftype-' + typestr) + '">' +
                                        typestr  +
@@ -1789,7 +1791,7 @@ remoteSearchDriver.prototype = {
                //@@todo we should instead support the wiki number format template system instead of inline calls
                if( cp.sObj.num_results != 0 ){ 
                        if( cp.sObj.num_results  >  cp.limit){          
-                               out+= gM( 'rsd_results_desc_total', [(cp.offset+1), to_num, $mw.lang.formatNumber( cp.sObj.num_results )] );
+                               out+= gM( 'rsd_results_desc_total', [(cp.offset+1), to_num, mw.lang.formatNumber( cp.sObj.num_results )] );
                        }else{          
                                out+= gM( 'rsd_results_desc', [(cp.offset+1), to_num] );
                        }
index e8fe90a..c67befd 100644 (file)
@@ -6,11 +6,11 @@ var archiveOrgSearch = function ( iObj){
        return this.init( iObj );
 }
 archiveOrgSearch.prototype = {
-       //archive.org constants: 
+       // Archive.org constants: 
        dnUrl:'http://www.archive.org/download/',
        dtUrl:'http://www.archive.org/details/',
        init:function( iObj ){
-               //init base class and inherit: 
+               // Init base class and inherit: 
                var baseSearch = new baseRemoteSearch( iObj );
                for(var i in baseSearch){
                        if(typeof this[i] =='undefined'){
@@ -19,7 +19,7 @@ archiveOrgSearch.prototype = {
                                this['parent_'+i] =  baseSearch[i];
                        }
                }
-               //inherit the cp settings for 
+               // Inherit the cp settings for 
        },
        getSearchResults:function(){
                //call parent: 
index b1765ef..9c95d9a 100644 (file)
@@ -80,8 +80,8 @@ flickrSearch.prototype = {
                                var resource = data.photos.photo[resource_id];  
                        
                                var rObj = {
-                                       'titleKey'       :  resource.title + '.jpg',
-                                       'resourceKey':  resource.id,
+                                       'titleKey'       : resource.title + '.jpg',
+                                       'resourceKey': resource.id,
                                        'link'           : _this.dtUrl + resource.pathalias + '/'+ resource.id,                         
                                        'title'          : resource.title,
                                        'thumbwidth' : resource.width_t,
index 9ba1233..1740e3d 100644 (file)
@@ -202,7 +202,7 @@ mediaWikiSearch.prototype = {
                                };      
                                /*
                                 //to use once we get the wiki-text parser in shape
-                               var pObj = $mw.parser.pNew( rObj.desc );
+                               var pObj = mw.parser.pNew( rObj.desc );
                                //structured data on commons is based on the "information" template: 
                                var tmplInfo = pObj.templates( 'information' );                         
                                */
index 00cef43..ce8f4cd 100644 (file)
@@ -54,9 +54,6 @@ loadGM({
        "mwe-copy-code" : "Copy code"
 });
 
-//set the globals:
-var commons_api_url =  'http://commons.wikimedia.org/w/api.php';
-
 var default_video_attributes = {
        "id" : null,
        "class" : null,
@@ -134,7 +131,7 @@ mvEmbed = {
                        mvEmbed.flist.push( swap_done_callback );
                        
                //get mv_embed location if it has not been set
-               js_log('mv_video_embed:: ' + $mw.version);                                              
+               js_log('mv_video_embed:: ' + mw.version);                                               
                
                var loadPlaylistLib=false;                                              
                
@@ -142,10 +139,10 @@ mvEmbed = {
                        js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
                                                                
                        if( $j(this_elm).attr("id") == '' ){
-                               $j(this_elm).attr("id", 'v'+ $mw.player_list.length);
+                               $j(this_elm).attr("id", 'v'+ mw.player_list.length);
                        }                       
                        //store a global reference to the id    
-                       $mw.player_list.push( $j(this_elm).attr("id") );                        
+                       mw.player_list.push( $j(this_elm).attr("id") );                 
                        
                        //if video doSwap
                        switch( this_elm.tagName.toLowerCase()){
@@ -248,16 +245,16 @@ mvEmbed = {
                        $j('#'+embed_video.id).get(0).init_with_sources_loaded();
                }
                
-               js_log('done with child: ' + embed_video.id + ' len:' + $mw.player_list.length);
+               js_log('done with child: ' + embed_video.id + ' len:' + mw.player_list.length);
                return true;
        },
        //this should not be needed.
        checkClipsReady : function(){
                //js_log('checkClipsReady');
                var is_ready=true;        
-                 for(var i=0; i < $mw.player_list.length; i++){
-                         if( $j('#'+$mw.player_list[i]).length !=0){
-                                 var cur_vid =  $j('#'+$mw.player_list[i]).get(0);               
+                 for(var i=0; i < mw.player_list.length; i++){
+                         if( $j('#'+mw.player_list[i]).length !=0){
+                                 var cur_vid =  $j('#'+mw.player_list[i]).get(0);                
                                is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
                                if( !is_ready && cur_vid.load_error ){ 
                                        is_ready=true;
@@ -855,15 +852,15 @@ embedVideo.prototype = {
                //set the skin name from the class  
                var     sn = element.getAttribute('class');
                if( sn && sn != ''){
-                       for(var n=0;n< $mw.valid_skins.length;n++){ 
-                               if( sn.indexOf($mw.valid_skins[n]) !== -1){
-                                       this.skin_name = $mw.valid_skins[n];
+                       for(var n=0;n< mw.valid_skins.length;n++){ 
+                               if( sn.indexOf(mw.valid_skins[n]) !== -1){
+                                       this.skin_name = mw.valid_skins[n];
                                }
                        }
                }
                //set the default if unset: 
                if(!this.skin_name)
-                       this.skin_name = $mw.conf.skin_name;
+                       this.skin_name = mw.conf.skin_name;
                
                //make sure startOffset is cast as an int                  
                if( this.startOffset && this.startOffset.split(':').length >= 2)
@@ -878,7 +875,7 @@ embedVideo.prototype = {
                js_log("duration is: " +  this.duration);
                
                //get defaults          
-               var dwh = $mw.conf['video_size'].split('x');
+               var dwh = mw.conf['video_size'].split('x');
                this.width = element.style.width ? element.style.width : dwh[0];                
                if( element.tagName == 'AUDIO' ){
                        this.height = element.style.height ? element.style.height : 0;
@@ -1189,7 +1186,7 @@ embedVideo.prototype = {
                        };
                        do_api_req({
                                'data':reqObj, 
-                               'url': commons_api_url
+                               'url': mw.commons_api_url
                        },  function(data){                         
                            //empty the videos:                     
                            $j('#dc_'+ _this.id + ' .related_vids ul').html(' ');
@@ -2457,9 +2454,9 @@ mediaPlayers.prototype =
                }
                if( selected_player )
                {
-                       for(var i=0; i < $mw.player_list.length; i++)
+                       for(var i=0; i < mw.player_list.length; i++)
                        {
-                               var embed = $j('#'+$mw.player_list[i]).get(0);
+                               var embed = $j('#'+mw.player_list[i]).get(0);
                                if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type))
                                {
                                        embed.selectPlayer(selected_player);
index 69b830c..70baf9c 100644 (file)
@@ -157,13 +157,14 @@ var nativeEmbed = {
                }
        },
        monitor : function(){           
-               this.getVID(); //make shure we have .vid obj
+               this.getVID(); //make sure we have .vid obj
                if(!this.vid){
                        js_log('could not find video embed: '+this.id + ' stop monitor');
                        this.stopMonitor();                     
                        return false;
                }               
-               //don't update status if we are not the current clip (playlist leekage?) .. should move to playlist overwite of monitor? 
+               //don't update status if we are not the current clip 
+               //(playlist leakage?) .. should move to playlist overwrite of monitor? 
                if(this.pc){
                        if(this.pc.pp.cur_clip.id != this.pc.id)
                                return true;
index 506f774..82581f5 100644 (file)
@@ -246,4 +246,4 @@ loadGM({
                }       
        }
        
-})(window.$mw);
+})(window.mw);
index 917ca37..a901962 100644 (file)
@@ -27,15 +27,14 @@ mvTextInterface.prototype = {
                //init a new availableTracks obj:
                this.availableTracks = new Array();
                //set the parent embed object:
-               this.pe=parentEmbed;
+               this.pe = parentEmbed;
                //parse roe if not already done:
-               this.getTimedTextTracks();
+               this.getTextTracks();
        },
        //@@todo separate out data loader & data display
-       getTimedTextTracks:function(){
+       getTextTracks:function(){
                //js_log("load timed text from roe: "+ this.pe.roe);
                var _this = this;
-               var apiUrl = mwGetLocalApiUrl();
                //if roe not yet loaded do load it:
                if(this.pe.roe || _this.pe.wikiTitleKey ){
                        if(!this.pe.media_element.addedROEData){
@@ -46,35 +45,9 @@ mvTextInterface.prototype = {
                                                _this.pe.media_element.addROE(data);
                                                _this.getParseTimedText_rowReady();
                                        });
-                               }else if( _this.pe.wikiTitleKey ){
+                               }else if( _this.pe.wikiTitleKey ){                              
                                        //check for a clear namespace key:
-                                       var timedtext_ns = 102;                                 
-                                       if( wgNamespaceIds && wgNamespaceIds['timedtext']){
-                                               timedtext_ns = wgNamespaceIds['timedtext'];
-                                       }
-                                       do_api_req({
-                                                       'url' : apiUrl,
-                                                       'data': {
-                                                               'list' : 'allpages',
-                                                               'apprefix' : _this.pe.wikiTitleKey,
-                                                               'apnamespace' : timedtext_ns,
-                                                               'prop':'revisions'
-                                                       }
-                                       }, function( subData ) {
-                                               if(     subData.error && subData.error.code == 'apunknown_apnamespace'){
-                                                       do_api_req({
-                                                               'url' : apiUrl,
-                                                               'data': {
-                                                                       'list' : 'allpages',
-                                                                       'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey,
-                                                               }
-                                                       }, function( subData ) {
-                                                               _this.doProcSubPages( subData, wgServer + wgScriptPath);
-                                                       });
-                                               }else{
-                                                       _this.doProcSubPages( subData, wgServer + wgScriptPath);
-                                               }
-                                       });
+                                       _this.getTextTracksWikiTitle()                                  
                                }
                        }else{
                                js_log('row data ready (no roe request)');
@@ -88,6 +61,38 @@ mvTextInterface.prototype = {
                        }
                }
        },
+       getTextTracksWikiTitle:function(){
+               var apiUrl = mw.getLocalApiUrl();
+               var _this = this;
+               
+               var timedtext_ns = 102;                                 
+               if( typeof wgNamespaceIds != 'undefined' && wgNamespaceIds['timedtext']){
+                       timedtext_ns = wgNamespaceIds['timedtext'];
+               }
+               do_api_req({
+                               'url' : apiUrl,
+                               'data': {
+                                       'list' : 'allpages',
+                                       'apprefix' : _this.pe.wikiTitleKey,
+                                       'apnamespace' : timedtext_ns,
+                                       'prop':'revisions'
+                               }
+               }, function( subData ) {
+                       if(     subData.error && subData.error.code == 'apunknown_apnamespace'){
+                               do_api_req({
+                                       'url' : apiUrl,
+                                       'data': {
+                                               'list' : 'allpages',
+                                               'apprefix' : 'TimedText:' + _this.pe.wikiTitleKey,
+                                       }
+                               }, function( subData ) {
+                                       _this.doProcSubPages( subData, wgServer + wgScriptPath);
+                               });
+                       }else{
+                               _this.doProcSubPages( subData, wgServer + wgScriptPath);
+                       }
+               });
+       },
        doProcSubPages: function( subData, hostPath ){
                var _this = this;
                //look for text tracks:
@@ -159,7 +164,7 @@ mvTextInterface.prototype = {
                                js_log('image is shared checking commons for subtitles');
                                //found shared repo assume commons: 
                                do_api_req({
-                                       'url': 'http://commons.wikimedia.org/w/api.php',
+                                       'url': mw.commons_api_url,
                                        'data':{
                                                'list' : 'allpages',
                                                'apprefix' : _this.pe.wikiTitleKey,
index 4303fee..1a24e94 100644 (file)
@@ -41,6 +41,7 @@ function mvGetClassPath(k){
                return false;
        }
 }
+
 if( typeof mvCssPaths == 'undefined' )
        mvCssPaths = {};
 
@@ -76,9 +77,9 @@ lcPaths({
        "$j.Jcrop"                      : "libClipEdit/Jcrop/js/jquery.Jcrop.js",
        "$j.fn.simpleUploadForm" : "libAddMedia/simpleUploadForm.js",
        
-       "$mw.proxy"             : "libMwApi/mw.proxy.js",
+       "mw.proxy"              : "libMwApi/mw.proxy.js",
        
-       "$mw.testLang"  :  "tests/testLang.js",
+       "mw.testLang"   :  "tests/testLang.js",
        
        "ctrlBuilder"   : "skins/ctrlBuilder.js",
        "kskinConfig"   : "skins/kskin/kskin.js",
@@ -191,19 +192,19 @@ parseUri.options = {
 // For use when mv_embed with script-loader is in the root MediaWiki path
 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
 
-//The global scope: will be depreciated once we get everything into $mw
+//The global scope: will be depreciated once we get everything into mw
 var _global = this; 
 
 /*
-* setup the empty global $mw object
+* setup the empty global mw object
 * will ensure all our functions and variables are properly namespaced
 * reducing chance of conflicts
 */
-if(!window['$mw']){
-       window['$mw'] = {}
+if(!window['mw']){
+       window['mw'] = {}
 }
 
-//@@todo move these into $mw
+//@@todo move these into mw
 var global_req_cb = new Array(); // The global request callback array
 
 // Get the mv_embed location if it has not been set
@@ -211,10 +212,10 @@ if( !mv_embed_path ) {
        var mv_embed_path = getMvEmbedPath();
 }
 /**
-* The global $mw object:
+* The global mw object:
 *
 * Any global functions/classes that are not jQuery plugins should make
-* there way into the $mw namespace
+* there way into the mw namespace
 */
 (function( $ ) {
        /*
@@ -230,6 +231,10 @@ if( !mv_embed_path ) {
        // the version of mwEmbed
        $.version = '1.0r21';
        
+       //special case of commons api url 
+       //(used for default subtitles server for media with a "wikiTitleKey" atm)
+       //(@@todo eventually we should have  wikiTitleKey be namespaced with interwiki ns
+       $.commons_api_url = 'http://commons.wikimedia.org/w/api.php';
        /*
        * some global containers flags 
        */
@@ -240,7 +245,7 @@ if( !mv_embed_path ) {
        $.req_cb = new Array() // The global request callback array     
         
        /*
-       * Language classes $mw.lang
+       * 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
@@ -602,9 +607,9 @@ if( !mv_embed_path ) {
 
                                // ~ probably a better algorithm out there / should mirror php parser flow ~
                                //       (we are already running white-space issues ie php parse strips whitespace differently)
+                               // or at least expose something similar to: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
                                
                                // ... but I am having fun with recursion so here it is...
-                               // or at least mirror: http://www.mediawiki.org/wiki/Extension:Page_Object_Model
                                function rdpp ( txt , cn){                              
                                        var node = {};                                  
                                        //inspect each char
@@ -649,8 +654,7 @@ if( !mv_embed_path ) {
                                                tObj["name"] = tname.split(':').shift();
                                                tObj["arg"] = tname.split(':').pop();
                                        }
-
-                                       //js_log("TNAME::" + tObj["name"] + ' from:: ' + ts);                                           
+                                                                               
                                        var pSet = ts.split('\|');
                                        pSet.splice(0,1);                                       
                                        if( pSet.length ){
@@ -780,21 +784,31 @@ if( !mv_embed_path ) {
                //return the parserObj
                return new parseObj( wikiText, opt) ;
        }
-       
-})(window.$mw);
+               
+       /* 
+       * API and request functions
+       */
+       $.getLocalApiUrl = function() {
+               if ( typeof wgServer != 'undefined' && typeof wgScriptPath  != 'undefined') {
+                       return wgServer + wgScriptPath + '/api.php';
+               }
+               return false;
+       }
+               
+})(window.mw);
 
 //load in js2 stopgap into proper location: 
 if( typeof gMsg != 'undefined'){
-       $mw.lang.loadGM( gMsg )
+       mw.lang.loadGM( gMsg )
 }
 
 //setup legacy global shortcuts:
-var loadGM = $mw.lang.loadGM;
-var loadRS = $mw.lang.loadRS;
-var gM = $mw.lang.gM;
+var loadGM = mw.lang.loadGM;
+var loadRS = mw.lang.loadRS;
+var gM = mw.lang.gM;
 
 // All default messages in [English] should be overwritten by the CMS language message system.
-$mw.lang.loadGM({
+mw.lang.loadGM({
        "mwe-loading_txt" : "Loading ...",
        "mwe-size-gigabytes" : "$1 GB",
        "mwe-size-megabytes" : "$1 MB",
@@ -1008,13 +1022,13 @@ var mvJsLoader = {
         * checks for jQuery and adds the $j noConflict var
         */
        jQueryCheck: function( callback ) {
-               //js_log( 'jQueryCheck::' );
+               //js_log( 'jQueryCheck::' + this.jQuerySetupFlag);
                var _this = this;
                // Skip stuff if $j is already loaded:
                if( _global['$j'] ){
                        callback(); //call the callback now
                        callback=null;
-                       // Check if we have jquery-ui css loaded and assigned skin globals
+                       // This is tricky because js2stopgap registers $j without doing the "setup" 
                        if( _this.jQuerySetupFlag )
                                return ;
                }               
@@ -1031,13 +1045,13 @@ var mvJsLoader = {
                                // Setup our global settings using the (jQuery helper)
 
                                // Set up the skin path
-                               _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' + $mw.conf['jui_skin'] + '/';
-                               _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/images/';
+                               _global['mv_jquery_skin_path'] = mv_embed_path + 'jquery/jquery.ui/themes/' + mw.conf['jui_skin'] + '/';
+                               _global['mv_skin_img_path'] = mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/images/';
                                _global['mv_default_thumb_url'] = mv_skin_img_path + 'vid_default_thumb.jpg';                   
 
                                // 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/' + $mw.conf['skin_name'] + '/styles.css' );
+                               loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
 
                                // Set up AJAX to not send dynamic URLs for loading scripts (we control that with
                                // the scriptLoader)
@@ -1050,6 +1064,7 @@ var mvJsLoader = {
                                mv_jqueryBindings();
                                _this.jQuerySetupFlag = true;
                                
+                               //js_log('should run callback: ' + callback);
                                // Run the callback if not already run above
                                if( callback ) {
                                        callback();
@@ -1078,9 +1093,9 @@ var mvJsLoader = {
                        ];
                        
                        //add any requested skins (supports multiple skins per single page)
-                       if( $mw.skin_list ){
-                               for(var i in $mw.skin_list  ){
-                                       depReq[0].push( $mw.skin_list[i] + 'Config' );
+                       if( mw.skin_list ){
+                               for(var i in mw.skin_list  ){
+                                       depReq[0].push( mw.skin_list[i] + 'Config' );
                                }
                        }                               
 
@@ -1124,8 +1139,8 @@ var mvJsLoader = {
 function mwLoad( loadSet, callback ) {
        mvJsLoader.doLoad( loadSet, callback );
 }
-//$mw.shortcut
-$mw.load = mwLoad;
+//mw.shortcut
+mw.load = mwLoad;
 
 // Load an external JS file. Similar to jquery .require plugin,
 // but checks for object availability rather than load state.
@@ -1139,11 +1154,11 @@ $mw.load = mwLoad;
  * $j(document).ready( function(){ */
 function mwdomReady( force ) {
        js_log( 'f:mwdomReady:' );
-       if( !force && $mw.init_done ) {
+       if( !force && mw.init_done ) {
                js_log( "mw done, do nothing..." );
                return false;
        }
-       $mw.init_done = true;
+       mw.init_done = true;
        // Handle the execution of queued functions with jQuery "ready"
 
        // Check if this page has a video, audio or playlist tag
@@ -1159,9 +1174,9 @@ function mwdomReady( force ) {
                                if(e[j][k] && typeof( e[j][k]) == 'object'){
                                        var     sn = e[j][k].getAttribute('class');                             
                                        if( sn && sn != ''){
-                                               for(var n=0;n< $mw.valid_skins.length;n++){ 
-                                                       if( sn.indexOf($mw.valid_skins[n]) !== -1){
-                                                               $mw.skin_list.push( $mw.valid_skins[n] );
+                                               for(var n=0;n< mw.valid_skins.length;n++){ 
+                                                       if( sn.indexOf(mw.valid_skins[n]) !== -1){
+                                                               mw.skin_list.push( mw.valid_skins[n] );
                                                        }
                                                }
                                        }
@@ -1183,15 +1198,14 @@ function mwdomReady( force ) {
 //js2AddOnloadHook: ensure jQuery and the DOM are ready
 function js2AddOnloadHook( func ) {    
        //js_log('js2AddOnloadHook:: jquery:' +func);   
-       //check for jQuery then add the load event (to run after video tag rewrites (if present) 
-       mvJsLoader.jQueryCheck( function() {
-               if( mvJsLoader.doneReadyEvents ) {
-                       //js_log('run queued event: ' + func);  
-                       func();
-               } else {                
-                       mvJsLoader.addLoadEvent( func );
-               }
-       });
+       // If we are ready run directly else add load event: 
+       if( mvJsLoader.doneReadyEvents ) {
+               js_log('run queued event: ' + func);    
+               func();
+       } else {
+               js_log('add to load event: ' + func);           
+               mvJsLoader.addLoadEvent( func );
+       }
 }
 // Deprecated mwAddOnloadHook in favour of js2 naming (for clear separation of js2 code from old MW code
 var mwAddOnloadHook = js2AddOnloadHook;
@@ -1244,7 +1258,7 @@ function mv_jqueryBindings() {
                        if( this.selector ){    
                                var _this = this;       
                                //load the dragger and "setup"
-                               $mw.load( ['$j.fn.dragDropFile'], function(){
+                               mw.load( ['$j.fn.dragDropFile'], function(){
                                        $j(_this.selector).dragDropFile();                                                      
                                }); 
                        }                                        
@@ -1257,18 +1271,18 @@ function mv_jqueryBindings() {
                $.apiProxy = function( mode, pConf, callback ){
                        js_log('do apiProxy setup');                    
                        mvJsLoader.doLoad( [
-                               '$mw.proxy',
+                               'mw.proxy',
                                'JSON'
                        ], function(){                          
                                //do the proxy setup or 
                                if( mode == 'client'){
                                        //just do the setup (no callbcak for client setup) 
-                                       $mw.proxy.client( pConf );
+                                       mw.proxy.client( pConf );
                                        if( callback )
                                                callback();
                                }else if( mode=='server' ){
                                        //do the request with the callback
-                                       $mw.proxy.server( pConf , callback );
+                                       mw.proxy.server( pConf , callback );
                                }
                        });     
                }
@@ -1306,7 +1320,7 @@ function mv_jqueryBindings() {
 
                        // Load the mv_embed_base skin:
                        loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
-                       loadExternalCss( mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/styles.css' );
+                       loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
                        // Load all the required libs:
                        mvJsLoader.jQueryCheck( function() {
                                // Load with staged dependencies (for IE that does not execute in order)
@@ -1340,7 +1354,7 @@ function mv_jqueryBindings() {
                        iObj['target_sequence_container'] = this.selector;
                        // 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/' + $mw.conf['skin_name'] + '/mv_sequence.css' );
+                       loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/mv_sequence.css' );
                        // Make sure we have the required mv_embed libs (they are not loaded when no video
                        // element is on the page)
                        mvJsLoader.embedVideoCheck( function() {
@@ -1386,7 +1400,7 @@ function mv_jqueryBindings() {
                                iObj = {};
                        // Add the base theme CSS:
                        loadExternalCss( mv_jquery_skin_path + 'jquery-ui-1.7.1.custom.css' );
-                       loadExternalCss( mv_embed_path + 'skins/' + $mw.conf['skin_name'] + '/styles.css' );
+                       loadExternalCss( mv_embed_path + 'skins/' + mw.conf['skin_name'] + '/styles.css' );
 
                        // Check if we already have Firefogg loaded (the call just updates the element's
                        // properties)
@@ -1594,9 +1608,9 @@ function mv_jqueryBindings() {
                }
        
                $.mwProxy = function( apiConf ){
-                       mvJsLoader.doLoad( ['$mw.apiProxy'], 
+                       mvJsLoader.doLoad( ['mw.apiProxy'], 
                        function(){
-                               $mw.apiProxy( apiConf );
+                               mw.apiProxy( apiConf );
                        });
                }
        })(jQuery);
@@ -1729,10 +1743,10 @@ function do_api_req( options, callback ) {
        }
        // Generate the URL if it's missing
        if( typeof options.url == 'undefined' || !options.url ) {
-               if( !wgServer || ! wgScriptPath ) {
+               if( typeof wgServer == 'undefined' ) {
                        return js_error('Error: no api url for api request');
                }
-               options.url = mwGetLocalApiUrl();
+               options.url = mw.getLocalApiUrl();
        }
        if( typeof options.data == 'undefined' )
                options.data = {};
@@ -1745,10 +1759,10 @@ function do_api_req( options, callback ) {
                options.data['action'] = 'query';
 
        // js_log('do api req: ' + options.url +'?' + jQuery.param(options.data) );     
-       if( options.url == 'proxy' && $mw.proxy){
-               //assume the proxy is already "setup" since $mw.proxy is defined.
+       if( options.url == 'proxy' && mw.proxy){
+               //assume the proxy is already "setup" since mw.proxy is defined.
                // @@todo we probably integrate that setup into the api call
-               $mw.proxy.doRequest( options.data,  callback);  
+               mw.proxy.doRequest( options.data,  callback);   
        }else if( parseUri( document.URL ).host == parseUri( options.url ).host ) {
                // Local request: do API request directly
                $j.ajax({
@@ -1777,18 +1791,12 @@ function do_api_req( options, callback ) {
                        req_url += paramAnd + encodeURIComponent( i ) + '=' + encodeURIComponent( options.data[i] );
                        paramAnd = '&';
                }
-               var fname = 'mycpfn_' + ( $mw.cb_count++ );
+               var fname = 'mycpfn_' + ( mw.cb_count++ );
                _global[ fname ] = callback;
                req_url += '&' + options.jsonCB + '=' + fname;
                loadExternalJs( req_url );
        }
 }
-function mwGetLocalApiUrl( url ) {
-       if ( typeof wgServer != 'undefined' && typeof wgScriptPath  != 'undefined') {
-               return wgServer + wgScriptPath + '/api.php';
-       }
-       return false;
-}
 // Do a "normal" request
 function do_request( req_url, callback ) {
        js_log( 'do_request::req_url:' + req_url + ' != ' +  parseUri( req_url ).host );
@@ -1950,7 +1958,7 @@ function getMwReqParam() {
                req_param += 'urid=' + urid;
        }else{
                // Otherwise, just use the mv_embed version
-               req_param += 'urid=' + $mw.version;
+               req_param += 'urid=' + mw.version;
        }
        //add the lang param:
        var langKey = parseUri( mv_embed_url ).queryKey['uselang'];
@@ -2017,8 +2025,8 @@ if ( typeof DOMParser == "undefined" ) {
 */
 function js_log( string ) {
        // Add any prepend debug strings if necessary (used for cross browser)
-       if( $mw.conf['debug_pre'] )
-               string = $mw.conf['debug_pre']+ string;
+       if( mw.conf['debug_pre'] )
+               string = mw.conf['debug_pre']+ string;
                        
        if( window.console ) {                          
                window.console.log( string );
index 2e42750..8067ee4 100644 (file)
@@ -180,7 +180,7 @@ ctrlBuilder.prototype = {
                        start: function(event, ui){
                                var id = (embedObj.pc!=null)?embedObj.pc.pp.id:embedObj.id;
                                embedObj.userSlide=true;
-                               $j(id + ' .play-btn-large').fadeOut('fast');
+                               $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]);
@@ -201,7 +201,7 @@ ctrlBuilder.prototype = {
                        },
                        change:function(event, ui){
                                //only run the onChange event if done by a user slide:
-                               if(embedObj.userSlide){
+                               if( embedObj.userSlide ){
                                        embedObj.userSlide=false;
                                        embedObj.seeking=true;
                                        //stop the monitor timer (if we can)
@@ -220,7 +220,7 @@ ctrlBuilder.prototype = {
                //up the z-index of the default status indicator:
                $tp.find('.play_head .ui-slider-handle').css('z-index', 4);
                $tp.find('.play_head .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 highlighter)
                $tp.find('.play_head').append( this.getMvBufferHtml() );
                        
                $opt = $j('#mv_vid_options_'+embedObj.id);
index e6ebe53..22d9149 100644 (file)
@@ -4,7 +4,7 @@
 
 var kskinConfig = {
        pClass: 'k-player',
-       //display time progres
+       //display time progress
        long_time_disp: false,
        body_options: false,
        volume_layout: 'horizontal',
@@ -38,11 +38,11 @@ var kskinConfig = {
                                                                                '<a href="#" title="' + gM( 'mwe-' + mk ) +'">' + gM( 'mwe-' + mk ) +'</a></li>';
                                                        }                                                       
                                                o+='</ul>' +
-                                               //we have to substract the width of the k-menu-bar
+                                               // We have to subtract the width of the k-menu-bar
                                                '<div class="k-menu-screens" style="width:' + ( embedObj.playerPixelWidth() -75) +
                                                        'px; height:' + (embedObj.playerPixelHeight() - ctrlBuilder.height) + 'px;">';
                                                
-                                               //output menu item containers: 
+                                               // Output menu item containers: 
                                                for(i=0; i < ctrlObj.menu_items.length; i++){                                                   
                                                        o+= '<div class="menu-screen menu-' + ctrlObj.menu_items[i] + '"></div>';
                                                }                                                                                                                                       
@@ -57,46 +57,49 @@ var kskinConfig = {
                var _this = this;
                var $tp=$j('#' + embedObj.id);
                
-               //adds options and bindings: (we do this onClick for faster vidoe tag startup times)  
+               // Adds options and bindings: (we do this onClick )  
                var addMvOptions = function(){
-                       if($j('#' + embedObj.id + ' .k-menu').length != 0 )
+                       if( $j('#' + embedObj.id + ' .k-menu').length != 0 )
                                return false;
                                
-                       $j('#' + embedObj.id + ' .' + _this.pClass).prepend( _this.components['mv_embedded_options'].o( $tp.get(0).ctrlBuilder ));
+                       $j('#' + embedObj.id + ' .' + _this.pClass).prepend(
+                               _this.components['mv_embedded_options'].o( $tp.get(0).ctrlBuilder )
+                       );
                        
-                       //by default its hidden:
+                       // By default its hidden:
                        $tp.find('.k-menu').hide();
                        
-                       //output menu-items: 
+                       // Output menu-items: 
                        for(i=0; i < _this.menu_items.length ; i++){                            
                        $tp.find('.k-' +  _this.menu_items[i] + '-btn').click(function(){ 
                                var mk = $j(this).attr('rel');
                                $target = $j('#' + embedObj.id  + ' .menu-'+mk).hide();                         
-                               //gennerate the menu html not already done:
+                               // Generate the menu html not already done:
                                if( $target.children().length == 0 ){
                                                //call the function show{Menuitem} with target:                         
                                                embedObj['show' + mk.charAt(0).toUpperCase() + mk.substring(1)](
                                                        $j('#' + embedObj.id + ' .menu-'+mk)
                                                );
                                }                                                       
-                               //slide out the others 
+                               // Slide out the others 
                                 $j('#' + embedObj.id  + ' .menu-screen').hide();
                                 $target.fadeIn("fast");
                                        //don't follow the # link                                                               
                            return false;
                                });     
                        }                       
-               }               
-               //options menu display:                 
+               }  
+                               
+               // Options menu display:                        
                $tp.find('.k-options').click(function(){                           
                        if($j('#' + embedObj.id + ' .k-menu').length == 0 ){
                                //stop the player if it does not support overlays: 
                                if(!embedObj.supports['overlays'])
                                        $tp.get(0).stop();
-                       //add the options                                       
+                       // Add the options                                      
                                addMvOptions();
                        }
-                       //set up the text and menu:                                                                     
+                       // Set up the text and menu:                                                                    
                        var $ktxt = $j(this);
                        var $kmenu = $tp.find('.k-menu');
                        if( $kmenu.is(':visible') ){
index 5264d47..4c8b402 100644 (file)
@@ -560,7 +560,7 @@ ui-widget-overlay{
        font-size:20px;
        margin:4px 0px 4px 11px;
        padding:0;
-       color:#F0F0F0;
+       color:#FFF;
        font-family:arial,sans-serif;
 }
 
index 5053ade..0c1797c 100644 (file)
@@ -7,9 +7,9 @@ loadGM({
        "mwe-upload-multi" : "Upload {{PLURAL:$1|file|files}}"  
 });
 
-$mw.lang.loadRS({
+mw.lang.loadRS({
        'PLURAL' : { "one" : 1 }        
 });
 
 //define a class by the name of this file:  
-$mw.testLang = {};
\ No newline at end of file
+mw.testLang = {};
\ No newline at end of file
index a53416a..aeb3b01 100644 (file)
@@ -36,7 +36,7 @@ function doPageSpecificRewrite() {
        if(wgPageName.indexOf("TimedText") === 0){              
                load_mv_embed(function(){
                        // Load with mw loader to get localized interface:
-                       $mw.load( ['mvTimeTextEdit'],function(){
+                       mw.load( ['mvTimeTextEdit'],function(){
                                //could run init here (but mvTimeTextEdit included onLoad actions)
                        });
                });
@@ -184,7 +184,7 @@ function mwGetReqArgs(){
 }
 function load_mv_embed( callback ) {
        // Inject mv_embed if needed
-       if( typeof $mw == 'undefined' ) {       
+       if( typeof mw == 'undefined' ) {        
                if( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && mwUseScriptLoader){
                        var rurl = mwEmbedHostPath + '/mwEmbed/jsScriptLoader.php?class=mv_embed';
                        // Add jQuery too if we need it: 
@@ -202,7 +202,7 @@ function load_mv_embed( callback ) {
 }
 
 function check_for_mv_embed( callback ) {
-       if( typeof $mw == 'undefined' ) {
+       if( typeof mw == 'undefined' ) {
                setTimeout( function(){
                        check_for_mv_embed( callback );
                }, 25 );