Skip to content

Commit cfbf543

Browse files
committed
change how img works
1 parent 7326c32 commit cfbf543

File tree

8 files changed

+36
-12
lines changed

8 files changed

+36
-12
lines changed

html/index.html

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="UTF-8">
5-
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
6-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
7-
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
8-
<title>keys</title>
9-
<link rel="stylesheet" href="./style.css">
10-
</head>
11-
<body>
12-
<img src='../images/1.png'/>
13-
</body>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
7+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
8+
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
9+
<title>keys</title>
10+
<link rel="stylesheet" href="./style.css">
11+
</head>
12+
13+
<body>
14+
<img src='../images/all.png' />
15+
</body>
16+
1417
</html>

html/style.css

+16
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,20 @@ body {
77

88
img {
99
width: 100%;
10+
}
11+
12+
.class1 {
13+
margin-top: 0;
14+
}
15+
16+
.class2 {
17+
margin-top: -192px;
18+
}
19+
20+
.class3 {
21+
margin-top: -384px;
22+
}
23+
24+
.class4 {
25+
margin-top: -576px;
1026
}

images/1.png

-33.8 KB
Binary file not shown.

images/2.png

-32 KB
Binary file not shown.

images/3.png

-34.3 KB
Binary file not shown.

images/all.png

819 KB
Loading

main.js

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ function createWindow() {
6666
}
6767
})
6868

69+
globalShortcut.register('Command+4', () => {
70+
if (mainWindow.isVisible()) {
71+
changeImg('4', mainWindow)
72+
}
73+
})
6974
ioHook.start()
7075

7176
mainWindow.setAlwaysOnTop(true, 'floating')

utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const changeImg = (img, mainWindow) => {
22
mainWindow.webContents.executeJavaScript(
3-
`document.querySelector("img").src="../images/${img}.png";`
3+
`document.querySelector("img").classList = "class${img}";`
44
)
55
}
66

0 commit comments

Comments
 (0)