-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
65 lines (59 loc) · 2.06 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
h1{
text-transform: uppercase;
}
</style>
</head>
<body>
<pre><code id="license-text"></code></pre>
<script type="text/javascript">
function loadDoc(filename, done) {
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
if(xmlhttp.status == 200){
done(xmlhttp.responseText);
}
else if(xmlhttp.status == 400) {
alert('There was an error 400');
}
else {
alert("error " + xmlhttp.status);
}
}
}
xmlhttp.open("GET", filename + ".txt", true);
xmlhttp.send();
}
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
urlParams = {};
while (match = search.exec(query)){
urlParams[decode(match[1])] = decode(match[2]);
}
//alert(urlParams.l + " " + urlParams.uid);
loadDoc(urlParams.license, function(text) {
text = '<h1>project <a href="' + (urlParams.projectUrl || "#") + '">' + (urlParams.projectName || "") + '</a> (' + urlParams.license + ' license)</h1>' + text;
text = text.replace("<[email]>", "");
text = text.replace("[year]", urlParams.year);
text = text.replace("[fullname]", '<a href="' + urlParams.profile + '">' + urlParams.fullname + '</a>');
document.getElementById("license-text").innerHTML = text;
});
</script>
<noscript>Your browser does not support JavaScript!</noscript>
</body>
</html>