Mollywhite has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73784


Change subject: Bug 51256: Load primary CSS separately from JavaScript.
......................................................................

Bug 51256: Load primary CSS separately from JavaScript.

The CSS was all loading with the JavaScript, which meant there was
a delay between the page loading and the CSS being applied. It also
meant that if JavaScript was disabled, no CSS was displayed. Now the
main page's CSS is loaded, and then the JavaScript and JavaScript-
related CSS is loaded after.

Bug: 51256
Change-Id: I0987bf4cab6a49f0ea12579ae73b6d8306af3aa8
---
M BookManagerv2.hooks.php
M BookManagerv2.php
M modules/ext.BookManagerv2.css
A modules/ext.BookManagerv2js.css
4 files changed, 66 insertions(+), 45 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BookManagerv2 
refs/changes/84/73784/1

diff --git a/BookManagerv2.hooks.php b/BookManagerv2.hooks.php
index 7fa43d3..8e56267 100644
--- a/BookManagerv2.hooks.php
+++ b/BookManagerv2.hooks.php
@@ -97,7 +97,8 @@
                // Check that the navigation bar is only added to mainspace 
pages.
                if ( $out->getTitle()->getNamespace() == NS_MAIN ) {
                        if ( $out->getRevisionId() != null ) {
-                               $out->addModules( "ext.BookManagerv2" );
+                               $out->addModuleStyles( "ext.BookManagerv2" );
+                               $out->addModules( "ext.BookManagerv2js" );
                                $prev = (object) array( "link"=>"/prev.html", 
"title"=>"Previous" );
                                $next = (object) array( "link"=>"/next.html", 
"title"=>"Next" );
                                $chapterList = Html::element( 'p', array(), 
'Chapter 1' )
@@ -113,5 +114,4 @@
                }
                return true;
        }
-
 }
diff --git a/BookManagerv2.php b/BookManagerv2.php
index e8566bd..1649a36 100644
--- a/BookManagerv2.php
+++ b/BookManagerv2.php
@@ -117,11 +117,16 @@
 
 // Load resources
 $wgResourceModules['ext.BookManagerv2'] = array(
-       'scripts' => 'ext.BookManagerv2.js',
        'styles' => 'ext.BookManagerv2.css',
        'localBasePath' => dirname(__FILE__) . '/modules',
        'remoteExtPath' => 'BookManagerv2/modules'
 );
+$wgResourceModules['ext.BookManagerv2js'] = array(
+       'scripts' => 'ext.BookManagerv2.js',
+       'styles' => 'ext.BookManagerv2js.css',
+       'localBasePath' => dirname(__FILE__) . '/modules',
+       'remoteExtPath' => 'BookManagerv2/modules'
+);
 
 // Register hook and content handlers for the JSON schema content iff
 // running on the MediaWiki instance housing the schemas.
diff --git a/modules/ext.BookManagerv2.css b/modules/ext.BookManagerv2.css
index 7fdee0d..19678e9 100644
--- a/modules/ext.BookManagerv2.css
+++ b/modules/ext.BookManagerv2.css
@@ -59,48 +59,6 @@
 a.mw-bookmanagerv2-nav-prev {
        margin-right: 20px;
 }
-
-div.mw-bookmanagerv2-nav-dropdown {
-       position: absolute;
-       width: 300px;
-       min-height: 100px;
-       background-color: #f5f5f5;
-       border: 1px solid #dcdcdc;
-       border-radius: 5px;
-       margin-top: 8px;
-       text-align: left;
-       padding: 5px 8px;
-}
-div.mw-bookmanagerv2-nav-dropdown:after, .mw-bookmanagerv2-nav-dropdown:before 
{
-       bottom: 100%;
-       border: solid transparent;
-       content: " ";
-       height: 0;
-       width: 0;
-       position: absolute;
-       pointer-events: none;
-}
-div.mw-bookmanagerv2-nav-dropdown:after {
-       border-color: rgba(245, 245, 245, 0);
-       border-bottom-color: #f5f5f5;
-       border-width: 5px;
-       left: 50%;
-       margin-left: -140px;
-}
-div.mw-bookmanagerv2-nav-dropdown:before {
-       border-color: rgba(220, 220, 220, 0);
-       border-bottom-color: #dcdcdc;
-       border-width: 6px;
-       left: 50%;
-       margin-left: -141px;
-}
-
-div.mw-bookmanagerv2-nav-toc {
-       margin-left: 45px;
-}
 div.mw-bookmanagerv2-nav-dropdown {
        display: none;
-}
-div.mw-bookmanagerv2-nav-dropdown .title {
-       font-style: italic;
 }
diff --git a/modules/ext.BookManagerv2js.css b/modules/ext.BookManagerv2js.css
new file mode 100644
index 0000000..bb59788
--- /dev/null
+++ b/modules/ext.BookManagerv2js.css
@@ -0,0 +1,58 @@
+/*
+ * @file
+ * @section LICENSE
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
+ **/
+div.mw-bookmanagerv2-nav-dropdown {
+       position: absolute;
+       width: 300px;
+       min-height: 100px;
+       background-color: #f5f5f5;
+       border: 1px solid #dcdcdc;
+       border-radius: 5px;
+       margin-top: 8px;
+       text-align: left;
+       padding: 5px 8px;
+}
+div.mw-bookmanagerv2-nav-dropdown:after, .mw-bookmanagerv2-nav-dropdown:before 
{
+       bottom: 100%;
+       border: solid transparent;
+       content: " ";
+       height: 0;
+       width: 0;
+       position: absolute;
+       pointer-events: none;
+}
+div.mw-bookmanagerv2-nav-dropdown:after {
+       border-color: rgba(245, 245, 245, 0);
+       border-bottom-color: #f5f5f5;
+       border-width: 5px;
+       left: 50%;
+       margin-left: -140px;
+}
+div.mw-bookmanagerv2-nav-dropdown:before {
+       border-color: rgba(220, 220, 220, 0);
+       border-bottom-color: #dcdcdc;
+       border-width: 6px;
+       left: 50%;
+       margin-left: -141px;
+}
+
+div.mw-bookmanagerv2-nav-toc {
+       margin-left: 45px;
+}
+div.mw-bookmanagerv2-nav-dropdown .title {
+       font-style: italic;
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/73784
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0987bf4cab6a49f0ea12579ae73b6d8306af3aa8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BookManagerv2
Gerrit-Branch: master
Gerrit-Owner: Mollywhite <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to