forked from dobtco/starrr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
74 lines (66 loc) · 2.65 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
<!doctype html>
<head>
<title>Starrr, for jQuery</title>
<meta name="description" content="">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" href="starrr.min.css">
<style type='text/css'>
img.ribbon {
position: fixed;
z-index: 1;
top: 0;
right: 0;
border: 0;
cursor: pointer; }
.container {
margin-top: 60px;
text-align: center;
max-width: 450px; }
</style>
</head>
<body>
<a href="https://github.com/dobtco/starrr">
<img class="ribbon" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub">
</a>
<div class="container">
<h3>Starrr</h3>
<h5>Click to rate:</h5>
<div class='starrr'></div>
<div>
<span class='your-choice-was' style='display: none;'>
Your rating was <span class='choice'></span>.
</span>
</div>
<h5>Advanced:</h5>
<div class='starrr' data-numstars='10' data-connected-input='rating'></div>
<br />
<input type='text' name='rating' value='3' />
<h5>Why?</h5>
<p>Because it shouldn't take <a href='https://github.com/wbotelhos/raty/blob/master/lib/jquery.raty.js'>hundreds</a> <a href='http://www.fyneworks.com/jquery/star-rating/'>of</a> <a href='http://rateit.codeplex.com/SourceControl/latest#src/jquery.rateit.js'>lines</a> of javascript to do this shit.</p> You can understand the entirety of Starrr's source code in about a minute, not to mention it's less than 2kb minified.
<h5>Dependencies</h5>
<p>jQuery.</p>
<p>I'm using Bootstrap + Font Awesome to render the stars, but you're more than welcome to use something else.</p>
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
<script src="starrr.min.js"></script>
<script>
$('.starrr:eq(0)').on('starrr:change', function(e, value){
if (value) {
$('.your-choice-was').show();
$('.choice').text(value);
} else {
$('.your-choice-was').hide();
}
});
</script>
<script type="text/javascript">
(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-39205841-5', 'dobtco.github.io');
ga('send', 'pageview');
</script>
</body>
</html>