Simplify by using mw.util.getUrl() instead of mw.util.wikiScript()
[lhc/web/wiklou.git] / resources / src / mediawiki / page / image-pagination.js
index 49a51df..02bc1de 100644 (file)
@@ -26,7 +26,7 @@
                        return $.Deferred().resolve( cache[ url ] ).promise();
                }
 
-               // @todo Don't fetch the entire page. Ideally we'd only fetch the content portion or the data
+               // TODO Don't fetch the entire page. Ideally we'd only fetch the content portion or the data
                // (thumbnail urls) and update the interface manually.
                jqXhr = $.ajax( url ).then( function ( data ) {
                        return $( data ).find( 'table.multipageimage' ).contents();
 
        function bindPageNavigation( $container ) {
                $container.find( '.multipageimagenavbox' ).one( 'click', 'a', function ( e ) {
-                       var page, uri;
+                       var page, url;
 
                        // Generate the same URL on client side as the one generated in ImagePage::openShowImage.
                        // We avoid using the URL in the link directly since it could have been manipulated (bug 66608)
                        page = Number( mw.util.getParamValue( 'page', this.href ) );
-                       uri = new mw.Uri( mw.util.wikiScript() )
-                               .extend( { title: mw.config.get( 'wgPageName' ), page: page } )
-                               .toString();
+                       url = mw.util.getUrl( mw.config.get( 'wgPageName' ), { page: page } );
 
-                       switchPage( uri );
+                       switchPage( url );
                        e.preventDefault();
                } );
 
        }
 
        $( function () {
-               if ( mw.config.get( 'wgNamespaceNumber' ) !== 6 ) {
+               if ( mw.config.get( 'wgCanonicalNamespace' ) !== 'File' ) {
                        return;
                }
                $multipageimage = $( 'table.multipageimage' );