2015-10-09 06:50:48 -07:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
2015-10-23 09:44:10 -07:00
|
|
|
|
2015-10-09 06:50:48 -07:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Settings</title>
|
|
|
|
</head>
|
2015-10-23 09:44:10 -07:00
|
|
|
|
2015-10-09 06:50:48 -07:00
|
|
|
<body>
|
|
|
|
<h1>Settings</h1>
|
2015-10-23 09:44:10 -07:00
|
|
|
<p>URL:
|
|
|
|
<input type="text" id="url">
|
|
|
|
</p>
|
2015-10-09 06:50:48 -07:00
|
|
|
<input type="button" value="OK" onclick="saveSettings()">
|
|
|
|
<input type="button" value="Cancel" onclick="goBack()">
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2015-11-20 01:54:44 -08:00
|
|
|
const remote = require('electron').remote;
|
2015-10-09 06:50:48 -07:00
|
|
|
var fs = require('fs');
|
|
|
|
|
2015-10-23 09:44:10 -07:00
|
|
|
var saveSettings = function() {
|
2015-12-12 03:32:06 -08:00
|
|
|
var configFile = remote.getGlobal('config-file');
|
2015-10-09 06:50:48 -07:00
|
|
|
var urlInput = document.getElementById('url');
|
|
|
|
var config = {
|
|
|
|
url: urlInput.value
|
|
|
|
};
|
2015-10-23 09:44:10 -07:00
|
|
|
fs.writeFile(configFile, JSON.stringify(config, null, ' '), function(err) {
|
|
|
|
if (err) throw err;
|
2015-10-09 06:50:48 -07:00
|
|
|
window.location.href = './index.html';
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-10-23 09:44:10 -07:00
|
|
|
var goBack = function() {
|
2015-10-09 06:50:48 -07:00
|
|
|
remote.getCurrentWindow().webContents.goBack();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
2015-10-23 09:44:10 -07:00
|
|
|
|
|
|
|
</html>
|