jenkins-bot has submitted this change and it was merged.
Change subject: Reduce loading spinner toggle to a single 'loading' CSS class
name
......................................................................
Reduce loading spinner toggle to a single 'loading' CSS class name
Originally I wanted to make the spinner a pure CSS solution but
could not do that for now because it relies on the
.mw-small-spinner class. We can address this in a later patch if
we want, e.g. by using our own spinner GIF.
Main advantage of this change is that it now supports multiple
Entities on one page.
Change-Id: I618977a80406267f309037914dea2afad10f8f47
---
M lib/resources/wikibase.css
M repo/includes/EntityView.php
2 files changed, 17 insertions(+), 13 deletions(-)
Approvals:
Henning Snater: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/resources/wikibase.css b/lib/resources/wikibase.css
index d77231a..bade4c4 100644
--- a/lib/resources/wikibase.css
+++ b/lib/resources/wikibase.css
@@ -139,14 +139,24 @@
}
.wb-entity.loading {
+ position: relative;
+}
+
+.wb-entity.loading > * {
opacity: .3;
}
-div.wb-entity-spinner { /* loading spinner positioning (animation is taken
from .mw-small-spinner) */
- height: 100px;
+.wb-entity-spinner { /* loading spinner positioning (animation is taken from
.mw-small-spinner) */
+ display: none;
+ left: 50%;
+ margin-left: -10px; /* half of the 20px width of .mw-small-spinner */
+ opacity: 1 !important;
position: absolute;
- width: 100px;
- z-index: 99;
+ top: 40px;
+}
+
+.loading .wb-entity-spinner {
+ display: block;
}
.wb-entity-undefinedinfo {
diff --git a/repo/includes/EntityView.php b/repo/includes/EntityView.php
index 1a6738e..844b3c1 100644
--- a/repo/includes/EntityView.php
+++ b/repo/includes/EntityView.php
@@ -133,15 +133,9 @@
// JavaScript is parsed.
return Html::inlineScript( '
if ( $ ) {
- $( ".wikibase-entityview" ).addClass( "loading" ).after( function() {
- var $div = $( "<div/>" ).addClass( "wb-entity-spinner
mw-small-spinner" );
- $div.css( "top", $div.height() + "px" );
- $div.css(
- "' . ( $this->language->isRTL() ? 'right' : 'left' ) .
'",
- ( ( $( this ).width() - $div.width() ) / 2 | 0 ) + "px"
- );
- return $div;
- } );
+ $( ".wikibase-entityview" ).addClass( "loading" ).append(
+ $( "<div/>" ).addClass( "mw-small-spinner wb-entity-spinner" )
+ );
window.setTimeout( function() {
$( ".wikibase-entityview" ).removeClass( "loading" );
$( ".wb-entity-spinner" ).remove();
--
To view, visit https://gerrit.wikimedia.org/r/123298
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I618977a80406267f309037914dea2afad10f8f47
Gerrit-PatchSet: 12
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Bene <[email protected]>
Gerrit-Reviewer: Henning Snater <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits