Brian Davis
Brian Davis

Reputation: 229

Trying to modify Google's search textbox with Greasemonkey

I happened to discover yesterday that when typing search text in Google that my search history has suddenly stopped showing. I use the https://www.google.com/webhp?complete=0 url to prevent the auto suggestions from appearing. That used to work great, but now Google has done something to prevent that from working.

I use Firefox and have Greasemonkey installed. I have had interest in learning to script in Greasemonkey, and this seems to be an opportune time to start learning. Does anyone have any examples of changing the search input form on Google to a different style so that the search history can be viewed? I've searched around and have found examples of text box modifications, but they don't work with the particular style of input box that Google uses.

TIA,
Brian

Upvotes: 0

Views: 434

Answers (2)

Brian Davis
Brian Davis

Reputation: 229

I've tried the code that RozzA provided, and it works so long as you click out of the text area and then click back into the text area. I made the following mods to it, and they seem to have fixed the problem:

function doIt() {
    document.getElementById("lst-ib").autocomplete = "on";
    document.getElementById("lst-ib").blur(); // disable focus
    document.getElementById("lst-ib").focus(); // re-enable focus

    // looping does not seem to be necessary.
    // window.setTimeout(doIt, 5000);
}


window.setTimeout(doIt, 500);       // wait half a second and apply changes.

Upvotes: 1

RozzA
RozzA

Reputation: 609

// ==UserScript==
// @name            re enable autocomplete
// @namespace       http://gcomplete.user.js
// @description     
// @include         htt*://*.google.com/webhp?complete=0
// ==/UserScript==
////////////////////////////////////////////////

    function doIt(){
        document.getElementById("lst-ib").autocomplete = "on";
        window.setTimeout(doIt, 5000);  // wait 5 sec and reapply changes, looped.
    }
    window.setTimeout(doIt, 500);       // wait half a second and apply changes.

this may not be the exact code you need but it should be pretty close.
i chose the loop because i'm lazy and because the textbox seems to be destroyed and recreated at least once.
"lst-ib" is the id of the text box you want, and it has the property 'autocomplete' which google helpfully sets to "off"

Upvotes: 1

Related Questions