PageSourceSearch

https://www.powerplustools.de/modules/gsnipreview/views/js/r_stars.js

js powerplustools.de collected 2026-09-25 20:43:01 UTC 3,693 bytes, 149 lines download raw bytes

1/**
2 * SERG
3 *
4 * NOTICE OF LICENSE
5 *
6 * This source file is subject to the EULA
7 * that is bundled with this package in the file LICENSE.txt.
8 *
9 /*
10 * 
11 * @author    SERG
12 * @category seo
13 * @package gsnipreview
14 * @copyright Copyright SERG
15 * @license   SERG
16 */
17
18
19var NUMBER_OF_STARS = 5;
20
21function init_rating()
22{
23    var ratings = document.getElementsByTagName('div');
24    for (var i = 0; i < ratings.length; i++)
25    {
26        if (ratings[i].className != 'rating')
27            continue;
28            
29        var rating = ratings[i].firstChild.nodeValue;
30       	put_stars(ratings[i], rating);
31    }
32}
33
34function put_stars(div, rating)
35{
36	if (rating == null) return;
37	
38	while (div.childNodes.length > 0)
39		div.removeChild(div.firstChild);
40
41	if (rating > NUMBER_OF_STARS || rating < 0)
42	    return;
43	
44	for (var j = 0; j < NUMBER_OF_STARS; j++)
45	{
46		var star_anchor = document.createElement('a');
47		star_anchor.setAttribute('href', 'javascript:void(' + j + ')');
48		
49	    var star = document.createElement('img');
50	    star.setAttribute('src', module_dir+'views/img/'+gsnipreview_star_active);
51	    star.setAttribute('width', '17');
52	    star.setAttribute('height', '17');
53	    if (rating >= 1)
54	    {
55	        star.setAttribute('src', module_dir+'views/img/'+gsnipreview_star_active);
56	        star.className = 'on';
57	        star_anchor.className = 'star1';
58	        rating--;
59	    }
60	    else if(rating == 0.5)
61	    {
62	        star.setAttribute('src', module_dir+'views/img/'+gsnipreview_star_active);
63	        star.className = 'half';
64	        star_anchor.className = 'star1';
65	        rating = 0;
66	    }
67	    else
68	    {
69	        star.setAttribute('src', module_dir+'views/img/'+gsnipreview_star_noactive);
70	        star.className = 'off';
71	        star_anchor.className = 'star2';
72	    }
73	    
74	    if (div.getAttribute('id') != null)
75	    {
76		    var widgetId = div.getAttribute('id').substr(7);
77		    star.setAttribute('id', 'star_'+widgetId+'_'+(j+1));
78		    div.appendChild(star_anchor);
79		    star_anchor.appendChild(star)
80	    }
81	    else
82	    {
83		    div.appendChild(star);
84	    }
85	   
86	}
87}
88
89
90
91var rating_checked = false;
92var block_rating = 0;
93
94function read_rating_review_shop(obj){
95	 var rat = document.getElementById(obj);
96	 rating_review_shop(obj,rat.value);
97	}
98
99	function rating_review_shop(obj,rating_value){
100	  var _img;
101	  //document.getElementById('error_rating').innerHTML = '';
102	  //document.getElementById('ratingText').style.color = '#2F5997';
103	  var rat = document.getElementById(obj);
104	  //if(rating_value == 0) return;
105	  rat.value = rating_value;
106	  for(var i=1; i<=5; i++){
107	   if(i<=rating_value){
108	    _img = document.getElementById('img_'+obj+'_'+i);
109	    _img.src = module_dir+'views/img/'+gsnipreview_star_active;
110	   }else{
111	    _img = document.getElementById('img_'+obj+'_'+i);
112	    _img.src = module_dir+'views/img/'+gsnipreview_star_noactive;
113	   }
114	  }
115	}
116
117	function _rating_efect_rev(star,action,obj){
118	 if(block_rating==0){
119	  var _img;
120	  clear_rating_rev(obj);
121	   if(action==1){
122	     for(var i=1; i<=5; i++){
123		    _img = document.getElementById('img_'+obj+'_'+i);
124		    _img.src = module_dir+'views/img/'+gsnipreview_star_noactive;
125	     }
126	   }
127	   else{
128	     for(var i=1; i<=star; i++){
129		    _img = document.getElementById('img_'+obj+'_'+i);
130	        _img.src = module_dir+'views/img/'+gsnipreview_star_active;
131	     }
132	   }
133	 }
134	}
135	
136function clear_rating_rev(obj){
137	  var _img;
138	  for(var i=1; i<=5; i++){
139	    _img = document.getElementById('img_'+obj+'_'+i);
140	    _img.src = module_dir+'views/img/'+gsnipreview_star_noactive;
141	  }
142	}
143loaded = true;
144
145function trim(str) {
146	   str = str.replace(/(^ *)|( *$)/,"");
147	   return str;
148	   }
149

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.