Gilles has uploaded a new change for review.

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

Change subject: Fix commons icon to avoid pixelation
......................................................................

Fix commons icon to avoid pixelation

The CSS to make the favico twice as big was looking horrible in
Firefox and possibly other browsers. Since we're already
special-casing commons, let's apply a proper SVG instead of the
favico.

Change-Id: Ie32302342eba7aa37bd310c013a9f4d7f9ae187e
---
A resources/mmv/ui/img/commons.svg
M resources/mmv/ui/mmv.ui.metadataPanel.js
M resources/mmv/ui/mmv.ui.metadataPanel.less
M tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
4 files changed, 51 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/68/125168/1

diff --git a/resources/mmv/ui/img/commons.svg b/resources/mmv/ui/img/commons.svg
new file mode 100644
index 0000000..3d9c98e
--- /dev/null
+++ b/resources/mmv/ui/img/commons.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:cc="http://creativecommons.org/ns#"; 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; 
xmlns:svg="http://www.w3.org/2000/svg"; xmlns="http://www.w3.org/2000/svg"; 
version="1.1" width="22" height="28" viewBox="-320 -540 13.75 17.5" 
id="Wikimedia Logo">
+  <metadata id="metadata4466">
+    <rdf:RDF>
+      <cc:Work rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+        <dc:title/>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs id="defs4438">
+    <clipPath id="boundary">
+      <circle cx="0" cy="0" r="298" id="circle4441"/>
+    </clipPath>
+    <clipPath id="clipPath4921">
+      <circle cx="0" cy="0" r="298" id="circle4894"/>
+    </clipPath>
+  </defs>
+  <g transform="matrix(0.02142652,0,0,0.02142652,-313.28293,-529.33772)" 
id="g4939">
+    <path d="M -2.256609,318.96639 C -87.283034,315.98131 -165.21368,278.44058 
-220.62769,213.77268 -266.4365,160.31402 -291.91872,91.073685 
-291.96362,19.938505 c -0.0457,-72.433331 25.00199,-140.026745 
72.57087,-195.838675 6.13141,-7.19391 22.05104,-23.45254 22.96353,-23.45254 
0.29556,0 18.44237,17.90433 40.32626,39.78739 l 39.78889,39.78738 
10.98621,-10.98076 c 6.927945,-6.92451 11.192481,-10.90162 11.544594,-10.7665 
0.466453,0.179 7.269736,24.71548 22.676763,81.785226 0.137601,0.509701 
-0.04684,0.701571 -0.674358,0.701571 -0.629739,0 -76.544119,-20.387307 
-81.514069,-21.891156 -0.38587,-0.116741 -0.70157,-0.426876 -0.70157,-0.689143 
0,-0.262308 4.87091,-5.345294 10.82424,-11.295582 5.95334,-5.950273 
10.82425,-11.001716 10.82425,-11.225426 0,-0.5522 -19.33554,-19.84417 
-19.88898,-19.84417 -0.55419,0 -5.70263,5.95873 -10.54197,12.20113 
-24.13758,31.135704 -39.39826,68.979193 -43.49852,107.8678217 
-1.09763,10.410443 -1.16754,11.899053 -0.57645,12.273653 0.89062,0.56438 
27.35054,0.4446 27.92157,-0.12644 0.35748,-0.35748 0.48108,-4.4381 
0.48108,-15.882219 0,-15.0838677 0.0161,-15.3969287 0.78349,-15.1962797 
1.24439,0.325409 73.78354,42.025259 73.78354,42.415209 0,0.19307 
-0.40591,0.61438 -0.90202,0.93626 -2.20472,1.43048 -73.02678,41.92844 
-73.32364,41.92844 -0.18264,0 -0.37926,-7.08086 -0.43694,-15.73525 l 
-0.10488,-15.73525 -14.23188,0 -14.23188,0 0.11245,3.40764 c 0.25184,7.63157 
2.24928,21.7435 4.53175,32.01667 6.77858,30.5099 20.26206,59.420415 
39.19668,84.043295 3.44508,4.48003 9.91023,12.18878 10.66687,12.71865 
0.43046,0.30147 20.25973,-19.20426 20.25973,-19.92912 0,-0.22066 
-4.91089,-5.31455 -10.91309,-11.31972 -6.98124,-6.98473 -10.77274,-11.05568 
-10.52357,-11.29931 0.64713,-0.6327 82.048629,-22.571675 82.409614,-22.210705 
0.34897,0.34898 -21.521087,81.813535 -22.147237,82.497065 -0.22059,0.24078 
-4.525457,-3.77706 -11.275317,-10.52357 -6.00518,-6.00221 -11.19279,-10.91309 
-11.52803,-10.91309 -0.95166,0 -20.10342,19.40058 -19.81972,20.07721 
0.27403,0.65359 8.29388,7.41822 13.61935,11.4877 24.309217,18.57609 
52.909862,31.82388 83.241484,38.5574 10.12878,2.24856 24.359769,4.27185 
31.816243,4.52342 l 3.608082,0.12175 0,-14.23188 0,-14.23188 
-15.735246,-0.10487 c -10.616044,-0.0708 -15.735247,-0.2413 -15.735247,-0.52418 
0,-0.79855 42.235755,-74.13843 42.695637,-74.13843 0.459882,0 
42.695636,73.33988 42.695636,74.13843 0,0.28288 -5.1192,0.45342 
-15.735245,0.52418 l -15.735247,0.10487 0,14.23188 0,14.23188 3.608082,-0.12175 
c 7.456475,-0.25157 21.68746,-2.27486 31.81624,-4.52342 30.33163,-6.73352 
58.932271,-19.98131 83.241491,-38.5574 5.32549,-4.06948 13.34533,-10.83411 
13.61934,-11.4877 0.28372,-0.67663 -18.86806,-20.07721 -19.81971,-20.07721 
-0.33523,0 -5.52285,4.91088 -11.52802,10.91309 -6.74988,6.74651 
-11.05473,10.76435 -11.27534,10.52357 -0.62612,-0.68353 -22.496201,-82.148085 
-22.147231,-82.497065 0.36099,-0.36097 81.762491,21.578005 82.409611,22.210705 
0.24916,0.24363 -3.54233,4.31458 -10.52357,11.29931 -6.0022,6.00517 
-10.91308,11.09906 -10.91308,11.31972 0,0.72486 19.82925,20.23059 
20.25974,19.92912 0.75661,-0.52987 7.22178,-8.23862 10.66685,-12.71865 
18.93461,-24.62288 32.4181,-53.533395 39.19668,-84.043295 2.28247,-10.27317 
4.27991,-24.3851 4.53175,-32.01667 l 0.11245,-3.40764 -14.23187,0 -14.23188,0 
-0.10488,15.73525 c -0.0577,8.65439 -0.25429,15.73525 -0.43694,15.73525 
-0.29686,0 -71.11894,-40.49796 -73.32364,-41.92844 -0.49611,-0.32188 
-0.90202,-0.74319 -0.90202,-0.93626 0,-0.38995 72.53916,-42.0898 
73.78355,-42.415209 0.76732,-0.200649 0.78348,0.112412 0.78348,15.1962797 
0,11.444119 0.12359,15.524739 0.48107,15.882219 0.57104,0.57104 
27.03095,0.69082 27.92159,0.12644 0.59108,-0.3746 0.52117,-1.86321 
-0.57645,-12.273653 -4.10027,-38.8886287 -19.36093,-76.7321177 
-43.49852,-107.8678217 -4.85908,-6.26784 -9.98849,-12.20113 -10.54807,-12.20113 
-0.55327,0 -19.88289,19.29787 -19.88289,19.85024 0,0.22037 4.87091,5.269083 
10.82424,11.219356 5.95334,5.950288 10.82425,11.033274 10.82425,11.295582 
0,0.262267 -0.31571,0.572402 -0.70157,0.689143 -4.96993,1.503849 
-80.884331,21.891156 -81.514071,21.891156 -0.62752,0 -0.81196,-0.19187 
-0.67436,-0.701571 15.407041,-57.069746 22.210321,-81.606226 
22.676761,-81.785226 0.35211,-0.13512 4.61622,3.84157 11.54342,10.76534 l 
10.98509,10.97961 9.82216,-9.81603 c 5.40218,-5.39882 9.82216,-10.02943 
9.82216,-10.29024 0,-0.59624 -6.73168,-5.5697 -11.9102,-8.7994 
-11.7316,-7.31671 -18.93561,-10.63773 -56.275931,-25.94296 -25.55089,-10.47292 
-39.13832,-17.2969 -53.486414,-26.86236 -33.629312,-22.41968 
-55.764563,-52.49638 -69.67948,-94.67833 -1.819973,-5.5171 -5.889793,-19.90631 
-5.889793,-20.82387 0,-0.60755 -2.692727,0.31328 -20.577413,7.03684 
-20.581101,7.73725 -29.102601,10.62825 -32.507203,11.02839 -3.775046,0.44369 
-4.726346,-0.95085 -2.983256,-4.37328 1.09127,-2.14265 2.04662,-3.42485 
6.783589,-9.10445 9.489793,-11.37823 16.544812,-22.27099 25.460479,-39.31031 
14.837034,-28.35602 30.346771,-67.34368 43.913533,-110.38778 3.857605,-12.23926 
8.83244,-28.87421 9.992194,-33.41208 0.295847,-1.15759 0.642812,-2.10471 
0.771031,-2.10471 0.576624,0 37.700857,62.85964 54.929729,93.00834 
35.072744,61.37357 50.726794,93.41787 46.861734,95.92733 -1.21157,0.78663 
-3.16473,-0.54821 -8.97582,-6.13429 -9.31804,-8.95725 -13.92743,-12.00307 
-22.84275,-15.09421 -3.55509,-1.23262 -10.75512,-2.79973 -14.532552,-3.16304 
-3.477197,-0.33444 -3.440804,-0.42923 -1.916613,4.99181 5.651105,20.09911 
14.292235,35.66201 25.978405,46.78777 11.76559,11.20138 25.84672,18.74779 
61.672251,33.05166 27.91264,11.14453 45.97827,20.0322 61.6962,30.35248 
12.9025,8.47167 23.23364,16.95344 33.87768,27.81325 63.83036,65.12405 
94.25134,154.504313 83.5563,245.497695 -9.29774,79.105465 -50.82084,152.303515 
-114.09126,201.123265 -35.64015,27.50012 -76.20577,46.39356 
-119.872961,55.83082 -23.26382,5.0277 -49.615276,7.41156 -72.894068,6.59433 z" 
id="path4653" style="fill:#006398"/>
+    <path d="m 0.95057498,119.92811 c -15.44031398,-1.53772 
-25.88967198,-4.35868 -37.70432798,-10.179 -10.960957,-5.39973 
-19.14458,-11.368895 -27.85178,-20.315215 -14.74071,-15.14557 
-23.887371,-33.48044 -27.328976,-54.78207 -1.16098,-7.18582 -1.258868,-21.86951 
-0.191629,-28.7447503 1.590587,-10.246634 4.034457,-18.7362507 
7.841838,-27.2412617 13.995429,-31.263228 42.817145,-53.13045 
77.016466,-58.432807 3.507393,-0.543778 7.00801398,-0.714802 
14.632777,-0.714802 7.624763,0 11.125385,0.171024 14.632777,0.714802 
34.199319,5.302357 63.021039,27.169579 77.016479,58.432807 3.807361,8.505011 
6.251241,16.9946277 7.841841,27.2412617 1.06723,6.8752403 0.96933,21.5589303 
-0.19163,28.7447503 -1.67234,10.35094 -4.48689,19.378 -8.849501,28.38321 
-5.08741,10.50129 -10.41712,18.11506 -18.47949,26.39886 -8.72619,8.96584 
-16.93476,14.948435 -27.85178,20.299015 -13.705375,6.71721 -26.613144,9.85801 
-41.913757,10.19869 -3.858643,0.0859 -7.737331,0.0844 -8.61930702,-0.003 z" 
id="path4697" style="fill:#970000;fill-opacity:1"/>
+  </g>
+</svg>
\ No newline at end of file
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js 
b/resources/mmv/ui/mmv.ui.metadataPanel.js
index 2701958..09186ba 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanel.js
+++ b/resources/mmv/ui/mmv.ui.metadataPanel.js
@@ -430,7 +430,7 @@
                this.$repo.text( repositoryMessage );
 
                this.$repoLi.css( 'background-image',
-                       repoInfo.favIcon ? 'url("' + repoInfo.favIcon + '")' : 
null );
+                       ( repoInfo.favIcon && !isCommons ) ? 'url("' + 
repoInfo.favIcon + '")' : '' );
 
                this.$repoLi.toggleClass( 'commons', isCommons );
                this.$repoSubtitle.text(
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.less 
b/resources/mmv/ui/mmv.ui.metadataPanel.less
index 6057e1e..6b435c4 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanel.less
+++ b/resources/mmv/ui/mmv.ui.metadataPanel.less
@@ -158,6 +158,8 @@
        line-height: 1.3;
 
        &.commons { // there is an extra subtitle for Commons images, box 
should be larger
+               /* @embed */
+               background-image: url(img/commons.svg);
                @icon-size: 32px;
                min-height: @icon-size;
                padding-left: @icon-size + 2 * @padding;
diff --git a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js 
b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
index 53419f4..798e912 100644
--- a/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
+++ b/tests/qunit/mmv/ui/mmv.ui.metadataPanel.test.js
@@ -275,4 +275,27 @@
 
                $qf.removeClass( 'invited' );
        } );
+
+       QUnit.test( 'Repo icon', 4, function ( assert ) {
+               var $qf = $( '#qunit-fixture' ),
+                       panel = new mw.mmv.ui.MetadataPanel( $qf, $( '<div>' 
).appendTo( $qf ) ),
+                       favIcon = 'http://foo.com/bar',
+                       repoData = {
+                               favIcon: favIcon,
+                               getArticlePath : function() { return 'Foo'; },
+                               isCommons: function() { return false; }
+                       };
+
+               panel.setRepoDisplay( repoData );
+
+               assert.ok( panel.$repoLi.css( 'background-image' ).indexOf( 
favIcon ) !== -1, 'Repo favicon is correctly applied' );
+               assert.ok( !panel.$repoLi.hasClass( 'commons' ), 'Repo does not 
have commons class' );
+
+               repoData.isCommons = function() { return true; };
+
+               panel.setRepoDisplay( repoData );
+
+               assert.ok( panel.$repoLi.css( 'background-image' ).indexOf( 
'data:image/svg+xml' ) !== -1, 'Repo favicon is correctly replaced by svg for 
Commons' );
+               assert.ok( panel.$repoLi.hasClass( 'commons' ), 'Repo has 
commons class' );
+       } );
 }( mediaWiki, jQuery ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie32302342eba7aa37bd310c013a9f4d7f9ae187e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Gilles <[email protected]>

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

Reply via email to