"use strict";var Scripts,blogOverviewViewModel;(function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f,e){this.Url=n;this.Image=t;this.ImageAlt=i;this.Title=r;this.Summary=u;this.Category=f;this.CategoryUrl=e}return n}();n.BlogPost=t})(t=n.Blog||(n.Blog={}))})(t=n.Components||(n.Components={}))})(Scripts||(Scripts={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t){this.projects=[];this.totalNumberOfResults=0;this.projects=t;this.totalNumberOfResults=n}return n}();n.SearchResult=t})(t=n.Blog||(n.Blog={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(){this.apiLocation="/api/sitecore/Blog/"}return t.prototype.search=function(t,i,r,u){$.ajax({url:this.apiLocation+"BlogPosts?postsToIgnoreIds="+t+"&categoryIds="+i+"&numberOfBlogPosts="+r,dataType:"json",cache:!1,ifModified:!1,success:function(t){for(var f=[],i=null,r=0;r<t.BlogPosts.length;r++)i=t.BlogPosts[r],f.push(new n.Components.Blog.BlogPost(i.Url,i.Image,i.ImageAlt,i.Title,i.Summary,i.Category,i.CategoryUrl));u(new n.Components.Blog.SearchResult(t.TotalNumberOfItems,f))}})},t}();t.BlogPostSearchService=i})(i=t.Blog||(t.Blog={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u){this.searchService=n;this.onSearchLoaded=u;this.blogposts=ko.observableArray();this.numberOfItemsToShowPerLoad=ko.observable(t);this.numberOfItems=ko.observable(t);this.totalNumberOfItems=ko.observable(1e3);this.postsToIgnore=ko.observable(i);this.categories=ko.observable(r);this.isLoading=ko.observable(!1)}return n.prototype.search=function(){this.isLoading(!0);this.windowXBeforeScrolling=window.scrollX;this.windowYBeforeScrolling=window.scrollY;this.searchService.search(this.postsToIgnore(),this.categories(),this.numberOfItems(),this.showResults.bind(this))},n.prototype.loadMore=function(){this.isLoading(!0);this.windowXBeforeScrolling=window.scrollX;this.windowYBeforeScrolling=window.scrollY;this.searchService.search(this.postsToIgnore(),this.categories(),this.numberOfItems()+this.numberOfItemsToShowPerLoad(),this.showResults.bind(this))},n.prototype.showResults=function(n){this.blogposts(n.projects);this.numberOfItems(n.projects.length);this.totalNumberOfItems(n.totalNumberOfResults);this.onSearchLoaded();this.isLoading(!1);window.scrollTo(this.windowXBeforeScrolling,this.windowYBeforeScrolling)},n}();n.BlogOverviewViewModel=t})(t=n.Blog||(n.Blog={}))})(t=n.Components||(n.Components={}))}(Scripts||(Scripts={}));blogOverviewViewModel=null;$(document).ready(function(){var n=$("#blogpostOverview"),t=parseInt(n.attr("data-NumberOfItemsToShow")),i=n.attr("data-PostsToIgnore"),r=n.attr("data-Categories");blogOverviewViewModel=new Scripts.Components.Blog.BlogOverviewViewModel(new Scripts.Components.Blog.BlogPostSearchService,t,i,r,function(){var n,t,i;chopstickBlazy();chopstickBlocklink();n=$("[data-mh='blog-teaser']");n.matchHeight({remove:!0});n.matchHeight();t=$("[data-mh='blog-teaser-title']");t.matchHeight({remove:!0});t.matchHeight();i=$("[data-mh='blog-teaser-paragraph']");i.matchHeight({remove:!0});i.matchHeight();$.fn.matchHeight._update()});ko.applyBindings(blogOverviewViewModel);blogOverviewViewModel.search()})