| Index: chrome/browser/resources/components.js
|
| diff --git a/chrome/browser/resources/components.js b/chrome/browser/resources/components.js
|
| index 8753e3192ab210b51c8f2d1ea813a50ca67c33bd..ef67ec014ccbdccab06c536c5cf32f702d368de5 100644
|
| --- a/chrome/browser/resources/components.js
|
| +++ b/chrome/browser/resources/components.js
|
| @@ -14,8 +14,11 @@
|
| function renderTemplate(componentsData) {
|
| // This is the javascript code that processes the template:
|
| var input = new JsEvalContext(componentsData);
|
| - var output = $('componentTemplate');
|
| + var output = $('componentTemplate').cloneNode(true);
|
| + $('componentPlaceholder').innerHTML = '';
|
| + $('componentPlaceholder').appendChild(output);
|
| jstProcess(input, output);
|
| + output.style.visibility = 'visible';
|
| }
|
|
|
| /**
|
| @@ -72,6 +75,21 @@ function returnComponentsData(componentsData) {
|
| body.className = 'show-tmi-mode-initial';
|
| }
|
|
|
| +function returnComponentStatus(component_id, status) {
|
| + $('status-' + component_id).innerText = status;
|
| + var node = $(component_id);
|
| + if (status == 'in-progress') {
|
| + node.disabled = true;
|
| + window.setTimeout(function() { updateComponentStatus(node); }, 1000);
|
| + } else {
|
| + node.disabled = false;
|
| + }
|
| +}
|
| +
|
| +function updateComponentStatus(node) {
|
| + chrome.send('requestComponentStatus', [String(node.id)]);
|
| +}
|
| +
|
| /**
|
| * Handles an 'enable' or 'disable' button getting clicked.
|
| * @param {HTMLElement} node The HTML element representing the component
|
| @@ -79,12 +97,13 @@ function returnComponentsData(componentsData) {
|
| */
|
| function handleCheckUpdate(node) {
|
| node.disabled = true;
|
| +
|
| + $('status-' + String(node.id)).innerText = 'Checking for update...';
|
| +
|
| // Tell the C++ ComponentssDOMHandler to check for update.
|
| chrome.send('checkUpdate', [String(node.id)]);
|
| + window.setTimeout(function() { updateComponentStatus(node); }, 1000);
|
| }
|
|
|
| // Get data and have it displayed upon loading.
|
| document.addEventListener('DOMContentLoaded', requestComponentsData);
|
| -
|
| -// Add handlers to static HTML elements.
|
| -$('button-check-update').onclick = handleCheckUpdate;
|
|
|