-
Notifications
You must be signed in to change notification settings - Fork 0
/
opensearch.html
46 lines (43 loc) · 1.82 KB
/
opensearch.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Redirection</title>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-54292016-1', 'auto');
ga('send', 'pageview');
// http://stackoverflow.com/a/979995
var QueryString = function () {
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
query_string[pair[0]] = pair[1];
// If second entry with this name
} else if (typeof query_string[pair[0]] === "string") {
var arr = [ query_string[pair[0]], pair[1] ];
query_string[pair[0]] = arr;
// If third or later entry with this name
} else {
query_string[pair[0]].push(pair[1]);
}
}
return query_string;
} ();
// http://stackoverflow.com/a/4458580
var query = decodeURIComponent((QueryString.q+'').replace(/\+/g, '%20'));
var localURL = query.match(/(github.com|bitbucket.org|code.google.com)[:\/]([^:\/]+)\/([^\/]+)/);
if (localURL !== null)
window.location.replace("http://other.erldocs.com/" + localURL[0].toLowerCase());
else
window.location.replace("http://other.erldocs.com/?q=" + QueryString.q);
</script>
</head>
<body>
You are being redirected…
</body>
</html>