| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 function attachListeners() { | 5 function attachListeners() { |
| 6 var radioEls = document.querySelectorAll('input[type="radio"]'); | 6 var radioEls = document.querySelectorAll('input[type="radio"]'); |
| 7 for (var i = 0; i < radioEls.length; ++i) { | 7 for (var i = 0; i < radioEls.length; ++i) { |
| 8 radioEls[i].addEventListener('click', onRadioClicked); | 8 radioEls[i].addEventListener('click', onRadioClicked); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 function onRadioClicked(e) { | 24 function onRadioClicked(e) { |
| 25 var divId = this.id.slice(5); // skip "radio" | 25 var divId = this.id.slice(5); // skip "radio" |
| 26 var functionEls = document.querySelectorAll('.function'); | 26 var functionEls = document.querySelectorAll('.function'); |
| 27 for (var i = 0; i < functionEls.length; ++i) { | 27 for (var i = 0; i < functionEls.length; ++i) { |
| 28 var visible = functionEls[i].id === divId; | 28 var visible = functionEls[i].id === divId; |
| 29 if (functionEls[i].id === divId) | 29 if (functionEls[i].id === divId) |
| 30 functionEls[i].removeAttribute('hidden'); | 30 functionEls[i].removeAttribute('hidden'); |
| 31 else | 31 else |
| 32 functionEls[i].setAttribute('hidden'); | 32 functionEls[i].setAttribute('hidden', ''); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 function getButtonClicked(e) { | 36 function getButtonClicked(e) { |
| 37 var key = document.getElementById('getKey').value; | 37 var key = document.getElementById('getKey').value; |
| 38 common.naclModule.postMessage({cmd: 'Get', key: key}); | 38 common.naclModule.postMessage({cmd: 'Get', key: key}); |
| 39 } | 39 } |
| 40 | 40 |
| 41 function setButtonClicked(e) { | 41 function setButtonClicked(e) { |
| 42 var key = document.getElementById('setKey').value; | 42 var key = document.getElementById('setKey').value; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Note that cmd is a String object, not a primitive, so the comparison cmd | 80 // Note that cmd is a String object, not a primitive, so the comparison cmd |
| 81 // !== '' will always fail. | 81 // !== '' will always fail. |
| 82 if (cmd != '') { | 82 if (cmd != '') { |
| 83 common.logMessage( | 83 common.logMessage( |
| 84 'Function ' + cmd + ' returned ' + JSON.stringify(result)); | 84 'Function ' + cmd + ' returned ' + JSON.stringify(result)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 var dictEl = document.getElementById('dict'); | 87 var dictEl = document.getElementById('dict'); |
| 88 dictEl.textContent = JSON.stringify(newDict, null, ' '); | 88 dictEl.textContent = JSON.stringify(newDict, null, ' '); |
| 89 } | 89 } |
| OLD | NEW |