glowingbear-mainbox/electron-start.html

37 lines
1.2 KiB
HTML
Raw Normal View History

2016-04-03 13:47:38 +02:00
<!DOCTYPE html>
<html>
<head>
2016-04-03 13:47:38 +02:00
<meta charset="utf-8">
<script>
onload = function() {
2016-04-03 13:47:38 +02:00
const ipc= require('electron').ipcRenderer;
const remote = require('electron').remote;
const nativeImage = require('electron').nativeImage;
2016-04-03 13:47:38 +02:00
var webview = document.getElementById("glowingbear");
2016-04-03 13:47:38 +02:00
var handleconsole = function(e) {
console.log("webview: " + e.message);
}
2016-04-03 13:47:38 +02:00
var handlenewwindow = function(e) {
require('shell').openExternal(e.url);
}
var handletitleset = function(e) {
document.title = e.title;
}
webview.addEventListener("console-message", handleconsole);
webview.addEventListener("new-window", handlenewwindow);
webview.addEventListener("page-title-set", handletitleset);
ipc.on('browser-window-focus', function() {
setTimeout(function() { webview.focus(); }, 0);
setTimeout(function() { webview.executeJavaScript("document.getElementById(\"sendMessage\").focus();") }, 0);
});
}
</script>
</head>
<body>
<webview preload="electron-globals.js" id="glowingbear" src="index.html" style="position:fixed; top:0; left:0; bottom:0; right:0;"></webview>
</body>
</html>