-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgxtodo.js
More file actions
35 lines (31 loc) · 1.15 KB
/
gxtodo.js
File metadata and controls
35 lines (31 loc) · 1.15 KB
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
29
30
31
32
33
34
35
const shell = require('electron').shell;
const injectCSS = `div#layout-main{width:100%;flex:0 1 auto;height:100%}
div#layout-container{width:100%;height:100%}
div#body{height:100%}`;
function getParameterByName(url, name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(url);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
onload = function () {
var webview = document.getElementById("webview");
webview.addEventListener('dom-ready', function () {
// overwrite css style. make it fullscreen.
console.log(webview);
const path = require('path');
const imgPath = path.join(process.resourcesPath, '/icon.png')
console.log(imgPath);
webview.insertCSS(injectCSS);
// inject js to trigger if there is new message in.
// webview.executeJavaScript('injectJS.getBadge()');
});
webview.addEventListener('new-window', function (e) {
var url = getParameterByName(e.url, 'requrl');
if (url.length > 1) {
shell.openExternal(url);
} else {
shell.openExternal(e.url);
}
});
};