| 805 | | }}} |
| 806 | | |
| 807 | | == Media queries [''since 6970''] (deprecated) == |
| 808 | | |
| 809 | | {{{#!td style="background-color: #faa" |
| 810 | | Note: media queries are deprecated. You should use @supports rules instead (see above). |
| 811 | | }}} |
| 812 | | Media queries are used to skip a section of the style under certain conditions. Typically you want to use a feature which is introduced in a newer version of JOSM, but like to have a fall back style for users of older JOSM clients. Example: |
| 813 | | {{{ |
| 814 | | #!mapcss |
| 815 | | @media (min-josm-version: 9789) { |
| 816 | | way[highway] { |
| 817 | | width: 4; |
| 818 | | color: orange; |
| 819 | | } |
| 820 | | /* fancy new stuff */ |
| 821 | | /* ... */ |
| 822 | | } |
| 823 | | |
| 824 | | @media (max-josm-version: 9788) { |
| 825 | | way[highway] { |
| 826 | | width: 4; |
| 827 | | color: blue; |
| 828 | | } |
| 829 | | /* fall back mode, using more simple features */ |
| 830 | | /* ... */ |
| 831 | | } |
| 832 | | }}} |
| 833 | | |
| 834 | | The syntax closely matches the official [http://www.w3.org/TR/css3-mediaqueries/#syntax css syntax]. The following conditions are supported: |
| 835 | | |
| 836 | | {{{#!th |
| 837 | | '''Media condition''' |
| 838 | | }}} |
| 839 | | {{{#!th |
| 840 | | '''Description''' |
| 841 | | }}} |
| 842 | | |- |
| 843 | | {{{#!td |
| 844 | | (min-josm-version: ''<number>'') |
| 845 | | }}} |
| 846 | | {{{#!td |
| 847 | | Only include {{{@media}}} section when the current version of JOSM is greater than or equal to the specified number. |
| 848 | | }}} |
| 849 | | |- |
| 850 | | {{{#!td |
| 851 | | (max-josm-version: ''<number>'') |
| 852 | | }}} |
| 853 | | {{{#!td |
| 854 | | Only include {{{@media}}} section when the current version of JOSM is lower than or equal to the specified number. |
| 855 | | }}} |
| 856 | | |- |
| 857 | | {{{#!td |
| 858 | | (user-agent: ''<string>'') |
| 859 | | }}} |
| 860 | | {{{#!td |
| 861 | | Only include {{{@media}}} section when the name of the editor / renderer matches the given string. In JOSM, the only accepted value is {{{josm}}}. |
| 862 | | }}} |
| 863 | | |
| 864 | | Conditions can be combined with {{{and}}}: |
| 865 | | |
| 866 | | {{{ |
| 867 | | #!mapcss |
| 868 | | @media (min-josm-version: 6970) and (max-josm-version: 7014) { |
| 869 | | /* only for JOSM versions 6970 to 7014 */ |
| 870 | | } |
| 871 | | }}} |
| 872 | | |
| 873 | | Multiple combined conditions can be chained with a comma (logical ''or''): |
| 874 | | |
| 875 | | {{{ |
| 876 | | #!mapcss |
| 877 | | @media (min-josm-version: 6970) and (max-josm-version: 7014), (user-agent: myEditor) { |
| 878 | | /* for JOSM version 6970 to 7014 and for the editor called "myEditor" */ |
| 879 | | } |
| 880 | | }}} |
| 881 | | |
| 882 | | Since media queries are only supported in JOSM 6970 and later, you should also specify this as minimum JOSM version in the meta selector: |
| 883 | | |
| 884 | | {{{ |
| 885 | | #!mapcss |
| 886 | | meta { |
| 887 | | min-josm-version: "6970"; /* This style uses media queries */ |
| 888 | | /* ... */ |
| 889 | | } |
| 890 | | }}} |
| 891 | | |
| 892 | | |
| 893 | | {{{#!comment |
| 894 | | There is also the {{{not}}} keyword (see the linked css doc for details). |
| 895 | | This is implemented, but probably not very useful. Feel free to add documentation. |
| | 1197 | == Media queries [''since 6970''] (deprecated) == |
| | 1198 | |
| | 1199 | {{{#!td style="background-color: #faa" |
| | 1200 | Note: media queries are deprecated. You should use @supports rules instead (see above). |
| | 1201 | }}} |
| | 1202 | Media queries are used to skip a section of the style under certain conditions. Typically you want to use a feature which is introduced in a newer version of JOSM, but like to have a fall back style for users of older JOSM clients. Example: |
| | 1203 | {{{ |
| | 1204 | #!mapcss |
| | 1205 | @media (min-josm-version: 9789) { |
| | 1206 | way[highway] { |
| | 1207 | width: 4; |
| | 1208 | color: orange; |
| | 1209 | } |
| | 1210 | /* fancy new stuff */ |
| | 1211 | /* ... */ |
| | 1212 | } |
| | 1213 | |
| | 1214 | @media (max-josm-version: 9788) { |
| | 1215 | way[highway] { |
| | 1216 | width: 4; |
| | 1217 | color: blue; |
| | 1218 | } |
| | 1219 | /* fall back mode, using more simple features */ |
| | 1220 | /* ... */ |
| | 1221 | } |
| | 1222 | }}} |
| | 1223 | |
| | 1224 | The syntax closely matches the official [http://www.w3.org/TR/css3-mediaqueries/#syntax css syntax]. The following conditions are supported: |
| | 1225 | |
| | 1226 | {{{#!th |
| | 1227 | '''Media condition''' |
| | 1228 | }}} |
| | 1229 | {{{#!th |
| | 1230 | '''Description''' |
| | 1231 | }}} |
| | 1232 | |- |
| | 1233 | {{{#!td |
| | 1234 | (min-josm-version: ''<number>'') |
| | 1235 | }}} |
| | 1236 | {{{#!td |
| | 1237 | Only include {{{@media}}} section when the current version of JOSM is greater than or equal to the specified number. |
| | 1238 | }}} |
| | 1239 | |- |
| | 1240 | {{{#!td |
| | 1241 | (max-josm-version: ''<number>'') |
| | 1242 | }}} |
| | 1243 | {{{#!td |
| | 1244 | Only include {{{@media}}} section when the current version of JOSM is lower than or equal to the specified number. |
| | 1245 | }}} |
| | 1246 | |- |
| | 1247 | {{{#!td |
| | 1248 | (user-agent: ''<string>'') |
| | 1249 | }}} |
| | 1250 | {{{#!td |
| | 1251 | Only include {{{@media}}} section when the name of the editor / renderer matches the given string. In JOSM, the only accepted value is {{{josm}}}. |
| | 1252 | }}} |
| | 1253 | |
| | 1254 | Conditions can be combined with {{{and}}}: |
| | 1255 | |
| | 1256 | {{{ |
| | 1257 | #!mapcss |
| | 1258 | @media (min-josm-version: 6970) and (max-josm-version: 7014) { |
| | 1259 | /* only for JOSM versions 6970 to 7014 */ |
| | 1260 | } |
| | 1261 | }}} |
| | 1262 | |
| | 1263 | Multiple combined conditions can be chained with a comma (logical ''or''): |
| | 1264 | |
| | 1265 | {{{ |
| | 1266 | #!mapcss |
| | 1267 | @media (min-josm-version: 6970) and (max-josm-version: 7014), (user-agent: myEditor) { |
| | 1268 | /* for JOSM version 6970 to 7014 and for the editor called "myEditor" */ |
| | 1269 | } |
| | 1270 | }}} |
| | 1271 | |
| | 1272 | Since media queries are only supported in JOSM 6970 and later, you should also specify this as minimum JOSM version in the meta selector: |
| | 1273 | |
| | 1274 | {{{ |
| | 1275 | #!mapcss |
| | 1276 | meta { |
| | 1277 | min-josm-version: "6970"; /* This style uses media queries */ |
| | 1278 | /* ... */ |
| | 1279 | } |
| | 1280 | }}} |
| | 1281 | |
| | 1282 | |
| | 1283 | {{{#!comment |
| | 1284 | There is also the {{{not}}} keyword (see the linked css doc for details). |
| | 1285 | This is implemented, but probably not very useful. Feel free to add documentation. |
| | 1286 | }}} |
| | 1287 | |