mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-03-05 10:02:03 +01:00
Start again
This commit is contained in:
29
vendors/starrr/.bower.json
vendored
Normal file
29
vendors/starrr/.bower.json
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "starrr",
|
||||
"authors": [
|
||||
"ajb <adam@dobt.co>"
|
||||
],
|
||||
"description": "1-5 star rating with jQuery.",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
],
|
||||
"main": [
|
||||
"dist/starrr.js",
|
||||
"dist/starrr.css"
|
||||
],
|
||||
"dependencies": {},
|
||||
"homepage": "https://github.com/dobtco/starrr",
|
||||
"version": "2.0.1",
|
||||
"_release": "2.0.1",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "2.0.1",
|
||||
"commit": "8f992a626da5667996b03138c1ce3f0a099761cc"
|
||||
},
|
||||
"_source": "https://github.com/dobtco/starrr.git",
|
||||
"_target": "^2.0.0",
|
||||
"_originalSource": "starrr"
|
||||
}
|
||||
30
vendors/starrr/Gruntfile.coffee
vendored
Normal file
30
vendors/starrr/Gruntfile.coffee
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
module.exports = (grunt) ->
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-coffee')
|
||||
grunt.loadNpmTasks('grunt-contrib-sass')
|
||||
grunt.loadNpmTasks('grunt-contrib-watch')
|
||||
grunt.loadNpmTasks('grunt-release')
|
||||
|
||||
grunt.initConfig
|
||||
pkg: '<json:package.json>'
|
||||
|
||||
coffee:
|
||||
all:
|
||||
src: 'src/starrr.coffee'
|
||||
dest: 'dist/starrr.js'
|
||||
options:
|
||||
bare: true
|
||||
|
||||
sass:
|
||||
all:
|
||||
files:
|
||||
'dist/starrr.css': 'src/starrr.scss'
|
||||
options:
|
||||
sourcemap: 'none'
|
||||
|
||||
watch:
|
||||
all:
|
||||
files: ['src/starrr.coffee', 'src/starrr.scss']
|
||||
tasks: 'default'
|
||||
|
||||
grunt.registerTask 'default', ['coffee:all', 'sass:all']
|
||||
73
vendors/starrr/README.md
vendored
Normal file
73
vendors/starrr/README.md
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
starrr
|
||||
======
|
||||
|
||||
1-5 (or 1-`n`) star rating in < 75 lines of code.
|
||||
|
||||
## Requirements
|
||||
|
||||
- jQuery
|
||||
|
||||
## Usage
|
||||
|
||||
### Create the stars
|
||||
|
||||
```html
|
||||
<div class='starrr'></div>
|
||||
```
|
||||
|
||||
```js
|
||||
$('.starrr').starrr()
|
||||
```
|
||||
|
||||
### With an existing rating
|
||||
|
||||
```js
|
||||
$('.starrr').starrr({
|
||||
rating: 4
|
||||
})
|
||||
```
|
||||
|
||||
### With more than 5 stars
|
||||
|
||||
```js
|
||||
$('.starrr').starrr({
|
||||
max: 10
|
||||
})
|
||||
```
|
||||
|
||||
### Read-only
|
||||
|
||||
```js
|
||||
$('.starrr').starrr({
|
||||
readOnly: true
|
||||
})
|
||||
```
|
||||
|
||||
### Do something with the rating...
|
||||
|
||||
```js
|
||||
$('.starrr').starrr({
|
||||
change: function(e, value){
|
||||
alert('new rating is ' + value)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Or if you prefer events:
|
||||
|
||||
```js
|
||||
$('.starrr').on('starrr:change', function(e, value){
|
||||
alert('new rating is ' + value)
|
||||
})
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
- `npm install`
|
||||
- `npm install -g grunt-cli`
|
||||
- Make changes in `src/`
|
||||
- Run `grunt` to compile them
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
18
vendors/starrr/bower.json
vendored
Normal file
18
vendors/starrr/bower.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "starrr",
|
||||
"authors": [
|
||||
"ajb <adam@dobt.co>"
|
||||
],
|
||||
"description": "1-5 star rating with jQuery.",
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
],
|
||||
"main": [
|
||||
"dist/starrr.js",
|
||||
"dist/starrr.css"
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
||||
8
vendors/starrr/dist/starrr.css
vendored
Normal file
8
vendors/starrr/dist/starrr.css
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
.starrr {
|
||||
display: inline-block; }
|
||||
.starrr a {
|
||||
font-size: 16px;
|
||||
padding: 0 1px;
|
||||
cursor: pointer;
|
||||
color: #FFD119;
|
||||
text-decoration: none; }
|
||||
98
vendors/starrr/dist/starrr.js
vendored
Normal file
98
vendors/starrr/dist/starrr.js
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
var slice = [].slice;
|
||||
|
||||
(function($, window) {
|
||||
var Starrr;
|
||||
window.Starrr = Starrr = (function() {
|
||||
Starrr.prototype.defaults = {
|
||||
rating: void 0,
|
||||
max: 5,
|
||||
readOnly: false,
|
||||
emptyClass: 'fa fa-star-o',
|
||||
fullClass: 'fa fa-star',
|
||||
change: function(e, value) {}
|
||||
};
|
||||
|
||||
function Starrr($el, options) {
|
||||
this.options = $.extend({}, this.defaults, options);
|
||||
this.$el = $el;
|
||||
this.createStars();
|
||||
this.syncRating();
|
||||
if (this.options.readOnly) {
|
||||
return;
|
||||
}
|
||||
this.$el.on('mouseover.starrr', 'a', (function(_this) {
|
||||
return function(e) {
|
||||
return _this.syncRating(_this.getStars().index(e.currentTarget) + 1);
|
||||
};
|
||||
})(this));
|
||||
this.$el.on('mouseout.starrr', (function(_this) {
|
||||
return function() {
|
||||
return _this.syncRating();
|
||||
};
|
||||
})(this));
|
||||
this.$el.on('click.starrr', 'a', (function(_this) {
|
||||
return function(e) {
|
||||
e.preventDefault();
|
||||
return _this.setRating(_this.getStars().index(e.currentTarget) + 1);
|
||||
};
|
||||
})(this));
|
||||
this.$el.on('starrr:change', this.options.change);
|
||||
}
|
||||
|
||||
Starrr.prototype.getStars = function() {
|
||||
return this.$el.find('a');
|
||||
};
|
||||
|
||||
Starrr.prototype.createStars = function() {
|
||||
var j, ref, results;
|
||||
results = [];
|
||||
for (j = 1, ref = this.options.max; 1 <= ref ? j <= ref : j >= ref; 1 <= ref ? j++ : j--) {
|
||||
results.push(this.$el.append("<a href='#' />"));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
Starrr.prototype.setRating = function(rating) {
|
||||
if (this.options.rating === rating) {
|
||||
rating = void 0;
|
||||
}
|
||||
this.options.rating = rating;
|
||||
this.syncRating();
|
||||
return this.$el.trigger('starrr:change', rating);
|
||||
};
|
||||
|
||||
Starrr.prototype.getRating = function() {
|
||||
return this.options.rating;
|
||||
};
|
||||
|
||||
Starrr.prototype.syncRating = function(rating) {
|
||||
var $stars, i, j, ref, results;
|
||||
rating || (rating = this.options.rating);
|
||||
$stars = this.getStars();
|
||||
results = [];
|
||||
for (i = j = 1, ref = this.options.max; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {
|
||||
results.push($stars.eq(i - 1).removeClass(rating >= i ? this.options.emptyClass : this.options.fullClass).addClass(rating >= i ? this.options.fullClass : this.options.emptyClass));
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
return Starrr;
|
||||
|
||||
})();
|
||||
return $.fn.extend({
|
||||
starrr: function() {
|
||||
var args, option;
|
||||
option = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
||||
return this.each(function() {
|
||||
var data;
|
||||
data = $(this).data('starrr');
|
||||
if (!data) {
|
||||
$(this).data('starrr', (data = new Starrr($(this), option)));
|
||||
}
|
||||
if (typeof option === 'string') {
|
||||
return data[option].apply(data, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(window.jQuery, window);
|
||||
90
vendors/starrr/index.html
vendored
Normal file
90
vendors/starrr/index.html
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
<!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="dist/starrr.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; }
|
||||
|
||||
input {
|
||||
width: 30px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
</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' id='star1'></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' id='star2'></div>
|
||||
<br />
|
||||
<input type='text' name='rating' value='3' id='star2_input' />
|
||||
|
||||
<h5>Why?</h5>
|
||||
<p>There are other libraries out there, but none that approach the level clarity and conciseness that I wanted. Starrr is less than 75 lines of code -- you can understand the entirety of its source code in about a minute.</p>
|
||||
|
||||
<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="dist/starrr.js"></script>
|
||||
<script>
|
||||
$('#star1').starrr({
|
||||
change: function(e, value){
|
||||
if (value) {
|
||||
$('.your-choice-was').show();
|
||||
$('.choice').text(value);
|
||||
} else {
|
||||
$('.your-choice-was').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var $s2input = $('#star2_input');
|
||||
$('#star2').starrr({
|
||||
max: 10,
|
||||
rating: $s2input.val(),
|
||||
change: function(e, value){
|
||||
$s2input.val(value).trigger('input');
|
||||
}
|
||||
});
|
||||
</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>
|
||||
13
vendors/starrr/package.json
vendored
Normal file
13
vendors/starrr/package.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "starrr",
|
||||
"version": "2.0.0",
|
||||
"main": "Gruntfile.coffee",
|
||||
"author": "ajb <adam@dobt.co>",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"grunt-contrib-sass": "^0.9.2",
|
||||
"grunt-contrib-coffee": "^0.13.0",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt": "^0.4.5"
|
||||
}
|
||||
}
|
||||
66
vendors/starrr/src/starrr.coffee
vendored
Normal file
66
vendors/starrr/src/starrr.coffee
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
(($, window) ->
|
||||
|
||||
window.Starrr = class Starrr
|
||||
defaults:
|
||||
rating: undefined
|
||||
max: 5
|
||||
readOnly: false
|
||||
emptyClass: 'fa fa-star-o'
|
||||
fullClass: 'fa fa-star'
|
||||
change: (e, value) ->
|
||||
|
||||
constructor: ($el, options) ->
|
||||
@options = $.extend({}, @defaults, options)
|
||||
@$el = $el
|
||||
@createStars()
|
||||
@syncRating()
|
||||
|
||||
return if @options.readOnly
|
||||
|
||||
@$el.on 'mouseover.starrr', 'a', (e) =>
|
||||
@syncRating(@getStars().index(e.currentTarget) + 1)
|
||||
|
||||
@$el.on 'mouseout.starrr', =>
|
||||
@syncRating()
|
||||
|
||||
@$el.on 'click.starrr', 'a', (e) =>
|
||||
e.preventDefault()
|
||||
@setRating(@getStars().index(e.currentTarget) + 1)
|
||||
|
||||
@$el.on 'starrr:change', @options.change
|
||||
|
||||
getStars: ->
|
||||
@$el.find('a')
|
||||
|
||||
createStars: ->
|
||||
@$el.append("<a href='#' />") for [1..@options.max]
|
||||
|
||||
setRating: (rating) ->
|
||||
rating = undefined if @options.rating == rating
|
||||
@options.rating = rating
|
||||
@syncRating()
|
||||
@$el.trigger('starrr:change', rating)
|
||||
|
||||
getRating: ->
|
||||
@options.rating
|
||||
|
||||
syncRating: (rating) ->
|
||||
rating ||= @options.rating
|
||||
$stars = @getStars()
|
||||
for i in [1..@options.max]
|
||||
$stars.
|
||||
eq(i - 1).
|
||||
removeClass(if rating >= i then @options.emptyClass else @options.fullClass).
|
||||
addClass(if rating >= i then @options.fullClass else @options.emptyClass)
|
||||
|
||||
# Define the plugin
|
||||
$.fn.extend starrr: (option, args...) ->
|
||||
@each ->
|
||||
data = $(@).data('starrr')
|
||||
|
||||
if !data
|
||||
$(@).data 'starrr', (data = new Starrr($(@), option))
|
||||
if typeof option == 'string'
|
||||
data[option].apply(data, args)
|
||||
|
||||
) window.jQuery, window
|
||||
13
vendors/starrr/src/starrr.scss
vendored
Normal file
13
vendors/starrr/src/starrr.scss
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
$starrrColor: #FFD119 !default;
|
||||
|
||||
.starrr {
|
||||
display: inline-block;
|
||||
|
||||
a {
|
||||
font-size: 16px;
|
||||
padding: 0 1px;
|
||||
cursor: pointer;
|
||||
color: $starrrColor;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user