Skip to content

Commit 21bb1d3

Browse files
authored
Merge branch 'main' into anti-generic
2 parents 86c7c98 + 5556938 commit 21bb1d3

72 files changed

Lines changed: 2705 additions & 207 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
package.json
3+
package-lock.json

_locales/tr/messages.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"extName": {
3+
"message": "Scratch için ScratchTools"
4+
},
5+
"extDescription": {
6+
"message": "ScratchTools, Scratch web sitesini daha iyi ve kullanımı daha kolay hale getirmek için birçok özellikle tamamen özelleştirilebilir bir araçtır!"
7+
},
8+
"supportButton": {
9+
"message": "Destek Ekibi"
10+
},
11+
"feedbackButton": {
12+
"message": "Geri Bildirim Bırak"
13+
},
14+
"settingsButton": {
15+
"message": "Ek Ayarlar"
16+
},
17+
"featuresFilterAll": {
18+
"message": "Tümü"
19+
},
20+
"featuresFilterWebsite": {
21+
"message": "Web Site"
22+
},
23+
"featuresFilterEditor": {
24+
"message": "Düzenleyici"
25+
},
26+
"featuresFilterForums": {
27+
"message": "Forumlar"
28+
},
29+
"allFeaturesHeader": {
30+
"message": "Tüm özellikler"
31+
},
32+
"forYouHeader": {
33+
"message": "Sizin için"
34+
},
35+
"searchPlaceholder": {
36+
"message": "Ara"
37+
},
38+
"creditsText": {
39+
"message": "Krediler"
40+
},
41+
"viewFeature": {
42+
"message": "Özelliği görüntülemek için tıklayın."
43+
},
44+
"themeStore": {
45+
"message": "Tema Mağazası"
46+
}
47+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
export default async function () {
2+
let alertedBefore = await ScratchTools.storage.get("steBlAlert");
3+
await ScratchTools.storage.set({ key: "steBlAlert", value: false });
4+
await ScratchTools.waitForElement("script.blocklive-ext");
5+
if (!alertedBefore) {
6+
let div = document.createElement("div")
7+
div.className = "ste-bl-together-bg"
8+
9+
let innerDiv = document.createElement("div")
10+
innerDiv.className = "ste-bl-together"
11+
div.appendChild(innerDiv)
12+
13+
let img = document.createElement("img")
14+
img.src = ScratchTools.dir + "/api/blocklive-detection/extensions.svg"
15+
16+
let h3 = document.createElement("h3")
17+
let span1 = document.createElement("span")
18+
span1.textContent = "You're Using"
19+
let span2 = document.createElement("span")
20+
span2.style.color = "#ff9f00"
21+
span2.style.fontWeight = "800"
22+
span2.textContent = " ScratchTools "
23+
let span3 = document.createElement("span")
24+
span3.textContent = "and"
25+
let span4 = document.createElement("span")
26+
span4.style.color = "#cf63cf"
27+
span4.style.fontWeight = "800"
28+
span4.textContent = " Blocklive "
29+
let span5 = document.createElement("span")
30+
span5.textContent = "Together!"
31+
h3.append(span1, span2, span3, span4, span5)
32+
33+
let p = document.createElement("p")
34+
p.textContent = "Thanks for using both extensions! If you experience any issues, please do reach out!"
35+
36+
innerDiv.appendChild(img)
37+
innerDiv.appendChild(h3)
38+
innerDiv.appendChild(p)
39+
document.body.appendChild(div)
40+
41+
let button = document.createElement("button")
42+
button.addEventListener("click", async function() {
43+
div.remove()
44+
await ScratchTools.storage.set({ key: "steBlAlert", value: true });
45+
})
46+
button.textContent = "Close"
47+
innerDiv.appendChild(button)
48+
49+
let link = document.createElement("link")
50+
link.rel = "stylesheet"
51+
link.href = ScratchTools.dir + "/api/blocklive-detection/style.css"
52+
document.head.appendChild(link)
53+
54+
setInterval(function() {
55+
div.style.backgroundImage = `linear-gradient(${Math.round(Date.now() / 20) - (Math.floor(Math.round(Date.now() / 20) / 360) * 360).toString()}deg, #cf63cf, #cf63cf20, #ff9f00, #ff9f0020)`
56+
}, 10)
57+
}
58+
}

api/blocklive-detection/extensions.svg

Lines changed: 158 additions & 0 deletions
Loading

api/blocklive-detection/style.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
.ste-bl-together-bg {
2+
width: 20rem;
3+
height: 20rem;
4+
border-radius: .5rem;
5+
z-index: 99999999999;
6+
position: fixed;
7+
right: 1rem;
8+
bottom: 1rem;
9+
background: linear-gradient(90deg, #cf63cf, #cf63cf20, #ff9f00, #ff9f0020);
10+
text-align: center;
11+
padding: .25rem;
12+
animation: rotateBackground 4s linear infinite;
13+
box-shadow: 0px 0px 10px #0000004d;
14+
}
15+
16+
.ste-bl-together {
17+
padding: 1rem;
18+
padding-top: 2rem;
19+
background-color: white;
20+
border-radius: .25rem;
21+
height: calc(100% - 3rem);
22+
box-shadow: 0px 0px 10px linear-gradient(90deg, #cf63cf, #cf63cf20, #ff9f00, #ff9f0020);
23+
font-family: "Inter", sans-serif !important;
24+
overflow-y: auto;
25+
}
26+
27+
body .ste-bl-together * {
28+
font-family: "Inter", sans-serif !important;
29+
}
30+
31+
.ste-bl-together h3 span {
32+
color: black;
33+
font-weight: 600;
34+
}
35+
36+
.ste-bl-together h3 {
37+
font-size: 1.25rem;
38+
line-height: 1.6rem;
39+
margin-top: .5rem;
40+
color: black;
41+
}
42+
43+
.ste-bl-together img {
44+
width: 7rem;
45+
}
46+
47+
.ste-bl-together button {
48+
background-color: hsla(260, 60%, 60%, 1);
49+
color: white;
50+
padding: .5rem;
51+
border-radius: .25rem;
52+
font-family: "Inter", sans-serif !important;
53+
outline: none;
54+
border: 0px;
55+
font-size: .9rem;
56+
padding-left: 2rem;
57+
padding-right: 2rem;
58+
transition: opacity .2s, transform .2s;
59+
}
60+
61+
.ste-bl-together button:hover {
62+
transform: scale(104%);
63+
opacity: .8;
64+
}

api/feature.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ class Feature {
88
});
99
this.data = finalFeature;
1010
this.msg = function (string) {
11-
if (this.data.translations) {
12-
return this.data.localesData[string];
13-
} else {
14-
throw new Error("Feature does not have locales set up.");
15-
}
11+
return this.data.localesData[`${this.data.id}/`+string] || `ScratchTools.${this.data.id}.${string}`;
1612
};
1713
this.getActiveUserstyles = function () {
1814
var styles = document.head.querySelectorAll(

api/feature/traps.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ export default function () {
55
gui: ScratchTools.Scratch.scratchGui,
66
paint: ScratchTools.Scratch.scratchPaint,
77
sound: ScratchTools.Scratch.scratchSound,
8+
blocks: ScratchTools.traps.getScratchBlocks,
89
};
910
}

api/main.js

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var steConsoleData = []
1+
var steConsoleData = [];
22

33
var ste = {
44
console: {
@@ -15,18 +15,13 @@ var ste = {
1515
"font-family: Inter",
1616
"width: 2rem",
1717
];
18-
console.log(
19-
"%cScratchTools",
20-
styleArray.join(";"),
21-
title,
22-
content
23-
);
18+
console.log("%cScratchTools", styleArray.join(";"), title, content);
2419
steConsoleData.push({
2520
script: title,
2621
data: content,
2722
time: Date.now(),
2823
type: "log",
29-
})
24+
});
3025
},
3126
warn: function (content, title) {
3227
var styleArray = [
@@ -41,18 +36,13 @@ var ste = {
4136
"font-family: Inter",
4237
"width: 2rem",
4338
];
44-
console.log(
45-
"%cScratchTools",
46-
styleArray.join(";"),
47-
title,
48-
content
49-
);
39+
console.log("%cScratchTools", styleArray.join(";"), title, content);
5040
steConsoleData.push({
5141
script: title,
5242
data: content,
5343
time: Date.now(),
5444
type: "warn",
55-
})
45+
});
5646
},
5747
error: function (content, title) {
5848
var styleArray = [
@@ -67,24 +57,19 @@ var ste = {
6757
"font-family: Inter",
6858
"width: 2rem",
6959
];
70-
console.log(
71-
"%cScratchTools",
72-
styleArray.join(";"),
73-
title,
74-
content
75-
);
60+
console.log("%cScratchTools", styleArray.join(";"), title, content);
7661
steConsoleData.push({
7762
script: title,
7863
data: content,
7964
time: Date.now(),
8065
type: "error",
81-
})
66+
});
8267
},
8368
},
8469
};
8570

8671
var ScratchTools = {};
87-
ScratchTools.managedElements = []
72+
ScratchTools.managedElements = [];
8873
ScratchTools.Storage = {};
8974
ScratchTools.Resources = {};
9075
ste.console.log("ScratchTools API Created", "ste-main");
@@ -276,21 +261,26 @@ ScratchTools.setDisable = function (feature, f) {
276261
ste.console.log(`Set disable function for ${feature}.`, "ste-main");
277262
};
278263

279-
Element.prototype.applyStyles = function(data) {
280-
var element = this
281-
Object.keys(data).forEach(function(el) {
282-
element.style[el] = data[el]
283-
})
284-
}
264+
Element.prototype.applyStyles = function (data) {
265+
var element = this;
266+
Object.keys(data).forEach(function (el) {
267+
element.style[el] = data[el];
268+
});
269+
};
285270

286271
ScratchTools.disable = function (feature) {
287-
allFeatures.filter((el) => el.self.id === feature).forEach(function(el) {
288-
el.self.enabled = false
289-
})
290-
ScratchTools.managedElements.filter((el) => el.feature === feature).forEach(function(el) {
291-
el.previousDisplay = el.element.style.display
292-
el.element.style.display = "none"
293-
})
272+
allFeatures
273+
.filter((el) => el.self.id === feature)
274+
.forEach(function (el) {
275+
el.self.enabled = false;
276+
});
277+
ScratchTools.managedElements
278+
.filter((el) => el.feature === feature)
279+
.forEach(function (el) {
280+
if (!el.element) return;
281+
el.previousDisplay = el.element?.style.display;
282+
el.element.style.display = "none";
283+
});
294284
ste.console.log(`Disabled ${feature}.`, "ste-main");
295285
document
296286
.querySelectorAll(`link[data-feature=${feature}]`)
@@ -391,3 +381,14 @@ ScratchTools.waitForElements(
391381
"ste-full-settings-btn",
392382
false
393383
);
384+
385+
async function blockliveDetection() {
386+
let gui = document
387+
.querySelector("#app")
388+
[
389+
Object.keys(app).find((key) => key.startsWith("__reactContainer"))
390+
].child.stateNode.store.getState()?.scratchGui;
391+
if (!gui?.projectState) return;
392+
let detectBlocklive = await import("./blocklive-detection/blocklive-detect.js");
393+
detectBlocklive.default();
394+
}

api/module.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ ScratchTools.injectModule = async function (script) {
7474
el.self.enabled = true
7575
})
7676
ScratchTools.managedElements.filter((el) => el.feature === script.feature.id).forEach(function(el) {
77-
el.element.style.display = el.previousDisplay || null
77+
if (!el.element) return;
78+
el.element.style.display = el?.previousDisplay || null
7879
})
7980
allEnableFunctions[script.feature.id]?.();
8081
}

changelog/changes.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"NOTE": "THERE IS NO NEED TO UPDATE THIS YOURSELF, IT WILL BE UPDATED WHEN RELEASED.",
3-
"version": "3.1.0",
4-
"enhanced": [],
5-
"fixed": []
3+
"version": "3.3.0",
4+
"enhanced": [
5+
"Messages on the settings page.",
6+
"Display last commit for beta.",
7+
"Uninstall logging.",
8+
"Port hide-scratch-news to v2.",
9+
"Port admin-notifications to v2.",
10+
"Improve localization for features.",
11+
"Translated into Turkish."
12+
],
13+
"fixed": ["Fix themes for first-time users."]
614
}

0 commit comments

Comments
 (0)