\n ")),console.log(g)}}};App.DispatchEvent=function(c,d,e){e=void 0===e?null:e;var f=document.createEvent("Event");f.initEvent(d,!0,!0);if(null!=e)for(var g in e)e.hasOwnProperty(g)&&(f[g]=e[g]);c.dispatchEvent(f)};var CookieConsent=function(){this.onChanged=new EventBus;this.data={updated:10,categories:{essential:{consent:!1,header:"Essential Cookies",items:[{name:"Sessions",description:"A cookie is required to keep you logged into the site as you browse."},{name:"Customisation",description:"For example, storing whether you're using dark mode and your chapter formatting options."}]},advertising:{consent:!1,header:"Advertising",items:[{name:"Advertising",description:'These adverts are required to support the site. Please consider supporting our Patreon if you dislike advertising',
providers:[{name:"DoubleClick",policy:"https://policies.google.com/technologies/ads"}]}]},embed:{consent:!0,optional:!0,header:"Third Party Cookies",items:[{name:"Embedded Content",description:"Includes things like YouTube and Soundcloud embeds. Without consent you will not be able to view embedded content.",providers:[{name:"Youtube",policy:"https://policies.google.com/technologies/partner-sites"},{name:"Soundcloud",policy:"https://soundcloud.com/pages/privacy"}]}]},trackingAds:{consent:!0,optional:!0,
header:"Personalised Advertising",items:[{name:"Advertising",description:"Personalised advertising shows you better adverts and helps support the site much more. The number of adverts does not change.",providerSrc:static_url+"/data/ad-providers.json",providers:[]}]}}};this.categories=JSON.parse(LocalStorageGet("consent","{}")).categories||{}};CookieConsent.prototype.getConsentRequired=function(){return"config"in window&&config.requireCookieConsent};
CookieConsent.prototype.getCategoryAllowed=function(c){return this.getConsentRequired()?null!=this.categories[c]&&this.categories[c].allowed:!0};
CookieConsent.prototype.requestConsent=function(c,d){var e=this;return new Promise(function(f,g){if(e.getConsentRequired()){if(!d&&(c=c.filter(function(n){return!e.getCategoryAllowed(n)}),0==c.length)){f(e);return}var k=new PopUpMenu(null,"Cookie Consent");k.SetWidth("700");k.SetCloseOnHoverOut(!1);k.SetCloseOnLinkPressed(!1);k.SetAllowClose(!1);k.SetFixed(!1);k.ShowDimmer();k.SetContent('');k.Show(null,null,!1);k.SetPosition();
var l=App.GetControllerFromElement(k.element.querySelector("[data-controller-id]"));l.onSave.addListener(function(n){var m=!0,p;for(p in n.categories)e.categories[p]={allowed:n.categories[p].allowed,date:(new Date).getTime()},n.categories[p].allowed||(m=!1);e.save();k.Close();e.onChanged.fire(e);m?f(e):g(e)});l.onReject.addListener(function(n){n?k.Close():window.location.href="/cookies?rejected";g(e)})}else f(e)})};
CookieConsent.prototype.save=function(){var c={};c.date=(new Date).getTime();c.categories=this.categories;LocalStorageSet("consent",JSON.stringify(c))};(function(){var c=new CookieConsent;App.AddDependency("cookieConsent",c)})();var HTMLConverter=function(){this.config={ignore:["SCRIPT","STYLE"],codeLanguages:{cs:"csharp"},thresholds:{em:.3,px:6,pt:6}};this.regex={block:/^(block|flex|table(-row)?|grid|list-item)$/i,lineThrough:/\bline-through\b/i,underline:/\bunderline\b/i,px:/([0-9.]+)(?:px|pt)/,em:/([0-9.]+)em/,spacing:/([0-9.]+)(em|px|pt)/,codeLanguage:/lang(?:uage)?-([a-z]+)/i,figureFloat:/bbcode-figure-(left|right)/i,email:/mailto:(.*)/i,validUrlProtocol:/^(https?|ftp):/i}};
HTMLConverter.prototype.processNode=function(c){switch(c.nodeType){case HTMLElement.TEXT_NODE:var d={type:"text"};d.text=c.nodeValue;return d;case HTMLElement.ELEMENT_NODE:if(-1==this.config.ignore.indexOf(c.tagName)){d={type:null,children:[]};var e=!1,f=window.getComputedStyle(c),g=f.fontSize,k=f.fontWeight,l=f.textDecoration;this.regex.lineThrough.test(l);var n=this.regex.block.test(f.display),m=n?1:0,p=n?1:0;if(n){if(r=this.regex.spacing.exec(f.marginTop))m=r[1]>this.config.thresholds[r[2]]?2:
1;if(r=this.regex.spacing.exec(f.paddingTop))m=Math.max(m,r[1]>this.config.thresholds[r[2]]?2:1);if(r=this.regex.spacing.exec(f.marginBottom))p=r[1]>this.config.thresholds[r[2]]?2:1;if(r=this.regex.spacing.exec(f.paddingBottom))p=Math.max(p,r[1]>this.config.thresholds[r[2]]?2:1);(r=this.regex.spacing.exec(c.style.height))&&0","God Mode Activated")},[73,68,68,81,68]),new Konami(document,function(){StyledAlert("Why would a pony need guns?")},[73,68,75,70,65]),new Konami(document,function(){StyledAlert('')},
[0,1,1,8,9,9,9,8,8,1,9,9,9,1,1,9,7,2,5,3].map(function(c){return c+48})),new Konami(document,function(){StyledAlert('')},"justinbailey".split("").map(function(c){c=c.charCodeAt(0);if(48<=c&&57>=c)return c;if(97<=c&&122>=c)return c-32})))})();
function composePm(c,d){var e=new PopUpMenu(""," Compose Private Message");e.LoadContent("/ajax/private-messages/new?receiver="+encodeURIComponent(d)+"&subject="+encodeURIComponent(c),!0).then(function(f){var g=App.GetControllerFromElement(f.element.querySelector(".compose-pm-controller"));g.onSend.addListener(function(){f.Close()});g.onCancel.addListener(function(){f.Close()})});e.SetWidth(500);e.SetDimmerEnabled(!0);e.Show()}
fQuery.addScopedEventListener(document,"[data-action='compose-pm']","click",function(){var c=this.getAttribute("data-subject");null==c&&(c="");composePm(c,this.getAttribute("data-recipient"))});var HashCallbacks={};function fireHashCallback(c){var d=window.location.hash.substr(1).split("/",2);if(Object.prototype.hasOwnProperty.call(HashCallbacks,d[0]))HashCallbacks[d[0]](d[1],c)}window.addEventListener("hashchange",function(){return fireHashCallback(!1)});
function AddHashCallback(c,d){HashCallbacks[c]=d}
function ShowErrorWindow(c){var d=new PopUpMenu(""," Error");d.SetContent("");d.SetCloseOnHoverOut(!1);d.SetFixed(!0);d.SetContent("
"+c+"
");d.SetFooter("
");d.SetCloseOnHoverOut(!1);d.SetWidth(350);d.Show();d.element.querySelector("button").addEventListener("click",function(e){e.preventDefault();e.stopPropagation();d.Close()})}
function StyledConfirm(c,d,e,f){var g=new PopUpMenu(""," Confirm");g.SetContent("");g.SetCloseOnHoverOut(!1);g.SetFixed(!0);g.SetContent("
\n Hey there, looks like you're using adblock! We know, we know, adverts are incredibly annoying, but they really help to support the site. If you'd consider unblocking the site, we'd be extremely appreciative!\n Hide This Message\n
");f.SetCloseOnHoverOut(!1);f.SetWidth(350);f.Show();f.element.querySelector("[data-alert-button]").addEventListener("click",
function(g){g.preventDefault();g.stopPropagation();f.Close()})};var dash_sayings="Do you want to come inside?;Are you a SPY?;It needs to be about 20% coo...*vomit*;I'm...an egghead!;Awesome!;Now careful [CENSORED];Excuse me!;Never fear, your friendly neighbourhood Dash is here!;And that's why you would never qualify to be my pet;Dun dun duuuun;My life is ruined!;I lost...;Best day ever!;LOUDER!;Pinkie Pie...you are SO random;Time to take out the adorable trash;Yes, it's all true;10...seconds...flat;I'd rather read Daring Do;'I love you, daddy'. Who'd write such trash?".split(";"),
InteractivePony=function(){var c=this;this.base_url="//static.fimfiction.net/images/interactive_pony/dash/";this.sprite="dashing_right.gif";this.dom_element=fQuery.createFromHtml("
Do you want to come inside?
");document.body.appendChild(this.dom_element);this.x=0;this.y=175;this.max_speed=300;this.hspeed=0;this.acceleration=17;this.friction=
.93;this.facing="right";this.on_ground=!0;this.sleep_timer=0;this.text="";this.target_y=this.target_x=this.next_text_timer=this.text_counter=0;this.state="default";this.dom_element.addEventListener("click",function(){c.Clicked()});document.body.addEventListener("mousemove",function(d){var e=d.target;if(!fQuery.isOrChildOf(e,c.dom_element)){do if(50this.x+30&&(this.hspeed+=this.acceleration),this.target_xthis.max_speed&&(this.hspeed=this.max_speed),this.hspeed<-this.max_speed&&(this.hspeed=-this.max_speed),this.hspeed*=this.friction,2this.hspeed&&(this.facing="left"),this.x+=this.hspeed*c;"default"==this.state&&(1>Math.abs(this.hspeed)?
(this.sleep_timer+=c,10f&&(f=-150);this.y+=f*c;1>Math.abs(e-this.y)&&this.x>d.left&&this.xthis.text.length&&(this.next_text_timer+=c);5this.hspeed?this.SetSprite("dashing_left.gif"):-15>this.hspeed?this.SetSprite("trotcycle_rainbow_left.gif"):this.SetSprite("stand_rainbow_"+this.facing+".gif"):this.SetSprite("fly_rainbow_"+this.facing+".gif");var c=parseInt(this.x-this.dom_element.getBoundingClientRect().width/
2,10)+"px",d=parseInt(this.y-this.dom_element.getBoundingClientRect().height,10)+"px";this.dom_element.style.top!=d&&(this.dom_element.style.top=d);this.dom_element.style.left!=c&&(this.dom_element.style.left=c);this.dom_element.querySelector(".speech").textContent=this.text.substr(0,parseInt(this.text_counter,10))};
function InitiateInteractivePony(){var c=new InteractivePony;window.addEventListener("blur",function(){});window.addEventListener("focus",function(){});fQuery.animationFrame(function(d){c.Update(d);c.Render()},.1)}fQuery.ready(function(){1==LocalStorageGet("show_interactive_pony",0)&&InitiateInteractivePony()});var Group=function(){};Group.showAddToGroup=function(c){var d=new PopUpMenu(""," Add To Groups");d.SetWidth(450);d.SetCloseOnHoverOut(!1);d.SetCloseOnLinkPressed(!1);d.SetContent("
");d.LoadContent("/ajax/groups/list/add-story?story="+c,!0);d.Show()};var window_focused=!0,last_update_interval=60,time_since_update=0,max_interval=600,total_elapsed_time=0,num_notifications=0,flash_title=!1,title_cache="",flash_state=!1,popup_timer=0,beep_enabled=!1,debug=!1,event_source=null,event_source_interval=null,popup_interval=null,worker=null;
function ShowNotification(c,d){"undefined"===typeof d&&(d=(new Date).getTime());if(!c.nsfw||"true"==getCookie("view_mature"))if(console.log("Showing notification: "+d),"granted"==DesktopNotificationStatus()){var e=LocalStorageGet("latest_message_id",-1);if(d!=e){LocalStorageSet("latest_message_id",d);var f=new Notification(c.title,{icon:"undefined"!==typeof c.icon?c.icon:"http://static.fimfiction.net/images/notifications/story.png",body:c.text,tag:d});"show"in f&&f.show();if("link"in c){var g=c.link,
k=window;f.onclick=function(){k&&!k.closed?(k.location=g,k.focus()):window.open(g)}}setTimeout(function(){f.close()},2E4);beep_enabled&&document.getElementById("notification_beep").play()}setTimeout(function(){LocalStorageSet("latest_message_id",-1)},1E3)}else e=LocalStorageGet("latest_message_id",-1),d>e&&(LocalStorageSet("latest_message_id",d),beep_enabled&&document.getElementById("notification_beep").play()),$("#notification_popup .notification_title").text(c.title),$("#notification_popup .notification_title").attr("href",
c.link),$("#notification_popup .notification_body").text(c.text),$("#notification_popup .notification_image").attr("src","http://static.fimfiction.net/images/notifications/story.png"),$("#notification_popup").fadeIn(),popup_timer=10,null==popup_interval&&(popup_interval=setInterval(function(){UpdateNotificationsPopup()},1E3))}
function StartNotificationsWorker(){worker=new SharedWorker("/workers/notifications_worker.js");worker.port.addEventListener("message",function(c){if("ping"===c.data)worker.port.postMessage(logged_in_user.id);else{if("notification"==c.data.message){var d=JSON.parse(c.data.data);ShowNotification(d,d.identifier);console.log("Updating counts: "+c.data.counts);SetNotificationCount(c.data.counts)}"private_message"==c.data.message&&(d=JSON.parse(c.data.data),ShowNotification(d,c.data.event_id));"counts"==
c.data.message&&(console.log("Updating counts: "+c.data.data),SetNotificationCount(c.data.data))}},!1);worker.port.start();worker.port.postMessage(logged_in_user.id)}
function StartNotificationsEventSource(){var c=function(){var d=LocalStorageGet("last_event_source_ping",0);null!=event_source?LocalStorageSet("last_event_source_ping",GetTime()):dnum_notifications;num_notifications=f;!window_focused&&g&&(flash_title=!0,document.title="("+num_notifications+") "+title_cache);0==d&&0==c?($("#num_notifications").parent().removeClass("new"),document.title=title_cache):$("#num_notifications").parent().addClass("new");$("#num_social_notifications").text(c);0==c?$("#num_social_notifications").parent().removeClass("new"):
$("#num_social_notifications").parent().addClass("new");$("#num_meta_notifications").text(d);0==d?$("#num_meta_notifications").parent().removeClass("new"):$("#num_meta_notifications").parent().addClass("new");$("#num_content_notifications").text(e);0==e?$("#num_content_notifications").parent().removeClass("new"):$("#num_content_notifications").parent().addClass("new");$("#num_notifications").text(parseInt(d)+parseInt(c))}
var Notifications=function(){this.num_meta_notifications=this.num_social_notifications=this.num_content_notifications=0;this.onCountsUpdated=new EventBus};Notifications.prototype.setContentNotifications=function(c){this.num_content_notifications=c;this.updateNotificationsDisplay()};Notifications.prototype.setMetaNotifications=function(c){this.num_social_notifications=c;this.updateNotificationsDisplay()};Notifications.prototype.setSocialNotifications=function(c){this.num_meta_notifications=c;this.updateNotificationsDisplay()};
Notifications.prototype.updateNotificationsDisplay=function(){this.onCountsUpdated.fire(this.num_content_notifications,this.num_meta_notifications,this.num_social_notifications)};var notifications=new Notifications;function InitialiseNotificationUpdater(c,d,e){num_notifications=c;title_cache=d;beep_enabled=e}function UpdateNotificationsPopup(){flash_state=!flash_state;popup_timer--;0==popup_timer&&($("#notification_popup").fadeOut(),clearInterval(popup_interval))}
function DesktopNotificationStatus(){if("function"!==typeof Notification)return null;if("permission"in Notification)return Notification.permission;if(window.webkitNotifications&&window.webkitNotifications.checkPermission)switch(window.webkitNotifications.checkPermission()){case 0:return"granted";case 1:return"default";case 2:return"denied"}return null};AjaxRequest.BindForm(".form-submit-story",function(c){window.setTimeout("location.reload()",0)});fQuery.addScopedEventListener(document,".button-set-featured-groups","click",function(c){c.preventDefault();c=this.dataset.story;var d=new PopUpMenu(""," Set Featured Groups");d.LoadContent("/ajax/groups/list/featured?story="+c,!0);d.SetCloseOnHoverOut(!1);d.SetWidth(400);d.Show()});
(function(){fQuery.ready(function(c){c=document.querySelectorAll(".story-description");for(var d=0;dc){var g=d;var k=f;var l=0}else 1<=c&&2>c?(g=f,k=d,l=0):2<=c&&3>c?(g=0,k=d,l=f):3<=c&&4>c?(g=0,k=f,l=d):4<=c&&5>c?(g=f,k=0,l=d):5<=c&&6>c&&(g=d,k=0,l=f);e-=d/2;g+=e;k+=e;l+=e;return rgbtohex(255*(0>g?0:1k?0:1l?0:1c;c+=40)fimf_chart_theme.AmSlicedChart.colors.push(hsltorgb(c,1,.47));for(c=20;360>c;c+=40)fimf_chart_theme.AmSlicedChart.colors.push(hsltorgb(c,1,.47))})();var fimf_dual_axis_chart_theme=JSON.parse(JSON.stringify(fimf_chart_theme));fimf_dual_axis_chart_theme.ValueAxesSettings.inside=!0;fimf_dual_axis_chart_theme.ValueAxesSettings.integersOnly=!0;fimf_dual_axis_chart_theme.PanelsSettings={};fimf_dual_axis_chart_theme.PanelsSettings.marginLeft=0;
fimf_dual_axis_chart_theme.PanelsSettings.marginRight=0;var RegisterController=function(){Controller.apply(this,arguments)};$jscomp.inherits(RegisterController,Controller);
RegisterController.prototype.bind=function(c){var d=this;Controller.prototype.bind.call(this,c);c=jstz.determine();this.inputs.timezone.value=c.name();this.inputs.name.addEventListener("blur",function(e){var f=e.target;new AjaxRequest({url:"/ajax/users/validate/username",method:"POST",data:{username:f.value},success:function(g){g.ok?d.elements.username_taken.classList.add("hidden"):(d.elements.username_taken.classList.remove("hidden"),f.setCustomValidity("Username has already been used"))}})});this.inputs.email.addEventListener("blur",
function(e){var f=e.target;new AjaxRequest({url:"/ajax/users/validate/email",method:"POST",data:{email:f.value},success:function(g){g.ok?d.elements.email_taken.classList.add("hidden"):(d.elements.email_taken.classList.remove("hidden"),f.setCustomValidity("Email has already been used"))}})})};RegisterController.prototype.inputName=function(c,d,e){e.setCustomValidity("")};RegisterController.prototype.inputEmail=function(c,d,e){e.setCustomValidity("")};App.AddController("register",RegisterController);var FrontpageController=function(){Controller.call(this);this.featuredStory=Math.floor(10*Math.random())+1;this.lastFeaturedStory=null;this.selectFeaturedStory(this.featuredStory)};$jscomp.inherits(FrontpageController,Controller);
FrontpageController.prototype.bind=function(c){var d=this;Controller.prototype.bind.call(this,c);this.newStories=document.querySelector("new_stories");this.latestStories=document.querySelector("latest_stories");this.nextTimer=setInterval(function(){d.nextFeaturedStory()},1E4);fQuery.click(c.querySelectorAll(".featured_box ul li"),function(e){e=e.target.getAttribute("data-story");d.selectFeaturedStory(e);clearInterval(d.nextTimer)})};
FrontpageController.prototype.nextFeaturedStory=function(){var c=this.featuredStory+1;10window.innerWidth||(this.featuredStory=c,this.lastFeaturedStory!=this.featuredStory&&(this.lastFeaturedStory=this.featuredStory,fQuery.removeClass(document.querySelectorAll(".featured_box ul li"),"selected"),document.getElementById("featured_story_link_"+c).classList.add("selected"),c=document.getElementById("featured_story_"+c),document.querySelector(".featured_box .right").appendChild(c)))};App.AddController("frontpage",FrontpageController);var CommentListController=function(){Controller.apply(this,arguments)};$jscomp.inherits(CommentListController,Controller);
CommentListController.prototype.bind=function(c){var d=this;Controller.prototype.bind.call(this,c);this.container=c;this.current_page=parseInt(c.getAttribute("data-current-page"),10);this.num_pages=parseInt(c.getAttribute("data-num-pages"),10);this.comment_list=c.querySelector(".comment_list");this.type=this.comment_list.getAttribute("data-type");this.item=parseInt(this.comment_list.getAttribute("data-item"),10);this.order=this.comment_list.getAttribute("data-order");this.hoverTimeout=this.quote_container=
null;this.updatePagination();this.setupQuotes();for(var e=this,f=c.querySelectorAll(".page_list .previous"),g=0;gthis.num_pages){e.classList.add("hidden");break}else e.classList.remove("hidden");e=400this.num_pages-f||g>this.current_page-(e+1)&&gf&&fQuery.scrollTop(f));d.comment_list.classList.add("loading");document.body.classList.add("loading");d.current_page=c;d.updatePagination();new AjaxRequest({url:"/ajax/comments/"+d.type,method:"GET",data:{item_id:d.item,page:c,order:d.order},success:function(g){for(var k=$jscomp.makeIterator(d.element.querySelectorAll(".comment_order")),
l=k.next();!l.done;l=k.next())l=l.value,g.order==l.getAttribute("data-order")?l.parentNode.classList.add("selected"):l.parentNode.classList.remove("selected");d.current_page=c;d.num_pages=g.num_pages;d.updatePagination();d.updateContent(g.content);d.endShowQuote();d.comment_list.classList.remove("loading");document.body.classList.remove("loading");App.DispatchEvent(document,"loadVisibleImages");d.setupQuotes();e(c);k=$jscomp.makeIterator(d.element.querySelectorAll(".start-index"));for(l=k.next();!l.done;l=
k.next())l.value.textContent=g.start_index;k=$jscomp.makeIterator(d.element.querySelectorAll(".end-index"));for(l=k.next();!l.done;l=k.next())l.value.textContent=g.end_index;k=$jscomp.makeIterator(d.element.querySelectorAll(".num-comments"));for(l=k.next();!l.done;l=k.next())l.value.textContent=g.num_comments}})})};CommentListController.prototype.getComments=function(){return this.comment_list.querySelectorAll(".comment")};
CommentListController.prototype.goToComment=function(c,d){var e=this;(new Promise(function(f,g){e.comment_list.querySelector("#comment_"+c)?f(e.current_page):new AjaxRequest({url:"/ajax/comments/page",method:"GET",data:{type:e.type,item:e.item,comment:c},success:function(k){0>"+e+"\n";c.insertText(""==c.getText()?e:"\n"+e,!d.ctrlKey&&!d.shiftKey);d.preventDefault();d.ctrlKey||d.shiftKey||fQuery.scrollTop(document.getElementById("add_comment_box").getBoundingClientRect().top)};
CommentListController.prototype.appendNewComment=function(c){"ASC"==this.order?this.comment_list.appendChild(c):fQuery.prepend(this.comment_list,c);fQuery.scrollTop(c.getBoundingClientRect().top)};
CommentListController.prototype.toggleLikeDislike=function(c,d){var e=c.parentNode,f="true"==e.dataset.liked,g="true"==e.dataset.disliked,k=e.querySelector(".like-text"),l=e.querySelector(".dislike-text"),n="POST";d&&f&&(n="DELETE");!d&&g&&(n="DELETE");new AjaxRequest({url:"/ajax/comments/"+this.type+"/"+c.dataset.comment+(d?"/like":"/dislike"),signed:!0,method:n,success:function(m){e.dataset.liked=m.liked?"true":"false";e.dataset.disliked=m.disliked?"true":"false";k.textContent=0==m.likes?"":m.likes;
l.textContent=0==m.dislikes?"":m.dislikes}})};CommentListController.prototype.toggleLike=function(c,d){this.toggleLikeDislike(c,!0)};CommentListController.prototype.toggleDislike=function(c,d){this.toggleLikeDislike(c,!1)};
CommentListController.prototype.preview=function(c,d){var e=this;new AjaxRequest({method:"POST",url:"/ajax/comments/preview",data:{comment:this.findElement("#comment_comment").value},success:function(f){var g=e.findElement("#comment_preview");g.innerHTML=f.comment;g.classList.remove("hidden");App.DispatchEvent(g,"loadVisibleImages")}})};
CommentListController.prototype.showHiddenComment=function(c){c=fQuery.closestParent(c,".comment");c.querySelector(".hidden").classList.remove("hidden");c.querySelector(".message").classList.add("hidden");App.DispatchEvent(c,"loadVisibleImages")};App.AddController("comment-list",CommentListController);(function(){function c(){if(document.querySelector(".content").contains(this)){clearTimeout(f);f=null;var l=this,n=this.getAttribute("href");if(n&&!l.hasAttribute("data-no-user-popup")&&(n=/^\/user\/([0-9]+)\/[^\/]*$/.exec(n))){var m=n[1];f=setTimeout(function(){if(m in g)g[m].CancelRemove(),g[m].Load(m),g[m].Show(l);else{var p=new k(l);p.Load(m);g[m]=p}},100)}}}function d(){var l=this.getAttribute("href");l&&!this.hasAttribute("data-no-user-popup")&&(l=/^\/user\/([0-9]+)\/[^\/]*$/.exec(l))&&(l=l[1],
l in g&&(g[l].CancelLoad(),g[l].TriggerRemove()),clearTimeout(f),f=null)}function e(l){l.addEventListener("mouseenter",c);l.addEventListener("mouseleave",d)}var f=null,g={},k=function(l){var n=this;this.dimmer=this.remove_timeout=this.ajaxRequest=null;this.link=l;this.loaded=this.showing=!1;l=document.createElement("div");l.className="info-card-container";var m=document.createElement("div");m.className="info-card";l.appendChild(m);this.infocard_container=l;this.infocard=m;this.infocard_container.addEventListener("mouseleave",
function(){n.TriggerRemove()});this.infocard_container.addEventListener("mouseenter",function(){n.CancelRemove()});document.body.appendChild(l)};k.prototype.Load=function(l){var n=this;this.loaded||(this.ajaxRequest=new AjaxRequest({url:"/ajax/users/"+l+"/infocard",method:"POST",success:function(m){n.infocard.innerHTML=m.content;n.loaded=!0;n.Show(n.link);n.ajaxRequest=null;App.BindAll(n.infocard_container)},fail:function(){n.ajaxRequest=null}},!1))};k.prototype.CancelLoad=function(){null!=this.ajaxRequest&&
this.ajaxRequest.cancel()};k.prototype.Show=function(l){this.CancelRemove();if(!this.showing&&this.loaded){this.showing=!0;var n=this.infocard_container,m=this.infocard.querySelector(".user-card");n.classList.remove("hidden");m.classList.remove("hiding");m.classList.add("shrunk");forceRelayout(m);m.classList.remove("shrunk");this.infocard_container.style.left=l.getBoundingClientRect().left+l.getBoundingClientRect().width-5+"px";this.infocard_container.style.top=l.getBoundingClientRect().top+fQuery.scrollTop()-
60+"px";forceRelayout(m);App.DispatchEvent(document,"loadVisibleImages")}};k.prototype.TriggerRemove=function(){clearTimeout(this.remove_timeout);var l=this,n=this.infocard.querySelector(".user-card");this.loaded?(this.removing_timeout=setTimeout(function(){n.classList.add("hiding")},150),this.remove_timeout=setTimeout(function(){l.infocard_container.classList.add("hidden");l.showing=!1},450)):(l.infocard_container.classList.add("hidden"),l.showing=!1)};k.prototype.CancelRemove=function(){clearTimeout(this.remove_timeout);
clearTimeout(this.removing_timeout);var l=this.infocard.querySelector(".user-card");null!=l&&l.classList.remove("hiding")};App.AddBinder(function(l){Array.prototype.forEach.call(l.querySelectorAll("a[href*='/user/']"),e)})})();var PopUpMenu=function(c,d){var e=this;this.element=fQuery.createFromHtml('