PageSourceSearch

https://dixsupps.com/wp-content/plugins/dix-ia-button/public/js/frontend.js?ver=1.0.0

js dixsupps.com collected 2026-09-24 13:11:22 UTC 2,595 bytes, 64 lines download raw bytes

1/**
2 * DIX IA Buttons - Frontend
3 * Gestion des clics sur les boutons de partage
4 */
5function piabSlugifyTextForUrl(text) {
6    const textWithoutAccents = text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
7    const cleanedText = textWithoutAccents.replace(/[^a-zA-Z0-9\s:/\.-]/g, '');
8    return cleanedText.trim().replace(/\s+/g, '+');
9}
10
11document.addEventListener('DOMContentLoaded', function () {
12    const URL_MAX_LENGTH = 2028;
13    const shareButtons = document.querySelectorAll('.piab-share-button');
14
15    shareButtons.forEach(function (button) {
16        button.addEventListener('click', function () {
17            let urlToOpen = '';
18            const action = this.dataset.action;
19            const service = this.dataset.service;
20
21            // Cas special : ChatGPT (URL avec prompt slugifie)
22            if (action === 'share-content' && service === 'chatgpt') {
23                if (typeof piab_data === 'undefined' || typeof piab_data.post_content === 'undefined') {
24                    return;
25                }
26
27                const promptTemplate = this.dataset.prompt;
28                const postContent = piab_data.post_content.replace(/\s+/g, ' ').trim();
29                const finalText = promptTemplate.replace('{CONTENT}', postContent);
30
31                const slugifiedText = piabSlugifyTextForUrl(finalText);
32                urlToOpen = 'https://chat.openai.com/?q=' + slugifiedText;
33
34            // Cas special : Claude (copie dans le presse-papier + ouverture claude.ai)
35            } else if (action === 'share-content' && service === 'claude') {
36                if (typeof piab_data === 'undefined' || typeof piab_data.post_content === 'undefined') {
37                    return;
38                }
39
40                const promptTemplate = this.dataset.prompt;
41                const postContent = piab_data.post_content.replace(/\s+/g, ' ').trim();
42                const finalText = promptTemplate.replace('{CONTENT}', postContent);
43
44                if (navigator.clipboard && navigator.clipboard.writeText) {
45                    navigator.clipboard.writeText(finalText);
46                }
47
48                urlToOpen = 'https://claude.ai/new';
49
50            } else {
51                // Cas normal : URL pre-construite
52                urlToOpen = this.dataset.url;
53            }
54
55            if (urlToOpen && urlToOpen.length > URL_MAX_LENGTH) {
56                urlToOpen = urlToOpen.substring(0, URL_MAX_LENGTH);
57            }
58
59            if (urlToOpen) {
60                window.open(urlToOpen, '_blank', 'noopener,noreferrer');
61            }
62        });
63    });
64});

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.