OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * A lookup helper function to find the first node that has an id (starting | 9 * A lookup helper function to find the first node that has an id (starting |
10 * at |node| and going up the parent chain). | 10 * at |node| and going up the parent chain). |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 }); | 322 }); |
323 } | 323 } |
324 | 324 |
325 // The install warnings. | 325 // The install warnings. |
326 if (extension.installWarnings) { | 326 if (extension.installWarnings) { |
327 var panel = node.querySelector('.install-warnings'); | 327 var panel = node.querySelector('.install-warnings'); |
328 panel.hidden = false; | 328 panel.hidden = false; |
329 var list = panel.querySelector('ul'); | 329 var list = panel.querySelector('ul'); |
330 extension.installWarnings.forEach(function(warning) { | 330 extension.installWarnings.forEach(function(warning) { |
331 var li = document.createElement('li'); | 331 var li = document.createElement('li'); |
332 li[warning.isHTML ? 'innerHTML' : 'innerText'] = warning.message; | 332 li.innerText = warning.message; |
333 list.appendChild(li); | 333 list.appendChild(li); |
334 }); | 334 }); |
335 } | 335 } |
336 | 336 |
337 this.appendChild(node); | 337 this.appendChild(node); |
338 if (location.hash.substr(1) == extension.id) { | 338 if (location.hash.substr(1) == extension.id) { |
339 // Scroll beneath the fixed header so that the extension is not | 339 // Scroll beneath the fixed header so that the extension is not |
340 // obscured. | 340 // obscured. |
341 var topScroll = node.offsetTop - $('page-header').offsetHeight; | 341 var topScroll = node.offsetTop - $('page-header').offsetHeight; |
342 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); | 342 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); |
343 if (!isNaN(pad)) | 343 if (!isNaN(pad)) |
344 topScroll -= pad / 2; | 344 topScroll -= pad / 2; |
345 document.body.scrollTop = topScroll; | 345 document.body.scrollTop = topScroll; |
346 } | 346 } |
347 } | 347 } |
348 }; | 348 }; |
349 | 349 |
350 return { | 350 return { |
351 ExtensionsList: ExtensionsList | 351 ExtensionsList: ExtensionsList |
352 }; | 352 }; |
353 }); | 353 }); |
OLD | NEW |