-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
434 lines (354 loc) · 12.8 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
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
433
434
<html>
<head>
<!-- Scriptquellen hier -->
<script src="time.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="http.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.2/pdfmake.min.js" integrity="sha512-Yf733gmgLgGUo+VfWq4r5HAEaxftvuTes86bKvwTpqOY3oH0hHKtX/9FfKYUcpaxeBJxeXvcN4EY3J6fnmc9cA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.2/vfs_fonts.js" integrity="sha512-cktKDgjEiIkPVHYbn8bh/FEyYxmt4JDJJjOCu5/FQAkW4bc911XtKYValiyzBiJigjVEvrIAyQFEbRJZyDA1wQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!--
<script src="//cdn.jsdelivr.net/npm/eruda"></script>
<script>eruda.init();</script>
-->
</head>
<body>
<script type="text/javascript" charset="utf-8">
const urlParams = new URLSearchParams(window.location.search);
const pvar = urlParams.get('user');
alert(pvar);
// Put your fortniteapi.io API key here
var apikey = "<API key here>";
// ------------------------------------
var datum=date.getTime()/1000;
var fnbr = JSON.parse(httpGet2("https://fortniteapi.io/news?lang=de&type=br","Authorization",apikey));
var fnstw = JSON.parse(httpGet2("https://fortniteapi.io/news?lang=de&type=stw","Authorization",apikey));
var fncreative = JSON.parse(httpGet2("https://fortniteapi.io/news?lang=de&type=creative","Authorization",apikey));
var fnuser = JSON.parse(httpGet2("https://fortniteapi.io/lookup?username="+pvar,"Authorization",apikey));
if(fnuser.result=true) {
var fnmatches= JSON.parse(httpGet2("https://fortniteapi.io/matches?account="+fnuser.account_id,"Authorization",apikey));
var fnstats= JSON.parse(httpGet2("https://fortniteapi.io/stats?account="+fnuser.account_id,"Authorization",apikey));
}
var fnshop= JSON.parse(httpGet2("https://fortniteapi.io/shop?lang=de","Authorization",apikey));
var fnchallenges = JSON.parse(httpGet2("https://fortniteapi.io/challenges?season=current&lang=de","Authorization",apikey));
// Cover
console.log("cover, toc, br news");
var inhalt = [
{text: "fnReport", fontSize: 75}
];
if(fnuser.result=true) {
inhalt.push({text: datum+" - "+timeConverter(datum)+" - "+pvar+" - "+fnuser.account_id+" - de", alignment: 'center'});
} else {
inhalt.push({text: datum+" - "+timeConverter(datum)+" - "+pvar+" - "+fnuser.error+" - de", alignment: 'center'});
}
var farbe1='#'+('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);
console.log(farbe1);
var farbe2='#'+('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);
console.log(farbe2);
var farbe3='#'+('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);
console.log(farbe3);
var bildurl1=fnbr.news[0].image;
var bild1=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl1);
console.log(bildurl1);
console.log(bild1);
var bildurl2=fnbr.news[1].image;
var bild2=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl2);
console.log(bildurl2);
console.log(bild2);
var bildurl3=fnstw.news[0].image;
var bild3=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl3);
console.log(bildurl3);
console.log(bild3);
var bildurl4=fnstw.news[1].image;
var bild4=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl4);
console.log(bildurl4);
console.log(bild4);
var bildurl5=fnshop.featured[0].icon;
var bild5=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl5);
console.log(bildurl5);
console.log(bild5);
var bildurl6=fnshop.featured[1].icon;
var bild6=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl6);
console.log(bildurl6);
console.log(bild6);
inhalt.push(
{text: "Made with fortniteapi.io", alignment: 'center'},
{text: "______________________________________________________________________________________", alignment: 'center'},
{text: " "},
{text: " "},
{layout: 'noBorders', alignment: 'center',
table: {
widths: [250,250],
body: [
[
{image: bild1, fillColor: farbe1, width: 245, alignment: 'center'},
{image: bild2, fillColor: farbe1, width: 245, alignment: 'center'}
],
[
{image: bild3, fillColor: farbe2, width: 245, alignment: 'center'},
{image: bild4, fillColor: farbe2, width: 245, alignment: 'center'}
],
[
{image: bild5, fillColor: farbe3, width: 245, alignment: 'center'},
{image: bild6, fillColor: farbe3, width: 245, alignment: 'center'}
]
]
}
},
// toc
{toc: {
title: {text: "Inhaltsverzeichnis", fontSize: 30},
numberStyle: {bold: true}
}, pageBreak: 'before'
},
{text: " "},
{text: "Battle Royale News", fontSize: 30, alignment: 'center', pageBreak: 'before', tocItem: true},
{text: " "}
);
for(i=0;i<fnbr.news.length;i++) {
var bildurl=fnbr.news[i].image;
var bild=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl);
console.log(bildurl);
console.log(bild);
inhalt.push(
{text: fnbr.news[i].title, fontSize: 20},
{text: fnbr.news[i].date+", aktuell: "+fnbr.news[i].live+", AdSpace: "+fnbr.news[i].adspace},
{text: " "}
);
if(bild!="") {
inhalt.push( {image: bild, width: 200} );
} else {
if(bildurl!="") {
inhalt.push( {qr: bildurl, fit: 200} );
} else {
inhalt.push( {text: "(Konnte kein Bild oder QR-Code erstellen)"} );
}
}
inhalt.push(
{text: " "},
{text: fnbr.news[i].body},
{text: "______________________________"},
{text: " "}
);
}
// stw news
console.log("stw news");
inhalt.push(
{text: " "},
{text: "Save The World News", fontSize: 30, alignment: 'center', pageBreak: 'before', tocItem: true},
{text: " "}
);
for(i=0;i<fnstw.news.length;i++) {
var bildurl=fnstw.news[i].image;
var bild=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl);
console.log(bildurl);
console.log(bild);
inhalt.push(
{text: fnstw.news[i].title, fontSize: 20},
{text: fnstw.news[i].date+", aktuell: "+fnstw.news[i].live+", AdSpace: "+fnstw.news[i].adspace},
{text: " "}
);
if(bild!="") {
inhalt.push( {image: bild, width: 200} );
} else {
if(bildurl!="") {
inhalt.push( {qr: bildurl, fit: 200} );
} else {
inhalt.push( {text: "(Konnte kein Bild oder QR-Code erstellen)"} );
}
}
inhalt.push(
{text: " "},
{text: fnstw.news[i].body},
{text: "______________________________"},
{text: " "}
);
}
// creative news
console.log("creative news");
inhalt.push(
{text: " "},
{text: "Creative Mode News", fontSize: 30, alignment: 'center', pageBreak: 'before', tocItem: true},
{text: " "}
);
for(i=0;i<fncreative.news.length;i++) {
var bildurl=fncreative.news[i].image;
var bild=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl);
console.log(bildurl);
console.log(bild);
inhalt.push(
{text: fncreative.news[i].title, fontSize: 20},
{text: fncreative.news[i].date+", aktuell: "+fncreative.news[i].live+", AdSpace: "+fncreative.news[i].adspace},
{text: " "}
);
if(bild!="") {
inhalt.push( {image: bild, width: 200} );
} else {
if(bildurl!="") {
inhalt.push( {qr: bildurl, fit: 200} );
} else {
inhalt.push( {text: "(Konnte kein Bild oder QR-Code erstellen)"} );
}
}
inhalt.push(
{text: " "},
{text: fncreative.news[i].body},
{text: "______________________________"},
{text: " "}
);
}
// map
console.log("map");
var karte=httpGet("https://helloacm.com/api/image-to-base64/?url=https://media.fortniteapi.io/images/map.png?showPOI=true");
console.log(karte);
inhalt.push(
{text: "Aktuelle Karte (Battle Royale)", pageBreak: 'before', fontSize: 30, alignment: 'center', tocItem: true},
{text: " "},
{image: karte, width: 500, alignment: 'center'}
);
//matches
if(fnuser.result=true) {
console.log("matches");
inhalt.push(
{text: "Zuletzt gespielt", fontSize: 30, pageBreak: 'before', alignment: 'center', tocItem: true},
{text: " "}
);
for(i=0;i<fnmatches.matches.length;i++) {
inhalt.push(
{text: fnmatches.matches[i].readable_name, fontSize: 20},
{text: fnmatches.matches[i].mode+" "+fnmatches.matches[i].platform},
{text: fnmatches.matches[i].date},
{text: fnmatches.matches[i].matchesplayed+" Mal gespielt"},
{text: fnmatches.matches[i].minutesplayed+" Minuten gespielt"},
{text: fnmatches.matches[i].kills+" Kills"},
{text: fnmatches.matches[i].playersoutlived+" Gegner \u00fcberlebt"},
{text: "Score: "+fnmatches.matches[i].score},
{text: " "}
)
}
}
// shop
console.log("shop");
inhalt.push(
{text: "Daily Shop", alignment: 'center', pageBreak: 'before', fontSize: 30, tocItem: true},
{text: " "}
);
for(i=0;i<fnshop.featured.length;i++) {
var bildurl=fnshop.featured[i].icon;
var bild=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl);
console.log(bildurl);
console.log(bild);
inhalt.push(
{text: fnshop.featured[i].name, fontSize: 20},
{text: fnshop.featured[i].id}
);
if(bild!="") {
inhalt.push( {image: bild, width: 200} );
} else {
if(bildurl!="") {
inhalt.push( {qr: bildurl, fit: 200} );
} else {
inhalt.push( {text: "(Konnte kein Bild oder QR-Code erstellen)"} );
}
}
inhalt.push(
{text: fnshop.featured[i].description},
{text: " "},
{text: "Release: "+fnshop.featured[i].releaseDate},
{text: "Zuletzt gesehen: "+fnshop.featured[i].lastAppearance},
{text: "Seltenheit: "+fnshop.featured[i].rarity+" ("+fnshop.featured[i].internalRarity+")"},
{text: "Kaufbar: "+fnshop.featured[i].buyAllowed+", als Geschenk: "+fnshop.featured[i].giftAllowed},
{text: "Preis: "+fnshop.featured[i].price+" VBucks ("+fnshop.featured[i].priceNoDiscount+" VBucks)"},
{text: "Banner: "+fnshop.featured[i].banner},
{text: "Enthalten: "},
{text: " "}
);
for(j=0;j<fnshop.featured[i].otherItemsDetails.length;j++) {
inhalt.push(
{text: fnshop.featured[i].otherItemsDetails[j].name, fontSize: 15},
{text: fnshop.featured[i].otherItemsDetails[j].id}
);
var bildurl=fnshop.featured[i].otherItemsDetails[j].images.icon;
var bild=httpGet("https://helloacm.com/api/image-to-base64/?url="+bildurl);
console.log(bildurl);
console.log(bild);
if(bild!="") {
inhalt.push( {image: bild, width: 150} );
} else {
if(bildurl!="") {
inhalt.push( {qr: bildurl, fit: 150} );
} else {
inhalt.push( {text: "(Konnte kein Bild oder QR-Code erstellen)"} );
}
}
inhalt.push(
{text: fnshop.featured[i].otherItemsDetails[j].description},
{text: " "}
);
}
inhalt.push(
{text: "_____________________________"},
{text: " "}
);
}
// Weekly challenges
var weekly = Object.values(fnchallenges.weeks);
console.log(weekly);
inhalt.push(
{text: "Wochen-Herausforderungen", fontSize: 30, alignment: 'center', pageBreak: 'before', tocItem: true},
{text: " "}
);
for(i=0;i<weekly.length;i++) {
inhalt.push(
{text: weekly[i].name, fontSize: 20, color: '#'+weekly[i].color},
{text: " "}
);
for(j=0;j<weekly[i].challenges.length;j++) {
inhalt.push(
{text: weekly[i].challenges[j].title+" ("+weekly[i].challenges[j].progress_total+")", fontSize: 15},
{text: weekly[i].challenges[j].quest_id},
{text: "XP: "+weekly[i].challenges[j].xp},
{text: "Stars: "+weekly[i].challenges[j].stars},
{text: "Party Assist: "+weekly[i].challenges[j].party_assist},
{text: "Prestige: "+weekly[i].challenges[j].prestige},
{text: "____________________________________"},
{text: " "}
);
}
}
// other challenges
/*
inhalt.push(
{text: "Andere Herausforderungen", fontSize: 30, alignment: 'center', tocItem: true, pageBreak: 'before'},
{text: " "}
);
for(i=0;i<fnchallenges.other.length;i++) {
inhalt.push(
{text: fnchallenges.other[i].name, fontSize: 20, color: '#'+fnchallenges.other[i].color},
{text: " "}
);
for(j=0;j<fnchallenges.other[i].challenges.length;j++) {
inhalt.push(
{text: fnchallenges.other[i].challenges[j].title+" ("+fnchallenges.other[i].challenges[j].progress_total+")", fontSize: 15},
{text: fnchallenges.other[i].challenges[j].quest_id},
{text: "XP: "+fnchallenges.other[i].challenges[j].xp},
{text: "Stars: "+fnchallenges.other[i].challenges[j].stars},
{text: "Party Assist: "+fnchallenges.other[i].challenges[j].party_assist},
{text: "Prestige: "+fnchallenges.other[i].challenges[j].prestige},
{text: "____________________________________"},
{text: " "}
);
}
}
*/
// ------------------------------------------
var docDefinition = {
content: inhalt,
header: {text: "fnReport "+datum, alignment: 'center', fontSize: 8},
footer: function(currentPage) { return {text: currentPage, alignment: 'center', fontSize: 8}}
};
console.log("PDF wird erstellt...");
pdfMake.createPdf(docDefinition).download("fnReport-"+datum+"-"+pvar+"-de.pdf");
console.log("Fertig.");
</script>
</body>
</html>