Skip to content

Commit

Permalink
feat: 重置快捷键
Browse files Browse the repository at this point in the history
close #4
  • Loading branch information
std-microblock committed Feb 5, 2024
1 parent 35f9b1d commit fe0ef8e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,22 @@ function MinifyEle() {
} });
}));
}
window.addEventListener('keypress', (e) => {
if (e.ctrlKey && e.altKey && e.key === 'F3') {
const res = prompt('确定要清除 TinyNCM 规则吗 | OK - 清除自定义规则 | 输入 All 并 OK - 清除所有 | Cancel - 取消');
if (res.toLocaleLowerCase() === 'all') {
localStorage.removeItem("cc.microblock.betterncm.tinyncm.minify");
localStorage.removeItem("cc.microblock.betterncm.tinyncm.custom");
}
else if (res === null) {
return;
}
else {
localStorage.removeItem("cc.microblock.betterncm.tinyncm.custom");
}
applyTinyNCM();
}
});
applyTinyNCM();
function applyFont() {
const config = JSON.parse(localStorage["cc.microblock.betterncm.tinyncm.font"] || "{}");
Expand Down
16 changes: 16 additions & 0 deletions main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,22 @@ function MinifyEle() {
</>
}

window.addEventListener('keypress', (e)=>{
if(e.ctrlKey && e.altKey && e.key === 'F3') {
const res = prompt('确定要清除 TinyNCM 规则吗 | OK - 清除自定义规则 | 输入 All 并 OK - 清除所有 | Cancel - 取消');
if (res.toLocaleLowerCase() === 'all') {
localStorage.removeItem("cc.microblock.betterncm.tinyncm.minify");
localStorage.removeItem("cc.microblock.betterncm.tinyncm.custom");
} else if (res === null) {
return;
} else {
localStorage.removeItem("cc.microblock.betterncm.tinyncm.custom");
}

applyTinyNCM();
}
})

applyTinyNCM();

function applyFont() {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "TinyNCM",
"version": "1.0.2",
"version": "1.0.3",
"author": "MicroBlock",
"description": "更改字体,更改颜色,删除无用组件",
"betterncm_version": ">=0.2.5",
Expand Down

0 comments on commit fe0ef8e

Please sign in to comment.