forked from spruke/doggos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoggos.html
38 lines (31 loc) · 1.19 KB
/
Doggos.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
<html>
<head>
<!-- Authorship: Bill "Spruke" Boulden, not that it's anything to be proud of. -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/marx/2.0.7/marx.min.css" />
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
</head>
<body>
<h1>Official Rated Dog "Retriever"</h1>
<h3>Pun intentional.</h3>
<p>Show me a dog that's rated...</p>
<p><input type="number" id="rating"></input> out of 10</p>
<p><button id="retrieve">Delight me.</button>
<div id="embed-tweet-here">
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#retrieve').click(function () {
$('#embed-tweet-here').empty();
$.get('https://3t2l2ug9si.execute-api.us-east-1.amazonaws.com/prod/doggos?rating='
+ $('#rating').val())
.done(function(json) {
let tweetNumber = json.tweet.match(/\/(\d+)$/)[1];
console.log(tweetNumber);
twttr.widgets.createTweet(tweetNumber, document.getElementById('embed-tweet-here'));
});
});
});
</script>
</body>
</html>