Skip to content

Commit

Permalink
✨可设定保存默认格式
Browse files Browse the repository at this point in the history
  • Loading branch information
xushengfeng committed Apr 30, 2022
1 parent 252636c commit 16fa357
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/clip_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ function tool_copy_f() {
var type;
function tool_save_f() {
s_center_bar("save");
document.querySelectorAll("#suffix > div")[0].className = "suffix_h";
var t_to_n = { png: 0, jpg: 1, svg: 2 };
var i = t_to_n[store.get("保存.默认格式")];
document.querySelectorAll("#suffix > div")[i].className = "suffix_h";
document.getElementById("suffix").onclick = (e) => {
var el = e.target;
if (el.dataset.value) {
Expand All @@ -373,7 +375,6 @@ function tool_save_f() {
}
};
hotkeys.setScope("c_bar");
var i = 0;
hotkeys("enter", "c_bar", () => {
document.querySelector("#suffix > .suffix_h").click();
s_center_bar("save");
Expand Down
3 changes: 3 additions & 0 deletions js/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ document.getElementById("保存文件名称后缀").style.width = `${
document.getElementById("保存文件名称后缀").value.length || 1
}em`;

document.getElementById("默认格式").value = store.get("保存.默认格式");

document.getElementById("jpg质量").value = store.get("jpg质量");

var 字体 = store.get("字体");
Expand Down Expand Up @@ -427,6 +429,7 @@ function save_setting() {
? (document.getElementById("快速截屏路径").value + "/").replace("//", "/")
: ""
);
store.set("保存.默认格式", document.getElementById("默认格式").value);
store.set("保存名称", {
前缀: document.getElementById("保存文件名称前缀").value,
时间: document.getElementById("保存文件名称时间").value,
Expand Down
3 changes: 3 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,9 @@ var default_setting = {
自动搜索中文占比: 0.2,
浏览器中打开: false,
搜索窗口自动关闭: true,
保存: {
默认格式: "png",
},
保存路径: app.getPath("pictures") + "/",
保存名称: { 前缀: "eSearch-", 时间: "YYYY-MM-DD-HH-mm-ss-S", 后缀: "" },
jpg质量: 1,
Expand Down
7 changes: 7 additions & 0 deletions setting.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ <h1>保存</h1>
s: 秒(1);
S: 毫秒(500);
</details>

<h2>默认格式</h2>
<set-select name="" id="默认格式">
<div value="png">png</div>
<div value="jpg">jpg</div>
<div value="svg">svg</div>
</set-select>
<br>
jpg质量
<range-b id="jpg质量" min="0" max="1.00" step="0.01"></range-b>
Expand Down

0 comments on commit 16fa357

Please sign in to comment.