PageSourceSearch

https://ruwest.ru/bitrix/cache/js/s1/westruss/page_96845cd58cf7f82…f7f820cdf6c3492472e92e_v1.js?17908644923381

js ruwest.ru collected 2026-10-02 07:48:47 UTC 3,381 bytes, 131 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:87:"/bitrix/templates/westruss/components/bitrix/iblock.vote/stars/script.js?15526762933018";s:6:"source";s:72:"/bitrix/templates/westruss/components/bitrix/iblock.vote/stars/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3;(function(window) {
4	if (window.JCIblockVoteStars)
5		return;
6
7	JCIblockVoteStars = function (params)
8	{
9		this.progressId = params.progressId;
10		this.ratingId = params.ratingId;
11		this.starsId = params.starsId;
12		this.ajaxUrl = params.ajaxUrl;
13		this.voteId = params.voteId;
14		this.starsObj = null;
15		this.votedValue = null;
16		this.preVotedValue = null;
17	};
18
19	JCIblockVoteStars.prototype.setValue = function(value)
20	{
21		value = parseInt(value);
22		if (isNaN(value))
23			value = 0;
24		else if(value > 100)
25			value = 100;
26		else if(value < 0)
27			value = 0;
28
29		var progressObj = BX(this.progressId);
30
31		if(!!progressObj)
32		{
33			progressObj.style.width = parseInt(value)+"%";
34			this.votedValue = value;
35		}
36	};
37
38	JCIblockVoteStars.prototype.setVotes = function(value)
39	{
40		var ratingObj = BX(this.ratingId);
41
42		if(!!ratingObj)
43			ratingObj.innerHTML = "( "+value+" )";
44	};
45
46	JCIblockVoteStars.prototype.getStarsObj = function()
47	{
48		if(!this.starsObj)
49			this.starsObj = BX(this.starsId);
50
51		return this.starsObj;
52	};
53
54	//todo: IE 8 has no pageX, pageY.
55	JCIblockVoteStars.prototype.onMouseMove = function(event)
56	{
57		var starsPos = BX.pos(this.getStarsObj());
58
59		var voteValue = (event.pageX - starsPos.left)/starsPos.width*5;
60
61		for (var i = 1; i <= 5; i++)
62		{
63			if(voteValue < i)
64			{
65				voteValue = i;
66				break;
67			}
68		}
69
70		this.setValue(voteValue*20);
71	};
72
73	JCIblockVoteStars.prototype.onMouseOver = function(event)
74	{
75		BX.bind(this.getStarsObj(), 'click', BX.proxy(this.onVote, this));
76		this.preVotedValue = this.votedValue;
77	};
78
79	JCIblockVoteStars.prototype.onMouseOut = function(event)
80	{
81		BX.unbind(this.getStarsObj(), 'click', BX.proxy(this.onVote, this));
82		this.votedValue = this.preVotedValue;
83		this.setValue(this.votedValue);
84	};
85
86	JCIblockVoteStars.prototype.onVote = function(event)
87	{
88		this.unBindEvents();
89
90		this.ajaxParams.rating = parseInt(this.votedValue/20)-1;
91		this.ajaxParams.vote = "Y";
92		this.ajaxParams.vote_id = this.voteId;
93
94		BX.ajax({
95			timeout:   30,
96			method:   'POST',
97			dataType: 'json',
98			url:       this.ajaxUrl,
99			data:      this.ajaxParams,
100			onsuccess: BX.delegate(this.SetResult, this)
101		});
102	};
103
104	JCIblockVoteStars.prototype.SetResult = function(result)
105	{
106		if (!!result && !result.ERROR)
107		{
108			this.setValue((result.value+1)*20);
109			this.setVotes(result.votes);
110		}
111	};
112
113	JCIblockVoteStars.prototype.bindEvents = function()
114	{
115		var starsObj = this.getStarsObj();
116		BX.bind(starsObj, 'mousemove', BX.proxy(this.onMouseMove, this));
117		BX.bind(starsObj, 'mouseover', BX.proxy(this.onMouseOver, this));
118		BX.bind(starsObj, 'mouseout', BX.proxy(this.onMouseOut, this));
119	};
120
121	JCIblockVoteStars.prototype.unBindEvents = function()
122	{
123		var starsObj = this.getStarsObj();
124		BX.unbind(starsObj, 'mousemove', BX.proxy(this.onMouseMove, this));
125		BX.unbind(starsObj, 'mouseover', BX.proxy(this.onMouseOver, this));
126		BX.unbind(starsObj, 'mouseout', BX.proxy(this.onMouseOut, this));
127		BX.unbind(this.getStarsObj(), 'click', BX.proxy(this.onVote, this));
128	};
129})(window);
130/* End */
131;; /* /bitrix/templates/westruss/components/bitrix/iblock.vote/stars/script.js?15526762933018*/

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.