Added old files
This commit is contained in:
parent
9ae92803ce
commit
ef3620f4f9
86 changed files with 2157 additions and 0 deletions
76
main.js
Normal file
76
main.js
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
const { app, BrowserWindow, webFrame, Menu, dialog } = require('electron')
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
const shell = require('electron').shell
|
||||
|
||||
let isShown = true
|
||||
|
||||
app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required')
|
||||
|
||||
app.on('ready', () => {
|
||||
app.win = new BrowserWindow({
|
||||
width: 860,
|
||||
height: 420,
|
||||
minWidth: 860,
|
||||
minHeight: 420,
|
||||
backgroundColor: '#000',
|
||||
icon: path.join(__dirname, { darwin: 'icon.icns', linux: 'icon.png', win32: 'icon.ico' }[process.platform] || 'icon.ico'),
|
||||
resizable: true,
|
||||
frame: process.platform !== 'darwin',
|
||||
skipTaskbar: process.platform === 'darwin',
|
||||
autoHideMenuBar: process.platform === 'darwin',
|
||||
webPreferences: { zoomFactor: 1.0, nodeIntegration: true, backgroundThrottling: false }
|
||||
})
|
||||
|
||||
app.win.loadURL(`file://${__dirname}/sources/index.html`)
|
||||
// app.inspect();
|
||||
|
||||
app.win.on('closed', () => {
|
||||
win = null
|
||||
app.quit()
|
||||
})
|
||||
|
||||
app.win.on('hide', function () {
|
||||
isShown = false
|
||||
})
|
||||
|
||||
app.win.on('show', function () {
|
||||
isShown = true
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
app.quit()
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (app.win === null) {
|
||||
createWindow()
|
||||
} else {
|
||||
app.win.show()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
app.inspect = function () {
|
||||
app.win.toggleDevTools()
|
||||
}
|
||||
|
||||
app.toggle_fullscreen = function () {
|
||||
app.win.setFullScreen(!app.win.isFullScreen())
|
||||
}
|
||||
|
||||
app.toggle_visible = function () {
|
||||
if (process.platform == 'win32') {
|
||||
if (!app.win.isMinimized()) { app.win.minimize() } else { app.win.restore() }
|
||||
} else {
|
||||
if (isShown && !app.win.isFullScreen()) { app.win.hide() } else { app.win.show() }
|
||||
}
|
||||
}
|
||||
|
||||
app.inject_menu = function (menu) {
|
||||
try {
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
|
||||
} catch (err) {
|
||||
console.warn('Cannot inject menu.')
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue