|
5 | 5 |
|
6 | 6 | <h1 class="sr-only">Speakers</h1>
|
7 | 7 |
|
8 |
| -<script> |
9 |
| - {% comment %} |
10 |
| - Generates a random placeholder image: |
11 |
| - css: css class for <img> element |
12 |
| - name: identifier for the speaker that gets hashed |
13 |
| - path: the path to the image with a # for the image. # gets replaced |
14 |
| - alt: alt text for the image |
15 |
| - num: total number of placeholder image options for modulo |
16 |
| - {% endcomment %} |
17 |
| - function placeholderImage(css, name, path, alt, num) { |
18 |
| - const hashCode = function(str) { |
19 |
| - if (Array.prototype.reduce) { |
20 |
| - return str.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); |
21 |
| - } else { |
22 |
| - var hash = 0, i, chr, len; |
23 |
| - if (str.length == 0) return hash; |
24 |
| - for (i = 0, len = str.length; i < len; i++) { |
25 |
| - chr = str.charCodeAt(i); |
26 |
| - hash = ((hash << 5) - hash) + chr; |
27 |
| - hash |= 0; // Convert to 32bit integer |
28 |
| - } |
29 |
| - return hash; |
30 |
| - } |
31 |
| - }; |
32 |
| - |
33 |
| - var output = '<img '; |
34 |
| - output += 'class="' + css + '" '; |
35 |
| - output += 'alt="' + alt + '" '; |
36 |
| - output += 'src="' + path.replace('#', Math.abs(hashCode(name)) % 10) + '" '; |
37 |
| - output = output.trim() + '>'; |
38 |
| - document.write(output); |
39 |
| - } |
40 |
| -</script> |
41 |
| - |
42 | 8 | {% if site.data.speakers %}
|
43 | 9 | <section>
|
44 | 10 | <div class="container">
|
|
0 commit comments