Mollywhite has submitted this change and it was merged.

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(+), 47 deletions(-)

Approvals:
  Mollywhite: Verified; Looks good to me, approved



diff --git a/BookManagerv2.hooks.php b/BookManagerv2.hooks.php
index 65a497e..1e495f2 100644
--- a/BookManagerv2.hooks.php
+++ b/BookManagerv2.hooks.php
@@ -316,7 +316,8 @@
                                                $jsonPageTitle = 
Title::newFromText( $cat );
                                                $jsonBook = self::getJson( 
$jsonPageTitle );
                                                if ( $jsonBook ) {
-                                                       $out->addModules( 
"ext.BookManagerv2" );
+                                                       $out->addModuleStyles( 
"ext.BookManagerv2" );
+                                                       $out->addModules( 
"ext.BookManagerv2js" );
                                                        $currentPageTitle = 
$out->getTitle()->getText();
                                                        $prev = (object) 
array();
                                                        $next = (object) 
array();
diff --git a/BookManagerv2.php b/BookManagerv2.php
index 1084d5e..f11cb9e 100644
--- a/BookManagerv2.php
+++ b/BookManagerv2.php
@@ -118,11 +118,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 a19d7d6..3b6d820 100644
--- a/modules/ext.BookManagerv2.css
+++ b/modules/ext.BookManagerv2.css
@@ -59,51 +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-dropdown ol, div.mw-bookmanagerv2-nav-dropdown ul {
-       list-style: none;
-       margin: 0;
-}
-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: merged
Gerrit-Change-Id: I0987bf4cab6a49f0ea12579ae73b6d8306af3aa8
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/BookManagerv2
Gerrit-Branch: master
Gerrit-Owner: Mollywhite <[email protected]>
Gerrit-Reviewer: Helder.wiki <[email protected]>
Gerrit-Reviewer: Mollywhite <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to