-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbookmark-blockage-fix.html
More file actions
432 lines (401 loc) · 15.3 KB
/
Copy pathbookmark-blockage-fix.html
File metadata and controls
432 lines (401 loc) · 15.3 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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<!doctype html>
<html lang="pl">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title data-i18n="fix_title">
Naprawa Blokady Bookmarklet | T212 Exporter
</title>
<meta
name="description"
data-i18n="fix_p"
content="Wykryto blokadę Content Security Policy (CSP). Dowiedz się, jak ręcznie uruchomić narzędzie T212 Exporter."
/>
<meta
name="keywords"
data-i18n="meta_keywords"
content="CSP block, T212 export fix, bookmarklet error, require-trusted-types-for, Trading212 tool fix"
/>
<meta name="author" content="Dawid Konopiaty (DarkSpine433)" />
<link
rel="canonical"
href="https://darkspine433.github.io/T212-data-exporter/bookmark-blockage-fix/"
/>
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta
property="og:url"
content="https://darkspine433.github.io/T212-data-exporter/bookmark-blockage-fix/"
/>
<meta
property="og:title"
data-i18n="fix_title"
content="Naprawa Blokady Bookmarklet | T212 Exporter"
/>
<meta
property="og:description"
data-i18n="fix_p"
content="Wykryto blokadę Content Security Policy (CSP). Dowiedz się, jak ręcznie uruchomić narzędzie T212 Exporter."
/>
<meta
property="og:image"
content="https://darkspine433.github.io/T212-data-exporter/src/assets/og-image.png"
/>
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta
property="twitter:url"
content="https://darkspine433.github.io/T212-data-exporter/bookmark-blockage-fix/"
/>
<meta
property="twitter:title"
data-i18n="fix_title"
content="Naprawa Blokady Bookmarklet | T212 Exporter"
/>
<meta
property="twitter:description"
data-i18n="fix_p"
content="Wykryto blokadę Content Security Policy (CSP). Dowiedz się, jak ręcznie uruchomić narzędzie T212 Exporter."
/>
<meta
property="twitter:image"
content="https://darkspine433.github.io/T212-data-exporter/src/assets/og-image.png"
/>
<!-- JSON-LD Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "T212 Bookmarklet CSP Fix",
"description": "Instructions to bypass Content Security Policy blockage for T212 Data Exporter.",
"url": "https://darkspine433.github.io/T212-data-exporter/bookmark-blockage-fix",
"publisher": {
"@type": "Organization",
"name": "T212 Tool"
}
}
</script>
<link rel="stylesheet" href="./src/styles/styles.css" />
<link rel="stylesheet" href="./src/styles/bookmark.css" />
<script src="./src/core/i18n.js"></script>
<script src="./src/components/LanguageSwitcher.js"></script>
</head>
<body>
<language-switcher></language-switcher>
<div class="bg-canvas">
<div class="glow-orb orb-1"></div>
<div class="glow-orb orb-2"></div>
<div class="grid-pattern"></div>
</div>
<div class="fix-container">
<img
src="./src/assets/logo.png"
alt="T212 Exporter Logo"
class="fix-logo"
/>
<h1 data-i18n="fix_h1">Rozwiązywanie problemów z uruchomieniem</h1>
<p data-i18n="fix_p">
Twoja przeglądarka lub ustawienia strony Trading212 zablokowały
automatyczne uruchomienie skryptu (Błąd:
<code>require-trusted-types-for 'script'</code>). Nie martw się, możesz
uruchomić narzędzie ręcznie w kilku prostych krokach.
</p>
<div class="alert-info">
<strong data-i18n="fix_why_t">Dlaczego to widzę?</strong>
<p data-i18n="fix_why_p" style="margin-bottom: 10px">
Nowoczesne zabezpieczenia stron (Content Security Policy oraz Same
Origin Policy / CORS) czasem blokują skrypty "wstrzykiwane" przez
zakładki lub pobierane z zewnętrznych serwerów.
</p>
</div>
<!-- Metoda 1: Konsola -->
<h2
data-i18n="fix_pc_title"
style="
text-align: left;
margin-top: 40px;
margin-bottom: 20px;
font-size: 1.4rem;
color: var(--accent);
"
>
Procedura dla przeglądarek stacjonarnych (Console)
</h2>
<div class="steps-wrapper">
<div class="step">
<div class="step-num">1</div>
<div data-i18n="fix_s1">
Skopiuj poniższy kod przyciskiem <strong>"Kopiuj Kod"</strong>.
</div>
</div>
<div class="step">
<div class="step-num">2</div>
<div data-i18n="fix_s2">
Przejdź do karty z otwartym <strong>Trading212</strong> i naciśnij
<kbd>F12</kbd> (lub Prawy Przycisk -> Zbadaj -> Konsola).
</div>
</div>
<div class="step">
<div class="step-num">3</div>
<div data-i18n="fix_s3">
Wklej kod w konsoli i naciśnij <kbd>Enter</kbd>.
</div>
</div>
</div>
<div class="code-box" style="margin-bottom: 40px">
<div class="copy-overlay">
<button class="copy-btn" id="copy-fix-btn" data-i18n="fix_copy">
Kopiuj Kod
</button>
</div>
<pre id="fix-code-display">Ładowanie kodu...</pre>
</div>
<!-- CFD / Crypto quick notes and GIF -->
<div style="display:flex; gap:18px; flex-wrap:wrap; margin-top:10px">
<div style="flex:1; min-width:220px; padding:10px; background:var(--card-bg); border:1px solid var(--border); border-radius:10px">
<strong>CFD (natywny eksport)</strong>
<p style="margin:6px 0; color:var(--text-muted)">Jeżeli korzystasz z konta CFD, użyj wbudowanej funkcji eksportu w aplikacji Trading212 (CSV).</p>
</div>
<div style="flex:1; min-width:220px; padding:10px; background:var(--card-bg); border:1px solid var(--border); border-radius:10px">
<strong>Crypto (użyj narzędzia)</strong>
<p style="margin:6px 0; color:var(--text-muted)">Konta Crypto eksportuj za pomocą tej strony (bookmarklet lub konsola). Nie ma jeszcze natywnego CSV.</p>
</div>
<div style="flex-basis:100%; text-align:center; margin-top:8px">
<img src="https://raw.githubusercontent.com/DarkSpine433/T212-data-exporter/main/src/assets/export-instrucion.gif" alt="Instrukcja eksportu" width="320" style="border-radius:10px; border:1px solid rgba(0,0,0,0.06)" />
</div>
</div>
<!-- Metoda 2: Bookmarklet -->
<!-- <div
style="
margin-top: 60px;
padding: 30px;
background: rgba(147, 197, 253, 0.05);
border: 1px dashed var(--accent);
border-radius: 12px;
"
>
<h2 style="color: var(--accent); margin-top: 0; font-size: 1.3rem">
🚀 Metoda 2: Bookmarklet Uniwersalny (Działa wszędzie)
</h2>
<p style="font-size: 0.9rem; margin-bottom: 20px">
Najprostsza i <strong>najbardziej niezawodna metoda</strong>.
Działająca na <strong>wszystkich przeglądarach</strong> i
urządzeniach. Skopiuj kod bookmarklet raz, dodaj do paska zakładek i
używaj wielokrotnie! <br />
<span style="color: var(--warning); font-size: 0.8rem"
>⚠️ Wymagana aktualizacja zakładki (Wersja 04.05.2026 - v3).</span
>
</p>
<div class="steps-wrapper">
<div class="step">
<div class="step-num">1</div>
<div>
<strong>Skopiuj kod bookmarklet</strong> przyciskiem poniżej.
</div>
</div>
<div class="step">
<div class="step-num">2</div>
<div>
<strong>Stwórz/Edytuj zakładkę</strong> o nazwie
<code>T212 Run</code> i wklej skopiowany kod jako jej adres URL.
</div>
</div>
<div class="step">
<div class="step-num">3</div>
<div>
<strong>Kliknij "Otwórz Trading212"</strong> aby przygotować kod
eksportu.
</div>
</div>
<div class="step">
<div class="step-num">4</div>
<div>
Będąc na stronie T212, <strong>kliknij swoją zakładkę</strong> z
paska zakładek.
</div>
</div>
</div>
<h3
style="
font-size: 0.95rem;
margin: 20px 0 10px 0;
color: var(--accent);
"
>
📋 Kod Zakładki (Uniwersalny Loader)
</h3>
<div class="code-box">
<div class="copy-overlay">
<button class="copy-btn" id="copy-mobile-magic-btn">
Kopiuj Zakładkę
</button>
</div>
<pre
id="mobile-magic-code-display"
style="max-height: 150px; overflow-y: auto; font-size: 0.75rem"
>
Generowanie...</pre
>
</div>
<button
id="open-trading212-btn"
class="copy-btn"
style="
width: 100%;
margin-top: 20px;
background: rgba(147, 197, 253, 0.2);
color: var(--accent);
padding: 12px;
font-weight: bold;
border-radius: 8px;
cursor: pointer;
font-size: 0.95rem;
border: 1px solid var(--accent);
"
>
🔗 Otwórz Trading212 & Prześlij Kod
</button>
<p
style="font-size: 0.8rem; color: var(--text-muted); margin-top: 15px"
>
💡 <strong>Jak to działa?</strong> Kod jest przesyłany w bezpiecznym,
zakodowanym formacie przez adres URL. Zakładka odczytuje go i
uruchamia skrypt bez ingerencji w zabezpieczenia strony.
</p>
</div> -->
<a
href="index.html"
class="partnership-badge"
style="display: inline-block; margin-top: 40px"
data-i18n="pp_back"
>⬅ Wróć do instrukcji głównej</a
>
<hr style="margin: 40px 0; opacity: 0.1" />
<dialog
id="browsers-dialog"
class="tool-card"
style="
max-width: 500px;
margin: auto;
padding: 30px;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--card-bg);
color: var(--text-main);
box-shadow: var(--shadow-lg);
"
>
<h3 style="margin-top: 0; margin-bottom: 15px">
Wspierane przeglądarki
</h3>
<ul style="text-align: left; list-style-type: none; padding-left: 0">
<li style="margin-bottom: 8px">
✅ Firefox, Chrome, Safari, Edge, Opera
</li>
<li style="margin-bottom: 8px">
✅ Wszystkie systemy (Windows, macOS, iOS, Android)
</li>
</ul>
<div style="text-align: right">
<button
onclick="closeBrowsersDialog()"
class="copy-btn"
style="
background: rgba(255, 255, 255, 0.1);
color: var(--text-main);
"
>
Zamknij
</button>
</div>
</dialog>
</div>
<script type="module">
async function loadCode() {
const display = document.getElementById("fix-code-display");
const mobileMagicDisplay = document.getElementById(
"mobile-magic-code-display",
);
try {
const { getData, getInstruction } =
await import("./src/core/get-t212-data.js");
const response = await fetch("./src/core/get-t212-data.js");
if (!response.ok) throw new Error("Failed to fetch script");
let rawCode = await response.text();
rawCode = rawCode.replace(
/export\s+\{\s*getData,\s*getInstruction\s*\};/g,
"",
);
const fullCode = `/*${getInstruction()}*/\n\n${rawCode}\n\ngetData();`;
if (display) display.textContent = fullCode;
const minify = (code) =>
code
.replace(/\/\*[\s\S]*?\*\//g, "")
.replace(/\/\/.*$/gm, "")
.replace(/\s+/g, " ")
.trim();
const minifiedLite = minify(rawCode) + " getData();";
// Generate Universal Bookmarklet (Loader)
if (mobileMagicDisplay) {
// Version 3 - Uses JSON.parse + atob for 100% reliable character handling
const universalBookmark = `javascript:(function(){try{var u=window.location.href,m=u.match(/[?&#]t212b=([^&#]+)/);if(m){var c=JSON.parse(atob(m[1]));(new Function(c))();}else{alert('Error: Please click \"Open Trading212\" again on instructions page.');}}catch(e){alert('Error:\\n'+e.message);}})();`;
mobileMagicDisplay.textContent = universalBookmark;
}
// Button handler: Open T212 and pass code
document
.getElementById("open-trading212-btn")
?.addEventListener("click", () => {
// Step 1: Escape Unicode characters to literal \u{...} to keep the code ASCII-safe
// We use double backslash so it stays a literal escape sequence in the final code
let asciiSafe = "";
for (const char of minifiedLite) {
const cp = char.codePointAt(0);
asciiSafe += cp > 127 ? "\\\\u{" + cp.toString(16) + "}" : char;
}
// Step 2: Wrap in JSON.stringify to handle existing quotes/backslashes
// then Base64 encode for URL safety.
const base64Code = btoa(JSON.stringify(asciiSafe));
const targetUrl = `https://app.trading212.com/#t212b=${base64Code}`;
if (window.opener && !window.opener.closed) {
try {
window.opener.location.href = targetUrl;
alert(
"✅ Kod został przesłany! Wróć do karty Trading212 i kliknij zakładkę.",
);
return;
} catch (e) {}
}
window.location.href = targetUrl;
});
// Copy button handlers
document
.getElementById("copy-fix-btn")
?.addEventListener("click", async (e) => {
await navigator.clipboard.writeText(fullCode);
e.target.textContent = "Skopiowano! ✅";
setTimeout(() => (e.target.textContent = "Kopiuj Kod"), 2000);
});
document
.getElementById("copy-mobile-magic-btn")
?.addEventListener("click", async (e) => {
await navigator.clipboard.writeText(
mobileMagicDisplay.textContent,
);
e.target.textContent = "Skopiowano! ✅";
setTimeout(
() => (e.target.textContent = "Kopiuj Zakładkę"),
2000,
);
});
} catch (err) {
console.error("Failed to load export code:", err);
}
}
loadCode();
window.openBrowsersDialog = () =>
document.getElementById("browsers-dialog").showModal();
window.closeBrowsersDialog = () =>
document.getElementById("browsers-dialog").close();
</script>
</body>
</html>