1// Copyright 2013 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() {
6
7function addGplusButton() {
8  var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
9  po.src = 'https://apis.google.com/js/plusone.js?onload=onLoadCallback';
10  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
11}
12
13function openFeedback(e) {
14  e.preventDefault();
15  userfeedback.api.startFeedback({productId: 86265});
16}
17
18function addGoogleFeedback() {
19  [].forEach.call(document.querySelectorAll('[data-feedback]'), function(el, i) {
20    el.addEventListener('click', openFeedback);
21  });
22}
23
24
25// Auto syntax highlight all pre tags.
26function prettyPrintCode() {
27  var pres = document.querySelectorAll('pre');
28  for (var i = 0, pre; pre = pres[i]; ++i) {
29    pre.classList.add('prettyprint');
30  }
31  window.prettyPrint && prettyPrint();
32}
33
34prettyPrintCode();
35addGoogleFeedback();
36addGplusButton();
37
38})();