jQuery(document).ready(function($) {
"use strict";
/*
***************************************************************
* Demo Data Import
***************************************************************
*/
$('.royal-import').on('click', function() {
var currentBTN = $(this);
if ( ! confirm('Are you sure you want to Import Demo Content?\n\nRECOMENDED!\nMake this action on a fresh installation of Wordpress, otherwise Demo Content will be added to your current website content.') ) {
return;
}
if ( $('.import-message').length === 0 ) {
$(this).after('
Importing Demo Content... Please be patient while content is being imported! It may take several minutes.
'); $('.import-message').css('border-color', '#ffba00'); currentBTN.val('Importing Demo Content ...'); $(window).scrollTop(0); var data = { action: 'royal_import' }; $.ajax({ type: 'POST', url: ajaxurl, data: { action: 'royal_import' }, success: function(data, textStatus, XMLHttpRequest){ $('.import-message').html('Import Was Sucessfull, Have Fun!
'); $('.import-message').css('border-color', '#7ad03a'); currentBTN.val('Demo Conetnt was Imported!'); $(window).scrollTop(0); }, error: function(MLHttpRequest, textStatus, errorThrown){ setTimeout(function(){ $('.import-message').html('Import Was Sucessfull, Have Fun!
'); $('.import-message').css('border-color', '#7ad03a'); currentBTN.val('Import Demo Content'); $(window).scrollTop(0); }, 15000); } }); }); }); // end dom ready