Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 5071422

Browse files
authored
EOL notice (#193)
* EOL notice * review feedback
1 parent cc62f0a commit 5071422

File tree

10 files changed

+71
-5
lines changed

10 files changed

+71
-5
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
> [!WARNING]
2+
> The Chrome team has been working hard to bring the best of the Web Vitals extension directly into the DevTools Performance panel. As of Chrome version 132, which became stable on January 7, 2025, we have finally ended support for the extension and encourage all users to switch to DevTools. Be aware that extension updates will stop and features may break without notice. [Learn more](https://developer.chrome.com/blog/web-vitals-extension)
3+
14
# Web Vitals Chrome Extension
25
*A Chrome extension to measure metrics for a healthy site*
36
[Install now](https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma)

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Web Vitals",
3-
"version": "1.5.3",
3+
"version": "1.6.0",
44
"manifest_version": 3,
55
"description": "Measure metrics for a healthy site",
66
"homepage_url": "https://web.dev/articles/vitals",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-vitals-extension",
3-
"version": "1.5.3",
3+
"version": "1.6.0",
44
"description": "Instant Web Vitals metrics",
55
"main": "src/browser_action/vitals.js",
66
"repository": "https://github.com/GoogleChrome/web-vitals-extension",

src/browser_action/core.css

+21
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,24 @@
395395
.web-vitals-chrome-extension-popup #settings-link a:hover svg {
396396
color: blue;
397397
}
398+
399+
.web-vitals-chrome-extension-popup #eol-notice {
400+
border: 4px solid var(--color-needs-improvement);
401+
margin: auto 20px;
402+
padding: 0 30px;
403+
font-size: 1.2rem;
404+
line-height: 1.8rem;
405+
}
406+
.web-vitals-chrome-extension-popup #eol-notice::backdrop {
407+
backdrop-filter: blur(1px);
408+
}
409+
.web-vitals-chrome-extension-popup button.danger {
410+
background-color: var(--color-needs-improvement);
411+
border: none;
412+
}
413+
.web-vitals-chrome-extension-popup #eol-notice > :first-child {
414+
margin-top: 30px;
415+
}
416+
.web-vitals-chrome-extension-popup #eol-notice > :last-child {
417+
margin-bottom: 30px;
418+
}

src/browser_action/crux.js

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export class CrUX {
1111
const origin = urlHelper.origin;
1212

1313
return CrUX.query({url, formFactor}).catch(e =>{
14-
console.warn('CrUX URL data unavailable', e);
1514
// If URL data is unavailable, fall back to the origin.
1615
return CrUX.query({origin, formFactor});
1716
});

src/browser_action/popup.html

+13
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ <h1>Metrics</h1>
8080

8181
</footer>
8282

83+
<dialog id="eol-notice" popover>
84+
<p>
85+
As of January 2025, support for the Web Vitals extension has ended.
86+
We encourage all users to switch to the DevTools Performance panel instead.
87+
<a href="https://developer.chrome.com/blog/web-vitals-extension" target="_blank">Learn more</a>
88+
</p>
89+
90+
<div>
91+
<button class="danger" popovertarget="eol-notice" popovertargetaction="hide">I understand</button>
92+
<label><input type="checkbox" id="hide-eol-notice">Don't show again</label>
93+
</div>
94+
</dialog>
95+
8396
<script type="module" src="popup.js"></script>
8497
</body>
8598
</html>

src/browser_action/popup.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Popup {
4444
this.initTimestamp();
4545
this.initMetrics();
4646
this.initFieldData();
47+
this.showEOLNotice();
4748
}
4849

4950
initStatus() {
@@ -95,11 +96,25 @@ class Popup {
9596
console.log('CrUX data', fieldData);
9697
this.renderFieldData(fieldData, formFactor);
9798
}).catch(e => {
98-
console.warn('Unable to load any CrUX data', e);
99+
console.warn('Unable to load any CrUX data. See https://developer.chrome.com/blog/web-vitals-extension', e);
99100
this.setStatus('Local metrics only (field data unavailable)');
100101
});
101102
}
102103

104+
showEOLNotice() {
105+
chrome.storage.sync.get({hideEOLNotice: false}, ({hideEOLNotice}) => {
106+
if (hideEOLNotice) {
107+
return;
108+
}
109+
const notice = document.getElementById('eol-notice');
110+
notice.showPopover();
111+
const hideNoticeToggle = document.getElementById('hide-eol-notice');
112+
hideNoticeToggle.addEventListener('change', (e) => {
113+
chrome.storage.sync.set({hideEOLNotice: e.target.checked});
114+
});
115+
});
116+
}
117+
103118
setStatus(status) {
104119
const statusElement = document.getElementById('status');
105120

src/browser_action/vitals.js

+6
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@
254254
default:
255255
formattedValue = secondsFormatter.format(metric.value / 1000);
256256
}
257+
258+
// Log the EOL warning at the same time as TTFB, which should only occur once per page load.
259+
if (metric.name === 'TTFB') {
260+
console.warn(`${LOG_PREFIX} As of January 2025, support for the Web Vitals extension has ended. We encourage all users to switch to the DevTools Performance panel instead. Learn more: https://developer.chrome.com/blog/web-vitals-extension`);
261+
}
262+
257263
console.groupCollapsed(
258264
`${LOG_PREFIX} ${metric.name} %c${formattedValue} (${metric.rating})`,
259265
`color: ${RATING_COLORS[metric.rating] || 'inherit'}`

src/options/options.html

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
<input type="checkbox" id="noBadgeAnimation">
3838
Only show overall status in badge (no animation of failing metrics)
3939
</label>
40+
<br/>
41+
<label for="hideEOLNotice">
42+
<input type="checkbox" id="hideEOLNotice">
43+
Never show extension deprecation notice
44+
</label> (<a href="https://developer.chrome.com/blog/web-vitals-extension">Learn more</a>)
4045
<div id="status"></div>
4146
<button id="save">Save</button>
4247
</div>

src/options/options.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const optionsConsoleLoggingNode = document.getElementById('consoleLogging');
33
const optionsNoBadgeAnimation = document.getElementById('noBadgeAnimation');
44
const optionsUserTimingNode = document.getElementById('userTiming');
55
const optionsPreferPhoneFieldNode = document.getElementById('preferPhoneField');
6+
const optionsHideEOLNotice = document.getElementById('hideEOLNotice');
67
const optionsSaveBtn = document.getElementById('save');
78
const optionsStatus = document.getElementById('status');
89

@@ -16,6 +17,7 @@ function saveOptions() {
1617
userTiming: optionsUserTimingNode.checked,
1718
preferPhoneField: optionsPreferPhoneFieldNode.checked,
1819
noBadgeAnimation: optionsNoBadgeAnimation.checked,
20+
hideEOLNotice: optionsHideEOLNotice.checked,
1921
}, () => {
2022
// Update status to let user know options were saved.
2123
optionsStatus.textContent = 'Options saved.';
@@ -36,12 +38,14 @@ function restoreOptions() {
3638
userTiming: false,
3739
preferPhoneField: false,
3840
noBadgeAnimation: false,
39-
}, ({enableOverlay, debug, userTiming, preferPhoneField, noBadgeAnimation}) => {
41+
hideEOLNotice: false,
42+
}, ({enableOverlay, debug, userTiming, preferPhoneField, noBadgeAnimation, hideEOLNotice}) => {
4043
optionsOverlayNode.checked = enableOverlay;
4144
optionsConsoleLoggingNode.checked = debug;
4245
optionsUserTimingNode.checked = userTiming;
4346
optionsPreferPhoneFieldNode.checked = preferPhoneField;
4447
optionsNoBadgeAnimation.checked = noBadgeAnimation;
48+
optionsHideEOLNotice.checked = hideEOLNotice;
4549
});
4650
}
4751
document.addEventListener('DOMContentLoaded', restoreOptions);

0 commit comments

Comments
 (0)