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 7window.buildbot = window.buildbot || {}; 8 9var prefs = new buildbot.PrefStore; 10 11// Initialize the checkbox checked state from the saved preference. 12function 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 30main(); 31 32})(); 33