* Fix css flipping: for Simple, it still depended on the content language (however, no css actually needs flipping there). For Standard/CologneBlue, I re-added flipping even though it's not needed there either. Just in case css is added that does need flipping, so it is future-proof :). Consequently, I added noflip to the existing css.
* For this flipping I added a parameter to addInlineStyle(), which I assume to be useful in other cases as well
/**
* Adds inline CSS styles
* @param $style_css Mixed: inline CSS
+ * @param $flip Boolean: Whether to flip the CSS if needed
*/
- public function addInlineStyle( $style_css ){
+ public function addInlineStyle( $style_css, $flip = false ) {
+ if( $flip && $this->getLang()->isRTL() ) {
+ # If wanted, and the interface is right-to-left, flip the CSS
+ $style_css = CSSJanus::transform( $style_css, true, false );
+ }
$this->mInlineStyles .= Html::inlineStyle( $style_css );
}
// Underline: 2 = browser default, 1 = always, 0 = never
if ( $options['underline'] < 2 ) {
$rules[] = "a { text-decoration: " .
- ( $options['underline'] ? 'underline' : 'none' ) . "; }";
+ ( $options['underline'] ? 'underline' : 'none' ) . " !important; }";
}
if ( $options['highlightbroken'] ) {
$rules[] = "a.new, #quickbar a.new { color: #ba0000; }\n";
$rules = array();
if ( 2 == $qb ) { # Right
- $rules[] = "#quickbar { position: absolute; right: 4px; }";
- $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
+ $rules[] = "/* @noflip */#quickbar { position: absolute; right: 4px; }";
+ $rules[] = "/* @noflip */#article { margin-left: 4px; margin-right: 148px; }";
} elseif ( 1 == $qb ) {
- $rules[] = "#quickbar { position: absolute; left: 4px; }";
- $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
+ $rules[] = "/* @noflip */#quickbar { position: absolute; left: 4px; }";
+ $rules[] = "/* @noflip */#article { margin-left: 148px; margin-right: 4px; }";
} elseif ( 3 == $qb ) { # Floating left
- $rules[] = "#quickbar { position:absolute; left:4px }";
- $rules[] = "#topbar { margin-left: 148px }";
- $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
- $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
+ $rules[] = "/* @noflip */#quickbar { position:absolute; left:4px }";
+ $rules[] = "/* @noflip */#topbar { margin-left: 148px }";
+ $rules[] = "/* @noflip */#article { margin-left:148px; margin-right: 4px; }";
+ $rules[] = "/* @noflip */body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto; bottom:4px;}"; # Hides from IE
} elseif ( 4 == $qb ) { # Floating right
- $rules[] = "#quickbar { position: fixed; right: 4px; }";
- $rules[] = "#topbar { margin-right: 148px }";
- $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
- $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
+ $rules[] = "/* @noflip */#quickbar { position: fixed; right: 4px; }";
+ $rules[] = "/* @noflip */#topbar { margin-right: 148px }";
+ $rules[] = "/* @noflip */#article { margin-right: 148px; margin-left: 4px; }";
+ $rules[] = "/* @noflip */body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto; bottom:4px;}"; # Hides from IE
}
$style = implode( "\n", $rules );
- $out->addInlineStyle( $style );
+ $out->addInlineStyle( $style, /* flip css if RTL */true );
}
}
$out->addModuleStyles( 'skins.simple' );
/* Add some userprefs specific CSS styling */
- global $wgUser, $wgContLang;
+ global $wgUser;
$rules = array();
$underline = "";
if ( $wgUser->getOption( 'underline' ) < 2 ) {
- $underline = "text-decoration: " . $wgUser->getOption( 'underline' ) ? 'underline' : 'none' . ";";
+ $underline = "text-decoration: " . $wgUser->getOption( 'underline' ) ? 'underline' : 'none' . " !important;";
}
/* Also inherits from resourceloader */
$rules[] = "a.stub:after { $underline; }";
}
$style = implode( "\n", $rules );
- if ( $wgContLang->getDir() === 'rtl' ) {
- $style = CSSJanus::transform( $style, true, false );
- }
- $out->addInlineStyle( $style );
+ $out->addInlineStyle( $style, /* flip css if RTL */true );
}
}
$rules = array();
if ( 2 == $qb ) { # Right
- $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
- $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
+ $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
+ $rules[] = "/* @noflip */#article, /* @noflip */#mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
} elseif ( 1 == $qb || 3 == $qb ) {
- $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
- $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
+ $rules[] = "/* @noflip */#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
+ $rules[] = "/* @noflip */#article, /* @noflip */#mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
if( 3 == $qb ) {
- $rules[] = "#quickbar { position: fixed; padding: 4px; }";
+ $rules[] = "/* @noflip */#quickbar { position: fixed; padding: 4px; }";
}
} elseif ( 4 == $qb ) {
- $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
- $rules[] = "#quickbar { border-right: 1px solid gray; }";
- $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
+ $rules[] = "/* @noflip */#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
+ $rules[] = "/* @noflip */#quickbar { border-right: 1px solid gray; }";
+ $rules[] = "/* @noflip */#article, /* @noflip */#mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
}
$style = implode( "\n", $rules );
- $out->addInlineStyle( $style );
+ $out->addInlineStyle( $style, /* flip css if RTL */true );
}
}