-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqsparam.txt
147 lines (123 loc) · 4.61 KB
/
qsparam.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
https://www.google.com/search?q=google&safe=off&gl=it&hl=it&lr=lang_it&sa=X
https://www.google.com/search?q=google&safe=off&gl=en&hl=en&lr=lang_en&sa=X
// ==UserScript==
// @name Google Search Better Privacy
// @description Delete unnecessary params and add useful params on Google Search.
// @version 0.0.4
// @include http://*.google.*/search*
// @include http://*.google.*/imgres*
// @include https://*.google.*/search*
// @include https://*.google.*/imgres*
// @exclude http://play.google.com/*
// @exclude http://mail.google.com/*
// @exclude https://play.google.com/*
// @exclude https://mail.google.com/*
// @author nodaguti
// @license MIT License
// @run-at document-start
// @namespace https://greasyfork.org/users/1453
// ==/UserScript==
(function(){
//--- Config ---
//For more information about parameters, please see
//http://www.blueglass.com/blog/google-search-url-parameters-query-string-anatomy/ or
//http://www.seomoz.org/ugc/the-ultimate-guide-to-the-google-search-parameters
var addParams = [
'safe=off', //Disable safe search
'newwindow=1', //Open links in new tab
'pws=0', //Disable personalized search
'complete=0', //Disable instant search
// 'as_qdr=y15', //Display when sites released
// 'adtest=on', //Turn off AdWords database connection
//See https://developers.google.com/custom-search-ads/docs/reference#adtest for detail
];
var deleteParams = [
//--- Tracking Params ---
//Thx: http://www.blueglass.com/blog/google-search-url-parameters-query-string-anatomy/
'client', //Browser Name
'sclient', //Browser Name
'sourceid', //Source of the query
'source', //Source of the query
'oq', //What you typed before you made a selection
//from the suggestions
'aq', //Google Suggest Tracking (Shows which suggestion you choose)
'pq', //Previous Query
'sa', //Google SERPs navigation behavior tracking
'swrnum', //The number of results the initial query returned
'as_q', //When searching within results, the query is added as_q
'oi', //Universal search: Group name
'resnum', //Universal search: Number of a result within the group
//--- Maybe Tracking Params, but details unknown ---
'gs_l', //Location?
'bav',
'bvm',
'bpcl',
'biw', //Client display width?
'bih', //Client display height?
'w',
'h',
'tbnh',
'tbnw',
'fp',
'ei',
'usg',
'sig2',
'tbs',
'ved',
//--- Appearance Setting Params (default: Disabled) ---
// If you want to delete these params, please reveal the comment out.
// 'tbo', //tbo=1: Display search toolbar
// 'prmdo', //prmdo=1: Expand 'services' in toolbar
// 'sout', //sout=1: Change UI of Google Image Search to old version
// 'esrch', //esrch=instantpreviews: Enable instant preview
// 'filter', //filter=1: Filter similar pages
// 'hl', //Interface language
// 'lr', //Search target language
// 'ie', //Query encoding
// 'oe', //Search result encoding
// 'noj', //noj=1: No JavaScript
//--- Unknown Params ---
'pdx',
'ech',
'psi',
'emsg',
'facrc',
'imgdii',
'iact',
'ndsp',
'tx',
'ty',
];
// --- /Config ---
var delParamReg = new RegExp('&(?:' + deleteParams.join('=[^&#]*|') + '=[^&#]*)', 'g');
var overwriteParamReg = new RegExp(
'&(?:' +
addParams
.map(function(i){return i.split('=')[0];})
.join('=[^&#]*|') + '=[^&#]*)', 'g');
//Delete and add params
function urlFix(url){
var _url = url;
//delete params
_url = url.replace(delParamReg, '');
//overwrite and add params
_url = _url.replace(overwriteParamReg, '').replace(/&$/, '');
_url += '&' + addParams.join('&') + '&urlfixed=1';
return _url;
}
//Reload page when hash is changed (when search from textbox on result page)
function hashChange(){
//Exclude Image Search
if(location.search.indexOf('tbm=isch') !== -1) return;
var newURL = ('https://' +
location.host + '/search' +
location.search + '&' +
location.hash.substr(1));
newURL = urlFix(newURL);
location.replace(newURL);
}
if(location.href.indexOf('urlfixed=1') === -1){
location.replace(urlFix(location.href));
}
window.addEventListener('hashchange', hashChange, false);
})();