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() { 6 'use strict'; 7 var toggleDisplay = function(event) { 8 var originatingButton = event.target; 9 var detailsNode = originatingButton.parentNode.getElementsByClassName( 10 'details')[0]; 11 12 if (detailsNode.getAttribute('hidden') != null) { 13 detailsNode.removeAttribute('hidden'); 14 } else { 15 detailsNode.setAttribute('hidden', 'hidden'); 16 } 17 } 18 19 var syncEvents = $('sync-events'); 20 21 var entries = chrome.sync.log.entries; 22 var displaySyncEvents = function() { 23 var eventTemplateContext = { 24 eventList: entries, 25 }; 26 var context = new JsEvalContext(eventTemplateContext); 27 jstProcess(context, syncEvents); 28 } 29 30 syncEvents.addEventListener('click', toggleDisplay); 31 chrome.sync.log.addEventListener('append', function(event) { 32 displaySyncEvents(); 33 }); 34 })(); 35