Index: trunk/extensions/ShortUrl/ShortUrl.php |
— | — | @@ -18,9 +18,11 @@ |
19 | 19 | /** |
20 | 20 | * Configuration variables |
21 | 21 | * Prefix to use for the shortened URL. mod_rewrite (or equivalent) needs to be setup |
22 | | - * to produce a shorter URL |
| 22 | + * to produce a shorter URL. See example redirect.htaccess file. |
23 | 23 | * Default is false which just uses the (not so short) URL that all Special Pages get |
24 | 24 | * Eg: http://en.wikipedia.org/wiki/Special:ShortUrl/5234 |
| 25 | + * An example value for this variable might be: |
| 26 | + * $wgShortUrlPrefix = '//en.wikipedia.org/r/'; |
25 | 27 | */ |
26 | 28 | $wgShortUrlPrefix = false; |
27 | 29 | |
— | — | @@ -53,5 +55,6 @@ |
54 | 56 | 'scripts' => 'js/ext.shortUrl.js', |
55 | 57 | 'styles' => 'css/ext.shortUrl.css', |
56 | 58 | 'localBasePath' => dirname( __FILE__ ), |
57 | | - 'remoteExtPath' => 'ShortUrl' |
| 59 | + 'remoteExtPath' => 'ShortUrl', |
| 60 | + 'dependencies' => array( 'mediawiki.Uri' ), |
58 | 61 | ); |
Index: trunk/extensions/ShortUrl/js/ext.shortUrl.js |
— | — | @@ -1,6 +1,15 @@ |
2 | 2 | jQuery( function( $ ) { |
3 | 3 | if( $( '#t-shorturl' ).length ) { |
4 | 4 | var url = $( '#t-shorturl a' ).attr( 'href' ); |
5 | | - $( '#firstHeading' ).append( $( '<div class="title-shortlink-container"></div>').append( $( '<a>' ).addClass( 'title-shortlink' ).attr( 'href', url ).text( url ) ) ); |
| 5 | + /* Add protocol for proto-relative urls */ |
| 6 | + var protoNonRelative = ( new mw.Uri( url ) ).toString(); |
| 7 | + $( '#firstHeading' ).append( |
| 8 | + $( '<div class="title-shortlink-container"></div>') |
| 9 | + .append( $( '<a>' ) |
| 10 | + .addClass( 'title-shortlink' ) |
| 11 | + .attr( 'href', url ) |
| 12 | + .text( protoNonRelative ) |
| 13 | + ) |
| 14 | + ); |
6 | 15 | } |
7 | 16 | }); |