File "settings.js"
Full path: /home/webide/saman-clinic.ir/wp-content/plugins/rss-autopilot/admin/js/settings.js
File size: 1.44 KB
MIME-type: application/javascript
Charset: utf-8
jQuery(document).ready(function() {
// Toggle content for metaboxes
jQuery('.hndle, .handlediv').click(function() {
jQuery(this).parent().toggleClass('closed');
if (jQuery(this).parent().hasClass('closed')) {
}
});
jQuery('#rssap-settings-form').submit(function() {
jQuery.post(
jQuery(this).attr('action'),
jQuery(this).serialize(),
function(data) {
if (data.status) {
window.location = data.redirect_url;
} else {
displayErrors(data.errors);
}
},
'json'
);
return false;
});
function displayErrors(errors)
{
if (!errors) return;
var offsetTop = 0;
jQuery.each(errors, function(name, error) {
var elements = jQuery.find('[name="'+name+'"]');
if (elements.length) {
jQuery('[name="'+name+'"]').last().parents('.rssap-field-container').first().append('<p class="rssap-error-notice">'+error+'</p>');
if (!offsetTop) {
offsetTop = jQuery('[name="'+name+'"]').last().parents('.rssap-field-container').first().offset().top;
}
}
});
if (offsetTop) {
jQuery(window).scrollTop(offsetTop);
}
}
function clearErrors()
{
jQuery('.rssap-error-notice').remove();
}
});