* Mark underline css as !important. It should override other css (such as the css...
authorRobin Pepermans <robin@users.mediawiki.org>
Sun, 4 Sep 2011 21:50:02 +0000 (21:50 +0000)
committerRobin Pepermans <robin@users.mediawiki.org>
Sun, 4 Sep 2011 21:50:02 +0000 (21:50 +0000)
* 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

includes/OutputPage.php
includes/resourceloader/ResourceLoaderUserOptionsModule.php
skins/CologneBlue.php
skins/Simple.php
skins/Standard.php

index b4f56b5..5b0070c 100644 (file)
@@ -2949,8 +2949,13 @@ $distantTemplates
        /**
         * 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 );
        }
 
index 1989353..2f63906 100644 (file)
@@ -97,7 +97,7 @@ class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
                        // 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";
index 808ed37..66255ad 100644 (file)
@@ -30,24 +30,24 @@ class SkinCologneBlue extends SkinLegacy {
                $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 );
        }
 
 }
index 0644377..ad0dbb0 100644 (file)
@@ -30,12 +30,12 @@ class SkinSimple extends SkinTemplate {
                $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 */
@@ -45,10 +45,7 @@ class SkinSimple extends SkinTemplate {
                        $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 );
 
        }
 }
index 322f7b2..53b1d63 100644 (file)
@@ -29,21 +29,21 @@ class SkinStandard extends SkinLegacy {
                $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 );
        }
 
 }