PageSourceSearch

https://mogilevkino.by/movie_rental/js/jquery.raty.js

js mogilevkino.by collected 2026-10-02 17:17:45 UTC 22,483 bytes, 830 lines download raw bytes

1/******/ (function(modules) { // webpackBootstrap
2/******/ 	// The module cache
3/******/ 	var installedModules = {};
4/******/
5/******/ 	// The require function
6/******/ 	function __webpack_require__(moduleId) {
7/******/
8/******/ 		// Check if module is in cache
9/******/ 		if(installedModules[moduleId]) {
10/******/ 			return installedModules[moduleId].exports;
11/******/ 		}
12/******/ 		// Create a new module (and put it into the cache)
13/******/ 		var module = installedModules[moduleId] = {
14/******/ 			i: moduleId,
15/******/ 			l: false,
16/******/ 			exports: {}
17/******/ 		};
18/******/
19/******/ 		// Execute the module function
20/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ 		// Flag the module as loaded
23/******/ 		module.l = true;
24/******/
25/******/ 		// Return the exports of the module
26/******/ 		return module.exports;
27/******/ 	}
28/******/
29/******/
30/******/ 	// expose the modules object (__webpack_modules__)
31/******/ 	__webpack_require__.m = modules;
32/******/
33/******/ 	// expose the module cache
34/******/ 	__webpack_require__.c = installedModules;
35/******/
36/******/ 	// define getter function for harmony exports
37/******/ 	__webpack_require__.d = function(exports, name, getter) {
38/******/ 		if(!__webpack_require__.o(exports, name)) {
39/******/ 			Object.defineProperty(exports, name, {
40/******/ 				configurable: false,
41/******/ 				enumerable: true,
42/******/ 				get: getter
43/******/ 			});
44/******/ 		}
45/******/ 	};
46/******/
47/******/ 	// getDefaultExport function for compatibility with non-harmony modules
48/******/ 	__webpack_require__.n = function(module) {
49/******/ 		var getter = module && module.__esModule ?
50/******/ 			function getDefault() { return module['default']; } :
51/******/ 			function getModuleExports() { return module; };
52/******/ 		__webpack_require__.d(getter, 'a', getter);
53/******/ 		return getter;
54/******/ 	};
55/******/
56/******/ 	// Object.prototype.hasOwnProperty.call
57/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58/******/
59/******/ 	// __webpack_public_path__
60/******/ 	__webpack_require__.p = "";
61/******/
62/******/ 	// Load entry module and return exports
63/******/ 	return __webpack_require__(__webpack_require__.s = 0);
64/******/ })
65/************************************************************************/
66/******/ ([
67/* 0 */
68/***/ (function(module, exports, __webpack_require__) {
69
70module.exports = __webpack_require__(1);
71
72
73/***/ }),
74/* 1 */
75/***/ (function(module, exports) {
76
77var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
78
79/*!
80 * jQuery Raty - A Star Rating Plugin
81 *
82 * The MIT License
83 *
84 * @author  : Washington Botelho
85 * @doc     : http://wbotelhos.com/raty
86 * @version : 2.7.1
87 *
88 */
89
90;
91(function ($) {
92  'use strict';
93
94  var methods = {
95    init: function init(options) {
96      return this.each(function () {
97        this.self = $(this);
98
99        methods.destroy.call(this.self);
100
101        this.opt = $.extend(true, {}, $.fn.raty.defaults, options);
102
103        methods._adjustCallback.call(this);
104        methods._adjustNumber.call(this);
105        methods._adjustHints.call(this);
106
107        this.opt.score = methods._adjustedScore.call(this, this.opt.score);
108
109        if (this.opt.starType !== 'img') {
110          methods._adjustStarType.call(this);
111        }
112
113        methods._adjustPath.call(this);
114        methods._createStars.call(this);
115
116        if (this.opt.cancel) {
117          methods._createCancel.call(this);
118        }
119
120        if (this.opt.precision) {
121          methods._adjustPrecision.call(this);
122        }
123
124        methods._createScore.call(this);
125        methods._apply.call(this, this.opt.score);
126        methods._setTitle.call(this, this.opt.score);
127        methods._target.call(this, this.opt.score);
128
129        if (this.opt.readOnly) {
130          methods._lock.call(this);
131        } else {
132          this.style.cursor = 'pointer';
133
134          methods._binds.call(this);
135        }
136      });
137    },
138
139    _adjustCallback: function _adjustCallback() {
140      var options = ['number', 'readOnly', 'score', 'scoreName', 'target', 'path'];
141
142      for (var i = 0; i < options.length; i++) {
143        if (typeof this.opt[options[i]] === 'function') {
144          this.opt[options[i]] = this.opt[options[i]].call(this);
145        }
146      }
147    },
148
149    _adjustedScore: function _adjustedScore(score) {
150      if (!score) {
151        return score;
152      }
153
154      return methods._between(score, 0, this.opt.number);
155    },
156
157    _adjustHints: function _adjustHints() {
158      if (!this.opt.hints) {
159        this.opt.hints = [];
160      }
161
162      if (!this.opt.halfShow && !this.opt.half) {
163        return;
164      }
165
166      var steps = this.opt.precision ? 10 : 2;
167
168      for (var i = 0; i < this.opt.number; i++) {
169        var group = this.opt.hints[i];
170
171        if (Object.prototype.toString.call(group) !== '[object Array]') {
172          group = [group];
173        }
174
175        this.opt.hints[i] = [];
176
177        for (var j = 0; j < steps; j++) {
178          var hint = group[j],
179              last = group[group.length - 1];
180
181          if (last === undefined) {
182            last = null;
183          }
184
185          this.opt.hints[i][j] = hint === undefined ? last : hint;
186        }
187      }
188    },
189
190    _adjustNumber: function _adjustNumber() {
191      this.opt.number = methods._between(this.opt.number, 1, this.opt.numberMax);
192    },
193
194    _adjustPath: function _adjustPath() {
195      this.opt.path = this.opt.path || '';
196
197      if (this.opt.path && this.opt.path.charAt(this.opt.path.length - 1) !== '/') {
198        this.opt.path += '/';
199      }
200    },
201
202    _adjustPrecision: function _adjustPrecision() {
203      this.opt.half = true;
204    },
205
206    _adjustStarType: function _adjustStarType() {
207      var replaces = ['cancelOff', 'cancelOn', 'starHalf', 'starOff', 'starOn'];
208
209      this.opt.path = '';
210
211      for (var i = 0; i < replaces.length; i++) {
212        this.opt[replaces[i]] = this.opt[replaces[i]].replace('.', '-');
213      }
214    },
215
216    _apply: function _apply(score) {
217      methods._fill.call(this, score);
218
219      if (score) {
220        if (score > 0) {
221          this.score.val(score);
222        }
223
224        methods._roundStars.call(this, score);
225      }
226    },
227
228    _between: function _between(value, min, max) {
229      return Math.min(Math.max(parseFloat(value), min), max);
230    },
231
232    _binds: function _binds() {
233      if (this.cancel) {
234        methods._bindOverCancel.call(this);
235        methods._bindClickCancel.call(this);
236        methods._bindOutCancel.call(this);
237      }
238
239      methods._bindOver.call(this);
240      methods._bindClick.call(this);
241      methods._bindOut.call(this);
242    },
243
244    _bindClick: function _bindClick() {
245      var that = this;
246
247      that.stars.on('click.raty', function (evt) {
248        var execute = true,
249            score = that.opt.half || that.opt.precision ? that.self.data('score') : this.alt || $(this).data('alt');
250
251        if (that.opt.click) {
252          execute = that.opt.click.call(that, +score, evt);
253        }
254
255        if (execute || execute === undefined) {
256          if (that.opt.half && !that.opt.precision) {
257            score = methods._roundHalfScore.call(that, score);
258          }
259
260          methods._apply.call(that, score);
261        }
262      });
263    },
264
265    _bindClickCancel: function _bindClickCancel() {
266      var that = this;
267
268      that.cancel.on('click.raty', function (evt) {
269        that.score.removeAttr('value');
270
271        if (that.opt.click) {
272          that.opt.click.call(that, null, evt);
273        }
274      });
275    },
276
277    _bindOut: function _bindOut() {
278      var that = this;
279
280      that.self.on('mouseleave.raty', function (evt) {
281        var score = +that.score.val() || undefined;
282
283        methods._apply.call(that, score);
284        methods._target.call(that, score, evt);
285        methods._resetTitle.call(that);
286
287        if (that.opt.mouseout) {
288          that.opt.mouseout.call(that, score, evt);
289        }
290      });
291    },
292
293    _bindOutCancel: function _bindOutCancel() {
294      var that = this;
295
296      that.cancel.on('mouseleave.raty', function (evt) {
297        var icon = that.opt.cancelOff;
298
299        if (that.opt.starType !== 'img') {
300          icon = that.opt.cancelClass + ' ' + icon;
301        }
302
303        methods._setIcon.call(that, this, icon);
304
305        if (that.opt.mouseout) {
306          var score = +that.score.val() || undefined;
307
308          that.opt.mouseout.call(that, score, evt);
309        }
310      });
311    },
312
313    _bindOver: function _bindOver() {
314      var that = this,
315          action = that.opt.half ? 'mousemove.raty' : 'mouseover.raty';
316
317      that.stars.on(action, function (evt) {
318        var score = methods._getScoreByPosition.call(that, evt, this);
319
320        methods._fill.call(that, score);
321
322        if (that.opt.half) {
323          methods._roundStars.call(that, score, evt);
324          methods._setTitle.call(that, score, evt);
325
326          that.self.data('score', score);
327        }
328
329        methods._target.call(that, score, evt);
330
331        if (that.opt.mouseover) {
332          that.opt.mouseover.call(that, score, evt);
333        }
334      });
335    },
336
337    _bindOverCancel: function _bindOverCancel() {
338      var that = this;
339
340      that.cancel.on('mouseover.raty', function (evt) {
341        var starOff = that.opt.path + that.opt.starOff,
342            icon = that.opt.cancelOn;
343
344        if (that.opt.starType === 'img') {
345          that.stars.attr('src', starOff);
346        } else {
347          icon = that.opt.cancelClass + ' ' + icon;
348
349          that.stars.attr('class', starOff);
350        }
351
352        methods._setIcon.call(that, this, icon);
353        methods._target.call(that, null, evt);
354
355        if (that.opt.mouseover) {
356          that.opt.mouseover.call(that, null);
357        }
358      });
359    },
360
361    _buildScoreField: function _buildScoreField() {
362      return $('<input />', { name: this.opt.scoreName, type: 'hidden' }).appendTo(this);
363    },
364
365    _createCancel: function _createCancel() {
366      var icon = this.opt.path + this.opt.cancelOff,
367          cancel = $('<' + this.opt.starType + ' />', { title: this.opt.cancelHint, 'class': this.opt.cancelClass });
368
369      if (this.opt.starType === 'img') {
370        cancel.attr({ src: icon, alt: 'x' });
371      } else {
372        // TODO: use $.data
373        cancel.attr('data-alt', 'x').addClass(icon);
374      }
375
376      if (this.opt.cancelPlace === 'left') {
377        this.self.prepend('&#160;').prepend(cancel);
378      } else {
379        this.self.append('&#160;').append(cancel);
380      }
381
382      this.cancel = cancel;
383    },
384
385    _createScore: function _createScore() {
386      var score = $(this.opt.targetScore);
387
388      this.score = score.length ? score : methods._buildScoreField.call(this);
389    },
390
391    _createStars: function _createStars() {
392      for (var i = 1; i <= this.opt.number; i++) {
393        var name = methods._nameForIndex.call(this, i),
394            attrs = { alt: i, src: this.opt.path + this.opt[name] };
395
396        if (this.opt.starType !== 'img') {
397          attrs = { 'data-alt': i, 'class': attrs.src }; // TODO: use $.data.
398        }
399
400        attrs.title = methods._getHint.call(this, i);
401
402        $('<' + this.opt.starType + ' />', attrs).appendTo(this);
403
404        if (this.opt.space) {
405          this.self.append(i < this.opt.number ? '&#160;' : '');
406        }
407      }
408
409      this.stars = this.self.children(this.opt.starType);
410    },
411
412    _error: function _error(message) {
413      $(this).text(message);
414
415      $.error(message);
416    },
417
418    _fill: function _fill(score) {
419      var hash = 0;
420
421      for (var i = 1; i <= this.stars.length; i++) {
422        var icon,
423            star = this.stars[i - 1],
424            turnOn = methods._turnOn.call(this, i, score);
425
426        if (this.opt.iconRange && this.opt.iconRange.length > hash) {
427          var irange = this.opt.iconRange[hash];
428
429          icon = methods._getRangeIcon.call(this, irange, turnOn);
430
431          if (i <= irange.range) {
432            methods._setIcon.call(this, star, icon);
433          }
434
435          if (i === irange.range) {
436            hash++;
437          }
438        } else {
439          icon = this.opt[turnOn ? 'starOn' : 'starOff'];
440
441          methods._setIcon.call(this, star, icon);
442        }
443      }
444    },
445
446    _getFirstDecimal: function _getFirstDecimal(number) {
447      var decimal = number.toString().split('.')[1],
448          result = 0;
449
450      if (decimal) {
451        result = parseInt(decimal.charAt(0), 10);
452
453        if (decimal.slice(1, 5) === '9999') {
454          result++;
455        }
456      }
457
458      return result;
459    },
460
461    _getRangeIcon: function _getRangeIcon(irange, turnOn) {
462      return turnOn ? irange.on || this.opt.starOn : irange.off || this.opt.starOff;
463    },
464
465    _getScoreByPosition: function _getScoreByPosition(evt, icon) {
466      var score = parseInt(icon.alt || icon.getAttribute('data-alt'), 10);
467
468      if (this.opt.half) {
469        var size = methods._getWidth.call(this),
470            percent = parseFloat((evt.pageX - $(icon).offset().left) / size);
471
472        score = score - 1 + percent;
473      }
474
475      return score;
476    },
477
478    _getHint: function _getHint(score, evt) {
479      if (score !== 0 && !score) {
480        return this.opt.noRatedMsg;
481      }
482
483      var decimal = methods._getFirstDecimal.call(this, score),
484          integer = Math.ceil(score),
485          group = this.opt.hints[(integer || 1) - 1],
486          hint = group,
487          set = !evt || this.move;
488
489      if (this.opt.precision) {
490        if (set) {
491          decimal = decimal === 0 ? 9 : decimal - 1;
492        }
493
494        hint = group[decimal];
495      } else if (this.opt.halfShow || this.opt.half) {
496        decimal = set && decimal === 0 ? 1 : decimal > 5 ? 1 : 0;
497
498        hint = group[decimal];
499      }
500
501      return hint === '' ? '' : hint || score;
502    },
503
504    _getWidth: function _getWidth() {
505      var width = this.stars[0].width || parseFloat(this.stars.eq(0).css('font-size'));
506
507      if (!width) {
508        methods._error.call(this, 'Could not get the icon width!');
509      }
510
511      return width;
512    },
513
514    _lock: function _lock() {
515      var hint = methods._getHint.call(this, this.score.val());
516
517      this.style.cursor = '';
518      this.title = hint;
519
520      this.score.prop('readonly', true);
521      this.stars.prop('title', hint);
522
523      if (this.cancel) {
524        this.cancel.hide();
525      }
526
527      this.self.data('readonly', true);
528    },
529
530    _nameForIndex: function _nameForIndex(i) {
531      return this.opt.score && this.opt.score >= i ? 'starOn' : 'starOff';
532    },
533
534    _resetTitle: function _resetTitle(star) {
535      for (var i = 0; i < this.opt.number; i++) {
536        this.stars[i].title = methods._getHint.call(this, i + 1);
537      }
538    },
539
540    _roundHalfScore: function _roundHalfScore(score) {
541      var integer = parseInt(score, 10),
542          decimal = methods._getFirstDecimal.call(this, score);
543
544      if (decimal !== 0) {
545        decimal = decimal > 5 ? 1 : 0.5;
546      }
547
548      return integer + decimal;
549    },
550
551    _roundStars: function _roundStars(score, evt) {
552      var decimal = (score % 1).toFixed(2),
553          name;
554
555      if (evt || this.move) {
556        name = decimal > 0.5 ? 'starOn' : 'starHalf';
557      } else if (decimal > this.opt.round.down) {
558        // Up:   [x.76 .. x.99]
559        name = 'starOn';
560
561        if (this.opt.halfShow && decimal < this.opt.round.up) {
562          // Half: [x.26 .. x.75]
563          name = 'starHalf';
564        } else if (decimal < this.opt.round.full) {
565          // Down: [x.00 .. x.5]
566          name = 'starOff';
567        }
568      }
569
570      if (name) {
571        var icon = this.opt[name],
572            star = this.stars[Math.ceil(score) - 1];
573
574        methods._setIcon.call(this, star, icon);
575      } // Full down: [x.00 .. x.25]
576    },
577
578    _setIcon: function _setIcon(star, icon) {
579      star[this.opt.starType === 'img' ? 'src' : 'className'] = this.opt.path + icon;
580    },
581
582    _setTarget: function _setTarget(target, score) {
583      if (score) {
584        score = this.opt.targetFormat.toString().replace('{score}', score);
585      }
586
587      if (target.is(':input')) {
588        target.val(score);
589      } else {
590        target.html(score);
591      }
592    },
593
594    _setTitle: function _setTitle(score, evt) {
595      if (score) {
596        var integer = parseInt(Math.ceil(score), 10),
597            star = this.stars[integer - 1];
598
599        star.title = methods._getHint.call(this, score, evt);
600      }
601    },
602
603    _target: function _target(score, evt) {
604      if (this.opt.target) {
605        var target = $(this.opt.target);
606
607        if (!target.length) {
608          methods._error.call(this, 'Target selector invalid or missing!');
609        }
610
611        var mouseover = evt && evt.type === 'mouseover';
612
613        if (score === undefined) {
614          score = this.opt.targetText;
615        } else if (score === null) {
616          score = mouseover ? this.opt.cancelHint : this.opt.targetText;
617        } else {
618          if (this.opt.targetType === 'hint') {
619            score = methods._getHint.call(this, score, evt);
620          } else if (this.opt.precision) {
621            score = parseFloat(score).toFixed(1);
622          }
623
624          var mousemove = evt && evt.type === 'mousemove';
625
626          if (!mouseover && !mousemove && !this.opt.targetKeep) {
627            score = this.opt.targetText;
628          }
629        }
630
631        methods._setTarget.call(this, target, score);
632      }
633    },
634
635    _turnOn: function _turnOn(i, score) {
636      return this.opt.single ? i === score : i <= score;
637    },
638
639    _unlock: function _unlock() {
640      this.style.cursor = 'pointer';
641      this.removeAttribute('title');
642
643      this.score.removeAttr('readonly');
644
645      this.self.data('readonly', false);
646
647      for (var i = 0; i < this.opt.number; i++) {
648        this.stars[i].title = methods._getHint.call(this, i + 1);
649      }
650
651      if (this.cancel) {
652        this.cancel.css('display', '');
653      }
654    },
655
656    cancel: function cancel(click) {
657      return this.each(function () {
658        var self = $(this);
659
660        if (self.data('readonly') !== true) {
661          methods[click ? 'click' : 'score'].call(self, null);
662
663          this.score.removeAttr('value');
664        }
665      });
666    },
667
668    click: function click(score) {
669      return this.each(function () {
670        if ($(this).data('readonly') !== true) {
671          score = methods._adjustedScore.call(this, score);
672
673          methods._apply.call(this, score);
674
675          if (this.opt.click) {
676            this.opt.click.call(this, score, $.Event('click'));
677          }
678
679          methods._target.call(this, score);
680        }
681      });
682    },
683
684    destroy: function destroy() {
685      return this.each(function () {
686        var self = $(this),
687            raw = self.data('raw');
688
689        if (raw) {
690          self.off('.raty').empty().css({ cursor: raw.style.cursor }).removeData('readonly');
691        } else {
692          self.data('raw', self.clone()[0]);
693        }
694      });
695    },
696
697    getScore: function getScore() {
698      var score = [],
699          value;
700
701      this.each(function () {
702        value = this.score.val();
703
704        score.push(value ? +value : undefined);
705      });
706
707      return score.length > 1 ? score : score[0];
708    },
709
710    move: function move(score) {
711      return this.each(function () {
712        var integer = parseInt(score, 10),
713            decimal = methods._getFirstDecimal.call(this, score);
714
715        if (integer >= this.opt.number) {
716          integer = this.opt.number - 1;
717          decimal = 10;
718        }
719
720        var width = methods._getWidth.call(this),
721            steps = width / 10,
722            star = $(this.stars[integer]),
723            percent = star.offset().left + steps * decimal,
724            evt = $.Event('mousemove', { pageX: percent });
725
726        this.move = true;
727
728        star.trigger(evt);
729
730        this.move = false;
731      });
732    },
733
734    readOnly: function readOnly(readonly) {
735      return this.each(function () {
736        var self = $(this);
737
738        if (self.data('readonly') !== readonly) {
739          if (readonly) {
740            self.off('.raty').children(this.opt.starType).off('.raty');
741
742            methods._lock.call(this);
743          } else {
744            methods._binds.call(this);
745            methods._unlock.call(this);
746          }
747
748          self.data('readonly', readonly);
749        }
750      });
751    },
752
753    reload: function reload() {
754      return methods.set.call(this, {});
755    },
756
757    score: function score() {
758      var self = $(this);
759
760      return arguments.length ? methods.setScore.apply(self, arguments) : methods.getScore.call(self);
761    },
762
763    set: function set(options) {
764      return this.each(function () {
765        $(this).raty($.extend({}, this.opt, options));
766      });
767    },
768
769    setScore: function setScore(score) {
770      return this.each(function () {
771        if ($(this).data('readonly') !== true) {
772          score = methods._adjustedScore.call(this, score);
773
774          methods._apply.call(this, score);
775          methods._target.call(this, score);
776        }
777      });
778    }
779  };
780
781  $.fn.raty = function (method) {
782    if (methods[method]) {
783      return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
784    } else if ((typeof method === 'undefined' ? 'undefined' : _typeof(method)) === 'object' || !method) {
785      return methods.init.apply(this, arguments);
786    } else {
787      $.error('Method ' + method + ' does not exist!');
788    }
789  };
790
791  $.fn.raty.defaults = {
792    cancel: false,
793    cancelClass: 'raty-cancel',
794    cancelHint: 'Cancel this rating!',
795    cancelOff: 'cancel-off.png',
796    cancelOn: 'cancel-on.png',
797    cancelPlace: 'left',
798    click: undefined,
799    half: false,
800    halfShow: true,
801    hints: ['bad', 'poor', 'regular', 'good', 'gorgeous'],
802    iconRange: undefined,
803    mouseout: undefined,
804    mouseover: undefined,
805    noRatedMsg: 'Not rated yet!',
806    number: 5,
807    numberMax: 20,
808    path: undefined,
809    precision: false,
810    readOnly: false,
811    round: { down: 0.25, full: 0.6, up: 0.76 },
812    score: undefined,
813    scoreName: 'score',
814    single: false,
815    space: true,
816    starHalf: 'star-half.png',
817    starOff: 'star-off.png',
818    starOn: 'star-on.png',
819    starType: 'img',
820    target: undefined,
821    targetFormat: '{score}',
822    targetKeep: false,
823    targetScore: undefined,
824    targetText: '',
825    targetType: 'hint'
826  };
827})(jQuery);
828
829/***/ })
830/******/ ]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.