-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.html
61 lines (51 loc) · 1.64 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
<!DOCTYPE html>
<html>
<head>
<title>One-Liners</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<meta name="viewport" content="width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
</head>
<body>
<!-- open main -->
<main>
<h1>One - Liners</h1>
<noscript>This site will not work without Javascript. Please enable Javascript to continue.</noscript>
<blockquote id="one-liners"></blockquote>
<section>
<button id="random">Random</button>
<button id="next">Next</button>
</section>
</main><!-- close main -->
<!-- open footer -->
<footer>
<p>Source Materials from <a href="http://textfiles.com">TextFiles.com</a></p>
<p>Created by <a href="http://daronspence.com">Daron Spence</a> | Fork on <a href="https://github.com/daronspence/one-liners">GitHub</a></p>
<a href="http://reddit.com"><img src="reddit.png" alt="Join Reddit" /></a>
</footer><!-- close footer -->
<!-- scripts -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/virtualevents.js"></script>
<script type="text/javascript">
// declare variables
var idx;
var quotes;
// declare functions
function randomline(){
$.get('jokes.txt', function(data){
quotes = data.split("\n\n");
idx = Math.floor(quotes.length * Math.random());
$('#one-liners').html(quotes[idx]);
});
};
function nextline(){
idx = idx + 1;
$('#one-liners').html(quotes[idx]);
};
// run initial function on page load
randomline();
$('#random').on('click', randomline);
$('#next').on('click', nextline);
</script><!-- end scripts -->
</body><!-- close body -->
</html>