mirror of
https://github.com/GuySandler/CanvasRefined.git
synced 2026-11-25 15:07:57 +01:00
background changer 3
done, theme compatible + weird loading fix
This commit is contained in:
1 parent
a7aea08668
commit
30ccf9db1d
4 files changed
+44
-25
No files matched your search
+6
-1
@@ -391,7 +391,7 @@ function applyCustomBackground() {
|
||||
|
||||
if (options.customBackgroundLink && options.customBackgroundLink !== "") {
|
||||
style.textContent = `
|
||||
#not_right_side {
|
||||
#wrapper {
|
||||
background-image: url('${options.customBackgroundLink}') !important;
|
||||
background-size: cover !important;
|
||||
background-attachment: fixed !important;
|
||||
@@ -408,6 +408,10 @@ function applyCustomBackground() {
|
||||
|
||||
document.documentElement.appendChild(style);
|
||||
}
|
||||
function clearCustomBackground() {
|
||||
let style = document.querySelector("#bettercanvas-background");
|
||||
if (style) style.remove();
|
||||
}
|
||||
|
||||
let insertTimer;
|
||||
function resetTimer() {
|
||||
@@ -465,6 +469,7 @@ function recieveMessage(request, sender, sendResponse) {
|
||||
case ("getcolors"): sendResponse(getCardColors()); break;
|
||||
case ("inspect"): sendResponse(inspectDarkMode(true)); break;
|
||||
case ("fixdm"): sendResponse(runDarkModeFixer(true)); break;
|
||||
case ("updateBackground"): clearCustomBackground(); sendResponse(true); break;
|
||||
default: sendResponse(true);
|
||||
}
|
||||
}
|
||||
|
||||
+13
-4
@@ -24,6 +24,7 @@ const syncedSubOptions = [
|
||||
"cardSpacing",
|
||||
"cardWidth",
|
||||
"cardHeight",
|
||||
"customBackgroundLink",
|
||||
];
|
||||
const localSwitches = [];
|
||||
|
||||
@@ -487,6 +488,9 @@ function setup() {
|
||||
case "export-customStyles":
|
||||
final = { ...final, ...(await getExport(storage, ["custom_styles"])) };
|
||||
break;
|
||||
case "export-background":
|
||||
final = { ...final, ...(await getExport(storage, ["customBackgroundLink"])) };
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -740,10 +744,9 @@ function setup() {
|
||||
});
|
||||
|
||||
document.getElementById("clearCustomBackground").addEventListener("click", () => {
|
||||
chrome.storage.sync.set({
|
||||
"customBackgroundLink": "",
|
||||
});
|
||||
chrome.storage.sync.set({ "customBackgroundLink": "" });
|
||||
document.querySelector("#customBackgroundLink").value = "";
|
||||
sendFromPopup("updateBackground");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1061,7 +1064,13 @@ function saveCurrentTheme() {
|
||||
"dark_preset": current["dark_preset"],
|
||||
"custom_cards": current["custom_cards"],
|
||||
"card_colors": current["card_colors"] === null ? [current["dark_preset"]["links"]] : current["card_colors"],
|
||||
"custom_font": current["custom_font"]
|
||||
"custom_font": current["custom_font"],
|
||||
"imageSize": current["imageSize"],
|
||||
"cardRoundness": current["cardRoundness"],
|
||||
"cardSpacing": current["cardSpacing"],
|
||||
"cardWidth": current["cardWidth"],
|
||||
"cardHeight": current["cardHeight"],
|
||||
"customBackgroundLink": current["customBackgroundLink"],
|
||||
}
|
||||
const now = new Date();
|
||||
local["saved_themes"][now.getTime()] = trimmed;
|
||||
|
||||
Reference in new issue
Block a user