forked from Drant/GW2Timer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
140 lines (131 loc) · 3.55 KB
/
404.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
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
<!DOCTYPE html>
<html>
<head>
<!-- Meta -->
<title>GW2Timer.com Clean URL</title>
<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow, noarchive" />
<!-- Google Analytics -->
<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-51018564-1', 'gw2timer.com');
ga('send', 'pageview');
</script>
<script type="text/javascript">
/*
* Converts a string to be all lower case except the first letter which is capitalized.
* @param string pString to convert.
* @returns string converted.
*/
var toFirstUpperCase = function(pString)
{
return pString.charAt(0).toUpperCase() + pString.slice(1).toLowerCase();
};
/*
* Converts directory style URL to site base URL with query string to content.
* Example:
* https://gw2timer.com/map/collectible/372,44,27 becomes
* https://gw2timer.com/?page=Map§ion=Collectible&go=372,44,27
* This works because this 404 page is displayed for non-existent directories,
* and it is assumed the requested URL directories do not exist.
* @returns string of new location.
*/
var getNewLocation = function()
{
var loc = document.location.toString();
var newloc = "";
var base = "https://gw2timer.com/";
var primer = "gw2timer.com/";
var primerindex = loc.indexOf(primer);
var params;
var page, section, article;
var coords;
if (primerindex !== -1)
{
params = loc.substring(primerindex + primer.length, loc.length).split("/");
if (params[0].indexOf("[") === 0) // If first param is an array
{
if (params[0].substring(0,2) === "[[")
{
newloc = base + "?draw=" + params[0];
}
else
{
newloc = base + "?go=" + params[0];
}
}
else // If params are in order: page/section/coordinates
{
if (params.length >= 1)
{
page = toFirstUpperCase(params[0]);
}
if (params.length >= 2)
{
section = toFirstUpperCase(params[1]);
}
if (params.length >= 3)
{
article = params[2];
}
if (params.length >= 4)
{
coords = params[3];
}
switch (params.length)
{
case 1:
{
// First argument has a comma then it is a coordinates
if (page.indexOf(",") !== -1)
{
newloc = base + "?go=" + page;
}
else
{
newloc = base + "?page=" + page;
}
} break;
case 2:
{
// Second argument can be a comma separated coordinates or a section index
if (section.indexOf(",") !== -1)
{
newloc = base + "?page=" + page + "&go=" + section;
}
else
{
newloc = base + "?page=" + page + "§ion=" + section;
}
} break;
case 3:
{
// Third argument can be a comma separated coordinates, a map zone, or an article index
if (article.indexOf(",") !== -1)
{
newloc = base + "?page=" + page + "§ion=" + section + "&go=" + article;
}
else
{
newloc = base + "?page=" + page + "§ion=" + section + "&article=" + article;
}
} break;
default: newloc = base + "?page=" + page + "§ion=" + section + "&article=" + article + "&go=" + coords;
}
}
}
else
{
newloc = base;
}
return newloc;
};
// Go to proper URL
setTimeout("window.location = '" + getNewLocation() + "'", 250);
</script>
</head>
<body></body>
</html>