dever 6 years ago
parent
commit
a2353f54e2

+ 423 - 0
assets/lib/color/colpick.css

@@ -0,0 +1,423 @@
+/*
+colpick Color Picker / colpick.com
+*/
+
+/*Main container*/
+.colpick {
+	position: absolute;
+	width: 346px;
+	height: 170px;
+	overflow: hidden;
+	display: none;
+	font-family: Arial, Helvetica, sans-serif;
+	background:#ebebeb;
+	border: 1px solid #bbb;
+	-webkit-border-radius: 5px;
+	-moz-border-radius: 5px;
+	border-radius: 5px;
+
+	/*Prevents selecting text when dragging the selectors*/
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	-o-user-select: none;
+	user-select: none;
+}
+.colpick,
+.colpick * {
+	-moz-box-sizing: content-box;
+	-webkit-box-sizing: content-box;
+	box-sizing: content-box;
+}
+/*Color selection box*/
+.colpick_color {
+	position: absolute;
+	left: 7px;
+	top: 7px;
+	width: 156px;
+	height: 156px;
+	overflow: hidden;
+	outline: 1px solid #aaa;
+	cursor: crosshair;
+}
+.colpick_color_overlay1 {
+	position: absolute;
+	left:0;
+	top:0;
+	width: 156px;
+	height: 156px;
+	filter:  progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff'); /* IE6 & IE7 */
+	-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')"; /* IE8 */
+	background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
+}
+.colpick_color_overlay2 {
+	position: absolute;
+	left:0;
+	top:0;
+	width: 156px;
+	height: 156px;
+	filter:  progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000'); /* IE6 & IE7 */
+	-ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')"; /* IE8 */
+	background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1));
+}
+/*HSL gradients are different*/
+.colpick_hsl .colpick_color_overlay1 {
+	background: linear-gradient(to right, rgba(128,128,128,1) 0%, rgba(128,128,128,0) 100%);
+}
+.colpick_hsl .colpick_color_overlay2 {
+	background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0) 50%, rgba(0,0,0,1) 100%);
+}
+/*Circular color selector*/
+.colpick_selector_outer {
+	background:none;
+	position: absolute;
+	width: 11px;
+	height: 11px;
+	margin: -6px 0 0 -6px;
+	border: 1px solid black;
+	border-radius: 50%;
+}
+.colpick_selector_inner{
+	position: absolute;
+	width: 9px;
+	height: 9px;
+	border: 1px solid white;
+	border-radius: 50%;
+}
+/*Vertical hue bar*/
+.colpick_hue {
+	position: absolute;
+	top: 6px;
+	left: 175px;
+	width: 19px;
+	height: 156px;
+	border: 1px solid #aaa;
+	cursor: n-resize;
+}
+/*Hue bar sliding indicator*/
+.colpick_hue_arrs {
+	position: absolute;
+	left: -8px;
+	width: 35px;
+	height: 7px;
+	margin: -7px 0 0 0;
+}
+.colpick_hue_larr {
+	position:absolute;
+	width: 0; 
+	height: 0; 
+	border-top: 6px solid transparent;
+	border-bottom: 6px solid transparent;
+	border-left: 7px solid #858585;
+}
+.colpick_hue_rarr {
+	position:absolute;
+	right:0;
+	width: 0; 
+	height: 0; 
+	border-top: 6px solid transparent;
+	border-bottom: 6px solid transparent; 
+	border-right: 7px solid #858585; 
+}
+/*New color box*/
+.colpick_new_color {
+	position: absolute;
+	left: 207px;
+	top: 6px;
+	width: 60px;
+	height: 27px;
+	background: #f00;
+	border: 1px solid #8f8f8f;
+}
+/*Current color box*/
+.colpick_current_color {
+	position: absolute;
+	left: 277px;
+	top: 6px;
+	width: 60px;
+	height: 27px;
+	background: #f00;
+	border: 1px solid #8f8f8f;
+}
+/*Input field containers*/
+.colpick_field, .colpick_hex_field  {
+	position: absolute;
+	height: 20px;
+	width: 60px;
+	overflow:hidden;
+	background:#f3f3f3;
+	color:#b8b8b8;
+	font-size:12px;
+	border:1px solid #bdbdbd;
+	-webkit-border-radius: 3px;
+	-moz-border-radius: 3px;
+	border-radius: 3px;
+}
+.colpick_rgb_r {
+	top: 40px;
+	left: 207px;
+}
+.colpick_rgb_g {
+	top: 67px;
+	left: 207px;
+}
+.colpick_rgb_b {
+	top: 94px;
+	left: 207px;
+}
+.colpick_hsx_h {
+	top: 40px;
+	left: 277px;
+}
+.colpick_hsx_s {
+	top: 67px;
+	left: 277px;
+}
+.colpick_hsx_x {
+	top: 94px;
+	left: 277px;
+}
+.colpick_hex_field {
+	width: 68px;
+	left: 207px;
+	top: 121px;
+}
+/*Text field container on focus*/
+.colpick_focus {
+	border-color: #999;
+}
+/*Field label container*/
+.colpick_field_letter {
+	position: absolute;
+	width: 12px;
+	height: 20px;
+	line-height: 20px;
+	padding-left: 4px;
+	background: #efefef;
+	border-right: 1px solid #bdbdbd;
+	font-weight: bold;
+	color:#777;
+}
+/*Text inputs*/
+.colpick_field input, .colpick_hex_field input {
+	position: absolute;
+	right: 11px;
+	margin: 0;
+	padding: 0;
+	height: 20px;
+	line-height: 20px;
+	background: transparent;
+	border: none;
+	font-size: 12px;
+	font-family: Arial, Helvetica, sans-serif;
+	color: #555;
+	text-align: right;
+	outline: none;
+}
+.colpick_hex_field input {
+	right: 4px;
+}
+/*Field up/down arrows*/
+.colpick_field_arrs {
+	position: absolute;
+	top: 0;
+	right: 0;
+	width: 9px;
+	height: 21px;
+	cursor: n-resize;
+}
+.colpick_field_uarr {
+	position: absolute;
+	top: 5px;
+	width: 0; 
+	height: 0; 
+	border-left: 4px solid transparent;
+	border-right: 4px solid transparent;
+	border-bottom: 4px solid #959595;
+}
+.colpick_field_darr {
+	position: absolute;
+	bottom:5px;
+	width: 0; 
+	height: 0; 
+	border-left: 4px solid transparent;
+	border-right: 4px solid transparent;
+	border-top: 4px solid #959595;
+}
+/*Submit/Select button*/
+.colpick_submit {
+	position: absolute;
+	left: 207px;
+	top: 149px;
+	width: 130px;
+	height: 22px;
+	line-height:22px;
+	background: #efefef;
+	text-align: center;
+	color: #555;
+	font-size: 12px;
+	font-weight:bold;
+	border: 1px solid #bdbdbd;
+	-webkit-border-radius: 3px;
+	-moz-border-radius: 3px;
+	border-radius: 3px;
+}
+.colpick_submit:hover {
+	background:#f3f3f3;
+	border-color:#999;
+	cursor: pointer;
+}
+
+/*full layout with no submit button*/
+.colpick_full_ns  .colpick_submit, .colpick_full_ns .colpick_current_color{
+	display:none;
+}
+.colpick_full_ns .colpick_new_color {
+	width: 130px;
+	height: 25px;
+}
+.colpick_full_ns .colpick_rgb_r, .colpick_full_ns .colpick_hsx_h {
+	top: 42px;
+}
+.colpick_full_ns .colpick_rgb_g, .colpick_full_ns .colpick_hsx_s {
+	top: 73px;
+}
+.colpick_full_ns .colpick_rgb_b, .colpick_full_ns .colpick_hsx_x {
+	top: 104px;
+}
+.colpick_full_ns .colpick_hex_field {
+	top: 135px;
+}
+
+/*rgbhex layout*/
+.colpick_rgbhex .colpick_hsx_h, .colpick_rgbhex .colpick_hsx_s, .colpick_rgbhex .colpick_hsx_x {
+	display:none;
+}
+.colpick_rgbhex {
+	width:282px;
+}
+.colpick_rgbhex .colpick_field, .colpick_rgbhex .colpick_submit {
+	width:68px;
+}
+.colpick_rgbhex .colpick_new_color {
+	width:34px;
+	border-right:none;
+}
+.colpick_rgbhex .colpick_current_color {
+	width:34px;
+	left:240px;
+	border-left:none;
+}
+
+/*rgbhex layout, no submit button*/
+.colpick_rgbhex_ns  .colpick_submit, .colpick_rgbhex_ns .colpick_current_color{
+	display:none;
+}
+.colpick_rgbhex_ns .colpick_new_color{
+	width:68px;
+	border: 1px solid #8f8f8f;
+}
+.colpick_rgbhex_ns .colpick_rgb_r {
+	top: 42px;
+}
+.colpick_rgbhex_ns .colpick_rgb_g {
+	top: 73px;
+}
+.colpick_rgbhex_ns .colpick_rgb_b {
+	top: 104px;
+}
+.colpick_rgbhex_ns .colpick_hex_field {
+	top: 135px;
+}
+
+/*hex layout*/
+.colpick_hex .colpick_hsx_h, .colpick_hex .colpick_hsx_s, .colpick_hex .colpick_hsx_x, .colpick_hex .colpick_rgb_r, .colpick_hex .colpick_rgb_g, .colpick_hex .colpick_rgb_b {
+	display:none;
+}
+.colpick_hex {
+	width:206px;
+	height:201px;
+}
+.colpick_hex .colpick_hex_field {
+	width:72px;
+	height:25px;
+	top:168px;
+	left:80px;
+}
+.colpick_hex .colpick_hex_field div, .colpick_hex .colpick_hex_field input {
+	height: 25px;
+	line-height: 25px;
+}
+.colpick_hex .colpick_new_color {
+	left:9px;
+	top:168px;
+	width:30px;
+	border-right:none;
+}
+.colpick_hex .colpick_current_color {
+	left:39px;
+	top:168px;
+	width:30px;
+	border-left:none;
+}
+.colpick_hex .colpick_submit {
+	left:164px;
+	top: 168px;
+	width:30px;
+	height:25px;
+	line-height: 25px;
+}
+
+/*hex layout, no submit button*/
+.colpick_hex_ns  .colpick_submit, .colpick_hex_ns .colpick_current_color {
+	display:none;
+}
+.colpick_hex_ns .colpick_hex_field {
+	width:80px;
+}
+.colpick_hex_ns .colpick_new_color{
+	width:60px;
+	border: 1px solid #8f8f8f;
+}
+
+/*Dark color scheme*/
+.colpick_dark {
+	background: #161616;
+	border-color: #2a2a2a;
+}
+.colpick_dark .colpick_color {
+	outline-color: #333;
+}
+.colpick_dark .colpick_hue {
+	border-color: #555;
+}
+.colpick_dark .colpick_field, .colpick_dark .colpick_hex_field {
+	background: #101010;
+	border-color: #2d2d2d;
+}
+.colpick_dark .colpick_field_letter {
+	background: #131313;
+	border-color: #2d2d2d;
+	color: #696969;
+}
+.colpick_dark .colpick_field input, .colpick_dark .colpick_hex_field input {
+	color: #7a7a7a;
+}
+.colpick_dark .colpick_field_uarr {
+	border-bottom-color:#696969;
+}
+.colpick_dark .colpick_field_darr {
+	border-top-color:#696969;
+}
+.colpick_dark .colpick_focus {
+	border-color:#444;
+}
+.colpick_dark .colpick_submit {
+	background: #131313;
+	border-color:#2d2d2d;
+	color:#7a7a7a;
+}
+.colpick_dark .colpick_submit:hover {
+	background-color:#101010;
+	border-color:#444;
+}

File diff suppressed because it is too large
+ 10 - 0
assets/lib/color/colpick.js


+ 34 - 1
assets/lib/manage/main.js

@@ -26,6 +26,7 @@ function init()
 	initPic();
 	initDate();
 	initLayui();
+	initColor();
 
 	//更新页面一些功能,上边的一些功能等找时间再优化吧
 	dever_update.init();
@@ -51,6 +52,34 @@ function initLayui()
 	});
 }
 
+function initColor()
+{
+	if ($('.dever-color').length) {
+		$('.dever-color').each(function()
+		{
+			var self = $(this);
+			var val = self.val();
+			if (!val) {
+				val = '#000000';
+			}
+			self.css('border-right', '40px solid '+val);
+			self.colpick({
+				layout:'hex',
+				submit:0,
+				colorScheme:'dark',
+				color: val,
+				onChange : function (hsb,hex,rgb,el,bySetColor) {
+					$(el).css('border-color','#'+hex);
+					if(!bySetColor) $(el).val('#' + hex);
+				}
+			}).keyup(function(){
+				$(this).colpickSetColor(this.value);
+			});
+		})
+		
+	}
+}
+
 function formData(form)
 {
 	var d = {};
@@ -952,6 +981,7 @@ function checkbox()
 		checkbox.each(function()
 		{
 			var self = $(this);
+			var len = $("." + name + "-" + self.val()).length;
 			$("." + name + "-" + self.val()).each(function()
 			{
 				$(this).click(function()
@@ -960,7 +990,10 @@ function checkbox()
 					
 					if($(this).get(0).checked == true)
 					{
-						self.get(0).checked = true;
+						if ($("." + name + "-" + self.val()+":checked").length >= len) {
+							self.get(0).checked = true;
+						}
+						
 						if(self.attr('type') == 'radio')
 						{
 							//如果父选项是radio类型,做下限制

BIN
assets/lib/star/img/cancel-off.png


BIN
assets/lib/star/img/cancel-on.png


BIN
assets/lib/star/img/star-half.png


BIN
assets/lib/star/img/star-off.png


BIN
assets/lib/star/img/star-on.png


+ 473 - 0
assets/lib/star/jquery.raty.js

@@ -0,0 +1,473 @@
+/*!
+ * jQuery Raty - A Star Rating Plugin
+ * ------------------------------------------------------------------
+ *
+ * jQuery Raty is a plugin that generates a customizable star rating.
+ *
+ * Licensed under The MIT License
+ *
+ * @version        2.5.2
+ * @since          2010.06.11
+ * @author         Washington Botelho
+ * @documentation  wbotelhos.com/raty
+ *
+ * ------------------------------------------------------------------
+ *
+ *  <div id="star"></div>
+ *
+ *  $('#star').raty();
+ *
+ */
+
+;(function($) {
+
+  var methods = {
+    init: function(settings) {
+      return this.each(function() {
+        methods.destroy.call(this);
+
+        this.opt = $.extend(true, {}, $.fn.raty.defaults, settings);
+
+        var that  = $(this),
+            inits = ['number', 'readOnly', 'score', 'scoreName'];
+
+        methods._callback.call(this, inits);
+
+        if (this.opt.precision) {
+          methods._adjustPrecision.call(this);
+        }
+
+        this.opt.number = methods._between(this.opt.number, 0, this.opt.numberMax)
+
+        this.opt.path = this.opt.path || '';
+
+        if (this.opt.path && this.opt.path.slice(this.opt.path.length - 1, this.opt.path.length) !== '/') {
+          this.opt.path += '/';
+        }
+
+        this.stars = methods._createStars.call(this);
+        this.score = methods._createScore.call(this);
+
+        methods._apply.call(this, this.opt.score);
+
+        var space  = this.opt.space ? 4 : 0,
+            width  = this.opt.width || (this.opt.number * this.opt.size + this.opt.number * space);
+
+        if (this.opt.cancel) {
+          this.cancel = methods._createCancel.call(this);
+
+          width += (this.opt.size + space);
+        }
+
+        if (this.opt.readOnly) {
+          methods._lock.call(this);
+        } else {
+          that.css('cursor', 'pointer');
+          methods._binds.call(this);
+        }
+
+        if (this.opt.width !== false) {
+          that.css('width', width);
+        }
+
+        methods._target.call(this, this.opt.score);
+
+        that.data({ 'settings': this.opt, 'raty': true });
+      });
+    }, _adjustPrecision: function() {
+      this.opt.targetType = 'score';
+      this.opt.half       = true;
+    }, _apply: function(score) {
+      if (score && score > 0) {
+        score = methods._between(score, 0, this.opt.number);
+        this.score.val(score);
+      }
+
+      methods._fill.call(this, score);
+
+      if (score) {
+        methods._roundStars.call(this, score);
+      }
+    }, _between: function(value, min, max) {
+      return Math.min(Math.max(parseFloat(value), min), max);
+    }, _binds: function() {
+      if (this.cancel) {
+        methods._bindCancel.call(this);
+      }
+
+      methods._bindClick.call(this);
+      methods._bindOut.call(this);
+      methods._bindOver.call(this);
+    }, _bindCancel: function() {
+      methods._bindClickCancel.call(this);
+      methods._bindOutCancel.call(this);
+      methods._bindOverCancel.call(this);
+    }, _bindClick: function() {
+      var self = this,
+          that = $(self);
+
+      self.stars.on('click.raty', function(evt) {
+        self.score.val((self.opt.half || self.opt.precision) ? that.data('score') : this.alt);
+
+        if (self.opt.click) {
+          self.opt.click.call(self, parseFloat(self.score.val()), evt);
+        }
+      });
+    }, _bindClickCancel: function() {
+      var self = this;
+
+      self.cancel.on('click.raty', function(evt) {
+        self.score.removeAttr('value');
+
+        if (self.opt.click) {
+          self.opt.click.call(self, null, evt);
+        }
+      });
+    }, _bindOut: function() {
+      var self = this;
+
+      $(this).on('mouseleave.raty', function(evt) {
+        var score = parseFloat(self.score.val()) || undefined;
+
+        methods._apply.call(self, score);
+        methods._target.call(self, score, evt);
+
+        if (self.opt.mouseout) {
+          self.opt.mouseout.call(self, score, evt);
+        }
+      });
+    }, _bindOutCancel: function() {
+      var self = this;
+
+      self.cancel.on('mouseleave.raty', function(evt) {
+        $(this).attr('src', self.opt.path + self.opt.cancelOff);
+
+        if (self.opt.mouseout) {
+          self.opt.mouseout.call(self, self.score.val() || null, evt);
+        }
+      });
+    }, _bindOverCancel: function() {
+      var self = this;
+
+      self.cancel.on('mouseover.raty', function(evt) {
+        $(this).attr('src', self.opt.path + self.opt.cancelOn);
+
+        self.stars.attr('src', self.opt.path + self.opt.starOff);
+
+        methods._target.call(self, null, evt);
+
+        if (self.opt.mouseover) {
+          self.opt.mouseover.call(self, null);
+        }
+      });
+    }, _bindOver: function() {
+      var self   = this,
+          that   = $(self),
+          action = self.opt.half ? 'mousemove.raty' : 'mouseover.raty';
+
+      self.stars.on(action, function(evt) {
+        var score = parseInt(this.alt, 10);
+
+        if (self.opt.half) {
+          var position = parseFloat((evt.pageX - $(this).offset().left) / self.opt.size),
+              plus     = (position > .5) ? 1 : .5;
+
+          score = score - 1 + plus;
+
+          methods._fill.call(self, score);
+
+          if (self.opt.precision) {
+            score = score - plus + position;
+          }
+
+          methods._roundStars.call(self, score);
+
+          that.data('score', score);
+        } else {
+          methods._fill.call(self, score);
+        }
+
+        methods._target.call(self, score, evt);
+
+        if (self.opt.mouseover) {
+          self.opt.mouseover.call(self, score, evt);
+        }
+      });
+    }, _callback: function(options) {
+      for (i in options) {
+        if (typeof this.opt[options[i]] === 'function') {
+          this.opt[options[i]] = this.opt[options[i]].call(this);
+        }
+      }
+    }, _createCancel: function() {
+      var that   = $(this),
+          icon   = this.opt.path + this.opt.cancelOff,
+          cancel = $('<img />', { src: icon, alt: 'x', title: this.opt.cancelHint, 'class': 'raty-cancel' });
+
+      if (this.opt.cancelPlace == 'left') {
+        that.prepend('&#160;').prepend(cancel);
+      } else {
+        that.append('&#160;').append(cancel);
+      }
+
+      return cancel;
+    }, _createScore: function() {
+      return $('<input />', { type: 'hidden', name: this.opt.scoreName }).appendTo(this);
+    }, _createStars: function() {
+      var that = $(this);
+
+      for (var i = 1; i <= this.opt.number; i++) {
+        var title = methods._getHint.call(this, i),
+            icon  = (this.opt.score && this.opt.score >= i) ? 'starOn' : 'starOff';
+
+        icon = this.opt.path + this.opt[icon];
+
+        $('<img />', { src : icon, alt: i, title: title }).appendTo(this);
+
+        if (this.opt.space) {
+          that.append((i < this.opt.number) ? '&#160;' : '');
+        }
+      }
+
+      return that.children('img');
+    }, _error: function(message) {
+      $(this).html(message);
+
+      $.error(message);
+    }, _fill: function(score) {
+      var self  = this,
+          hash  = 0;
+
+      for (var i = 1; i <= self.stars.length; i++) {
+        var star   = self.stars.eq(i - 1),
+            select = self.opt.single ? (i == score) : (i <= score);
+
+        if (self.opt.iconRange && self.opt.iconRange.length > hash) {
+          var irange = self.opt.iconRange[hash],
+              on     = irange.on  || self.opt.starOn,
+              off    = irange.off || self.opt.starOff,
+              icon   = select ? on : off;
+
+          if (i <= irange.range) {
+            star.attr('src', self.opt.path + icon);
+          }
+
+          if (i == irange.range) {
+            hash++;
+          }
+        } else {
+          var icon = select ? 'starOn' : 'starOff';
+
+          star.attr('src', this.opt.path + this.opt[icon]);
+        }
+      }
+    }, _getHint: function(score) {
+      var hint = this.opt.hints[score - 1];
+      return (hint === '') ? '' : (hint || score);
+    }, _lock: function() {
+      var score = parseInt(this.score.val(), 10), // TODO: 3.1 >> [['1'], ['2'], ['3', '.1', '.2']]
+          hint  = score ? methods._getHint.call(this, score) : this.opt.noRatedMsg;
+
+      $(this).data('readonly', true).css('cursor', '').attr('title', hint);
+
+      this.score.attr('readonly', 'readonly');
+      this.stars.attr('title', hint);
+
+      if (this.cancel) {
+        this.cancel.hide();
+      }
+    }, _roundStars: function(score) {
+      var rest = (score - Math.floor(score)).toFixed(2);
+
+      if (rest > this.opt.round.down) {
+        var icon = 'starOn';                                 // Up:   [x.76 .. x.99]
+
+        if (this.opt.halfShow && rest < this.opt.round.up) { // Half: [x.26 .. x.75]
+          icon = 'starHalf';
+        } else if (rest < this.opt.round.full) {             // Down: [x.00 .. x.5]
+          icon = 'starOff';
+        }
+
+        this.stars.eq(Math.ceil(score) - 1).attr('src', this.opt.path + this.opt[icon]);
+      }                              // Full down: [x.00 .. x.25]
+    }, _target: function(score, evt) {
+      if (this.opt.target) {
+        var target = $(this.opt.target);
+
+        if (target.length === 0) {
+          methods._error.call(this, 'Target selector invalid or missing!');
+        }
+
+        if (this.opt.targetFormat.indexOf('{score}') < 0) {
+          methods._error.call(this, 'Template "{score}" missing!');
+        }
+
+        var mouseover = evt && evt.type == 'mouseover';
+
+        if (score === undefined) {
+          score = this.opt.targetText;
+        } else if (score === null) {
+          score = mouseover ? this.opt.cancelHint : this.opt.targetText;
+        } else {
+          if (this.opt.targetType == 'hint') {
+            score = methods._getHint.call(this, Math.ceil(score));
+          } else if (this.opt.precision) {
+            score = parseFloat(score).toFixed(1);
+          }
+
+          if (!mouseover && !this.opt.targetKeep) {
+            score = this.opt.targetText;
+          }
+        }
+
+        if (score) {
+          score = this.opt.targetFormat.toString().replace('{score}', score);
+        }
+
+        if (target.is(':input')) {
+          target.val(score);
+        } else {
+          target.html(score);
+        }
+      }
+    }, _unlock: function() {
+      $(this).data('readonly', false).css('cursor', 'pointer').removeAttr('title');
+
+      this.score.removeAttr('readonly', 'readonly');
+
+      for (var i = 0; i < this.opt.number; i++) {
+        this.stars.eq(i).attr('title', methods._getHint.call(this, i + 1));
+      }
+
+      if (this.cancel) {
+        this.cancel.css('display', '');
+      }
+    }, cancel: function(click) {
+      return this.each(function() {
+        if ($(this).data('readonly') !== true) {
+          methods[click ? 'click' : 'score'].call(this, null);
+          this.score.removeAttr('value');
+        }
+      });
+    }, click: function(score) {
+      return $(this).each(function() {
+        if ($(this).data('readonly') !== true) {
+          methods._apply.call(this, score);
+
+          if (!this.opt.click) {
+            methods._error.call(this, 'You must add the "click: function(score, evt) { }" callback.');
+          }
+
+          this.opt.click.call(this, score, { type: 'click' });
+
+          methods._target.call(this, score);
+        }
+      });
+    }, destroy: function() {
+      return $(this).each(function() {
+        var that = $(this),
+            raw  = that.data('raw');
+
+        if (raw) {
+          that.off('.raty').empty().css({ cursor: raw.style.cursor, width: raw.style.width }).removeData('readonly');
+        } else {
+          that.data('raw', that.clone()[0]);
+        }
+      });
+    }, getScore: function() {
+      var score = [],
+          value ;
+
+      $(this).each(function() {
+        value = this.score.val();
+
+        score.push(value ? parseFloat(value) : undefined);
+      });
+
+      return (score.length > 1) ? score : score[0];
+    }, readOnly: function(readonly) {
+      return this.each(function() {
+        var that = $(this);
+
+        if (that.data('readonly') !== readonly) {
+          if (readonly) {
+            that.off('.raty').children('img').off('.raty');
+
+            methods._lock.call(this);
+          } else {
+            methods._binds.call(this);
+            methods._unlock.call(this);
+          }
+
+          that.data('readonly', readonly);
+        }
+      });
+    }, reload: function() {
+      return methods.set.call(this, {});
+    }, score: function() {
+      return arguments.length ? methods.setScore.apply(this, arguments) : methods.getScore.call(this);
+    }, set: function(settings) {
+      return this.each(function() {
+        var that   = $(this),
+            actual = that.data('settings'),
+            news   = $.extend({}, actual, settings);
+
+        that.raty(news);
+      });
+    }, setScore: function(score) {
+      return $(this).each(function() {
+        if ($(this).data('readonly') !== true) {
+          methods._apply.call(this, score);
+          methods._target.call(this, score);
+        }
+      });
+    }
+  };
+
+  $.fn.raty = function(method) {
+    if (methods[method]) {
+      return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+    } else if (typeof method === 'object' || !method) {
+      return methods.init.apply(this, arguments);
+    } else {
+      $.error('Method ' + method + ' does not exist!');
+    }
+  };
+
+  $.fn.raty.defaults = {
+    cancel        : false,
+    cancelHint    : 'Cancel this rating!',
+    cancelOff     : 'cancel-off.png',
+    cancelOn      : 'cancel-on.png',
+    cancelPlace   : 'left',
+    click         : undefined,
+    half          : false,
+    halfShow      : true,
+    hints         : ['bad', 'poor', 'regular', 'good', 'gorgeous'],
+    iconRange     : undefined,
+    mouseout      : undefined,
+    mouseover     : undefined,
+    noRatedMsg    : 'Not rated yet!',
+    number        : 5,
+    numberMax     : 20,
+    path          : '',
+    precision     : false,
+    readOnly      : false,
+    round         : { down: .25, full: .6, up: .76 },
+    score         : undefined,
+    scoreName     : 'score',
+    single        : false,
+    size          : 16,
+    space         : true,
+    starHalf      : 'star-half.png',
+    starOff       : 'star-off.png',
+    starOn        : 'star-on.png',
+    target        : undefined,
+    targetFormat  : '{score}',
+    targetKeep    : false,
+    targetText    : '',
+    targetType    : 'hint',
+    width         : undefined
+  };
+
+})(jQuery);

File diff suppressed because it is too large
+ 11 - 0
assets/lib/star/jquery.raty.min.js


Some files were not shown because too many files changed in this diff