Skip to content

Commit 1e73b62

Browse files
authored
Merge pull request #503 from matchID-project/dev
Fix firefox bug & gedcom fixes
2 parents cc21a18 + bf62f29 commit 1e73b62

File tree

6 files changed

+81
-31
lines changed

6 files changed

+81
-31
lines changed

src/components/views/GedcomPersonCard.svelte

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
class="rf-card rf-card--horizontal rf-card--{expand ? "md": "sm"}"
1414
class:rf-card--left-arrow={expand}
1515
on:click={toggleExpand}
16+
class:rf-inactive={(!active)&&(!focus)}
1617
>
1718
<div class="rf-card__img" style="position:relative">
1819
<img
19-
class="rf-background--{ active ? "bf" : "g400"}"
20+
class="{ focus ? "rf-background--bf" : (active? "rf-callout--scheme-soft-blue-soft" : "rf-background--g400") }"
2021
class:match={match}
2122
alt={ record.sex }
2223
src={ record.sex === 'M' ? '/male.svg' : '/female.svg' }
@@ -98,8 +99,10 @@
9899
{/if}
99100
{#if record.cons}
100101
<p>
101-
<strong>Conjoint</strong><br>
102-
<a class="rf-link" href="#{record.cons.id}" title={record.cons.surn+' '+(record.cons.givn || '')}>{record.cons.surn} {record.cons.givn || ''}</a>
102+
<strong>Conjoint{record.cons.lengh > 1 ? 's' : ''}</strong><br>
103+
{#each record.cons as cons}
104+
<a class="rf-link" href="#{cons.id}" title={cons.surn+' '+(cons.givn || '')}>{cons.surn} {cons.givn || ''}</a>
105+
{/each}
103106
</p>
104107
{/if}
105108
{#if record.chil}
@@ -136,14 +139,13 @@
136139
export let mouseenter = () => {};
137140
export let mouseleave = () => {};
138141
export let active = false;
142+
export let focus = false;
139143
let match = false;
140144
141145
let linkCopied = false;
142146
143147
let expand;
144148
145-
$: console.log(record.note, note);
146-
147149
window.addEventListener('hashchange', () => {
148150
expand = (window.location.hash.replace('#','') === id);
149151
}, false)
@@ -187,7 +189,6 @@
187189
}
188190
return x && !match;
189191
}).forEach(n => {
190-
console.log('la',n);
191192
note += '<br>' + `${n}`.replace(/(http:\S+)/g,'<a target="_blank" class="rf-link" href="$1">$1</a>')
192193
});
193194
}

src/components/views/GedcomTree.svelte

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,46 @@
22
<div
33
class="rf-container-fluid"
44
on:click={actualizeLines}
5+
on:mouseleave={() => {showFamily = undefined; showId = undefined}}
56
>
67
<div class="rf-grid-row rf-text--center">
78
<div class="rf-col-12 rf-margin-3N">
89
<strong>Visualisation des individus de l'arbre généalogique: </strong>
910
</div>
10-
{#each Object.keys(gedcom).filter(x => /\@i.*@/i.test(x)).sort((a,b) => gedcom[a].rank - gedcom[b].rank) as id}
11-
<GedcomPersonCard
12-
id={id}
13-
active={showFamily && ((showFamily === gedcom[id].fams) || (showFamily === gedcom[id].famc))}
14-
record={gedcom[id]}
15-
mouseenter={() => {
16-
actualizeLines();
17-
showFamily = gedcom[id].fams;
18-
}}
19-
/>
11+
{#each Object.keys(gedcom)
12+
.filter(x => /\@i.*@/i.test(x))
13+
.map(i => Math.round(gedcom[i].rank))
14+
.sort()
15+
.filter(function(el,i,a){return i===a.indexOf(el)})
16+
as gen}
17+
<div class="rf-container-fluid">
18+
<div class="rf-grid-row rf-text--center rf-margin-bottom-2N">
19+
{#each Object.keys(gedcom)
20+
.filter(i => /\@i.*@/i.test(i) && (Math.round(gedcom[i].rank) === gen))
21+
as id}
22+
<GedcomPersonCard
23+
id={id}
24+
focus={(showId === id)}
25+
active={(!showId)
26+
|| sameFamily(gedcom[id].fams,showFamily)
27+
|| sameFamily(gedcom[id].famc,showFamily)
28+
|| (gedcom[id].chil && gedcom[id].chil.some(c => c.id === showId))
29+
}
30+
record={gedcom[id]}
31+
mouseenter={() => {
32+
actualizeLines();
33+
showFamily = gedcom[id].fams;
34+
showId = id;
35+
}}
36+
/>
37+
{/each}
38+
</div>
39+
</div>
2040
{/each}
2141
</div>
2242
</div>
23-
{#each Object.keys(gedcom).filter(x => /\@f.*@/i.test(x)) as id}
24-
<div class="line" class:rf-hide={showFamily !== id} id={id}></div>
43+
{#each Object.keys(gedcom).filter(x => /\@f.*@/i.test(x)) as f}
44+
<div class="line" class:rf-hide={!sameFamily(f,showFamily)} id={f}></div>
2545
{/each}
2646
{/if}
2747

@@ -31,9 +51,13 @@
3151
export let gedcom;
3252
let computed = false;
3353
let fmax = 10000;
34-
let showFamily;
54+
let showFamily, showId;
3555
3656
const getGenerationRank = (i) => {
57+
if (!i) {return -1;}
58+
if (gedcom[i].rank !== undefined) {
59+
return gedcom[i].rank
60+
}
3761
if(gedcom[i] && gedcom[i].pare) {
3862
let fRank = 0;
3963
if (gedcom[i].fams) {
@@ -43,9 +67,23 @@
4367
fRank = Math.max(...gedcom[i].fams.map(f => parseInt((f.replace(/\@f(.*)\@/i,'$1'))))) / fmax;
4468
}
4569
}
46-
return 1 + fRank + Math.min(...gedcom[i].pare.map(p => getGenerationRank(p.id)));
70+
gedcom[i].rank = 1 + fRank + Math.max(...gedcom[i].pare.map(p => getGenerationRank(p.id)));
71+
} else {
72+
gedcom[i].rank = 0;
73+
}
74+
gedcom[i].rank = Math.max(
75+
gedcom[i].rank || 0,
76+
(gedcom[i].cons && Math.max(...gedcom[i].cons.map(c => getGenerationRank(c.id)))) || 0
77+
);
78+
return gedcom[i].rank;
79+
}
80+
81+
const sameFamily = (f1, f2) => {
82+
if (!f1) {return false}
83+
if (f1 && typeof(f1) === 'string') {
84+
f1 = [f1];
4785
}
48-
return 0;
86+
return f1.some(f => f2 && f2.includes(f));
4987
}
5088
5189
const actualizeLines = () => {
@@ -79,7 +117,7 @@
79117
f.chil = f.chil.map(c => c)
80118
}
81119
f.chil.forEach(c => {
82-
gedcom[c].pare = parents.map(p => {
120+
gedcom[c].pare = parents.filter(p => gedcom[p]).map(p => {
83121
return {
84122
id: p,
85123
surn: gedcom[p].surn || gedcom[p].name.replace(/^.*\/\s*(.*)\s*\/.*$/,'$1'),
@@ -88,7 +126,7 @@
88126
})
89127
})
90128
parents.forEach(p => {
91-
gedcom[p].chil = f.chil.map(c => {
129+
gedcom[p].chil = f.chil.filter(c => gedcom[c]).map(c => {
92130
return {
93131
id: c,
94132
surn: gedcom[c].surn || gedcom[c].name.replace(/^.*\/\s*(.*)\s*\/.*$/,'$1'),
@@ -98,20 +136,22 @@
98136
})
99137
}
100138
if (f.wife && f.husb) {
101-
gedcom[f.wife].cons = {
139+
if (!gedcom[f.wife].cons) { gedcom[f.wife].cons = [] }
140+
gedcom[f.wife].cons.push({
102141
id: f.husb,
103142
surn: gedcom[f.husb].surn || gedcom[f.husb].name.replace(/^.*\/\s*(.*)\s*\/.*$/,'$1'),
104143
givn: gedcom[f.husb].givn || gedcom[f.husb].name.replace(/^(.*)\/\s*(.*)\s*\/.*$/,'$1')
105-
}
106-
gedcom[f.husb].cons = {
144+
});
145+
if (!gedcom[f.husb].cons) { gedcom[f.husb].cons = [] }
146+
gedcom[f.husb].cons.push({
107147
id: f.wife,
108148
surn: gedcom[f.wife].surn || gedcom[f.wife].name.replace(/^.*\/\s*(.*)\s*\/.*$/,'$1'),
109149
givn: gedcom[f.wife].givn || gedcom[f.wife].name.replace(/^(.*)\/\s*(.*)\s*\/.*$/,'$1')
110-
}
150+
});
111151
}
112152
});
113153
Object.keys(gedcom).filter(x => /\@i.*\@/i.test(x)).forEach(i => {
114-
gedcom[i].rank = getGenerationRank(i);
154+
getGenerationRank(i);
115155
});
116156
computed = true;
117157
actualizeLines();
@@ -165,6 +205,7 @@
165205
</script>
166206

167207
<style>
208+
168209
.line{
169210
position:absolute;
170211
width:2px;

src/components/views/LinkCheck.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@
211211
let gedcom = JSON.parse(JSON.stringify($linkOptions.csv.gedcom));
212212
const idCol = $linkResults.header.indexOf('id');
213213
214+
Object.keys(gedcom).filter(i => /\@i.*@/i.test(i)).forEach(i => {
215+
delete gedcom[i].rank;
216+
delete gedcom[i].cons;
217+
delete gedcom[i].pare;
218+
delete gedcom[i].chil;
219+
})
220+
214221
$linkResults.rows.forEach((r,i) => {
215222
const l = $linkValidations[i];
216223
const gedcomId = r[0][0];

src/components/views/LinkJob.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
formData.append('encoding', $linkOptions.csv.encoding);
152152
formData.append('skipLines', $linkOptions.csv.skipLines);
153153
formData.append('candidateNumber', $linkOptions.api.candidateNumber);
154-
formData.append('pruneScoe', $linkOptions.api.pruneScore);
154+
formData.append('pruneScore', $linkOptions.api.pruneScore);
155155
formData.append('dateFormat', $linkOptions.csv.dateFormat || 'DD/MM/YYYY');
156156
Object.keys($linkMapping && $linkMapping.reverse).map(k => formData.append(k,$linkMapping.reverse[k]));
157157
if ($linkOptions.csv.type === 'gedcom') {

src/components/views/LinkSampleTable.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
}
209209
}
210210
};
211-
return row.map(col => col.replace(/^\s*/,'') || '<vide>');
211+
return row.map(col => col.replace(/^\s*/,'').replace(/\s*$/,'') || '<vide>');
212212
});
213213
if (quoteCounts[0] > quoteCounts[1]) {
214214
quote = q;
@@ -244,7 +244,7 @@
244244
[/(\@\S+\@)/mg, (a,b) => {return b.toLowerCase()}],
245245
// simple array
246246
[/^( *)(\w{4}): *([^\n]+)\n(\1(\2): *([^\n]+)\n)+/mg,(a) => {
247-
return a.replace(/:.*$/s,':\n') + a.replace(/( +)\w{4}: +(.*)/mg,' $1- $2');
247+
return a.substring(0,a.indexOf(':')+1) + '\n' + a.replace(/( +)\w{4}: +(.*)/mg,' $1- $2');
248248
}],
249249
//complex arrays
250250
[/^(\s*)(\w{4}):\s*([^\n]*\n(\s+\1[a-zA-Z0-9_\-][^\n]*\n)*)\1(\2):\s*([^\n]*)\n/mg,'$1$2:\n $1- $3 $1- $6\n'],

stats/src/parseLogs.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
@referrerUrlRegexp = (
2020
[qr|^(https?://)?(www\.)?|,'""'],
21+
[qr/^(fr|fr\.m|m)\./,'""'],
2122
[qr|/.*$|,'""'],
2223
[qr|\d+.\d+.\d+.\d+(:\d+)?$|,'"internal"'],
2324
[qr|^(https?://)?[a-z].*matchid.io?$|,'"matchid.io"'],

0 commit comments

Comments
 (0)