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.
5 var OptionsPage = options.OptionsPage;
6 var Preferences = options.Preferences;
7 var DetailsInternetPage = options.internet.DetailsInternetPage;
10 * DOMContentLoaded handler, sets up the page.
14 document.documentElement.setAttribute('os', 'chromeos');
16 // Decorate the existing elements in the document.
17 cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox);
18 cr.ui.decorate('input[pref][type=number]', options.PrefNumber);
19 cr.ui.decorate('input[pref][type=radio]', options.PrefRadio);
20 cr.ui.decorate('input[pref][type=range]', options.PrefRange);
21 cr.ui.decorate('select[pref]', options.PrefSelect);
22 cr.ui.decorate('input[pref][type=text]', options.PrefTextField);
23 cr.ui.decorate('input[pref][type=url]', options.PrefTextField);
25 DetailsInternetPage.initializeProxySettings();
27 // TODO(ivankr): remove when http://crosbug.com/20660 is resolved.
28 var inputs = document.querySelectorAll('input[pref]');
29 for (var i = 0, el; el = inputs[i]; i++) {
30 el.addEventListener('keyup', function(e) {
31 cr.dispatchSimpleEvent(this, 'change');
35 Preferences.getInstance().initialize();
36 chrome.send('coreOptionsInitialize');
38 var params = parseQueryParams(window.location);
39 var network = params.network;
41 console.error('Error: No network argument provided!');
44 chrome.send('selectNetwork', [network]);
46 DetailsInternetPage.showProxySettings();
49 disableTextSelectAndDrag(function(e) {
51 return src instanceof HTMLTextAreaElement ||
52 src instanceof HTMLInputElement &&
53 /text|url/.test(src.type);
56 document.addEventListener('DOMContentLoaded', load);