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.
5 cr.define('chrome.sync.events_tab', function() {
8 function toggleDisplay(event) {
9 var originatingButton = event.target;
10 if (originatingButton.className != 'toggle-button') {
13 var detailsNode = originatingButton.parentNode.getElementsByClassName(
15 var detailsColumn = detailsNode.parentNode;
16 var detailsRow = detailsColumn.parentNode;
18 if (!detailsRow.classList.contains('expanded')) {
19 detailsRow.classList.toggle('expanded');
20 detailsColumn.setAttribute('colspan', 4);
21 detailsNode.removeAttribute('hidden');
23 detailsNode.setAttribute('hidden', '');
24 detailsColumn.removeAttribute('colspan');
25 detailsRow.classList.toggle('expanded');
29 function displaySyncEvents() {
30 var entries = chrome.sync.log.entries;
31 var eventTemplateContext = {
34 var context = new JsEvalContext(eventTemplateContext);
35 jstProcess(context, $('sync-events'));
39 $('sync-events').addEventListener('click', toggleDisplay);
40 chrome.sync.log.addEventListener('append', function(event) {
50 document.addEventListener(
51 'DOMContentLoaded', chrome.sync.events_tab.onLoad, false);