Created
January 2, 2018 14:23
-
-
Save mityukov/95c8377b2595ff8091239f1eb899665d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Search site with google | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Kotique | |
// @match *food4vita.ru* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var searchField = document.getElementById('searchfrm'); | |
searchField.addEventListener('keypress', function (event) { | |
if (event.keyCode !== 13) { return; } | |
var redirectUrl = 'https://www.google.com/search?q=' + encodeURIComponent(event.target.value) + ' site:food4vita.ru'; | |
console.log(redirectUrl); | |
window.location.href = redirectUrl; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment