Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.onload=boot;
- const GOOGLE_SEARCH_BASE = "https://www.google.com/search?"
- const ID_QUERY="idQuery";
- const ID_QUANTITY="idQuantity";
- const ID_REJECT="idReject";
- const ID_FORM_SEARCH="idFormSearch";
- const ID_RECENCY="idSelectRecency"
- var oQuery, oQuantity, oFormSearch, oReject;
- var oSelectRecency;
- function boot(){
- //1 - assocs
- oQuery=id(ID_QUERY);
- oQuantity=id(ID_QUANTITY);
- oFormSearch=id(ID_FORM_SEARCH);
- oReject=id(ID_REJECT);
- oSelectRecency=id(ID_RECENCY);
- //2 - behaviors
- oFormSearch.onsubmit=ehGoSearch;
- }//boot
- function ehGoSearch(){
- var strQueryString = ""
- var strQuery=encodeURIComponent(
- oQuery.value.trim()
- );
- var strQuantity=encodeURIComponent(
- oQuantity.value.trim()
- )
- var strReject=encodeURIComponent(
- oReject.value.trim()
- )
- var strRecency=encodeURIComponent(
- oSelectRecency.value.trim()
- )
- //1 - q - the query
- strQueryString="q="+strQuery;
- //2 - num - the quantity
- strQueryString+="&num="+strQuantity;
- //3 - as_eq - to reject
- if(strReject!=""){
- strQueryString+="&as_eq="+strReject;
- }
- //4 - as_qdr - the indexing recency
- if(strRecency!=""){
- strQueryString+="&as_qdr="+strRecency;
- }
- var strURL = GOOGLE_SEARCH_BASE
- +strQueryString;
- //document.write(strURL);
- window.document.location.href=strURL;
- return false;//false more things to do
- }//boot
Add Comment
Please, Sign In to add comment