-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (35 loc) · 1.23 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
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js'></script>
<link href="https://fonts.googleapis.com/css?family=Oswald|Pacifico" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1 id="name">Design Quotes</h1>
<div class="shadow">
<div id="content"></div>
<div class="img-container">
<a id="tweet-link" href="">
<img id="t-img" src="photos/twitter.png"/>
</a>
</div>
</div>
</body>
<script>
var currentQuote = '';
function getQuote() {
$.ajaxSetup({ cache: false });
$.getJSON("https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_callback=", function(a) {
$("#content").html(a[0].content + "<p>— " + a[0].title + "</p>");
var currentQuote = a[0].content;
var currentAuth = a[0].title;
var currentQuote = $(currentQuote).text();
var currentQuote = currentQuote + " -" + currentAuth;
$('#tweet-link').attr('href','https://twitter.com/intent/tweet?related=jacob_roush&text=' + encodeURIComponent(currentQuote) );
});
}
getQuote();
$('#name').on('click', getQuote);
$(window).bind("load", function() {
});
</script>