]>
git.proxmox.com Git - rustc.git/blob - src/doc/book/ferris.js
3 attr
: 'does_not_compile',
4 title
: 'This code does not compile!'
8 title
: 'This code panics!'
11 attr
: 'not_desired_behavior',
12 title
: 'This code does not produce the desired behavior.'
16 document
.addEventListener('DOMContentLoaded', () => {
17 for (var ferrisType
of ferrisTypes
) {
18 attachFerrises(ferrisType
)
22 function attachFerrises (type
) {
23 var elements
= document
.getElementsByClassName(type
.attr
)
25 for (var codeBlock
of elements
) {
26 var lines
= codeBlock
.textContent
.split(/\r|\r\n|\n/).length
- 1;
29 attachFerris(codeBlock
, type
)
34 function attachFerris (element
, type
) {
35 var a
= document
.createElement('a')
36 a
.setAttribute('href', 'ch00-00-introduction.html#ferris')
37 a
.setAttribute('target', '_blank')
39 var img
= document
.createElement('img')
40 img
.setAttribute('src', 'img/ferris/' + type
.attr
+ '.svg')
41 img
.setAttribute('title', type
.title
)
42 img
.className
= 'ferris'
46 element
.parentElement
.insertBefore(a
, element
)