Skip to content

Commit d61d692

Browse files
committed
UPDATE: Improve code
1 parent 001184b commit d61d692

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

api/logging.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
ScratchTools.console = {};
2-
ScratchTools.console.log = function (text) {
2+
3+
ScratchTools.console.styleLog = function (text, backgroundColor) {
34
var styleArray = [
45
"padding: 0.1rem",
5-
"background-color: lime",
6+
"background-color: " + backgroundColor,
67
"border-radius: 0.2rem",
78
"color: black",
89
];
910
console.log("%cScratchTools", styleArray.join(";"), text);
1011
};
12+
13+
ScratchTools.console.log = function (text) {
14+
ScratchTools.console.styleLog(text, "lime");
15+
};
16+
1117
ScratchTools.console.warn = function (text) {
12-
var styleArray = [
13-
"padding: 0.1rem",
14-
"background-color: yellow",
15-
"border-radius: 0.2rem",
16-
"color: black",
17-
];
18-
console.log("%cScratchTools", styleArray.join(";"), text);
18+
ScratchTools.console.styleLog(text, "yellow");
1919
};
20+
2021
ScratchTools.console.error = function (text) {
21-
var styleArray = [
22-
"padding: 0.1rem",
23-
"background-color: #ff9f00",
24-
"border-radius: 0.2rem",
25-
"color: black",
26-
];
27-
console.log("%cScratchTools", styleArray.join(";"), text);
22+
ScratchTools.console.styleLog(text, "#ff9f00");
2823
};

api/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ ScratchTools.managedElements = [];
7373
ScratchTools.Storage = {};
7474
ScratchTools.Resources = {};
7575
ste.console.log("ScratchTools API Created", "ste-main");
76+
7677
if (
7778
window.location.href.startsWith("https://scratch.mit.edu/projects/") &&
7879
window.location.href.includes("/editor")
@@ -154,6 +155,7 @@ function enableScratchToolsSelectorsMutationObserver() {
154155
{ attributes: true, childList: true, subtree: true }
155156
);
156157
}
158+
157159
enableScratchToolsSelectorsMutationObserver();
158160

159161
function returnScratchToolsSelectorsMutationObserverCallbacks() {

api/modal.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
position: fixed;
88
left: 0px;
99
top: 0px;
10-
z-index: 999999999999999;
10+
z-index: 2147483646;
1111
}
1212

1313
.st-modal {
@@ -19,7 +19,7 @@
1919
background-color: #fafafa;
2020
border-radius: 0.5rem;
2121
padding-top: 3rem;
22-
z-index: 999999999999999999999;
22+
z-index: 2147483647;
2323
}
2424

2525
.st-modal h1 {

extras/modals.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
position: fixed;
88
left: 0px;
99
top: 0px;
10-
z-index: 999999999999999;
10+
z-index: 2147483646;
1111
}
1212

1313
.st-modal {
@@ -19,7 +19,7 @@
1919
background-color: var(--background);
2020
border-radius: 0.5rem;
2121
padding-top: 3rem;
22-
z-index: 999999999999999999999;
22+
z-index: 2147483647;
2323
}
2424

2525
.st-modal h1 {

features/project-bar/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
position: fixed;
44
right: 3rem;
55
top: 5rem;
6-
z-index: 9999999999999;
6+
z-index: 2147483644;
77
width: 40rem;
88
padding: 1rem;
99
border-radius: .5rem;

0 commit comments

Comments
 (0)