-
Notifications
You must be signed in to change notification settings - Fork 3
/
configWindow.html
129 lines (123 loc) · 4.6 KB
/
configWindow.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
<!DOCTYPE html>
<html lang="de">
<head>
<title>Config NCT Tray Notifier</title>
<meta charset="UTF-8">
<!-- meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'" -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="fonts/Linearicons-Free-v1.0.0/icon-font.min.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<style>
.invis {
display: none;
}
fieldset {
border: none;
padding: 0;
}
ul {
padding-inline-start: 0px;
margin: 0px;
}
li { list-style-type: none; }
</style>
<script>
const electron = require('electron');
const {ipcRenderer} = electron;
function changeVal(i,v){
// console.log(i + ' : ' + v);
const {ipcRenderer} = require('electron');
let newcontent = btoa(document.getElementById('ncurl').value);
ipcRenderer.send('serverChange', newcontent );
console.log("serverChange: " + newcontent);
}
function changeOpt(i,v,c){
//console.log(i + ' : ' + v + ' : ' + c);
const {ipcRenderer} = require('electron');
//let newcontent = i+'_'+v+':'+c;
let newcontent = "";
var x = document.getElementsByName("option");
var i;
console.log(x.length);
for (i = 0; i < x.length; i++) {
if (x[i].type == "checkbox") {
console.log(i);
newcontent = newcontent + x[i].value + ':' + x[i].checked + "\n";
}
}
ipcRenderer.send('optionChange', newcontent );
}
function connectServer() {
const {ipcRenderer} = require('electron');
ipcRenderer.send('connectServer', '' );
console.log("sent IPC");
myWinRef = window.self;
//alert(document.getElementById('ncurl').value);
myWinRef.close();
}
</script>
</head>
<body>
<div class="container-contact100">
<div class="wrap-contact100">
<form id="configList">
<div class="wrap-input100 validate-input" data-validate="URL is required">
<input class="input100" type="text" size="30" id="ncurl" onchange="changeVal(this.id,this.value);" placeholder="URL">
<label class="label-input100" for="ncurl">
<span class="lnr lnr-cloud-sync"></span>
</label>
</div>
<input class="contact100-form-btn" type="submit" id="connect" onclick="connectServer();" value="Connect..."></input><br><br>
<fieldset>
<ul>
<li class="in-vis contact100-form-checkbox">
<input class="input-checkbox100" id="ckb1" type="checkbox" name="option" value="browser" onchange="changeOpt(this.name,this.value,this.checked);" >
<label class="label-checkbox100" for="ckb1">
use external default browser instead of built-in chromium
</label>
</li>
<li class="in-vis contact100-form-checkbox">
<input class="input-checkbox100" id="ckb2" type="checkbox" name="option" value="base-url" onchange="changeOpt(this.name,this.value,this.checked);">
<label class="label-checkbox100" for="ckb2">
default to NC-Talk instead of base URL
</label>
</li>
<li class="in-vis contact100-form-checkbox">
<input class="input-checkbox100" id="ckb3" type="checkbox" name="option" value="nontalk" onchange="changeOpt(this.name,this.value,this.checked);">
<label class="label-checkbox100" for="ckb3">
limit notifications to Nextcloud Talk only
</label>
</li>
<li class="in-vis contact100-form-checkbox">
<input class="input-checkbox100" id="ckb4" type="checkbox" name="option" value="debug" onchange="changeOpt(this.name,this.value,this.checked);">
<label class="label-checkbox100" for="ckb4">
activate debug mode
</label>
</li>
</ul>
</fieldset>
</form>
</div>
</div>
<script src="form.js"></script>
<script>
console.log("Neu laden!");
let arg = ipcRenderer.sendSync('initServerUrl', 'connection' );
console.log(arg);
CV = arg.split(':');
document.getElementById('ncurl').value = atob(CV[0]);
// set options
var x = document.getElementsByName("option");
var i;
for (i = 0; i < x.length; i++) {
if (x[i].value == 'debug' && CV[1] == 'true') { x[i].checked = true ; }
if (x[i].value == 'browser' && CV[2] == 'true') { x[i].checked = true ; }
if (x[i].value == 'base-url' && CV[3] == 'true') { x[i].checked = true ; }
if (x[i].value == 'nontalk' && CV[4] == 'true') { x[i].checked = true ; }
}
//document.getElementById('ncuser').value = atob(CV[1]);
//document.getElementById('ncpwd').value = atob(CV[2]);
</script>
</body>
</html>