Repair quickbar of standard and cologneblue skins to work under Resourceloader.
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Tue, 11 Jan 2011 20:22:05 +0000 (20:22 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Tue, 11 Jan 2011 20:22:05 +0000 (20:22 +0000)
Refs bug #26649

Factoring this out into seperate stylesheets seemed silly. Instead just moved
that last css line from skins/common/quickbar.css and skins/common/quickbar-right.css
inline as well.

skins/CologneBlue.php
skins/Standard.php
skins/common/quickbar-right.css [deleted file]
skins/common/quickbar.css [deleted file]

index 7aed2bb..b9a798c 100644 (file)
@@ -106,28 +106,33 @@ class SkinCologneBlue extends Skin {
                return $s;
        }
 
-       function reallyGenerateUserStylesheet() {
-               $s = parent::reallyGenerateUserStylesheet();
+       function setupSkinUserCss( OutputPage $out ){
+               global $wgContLang;
                $qb = $this->qbSetting();
 
                if ( 2 == $qb ) { # Right
-                       $s .= "#quickbar { position: absolute; right: 4px; }\n" .
-                               "#article { margin-left: 4px; margin-right: 148px; }\n";
+                       $rules[] = "#quickbar { position: absolute; right: 4px; }";
+                       $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
                } elseif ( 1 == $qb ) {
-                       $s .= "#quickbar { position: absolute; left: 4px; }\n" .
-                               "#article { margin-left: 148px; margin-right: 4px; }\n";
+                       $rules[] = "#quickbar { position: absolute; left: 4px; }";
+                       $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
                } elseif ( 3 == $qb ) { # Floating left
-                       $s .= "#quickbar { position:absolute; left:4px } \n" .
-                               "#topbar { margin-left: 148px }\n" .
-                               "#article { margin-left:148px; margin-right: 4px; } \n" .
-                               "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
+                       $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
                } elseif ( 4 == $qb ) { # Floating right
-                       $s .= "#quickbar { position: fixed; right: 4px; } \n" .
-                               "#topbar { margin-right: 148px }\n" .
-                               "#article { margin-right: 148px; margin-left: 4px; } \n" .
-                               "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
+                       $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
                }
-               return $s;
+               $style = implode( "\n", $rules );
+               if ( $wgContLang->getDir() === 'rtl' ) {
+                       $style = CSSJanus::transform( $style, true, false );
+               }
+               $out->addInlineStyle( $style );
+               parent::setupSkinUserCss( $out );
        }
 
        function sysLinks() {
index b91254b..5067aa1 100644 (file)
@@ -20,34 +20,28 @@ class SkinStandard extends Skin {
         *
         */
        function setupSkinUserCss( OutputPage $out ){
-               if ( 3 == $this->qbSetting() ) { # Floating left
-                       $out->addStyle( 'common/quickbar.css' );
-               } elseif ( 4 == $this->qbSetting() ) { # Floating right
-                       $out->addStyle( 'common/quickbar-right.css' );
-               }
-               parent::setupSkinUserCss( $out );
-       }
-
-       /**
-        *
-        */
-       function reallyGenerateUserStylesheet() {
-               $s = parent::reallyGenerateUserStylesheet();
+               global $wgContLang;
                $qb = $this->qbSetting();
-
                if ( 2 == $qb ) { # Right
-                       $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
-                               "border-left: 2px solid #000000; }\n" .
-                               "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
+                       $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; }";
                } elseif ( 1 == $qb || 3 == $qb ) {
-                       $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
-                               "border-right: 1px solid gray; }\n" .
-                               "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
+                       $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; }";
+                       if( 3 == $qb ) {
+                               $rules[] = "#quickbar { position: fixed; padding: 4px; }";
+                       }
                } elseif ( 4 == $qb ) {
-                       $s .= "#quickbar { border-right: 1px solid gray; }\n" .
-                               "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
+                       $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; }";
                }
-               return $s;
+               $style = implode( "\n", $rules );
+               if ( $wgContLang->getDir() === 'rtl' ) {
+                       $style = CSSJanus::transform( $style, true, false );
+               }
+               $out->addInlineStyle( $style );
+               parent::setupSkinUserCss( $out );
        }
 
        function doAfterContent() {
diff --git a/skins/common/quickbar-right.css b/skins/common/quickbar-right.css
deleted file mode 100644 (file)
index 43bd427..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}
diff --git a/skins/common/quickbar.css b/skins/common/quickbar.css
deleted file mode 100644 (file)
index d7930c2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#quickbar { position: fixed; padding: 4px; }