-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexV2.html
165 lines (139 loc) · 4.37 KB
/
indexV2.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!--
** This version seems to work with Codepen.io
-->
<html>
<title> Random Ron Swanson Quote </title>
<head>
<style>
@import url(http://fonts.googleapis.com/css?family=Permanent+Marker:400,500);
* {
margin: 0;
padding: 0;
list-style: none;
vertical-align: baseline;
}
div {
position: relative;
z-index: 2;
}
body {
background-color: #333;
color: #333;
font-family: 'Permanent+Marker', sans-serif;
font-weight: 400;
}
.footer {
width: 450px;
text-align: center;
display: block;
margin: 15px auto 30px auto;
font-size: 0.8em;
color: #fff;
}
.footer a {
font-weight: 500;
text-decoration: none;
color: #fff;
}
.quote-box {
border-radius: 3px;
position: relative;
margin: 8% auto auto auto;
width: 450px;
padding: 40px 50px;
display: table;
background-color: #fff;
}
.quote-box .quote-text {
text-align: center;
width: 450px;
height: auto;
clear: both;
font-weight: 500;
font-size: 2em;
}
.quote-box .quote-text i {
font-size: 1.0em;
margin-right: 0.4em;
}
.quote-box .quote-author {
width: 450px;
height: auto;
clear: both;
padding-top: 20px;
font-size: 1em;
text-align: right;
}
.quote-box .buttons {
width: 450px;
margin: auto;
display: block;
}
.quote-box .buttons .button {
height: 38px;
border: none;
border-radius: 3px;
color: #fff;
background-color: #333;
outline: none;
font-size: 0.85em;
padding: 8px 18px 6px 18px;
margin-top: 30px;
opacity: 1;
cursor: pointer;
}
.quote-box .buttons .button:hover {
opacity: 0.9;
}
.quote-box .buttons .button#tweet-quote {
float: left;
padding: 0px;
padding-top: 8px;
text-align: center;
font-size: 1.2em;
margin-right: 5px;
height: 30px;
width: 40px;
}
.quote-box .buttons .button#new-quote {
float: right;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js'></script>
</head>
<body>
<div class="quote-box">
<div class="quote-text">
<i class="fa fa-quote-left"> </i><span id="text"></span>
</div>
<div class="quote-author">
- <span id="author">Ron Swanson</span>
</div>
<div class="buttons">
<a href="http://twitter" class="button" id="tweet-quote" title="Tweet this quote!" target="_blank">
<i class="fa fa-twitter"></i>
</a>
<button class="button" id="new-quote"> New Random Quote </button>
</div>
</div>
<div class="footer"> by <a href="http://codepen.io/ssharizal/">Syed Sharizal</a></div>
<script>
$(document).ready(function() {
var quoteOutput = document.body.querySelector('#text');
function getQuote() {
var url = "http://ron-swanson-quotes.herokuapp.com/v2/quotes";
$.getJSON(url, function(data) {
quoteOutput.innerHTML = `"${data[0]}"`;
document.body.querySelector('#tweet-quote').href = "https://twitter.com/intent/tweet?hashtags=quotes&text=" + `"${data[0]}"` + " - Ron Swanson";
});
}
$("#new-quote").on("click", function() {
getQuote();
});
getQuote();
});
</script>
</body>
</html>