File tree Expand file tree Collapse file tree 4 files changed +52
-3
lines changed
Expand file tree Collapse file tree 4 files changed +52
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,10 @@ function addAltTextToImages() {
1313
1414 imagesWithoutAlt . forEach ( ( img ) => {
1515 const position = Array . from ( allImages ) . indexOf ( img ) + 1 ;
16- const altText = "Image " + position + " in article" ;
16+ const altText = window . articleImageAltText . replace (
17+ "{{position}}" ,
18+ position
19+ ) ;
1720 img . setAttribute ( "alt" , altText ) ;
1821 } ) ;
1922 }
@@ -27,7 +30,7 @@ function addAltTextToImages() {
2730
2831 imagesWithoutAlt . forEach ( ( img ) => {
2932 const position = Array . from ( allImages ) . indexOf ( img ) + 1 ;
30- const altText = "Image " + position + " in post" ;
33+ const altText = window . postImageAltText . replace ( "{{ position}}" , position ) ;
3134 img . setAttribute ( "alt" , altText ) ;
3235 } ) ;
3336 }
Original file line number Diff line number Diff line change 11<meta content =" width=device-width, initial-scale=1.0" name =" viewport" />
22<!-- Make the translated search clear button label available for use in JS -->
33<!-- See buildClearSearchButton() in script.js -->
4- <script type =" text/javascript" >window .searchClearButtonLabelLocalized = " {{t 'search_clear'}}" ;</script >
4+ <script type =" text/javascript" >
5+ window .searchClearButtonLabelLocalized = " {{t 'search_clear'}}" ;
6+ window .articleImageAltText = " {{t 'article_image_alt_text' position=0}}" ;
7+ window .postImageAltText = " {{t 'post_image_alt_text' position=0}}" ;
8+ </script >
59<script type =" text/javascript" >
610 // Load ES module polyfill only for browsers that don't support ES modules
711 if (! (HTMLScriptElement .supports && HTMLScriptElement .supports (' importmap' ))) {
Original file line number Diff line number Diff line change 11{
2+ "article_image_alt_text" : " Image {{position}} in article" ,
3+ "post_image_alt_text" : " Image {{position}} in post" ,
24 "article_author_description" : " Show author image and name" ,
35 "article_author_label" : " Author" ,
46 "article_comments_description" : " Show comments on articles" ,
You can’t perform that action at this time.
0 commit comments