-
Notifications
You must be signed in to change notification settings - Fork 1
/
settings.html
133 lines (125 loc) · 5.92 KB
/
settings.html
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>
<title>设置</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimal-ui" />
<script>
if (typeof module === 'object') {
window.module = module; module = undefined;
}
</script><!-- solve the electron-jquery conflict -->
<script src="res/lib/jquery-3.3.1.min.js"></script>
<script src="res/lib/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="res/lib/bootstrap.min.css" />
<script src="res/lib/all.js"></script>
<script src="res/lib/v4-shims.js"></script><!-- font-awesome 5 use as 4 -->
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="d-flex mx-auto justify-content-center align-items-center text-dark" id="main">
<div id="controller">
<a href="javascript:require('electron').shell.openExternal(require('./package.json').homepage)"
class="small flower"><i class="fa fa-info fa-fw" title="关于"></i></a>
<a href="javascript:winhider()" class="small flower" id="win-hider"><i class="fa fa-sort-desc fa-fw"
title="最小化到托盘"></i></a><span id="no-use-space"> </span>
<a href="index.html" class="small flower"><i class="fa fa-chevron-left" title="返回"></i></a>
<a href="javascript:window.close()" class="small flower"><i class="fa fa-times fa-fw"
title="退出"></i></a>
</div>
<div id="set" class="flower align-content-center">
<div class="h3">
<i class="fa fa-cog fa-fw" id="settings" aria-hidden="true"></i>设置
<hr />
</div>
<input id="longmode-set" type="checkbox" onchange="longmodeset()" />
<label for="longmode-set">32位模式</label>
<input id="autocopy-set" type="checkbox" onchange="autocopyset()" />
<label for="autocopy-set">自动复制</label>
<br />
<span id="autohider"><input id="autohide-set" type="checkbox" onchange="autohideset()" />
<label for="autohide-set">复制后自动隐藏</label> </span>
<input id="autostart-set" type="checkbox" onchange="autostartset()" />
<label for="autostart-set">开机自启</label>
<br />
<a href="index.html" class="flowerbtn">提交</a>
</div>
<div id="versioninfo" class="text-black-50">
版本:
<script>document.write(require("./package.json").version);</script>
<br />
全局快捷键:Command/Ctrl + Shift + Alt + F
<br />
</div>
</div>
<script>
const Store = require('electron-store');
const store = new Store();
const remote = require('electron').remote;
const ipc = require('electron').ipcRenderer;
const md5 = require('blueimp-md5');
function winhider() {
ipc.send("winhider");
}
if (store.get("longmode") == undefined) store.set("longmode", false);
if (store.get("longmode") == true) document.getElementById("longmode-set").checked = true;
else document.getElementById("longmode-set").checked = false;
function longmodeset() {
if (document.getElementById("longmode-set").checked == true) store.set("longmode", true);
else store.set("longmode", false);
}
if (store.get("autocopy") == undefined) store.set("autocopy", true);
if (store.get("autocopy") == true) {
document.getElementById("autocopy-set").checked = true;
$("#autohider").css("display", "inline-block");
} else {
document.getElementById("autocopy-set").checked = false;
$("#autohider").css("display", "none");
}
function autocopyset() {
if (document.getElementById("autocopy-set").checked == true) {
store.set("autocopy", true);
$("#autohider").css("display", "inline-block");
} else {
store.set("autocopy", false);
$("#autohider").css("display", "none");
}
}
if (store.get("autohide") == undefined) store.set("autohide", false);
if (store.get("autohide") == true) document.getElementById("autohide-set").checked = true;
else document.getElementById("autohide-set").checked = false;
function autohideset() {
if (document.getElementById("autohide-set").checked == true) store.set("autohide", true);
else store.set("autohide", false);
}
if (store.get("autostart") == undefined) store.set("autostart", false);
if (store.get("autostart") == true) document.getElementById("autostart-set").checked = true;
else document.getElementById("autostart-set").checked = false;
function autostartset() {
var AutoLaunch = require('auto-launch');
var autoLauncher = new AutoLaunch({ name: 'flowerpassword-electron' });
if (document.getElementById("autostart-set").checked == true) {
store.set("autostart", true);
autoLauncher.isEnabled()
.then(function (isEnabled) {
if (isEnabled) {
return;
}
autoLauncher.enable();
})
}
else {
store.set("autostart", false);
autoLauncher.isEnabled()
.then(function (isEnabled) {
if (isEnabled) {
autoLauncher.disable();
}
return;
})
}
}
</script>
</body>
</html>