-
Notifications
You must be signed in to change notification settings - Fork 1
/
modalVar.html
51 lines (50 loc) · 1.69 KB
/
modalVar.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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.3.3.6.css"/>
<link rel="stylesheet" type="text/css" href="css/blocklino.css"/>
</head>
<body>
<div id="title-bar">
<div id="title"></div>
<div id="title-bar-btns">
<button id="btn_quit" type="button" class="btn btn-quitBlue" onclick="cancel()"><span class="fa fa-times fa-1_75x"></span></button>
</div>
</div>
<div id="div_var">
<div class="form-group">
<h4 id="label"></h4>
<div class="input-group input-group-md icon-addon addon-md">
<input type="text" class="form-control" id="var_name" onfocus="this.value=''">
<span class="input-group-btn">
<button id="btn_variable" type="button" class="btn btn-info" onclick="response()"></button>
</span>
</div>
</div>
</div>
<script>
var { ipcRenderer } = require("electron") ;
var input = document.getElementById("var_name") ;
input.addEventListener("keyup", function(event) {
if (event.keyCode === 13) document.getElementById("btn_variable").click()
})
function cancel() {
ipcRenderer.send("closeDialog", "") ;
this.close()
}
function response() {
ipcRenderer.send("closeDialog", document.getElementById("var_name").value) ;
this.close()
}
window.onload=function() {
document.getElementById("var_name").focus() ;
var options = ipcRenderer.sendSync("openDialog", "") ;
var params = JSON.parse(options) ;
document.getElementById("title").innerHTML = params.label ;
document.getElementById("var_name").value = params.value ;
document.getElementById("btn_variable").innerText = params.ok
}
</script>
</body>
</html>