-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
184 lines (151 loc) · 4.5 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Packtpub Free Ebook</title>
<style>
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
html {
height: 100%;
animation: fadein 0.5s;
-webkit-user-select: none;
user-select: none;
/*-webkit-app-region: drag;*/
}
h2 {
padding: 0px 0px;
margin: 5px 0px;
text-align: left;
}
body {
height: 100%;
}
body,
p {
padding: 0px 0px;
margin: 0px 0px;
text-align: justify;
overflow: hidden;
}
.main {
margin: 0px 0px;
padding: 5px 5px;
}
.cover {
float: left;
width: 180px;
padding: 0px 0px;
object-fit: contain;
margin: 5px 15px 5px 5px;
}
.submain {
padding: 0px 10px;
}
.linkButton {
height: 35px;
width: auto;
float: left;
background: #4479BA;
color: #FFF;
border: 2px solid;
}
.timeLeft p {
font-size: 25px;
font-weight: bold;
padding: 5px 10px;
margin: 0px 0px;
/*float: right;*/
color: crimson;
left: 407px;
position: absolute;
}
.timeLeft {
/*padding-top: 7px;*/
position: absolute;
bottom: 13px;
left: 205px;
}
.svg {
margin-left: auto;
margin-right: auto;
position: absolute;
left: 70px;
top: 80px;
z-index: 1;
}
.description {
padding: 0px 0px;
height: 130px;
}
.scroller {
height: 7px;
}
</style>
</head>
<body>
<img src="svg-loaders/ball-triangle.svg" class="svg" id="loaderUI" />
<div id="main-container" class="main">
<img id="book-cover" class="cover" />
<div class="submain">
<h2 id="book-title"></h2>
<div onmouseover="scroll_up();" onmouseout="stop_scroll();" class="scroller"></div>
<p id="book-description" class="description"></p>
<div onmouseover="scroll_down();" onmouseout="stop_scroll();" class="scroller"></div>
<div class="timeLeft">
<button class="linkButton" onclick="openBrowser()" id="dotdLink">Free Ebook</button>
<p id="book-time-left"></p>
</div>
</div>
</div>
</body>
<script>
const { ipcRenderer } = require('electron');
const shell = require('electron').shell;
document.getElementById('dotdLink').style.display = "none";
// Trigger
ipcRenderer.send('asyncData', 'init');
ipcRenderer.on('asyncMessage', (event, arg) => {
if (arg != null) {
document.getElementById("book-cover").src = "https:" + arg.image;
document.getElementById("book-title").innerHTML = arg.title;
document.getElementById("book-description").innerHTML = arg.description;
document.getElementById('dotdLink').style.display = "block";
document.getElementById("book-time-left").innerHTML = arg.timeLeft;
} else {
document.getElementById("book-title").innerHTML = "No Connection!";
}
ipcRenderer.send('hiddenLoader', "true");
});
function openBrowser() {
shell.openExternal("https://www.packtpub.com/packt/offers/free-learning");
}
// https://bytes.com/topic/javascript/answers/791790-div-scroll-mouseover
var scrolling = null;
function scroll_up() {
var d = document.getElementById('book-description');
d.scrollTop = d.scrollTop - 5;
scrolling = window.setTimeout(function () {
scroll_up();
}, 100);
}
function scroll_down() {
var d = document.getElementById('book-description');
d.scrollTop = d.scrollTop + 5;
scrolling = window.setTimeout(function () {
scroll_down();
}, 100);
}
function stop_scroll() {
window.clearTimeout(scrolling);
}
</script>
</html>