OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 moduleListDataFormat = { | 9 var moduleListDataFormat = { |
10 'moduleList': [ | 10 'moduleList': [ |
(...skipping 12 matching lines...) Expand all Loading... |
23 'possible_resolution': 'The help tips in string form', | 23 'possible_resolution': 'The help tips in string form', |
24 'help_url': 'The link to the Help Center article' | 24 'help_url': 'The link to the Help Center article' |
25 } | 25 } |
26 ] | 26 ] |
27 }; | 27 }; |
28 | 28 |
29 /** | 29 /** |
30 * Takes the |moduleListData| input argument which represents data about | 30 * Takes the |moduleListData| input argument which represents data about |
31 * the currently available modules and populates the html jstemplate | 31 * the currently available modules and populates the html jstemplate |
32 * with that data. It expects an object structure like the above. | 32 * with that data. It expects an object structure like the above. |
33 * @param {Object} moduleListData Information about available modules | 33 * @param {Object} moduleListData Information about available modules. |
34 */ | 34 */ |
35 function renderTemplate(moduleListData) { | 35 function renderTemplate(moduleListData) { |
36 // This is the javascript code that processes the template: | 36 // This is the javascript code that processes the template: |
37 var input = new JsEvalContext(moduleListData); | 37 var input = new JsEvalContext(moduleListData); |
38 var output = document.getElementById('modulesTemplate'); | 38 var output = $('modulesTemplate'); |
39 jstProcess(input, output); | 39 jstProcess(input, output); |
40 } | 40 } |
41 | 41 |
42 /** | 42 /** |
43 * Asks the C++ ConflictsDOMHandler to get details about the available modules | 43 * Asks the C++ ConflictsDOMHandler to get details about the available modules |
44 * and return detailed data about the configuration. The ConflictsDOMHandler | 44 * and return detailed data about the configuration. The ConflictsDOMHandler |
45 * should reply to returnModuleList() (below). | 45 * should reply to returnModuleList() (below). |
46 */ | 46 */ |
47 function requestModuleListData() { | 47 function requestModuleListData() { |
48 chrome.send('requestModuleList', []); | 48 chrome.send('requestModuleList'); |
49 } | 49 } |
50 | 50 |
51 /** | 51 /** |
52 * Called by the WebUI to re-populate the page with data representing the | 52 * Called by the WebUI to re-populate the page with data representing the |
53 * current state of installed modules. | 53 * current state of installed modules. |
| 54 * @param {Object} moduleListData Information about available modules. |
54 */ | 55 */ |
55 function returnModuleList(moduleListData) { | 56 function returnModuleList(moduleListData) { |
56 renderTemplate(moduleListData); | 57 renderTemplate(moduleListData); |
57 document.getElementById('loading-message').style.visibility = 'hidden'; | 58 $('loading-message').style.visibility = 'hidden'; |
58 document.getElementById('body-container').style.visibility = 'visible'; | 59 $('body-container').style.visibility = 'visible'; |
59 } | 60 } |
60 | 61 |
61 // Get data and have it displayed upon loading. | 62 // Get data and have it displayed upon loading. |
62 document.addEventListener('DOMContentLoaded', requestModuleListData); | 63 document.addEventListener('DOMContentLoaded', requestModuleListData); |
OLD | NEW |