PageSourceSearch

https://kishinev.info/assets/snippets/star_rating/assets/js/scripts.min.js

js kishinev.info collected 2026-10-02 18:43:19 UTC 11,159 bytes, 77 lines download raw bytes

1!function(t){"use strict";var s={init:function(a){return this.each(function(){this.self=t(this),s.destroy.call(this.self),this.opt=t.extend(!0,{},t.fn.raty.defaults,a),s._adjustCallback.call(this),s._adjustNumber.call(this),s._adjustHints.call(this),this.opt.score=s._adjustedScore.call(this,this.opt.score),"img"!==this.opt.starType&&s._adjustStarType.call(this),s._adjustPath.call(this),s._createStars.call(this),this.opt.precision&&s._adjustPrecision.call(this),s._createScore.call(this),s._apply.call(this,this.opt.score),s._setTitle.call(this,this.opt.score),s._target.call(this,this.opt.score),this.opt.readOnly?s._lock.call(this):(this.style.cursor="pointer",s._binds.call(this))})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName","target","path","starOn","starOff","starHalf","starType"],s=0;s<t.length;s++)"function"==typeof this.opt[t[s]]&&(this.opt[t[s]]=this.opt[t[s]].call(this))},_adjustedScore:function(t){return t?s._between(t,0,this.opt.number):t},_adjustHints:function(){if(this.opt.hints||(this.opt.hints=[]),this.opt.halfShow||this.opt.half)for(var t=this.opt.precision?10:2,s=0;s<this.opt.number;s++){var a=this.opt.hints[s];"[object Array]"!==Object.prototype.toString.call(a)&&(a=[a]),this.opt.hints[s]=[];for(var i=0;t>i;i++){var e=a[i],r=a[a.length-1];void 0===r&&(r=null),this.opt.hints[s][i]=void 0===e?r:e}}},_adjustNumber:function(){this.opt.number=s._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0},_adjustStarType:function(){var t=["starHalf","starOff","starOn"];this.opt.path="";for(var s=0;s<t.length;s++)this.opt[t[s]]=this.opt[t[s]].replace(".","-")},_apply:function(t){s._fill.call(this,t),t&&(t>0&&this.score.val(t),s._roundStars.call(this,t))},_between:function(t,s,a){return Math.min(Math.max(parseFloat(t),s),a)},_binds:function(){s._bindOver.call(this),s._bindClick.call(this),s._bindOut.call(this)},_bindClick:function(){var a=this;a.stars.on("click.raty",function(i){var e=!0,r=a.opt.half||a.opt.precision?a.self.data("score"):this.alt||t(this).data("alt");a.opt.click&&(e=a.opt.click.call(a,+r,i)),(e||void 0===e)&&(a.opt.half&&!a.opt.precision&&(r=s._roundHalfScore.call(a,r)),s._apply.call(a,r))})},_bindOut:function(){var t=this;t.self.on("mouseleave.raty",function(a){var i=+t.score.val()||void 0;s._apply.call(t,i),s._target.call(t,i,a),s._resetTitle.call(t),t.opt.mouseout&&t.opt.mouseout.call(t,i,a)})},_bindOver:function(){var t=this,a=t.opt.half?"mousemove.raty":"mouseover.raty";t.stars.on(a,function(a){var i=s._getScoreByPosition.call(t,a,this);s._fill.call(t,i),t.opt.half&&(s._roundStars.call(t,i,a),s._setTitle.call(t,i,a),t.self.data("score",i)),s._target.call(t,i,a),t.opt.mouseover&&t.opt.mouseover.call(t,i,a)})},_buildScoreField:function(){return t("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createScore:function(){var a=t(this.opt.targetScore);this.score=a.length?a:s._buildScoreField.call(this)},_createStars:function(){for(var a=1;a<=this.opt.number;a++){var i=s._nameForIndex.call(this,a),e={alt:a,src:this.opt.path+this.opt[i]};"img"!==this.opt.starType&&(e={"data-alt":a,"class":e.src}),e.title=s._getHint.call(this,a),t("<"+this.opt.starType+" />",e).appendTo(this)}this.stars=this.self.children(this.opt.starType)},_error:function(s){t(this).text(s),t.error(s)},_fill:function(t){for(var a=0,i=1;i<=this.stars.length;i++){var e,r=this.stars[i-1],o=s._turnOn.call(this,i,t);if(this.opt.iconRange&&this.opt.iconRange.length>a){var n=this.opt.iconRange[a];e=s._getRangeIcon.call(this,n,o),i<=n.range&&s._setIcon.call(this,r,e),i===n.range&&a++}else e=this.opt[o?"starOn":"starOff"],s._setIcon.call(this,r,e)}},_getFirstDecimal:function(t){var s=t.toString().split(".")[1],a=0;return s&&(a=parseInt(s.charAt(0),10),"9999"===s.slice(1,5)&&a++),a},_getRangeIcon:function(t,s){return s?t.on||this.opt.starOn:t.off||this.opt.starOff},_getScoreByPosition:function(a,i){var e=parseInt(i.alt||i.getAttribute("data-alt"),10);if(this.opt.half){var r=s._getWidth.call(this),o=parseFloat((a.pageX-t(i).offset().left)/r);e=e-1+o}return e},_getHint:function(t,a){if(0!==t&&!t)return this.opt.noRatedMsg;var i=s._getFirstDecimal.call(this,t),e=Math.ceil(t),r=this.opt.hints[(e||1)-1],o=r,n=!a||this.move;return this.opt.precision?(n&&(i=0===i?9:i-1),o=r[i]):(this.opt.halfShow||this.opt.half)&&(i=n&&0===i?1:i>5?1:0,o=r[i]),""===o?"":o||t},_getWidth:function(){var t=this.stars[0].width||parseFloat(this.stars.eq(0).css("font-size"));
1return t||s._error.call(this,"Could not get the icon width!"),t},_lock:function(){var t=s._getHint.call(this,this.score.val());this.style.cursor="",this.title=t,this.score.prop("readonly",!0),this.stars.prop("title",t),this.self.data("readonly",!0)},_nameForIndex:function(t){return this.opt.score&&this.opt.score>=t?"starOn":"starOff"},_resetTitle:function(){for(var t=0;t<this.opt.number;t++)this.stars[t].title=s._getHint.call(this,t+1)},_roundHalfScore:function(t){var a=parseInt(t,10),i=s._getFirstDecimal.call(this,t);return 0!==i&&(i=i>5?1:.5),a+i},_roundStars:function(t,a){var i,e=(t%1).toFixed(2);if(a||this.move?i=e>.5?"starOn":"starHalf":e>this.opt.round.down&&(i="starOn",this.opt.halfShow&&e<this.opt.round.up?i="starHalf":e<this.opt.round.full&&(i="starOff")),i){var r=this.opt[i],o=this.stars[Math.ceil(t)-1];s._setIcon.call(this,o,r)}},_setIcon:function(t,s){t["img"===this.opt.starType?"src":"className"]=this.opt.path+s},_setTarget:function(t,s){s&&(s=this.opt.targetFormat.toString().replace("{score}",s)),t.is(":input")?t.val(s):t.html(s)},_setTitle:function(t,a){if(t){var i=parseInt(Math.ceil(t),10),e=this.stars[i-1];e.title=s._getHint.call(this,t,a)}},_target:function(a,i){if(this.opt.target){var e=t(this.opt.target);e.length||s._error.call(this,"Target selector invalid or missing!");var r=i&&"mouseover"===i.type;if(void 0===a)a=this.opt.targetText;else if(null===a)a=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?a=s._getHint.call(this,a,i):this.opt.precision&&(a=parseFloat(a).toFixed(1));var o=i&&"mousemove"===i.type;r||o||this.opt.targetKeep||(a=this.opt.targetText)}s._setTarget.call(this,e,a)}},_turnOn:function(t,s){return this.opt.single?t===s:s>=t},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var t=0;t<this.opt.number;t++)this.stars[t].title=s._getHint.call(this,t+1)},click:function(a){return this.each(function(){t(this).data("readonly")!==!0&&(a=s._adjustedScore.call(this,a),s._apply.call(this,a),this.opt.click&&this.opt.click.call(this,a,t.Event("click")),s._target.call(this,a))})},destroy:function(){return this.each(function(){var s=t(this),a=s.data("raw");a?s.off(".raty").empty().css({cursor:a.style.cursor}).removeData("readonly"):s.data("raw",s.clone()[0])})},getScore:function(){var t,s=[];return this.each(function(){t=this.score.val(),s.push(t?+t:void 0)}),s.length>1?s:s[0]},move:function(a){return this.each(function(){var i=parseInt(a,10),e=s._getFirstDecimal.call(this,a);i>=this.opt.number&&(i=this.opt.number-1,e=10);var r=s._getWidth.call(this),o=r/10,n=t(this.stars[i]),l=n.offset().left+o*e,c=t.Event("mousemove",{pageX:l});this.move=!0,n.trigger(c),this.move=!1})},readOnly:function(a){return this.each(function(){var i=t(this);i.data("readonly")!==a&&(a?(i.off(".raty").children(this.opt.starType||"img").off(".raty"),s._lock.call(this)):(s._binds.call(this),s._unlock.call(this)),i.data("readonly",a))})},reload:function(){return s.set.call(this,{})},score:function(){var a=t(this);return arguments.length?s.setScore.apply(a,arguments):s.getScore.call(a)},set:function(s){return this.each(function(){t(this).raty(t.extend({},this.opt,s))})},setScore:function(a){return this.each(function(){t(this).data("readonly")!==!0&&(a=s._adjustedScore.call(this,a),s._apply.call(this,a),s._target.call(this,a))})}};t.fn.raty=function(a){return s[a]?s[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?void t.error("Method "+a+" does not exist!"):s.init.apply(this,arguments)},t.fn.raty.defaults={cancelHint:"Cancel this rating!",click:void 0,half:!1,halfShow:!0,hints:[],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),
2
3jQuery(document).ready(function(t) {
4    t(".star-rating").raty({
5        path: function() {
6            return this.dataset.path || "/assets/snippets/star_rating/assets/img/"
7        },
8        starOn: function() {
9            return this.dataset.on || "star-on.png"
10        },
11        starOff: function() {
12            return this.dataset.off || "star-off.png"
13        },
14        starHalf: function() {
15            return this.dataset.half || "star-half.png"
16        },
17        number: function() {
18            return this.dataset.stars || 5
19        },
20        score: function() {
21            return this.dataset.rating || 0
22        },
23        readOnly: function() {
24            return 1 == this.dataset.disabled
25        },
26        starType: function() {
27            return this.dataset.type || "img"
28        },
29        click: function(s) {
30            var a = t(this),
31                i = a.closest(".star-rating-container"),
32                e = this.dataset.id;
33            t.ajax({
34                url: window.location.href,
35                type: "get",
36				cache: false,
37                data: {
38                    rid: e,
39                    vote: s
40                },
41                success: function(s) {
42                    s ? (i.find(".msg").remove(), s.success !== !0 || s.error ? a.raty("reload") : (i.find(".star-rating-votes").text(s.votes), i.find(".star-rating-rating").text(s.rating), a.raty("score", s.rating), a.raty("readOnly", !0))/*, a.append('<div class="msg">' + s.message + "</div>"), a.find(".mask").fadeOut(100, function() {
43                        t(this).remove()
44                    }),
45					setTimeout(function() {
46                        i.find(".msg").fadeOut(1e3)
47                    }, 2e3)*/,
48					setTimeout(function() {
49						$.notify({
50								icon: 'icon_set_1_icon-76',
51								title: '<h4>'+s.message+'</h4>',
52								message: " "
53							},{
54								type: 'info',
55								delay: 5000,
56								timer: 3000,
57								z_index: 9999,
58								showProgressbar: false,
59								placement: {
60									from: "bottom",
61									align: "right"
62								},
63							animate: {
64								enter: 'animated bounceInUp',
65								exit: 'animated bounceOutDown'
66							},
67						});
68					}, 100)
69				) : alert("Unknown error. Try again later")
70                },
71                beforeSend: function() {
72                    //a.append('<div class="mask" />')
73                }
74            })
75        }
76    })
77});

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.