function entryLoadingBindings(){$(".edit-button2").on("click",function(){var n=$(this).attr("data-rel"),t=$(this).attr("data-type");$.get({type:"GET",url:"/entry/editentry",data:{entryid:n}}).done(function(i){var r=$("#edit-entry-container-"+n);r.html(i);r.find("input[name=saveEntryButton]").on("click",function(){var n=$(this).attr("data-rel");$("#entry-editor-"+n).sync();var t=$("#entry-editor-"+n).bbcode(),i=$("#entry-editor-title-"+n),r=document.getElementById("entry-form-"+n);t.length>0&&i.val.length>0&&r.submit()});r.find("input[name=previewEntryButton]").on("click",function(){var n=$(this).attr("data-rel"),t,i;showLoading("preview-entry-loading-"+n);t=$("#preview-entry-title-"+n);i=$("#preview-entry-text-"+n);$("#entry-editor-"+n).sync();var r=$("#entry-editor-"+n).bbcode(),u=$("#entry-editor-title-"+n).val(),f={Text:r,Title:u};$.ajax({method:"POST",url:"/entry/preview",data:JSON.stringify(f),contentType:"application/json"}).done(function(t){$("#preview-entry-container-"+n).html(t);hideLoading("preview-entry-loading-"+n)})});r.find("input[name=cancelEditEntryButton]").on("click",function(){var n=$(this).attr("data-rel");$("#edit-entry-container-"+n).css("display","none");$("#entry-container-"+n).css("display","block")});loadBBCodeEditor(t,"#entry-editor-"+n);$("#entry-editor-"+n).bbcode();$("#edit-entry-container-"+n).css("display","block");$("#entry-container-"+n).css("display","none")})});$(".approve-button").on("click",function(){var n=$(this).attr("data-id");confirm(function(){$.ajax({type:"POST",url:"/entry/approve",data:{id:n}}).done(function(t){t.Status=="fail"?showError(t.Message):(showSuccess(t.Message),$(".entry-text .entry"+n).css("opacity","1.0"))})})});$(".delete-button").on("click",function(){if($("#currentDialog").length>0){$("#currentDialog").dialog("destroy");$("#currentDialog").remove();return}var t=$(this),n=$('<div id="currentDialog"><\/div>'),i=t.parent().parent();$.get({type:"GET",url:"/entry/delete"}).done(function(r){n.html(r);i.append(n);n.dialog({autoOpen:!1,closeText:"Close",buttons:{Save:function(){var i={Reason:$("#delete-reason").bbcode().trim(),EntryId:t.attr("data-id")};$.ajax({type:"POST",url:"/entry/delete",data:JSON.stringify(i),dataType:"json",contentType:"application/json"}).done(function(i){i.Status=="fail"?showError(i.Message):(showSuccess(i.Message),$(".entry-insider .entry"+t.attr("data-id")).html(""));n.dialog("destroy");$("#currentDialog").remove()})},Cancel:function(){n.dialog("destroy");$("#currentDialog").remove()}},show:{effect:"blind",duration:500},minWidth:750,minHeight:420,width:750,height:420,modal:!1,title:"Delete entry with a reason."});loadBBCodeEditor(1,n.find(".bbcode"));n.dialog("open")})});$(".detach-button").on("click",function(){var n=$(this).attr("data-id"),t=$(this).attr("data-obj"),i=$(this).attr("data-objid");confirm(function(){$.ajax({type:"POST",url:"/entry/detach",data:{id:n,obj:t,objid:i}}).done(function(t){t.Status=="fail"?showError(t.Message):(showSuccess(t.Message),$(".entry-insider .entry"+n).html(""))})})})}function openCreateEntry(n){var t=$(n).attr("data-object"),i=$(n).attr("data-objectId");$.get({type:"GET",url:"/entry/addentry",data:{obj:t,id:i}}).done(function(n){var t=$("#entry-form-container");t.html(n);t.find("input[name=saveEntryButton]").on("click",function(){var r=$(this).attr("data-rel");$("#entry-editor-0").sync();var n=$("#entry-editor-0").bbcode(),t=$("#entry-editor-title-0"),i=document.getElementById("entry-form-0");n.length>0&&t.val.length>0&&i.submit()});t.find("input[name=previewEntryButton]").on("click",function(){var f=$(this).attr("data-rel"),n,t;showLoading("preview-entry-loading-0");n=$("#preview-entry-title-0");t=$("#preview-entry-text-0");$("#entry-editor-0").sync();var i=$("#entry-editor-0").bbcode(),r=$("#entry-editor-title-0").val(),u={Text:i,Title:r};$.ajax({method:"POST",url:"/entry/preview",data:JSON.stringify(u),contentType:"application/json"}).done(function(n){$("#preview-entry-container-0").html(n);hideLoading("preview-entry-loading-0")})});loadBBCodeEditor(1,"#entry-editor-0")})}function openAttachEntry(n){var t=$(n).attr("data-object"),i=$(n).attr("data-objectId");$("#entry-form-container").load("/entry/attachentry?obj="+t+"&id="+i,function(){})}function detachEntryObject(n){var r=$(n).attr("data-rel"),t=$(n).attr("data-obj"),i=$(n).attr("data-objid"),u=$(n).attr("data-name");confirm('Are you sure you want to detach "'+u+'"?')&&$("#detach-message-"+t+i).load("/entry/detach?id="+r+"&obj="+t+"&objid="+i,function(){$(n).unbind("click")})}function loadEntry(){$("#attach-preview-entry-loading").css("display","block");$("#attach-entry-preview").load("/entry/get?id="+$("#entry-select").val(),function(){$("#attach-preview-entry-loading").css("display","none")})}function loadEdit(n){var t=$(n).attr("data-id");$("#entry-edit-preview").load("/entry/getedit?id="+t,function(){})}function openEntryComments(n){var t=$(n).attr("data-id");$("#viewcomments-button-"+t).prop("disabled",!0);$("#entry-comments-loading-"+t).css("display","block");$("#entry-comment-container-"+t).load("/comment/getentrycomments?id="+t,function(){$("#entry-comments-loading-"+t).css("display","none");$("#viewcomments-button-"+t).css("display","none");$("#hidecomments-button-"+t).css("display","block");$("#viewcomments-button-"+t).prop("disabled",!1);$("#entry-comment-container-"+t).find(".timeago").timeago();$("#comment-editor-"+t).keypress(function(n){n.which==13&&(n.preventDefault(),postQuickComment(this))})})}function closeEntryComments(n){var t=$(n).attr("data-id");$("#entry-comment-container-"+t).html("");$("#hidecomments-button-"+t).css("display","none");$("#viewcomments-button-"+t).css("display","block")}function sendForm(n){var t=document.getElementById(n);t.submit()}function showLoading(n){var t=document.getElementById(n);t&&(t.style.display="block")}function hideLoading(n){var t=document.getElementById(n);t&&(t.style.display="none")}function pressLike(n,t){var i="like-placeholder-"+n+"-"+t;$("#"+i).load("/like",{obj:n,id:t},function(){$("#"+i).load("/like/getlike?obj="+n+"&id="+t,function(){})})}function pressFollow(){var n=$("input[name=page-object]").val(),t=$("input[name=page-id]").val(),i=$("input[name=page-name]").val();$("#page-follow-holder").load("/follow",{obj:n,objId:t,name:i},function(){$("#page-follow-holder").load("/follow/getfollow?obj="+n+"&objId="+t+"&name="+i,function(){})})}function validateComment(){var n=$("#comment-editor").bbcode();$("#comment-editor").sync();n.trim().length>0&&$("#comment-form").submit()}function saveComment(n){var t=$(n).attr("data-rel"),r=$("#comment-editor-"+t).bbcode(),i;$("#comment-editor-"+t).sync();i=document.getElementById("comment-form-"+t);r.length>0&&i.submit()}function cancelEditComment(n){var t=$(n).attr("data-rel");$("#edit-comment-container-"+t).css("display","none");$("#comment-container-"+t).css("display","block")}function postQuickComment(n){var t=$(n).attr("data-id"),i=$("#comment-editor-"+t).val();if(i.trim()!=""){var r=$("#obj-"+t).val(),u=$("#objId-"+t).val(),f={Object:r,ObjectId:u,Text:i};$.ajax({method:"POST",url:"/comment/postquickcomment",data:JSON.stringify(f),contentType:"application/json"}).done(function(n){$("#nocomments-"+t)&&$("#nocomments-"+t).remove();$("#comment-container-"+t).prepend('<div id="newly-posted-comment-'+t+'"><\/div>');$("#newly-posted-comment-"+t).load("/comment/getentrycomment?id="+n,function(){$("#comment-editor-"+t).val("");$("#newly-posted-comment-"+t).find(".timeago").timeago()})})}}function openCreateNews(n){n.style.display="none";$("#news-form-container").load("/news/add",function(){loadBBCodeEditor(!0,"#news-editor")})}function validateNews(){var t=$("#news-editor").bbcode(),i=$("#news-editor-title"),r=$("#news-editor-cateogry"),n;$("#news-editor").sync();n=document.getElementById("news-form");t.length>0&&i.val.length>0&&r.val.length>0&&n.submit()}function addMediaPicture(n,t){var r="#add-media-"+n+"-"+t,i="/file/uploadimage?obj="+n;t>0&&(i+="&objectId="+t);i+="&returnurl="+window.location.href;$(r).load(i,function(){})}function addMediaVideo(n,t){var r="#add-media-"+n+"-"+t,i="/media/linkvideo?obj="+n;t>0&&(i+="&objectId="+t);i+="&returnurl="+window.location.href;$(r).load(i,function(){})}function loadGif(n){$("#"+n).find("img").attr("src",$("#"+n).attr("data-rel"));$("#"+n).attr("href",$("#"+n).attr("data-link"))}function showEditMedia(n){var t=$(n).attr("data-rel");$("#media-edit-title-"+t).load("/media/edit?id="+t)}function sendEditMedia(n){var t=$(n).attr("data-rel"),i=$("#edit-media-form-"+t);$(i).submit()}function editMediaDone(n,t){$("#media-edit-title-"+n).html("");t&&t!=""&&$("#media-title-"+n).html(t)}(function(n){n.fn.dropit=function(t){var i={init:function(t){return this.dropit.settings=n.extend({},this.dropit.defaults,t),this.each(function(){var i=n(this),r=this,t=n.fn.dropit.settings;i.addClass("dropit").find(">"+t.triggerParentEl+":has("+t.submenuEl+")").addClass("dropit-trigger").find(t.submenuEl).addClass("dropit-submenu").hide();i.off(t.action).on(t.action,t.triggerParentEl+":has("+t.submenuEl+") > "+t.triggerEl+"",function(){return t.action=="click"&&n(this).parents(t.triggerParentEl).hasClass("dropit-open")?(t.beforeHide.call(this),n(this).parents(t.triggerParentEl).removeClass("dropit-open").find(t.submenuEl).hide(),t.afterHide.call(this),!1):(t.beforeHide.call(this),n(".dropit-open").removeClass("dropit-open").find(".dropit-submenu").hide(),t.afterHide.call(this),t.beforeShow.call(this),n(this).parents(t.triggerParentEl).addClass("dropit-open").find(t.submenuEl).show(),t.afterShow.call(this),!1)});n(document).on("click",function(){t.beforeHide.call(this);n(".dropit-open").removeClass("dropit-open").find(".dropit-submenu").hide();t.afterHide.call(this)});if(t.action=="mouseenter")i.on("mouseleave",".dropit-open",function(){t.beforeHide.call(this);n(this).removeClass("dropit-open").find(t.submenuEl).hide();t.afterHide.call(this)});t.afterLoad.call(this)})}};if(i[t])return i[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t!="object"&&t)n.error('Method "'+t+'" does not exist in dropit plugin!');else return i.init.apply(this,arguments)};n.fn.dropit.defaults={action:"click",submenuEl:"ul",triggerEl:"a",triggerParentEl:"li",afterLoad:function(){},beforeShow:function(){},afterShow:function(){},beforeHide:function(){},afterHide:function(){}};n.fn.dropit.settings={}})(jQuery)