OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 /** | 5 /** |
6 * This variable structure is here to document the structure that the template | 6 * This variable structure is here to document the structure that the template |
7 * expects to correctly populate the page. | 7 * expects to correctly populate the page. |
8 */ | 8 */ |
9 var policyDataFormat = { | 9 var policyDataFormat = { |
10 // Whether any of the policies in 'policies' have a value. | 10 // Whether any of the policies in 'policies' have a value. |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 */ | 241 */ |
242 Policy.shouldDisplayPolicy = function(policy) { | 242 Policy.shouldDisplayPolicy = function(policy) { |
243 return $('toggle-unsent-policies').checked || policy.set; | 243 return $('toggle-unsent-policies').checked || policy.set; |
244 }; | 244 }; |
245 | 245 |
246 /** | 246 /** |
247 * Initializes the page and loads the list of policies and the policy | 247 * Initializes the page and loads the list of policies and the policy |
248 * status data. | 248 * status data. |
249 */ | 249 */ |
250 Policy.initialize = function() { | 250 Policy.initialize = function() { |
251 i18nTemplate.process(document, templateData); | |
252 Policy.requestData(); | 251 Policy.requestData(); |
253 | 252 |
254 // Set HTML event handlers. | 253 // Set HTML event handlers. |
255 $('fetch-policies-button').onclick = function(event) { | 254 $('fetch-policies-button').onclick = function(event) { |
256 this.disabled = true; | 255 this.disabled = true; |
257 Policy.triggerPolicyFetch(); | 256 Policy.triggerPolicyFetch(); |
258 }; | 257 }; |
259 | 258 |
260 $('toggle-unsent-policies').onchange = function(event) { | 259 $('toggle-unsent-policies').onchange = function(event) { |
261 Policy.getInstance().updatePolicyVisibility(); | 260 Policy.getInstance().updatePolicyVisibility(); |
262 }; | 261 }; |
263 | 262 |
264 $('search-field').onsearch = function(event) { | 263 $('search-field').onsearch = function(event) { |
265 Policy.getInstance().filterTable(this.value); | 264 Policy.getInstance().filterTable(this.value); |
266 }; | 265 }; |
267 }; | 266 }; |
268 | 267 |
269 // Export | 268 // Export |
270 return { | 269 return { |
271 Policy: Policy | 270 Policy: Policy |
272 }; | 271 }; |
273 }); | 272 }); |
274 | 273 |
275 var Policy = policies.Policy; | 274 var Policy = policies.Policy; |
276 | 275 |
277 // Get data and have it displayed upon loading. | 276 // Get data and have it displayed upon loading. |
278 document.addEventListener('DOMContentLoaded', policies.Policy.initialize); | 277 document.addEventListener('DOMContentLoaded', policies.Policy.initialize); |
OLD | NEW |