File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
docs/yuidoc-p5-theme-src/scripts Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ <h3><%=item.name%><% if (item.isMethod) { %>()<% } %></h3>
4
4
< div class ="example ">
5
5
< h4 > Example</ h4 >
6
6
7
- < div class ="example-content ">
7
+ < div class ="example-content " data-alt =" <%= item.alt %> " >
8
8
< %= item.example %>
9
9
</ div >
10
10
</ div >
@@ -13,6 +13,7 @@ <h4>Example</h4>
13
13
14
14
< div class ="description ">
15
15
< h4 > Description</ h4 >
16
+
16
17
< p > < %= item.description %> </ p >
17
18
18
19
< % if (item.module === 'p5.dom') { %>
Original file line number Diff line number Diff line change @@ -99,6 +99,21 @@ define([
99
99
this . $el . html ( itemHtml ) ;
100
100
101
101
renderCode ( ) ;
102
+
103
+ // Hook up alt-text for examples
104
+ setTimeout ( function ( ) {
105
+ var alts = $ ( '.example-content' ) [ 0 ] ;
106
+ if ( alts ) {
107
+ alts = $ ( alts ) . data ( 'alt' ) . split ( '\n' ) ;
108
+
109
+ var examples = $ ( '.example_container canvas' ) ;
110
+ for ( var i = 0 ; i < alts . length ; i ++ ) {
111
+ if ( i < examples . length ) {
112
+ $ ( examples [ i ] ) . attr ( 'alt' , alts [ i ] ) ;
113
+ }
114
+ }
115
+ }
116
+ } , 1000 ) ;
102
117
Prism . highlightAll ( ) ;
103
118
}
104
119
Original file line number Diff line number Diff line change @@ -115,6 +115,10 @@ p5.prototype.brightness = function(c) {
115
115
* (default is 0-100)
116
116
* @return {Array } resulting color
117
117
*
118
+ * @alt
119
+ * This is alt text for example 1.
120
+ * This is alt text for example 2.
121
+ * This is alt text for example 3.
118
122
* @example
119
123
* <div>
120
124
* <code>
You can’t perform that action at this time.
0 commit comments