forked from olton/metroui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rating and progress bar, minor bug fix
- Loading branch information
Showing
12 changed files
with
582 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
(function($){ | ||
$.fn.Rating = function( options ){ | ||
var defaults = { | ||
}; | ||
|
||
var $this = $(this) | ||
; | ||
|
||
var init = function(el){ | ||
var a = el.find("a"); | ||
var r = Math.round(el.data("rating")) || 0; | ||
|
||
a.each(function(index){ | ||
console.log(index); | ||
if (index < r) { | ||
$(this).addClass("rated"); | ||
} | ||
|
||
$(this).hover( | ||
function(){ | ||
$(this).prevAll().andSelf().addClass("hover"); | ||
$(this).nextAll().removeClass("hover"); | ||
}, | ||
function(){ | ||
$(this).prevAll().andSelf().removeClass("hover"); | ||
} | ||
) | ||
}) | ||
|
||
} | ||
|
||
return this.each(function(){ | ||
if ( options ) { | ||
$.extend(defaults, options) | ||
} | ||
|
||
init($this); | ||
}); | ||
} | ||
|
||
$(function () { | ||
$('[data-role="rating"]').each(function () { | ||
$(this).Rating(); | ||
}) | ||
}) | ||
})(window.jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Metro UI CSS v 0.1.3 | ||
* Copyright 2012 Sergey Pimenov | ||
* Licensed under the MIT Lilcense | ||
* | ||
* Progress.less | ||
*/ | ||
|
||
.progress-bar { | ||
height: 5px; | ||
width: 100%; | ||
margin-bottom: 10px; | ||
|
||
.bar { | ||
float: left; | ||
width: 0; | ||
background-color: #008287; | ||
height: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Metro UI CSS v 0.1.3 | ||
* Copyright 2012 Sergey Pimenov | ||
* Licensed under the MIT Lilcense | ||
* | ||
* rating.less | ||
*/ | ||
|
||
@image_big_star: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAABOCAYAAADRl20RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cD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A8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5QzA5Qjg2QTFDRjUxMUUyOUY5OEFBNUNEQ0RBREM1RCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5QzA5Qjg2QjFDRjUxMUUyOUY5OEFBNUNEQ0RBREM1RCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pu4JKw4AAAILSURBVHjavJRPSFRRFIfnjUM22hiFTM4YlNhSIQKjaCdRCYlki2jjqsEgN4FbN7rUdtHKhbhrkdBsWigUVKtwaRakxuj8IUMYC9xMTt/B895Mj3vfzKh04ePd+879nXfvub93nWQyGbK085CDfVMwHLK3CxC3BW3CKJyFzkaFruAcREwT5GVLgLBJ9/rDFy+J8DRctmWm9frGP2FZJufhF/TBqVBwW4NVKLt7/A3voWARlOQr8FlE/uJIcMUi3NYztVa1wyKMa6GswoQ+9+ATfK+qbtx/HG47CWcgo0su6Z5zWvWEFvIgUywWc/vtsAXrPn/uabI22DEVp1B90PnHT0egWYd/4Et1wkg2mzV7cWpmlEeR+Ou6vYpI/ozr8LBRkz8ABwZJYnST40xOd+mk6vZKKyltDN744kU5jiswF+DT577xW1lReH9iXLJfha81DC7H8Axuodl2yuWyWxA5p3kYMojkJ3iE4KW3R1eo4os8NgzCBUT3g6p6z7LM2ySNBgndrJu65Be6t1YYMArJKBfsNZiFHpaWhif0+3X5w7YvytVxl8kp2HVf0n+n906G5CcqNaY4JroXP4xAsy0edJOLye805NVLSx+PbnKSmE3OPv6zyb/dvNGwydFUTM5eapocgdnkiK0mR3Q4k5P0mE1Oxn9MztLSUL/JmZwCz+T0PZOT3DP5XwEGAJj+1ghmlpwuAAAAAElFTkSuQmCC); | ||
|
||
.static-rating { | ||
background: @image_big_star top left repeat-x; | ||
height: 26px; | ||
width: 134px; | ||
|
||
.rating-value { | ||
background: @image_big_star top left repeat-x; | ||
background-position: left -26px; | ||
height: 26px; | ||
width: 0; | ||
} | ||
|
||
&.small { | ||
background: @image_small_star top left repeat-x; | ||
height: 12px; | ||
width: 70px; | ||
|
||
.rating-value { | ||
background: @image_small_star top left repeat-x; | ||
background-position: left -13px; | ||
height: 12px; | ||
width: 0; | ||
} | ||
} | ||
|
||
.clearfix; | ||
} | ||
|
||
.rating { | ||
a { | ||
float: left; | ||
display: block; | ||
width: 26px; | ||
height: 26px; | ||
position: relative; | ||
background: @image_big_star top left; | ||
|
||
&.rated { | ||
background-position: 0 -26px; | ||
} | ||
|
||
&.hover { | ||
background-position: 0 -52px; | ||
} | ||
} | ||
|
||
&.small { | ||
a { | ||
float: left; | ||
display: block; | ||
width: 12px; | ||
height: 12px; | ||
position: relative; | ||
background: @image_small_star top left; | ||
|
||
&.rated { | ||
background-position: 0 -13px; | ||
} | ||
|
||
&.hover { | ||
background-position: 0 -26px; | ||
} | ||
} | ||
} | ||
|
||
.clearfix; | ||
} |
Oops, something went wrong.