This is a greasemonkey question.
What I'm trying to do is modify an old google discussions script.
What were wanting to do is be able to take the google search query and add modifiers to the end of it.
Like this:
search query: "superuser"
modifiers: inurl:greasemonkey+question
end result: "superuser" inurl:greasemonkey+question
The old script creates a new div within the "hdtb_more_mn" element which is where you get the new discussions tab.
However, since the "tbm=dsc" option to do a discussion search has died, this script no longer works.
Hence the need to add modifiers to your searches.
I tried to edit the script, but it appends the modifiers to the end of the url which includes "&client=firefox-a&hs=8uS&rls=org.mozilla:en-US:official". This means you're also searching for the above as well as your query, which doesn't work.
I would like to be able to append the modifiers @ the end of the search querty, rather than the whole URL.
I'm just not sure how to code it to where it adds the below "&tbm=" stuff within "discussionDiv.innerHTML" to the end of the query.
The google search id seems to be, "gbqfq" for the search box, but I'm not sure how to add this id.
Here is the old script
// ==UserScript==
// @name Add Back Google Discussions
// @version 1.4
// @description Adds back the Discussion filters to Google Search
// @include *://*.google.tld/search*
// ==/UserScript==
var url = location.href;
if (url.indexOf('tbm=dsc') < 0)
addFilterType('dsc', 'Discussions');
function addFilterType(val, name) {
var searchType = document.getElementById('hdtb_more_mn');
var discussionDiv = document.createElement('DIV');
discussionDiv.className = 'hdtb_mitem';
discussionDiv.innerHTML = '<a class="q qs" href="'+ (url.replace(/&tbm=[^&]*/g,'') + '&tbm=' + val) +'">'+name+'</a>';
searchType.innerHTML += discussionDiv.outerHTML;
}
Thanks for any help, or suggestions on who to ask. Google Chrome has an extension for discussion searches, but FF doesn't seem to have one as of yet, which is why I'm trying to modify the above.