| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 text.createChild('span', 'audits2-landing-bold-text').textContent = Common.U
IString('Audits'); | 68 text.createChild('span', 'audits2-landing-bold-text').textContent = Common.U
IString('Audits'); |
| 69 text.createChild('span').textContent = Common.UIString( | 69 text.createChild('span').textContent = Common.UIString( |
| 70 ' help you identify and fix common problems that affect' + | 70 ' help you identify and fix common problems that affect' + |
| 71 ' your site\'s performance, accessibility, and user experience. '); | 71 ' your site\'s performance, accessibility, and user experience. '); |
| 72 var link = text.createChild('span', 'link'); | 72 var link = text.createChild('span', 'link'); |
| 73 link.textContent = Common.UIString('Learn more'); | 73 link.textContent = Common.UIString('Learn more'); |
| 74 link.addEventListener( | 74 link.addEventListener( |
| 75 'click', () => InspectorFrontendHost.openInNewTab('https://developers.go
ogle.com/web/tools/lighthouse/')); | 75 'click', () => InspectorFrontendHost.openInNewTab('https://developers.go
ogle.com/web/tools/lighthouse/')); |
| 76 | 76 |
| 77 var newButton = UI.createTextButton( | 77 var newButton = UI.createTextButton( |
| 78 Common.UIString('Perform an audit\u2026'), this._showLauncherUI.bind(thi
s), 'material-button default'); | 78 Common.UIString('Perform an audit\u2026'), this._showLauncherUI.bind(thi
s), '', true /* primary */); |
| 79 landingCenter.appendChild(newButton); | 79 landingCenter.appendChild(newButton); |
| 80 this.setDefaultFocusedElement(newButton); | 80 this.setDefaultFocusedElement(newButton); |
| 81 } | 81 } |
| 82 | 82 |
| 83 _showLauncherUI() { | 83 _showLauncherUI() { |
| 84 this._dialog = new UI.Dialog(); | 84 this._dialog = new UI.Dialog(); |
| 85 this._dialog.setOutsideClickCallback(event => event.consume(true)); | 85 this._dialog.setOutsideClickCallback(event => event.consume(true)); |
| 86 var root = UI.createShadowRootWithCoreStyles(this._dialog.contentElement, 'a
udits2/audits2Dialog.css'); | 86 var root = UI.createShadowRootWithCoreStyles(this._dialog.contentElement, 'a
udits2/audits2Dialog.css'); |
| 87 var auditsViewElement = root.createChild('div', 'audits2-view'); | 87 var auditsViewElement = root.createChild('div', 'audits2-view'); |
| 88 var uiElement = auditsViewElement.createChild('div'); | 88 var uiElement = auditsViewElement.createChild('div'); |
| 89 var headerElement = uiElement.createChild('header'); | 89 var headerElement = uiElement.createChild('header'); |
| 90 this._headerTitleElement = headerElement.createChild('p'); | 90 this._headerTitleElement = headerElement.createChild('p'); |
| 91 this._headerTitleElement.textContent = Common.UIString('Audits to perform'); | 91 this._headerTitleElement.textContent = Common.UIString('Audits to perform'); |
| 92 uiElement.appendChild(headerElement); | 92 uiElement.appendChild(headerElement); |
| 93 | 93 |
| 94 this._auditSelectorForm = uiElement.createChild('form', 'audits2-form'); | 94 this._auditSelectorForm = uiElement.createChild('form', 'audits2-form'); |
| 95 | 95 |
| 96 for (var preset of Audits2.Audits2Panel.Presets) { | 96 for (var preset of Audits2.Audits2Panel.Presets) { |
| 97 preset.setting.setTitle(preset.title); | 97 preset.setting.setTitle(preset.title); |
| 98 var checkbox = new UI.ToolbarSettingCheckbox(preset.setting); | 98 var checkbox = new UI.ToolbarSettingCheckbox(preset.setting); |
| 99 var row = this._auditSelectorForm.createChild('div', 'vbox audits2-launche
r-row'); | 99 var row = this._auditSelectorForm.createChild('div', 'vbox audits2-launche
r-row'); |
| 100 row.appendChild(checkbox.element); | 100 row.appendChild(checkbox.element); |
| 101 row.createChild('span', 'audits2-launcher-description dimmed').textContent
= preset.description; | 101 row.createChild('span', 'audits2-launcher-description dimmed').textContent
= preset.description; |
| 102 } | 102 } |
| 103 | 103 |
| 104 this._statusView = this._createStatusView(uiElement); | 104 this._statusView = this._createStatusView(uiElement); |
| 105 | 105 |
| 106 var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox')
; | 106 var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox')
; |
| 107 this._startButton = | 107 this._startButton = |
| 108 UI.createTextButton(Common.UIString('Run audit'), this._start.bind(this)
, 'material-button default'); | 108 UI.createTextButton(Common.UIString('Run audit'), this._start.bind(this)
, '', true /* primary */); |
| 109 this._updateStartButtonEnabled(); | 109 this._updateStartButtonEnabled(); |
| 110 buttonsRow.appendChild(this._startButton); | 110 buttonsRow.appendChild(this._startButton); |
| 111 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca
ncel.bind(this), 'material-button'); | 111 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca
ncel.bind(this)); |
| 112 buttonsRow.appendChild(this._cancelButton); | 112 buttonsRow.appendChild(this._cancelButton); |
| 113 | 113 |
| 114 this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeigh
t); | 114 this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeigh
t); |
| 115 this._dialog.setMaxContentSize(new UI.Size(500, 400)); | 115 this._dialog.setMaxContentSize(new UI.Size(500, 400)); |
| 116 this._dialog.show(this.mainElement()); | 116 this._dialog.show(this.mainElement()); |
| 117 auditsViewElement.tabIndex = 0; | 117 auditsViewElement.tabIndex = 0; |
| 118 auditsViewElement.focus(); | 118 auditsViewElement.focus(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 _updateStartButtonEnabled() { | 121 _updateStartButtonEnabled() { |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 return; | 680 return; |
| 681 | 681 |
| 682 var element = Components.DOMPresentationUtils.linkifyNodeReference(node,
undefined, detailsItem.snippet); | 682 var element = Components.DOMPresentationUtils.linkifyNodeReference(node,
undefined, detailsItem.snippet); |
| 683 origElement.title = ''; | 683 origElement.title = ''; |
| 684 origElement.textContent = ''; | 684 origElement.textContent = ''; |
| 685 origElement.appendChild(element); | 685 origElement.appendChild(element); |
| 686 }); | 686 }); |
| 687 }); | 687 }); |
| 688 } | 688 } |
| 689 }; | 689 }; |
| OLD | NEW |