-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
163 lines (150 loc) · 6.7 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="css/style.css" type="text/css" rel="stylesheet" >
<meta name="author" content="Nitin Chandran Nair">
<meta name="description" content="A simple Random Quote Generator that fetches you random quotes when you click the 'Randomize' button. Developed on top of Google's Materialize Reponsive framework, this 'Machine' looks just fine on all screens! A simple code and very easy to customize! All you need would be a 'Key' to fetch random quotes from the server!">
</head>
<body>
<section id="quote-box" class="center">
<div class="container-fluid">
<div class="row">
<div class="col s12 m12 l12">
<div id="box">
<h2 id="quote">"Everyone wants to be Different, but Death makes us the Same!"</h2>
<h3 id="author" class="right"> - Nitin Chandran Nair</h3>
</div>
</div>
</div>
</div>
</section>
<section class="center" id="randomize">
<div class="container">
<div class="row">
<div class="col s12 m12 l12">
<button class="btn" id="randomize-btn">
<span id="randomize-btn-icon">
<i class="fa fa-1.5x fa-random"></i>
</span>
<span id="randomize-btn-text">
Randomize!
</span>
</button>
</div>
</div>
<div class="row">
<div class="col s12 m4 l4">
<div class="card-panel indigo-text darken-6">
<span>
A Random Quote Generator that fetches you random quotes when you click the "Randomize" button above.
</span>
</div>
</div>
<div class="col s12 m4 l4">
<div class="card-panel indigo-text darken-6">
<span>
Developed on top of Google's Materialize Reponsive framework, this "Machine" looks just fine on all screens!
</span>
</div>
</div>
<div class="col s12 m4 l4">
<div class="card-panel indigo-text darken-6">
<span>
A simple code and very easy to customize! All you need is a "Key" to fetch random quotes from the server!
</span>
</div>
</div>
</div>
</div>
</section>
<section>
<footer class="indigo-text center">
<div class="container-fluid">
<div class="row">
<div class="col s12 m6 l8">
<span id="social-links">
<a href="https://www.facebook.com/nitin.c.nair.5" target="_blank">
<i class="fa fa-2x fa-facebook"></i>
</a>
<a href="https://twitter.com/Nitin_Nair89" target="_blank">
<i class="fa fa-2x fa-twitter"></i>
</a>
<a href="https://plus.google.com/+NitinNair89" target="_blank">
<i class="fa fa-2x fa-google"></i>
</a>
<a href="https://github.com/NitinNair89" target="_blank">
<i class="fa fa-2x fa-github"></i>
</a>
<a href="https://codepen.io/Nitin-Chandran-Nair" target="_blank">
<i class="fa fa-2x fa-codepen"></i>
</a>
<a href="http://www.nitinchandrannair.com/NitinNairWrites" target="_blank">
<i class="fa fa-2x fa-wordpress"></i>
</a>
</span>
</div>
<div class="col s12 m6 l4">
<span>Developed by <a href="http://www.nitinchandrannair.com" target="_blank">Nitin Chandran Nair</a></span>
</div>
</div>
</div>
</footer>
</section>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
<script type="text/javascript" src="config/config.js"></script>
<script>
$(document).ready(function(){
animateQuote();
animateAuthor();
$("#randomize-btn").click(function() {
$('#randomize-btn-text').text('Loading...');
getQuote();
$("#quote").removeClass("animated zoomIn");
$("#author").removeClass("animated zoomIn");
});
});
function getQuote() {
var quote = "",
author = "",
key = config.MyKey;
$.ajax({
headers: {
"X-Mashape-Key": key,
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json"
},
url: "https://andruxnet-random-famous-quotes.p.mashape.com/?cat=famous",
success: function(data) {
var d = JSON.parse(data);
quote = d.quote;
author = d.author;
updateQuote(quote);
updateAuthor(author);
$('#randomize-btn-text').text('Randomize');
}
});
}
function updateQuote(quote) {
document.getElementById("quote").innerHTML = quote;
animateQuote();
}
function updateAuthor(author) {
document.getElementById("author").innerHTML = " - " + author;
animateAuthor();
}
function animateQuote() {
$("#quote").addClass("animated zoomIn");
}
function animateAuthor() {
$("#author").addClass("animated zoomIn");
}
</script>
</body>
</html>