本WIKI于2021年03月04日通过了时雨音的接管申请,编辑权限开放。

欢迎收藏本WIKI防止迷路,也希望有爱的小伙伴和我们一起编辑哟~

建议使用PC版页面访问本WIKI以获得更佳体验!

编辑帮助WIKI建议加入我们使用哔哩哔哩APP打开WIKI

全站通知:

用户:646195980/Mascot.js

来自坎特伯雷公主与骑士唤醒冠军之剑的奇幻冒险WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
  • Opera:Ctrl-F5
/**
 * Mascot.js | Inspiration comes from https://wiki.biligame.com/gt/?curid=7044
 * Author: 飞小RAN (https://wiki.biligame.com/gt/User:646195980)
 * License: See https://wiki.biligame.com/gt/User:646195980#License
 **/
(function() {
    'use strict';
    // 极端环境加载不出mw函数所以使用RLCONF,如使用mw.loader.load则可以选用mw.config.get(标准调用)
    //var RLCONF = window.RLCONF;
    //var wg = RLCONF.wgAction;
    var mw = window.mw;
    var wg = mw.config.get('wgAction');
    if (wg === "view") {
        //window.AnimeChara = [];
        let a = [...document.querySelectorAll('.animechara')].at(-1);
        a.style.display = "";
        let i = 0;
        a.querySelectorAll('p').forEach(p => {
            const div = document.createElement('div');
            div.className = 'chara';
            div.dataset.id = i;
            div.style.background = `url("${p.querySelector('a').getAttribute('href')}") no-repeat`;
            if (i === 0) div.dataset.show = "on";
            a.replaceChild(div, p);
            i++;
        });
        if (a.dataset.type === "hero") {
            a.addEventListener('click', e => {
                if (!a.querySelector('.charamessage')) {
                    const n = document.createElement('span');
                    n.className = 'charamessage';
                    n.textContent = window.AnimeChara[Math.floor(Math.random() * window.AnimeChara.length)];
                    a.appendChild(n);
                    setTimeout(()=>{n.remove()}, 3000);
                }
            });
        } else {
            window.AnimeChara = [
                "今天也要开开心心的呀,我亲爱的守护者~!",
                "嘿嘿,这个奖杯是我送给你哒!以后也要继续加油哦!",
                "坎特伯雷交通组提醒您,请认真遵守社区规则哦~!",
                "在任何时候,都绝对不能松懈!一定要保护好我哦,明白了吗~?",
                "守护者守护者,你看到我的坐骑了嘛?它可是很凶的哦,嗷呜~!",
                "诶?我为什么变小了?……不过也正好,这样就可以一根鸡腿吃好几天啦~!",
                "好合适的衣服啊!嘿嘿,我看起来还漂亮嘛?觉得漂亮的话就多夸夸我吧!",
                "我给你准备了一份超~级超级豪华的礼物,希望你能高兴起来!",
                "不~给~鸡~腿~就~捣~蛋!嘎哦!",
                "过年啦~!新的一年也要开开心心哦~!",
                "咳咳!我是坎特伯雷王国的公……不、不对,是神秘人!今天一定要认真工作哦,听到了嘛~?"
            ];
            let ii = 0;
            let ie = 0;
            a.addEventListener('click', e => {
                if (!a.querySelector('.charamessage')) {
                    if (ie === 1) {
                        a.querySelectorAll('.chara').forEach(p => {
                            p.dataset.show = "off";
                        });
                        a.querySelector(`.chara[data-id="${ii}"]`).dataset.show = "on";
                    }
                    const n = document.createElement('span');
                    n.className = 'charamessage';
                    n.textContent = window.AnimeChara[ii];
                    a.appendChild(n);
                    ii = Math.floor(Math.random() * window.AnimeChara.length);
                    ie = 1;
                    setTimeout(()=>{n.remove()}, 3000);
                }
            });
        }
        a.querySelector('#closeanimechara').addEventListener('click', e => {
            a.remove();
        });
        document.body.appendChild(a);
    }
})();