Allow only one bookmark to be added for multiple fast starring
[chromium-blink-merge.git] / chrome / browser / resources / sync_internals / events.js
blobf18477d17b55ea9ae4b32e5b121768ea19f5074a
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() {
6 'use strict';
8 function toggleDisplay(event) {
9 var originatingButton = event.target;
10 if (originatingButton.className != 'toggle-button') {
11 return;
13 var detailsNode = originatingButton.parentNode.getElementsByClassName(
14 'details')[0];
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');
22 } else {
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 = {
32 eventList: entries,
34 var context = new JsEvalContext(eventTemplateContext);
35 jstProcess(context, $('sync-events'));
38 function onLoad() {
39 $('sync-events').addEventListener('click', toggleDisplay);
40 chrome.sync.log.addEventListener('append', function(event) {
41 displaySyncEvents();
42 });
45 return {
46 onLoad: onLoad
48 });
50 document.addEventListener(
51 'DOMContentLoaded', chrome.sync.events_tab.onLoad, false);