JGonera has uploaded a new change for review.
https://gerrit.wikimedia.org/r/93908
Change subject: Story 1289: Promote image viewer overlay to beta
......................................................................
Story 1289: Promote image viewer overlay to beta
Change-Id: Iab2b857d009f25f077edb940d836ad84d576a9b8
Dependency: Ibaf09360041408e9bf9692056572f5b23b7f7c08
---
M includes/Resources.php
M javascripts/common/history-alpha.js
M javascripts/modules/mediaViewer.js
M less/modules/mediaViewer.less
M templates/modules/ImageOverlay.html
5 files changed, 24 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/08/93908/1
diff --git a/includes/Resources.php b/includes/Resources.php
index 27f93cb..5cce9f0 100644
--- a/includes/Resources.php
+++ b/includes/Resources.php
@@ -391,12 +391,14 @@
'styles' => array(
'less/common/OverlayNew.less',
'less/modules/talk.less',
+ 'less/modules/mediaViewer.less',
),
'scripts' => array(
'javascripts/common/OverlayNew.js',
'javascripts/common/LoadingOverlayNew.js',
'javascripts/modules/mf-toggle-dynamic.js',
'javascripts/modules/talk/talk.js',
+ 'javascripts/modules/mediaViewer.js',
'javascripts/modules/search/pageImages.js',
'javascripts/modules/languages/preferred.js',
'javascripts/modules/lastEdited/lastEditedBeta.js',
@@ -404,6 +406,7 @@
),
'templates' => array(
'OverlayNew',
+ 'modules/ImageOverlay',
),
'position' => 'bottom',
'messages' => array(
@@ -422,6 +425,9 @@
'mobile-frontend-last-modified-with-user-months',
'mobile-frontend-last-modified-with-user-years',
'mobile-frontend-last-modified-with-user-just-now',
+
+ // mediaViewer.js
+ 'mobile-frontend-media-details',
),
),
@@ -457,9 +463,6 @@
),
'mobile.alpha' => $wgMFMobileResourceBoilerplate + array(
- 'templates' => array(
- 'modules/ImageOverlay',
- ),
'dependencies' => array(
'mobile.stable',
'mobile.beta',
@@ -472,13 +475,9 @@
// for mf-table.js
'mobile-frontend-table',
-
- // mediaViewer.js
- 'mobile-frontend-media-details',
),
'styles' => array(
'less/common/mainmenuAnimation.less',
- 'less/modules/mediaViewer.less',
),
'scripts' => array(
'javascripts/externals/micro.tap.js',
@@ -486,7 +485,6 @@
'javascripts/common/history-alpha.js',
'javascripts/modules/mf-translator.js',
'javascripts/modules/lazyload.js',
- 'javascripts/modules/mediaViewer.js',
'javascripts/modules/random/random.js',
),
),
diff --git a/javascripts/common/history-alpha.js
b/javascripts/common/history-alpha.js
index fb87b7d..94c3792 100644
--- a/javascripts/common/history-alpha.js
+++ b/javascripts/common/history-alpha.js
@@ -67,7 +67,8 @@
$a.on( 'click', lazyLoad );
}
- $container.find( 'a' ).each( function() {
+ // do not hijack image links, media viewer does it
+ $container.find( 'a:not([class="image"])' ).each(
function() {
var $a = $( this ), title = $a.data( 'title' ),
tooltip = $a.attr( 'title' ),
namespaced, canHijack;
diff --git a/javascripts/modules/mediaViewer.js
b/javascripts/modules/mediaViewer.js
index 1eeecbc..ef30fa4 100644
--- a/javascripts/modules/mediaViewer.js
+++ b/javascripts/modules/mediaViewer.js
@@ -1,5 +1,5 @@
( function( M, $ ) {
- M.assertMode( [ 'alpha' ] );
+ M.assertMode( [ 'alpha', 'beta' ] );
var Overlay = M.require( 'Overlay' ),
Api = M.require( 'api' ).Api,
@@ -21,7 +21,7 @@
action: 'query',
prop: 'imageinfo',
titles: title,
- iiprop: 'url',
+ iiprop: ['url', 'extmetadata'],
// request an image two times bigger
than the reported screen size
// for retina displays and zooming
iiurlwidth: $( window ).width() * 2,
@@ -62,6 +62,9 @@
self.$( '.container div' ).append( $img );
self._positionImage();
self.$( '.details a' ).attr( 'href',
data.descriptionurl );
+ if ( data.extmetadata &&
data.extmetadata.License ) {
+ self.$( '.license' ).text(
data.extmetadata.License );
+ }
self.$el.on( M.tapEvent( 'click' ), function() {
self.$( '.details' ).toggleClass(
'visible' );
diff --git a/less/modules/mediaViewer.less b/less/modules/mediaViewer.less
index 4aa33c5..333480a 100644
--- a/less/modules/mediaViewer.less
+++ b/less/modules/mediaViewer.less
@@ -62,6 +62,13 @@
a {
float: right;
}
+
+ // FIXME: use general license styling when license in editor and
+ // uploads is not hardcoded in MobileFrontend
+ .license {
+ font-size: .75em;
+ line-height: 1.2;
+ }
}
}
diff --git a/templates/modules/ImageOverlay.html
b/templates/modules/ImageOverlay.html
index 779b948..005d1fe 100644
--- a/templates/modules/ImageOverlay.html
+++ b/templates/modules/ImageOverlay.html
@@ -1,6 +1,7 @@
<button class="cancel">{{closeMsg}}</button>
<div class="container loading"><div></div></div>
-<p class="content details">
+<div class="content details">
<a class="button" href="#">{{detailsMsg}}</a>
- {{caption}}
-</p>
+ <p>{{caption}}</p>
+ <p class="license">{{license}}</p>
+</div>
--
To view, visit https://gerrit.wikimedia.org/r/93908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab2b857d009f25f077edb940d836ad84d576a9b8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: JGonera <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits