forked from RDCNWebs/rd.rdlevel.cn
- 修复了一些死链
- 添加了新的 otto 插图(没错作者又更了)并修改了更换逻辑
This commit is contained in:
+12
-20
@@ -4,6 +4,13 @@ var isHidingTips = false;
|
||||
var show = true;
|
||||
var anim;
|
||||
var tipTexts = [""];
|
||||
var ottos = [
|
||||
"/images/otto-wyym.png",
|
||||
"/images/otto-rd2.png",
|
||||
"/images/otto-rd2-xmas-compressed.png",
|
||||
"/images/otto-traditional.png",
|
||||
]
|
||||
var ottoIndex = 0;
|
||||
|
||||
function showOtto(callback) {
|
||||
node.style.opacity = 1;
|
||||
@@ -38,26 +45,18 @@ window.onload = function () {
|
||||
showOtto()
|
||||
}
|
||||
|
||||
window.$docsify.onLightDarkModeChange = function () {
|
||||
if (show) {
|
||||
if (anim.playState != "running")
|
||||
hideOtto(() => {
|
||||
image.src = getCurrentImage();
|
||||
showOtto();
|
||||
});
|
||||
}
|
||||
else
|
||||
image.src = getCurrentImage();
|
||||
}
|
||||
|
||||
window.$docsify.onOttoShow = function () {
|
||||
if (!anim.playState || anim.playState != "finished") {
|
||||
return;
|
||||
}
|
||||
show = !show;
|
||||
if (show) {
|
||||
image.src = getCurrentImage();
|
||||
showOtto();
|
||||
} else {
|
||||
hideOtto();
|
||||
ottoIndex++;
|
||||
}
|
||||
}
|
||||
function addOtto(document) {
|
||||
@@ -120,13 +119,6 @@ function randomTips() {
|
||||
}
|
||||
|
||||
function getCurrentImage() {
|
||||
currentImageIndex = window.$docsify.currentThemeModeIndex;
|
||||
switch (currentImageIndex) {
|
||||
case 0: //light
|
||||
return "/images/otto-rd2.png";
|
||||
case 1: //dark
|
||||
return "/images/otto-rd2-xmas-compressed.png";
|
||||
case 2: //default
|
||||
return "/images/otto-wyym.png";
|
||||
}
|
||||
ottoIndex = (ottoIndex) % ottos.length;
|
||||
return ottos[ottoIndex];
|
||||
}
|
||||
Reference in New Issue
Block a user