// ==UserScript== // @name "Search with Reddit / HN" on Google // @version 1.1 // @description Adds a button to search Reddit posts with Google (inspired from Mario Ortiz) // @author Mael Primet // @include http*://www.google.*/search* // @include http*://google.*/search* // @icon https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png // @license MIT // @run-at document-end // @namespace https://greasyfork.org/users/1366101 // @downloadURL none // ==/UserScript== const queryRegex = /q=[^&]+/g; const siteRegex = /\+site(?:%3A|\:).+\.[^&+]+/g; const sitePrefix = '+site%3A'; (function () { // Creating the 'Search on Reddit' button const container = document.createElement('div'); container.className = "search-btns-container"; const listDiv = document.createElement('div'); listDiv.className = "serach-btns-list"; container.appendChild(listDiv); // Insert the button after the .logo element const insertEl = document.querySelector('.main'); insertEl.parentNode.insertBefore(container, insertEl); // Add external CSS styling via