Skip to content

Commit

Permalink
✨ feat: 支持 Esc 关闭预览窗口
Browse files Browse the repository at this point in the history
  • Loading branch information
dlzmoe committed Oct 15, 2024
1 parent 244a818 commit bb22b3c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- 新增:是否开启黑夜模式自动检测。
- 优化:支持 Esc 关闭预览窗口
26 changes: 18 additions & 8 deletions dist/linuxdo-scripts.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name linuxdo 增强插件
// @namespace https://github.com/dlzmoe/linuxdo-scripts
// @version 0.3.51
// @version 0.3.52
// @author dlzmoe
// @description linux.do 增强插件,功能持续更新,欢迎提出新想法!
// @license Apache-2.0
Expand All @@ -21,7 +21,7 @@
'use strict';

const name = "linuxdo-scripts";
const version = "0.3.51";
const version = "0.3.52";
const author = "dlzmoe";
const description = "An enhanced script for the linux.do forum";
const type = "module";
Expand Down Expand Up @@ -611,12 +611,18 @@
});
});
});
$(".topicpreview-opacity").click(function() {
$(".topicpreview").hide();
$(".topicpreview-container").html(
`<p style="text-align: center">正在加载中...</p> `
);
});
$(".topicpreview-opacity").click(this.closePreview);
},
closePreview() {
$(".topicpreview").hide();
$(".topicpreview-container").html(
`<p style="text-align: center">正在加载中...</p> `
);
},
handleKeyDown(event) {
if (event.key === "Escape") {
this.closePreview();
}
}
},
created() {
Expand All @@ -636,7 +642,11 @@
this.setClick();
}
}, 1e3);
document.addEventListener("keydown", this.handleKeyDown);
}
},
beforeUnmount() {
document.removeEventListener("keydown", this.handleKeyDown);
}
};
const _hoisted_1$H = { class: "item" };
Expand Down
26 changes: 18 additions & 8 deletions linuxdo-scripts.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name linuxdo 增强插件
// @namespace https://github.com/dlzmoe/linuxdo-scripts
// @version 0.3.51
// @version 0.3.52
// @author dlzmoe
// @description linux.do 增强插件,功能持续更新,欢迎提出新想法!
// @license Apache-2.0
Expand All @@ -21,7 +21,7 @@
'use strict';

const name = "linuxdo-scripts";
const version = "0.3.51";
const version = "0.3.52";
const author = "dlzmoe";
const description = "An enhanced script for the linux.do forum";
const type = "module";
Expand Down Expand Up @@ -611,12 +611,18 @@
});
});
});
$(".topicpreview-opacity").click(function() {
$(".topicpreview").hide();
$(".topicpreview-container").html(
`<p style="text-align: center">正在加载中...</p> `
);
});
$(".topicpreview-opacity").click(this.closePreview);
},
closePreview() {
$(".topicpreview").hide();
$(".topicpreview-container").html(
`<p style="text-align: center">正在加载中...</p> `
);
},
handleKeyDown(event) {
if (event.key === "Escape") {
this.closePreview();
}
}
},
created() {
Expand All @@ -636,7 +642,11 @@
this.setClick();
}
}, 1e3);
document.addEventListener("keydown", this.handleKeyDown);
}
},
beforeUnmount() {
document.removeEventListener("keydown", this.handleKeyDown);
}
};
const _hoisted_1$H = { class: "item" };
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linuxdo-scripts",
"version": "0.3.51",
"version": "0.3.52",
"author": "dlzmoe",
"description": "An enhanced script for the linux.do forum",
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions version-log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.52

- 优化:支持 Esc 关闭预览窗口

## 0.3.51

- 新增:是否开启黑夜模式自动检测。
Expand Down

0 comments on commit bb22b3c

Please sign in to comment.