Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 /** | 5 /** |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Audits2.Audits2Panel = class extends UI.PanelWithSidebar { | 8 Audits2.Audits2Panel = class extends UI.PanelWithSidebar { |
| 9 constructor() { | 9 constructor() { |
| 10 super('audits2'); | 10 super('audits2'); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 var text = landingCenter.createChild('div', 'audits2-landing-text'); | 65 var text = landingCenter.createChild('div', 'audits2-landing-text'); |
| 66 text.createChild('span', 'audits2-landing-bold-text').textContent = Common.U IString('Audits'); | 66 text.createChild('span', 'audits2-landing-bold-text').textContent = Common.U IString('Audits'); |
| 67 text.createChild('span').textContent = Common.UIString( | 67 text.createChild('span').textContent = Common.UIString( |
| 68 ' help you identify and fix common problems that affect' + | 68 ' help you identify and fix common problems that affect' + |
| 69 ' your site\'s performance, accessibility, and user experience. '); | 69 ' your site\'s performance, accessibility, and user experience. '); |
| 70 var link = text.createChild('span', 'link'); | 70 var link = text.createChild('span', 'link'); |
| 71 link.textContent = Common.UIString('Learn more'); | 71 link.textContent = Common.UIString('Learn more'); |
| 72 link.addEventListener( | 72 link.addEventListener( |
| 73 'click', () => InspectorFrontendHost.openInNewTab('https://developers.go ogle.com/web/tools/lighthouse/')); | 73 'click', () => InspectorFrontendHost.openInNewTab('https://developers.go ogle.com/web/tools/lighthouse/')); |
| 74 | 74 |
| 75 var newButton = UI.createTextButton( | 75 var newButton = |
| 76 Common.UIString('Perform an audit\u2026'), this._showLauncherUI.bind(thi s), 'material-button default'); | 76 UI.createTextButton(Common.UIString('Perform an audit\u2026'), this._sho wLauncherUI.bind(this), 'primary'); |
|
dgozman
2017/05/15 21:29:00
Let's either pass a boolean primary, or have two m
luoe
2017/05/18 21:29:25
Done as boolean primary. I don't think we need to
| |
| 77 landingCenter.appendChild(newButton); | 77 landingCenter.appendChild(newButton); |
| 78 } | 78 } |
| 79 | 79 |
| 80 _showLauncherUI() { | 80 _showLauncherUI() { |
| 81 this._dialog = new UI.Dialog(); | 81 this._dialog = new UI.Dialog(); |
| 82 this._dialog.setOutsideClickCallback(event => event.consume(true)); | 82 this._dialog.setOutsideClickCallback(event => event.consume(true)); |
| 83 var root = UI.createShadowRootWithCoreStyles(this._dialog.contentElement, 'a udits2/audits2Dialog.css'); | 83 var root = UI.createShadowRootWithCoreStyles(this._dialog.contentElement, 'a udits2/audits2Dialog.css'); |
| 84 var auditsViewElement = root.createChild('div', 'audits2-view'); | 84 var auditsViewElement = root.createChild('div', 'audits2-view'); |
| 85 var uiElement = auditsViewElement.createChild('div'); | 85 var uiElement = auditsViewElement.createChild('div'); |
| 86 var headerElement = uiElement.createChild('header'); | 86 var headerElement = uiElement.createChild('header'); |
| 87 this._headerTitleElement = headerElement.createChild('p'); | 87 this._headerTitleElement = headerElement.createChild('p'); |
| 88 this._headerTitleElement.textContent = Common.UIString('Audits to perform'); | 88 this._headerTitleElement.textContent = Common.UIString('Audits to perform'); |
| 89 uiElement.appendChild(headerElement); | 89 uiElement.appendChild(headerElement); |
| 90 | 90 |
| 91 this._auditSelectorForm = uiElement.createChild('form', 'audits2-form'); | 91 this._auditSelectorForm = uiElement.createChild('form', 'audits2-form'); |
| 92 | 92 |
| 93 for (var preset of Audits2.Audits2Panel.Presets) { | 93 for (var preset of Audits2.Audits2Panel.Presets) { |
| 94 preset.setting.setTitle(preset.title); | 94 preset.setting.setTitle(preset.title); |
| 95 var checkbox = new UI.ToolbarSettingCheckbox(preset.setting); | 95 var checkbox = new UI.ToolbarSettingCheckbox(preset.setting); |
| 96 var row = this._auditSelectorForm.createChild('div', 'vbox audits2-launche r-row'); | 96 var row = this._auditSelectorForm.createChild('div', 'vbox audits2-launche r-row'); |
| 97 row.appendChild(checkbox.element); | 97 row.appendChild(checkbox.element); |
| 98 row.createChild('span', 'audits2-launcher-description dimmed').textContent = preset.description; | 98 row.createChild('span', 'audits2-launcher-description dimmed').textContent = preset.description; |
| 99 } | 99 } |
| 100 | 100 |
| 101 this._statusView = this._createStatusView(uiElement); | 101 this._statusView = this._createStatusView(uiElement); |
| 102 | 102 |
| 103 var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox') ; | 103 var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox') ; |
| 104 this._startButton = | 104 this._startButton = UI.createTextButton(Common.UIString('Run audit'), this._ start.bind(this), 'primary'); |
| 105 UI.createTextButton(Common.UIString('Run audit'), this._start.bind(this) , 'material-button default'); | |
| 106 buttonsRow.appendChild(this._startButton); | 105 buttonsRow.appendChild(this._startButton); |
| 107 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca ncel.bind(this), 'material-button'); | 106 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca ncel.bind(this)); |
| 108 buttonsRow.appendChild(this._cancelButton); | 107 buttonsRow.appendChild(this._cancelButton); |
| 109 | 108 |
| 110 this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeigh t); | 109 this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeigh t); |
| 111 this._dialog.setMaxContentSize(new UI.Size(500, 400)); | 110 this._dialog.setMaxContentSize(new UI.Size(500, 400)); |
| 112 this._dialog.show(this.mainElement()); | 111 this._dialog.show(this.mainElement()); |
| 113 auditsViewElement.tabIndex = 0; | 112 auditsViewElement.tabIndex = 0; |
| 114 auditsViewElement.focus(); | 113 auditsViewElement.focus(); |
| 115 } | 114 } |
| 116 | 115 |
| 117 /** | 116 /** |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 onselect() { | 627 onselect() { |
| 629 this.parent._renderReport(); | 628 this.parent._renderReport(); |
| 630 var node = this.parent._resultsView.querySelector('.lh-category[id=' + this. _id + ']'); | 629 var node = this.parent._resultsView.querySelector('.lh-category[id=' + this. _id + ']'); |
| 631 if (node) { | 630 if (node) { |
| 632 node.scrollIntoView(true); | 631 node.scrollIntoView(true); |
| 633 return true; | 632 return true; |
| 634 } | 633 } |
| 635 return false; | 634 return false; |
| 636 } | 635 } |
| 637 }; | 636 }; |
| OLD | NEW |