app/Resources/static-src/libs/jquery-raty.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

(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.charAt(this.opt.path.length - 1) !== '/') {
          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);

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。