-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreload.js
28 lines (23 loc) · 837 Bytes
/
preload.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// All of the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
const { dialog, screen, globalShortcut, BrowserWindow } = require('electron').remote
var robot = require("robotjs");
function click(x, y) {
// var el = document.elementFromPoint(x, y)
robot.mouseClick();
}
globalShortcut.register('F8', () => {
var point = screen.getCursorScreenPoint()
click(point.x, point.y)
// document.elementFromPoint(point.x, point.y).click();
console.log(point)
})
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const type of ['chrome', 'node', 'electron']) {
replaceText(`${type}-version`, process.versions[type])
}
})