blob: d5e62f5595f8599e8a642bc6dbddeccca35107fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function highlightIfChanged(node, oldVal, newVal) {
function clearHighlight() {
this.removeAttribute('highlighted');
}
var oldStr = oldVal.toString();
var newStr = newVal.toString();
if (oldStr != '' && oldStr != newStr) {
// Note the addListener function does not end up creating duplicate
// listeners. There can be only one listener per event at a time.
// Reference: https://developer.mozilla.org/en/DOM/element.addEventListener
node.addEventListener('webkitAnimationEnd', clearHighlight, false);
node.setAttribute('highlighted');
}
}
(function () {
// Contains the latest snapshot of sync about info.
chrome.sync.aboutInfo = {};
// TODO(akalin): Make aboutInfo have key names likeThis and not
// like_this.
function refreshAboutInfo(aboutInfo) {
chrome.sync.aboutInfo = aboutInfo;
var aboutInfoDiv = document.getElementById('aboutInfo');
jstProcess(new JsEvalContext(aboutInfo), aboutInfoDiv);
}
function onLoad() {
chrome.sync.getAboutInfo(refreshAboutInfo);
chrome.sync.onServiceStateChanged.addListener(function() {
chrome.sync.getAboutInfo(refreshAboutInfo);
});
}
document.addEventListener("DOMContentLoaded", onLoad, false);
})();
|