1. /* globals chrome */
    
  2. 
    
  3. 'use strict';
    
  4. 
    
  5. document.addEventListener('DOMContentLoaded', function () {
    
  6.   // Make links work
    
  7.   const links = document.getElementsByTagName('a');
    
  8.   for (let i = 0; i < links.length; i++) {
    
  9.     (function () {
    
  10.       const ln = links[i];
    
  11.       const location = ln.href;
    
  12.       ln.onclick = function () {
    
  13.         chrome.tabs.create({active: true, url: location});
    
  14.         return false;
    
  15.       };
    
  16.     })();
    
  17.   }
    
  18. 
    
  19.   // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=428044
    
  20.   document.body.style.opacity = 0;
    
  21.   document.body.style.transition = 'opacity ease-out .4s';
    
  22.   requestAnimationFrame(function () {
    
  23.     document.body.style.opacity = 1;
    
  24.   });
    
  25. });