注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
?_=1
来访问最新页面。https://zh.moegirl.org.cn/User:%E6%9C%BA%E6%99%BA%E7%9A%84%E5%B0%8F%E9%B1%BC%E5%90%9B/moeskin.js?_=1
/**
* 添加背景视频
* just for fun
*/
;(function () {
const windowWidth = document.documentElement.clientWidth
if (windowWidth < 768) {
return // EARLY RETURNING
}
var VIDEO_LIST = [
'https://r2.epb.wiki/videos/steam_ad5fa9597db193112408fe0e058c3ce8b07bd7e2.mp4',
'https://r2.epb.wiki/videos/steam_b3d43fe9bba52b7fb930dd8c306230e35870602e.mp4',
'https://r2.epb.wiki/videos/steam_1e12a183139d56d904ec334bd8e8c07b386d6a48.mp4',
'https://r2.epb.wiki/videos/wallpaper_2265394105.mp4',
'https://r2.epb.wiki/videos/wallpaper_2653049950.mp4',
]
// 创建画布
var bg = document.createElement('div')
bg.id = 'custom-video-background'
bg.style.position = 'fixed'
bg.style.top = '0'
bg.style.left = '0'
bg.style.width = '100%'
bg.style.height = '100%'
bg.style.zIndex = '0'
bg.style.userSelect = 'none'
bg.style.display = 'none'
// 读取视频
var video = document.createElement('video')
video.src = randomPick(VIDEO_LIST)
video.autoplay = true
video.loop = true
video.muted = true
video.style.width = '100%'
video.style.height = '100%'
video.style.objectFit = 'cover'
video.disablePictureInPicture = true
video.disableRemotePlayback = true
bg.appendChild(video)
bg.addEventListener('click', function () {
video.src = randomPick(VIDEO_LIST, video.src)
video.play()
})
/**
* @param {Event} ev
*/
function firstInit(ev) {
var oldBackground = document.querySelector('#moe-global-background')
if (oldBackground) {
oldBackground.after(bg)
$(oldBackground).fadeOut(450)
} else {
document.body.appendChild(bg)
}
$(bg).fadeIn(250)
ev.target.removeEventListener('canplay', firstInit)
}
video.play()
video.addEventListener('canplay', firstInit)
})()
/**
* @template T
* @param {T[]} arr
* @param {T|undefined} current
* @returns {T}
*/
function randomPick(arr, current) {
if (!Array.isArray(arr)) {
throw new TypeError('arr must be an array, but got ' + typeof arr)
}
var list = arr.filter(function (v) {
return v !== current
})
return list[Math.floor(Math.random() * list.length)]
}