Skip to content

Instantly share code, notes, and snippets.

@smt
Last active May 17, 2024 04:34
Show Gist options
  • Save smt/ed4c1d9a18b8b64f7e665b0d4b099f59 to your computer and use it in GitHub Desktop.
Save smt/ed4c1d9a18b8b64f7e665b0d4b099f59 to your computer and use it in GitHub Desktop.
GitHub magic query params
javascript:(function(w)%7Bvar%20W%3D1%2CTS%3D4%2Cl%3Dw.location%2Cqs%3Bif(l.search)%7Bqs%3Dl.search.split(\'%3F\')%5B1%5D.split(\'%26\').reduce(function(acc%2Cp)%7Bvar%20kv%3Dp.split(\'%3D\')%3Bacc%5Bkv%5B0%5D%5D%3Dkv%5B1%5D%3Breturn%20acc%7D%2C%7B%7D)%3Bqs.w%3DW%3Bqs.ts%3DTS%3Bl.search%3D\'%3F\'%2B(Object.keys(qs).reduce(function(acc%2Ck)%7Bacc.push(k%2B\'%3D\'%2Bqs%5Bk%5D)%3Breturn%20acc%7D%2C%5B%5D).join(\'%26\'))%7Delse%7Bl.search%3D\'%3Fw%3D\'%2BW%2B\'%26ts%3D\'%2BTS%7D%7D)(window)
(function(w){var W=1,TS=4,l=w.location,qs;if(l.search){qs=l.search.split('?')[1].split('&').reduce(function(acc,p){var kv=p.split('=');acc[kv[0]]=kv[1];return acc},{});qs.w=W;qs.ts=TS;l.search='?'+(Object.keys(qs).reduce(function(acc,k){acc.push(k+'='+qs[k]);return acc},[]).join('&'))}else{l.search='?w='+W+'&ts='+TS}})(window)
(function(w){
var W=1,
TS=4,
l=w.location,
qs;
if(l.search){
qs=l.search
.split('?')[1]
.split('&')
.reduce(function(acc,p){
var kv=p.split('=');
acc[kv[0]]=kv[1];
return acc
},{});
qs.w=W;
qs.ts=TS;
l.search='?'+(Object.keys(qs).reduce(function(acc,k){
acc.push(k+'='+qs[k]);
return acc
},[]).join('&'))
}else{
l.search='?w='+W+'&ts='+TS
}
})(window)
@amwmedia
Copy link

amwmedia commented May 5, 2017

could be written into a Chrome extension that automatically modifies these QS params when you visit an appropriate page 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment