The two scripts both have a function named changeLinkQuery
, but changeLinkQuery
is not the same in each! Plus one of the changeLinkQuery
functions is misnamed, because it is not changing any link's query part.
Also, waitForKeyElements
does not take multiple selector strings like that, but a jQuery selector can have multiple parts.
So this is bad: "a[href*='?q=']","input[name*='q']"
But this will work: "a[href*='?q='],input[name*='q']"
but is not the best way for your situation.
The solution is to rename one of the changeLinkQuery
functions, like so (also incorporating the fix from your previous question):
// ==UserScript==
// @name Normal Google Input
// @include http://62.0.54.118/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
waitForKeyElements ("a[href*='?q=']", changeLinkQuery);
waitForKeyElements ("input[name='q']", changeInputName);
function changeLinkQuery (jNode) {
var oldHref = jNode.attr ('href');
var newHref = oldHref.replace (/\?q=/, "?&q=");
jNode.attr ('href', newHref);
return true;
}
function changeInputName (jNode) {
var oldName = jNode.attr ('name');
var newName = oldName.replace (/q/, "&q");
jNode.attr ('name', newName);
return true;
}