jQuery(document).ready(function(a){a("input[name=generartv]").click(function(){if("progress"==DTapi.action)var b=a("input[name=ids]").get(0).value,c=DTapi.tmdb,d="?append_to_response=images,trailers",e="&language="+DTapi.lang+"&include_image_language="+DTapi.lang+",null",f="&api_key="+DTapi.key;a.getJSON(c+b+d+e+f,function(d){var g="",h="",i="";a.each(d,function(e,j){if(a("input[name="+e+"]").val(j),a("#message").remove(),a("#postbox-container-2").prepend('<div id="message" class="notice rebskt updated "><p>'+DTapi.complete+"</p></div>"),a("#verificador").show(),"name"==e&&(a("label#title-prompt-text").addClass("screen-reader-text"),a("input[name=post_title]").val(j)),"vote_count"==e&&a("#imdbVotes").val(j),"vote_average"==e&&a("#imdbRating").val(j),"overview"==e&&"undefined"!=typeof tinymce){var k=tinymce.get("content");k&&k instanceof tinymce.Editor?(k.setContent(j),k.save({no_events:!0})):a("textarea#content").val(j)}if("poster_path"==e&&(g+=j+""),"backdrop_path"==e&&(h+=j+""),"poster_path"==e&&(i+="https://image.tmdb.org/t/p/w396"+j),"genres"==e&&"true"==DTapi.genres){var l="";a.each(d.genres,function(b,c){l+=c.name+", ",genr1=c.name,a("input[name=newgenres]").val(genr1),a("#genres-add-submit").trigger("click"),a("#genres-add-submit").prop("disabled",!1),a("input[name=genres]").val("")}),a("input[name="+e+"]").val(l)}if("images"==e){var m="";a.each(d.images.backdrops,function(a,b){if(a>9)return!1;m+=b.file_path+"\n"}),a('textarea[name="imagenes"]').val(m)}if("first_air_date"==e&&a("#new-tag-dtyear").val(j.slice(0,4)),"created_by"==e){var n="",o="";a.each(d.created_by,function(a,b){n+=b.name+",",o+="["+b.profile_path+";"+b.name+"]"}),a("#new-tag-dtcreator").val(n),a("#dt_creator").val(o)}if("production_companies"==e){var p="";a.each(d.production_companies,function(a,b){p+=b.name+","}),a("#new-tag-dtstudio").val(p)}if("networks"==e){var q="";a.each(d.networks,function(a,b){q+=b.name+","}),a("#new-tag-dtnetworks").val(q)}a.getJSON(c+b+"/credits?"+f,function(d){a.each(d,function(b,c){if("cast"==b){var e="",f="";a.each(d.cast,function(a,b){if(a>9)return!1;e+=b.name+", ",f+="["+b.profile_path+";"+b.name+","+b.character+"]"}),a("#new-tag-dtcast").val(e),a("#dt_cast").val(f)}}),a.getJSON(c+b+"/videos?"+f,function(b){a.each(b,function(c,d){var e="";a.each(b.results,function(a,b){if(a>0)return!1;e+="["+b.key+"]"}),a('input[name="youtube_id"]').val(e)})})})}),a('input[name="dt_poster"]').val(g),a('input[name="dt_backdrop"]').val(h),"true"==DTapi.upload&&("edit"==DTapi.post||(a("#url_image_upload").val(i),a("#postimagediv p").html("<ul><li><img class='dt_poster_preview' src='"+i+"'/> </li></ul>")))})})});