PageSourceSearch

https://mentoringusaitalia.org/wp-content/plugins/wp-causes/assets/scripts/cause_functions_ver-4.2.15.js

js mentoringusaitalia.org collected 2026-09-25 11:23:51 UTC 11,379 bytes, 420 lines download raw bytes

1jQuery(document).ready(function($) {
2	//$('.bg_color').wpColorPicker();
3	/*jQuery("#date").datetimepicker({
4		format: 'd.m.Y H:i'
5
6	});*/
7});
8/**
9* Toggle Function
10*/
11function cs_toggle(id) {
12	jQuery("#" + id).slideToggle("slow");
13}
14
15/**
16* Update Title
17*/
18function update_title(id) {
19	var val;
20	val = jQuery('#address_name' + id).val();
21	jQuery('#address_name' + id).html(val);
22}
23
24/**
25* Delete Confirm Html popup
26*/
27var html_popup = "<div id='confirmOverlay' style='display:block'> \
28								<div id='confirmBox'><div id='confirmText'>Are you sure to do this?</div> \
29								<div id='confirmButtons'><div class='button confirm-yes'>Delete</div>\
30								<div class='button confirm-no'>Cancel</div><br class='clear'></div></div></div>"
31								
32
33/**
34* Delete Item
35*/
36jQuery(".btndeleteit").live("click", function() {
37	
38	jQuery(this).parents(".parentdelete").addClass("warning");
39	jQuery(this).parent().append(html_popup);
40
41	jQuery(".confirm-yes").click(function() {
42		jQuery(this).parents(".parentdelete").fadeOut(400, function() {
43			jQuery(this).remove();
44		});
45		
46		jQuery(this).parents(".parentdelete").each(function(){
47			var lengthitem = jQuery(this).parents(".dragarea").find(".parentdelete").size() - 1;
48			jQuery(this).parents(".dragarea").find("input.textfld") .val(lengthitem);
49		});
50
51		jQuery("#confirmOverlay").remove();
52		//count_widget--;
53		//if (count_widget == 0) jQuery("#add_page_builder_item").removeClass("hasclass");
54	
55	});
56	jQuery(".confirm-no").click(function() {
57		jQuery(this).parents(".parentdelete").removeClass("warning");
58		jQuery("#confirmOverlay").remove();
59	});
60	
61	return false;
62});
63
64/**
65* Create Popup
66*/
67function _createpop(data, type) {
68	var _structure = "<div id='cs-pbwp-outerlay'><div id='cs-widgets-list'></div></div>",
69		$elem = jQuery('#cs-widgets-list');
70	jQuery('body').addClass("cs-overflow");
71	if (type == "csmedia") {
72		$elem.append(data);
73	}
74	if (type == "filter") {
75		jQuery('#' + data).wrap(_structure).delay(100).fadeIn(150);
76		jQuery('#' + data).parent().addClass("wide-width");
77	}
78	if (type == "filterdrag") {
79		jQuery('#' + data).wrap(_structure).delay(100).fadeIn(150);
80	}
81
82}
83
84/**
85* Remove Popup
86*/
87function removeoverlay(id, text) {
88	jQuery("#cs-widgets-list .loader").remove();
89	var _elem1 = "<div id='cs-pbwp-outerlay'></div>",
90		_elem2 = "<div id='cs-widgets-list'></div>";
91	$elem = jQuery("#" + id);
92	jQuery("#cs-widgets-list").unwrap(_elem1);
93	if (text == "append" || text == "filterdrag") {
94		$elem.hide().unwrap(_elem2);
95	}
96	if (text == "widgetitem") {
97		$elem.hide().unwrap(_elem2);
98		jQuery("body").append("<div id='cs-pbwp-outerlay'><div id='cs-widgets-list'></div></div>");
99		return false;
100
101	}
102	if (text == "ajax-drag") {
103		jQuery("#cs-widgets-list").remove();
104	}
105	jQuery("body").removeClass("cs-overflow");
106}
107
108/**
109* Open Popup
110*/
111function openpopedup(id) {
112	var $ = jQuery;
113	$(".elementhidden,.opt-head,.to-table thead,.to-table tr").hide();
114	$("#" + id).parents("tr").show();
115	$("#" + id).parents("td").css("width", "100%");
116	$("#" + id).parents("td").prev().hide();
117	$("#" + id).parents("td").find("a.actions").hide();
118	$("#" + id).children(".opt-head").show();
119	$("#" + id).slideDown();
120
121	$("#" + id).animate({
122		top: 0,
123	}, 400, function() {
124		// Animation complete.
125	});
126	/*$.scrollTo('#normal-sortables', 800, {
127		easing: 'swing'
128	});*/
129};
130
131/**
132* close Popup
133*/ 
134function closepopedup(id) {
135	var $ = jQuery;
136	$("#" + id).slideUp(800);
137
138	$(".to-table tr").css("width", "");
139	$(".elementhidden,.opt-head,.option-sec,.to-table thead,.to-table tr,a.actions,.to-table tr td").delay(600).fadeIn(200);
140
141	$.scrollTo('.elementhidden', 800, {
142		
143	});
144};
145
146
147/**
148 * Cause Last Miles Toggle
149 */ 
150function cs_toggle_cause_last_miles(id, counter){
151	if ( id == 'cause-last-miles'){
152		jQuery("#port_last"+counter).show();
153	} else {
154		jQuery("#port_last"+counter).hide();
155	}
156}
157
158/**
159 * Add Cause Donors to List
160 */ 
161 var counter_donation = 0;
162 function add_cause_donation_to_list(admin_url, theme_url){
163	counter_donation++;
164	//cause-other-options
165	jQuery("#cause_other_options").hide();
166	var dataString = 'counter_donation=' + counter_donation + 
167					'&user_id=' + jQuery("#user_id").val() +
168					'&address_name=' + jQuery("#address_name").val() +
169					'&payer_email=' + jQuery("#payer_email").val() +
170					'&payment_gross=' + jQuery("#payment_gross").val() +
171					'&txn_id=' + jQuery("#txn_id").val() +
172					'&payment_date=' + jQuery("#payment_date").val() +
173					'&action=add_cause_donation_to_list';
174	jQuery("#loading").html("<img src='"+theme_url+"/images/admin/ajax_loading.gif' />");
175	jQuery.ajax({
176		type:"POST",
177		url: admin_url,
178		data: dataString,
179		success:function(response){
180			jQuery("#total_cause_donations").append(response);
181			jQuery("#loading").html("");
182			removeoverlay('add_cuase_dontations', 'append');
183			jQuery("#address_name").val("Title");
184			//jQuery("#cause_other_options").show();
185				//jQuery("#ingredient_other").val("");
186		}
187	});
188	//return false;
189}
190
191/**
192 * Map Tab Resize
193 */ 
194jQuery('#tab-location-settings-cs-events').bind('tabsshow', function(event, ui) {
195    if (ui.panel.id == "map-tab") {
196        resizeMap();
197    }
198});
199
200/**
201* Map Location Resize
202*/ 
203jQuery(document).ready(function() {
204	jQuery('a[href="#tab-location-settings-cs-events"]').click(function (e){
205		var map = jQuery("#cs-map-location-id")[0];
206		setTimeout(function(){google.maps.event.trigger(map, 'resize');},400)
207	 });
208});	
209
210
211/**
212* Messages Slideout
213*/ 
214function slideout() {
215	setTimeout(function() {
216		jQuery(".form-msg").slideUp("slow", function() {});
217	}, 5000);
218}
219function slideout_msgs() {
220	setTimeout(function() {
221		jQuery("#newsletter_mess").slideUp("slow", function() {});
222	}, 5000);
223}
224
225 /**
226 * Media upload
227 */
228jQuery(document).ready(function() {
229	var ww = jQuery('#post_id_reference').text();
230	window.original_send_to_editor = window.send_to_editor;
231	window.send_to_editor_clone = function(html){
232		imgurl = jQuery('a','<p>'+html+'</p>').attr('href');
233		jQuery('#'+formfield).val(imgurl);
234		tb_remove();
235	}
236	jQuery('input.uploadfile').click(function() {
237		window.send_to_editor=window.send_to_editor_clone;
238		formfield = jQuery(this).attr('name');
239		tb_show('', 'media-upload.php?post_id=' + ww + '&type=image&TB_iframe=true');
240		return false;
241	});
242});
243
244 /**
245 * User Login Authentication
246 */			 
247function cs_user_authentication(admin_url,id){
248	"use strict";
249	jQuery('.login-form-id-'+id+' .status-message').addClass('cs-spinner');
250	jQuery('.login-form-id-'+id+' span.status').html('<i class="fa fa-spinner fa-spin"></i>').fadeIn();
251	
252	function newValues(id) {
253		var serializedValues = jQuery("#ControlForm_"+id).serialize();
254		return serializedValues;
255	}
256	var serializedReturn = newValues(id);
257	jQuery('.login-form-id-'+id+' .status-message').removeClass('success error');
258	jQuery.ajax({
259		type:"POST",
260		url: admin_url,
261		dataType: 'json',
262		data:serializedReturn, 
263		success: function(data){
264			jQuery('.login-form-id-'+id+' .status-message').html(data.message);
265			jQuery('.fa-spin').remove();
266			
267			if (data.loggedin == false){
268				jQuery('.login-form-id-'+id+' .status-message').removeClass('success').addClass( "error" );
269				jQuery('.login-form-id-'+id+' .status-message').removeClass('cs-spinner');
270				jQuery('.login-form-id-'+id+' .status-message').html(data.message);
271				jQuery('.login-form-id-'+id+' .status-message').show();
272			}else if (data.loggedin == true){
273				jQuery('.login-form-id-'+id+' .status-message').removeClass('error').addClass( "success" );
274				jQuery('.login-form-id-'+id+' .status-message').removeClass('cs-spinner');
275				jQuery('.login-form-id-'+id+' .status-message').html(data.message);
276				jQuery('.login-form-id-'+id+' .status-message').show();
277				document.location.href = data.redirecturl;
278			}
279		}
280	});
281}
282
283 /**
284 * skills Function
285 */	
286function cs_progress_bar(){
287	"use strict";	 
288	jQuery('.skillbar').each(function() {
289		jQuery(this).waypoint(function(direction) {
290			jQuery(this).find('.skillbar-bar').animate({
291				width: jQuery(this).attr('data-percent')
292			}, 2000);
293		}, {
294			offset: "100%",
295		triggerOnce: true
296		});
297	});
298}
299	
300 /**
301 * Add to Wishlist Function
302 */	
303function cs_addto_wishlist(admin_url, post_id){
304	"use strict";
305	 var dataString = 'post_id=' + post_id+'&action=cs_addto_usermeta';
306	 jQuery(".post-"+post_id+" .cs-add-wishlist").html('<i class="fa fa-spinner fa-spin"></i>');
307		jQuery.ajax({
308			type:"POST",
309			url: admin_url,
310			data: dataString,
311			success:function(response){
312				jQuery(".post-"+post_id+" .cs-add-wishlist").html(response);
313				jQuery(".post-"+post_id+" a.cs-add-wishlist").removeAttr("onclick");
314			}
315	});
316
317	return false;
318}
319
320 /**
321 * Remove Wishlist Function
322 */		 
323function cs_delete_wishlist(admin_url, post_id){
324	if(confirm('Remove From wishlist')){
325			"use strict";
326			 var dataString = 'post_id=' + post_id+'&action=cs_delete_wishlist';
327			 jQuery(".close-"+post_id).html('<i style="color:#fe9909;" class="fa fa-spinner fa-spin"></i>');
328				jQuery.ajax({
329					type:"POST",
330					url: admin_url,
331					data: dataString,
332					success:function(response){
333						jQuery(".close-"+post_id).parents('.holder-'+post_id).remove();
334						
335					}
336			});
337	}
338
339	return false;
340}
341
342/**
343* Remove Thumbnail Function
344*/		 
345function cs_delete_compaign_thumbnail(admin_url, post_id, thumb_id){
346	if(confirm('Remove Featured Image')){
347			"use strict";
348			 var dataString = 'post_id=' + post_id+'&thumb_id='+thumb_id+'&action=cs_delete_compaign_thumbnail';
349			 jQuery(".close-"+post_id).html('<i style="color:#fe9909;" class="fa fa-spinner fa-spin"></i>');
350				jQuery.ajax({
351					type:"POST",
352					url: admin_url,
353					data: dataString,
354					success:function(response){
355						jQuery(".attachment-thumbnail").remove();
356						jQuery(".close-"+post_id).remove();
357					}
358			});
359	}
360
361	return false;
362}
363
364/**
365* Delete User Campaign Function
366*/		 
367function cs_delete_user_compaign(admin_url, post_id, thumb_id){
368	if(confirm('Delete Campaign')){
369			"use strict";
370			 var dataString = 'post_id=' + post_id+'&thumb_id='+thumb_id+'&action=cs_delete_user_compaign';
371			 jQuery(".close-"+post_id).html('<i style="color:#fe9909;" class="fa fa-spinner fa-spin"></i>');
372				jQuery.ajax({
373					type:"POST",
374					url: admin_url,
375					data: dataString,
376					success:function(response){
377						jQuery(".campaing-post-"+post_id).remove();
378					}
379			});
380	}
381
382	return false;
383}
384
385/**
386* User Register Validation
387*/			 
388function cs_registration_validation(admin_url,id){
389	"use strict";
390	jQuery('div#result_'+id).html('<i class="fa fa-spinner fa-spin"></i>').fadeIn();
391	
392	function newValues(id) {
393		jQuery('#user_profile').val();
394		var serializedValues = jQuery("#wp_signup_form_"+id).serialize();
395		return serializedValues;
396	}
397	var serializedReturn = newValues(id);
398	jQuery('div#result_'+id).removeClass('success error');
399	jQuery.ajax({
400		type:"POST",
401		url: admin_url,
402		dataType: 'json',
403		data:serializedReturn, 
404			
405		success:function(response){
406			if ( response.type == 'error' ) {
407				jQuery('div#result_'+id+' .fa-spin').remove();
408				jQuery("div#result_"+id).removeClass('success').addClass( "error" );
409				jQuery("div#result_"+id).show();
410				jQuery('div#result_'+id).html(response.message);
411			} else if ( response.type == 'success' ) {
412				jQuery('div#result_'+id+' .fa-spin').remove();
413				jQuery("div#result_"+id).removeClass('error').addClass( "success" );
414				jQuery("div#result_"+id).show();
415				jQuery('div#result_'+id).html(response.message);
416				
417			}
418		}
419	});
420}

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.