PageSourceSearch

https://www.suleymaniyevakfi.org/wp-content/themes/sv-tema-01/desi…?ver=7c40140113ac957ed72a5901bdd8bf55

js suleymaniyevakfi.org collected 2026-09-24 10:03:18 UTC 15,679 bytes, 520 lines download raw bytes

1/*!
2 * jQuery Raty - A Star Rating Plugin
3 * ------------------------------------------------------------------
4 *
5 * jQuery Raty is a plugin that generates a customizable star rating.
6 *
7 * Licensed under The MIT License
8 *
9 * @version        2.5.2
10 * @since          2010.06.11
11 * @author         Washington Botelho
12 * @documentation  wbotelhos.com/raty
13 *
14 * ------------------------------------------------------------------
15 *
16 *  <div id="star"></div>
17 *
18 *  $('#star').raty();
19 *
20 */
21
22;(function($) {
23
24  var methods = {
25    init: function(settings) {
26      return this.each(function() {
27        methods.destroy.call(this);
28
29        this.opt = $.extend(true, {}, $.fn.raty.defaults, settings);
30
31        var that  = $(this),
32            inits = ['number', 'readOnly', 'score', 'scoreName'];
33
34        methods._callback.call(this, inits);
35
36        if (this.opt.precision) {
37          methods._adjustPrecision.call(this);
38        }
39
40        this.opt.number = methods._between(this.opt.number, 0, this.opt.numberMax);
41
42        this.opt.path = this.opt.path || '';
43
44        if (this.opt.path && this.opt.path.charAt( this.opt.path.length - 1 ) !== '/') {
45          this.opt.path += '/';
46        }
47
48        this.stars = methods._createStars.call(this);
49        this.score = methods._createScore.call(this);
50
51        methods._apply.call(this, this.opt.score);
52
53        var space  = this.opt.space ? 4 : 0,
54            width  = this.opt.width || (this.opt.number * this.opt.size + this.opt.number * space);
55
56        if (this.opt.cancel) {
57          this.cancel = methods._createCancel.call(this);
58
59          width += (this.opt.size + space);
60        }
61
62        if (this.opt.readOnly) {
63          methods._lock.call(this);
64        } else {
65          that.css('cursor', 'pointer');
66          methods._binds.call(this);
67        }
68
69        if (this.opt.width !== false) {
70			if(this.opt.font == true){
71				that.css('font-size', this.opt.size);
72			}else{
73				that.css('width', width);
74			}
75        }
76
77        methods._target.call(this, this.opt.score);
78
79        that.data({ 'settings': this.opt, 'raty': true });
80      });
81    }, _adjustPrecision: function() {
82      this.opt.targetType = 'score';
83      this.opt.half       = true;
84    }, _apply: function(score) {
85      if (score && score > 0) {
86        score = methods._between(score, 0, this.opt.number);
87        this.score.val(score);
88      }
89
90      methods._fill.call(this, score);
91
92      if (score) {
93        methods._roundStars.call(this, score);
94      }
95    }, _between: function(value, min, max) {
96      return Math.min(Math.max(parseFloat(value), min), max);
97    }, _binds: function() {
98      if (this.cancel) {
99        methods._bindCancel.call(this);
100      }
101
102      methods._bindClick.call(this);
103      methods._bindOut.call(this);
104      methods._bindOver.call(this);
105    }, _bindCancel: function() {
106      methods._bindClickCancel.call(this);
107      methods._bindOutCancel.call(this);
108      methods._bindOverCancel.call(this);
109    }, _bindClick: function() {
110      var self = this,
111          that = $(self);
112
113      self.stars.on('click.raty', function(evt) {
114		  if(self.opt.font == true){
115			  self.score.val((self.opt.half || self.opt.precision) ? that.data('score') : $(this).data('ival'));
116		  }else{
117			  self.score.val((self.opt.half || self.opt.precision) ? that.data('score') : this.alt);
118		  }
119        
120
121        if (self.opt.click) {
122          self.opt.click.call(self, parseFloat(self.score.val()), evt);
123        }
124      });
125    }, _bindClickCancel: function() {
126      var self = this;
127
128      self.cancel.on('click.raty', function(evt) {
129        self.score.removeAttr('value');
130
131        if (self.opt.click) {
132          self.opt.click.call(self, null, evt);
133        }
134      });
135    }, _bindOut: function() {
136      var self = this;
137
138      $(this).on('mouseleave.raty', function(evt) {
139        var score = parseFloat(self.score.val()) || undefined;
140
141        methods._apply.call(self, score);
142        methods._target.call(self, score, evt);
143
144        if (self.opt.mouseout) {
145          self.opt.mouseout.call(self, score, evt);
146        }
147      });
148    }, _bindOutCancel: function() {
149      var self = this;
150
151      self.cancel.on('mouseleave.raty', function(evt) {
152		  if(self.opt.font == true){
153		  	$(this).attr('class', 'fa ' + self.opt.cancelOff);
154		  }else{
155		  	 $(this).attr('src', self.opt.path + self.opt.cancelOff);
156		  }
157
158        if (self.opt.mouseout) {
159          self.opt.mouseout.call(self, self.score.val() || null, evt);
160        }
161      });
162    }, _bindOverCancel: function() {
163      var self = this;
164
165      self.cancel.on('mouseover.raty', function(evt) {
166		  if(self.opt.font == true){
167        	  $(this).attr('class', 'fa ' + self.opt.cancelOn);
168			  self.stars.attr('class', 'fa ' + self.opt.starOff);
169		  }else{
170			  $(this).attr('src', self.opt.path + self.opt.cancelOn);
171			  self.stars.attr('src', self.opt.path + self.opt.starOff);
172		  }
173
174        methods._target.call(self, null, evt);
175
176        if (self.opt.mouseover) {
177          self.opt.mouseover.call(self, null);
178        }
179      });
180    }, _bindOver: function() {
181      var self   = this,
182          that   = $(self),
183          action = self.opt.half ? 'mousemove.raty' : 'mouseover.raty';
184
185      self.stars.on(action, function(evt) {
186        var score = ((self.opt.font == true) ? $(this).data('ival') : parseInt(this.alt, 10));
187
188        if (self.opt.half) {
189          var position = parseFloat((evt.pageX - $(this).offset().left) / self.opt.size),
190              plus     = (position > .5) ? 1 : .5;
191
192          score = score - 1 + plus;
193
194          methods._fill.call(self, score);
195
196          if (self.opt.precision) {
197            score = score - plus + position;
198          }
199
200          methods._roundStars.call(self, score);
201
202          that.data('score', score);
203        } else {
204          methods._fill.call(self, score);
205        }
206
207        methods._target.call(self, score, evt);
208
209        if (self.opt.mouseover) {
210          self.opt.mouseover.call(self, score, evt);
211        }
212      });
213    }, _callback: function(options) {
214      for (var i in options) {
215        if (typeof this.opt[options[i]] === 'function') {
216          this.opt[options[i]] = this.opt[options[i]].call(this);
217        }
218      }
219    }, _createCancel: function() {
220      var that   = $(this),
221          icon   = ((this.opt.font == true) ? 'fa ' + this.opt.cancelOff : this.opt.path + this.opt.cancelOff),
222          cancel = ((this.opt.font == true) ? $('<i />', { title: this.opt.cancelHint, 'class': 'raty-cancel '+icon}) : $('<img />', { src: icon, alt: 'x', title: this.opt.cancelHint, 'class': 'raty-cancel' }));
223
224      if (this.opt.cancelPlace == 'left') {
225        that.prepend('&#160;').prepend(cancel);
226      } else {
227        that.append('&#160;').append(cancel);
228      }
229
230      return cancel;
231    }, _createScore: function() {
232      return $('<input />', { type: 'hidden', name: this.opt.scoreName }).appendTo(this);
233    }, _createStars: function() {
234      var that = $(this);
235
236      for (var i = 1; i <= this.opt.number; i++) {
237        var title = methods._getHint.call(this, i),
238            icon  = (this.opt.score && this.opt.score >= i) ? 'starOn' : 'starOff';
239
240        icon = ((this.opt.font == true) ? 'fa ' + this.opt[icon] : this.opt.path + this.opt[icon]);
241
242		if(this.opt.font == true){
243			$('<i />', { 'class' : 'fa ' + icon, title: title }).data('ival', i).appendTo(this);
244		}else{
245			$('<img />', { src : icon, alt: i, title: title }).appendTo(this);
246		}
247        
248
249        if (this.opt.space) {
250          that.append((i < this.opt.number) ? '&#160;' : '');
251        }
252      }
253
254	  if(this.opt.font == true){
255		  return that.children('i');
256	  }else{
257		  return that.children('img');
258	  }
259      
260    }, _error: function(message) {
261      $(this).html(message);
262
263      $.error(message);
264    }, _fill: function(score) {
265      var self  = this,
266          hash  = 0;
267
268      for (var i = 1; i <= self.stars.length; i++) {
269        var star   = self.stars.eq(i - 1),
270            select = self.opt.single ? (i == score) : (i <= score);
271
272        if (self.opt.iconRange && self.opt.iconRange.length > hash) {
273          var irange = self.opt.iconRange[hash],
274              on     = irange.on  || self.opt.starOn,
275              off    = irange.off || self.opt.starOff,
276              icon   = select ? on : off;
277
278          if (i <= irange.range) {
279			  if(this.opt.font == true){
280				  star.attr('class', 'fa ' + icon);
281			  }else{
282				  star.attr('src', self.opt.path + icon);
283			  }
284            
285          }
286
287          if (i == irange.range) {
288            hash++;
289          }
290        } else {
291          var icon = select ? 'starOn' : 'starOff';
292
293		  if(this.opt.font == true){
294			  star.attr('class', 'fa ' + this.opt[icon]);
295		  }else{
296			  star.attr('src', this.opt.path + this.opt[icon]);
297		  }
298        }
299      }
300    }, _getHint: function(score) {
301      var hint = this.opt.hints[score - 1];
302      return (hint === '') ? '' : (hint || score);
303    }, _lock: function() {
304      var score = parseInt(this.score.val(), 10), // TODO: 3.1 >> [['1'], ['2'], ['3', '.1', '.2']]
305          hint  = score ? methods._getHint.call(this, score) : this.opt.noRatedMsg;
306
307      $(this).data('readonly', true).css('cursor', '').attr('title', hint);
308
309      this.score.attr('readonly', 'readonly');
310      this.stars.attr('title', hint);
311
312      if (this.cancel) {
313        this.cancel.hide();
314      }
315    }, _roundStars: function(score) {
316      var rest = (score - Math.floor(score)).toFixed(2);
317
318      if (rest > this.opt.round.down) {
319        var icon = 'starOn';                                 // Up:   [x.76 .. x.99]
320
321        if (this.opt.halfShow && rest < this.opt.round.up) { // Half: [x.26 .. x.75]
322          icon = 'starHalf';
323        } else if (rest < this.opt.round.full) {             // Down: [x.00 .. x.5]
324          icon = 'starOff';
325        }
326
327		if(this.opt.font == true){
328			this.stars.eq(Math.ceil(score) - 1).attr('class', 'fa ' + this.opt[icon]);
329		}else{
330			this.stars.eq(Math.ceil(score) - 1).attr('src', this.opt.path + this.opt[icon]);
331		}
332       
333      }                              // Full down: [x.00 .. x.25]
334    }, _target: function(score, evt) {
335      if (this.opt.target) {
336        var target = $(this.opt.target);
337
338        if (target.length === 0) {
339          methods._error.call(this, 'Target selector invalid or missing!');
340        }
341
342        if (this.opt.targetFormat.indexOf('{score}') < 0) {
343          methods._error.call(this, 'Template "{score}" missing!');
344        }
345
346        var mouseover = evt && evt.type == 'mouseover';
347
348        if (score === undefined) {
349          score = this.opt.targetText;
350        } else if (score === null) {
351          score = mouseover ? this.opt.cancelHint : this.opt.targetText;
352        } else {
353          if (this.opt.targetType == 'hint') {
354            score = methods._getHint.call(this, Math.ceil(score));
355          } else if (this.opt.precision) {
356            score = parseFloat(score).toFixed(1);
357          }
358
359          if (!mouseover && !this.opt.targetKeep) {
360            score = this.opt.targetText;
361          }
362        }
363
364        if (score) {
365          score = this.opt.targetFormat.toString().replace('{score}', score);
366        }
367
368        if (target.is(':input')) {
369          target.val(score);
370        } else {
371          target.html(score);
372        }
373      }
374    }, _unlock: function() {
375      $(this).data('readonly', false).css('cursor', 'pointer').removeAttr('title');
376
377      this.score.removeAttr('readonly', 'readonly');
378
379      for (var i = 0; i < this.opt.number; i++) {
380        this.stars.eq(i).attr('title', methods._getHint.call(this, i + 1));
381      }
382
383      if (this.cancel) {
384        this.cancel.css('display', '');
385      }
386    }, cancel: function(click) {
387      return this.each(function() {
388        if ($(this).data('readonly') !== true) {
389          methods[click ? 'click' : 'score'].call(this, null);
390          this.score.removeAttr('value');
391        }
392      });
393    }, click: function(score) {
394      return $(this).each(function() {
395        if ($(this).data('readonly') !== true) {
396          methods._apply.call(this, score);
397
398          if (!this.opt.click) {
399            methods._error.call(this, 'You must add the "click: function(score, evt) { }" callback.');
400          }
401
402
403          this.opt.click.call(this, score, $.Event('click'));
404
405          methods._target.call(this, score);
406        }
407      });
408    }, destroy: function() {
409      return $(this).each(function() {
410        var that = $(this),
411            raw  = that.data('raw');
412
413        if (raw) {
414          that.off('.raty').empty().css({ cursor: raw.style.cursor, width: raw.style.width }).removeData('readonly');
415        } else {
416          that.data('raw', that.clone()[0]);
417        }
418      });
419    }, getScore: function() {
420      var score = [],
421          value ;
422
423      $(this).each(function() {
424        value = this.score.val();
425
426        score.push(value ? parseFloat(value) : undefined);
427      });
428
429      return (score.length > 1) ? score : score[0];
430    }, readOnly: function(readonly) {
431      return this.each(function() {
432        var that = $(this);
433
434        if (that.data('readonly') !== readonly) {
435          if (readonly) {
436			 if(this.opt.font == true){
437				 that.off('.raty').children('i').off('.raty');
438			 }else{
439				 that.off('.raty').children('img').off('.raty');
440			 }
441
442            methods._lock.call(this);
443          } else {
444            methods._binds.call(this);
445            methods._unlock.call(this);
446          }
447
448          that.data('readonly', readonly);
449        }
450      });
451    }, reload: function() {
452      return methods.set.call(this, {});
453    }, score: function() {
454      return arguments.length ? methods.setScore.apply(this, arguments) : methods.getScore.call(this);
455    }, set: function(settings) {
456      return this.each(function() {
457        var that   = $(this),
458            actual = that.data('settings'),
459            news   = $.extend({}, actual, settings);
460
461        that.raty(news);
462      });
463    }, setScore: function(score) {
464      return $(this).each(function() {
465        if ($(this).data('readonly') !== true) {
466          methods._apply.call(this, score);
467          methods._target.call(this, score);
468        }
469      });
470    }
471  };
472
473  $.fn.raty = function(method) {
474    if (methods[method]) {
475      return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
476    } else if (typeof method === 'object' || !method) {
477      return methods.init.apply(this, arguments);
478    } else {
479      $.error('Method ' + method + ' does not exist!');
480    }
481  };
482
483  $.fn.raty.defaults = {
484    cancel        : false,
485    cancelHint    : 'Cancel this rating!',
486    cancelOff     : 'cancel-off.png',
487    cancelOn      : 'cancel-on.png',
488    cancelPlace   : 'left',
489    click         : undefined,
490    half          : false,
491    halfShow      : true,
492    hints         : ['bad', 'poor', 'regular', 'good', 'gorgeous'],
493    iconRange     : undefined,
494    mouseout      : undefined,
495    mouseover     : undefined,
496    noRatedMsg    : 'Not rated yet!',
497    number        : 5,
498    numberMax     : 20,
499    path          : '',
500    precision     : false,
501    readOnly      : false,
502    round         : { down: .25, full: .6, up: .76 },
503    score         : undefined,
504    scoreName     : 'score',
505    single        : false,
506    size          : 16,
507    space         : true,
508    starHalf      : 'star-half.png',
509    starOff       : 'star-off.png',
510    starOn        : 'star-on.png',
511    target        : undefined,
512    targetFormat  : '{score}',
513    targetKeep    : false,
514    targetText    : '',
515    targetType    : 'hint',
516    width         : undefined,
517	font          : false,
518  };
519
520})(jQuery);

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.