Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only inject the styles we need as a content script #2281

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dwds/debug_extension_mv3/web/copier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ void _copyAppId(String appId) {
Future<void> _showCopiedMessage(String appId) async {
final snackbar = document.createElement('div');
snackbar.setInnerHtml('Copied app ID: <i>$appId</i>');
snackbar.classes.addAll(['snackbar', 'snackbar--info', 'show']);
snackbar.classes.addAll([
'dart-debug-extension-snackbar',
]);
document.body?.append(snackbar);
await Future.delayed(Duration(seconds: 4));
snackbar.remove();
Expand Down
4 changes: 2 additions & 2 deletions dwds/debug_extension_mv3/web/manifest_mv2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "1.38",
"version": "1.40",
"manifest_version": 2,
"devtools_page": "static_assets/devtools.html",
"browser_action": {
Expand All @@ -25,7 +25,7 @@
{
"matches": ["<all_urls>"],
"js": ["detector.dart.js", "copier.dart.js"],
"css": ["static_assets/styles.css"],
"css": ["static_assets/styles_injected.css"],
"run_at": "document_end"
}
],
Expand Down
4 changes: 2 additions & 2 deletions dwds/debug_extension_mv3/web/manifest_mv3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Dart Debug Extension",
"version": "1.38",
"version": "1.40",
"manifest_version": 3,
"devtools_page": "static_assets/devtools.html",
"action": {
Expand Down Expand Up @@ -32,7 +32,7 @@
{
"matches": ["<all_urls>"],
"js": ["detector.dart.js", "copier.dart.js"],
"css": ["static_assets/styles.css"],
"css": ["static_assets/styles_injected.css"],
"run_at": "document_end"
}
],
Expand Down
45 changes: 45 additions & 0 deletions dwds/debug_extension_mv3/web/static_assets/styles_injected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* WARNING: THIS STYLESHEET IS INJECTED INTO EVERY WEBPAGE.
*
* All classes should be prefixed with "dart-debug-extension"
* to avoid interfering with other styles on the page.
*/

.dart-debug-extension-snackbar {
-webkit-animation: dart-debug-extension-fadein 0.5s;
animation: dart-debug-extension-fadein 0.5s;
background-color: #303030;
color: #eeeeee;
font-family: Roboto, 'Helvetica Neue', sans-serif;
left: 0px;
padding: 16px;
position: fixed;
right: 0px;
text-align: center;
top: 0px;
visibility: visible;
width: 100%;
z-index: 2147483647;
}

@-webkit-keyframes dart-debug-extension-fadein {
from {
opacity: 0;
top: 0;
}
to {
opacity: 1;
top: 0px;
}
}

@keyframes dart-debug-extension-fadein {
from {
opacity: 0;
top: 0;
}
to {
opacity: 1;
top: 0px;
}
}
Loading