vericudebuget commited on
Commit
31ca84e
·
verified ·
1 Parent(s): 50548e4

Update reader.html

Browse files
Files changed (1) hide show
  1. reader.html +271 -270
reader.html CHANGED
@@ -1,270 +1,271 @@
1
- <!DOCTYPE html>
2
- <html lang="ro">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Cititor</title>
7
- <style>
8
- body {
9
- margin: 0;
10
- display: flex;
11
- flex-direction: column;
12
- align-items: center;
13
- justify-content: center;
14
- height: 100vh;
15
- background-color: #f5f5f5;
16
- overflow: hidden;
17
- }
18
-
19
- #reader-container {
20
- position: relative;
21
- width: 100%;
22
- height: 100%;
23
- overflow: hidden;
24
- display: flex;
25
- justify-content: center;
26
- align-items: center;
27
- }
28
-
29
- #reader-container img {
30
- width: 100%;
31
- height: auto;
32
- transform-origin: center center;
33
- transition: transform 0.3s;
34
- cursor: grab;
35
- }
36
-
37
- @media (min-width: 768px) {
38
- #reader-container img {
39
- height: 90vh;
40
- width: auto;
41
- }
42
- }
43
-
44
- .controls {
45
- position: absolute;
46
- bottom: 20px;
47
- display: flex;
48
- justify-content: center;
49
- gap: 10px;
50
- }
51
-
52
- button {
53
- padding: 10px 20px;
54
- font-size: 16px;
55
- cursor: pointer;
56
- border: none;
57
- border-radius: 5px;
58
- background-color: #007bff;
59
- color: white;
60
- transition: background-color 0.3s;
61
- }
62
-
63
- button:disabled {
64
- background-color: #ddd;
65
- cursor: not-allowed;
66
- }
67
-
68
- button:hover:not(:disabled) {
69
- background-color: #0056b3;
70
- }
71
-
72
- #page-input {
73
- position: absolute;
74
- top: 20px;
75
- font-size: 24px;
76
- padding: 10px 20px;
77
- border: none;
78
- border-radius: 10px;
79
- text-align: center;
80
- z-index: 1;
81
- }
82
-
83
- #page-input:focus {
84
- outline: none;
85
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
86
- }
87
-
88
- #page-number {
89
- position: absolute;
90
- top: 20px;
91
- left: 20px;
92
- font-size: 24px;
93
- padding: 10px 20px;
94
- border: none;
95
- border-radius: 10px;
96
- text-align: center;
97
- z-index: 1;
98
- background-color: #007bff;
99
- color: white;
100
- }
101
-
102
- #loading-message {
103
- position: absolute;
104
- top: 50%;
105
- left: 50%;
106
- transform: translate(-50%, -50%);
107
- font-size: 24px;
108
- color: #333;
109
- }
110
- </style>
111
- </head>
112
- <body>
113
- <div id="reader-container">
114
- <div id="page-number"></div>
115
- <input id="page-input" type="number" placeholder="Introdu pagina" oninput="handlePageInput(this.value)">
116
- <img id="page-image" src="pages/1.jpg" alt="Pagina 1" style="display: none;">
117
- <div id="loading-message">Imaginea se încarcă, rog așteptați</div>
118
- </div>
119
-
120
- <div class="controls">
121
- <button id="prev-button" disabled>Înapoi</button>
122
- <button id="next-button">Înainte</button>
123
- </div>
124
-
125
- <script>
126
- const TOTAL_PAGES = 92;
127
- let currentPage = 1;
128
- const imageElement = document.getElementById('page-image');
129
- const prevButton = document.getElementById('prev-button');
130
- const nextButton = document.getElementById('next-button');
131
- const pageNumberElement = document.getElementById('page-number');
132
- const loadingMessage = document.getElementById('loading-message');
133
-
134
- const updatePage = () => {
135
- imageElement.src = `pages/${currentPage}.jpg`;
136
- imageElement.alt = `Pagina ${currentPage}`;
137
- prevButton.disabled = currentPage === 1;
138
- nextButton.disabled = currentPage === TOTAL_PAGES;
139
- const pageNumber = currentPage * 2 + 1;
140
- pageNumberElement.textContent = `${pageNumber - 1}-${pageNumber}`;
141
- imageElement.style.display = 'none';
142
- loadingMessage.style.display = 'block';
143
- };
144
-
145
- imageElement.onload = () => {
146
- imageElement.style.display = 'block';
147
- loadingMessage.style.display = 'none';
148
- };
149
-
150
- prevButton.addEventListener('click', () => {
151
- if (currentPage > 1) {
152
- currentPage--;
153
- updatePage();
154
- }
155
- });
156
-
157
- nextButton.addEventListener('click', () => {
158
- if (currentPage < TOTAL_PAGES) {
159
- currentPage++;
160
- updatePage();
161
- }
162
- });
163
-
164
- let scale = 1;
165
- const zoomStep = 0.1;
166
- const maxScale = 3;
167
- const minScale = 1;
168
- let translateX = 0;
169
- let translateY = 0;
170
-
171
- const zoom = (delta) => {
172
- scale = Math.min(maxScale, Math.max(minScale, scale + delta));
173
- applyTransform();
174
- };
175
-
176
- const applyTransform = () => {
177
- imageElement.style.transform = `scale(${scale}) translate(${translateX}px, ${translateY}px)`;
178
- };
179
-
180
- imageElement.addEventListener('wheel', (e) => {
181
- e.preventDefault();
182
- zoom(e.deltaY < 0 ? zoomStep : -zoomStep);
183
- });
184
-
185
- let startX = 0;
186
- let startY = 0;
187
- let isDragging = false;
188
-
189
- imageElement.addEventListener('mousedown', (e) => {
190
- e.preventDefault();
191
- startX = e.clientX;
192
- startY = e.clientY;
193
- isDragging = true;
194
- imageElement.style.cursor = 'grabbing';
195
- });
196
-
197
- window.addEventListener('mousemove', (e) => {
198
- if (isDragging) {
199
- const dx = e.clientX - startX;
200
- const dy = e.clientY - startY;
201
- translateX += dx / scale;
202
- translateY += dy / scale;
203
- startX = e.clientX;
204
- startY = e.clientY;
205
- applyTransform();
206
- }
207
- });
208
-
209
- window.addEventListener('mouseup', () => {
210
- isDragging = false;
211
- imageElement.style.cursor = 'grab';
212
- });
213
-
214
- let touchStartDistance = 0;
215
- imageElement.addEventListener('touchstart', (e) => {
216
- if (e.touches.length === 2) {
217
- e.preventDefault();
218
- touchStartDistance = Math.hypot(
219
- e.touches[0].clientX - e.touches[1].clientX,
220
- e.touches[0].clientY - e.touches[1].clientY
221
- );
222
- } else if (e.touches.length === 1) {
223
- startX = e.touches[0].clientX;
224
- startY = e.touches[0].clientY;
225
- isDragging = true;
226
- }
227
- });
228
-
229
- imageElement.addEventListener('touchmove', (e) => {
230
- if (e.touches.length === 2) {
231
- e.preventDefault();
232
- const currentDistance = Math.hypot(
233
- e.touches[0].clientX - e.touches[1].clientX,
234
- e.touches[0].clientY - e.touches[1].clientY
235
- );
236
- const delta = (currentDistance - touchStartDistance) / 100;
237
- zoom(delta);
238
- touchStartDistance = currentDistance;
239
- } else if (e.touches.length === 1 && isDragging) {
240
- e.preventDefault();
241
- const dx = e.touches[0].clientX - startX;
242
- const dy = e.touches[0].clientY - startY;
243
- translateX += dx / scale;
244
- translateY += dy / scale;
245
- startX = e.touches[0].clientX;
246
- startY = e.touches[0].clientY;
247
- applyTransform();
248
- }
249
- });
250
-
251
- imageElement.addEventListener('touchend', () => {
252
- isDragging = false;
253
- });
254
-
255
- function handlePageInput(value) {
256
- const pageNumber = parseInt(value);
257
- if (!isNaN(pageNumber)) {
258
- if (pageNumber % 2 === 0) {
259
- currentPage = pageNumber / 2;
260
- } else {
261
- currentPage = (pageNumber - 1) / 2;
262
- }
263
- updatePage();
264
- }
265
- }
266
-
267
- updatePage();
268
- </script>
269
- </body>
270
- </html>
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ro">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Cititor</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ display: flex;
11
+ flex-direction: column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ height: 100vh;
15
+ background-color: #f5f5f5;
16
+ overflow: hidden;
17
+ }
18
+
19
+ #reader-container {
20
+ position: relative;
21
+ width: 100%;
22
+ height: 100%;
23
+ overflow: hidden;
24
+ display: flex;
25
+ justify-content: center;
26
+ align-items: center;
27
+ }
28
+
29
+ #reader-container img {
30
+ width: 100%;
31
+ height: auto;
32
+ transform-origin: center center;
33
+ transition: transform 0.3s;
34
+ cursor: grab;
35
+ }
36
+
37
+ @media (min-width: 768px) {
38
+ #reader-container img {
39
+ height: 90vh;
40
+ width: auto;
41
+ }
42
+ }
43
+
44
+ .controls {
45
+ position: absolute;
46
+ bottom: 20px;
47
+ display: flex;
48
+ justify-content: center;
49
+ gap: 10px;
50
+ }
51
+
52
+ button {
53
+ padding: 10px 20px;
54
+ font-size: 16px;
55
+ cursor: pointer;
56
+ border: none;
57
+ border-radius: 5px;
58
+ background-color: #007bff;
59
+ color: white;
60
+ transition: background-color 0.3s;
61
+ }
62
+
63
+ button:disabled {
64
+ background-color: #ddd;
65
+ cursor: not-allowed;
66
+ }
67
+
68
+ button:hover:not(:disabled) {
69
+ background-color: #0056b3;
70
+ }
71
+
72
+ #page-input {
73
+ position: absolute;
74
+ top: 20px;
75
+ font-size: 24px;
76
+ padding: 10px 20px;
77
+ border: none;
78
+ border-radius: 10px;
79
+ text-align: center;
80
+ width: 190px;
81
+ z-index: 1;
82
+ }
83
+
84
+ #page-input:focus {
85
+ outline: none;
86
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
87
+ }
88
+
89
+ #page-number {
90
+ position: absolute;
91
+ top: 20px;
92
+ left: 20px;
93
+ font-size: 24px;
94
+ padding: 10px 20px;
95
+ border: none;
96
+ border-radius: 10px;
97
+ text-align: center;
98
+ z-index: 1;
99
+ background-color: #007bff;
100
+ color: white;
101
+ }
102
+
103
+ #loading-message {
104
+ position: absolute;
105
+ top: 50%;
106
+ left: 50%;
107
+ transform: translate(-50%, -50%);
108
+ font-size: 24px;
109
+ color: #333;
110
+ }
111
+ </style>
112
+ </head>
113
+ <body>
114
+ <div id="reader-container">
115
+ <div id="page-number"></div>
116
+ <input id="page-input" type="number" placeholder="Introdu pagina" oninput="handlePageInput(this.value)">
117
+ <img id="page-image" src="pages/1.jpg" alt="Pagina 1" style="display: none;">
118
+ <div id="loading-message">Imaginea se încarcă, vă rog așteptați</div>
119
+ </div>
120
+
121
+ <div class="controls">
122
+ <button id="prev-button" disablednapoi</button>
123
+ <button id="next-button">Înainte</button>
124
+ </div>
125
+
126
+ <script>
127
+ const TOTAL_PAGES = 92;
128
+ let currentPage = 1;
129
+ const imageElement = document.getElementById('page-image');
130
+ const prevButton = document.getElementById('prev-button');
131
+ const nextButton = document.getElementById('next-button');
132
+ const pageNumberElement = document.getElementById('page-number');
133
+ const loadingMessage = document.getElementById('loading-message');
134
+
135
+ const updatePage = () => {
136
+ imageElement.src = `pages/${currentPage}.jpg`;
137
+ imageElement.alt = `Pagina ${currentPage}`;
138
+ prevButton.disabled = currentPage === 1;
139
+ nextButton.disabled = currentPage === TOTAL_PAGES;
140
+ const pageNumber = currentPage * 2 + 1;
141
+ pageNumberElement.textContent = `${pageNumber - 1}-${pageNumber}`;
142
+ imageElement.style.display = 'none';
143
+ loadingMessage.style.display = 'block';
144
+ };
145
+
146
+ imageElement.onload = () => {
147
+ imageElement.style.display = 'block';
148
+ loadingMessage.style.display = 'none';
149
+ };
150
+
151
+ prevButton.addEventListener('click', () => {
152
+ if (currentPage > 1) {
153
+ currentPage--;
154
+ updatePage();
155
+ }
156
+ });
157
+
158
+ nextButton.addEventListener('click', () => {
159
+ if (currentPage < TOTAL_PAGES) {
160
+ currentPage++;
161
+ updatePage();
162
+ }
163
+ });
164
+
165
+ let scale = 1;
166
+ const zoomStep = 0.1;
167
+ const maxScale = 3;
168
+ const minScale = 1;
169
+ let translateX = 0;
170
+ let translateY = 0;
171
+
172
+ const zoom = (delta) => {
173
+ scale = Math.min(maxScale, Math.max(minScale, scale + delta));
174
+ applyTransform();
175
+ };
176
+
177
+ const applyTransform = () => {
178
+ imageElement.style.transform = `scale(${scale}) translate(${translateX}px, ${translateY}px)`;
179
+ };
180
+
181
+ imageElement.addEventListener('wheel', (e) => {
182
+ e.preventDefault();
183
+ zoom(e.deltaY < 0 ? zoomStep : -zoomStep);
184
+ });
185
+
186
+ let startX = 0;
187
+ let startY = 0;
188
+ let isDragging = false;
189
+
190
+ imageElement.addEventListener('mousedown', (e) => {
191
+ e.preventDefault();
192
+ startX = e.clientX;
193
+ startY = e.clientY;
194
+ isDragging = true;
195
+ imageElement.style.cursor = 'grabbing';
196
+ });
197
+
198
+ window.addEventListener('mousemove', (e) => {
199
+ if (isDragging) {
200
+ const dx = e.clientX - startX;
201
+ const dy = e.clientY - startY;
202
+ translateX += dx / scale;
203
+ translateY += dy / scale;
204
+ startX = e.clientX;
205
+ startY = e.clientY;
206
+ applyTransform();
207
+ }
208
+ });
209
+
210
+ window.addEventListener('mouseup', () => {
211
+ isDragging = false;
212
+ imageElement.style.cursor = 'grab';
213
+ });
214
+
215
+ let touchStartDistance = 0;
216
+ imageElement.addEventListener('touchstart', (e) => {
217
+ if (e.touches.length === 2) {
218
+ e.preventDefault();
219
+ touchStartDistance = Math.hypot(
220
+ e.touches[0].clientX - e.touches[1].clientX,
221
+ e.touches[0].clientY - e.touches[1].clientY
222
+ );
223
+ } else if (e.touches.length === 1) {
224
+ startX = e.touches[0].clientX;
225
+ startY = e.touches[0].clientY;
226
+ isDragging = true;
227
+ }
228
+ });
229
+
230
+ imageElement.addEventListener('touchmove', (e) => {
231
+ if (e.touches.length === 2) {
232
+ e.preventDefault();
233
+ const currentDistance = Math.hypot(
234
+ e.touches[0].clientX - e.touches[1].clientX,
235
+ e.touches[0].clientY - e.touches[1].clientY
236
+ );
237
+ const delta = (currentDistance - touchStartDistance) / 100;
238
+ zoom(delta);
239
+ touchStartDistance = currentDistance;
240
+ } else if (e.touches.length === 1 && isDragging) {
241
+ e.preventDefault();
242
+ const dx = e.touches[0].clientX - startX;
243
+ const dy = e.touches[0].clientY - startY;
244
+ translateX += dx / scale;
245
+ translateY += dy / scale;
246
+ startX = e.touches[0].clientX;
247
+ startY = e.touches[0].clientY;
248
+ applyTransform();
249
+ }
250
+ });
251
+
252
+ imageElement.addEventListener('touchend', () => {
253
+ isDragging = false;
254
+ });
255
+
256
+ function handlePageInput(value) {
257
+ const pageNumber = parseInt(value);
258
+ if (!isNaN(pageNumber)) {
259
+ if (pageNumber % 2 === 0) {
260
+ currentPage = pageNumber / 2;
261
+ } else {
262
+ currentPage = (pageNumber - 1) / 2;
263
+ }
264
+ updatePage();
265
+ }
266
+ }
267
+
268
+ updatePage();
269
+ </script>
270
+ </body>
271
+ </html>