|
1 |
| -var domReady = function(callback) { |
2 |
| - var state = document.readyState ; |
3 |
| - if ( state === 'interactive' || state === 'complete' ) { |
4 |
| - callback() ; |
5 |
| - } |
6 |
| - else { |
| 1 | +const domReady = function (callback) { |
| 2 | + const state = document.readyState; |
| 3 | + if (state === 'interactive' || state === 'complete') { |
| 4 | + callback(); |
| 5 | + } else { |
7 | 6 | document.addEventListener('DOMContentLoaded', callback);
|
8 | 7 | }
|
9 |
| -} ; |
10 |
| - |
| 8 | +}; |
11 | 9 |
|
12 |
| -domReady(function(){ |
13 |
| - |
14 |
| - var projectname = document.createElement('a'); |
| 10 | +domReady(() => { |
| 11 | + const projectname = document.createElement('a'); |
15 | 12 | projectname.classList.add('project-name');
|
16 | 13 | projectname.text = 'compression-algorithm/lempel-ziv';
|
17 |
| - projectname.href = './index.html' ; |
| 14 | + projectname.href = './index.html'; |
18 | 15 |
|
19 |
| - var header = document.getElementsByTagName('header')[0] ; |
20 |
| - header.insertBefore(projectname,header.firstChild); |
| 16 | + const header = document.querySelectorAll('header')[0]; |
| 17 | + header.insertBefore(projectname, header.firstChild); |
21 | 18 |
|
22 |
| - var testlink = document.querySelector('header > a[data-ice="testLink"]') ; |
23 |
| - testlink.href = 'https://coveralls.io/github/compression-algorithm/lempel-ziv' ; |
24 |
| - testlink.target = '_BLANK' ; |
| 19 | + const testlink = document.querySelector('header > a[data-ice="testLink"]'); |
| 20 | + testlink.href = |
| 21 | + 'https://coveralls.io/github/compression-algorithm/lempel-ziv'; |
| 22 | + testlink.target = '_BLANK'; |
25 | 23 |
|
26 |
| - var searchBox = document.querySelector('.search-box'); |
27 |
| - var input = document.querySelector('.search-input'); |
| 24 | + const searchBox = document.querySelector('.search-box'); |
| 25 | + const input = document.querySelector('.search-input'); |
28 | 26 |
|
29 |
| - // active search box when focus on searchBox. |
30 |
| - input.addEventListener('focus', function(){ |
| 27 | + // Active search box when focus on searchBox. |
| 28 | + input.addEventListener('focus', () => { |
31 | 29 | searchBox.classList.add('active');
|
32 | 30 | });
|
33 |
| - |
34 | 31 | });
|
0 commit comments