-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (76 loc) · 2.37 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
66
67
68
69
70
71
72
73
74
75
76
77
78
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Pseudorandomness</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/github-light.css">
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script>
function ArchiveMessage(){
this.paragraphs = [];
this.date = null;
}
ArchiveMessage.prototype.append = function(line){
var p = $("<p></p>");
p.text(line);
var html = p.html();
html = html.replace(/\*\*([^\*]+)\*\*/g, "<b>$1</b>")
.replace(/\*([^\*]+)\*/g, "<b>$1</b>")
.replace(/`([^`]+)`/g, "<code>$1</code>");
p.html(html);
this.paragraphs.push(p);
};
ArchiveMessage.prototype.publish = function(date){
var message = $("<div></div>");
message.addClass("message");
message.prepend("<hr>");
for(var i = 0; i < this.paragraphs.length; i++){
message.append(this.paragraphs[i]);
}
message.append("<p class='footer'>Signed: " + date + "</p>");
return message;
};
$(document).ready(function(){
$.get("https://chankyin.github.io/data/messages.txt", {}, function(data){
var holder = $("#holder");
var lines = data.split("\n");
var currentMessage = null;
for(var i = 0; i < lines.length; i++){
if(currentMessage === null){
currentMessage = new ArchiveMessage();
}
if(lines[i].substring(0, 4) === "~~~ "){
currentMessage.publish(lines[i++].substring(4))
.prependTo(holder);
currentMessage = null;
continue;
}
currentMessage.append(lines[i]);
}
});
});
</script>
<meta name="viewport" content="width=device-width">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="wrapper">
<header>
<h1>Pseudorandomness</h1>
<div id="holder"></div>
<p class="view"><a href="https://github.com/chankyin">View My GitHub Profile</a></p>
</header>
<section>
<p>An archive of <em>not-really</em>-random things I thought of</p>
</section>
<footer>
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="javascripts/scale.fix.js"></script>
</body>
</html>