Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/resources/sync_internals/events.js

Issue 454573002: [Sync] Make about:sync events page more selection friendly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser_test Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 cr.define('chrome.sync.events_tab', function() {
6 'use strict'; 6 'use strict';
7 var toggleDisplay = function(event) {
8 var originatingButton = event.target;
9 var detailsNode = originatingButton.parentNode.getElementsByClassName(
10 'details')[0];
11 7
12 if (detailsNode.getAttribute('hidden') != null) { 8 function toggleDisplay(event) {
13 detailsNode.removeAttribute('hidden'); 9 var originatingButton = event.target;
14 } else { 10 if (originatingButton.className != 'toggle-button') {
15 detailsNode.setAttribute('hidden', 'hidden'); 11 return;
12 }
13 var detailsNode = originatingButton.parentNode.getElementsByClassName(
14 'details')[0];
15 var detailsColumn = detailsNode.parentNode;
16 var detailsRow = detailsColumn.parentNode;
17
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');
26 }
27 };
28
29 function displaySyncEvents() {
30 var entries = chrome.sync.log.entries;
31 var eventTemplateContext = {
32 eventList: entries,
33 };
34 var context = new JsEvalContext(eventTemplateContext);
35 jstProcess(context, $('sync-events'));
36 };
37
38 function onLoad() {
39 $('sync-events').addEventListener('click', toggleDisplay);
40 chrome.sync.log.addEventListener('append', function(event) {
41 displaySyncEvents();
42 });
16 } 43 }
17 }
18 44
19 var syncEvents = $('sync-events'); 45 return {
46 onLoad: onLoad
47 };
48 });
20 49
21 var entries = chrome.sync.log.entries; 50 document.addEventListener(
22 var displaySyncEvents = function() { 51 'DOMContentLoaded', chrome.sync.events_tab.onLoad, false);
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 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/sync_internals/events.html ('k') | chrome/browser/resources/sync_internals/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698