沙盒:修订间差异
外观
无编辑摘要 标签:手工回退 |
无编辑摘要 标签:已被回退 |
||
| 第1行: | 第1行: | ||
{{沙盒}} | {{沙盒}} | ||
<span id="glitch-text">简中Robloxian Wiki</span> | |||
<script type="text/javascript"> | |||
$(function() { | |||
const element = document.getElementById('glitch-text'); | |||
const originalText = element.textContent; | |||
const chars = '!@#$%^&*()_+-=[]{}|;:,.<>?/~`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |||
let interval; | |||
function glitch() { | |||
let iteration = 0; | |||
clearInterval(interval); | |||
interval = setInterval(() => { | |||
element.textContent = originalText | |||
.split('') | |||
.map((char, index) => { | |||
if (index < iteration) { | |||
return originalText[index]; | |||
} | |||
return chars[Math.floor(Math.random() * chars.length)]; | |||
}) | |||
.join(''); | |||
if (iteration >= originalText.length) { | |||
clearInterval(interval); | |||
// 2秒后再次触发乱码 | |||
setTimeout(glitch, 2000); | |||
} | |||
iteration += 1 / 3; | |||
}, 30); | |||
} | |||
// 页面加载完成后开始 | |||
glitch(); | |||
}); | |||
</script> | |||
2026年4月28日 (二) 17:32的版本
这是沙盒页面,随意测试编辑。
离开时请清空此页面。
简中Robloxian Wiki
<script type="text/javascript"> $(function() {
const element = document.getElementById('glitch-text');
const originalText = element.textContent;
const chars = '!@#$%^&*()_+-=[]{}|;:,.<>?/~`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
let interval;
function glitch() {
let iteration = 0;
clearInterval(interval);
interval = setInterval(() => {
element.textContent = originalText
.split()
.map((char, index) => {
if (index < iteration) {
return originalText[index];
}
return chars[Math.floor(Math.random() * chars.length)];
})
.join();
if (iteration >= originalText.length) {
clearInterval(interval);
// 2秒后再次触发乱码
setTimeout(glitch, 2000);
}
iteration += 1 / 3;
}, 30);
}
// 页面加载完成后开始 glitch();
}); </script>