This repository has been archived on 2019-03-08. You can view files and clone it, but cannot push or open issues or pull requests.
MillionHopes/preferencemanager.js

42 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2017-07-03 16:56:29 +00:00
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})
2017-07-07 07:53:35 +00:00
if (process.platform !== 'darwin') preferencesWindow.setMenu(null);
2017-07-03 16:56:29 +00:00
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
})
2017-07-03 17:07:12 +00:00
preferencesWindow.on('blur',() => {
preferencesWindow.close();
})
2017-07-03 16:56:29 +00:00
}
}
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();");
});
}