Chromium Code Reviews| Index: chrome/browser/resources/translate_internals/translate_internals.js |
| diff --git a/chrome/browser/resources/translate_internals/translate_internals.js b/chrome/browser/resources/translate_internals/translate_internals.js |
| index 1e780744733724d175f865c5d0a347f24502945a..41902ed3c0a2639ad98f5830f493c2661d74c6c5 100644 |
| --- a/chrome/browser/resources/translate_internals/translate_internals.js |
| +++ b/chrome/browser/resources/translate_internals/translate_internals.js |
| @@ -60,6 +60,22 @@ |
| activateTabByHash(); |
| } |
| + /* |
| + * Creates a button to dismiss an item. |
| + * |
| + * @param {Function} func Callback called when the button is clicked. |
| + */ |
| + function createDismissingButton(func) { |
| + var button = document.createElement('button'); |
| + button.textContent = 'X'; |
| + button.classList.add('dismissing'); |
| + button.addEventListener('click', function(e) { |
| + e.preventDefault(); |
| + func(); |
| + }, false); |
| + return button; |
| + } |
| + |
| /** |
| * Creates a new LI element with a button to dismiss the item. |
| * |
| @@ -72,15 +88,7 @@ |
| var li = document.createElement('li'); |
| li.appendChild(span); |
| - |
| - var button = document.createElement('button'); |
| - button.textContent = 'X'; |
| - button.addEventListener('click', function(e) { |
| - e.preventDefault(); |
| - func(); |
| - }, false); |
| - |
| - li.appendChild(button); |
| + li.appendChild(createDismissingButton(func)); |
| return li; |
| } |
| @@ -206,7 +214,14 @@ |
| }); |
| } |
| - var p = document.querySelector('#prefs-dump p'); |
| + var p = $('prefs-too-often-denied'); |
| + p.classList.toggle('prefs-setting-disabled', |
| + !detail['translate_too_often_denied']); |
| + p.appendChild(createDismissingButton(function() { |
|
Evan Stade
2014/07/07 16:12:39
I think if you do:
p.appendChild(createDismissing
hajimehoshi
2014/07/08 05:33:47
Done.
|
| + chrome.send('removePrefItem', ['too_often_denied']); |
| + })); |
| + |
| + p = document.querySelector('#prefs-dump p'); |
| var content = JSON.stringify(detail, null, 2); |
| p.textContent = content; |
| } |