function loadPageFollow(n){var r=n&&n>0,t=$("input[name=page-id]").val(),u=$("input[name=page-object]").val(),i=$("input[name=page-name]").val();(r||t!=0||i!="")&&$("#page-follow-holder").load("/follow/getfollow?obj="+u+"&objId="+t+"&name="+i,function(){})}function loadEntries(){$.each($(".entry-container"),function(n,t){var u=$(t).find("input[name=entry-object]").val(),i,r;console.log(u);i=-1;r=$(t).find("input[name=entry-objectid]");r&&(i=$(r).val());$.get({type:"GET",url:"/entry/getentries",data:{id:i,obj:u}}).done(function(n){$(".entry-container").append(n);entryLoadingBindings();var i=$(this).find("input[name=entry-id]").val();$("#media-entry-"+i).load("/media/getmedias?obj=ENTRY&id="+i,function(){var i=$(this).find(".single-media-container").length,n,t;i>0&&(n=$(this).parent(),n&&(t=$(n).find(".entry-text"),$(t).css("width","720px")))});$(t).find(".timeago").timeago()})})}function loadComments(){for(var u=$(".comment-container"),f=u.length,r,t=0;t<f;t++){var i=u[t],e=$(i).find("#comment-object"),o=$(e).val(),n=$(i).find("#comment-objectid");n&&(n=$(n).val());r="/comment/getcomments?obj="+o;n&&(r+="&id="+n);$(i).load(r,function(){loadBBCodeEditor(0,"#comment-editor");$(i).find(".timeago").timeago();var n=getAnchor();scrollToAnchor(n);$(".delete-comment-button").on("click",function(){var n=$(this).attr("data-id");confirm(function(){var t={Object:"comment",ObjectId:n};$.ajax({type:"POST",url:"/comment/deletecomment",data:JSON.stringify(t),dataType:"json",contentType:"application/json"}).done(function(t){t.Status=="fail"?showError(t.Message):(showSuccess(t.Message),$(".comment-"+n).find(".formatted-text").html(t.Message))})})});$(".force-delete-comment-button").on("click",function(){var n=$(this).attr("data-id");confirm(function(){var t={Object:"comment",ObjectId:n};$.ajax({type:"POST",url:"/comment/forcedeletecomment",data:JSON.stringify(t),dataType:"json",contentType:"application/json"}).done(function(t){t.Status=="fail"?showError(t.Message):(showSuccess(t.Message),$(".comment-"+n).find(".formatted-text").html(t.Message))})})});$(".edit-comment-button").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:"/comment/editcomment",data:{id:t.attr("data-id")}}).done(function(r){n.html(r);i.append(n);n.dialog({autoOpen:!1,closeText:"Close",buttons:{Save:function(){var r=n.find("._EditComment-text").bbcode(),u;if(r.trim().length<=0){n.find("._EditComment-error").animate({height:"show"},500,"linear",function(){setTimeout(function(){n.find("._EditComment-error").animate({height:"hide"},500,"linear",function(){})},3e3)});return}u={NewText:r.trim(),Id:t.attr("data-id")};$.ajax({type:"POST",url:"/comment/editcomment",data:JSON.stringify(u),dataType:"json",contentType:"application/json"}).done(function(r){r.Status=="fail"?showError(r.Message):(showSuccess(r.Message),$.get({type:"GET",url:"/comment/getformatted",data:{id:t.attr("data-id")}}).done(function(n){i.find(".formatted-text").html(n)}));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:"Edit Comment"});loadBBCodeEditor(1,n.find(".bbcode"));n.dialog("open")})});$(".reply-comment-button").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:"/comment/reply",data:{id:t.attr("data-id")}}).done(function(r){n.html(r);i.append(n);n.dialog({autoOpen:!1,closeText:"Close",buttons:{Save:function(){var i=n.find("._ReplyComment-text").bbcode(),r;if(i.trim().length<=0){n.find("._ReplyComment-error").animate({height:"show"},500,"linear",function(){setTimeout(function(){n.find("._ReplyComment-error").animate({height:"hide"},500,"linear",function(){})},3e3)});return}r={Text:i.trim(),ParentId:t.attr("data-id")};$.ajax({type:"POST",url:"/comment/reply",data:JSON.stringify(r),dataType:"json",contentType:"application/json"}).done(function(i){i.Status=="fail"?showError(i.Message):(showSuccess(i.Message),$replyContainer=$("#main").find("#reply-container-"+t.attr("data-id")),$.get({type:"GET",url:"/comment/getformattedreply",data:{id:i.Link,margin:$replyContainer.attr("data-margin")}}).done(function(n){var i=$(n);$replyContainer.prepend(i);i.find(".timeago").timeago();$.each($._data(t.get(0),"events"),function(){$.each(this,function(){i.find(".reply-comment-button").bind(this.type,this.handler)})});$.each($._data(t.parent().find(".force-delete-comment-button").get(0),"events"),function(){$.each(this,function(){i.find(".force-delete-comment-button").bind(this.type,this.handler)})});$.each($._data(t.parent().find(".delete-comment-button").get(0),"events"),function(){$.each(this,function(){i.find(".delete-comment-button").bind(this.type,this.handler)})});$.each($._data(t.parent().find(".edit-comment-button").get(0),"events"),function(){$.each(this,function(){i.find(".edit-comment-button").bind(this.type,this.handler)})})}));n.dialog("destroy");$("#currentDialog").remove()})},Cancel:function(){n.dialog("destroy");$("#currentDialog").remove()}},show:{effect:"blind",duration:500},minWidth:750,minHeight:720,width:750,height:720,modal:!1,title:"Write Reply"});loadBBCodeEditor(1,n.find(".bbcode"));n.dialog("open")})});$.jAlert("attach")},"json")}}function loadMedias(n){var t=$(".media-container");$.each(t,function(t,i){var u=$(i).find("input[name=media-object]").val(),r;if(n&&n!=""&&objectval.toLowerCase()!=n.toLowerCase())return!0;r=$(i).find("input[name=media-objectid]").val();$.get({type:"GET",url:"/media/getmedias",data:{id:r,obj:u}}).done(function(n){$(i).html(n);$(i).find(".timeago").timeago();$(i).find(".delete-media-button").on("click",function(){var n=$(this).attr("data-id");confirm(function(){$.ajax({type:"POST",url:"/media/delete",data:{id:n}}).done(function(t){t.Status=="fail"?showError(t.Message):(showSuccess(t.Message),$("#single-media-container-"+n).hide(),$("#single-media-container-"+n).html(""))})})});$(i).find(".edit-media-button").on("click",function(){var n=$(this).attr("data-id");$.get({type:"GET",url:"/media/edit",data:{id:n}}).done(function(t){$("#media-edit-title-"+n).html(t);$("input[name=edit-media-save]").on("click",function(){$.ajax({type:"POST",url:"/media/edit",data:{Id:n,Title:$(".media"+n).val()}}).done(function(t){t.Status=="fail"?showError(t.Message):(showSuccess(t.Message),$("#media-title-"+n).text(t.Link),$("#media-edit-title-"+n).html(""))})});$("input[name=edit-media-cancel").on("click",function(){$("#media-edit-title-"+n).html("")})})})})})}function loadPostedData(){$("#posted-data-container").load("/rabi/GetLatestPostData",function(){$("#posted-data-container").find(".timeago").timeago();checkWidth()})}function getRandomMascot(){var n="/images/mascotv"+(Math.floor(Math.random()*5)+2)+"-small.png";$("#mascot").attr("src",n)}jQuery.browser={},function(){jQuery.browser.msie=!1;jQuery.browser.version=0;navigator.userAgent.match(/MSIE ([0-9]+)\./)&&(jQuery.browser.msie=!0,jQuery.browser.version=RegExp.$1)}();var bbOptNoVis={lang:"en",buttons:"bold,italic,underline,|,bullist,|,link,|,removeFormat,",smileList:[{title:"erina",img:'<img alt="icon" src="/images/emoticons/erina.png" class="inboundlink-image" />',bbcode:":erina:"},{title:"ribbon",img:'<img alt="icon" src="/images/emoticons/ribbon.png" class="inboundlink-image" />',bbcode:":ribbon:"},{title:"rita",img:'<img alt="icon" src="/images/emoticons/rita.png" class="inboundlink-image" />',bbcode:":rita:"},{title:"rumi",img:'<img alt="icon" src="/images/emoticons/rumi.png" class="inboundlink-image" />',bbcode:":rumi:"},{title:"miru",img:'<img alt="icon" src="/images/emoticons/miru.png" class="inboundlink-image" />',bbcode:":miru:"},{title:"pandora",img:'<img alt="icon" src="/images/emoticons/pandora.png" class="inboundlink-image" />',bbcode:":pandora:"},{title:"seana",img:'<img alt="icon" src="/images/emoticons/seana.png" class="inboundlink-image" />',bbcode:":seana:"},{title:"saya",img:'<img alt="icon" src="/images/emoticons/saya.png" class="inboundlink-image" />',bbcode:":saya:"},{title:"ashuri",img:'<img alt="icon" src="/images/emoticons/ashuri.png" class="inboundlink-image" />',bbcode:":ashuri:"},{title:"cocoa",img:'<img alt="icon" src="/images/emoticons/cocoa.png" class="inboundlink-image" />',bbcode:":cocoa:"},{title:"irisu",img:'<img alt="icon" src="/images/emoticons/irisu.png" class="inboundlink-image" />',bbcode:":irisu:"},{title:"cicini",img:'<img alt="icon" src="/images/emoticons/cicini.png" class="inboundlink-image" />',bbcode:":cicini:"},{title:"chocolate",img:'<img alt="icon" src="/images/emoticons/chocolate.png" class="inboundlink-image" />',bbcode:":chocolate:"},{title:"vanilla",img:'<img alt="icon" src="/images/emoticons/vanilla.png" class="inboundlink-image" />',bbcode:":vanilla:"},{title:"nieve",img:'<img alt="icon" src="/images/emoticons/nieve.png" class="inboundlink-image" />',bbcode:":nieve:"},{title:"nixie",img:'<img alt="icon" src="/images/emoticons/nixie.png" class="inboundlink-image" />',bbcode:":nixie:"}]},wwidth;$(window).ready(function(){wwidth=$(window).width()});$(document).ready(function(){checkWidth(wwidth);$(window).resize(checkWidth);$("#header-logoff-button").on("mouseenter",function(){$("#header-logoff-button-static").css("display","none");$("#header-logoff-button-anim").css("display","block")});$("#header-logoff-button").on("mouseleave",function(){$("#header-logoff-button-static").css("display","block");$("#header-logoff-button-anim").css("display","none")});loadPageFollow();loadEntries();loadComments();loadMedias();loadBBCodeEditor(!0);loadPostedData();refreshUserCount();$(".timeago").timeago();$.timeago.settings.allowFuture=!0;discordWidget.init({serverId:"358674457377898496",title:!1,join:!0,alphabetical:!1,theme:"none",hideChannels:!0,showAllUsers:!1,allUsersDefaultState:!0,showNick:!1});discordWidget.render();$.fn.jAlert.defaults.size="md";$.fn.jAlert.defaults.theme="black";$.fn.jAlert.defaults.showAnimation="fadeInUp";$.fn.jAlert.defaults.hideAnimation="fadeOutDown";$.fn.jAlert.defaults.closeOnClick=!0;$.fn.jAlert.defaults.closeOnEsc=!0;$.fn.jAlert.defaults.replaceOtherAlerts=!0;$.fn.jAlert.defaults.onOpen=function(){loadBBCodeEditor(!0)};$.jAlert("attach");$("#mascot").ready(getRandomMascot());$("#mascot").on("click",function(){getRandomMascot()});$("#main-menu").find("li").each(function(){var i=$(this).attr("data-index"),n=$(this).find("ul"),t=$(this);$(this).mouseover(function(){$(this).find(".txt-menu").addClass("highlighted")});$(this).mouseleave(function(){$(this).find(".txt-menu").removeClass("highlighted")});$(this).find("li").each(function(){$(this).mouseover(function(){$(this).find(".txt-submenu").addClass("highlighted")});$(this).mouseleave(function(){$(this).find(".txt-submenu").removeClass("highlighted")})});t.mouseover(function(){$(this).find("ul").each(function(){n.show();var t=0;$(this).find("li").each(function(){$(this).delay(t*35).animate({width:"show"},300,"linear",function(){});t++})})});t.mouseleave(function(){$(this).find("ul").each(function(){n.hide();$(this).find("li").each(function(){$(this).stop(!0,!0);$(this).hide()})})})});$("#main-menu-button").click(function(){$("#sidemenu").animate({width:"toggle"},350)});$("#notification").click(function(){toggleNotifications()});$("#poll-button").click(function(){if($("#currentDialog").length>0){$("#currentDialog").dialog("destroy");$("#currentDialog").remove();return}var t=$(this),n=$('<div id="currentDialog"><\/div>'),i=t.parent();$.get({type:"GET",url:"/poll/getpolls",data:{}}).done(function(t){n.html(t);var r=n.find("input[name=alreadyAnswered]").val(),u=n.find("input[name=isAuthenticated]").val();i.append(n);r>0?n.dialog({autoOpen:!1,closeText:"Close",buttons:{Close:function(){n.dialog("destroy");$("#currentDialog").remove()}},show:{effect:"blind",duration:200},minWidth:500,minHeight:620,width:500,height:620,modal:!1,title:u==1?"Here are the results...":"Current poll answers..."}):n.dialog({autoOpen:!1,closeText:"Close",buttons:{Send:function(){if($("input[name=pollAnswer]:checked").length==0){showError("You must first select an answer to send.");return}var n={PollId:$("input[name=currentPollId]").val(),AnswerId:$("input[name=pollAnswer]:checked").val()};$.ajax({type:"POST",url:"/poll/answerpoll",data:JSON.stringify(n),dataType:"json",contentType:"application/json"}).done(function(n){n.Status=="fail"?showError(n.Message):(showSuccess(n.Message),$.get({type:"GET",url:"/poll/getpollresult",data:{pollId:$("input[name=currentPollId]").val()}}).done(function(n){$("#poll-result").html(n);$("#poll-result .timeago").timeago()}))})},Close:function(){n.dialog("destroy");$("#currentDialog").remove()}},show:{effect:"blind",duration:200},minWidth:500,minHeight:620,width:500,height:620,modal:!1,title:"What's your answer...?"});n.find(".timeago").timeago();n.dialog("open")})})})