-
Notifications
You must be signed in to change notification settings - Fork 9
/
manpage.html
62 lines (57 loc) · 1.79 KB
/
manpage.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
---
layout: null
permalink: manpage.html
sitemap: false
---
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ site.baseurl }}/public/jroff.css">
<base target="_blank">
</head>
<page><p class="loading">Loading...</p></page>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="{{ site.baseurl }}/public/jroff.js"></script>
<script>
function urlify(text) {
var urlRegex = /((https?:\/\/)|(www\.))[^\s<&]*[^\s<&.;,:]/g;
return text.replace(urlRegex, function(url,b,c) {
var url2 = (c == 'www.') ? 'http://' +url : url;
return '<a href="' +url2+ '" target="_blank">' + url + '</a>';
})
}
$.urlParam = function(name){
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results==null){
return null;
}
else{
return results[1] || 0;
}
}
url= $.urlParam('url');
if (url.indexOf("%3A%2F%2F")!=-1)
url= decodeURIComponent(url);
// Fat ugly hack for old Safari
if (url.indexOf("https")==0) {
ua= navigator.userAgent;
if (ua.indexOf('Safari') != -1 && ua.indexOf('Chrome') == -1) {
if (ua.indexOf("Version/9.")>0 ||
ua.indexOf("Version/8.")>0 ||
ua.indexOf("Version/7.")>0) {
url= url.replace("https", "http");
console.log("Ugly hack for: "+ua);
}
}
}
document.title = url.replace(/^.*\/|\.[^.]*$/g, '') + " Man Page";
jqXHR= $.get("//cors-anywhere.herokuapp.com/"+ url, function (response) {
// Instantiate a new generator
var generator = new Jroff.HTMLGenerator();
// Generate the HTML output
var result = generator.generate(response, 'an');
$("page").html(urlify(result));
});
</script>
</html>