UNPKG

766 BJavaScriptView Raw
1'use strict';
2
3var App = {
4 init: function() {
5 this.events();
6 this.fixFileProtocol();
7 },
8 fixFileProtocol: function() {
9 if (window.location.protocol === 'file:') {
10 return;
11 }
12
13 var links = document.querySelectorAll('.page a');
14 for (var i = 0, len = links.length; i < len; i++) {
15 var link = links[i];
16 if (link.href.search(/^file:/) !== -1) {
17 link.removeAttribute('href');
18 }
19 }
20 },
21 events: function() {
22 var ef = document.querySelector('.show-only-errors');
23 ef && ef.addEventListener('click', function() {
24 document.body.classList.toggle('show-only-errors_checked');
25 }, false);
26 }
27};
28
29App.init();