Prtksxna has uploaded a new change for review.

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

Change subject: Limit image size for portrait popups
......................................................................

Limit image size for portrait popups

Change-Id: I4980e6d6e024515710abc1912ffcf99b71297e9e
---
M resources/ext.popups.core.js
M resources/ext.popups.core.less
2 files changed, 15 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/86/115186/1

diff --git a/resources/ext.popups.core.js b/resources/ext.popups.core.js
index b370d84..4e912be 100644
--- a/resources/ext.popups.core.js
+++ b/resources/ext.popups.core.js
@@ -122,7 +122,7 @@
                                                        'xlink:href': 
thumbnail.source,
                                                        'clip-path': 
'url(#mwe-popups-mask)',
                                                        x: 0,
-                                                       y: 0,
+                                                       y: ( thumbnail.height > 
200) ? ( ( thumbnail.height - 200 ) / -2 ) : thumbnail.height,
                                                        width: thumbnail.width,
                                                        height: thumbnail.height
                                                } );
@@ -130,15 +130,15 @@
                                        $thumbnail = $( '<svg>' )
                                                .attr( {
                                                        xmlns: 
'http://www.w3.org/2000/svg',
-                                                       viewBox: '0 0 ' + 
thumbnail.width + ' ' + thumbnail.height,
-                                                       width: thumbnail.width,
-                                                       height: thumbnail.height
+                                                       viewBox: '0 0 300 ' + ( 
thumbnail.height > 200 ) ? 200 : thumbnail.height,
+                                                       width: 300,
+                                                       height: ( 
thumbnail.height > 200 ) ? 200 : thumbnail.height
                                                } )
                                                .append( $thumbnail );
                                } else {
-                                       $thumbnail = $( '<img>' )
-                                               .attr( 'src', thumbnail.source )
-                                               .addClass( 
'mwe-popups-is-not-tall' );
+                                       $thumbnail = $( '<div>' )
+                                               .addClass( 
'mwe-popups-is-not-tall' )
+                                               .css( 'background-image', 
'url(' + thumbnail.source + ')' );
                                }
                        }
 
diff --git a/resources/ext.popups.core.less b/resources/ext.popups.core.less
index 9f0ea51..42db1be 100644
--- a/resources/ext.popups.core.less
+++ b/resources/ext.popups.core.less
@@ -50,19 +50,17 @@
                        background-size: cover;
                        background-repeat: no-repeat;
                        overflow: hidden;
-
-                       img {
-                               min-height: 100%;
-                               min-width: 100%;
-                               
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
-                               filter: alpha(opacity=0);
-                               opacity: 0
-                       }
                }
 
-               > img.mwe-popups-is-not-tall{
+               > div.mwe-popups-is-not-tall{
+                       float: right;
+                       height: 200px;
                        width: 300px;
-                       float: initial;
+                       padding: 0;
+                       background-size: cover;
+                       background-position: center;
+                       background-repeat: no-repeat;
+                       overflow: hidden;
                }
 
                > div.mwe-popups-timestamp-older, 
div.mwe-popups-timestamp-recent{

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4980e6d6e024515710abc1912ffcf99b71297e9e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>

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

Reply via email to