Skip to content

Commit c2b09a0

Browse files
authored
Update script.js
1 parent 99f38f7 commit c2b09a0

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

script.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ let threadId = null;
66

77
// ✅ Bronvermeldingen omzetten naar klikbare links
88
function formatSources(text, sources) {
9-
return text.replace(/(?:\d+:)?(\d+)source/g, (match, number) => {
9+
// Vervang 【...†source】 notatie
10+
text = text.replace(/(?:\d+:)?(\d+)source/g, (match, number) => {
1011
const source = sources?.[number];
11-
if (source?.url) {
12-
return `<a href="${source.url}" target="_blank" class="bronlink">[bron ${number}]</a>`;
13-
} else {
14-
return `[bron ${number}]`;
15-
}
12+
return source?.url
13+
? `<a href="${source.url}" target="_blank" class="bronlink">[bron ${number}]</a>`
14+
: `[bron ${number}]`;
1615
});
16+
17+
// Vervang [4:0*bron] notatie
18+
text = text.replace(/\[(?:\d+:)?(\d+)\*bron\]/g, (match, number) => {
19+
const source = sources?.[number];
20+
return source?.url
21+
? `<a href="${source.url}" target="_blank" class="bronlink">[bron ${number}]</a>`
22+
: `[bron ${number}]`;
23+
});
24+
25+
return text;
1726
}
1827

1928
// ✅ Decode HTML entities

0 commit comments

Comments
 (0)