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
2017-07-03 23:56:29 +07:00

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();");
});
}