Love Letter Generator
by vaopoku
HTML
<body onload="produce_litany();">
<div id="main"></div>
</body>
CSS
body {
background: #7B68EE;
color: #ccc;
margin: 20pt 20pt 20pt 30pt;
font-family: 'Texturina', serif;
font-size: 16pt;
}
a {
color: #117;
text-decoration: none;
}
#main {
padding-top: 18px;
width: 70%;
margin-left: 15%;
}
#main div {
font-weight: bold;
padding-bottom: 9px;
}
JavaScript
var t = 0,
first = ['You might try looking around.', 'This is where I live.', 'Look!', 'Open your eye!'],
second = ['Where are we?', 'This is my time!', 'Fasure, look how pretty it is!', 'You seem disappointed.'],
adjectives = ['wasteful', 'poor', 'deaf', 'bolted down', 'miles deep', 'reluctant', 'far', 'near', 'somewhere', 'at midday', 'fearfull', 'broken open', 'to her side', 'slow', 'strange', 'turned', 'ordinary', 'in the right direction', 'into the future', 'on top of'],
nouns = ['a lot of birds', 'villages', 'rivers', 'no-account buildings', 'strange structures like long-legged birds', 'winds', 'yellow buildings', 'domes', 'bird objects', 'pine trees', 'green vines', 'skyscrapers', 'spaceports', 'traffic jams in the sky', 'futures', 'cities', 'gardens', 'woods', 'bricks', 'people on foot', 'cement blocks', 'vegetables', 'huts', 'dark-skinned men', 'visions', 'strangers', 'pasts', 'paths'],
adverbs = ['fearfully', 'gently', 'roughly', 'slowly', 'scarcely', 'randomly', 'wildly', 'firmly', 'casually', 'obviously', 'mildly', 'only', 'quickly', 'eventually', 'exactly', 'guiltily', 'expectantly', 'finally', 'really', 'mostly', 'openly'],
verbs = ['envy', 'see', 'imagine', 'pry', 'live', 'take', 'turn', 'overrun', 'are', 'have', 'seem', 'scatter', 'put', 'graze', 'begin', 'stretch', 'get', 'readjust', 'know', 'show', 'compare', 'scavenge', 'predict', 'like', 'look'];
function rand_range(maximum) {
return Math.floor(Math.random() * (maximum + 1));
}
function choose(array) {
return array[rand_range(array.length - 1)];
}
function maybe(words) {
if (Math.random() > 0.5) {
return ' ' + choose(words);
}
return '';
}
function longer() {
return ' There,' + maybe(adjectives) + ' I see ' + choose(nouns) + maybe(adverbs) + ' ' + choose(verbs) + ' over their' + maybe(adjectives) + ' ' + choose(nouns) + '.';
}
function shorter() {
return ' ...and here are ' + choose(adjectives) + ' ' + choose(nouns) + '.';
}
function letter() {
var i,...