Skip to content

Commit c5c672e

Browse files
authored
Merge pull request #535 from rgantzos/main
2 parents fd7c9c6 + 317916b commit c5c672e

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

api/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ ScratchTools.waitForElements = function (selector, callback, id, rework) {
4040
}
4141
};
4242

43+
var stylesDiv = document.createElement("div");
44+
stylesDiv.className = "scratchtools-styles-div";
45+
document.head.appendChild(stylesDiv);
46+
ScratchTools.waitForElements("head > *", function (el) {
47+
if (el !== stylesDiv) {
48+
document.head.appendChild(stylesDiv);
49+
}
50+
});
4351
function enableScratchToolsSelectorsMutationObserver() {
4452
var ScratchToolsSelectorsMutationObserver = new MutationObserver(
4553
returnScratchToolsSelectorsMutationObserverCallbacks

extras/background.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ chrome.tabs.onUpdated.addListener(async function (tabId, info) {
450450
world: newData.world?.toUpperCase() || "MAIN",
451451
});
452452
}
453+
}
453454
});
454455
newData.styles?.forEach(function (style) {
455456
if (new URL(tab.url).pathname.match(style.runOn)) {
@@ -469,7 +470,7 @@ chrome.tabs.onUpdated.addListener(async function (tabId, info) {
469470
link.rel = "stylesheet";
470471
link.href = path;
471472
link.dataset.feature = feature;
472-
document.head.prepend(link);
473+
document.querySelector(".scratchtools-styles-div").appendChild(link);
473474
}
474475
}
475476
});

extras/popup/popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ async function dynamicEnable(id) {
572572
link.rel = "stylesheet";
573573
link.href = path;
574574
link.dataset.feature = feature;
575-
document.head.appendChild(link);
575+
document.querySelector(".scratchtools-styles-div").appendChild(link);
576576
}
577577
}
578578
} catch (err) {}

features/most-popular-project.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function addBox(title, id, views, instructions) {
6464
box.appendChild(boxContent);
6565
var p = document.createElement("p");
6666
p.style.width = "500px";
67+
p.style.whiteSpace = "pre-line";
6768
p.textContent = instructions;
6869
boxContent.appendChild(p);
6970
boxTitle.style.color = "#1aa0d8";

0 commit comments

Comments
 (0)