// ==UserScript== // @name Fix Gmail Email Search // @namespace https://github.com/gserafini/fix-gmail-email-search-userscript/ // @version 1.0 // @description Bring back the old "Emails" quick search functionality to Gmail, improved to not require hovering -- one click to view all emails you've sent or received from any address // @author Gabriel Serafini // @license MIT // @donate If you like this, PayPal a little love to gserafini@gmail.com // @screenshot https://github.com/gserafini/fix-gmail-email-search-userscript/raw/master/fix-gmail-email-search-screenshot.png // @match http://*/* // @grant none // @include *gmail.com/* // @include *mail.google.com/* // @require http://code.jquery.com/jquery-3.3.1.min.js // @downloadURL none // ==/UserScript== (function() { 'use strict'; $(function() { // Handler for .ready() called. function insert_email_search_icon() { $('.gD').not('.email_search_icon+.gD') .each( function (index) { console.log("Found email for possible searching: " + $(this).attr('email')); $(this) .before('
') } ); } // Run every 1 seconds... // Not quite sure how to only fire when Gmail updates the interface / inserts new divs or if there's a better way to do this setInterval(insert_email_search_icon, 1000); $('body').on('click', '.email_search_icon', function() { event.stopPropagation(); $('input[name="q"]').val($(this).attr('email')); $('button.gb_ff.gb_gf').click(); console.log("Search icon clicked! Searching for " + $(this).attr('email') + "..."); }); }); })();