* added in language mapping for commons upload form language hack
authorMichael Dale <dale@users.mediawiki.org>
Fri, 13 Nov 2009 15:34:01 +0000 (15:34 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Fri, 13 Nov 2009 15:34:01 +0000 (15:34 +0000)
* fixed issue of mwUploadHelper not being ready by moving init call past define of mwUploadHelper
* moved parseUri to mw.parseUri
* fixed jCrop css loading
* other minor fixes realted to style.php and regEx

16 files changed:
js2/mwEmbed/libAddMedia/remoteSearchDriver.js
js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
js2/mwEmbed/libClipEdit/mvClipEdit.js
js2/mwEmbed/libEmbedVideo/embedVideo.js
js2/mwEmbed/libEmbedVideo/javaEmbed.js
js2/mwEmbed/libEmbedVideo/vlcEmbed.js
js2/mwEmbed/libMwApi/mw.proxy.js
js2/mwEmbed/libSequencer/mvPlayList.js
js2/mwEmbed/libSequencer/mvSequencer.js
js2/mwEmbed/libTimedText/mvTextInterface.js
js2/mwEmbed/libTimedText/mvTimeTextEdit.js
js2/mwEmbed/mv_embed.js
js2/mwEmbed/php/noMediaWikiConfig.php
js2/remoteMwEmbed.js
js2/uploadPage.js

index e9f5355..4b229a6 100644 (file)
@@ -418,7 +418,7 @@ remoteSearchDriver.prototype = {
                        } else {
                                var keyCheck = jL;
                        }
-                       if ( parseUri( license_url ).path.indexOf( '/' + keyCheck + '/' ) != - 1 ) {
+                       if ( mw.parseUri( license_url ).path.indexOf( '/' + keyCheck + '/' ) != - 1 ) {
                                return this.getLicenceFromKey( jL , license_url );
                        }
                };
@@ -943,9 +943,9 @@ remoteSearchDriver.prototype = {
        },
        // @@todo we could load the id with the content provider id to find the object faster...
        getResourceFromId:function( rid ) {
-               js_log('getResourceFromId:' + rid );
+               //js_log('getResourceFromId:' + rid );
                // strip out /res/ if preset:
-               rid = rid.replace( /res_/ , '' );
+               rid = rid.replace( /res_/, '' );
                // js_log("looking at: " + rid);
                p = rid.split( '__' );
                var cp_id = p[0];
@@ -1307,7 +1307,7 @@ remoteSearchDriver.prototype = {
                        return true;
                } else {
                        // Check if we can embed the content locally per a domain name check:
-                       var local_host = parseUri( this.local_wiki_api_url ).host;
+                       var local_host = mw.parseUri( this.local_wiki_api_url ).host;
                        if ( cp.local_domains ) {
                                for ( var i = 0; i < cp.local_domains.length; i++ ) {
                                        var ld = cp.local_domains[i];
index 7b43a6e..92bc29f 100644 (file)
@@ -67,7 +67,7 @@ baseRemoteSearch.prototype = {
                var http_host = '';
                var http_path = '';
                if ( provider_url ) {
-                       pUrl =  parseUri( provider_url );
+                       pUrl =  mw.parseUri( provider_url );
                        http_host = pUrl.protocol + '://' + pUrl.authority;
                        http_path = pUrl.directory;
                }
@@ -132,7 +132,7 @@ baseRemoteSearch.prototype = {
                                        if ( rObj[p].substr( 0, 1 ) == '/' ) {
                                                rObj[p] = http_host + rObj[p];
                                        }
-                                       if ( parseUri( rObj[i] ).host ==  rObj[p] ) {
+                                       if ( mw.parseUri( rObj[i] ).host ==  rObj[p] ) {
                                                rObj[p] = http_host + http_path + rObj[p];
                                        }
                                }
index 0b7a5f3..c320099 100644 (file)
@@ -49,7 +49,7 @@ metavidSearch.prototype = {
                        // do some metavid specific pos processing on the rObj data:
                        for ( var i in _this.resultsObj ) {
                                var rObj = _this.resultsObj[i];
-                               var proe = parseUri( rObj['roe_url'] );
+                               var proe = mw.parseUri( rObj['roe_url'] );
                                rObj['start_time'] = proe.queryKey['t'].split( '/' )[0];
                                rObj['end_time'] = proe.queryKey['t'].split( '/' )[1];
                                rObj['stream_name'] = proe.queryKey['stream_name'];
index 7ff9aff..e81ae65 100644 (file)
@@ -246,7 +246,7 @@ mvClipEdit.prototype = {
                } else {
                        // var res_page =
                        var res_src = _this.rObj.src;
-                       var res_title = parseUri( _this.rObj.src ).file;
+                       var res_title = mw.parseUri( _this.rObj.src ).file;
                }
                o +=    '<tr>' +
                                        '<td colspan="2"><b>' + gM( 'mwe-other_properties' ) + '</b></td>' +
index c6f7fa5..f0c0b8d 100644 (file)
@@ -325,7 +325,7 @@ mediaSource.prototype = {
                // Set default URLTimeEncoding if we have a time  url:
                // not ideal way to discover if content is on an oggz_chop server. 
                // should check some other way. 
-               var pUrl = parseUri ( this.src );
+               var pUrl = mw.parseUri ( this.src );
                if ( typeof pUrl['queryKey']['t'] != 'undefined' ) {
                        this['URLTimeEncoding'] = true;
                }
@@ -443,7 +443,7 @@ mediaSource.prototype = {
        parseURLDuration : function() {
                // check if we have a URLTimeEncoding: 
                if ( this.URLTimeEncoding ) {
-                       var annoURL = parseUri( this.src );
+                       var annoURL = mw.parseUri( this.src );
                        if ( annoURL.queryKey['t'] ) {
                                var times = annoURL.queryKey['t'].split( '/' );
                                this.start_ntp = times[0];
@@ -1146,16 +1146,16 @@ embedVideo.prototype = {
        },
        relatedTitleKeySearch:function() {
                var _this = this;
-               js_log( 'Switch video Relational' );
                var reqObj = {
                        'action' : 'query',
-                       'titles' : this.wikiTitleKey,
+                       //normalize the File NS (ie sometimes its present in wikiTitleKey other times not
+                       'titles' : 'File:' + this.wikiTitleKey.replace(/File:|Image:/,''),
                    'generator' : 'categories'
                };
                var req_categories = new Array();
            do_api_req( {
-                       'data'  : reqObj,
-                       'url'   : commons_api_url
+               'url'   : mw.commons_api_url,
+                       'data'  : reqObj                        
            },  function( data ) {
                        req_categories = Array();
                        if ( data.query && data.query.pages ) {
@@ -1320,7 +1320,7 @@ embedVideo.prototype = {
                js_log( 'we have annotative track:' + anno_track_url );
                // Zero out seconds (should improve cache hit rate and generally expands metadata search)
                // @@todo this could be replaced with a regExp
-               var annoURL = parseUri( anno_track_url );
+               var annoURL = mw.parseUri( anno_track_url );
                var times = annoURL.queryKey['t'].split( '/' );
                var stime_parts = times[0].split( ':' );
                var etime_parts = times[1].split( ':' );
@@ -1670,7 +1670,7 @@ embedVideo.prototype = {
 
                var embed_thumb_html;
                if ( thumbnail.substring( 0, 1 ) == '/' ) {
-                       eURL = parseUri( mv_embed_path );
+                       eURL = mw.parseUri( mv_embed_path );
                        embed_thumb_url = eURL.protocol + '://' + eURL.host + thumbnail;
                        // js_log('set from mv_embed_path:'+embed_thumb_html);
                } else {
@@ -1761,22 +1761,25 @@ embedVideo.prototype = {
        },
        showTextInterface:function() {
                var _this = this;
+               if( $j( '#metaBox_' + this.id ).is( ':visible' ) ) {
+                       $j( '#metaBox_' + this.id ).fadeOut("fast");
+               }else{
+                       $j( '#metaBox_' + this.id ).fadeIn( "fast" );
+               }
                // display the text container with loading text: 
                // @@todo support position config
                var loc = $j( this ).position();
-               if ( $j( '#metaBox_' + this.id ).length == 0 ) {
-                       var theight =  ( parseInt( this.height ) < 200 ) ? 200 : parseInt( this.height );
+               if ( $j( '#metaBox_' + this.id ).length == 0 ) {                        
+                       var theight = ( ( parseInt( this.height ) + this.ctrlBuilder.height ) < 200 ) ? 200 : ( parseInt( this.height ) + this.ctrlBuilder.height );
                        $j( this ).after( '<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;' +
                                'top:' + ( loc.top ) + 'px;' +
-                               'left:' + ( parseInt( loc.left ) + parseInt( this.width ) + 10 ) + 'px;' +
+                               'left:' + ( parseInt( loc.left ) + parseInt( this.width ) + 10) + 'px;' +
                                'height:' + theight + 'px;width:400px;' +
                                'display:none;" ' +
                                'id="metaBox_' + this.id + '">' +
                                        mv_get_loading_img() +
                                '</div>' );
-               }
-               // fade in the text display
-               $j( '#metaBox_' + this.id ).fadeIn( "fast" );
+               }               
                // check if textObj present:
                if ( typeof this.textInterface == 'undefined' ) {
                        // load the default text interface:
index bd96038..9e1fb42 100644 (file)
@@ -32,9 +32,9 @@ var javaEmbed = {
                // @@todo we should have src property in our base embed object
                var mediaSrc = this.getSrc();
                
-               if ( mediaSrc.indexOf( '://' ) != - 1 & parseUri( document.URL ).host !=  parseUri( mediaSrc ).host ) {
-                       if ( window.cortadoDomainLocations[parseUri( mediaSrc ).host] ) {
-                               applet_loc =  window.cortadoDomainLocations[parseUri( mediaSrc ).host];
+               if ( mediaSrc.indexOf( '://' ) != - 1 & mw.parseUri( document.URL ).host !=  mw.parseUri( mediaSrc ).host ) {
+                       if ( window.cortadoDomainLocations[mw.parseUri( mediaSrc ).host] ) {
+                               applet_loc =  window.cortadoDomainLocations[mw.parseUri( mediaSrc ).host];
                        } else {
                                applet_loc  = 'http://theora.org/cortado.jar';
                        }
index 8ebda9d..71c4b26 100644 (file)
@@ -88,6 +88,7 @@ var vlcEmbed = {
        },
        // disable local seeking (while we don't know what we have avaliable)
        doSeek : function( perc ) {
+               this.getVLC();
                if ( this.supportsURLTimeEncoding() ) {
                        this.parent_doSeek( perc );
                } else if ( this.vlc ) {
index 81b80b7..e513b5b 100644 (file)
@@ -67,7 +67,7 @@ loadGM( {
                        $.proxy.client_frame_path =  wgScriptPath + '/js2/mwEmbed/libMwApi/NestedCallbackIframe.html';
                }
                                
-               if ( parseUri( $.proxy.server_frame ).host ==  parseUri( document.URL ).host ) {
+               if ( mw.parseUri( $.proxy.server_frame ).host ==  mw.parseUri( document.URL ).host ) {
                        js_log( "Error: why are you trying to proxy yourself? " );
                        return false;
                }
@@ -78,7 +78,7 @@ loadGM( {
        /* setup a iframe request hash */
        $.proxy.doFrameProxy = function( reqObj ) {
                var hashPack = {
-                       'cd': parseUri( document.URL ).host,
+                       'cd': mw.parseUri( document.URL ).host,
                        'cfp': $.proxy.client_frame_path,
                        'req': reqObj
                }
@@ -114,7 +114,7 @@ loadGM( {
                btn[ gM( 'mwe-cancel' ) ] = function() {
                        $j.closeLoaderDialog();
                }
-               var pUri =  parseUri( $.proxy.server_frame );
+               var pUri =  mw.parseUri( $.proxy.server_frame );
                // this is sort of a temporary hack if we change the MediaWiki:ApiProxy key
                // we will have to deal with that here as well: 
                var login_url = pUri.protocol + '://' + pUri.host +
@@ -165,7 +165,7 @@ loadGM( {
                $j( 'body' ).html( 'proxy setup' );
                
                // read the anchor action from the requesting url
-               var jmsg = unescape( parseUri( document.URL ).anchor );
+               var jmsg = unescape( mw.parseUri( document.URL ).anchor );
                try {
                        var aObj = JSON.parse( jmsg );
                } catch ( e ) {
@@ -176,7 +176,7 @@ loadGM( {
                        return false;
                }
                
-               js_log( "Setup server on: "  + parseUri( document.URL ).host +
+               js_log( "Setup server on: "  + mw.parseUri( document.URL ).host +
                        ' client from: ' + aObj.cd +
                        ' to nested target: ' + aObj.cfp );
                
index 80a15e8..12f0ffd 100644 (file)
@@ -368,7 +368,7 @@ mvPlayList.prototype = {
        makeURLAbsolute:function() {
                if ( this.src ) {
                        if ( this.src.indexOf( '://' ) == - 1 ) {
-                               var purl = parseUri( document.URL );
+                               var purl = mw.parseUri( document.URL );
                                if ( this.src.charAt( 0 ) == '/' ) {
                                        this.src = purl.protocol + '://' + purl.host + this.src;
                                } else {
index 6180ad1..fe26eb5 100644 (file)
@@ -803,7 +803,7 @@ mvSequencer.prototype = {
                        this_seq.clipboard.push( cur_clip.getAttributeObj() );
                } );
                // upload clipboard to the server (if possible)
-               if ( parseUri(  document.URL ).host != parseUri( this_seq.plObj.interface_url ).host ) {
+               if ( mw.parseUri(  document.URL ).host != mw.parseUri( this_seq.plObj.interface_url ).host ) {
                        js_log( 'error: presently we can\'t copy clips across domains' );
                } else {
                        // @@we need a api entry point to store a "clipboard"
index 0e63f20..695fe4b 100644 (file)
@@ -571,7 +571,7 @@ timedTextCMML = {
                js_log( 'textCMML: loading track: ' + this.src );
 
                // :: Load transcript range ::
-               var pcurl =  parseUri( _this.getSRC() );
+               var pcurl =  mw.parseUri( _this.getSRC() );
                // check for urls without time keys:
                if ( typeof pcurl.queryKey['t'] == 'undefined' ) {
                        // in which case just get the full time req:
index 787e2f4..b85af71 100644 (file)
@@ -6,7 +6,7 @@
 if ( !mwAddMediaConfig )
   var mwAddMediaConfig = { };
 
-var mvTimedTextEdit = { };
+var mvTimeTextEdit = { };
 
 loadGM( {
   "mwe-upload-subs-file" : "Upload subtitle",
index 0b13d7a..9bc69c3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * @url http://metavid.org
  *
- * parseUri:
+ * mw.parseUri:
  * http://stevenlevithan.com/demo/parseuri/js/
  *
  * Config values: you can manually set the location of the mv_embed folder here
@@ -47,7 +47,7 @@ if ( typeof mvCssPaths == 'undefined' )
 
 function lcCssPath( cssSet ) {
        for ( var i in cssSet ) {
-               mvCssPaths[i] = mv_embed_path + cssSet[i];
+               mvCssPaths[i] = cssSet[i];
        }
 }
 
@@ -155,39 +155,7 @@ lcPaths( {
 lcCssPath( {
        '$j.Jcrop'                      : 'libClipEdit/Jcrop/css/jquery.Jcrop.css',
        '$j.fn.ColorPicker'     : 'libClipEdit/colorpicker/css/colorpicker.css'
-} )
-
-
-// parseUri 1.2.2
-// (c) Steven Levithan <stevenlevithan.com>
-// MIT License
-function parseUri (str) {
-       var     o   = parseUri.options,
-               m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
-               uri = {},
-               i   = 14;
-
-       while (i--) uri[o.key[i]] = m[i] || "";
-
-       uri[o.q.name] = {};
-       uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
-               if ($1) uri[o.q.name][$1] = $2;
-       });
-
-       return uri;
-};
-parseUri.options = {
-       strictMode: false,
-       key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
-       q:   {
-               name:   "queryKey",
-               parser: /(?:^|&)([^&=]*)=?([^&]*)/g
-       },
-       parser: {
-               strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
-               loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
-       }
-};
+})
 
 // For use when mv_embed with script-loader is in the root MediaWiki path
 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
@@ -207,10 +175,6 @@ if ( !window['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
-if ( !mv_embed_path ) {
-       var mv_embed_path = getMvEmbedPath();
-}
 /**
 * The global mw object:
 *
@@ -298,13 +262,11 @@ if ( !mv_embed_path ) {
                        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 && ms.indexOf( '[' ) === - 1 ) {
+               if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) {
                        return ms;
                }
 
@@ -326,9 +288,9 @@ if ( !mv_embed_path ) {
        $.lang.gMsgSwap = function( key , args ) {
                if ( ! gMsg[ key ] )
                        return '&lt;' + key + '&gt;';// Missing key placeholder
-               // get the messeage string:
+               // get the message string:
                var ms = gMsg[ key ];
-
+               
                // replace values
                if ( typeof args == 'object' || typeof args == 'array' ) {
                        for ( var v in args ) {
@@ -820,9 +782,48 @@ if ( !mv_embed_path ) {
                }
                return false;
        }
-               
+       
+       /**
+       * Utility Functions
+       * 
+       * parseUri 1.2.2
+       * (c) Steven Levithan <stevenlevithan.com>
+       *  MIT License
+       */      
+       $.parseUri = function (str) {
+               var     o   = $.parseUri.options,
+                       m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
+                       uri = {},
+                       i   = 14;
+       
+               while (i--) uri[o.key[i]] = m[i] || "";
+       
+               uri[o.q.name] = {};
+               uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
+                       if ($1) uri[o.q.name][$1] = $2;
+               });
+       
+               return uri;
+       };
+       $.parseUri.options = {
+               strictMode: false,
+               key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+               q:   {
+                       name:   "queryKey",
+                       parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+               },
+               parser: {
+                       strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
+                       loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
+               }
+       };                      
 } )( window.mw );
 
+// Get the mv_embed location if it has not been set
+if ( !mv_embed_path ) {
+       var mv_embed_path = getMvEmbedPath();
+}
+
 // load in js2 stopgap into proper location: 
 if ( typeof gMsg != 'undefined' ) {
        mw.lang.loadGM( gMsg )
@@ -906,7 +907,7 @@ var mvJsLoader = {
                        // Do a check for any CSS we may need and get it
                        for ( var i = 0; i < loadLibs.length; i++ ) {
                                if ( typeof mvCssPaths[ loadLibs[i] ] != 'undefined' ) {
-                                       loadExternalCss( mvCssPaths[ loadLibs[i] ] );
+                                       loadExternalCss( mv_embed_path + mvCssPaths[ loadLibs[i] ] );
                                }
                        }
 
@@ -925,9 +926,9 @@ var mvJsLoader = {
                                        }
                                }
                                // Build the url to the scriptServer striping its request parameters:
-                               var puri = parseUri( getMvEmbedURL() );
+                               var puri = mw.parseUri( getMvEmbedURL() );
                                if ( ( getMvEmbedURL().indexOf( '://' ) != - 1 )
-                                       && puri.host != parseUri( document.URL ).host )
+                                       && puri.host != mw.parseUri( document.URL ).host )
                                {
                                        var scriptPath = puri.protocol + '://' + puri.authority + puri.path;
                                } else {
@@ -1226,10 +1227,10 @@ function js2AddOnloadHook( func ) {
        // js_log('js2AddOnloadHook:: jquery:' +func);  
        // If we are ready run directly else add load event: 
        if ( mvJsLoader.doneReadyEvents ) {
-               js_log( 'run queued event: ' + func );
+               //js_log( 'run queued event: ' + func );
                func();
        } else {
-               js_log( 'add to load event: ' + func );
+               //js_log( 'add to load event: ' + func );
                mvJsLoader.addLoadEvent( func );
        }
 }
@@ -1646,7 +1647,7 @@ function mv_jqueryBindings() {
 */
 // Simple URL rewriter (could probably be refactored into an inline regular exp)
 function getURLParamReplace( url, opt ) {
-       var pSrc = parseUri( url );
+       var pSrc = mw.parseUri( url );
        if ( pSrc.protocol != '' ) {
                var new_url = pSrc.protocol + '://' + pSrc.authority + pSrc.path + '?';
        } else {
@@ -1789,7 +1790,7 @@ function do_api_req( options, callback ) {
                // 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 );
-       } else if ( parseUri( document.URL ).host == parseUri( options.url ).host ) {
+       } else if ( mw.parseUri( document.URL ).host == mw.parseUri( options.url ).host ) {
                // Local request: do API request directly
                $j.ajax( {
                        type: "POST",
@@ -1825,9 +1826,9 @@ function do_api_req( options, callback ) {
 }
 // Do a "normal" request
 function do_request( req_url, callback ) {
-       js_log( 'do_request::req_url:' + req_url + ' != ' +  parseUri( req_url ).host );
+       js_log( 'do_request::req_url:' + req_url + ' != ' +  mw.parseUri( req_url ).host );
        // If we are doing a request to the same domain or relative link, do a normal GET
-       if ( parseUri( document.URL ).host == parseUri( req_url ).host ||
+       if ( mw.parseUri( document.URL ).host == mw.parseUri( req_url ).host ||
                req_url.indexOf( '://' ) == - 1 ) // Relative url
        {
                // Do a direct request
@@ -1974,9 +1975,9 @@ function getMwReqParam() {
        var req_param = '';
        
        // If we have a URI, add it to the req
-       var urid = parseUri( mv_embed_url ).queryKey['urid']
+       var urid = mw.parseUri( mv_embed_url ).queryKey['urid']
        // If we're in debug mode, get a fresh unique request key and pass on "debug" param
-       if ( parseUri( mv_embed_url ).queryKey['debug'] == 'true' ) {
+       if ( mw.parseUri( mv_embed_url ).queryKey['debug'] == 'true' ) {
                var d = new Date();
                req_param += 'urid=' + d.getTime() + '&debug=true';
        } else if ( urid ) {
@@ -1987,7 +1988,7 @@ function getMwReqParam() {
                req_param += 'urid=' + mw.version;
        }
        // add the lang param:
-       var langKey = parseUri( mv_embed_url ).queryKey['uselang'];
+       var langKey = mw.parseUri( mv_embed_url ).queryKey['uselang'];
        if ( langKey )
                req_param += '&uselang=' + langKey;
                        
@@ -2013,7 +2014,7 @@ function getMvEmbedPath() {
        }
        // Make an absolute URL (if it's relative and we don't have an mv_embed path)
        if ( mv_embed_path.indexOf( '://' ) == - 1 ) {
-               var pURL = parseUri( document.URL );
+               var pURL = mw.parseUri( document.URL );
                if ( mv_embed_path.charAt( 0 ) == '/' ) {
                        mv_embed_path = pURL.protocol + '://' + pURL.authority + mv_embed_path;
                } else {
index a18aaf4..66ec1cc 100644 (file)
@@ -47,6 +47,9 @@ require_once( realpath( dirname( __FILE__ ) ) . '/jsAutoloadLocalClasses.php' );
 // Get the JSmin class:
 require_once( realpath( dirname( __FILE__ ) ) . '/minify/JSMin.php' );
 
+// Get the messages file:
+require_once( realpath( dirname( __FILE__ ) ) . '/languages/mwEmbed.i18n.php' );
+
 function wfDebug() {
     return false;
 }
@@ -79,8 +82,6 @@ function wfMsgGetKey( $msgKey, $na, $langKey=false ) {
     if(!$langKey){
        $langKey = $mwLanguageCode;
     }
-    // Make sure we have the messages file:
-    require_once( realpath( dirname( __FILE__ ) ) . '/languages/mwEmbed.i18n.php' );
     if ( isset( $messages[$mwLanguageCode] ) && isset( $messages[$langKey][$msgKey] ) ) {
         return $messages[$langKey][$msgKey];
     } else {
index 19f5f72..02e1a70 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * this file exposes some of the functionality of mwEmbed to wikis
+ * 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 mwRemoteVersion = '1.06';
+var mwRemoteVersion = '1.07';
 var mwUseScriptLoader = true;
 
 // setup up request Params: 
index eba8680..b90db37 100644 (file)
@@ -3,10 +3,6 @@
  * It controls the invocation of the mvUploader class based on local config.
  */
 
-js2AddOnloadHook( function() {
-       mwUploadHelper.init();
-} );
-
 var mwUploadFormTarget = '#mw-upload-form';
 // Set up the upload form bindings once all DOM manipulation is done
 var mwUploadHelper = {
@@ -128,7 +124,7 @@ var mwUploadHelper = {
                        }
                }
                // Capitalise first letter and replace spaces by underscores
-               fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace( / / g, '_' );
+               fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ).replace(/ /g, '_' );
                // Output result
                $j( '#wpDestFile' ).val( fname );
 
@@ -138,3 +134,8 @@ var mwUploadHelper = {
                } );
        }
 }
+
+
+js2AddOnloadHook( function() {
+       mwUploadHelper.init();
+} );
\ No newline at end of file