rek655869 / Проверка должностей

// ==UserScript==
// @name Проверка должностей
// @author rek655
// @license MIT
// @version 1.0
// @include https://catwar.su/blog*
// @grant        GM_xmlhttpRequest
// @grant        GM.xmlHttpRequest
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// ==/UserScript==
(function (window, document, $) {
  'use strict';

	if (typeof $ === 'undefined') return;

	if (/https:\/\/catwar.su\/blogs\?creation=/.test(window.location.href)) {
  		$(document).ready(
      		setTimeout(function() {
      			$('#creation_form').append('<input type="button" id = "check_id" value="Проверить ID" />');

				$('#check_id').on('click', function() {
	      			var code = $("#creation-text").text();
	      			var results = code.match(/(link|cat)[0-9]+/gm);
	  				var ids = results.map(function(result) {
						return result.replace(/cat|link/, '');
					});
					var deleted = '';
					var string = '';
					var exit = '';
					if (ids) {
						$.each(ids, function(index, id) {
							$.ajax({
								type: "GET",
								url: "cat"+id,
								contentType: "application/json; charset=utf-8",
								async: false,
								success: function(data) {
									let name = data.match(/<big>[А-яё ]+<\/big>/);
									if (name == undefined) {
										deleted += id + ' ';
									} else {
										name = name.toString().replace(/[<big>\/]+/g, '');
										let position = data.match(/<i>[А-яё ]+<\/i>/);
										if (position == undefined) {
											exit += id + ' ';
										} else {
											position = position.toString().replace(/[<i>\/]+/g, '');
											string += id+' '+name+' '+position+'<br>'
										}
									}
								}
							})
						})
						console.log(string);
						$('#creation_form').append('<p>'+string+'<br>Удалены или не в племени/клане: '+deleted+' '+exit+'</p>');
					};
				});	
      		}, 1000)
    );
  }
})(window, document, jQuery);