-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-1.html
520 lines (414 loc) Β· 32.2 KB
/
post-1.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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<!DOCTYPE html><html lang="en-gb"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Make a Family Tree Fan Chart</title><meta name="description" content="This thing is a new Family Tree Chart for the Photo Family Tree template. A fan chart is a creative display of a personβs direct ancestors. FamilySearch.org has a fan chart view, which this thing is based on. If you want to create a fan…"><meta name="generator" content="Publii Open-Source CMS for Static Site"><script type="text/javascript" async src="https://www.googletagmanager.com/gtag/js?id="></script><script type="text/javascript">window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '' );</script><link rel="canonical" href="https://UUoocl.github.io/post-1.html"><link rel="alternate" type="application/atom+xml" href="https://UUoocl.github.io/feed.xml"><link rel="alternate" type="application/json" href="https://UUoocl.github.io/feed.json"><meta property="og:title" content="Make a Family Tree Fan Chart"><meta property="og:site_name" content="UUoocl πͺ΅"><meta property="og:description" content="This thing is a new Family Tree Chart for the Photo Family Tree template. A fan chart is a creative display of a personβs direct ancestors. FamilySearch.org has a fan chart view, which this thing is based on. If you want to create a fan…"><meta property="og:url" content="https://UUoocl.github.io/post-1.html"><meta property="og:type" content="article"><link rel="stylesheet" href="https://UUoocl.github.io/assets/css/style.css?v=b9a8c1aef219bfea88376c3a9d73f38c"><script type="application/ld+json">{"@context":"http://schema.org","@type":"Article","mainEntityOfPage":{"@type":"WebPage","@id":"https://UUoocl.github.io/post-1.html"},"headline":"Make a Family Tree Fan Chart","datePublished":"2022-10-29T16:20","dateModified":"2022-12-05T12:20","description":"This thing is a new Family Tree Chart for the Photo Family Tree template. A fan chart is a creative display of a personβs direct ancestors. FamilySearch.org has a fan chart view, which this thing is based on. If you want to create a fan…","author":{"@type":"Person","name":"Jonathan","url":"https://UUoocl.github.io/authors/jonathan/"},"publisher":{"@type":"Organization","name":"Jonathan"}}</script></head><body><div class="site-container"><header class="top" id="js-header"><a class="logo" href="https://UUoocl.github.io/">UUoocl πͺ΅</a></header><main><article class="post"><div class="hero"><header class="hero__content"><div class="wrapper"><h1>Make a Family Tree Fan Chart</h1></div></header></div><div class="wrapper post__entry"><p>This thing is a new Family Tree Chart for the Photo Family Tree template. A fan chart is a creative display of a personβs direct ancestors. FamilySearch.org has a fan chart view, which this thing is based on. If you want to create a fan chart but donβt want to enter your family information on FamilySearch, then you might like this.</p><p>This chart shows the ancestors of a single person in your family tree. The chart looks like this,</p><figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/FanChart_Template_Example.jpg" alt="Image description" width="1407" height="912" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_Example-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_Example-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_Example-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_Example-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_Example-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_Example-2xl.jpg 1600w"></figure><p></p><p>The template can be cusomized. Here is an example in with a water color style.<br></p><figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/FanChart_Template_WaterColor_Example-2.jpg" alt="Image description" width="1625" height="965" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_WaterColor_Example-2-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_WaterColor_Example-2-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_WaterColor_Example-2-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_WaterColor_Example-2-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_WaterColor_Example-2-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Template_WaterColor_Example-2-2xl.jpg 1600w"></figure>To create the chart youβll need Inkscape and an extension Next Generator. Both are free!<p></p><p>Follow along to make your own.</p><p>There are 2 parts to the Fan Chart Template.</p><ol><li>a Google Sheets Template where the family tree data is saved</li><li>an Inkscape Scabalbe Vector Graphic (SVG) file.</li></ol><h3 id="1-get-a-copy-of-the-family-tree-fan-chart-google-sheets-template">1. Get a Copy of the Family Tree Fan Chart Google Sheets template</h3><p>Copy the <a href="https://docs.google.com/spreadsheets/d/1c7niicz6SytnLpoOyrmLOtaSqAg9d2UyZgxxzZUOX7M/copy">Google sheet Photo Famly Tree with Fan Chart template</a> to your Google Drive. Use the βPeopleβ tab to enter you family tree information. Watch this video to learn how to get started.<br><a href="https://www.youtube.com/watch?v=qs8Ips159ts">Create a Photo Family Tree with Google Sheets and yEd</a></p><h4 id="add-fan-chart-to-existing-spreadsheet">Add Fan Chart to Existing Spreadsheet</h4><p>If you already have a family tree template you can add the βFanChartβ tab.</p><ul><li><p>Right click on the βFanChartβ Tab.</p></li><li><p>Select βCopy Toβ</p><figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/Copy_Sheet_Tab.jpg" alt="Image description" width="353" height="396" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/Copy_Sheet_Tab-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/Copy_Sheet_Tab-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/Copy_Sheet_Tab-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/Copy_Sheet_Tab-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/Copy_Sheet_Tab-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/Copy_Sheet_Tab-2xl.jpg 1600w"></figure><p></p></li><li><p>Then select the spreadsheet to add the sheet to.</p></li></ul><h3 id="2-fill-in-the-fan-chart-sheet">2. Fill In the Fan Chart Sheet</h3><p>Use Column A to select a Person. Each row in the Fan Chart Sheet will create a fan chart diagram.<br></p><figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/FanChart_Dropdown.jpg" alt="Image description" width="514" height="333" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/FanChart_Dropdown-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Dropdown-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Dropdown-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Dropdown-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Dropdown-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/FanChart_Dropdown-2xl.jpg 1600w"></figure><p></p><h3 id="3-download-the-fan-chart-info">3. Download the Fan Chart info</h3><p>In the Family Tree Template, select the βFan Chartβ sheet. Click</p><ul><li>File β‘οΈ Download β‘οΈComma Separated Values (.csv)<figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/Download_CSV.jpg" alt="Image description" width="575" height="412" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/Download_CSV-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/Download_CSV-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/Download_CSV-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/Download_CSV-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/Download_CSV-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/Download_CSV-2xl.jpg 1600w"></figure></li></ul><p>Now that the Fan chart data is downloaded from the Google Sheet, itβs time to work on creating the fan Chart diagram in Inkscape.</p><h3 id="4-create-the-fan-chart-diagram-in-inkscape">4. Create the Fan Chart Diagram in Inkscape</h3><ul><li><h4 id="download-inkscape">Download Inkscape</h4><p>Inkscape is a free drawing application. <a href="https://inkscape.org/">https://inkscape.org/</a> Install and Open Inkscape</p></li><li><h4 id="download-the-inkscape-extension-nextgenerator">Download the Inkscape Extension NextGenerator</h4><p>The NextGenerator Extension will match the data from the CSV file to the Fan Chart template. <a href="https://inkscape.org/~Moini/%E2%98%85nextgenerator-replace-export">NextGenerator Extension</a></p></li></ul><p>The extension will need to be saved to a folder named βUser extensionsβ. Hereβs how to find the βUser extensionsβ folder.</p><ul><li><p>In Inkscape, click Edit β‘οΈPreferences</p></li><li><p>Select βSystemβ, then click the βopenβ button next to βUser extensionsβ</p><figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/Inkscape_Preferences.jpg" alt="Image description" width="846" height="326" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/Inkscape_Preferences-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/Inkscape_Preferences-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/Inkscape_Preferences-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/Inkscape_Preferences-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/Inkscape_Preferences-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/Inkscape_Preferences-2xl.jpg 1600w"></figure><p></p></li></ul><p>The 2 NextGenerator files that will be saved in the User extensions folder are</p><ul><li><a href="https://gitlab.com/Moini/nextgenerator/-/raw/master/next_gen.inx?inline=false">next_gen.inx</a></li><li><a href="https://gitlab.com/Moini/nextgenerator/-/raw/master/next_gen.py?inline=false">next_gen.py</a></li><li>Download the next_gen.inx and next_gen.py files to the βUser extensionsβ folder.<ul><li>Close and reopen Inkscape.</li></ul></li></ul><h4 id="download-the-family-tree-fan-chart-template">Download the Family Tree Fan Chart Template</h4><p><a href="https://rebrand.ly/k92g10x">Family Tree Fan Chart Template</a></p><h4 id="open-the-fan-chart-template-in-inkscape">Open the Fan Chart Template in Inkscape</h4><ul><li>File β‘οΈOpen</li><li><h4 id="open-the-nextgenerator-extension">Open the NextGenerator Extension</h4><ul><li>Extensions β‘οΈExportβ‘οΈNextGenerator</li><li><figure class="post__image"><img loading="lazy" src="https://UUoocl.github.io/media/posts/1/NextGeneratorUI.jpg" alt="Image description" width="469" height="594" sizes="100vw" srcset="https://UUoocl.github.io/media/posts/1/responsive/NextGeneratorUI-xs.jpg 300w, https://UUoocl.github.io/media/posts/1/responsive/NextGeneratorUI-sm.jpg 480w, https://UUoocl.github.io/media/posts/1/responsive/NextGeneratorUI-md.jpg 768w, https://UUoocl.github.io/media/posts/1/responsive/NextGeneratorUI-lg.jpg 1024w, https://UUoocl.github.io/media/posts/1/responsive/NextGeneratorUI-xl.jpg 1360w, https://UUoocl.github.io/media/posts/1/responsive/NextGeneratorUI-2xl.jpg 1600w"></figure><ul><li>Choose the location of the CSV file</li><li>Enter %VAR_Name% as the file name</li><li>Choose a folder to save the Fan Charts<ul><li>Create the folder, if it doesnβt exist.</li></ul></li><li>Press the βApplyβ button</li></ul></li></ul></li></ul><p>The template uses the free Google Font βCourier Primeβ. This font can be optional installed. <a href="https://fonts.google.com/specimen/Courier+Prime">Courier Prime Font</a></p></div><footer class="wrapper post__footer"><p class="post__last-updated">This article was updated on December 5, 2022</p><div class="post__share"></div></footer></article><nav class="post__nav"><div class="post__nav-inner"><div class="post__nav-next"><a href="https://UUoocl.github.io/set-yed-family-tree-custom-colors.html" class="post__nav-link" rel="next"><span>Next</span> Set yEd Family Tree Custom ColorsΒ Β </a><svg width="1.041em" height="0.416em" aria-hidden="true"><use xlink:href="https://UUoocl.github.io/assets/svg/svg-map.svg#arrow-next"/></svg></div></div></nav><div class="post__related related"><div class="wrapper"><h2 class="h5 related__title">You should also read:</h2><article class="related__item"><div class="feed__meta"><time datetime="2022-11-01T07:23" class="feed__date">November 1, 2022</time></div><h3 class="h1"><a href="https://UUoocl.github.io/set-yed-family-tree-custom-colors.html">Set yEd Family Tree Custom ColorsΒ Β </a></h3></article></div></div></main><footer class="footer"><div class="footer__copyright"><p>Powered by Publii</p></div><button onclick="backToTopFunction()" id="backToTop" class="footer__bttop" aria-label="Back to top" title="Back to top"><svg><use xlink:href="https://UUoocl.github.io/assets/svg/svg-map.svg#toparrow"/></svg></button></footer></div><script defer="defer" src="https://UUoocl.github.io/assets/js/scripts.min.js?v=f47c11534595205f20935f0db2a62a85"></script><script>window.publiiThemeMenuConfig={mobileMenuMode:'sidebar',animationSpeed:300,submenuWidth: 'auto',doubleClickTime:500,mobileMenuExpandableSubmenus:true,relatedContainerForOverlayMenuSelector:'.top'};</script><script>var images = document.querySelectorAll('img[loading]');
for (var i = 0; i < images.length; i++) {
if (images[i].complete) {
images[i].classList.add('is-loaded');
} else {
images[i].addEventListener('load', function () {
this.classList.add('is-loaded');
}, false);
}
}</script><div class="pcb" data-behaviour="link" data-behaviour-link="#cookie-settings" data-revision="1" data-config-ttl="90" data-debug-mode="false"><div role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="pcb-title" aria-describedby="pcb-txt" class="pcb__banner"><div class="pcb__inner"><div id="pcb-title" role="heading" class="pcb__title">This website uses cookies</div><div id="pcb-txt" class="pcb__txt">Select which cookies to opt-in to via the checkboxes below; our website uses cookies to examine site traffic and user activity while on our site, for marketing, and to provide social media functionality.</div><div class="pcb__buttons"><button type="button" class="pcb__btn pcb__btn--link pcb__btn--configure" aria-haspopup="dialog">Manage preferences</button> <button type="button" class="pcb__btn pcb__btn--solid pcb__btn--accept">Accept all</button></div></div></div><div class="pcb__popup" role="dialog" aria-modal="true" aria-hidden="true" aria-labelledby="pcb-popup-title"><div class="pcb__popup__wrapper"><div class="pcb__inner pcb__popup__inner"><div class="pcb__popup__heading"><div id="pcb-popup-title" role="heading" class="pcb__title">Cookie settings</div><button class="pcb__popup__close" aria-label="Close"></button></div><div class="pcb__popup__content"><div class="pcb__txt pcb__popup__txt">We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.</div><ul class="pcb__groups"><li class="pcb__group"><details><summary class="pcb__group__title no-desc">Required</summary></details><div class="pcb__popup__switch"><input type="checkbox" data-group-name="-1" id="-1-cookies"> <label for="-1-cookies">Required</label></div></li></ul></div><div class="pcb__buttons pcb__popup__buttons"><button type="button" class="pcb__btn pcb__btn--solid pcb__btn--accept">Accept all</button> <button type="button" class="pcb__btn pcb__btn--reject">Reject all</button> <button type="button" class="pcb__btn pcb__btn--save">Save settings</button></div></div></div></div><div class="pcb__overlay" aria-hidden="true"></div></div><script>(function(win) {
if (!document.querySelector('.pcb')) {
return;
}
var cbConfig = {
behaviour: document.querySelector('.pcb').getAttribute('data-behaviour'),
behaviourLink: document.querySelector('.pcb').getAttribute('data-behaviour-link'),
revision: document.querySelector('.pcb').getAttribute('data-revision'),
configTTL: parseInt(document.querySelector('.pcb').getAttribute('data-config-ttl'), 10),
debugMode: document.querySelector('.pcb').getAttribute('data-debug-mode') === 'true',
initialState: null,
previouslyAccepted: []
};
var cbUI = {
wrapper: document.querySelector('.pcb'),
banner: {
element: null,
btnAccept: null,
btnReject: null,
btnConfigure: null
},
popup: {
element: null,
btnClose: null,
btnSave: null,
btnAccept: null,
btnReject: null,
checkboxes: null,
},
overlay: null,
badge: null,
blockedScripts: document.querySelectorAll('script[type^="gdpr-blocker/"]'),
triggerLinks: cbConfig.behaviourLink ? document.querySelectorAll('a[href*="' + cbConfig.behaviourLink + '"]') : null
};
function initUI () {
// setup banner elements
cbUI.banner.element = cbUI.wrapper.querySelector('.pcb__banner');
cbUI.banner.btnAccept = cbUI.banner.element.querySelector('.pcb__btn--accept');
cbUI.banner.btnReject = cbUI.banner.element.querySelector('.pcb__btn--reject');
cbUI.banner.btnConfigure = cbUI.banner.element.querySelector('.pcb__btn--configure');
// setup popup elements
if (cbUI.wrapper.querySelector('.pcb__popup')) {
cbUI.popup.element = cbUI.wrapper.querySelector('.pcb__popup');
cbUI.popup.btnClose = cbUI.wrapper.querySelector('.pcb__popup__close');
cbUI.popup.btnSave = cbUI.popup.element.querySelector('.pcb__btn--save');
cbUI.popup.btnAccept = cbUI.popup.element.querySelector('.pcb__btn--accept');
cbUI.popup.btnReject = cbUI.popup.element.querySelector('.pcb__btn--reject');
cbUI.popup.checkboxes = cbUI.popup.element.querySelector('input[type="checkbox"]');
// setup overlay
cbUI.overlay = cbUI.wrapper.querySelector('.pcb__overlay');
}
cbUI.badge = cbUI.wrapper.querySelector('.pcb__badge');
if (cbConfig.behaviour.indexOf('link') > -1) {
for (var i = 0; i < cbUI.triggerLinks.length; i++) {
cbUI.triggerLinks[i].addEventListener('click', function(e) {
e.preventDefault();
showBannerOrPopup();
});
}
}
}
function initState () {
var lsKeyName = getConfigName();
var currentConfig = localStorage.getItem(lsKeyName);
var configIsFresh = checkIfConfigIsFresh();
if (!configIsFresh || currentConfig === null) {
if (cbConfig.debugMode) {
console.log('πͺ Config not found, or configuration expired');
}
showBanner();
} else if (typeof currentConfig === 'string') {
if (cbConfig.debugMode) {
console.log('πͺ Config founded');
}
showBadge();
if (cbUI.popup.element) {
var allowedGroups = currentConfig.split(',');
var checkedCheckboxes = cbUI.popup.element.querySelectorAll('input[type="checkbox"]:checked');
for (var j = 0; j < checkedCheckboxes.length; j++) {
var name = checkedCheckboxes[j].getAttribute('data-group-name');
if (name && name !== '-' && allowedGroups.indexOf(name) === -1) {
checkedCheckboxes[j].checked = false;
}
}
for (var i = 0; i < allowedGroups.length; i++) {
var checkbox = cbUI.popup.element.querySelector('input[type="checkbox"][data-group-name="' + allowedGroups[i] + '"]');
if (checkbox) {
checkbox.checked = true;
}
allowCookieGroup(allowedGroups[i]);
}
}
}
setTimeout(function () {
cbConfig.initialState = getInitialStateOfConsents();
}, 0);
}
function checkIfConfigIsFresh () {
var lastConfigSave = localStorage.getItem('publii-gdpr-cookies-config-save-date');
if (lastConfigSave === null) {
return false;
}
lastConfigSave = parseInt(lastConfigSave, 10);
if (lastConfigSave === 0) {
return true;
}
if (+new Date() - lastConfigSave < cbConfig.configTTL * 24 * 60 * 60 * 1000) {
return true;
}
return false;
}
function initBannerEvents () {
cbUI.banner.btnAccept.addEventListener('click', function (e) {
e.preventDefault();
acceptAllCookies('banner');
showBadge();
}, false);
if (cbUI.banner.btnReject) {
cbUI.banner.btnReject.addEventListener('click', function (e) {
e.preventDefault();
rejectAllCookies();
showBadge();
}, false);
}
if (cbUI.banner.btnConfigure) {
cbUI.banner.btnConfigure.addEventListener('click', function (e) {
e.preventDefault();
hideBanner();
showAdvancedPopup();
showBadge();
}, false);
}
}
function initPopupEvents () {
if (!cbUI.popup.element) {
return;
}
cbUI.overlay.addEventListener('click', function (e) {
hideAdvancedPopup();
}, false);
cbUI.popup.element.addEventListener('click', function (e) {
e.stopPropagation();
}, false);
cbUI.popup.btnAccept.addEventListener('click', function (e) {
e.preventDefault();
acceptAllCookies('popup');
}, false);
cbUI.popup.btnReject.addEventListener('click', function (e) {
e.preventDefault();
rejectAllCookies();
}, false);
cbUI.popup.btnSave.addEventListener('click', function (e) {
e.preventDefault();
saveConfiguration();
}, false);
cbUI.popup.btnClose.addEventListener('click', function (e) {
e.preventDefault();
hideAdvancedPopup();
}, false);
}
function initBadgeEvents () {
if (!cbUI.badge) {
return;
}
cbUI.badge.addEventListener('click', function (e) {
showBannerOrPopup();
}, false);
}
initUI();
initState();
initBannerEvents();
initPopupEvents();
initBadgeEvents();
/**
* API
*/
function addScript (src, inline) {
var newScript = document.createElement('script');
if (src) {
newScript.setAttribute('src', src);
}
if (inline) {
newScript.text = inline;
}
document.body.appendChild(newScript);
}
function allowCookieGroup (allowedGroup) {
var scripts = document.querySelectorAll('script[type="gdpr-blocker/' + allowedGroup + '"]');
cbConfig.previouslyAccepted.push(allowedGroup);
for (var j = 0; j < scripts.length; j++) {
addScript(scripts[j].src, scripts[j].text);
}
var groupEvent = new Event('publii-cookie-banner-unblock-' + allowedGroup);
document.body.dispatchEvent(groupEvent);
unlockEmbeds(allowedGroup);
if (cbConfig.debugMode) {
console.log('πͺ Allowed group: ' + allowedGroup);
}
}
function showBannerOrPopup () {
if (cbUI.popup.element) {
showAdvancedPopup();
} else {
showBanner();
}
}
function showAdvancedPopup () {
cbUI.popup.element.classList.add('is-visible');
cbUI.overlay.classList.add('is-visible');
cbUI.popup.element.setAttribute('aria-hidden', 'false');
cbUI.overlay.setAttribute('aria-hidden', 'false');
}
function hideAdvancedPopup () {
cbUI.popup.element.classList.remove('is-visible');
cbUI.overlay.classList.remove('is-visible');
cbUI.popup.element.setAttribute('aria-hidden', 'true');
cbUI.overlay.setAttribute('aria-hidden', 'true');
}
function showBanner () {
cbUI.banner.element.classList.add('is-visible');
cbUI.banner.element.setAttribute('aria-hidden', 'false');
}
function hideBanner () {
cbUI.banner.element.classList.remove('is-visible');
cbUI.banner.element.setAttribute('aria-hidden', 'true');
}
function showBadge () {
if (!cbUI.badge) {
return;
}
cbUI.badge.classList.add('is-visible');
cbUI.badge.setAttribute('aria-hidden', 'false');
}
function getConfigName () {
var lsKeyName = 'publii-gdpr-allowed-cookies';
if (cbConfig.revision) {
lsKeyName = lsKeyName + '-v' + parseInt(cbConfig.revision, 10);
}
return lsKeyName;
}
function storeConfiguration (allowedGroups) {
var lsKeyName = getConfigName();
var dataToStore = allowedGroups.join(',');
localStorage.setItem(lsKeyName, dataToStore);
if (cbConfig.configTTL === 0) {
localStorage.setItem('publii-gdpr-cookies-config-save-date', 0);
if (cbConfig.debugMode) {
console.log('πͺ Store never expiring configuration');
}
} else {
localStorage.setItem('publii-gdpr-cookies-config-save-date', +new Date());
}
}
function getInitialStateOfConsents () {
if (!cbUI.popup.element) {
return [];
}
var checkedGroups = cbUI.popup.element.querySelectorAll('input[type="checkbox"]:checked');
var groups = [];
for (var i = 0; i < checkedGroups.length; i++) {
var allowedGroup = checkedGroups[i].getAttribute('data-group-name');
if (allowedGroup !== '') {
groups.push(allowedGroup);
}
}
if (cbConfig.debugMode) {
console.log('πͺ Initial state: ' + groups.join(', '));
}
return groups;
}
function getCurrentStateOfConsents () {
if (!cbUI.popup.element) {
return [];
}
var checkedGroups = cbUI.popup.element.querySelectorAll('input[type="checkbox"]:checked');
var groups = [];
for (var i = 0; i < checkedGroups.length; i++) {
var allowedGroup = checkedGroups[i].getAttribute('data-group-name');
if (allowedGroup !== '') {
groups.push(allowedGroup);
}
}
if (cbConfig.debugMode) {
console.log('πͺ State to save: ' + groups.join(', '));
}
return groups;
}
function getAllGroups () {
if (!cbUI.popup.element) {
return [];
}
var checkedGroups = cbUI.popup.element.querySelectorAll('input[type="checkbox"]');
var groups = [];
for (var i = 0; i < checkedGroups.length; i++) {
var allowedGroup = checkedGroups[i].getAttribute('data-group-name');
if (allowedGroup !== '') {
groups.push(allowedGroup);
}
}
return groups;
}
function acceptAllCookies (source) {
var groupsToAccept = getAllGroups();
storeConfiguration(groupsToAccept);
for (var i = 0; i < groupsToAccept.length; i++) {
var group = groupsToAccept[i];
if (cbConfig.initialState.indexOf(group) > -1 || cbConfig.previouslyAccepted.indexOf(group) > -1) {
if (cbConfig.debugMode) {
console.log('πͺ Skip previously activated group: ' + group);
}
continue;
}
allowCookieGroup(group);
}
if (cbUI.popup.element) {
var checkboxesToCheck = cbUI.popup.element.querySelectorAll('input[type="checkbox"]');
for (var j = 0; j < checkboxesToCheck.length; j++) {
checkboxesToCheck[j].checked = true;
}
}
if (cbConfig.debugMode) {
console.log('πͺ Accept all cookies: ', groupsToAccept.join(', '));
}
if (source === 'popup') {
hideAdvancedPopup();
} else if (source === 'banner') {
hideBanner();
}
}
function rejectAllCookies () {
if (cbConfig.debugMode) {
console.log('πͺ Reject all cookies');
}
storeConfiguration([]);
setTimeout(function () {
window.location.reload();
}, 100);
}
function saveConfiguration () {
var groupsToAccept = getCurrentStateOfConsents();
storeConfiguration(groupsToAccept);
if (cbConfig.debugMode) {
console.log('πͺ Save new config: ', groupsToAccept.join(', '));
}
if (reloadIsNeeded(groupsToAccept)) {
setTimeout(function () {
window.location.reload();
}, 100);
return;
}
for (var i = 0; i < groupsToAccept.length; i++) {
var group = groupsToAccept[i];
if (cbConfig.initialState.indexOf(group) > -1 || cbConfig.previouslyAccepted.indexOf(group) > -1) {
if (cbConfig.debugMode) {
console.log('πͺ Skip previously activated group: ' + group);
}
continue;
}
allowCookieGroup(group);
}
hideAdvancedPopup();
}
function reloadIsNeeded (groupsToAccept) {
// check if user rejected consent for initial groups
var initialGroups = cbConfig.initialState;
var previouslyAcceptedGroups = cbConfig.previouslyAccepted;
var groupsToCheck = initialGroups.concat(previouslyAcceptedGroups);
for (var i = 0; i < groupsToCheck.length; i++) {
var groupToCheck = groupsToCheck[i];
if (groupsToAccept.indexOf(groupToCheck) === -1) {
if (cbConfig.debugMode) {
console.log('πͺ Reload is needed due lack of: ', groupToCheck);
}
return true;
}
}
return false;
}
function unlockEmbeds (cookieGroup) {
var iframesToUnlock = document.querySelectorAll('.pec-wrapper[data-consent-group-id="' + cookieGroup + '"]');
for (var i = 0; i < iframesToUnlock.length; i++) {
var iframeWrapper = iframesToUnlock[i];
iframeWrapper.querySelector('.pec-overlay').classList.remove('is-active');
iframeWrapper.querySelector('.pec-overlay').setAttribute('aria-hidden', 'true');
var iframe = iframeWrapper.querySelector('iframe');
iframe.setAttribute('src', iframe.getAttribute('data-consent-src'));
}
}
win.publiiEmbedConsentGiven = function (cookieGroup) {
// it will unlock embeds
allowCookieGroup(cookieGroup);
var checkbox = cbUI.popup.element.querySelector('input[type="checkbox"][data-group-name="' + cookieGroup + '"]');
if (checkbox) {
checkbox.checked = true;
}
var groupsToAccept = getCurrentStateOfConsents();
storeConfiguration(groupsToAccept);
if (cbConfig.debugMode) {
console.log('πͺ Save new config: ', groupsToAccept.join(', '));
}
}
})(window);</script></body></html>