All tables sortable

Make all tables on any page sortable by converting them to dataTables

// ==UserScript==
// @name         All tables sortable
// @namespace	 https://greasyfork.org/ru/users/303426
// @version      1.1
// @description  Make all tables on any page sortable by converting them to dataTables
// @author       Титан
// @match        *://*/*
// @icon         data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iI2ZmZiIgY2xhc3M9ImJpIGJpLXRhYmxlIiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik0wIDJhMiAyIDAgMCAxIDItMmgxMmEyIDIgMCAwIDEgMiAydjEyYTIgMiAwIDAgMS0yIDJIMmEyIDIgMCAwIDEtMi0yVjJ6bTE1IDJoLTR2M2g0VjR6bTAgNGgtNHYzaDRWOHptMCA0aC00djNoM2ExIDEgMCAwIDAgMS0xdi0yem0tNSAzdi0zSDZ2M2g0em0tNSAwdi0zSDF2MmExIDEgMCAwIDAgMSAxaDN6bS00LTRoNFY4SDF2M3ptMC00aDRWNEgxdjN6bTUtM3YzaDRWNEg2em00IDRINnYzaDRWOHoiLz4KPC9zdmc+
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @grant       GM_registerMenuCommand
// @require https://cdn.jsdelivr.net/npm/[email protected]/js/jquery.dataTables.min.js
// @license MIT
// ==/UserScript==

(function() {
	'use strict';
	let autolaunch = false;

	function ConvertTables() {
		$('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">'); // add dataTAbles css

		try {
			$('table').DataTable({
				"paging": false,
			});
		} catch (e) {
			console.log("All tables sortable error: " + e);
		}
	}

	GM_registerMenuCommand('Convert Tables', () => {
		ConvertTables();
	});

	$(document).ready(function() {
		window.alert = (function() {  // suppress DataTables alert
			let nativeAlert = window.alert;
			return function(message) {
				//window.alert = nativeAlert;
				message.indexOf("DataTables warning") === 0 ?
					console.warn(message) :
					nativeAlert(message);
			}
		})();

		if (autolaunch) {
			ConvertTables();
		}

	});
})();