| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 var CodeSection = Polymer({ | 8 var CodeSection = Polymer({ |
| 9 is: 'extensions-code-section', | 9 is: 'extensions-code-section', |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 /** | 30 /** |
| 31 * Computes the content of the line numbers span, which basically just | 31 * Computes the content of the line numbers span, which basically just |
| 32 * contains 1\n2\n3\n... for the number of lines. | 32 * contains 1\n2\n3\n... for the number of lines. |
| 33 * @return {string} | 33 * @return {string} |
| 34 * @private | 34 * @private |
| 35 */ | 35 */ |
| 36 computeLineNumbersContent_: function() { | 36 computeLineNumbersContent_: function() { |
| 37 if (!this.code) | 37 if (!this.code) |
| 38 return ''; | 38 return ''; |
| 39 | 39 |
| 40 var lines = [this.code.beforeHighlight, | 40 var lines = [ |
| 41 this.code.highlight, | 41 this.code.beforeHighlight, this.code.highlight, this.code.afterHighlight |
| 42 this.code.afterHighlight].join('').match(/\n/g); | 42 ].join('').match(/\n/g); |
| 43 var lineCount = lines ? lines.length : 0; | 43 var lineCount = lines ? lines.length : 0; |
| 44 var textContent = ''; | 44 var textContent = ''; |
| 45 for (var i = 1; i <= lineCount; ++i) | 45 for (var i = 1; i <= lineCount; ++i) |
| 46 textContent += i + '\n'; | 46 textContent += i + '\n'; |
| 47 return textContent; | 47 return textContent; |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * @return {boolean} | 51 * @return {boolean} |
| 52 * @private | 52 * @private |
| 53 */ | 53 */ |
| 54 isMainHidden_: function() { | 54 isMainHidden_: function() { |
| 55 return !this.code; | 55 return !this.code; |
| 56 }, | 56 }, |
| 57 }); | 57 }); |
| 58 | 58 |
| 59 return {CodeSection: CodeSection}; | 59 return {CodeSection: CodeSection}; |
| 60 }); | 60 }); |
| OLD | NEW |