Last active
October 13, 2018 16:02
-
-
Save manuc66/ff9b6083493e27d1891d145ab5a22691 to your computer and use it in GitHub Desktop.
UStartShowResultsOnQwant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name UStartShowResultsOnQwant | |
// @namespace manuc66 | |
// @description UStart open search results on Qwant | |
// @include http://www.ustart.org/* | |
// @include https://www.ustart.org/* | |
// @version 4 | |
// ==/UserScript== | |
// redirect search to google pages | |
var searchForm = document.getElementsByName("mysearch"); | |
searchForm[0].removeAttribute("onsubmit"); | |
searchForm[0].setAttribute("action", "https://www.qwant.com/"); | |
searchForm[0].setAttribute("accept-charset", "utf-8"); | |
var MyInput = document.getElementById("q"); | |
// do not show search result while typing | |
var backToFirst = function(e) { App.page.selectTab(0); }; | |
App.event.attach(MyInput, "keyup", backToFirst); | |
App.search.suggest.Click_Suggestion = function (i) { | |
// get selected value | |
var sug = document.getElementById("suggesttable"); | |
var selectedCell = sug.rows[i].cells[0]; | |
var celValue = selectedCell.innerHTML.replace(/<([^>]*)>/gi,""); | |
// set value in search box | |
var MyInput = document.getElementById("q"); | |
MyInput.value = celValue; | |
// close suggest box | |
App.search.suggest.SwitchAutoComplete(true); | |
// send search | |
var searchForm = document.getElementsByName("mysearch"); | |
searchForm[0].submit(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment