Merge "Make SVG files show "In other resolutions" at all sizes"
[lhc/web/wiklou.git] / resources / src / mediawiki.less / mediawiki.mixins.less
1 /**
2 * Common LESS mixin library for MediaWiki
3 *
4 * By default the folder containing this file is included in $wgResourceLoaderLESSImportPaths,
5 * which makes this file importable by all less files via '@import "mediawiki.mixins";'.
6 *
7 * The mixins included below are considered a public interface for MediaWiki extensions.
8 * The signatures of parametrized mixins should be kept as stable as possible.
9 *
10 * See <http://lesscss.org/#-mixins> for more information about how to write mixins.
11 */
12
13 .background-image(@url) when (embeddable(@url)) {
14 background-image: embed(@url);
15 background-image: url(@url)!ie;
16 }
17
18 .background-image(@url) when not (embeddable(@url)) {
19 background-image: url(@url);
20 }
21
22 .vertical-gradient(@startColor: gray, @endColor: white, @startPos: 0, @endPos: 100%) {
23 background-color: @endColor;
24 background-image: -moz-linear-gradient( top, @startColor @startPos, @endColor @endPos ); // Firefox 3.6+
25 background-image: -webkit-gradient( linear, left top, left bottom, color-stop( @startPos, @startColor ), color-stop( @endPos, @endColor ) ); // Safari 4+, Chrome 2+
26 background-image: -webkit-linear-gradient( top, @startColor @startPos, @endColor @endPos ); // Safari 5.1+, Chrome 10+
27 background-image: linear-gradient( @startColor @startPos, @endColor @endPos ); // Standard
28 }
29
30 /*
31 * SVG support using a transparent gradient to guarantee cross-browser
32 * compatibility (browsers able to understand gradient syntax support also SVG).
33 * http://pauginer.tumblr.com/post/36614680636/invisible-gradient-technique
34 *
35 * We use gzip compression, which means that it is okay to embed twice.
36 *
37 * We do not embed the fallback image on the assumption that the gain for old browsers
38 * is not worth the harm done to modern ones.
39 */
40 .background-image-svg(@svg, @fallback) when (embeddable(@svg)) {
41 background-image: url(@fallback);
42 /* We don't need the !ie hack because this old IE uses the fallback already */
43 background-image: -webkit-linear-gradient(transparent, transparent), embed(@svg);
44 background-image: linear-gradient(transparent, transparent), embed(@svg);
45 }
46
47 .background-image-svg(@svg, @fallback) when not (embeddable(@svg)) {
48 background-image: url(@fallback);
49 background-image: -webkit-linear-gradient(transparent, transparent), url(@svg);
50 background-image: linear-gradient(transparent, transparent), url(@svg);
51 }
52
53 /* Caution: Does not support localisable images */
54 .list-style-image(@url) when (embeddable(@url)) {
55 list-style-image: embed(@url);
56 list-style-image: url(@url)!ie;
57 }
58
59 .list-style-image(@url) when not (embeddable(@url)) {
60 list-style-image: url(@url);
61 }
62
63 .transition(@value) {
64 -webkit-transition: @value;
65 -moz-transition: @value;
66 -o-transition: @value;
67 transition: @value;
68 }
69
70 .box-sizing(@value) {
71 -webkit-box-sizing: @value;
72 -moz-box-sizing: @value;
73 box-sizing: @value;
74 }
75
76 .box-shadow(@value) {
77 -webkit-box-shadow: @value; // Android 2.3+, iOS 4.0.2-4.2, Safari 3-4
78 box-shadow: @value; // Chrome 6+, Firefox 4+, IE 9+, iOS 5+, Opera 10.50+
79 }