CW: Replacements

Перестановка блоков

当前为 2024-08-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         CW: Replacements
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Перестановка блоков
// @copyright    2021, Тис (https://catwar.su/cat930302)
// @license      MIT; https://opensource.org/licenses/MIT
// @include      /https:\/\/\w?\.?catwar\.su\/.*/
// @icon         https://www.google.com/s2/favicons?domain=catwar.su
// @grant        GM_xmlhttpRequest
// @grant        GM.xmlHttpRequest
// ==/UserScript==
/*global jQuery*/
(function (window, document, $) {
    'use strict';
    if (typeof $ === 'undefined') return;
    const version = '0.1';
    const isDesktop = !$('meta[name=viewport]').length;
    // const MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
    const pageurl = window.location.href;
    const isCW3 = (/^https:\/\/\w*\.?catwar.su\/cw3(?!(\/kns|\/jagd))/.test(pageurl));
    try {
        if (isCW3) cw3();
    }
    catch (err) {
        window.console.error('CW:Replacements error: ', err);
    }
    function cw3() {
        if (isDesktop) {
            $('head').append(`<style id="cwr">.cwr_infos { padding: 0 .75em; }</style>`);
            $('#info_main > tbody').append('<tr id="cwr_history_tr"></tr>');

            var $hist_tr = $('#cwr_history_tr'),
                $history = $('#history').attr('colspan', 2);
            $hist_tr.append($history);
            $('#info_main .infos').not('#parameter').removeClass('infos').addClass('cwr_infos');

            $history.children('h2').attr('align', 'center');
            $history.children('#history_block').attr('align', 'justify');
        }
    }
    // Your code here...
})(window, document, jQuery);