Skip to content

Commit 01e7e98

Browse files
Add(content && autoScroll)
1 parent 8b7194e commit 01e7e98

File tree

1 file changed

+113
-26
lines changed

1 file changed

+113
-26
lines changed

public/text.html

Lines changed: 113 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,84 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Document</title>
88
<style>
9+
* {
10+
margin: 0;
11+
padding: 0;
12+
box-sizing: border-box;
13+
}
14+
15+
html,
16+
body {
17+
width: 100%;
18+
height: 100%;
19+
overflow-y: auto;
20+
overflow-x: hidden;
21+
}
22+
923
body {
1024
color: #bfb;
1125
text-shadow: 0 0 2px #fff, 0 0 6px #fff, 0 0 15px #00a67c;
1226
filter: drop-shadow(0 0 2px #00a67c);
27+
padding: 15px 20px;
28+
font-size: 16px;
29+
line-height: 1.6;
1330
}
14-
31+
32+
#text {
33+
width: 100%;
34+
height: 100%;
35+
}
36+
37+
#text li {
38+
list-style: none;
39+
margin-bottom: 15px;
40+
line-height: 1.7;
41+
font-size: 16px;
42+
}
43+
44+
#text li span:first-child {
45+
display: inline-block;
46+
min-width: 70px;
47+
margin-right: 12px;
48+
font-size: 17px;
49+
font-weight: bold;
50+
color: #0f7;
51+
}
52+
53+
#text li span:last-child {
54+
font-size: 15px;
55+
}
56+
57+
#text div {
58+
margin-bottom: 15px;
59+
line-height: 1.7;
60+
font-size: 16px;
61+
}
62+
63+
#text h1 {
64+
margin: 25px 0 20px 0;
65+
font-size: 28px;
66+
}
67+
1568
button {
1669
background-color: #00a67c;
1770
color: #bfb;
1871
text-shadow: 0 0 2px #fff, 0 0 6px #fff, 0 0 15px #00a67c;
1972
outline: none;
2073
border: none;
2174
border-radius: 4px;
75+
padding: 10px 18px;
76+
font-size: 15px;
77+
}
78+
79+
/* 隐藏滚动条 */
80+
body::-webkit-scrollbar {
81+
display: none;
82+
}
83+
84+
body {
85+
-ms-overflow-style: none; /* IE and Edge */
86+
scrollbar-width: none; /* Firefox */
2287
}
2388
</style>
2489
</head>
@@ -28,33 +93,53 @@
2893
<script src="https://unpkg.com/typeit@8.6.0/dist/index.umd.js"></script>
2994
<script>
3095
let hash = window.parent?.location?.hash?.split("#")?.[1];
31-
// let hash = location?.hash?.split("#")?.[1];
32-
// 基本加密方式
33-
// const encode = (name) => {
34-
// hash = [...encodeURI(name)].map((c) => c.charCodeAt(0) ^ "lec").join("&");
35-
// return hash;
36-
// };
37-
let time
38-
const handleClick = () => {
39-
alert(1);
40-
};
41-
96+
console.log(hash)
97+
let time;
98+
4299
const decode = () => {
43-
const hashList = hash?.split('/')
44-
time = hashList[1]
45-
hash = hashList[2]
100+
const hashList = hash?.split("/");
101+
console.log(hashList)
102+
time = hashList[1];
103+
hash = hashList[2];
104+
console.log(hash)
46105
const arr = hash?.split("&")?.map((c) => +c ^ "lec");
47106
const text = String.fromCharCode(...arr);
48-
hash = decodeURI(text);
107+
hash = text
49108
return hash;
50109
};
110+
51111
const res = decode();
52112

113+
console.log('year:')
114+
console.log('name:',res)
115+
116+
// 改进的自动滚动函数
117+
const scrollToBottom = () => {
118+
requestAnimationFrame(() => {
119+
const body = document.body;
120+
const html = document.documentElement;
121+
122+
// 尝试所有可能的滚动方式
123+
body.scrollTop = body.scrollHeight;
124+
html.scrollTop = html.scrollHeight;
125+
window.scrollTo(0, document.body.scrollHeight);
126+
127+
// 使用 scrollIntoView
128+
const textElement = document.getElementById('text');
129+
if (textElement && textElement.lastElementChild) {
130+
textElement.lastElementChild.scrollIntoView({
131+
behavior: 'smooth',
132+
block: 'nearest'
133+
});
134+
}
135+
});
136+
};
137+
53138
if (hash) {
54-
console.log(1);
55139
new TypeIt("#text", {
56140
speed: 50,
57141
startDelay: 900,
142+
afterStep: scrollToBottom, // 每步后滚动
58143
})
59144
.type(
60145
`<li>
@@ -129,6 +214,8 @@
129214
<span>OpenAI 发布 GPT-2,大模型时代的前夜到来</span>
130215
</li>
131216
217+
<li><span>2024</span><span>开源大模型爆发式增长,Llama 3、Qwen 等系列模型推动 AI 技术普惠化</span></li>
218+
132219
`,
133220
{ delay: 100 }
134221
)
@@ -170,13 +257,13 @@
170257
{ delay: 800 }
171258
)
172259
.go();
173-
} else {
174-
new TypeIt("#text", {
175-
speed: 50,
176-
startDelay: 900,
177-
})
178-
.type(`ERROR: INVADED BY SOMEONE UNKNOWN!`, { delay: 100 })
179-
.go();
180-
}
181-
</script>
260+
} else {
261+
new TypeIt("#text", {
262+
speed: 50,
263+
startDelay: 900,
264+
})
265+
.type(`ERROR: INVADED BY SOMEONE UNKNOWN!`, { delay: 100 })
266+
.go();
267+
}
268+
</script>
182269
</html>

0 commit comments

Comments
 (0)