Home | History | Annotate | Download | only in resources
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 function $(o) {return document.getElementById(o);}
      6 
      7 function toggle(o) {
      8   var licence = o.nextSibling;
      9 
     10   while (licence.className != 'licence') {
     11     if (!licence) return false;
     12     licence = licence.nextSibling;
     13   }
     14 
     15   if (licence.style && licence.style.display == 'block') {
     16     licence.style.display = 'none';
     17     o.innerHTML = 'show license';
     18   } else {
     19     licence.style.display = 'block';
     20     o.innerHTML = 'hide license';
     21   }
     22   return false;
     23 }
     24 
     25 document.body.onload = function () {
     26   var links = document.getElementsByTagName("a");
     27   for (var i = 0; i < links.length; i++) {
     28     if (links[i].className === "show") {
     29       links[i].onclick = function () { return toggle(this); };
     30     }
     31   }
     32 
     33   $("print-link").onclick = function () {
     34     window.print();
     35     return false;
     36   }
     37 };
     38 
     39