PageSourceSearch

https://www.aeternae-funeraire.fr/wp-content/plugins/simpli-wp-obituary/assets/js/obflink.js?ver=3.3.4

js aeternae-funeraire.fr collected 2026-10-04 02:22:08 UTC 5,741 bytes, 182 lines download raw bytes

1function bindObflinkElement(link) {
2	link.addEventListener('click', redirectBase64);
3	link.addEventListener('contextmenu', rightClickRedirectBase64);
4	link.addEventListener('keydown', function (event) {
5		if (event.key === 'Enter' || event.key === ' ') {
6			event.preventDefault();
7			event.stopPropagation();
8			this.click();
9		}
10	}, false);
11}
12
13window.smpBindObflinks = function (container) {
14	if (!container) {
15		return;
16	}
17	if (container.classList && container.classList.contains('obflink')) {
18		bindObflinkElement(container);
19	}
20	if (container.querySelectorAll) {
21		container.querySelectorAll('.obflink').forEach(bindObflinkElement);
22	}
23};
24
25document.addEventListener('DOMContentLoaded', function () {
26	window.smpBindObflinks(document);
27});
28
29// Self-inverse substitution cipher: ROT13 letters, ROT5 digits, swap pairs for symbols.
30var SMP_OBF_FROM = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789:-/_.~?!=+&^%#@*{}[]';
31var SMP_OBF_TO   = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm5678901234-:_/~.!?+=^&#%*@}{][';
32var SMP_OBF_MAP  = {};
33for (var _i = 0; _i < SMP_OBF_FROM.length; _i++) {
34	SMP_OBF_MAP[SMP_OBF_FROM[_i]] = SMP_OBF_TO[_i];
35}
36
37/**
38 * Decode (or encode) a string using the self-inverse substitution cipher.
39 * Falls back to atob() if the result doesn't look like a URL (backward compat with old base64 links).
40 */
41function smpDecode(s) {
42	if (!s) return '';
43	var out = '';
44	for (var i = 0; i < s.length; i++) {
45		out += SMP_OBF_MAP[s[i]] || s[i];
46	}
47	// If result looks like a URL or path, return it; otherwise try atob() for legacy base64
48	if (out.indexOf('http') === 0 || out.indexOf('/') === 0 || out.indexOf('tel:') === 0 || out.indexOf('mailto:') === 0 || out.indexOf('sms:') === 0 || out.indexOf('#') === 0 || out.indexOf('whatsapp:') === 0 || out.indexOf('javascript:') === 0) {
49		return out;
50	}
51	try {
52		return atob(s);
53	} catch (e) {
54		return out;
55	}
56}
57
58window.smpGetLink = function (ref) {
59	var r = window.smpLinkRegistry;
60	return r && r[ref] ? smpDecode(r[ref]) : '';
61};
62
63function getObflinkValue(el) {
64	var ref = el.getAttribute('data-ref');
65	if (ref && window.smpLinkRegistry && window.smpLinkRegistry[ref]) {
66		return window.smpLinkRegistry[ref];
67	}
68	return el.getAttribute('data-o') || el.getAttribute('data-l') || null;
69}
70
71function stripObflinkInvisibleChars(url) {
72	return url.replace(/[\u00AD\u200B-\u200D\u2060\uFEFF]/g, '');
73}
74
75function isProtocolHandlerUrl(url) {
76	return (
77		url.indexOf('mailto:') === 0 ||
78		url.indexOf('tel:') === 0 ||
79		url.indexOf('sms:') === 0
80	);
81}
82
83function navigateObflinkUrl(url, openInNewTab) {
84	if (isProtocolHandlerUrl(url)) {
85		var anchor = document.createElement('a');
86		anchor.setAttribute('href', url);
87		anchor.setAttribute('rel', 'noopener noreferrer');
88		document.body.appendChild(anchor);
89		anchor.click();
90		document.body.removeChild(anchor);
91		return;
92	}
93	if (openInNewTab) {
94		var win = window.open(url, '_blank');
95		if (win) {
96			win.focus();
97		}
98		return;
99	}
100	window.location.assign(url);
101}
102
103function rightClickRedirectBase64(event) {
104	event.preventDefault();
105	// Right click = same behavior as a left click.
106	redirectBase64.call(this, event);
107}
108
109function redirectBase64(event) {
110	// A real <a href> nested inside the obflink handles its own navigation.
111	// Don't hijack it with window.location.assign() (would cancel its request).
112	var innerLink = event.target.closest && event.target.closest('a[href]');
113	if (innerLink && innerLink !== this && this.contains(innerLink)) {
114		return;
115	}
116	event.stopPropagation();
117	// Prevent the parent <label> (e.g. checkbox) from toggling when clicking the link.
118	if (this.closest('label')) {
119		event.preventDefault();
120	}
121	let params = getObflinkValue(this);
122    let url = undefined;
123    if (this.getAttribute("data-a")) {
124        params = this.getAttribute("data-a");
125        var myAssocArray = JSON.parse(params);
126
127        if (this.getAttribute("data-p")) {
128            var b2cshop = 'https://www.simplifia.fr/boutique/' + this.getAttribute("data-p");
129        } else {
130            var b2cshop = 'https://www.simplifia.fr/boutique/';
131        }
132        url = b2cshop + '?affiliation=' + encodeURIComponent(decodeURIComponent(window.atob(myAssocArray.affiliation))) + '&defunct_uuid=' + encodeURIComponent(myAssocArray.defunct_uuid) + '&theme_color=' + encodeURIComponent(myAssocArray.theme_color) + '&logo_url=' + encodeURIComponent(decodeURIComponent(window.atob(myAssocArray.logo_url))) + '&funeral_home_name=' + encodeURIComponent(myAssocArray.funeral_home_name);
133		window.location.assign(url);
134    } else if (params !== null) {
135		url = buildUrl(
136			params,
137			!this.getAttribute('data-decode') ||
138				this.getAttribute('data-decode') !== 'false'
139		);
140		navigateObflinkUrl(
141			url,
142			this.getAttribute('data-target') === '_blank' ||
143				this.getAttribute('target') === '_blank'
144		);
145	}
146}
147
148function buildUrl(encoded, useDecode) {
149	if (useDecode === undefined) useDecode = true;
150	var url = smpDecode(encoded);
151	if (!url) {
152		throw new Error('Invalid buildUrl');
153	}
154	var uri = url;
155	if (useDecode) {
156		try {
157			uri = decodeURIComponent(uri);
158		} catch (e) {
159			// Keep smpDecode output when the URI is not percent-encoded.
160		}
161	}
162	uri = stripObflinkInvisibleChars(uri);
163	if (uri.indexOf('http://') === 0 || uri.indexOf('https://') === 0) {
164		var parsed = new URL(uri);
165		if (
166			typeof axeptioSDK !== 'undefined' &&
167			axeptioSDK &&
168			axeptioSDK.getToken
169		) {
170			if (parsed.hostname.includes('simplifia.fr')) {
171				parsed.searchParams.append('axeptio_token', axeptioSDK.getToken());
172			}
173		}
174		return parsed.toString();
175	}
176	return uri;
177}
178
179window.smpDecode = smpDecode;
180window.buildUrl = buildUrl;
181window.rightClickRedirectBase64 = rightClickRedirectBase64;
182window.redirectBase64 = redirectBase64;

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.