| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 // Allow a function to be provided by tests, which will be called when | 7 // Allow a function to be provided by tests, which will be called when |
| 8 // the page has been populated with site engagement details. | 8 // the page has been populated with site engagement details. |
| 9 var resolvePageIsPopulated = null; | 9 var resolvePageIsPopulated = null; |
| 10 var pageIsPopulatedPromise = new Promise((resolve, reject) => { | 10 var pageIsPopulatedPromise = new Promise((resolve, reject) => { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Sets the engagement score when a score input is changed. | 106 * Sets the engagement score when a score input is changed. |
| 107 * Resets the length of engagement-bar-cell to match the new score. | 107 * Resets the length of engagement-bar-cell to match the new score. |
| 108 * Also resets the update interval. | 108 * Also resets the update interval. |
| 109 * @param {string} origin The origin of the engagement score to set. | 109 * @param {string} origin The origin of the engagement score to set. |
| 110 * @param {Event} e | 110 * @param {Event} e |
| 111 */ | 111 */ |
| 112 function handleScoreChange(origin, e) { | 112 function handleScoreChange(origin, e) { |
| 113 var scoreInput = e.target; | 113 var scoreInput = e.target; |
| 114 uiHandler.setSiteEngagementScoreForUrl(origin, scoreInput.value); | 114 uiHandler.setSiteEngagementBaseScoreForUrl(origin, scoreInput.value); |
| 115 scoreInput.barCellRef.style.width = (scoreInput.value * 4) + 'px'; | 115 scoreInput.barCellRef.style.width = (scoreInput.value * 4) + 'px'; |
| 116 scoreInput.blur(); | 116 scoreInput.blur(); |
| 117 enableAutoupdate(); | 117 enableAutoupdate(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Remove all rows from the engagement table. | 121 * Remove all rows from the engagement table. |
| 122 */ | 122 */ |
| 123 function clearTable() { | 123 function clearTable() { |
| 124 engagementTableBody.innerHTML = ''; | 124 engagementTableBody.innerHTML = ''; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 uiHandler.getSiteEngagementDetails().then((response) => { | 178 uiHandler.getSiteEngagementDetails().then((response) => { |
| 179 info = response.info; | 179 info = response.info; |
| 180 renderTable(info); | 180 renderTable(info); |
| 181 }); | 181 }); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 updateEngagementTable(); | 184 updateEngagementTable(); |
| 185 enableAutoupdate(); | 185 enableAutoupdate(); |
| 186 }; | 186 }; |
| 187 }); | 187 }); |
| OLD | NEW |