38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const {app, Menu, BrowserWindow} = require('electron')
|
|
|
|
const url = require('url')
|
|
|
|
const path = require('path')
|
|
|
|
let preferencesWindow;
|
|
|
|
require('electron-debug')();
|
|
function showPreferences_int(){
|
|
if(!preferencesWindow){
|
|
preferencesWindow = new BrowserWindow({width: 800, height: 600})
|
|
preferencesWindow.loadURL(url.format({
|
|
pathname: path.join(__dirname, 'preferences.html'),
|
|
protocol: 'file:',
|
|
slashes: true
|
|
}))
|
|
preferencesWindow.on('closed', () => {
|
|
// Dereference the window object, usually you would store windows
|
|
// in an array if your app supports multi windows, this is the time
|
|
// when you should delete the corresponding element.
|
|
preferencesWindow = null
|
|
})
|
|
}
|
|
}
|
|
module.exports.showPreferences = function(){
|
|
showPreferences_int();
|
|
preferencesWindow.webContents.on('did-finish-load', function() {
|
|
preferencesWindow.webContents.executeJavaScript("document.getElementById('mh-pane-general').click();");
|
|
});
|
|
}
|
|
module.exports.showAbout = function(){
|
|
showPreferences_int();
|
|
preferencesWindow.webContents.on('did-finish-load', function() {
|
|
preferencesWindow.webContents.executeJavaScript("document.getElementById('mh-pane-about').click();");
|
|
});
|
|
}
|