-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.js
49 lines (43 loc) · 1.59 KB
/
theme.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
plugin.onAllPluginsLoaded(async function (plugins) {
if (plugins.StyleSnippet?.addExternalSnippet == undefined) {
async function addTips() {
(await betterncm.utils.waitForElement('header')).prepend(dom('div', {
innerText: '请安装/更新 StyleSnippet 插件,否则 ArkTheme 将不会生效。',
style: {
width: "100%",
height: "30px",
lineHeight: "30px",
background: "#ec414188",
color: "white",
textAlign: "center",
zIndex: 999,
position: "absolute",
pointerEvents: "none"
}
}));
}
setTimeout(addTips, 1000);
}
setTimeout(()=>{
const getEBtn=()=>[...document.querySelectorAll('.rnp-checkbox')].find(v=>v.nextElementSibling?.innerText.includes('优化底栏'));
let btn;
const fixDL=async ()=>{
if(!btn){
btn=getEBtn();
btn.addEventListener('change',fixDL);
document.querySelector('#vertical-align [value="bottom"]:not(.selected)')?.click();
}
if(btn && btn.checked){
btn.click();
}
};
fixDL();
window.addEventListener('load',fixDL());
setInterval(fixDL,1000);
});
plugins.StyleSnippet.addExternalSnippet(
await betterncm.fs.readFileText(this.pluginPath + './theme.less'),
"ArkTheme",
'ark-theme-release'
)
});