Skip to content

Commit bd8c0ba

Browse files
committed
replace css
1 parent 4e9e7f3 commit bd8c0ba

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

js/scrapboxCssScript.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const indentLineCSS = [
7575
}`,
7676
];
7777

78-
const insertIndentLineCSSRule = (isLining) => {
78+
const insertIndentLineCSSRule = (isLining, indentColor) => {
7979
// delete existing rules
8080
const cssRules = document.styleSheets[0].cssRules;
8181
const cssRulesNum = cssRules.length;
@@ -97,6 +97,10 @@ const insertIndentLineCSSRule = (isLining) => {
9797
// insert new rules
9898
if (isLining) {
9999
indentLineCSS.map((css) => {
100+
if (css.includes('#dcdcdc')) {
101+
css = css.replace('#dcdcdc', indentColor);
102+
console.log(css);
103+
}
100104
document.styleSheets[0].insertRule(css);
101105
});
102106
}
@@ -112,7 +116,12 @@ const makerAttachment = () => {
112116
const liningAttachment = () => {
113117
chrome.storage.local.get('scrapboxIndentLining', (result) => {
114118
const isLining = result.scrapboxIndentLining;
115-
insertIndentLineCSSRule(isLining);
119+
120+
chrome.storage.local.get('scrapboxIndentLineColor', (result) => {
121+
const scrapboxIndentLineColor =
122+
result.scrapboxIndentLineColor || '#dcdcdc';
123+
insertIndentLineCSSRule(isLining, scrapboxIndentLineColor);
124+
});
116125
});
117126
};
118127

@@ -124,6 +133,9 @@ chrome.runtime.onMessage.addListener((request) => {
124133
if (request === 'scrapbox_indent_lining') {
125134
liningAttachment();
126135
}
136+
if (request === 'scrapbox_indent_lining_color') {
137+
liningAttachment();
138+
}
127139
});
128140

129141
// initialize

0 commit comments

Comments
 (0)