二次元小姐姐(引用看板娘)!
// ==UserScript==
// @name 所有网页添加二次元小姐姐(看板娘)
// @namespace http://tampermonkey.net/
// @version 1.0.1
// @description 二次元小姐姐(引用看板娘)!
// @author ziran
// @match https://juejin.cn/*
// @match https://www.baidu.com/*
// @match https://*/*
// @icon https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fup.enterdesk.com%2Fedpic%2Fb2%2Ffc%2F5d%2Fb2fc5d85ad14ccaf2e7a2cd2632d842c.jpg&refer=http%3A%2F%2Fup.enterdesk.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1645173435&t=116608116a9249ddac16a37973d07162
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
// 注意:live2d_path 参数应使用绝对路径
const live2d_path = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/";
//const live2d_path = "/live2d-widget/";
// 封装异步加载资源的方法
function loadExternalResource(url, type) {
return new Promise((resolve, reject) => {
let tag;
if (type === "css") {
tag = document.createElement("link");
tag.rel = "stylesheet";
tag.href = url;
}
else if (type === "js") {
tag = document.createElement("script");
tag.src = url;
}
if (tag) {
tag.onload = () => resolve(url);
tag.onerror = () => reject(url);
document.head.appendChild(tag);
}
});
}
// 加载 waifu.css live2d.min.js waifu-tips.js
if (screen.width >= 768) {
Promise.all([
loadExternalResource(live2d_path + "waifu.css", "css"),
loadExternalResource(live2d_path + "live2d.min.js", "js"),
loadExternalResource(live2d_path + "waifu-tips.js", "js")
]).then(() => {
initWidget({
waifuPath: live2d_path + "waifu-tips.json",
//apiPath: "https://live2d.fghrsh.net/api/",
cdnPath: "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api/"
});
});
}
// 让人物在右边
let styleConfig = `
#waifu{left:100% !important;transform:translateX(-100%) !important}
#waifu:hover{transform:translateX(-100%) !important}
`
GM_addStyle(styleConfig)
})();