-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
111 lines (88 loc) · 4.54 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
<!DOCTYPE html>
<html lang="en-us" ng-app="randomKittens">
<head>
<meta charset="UTF-8">
<title>Randomkittens by mrigo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen">
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-64431015-1', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript">
angular.module('randomKittens', []).controller('kittensController', function ($scope, $q) {
$scope.image = ""
$scope.giveMeKittens = function() {
var height = 400 + Math.floor((Math.random() * 98) + 1) + 1;
var width = 600 + Math.floor((Math.random() * 98) + 1) + 1;
$scope.image = '//placekitten.com/' + width + '/' + height;
isImage($scope.image).then(function(test) {
if (!test) {
ga('send', 'event', 'KittyClick', 'giveMeKittens', 'success', 0);
$scope.giveMeKittens();
} else {
ga('send', 'event', 'KittyClick', 'giveMeKittens', 'success', 1);
}
});
}
function isImage(src) {
var deferred = $q.defer();
var image = new Image();
image.onerror = function() {
deferred.resolve(false);
};
image.onload = function() {
deferred.resolve(true);
};
image.src = src;
return deferred.promise;
}
$scope.giveMeKittens();
});
</script>
</head>
<body ng-controller="kittensController">
<section class="page-header">
<h1 class="project-name">Randomkittens</h1>
<h2 class="project-tagline">Random kittens for sad days</h2>
<button type="button" class="btn btn-info" ng-click="giveMeKittens()">MORE KITTENS !!!</button><br />
<img src="{{ image }}" class="btn"/><br />
<a href="https://github.com/mrigo/randomkitten" class="btn">View on GitHub</a>
<a href="https://github.com/mrigo/randomkitten/zipball/master" class="btn">Download .zip</a>
<a href="https://github.com/mrigo/randomkitten/tarball/master" class="btn">Download .tar.gz</a>
</section>
<section class="main-content">
<h3>
<a id="welcome-to-random-kittens" class="anchor" href="#welcome-to-random-kittens" aria-hidden="true"><span class="octicon octicon-link"></span></a>Welcome to Random kittens.</h3>
<p>When it hasn't been your day, your week, your month, or even your year, but
<br><br>
Kittens'll be there for you <br>
(When the rain starts to pour) <br>
Kittens'll be there for you <br>
(Like they've been there before) <br>
Kittens'll be there for you <br>
('Cause you're there for them too)<br></p>
<p>Freely inspired by <a href="https://www.youtube.com/watch?v=813bZYxnwYA">Friends OST</a><br>
Thanks also to <a href="https://placekitten.com/">https://placekitten.com/</a></p>
<h3>
<a id="authors-and-contributors" class="anchor" href="#authors-and-contributors" aria-hidden="true"><span class="octicon octicon-link"></span></a>Authors and Contributors</h3>
<p>Me.<br>
<a href="https://placekitten.com/">https://placekitten.com/</a></p>
<h3>
<a id="why" class="anchor" href="#why" aria-hidden="true"><span class="octicon octicon-link"></span></a>Why?</h3>
<p>Basically I've made this for my Girlfriend, who loves cats more than pizza (impossible for me!).</p>
<footer class="site-footer">
<span class="site-footer-owner"><a href="https://github.com/mrigo/randomkitten">Randomkittens</a> is maintained by <a href="https://github.com/mrigo">mrigo</a>.</span>
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span>
</footer>
</section>
</body>
</html>