-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
569 lines (504 loc) · 20.8 KB
/
index.html
File metadata and controls
569 lines (504 loc) · 20.8 KB
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DeepTruth - 打击假新闻系统</title>
<style>
/* 全局样式 */
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #f4f5f7;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
color: #333;
font-size: 16.5px;
}
.container {
background-color: white;
padding: 40px 50px;
border-radius: 12px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
border: 1px solid #e0e0e0;
width: 100%;
max-width: 1100px;
text-align: center;
box-sizing: border-box;
position: relative;
}
.logo img { max-width: 160px; margin-bottom: 25px; opacity: 0.7; }
h1 { font-size: 2.2em; color: #172b4d; }
/* 欢迎页面样式 */
.welcome-page .intro-text { text-align: left; margin: 30px auto; max-width: 550px; line-height: 1.8; font-size: 1.2em; }
.features { list-style: none; padding-left: 0; }
.features li { margin-bottom: 12px; display: flex; align-items: flex-start; }
.checkmark { color: #4CAF50; font-weight: bold; margin-right: 10px; flex-shrink: 0; }
.more-info { margin-top: 30px; color: #555; }
.action-button {
display: inline-block;
padding: 14px 35px;
background-color: #fff;
color: #333;
text-decoration: none;
border-radius: 5px;
font-size: 1.2em;
font-weight: bold;
border: 2px solid #ccc;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 10px;
}
.action-button:hover {
background-color: #f0f0f0;
border-color: #bbb;
}
/* 新闻判断页面样式 */
.judge-page {
display: none;
text-align: left;
}
.page-title {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 30px;
padding-bottom: 15px;
border-bottom: 1px solid #eaeaea;
}
.logo-area {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.logo-area img {
max-width: 140px;
}
.judge-content {
display: flex;
gap: 30px;
margin-bottom: 30px;
}
.left-panel {
flex: 0 0 45%;
display: flex;
flex-direction: column;
}
.right-panel {
flex: 1;
display: flex;
flex-direction: column;
gap: 30px;
}
.news-number {
font-size: 1.5em;
font-weight: bold;
margin-bottom: 15px;
color: #333;
}
.news-image {
width: 100%;
background-color: #f0f0f0;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
height: 250px;
color: #888;
font-size: 1.1em;
margin-bottom: 20px;
overflow: hidden;
}
.news-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.news-title {
font-size: 1.5em;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
.news-meta {
display: flex;
flex-direction: column;
margin-bottom: 15px;
color: #666;
font-size: 0.9em;
}
.news-source {
margin-bottom: 5px;
}
.news-time {
color: #888;
}
.judgment-area, .thinking-area {
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 20px;
}
.judgment-result {
font-size: 1.1em;
line-height: 1.6;
}
.thinking-title {
font-size: 1.3em;
font-weight: bold;
margin-bottom: 15px;
color: #333;
}
.thinking-list {
list-style-type: none;
padding-left: 0;
margin-bottom: 0;
}
.thinking-list li {
margin-bottom: 12px;
padding-left: 20px;
position: relative;
line-height: 1.6;
}
.thinking-list li:before {
content: "•";
position: absolute;
left: 10px;
color: #333;
font-size: 1.2em;
}
.footer-controls {
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 30px;
gap: 15px;
}
.next-button {
padding: 14px 35px;
background-color: #fff;
color: #333;
text-decoration: none;
border-radius: 5px;
font-size: 1.2em;
font-weight: bold;
border: 2px solid #ccc;
cursor: pointer;
transition: all 0.3s ease;
}
.next-button:hover {
background-color: #f0f0f0;
border-color: #bbb;
}
.back-button {
padding: 14px 35px;
background-color: #6c757d;
color: white;
border: none;
border-radius: 5px;
font-size: 1.2em;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease;
}
.back-button:hover {
background-color: #545b62;
}
/* 提示信息样式 */
.notification {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background-color: #4CAF50;
color: white;
padding: 15px 25px;
border-radius: 5px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
z-index: 1000;
display: none;
font-weight: bold;
}
</style>
</head>
<body>
<!-- 提示信息 -->
<div class="notification" id="notification">
体验已完成!感谢您使用DeepTruth系统
</div>
<!-- 欢迎页面 -->
<div class="container welcome-page" id="welcomePage">
<div class="logo">
<img src="deeptruth.png" alt="DeepTruth Logo">
</div>
<h1>什么是DeepTruth?</h1>
<div class="intro-text">
<p><strong>DeepTruth是一款能够打击假新闻的系统。</strong></p>
<p><strong>它可以提供:</strong></p>
<ul class="features">
<li><span class="checkmark">✓</span> 分析在线新闻文章并检测假新闻</li>
<li><span class="checkmark">✓</span> 自动标记并移除社交媒体新闻源中的假新闻</li>
<li><span class="checkmark">✓</span> 自动标记并移除新闻聚合器中的假新闻</li>
</ul>
</div>
<p class="more-info">点击下面按钮了解更多:</p>
<a href="#" class="action-button" id="startButton">开始体验</a>
</div>
<!-- 新闻判断页面 -->
<div class="container judge-page" id="judgePage">
<div class="page-title">
<div class="logo-area">
<img src="deeptruth.png" alt="DeepTruth Logo">
</div>
</div>
<div class="judge-content">
<!-- 左侧:新闻信息 -->
<div class="left-panel">
<div class="news-number" id="newsNumber">新闻1</div>
<div class="news-image" id="newsImageContainer">
<!-- 图片将动态加载 -->
</div>
<div class="news-title" id="newsTitle">当太阳消失时,一块巨大的水晶将取而代之</div>
<div class="news-meta">
<div class="news-source" id="newsSource">Jill Kiedaisch</div>
<div class="news-time" id="newsTime">37分钟前</div>
</div>
</div>
<!-- 右侧:判断结果和思索过程 -->
<div class="right-panel">
<div class="judgment-area">
<div class="judgment-result" id="judgmentResult">DeepTruth判断它是正确的</div>
</div>
<div class="thinking-area">
<div class="thinking-title">思索过程如下:</div>
<ul class="thinking-list" id="thinkingList">
<li>首先,本文中的引用无法核实。</li>
<li>其次,这个新闻故事的内容与其他新闻来源不一致,故判断为假。</li>
</ul>
</div>
</div>
</div>
<!-- 按钮位于思索过程区域外面的右下角 -->
<div class="footer-controls">
<button class="back-button" id="backButton">返回首页</button>
<button class="next-button" id="nextButton">下一个</button>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// 页面元素
const welcomePage = document.getElementById('welcomePage');
const judgePage = document.getElementById('judgePage');
const startButton = document.getElementById('startButton');
const backButton = document.getElementById('backButton');
const nextButton = document.getElementById('nextButton');
const newsImageContainer = document.getElementById('newsImageContainer');
const notification = document.getElementById('notification');
// 新闻判断页面元素
const newsNumber = document.getElementById('newsNumber');
const newsTitle = document.getElementById('newsTitle');
const newsSource = document.getElementById('newsSource');
const newsTime = document.getElementById('newsTime');
const judgmentResult = document.getElementById('judgmentResult');
const thinkingList = document.getElementById('thinkingList');
// 所有新闻数据 - 不包含真假属性
const allNewsItems = [
{
id: 1,
title: "当太阳消失时,一块巨大的水晶将取而代之",
source: "Jill Kiedaisch",
time: "37分钟前",
image: "image1.png"
},
{
id: 2,
title: "科学家在南极洲发现特别的结构,可能正在改变全球气候",
source: "Lena Morozov",
time: "18分钟前",
image: "image2.png"
},
{
id: 3,
title: "\"只在你眨眼时发光\"的低能耗屏幕——科技公司开始测试",
source: "Clara Nguyen",
time: "27分钟前",
image: "image3.png"
},
{
id: 4,
title: "太空望远镜发现\"粉红色小行星\"",
source: "Jacob Harper",
time: "3小时前",
image: "image4.png"
},
{
id: 5,
title: "北极永久冻土加速解冻,释放温室气体量超预期40%",
source: "Liam O'Connor",
time: "6小时前",
image: "image5.png"
},
{
id: 6,
title: "新的基因技术——精准识别和攻击癌细胞",
source: "Claire Bennett",
time: "2小时前",
image: "image6.png"
},
{
id: 7,
title: "芬兰试点\"融合课堂\",学生创造力评估得分提升10%",
source: "Elina Koskinen",
time: "1天前",
image: "image7.png"
},
{
id: 8,
title: "新型环保材料——\"零碳混凝土\"",
source: "Lukas Müller",
time: "2天前",
image: "image8.png"
}
];
// 思索过程库 - 使用新的思索过程
const falseReasoning1 = [
"首先,本文中的引用无法核实。",
"其次,这个新闻故事的内容与其他新闻来源不一致,故判断为假。"
];
const falseReasoning2 = [
"首先,它的写作风格不坚持新闻写作的专业风格。",
"其次,在网上找不到关于作者的任何信息,故判断为假。"
];
const trueReasoning3 = [
"首先,作者是经过验证的专业新闻记者。",
"其次,该新闻内容与多家独立新闻媒体报道相一致,故判断为真。"
];
const trueReasoning4 = [
"首先,报道的事实与其他来源一致。",
"其次,这个URL链接到一个有信誉的、知名的新闻网站,故判断为真。"
];
let currentNewsIndex = 0;
let selectedNewsItems = [];
// 显示通知
function showNotification(message) {
notification.textContent = message;
notification.style.display = 'block';
setTimeout(() => {
notification.style.display = 'none';
}, 3000);
}
// 随机选择4篇新闻,并确保两真两假
function selectRandomNews() {
// 创建新闻副本,避免修改原始数据
const newsItemsCopy = allNewsItems.map(item => ({...item}));
// 随机打乱数组
shuffleArray(newsItemsCopy);
// 只取前4个
selectedNewsItems = newsItemsCopy.slice(0, 4);
// 为每个新闻随机分配真假,确保两真两假
const indices = [0, 1, 2, 3];
shuffleArray(indices);
// 创建思索过程数组并打乱顺序
const falseReasonings = [falseReasoning1, falseReasoning2];
const trueReasonings = [trueReasoning3, trueReasoning4];
shuffleArray(falseReasonings);
shuffleArray(trueReasonings);
// 前两个设为真,后两个设为假
for (let i = 0; i < 2; i++) {
selectedNewsItems[indices[i]].isTrue = true;
// 确保两个真新闻使用不同的思索过程
selectedNewsItems[indices[i]].reasoning = trueReasonings[i];
}
for (let i = 2; i < 4; i++) {
selectedNewsItems[indices[i]].isTrue = false;
// 确保两个假新闻使用不同的思索过程
selectedNewsItems[indices[i]].reasoning = falseReasonings[i-2];
}
console.log("本次体验的新闻真假分配:");
selectedNewsItems.forEach((news, index) => {
console.log(`新闻${index+1}: ${news.title} - ${news.isTrue ? '真' : '假'}`);
});
console.log("思索过程分配:");
selectedNewsItems.forEach((news, index) => {
console.log(`新闻${index+1}: ${news.isTrue ? '真' : '假'} - 思索过程: ${news.reasoning[0].substring(0, 20)}...`);
});
}
// 随机打乱数组
function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
// 更新新闻判断页面内容
function updateNewsContent() {
const news = selectedNewsItems[currentNewsIndex];
newsNumber.textContent = `新闻${currentNewsIndex + 1}`;
newsTitle.textContent = news.title;
newsSource.textContent = news.source;
newsTime.textContent = news.time;
judgmentResult.textContent = news.isTrue ?
"DeepTruth判断它是真实的" : "DeepTruth判断它是虚假的";
// 更新新闻图片
newsImageContainer.innerHTML = '';
const img = document.createElement('img');
img.src = news.image;
img.alt = "新闻图片";
img.style.maxWidth = "100%";
img.style.maxHeight = "100%";
img.style.objectFit = "cover";
// 添加图片加载失败的处理
img.onerror = function() {
this.src = "deeptruth.png"; // 如果图片加载失败,使用默认图片
this.alt = "图片加载失败";
};
newsImageContainer.appendChild(img);
// 清空并重新填充思索过程列表
thinkingList.innerHTML = '';
news.reasoning.forEach(reason => {
const li = document.createElement('li');
li.textContent = reason;
thinkingList.appendChild(li);
});
// 如果是最后一个新闻,更改按钮文本
if (currentNewsIndex === selectedNewsItems.length - 1) {
nextButton.textContent = "完成体验";
} else {
nextButton.textContent = "下一个";
}
}
// 开始体验按钮点击事件
startButton.addEventListener('click', function(e) {
e.preventDefault();
selectRandomNews();
currentNewsIndex = 0;
welcomePage.style.display = 'none';
judgePage.style.display = 'block';
updateNewsContent();
});
// 返回首页按钮点击事件
backButton.addEventListener('click', function() {
judgePage.style.display = 'none';
welcomePage.style.display = 'block';
});
// 下一个按钮点击事件
nextButton.addEventListener('click', function() {
if (currentNewsIndex < selectedNewsItems.length - 1) {
currentNewsIndex++;
updateNewsContent();
} else {
// 如果是最后一个新闻,显示通知并返回首页
showNotification("体验已完成!感谢您使用DeepTruth系统");
setTimeout(() => {
judgePage.style.display = 'none';
welcomePage.style.display = 'block';
}, 1000);
}
});
});
</script>
</body>
</html>