-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
142 lines (131 loc) · 6.59 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
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
<!DOCTYPE HTML>
<html class="" lang="en">
<head>
<title>Yet Another Quote Machine</title>
<meta charset="utf-8">
<link rel="icon" type="image/png" href="assets/img/favicon.png">
<meta name="viewport" content="width=device-width, height=device-height initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script><link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
<meta name="author" content="Ryan Hults">
<link rel="author" href="https://ryanthults.github.io" alt="https://plus.google.com/u/2/108203311083664618233">
<script>
(function() {
$(document).ready(function() {
function htmlStripper(val) {
console.log("before regex "+val);
val = $(val).text();
console.log("after regex "+val);
val = encodeURIComponent(val);
return val;
}
$(".quoteSpot").addClass("fade-out");
$(".quoteAuthor").addClass("fade-out");
$.getJSON("https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=?", function(a) {
var quote = "";
var author = "";
quote += "<i>"+a[0].content+"</i>";
author += "-"+a[0].title;
console.log(author);
$(".quoteSpot").html(quote);
$(".quoteAuthor").html(author);
$("#twitter-btn").attr('href','https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text="'+htmlStripper(quote)+'" '+author);
});
$(".quoteSpot").removeClass("fade-out");
$(".quoteSpot").addClass("fade-in");
$(".quoteAuthor").removeClass("fade-out");
$(".quoteAuthor").addClass("fade-in");
$("#new-quote-btn").on("click", function() {
$(".quoteSpot").removeClass("fade-in");
$(".quoteSpot").addClass("fade-out");
$(".quoteAuthor").removeClass("fade-in");
$(".quoteAuthor").addClass("fade-out");
$.getJSON("https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&_jsonp=?", function(a) {
var quote = "";
var author = "";
quote += "<i>"+a[0].content+"</i>";
author += "-"+a[0].title;
console.log(quote);
$(".quoteSpot").html(quote);
$(".quoteAuthor").html(author);
$("#twitter-btn").attr('href','https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text="'+htmlStripper(quote)+'" '+author);
$(".quoteSpot").removeClass("fade-out");
$(".quoteSpot").addClass("fade-in");
$(".quoteAuthor").removeClass("fade-out");
$(".quoteAuthor").addClass("fade-in");
});
});
});
})(jQuery);
</script>
<style>
/* Overrides */
.container-fluid {
height: 100vh;
width: 100vw;
margin: 0 !important;
background: coral;
}
/* main CSS */
#app {
background: white;
border-radius: 3px;
margin-top: 30vh;
padding: 10px 20px 20px 20px;
}
.quoteSpot {
padding: 0 60px 0 60px;
transition: opacity ease-in-out 0.25s;
}
.quoteAuthor {
padding: 0 60px 0 60px;
transition: opacity ease-in-out 0.25s;
}
.fade-in {
opacity: 1 !important;
}
.fade-out {
opacity: 0 !important;
}
#twitter-btn {
color: #1dcaff;
font-size: 3em;
padding: 0;
}
#new-quote-btn {
margin: 5% 0 5% 0;
}
#attribution {
margin-top: 20px;
color: white;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class = "row">
<div class = "col-md-6 col-lg-4 offset-md-3 offset-lg-4 text-center" id = "app">
<h1>Yet Another Quote Machine</h1>
<h3 class="quoteSpot"><i class="fas fa-quote-right"></i></h3>
<div class="col-sm align-self-end text-right">
<div class="quoteAuthor"></div>
</div>
<div class="row align-items-center">
<div class = "col">
<a href = "#" target="__blank" title="Tweet this quote!" id="twitter-btn"><i class="fab fa-twitter-square"></i></a>
</div>
<div class= "col offset-sm-4">
<button type="button" class="btn btn-primary" id ="new-quote-btn">New Quote</button>
</div>
</div>
</div>
<div class="col-12 align-self-center text-center">
<p style="color:white">by <a href="http://ryanthults.com" target="__blank" style="color:white;">Ryan Hults</a><p/>
</div>
</div>
</div>
</body>
</html>