-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathscript.js
30 lines (29 loc) · 909 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
jQuery(document).ready( function($) {
$('body').on('click', '.wpfp-link', function() {
dhis = $(this);
wpfp_do_js( dhis, 1 );
// for favorite post listing page
if (dhis.hasClass('remove-parent')) {
dhis.parent("li").fadeOut();
}
return false;
});
});
function wpfp_do_js( dhis, doAjax ) {
loadingImg = dhis.prev();
loadingImg.show();
beforeImg = dhis.prev().prev();
beforeImg.hide();
url = document.location.href.split('#')[0];
params = dhis.attr('href').replace('?', '') + '&ajax=1';
if ( doAjax ) {
jQuery.get(url, params, function(data) {
dhis.parent().html(data);
if(typeof wpfp_after_ajax == 'function') {
wpfp_after_ajax( dhis ); // use this like a wp action.
}
loadingImg.hide();
}
);
}
}