← Back
Editing: postnow.js
"use strict"; function fbomatic_post_now(postId) { if (confirm("Are you sure you want to submit this post now?") == true) { document.getElementById('fbomatic_submit_post').setAttribute('disabled','disabled'); document.getElementById("fbomatic_span").innerHTML = 'Submitting... (please do not close or refresh this page) '; var data = { action: 'fbomatic_post_now', id: postId }; jQuery.post(ajaxurl, data, function(response) { document.getElementById('fbomatic_submit_post').removeAttribute('disabled'); document.getElementById("fbomatic_span").innerHTML = 'Done! '; }).fail( function(xhr) { document.getElementById("fbomatic_span").innerHTML = 'Error, please check the plugin\'s \'Activity and Logging\' menu for details!'; console.log('Error occured in processing: ' + xhr.statusText + ' - please check plugin\'s \'Activity and Logging\' menu for details.'); }); } else { return; } } function fbomatic_comments_now(postId, groupId, fbpostId) { if (confirm("Are you sure you want to import comments for this post now?") == true) { document.getElementById('fbomatic_submit_comment').setAttribute('disabled','disabled'); document.getElementById("fbomatic_comm_span").innerHTML = 'Submitting... (please do not close or refresh this page) '; var commentnum = document.getElementById("fbomatic_comment_num").value; var commentcontent = jQuery('#fbomatic_comment_content').is(":checked"); var data = { action: 'fbomatic_comments_now', id: postId, groupid: groupId, fbpostId: fbpostId, commentnum: commentnum, commentcontent: commentcontent }; jQuery.post(ajaxurl, data, function(response) { document.getElementById('fbomatic_submit_comment').removeAttribute('disabled'); if(response == "fail") { document.getElementById("fbomatic_comm_span").innerHTML = 'Failed to import comments, please check plugin log! '; } else { document.getElementById("fbomatic_comm_span").innerHTML = 'Done! '; } }).fail( function(xhr) { document.getElementById("fbomatic_comm_span").innerHTML = 'Error, please check the plugin\'s \'Activity and Logging\' menu for details!'; console.log('Error occured in processing: ' + xhr.statusText + ' - please check plugin\'s \'Activity and Logging\' menu for details.'); }); } else { return; } }
Save File
Cancel