PageSourceSearch

https://mahlerfoundation.net/wp-content/plugins/genealogical-tree-…/genealogical-tree-public.min.js?ver=2.2.8

js mahlerfoundation.net collected 2026-09-26 08:21:31 UTC 63,428 bytes, 1,233 lines download raw bytes

1Object.size = function(obj) {
2    var size = 0,
3        key;
4    for (key in obj) {
5        if (obj.hasOwnProperty(key)) size++;
6    }
7    return size;
8};
9
10
11document.getElementById('printTreeButton').addEventListener('click', function () {
12
13    const treeElement = document.getElementById('famTree');
14    setTimeout(() => {
15        html2canvas(treeElement).then(canvas => {
16            const imageData = canvas.toDataURL('image/png');
17            const link = document.createElement('a');
18            link.href = imageData;
19            link.download = 'genealogical-tree.png';
20            link.click();
21        });
22    }, 1500); 
23});
24
25
26(function($) {
27    'use strict';
28    jQuery(window).on('load', function() {
29        $(document).ready(function() {
30            $('.gt-expand-compress').click(function() {
31                $(this).parents('.gt-content').toggleClass('gt-expand-compress-toggle');
32            });
33            $('.gt-tree ul').not(':has(li)').remove();
34            $('.gt-style-2 .parents > li > div > .info:not(".unknown")').each(function() {
35                var thisW = $(this).width();
36                $(this).width(thisW.toFixed(0))
37            });
38            $('.gt-style-2-alt .parents > li > div > .info:not(".unknown")').each(function() {
39                var thisW = $(this).width();
40                $(this).width(thisW.toFixed(0))
41            });
42            $('.gt-content > .gt-tree').each(function() {
43                var scene = this;
44                if (scene) {
45                    var sceneParentWidth = scene.parentNode.getBoundingClientRect().width;
46                    var sceneWidth = scene.getBoundingClientRect().width;
47                    var ratio = 1 / (sceneWidth / sceneParentWidth);
48                    inseatePanzoom(scene, ratio, 'initial')
49                }
50            });
51            /* <fs_premium_only> */
52            $(document).on('click', '.gt-tree-popup .name > a[data-popid]', function(event) {
53                var base = $(this);
54                var popid = $(this).attr('data-popid');
55                $.ajax({
56                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/popover/" + popid,
57                    cache: true,
58                    dataType: "json"
59                }).done(function(ancestor) {
60                    base.parents('.gt-content').find('.gt-popover-container').remove();
61                    base.parents('.gt-content').prepend(ancestor);
62                })
63                return false;
64            });
65            $(document).on('click', '.gt-style-1 .gt-collapse-family', function(event) {
66                if ($(this).hasClass('gt-collapsed')) {
67                    $(this).text('-');
68                } else {
69                    $(this).text('+');
70                }
71                $(this).toggleClass('gt-collapsed');
72                $(this).parents('li').first().find('ul').first().toggle();
73            })
74            $(document).on('click', '.gt-style-2 .gt-collapse-family, .gt-style-2-alt .gt-collapse-family, .gt-style-3 .gt-collapse-family, .gt-style-3-alt .gt-collapse-family', function(event) {
75                if ($(this).hasClass('gt-collapsed')) {
76                    $(this).text('-');
77                } else {
78                    $(this).text('+');
79                }
80                $(this).toggleClass('gt-collapsed');
81                $(this).parents('li.child').first().find('ul.childs').first().toggle();
82            })
83            $(document).on('click', '.gt-style-4 .gt-collapse-family', function(event) {
84                if ($(this).hasClass('gt-collapsed')) {
85                    $(this).text('-');
86                } else {
87                    $(this).text('+');
88                }
89                $(this).toggleClass('gt-collapsed');
90                if ($(this).parents('li').first().hasClass('spouse')) {
91                    $(this).parents('li').first().find('ul.childs').first().toggle();
92                }
93                if ($(this).parents('li').first().hasClass('root')) {
94                    $(this).parents('li').first().toggleClass('li-collapsed')
95                    $(this).parents('ul').first().children('li.spouse').toggle();
96                }
97            })
98            $(document).on('click', '.gt-style-5 .gt-collapse-family', function(event) {
99                if ($(this).hasClass('gt-collapsed')) {
100                    $(this).text('-');
101                } else {
102                    $(this).text('+');
103                }
104                $(this).toggleClass('gt-collapsed');
105                if ($(this).parents('li').first().hasClass('spouse')) {
106                    $(this).parents('li').first().find('ul').first().toggle();
107                }
108                if ($(this).parents('li').first().hasClass('root')) {
109                    $(this).parents('li').first().toggleClass('li-collapsed')
110                    $(this).parents('ul').first().find('li.spouses').first().toggle();
111                }
112            })
113            $(document).on('click', '.gt-popover-container .close', function(event) {
114                $(this).parent().remove();
115            })
116            $('.gt-content > .gt-tree').each(function() {
117                var base = $(this);
118                var setting = base.data('setting');
119                var id = base.data('id');
120                var main_id = id;
121                /*
122                 *
123                 */
124
125                if(setting){
126                    var gena = ((setting.generation_start_from ? setting.generation_start_from : 1) - 1);
127                }
128
129                if (setting && setting.style == 1) {
130
131                    if (setting.ancestor && setting.ancestor == 'on') {
132                        $.ajax({
133                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
134                            cache: true,
135                            dataType: "json"
136                        }).done(function(ancestor) {
137                            
138                            var mother = '';
139                            var father = '';
140
141                            var template = '\
142                            <div class="gt-style-1">\
143                                <ul class="has-ancestor">\
144                                    <li class="parent alter-tree">\
145                                        <ul class="parents">\
146                                        </ul>\
147                                    </li>\
148                                    <li class="child root">\
149                                        <ul class="childs">\
150                                            <li class="child root" data-id=' + id + '></li>\
151                                        </ul>\
152                                    </li>\
153                                    </li>\
154                            </div>';
155
156                            base.append(template)
157
158                            var newBase = base.find('ul.childs')
159
160                            tree1(newBase, id, setting, gena, null, null, main_id);
161
162                            var alterBase = base.find('ul.parents')
163
164                            if (ancestor.father && ancestor.father.root.indi) {
165                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
166                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
167                            }
168
169                            if (ancestor.mother && ancestor.mother.root.indi) {
170                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
171                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
172                            }
173
174                        });
175                    } else {
176                        var template = '\
177                        <div class="gt-style-1">\
178                            <ul class="childs">\
179                                <li class="child root" data-id=' + id + '></li>\
180                            </ul>\
181                        </div>';
182                        base.append(template)
183                        tree1(base, id, setting);
184                    }
185                }
186                /*
187                 *
188                 */
189                if (setting && setting.style == 2) {
190                    if (setting.ancestor && setting.ancestor == 'on') {
191                        $.ajax({
192                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
193                            cache: true,
194                            dataType: "json"
195                        }).done(function(ancestor) {
196                            
197                            var mother = '';
198                            var father = '';
199
200                            var template = '\
201                            <div class="gt-style-2">\
202                                <ul class="has-ancestor">\
203                                    <li class="parent alter-tree">\
204                                        <ul class="parents">\
205                                        </ul>\
206                                    </li>\
207                                    <li class="child root">\
208                                        <ul class="childs">\
209                                            <li class="child root" data-id=' + id + '></li>\
210                                        </ul>\
211                                    </li>\
212                                    </li>\
213                            </div>';
214
215                            base.append(template)
216
217                            var newBase = base.find('ul.childs')
218
219                            tree2(newBase, id, setting, gena, null, null, main_id);
220
221                            var alterBase = base.find('ul.parents')
222
223                            if (ancestor.father && ancestor.father.root.indi) {
224                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
225                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
226                            }
227
228                            if (ancestor.mother && ancestor.mother.root.indi) {
229                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
230                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
231                            }
232
233                        });
234                    } else {
235                        var template = '\
236                        <div class="gt-style-2">\
237                            <ul class="childs">\
238                                <li class="child root" data-id=' + id + '></li>\
239                            </ul>\
240                        </div>';
241                        base.append(template)
242                        tree2(base, id, setting);
243                    }
244                }
245                /*
246                 *
247                 */
248                if (setting && setting.style == '2-alt') {
249                    if (setting.ancestor && setting.ancestor == 'on') {
250                        $.ajax({
251                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
252                            cache: true,
253                            dataType: "json"
254                        }).done(function(ancestor) {
255                            
256                            var mother = '';
257                            var father = '';
258
259                            var template = '\
260                            <div class="gt-style-2-alt">\
261                                <ul class="has-ancestor">\
262                                    <li class="parent alter-tree">\
263                                        <ul class="parents">\
264                                        </ul>\
265                                    </li>\
266                                    <li class="child root">\
267                                        <ul class="childs">\
268                                            <li class="child root" data-id=' + id + '></li>\
269                                        </ul>\
270                                    </li>\
271                                    </li>\
272                            </div>';
273
274                            base.append(template)
275
276                            var newBase = base.find('ul.childs')
277
278                            tree2(newBase, id, setting, gena, null, null, main_id);
279
280                            var alterBase = base.find('ul.parents')
281
282                            if (ancestor.father && ancestor.father.root.indi) {
283                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
284                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
285                            }
286
287                            if (ancestor.mother && ancestor.mother.root.indi) {
288                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
289                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
290                            }
291
292                        });
293                    } else {
294                        var template = '\
295                        <div class="gt-style-2-alt">\
296                            <ul class="childs">\
297                                <li class="child root" data-id=' + id + '></li>\
298                            </ul>\
299                        </div>';
300                        base.append(template)
301                        tree2(base, id, setting);
302                    }
303                }
304                /*
305                 *
306                 */
307                if (setting && setting.style == 3) {
308                    if (setting.ancestor && setting.ancestor == 'on') {
309                        $.ajax({
310                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
311                            cache: true,
312                            dataType: "json"
313                        }).done(function(ancestor) {
314                            
315                            var mother = '';
316                            var father = '';
317
318                            var template = '\
319                            <div class="gt-style-3">\
320                                <ul class="has-ancestor">\
321                                    <li class="parent alter-tree">\
322                                        <ul class="parents">\
323                                        </ul>\
324                                    </li>\
325                                    <li class="child root">\
326                                        <ul class="childs">\
327                                            <li class="child root" data-id=' + id + '></li>\
328                                        </ul>\
329                                    </li>\
330                                    </li>\
331                            </div>';
332
333                            base.append(template)
334
335                            var newBase = base.find('ul.childs')
336
337                            tree3(newBase, id, setting, gena, null, null, main_id);
338
339                            var alterBase = base.find('ul.parents')
340
341                            if (ancestor.father && ancestor.father.root.indi) {
342                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
343                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
344                            }
345
346                            if (ancestor.mother && ancestor.mother.root.indi) {
347                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
348                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
349                            }
350
351                        });
352                    } else {
353                        var template = '\
354                        <div class="gt-style-3">\
355                            <ul class="childs">\
356                                <li class="child root" data-id=' + id + '></li>\
357                            </ul>\
358                        </div>';
359                        base.append(template)
360                        tree3(base, id, setting);
361                    }
362                }
363                /*
364                 *
365                 */
366                if (setting && setting.style == '3-alt') {
367                    if (setting.ancestor && setting.ancestor == 'on') {
368                        $.ajax({
369                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
370                            cache: true,
371                            dataType: "json"
372                        }).done(function(ancestor) {
373                            
374                            var mother = '';
375                            var father = '';
376
377                            var template = '\
378                            <div class="gt-style-3-alt">\
379                                <ul class="has-ancestor">\
380                                    <li class="parent alter-tree">\
381                                        <ul class="parents">\
382                                        </ul>\
383                                    </li>\
384                                    <li class="child root">\
385                                        <ul class="childs">\
386                                            <li class="child root" data-id=' + id + '></li>\
387                                        </ul>\
388                                    </li>\
389                                    </li>\
390                            </div>';
391
392                            base.append(template)
393
394                            var newBase = base.find('ul.childs')
395
396                            tree3(newBase, id, setting, gena, null, null, main_id);
397
398                            var alterBase = base.find('ul.parents')
399
400                            if (ancestor.father && ancestor.father.root.indi) {
401                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
402                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
403                            }
404
405                            if (ancestor.mother && ancestor.mother.root.indi) {
406                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
407                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
408                            }
409
410                        });
411                    } else {
412                        var template = '\
413                        <div class="gt-style-3-alt">\
414                            <ul class="childs">\
415                                <li class="child root" data-id=' + id + '></li>\
416                            </ul>\
417                        </div>';
418                        base.append(template)
419                        tree3(base, id, setting);
420                    }
421                }
422                /*
423                 *
424                 */
425                if (setting && setting.style == '4') {
426                    if (setting.ancestor && setting.ancestor == 'on') {
427                        $.ajax({
428                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
429                            cache: true,
430                            dataType: "json"
431                        }).done(function(ancestor) {
432                            
433                            var mother = '';
434                            var father = '';
435
436                            var template = '\
437                            <div class="gt-style-4">\
438                                <ul class="has-ancestor">\
439                                    <li class="parent alter-tree">\
440                                        <ul class="parents">\
441                                        </ul>\
442                                    </li>\
443                                    <li class="child root">\
444                                        <ul class="childs">\
445                                            <li class="child root" data-id=' + id + '></li>\
446                                        </ul>\
447                                    </li>\
448                                    </li>\
449                            </div>';
450
451                            base.append(template)
452
453                            var newBase = base.find('ul.childs')
454
455                            tree4(newBase, id, setting, gena, null, null, main_id);
456
457                            var alterBase = base.find('ul.parents')
458
459                            if (ancestor.father && ancestor.father.root.indi) {
460                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
461                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
462                            }
463
464                            if (ancestor.mother && ancestor.mother.root.indi) {
465                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
466                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
467                            }
468
469                        });
470                    } else {
471                        var template = '\
472                        <div class="gt-style-4">\
473                            <ul class="childs">\
474                                <li class="child root" data-id=' + id + '></li>\
475                            </ul>\
476                        </div>';
477                        base.append(template)
478                        tree4(base, id, setting);
479                    }
480                }
481                /*
482                 *
483                 */
484                if (setting && setting.style == '5') {
485
486                    if (setting.ancestor && setting.ancestor == 'on') {
487                        $.ajax({
488                            url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
489                            cache: true,
490                            dataType: "json"
491                        }).done(function(ancestor) {
492                            
493                            var mother = '';
494                            var father = '';
495
496                            var template = '\
497                            <div class="gt-style-5">\
498                                <ul class="has-ancestor">\
499                                    <li class="parent alter-tree">\
500                                        <ul class="parents">\
501                                        </ul>\
502                                    </li>\
503                                    <li class="child root">\
504                                        <ul class="childs">\
505                                            <li class="child root" data-id=' + id + '></li>\
506                                        </ul>\
507                                    </li>\
508                                    </li>\
509                            </div>';
510
511                            base.append(template)
512
513                            var newBase = base.find('ul.childs')
514
515                            tree5(newBase, id, setting, gena, null, null, main_id);
516
517                            var alterBase = base.find('ul.parents')
518
519                            if (ancestor.father && ancestor.father.root.indi) {
520                                alterBase.append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
521                                tree1alter(alterBase, ancestor.father.root.indi.id, setting, (gena+1), null, null, main_id)
522                            }
523
524                            if (ancestor.mother && ancestor.mother.root.indi) {
525                                alterBase.append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
526                                tree1alter(alterBase, ancestor.mother.root.indi.id, setting, (gena+1), null, null, main_id)
527                            }
528
529                        });
530                    } else {
531                        var template = '\
532                        <div class="gt-style-5">\
533                            <ul class="childs">\
534                                <li class="child root" data-id=' + id + '></li>\
535                            </ul>\
536                        </div>';
537                        base.append(template)
538                        tree5(base, id, setting);
539                    }
540                }
541            });
542            /* </fs_premium_only> */
543
544            /* <fs_premium_only> */
545            function tree1alter(base, id, setting, gen = 0, root = null, uniqid = null, main_root = null) {
546                
547                gen--;
548                if(gen==0){
549                    gen--;
550                }
551
552                if(setting.generation_number_ancestor != -1) {
553                    if(gen > setting.generation_number_ancestor){
554                        return;
555                    }
556                }
557
558                var cont = base.find('li[data-id="' + id + '"]');
559
560
561                var collapsible_family_onload;
562                var sign;
563
564                if (setting.collapsible_family_root && setting.collapsible_family_onload) {
565                    collapsible_family_onload = 'display:none;';
566                    sign = '+';
567                } else {
568                    collapsible_family_onload = '';
569                    sign = '-';
570                }
571
572
573                $.ajax({
574                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/" + id,
575                    cache: true,
576                    dataType: "json"
577                }).done(function(ind) {
578
579                    var temp = ind_template(ind.root.indi, setting, gen, [], 'root', sign)
580                    var temp_cont = cont;
581                    templateAppend(temp_cont, temp);
582                })
583
584                $.ajax({
585                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/ancestor/" + id,
586                    cache: true,
587                    dataType: "json"
588                }).done(function(ancestor) {
589                    if(ancestor.father || ancestor.mother) {
590                        cont.prepend('<ul class="parents" style="' + collapsible_family_onload + '"></ul>');
591                        if (ancestor.father && ancestor.father.root.indi) {
592                            cont.find('.parents').append('<li class="parent father" data-id=' + ancestor.father.root.indi.id + '></li>');
593                            tree1alter(base, ancestor.father.root.indi.id, setting, gen, root, uniqid, main_root)
594                        }
595                        if (ancestor.mother && ancestor.mother.root.indi) {
596                            cont.find('.parents').append('<li class="parent mother" data-id=' + ancestor.mother.root.indi.id + '></li>');
597                            tree1alter(base, ancestor.mother.root.indi.id, setting, gen, root, uniqid, main_root)
598                        }
599                    }
600                });
601            }
602            /* </fs_premium_only> */
603
604            /* <fs_premium_only> */
605            function tree1(base, id, setting, gen = 0, root = null, uniqid = null, main_root = null) {
606                
607                gen++;
608
609                if(setting.generation_number != -1) {
610                    if(gen > setting.generation_number){
611                        return;
612                    }
613                }
614
615                var cont = base.find('li[data-id="' + id + '"]');
616                if (root && !uniqid) {
617                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"]');
618                }
619                if (!root && uniqid) {
620                    var cont = base.find('li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
621                }
622                if (root && uniqid) {
623                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
624                }
625                $.ajax({
626                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/" + id,
627                    cache: true,
628                    dataType: "json"
629                }).done(function(ind) {
630                    var collapsible_family_onload;
631                    var sign;
632                    if (setting.collapsible_family_root && setting.collapsible_family_onload) {
633                        collapsible_family_onload = 'display:none;';
634                        sign = '+';
635                    } else {
636                        collapsible_family_onload = '';
637                        sign = '-';
638                    }
639                    var temp = ind_template(ind.root.indi, setting, gen, ind.root.indi.fam, 'root', sign)
640                    var temp_cont = cont;
641                    templateAppend(temp_cont, temp);
642
643                    if (ind.root.indi.fam) {
644                        console.log(ind.root.indi.fam);
645                        var x = 1;
646                        $.each(ind.root.indi.fam, function(famindex, fam) {
647                            if (x == 1) {
648                                cont.append('<ul class="families" style="' + collapsible_family_onload + '"></ul>');
649                            }
650                            x++;
651                            $.ajax({
652                                url: gt_obj.gt_rest_url + "genealogical-tree/v1/family/fam/" + fam,
653                                cache: true,
654                                dataType: "json"
655                            }).done(function(fam) {
656                                if (ind.root.indi.sex == 'M') {
657                                    var partner = fam.root.fam.wife;
658                                } else {
659                                    var partner = fam.root.fam.husb;
660                                }
661                                var collapsible_family_onload;
662                                var sign;
663                                if (setting.collapsible_family_spouse && setting.collapsible_family_onload) {
664                                    collapsible_family_onload = 'display:none;';
665                                    sign = '+';
666                                } else {
667                                    collapsible_family_onload = '';
668                                    sign = '-';
669                                }
670                                var temp = ind_template(partner, setting, null, fam.root.fam.children, 'spouse', sign)
671                                cont.find('.families').append('<li data-order="' + famindex + '" class="family ' + famindex + '"></li>')
672                                var temp_cont = cont.find('.families > li.family.' + famindex);
673                                templateAppend(temp_cont, temp);
674                                if (fam.root.fam.children) {
675                                    var root = fam.root.fam.root;
676                                    cont.find('.families > li.family.' + famindex).append('<ul class="childs" style="' + collapsible_family_onload + '"></ul>');
677                                    $.each(fam.root.fam.children, function(index, children) {
678                                        var uniqid = js_uniqid(10);
679                                        cont.find('.families > li.family.' + famindex + ' > ul.childs').append('<li class="child root" data-id="' + children.ref + '" data-uniqid="' + uniqid + '"></li>');
680                                        tree1(base, children.ref, setting, gen, root, uniqid);
681                                    })
682                                }
683                            })
684                        });
685                    }
686                })
687            }
688
689            function tree2(base, id, setting, gen = 0, root = null, uniqid = null, ancestor = false, main_root = null) {
690                gen++;
691
692
693                if(setting.generation_number != -1) {
694                    if(gen > setting.generation_number){
695                        return;
696                    }
697                }
698                
699                var cont = base.find('li[data-id="' + id + '"]');
700                if (root && !uniqid) {
701                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"]');
702                }
703                if (!root && uniqid) {
704                    var cont = base.find('li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
705                }
706                if (root && uniqid) {
707                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
708                }
709                $.ajax({
710                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/" + id,
711                    cache: true,
712                    dataType: "json"
713                }).done(function(ind) {
714                    var collapsible_family_onload;
715                    var sign;
716                    if (setting.collapsible_family_root && setting.collapsible_family_onload) {
717                        collapsible_family_onload = 'display:none;';
718                        sign = '+';
719                    } else {
720                        collapsible_family_onload = '';
721                        sign = '-';
722                    }
723                    if (ind.root.indi.fam) {
724                        cont.append('<ul class="parents"></ul>');
725                        var temp = ind_template(ind.root.indi, setting, gen, ind.root.indi.fam, 'root', sign)
726                        cont.find('.parents').append('<li class="root"></li>');
727                        var temp_cont = cont.find('.parents > .root');
728                        templateAppend(temp_cont, temp);
729                        var x = 1;
730                        if (ind.root.indi.sex == 'M' || (ind.root.indi.sex == 'F' && setting.female_tree != 'on')) {
731                            $.each(ind.root.indi.fam, function(famindex, fam) {
732                                $.ajax({
733                                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/family/fam/" + fam,
734                                    cache: true,
735                                    dataType: "json"
736                                }).done(function(fam) {
737                                    if (ind.root.indi.sex == 'M') {
738                                        var partner = fam.root.fam.wife;
739                                    } else {
740                                        var partner = fam.root.fam.husb;
741                                    }
742                                    if (setting.hide_spouse != 'on') {
743                                        if ((setting.hide_un_spouse != 'on' && !partner.ref) || partner.ref) {
744                                            var temp = ind_template(partner, setting)
745                                            cont.find('.parents').append('<li data-order="' + famindex + '" class="spouse ' + famindex + '"></li>')
746                                            var temp_cont = cont.find('.parents > li.spouse.' + famindex);
747                                            templateAppend(temp_cont, temp);
748                                        }
749                                    }
750
751                                    if (fam.root.fam.children) {
752                                        if (x == 1) {
753                                            cont.append('<ul class="childs" style="' + collapsible_family_onload + '"></ul>');
754                                            x++;
755                                        }
756                                        $.each(fam.root.fam.children, function(index, children) {
757                                            if (ancestor && Object.keys(ancestor).length && main_root) {
758                                                if (children.ref != main_root) {
759                                                    return;
760                                                }
761                                            }
762                                            var uniqid = js_uniqid(10);
763                                            var root = fam.root.fam.root;
764                                            cont.find('.childs').append('<li class="child root" data-id="' + children.ref + '" data-uniqid="' + uniqid + '"></li>');
765                                            tree2(base, children.ref, setting, gen, root, uniqid);
766                                        })
767                                    }
768                                })
769                            });
770                        }
771                    }
772                })
773            }
774
775            function tree3(base, id, setting, gen = 0, root = null, uniqid = null, ancestor = false, main_root = null) {
776                gen++;
777
778
779                if(setting.generation_number != -1) {
780                    if(gen > setting.generation_number){
781                        return;
782                    }
783                }
784                var cont = base.find('li[data-id="' + id + '"]');
785                if (root && !uniqid) {
786                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"]');
787                }
788                if (!root && uniqid) {
789                    var cont = base.find('li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
790                }
791                if (root && uniqid) {
792                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
793                }
794                $.ajax({
795                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/" + id,
796                    cache: true,
797                    dataType: "json"
798                }).done(function(ind) {
799                    var collapsible_family_onload;
800                    var sign;
801                    if (setting.collapsible_family_root && setting.collapsible_family_onload) {
802                        collapsible_family_onload = 'display:none;';
803                        sign = '+';
804                    } else {
805                        collapsible_family_onload = '';
806                        sign = '-';
807                    }
808                    if (ind.root.indi.fam) {
809                        cont.append('<ul class="parents"></ul>');
810                        var temp = ind_template(ind.root.indi, setting, gen, ind.root.indi.fam, 'root', sign)
811                        cont.find('.parents').append('<li class="root"></li>');
812                        cont.find('.parents > .root').append(temp);
813                        cont.find('.parents > .root > .ind').append('<div class="partners"></div>')
814                        var x = 1;
815                        $.each(ind.root.indi.fam, function(famindex, fam) {
816                            if (ind.root.indi.sex == 'M' || (ind.root.indi.sex == 'F' && setting.female_tree != 'on')) {
817                                $.ajax({
818                                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/family/fam/" + fam,
819                                    cache: true,
820                                    dataType: "json"
821                                }).done(function(fam) {
822                                    if (ind.root.indi.sex == 'M') {
823                                        var partner = fam.root.fam.wife;
824                                    } else {
825                                        var partner = fam.root.fam.husb;
826                                    }
827                                    if (setting.hide_spouse != 'on') {
828                                        if ((setting.hide_un_spouse != 'on' && !partner.ref) || partner.ref) {
829                                            var temp = ind_template(partner, setting)
830                                            cont.find('.parents > .root > .ind > .partners').append('<div data-order="' + famindex + '" class="partner ' + famindex + '"></div>')
831                                            cont.find('.parents > .root > .ind > .partners > .partner.' + famindex).append(temp);
832                                        }
833                                    }
834                                    if (fam.root.fam.children) {
835                                        var root = fam.root.fam.root;
836                                        if (x == 1) {
837                                            cont.append('<ul class="childs" style="' + collapsible_family_onload + '"></ul>');
838                                            x++;
839                                        }
840                                        $.each(fam.root.fam.children, function(index, children) {
841                                            if (ancestor && Object.keys(ancestor).length && main_root) {
842                                                if (children.ref != main_root) {
843                                                    return;
844                                                }
845                                            }
846                                            var uniqid = js_uniqid(10);
847                                            cont.find('.childs').append('<li class="child" data-id="' + children.ref + '" data-uniqid="' + uniqid + '"></li>');
848                                            tree3(base, children.ref, setting, gen, root, uniqid);
849                                        })
850                                    }
851                                })
852                            }
853                        });
854                    }
855                })
856            }
857
858            function tree4(base, id, setting, gen = 0, root = null, uniqid = null, ancestor = false, main_root = null) {
859                gen++;
860
861
862                if(setting.generation_number != -1) {
863                    if(gen > setting.generation_number){
864                        return;
865                    }
866                }
867                var cont = base.find('li[data-id="' + id + '"]');
868                if (root && !uniqid) {
869                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"]');
870                }
871                if (!root && uniqid) {
872                    var cont = base.find('li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
873                }
874                if (root && uniqid) {
875                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
876                }
877                $.ajax({
878                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/" + id,
879                    cache: true,
880                    dataType: "json"
881                }).done(function(ind) {
882                    var collapsible_family_onload;
883                    var sign;
884                    if (setting.collapsible_family_root && setting.collapsible_family_onload) {
885                        collapsible_family_onload = 'display:none;';
886                        sign = '+';
887                    } else {
888                        collapsible_family_onload = '';
889                        sign = '-';
890                    }
891                    if (ind.root.indi.fam) {
892                        cont.append('<ul class="family"></ul>');
893                        var temp = ind_template(ind.root.indi, setting, gen, ind.root.indi.fam, 'root', sign)
894                        cont.find('.family').append('<li class="root"></li>');
895                        cont.find('.family > .root').append(temp);
896                        //cont.find('.family > .root > .ind').append('<div class="partners"></div>')
897                        var x = 1;
898                        $.each(ind.root.indi.fam, function(famindex, fam) {
899                            var collapsible_family_onload;
900                            var sign;
901                            if (setting.collapsible_family_spouse && setting.collapsible_family_onload) {
902                                collapsible_family_onload = 'display:none;';
903                                sign = '+';
904                            } else {
905                                collapsible_family_onload = '';
906                                sign = '-';
907                            }
908                            if (ind.root.indi.sex == 'M' || (ind.root.indi.sex == 'F' && setting.female_tree != 'on')) {
909                                $.ajax({
910                                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/family/fam/" + fam,
911                                    cache: true,
912                                    dataType: "json"
913                                }).done(function(fam) {
914                                    if (ind.root.indi.sex == 'M') {
915                                        var partner = fam.root.fam.wife;
916                                    } else {
917                                        var partner = fam.root.fam.husb;
918                                    }
919                                    if (setting.hide_spouse != 'on') {
920                                        if ((setting.hide_un_spouse != 'on' && !partner.ref) || partner.ref) {
921                                            var temp = ind_template(partner, setting, null, fam.root.fam.children, 'spouse', sign)
922                                            cont.find('.family').append('<li data-order="' + famindex + '" class="spouse ' + famindex + '"></li>')
923                                            cont.find('.family > .spouse.' + famindex).append(temp);
924                                        }
925                                    }
926                                    if (fam.root.fam.children) {
927                                        var root = fam.root.fam.root;
928                                        cont.find('.family > .spouse.' + famindex).append('<ul class="childs" style="' + collapsible_family_onload + '"></ul>');
929                                        $.each(fam.root.fam.children, function(index, children) {
930                                            if (ancestor && Object.keys(ancestor).length && main_root) {
931                                                if (children.ref != main_root) {
932                                                    return;
933                                                }
934                                            }
935                                            var uniqid = js_uniqid(10);
936                                            cont.find('.family > .spouse.' + famindex).find('.childs').append('<li class="child" data-id="' + children.ref + '" data-uniqid="' + uniqid + '"></li>');
937                                            tree4(base, children.ref, setting, gen, root, uniqid);
938                                        })
939                                    }
940                                })
941                            }
942                        });
943                    }
944                })
945            }
946
947            function tree5(base, id, setting, gen = 0, root = null, uniqid = null, ancestor = false, main_root = null) {
948                gen++;
949
950
951                if(setting.generation_number != -1) {
952                    if(gen > setting.generation_number){
953                        return;
954                    }
955                }
956
957                var cont = base.find('li[data-id="' + id + '"]');
958                if (root && !uniqid) {
959                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"]');
960                }
961                if (!root && uniqid) {
962                    var cont = base.find('li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
963                }
964                if (root && uniqid) {
965                    var cont = base.find('li[data-id="' + root + '"] li[data-id="' + id + '"][data-uniqid="' + uniqid + '"]');
966                }
967                $.ajax({
968                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/member/indi/" + id,
969                    cache: true,
970                    dataType: "json"
971                }).done(function(ind) {
972                    var collapsible_family_onload;
973                    var sign;
974                    if (setting.collapsible_family_root && setting.collapsible_family_onload) {
975                        collapsible_family_onload = 'display:none;';
976                        sign = '+';
977                    } else {
978                        collapsible_family_onload = '';
979                        sign = '-';
980                    }
981                    if (ind.root.indi.fam) {
982                        cont.append('<ul class="families"></ul>');
983                        //ind_template(ind, setting, gen = null, fams_or_chills = [], type = 'root', sign = '-') 
984                        var temp = ind_template(ind.root.indi, setting, gen, ind.root.indi.fam, 'root', sign)
985                        cont.find('.families').append('<li class="root"></li>');
986                        cont.find('.families > .root').append(temp);
987                        if (ind.root.indi.fam.length) {
988                            cont.find('.families').append('<li class="spouses"><ul></ul></li>');
989                        }
990                        var x = 1;
991                        $.each(ind.root.indi.fam, function(famindex, fam) {
992                            var collapsible_family_onload;
993                            var sign;
994                            if (setting.collapsible_family_spouse && setting.collapsible_family_onload) {
995                                collapsible_family_onload = 'display:none;';
996                                sign = '+';
997                            } else {
998                                collapsible_family_onload = '';
999                                sign = '-';
1000                            }
1001                            if (ind.root.indi.sex == 'M' || (ind.root.indi.sex == 'F' && setting.female_tree != 'on')) {
1002                                $.ajax({
1003                                    url: gt_obj.gt_rest_url + "genealogical-tree/v1/family/fam/" + fam,
1004                                    cache: true,
1005                                    dataType: "json"
1006                                }).done(function(fam) {
1007                                    if (ind.root.indi.sex == 'M') {
1008                                        var partner = fam.root.fam.wife;
1009                                    } else {
1010                                        var partner = fam.root.fam.husb;
1011                                    }
1012                                    if (setting.hide_spouse != 'on') {
1013                                        if ((setting.hide_un_spouse != 'on' && !partner.ref) || partner.ref) {
1014                                            var temp = ind_template(partner, setting, null, fam.root.fam.children, 'spouse', sign)
1015                                            cont.find('.families > .spouses > ul').append('<li data-order="' + famindex + '" class="spouse ' + famindex + '"></li>')
1016                                            cont.find('.families > .spouses > ul > li.spouse.' + famindex).append(temp);
1017                                        }
1018                                    }
1019                                    if (fam.root.fam.children) {
1020                                        var root = fam.root.fam.root;
1021                                        cont.find('.families > .spouses > ul > li.spouse.' + famindex).append('<ul class="childs" style="' + collapsible_family_onload + '"></ul>');
1022                                        $.each(fam.root.fam.children, function(index, children) {
1023                                            if (ancestor && Object.keys(ancestor).length && main_root) {
1024                                                if (children.ref != main_root) {
1025                                                    return;
1026                                                }
1027                                            }
1028                                            var uniqid = js_uniqid(10);
1029                                            cont.find('.families > .spouses > ul > li.spouse.' + famindex).find('.childs').append('<li class="child" data-id="' + children.ref + '" data-uniqid="' + uniqid + '"></li>');
1030                                            tree5(base, children.ref, setting, gen, root, uniqid);
1031                                        })
1032                                    }
1033                                })
1034                            }
1035                        });
1036                    }
1037                })
1038            }
1039
1040            function addValue(current_value) {
1041                const ADD_VALUE = 0.001;
1042                return parseFloat(current_value - ADD_VALUE).toFixed(1);
1043            }
1044
1045            function js_uniqid(length) {
1046                var result = '';
1047                var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
1048                var characters_length = characters.length;
1049                for (var i = 0; i < length; i++) {
1050                    result += characters.charAt(Math.floor(Math.random() * characters_length));
1051                }
1052                return result;
1053            }
1054
1055            function ind_template(ind, setting, gen = null, fams_or_chills = [], type = 'root', sign = '-') {
1056                if (!ind || (ind && !ind.id && !ind.ref)) {
1057                    return '<div class="ind"><div class="ind-cont"><div class="info"><div class="name">Unknown</div></div></div></div>';
1058                }
1059                var id = '';
1060                var isalive = true;
1061                isalive = ind.deat ? false : true;
1062                if (ind.id) {
1063                    var id = ind.id;
1064                }
1065                if (ind.ref) {
1066                    var id = ind.ref;
1067                }
1068                var image = gt_obj.gt_dir_url + '/public/img/ava-' + ind.sex + '.jpg';
1069                if (ind.image) {
1070                    var image = ind.image;
1071                }
1072                if (setting.image && setting.image == 'true') {
1073                    setting.thumb.show = 'on';
1074                }
1075                var template = '';
1076                var highlight = '';
1077                if (setting.root == id && setting.root_highlight == 'on') {
1078                    highlight = 'H'
1079                }
1080                template += '<div data-id="' + id + '" class="ind ' + ind.sex + ' ' + setting.box.layout + ' ' + highlight + '">';
1081                var collapsible = '';
1082                var fams_or_chills_length = Object.size(fams_or_chills);
1083                if (((setting.collapsible_family_root == 'on' && type == 'root') || (sett
1083ing.collapsible_family_spouse == 'on' && type == 'spouse')) && fams_or_chills_length) {
1084                    collapsible = 'gt-collapsible';
1085                }
1086                template += '<div class="ind-cont ' + collapsible + '">';
1087                if (setting.thumb.show && setting.thumb.show == 'on') {
1088                    template += '<div class="image">'
1089                    template += '<img src="' + image + '">'
1090                    template += '</div>'
1091                }
1092                template += '<div class="info" data-member-id="' + id + '">'
1093                if (gen) {
1094                    if (setting.generation && setting.generation == 'on') {
1095                        template += '<div class="gt-generation">'+gt_obj.GEN+': ' + gen + '</div>';
1096                    }
1097                }
1098                if (setting.treelink && setting.treelink == 'on') {
1099                    template += '\
1100                <div class="tree-link">\
1101                    <a data-popid="' + id + '" href="?root=' + id + '"><img style="width:20px;" src="' + gt_obj.gt_dir_url + 'public/img/family-tree.svg"></a>\
1102                </div>';
1103                }
1104                template += '<div class="name">'
1105
1106
1107                var name = ind.full_name;
1108                if(setting.name && setting.name=='first') {
1109                    name =  name.split(' ')[0]
1110                }
1111                if(setting.name && setting.name=='title') {
1112                    name = ind.post_title;
1113                }
1114
1115                template += '<a data-popid="' + id + '" href="' + ind.href + '">' + name + '</a>';
1116
1117                if ((setting.gender && setting.gender != 'none') || setting.gender == 'true') {
1118                    template += '<span class="gender ' + ind.sex + '">'
1119                    if (setting.gender == 'icon') {
1120                        template += ' <span></span>';
1121                    } else if (setting.gender == 'short') {
1122                        if (ind.sex == 'M') {
1123                            template += ' (M) ';
1124                        }
1125                        if (ind.sex == 'F') {
1126                            template += ' (F)';
1127                        }
1128                    } else if (setting.gender == 'full') {
1129                        if (ind.sex == 'M') {
1130                            template += ' (Male) ';
1131                        }
1132                        if (ind.sex == 'F') {
1133                            template += ' (Female) ';
1134                        }
1135                    } else {
1136                        if (ind.sex == 'M') {
1137                            template += ' ♂'
1138                        }
1139                        if (ind.sex == 'F') {
1140                            template += ' ♀'
1141                        }
1142                    }
1143                    template += '</span>';
1144                }
1145                template += '</div>';
1146                console.log(ind.birt);
1147                if ((setting.birt != 'none' || setting.deat != 'none') && (ind.birt || ind.deat)) {
1148                    template += '<div class="birt-deat">'
1149                    if ((setting.birt != 'none' && setting.deat != 'none') && (ind.birt && ind.deat)) {
1150                        template += '('
1151                    }
1152                    if (setting.birt != 'none' && ind.birt) {
1153                        if (setting.birt_hide_alive && setting.birt_hide_alive == 'on') {
1154                            if (!isalive) {
1155                                template += 'B : ' + ind.birt;
1156                            }
1157                        } else {
1158                            template += 'B : ' + ind.birt;
1159                        }
1160                    }
1161                    if ((setting.birt != 'none' && setting.deat != 'none') && (ind.birt && ind.deat)) {
1162                        template += ' - '
1163                    }
1164                    if (setting.deat != 'none' && ind.deat) {
1165                        template += ' D : ' + ind.deat;
1166                    }
1167                    if ((setting.birt != 'none' && setting.deat != 'none') && (ind.birt && ind.deat)) {
1168                        template += ')'
1169                    }
1170                    template += '</div>';
1171                }
1172                template += '</div>';
1173                if (((setting.collapsible_family_root == 'on' && type == 'root') || (sett
1173ing.collapsible_family_spouse == 'on' && type == 'spouse')) && fams_or_chills_length) {
1174                    var gt_collapsed;
1175                    if (sign == '+') {
1176                        gt_collapsed = 'gt-collapsed';
1177                    } else if (sign == '-') {
1178                        gt_collapsed = '';
1179                    } else {
1180                        gt_collapsed = '';
1181                    }
1182                    template += '<div class="gt-collapse-family ' + gt_collapsed + '">' + sign + '</div>';
1183                }
1184                template += '</div>';
1185                template += '</div>';
1186                return template;
1187            }
1188
1189            function templateAppend(element, template) {
1190
1191                element.append(template).hide().show('slow');
1192                var scene = $(element).parents('#famTree.gt-tree');
1193                var widthParent = scene.parent().width();
1194                var width = scene.width();
1195                var widthOld = scene.attr('data-width');
1196                scene.attr('data-width', width);
1197                if (widthOld != width && widthParent < width) {
1198                    var ratio = 1 / (width / widthParent);
1199                    var ratio = ratio.toFixed(5)
1200                    var ratioOld = scene.attr('data-ratio');
1201                    scene.attr('data-ratio', ratio);
1202                    if (parseFloat(ratioOld) > parseFloat(ratio)) {
1203                        inseatePanzoom(scene[0], ratio);
1204                    }
1205                }
1206            }
1207            /* </fs_premium_only> */
1208            function inseatePanzoom(scene, ratio, load = null) {
1209                panzoom(scene, {
1210                    beforeWheel: function(e) {
1211                        // Ignore zoom if shift key is not pressed or if target is an input field
1212                        const shouldIgnore = !e.shiftKey || isExcludedElement(e.target);
1213                        return shouldIgnore;
1214                    },
1215                    onTouch: function(e) {
1216                        
1217                        return;
1218                    },
1219                    maxZoom: 1,
1220                    minZoom: 0.1,
1221                    zoomSpeed: 0.1,
1222                })
1223            }
1224
1225            // Helper function to check if the target is an excluded element
1226            function isExcludedElement(element) {
1227                const excludedTags = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON'];
1228                return excludedTags.includes(element.tagName);
1229            }
1230
1231        })
1232    });
1233})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.