-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex.html
84 lines (67 loc) · 2.06 KB
/
index.html
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>KissNemp</title>
<link rel="stylesheet" href="./mainWindowStyle.css" />
<script>
var remote = require('remote');
const ipc = require('electron').ipcRenderer;
var browserWindow = remote.getCurrentWindow();
var webView;
var isMini = false;
var playControl = {};
ipc.on('playControl', (e, msg)=>
{
webview.send('playControl', msg);
});
ipc.on('windowControl', (e, msg)=>
{
if(msg == 'showMain')
{
browserWindow.show();
if(isMini)
{
toggleMiniMode();
}
}
});
function toggleMiniMode()
{
if(isMini)
{
browserWindow.setSize(982, 600);
browserWindow.setAlwaysOnTop(false);
browserWindow.setMinimumSize(982, 600);
}else
{
browserWindow.setSize(350, 100);
browserWindow.setMaximumSize(350, 100);
browserWindow.setAlwaysOnTop(true);
}
document.getElementById("title-text").style.width = isMini ? "900px" : "278px";
document.getElementById("btn-minimize").style.display = isMini ? "inherit" : "none";
webview.send('windowControl', 'toggleMiniMode');
isMini = !isMini;
}
</script>
</head>
<body>
<div id="title-bar">
<div id="title-text"></div>
<ul id="window-btns">
<li onclick="browserWindow.close();" style="background:rgba(255, 60, 60, 0.5);">x</li>
<li onclick="toggleMiniMode();" style="background:rgba(80, 180, 255, 0.5);">=</li>
<li id="btn-minimize" onclick="browserWindow.minimize()" style="background:rgba(255,255,255, 0.5);">_</li>
</ul>
</div>
<webview style="padding-right:15px;" id="webView" preload="hack.js" src="http://music.163.com/#/my"/>
<script type="text/javascript">
webview = document.getElementById("webView");
webview.addEventListener("dom-ready", () =>
{
//webview.openDevTools();
});
</script>
</body>
</html>