File size: 10,958 Bytes
d884d35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3355090
d884d35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344a40e
 
 
 
 
 
 
 
 
 
 
 
d884d35
 
 
 
 
3355090
d884d35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3355090
d884d35
 
 
 
 
 
 
 
344a40e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d884d35
3355090
d884d35
 
6597e2e
3c82ed6
d884d35
3355090
 
d884d35
3355090
 
 
 
 
 
 
 
 
344a40e
 
 
 
 
 
 
 
 
 
 
 
 
3355090
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d884d35
3355090
 
 
 
 
 
 
 
 
344a40e
3355090
 
 
 
 
 
 
d884d35
 
344a40e
 
 
 
 
d884d35
 
 
344a40e
d884d35
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JVCGPT - Faux Forum</title>
    <style>

        body {

            font-family: Arial, sans-serif;

            background-color: #121212;

            color: #d3d3d3;

            margin: 0;

            padding: 0;

        }

        header {

            background-color: #ff8000;

            color: white;

            padding: 10px;

            text-align: center;

        }

        .container {

            width: 90%;

            max-width: 800px;

            margin: 20px auto;

            background-color: #1c1c1c;

            border: 1px solid #333;

            border-radius: 5px;

            box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);

        }

        .topic-header {

            padding: 10px;

            background-color: #2a2a2a;

            border-bottom: 1px solid #444;

            color: #ff8000;

            font-weight: bold;

        }

        .post {

            display: flex;

            align-items: flex-start;

            padding: 10px;

            border-bottom: 1px solid #444;

        }

        .post:last-child {

            border-bottom: none;

        }

        .avatar {

            margin-right: 10px;

        }

        .avatar img {

            width: 50px;

            height: 50px;

            border-radius: 5px;

        }

        .post-content-wrapper {

            flex: 1;

        }

        .post-meta {

            font-size: 0.9em;

            color: #aaa;

            margin-bottom: 5px;

        }

        .post-meta .username {

            font-weight: bold;

        }

        .post-meta .username.author {

            color: #ff8000;

            text-shadow: 0 0 5px #ff8000;

        }

        .post-meta .date {

            font-size: 0.8em;

            color: #aaa;

        }

        .post-content {

            font-size: 1em;

            color: #d3d3d3;

            word-wrap: break-word;

            white-space: pre-wrap; /* Permet les retours à la ligne */

        }

        footer {

            text-align: center;

            margin: 20px 0;

            color: #888;

        }

        textarea {

            width: 100%;

            height: 150px;

            margin: 20px 0;

            padding: 10px;

            background-color: #1c1c1c;

            border: 1px solid #333;

            border-radius: 5px;

            color: #d3d3d3;

            box-sizing: border-box;

            font-family: Arial, sans-serif;

            font-size: 1em;

        }

        button {

            display: block;

            margin: 10px auto;

            padding: 10px 20px;

            background-color: #007bff;

            color: white;

            border: none;

            border-radius: 5px;

            cursor: pointer;

            font-size: 1em;

        }

        button:hover {

            background-color: #0056b3;

        }

		/* Ne pas redimensionner les smileys */

		.smiley-img {

			width: auto;

			height: auto;

		}



		/* Redimensionner uniquement les images NoelShack */

		.post-content img:not(.smiley-img) {

			width: 75px;

			height: 50px;

		}



    </style>
</head>
<body>

<header>
    <h1>JVCGPT - Faux Forum</h1>
</header>

<div class="container">
    <div class="topic-header">Sujet : <span id="topic-title">Titre du sujet</span></div>
    <div id="posts-container">
        <!-- Posts will be dynamically loaded here -->
    </div>
</div>

<div class="container">
    <textarea id="logInput" placeholder="Collez vos logs ici..."></textarea>
    <button onclick="parseLogs()">Générer le topic</button>
</div>

<footer>
    <p>JVCGPT - Faux Forum simulé pour usage personnel</p>
</footer>

<script>

    function parseLogs() {

        const logs = document.getElementById('logInput').value;

        const postsContainer = document.getElementById('posts-container');

        postsContainer.innerHTML = ''; // Clear previous posts



        const smileyMap = {

            ":)": "smileys/1.gif",

            ":question:": "smileys/2.gif",

            ":g)": "smileys/3.gif",

            ":d)": "smileys/4.gif",

            ":cd:": "smileys/5.gif",

            ":globe:": "smileys/6.gif",

            ":p)": "smileys/7.gif",

            ":malade:": "smileys/8.gif",

            ":pacg:": "smileys/9.gif",

            ":pacd:": "smileys/10.gif",

            ":noel:": "smileys/11.gif",

            ":o))": "smileys/12.gif",

            ":snif2:": "smileys/13.gif",

            ":-(": "smileys/14.gif",

            ":-((:": "smileys/15.gif",

            ":mac:": "smileys/16.gif",

            ":gba:": "smileys/17.gif",

            ":hap:": "smileys/18.gif",

            ":nah:": "smileys/19.gif",

            ":snif:": "smileys/20.gif",

            ":mort:": "smileys/21.gif",

            ":ouch:": "smileys/22.gif",

            ":-)))": "smileys/23.gif",

            ":content:": "smileys/24.gif",

            ":nonnon:": "smileys/25.gif",

            ":cool:": "smileys/26.gif",

            ":sleep:": "smileys/27.gif",

            ":doute:": "smileys/28.gif",

            ":hello:": "smileys/29.gif",

            ":honte:": "smileys/30.gif",

            ":-p": "smileys/31.gif",

            ":lol:": "smileys/32.gif",

            ":non2:": "smileys/33.gif",

            ":monoeil:": "smileys/34.gif",

            ":non:": "smileys/35.gif",

            ":ok:": "smileys/36.gif",

            ":oui:": "smileys/37.gif",

            ":rechercher:": "smileys/38.gif",

            ":rire:": "smileys/39.gif",

            ":-D": "smileys/40.gif",

            ":rire2:": "smileys/41.gif",

            ":salut:": "smileys/42.gif",

            ":sarcastic:": "smileys/43.gif",

            ":up:": "smileys/44.gif",

            ":(": "smileys/45.gif",

            ":-)": "smileys/46.gif",

            ":peur:": "smileys/47.gif",

            ":bye:": "smileys/48.gif",

            ":dpdr:": "smileys/49.gif",

            ":fou:": "smileys/50.gif",

            ":gne:": "smileys/51.gif",

            ":dehors:": "smileys/52.gif",

            ":fier:": "smileys/53.gif",

            ":coeur:": "smileys/54.gif",

            ":rouge:": "smileys/55.gif",

            ":sors:": "smileys/56.gif",

            ":ouch2:": "smileys/57.gif",

            ":merci:": "smileys/58.gif",

            ":svp:": "smileys/59.gif",

            ":ange:": "smileys/60.gif",

            ":diable:": "smileys/61.gif",

            ":gni:": "smileys/62.gif",

            ":spoiler:": "smileys/63.gif",

            ":hs:": "smileys/64.gif",

            ":desole:": "smileys/65.gif",

            ":fete:": "smileys/66.gif",

            ":sournois:": "smileys/67.gif",

            ":hum:": "smileys/68.gif",

            ":bravo:": "smileys/69.gif",

            ":banzai:": "smileys/70.gif",

            ":bave:": "smileys/71.gif",

            ":ddb:": "smileys/ddb.gif",

            ":fish:": "smileys/fish.gif",

            ":cimer:": "smileys/cimer.gif",

            ":hapoelparty:": "smileys/hapoelparty.gif",

            ":loveyou:": "smileys/loveyou.gif",

            ":cute:": "smileys/nyu.gif",

            ":objection:": "smileys/objection.gif",

            ":pf:": "smileys/pf.gif",

            ":play:": "smileys/play.gif",

            ":siffle:": "smileys/siffle.gif"

        };



        const blocks = logs.split('<|eot_id|>');

        let topicTitleSet = false; // Ensure the topic title is set only once



        blocks.forEach(block => {

            if (!topicTitleSet && block.includes('<|start_header_id|><|sujet|><|end_header_id|>')) {

                const titleMatch = block.match(/Sujet : ?["']?(.*?)["']?$/);

                if (titleMatch) {

                    document.getElementById('topic-title').textContent = titleMatch[1];

                    topicTitleSet = true;

                }

            }



            const pseudoMatch = block.match(/<\|im_pseudo\|>(.*?)<\|end_pseudo\|>/);

            const dateMatch = block.match(/<\|im_date\|>(.*?)<\|end_date\|>/);

            const postMatch = block.match(/<\|begin_of_post\|>([\s\S]*?)<\|end_of_post\|>/);



            if (pseudoMatch && dateMatch && postMatch) {

                const username = pseudoMatch[1];

                const date = dateMatch[1];

                let message = postMatch[1];



			// Remplacement des codes smileys

			Object.entries(smileyMap).forEach(([code, imgPath]) => {

				const regex = new RegExp(escapeRegExp(code), "g");

				message = message.replace(regex, `<img src="${imgPath}" alt="${code}" title="${code}" class="smiley-img" />`);

			});



			// Remplacement des URLs NoelShack

			message = message.replace(/https?:\/\/image\.noelshack\.com\/[^\s]+/g, (url) => {

				return `<img src="${url}" alt="Image">`;

			});





                const postDiv = document.createElement('div');

                postDiv.className = 'post';



                const avatarDiv = document.createElement('div');

                avatarDiv.className = 'avatar';

                const avatarImg = document.createElement('img');

                avatarImg.src = 'https://image.jeuxvideo.com/avatar-md/default.jpg';

                avatarDiv.appendChild(avatarImg);



                const contentWrapper = document.createElement('div');

                contentWrapper.className = 'post-content-wrapper';



                const metaDiv = document.createElement('div');

                metaDiv.className = 'post-meta';



                const usernameDiv = document.createElement('div');

                usernameDiv.textContent = username;

                usernameDiv.className = 'username';

                if (block.includes('<|start_header_id|><|autheur|><|end_header_id|>')) {

                    usernameDiv.classList.add('author');

                }

                metaDiv.appendChild(usernameDiv);



                const dateDiv = document.createElement('div');

                dateDiv.textContent = date;

                dateDiv.className = 'date';

                metaDiv.appendChild(dateDiv);



                const contentDiv = document.createElement('div');

                contentDiv.className = 'post-content';

                contentDiv.innerHTML = message;



                contentWrapper.appendChild(metaDiv);

                contentWrapper.appendChild(contentDiv);



                postDiv.appendChild(avatarDiv);

                postDiv.appendChild(contentWrapper);

                postsContainer.appendChild(postDiv);

            }

        });



        // Échapper les caractères spéciaux pour la RegExp

        function escapeRegExp(string) {

            return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");

        }

    }

</script>


</body>
</html>