PageSourceSearch

https://www.hipwee.com/wp-content/plugins/hipwee-polling/js/scripts.js?ver=6b7f316c76fa01721093eb280faf31d1

js hipwee.com collected 2026-10-02 04:08:39 UTC 3,896 bytes, 173 lines download raw bytes

1(function($){
2	function setCookie(name, value, seconds) {
3		var expires;
4		
5		if ( seconds ) {
6			var date = new Date();
7			date.setTime(date.getTime() + (seconds * 1000));
8			expires = "; expires=" + date.toGMTString();
9		} else {
10			expires = "";
11		} 
12
13		document.cookie = name + "=" + value + expires + "; path=/";
14	}
15
16	function getCookie(name) {
17		if ( document.cookie.length > 0 ) {
18			c_start = document.cookie.indexOf(name + "=");
19			if ( c_start != -1 ) {
20				c_start = c_start + name.length + 1;
21				c_end = document.cookie.indexOf(";", c_start);
22				if ( c_end == -1 ) {
23					c_end = document.cookie.length;
24				}
25				
26				return unescape(document.cookie.substring(c_start, c_end));
27			}
28		}
29
30		return "";
31	}
32
33	/*
34	$(document).ready(function(){
35		$('.hipwee-polling').each(function(){
36			var div = $(this), 
37				post_id = $(this).attr('data-ID');
38
39			var dataForm = { 
40				post_id: post_id 
41			};
42
43			var dataPost = {
44				'action': 'display_polling', 
45				'dataForm': dataForm 
46			};
47
48			$.ajax({ // ajax form submit
49				url : hipwee_polling.ajaxurl,
50				data : dataPost,
51				type : 'POST',
52				dataType : 'json',
53				success : function(response){
54					// console.log(response);
55
56					div.html(response);
57				}
58			});
59		});
60	});
61	*/
62
63	$(document).ready(function(){
64		$('.hipwee-polling').each(function(){
65			var div = $(this), 
66				post_id = $(this).attr('data-ID');
67
68			var dataForm = { 
69				post_id: post_id 
70			};
71
72			var dataPost = {
73				'dataForm': dataForm 
74			};
75
76			$.ajax({ // ajax form submit
77				url : hipwee_polling.ajaxDisplayPoll,
78				data : dataPost,
79				type : 'POST',
80				dataType : 'json',
81				success : function(response){
82					// console.log(response);
83
84					div.html(response);
85				}
86			});
87		});
88	});
89
90	/*
91	$(document).delegate('.form-polling', 'submit', function(e) {
92		e.preventDefault();
93
94		var form = $(this), 
95			// post_url = form.attr('action'), 
96			post_url = hipwee_polling.ajaxSubmitVote, 
97			form_data = new FormData(this); 
98
99		$.ajax({ // ajax form submit
100			url : post_url,
101			type : 'POST',
102			data : form_data,
103			dataType : "json",
104			contentType : false,
105			cache : false,
106			processData : false
107		}).done(function(response){ // fetch server "json" messages when done
108			// console.log( response );
109
110			form.find('.alert').hide().attr('class', 'alert alert-'+response.alert).html(response.message).fadeIn('slow');
111
112			if ( response.success ) {
113				setCookie( 'hipwee_polling', JSON.stringify(response.data), 365*24*60*60 );
114			}
115		});
116	});
117	*/
118
119	$(document).delegate('.polling-list a.polling-item ', 'click', function(e) {
120		e.preventDefault();
121
122		var el = $(this);
123
124		if ( ! el.closest('.polling-list').hasClass('active') ) {
125			var post_id = el.data('postid'), 
126				vote = el.data('key');
127
128			var dataForm = { 
129				post_id: post_id, 
130				vote: vote 
131			};
132
133			var dataPost = { 
134				'dataForm': dataForm 
135			};
136
137			$.ajax({ // ajax form submit
138				url : hipwee_polling.ajaxSubmitVote, 
139				data : dataPost, 
140				type : 'POST',
141				dataType : 'json',
142				success : function(response){
143					// console.log( response );
144
145					el.closest('.polling-list-wrapper').find('#polling-alert').hide().attr('class', 'alert alert-'+response.alert).html(response.message).fadeIn('slow');
146
147					if ( response.success ) {
148						setCookie( 'hipwee_polling', JSON.stringify(response.data), 365*24*60*60 );
149
150						if ( "undefined" !== typeof(response.results) ) { 
151							var results = response.results;
152
153							var i = 0;
154
155							el.closest('ul.polling-list').find('li').each(function(){
156								$(this).find('.bar-progress').css('width', results[i].percent+'%');
157								$(this).find('.value').find('.percent').text(results[i].percent+'%');
158
159								i++;
160							});
161						}
162					}
163				}, 
164				complete : function(jqXHR, status) { 
165					el.addClass('active');
166					el.closest('.polling-list').addClass('active');
167				}
168			});
169
170			return false;
171		}
172	});
173}(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.