NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Insert ERPID to search input // @version 0.1 // @match https://proverki.gov.ru/portal/public-search?erpid=* // @licence MIT // ==/UserScript== (function() { 'use strict'; function get_param(name){ if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search)) { return decodeURIComponent(name[1]); } } var searchInput = document.querySelector('input[name=searchString]'); if (!searchInput) { return; } searchInput.setAttribute('value', get_param('erpid')); var event = new Event('input', { bubbles: true}); event.simulated = true; searchInput.dispatchEvent(event); var clickEvent = document.createEvent("MouseEvents"); clickEvent.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); var searchButton = document.querySelector('button[class*="Search"]'); searchButton.dispatchEvent(clickEvent); })();