Greasy Fork

来自缓存

Greasy Fork is available in English.

其乐勋章美化

勋章美化

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         其乐勋章美化
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  勋章美化
// @author       楪蘭楓
// @match        *://*keylol.com/*
// @require      http://cdn.staticfile.org/jquery/3.1.1/jquery.min.js
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    // 用户id
    var uid = "804115";
    // 勋章图片地址
    var img1_url = "https://pic.imgdb.cn/item/5efdcad714195aa59495fb15.jpg";
    var img2_url = "";

    var height = 0;
    var img1 = new Image();
    img1.src = img1_url;
    var img2 = new Image();
    img2.src = img2_url;

    function addNewStyle(newStyle) {
        var styleElement = document.getElementById('styles_js');
        if (!styleElement) {
            styleElement = document.createElement('style');
            styleElement.type = 'text/css';
            styleElement.id = 'styles_js';
            document.getElementsByTagName('head')[0].appendChild(styleElement);
        }
        styleElement.appendChild(document.createTextNode(newStyle));
    }

    setTimeout(function() {
        if (img1.width > 0) {
            height += img1.height / img1.width * 180;
        }
        if (img2.width > 0) {
            height += img2.height / img2.width * 180;
        }
        addNewStyle('.medal{height: ' + height + 'px !important;}');
        addNewStyle('.medal img:nth-child(1){content: url(' + img1_url + ');max-width: 180px;}');
        addNewStyle('.medal img:nth-child(2){content: url(' + img2_url + ');max-width: 180px;}');
        addNewStyle('.楪蘭楓 img{content: url(https://pic.imgdb.cn/item/5f0c5fba14195aa5948927a8.png);max-width: 180px;}');
        addNewStyle('.kazekyu img{content: url(https://pic.imgdb.cn/item/5f05b0b814195aa594144d6b.png);max-width: 180px;}');
        addNewStyle('.benaresguw img:nth-child(1){content: url(https://blob.keylol.com/forum/202010/28/234439rhqjkv2t2wkrev4b.jpg);max-width: 180px;}');
    },500);

    setInterval(function() {
        $('[href=suid-' + uid + '].avtm').parent().parent().next().next().next().next().next().addClass('medal');
        $('[href=suid-804115].avtm').parent().parent().next().next().next().addClass('楪蘭楓');
        $('[href=suid-1285681].avtm').parent().parent().next().next().next().addClass('kazekyu');
        $('[href=suid-279184].avtm').parent().parent().next().next().next().next().next().addClass('benaresguw');
    },1000);
})();