-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
96 lines (87 loc) · 4.75 KB
/
Copy pathindex.html
File metadata and controls
96 lines (87 loc) · 4.75 KB
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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta property="og:title" content="Another Life">
<meta property="og:description" content="Another Life is an entry for NaNoGenMo 2015. The novel is a generated text based off of my own personal diary entries between the years of 2012-2014. Much of the text remains the way that I wrote it, however all the names of People, Places, Organizations, Numbers (dates, times, quantities) and Media (TV, movies, video games) have been algorithmically replaced. The result is a version of my life that takes place in a slightly alternate universe than the original.">
<meta name="description" content="Another Life is an entry for NaNoGenMo 2015. The novel is a generated text based off of my own personal diary entries between the years of 2012-2014. Much of the text remains the way that I wrote it, however all the names of People, Places, Organizations, Numbers (dates, times, quantities) and Media (TV, movies, video games) have been algorithmically replaced. The result is a version of my life that takes place in a slightly alternate universe than the original.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="intro">
<p><em>Another Life</em> is an entry for <a href="https://github.com/dariusk/NaNoGenMo-2015">NaNoGenMo 2015.</a></p>
<p>The novel is a generated text based off of my own personal diary entries between the years of 2012-2014. Much of the text remains the way that I wrote it, however all the names of People, Places, Organizations, Numbers (dates, times, quantities) and Media (TV, movies, video games) have been algorithmically replaced. The result is a version of my life that takes place in a slightly alternate universe than the original.</p>
<p class="disclaimer">For privacy reasons, some of this text has been redacted from the publicly available version.</p>
</div>
<h1>Another Life</h1>
<div class="diary-contents"></div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="moment.min.js"></script>
<script type="text/html" id="entry_template">
<div class="date"><%=entry_date%></div>
<div class="text"><%=entry_text%></div>
</script>
<script>
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
cache[str] = cache[str] ||
tmpl(document.getElementById(str).innerHTML) :
// Generate a reusable function that will serve as a template
// generator (and which will be cached).
new Function("obj",
"var p=[],print=function(){p.push.apply(p,arguments);};" +
// Introduce the data as local variables using with(){}
"with(obj){p.push('" +
// Convert the template into pure JavaScript
str
.replace(/[\r\t\n]/g, " ")
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
.split("\t").join("');")
.split("%>").join("p.push('")
.split("\r").join("\\'")
+ "');}return p.join('');");
// Provide some basic currying to the user
return data ? fn( data ) : fn;
};
})();
var fileName =
"/outputText/" + (location.search ? 'run-2__11-30-15-redacted' : 'outputText') + ".json";
if(location.hostname.indexOf("github.io") !== -1) {
fileName = "https://raw.githubusercontent.com/rvinluan/AnotherLife/master/outputText/run-2__11-30-15-redacted.json"
}
$.getJSON(fileName, function (data) {
var contents = $(".diary-contents"),
newDiv;
for(var entry in data) {
var formatString = moment(data[entry].date).format("dddd, MMMM Do YYYY");
newDiv = $("<div class='single-entry'>");
if(data[entry].type == "redacted") {
newDiv.addClass("redacted");
}
newDiv.html(tmpl("entry_template", {
entry_date: formatString,
entry_text: htmlizeText(data[entry].text)
}));
newDiv.appendTo(contents);
}
})
function htmlizeText(text) {
var newstring = "<p>" + text + "</p>";
return newstring.replace('\n', '</p><p>');
}
</script>
</body>
</html>