PageSourceSearch

https://www.ofah.org/wp-content/plugins/108-salesforce-connector/assets/js/admin-script.js?ver=1790284441

js ofah.org collected 2026-09-24 21:14:49 UTC 4,020 bytes, 132 lines download raw bytes

1jQuery(document).ready(function($){ 
2
3	// Object field mapping
4	jQuery("#field-mapping #sf_object").on('change', function(){
5
6		jQuery('#field-mapping').submit();
7	});
8	
9	// Sync user to SF
10	$('table.users .column-sf_action .dashicons-upload').on('click', function() {
11		var current_user = jQuery(this);
12		var user_id = jQuery(this).attr('data');
13
14		current_user.parent().find('.sf_result').text("Exporting to Salesforce...");
15
16		$.ajax({
17			type: 'POST',
18			url: sfsyncScript.ajaxurl,
19			data: {
20				"action": "sf_export_user_sync",//here
21				"user_id": user_id
22			}, //CLOSE DATA
23			success: function (data) {
24				var result = jQuery.parseJSON( data );
25				console.log(result);
26				current_user.parent().find('.sf_result').text(result.message);
27				current_user.parent().find('.sf_object_id a').attr('href',result.sf_link);
28				current_user.parent().find('.sf_object_id a').text(result.sf_id);
29				// window.location.reload();
30			} //CLOSE SUCCESS
31		}); //CLOSE AJAX
32	});
33
34	// Sync SF to user
35	$('table.users .column-sf_action .dashicons-download').on('click', function() {
36		var current_user = jQuery(this);
37		var user_id = jQuery(this).attr('data');
38
39		current_user.parent().find('.sf_result').text("Importing from Salesforce...");
40
41		$.ajax({
42			type: 'POST',
43			url: sfsyncScript.ajaxurl,
44			data: {
45				"action": "sf_import_user_sync",//here
46				"user_id": user_id
47			}, //CLOSE DATA
48			success: function (data) {
49				var result = jQuery.parseJSON( data );
50				console.log(result);
51				current_user.parent().find('.sf_result').text(result.message);
52				current_user.parent().find('.sf_object_id a').attr('href',result.sf_link);
53				current_user.parent().find('.sf_object_id a').text(result.sf_id);
54				// window.location.reload();
55			} //CLOSE SUCCESS
56		}); //CLOSE AJAX
57	});
58
59	// Sync post to SF
60	$('table.wp-list-table .column-sf_action .dashicons-upload').on('click', function() {
61		var current_post = jQuery(this);
62		var post_id = jQuery(this).attr('data');
63
64		current_post.parent().find('.sf_result').text("Exporting to Salesforce...");
65
66		$.ajax({
67			type: 'POST',
68			url: sfsyncScript.ajaxurl,
69			data: {
70				"action": "sf_export_post_sync",//here
71				"post_id": post_id,
72				"post_type": jQuery("input[name='post_type']").val()
73			}, //CLOSE DATA
74			success: function (data) {
75				var result = jQuery.parseJSON( data );
76				console.log(result);
77				current_post.parent().find('.sf_result').text(result.message);
78				current_post.parent().find('.sf_object_id a').attr('href',result.sf_link);
79				current_post.parent().find('.sf_object_id a').text(result.sf_id);
80				// window.location.reload();
81			} //CLOSE SUCCESS
82		}); //CLOSE AJAX
83	});
84
85	// Sync SF to post
86	$('table.wp-list-table .column-sf_action .dashicons-download').on('click', function() {
87		var current_post = jQuery(this);
88		var post_id = jQuery(this).attr('data');
89
90		current_post.parent().find('.sf_result').text("Importing from Salesforce...");
91
92		$.ajax({
93			type: 'POST',
94			url: sfsyncScript.ajaxurl,
95			data: {
96				"action": "sf_import_post_sync",//here
97				"post_id": post_id,
98				"post_type": jQuery("input[name='post_type']").val()
99			}, //CLOSE DATA
100			success: function (data) {
101				var result = jQuery.parseJSON( data );
102				console.log(result);
103				current_post.parent().find('.sf_result').text(result.message);
104				current_post.parent().find('.sf_object_id a').attr('href',result.sf_link);
105				current_post.parent().find('.sf_object_id a').text(result.sf_id);
106				// window.location.reload();
107			} //CLOSE SUCCESS
108		}); //CLOSE AJAX
109	});
110
111
112	// discoonect API connctions
113	$('.sf_disconnectapi').on('click', function(event) {
114
115		var cb = confirm("Do you really want to disconnect API connection?");
116		if ( cb != true) {
117			return
118		}
119		$.ajax({
120			type: 'POST',
121			url: sfsyncScript.ajaxurl,
122			data: {
123				"action": "sf_disconnect_api_connection",
124			}, //CLOSE DATA
125			success: function (data) {
126				console.log('API connection is disconnected!');
127			// window.location.reload();
128			} //CLOSE SUCCESS
129		}); //CLOSE AJAX
130	});
131
132});

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.