PageSourceSearch

https://accioncontralatrata.com/wp-content/plugins/wp-crowdfunding…/js/dist/crowdfunding-front.js?ver=2.2.2

js accioncontralatrata.com collected 2026-10-02 13:22:50 UTC 18,833 bytes, 625 lines download raw bytes

1// Crowdfunding Scripts
2jQuery(document).ready(function ($) {
3	var count = 0;
4	var numItems = $('.wpneo-block').length;
5	if (numItems != 0) {
6		count = numItems;
7	}
8	$.fn.createNewForm = function (count) {
9		return this.each(function () {
10			$(this)
11				.find('input,textarea,select')
12				.each(function () {
13					var $that = $(this);
14					$that.attr('name', this.name.replace(/\d/, count));
15					$that.val('');
16				});
17		});
18	};
19	$('.add-new').on('click', function (e) {
20		var $form = $('.wpneo-block').last(),
21			$cloned = $form.clone();
22		$cloned.createNewForm(count);
23		$('#wpneo-clone .add-new').before($($cloned));
24		count = count + 1;
25	});
26	$(document).on('click', '.remove-button', function (events) {
27		if ($('.wpneo-block').length > 1) {
28			$(this).parent('.wpneo-block').remove();
29		}
30	});
31	$('#wpneo_form_start_date, #wpneo_form_end_date, .update-datepicker').datepicker({
32		dateFormat: 'dd-mm-yy',
33	});
34
35	$('.wpneo_donate_button').on('click', function (e) {
36		const data = $('.wpneo_donate_amount_field').val();
37		if (!data) {
38			e.preventDefault();
39			$('.wpneo-tooltip-empty').css({ visibility: 'visible' });
40		} else {
41			$('.wpneo-tooltip-empty').css({ visibility: 'hidden' });
42		}
43	});
44
45	// Pie Chart
46	$('.crowdfound-pie-chart').easyPieChart({
47		barColor: 'var(--wpcf-primary-color)',
48		trackColor: '#f5f5f5',
49		scaleColor: false,
50		lineWidth: 5,
51	});
52
53	$('.datepickers_1').datepicker({
54		dateFormat: 'yy-mm-dd',
55	});
56	$('.datepickers_2').datepicker({
57		dateFormat: 'yy-mm-dd',
58	});
59
60	// Insert Campaign Post Data
61	$('#wpneofrontenddata').submit(submit_frontend);
62	function submit_frontend() {
63		tinyMCE.triggerSave();
64		var front_end_data = $(this).serialize();
65		$.ajax({
66			type: 'POST',
67			url: wpcf_ajax_object.ajax_url,
68			data: front_end_data,
69			success: function (data) {
70				var parseData = JSON.parse(data);
71
72				if (!parseData.success) {
73					//Reset reCaptcha if failed
74					if (typeof grecaptcha !== 'undefined' && $('.g-recaptcha').length !== 0) {
75						grecaptcha.reset();
76					}
77				}
78				if (wpcf_modal(data)) {
79				}
80			},
81			error: function (jqXHR, textStatus, errorThrown) {
82				wpcf_modal({ success: 0, message: 'Error sending data' });
83			},
84		});
85		return false;
86	}
87
88	$(document).on('click', '.wpcf-print-button', function (e) {
89		window.print();
90	});
91
92	// Common Modal Function
93	function wpcf_modal(data, print = false) {
94		var data = JSON.parse(data);
95		var html =
96			'<div class="wpneo-modal-wrapper"> ' +
97			'<div class="wpneo-modal-content"> ' +
98			'<div class="wpneo-modal-wrapper-head">' +
99			'<span id="wpcf_modal_title">Message</span><a href="javascript:;" class="wpneo-modal-close">&times;</a>';
100		if (print) {
101			html += '</div><span class="wpcf-print-button button wpneo-edit-btn">print</span>';
102		}
103		html += '<div class="wpneo-modal-content-inner"><div id="wpcf_modal_message"></div></div></div></div>';
104		if ($('.wpneo-modal-wrapper').length == 0) {
105			$('body').append(html);
106			if (data.redirect) {
107				if ($('#wpneo_crowdfunding_redirect_url').length == 0) {
108					$('body').append(
109						'<input type="hidden" id="wpneo_crowdfunding_redirect_url" value="' + data.redirect + '" />'
110					);
111				}
112			}
113		}
114		if (data.success == 1) {
115			if (data.message) {
116				$('.wpneo-modal-wrapper #wpcf_modal_message').html(data.message);
117			}
118			if (data.title) {
119				$('.wpneo-modal-wrapper #wpcf_modal_title').html(data.title);
120			}
121			$('.wpneo-modal-wrapper').css({ display: 'block' });
122			if ($('#wpneofrontenddata').length > 0) {
123				$('#wpneofrontenddata')[0].reset();
124			}
125			return true;
126		} else {
127			$('.wpneo-modal-wrapper #wpcf_modal_message').html(data.message);
128			$('.wpneo-modal-wrapper').css({ display: 'block' });
129			return false;
130		}
131	}
132	window.wpcf_modal = wpcf_modal; //make global function
133
134	function wpcf_image_gallery_upload(button_class) {
135		var file_frame; // variable for the wp.media file_frame
136
137		$('body').on('click', button_class, function (event) {
138			event.preventDefault();
139			var gallery_image_ids = $('.gallery-image-ids');
140			var gallery_image_id_show = $('.gallery-image-id-show');
141			if (file_frame) {
142				file_frame.open();
143				return;
144			}
145			file_frame = wp.media.frames.file_frame = wp.media({
146				title: $(this).data('uploader_title'),
147				button: {
148					text: $(this).data('uploader_button_text'),
149				},
150				multiple: true,
151			});
152			file_frame.on('select', function () {
153				var image_ids = [];
154				attachments = file_frame.state().get('selection').toJSON();
155				gallery_image_ids.val('');
156				gallery_image_id_show.val('');
157				attachments.forEach(function (attachment) {
158					image_ids.push(attachment.id);
159				});
160				gallery_image_ids.val(image_ids);
161				gallery_image_id_show.val(image_ids);
162			});
163			file_frame.open();
164		});
165	}
166
167	wpcf_image_gallery_upload('.wpneo-upload-image-gallery');
168
169	// Image Upload Function
170	function wpcf_upload_image(button_class) {
171		var _custom_media = true,
172			_orig_send_attachment = wp.media.editor.send.attachment;
173		$('body').on('click', button_class, function (e) {
174			var button_id = '#' + $(this).attr('id');
175			var button = $(button_id);
176			_custom_media = true;
177			wp.media.editor.send.attachment = function (props, attachment) {
178				if (_custom_media) {
179					var attachment_url = attachment.url;
180					$('.wpneo-form-image-url').val(attachment_url);
181					$('.wpneo-form-image-id').val(attachment.id);
182				} else {
183					return _orig_send_attachment.apply(button_id, [props, attachment]);
184				}
185			};
186			wp.media.editor.open(button);
187			return false;
188		});
189	}
190	wpcf_upload_image('.wpneo-image-upload');
191	$(document).on('click', '.add_media', function () {
192		_custom_media = false;
193	});
194
195	// Login Toggle Add (Frontend Submit Form)
196	$('.wpneoShowLogin').on('click', function (e) {
197		e.preventDefault();
198		$('.wpneo_login_form_div').slideToggle();
199	});
200
201	// Repeatable Rewards
202	function countRemovesBtn(btn) {
203		var rewards_count = $(btn).length;
204		if (rewards_count > 1) {
205			$(btn).show();
206		} else {
207			$(btn).hide();
208			if (btn == '.removeCampaignRewards') {
209				$('.reward_group').show();
210			}
211			if (btn == '.removecampaignupdate') {
212				$('#campaign_update_field').show();
213			}
214		}
215		$(btn).first().hide();
216	}
217
218	//Add Rewards
219	$('#addreward').on('click', function (e) {
220		e.preventDefault();
221		var rewards_fields = $('.reward_group').html();
222		$('#rewards_addon_fields').append(rewards_fields).hide().show('slow');
223		$('#rewards_addon_fields .campaign_rewards_field_copy:last-child')
224			.find('input,textarea,select')
225			.each(function () {
226				if ($(this).attr('name') != 'remove_rewards' && $(this).attr('type') != 'button') {
227					$(this).val('');
228				}
229			});
230		countRemovesBtn('.removeCampaignRewards');
231	});
232
233	// Remove Campaign Reward
234	$('body').on('click', '.removeCampaignRewards', function (e) {
235		e.preventDefault();
236		const topPosition = $(this).closest('#reward_options').offset().top;
237		$(this).closest('.campaign_rewards_field_copy').html('');
238		$('html, body').animate({ scrollTop: topPosition - 100 }, 100);
239		countRemovesBtn('.removeCampaignRewards');
240	});
241	countRemovesBtn('.removeCampaignRewards');
242
243	//Add More Campaign Update Field
244	$('#addcampaignupdate').on('click', function (e) {
245		e.preventDefault();
246		var update_fields = $('#campaign_update_field').html();
247		$('#campaign_update_addon_field').append(update_fields);
248		countRemovesBtn('.removecampaignupdate');
249	});
250
251	// Remove Campaign Update
252	$('body').on('click', '.removecampaignupdate', function (e) {
253		e.preventDefault();
254		$(this).closest('.campaign_update_field_copy').html('').hide();
255		countRemovesBtn('.removecampaignupdate');
256	});
257	countRemovesBtn('.removecampaignupdate');
258
259	// Dashboard Edit Form
260	$('#wpneo_active_edit_form').on('click', function (e) {
261		e.preventDefault();
262		$('#wpneo_update_display_wrapper').hide();
263		$('#wpneo_update_form_wrapper').fadeIn('slow');
264	});
265
266	// Edit Enable
267	$('#wpneo-edit').on('click', function (e) {
268		e.preventDefault();
269		$('#wpneo-edit').hide();
270		$('.wpneo-content input,.wpneo-content textarea,.wpneo-content select')
271			.not('.wpneo-content input[name="username"]')
272			.removeAttr('disabled')
273			.css('border', '1px solid #dfe1e5');
274		$('.wpneo-save-btn').delay(100).fadeIn('slow');
275		$('.wpneo-cancel-btn').delay(100).fadeIn('slow');
276		$('button.wpneo-image-upload').show();
277	});
278
279	// Dashboard Data Save
280	function wpcf_dashboard_data_save() {
281		var return_data;
282		var postdata = $('#wpneo-dashboard-form').serializeArray();
283		$.ajax({
284			async: false,
285			url: wpcf_ajax_object.ajax_url,
286			type: 'POST',
287			data: postdata,
288			success: function (data, textStatus, jqXHR) {
289				wpcf_modal(data);
290				return_data = data;
291			},
292			error: function (jqXHR, textStatus, errorThrown) {
293				wpcf_modal({ success: 0, message: 'Error sending data' });
294			},
295		});
296		$('.wpneo-content input,.wpneo-content textarea,.wpneo-content select')
297			.attr('disabled', 'disabled')
298			.css('border', 'none');
299		$('.wpneo-cancel-btn').hide();
300		$('#wpneo-edit').delay(100).fadeIn('slow');
301		return return_data;
302	}
303
304	// Dashboard Cancel Button
305	$('.wpneo-cancel-btn').on('click', function (e) {
306		e.preventDefault();
307		$('.wpneo-content input,.wpneo-content textarea,.wpneo-content select')
308			.attr('disabled', 'disabled')
309			.css('border', 'none');
310		$('.wpneo-cancel-btn').hide();
311		$('#wpneo-dashboard-save').hide();
312		$('#wpneo-profile-save').hide();
313		$('#wpneo-contact-save').hide();
314		$('button.wpneo-image-upload').hide();
315		$('#wpneo-edit').delay(100).fadeIn('slow');
316	});
317
318	// Dashboard Froentend ( Dashboard )
319	$('#wpneo-dashboard-save').on('click', function (e) {
320		e.preventDefault(); //STOP default action
321		var postdata = $('#wpneo-dashboard-form').serializeArray();
322		wpcf_dashboard_data_save();
323	});
324
325	// Dashboard Froentend ( Profile )
326	$('#wpneo-profile-save').on('click', function (e) {
327		e.preventDefault(); //STOP default action
328		wpcf_dashboard_data_save();
329	});
330
331	// Dashboard Froentend ( Contact )
332	$('#wpneo-contact-save').on('click', function (e) {
333		e.preventDefault(); //STOP default action
334		wpcf_dashboard_data_save();
335	});
336
337	// Dashboard Froentend ( Password )
338	$('#wpneo-password-save').on('click', function (e) {
339		e.preventDefault(); //STOP default action
340		wpcf_dashboard_data_save();
341	});
342
343	// Dashboard Froentend ( Update )
344	$('#wpneo-update-save').on('click', function (e) {
345		e.preventDefault(); //STOP default action
346		var return_respone = wpcf_dashboard_data_save();
347		wpcf_modal(return_respone);
348	});
349
350	// Tab Menu Action (Product Single)
351	$('.wpneo-tabs-menu a').on('click', function (e) {
352		e.preventDefault();
353		$('.wpneo-tabs-menu li').removeClass('wpneo-current');
354		$(this).parent().addClass('wpneo-current');
355		var currentTab = $(this).attr('href');
356		$('.wpneo-tab-content').hide();
357		$(currentTab).fadeIn();
358		return false;
359	});
360	$($('.wpneo-current a').attr('href')).fadeIn();
361
362	// Modal Bio in Product details
363	$('.wpneo-fund-modal-btn').on('click', function (e) {
364		e.preventDefault();
365		var author = $(this).data('author');
366		$.ajax({
367			type: 'POST',
368			url: wpcf_ajax_object.ajax_url,
369			data: { action: 'wpcf_bio_action', author: author, nonce: wpcf_ajax_object.nonce },
370			success: function (data) {
371				wpcf_modal(data);
372			},
373			error: function (jqXHR, textStatus, errorThrown) {
374				wpcf_modal({ success: 0, message: 'Error' });
375			},
376		});
377	});
378
379	// Modal Close Option
380	$(document).on('click', '.wpneo-modal-close', function () {
381		$('.wpneo-modal-wrapper').css({ display: 'none' });
382		if ($('#wpneo_crowdfunding_redirect_url').length > 0) {
383			location.href = $('#wpneo_crowdfunding_redirect_url').val();
384		}
385	});
386
387	// Donate Field Add Max & Min Amount
388	$('input[name="wpneo_donate_amount_field"]').on('blur change paste', function () {
389		var input_price = $(this).val();
390		var min_price = $(this).data('min-price');
391		var max_price = $(this).data('max-price');
392		if (input_price < min_price) {
393			if (min_price) {
394				$(this).val(min_price);
395				$('.wpneo-tooltip-min').css({ visibility: 'visible' });
396			}
397		} else if (max_price < input_price) {
398			if (max_price) {
399				$(this).val(max_price);
400				$('.wpneo-tooltip-max').css({ visibility: 'visible' });
401			}
402		} else {
403			$('.wpneo-tooltip-min,.wpneo-tooltip-max').css({ visibility: 'hidden' });
404		}
405	});
406
407	// Add Love Campaign
408	$(document).on('click', '#love_this_campaign', function () {
409		var campaign_id = $(this).data('campaign-id');
410		$.ajax({
411			type: 'POST',
412			url: wpcf_ajax_object.ajax_url,
413			data: {
414				action: 'love_campaign_action',
415				campaign_id: campaign_id,
416				nonce: wpcf_ajax_object.nonce,
417			},
418			success: function (data) {
419				data = JSON.parse(data);
420				if (data.success == 1) {
421					$('#campaign_loved_html').html(data.return_html);
422				}
423			},
424			error: function (jqXHR, textStatus, errorThrown) {
425				wpcf_modal({ success: 0, message: 'Error' });
426			},
427		});
428	});
429
430	// Remove Love Campaign
431	$(document).on('click', '#remove_from_love_campaign', function () {
432		var campaign_id = $(this).data('campaign-id');
433		$.ajax({
434			type: 'POST',
435			url: wpcf_ajax_object.ajax_url,
436			data: { action: 'remove_love_campaign_action', campaign_id: campaign_id, nonce: wpcf_ajax_object.nonce },
437			success: function (data) {
438				data = JSON.parse(data);
439				$('#campaign_loved_html').html(data.return_html);
440			},
441			error: function (jqXHR, textStatus, errorThrown) {
442				wpcf_modal({ success: 0, message: 'Error' });
443			},
444		});
445	});
446
447	$(document).on('click', '#user-registration-btn', function (e) {
448		e.preventDefault();
449		var registration_form_data = $(this).closest('form').serialize();
450		$.ajax({
451			type: 'POST',
452			url: wpcf_ajax_object.ajax_url,
453			data: registration_form_data,
454			success: function (data) {
455				wpcf_modal(data);
456				data = JSON.parse(data);
457				if (data.success) {
458					location.href = data.redirect;
459				} else {
460					if (typeof grecaptcha !== 'undefined') {
461						grecaptcha.reset();
462					}
463				}
464			},
465			error: function (jqXHR, textStatus, errorThrown) {
466				wpcf_modal({ success: 0, message: 'Error' });
467			},
468		});
469	});
470
471	var image = $('input[name=wpneo-form-image-url]').val();
472	if (image != '') {
473		$('#wpneo-image-show').html('<img width="150" src="' + image + '" />');
474	}
475
476	$(document).on('click', '.media-button-insert', function (e) {
477		var image = $('input[name=wpneo-form-image-url]').val();
478		if ($('.profile-form-img').length > 0) {
479			$('.profile-form-img').attr('src', image);
480		} else {
481			if (image != '') {
482				$('#wpneo-image-show').html('<img width="150" src="' + image + '" />');
483			}
484		}
485	});
486
487	// Hide Billing and Shipping Information
488	if ($('body.woocommerce-checkout').length >= 1) {
489		if ($('#billing_email').length < 1) {
490			$('#customer_details').css({ display: 'none' });
491		}
492	}
493
494	// Form Reward Image Upload
495	$('body').on('click', '.wpneo-image-upload-btn', function (e) {
496		e.preventDefault();
497		var that = $(this);
498
499		var image = wp
500			.media({
501				title: 'Upload Image',
502				multiple: false,
503			})
504			.open()
505			.on('select', function (e) {
506				var uploaded_image = image.state().get('selection').first();
507				var uploaded_url = uploaded_image.toJSON().url;
508				uploaded_image = uploaded_image.toJSON().id;
509				$(that).parent().find('.wpneo_rewards_image_field').val(uploaded_image);
510				$(that).parent().find('.wpneo_rewards_image_field_url').val(uploaded_url);
511			});
512	});
513
514	$('body').on('click', '.wpneo-image-remove', function (e) {
515		var that = $(this);
516		$(that).parent().find('wpneo_rewards_image_field_url').val('');
517		$(that).parent().find('.wpneo_rewards_image_field').val('');
518	});
519
520	// Reward On Click
521	$('body').on('click', '.price-value-change', function (e) {
522		e.preventDefault();
523		var reward = $(this).data('reward-amount');
524		$('html, body').animate({ scrollTop: 0 }, 600, function () {
525			setTimeout(function () {
526				$('.wpneo_donate_amount_field').addClass('wpneosplash');
527			}, 100);
528			setTimeout(function () {
529				$('.wpneo_donate_amount_field').val(reward);
530				$('.wpneo_donate_amount_field').removeClass('wpneosplash');
531			}, 1000);
532		});
533	});
534	$(document).on('click', 'table.reward_table_dashboard tr', function (e) {
535		$(this).find('.reward_description').slideToggle();
536	});
537
538	// Order View (Dashboard Page)
539	$(document).on('click', '.wpcf-order-view', function (e) {
540		e.preventDefault();
541		var orderid = $(this).data('orderid');
542		$.ajax({
543			type: 'POST',
544			url: wpcf_ajax_object.ajax_url,
545			data: { action: 'wpcf_order_action', orderid: orderid, nonce: wpcf_ajax_object.nonce },
546			success: function (data) {
547				wpcf_modal(data, true);
548			},
549			error: function (jqXHR, textStatus, errorThrown) {
550				wpcf_modal({ success: 0, message: 'Error' });
551			},
552		});
553	});
554
555	// Embed Popup (Single Page)
556	$(document).on('click', '.wpneo-icon-embed', function (e) {
557		e.preventDefault();
558		var postid = $(this).data('postid');
559		$.ajax({
560			type: 'POST',
561			url: wpcf_ajax_object.ajax_url,
562			data: { action: 'wpcf_embed_action', postid: postid, nonce: wpcf_ajax_object.nonce },
563			success: function (data) {
564				wpcf_modal(data);
565			},
566			error: function (jqXHR, textStatus, errorThrown) {
567				wpcf_modal({ success: 0, message: 'Error' });
568			},
569		});
570	});
571
572	// $(document).on('click', '.wpcf-export-data', function (e) {
573	//     e.preventDefault();
574	//     //var postid = $(this).data('postid');
575	//     console.log('Done 2');
576	//     $.ajax({
577	//         type:"POST",
578	//         url: wpcf_ajax_object.ajax_url,
579	//         data: { 'action': 'download_data', 'postid': 222 },
580	//         success:function(data){
581	//             // wpcf_modal(data);
582	//             console.log('Done 1');
583	//         },
584	//         error: function(jqXHR, textStatus, errorThrown){
585	//             console.log('1->', jqXHR);
586	//             console.log('2->', textStatus);
587	//             console.log('3->', errorThrown);
588	//         }
589	//     });
590	// });
591
592	/**
593	 * Place the predefined price in the donation input value
594	 *
595	 * @since 10.22
596	 */
597	$(document).on('click', 'ul.wpcf_predefined_pledge_amount li a', function () {
598		var price = $(this).attr('data-predefined-price');
599		$('.wpneo_donate_amount_field').val(price);
600	});
601
602	$('select[name="wpneo-form-type"]').on('change', function () {
603		if ($(this).val() == 'never_end') {
604			$('#wpneo_form_start_date').parents('.wpneo-single').hide();
605			$('#wpneo_form_end_date').parents('.wpneo-single').hide();
606		} else {
607			$('#wpneo_form_start_date').parents('.wpneo-single').show();
608			$('#wpneo_form_end_date').parents('.wpneo-single').show();
609		}
610	});
611
612	$('.cloud-zoom').magnificPopup({
613		type: 'image',
614		mainClass: 'product-img-zoomin',
615		gallery: { enabled: true },
616		zoom: {
617			enabled: true, // By default it's false, so don't forget to enable it
618			duration: 400, // duration of the effect, in milliseconds
619			easing: 'ease-in-out', // CSS transition easing function
620			opener: function (openerElement) {
621				return openerElement.is('img') ? openerElement : openerElement.find('img');
622			},
623		},
624	});
625});

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.