-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
99 lines (82 loc) · 3 KB
/
index.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
<head>
<title>PiQture</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<div class="container">
<div class="demo-flex-spacer"></div>
<div class="webflow-style-input">
<input class="" type="text" placeholder="PiQture 0.13" id="screenshot-path" readonly></input>
<button id="screenshot"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABTSURBVDhPY6A14AdiHQiTPNAPxG+B2AjMIwNwAfEBIB4chuwHYtoZkgfEq4jAW4D4PxCDDDEAYjig2ABiAEXhQLFmsqORIs0gQHFSpjgzEQAMDABVMCWHZbRzNwAAAABJRU5ErkJggg=="></button>
</div>
<div class="control-group">
<label class="control control-checkbox">
<input type="checkbox" checked="checked" id="nativeCaptureValue"/>
<div class="control_indicator" onmouseover="screenshotMsg.value = 'Native capture(full resolution)'" onmouseout="getSource()"></div>
</label>
</div>
<div class="demo-flex-spacer"></div>
<a id="close" onclick="hide()" title="PiQture will hide automatically after capturing">Hide PiQture to tray</a>
<!-- <div id="snackbar">Config reading error</div> -->
</div>
<script src="js/time.js"></script>
<script>
const electron = require('electron')
const desktopCapturer = electron.desktopCapturer
const electronScreen = electron.screen
const shell = electron.shell
const remote = electron.remote
const {Tray, Menu} = remote
const {clipboard} = require('electron')
const fs = require('fs')
const os = require('os')
const path = require('path')
const screenshot = document.getElementById('screenshot')
const screenshotMsg = document.getElementById('screenshot-path')
const nativeCaptureValue = document.getElementById('nativeCaptureValue')
const windowSecond = remote.getCurrentWindow()
const ipc = require('electron').ipcRenderer
const Store = require('./js/store.js');
const settings = new Store({
configName: 'piqturesettings',
defaults: {
developerKey: 123,
timeOutCapture: 1000,
nativeCapture: true,
openPhoto: true,
playBeep: true
}
});
nativeCaptureValue.checked = settings.get("nativeCapture")
screenshot.addEventListener('click', function (event) {
ipc.send('save-dialog')
ipc.on('saved-file', function (event, pathFile) {
if (!pathFile) pathFile = 'Clipboard'
screenshotMsg.value = `Path selected: ${pathFile}`
settings.set("nativeCapture", nativeCaptureValue.checked)
start(pathFile)
})
})
function hide(){
windowSecond.hide();
}
function show(){
windowSecond.show();
}
function exit(){
windowSecond.close();
}
ipc.on('shortcut-screenshot', function (event) {
start(path.join(os.homedir(), piqture_time()+".png"))
})
document.addEventListener("keydown", function (e) {
if (e.which === settings.get('developerKey')) {
ipc.send('developer')
}
});
</script>
<script src="js/screenSize.js"></script>
<script src="js/getSource.js"></script>
<script src="js/diagnostics.js"></script>
<script src="js/snackbar.js"></script>
<script src="js/start.js"></script>
<script src="js/tray.js"></script>