artefacts by ctsigma

shows artefacts on unit list

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
}