!function(o){o(document).ready((function(){o("#import").on("click",(function(t){var e;t.preventDefault(),e=o("#flipbook-admin-json").val(),e=JSON.stringify(JSON.parse(e)),confirm("Import flipbooks from JSON. This will delete any existing flipbooks. Are you sure?")&&o.ajax({type:"POST",url:"admin-ajax.php?page=real3d_flipbook_admin",data:{flipbooks:e,security:window.r3d_nonce[0],action:"r3d_import"},success:function(o,t,e){location.href="edit.php?post_type=r3d"},error:function(o,t,e){alert("Status: "+t),alert("Error: "+e)}})})),o("#download").on("click",(function(t){t.preventDefault(),o.ajax({type:"POST",url:"admin-ajax.php?page=real3d_flipbook_admin",data:{security:window.r3d_nonce[0],action:"r3d_get_json"},success:function(o,t,e){var n,r,a;n="flipbooks",r="data:text/json;charset=utf-8,"+encodeURIComponent(o),(a=document.createElement("a")).setAttribute("href",r),a.setAttribute("download",n+".json"),document.body.appendChild(a),a.click(),a.remove()},error:function(o,t,e){alert("Status: "+t),alert("Error: "+e)}})}))}))}(jQuery);