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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 }); | 320 }); |
321 } | 321 } |
322 | 322 |
323 // The install warnings. | 323 // The install warnings. |
324 if (extension.installWarnings) { | 324 if (extension.installWarnings) { |
325 var panel = node.querySelector('.install-warnings'); | 325 var panel = node.querySelector('.install-warnings'); |
326 panel.hidden = false; | 326 panel.hidden = false; |
327 var list = panel.querySelector('ul'); | 327 var list = panel.querySelector('ul'); |
328 extension.installWarnings.forEach(function(warning) { | 328 extension.installWarnings.forEach(function(warning) { |
329 var li = document.createElement('li'); | 329 var li = document.createElement('li'); |
330 li[warning.isHTML ? 'innerHTML' : 'innerText'] = warning.message; | 330 li.innerText = warning.message; |
331 list.appendChild(li); | 331 list.appendChild(li); |
332 }); | 332 }); |
333 } | 333 } |
334 | 334 |
335 this.appendChild(node); | 335 this.appendChild(node); |
336 if (location.hash.substr(1) == extension.id) { | 336 if (location.hash.substr(1) == extension.id) { |
337 // Scroll beneath the fixed header so that the extension is not | 337 // Scroll beneath the fixed header so that the extension is not |
338 // obscured. | 338 // obscured. |
339 var topScroll = node.offsetTop - $('page-header').offsetHeight; | 339 var topScroll = node.offsetTop - $('page-header').offsetHeight; |
340 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); | 340 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); |
341 if (!isNaN(pad)) | 341 if (!isNaN(pad)) |
342 topScroll -= pad / 2; | 342 topScroll -= pad / 2; |
343 document.body.scrollTop = topScroll; | 343 document.body.scrollTop = topScroll; |
344 } | 344 } |
345 } | 345 } |
346 }; | 346 }; |
347 | 347 |
348 return { | 348 return { |
349 ExtensionsList: ExtensionsList | 349 ExtensionsList: ExtensionsList |
350 }; | 350 }; |
351 }); | 351 }); |
OLD | NEW |