CW: Replacements

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

  1. // ==UserScript==
  2. // @name CW: Replacements
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Перестановка блоков
  6. // @copyright 2021, Тис (https://catwar.su/cat930302)
  7. // @license MIT; https://opensource.org/licenses/MIT
  8. // @include /https:\/\/\w?\.?catwar\.su\/.*/
  9. // @icon https://www.google.com/s2/favicons?domain=catwar.su
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM.xmlHttpRequest
  12. // ==/UserScript==
  13. /*global jQuery*/
  14. (function (window, document, $) {
  15. 'use strict';
  16. if (typeof $ === 'undefined') return;
  17. const version = '0.1';
  18. const isDesktop = !$('meta[name=viewport]').length;
  19. // const MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
  20. const pageurl = window.location.href;
  21. const isCW3 = (/^https:\/\/\w*\.?catwar.su\/cw3(?!(\/kns|\/jagd))/.test(pageurl));
  22. try {
  23. if (isCW3) cw3();
  24. }
  25. catch (err) {
  26. window.console.error('CW:Replacements error: ', err);
  27. }
  28. function cw3() {
  29. if (isDesktop) {
  30. $('head').append(`<style id="cwr">.cwr_infos { padding: 0 .75em; }</style>`);
  31. $('#info_main > tbody').append('<tr id="cwr_history_tr"></tr>');
  32.  
  33. var $hist_tr = $('#cwr_history_tr'),
  34. $history = $('#history').attr('colspan', 2);
  35. $hist_tr.append($history);
  36. $('#info_main .infos').not('#parameter').removeClass('infos').addClass('cwr_infos');
  37.  
  38. $history.children('h2').attr('align', 'center');
  39. $history.children('#history_block').attr('align', 'justify');
  40. }
  41. }
  42. // Your code here...
  43. })(window, document, jQuery);