artefacts by ctsigma

shows artefacts on unit list

当前为 2018-04-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        artefacts by ctsigma
// @namespace   virtonomica
// @include     https://*virtonomic*.*/*/main/company/view/*/unit_list
// @description shows artefacts on unit list
// @version     1.01
// @author      ctsigma
// @grant       none
// ==/UserScript==
var run = function () {
    var win = (typeof (unsafeWindow) != 'undefined' ? unsafeWindow : top.window);
    var $ = win.$;
    var art = $('<img style="cursor:pointer;vertical-align:middle;" width="32" src="/img/artefact/icons/color/other.gif" title="инновации">').click(function () {artefacts()});
    $('img[src="/img/icon/unit_build.png"]').parents('td').prepend(art);

    function artefacts() {
        $('.info.i-lab').each(function(){
            var url = $('a',this).attr('href');
            var art = [];
            $.ajax({
                type: 'GET',
                url: url,
                async: false,
                success: function (data) {$('.artf_slots img',data).each(function(){art[art.length] = $(this);})}
            });
            var alerts = $(this).nextAll('.alerts');
            art.forEach(function(o){alerts.append(o.attr('width',24));})
        })}
}
if (window.top == window) {
    var script = document.createElement('script');
    script.textContent = '(' + run.toString() + ')();';
    document.documentElement.appendChild(script);
}