免责声明
本插件无任何实际用途,仅做整活使用。
本插件保证不存在恶意代码,实现的功能仅为给洛谷首页添加一个启动动画效果。
介绍
一个简单的窜改猴插件,安装完之后每次你打开洛谷首页都会显示一段启动动画,包括:显示洛谷 logo、显示《健康刷题忠告》。具体效果请各位用户自行尝试。
最关键的一点来了,你也可以自己 DIY 你想展示的 logo!只需把你的图片链接替换到下面的源代码中的注释处即可。
另附:动画的具体组成
| 时间(秒) | 动画内容 |
|---|---|
| 0~1 | 纯白背景 |
| 1~3 | logo 淡入 |
| 3~6 | logo 持续显示 |
| 6~8 | logo 淡出 |
| 8~10 | 《健康刷题忠告》淡入 |
| 10~13 | 《健康刷题忠告》持续显示 |
| 13~15 | 《健康刷题忠告》淡出 |
| 15~17 | 纯白背景淡出 |
安装方法
安装此插件前,建议给自己的电脑安装汉仪文黑-85W Heavy字体以获得最佳效果。
直接复制下面的源代码然后去窜改猴安装即可。如何使用窜改猴安装插件请用户自行上网搜索。
这里是源代码
// ==UserScript==
// @name 洛谷启动界面效果
// @version 1.0
// @description 在打开洛谷首页时,依次显示logo和“健康刷题忠告”的动画界面。
// @match https://www.luogu.com.cn/
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const css = `
@font-face {
font-family: 'HYWenHei';
src: local('汉仪文黑-85W Heavy'),
url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@700;900&display=swap');
font-weight: 900;
font-style: normal;
}
#ovl {
position: fixed; top: 0; left: 0;
width: 100vw; height: 100vh;
background-color: white; z-index: 99999999;
display: flex; justify-content: center; align-items: center;
opacity: 1; transition: opacity 2s ease-in-out;
font-family: 'HYWenHei', 'Microsoft YaHei', sans-serif;
color: black;
}
#img {
position: absolute; opacity: 0;
transition: opacity 2s ease-in-out;
max-width: 80vw; max-height: 80vh;
}
#ovl .txt {
position: absolute; text-align: center; line-height: 2;
opacity: 0; transition: opacity 2s ease-in-out;
}
#ovl h1 { font-size: 32px; margin-bottom: 20px; }
#ovl p { font-size: 24px; margin: 10px 0; }
#ovl .tip {
position: absolute; bottom: 20px; left: 20px;
font-size: 16px; opacity: 0;
transition: opacity 2s ease-in-out;
}
`;
// TODO : 将图片地址替换进下面的src=""中并调整为合适的大小(width为宽,height为高)
const html = `
<img id="img" src="https://fecdn.luogu.com.cn/luogu/logo.png" width="257" height="131">
<div class="txt">
<h1>健康刷题忠告</h1>
<p>抵制不良水题,拒绝盗版水题。</p>
<p>注意自我保护,谨防受骗上当。</p>
<p>适度水题益脑,沉迷水题伤身。</p>
<p>合理安排时间,享受健康生活。</p>
</div>
`;
GM_addStyle(css);
const ovl = document.createElement('div');
ovl.id = 'ovl';
ovl.innerHTML = html;
document.documentElement.appendChild(ovl);
const img = ovl.querySelector('#img');
const txt = ovl.querySelector('.txt');
const tip = ovl.querySelector('.tip');
setTimeout(() => {
if (img) img.style.opacity = '1';
if (tip) tip.style.opacity = '1';
}, 1000);
setTimeout(() => {
if (img) img.style.opacity = '0';
if (tip) tip.style.opacity = '0';
}, 6000);
setTimeout(() => { if (txt) txt.style.opacity = '1'; }, 8000);
setTimeout(() => { if (txt) txt.style.opacity = '0'; }, 13000);
setTimeout(() => {
ovl.style.pointerEvents = 'none';
ovl.style.opacity = '0';
}, 15000);
setTimeout(() => { ovl.remove(); }, 17000);
})();