- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / examples / extensions / buildbot / options.js
1 // Copyright (c) 2012 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
7 window.buildbot = window.buildbot || {};
8
9 var prefs = new buildbot.PrefStore;
10
11 // Initialize the checkbox checked state from the saved preference.
12 function main() {
13   var checkbox = document.getElementById('notifications');
14   prefs.getUseNotifications(function(useNotifications) {
15     checkbox.checked = useNotifications;
16     checkbox.addEventListener(
17       'click',
18       function() {prefs.setUseNotifications(checkbox.checked);});
19   });
20
21   var textbox = document.getElementById('try-job-username');
22   prefs.getTryJobUsername(function(tryJobUsername) {
23     textbox.value = tryJobUsername;
24     textbox.addEventListener(
25         'change',
26         function() {prefs.setTryJobUsername(textbox.value);});
27   });
28 }
29
30 main();
31
32 })();