Index: trunk/extensions/RTLDebug/rtl-debug.js |
— | — | @@ -1,10 +1,12 @@ |
2 | | -(function($) { |
3 | | - $('*').each( function() { |
4 | | - var style = window.getComputedStyle( this, null ); |
5 | | - if ( style.getPropertyValue( 'direction' ) == 'rtl' ) { |
6 | | - $(this).addClass( 'mw-rtldebug-rtl' ); |
7 | | - } else { |
8 | | - $(this).addClass( 'mw-rtldebug-ltr' ); |
9 | | - } |
10 | | - } ); |
11 | | -})(jQuery); |
| 2 | +( function( $ ) { |
| 3 | + |
| 4 | + // Select all elements in the body (we don't need stuff in <head>) |
| 5 | + $( document.body ) |
| 6 | + .find( '*' ) |
| 7 | + .andSelf() // include body as well |
| 8 | + .each( function() { |
| 9 | + var $el = $( this ); |
| 10 | + $el.addClass( $el.css( 'direction' ) === 'rtl' ? 'mw-rtldebug-rtl' : 'mw-rtldebug-ltr' ); |
| 11 | + } ); |
| 12 | + |
| 13 | +} )( jQuery ); |
Index: trunk/extensions/RTLDebug/RTLDebug.php |
— | — | @@ -24,17 +24,16 @@ |
25 | 25 | $wgResourceModules['ext.rtlDebug'] = array( |
26 | 26 | 'scripts' => 'rtl-debug.js', |
27 | 27 | 'styles' => 'rtl-debug.css', |
28 | | - 'localBasePath' => dirname( __FILE__ ) |
| 28 | + 'remoteExtPath' => 'RTLDebug', |
| 29 | + 'localBasePath' => dirname( __FILE__ ), |
29 | 30 | ); |
30 | 31 | |
31 | 32 | $wgHooks['BeforePageDisplay'][] = 'wfRtlDebug_BeforePageDisplay'; |
32 | 33 | $wgExtraLanguageNames['en-rtl'] = 'English (RTL)'; |
33 | 34 | |
34 | 35 | function wfRtlDebug_BeforePageDisplay( &$out, &$skin ) { |
35 | | - global $wgLang; |
36 | | - |
37 | 36 | $out->addModules( 'ext.rtlDebug' ); |
38 | | - if ( $wgLang->getCode() == 'en-rtl' ) { |
| 37 | + if ( $out->getLang()->getCode() == 'en-rtl' ) { |
39 | 38 | $out->addInlineStyle( '* { unicode-bidi: bidi-override; }' ); |
40 | 39 | } |
41 | 40 | return true; |