var LandingPageNewsViewModel,MatchViewModel,MyFeedViewModel,MyLatestResultsModel,PersonalizedShowViewModel,PersonalizedMatchListModel,PickYourTeamListViewModel,SvSMatchViewModel,VideoCountDownViewModel,VideoLandingPageTabViewModel;Bonnier.namespace("Bonnier.Fotbollskanalen.BrowserDetectionModule");Bonnier.Fotbollskanalen.BrowserDetectionModule=function(){var n=function(){var i=navigator.userAgent,t,n=i.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return i.contains("Google Page Speed Insights")?null:/trident/i.test(n[1])?(t=/\brv[ :]+(\d+)/g.exec(i)||[],"IE "+(t[1]||"")):n[1]==="Chrome"&&(t=i.match(/\b(OPR|Edge)\/(\d+)/),t!=null)?t.slice(1).join(" ").replace("OPR","Opera"):(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],(t=i.match(/version\/(\d+)/i))!=null&&n.splice(1,1,t[1]),n)},t=function(){var r=n(),t=parseInt(r[1],10),i=r[0];if(i==="Firefox"&&t<=27||i==="Chrome"&&t<=35||i==="MSIE"&&t<=9||i==="Safari"&&t<=6){if(Fotbollskanalen.CookieModule.getCookie("browserDetection")==="true")return;$('[data-js="old-browser-screen"]').show();$('[data-js="old-browser-continue"]').on("click",function(){$('[data-js="old-browser-screen"]').remove();Fotbollskanalen.CookieModule.setCookie("browserDetection","true",7)})}};return{Init:t}}();(window.$fk||$)(function(){var n=navigator.userAgent;Bonnier.Fotbollskanalen.DeviceTypeModule.IsDesktop()&&!n.contains("Google Page Speed Insights")&&Bonnier.Fotbollskanalen.BrowserDetectionModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.CommentsModule");Bonnier.Fotbollskanalen.CommentsModule=function(){var n=!1,t=function(n,t,r,u,f){var e=window.document.getElementById("disqus_thread");e&&e.parentElement.removeChild(e);e=window.document.createElement("div");e.id="disqus_thread";window.document.getElementById(n).appendChild(e);i(t,r,u,f)},i=function(t,i,u,f){n?window.DISQUS.reset({reload:!0,config:function(){this.page.identifier=t;this.page.url=i;this.page.title=u}}):(window.disqus_config=function(){this.page.url=i;this.page.identifier=t;this.page.title=u},r(f))},r=function(t){if(!n){var i=document.createElement("script");i.type="text/javascript";i.async=!0;i.src="https://"+t+".disqus.com/embed.js";i.setAttribute("date-timestamp",+new Date);i.id="dsq_js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(i);n=!0}};return{Load:t}}();Bonnier.namespace("Bonnier.Fotbollskanalen.CookieAcceptModule");Bonnier.Fotbollskanalen.CookieAcceptModule=function(){var n=function(){$('[data-js="add-cookie"]').on("click",function(){Fotbollskanalen.CookieModule.setCookie("cookie_accept","true",365);$('[data-js="cookie-accept"]').remove()})},t=function(){Fotbollskanalen.CookieModule.hasCookie("cookie_accept")||($('[data-js="cookie-accept"]').show(),n())};return{Init:t}}();(window.$fk||$)(function(){var n=navigator.userAgent;n.contains("Google Page Speed Insights")||location.search.contains("utm_")||Bonnier.Fotbollskanalen.CookieAcceptModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.DesktopAdPageViewIdModule");Bonnier.Fotbollskanalen.DesktopAdPageViewIdModule=function(){function t(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,i=n=="x"?t:t&3|8;return i.toString(16)})}function i(){return n}function r(){n=t()}var n;return{Init:r,GetPageViewId:i}}();Bonnier.Fotbollskanalen.DesktopAdPageViewIdModule.Init();Bonnier.namespace("Bonnier.Fotbollskanalen.DeviceTypeModule");Bonnier.Fotbollskanalen.DeviceTypeModule=function(){var n=function(n,t){return(" "+n.className+" ").indexOf(" "+t+" ")>-1},t=function(){return n(document.body,"mobile")},i=function(){return n(document.body,"tablet")},r=function(){return t()||i()},u=function(){return n(document.body,"desktop")},f=function(){return window.matchMedia&&(window.matchMedia("only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)").matches)||window.devicePixelRatio&&window.devicePixelRatio>1.3};return{IsSmartPhone:t,IsTablet:i,IsSmartPhoneOrTablet:r,IsDesktop:u,IsHighDensity:f}}();Bonnier.namespace("Bonnier.Fotbollskanalen.ForceUpdateModule");Bonnier.Fotbollskanalen.ForceUpdateModule=function(){var i=1500,n,t,r=function(r,u){if(location.pathname!=="/"&&location.pathname!==""&&Bonnier.Fotbollskanalen.NativeBridgeModule.CurrentVersionIsLowerThan(r)&&(u||!Fotbollskanalen.CookieModule.hasDeclinedAppVersion(r))){if(n=document.createElement("div"),n.setAttribute("class","app-update-banner"),$t.isIos?(n.innerHTML='<div class="version-msg">Det finns en ny version ('+r+') av Fotbollskanalen<\/div><div class="download-msg">Uppdatera nu<\/div>',t="itms-apps://itunes.apple.com/se/app/id445591689?mt=8"):(n.innerHTML='<div class="version-msg">Det finns en ny version ('+r+') av Fotbollskanalen<\/div><div class="download-msg">Uppdatera nu<\/div>',t="https://play.google.com/store/apps/details?id=se.tv4.fotbollskanalen.ui&hl=sv"),n.onclick=function(){window.location=t},!u){var f=document.createElement("div");f.setAttribute("class","close-button");f.innerHTML="&times;";f.onclick=function(t){n.style.top="-140px";Fotbollskanalen.CookieModule.declineAppVersion(r);t.stopPropagation()};n.appendChild(f)}document.body.appendChild(n);setTimeout(function(){n.style.top="0px"},i)}};return{NotifyIfOutdatedVersion:r}}();Bonnier.namespace("Bonnier.Fotbollskanalen.GlobalSearchModule");GlobalSearchViewModel=function(){var n=this,o,s;n.query=ko.observable("");var c=$(document.body),p=$("[data-mobile-menu]"),w=$("[data-clear-input]"),l=$("[data-global-search]"),a=$("[data-header]");n.scrollPosition=0;n.ArticleSearchResults=ko.observableArray();n.VideoSearchResults=ko.observableArray();n.MixedSearchResults=ko.observableArray();n.hasMoreArticles=ko.observable(!1);n.hasMoreVideos=ko.observable(!1);n.searchText=ko.observable("");n.articleCountText=ko.observable("");n.videoCountText=ko.observable("");n.SuggestedLeagues=ko.observableArray();n.SuggestedTeams=ko.observableArray();n.SuggestedPlayers=ko.observableArray();n.SuggestedBlogs=ko.observableArray();n.MyItems=ko.observableArray();n.MyItemsHasItems=ko.observable(!1);var u=null,f=null,e=!1,v=!1,r="",t="";($t.isBlog||$t.isBlogTest)&&(o=navigator.userAgent.toLowerCase(),s=Fotbollskanalen.CookieModule.getCookie("NativeCookie")!=="",t=s&&o.indexOf("android")>-1?"https://android.fotbollskanalen.se":s&&(o.indexOf("ipad")>-1||o.indexOf("iphone")>-1)?"https://ios.fotbollskanalen.se":"https://www.fotbollskanalen.se");moment.locale("en",{relativeTime:{future:"in %s",past:"%s ago",s:"s",m:"1m",mm:"%dm",h:"1t",hh:"%dt",d:"1d",dd:"%dd",M:"1m",MM:"%dm",y:"1å",yy:"%då"}});n.computeDate=function(n){return n=moment(n),moment().diff(n,"days")>1?moment(n,"YYYY-MM-DD HH:mm").fromNow(!0):zeroPad(n.hour())+":"+zeroPad(n.minutes())};n.memberContent=function(n){return n!==null&&(n.indexOf("fotbollskanalen-medlemmar-geoblock")!==-1||n.indexOf("fotbollskanalen-medlemmar-ej-geoblock")!==-1)};var i={Videos:{create:function(i){var r=ko.mapping.fromJS(i.data);return r.id=i.data.id,r.published_date_time=n.computeDate(i.data.published_date_time),r.member_content=n.memberContent(i.data.category_title_nids),r.url=t+i.data.url,r}},Articles:{create:function(i){var r=ko.mapping.fromJS(i.data);return r.created=n.computeDate(i.data.created),r.url=t+i.data.url,r}},LandingPages:{create:function(n){var i=ko.mapping.fromJS(n.data);return i.friendly_url=t+n.data.friendly_url,i.name=n.data.name.length<=15||!n.data.short_name?n.data.name:n.data.short_name,i}},SuggestedPlayers:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.name=n.data.name,t.touch_line_id=function(){return n.data.player_id},t}},SuggestedTeams:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.name=n.data.nick_name||n.data.name,t.touch_line_id=function(){return n.data.team_id},t}},SuggestedLeagues:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.name=n.data.nick_name||n.data.name,t}},SuggestedBlogs:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.name=n.data.name,t}},MyItems:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.name=n.data.nick_name,t.name||(t.name=n.data.name.length<=15||!n.data.short_name?n.data.name:n.data.short_name),t.image_url=function(){return n.data.image_url},t}}},h=function(){u&&(clearTimeout(u),u=null);f&&(clearTimeout(f),f=null)},y=function(){n.searchText("Snabbsök genom att klicka på lag eller spelare");$('[data-js="global-search-suggestions"]').show();n.SuggestedTeams().length===0&&($.get(t+"/api/globalsearchsuggestions/",{},function(t){ko.mapping.fromJS(t.leagues,i.SuggestedLeagues,n.SuggestedLeagues);ko.mapping.fromJS(t.blogs,i.SuggestedBlogs,n.SuggestedBlogs);ko.mapping.fromJS(t.teams,i.SuggestedTeams,n.SuggestedTeams);ko.mapping.fromJS(t.players,i.SuggestedPlayers,n.SuggestedPlayers);Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad()},"json"),teamCookies=Fotbollskanalen.CookieModule.getPersonalizedTeams().join(),playerCookies=Fotbollskanalen.CookieModule.getPersonalizedPlayers().join(),$.when(teamCookies?$.getJSON("/api/teams/filter/"+teamCookies):[[]],playerCookies?$.getJSON("/api/players/filter/"+playerCookies):[[]]).then(function(t,r){var u=t[0].concat(r[0]);n.MyItemsHasItems(u.length>0);ko.mapping.fromJS(u,i.MyItems,n.MyItems);Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad()}))};n.KillSearch=function(){l.hide();a.removeClass("header__search--open");n.Search("");$('[data-js="all"]').removeClass("all--hide");n.scrollPosition>0&&(document.documentElement.scrollTop=document.body.scrollTop=n.scrollPosition)};n.OpenSearch=function(){l.show();a.addClass("header__search--open");n.scrollPosition=document.documentElement.scrollTop||document.body.scrollTop;c.hasClass("hamburger--open")&&(c.removeClass("hamburger--open"),p.addClass("hidden"));y();$('[data-js="all"]').addClass("all--hide")};n.showMoreArticles=function(){var i=~~(n.ArticleSearchResults().length/5)+1;$.get(t+"/api/articlesearch/freetext/"+encodeURIComponent(r)+"/page/"+i,{},function(i){$.map(i.items,function(i){i.created=n.computeDate(i.created);i.url=t+i.url});n.ArticleSearchResults.push.apply(n.ArticleSearchResults,i.items);n.hasMoreArticles(n.ArticleSearchResults().length<i.count);n.articleCountText(n.ArticleSearchResults().length+" av "+i.count)},"json")};n.showMoreVideos=function(){var i=~~(n.VideoSearchResults().length/5)+1;$.get(t+"/api/videosearch/freetext/"+encodeURIComponent(r)+"/page/"+i,{},function(i){$.map(i.items,function(i){i.published_date_time=n.computeDate(i.published_date_time);i.member_content=n.memberContent(i.category_title_nids);i.url=t+i.url});n.VideoSearchResults.push.apply(n.VideoSearchResults,i.items);n.hasMoreVideos(n.VideoSearchResults().length<i.count);n.videoCountText(n.VideoSearchResults().length+" av "+i.count);Bonnier.Fotbollskanalen.ImageLazyLoadModule.LazyLoadWithinContainer("#globalSearch",!0)},"json")};n.clickOnArticleSearchResult=function(t,i){i.preventDefault();Bonnier.Fotbollskanalen.TrackingModule.TrackMemberContentClick(t.url,"Globalsök",-1);Bonnier.Fotbollskanalen.TrackingModule.TrackGlobalSearch(n.query,t.page_name,"article");window.location=t.url};n.clickOnVideoSearchResult=function(t,i){i.preventDefault();Bonnier.Fotbollskanalen.TrackingModule.TrackGlobalSearch(n.query,t.title,"video");window.location=t.url};n.clickOnTagResult=function(t,i){i.preventDefault();Bonnier.Fotbollskanalen.TrackingModule.TrackGlobalSearch(n.query,t.name,"tag");window.location=t.friendly_url};n.clickedOnSuggestion=function(t,i){i.preventDefault();Bonnier.Fotbollskanalen.TrackingModule.TrackGlobalSearch(n.query,t.name,"suggestion");window.location=t.friendly_url()};n.Search=function(o){function s(t){e=!1;$('[data-js="global-search-spinner"]').hide();t===null||t===undefined||t.total_count===0?(n.ArticleSearchResults([]),n.VideoSearchResults([]),n.articleCountText(""),n.videoCountText(""),n.hasMoreArticles(!1),n.hasMoreVideos(!1),n.searchText('0 resultat på din sökning "'+o+'"'),Bonnier.Fotbollskanalen.TrackingModule.TrackNoResultGlobalSearch(o)):(n.hasMoreArticles(t.article_search_result.items.length<t.article_search_result.count),n.hasMoreVideos(t.video_search_result.items.length<t.video_search_result.count),ko.mapping.fromJS(t.article_search_result.items,i.Articles,n.ArticleSearchResults),ko.mapping.fromJS(t.video_search_result.items,i.Videos,n.VideoSearchResults),n.searchText(t.total_count+' resultat på din sökning "'+o+'"'),n.articleCountText(t.article_search_result.items.length+" av "+t.article_search_result.count),n.videoCountText(t.video_search_result.items.length+" av "+t.video_search_result.count),Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad())}if(o=o.removeSpecialCharacters(),o!==r){if(r=o,n.query=o,h(),o.length<3&&n.MixedSearchResults([]),o===""){e=!1;$('[data-js="global-search-spinner"]').hide();n.ArticleSearchResults([]);n.VideoSearchResults([]);n.articleCountText("");n.videoCountText("");n.hasMoreArticles(!1);n.hasMoreVideos(!1);y();return}$('[data-js="global-search-suggestions"]').hide();w.addClass("search__input-clear-wrapper--open");f=setTimeout(function(){v=Date.now();n.ArticleSearchResults([]);n.VideoSearchResults([]);n.articleCountText("");n.videoCountText("");n.hasMoreArticles(!1);n.hasMoreVideos(!1);n.searchText('Söker på "'+o+'"');e=!0;$('[data-js="global-search-spinner"]').show()},150);$.get(t+"/api/search/freetext/"+encodeURIComponent(o),{},function(n){if(r===o)if(h(),e){var t=600-(Date.now()-v);t>0?u=setTimeout(function(){s(n)},t):s(n)}else s(n)},"json").fail(function(){h();s(null)});o.length>=3&&$.getJSON(t+"/api/mixed/autocomplete/"+encodeURIComponent(o),function(t){r===o&&(t.length>3&&(t=t.slice(0,3)),ko.mapping.fromJS(t,i.LandingPages,n.MixedSearchResults))})}}};(window.$fk||$)(function(){$t.exists("#globalSearch")&&(Bonnier.Fotbollskanalen.GlobalSearchModule=new GlobalSearchViewModel,ko.applyBindings(Bonnier.Fotbollskanalen.GlobalSearchModule,document.getElementById("globalSearch")))});Bonnier.namespace("Bonnier.Fotbollskanalen.HideElementsModule");Bonnier.Fotbollskanalen.HideElementsModule=function(){var n=function(){$(window).width()<980||$('[data-js="hideOverflowItems"]').each(function(){var n=0,t=$(this),i=$(this).find('[data-js="group-item"]');i.each(function(){n++;n+1>t.attr("data-limit")?$(this).hide():$(this).find(".match-list__group-item").each(function(){n++;n>t.attr("data-limit")&&$(this).hide()})})})};return{HideOverflowedResults:n}}();(window.$fk||$)(function(){$t.exists('[data-js="hideOverflowItems"]')&&Bonnier.Fotbollskanalen.HideElementsModule.HideOverflowedResults()});Bonnier.namespace("Bonnier.Fotbollskanalen.ImageLazyLoadModule");Bonnier.Fotbollskanalen.ImageLazyLoadModule=function(n){function e(){"IntersectionObserver"in window?o():(window.$fk||$)(function(){f()})}function o(){function i(n){var t=n.getAttribute("data-original"),i;t!==null&&t!==undefined&&(t.contains("_width_")&&t.contains("_height_")&&(t=t.replace("_width_",n.parentElement.offsetWidth),t=t.replace("_height_",n.parentElement.offsetHeight),navigator.userAgent.contains("AppleWebKit")&&navigator.vendor==="Google Inc."&&(t+="&imformat=chrome"),Bonnier.Fotbollskanalen.DeviceTypeModule.IsDesktop()&&Bonnier.Fotbollskanalen.DeviceTypeModule.IsHighDensity()&&(t+="&retina=true"),n.setAttribute("data-original",t)),i=t,i)&&(n.onload=function(){this.removeAttribute("data-original");this.style.opacity="1"},n.onerror=function(){this.style.opacity="1"},n.src=i)}var n=document.querySelectorAll("[data-original]"),t=new IntersectionObserver(function(n,t){n.forEach(function(n){n.isIntersecting&&(i(n.target),t.unobserve(n.target))})},{rootMargin:"0px 0px 0px 0px",threshold:0});n.forEach(function(n){n.offsetParent!==null&&(n.style.transition="all 0.3s",t.observe(n))})}var t=1250,r=function(r){var f=n(r).find("img.lazy"),u=!1;(f.each(function(){if($(this).attr("src")===$(this).attr("data-original")){u=!0;return}}),u)||n("img.lazy").lazyload({threshold:t,skip_invisible:!0,effect:"fadeIn",appear:function(){i(this)}})},u=function(r,u,f){u===undefined&&(u=!0);f===undefined&&(f="fadeIn");n("img.lazy").lazyload({threshold:t,skip_invisible:u,container:$(r),effect:f,appear:function(){i(this)}})},f=function(){setTimeout(function(){n("img.lazy").lazyload({threshold:t,skip_invisible:!1,failure_limit:10,appear:function(){i(this)}})},10)},i=function(n){var t=n.getAttribute("data-original"),i,r;t!==null&&t!==undefined&&(t.contains("_width_")&&t.contains("_height_")&&(i=Math.round($(n).parent()[0].getBoundingClientRect().height),r=Math.round($(n).parent()[0].getBoundingClientRect().width),t=t.replace("_width_",r),t=t.replace("_height_",i),navigator.userAgent.contains("AppleWebKit")&&navigator.vendor==="Google Inc."&&(t+="&imformat=chrome"),n.setAttribute("data-original",t)),$(n).removeClass("lazy"),$(n).css("opacity","1"))};return{LazyLoadWithinContainer:u,InitLazyLoad:e,InitLazyLoadTab:r}}(jQuery);Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad();Bonnier.namespace("Bonnier.Fotbollskanalen.ImageSwitchModule");Bonnier.Fotbollskanalen.ImageSwitchModule=function(){var n=function(){setTimeout(function(){$("img.image-switch").each(function(){var n;$(this).is(":hidden")||($(window).width()<640?(n=$(this).attr("data-mobile-image"),n.contains("_width_")&&n.contains("_height_")&&(n=n.replace("_width_",$(this).parent().outerWidth()),n=n.replace("_height_",$(this).parent().outerHeight())),$(this).attr("src",n)):(n=$(this).attr("data-desktop-image"),n.contains("_width_")&&n.contains("_height_")&&(n=n.replace("_width_",$(this).parent().outerWidth()),n=n.replace("_height_",$(this).parent().outerHeight())),$(this).attr("src",n)))})},10)};return{Init:n}}();(window.$fk||$)(function(){$t.exists(".image-switch")&&Bonnier.Fotbollskanalen.ImageSwitchModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.InnerTabNavigationModule");Bonnier.Fotbollskanalen.InnerTabNavigationModule=function(){var n=function(){$('[data-js="tabs-menu"]').on("click",'[data-js="tab-btn"]',function(n){n.preventDefault();var i=$(this),t=$(this).attr("href"),r=i.parent().find(".selected");r.removeClass("selected");i.addClass("selected");$(t).siblings().hide();$(t).show();Bonnier.Fotbollskanalen.TrackingModule.TrackIntraPageTabClick(window.location.pathname,t.replace("#",""));Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoadTab(t);$("body").hasClass("mobile")&&i.parent().hasClass("tabs__menu-fixed")&&window.scrollY>70&&$(window).scrollTop(70)})};return{Init:n}}();(window.$fk||$)(function(){$t.exists('[data-js="tabs"]')&&$t.exists('[data-js="tabs-menu"]')&&Bonnier.Fotbollskanalen.InnerTabNavigationModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.LandingPageNewsModule");LandingPageNewsViewModel=function(n,t,i){var r=this,u=2;r.ExtraArticles=ko.observableArray([]);r.HasMoreArticles=ko.observable(!0);r.LoadMoreArticles=function(){$.getJSON("/api/articlesearch/"+n+"/"+t+"/page/"+u+"/pagesize/"+i,function(n){for(var t=0;t<n.items.length;t++)r.ExtraArticles.push(n.items[t]);Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad();r.HasMoreArticles(r.ExtraArticles().length+i<n.count);++u;$t.isNative&&Fotbollskanalen.ArticleHistoryModule.updateVisited()})}};(window.$fk||$)(function(){if($t.exists("#landing-page-news")){var n=$("#landing-page-news");Bonnier.Fotbollskanalen.LandingPageNewsModule=new LandingPageNewsViewModel(n.attr("data-type"),n.attr("data-id"),parseInt(n.attr("data-page-size")));ko.applyBindings(Bonnier.Fotbollskanalen.LandingPageNewsModule,n[0])}});Bonnier.namespace("Bonnier.Fotbollskanalen.LatestTransfersModule");var LatestTransfersViewModel=function(n,t){var i=this,r;i.IsEmpty=ko.observable(!0);i.Transfers=ko.observableArray([]);i.Message=ko.observableArray("");i.Transfers=ko.mapping.fromJS([],{key:function(n){return ko.utils.unwrapObservable(n.transfer_id)},create:function(n){var t=ko.mapping.fromJS(n.data);return t.isNew=!i.IsEmpty(),t}});r=function(){var r="/api/transfers/latest/"+n;t&&(r+="/leagues/"+t);$.getJSON(r,function(n){ko.mapping.fromJS(n,i.Transfers);i.IsEmpty(n.length===0);n.length===0&&i.Message("Det finns inga aktuella transfers")})};i.init=function(){r();setInterval(r,12e4)};i.init()},LiveMatchWidgetViewModel=function(n){var t=this;t.status=ko.observable("");t.kickoffDate=ko.observable("");t.timer=ko.observable("");t.progress=ko.observable(0);t.homeTeam=ko.observable();t.awayTeam=ko.observable();t.attendance=ko.observable("");t.competitionAndRound=ko.observable("");t.homeTeamName=ko.observable("");t.homeTeamScore=ko.observable("");t.homeTeamAggScore=ko.observable("");t.awayTeamAggScore=ko.observable("");t.homeTeamPenaltyScore=ko.observable("");t.awayTeamPenaltyScore=ko.observable("");t.awayTeamName=ko.observable("");t.awayTeamScore=ko.observable("");t.goals=ko.observableArray([]);t.bookings=ko.observableArray([]);var u=33e3,i,f=function(n){n===""||n==="Ssp"||n==="Psp"?t.status("before"):n==="FT"||n==="AET"||n==="11M"?t.status("after"):t.status("during")},e=function(n){t.timer(n);var i=parseInt(n),r=i>90?i/120:i/90;t.progress(r||0)},r=function(n){t.homeTeamScore(n.home_team_goals);t.awayTeamScore(n.away_team_goals);t.homeTeamAggScore(n.home_team_aggregated_score);t.awayTeamAggScore(n.away_team_aggregated_score);t.homeTeamPenaltyScore(n.home_team_penalty_score);t.awayTeamPenaltyScore(n.away_team_penalty_score);t.goals(n.events.filter(function(n){return n.event_type==="Goal"||n.event_type==="Penalty Goal"||n.event_type==="Own Goal"}));t.bookings(n.events.filter(function(n){return n.event_type==="Yellow Card"||n.event_type==="Yellow Card Two"||n.event_type==="Red Card"}));f(n.status.type);e(n.timer);t.status()==="after"&&clearInterval(i)};$.getJSON("/api/matchinfo/"+n,function(f){var e,o;t.homeTeam(f.match_sheet.home_team);t.awayTeam(f.match_sheet.away_team);t.attendance(f.match_sheet.attendance_string);e="";f.match_sheet.round_string?(e="Omgång "+f.match_sheet.round_string,t.competitionAndRound(f.match_sheet.competition_name?f.match_sheet.competition_name+" - "+e:e)):f.competition_table.group_info.group_name?(e=f.competition_table.group_info.group_name,t.competitionAndRound(f.match_sheet.competition_name?f.match_sheet.competition_name+" - "+e:e)):t.competitionAndRound(f.match_sheet.competition_name?f.match_sheet.competition_name:"");o=f.match_sheet.game_date.date;t.kickoffDate(moment(o.year+"-"+o.month+"-"+o.day,"YYYY-MM-DD").locale("sv").format("ddd Do MMM YYYY").capitalize()+" kl "+o.time);i=setInterval(function(){$.getJSON("/api/matchinfo/liveupdates/"+n,r)},u);r(f.live_updates)})},LoadMoreLatestVideosViewModel=function(n){var t=this;t.page=2;t.pageSize=n.pageSize||14;t.keywords=n.keywords;t.VideoSearchResults=ko.observableArray();t.hasMoreVideos=ko.observable(!0);t.videoCountText=ko.observable("");moment.locale("en",{relativeTime:{future:"in %s",past:"%s ago",s:"s",m:"1m",mm:"%dm",h:"1t",hh:"%dt",d:"1d",dd:"%dd",M:"1m",MM:"%dm",y:"1å",yy:"%då"}});t.computeDate=function(n){return console.log(n),n=moment(n),moment().diff(n,"days")>1?moment(n,"YYYY-MM-DD HH:mm").fromNow(!0):zeroPad(n.hour())+":"+zeroPad(n.minutes())};t.showMoreVideos=function(){var n=t.keywords.length>0?"/api/videosearch/keywords/"+t.keywords+"/pagesize/"+t.pageSize+"/page/"+t.page:"/api/videosearch/pagesize/"+t.pageSize+"/page/"+t.page;$.get(n,{},function(n){t.VideoSearchResults.push.apply(t.VideoSearchResults,n.items);t.hasMoreVideos(n.show_load_more);t.videoCountText(t.VideoSearchResults().length+" av "+n.count);Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad()},"json");t.page+=1}},LoginViewModel=function(){var n=this;n.HasState=ko.observable(!1);n.Entitlements=ko.observableArray([]);n.Username=ko.observable("");n.IsLoggedIn=ko.observable(!1);n.UpdateState=function(t){n.Username(t.username);n.IsLoggedIn(t.isLoggedIn);ko.mapping.fromJS(t.entitlements,{},n.Entitlements);n.HasState(!0);$("[data-js='premiumSportItem']").removeClass("full-width").show();$("[data-js='premiumItem']").removeClass("full-width").show();t.entitlements.forEach(function(n){n.id==1104?($("[data-js='premiumSportItem']").hide(),$("[data-js='premiumItem']").hide()):n.id==7&&($("[data-js='premiumItem']").hide(),$("[data-js='premiumSportItem']").addClass("full-width"))})}};(window.$fk||$)(function(){$t.exists("#login")&&(Bonnier.namespace("Bonnier.Fotbollskanalen.LoginModule"),Bonnier.Fotbollskanalen.LoginModule=new LoginViewModel,ko.applyBindings(Bonnier.Fotbollskanalen.LoginModule,document.getElementById("login")),Bonnier.Fotbollskanalen.NativeBridgeModule.RequestLoginState())});MatchViewModel=function(n){var t=this,c=null,l=null,e=null,o=null,s=null,i=[],r=[],h=[],u=[],a=!1;t.Stadium=ko.observable("");t.Attendance=ko.observable("");t.Referee=ko.observable("");t.CompetitionName=ko.observable();t.CompetitionUrl=ko.observable();t.TableHeader=ko.observable();t.GroupName=ko.observable("");t.IsGroupStage=ko.observable(!1);t.HomeTeam=ko.observable({name:"",team_id:"",manager:"",team_landing_page_url:"",image_url:""});t.AwayTeam=ko.observable({name:"",team_id:"",manager:"",team_landing_page_url:"",image_url:""});t.Date=ko.observable({date:"",time:"",has_timestamp:""});t.HomeScore=ko.observable();t.AwayScore=ko.observable();t.HomePenalties=ko.observable();t.AwayPenalties=ko.observable();t.AwayScore=ko.observable();t.HomeLastSix=ko.observableArray([]);t.AwayLastSix=ko.observableArray([]);t.HomeTeamStartingPlayers=ko.observableArray([]);t.HomeTeamSubPlayers=ko.observableArray([]);t.AwayTeamStartingPlayers=ko.observableArray([]);t.AwayTeamSubPlayers=ko.observableArray([]);t.Table=ko.observableArray([]);t.Statistics=ko.observable();t.HeadToHead=ko.observableArray([]);t.Events=ko.observableArray([]);t.IsLive=ko.observable(!1);t.Timer=ko.observable("");t.AggregatedString=ko.observable("");t.TimerTicker=ko.observable(!1);t.Progress=ko.observable(0);t.VideoHighlights=ko.observableArray([]);ko.observable();t.onLoadedHeadToHead=function(n){n.matches.map(function(n){var t=n.game_date.date;n.dateString=moment(t.year+"-"+t.month+"-"+t.day,"YYYY-MM-DD").locale("sv").format("LL")});t.HeadToHead(n.matches)};var f=function(n,t){var i=["fw","mf","b","mv"],r=i.indexOf(n.gen_pos_short),u=i.indexOf(t.gen_pos_short);return r===u?n.squad_no?t.squad_no?Number(n.squad_no)<Number(t.squad_no)?-1:1:-1:1:r<u?1:-1},y=function(n){var i=parseInt(n),r=i>90?i/120:i/90;t.Progress(r||0)},p=function(n){n===""||n==="Ssp"||n==="Psp"||n==="FT"||n==="AET"||n==="11M"?t.IsLive(!1):t.IsLive(!0)},v=function(n){var t=function(t){t.name=t.firstname+" "+t.surname;t.squad_no&&(t.name=t.squad_no+". "+t.name);t.gen_pos_short&&t.gen_pos_short!=="null"&&(t.name+=" ("+t.gen_pos_short+")");t.yellow_cards=t.cards_yellow1+t.cards_yellow2;var i=!1;n.substituted_players.forEach(function(n){t.time_off===n.time_on&&(i=!0)});i||(t.time_off=0)};n.starting_players.map(t);n.starting_players.sort(f);n.substituted_players.map(t);n.substituted_players.sort(f);n.substituted_players_not_used&&(n.substituted_players_not_used.map(t),n.substituted_players_not_used.sort(f))},w=function(n){var t={};return t.date=moment(n.year+"-"+n.month+"-"+n.day,"YYYY-MM-DD").locale("sv").format("ddd Do MMM YYYY").capitalize(),t.time=n.time,t.has_timestamp=n.has_timestamp,t};t.onLoadedTeams=function(n,f){n.starting_players.length>0&&(a=!0,v(n),v(f),i=n.starting_players,h=f.starting_players,r=n.substituted_players_not_used?n.substituted_players.concat(n.substituted_players_not_used):n.substituted_players,u=f.substituted_players_not_used?f.substituted_players.concat(f.substituted_players_not_used):f.substituted_players,t.bindPlayerArrays(),clearInterval(l));n.name=n.short_name&&hasTooLongName(n.name.split(" "))?n.short_name:n.name;f.name=f.short_name&&hasTooLongName(f.name.split(" "))?f.short_name:f.name;t.HomeTeam(n);t.AwayTeam(f)};t.load=function(){$.getJSON("/api/matchinfo/"+n,function(i){n<1e6&&(e=setInterval(t.loadLiveUpdates,3e4),l=setInterval(t.loadLineups,12e4));t.onLoadedHeadToHead(i.head_to_head);if(i.last6_matches&&(ko.mapping.fromJS(i.last6_matches.home_team_history,{},t.HomeLastSix),ko.mapping.fromJS(i.last6_matches.away_team_history,{},t.AwayLastSix)),i.match_sheet.home_team&&i.match_sheet.away_team)t.onLoadedTeams(i.match_sheet.home_team,i.match_sheet.away_team);if(competitionId=i.match_sheet.competition_id,c=i.competition_table.group_info.group_id,i.match_sheet.referee&&t.Referee(i.match_sheet.referee),i.match_sheet.stadium&&t.Stadium(i.match_sheet.stadium),i.match_sheet.attendance&&t.Attendance(i.match_sheet.attendance_string),t.CompetitionName(i.match_sheet.competition_name),t.CompetitionUrl(i.match_sheet.competition_friendly_url),t.GroupName(i.match_sheet.round?"Omgång "+i.match_sheet.round_string:i.competition_table.group_info.group_name||""),i.match_sheet.game_date&&i.match_sheet.game_date.date&&t.Date(w(i.match_sheet.game_date.date)),i.table.length>0){s=setInterval(t.loadTable,12e4);t.onLoadedTable(i.table);t.TableHeader(t.CompetitionName())}else if(c&&i.competition_table.is_stage_group){t.IsGroupStage(!0);o=setInterval(t.loadGroupTable,12e4);t.onLoadedGroupTable(i.competition_table);t.TableHeader(i.competition_table.group_info.group_name)}t.onLoadedLineups(i.line_ups);t.onLoadedLiveUpdates(i.live_updates);$('[data-js="match-spinner"]').remove()})};t.resetAllPlayers=function(){var n=function(n){n.name=n.squad_no?n.squad_no+". "+n.player:n.player;n.gen_pos_short&&n.gen_pos_short!=="null"&&(n.name+=" ("+n.gen_pos_short+")");n.goals=0;n.own_goals=0;n.yellow_cards=0;n.cards_red=0;n.time_off=0;n.time_on=0};i.map(n);r.map(n);h.map(n);u.map(n)};t.getPlayerByEvent=function(n){var f=function(t){return n.player_id&&t.player_id===n.player_id||t.name===n.player},t;if(n.team==="A"){if((t=i.filter(f),t.length>0)||(t=r.filter(f),t.length>0))return t[0]}else if((t=h.filter(f),t.length>0)||(t=u.filter(f),t.length>0))return t[0]};t.handlePlayerEvent=function(n){var i=t.getPlayerByEvent(n);if(i)switch(n.event_type){case"Yellow Card":i.yellow_cards++;break;case"Yellow Card Two":i.yellow_cards=2;break;case"Red Card":i.cards_red=1;break;case"Goal":case"Penalty Goal":i.goals++;break;case"Own Goal":i.own_goals++;break;case"Substitution In":i.time_on=n.time;break;case"Substitution Out":i.time_off=n.time}};t.bindPlayerArrays=function(){ko.mapping.fromJS(i,{},t.HomeTeamStartingPlayers);ko.mapping.fromJS(r,{},t.HomeTeamSubPlayers);ko.mapping.fromJS(h,{},t.AwayTeamStartingPlayers);ko.mapping.fromJS(u,{},t.AwayTeamSubPlayers)};t.onLoadedLiveUpdates=function(n){if(n.events&&ko.mapping.fromJS(n.events,{},t.Events),!a&&i.length>0){t.resetAllPlayers();for(var r=n.events.length-1;r>=0;r--)t.handlePlayerEvent(n.events[r]);t.bindPlayerArrays()}if(t.Statistics(n.statistics),t.HomeScore(n.home_team_goals),t.AwayScore(n.away_team_goals),n.highlights&&(ko.mapping.fromJS(n.highlights,{},t.VideoHighlights),Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad()),n.home_team_aggregated_score!==null&&n.home_team_penalty_score===null?t.AggregatedString(n.home_team_aggregated_score+"-"+n.away_team_aggregated_score):t.AggregatedString(""),t.AwayScore(n.away_team_goals),y(n.timer),n.status){p(n.status.type);switch(n.status.type.toLowerCase()){case"ft":clearInterval(e);clearInterval(s);clearInterval(o);t.Timer("FT");break;case"aet":clearInterval(e);clearInterval(s);clearInterval(o);t.Timer("AET");break;case"ssp":clearInterval(e);clearInterval(s);clearInterval(o);t.Timer("Susp.");break;case"psp":clearInterval(e);clearInterval(s);clearInterval(o);t.Timer("Postp.");break;case"11m":clearInterval(e);clearInterval(s);clearInterval(o);n.home_team_penalty_score!==null&&n.away_team_penalty_score!==null&&t.Timer("("+n.home_team_penalty_score+"-"+n.away_team_penalty_score+" str)");break;case"ht":t.Timer("HT");t.TimerTicker(!1);break;case"pen":t.TimerTicker(!0);n.match_sheet.home_team.penalties!==null&&n.match_sheet.away_team.penalties!==null&&t.Timer("("+n.home_team_penalty_score+"-"+n.away_team_penalty_score+" str)");break;default:t.TimerTicker()||t.TimerTicker(!0);t.Timer(n.timer)}}};t.loadLiveUpdates=function(){$.getJSON("/api/matchinfo/liveupdates/"+n,t.onLoadedLiveUpdates)};t.onLoadedLineups=function(n){if(n&&n.line_up_home_team.length>0)clearInterval(l);else return;i=n.line_up_home_team;r=n.substitutes_home_team;h=n.line_up_away_team;u=n.substitutes_away_team;i.sort(f);r.sort(f);h.sort(f);u.sort(f);t.resetAllPlayers();t.bindPlayerArrays()};t.loadLineups=function(){$.getJSON("/api/matchinfo/lineups/"+n,t.onLoadedLineups)};t.onLoadedTable=function(n){ko.mapping.fromJS(n,{},t.Table)};t.onLoadedGroupTable=function(n){ko.mapping.fromJS(n.table,{},t.Table)};t.loadTable=function(){$.getJSON("/api/table/"+competitionId,t.onLoadedTable)};t.loadGroupTable=function(){$.getJSON("/api/group/"+c,t.onLoadedTable)};t.load()};ko.bindingHandlers.stopBinding={init:function(){return{controlsDescendantBindings:!0}}};ko.bindingHandlers.timer={update:function(n){var t=$(n).find("> span"),u;if(!t.attr("target-timestamp")){$(n).hide();return}var f=new Date(t.attr("target-timestamp")),i=function(n){return n<10?"0"+n:n},r=function(){var r=Math.floor((f.getTime()-Date.now())/1e3);if(r<=0)clearInterval(u),$(n).text("Matchen startar"),setTimeout(function(){location.href+=(location.href.indexOf("?")===-1?"?":"&")+"aver="+~~(Math.random()*1e5)},3e3);else{var e=Math.floor(r/86400),o=Math.floor(r%86400/3600),s=Math.floor(r%3600/60),h=r%60,c="Avspark om: "+e+"."+i(o)+":"+i(s)+":"+i(h);t.text(c)}};r();u=setInterval(r,1e3)}};MyFeedViewModel=function(){var n=this,i="",r="",c=/^([0-9]{2})\:([0-9]{2})$/,u=1,f=1,t=Bonnier.Fotbollskanalen.DeviceTypeModule.IsSmartPhone()?4:8,e=!0,o=!0,l=!1,a,s,h,v;n.Articles=ko.observableArray([]);n.FetchedArticles=[];n.FetchedVideos=[];n.ArticlesShowMore=ko.observable(!0);n.ArticlesCountLabel=ko.observable("");n.Videos=ko.observableArray([]);n.VideosShowMore=ko.observable(!0);n.VideosShowMoreVisibility=ko.observable(!1);n.ArticlesShowMoreVisibility=ko.observable(!1);n.VideosCountLabel=ko.observable("");n.MatchSwipeList=ko.observableArray([]);n.ShowEmptyFeed=ko.observable(!1);n.IsLoggedIn=ko.observable(!1);n.AnyFavoritesSelected=ko.observable(!1);a=["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"];n.getDateString=function(n){var i=moment(),r=moment().add(1,"d"),t=moment(n.year+"-"+n.month+"-"+n.day,"YYYY-MM-DD");return i.isSame(t,"d")?"Idag":r.isSame(t,"d")?"Imorgon":a[t.weekday()]+" "+n.day+"/"+n.month};n.isLive=function(){return!1};n.isHighlighted=function(n){return n=moment(n,"YYYY-MM-DD HH:mm"),moment().diff(n,"hours")<6?!0:!1};matchBackground=function(n){return n===undefined?"":"background-image: linear-gradient(120deg, "+n.homeTeamColor+" 0%, "+n.homeTeamColor+" var(--split), "+n.awayTeamColor+" var(--split), "+n.awayTeamColor+" 100%);"};futureMatch=function(n){return isFutureMatch(n)?"future-match":""};isFutureMatch=function(n){if(n===undefined)return"";var t=moment(n.date(),"YYYY-MM-DDTHH:mm:ss"),i=moment().add(-2,"hours");return i<t};fullscreenClick=function(n){$t.isNative&&Bonnier.Fotbollskanalen.NativeBridgeModule.CanIUse("fullscreen-video")?(Bonnier.Fotbollskanalen.NativeBridgeModule.SetVideoInfo(n.image_url,n.title,!1),Bonnier.Fotbollskanalen.NativeBridgeModule.PlayVideo(n.video_id,!0)):window.open(n.url,"_self")};iconClicked=function(n){n.video&&n.video.external_url()&&window.open(n.video.external_url(),"_top")};s={Articles:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isHighlighted=c.test(n.data.publish_date),t.fullscreen_url=n.data.url+"?fullscreen=1",t.url=n.data.url,t.video_id=n.data.video_id,t.image_url=n.data.image_url,t.title=n.data.title,t}},Videos:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isHighlighted=c.test(n.data.publish_date),t.fullscreen_url=n.data.url+"?fullscreen=1",t.url=n.data.url,t.video_id=n.data.video_id,t.image_url=n.data.image_url,t.title=n.data.title,t}},MatchSwipeList:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.homeTeamColor=n.data.home_team_color,t.awayTeamColor=n.data.away_team_color,t}}};n.getCookieSearchString=function(){var n=Fotbollskanalen.CookieModule.getPersonalizedLeagues().sort().join(),t=Fotbollskanalen.CookieModule.getPersonalizedTeams().sort().join(),i=Fotbollskanalen.CookieModule.getPersonalizedPlayers().sort().join();return n===""&&(n="0"),t===""&&(t="0"),i===""&&(i="0"),"/leagues/"+n+"/teams/"+t+"/players/"+i};h=function(){var n=Fotbollskanalen.CookieModule.getPersonalizedSections().sort().join();return n===""?"/sections/0":"/sections/"+n};v=function(t){n.ArticlesCountLabel("Visar "+n.Articles().length+" av "+t)};n.loadMoreFeedItems=function(){n.FetchedArticles.length<t&&n.FetchedVideos.length<t&&e&&o?$.when($.getJSON("/api/search/articles"+i+r+"/page/"+u+"/pagesize/"+t),$.getJSON("/api/search/videos"+i+r+"/page/"+f+"/pagesize/"+t)).then(function(i,r){o=i[0].length==t;e=r[0].length==t;i[0].length>0&&(n.FetchedArticles=n.FetchedArticles.concat(i[0]),u++);r[0].length>0&&(n.FetchedVideos=n.FetchedVideos.concat(r[0]),f++);n.sortAndPruneFeed(!0)}):n.FetchedArticles.length<t&&o?$.when($.getJSON("/api/search/articles"+i+r+"/page/"+u+"/pagesize/"+t)).then(function(i){o=i.length==t;i.length>0&&(n.FetchedArticles=n.FetchedArticles.concat(i),u++);n.sortAndPruneFeed(!0)}):n.FetchedVideos.length<t&&e?$.when($.getJSON("/api/search/videos"+i+r+"/page/"+f+"/pagesize/"+t)).then(function(i){e=i.length==t;i.length>0&&(n.FetchedVideos=n.FetchedVideos.concat(i),f++);n.sortAndPruneFeed(!0)}):n.sortAndPruneFeed(!0)};n.loadAd=function(n){$.ajax({url:"/api/ads/getad/"+n(),type:"GET",dataType:"json",success:function(t){$("#ad-container-"+n()).append(t.html)}})};n.hasEmptyFeed=function(){return Fotbollskanalen.CookieModule.getPersonalizedLeagues().concat(Fotbollskanalen.CookieModule.getPersonalizedTeams()).concat(Fotbollskanalen.CookieModule.getPersonalizedPlayers()).concat(Fotbollskanalen.CookieModule.getPersonalizedSections()).length===0};n.sortAndPruneFeed=function(i){var r=[],u,f,e,o;if(n.FetchedArticles.length==0)r=r.concat(n.FetchedVideos),n.FetchedVideos=[];else if(n.FetchedVideos.length==0)r=r.concat(n.FetchedArticles),n.FetchedArticles=[];else for(u=0,f=0;r.length<t&&n.FetchedArticles.length!==0&&n.FetchedVideos.length!==0;)e=n.FetchedArticles[u],o=n.FetchedVideos[f],new Date(e.publish_date)-new Date(o.publish_date)>0?(r.push(e),n.FetchedArticles.splice(u,1),u>0&&u--):(r.push(o),n.FetchedVideos.splice(f,1),f>0&&f--);i?n.Articles.push.apply(n.Articles,ko.mapping.fromJS(r,s.Articles)()):ko.mapping.fromJS(r,s.Articles,n.Articles);Bonnier.Fotbollskanalen.ImageLazyLoadModule&&Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad()};n.loadMyFeed=function(){var a=n.getCookieSearchString(),c;if(!Fotbollskanalen.AccountModule.isLoggedIn()){Bonnier.Fotbollskanalen.PersonalizationEditModule.show();return}if(n.hasEmptyFeed()&&Bonnier.Fotbollskanalen.PersonalizationEditModule.show(),c=h(),n.ShowEmptyFeed(n.hasEmptyFeed()),a!==i||c!==r){if(i=a,r=c,n.hasEmptyFeed()){n.Articles([]);n.Videos([]);n.MatchSwipeList([]);n.ArticlesCountLabel("");n.VideosCountLabel("");$('[data-js="myfeed-spinner"]').hide();return}$('[data-js="myfeed-spinner"]').show();$.when($.getJSON("/api/search/articles"+i+r+"/page/1/pagesize/"+t),$.getJSON("/api/search/videos"+i+r+"/page/1/pagesize/"+t),$.getJSON("/api/mymatchswipelist"+i)).then(function(i,r,h){o=i[0].length==t;e=r[0].length==t;f=2;u=2;n.FetchedVideos=[];n.FetchedArticles=[];r[0].length>0&&(n.FetchedVideos=r[0]);i[0].length>0&&(n.FetchedArticles=i[0]);n.sortAndPruneFeed(!1);ko.mapping.fromJS(h[0],s.MatchSwipeList,n.MatchSwipeList);$t.dispatchCustomEvent("matchlistloaded");$t.exists(".myfeed--matchswipe-wrapper")&&$t.exists(".future-match")&&$(".myfeed--matchswipe-wrapper")[0].scroll($(".future-match")[0].getBoundingClientRect().x-30,0);n.ShowEmptyFeed(n.Videos().length===0&&n.Articles().length===0);v(i[0].count);Bonnier.Fotbollskanalen.ImageLazyLoadModule&&Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad();$('[data-js="myfeed-spinner"]').hide();l||(l=!0,"IntersectionObserver"in window?initLoadMoreObserver():initInViewObserver())})}};initLoadMoreObserver=function(){var n=document.querySelector(".myfeed-loadmore"),t=new IntersectionObserver(function(n){n.forEach(function(n){n.isIntersecting&&Bonnier.Fotbollskanalen.MyFeedModule.loadMoreFeedItems()})},{rootMargin:"100px 0px 0px 0px",threshold:0});t.observe(n)};initInViewObserver=function(){inView.offset({top:500,right:0,bottom:0,left:0});inView(".myfeed-loadmore").on("enter",function(){Bonnier.Fotbollskanalen.MyFeedModule.loadMoreFeedItems()})};n.loadMyFeedStartpage=function(){var u,f;if(t=3,u=n.getCookieSearchString(),!Fotbollskanalen.AccountModule.isLoggedIn()){n.ShowEmptyFeed(!0);n.IsLoggedIn(!1);return}if(n.AnyFavoritesSelected(n.hasEmptyFeed()===!1),n.IsLoggedIn(!0),n.ShowEmptyFeed(n.hasEmptyFeed()),f=h(),u!==i||f!==r){if(i=u,r=f,n.hasEmptyFeed()){n.Articles([]);n.ArticlesCountLabel("");$('[data-js="myfeed-spinner"]').hide();return}$('[data-js="myfeed-spinner"]').show();n.reloadMyFeedStartpage()}};n.reloadMyFeedStartpage=function(){$.when($.getJSON("/api/search/articles"+i+r+"/page/1/pagesize/"+t),$.getJSON("/api/search/videos"+i+r+"/page/1/pagesize/"+t)).then(function(i,r){o=i[0].length==t;e=r[0].length==t;f=2;u=2;n.FetchedVideos=[];n.FetchedArticles=[];r[0].length>0&&(n.FetchedVideos=r[0]);i[0].length>0&&(n.FetchedArticles=i[0]);r[0].length==0&&i[0]==0&&n.ShowEmptyFeed(!0);n.sortAndPruneFeed(!1);$('[data-js="myfeed-spinner"]').hide()})}};(window.$fk||$)(function(){var n=function(){Bonnier.namespace("Bonnier.Fotbollskanalen.MyFeedModule");Bonnier.Fotbollskanalen.MyFeedModule=new MyFeedViewModel;Bonnier.Fotbollskanalen.MyFeedModule.loadMyFeedStartpage();Bonnier.Fotbollskanalen.PersonalizationEditModule.init();ko.applyBindings(Bonnier.Fotbollskanalen.MyFeedModule,document.getElementById("myfeed-startpage"))};if($t.exists("#myfeed")&&(Bonnier.namespace("Bonnier.Fotbollskanalen.MyFeedModule"),Bonnier.Fotbollskanalen.MyFeedModule=new MyFeedViewModel,Bonnier.Fotbollskanalen.MyFeedModule.loadMyFeed(),ko.applyBindings(Bonnier.Fotbollskanalen.MyFeedModule,document.getElementById("myfeed"))),$t.exists("#myfeed-startpage"))if(inView.is(document.getElementById("myfeed-startpage")))n();else{inView.offset(-150);inView("#myfeed-startpage").once("enter",function(){n()})}});MyLatestResultsModel=function(){var n=this,u;n.MatchList=ko.observableArray([]);n.Message=ko.observable("");n.ShowMyResults=ko.observable(!1);n.HasPersonalization=ko.observable(!1);var f=null,t=null,i=!1,r=!1;n.getCookieSearchString=function(){var n=Fotbollskanalen.CookieModule.getPersonalizedLeagues().sort().join(),t=Fotbollskanalen.CookieModule.getPersonalizedTeams().sort().join(),i=Fotbollskanalen.CookieModule.getPersonalizedPlayers().sort().join();return n===""&&i===""&&t===""?"":(n===""&&(n="0"),i===""&&(i="0"),t===""&&(t="0"),"/leagues/"+n+"/teams/"+t+"/players/"+i)};u={MyMatches:{create:function(n){n.data.matches.map(function(n){if(n.status!==null&&n.status!=="undefined")switch(n.status.toLowerCase()){case"ht":n.timer=n.status;break;case"pen":n.timer=n.status;break;default:n.timer=n.timer+"'"}n.round_title=n.round>0?"Omgång "+n.round:"";n.home_team_score!=null&&n.away_team_score!=null?(n.is_home_team_loser=n.home_team_score<n.away_team_score,n.is_away_team_loser=n.home_team_score>n.away_team_score):(n.is_home_team_loser=!1,n.is_away_team_loser=!1);n.home_team_penalties!=null&&n.away_team_penalties!=null?(n.is_home_team_penalty_loser=n.home_team_penalties<n.away_team_penalties,n.is_away_team_penalty_loser=n.home_team_penalties>n.away_team_penalties):(n.is_home_team_penalty_loser=!1,n.is_away_team_penalty_loser=!1)});n.data.league_table_url=n.data.league_url+"?tab=tables";return ko.mapping.fromJS(n.data)}}};n.reload=function(e){var h=Fotbollskanalen.CookieModule.hasPersonalization(),s,o;if(n.HasPersonalization(h),$(".page-header__edit-area").find('[data-js="openPersonalizationEdit"]').show(),s=n.getCookieSearchString(),s===""){n.Message("Här kommer matcher visas för spelare, lag, ligor och turneringar som du följer.");$(".match__background-container").show();n.MatchList([]);return}n.Message("");n.ShowMyResults(!0);e||(t=setTimeout(function(){r=Date.now();i=!0;$('[data-js="match-list-spinner"]').show()},150));o=function(t){ko.mapping.fromJS(t,u.MyMatches,n.MatchList);n.MatchList().length===0?n.Message("Dina ligor, spelare eller lag har inga matcher den kommande veckan"):($('[data-js="match-list"]').show(),n.Message(""));Fotbollskanalen.StickyHeadingModule.setupStickyHeaders();$('[data-js="match-list-spinner"]').hide()};$.getJSON("/api/myresultlistbydate"+s,function(n){if(clearTimeout(t),i){var u=600-(Date.now()-r);u>0?f=setTimeout(function(){o(n)},u):o(n)}else o(n)})};n.reload();setInterval(function(){n.reload(!0)},3e4)};(window.$fk||$)(function(){Fotbollskanalen.StickyHeadingModule.init();$t.exists("#my-matchresults-list")&&(Bonnier.namespace("Bonnier.Fotbollskanalen.MyLatestResultsModule"),Bonnier.Fotbollskanalen.MyLatestResultsModel=new MyLatestResultsModel,ko.applyBindings(Bonnier.Fotbollskanalen.MyLatestResultsModel,document.getElementById("my-matchresults-list")),document.addEventListener("onRefreshPersonalization",function(){Bonnier.Fotbollskanalen.MyLatestResultsModel.reload()},!1))});Bonnier.namespace("Bonnier.Fotbollskanalen.NativeBridgeModule");Bonnier.Fotbollskanalen.NativeBridgeModule=function(){var i={"trigger-sharing":{androidAppMinVersion:"1.5.2",iosAppMinVersion:"4.2"},"push-events":{androidAppMinVersion:"1.5.3",iosAppMinVersion:"4.3"},"hamburger-menu":{androidAppMinVersion:"1.7.0",androidAppMaxVersion:"1.11.0",iosAppMinVersion:"5.0",iosAppMaxVersion:"7.5"},"bottom-menu":{androidAppMinVersion:"1.11.1",iosAppMinVersion:"7.6"},"restore-video-image":{androidAppMinVersion:"1.8.5",iosAppMinVersion:"5.4"},"account-login":{androidAppMinVersion:"1.12.2",iosAppMinVersion:"8.6"},vibrate:{androidAppMinVersion:"1.12.3",iosAppMinVersion:"8.8"},"sync-cookies":{androidAppMinVersion:"1.12.3",iosAppMinVersion:"8.8"},"video-playlist":{androidAppMinVersion:"1.14.3",iosAppMinVersion:"12.2"},"fullscreen-video":{androidAppMinVersion:"1.14.4",iosAppMinVersion:"12.3"},"fullscreen-popup":{androidAppMinVersion:"1.14.7",iosAppMinVersion:"12.5"},consent:{androidAppMinVersion:"1.14.9",iosAppMinVersion:"12.9"},"floating-video":{androidAppMinVersion:"1.15.3",iosAppMinVersion:"13.1"},commenting:{androidAppMinVersion:"1.15.3",iosAppMinVersion:"14.1"}},o="9999.9999.9999",u=function(n,t,i){var u,r,s,f;i===undefined&&(i=o);var e=n.split("."),h=t.split("."),c=i.split(".");for(u=0;u<e.length;u++){if(u>=h.length)break;if(r=parseInt(e[u]),s=parseInt(h[u]),r>s)break;if(r<s)return!1}for(f=0;f<e.length;f++){if(f>=c.length||(r=parseInt(e[f]),maxVersionDigit=parseInt(c[f]),r<maxVersionDigit))return!0;if(r>maxVersionDigit)return!1}return r.length<s.length?!1:!0},f=null,e=null,t=function(n){if(!i[n])return!1;var t,r;if($t.isAndroid)t=Fotbollskanalen.CookieModule.getAndroidAppVersion(),r=i[n].androidAppMinVersion,requiredMaxVersion=i[n].androidAppMaxVersion;else if($t.isIos){if(t=Fotbollskanalen.CookieModule.getIosAppVersion(),r=i[n].iosAppMinVersion,requiredMaxVersion=i[n].iosAppMaxVersion,t==="")return!0}else return!1;return u(t,r,requiredMaxVersion||o)},y=function(n){var t;if($t.isAndroid)t=Fotbollskanalen.CookieModule.getAndroidAppVersion();else if($t.isIos){if(t=Fotbollskanalen.CookieModule.getIosAppVersion(),t==="")return!1}else return!1;return!u(t,n)},p=function(n){Bonnier.Fotbollskanalen.GlobalSearchModule.Search(n)},n=function(n){if($t.isIos){var t=document.createElement("iframe");t.setAttribute("src",n);document.body.appendChild(t);t.parentNode.removeChild(t);t=null}},w=function(){Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch();n("globalsearch://kill")},b=function(){Bonnier.Fotbollskanalen.GlobalSearchModule.OpenSearch();n("globalsearch://open")},k=function(){Bonnier.Fotbollskanalen.PersonalizationEditModule.openPersonalizationSearch();n("personalizationsearch://open");window.Android_JS&&window.Android_JS.onPersonalizationSearchOpen&&window.Android_JS.onPersonalizationSearchOpen()},d=function(){Bonnier.Fotbollskanalen.PersonalizationEditModule.ShowAllHideContainer();n("personalizationsearch://kill");window.Android_JS&&window.Android_JS.onPersonalizationSearchClose&&window.Android_JS.onPersonalizationSearchClose()},g=function(i,r){if(r&&t("fullscreen-video")){if(n("nativeplayvideo://"+i+"?useFullscreen=true"),window.Android_JS&&window.Android_JS.onPlayVideo)window.Android_JS.onPlayVideo(i,r)}else if(n("nativeplayvideo://"+i),window.Android_JS&&window.Android_JS.onPlayVideo)window.Android_JS.onPlayVideo(i)},nt=function(i,r,u){if(t("floating-video")){if(n("nativeplayvideo://"+i+"?yPosition="+r+"&updatedPositionScript="+encodeURIComponent(u)),window.Android_JS&&window.Android_JS.onPlayFloatingVideo)window.Android_JS.onPlayFloatingVideo(i,r,u)}else if(n("nativeplayvideo://"+i),window.Android_JS&&window.Android_JS.onPlayVideo)window.Android_JS.onPlayVideo(i)},tt=function(i){t("fullscreen-popup")&&(n("openfullscreenpopup://?path="+encodeURIComponent(i)),window.Android_JS&&window.Android_JS.openFullscreenPopup&&window.Android_JS.openFullscreenPopup(i))},it=function(i){t("fullscreen-popup")&&(n("closefullscreenpopup://?tab="+i),window.Android_JS&&window.Android_JS.closeFullscreenPopup&&window.Android_JS.closeFullscreenPopup(i))},rt=function(n){t("video-playlist")&&($t.isIos&&$t.isDefined("window.webkit.messageHandlers.videoPlayList.postMessage")&&window.webkit.messageHandlers.videoPlayList.postMessage(n),$t.isAndroid&&$t.isDefined("window.Android_JS.videoPlayList")&&window.Android_JS.videoPlayList(n))},ut=function(n){t("commenting")&&$t.isIos&&$t.isDefined("window.webkit.messageHandlers.commentInfo.postMessage")&&window.webkit.messageHandlers.commentInfo.postMessage(JSON.stringify(n))},ft=function(n){$t.dispatchCustomEvent("currentplaylistvideo",{detail:{assetId:n}})},et=function(){n("hamburgermenu://open");window.Android_JS&&window.Android_JS.onHamburgerMenuOpen&&window.Android_JS.onHamburgerMenuOpen()},ot=function(){n("hamburgermenu://close");window.Android_JS&&window.Android_JS.onHamburgerMenuClose&&window.Android_JS.onHamburgerMenuClose()},st=function(){var n=$(document.body);n.hasClass("hamburger--open")&&(n.removeClass("hamburger--open"),$mobileMenu.addClass("hidden"))},ht=function(n){n==="login"?$("#videoErrorMessage").text("Du behöver "+window.fotbollskanalen_premium_text+" för att spela upp den här videon."):n==="fetch"&&$("#videoErrorMessage").text("Videon kunde inte spelas upp.");$("#videoErrorContainer").show()},s=function(t,i){if(f=t,e=i||location.protocol+"//www.fotbollskanalen.se"+location.pathname,n("enablesharing://"),window.Android_JS&&window.Android_JS.onPassSharingInfo)window.Android_JS.onPassSharingInfo(f,e)},h=function(){n("triggersharing://");window.Android_JS&&window.Android_JS.onTriggerSharing&&window.Android_JS.onTriggerSharing()},ct=function(){t("sync-cookies")&&(n("syncCookies://"),window.Android_JS&&window.Android_JS.onSyncCookies&&window.Android_JS.onSyncCookies())},lt=function(n,t){s(n,t);setTimeout(function(){h()},30)},at=function(){window.Android_JS&&window.Android_JS.onPersonalizationChanged&&window.Android_JS.onPersonalizationChanged()},vt=function(){window.Android_JS&&window.Android_JS.onPushEventChanged&&window.Android_JS.onPushEventChanged()},yt=function(t,i,r){n("setvideoinfo://?coverimageurl="+encodeURIComponent(t)+"&assettitle="+encodeURIComponent(i)+"&islive="+r);window.Android_JS&&window.Android_JS.setVideoInfo&&(currentVersion=Fotbollskanalen.CookieModule.getAndroidAppVersion(),u(currentVersion,"1.9.1")?window.Android_JS.setVideoInfo(t,i,r):window.Android_JS.setVideoInfo(t,i))},pt=function(){return f},wt=function(){return e},bt=function(){},kt=function(){},dt=function(){return window.location.href},gt=function(){window.DISQUS&&window.DISQUS.reset({reload:!0})},ni=function(){n("requestloginstate://");window.Android_JS&&window.Android_JS.onLoginStateRequested&&window.Android_JS.onLoginStateRequested()},ti=function(n){Bonnier.Fotbollskanalen.LoginModule&&Bonnier.Fotbollskanalen.LoginModule.UpdateState($.parseJSON(n))},ii=function(){n("login://");window.Android_JS&&window.Android_JS.doLogin&&window.Android_JS.doLogin()},ri=function(){n("logout://");window.Android_JS&&window.Android_JS.doLogout&&window.Android_JS.doLogout()},ui=function(){n("requestpushnotificationstate://");window.Android_JS&&window.Android_JS.onPushNotificationStateRequested&&window.Android_JS.onPushNotificationStateRequested()},fi=function(n){Bonnier.Fotbollskanalen.PushModule.UpdateNativeState(n)},ei=function(){n("gotonotificationsettings://");window.Android_JS&&window.Android_JS.onGoToPushNotificationSettings&&window.Android_JS.onGoToPushNotificationSettings()},oi=function(){Bonnier.Fotbollskanalen.TrackingModule.TrackAndroidPageView()},c=function(){var n=new Event("onBackNavigation");document.dispatchEvent(n);Bonnier.Fotbollskanalen.TrackingModule.TrackNativeBackNavigatePageView()},si=function(n){localStorage.setItem("nativeTextSize",n)},hi=function(){var n=new Event("onBackNavigation");document.dispatchEvent(n)},ci=function(n){var t=new Fotbollskanalen.PushNextContentModule,i=Bonnier.Fotbollskanalen.NativeBridgeModule.PushNextContentReceived;t.getNextContentAssetId(parseInt(n),null,i)},li=function(t){if(r=t,n("nextcontent://?id="+t.id+"&title="+encodeURIComponent(t.title)+"&image="+encodeURIComponent(t.image)+"&nextContentUrl="+encodeURIComponent(t.nextContentUrl)),window.Android_JS&&window.Android_JS.onPushNextContent)window.Android_JS.onPushNextContent(t.id.toString(),t.title,t.image,t.nextContentUrl)},r=undefined,ai=function(){if(r&&location.pathname.startsWith("/video/")){var n=new Fotbollskanalen.BonnierBroadcastingPlayerModule;n.setNextContentProperties(r)}Fotbollskanalen.PushNextContentModule.setPlayedVideo(r.id)},vi=function(){console.info("activateTimers");c()},yi=function(){console.info("onInactivateTimers");var n=new Event("onInactivateTimers");document.dispatchEvent(n)},l,a=function(){document.body.scrollTop!==0||document.documentElement.scrollTop!==0?(window.scrollBy(0,-200),l=setTimeout(a,20)):clearTimeout(l)},pi=function(n,t){Bonnier.Fotbollskanalen.TrackingModule.MobileNavigationClick(n,t)},wi=function(i,r){t("account-login")&&(n("storecredentials://?username="+i+"&password="+r),window.Android_JS&&window.Android_JS.storeCredentials&&window.Android_JS.storeCredentials(i,r))},bi=function(){t("account-login")&&(n("accountloggedout://"),window.Android_JS&&window.Android_JS.accountLoggedOut&&window.Android_JS.accountLoggedOut())},ki=function(i){t("account-login")&&(n("accountstatusupdated://?"+gi(i)),window.Android_JS&&window.Android_JS.accountStatusUpdated&&window.Android_JS.accountStatusUpdated(JSON.stringify(i)))},di=function(){Fotbollskanalen.AccountModule.reauthenticate(!0)},gi=function(n){var i=[];for(var t in n)n.hasOwnProperty(t)&&i.push(encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return i.join("&")},v=!1,nr=function(){return v},tr=function(){(v=!0,$t.isIos&&t("account-login"))&&n("requestcredentials://")},ir=function(n,t){$('input[name="username"]').val(n);$('input[name="password"]').val(t)},rr=function(){t("vibrate")&&(n("vibrate://"),window.Android_JS&&window.Android_JS.onVibrate&&window.Android_JS.onVibrate())},ur=function(){var n=new Event("onRefreshPersonalization");document.dispatchEvent(n)},fr=function(n,t,i){Bonnier.Fotbollskanalen.TrackingModule.TrackVideoStarted(n,t,i)},er=function(n,t,i,r){Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent(n,t,i,r)},or=function(n,t,i){Bonnier.Fotbollskanalen.TrackingModule.TrackVideoInitialized(n,t,i)},sr=function(n){localStorage.setItem("reachabilityState",n);var t=new Event("reachabilityChanged");document.dispatchEvent(t)},hr=function(){t("consent")&&(n("consentsettings://"),window.Android_JS&&window.Android_JS.consentSettings&&window.Android_JS.consentSettings())};return{CanIUse:t,CurrentVersionIsLowerThan:y,OpenPersonalizationSearch:k,KillPersonalizationSearch:d,KillGlobalSearch:w,KillHamburgerMenu:st,OpenGlobalSearch:b,GlobalSearchInput:p,PlayVideo:g,PlayFloatingVideo:nt,SetVideoPlayList:rt,SetCommentInfo:ut,SetCurrentPlayListVideo:ft,SetVideoInfo:yt,OpenHamburgerMenu:et,CloseHamburgerMenu:ot,OnVideoError:ht,EnableSharing:s,TriggerSharing:h,GetSharingText:pt,GetSharingUrl:wt,EnableRefresh:bt,DisableRefresh:kt,Refresh:dt,RefreshDisqus:gt,RequestLoginState:ni,SetLoginState:ti,Login:ii,Logout:ri,RequestPushNotificationState:ui,SetPushNotificationState:fi,GoToPushNotificationSettings:ei,TrackPageView:oi,OnPersonalizationChanged:at,OnPushEventChanged:vt,OnBackNavigation:c,RestoreCoverImage:hi,RequestPushNextContent:ci,PushNextContentReceived:li,ActivateTimers:vi,InactivateTimers:yi,ScrollToTop:a,MobileNavigationClick:pi,Share:lt,StoreCredentials:wi,AccountLoggedOut:bi,AccountStatusUpdated:ki,Reauthenticate:di,GetRequestedCredentials:nr,RequestCredentials:tr,ReturnCredentials:ir,Vibrate:rr,RefreshPersonalization:ur,SyncCookies:ct,TrackVideoStarted:fr,TrackVideoInitialized:or,UpdateNextContentMetaData:ai,ReachabilityChanged:sr,OpenFullscreenPopup:tt,CloseFullscreenPopup:it,ShowConsentPreferences:hr,UpdateTextSize:si,TrackEvent:er}}();Bonnier.namespace("Bonnier.Fotbollskanalen.PersonalizationEditModule");Bonnier.Fotbollskanalen.PersonalizationEditModule=function(){var n=function(){var n=this;n.MyItems=ko.observableArray([]);n.Leagues=ko.observableArray([]);n.Teams=ko.observableArray([]);n.Players=ko.observableArray([]);n.Sections=ko.observableArray([]);n.query=ko.observable("");n.articleCountText="";n.isChecked=ko.observable();n.isSelected=ko.observable(!1);n.SuggestedLeagues=ko.observableArray();n.SuggestedTeams=ko.observableArray();n.SuggestedPlayers=ko.observableArray();n.SuggestedSections=ko.observableArray();n.ErrorSectionMsg=ko.observable("");n.ErrorLeagueMsg=ko.observable("");n.ErrorPlayerMsg=ko.observable("");n.ErrorTeamMsg=ko.observable("");n.isPersonalizationArea=ko.observable(!1);n.isFeedArea=ko.observable(!1);n.isLoggedIn=ko.observable(!1);var r,t,u,f,s=[],h=[],c=Fotbollskanalen.CookieModule.playersMaxLimit,l=Fotbollskanalen.CookieModule.teamsMaxLimit,a=Fotbollskanalen.CookieModule.leaguesMaxLimit,v=Fotbollskanalen.CookieModule.sectionsMaxLimit,y="";n.isFeed=!1;n.AddOnCompleteCallback=function(n){s.push(n)};n.AddOnCloseDialogCompleteCallback=function(n){h.push(n)};var p=function(){for(var n=0;n<s.length;n++)s[n]()},w=function(){for(var n=0;n<h.length;n++)h[n]()},e=function(n,t){ko.utils.arrayForEach(t,function(t){if(t.id()===n){t.isChecked(!0);return}})},i={MyItems:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.touch_line_id=function(){return n.data.type==="player"?n.data.player_id:n.data.type==="team"?n.data.team_id:n.data.league_id},t}},SearchPlayers:{create:function(n){var i=ko.mapping.fromJS(n.data);return i.isChecked=ko.observable(t.indexOf(n.data.id)>-1),i}},SearchTeams:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isChecked=ko.observable(r.indexOf(n.data.id)>-1),t}},SearchLeagues:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isChecked=ko.observable(u.indexOf(n.data.id)>-1),t}},SearchSections:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isChecked=ko.observable(f.indexOf(n.data.id)>-1),t}},SuggestedLeagues:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isChecked=ko.observable(u.indexOf(n.data.id)>-1),t.touch_line_id=function(){return n.data.league_id},t}},SuggestedPlayers:{create:function(n){var i=ko.mapping.fromJS(n.data);return i.isChecked=ko.observable(t.indexOf(n.data.id)>-1),i.touch_line_id=function(){return n.data.player_id},i}},SuggestedTeams:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isChecked=ko.observable(r.indexOf(n.data.id)>-1),t.touch_line_id=function(){return n.data.team_id},t}},SuggestedSections:{create:function(n){var t=ko.mapping.fromJS(n.data);return t.isChecked=ko.observable(f.indexOf(n.data.id)>-1),t.section_id=function(){return n.data.section_id},t}}},o=function(){$('[data-js="personalization-search-result"]').hide();$('[data-js="personalization-search-suggestions"]').show();n.SuggestedTeams().length===0&&$.get("/api/suggestions/",{},function(t){ko.mapping.fromJS(t.league_suggestions,i.SuggestedLeagues,n.SuggestedLeagues);ko.mapping.fromJS(t.team_suggestions,i.SuggestedTeams,n.SuggestedTeams);ko.mapping.fromJS(t.player_suggestions,i.SuggestedPlayers,n.SuggestedPlayers);ko.mapping.fromJS(t.section_suggestions,i.SuggestedSections,n.SuggestedSections)},"json")},b=function(){$('[data-js="personalization-search-suggestions"]').hide();$('[data-js="personalization-search-result"]').show()},k=function(t){ko.utils.arrayForEach(n.Leagues(),function(n){if(n.id()===t){n.isChecked(!1);return}});ko.utils.arrayForEach(n.SuggestedLeagues(),function(n){if(n.id()===t){n.isChecked(!1);return}});n.MyItems.remove(function(n){return n.id()===t})},d=function(t){ko.utils.arrayForEach(n.Teams(),function(n){if(n.id()===t){n.isChecked(!1);return}});ko.utils.arrayForEach(n.SuggestedTeams(),function(n){if(n.id()===t){n.isChecked(!1);return}});n.MyItems.remove(function(n){return n.id()===t})},g=function(t){ko.utils.arrayForEach(n.Players(),function(n){if(n.id()===t){n.isChecked(!1);return}});ko.utils.arrayForEach(n.SuggestedPlayers(),function(n){if(n.id()===t){n.isChecked(!1);return}});n.MyItems.remove(function(n){return n.id()===t})},nt=function(t){ko.utils.arrayForEach(n.Sections(),function(n){if(n.id()===t){n.isChecked(!1);return}});ko.utils.arrayForEach(n.SuggestedSections(),function(n){if(n.id()===t){n.isChecked(!1);return}});n.MyItems.remove(function(n){return n.id()===t})};n.openPersonalizationSearch=function(){if(n.isFeedArea(n.isFeed),n.isLoggedIn(Fotbollskanalen.AccountModule.isLoggedIn()),!Fotbollskanalen.AccountModule.isLoggedIn()&&!this.isFeed){Fotbollskanalen.AccountModule.loginSuccessCallback=function(){var t=Fotbollskanalen.AccountModule.getAccountSession();t.token&&Fotbollskanalen.AccountModule.syncAccountStorage(t,function(){Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies();n.HideAllShowContainer();o()});$(".login-wall").removeClass("show")};$(".login-wall").addClass("show");return}n.HideAllShowContainer();o()};n.ShowAllHideContainer=function(){$('[data-js="personalizationSearch"]').hide();$('[data-js="all"]').removeClass("all--hide");n.clearSearch();Bonnier.Fotbollskanalen.DeviceTypeModule.IsSmartPhoneOrTablet()&&$(window).scrollTop(0);p();Bonnier.Fotbollskanalen.MyFeedModule&&($t.exists("#myfeed")?Bonnier.Fotbollskanalen.MyFeedModule.loadMyFeed():$t.exists("#myfeed-startpage")&&Bonnier.Fotbollskanalen.MyFeedModule.loadMyFeedStartpage());Bonnier.Fotbollskanalen.PersonalizedMatchListModule&&Bonnier.Fotbollskanalen.PersonalizedMatchListModule.reload();Bonnier.Fotbollskanalen.MyLatestResultsModel&&Bonnier.Fotbollskanalen.MyLatestResultsModel.reload()};n.HideAllShowContainer=function(){Bonnier.Fotbollskanalen.DeviceTypeModule.IsSmartPhoneOrTablet()?($('[data-js="personalizationSearch"]').show(),$(window).scrollTop(0)):($('[data-js="personalizationSearch"]').fadeIn(),n.isSelected(!0));$('[data-js="all"]').addClass("all--hide")};n.openLogin=function(){if(!Fotbollskanalen.AccountModule.isLoggedIn()&&n.isFeed){Fotbollskanalen.AccountModule.loginSuccessCallback=function(){Fotbollskanalen.AccountModule.syncAccountStorage(Fotbollskanalen.AccountModule.getAccountSession(),function(){Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies();n.loadMyTeamsAndPlayers();$t.exists(".native")&&location.search.contains("fullscreen")?Bonnier.Fotbollskanalen.NativeBridgeModule.CloseFullscreenPopup(4):($(".login-wall").removeClass("show"),n.closeDialog())})};$.ajax({url:"/api/account/darkloginview",type:"GET",dataType:"json",success:function(n){$(".account-container").empty().append(n.html);$(".login-wall").addClass("show")}});return}};n.killPersonalizationSearch=function(){if(!Fotbollskanalen.AccountModule.isLoggedIn()||!n.isFeed||n.MyItems().length!==0){if(Fotbollskanalen.AccountModule.isLoggedIn()&&n.isFeed&&n.MyItems().length!==0&&!!sessionStorage.getItem("isLoggedInWithoutPersonalization")&&Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent("red-bubble","registered_user_setup_feed"),!Fotbollskanalen.AccountModule.isLoggedIn()&&n.isFeed&&n.MyItems().length!==0){Fotbollskanalen.AccountModule.loginSuccessCallback=function(){$t.exists(".native")&&location.search.contains("fullscreen")?Bonnier.Fotbollskanalen.NativeBridgeModule.CloseFullscreenPopup(4):($(".login-wall").removeClass("show"),n.closeDialog())};var t="/api/account/darkregistrationview";localStorage.getItem("hasLoggedIn")&&(t="/api/account/darkloginview");$.ajax({url:t,type:"GET",dataType:"json",success:function(n){$(".account-container").empty().append(n.html);$(".account-container h2").text("Spara inställningar");$(".account-container .description").text("Logga in eller skapa ett gratiskonto för att spara dina inställningar.\nSamma login på Fotbollskanalen, C More & TV4 Play.");$(".login-wall").addClass("show")}});return}n.closeDialog()}};n.closeDialog=function(){$t.isIos||$t.isAndroid?Bonnier.Fotbollskanalen.NativeBridgeModule.KillPersonalizationSearch():(n.ShowAllHideContainer(),n.isSelected(!1));w()};n.toggleButton=function(){n.isChecked(!0)};n.clearSearch=function(){n.query("");n.Players([]);n.Teams([]);n.Leagues([]);o()};n.getData=function(r){r.length>2?(b(),$(".spinner-player , .spinner-team").show(),t=Fotbollskanalen.CookieModule.getPersonalizedPlayers().join(),$.getJSON("/api/sections/autocomplete/"+r,function(t){ko.mapping.fromJS(t,i.SearchSections,n.Sections);$(".spinner-section").hide()}),$.getJSON("/api/leagues/autocomplete/"+r,function(t){ko.mapping.fromJS(t,i.SearchLeagues,n.Leagues);$(".spinner-league").hide()}),$.getJSON("/api/teams/autocomplete/"+r,function(t){ko.mapping.fromJS(t,i.SearchTeams,n.Teams);$(".spinner-team").hide()}),$.getJSON("/api/players/autocomplete/"+r,function(t){ko.mapping.fromJS(t,i.SearchPlayers,n.Players);$(".spinner-player").hide()})):(n.Sections([]),n.Leagues([]),n.Teams([]),n.Players([]),o())};n.search=function(){var t=n.query();return(t=t.removeSpecialCharacters(),t===y)?!0:(y=t,n.getData(t),!0)};n.addPlayer=function(){if(t.split(",").length>=c&&!this.isChecked()){n.ErrorPlayerMsg("Obs! maxgräns av "+c+" spelare har uppnåtts");return}if(this.isChecked()){n.removePlayer(this);return}e(this.id(),n.Players());e(this.id(),n.SuggestedPlayers());n.MyItems.unshift(this);$(".personalization-top .personalization-list").scrollLeft(0);n.ErrorPlayerMsg("");Fotbollskanalen.CookieModule.addPersonalizedPlayer(this.id(),this.name());t=Fotbollskanalen.CookieModule.getPersonalizedPlayers().join();Fotbollskanalen.AccountModule.forceSyncAccountFavorites()};n.addTeam=function(){if(r.split(",").length>=l&&!this.isChecked()){n.ErrorTeamMsg("Obs! maxgräns av "+l+" lag har uppnåtts");return}if(this.isChecked()){n.removeTeam(this);return}hasTooLongName(this.name().split(" "))&&this.short_name&&(this.name=this.short_name);e(this.id(),n.Teams());e(this.id(),n.SuggestedTeams());n.MyItems.unshift(this);$(".personalization-top .personalization-list").scrollLeft(0);n.ErrorTeamMsg("");Fotbollskanalen.CookieModule.addPersonalizedTeam(this.id(),this.name());r=Fotbollskanalen.CookieModule.getPersonalizedTeams().join();Fotbollskanalen.AccountModule.forceSyncAccountFavorites()};n.addLeague=function(){if(u.split(",").length>=a&&!this.isChecked()){n.ErrorLeagueMsg("Obs! maxgräns av "+a+" ligor har uppnåtts");return}if(this.isChecked()){n.removeLeague(this);return}hasTooLongName(this.name().split(" "))&&this.short_name&&(this.name=this.short_name);e(this.id(),n.Leagues());e(this.id(),n.SuggestedLeagues());n.MyItems.unshift(this);$(".personalization-top .personalization-list").scrollLeft(0);n.ErrorLeagueMsg("");Fotbollskanalen.CookieModule.addPersonalizedLeague(this.id(),this.name());u=Fotbollskanalen.CookieModule.getPersonalizedLeagues().join();Fotbollskanalen.AccountModule.forceSyncAccountFavorites()};n.addSection=function(){if(f.split(",").length>=v&&!this.isChecked()){n.ErrorSectionMsg("Obs! maxgräns av "+v+" bloggar & poddar har uppnåtts");return}if(this.isChecked()){n.removeSection(this);return}hasTooLongName(this.name().split(" "))&&this.short_name&&(this.name=this.short_name);e(this.id(),n.Sections());e(this.id(),n.SuggestedSections());n.MyItems.unshift(this);$(".personalization-top .personalization-list").scrollLeft(0);n.ErrorSectionMsg("");Fotbollskanalen.CookieModule.addPersonalizedSection(this.id(),this.name());f=Fotbollskanalen.CookieModule.getPersonalizedSections().join();Fotbollskanalen.AccountModule.forceSyncAccountFavorites()};n.removePlayer=function(i){var r=this;(typeof i=="object"&&(r=i),r!==null&&r!=="undefined")&&(g(r.id()),n.ErrorPlayerMsg(""),Fotbollskanalen.CookieModule.removePersonalizedPlayer(r.id(),r.name()),t=Fotbollskanalen.CookieModule.getPersonalizedPlayers().join(),Fotbollskanalen.AccountModule.forceSyncAccountFavorites())};n.removeTeam=function(t){var i=this;(typeof t=="object"&&(i=t),i!==null&&i!=="undefined")&&(d(i.id()),n.ErrorTeamMsg(""),Fotbollskanalen.CookieModule.removePersonalizedTeam(i.id(),i.name()),r=Fotbollskanalen.CookieModule.getPersonalizedTeams().join(),Fotbollskanalen.AccountModule.forceSyncAccountFavorites())};n.removeLeague=function(t){var i=this;(typeof t=="object"&&(i=t),i!==null&&i!=="undefined")&&(k(i.id()),n.ErrorLeagueMsg(""),Fotbollskanalen.CookieModule.removePersonalizedLeague(i.id(),i.name()),u=Fotbollskanalen.CookieModule.getPersonalizedLeagues().join(),Fotbollskanalen.AccountModule.forceSyncAccountFavorites())};n.removeSection=function(t){var i=this;(typeof t=="object"&&(i=t),i!==null&&i!=="undefined")&&(nt(i.id()),n.ErrorSectionMsg(""),Fotbollskanalen.CookieModule.removePersonalizedSection(i.id(),i.name()),f=Fotbollskanalen.CookieModule.getPersonalizedSections().join(),Fotbollskanalen.AccountModule.forceSyncAccountFavorites())};n.loadMyTeamsAndPlayers=function(){u=Fotbollskanalen.CookieModule.getPersonalizedLeagues().join();r=Fotbollskanalen.CookieModule.getPersonalizedTeams().join();t=Fotbollskanalen.CookieModule.getPersonalizedPlayers().join();f=Fotbollskanalen.CookieModule.getPersonalizedSections().join();$.when(u?$.getJSON("/api/leagues/filter/"+u):[[]],r?$.getJSON("/api/teams/filter/"+r):[[]],t?$.getJSON("/api/players/filter/"+t):[[]],f?$.getJSON("/api/sections/filter/"+f):[[]]).then(function(t,r,u,f){ko.mapping.fromJS(t[0].concat(r[0].concat(u[0]).concat(f[0])),i.MyItems,n.MyItems);p()})};n.init=function(){var t=Fotbollskanalen.AccountModule.getAccountSession();if(t.token&&Fotbollskanalen.AccountModule.shouldReauthenticate()){Fotbollskanalen.AccountModule.syncAccountStorage(t,function(){Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies();n.loadMyTeamsAndPlayers()});return}n.loadMyTeamsAndPlayers()};n.show=function(){Fotbollskanalen.AccountModule.isLoggedIn()?Fotbollskanalen.AccountModule.syncAccountStorage(Fotbollskanalen.AccountModule.getAccountSession(),function(){Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies();n.loadMyTeamsAndPlayers();$t.isIos||$t.isAndroid?Bonnier.Fotbollskanalen.NativeBridgeModule.OpenPersonalizationSearch():n.openPersonalizationSearch()}):(n.loadMyTeamsAndPlayers(),$t.isIos||$t.isAndroid?Bonnier.Fotbollskanalen.NativeBridgeModule.OpenPersonalizationSearch():n.openPersonalizationSearch())}};return new n}();(window.$fk||$)(function(){$t.exists("#personalization-edit")&&ko.applyBindings(Bonnier.Fotbollskanalen.PersonalizationEditModule,document.getElementById("personalization-edit"))});Bonnier.namespace("Bonnier.Fotbollskanalen.PersonalizationFollowArticleTagModule");Bonnier.Fotbollskanalen.PersonalizationFollowArticleTagModule=function(){var i=function(n){n.preventDefault();var f=n.currentTarget,i=$(n.currentTarget).data("id").toString(),r=$(n.currentTarget).data("type"),u=$(n.currentTarget).data("name");if(!Fotbollskanalen.AccountModule.isLoggedIn()){Fotbollskanalen.AccountModule.loginSuccessCallback=function(){t(i,r,u);$(".login-wall").removeClass("show");$t.dispatchCustomEvent("unlockMemberArticle")};$(".login-wall").addClass("show");return}t(f,i,r,u)},t=function(t,i,r,u){var f=Fotbollskanalen.AccountModule.getAccountSession();f.token&&Fotbollskanalen.AccountModule.syncAccountStorage(f,function(){r==="team"?Fotbollskanalen.CookieModule.isFollowingTeam(i)?Fotbollskanalen.CookieModule.removePersonalizedTeam(i,u):Fotbollskanalen.CookieModule.addPersonalizedTeam(i,u)===!1&&$(t).addClass("maxlimit"):r==="player"?Fotbollskanalen.CookieModule.isFollowingPlayer(i)?Fotbollskanalen.CookieModule.removePersonalizedPlayer(i,u):Fotbollskanalen.CookieModule.addPersonalizedPlayer(i,u)===!1&&$(t).addClass("maxlimit"):r==="league"&&(Fotbollskanalen.CookieModule.isFollowingLeague(i)?Fotbollskanalen.CookieModule.removePersonalizedLeague(i,u):Fotbollskanalen.CookieModule.addPersonalizedLeague(i,u)===!1&&$(t).addClass("maxlimit"));f.token?Fotbollskanalen.AccountModule.forceSyncAccountFavorites(function(){Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies();n()}):(Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies(),n())})},n=function(){$t.exists($("[data-js=article-tags__follow-button]"))&&$("[data-js=article-tags__follow-button]").each(function(){r($(this))})},r=function(n){var t=n.attr("data-type"),i=n.attr("data-id");t==="team"?Fotbollskanalen.CookieModule.isFollowingTeam(i)?n.addClass("following"):n.removeClass("following"):t==="player"?Fotbollskanalen.CookieModule.isFollowingPlayer(i)?n.addClass("following"):n.removeClass("following"):t==="league"&&(Fotbollskanalen.CookieModule.isFollowingLeague(i)?n.addClass("following"):n.removeClass("following"))};return{UpdateFollowing:n,FollowClicked:i}}();Bonnier.namespace("Bonnier.Fotbollskanalen.PersonalizationShowModule");PersonalizedShowViewModel=function(n){var t=this;t.showFeedResult=n;t.MyItems=ko.observableArray([]);t.HasNoItems=ko.observable(!1);t.HasItems=ko.observable(!1);t.openPersonalizationSearch=function(){Bonnier.Fotbollskanalen.PersonalizationEditModule.show()};t.update=function(){t.MyItems(Bonnier.Fotbollskanalen.PersonalizationEditModule.MyItems());t.HasNoItems(t.MyItems().length===0);t.HasItems(!t.HasNoItems())};t.init=function(){Bonnier.Fotbollskanalen.PersonalizationEditModule.AddOnCompleteCallback(t.update);Bonnier.Fotbollskanalen.PersonalizationEditModule.isFeed=t.showFeedResult;Bonnier.Fotbollskanalen.PersonalizationEditModule.init()};t.init()};Bonnier.namespace("Bonnier.Fotbollskanalen.PersonalizationToggleModule");Bonnier.Fotbollskanalen.PersonalizationToggleModule=function(){var n={team:{isFollowing:Fotbollskanalen.CookieModule.isFollowingTeam,follow:Fotbollskanalen.CookieModule.addPersonalizedTeam,unfollow:Fotbollskanalen.CookieModule.removePersonalizedTeam},player:{isFollowing:Fotbollskanalen.CookieModule.isFollowingPlayer,follow:Fotbollskanalen.CookieModule.addPersonalizedPlayer,unfollow:Fotbollskanalen.CookieModule.removePersonalizedPlayer},league:{isFollowing:Fotbollskanalen.CookieModule.isFollowingLeague,follow:Fotbollskanalen.CookieModule.addPersonalizedLeague,unfollow:Fotbollskanalen.CookieModule.removePersonalizedLeague},section:{isFollowing:Fotbollskanalen.CookieModule.isFollowingSection,follow:Fotbollskanalen.CookieModule.addPersonalizedSection,unfollow:Fotbollskanalen.CookieModule.removePersonalizedSection}},i=function(t,i){return n[t].isFollowing(i)},r=function(n){var t=n.currentTarget,i=$(n.currentTarget).data("id").toString(),r=$(n.currentTarget).data("type"),f=$(n.currentTarget).data("name");if(!Fotbollskanalen.AccountModule.isLoggedIn()){Fotbollskanalen.AccountModule.loginSuccessCallback=function(){u(t,i,r,f);$(".login-wall").removeClass("show")};$(".login-wall").addClass("show");return}u(t,i,r,f)},u=function(r,u,e,o){var s=Fotbollskanalen.AccountModule.getAccountSession();s.token?Fotbollskanalen.AccountModule.syncAccountStorage(s,function(){i(e,u)?n[e].unfollow(u,o):n[e].follow(u,o)===!1&&$(r).addClass("maxlimit");t($(r));Fotbollskanalen.AccountModule.forceSyncAccountFavorites(function(){Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies();f()});Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies()}):Bonnier.Fotbollskanalen.NativeBridgeModule.SyncCookies()},e=function(n){n.click(r);t(n)},t=function(n){var t=n.attr("data-type"),r=n.attr("data-id");i(t,r)?n.addClass("following"):n.removeClass("following")},f=function(){$t.exists($("[data-js=personalization-tag__follow-button]"))&&$("[data-js=personalization-tag__follow-button]").each(function(){t($(this))})};return{SetButton:e,UpdateFollowing:f,FollowClicked:r}}();PersonalizedMatchListModel=function(){var n=this,u;n.MatchList=ko.observableArray([]);n.Message=ko.observable("");n.ShowMyMatches=ko.observable(!1);n.HasPersonalization=ko.observable(!1);var f=null,t=null,i=!1,r=!1;iconClicked=function(n){console.log(n);n.video&&n.video.external_url()&&window.open(n.video.external_url(),"_top")};u={MatchList:{create:function(n){n.data.matches.map(function(n){n.title=n.home_team+" - "+n.away_team;n.round_title=n.round>0?"Omgång "+n.round:"";n.home_team_score!=null&&n.away_team_score!=null?(n.is_home_team_loser=n.home_team_score<n.away_team_score,n.is_away_team_loser=n.home_team_score>n.away_team_score):(n.is_home_team_loser=!1,n.is_away_team_loser=!1);n.home_team_penalties!=null&&n.away_team_penalties!=null?(n.is_home_team_penalty_loser=n.home_team_penalties<n.away_team_penalties,n.is_away_team_penalty_loser=n.home_team_penalties>n.away_team_penalties):(n.is_home_team_penalty_loser=!1,n.is_away_team_penalty_loser=!1)});n.data.league_table_url=n.data.league_url+"?tab=tables";return ko.mapping.fromJS(n.data)}}};n.getCookieSearchString=function(){var n=Fotbollskanalen.CookieModule.getPersonalizedLeagues().sort().join(),t=Fotbollskanalen.CookieModule.getPersonalizedTeams().sort().join(),i=Fotbollskanalen.CookieModule.getPersonalizedPlayers().sort().join();return n===""&&i===""&&t===""?"":(n===""&&(n="0"),i===""&&(i="0"),t===""&&(t="0"),"/leagues/"+n+"/teams/"+t+"/players/"+i)};n.reload=function(){var s=Fotbollskanalen.CookieModule.hasPersonalization(),o,e;if(n.HasPersonalization(s),$(".page-header__edit-area").find('[data-js="openPersonalizationEdit"]').show(),o=n.getCookieSearchString(),o===""){n.Message("Här kommer matcher visas för spelare, lag, ligor och turneringar som du följer.");n.MatchList([]);return}n.Message("");n.ShowMyMatches(!0);t=setTimeout(function(){r=Date.now();i=!0;$('[data-js="match-list-spinner"]').show()},150);e=function(t){ko.mapping.fromJS(t,u.MatchList,n.MatchList);n.MatchList().length===0?n.Message("Dina ligor, spelare eller lag har inga matcher den kommande veckan."):($('[data-js="match-list"]').show(),n.Message(""));Fotbollskanalen.StickyHeadingModule.setupStickyHeaders();$('[data-js="match-list-spinner"]').hide()};$.getJSON("/api/mymatchlist"+o,function(n){if(clearTimeout(t),i){var u=600-(Date.now()-r);u>0?f=setTimeout(function(){e(n)},u):e(n)}else e(n)})};n.reload()};(window.$fk||$)(function(){Fotbollskanalen.StickyHeadingModule.init();$t.exists("#personalized-matchlist")&&(Bonnier.namespace("Bonnier.Fotbollskanalen.PersonalizedMatchListModule"),Bonnier.Fotbollskanalen.PersonalizedMatchListModule=new PersonalizedMatchListModel,ko.applyBindings(Bonnier.Fotbollskanalen.PersonalizedMatchListModule,document.getElementById("personalized-matchlist")),document.addEventListener("onRefreshPersonalization",function(){Bonnier.Fotbollskanalen.PersonalizedMatchListModule.reload()},!1))});PickYourTeamListViewModel=function(n){var t=this;t.Teams=ko.observable("");t.SharedTeam=ko.observable("");t.currentPage=ko.observable(1);t.pageCount=ko.observable(1);t.pageSize=ko.observable(10);t.totalCount=ko.observable(1);t.firstItemIndex=ko.observable(1);t.lastItemIndex=ko.observable(10);t.scrolled=!1;t.loadByShareId=function(n,i){if(n&&!n.startsWith("#page-")){var r="/api/pickyourteam/getsharedteambyid/"+n;$.ajax({url:r,success:function(n){n!==null&&typeof n!="undefined"&&ko.mapping.fromJS(n,{},t.SharedTeam)}}).done(function(){i&&i();t.bindSharingButtons()})}};t.load=function(i){i===undefined&&location.hash.startsWith("#page-")&&(i=location.hash.replace("#page-",""));t.initialScrollToHashId();var r="/api/pickyourteam/getpickedteams/"+n;i&&(r+="/page/"+i);$.ajax({url:r,success:function(n){n!==null&&typeof n!="undefined"&&(ko.mapping.fromJS(n.data.teams,{},t.Teams),t.currentPage(n.current_page),t.pageCount(n.page_count),t.pageSize(n.page_size),t.totalCount(n.total_count),t.firstItemIndex(n.first_item_index),t.lastItemIndex(n.last_item_index),t.createPagination())}}).done(function(){t.bindSharingButtons();Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad();t.bindDeleteButtons()})};t.bindSharingButtons=function(){Bonnier.Fotbollskanalen.SocialShareModule.Init();$t.exists('[data-js="trigger-sharing-button"]')&&Bonnier.Fotbollskanalen.NativeBridgeModule.CanIUse("trigger-sharing")&&$('[data-js="trigger-sharing-button"]').show()};t.bindDeleteButtons=function(){$("[data-js=team-delete-button]").on("click",function(){this.parentElement.remove();var n=this.attributes["data-guid"].value;$.ajax({type:"delete",datatype:"jsonp",data:JSON.stringify(n),url:"/api/pickyourteam/deleteteam/",contentType:"application/json"})})};t.initialScrollToHashId=function(){t.scrolled||(t.scrolled=!0,t.loadByShareId(location.hash.replace("#pick-your-team-list-",""),function(){var n=$(location.hash);n.length&&($(".single-shared-team-container").show(),setTimeout(function(){$("html, body").animate({scrollTop:n.offset().top-150},1500,function(){Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad()})},1500))}))};t.goToPage=function(n){t.load(n)};t.createPagination=function(){$("#paginationHolder").pagination({pages:t.pageCount(),itemsOnPage:t.pageSize(),currentPage:t.currentPage(),onPageClick:t.goToPage,prevText:"Föreg.",nextText:"Nästa"})};t.load()};Bonnier.namespace("Bonnier.Fotbollskanalen.PickYourTeamModule");Bonnier.Fotbollskanalen.PickYourTeamModule=function(){var n=this,t;return n.Player=$(".pick-your-team__player"),n.Bench=$(".pick-your-team__squad-list"),n.Pitch=$(".pitch__starting-eleven"),n.StartingGoalKeeper=Pitch.filter("[data-position=pick-your-team-goalkeeper]"),n.StartingDefenders=Pitch.filter("[data-position=pick-your-team-defender]"),n.StartingMidfielders=Pitch.filter("[data-position=pick-your-team-midfielder]"),n.StartingStrikers=Pitch.filter("[data-position=pick-your-team-striker]"),n.ResetButton=$("[data-js=pick-your-team-reset-btn]"),n.SaveButton=$("[data-js=pick-your-team-save-btn]"),n.SaveButtonActive=!1,n.TeamNameInput=$("[data-js=pick-your-team-name]"),n.PitchHelpText=$("[data-js=pitch__help]"),n.MAX_OUTFIELD_PLAYERS=10,n.MAX_SQUAD_PLAYERS=26,n.MAX_SQUAD_GOALKEEPERS=3,t=function(t){n.WidgetId=t.widgetId;n.ListElementId=t.listElementId;n.PickSquad=t.pickSquad===!0;AddPlayer();tabSwitch();teamNameInputTypeCheck();dataBindStoredTeams()},n.teamNameInputTypeCheck=function(){TeamNameInput.keyup(function(){validateInputReadyToSave()});TeamNameInput.onfocusout=function(){validateInputReadyToSave()}},n.dataBindStoredTeams=function(){if(n.viewModel=new PickYourTeamListViewModel(n.WidgetId),ko.applyBindings(n.viewModel,document.getElementById(n.ListElementId)),$("#"+n.ListElementId).show(),location.hash.length>0){var t=document.getElementById("your-own-team-list");ko.cleanNode(t);ko.applyBindings(n.viewModel,t)}},n.deactivateTeamSaveButton=function(){n.SaveButtonActive&&(n.SaveButton.addClass("btn-disabled"),n.SaveButton.addClass("grey-btn"),n.SaveButton.removeClass("green-border-btn"),n.SaveButton.off("click"),n.SaveButtonActive=!1)},n.activateTeamSaveButton=function(){if(!SaveButtonActive){n.SaveButtonActive=!0;n.SaveButton.removeClass("btn-disabled");n.SaveButton.removeClass("grey-btn");n.SaveButton.addClass("green-border-btn");n.SaveButton.on("click",function(){n.deactivateTeamSaveButton();var t={widget_id:n.WidgetId,team_data:{team_pick_author:TeamNameInput.val(),goalkeeper:$.map($("[data-position=pick-your-team-goalkeeper] > li"),getPlayerId),defenders:$.map($("[data-position=pick-your-team-defender] > li"),getPlayerId),midfielders:$.map($("[data-position=pick-your-team-midfielder] > li"),getPlayerId),forwards:$.map($("[data-position=pick-your-team-striker] > li"),getPlayerId)}};$.ajax({type:"post",datatype:"jsonp",data:JSON.stringify(t),url:"/api/pickyourteam/postteam/",contentType:"application/json"}).done(function(t){n.viewModel.loadByShareId(t.guid,function(){if($(".single-shared-team-container").show(),!n.isBound("your-own-team-list")){var i=document.getElementById("your-own-team-list");ko.applyBindings(n.viewModel,i)}n.resetAllPlayers();window.history.pushState({},t.team_pick_author,location.protocol+"//"+location.hostname+location.pathname+"#pick-your-team-list-"+t.guid);n.viewModel.scrolled=!1;n.viewModel.initialScrollToHashId()})})})}},n.isBound=function(n){return!!ko.dataFor(document.getElementById(n))},n.resetAllPlayers=function(){$(".pitch__starting-eleven .pick-your-team__player").each(function(){var t=$(this);HideCheckbox(t);t.remove();n.PitchHelpText.attr("data-show","true");n.PitchHelpText.show();TeamNameInput.val("")})},n.getPlayerId=function(n){return parseInt($(n).attr("data-pageId"))},n.tabSwitch=function(){$(".pick-your-team_radio").on("click",function(){Bonnier.Fotbollskanalen.ImageLazyLoadModule.LazyLoadWithinContainer(".pick-your-team__container",!0,"show")})},n.playerAlreadyAdded=function(n){return n.attr("data-starting")=="true"},n.showPitchText=function(){n.PitchHelpText.attr("data-show")=="true"&&(n.PitchHelpText.attr("data-show","false"),n.PitchHelpText.hide())},n.AddPlayer=function(){n.Player.on("click",function(){var t=$(this),n,i;playerAlreadyAdded(t)||(n=t.clone(),i=n.attr("data-position"),n.attr("onClick","RemovePlayer($(this));"),showPitchText(),addPlayerAtPosition(n,t,i))})},n.validateInputReadyToSave=function(){TotalNumberOfPlayers()===11&&TeamNameInput[0].value.length>0&&!n.PickSquad?activateTeamSaveButton():GoalkeeperCount()===n.MAX_SQUAD_GOALKEEPERS&&TotalNumberOfPlayers()===n.MAX_SQUAD_PLAYERS&&n.PickSquad?activateTeamSaveButton():deactivateTeamSaveButton()},n.addPlayerAtPosition=function(t,i,r){n.PickSquad?n.addSquadPlayerAtPosition(t,i,r):n.addTeamPlayerAtPosition(t,i,r);validateInputReadyToSave()},n.addSquadPlayerAtPosition=function(t,i,r){if(TotalNumberOfPlayers()==n.MAX_SQUAD_PLAYERS){validateInputReadyToSave();return}r=="pick-your-team-goalkeeper"&&GoalkeeperCount()<n.MAX_SQUAD_GOALKEEPERS?(AddGoalKeeper(t),ShowCheckbox(i)):r=="pick-your-team-defender"&&DefenderCount()<n.MAX_SQUAD_PLAYERS-n.MAX_SQUAD_GOALKEEPERS?(AddDefender(t),ShowCheckbox(i)):r=="pick-your-team-midfielder"&&MidfielderCount()<n.MAX_SQUAD_PLAYERS-n.MAX_SQUAD_GOALKEEPERS?(AddMidfielder(t),ShowCheckbox(i)):r=="pick-your-team-striker"&&StrikerCount()<n.MAX_SQUAD_PLAYERS-n.MAX_SQUAD_GOALKEEPERS&&(AddStriker(t),ShowCheckbox(i))},n.addTeamPlayerAtPosition=function(t,i,r){TotalNumberOfPlayers()==11?validateInputReadyToSave():r=="pick-your-team-goalkeeper"?GoalkeeperCount()==0&&(AddGoalKeeper(t),ShowCheckbox(i)):NumberOfOutfieldPlayersInStartingEleven()<n.MAX_OUTFIELD_PLAYERS&&(r=="pick-your-team-defender"&&DefenderCount()<5&&(AddDefender(t),ShowCheckbox(i)),r=="pick-your-team-midfielder"&&MidfielderCount()<5&&(AddMidfielder(t),ShowCheckbox(i)),r=="pick-your-team-striker"&&StrikerCount()<5&&(AddStriker(t),ShowCheckbox(i)))},n.RemovePlayer=function(t){HideCheckbox(t);t.remove();n.deactivateTeamSaveButton()},n.ShowCheckbox=function(t){var r="[data-playerId="+t.attr("data-playerId")+"]",i=n.Bench.find(r);i.find("[data-js=icon-check]").addClass("icon-check personalization-item__checkbox");i.attr("data-starting","true")},n.HideCheckbox=function(t){var r="[data-playerId="+t.attr("data-playerId")+"]",i=n.Bench.find(r);i.find(".icon-check").removeClass("personalization-item__checkbox");i.attr("data-starting","false")},n.GoalkeeperCount=function(){return n.StartingGoalKeeper.children().length},n.DefenderCount=function(){return n.StartingDefenders.children().length},n.MidfielderCount=function(){return n.StartingMidfielders.children().length},n.StrikerCount=function(){return n.StartingStrikers.children().length},n.NumberOfOutfieldPlayersInStartingEleven=function(){return DefenderCount()+MidfielderCount()+StrikerCount()},n.TotalNumberOfPlayers=function(){return GoalkeeperCount()+NumberOfOutfieldPlayersInStartingEleven()},n.AddGoalKeeper=function(t){t.appendTo(n.StartingGoalKeeper)},n.AddDefender=function(t){t.appendTo(n.StartingDefenders)},n.AddMidfielder=function(t){t.appendTo(n.StartingMidfielders)},n.AddStriker=function(t){t.appendTo(n.StartingStrikers)},{Init:t}}();Bonnier.namespace("Bonnier.Fotbollskanalen.PushModule");Bonnier.Fotbollskanalen.PushModule=function(){var n=function(){$('[data-js="push-option"]').on("click",function(){var t=$(this).attr("data-push-event"),n=$(this);n.hasClass("pressed")?(Fotbollskanalen.CookieModule.removePushEvent(t),n.removeClass("pressed")):(Fotbollskanalen.CookieModule.addPushEvent(t),n.addClass("pressed"));Bonnier.Fotbollskanalen.NativeBridgeModule.Vibrate()});$('[data-js="push-option-reversed"]').on("click",function(){var t=$(this).attr("data-push-event"),n=$(this);n.hasClass("pressed")?(Fotbollskanalen.CookieModule.addPushEvent(t),n.removeClass("pressed")):(Fotbollskanalen.CookieModule.removePushEvent(t),n.addClass("pressed"));Bonnier.Fotbollskanalen.NativeBridgeModule.Vibrate()});$('[data-js="push-option-rolldown"]').on("click",function(){var t=$(this),f=t.attr("data-push-event"),i=$('[data-js="push-rolldown"]'),e=i.children(":first").outerHeight(!0),n=i.find('[data-js="push-option"]'),r,u;if(t.hasClass("pressed"))for(t.removeClass("pressed"),Fotbollskanalen.CookieModule.removePushEvent(f),i.height(0),n.removeClass("pressed"),r=0;typeof n[r]!="undefined";r++)Fotbollskanalen.CookieModule.removePushEvent(n[r].getAttribute("data-push-event"));else for(t.addClass("pressed"),i.height(e),n.addClass("pressed"),Fotbollskanalen.CookieModule.addPushEvent(f),u=0;typeof n[u]!="undefined";u++)Fotbollskanalen.CookieModule.addPushEvent(n[u].getAttribute("data-push-event"));Bonnier.Fotbollskanalen.NativeBridgeModule.Vibrate()})},t=function(){var n=Fotbollskanalen.CookieModule.getPushEvents();n.forEach(function(n){var t=$('[data-push-event="'+n+'"]').attr("data-js"),i=t==="push-option-reversed",r=t==="push-option-rolldown";i?$('[data-push-event="'+n+'"]').removeClass("pressed"):($('[data-push-event="'+n+'"]').addClass("pressed"),r&&$('[data-js="push-rolldown"]').css({height:"auto"}))})},i=function(n){var t=$("#native-push-state-info");n==="on"?t.hide():t.show();n==="off_ios7"?$("#native-push-state-info-msg").html("Du har slagit av Fotbollskanalen-notiser i dina telefon-inställningar.<br/>Slå på det i Inställningar > Notiser"):n==="off_ios8+"?($("#native-push-state-info-msg").html("Du har slagit av Fotbollskanalen-notiser i dina telefon-inställningar."),$("#native-push-goto-button").css("display","inline-block")):n==="off_android"?($("#native-push-state-info-msg").html("Du har slagit av Fotbollskanalen-notiser i dina telefon-inställningar."),$("#native-push-goto-button").css("display","inline-block")):n==="error_android"&&$("#native-push-state-info-msg").html("Det går inte att ta emot Fotbollskanalen-notiser i din mobil")},r=function(){Fotbollskanalen.AccountModule.isLoggedIn()||($(".push-group__item").hide(),$('[data-js="push-breaking-news"]').show(),$('[data-js="push-news"]').show(),$(".push-group__item-disabled").css("display","table"))},u=function(){Bonnier.Fotbollskanalen.NativeBridgeModule.RequestPushNotificationState();$('[data-js="push-module"]').show();r();n();t()};return{Init:u,UpdateNativeState:i}}();(window.$fk||$)(function(){$t.exists('[data-js="push-module"]')&&Bonnier.Fotbollskanalen.NativeBridgeModule.CanIUse("push-events")&&Bonnier.Fotbollskanalen.PushModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.PushNextArticleModule");Bonnier.Fotbollskanalen.PushNextArticleModule=function(){var i=!1,r=!1,h=!0,n=null,t=-1,u=1,p=10,f=5,e,o=!1,c=0,l=[],w=function(n){if(n===undefined||n===null)return[];var t=[];return n.forEach(function(n){n.url&&n.url.length>0&&t.push(n)}),t},b=function(n){if(n===undefined||n===null)return[];var t=[],i=Fotbollskanalen.ArticleHistoryModule.getAllIds();return n.forEach(function(n){i.indexOf(n.page_id.toString())===-1&&t.push(n)}),t},s=function(){return!(n===undefined||n===null)},k=function(n){$("#article-next-"+n).on("click",function(n){var r,t,i;(n.preventDefault(),r=v($(window).height(),$(window).scrollTop()),t=a(r),t!==null)&&(o=!0,i=0,$t.isNative||(i=70),$("html, body").animate({scrollTop:$("#article_"+t.page_id).offset().top-i},800,"swing",null))})},d=function(){$(document).on("scroll",function(){var d=window.pageYOffset||document.documentElement.scrollTop,tt=!1,rt,k,u,f;d>c&&(tt=!0);c=d<=0?0:d;var w=v($(window).height(),$(window).scrollTop()),e=articleIdList[w],n=$("#article_"+articleIdList[w]);if(w!==t){if(t!==-1){$(".article-next-slidein").css("height","0");$(".article-next-slidein__progress").each(function(n,t){var i=$(t);i.css("opacity","0")});g(n.data("title"),n.data("url"));$t.isNative&&Bonnier.Fotbollskanalen.NativeBridgeModule.EnableSharing(n.data("title"),n.data("shareurl"));$t.isIos&&(rt={articleId:"article"+n.data("pagelinkid"),customerId:"310889100",alias:"true",cssUrl:n.data("styleurl"),articleUrl:n.data("shareurl"),articleTitle:n.data("title"),articleDescription:n.data("description"),articleImage:n.data("image"),articleTags:n.data("articletags"),articlePublishedTime:n.data("publishedtime")},Bonnier.Fotbollskanalen.NativeBridgeModule.SetCommentInfo(rt));Fotbollskanalen.ArticleHistoryModule.save(e,e,7);Fotbollskanalen.ArticleHistoryModule.removeOldHistory();var b=n.data("url"),ut=n.data("pagename"),ft=n.data("pagetype"),et=n.find('div[itemprop="image"]').find('meta[itemprop="url"]').attr("content");l.includes(b)?console.info("PNA Tracking duplicate was removed"):(o?Bonnier.Fotbollskanalen.TrackingModule.TrackPushNextArticlePageViewByClick(b,ut,ft,et):Bonnier.Fotbollskanalen.TrackingModule.TrackPushNextArticlePageView(b,ut,ft,et),l.push(b))}t=w;o=!1}k=$(window).scrollTop();u=0;t>0?(k+=$(window).height()/2,u=(k-n.offset().top)/n.height()*100):u=(k-n.offset().top)/(n.height()-$(window).height()/2)*100;f=a(w);f===null&&h&&!r&&u>50&&y();var s=$("#article-next-"+e+".article-next-slidein"),p=$("#article-next-"+e+" .article-next-slidein__progress"),ht=$("#article-next-"+e+" .article-next-slidein__title"),ot=$("#article-next-"+e+" .article-next-slidein__thumbnail img"),st=n.parent().siblings('[data-adk-container="native-scroll"]');f&&(ht.text(f.title),ot.attr("src",f.image_url));p.css("width",""+u+"%");st.length>0&&st.offsetHeight>0?s.css("height","0"):tt?u<=0?(s.css("height","0"),p.css("opacity","0")):u<65?(s.css("height","0"),p.css("opacity","1")):u<=100&&f?(s.css("height","80px"),ot.removeClass("lazy"),p.css("opacity","1")):u>105&&(s.css("height","0"),p.css("opacity","0")):u<30?s.css("height","0"):(s.css("height","0"),p.css("opacity","1"));u>65&&f&&(i||nt(f.page_id)||(i=!0,f.url&&f.url.length>0&&it(e,f.url+"?control=MainContent")))})},g=function(n,t){document.title=n;window.history.replaceState({},n,t)},nt=function(n){return articleIdList.indexOf(n.toString())!==-1},a=function(t){return!s()||t>=n.length?null:n[t]},v=function(n,t){for(var i=0,r,u;i+1<articleIdList.length;)if(r=articleIdList[i+1],u=$("#article_"+r),t>u.offset().top-n/2)i++;else break;return i},tt=function(n){e=n},y=function(){if(e===null){console.log("baseArticleId is not set!");return}if(u>p){console.log("Max number of pages fetched!");return}if(n!==null&&n!==undefined&&n.length>=f){console.log("Max number of pages loaded: "+n.length);return}r=!0;$.ajax({url:"/api/relatedarticles/"+e+"/page/"+u,type:"get",contentType:"application/json"}).done(function(t){!(t===undefined||t===null)&&t.length>0?u++:(h=!1,console.log("No more related articles to to fetch!"));r=!1;var e=w(t),i=b(e);n=s()?n.concat(i):i;n.length>=f&&(n.length=f)})},it=function(n,t){var r=$("#article-"+n+"-bottom-widgets-content .spinner");r.show();$.ajax({url:t,type:"GET",success:function(t){var r="#article-"+n+"-bottom-widgets-content";$(r).empty().append(t);Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoad();Bonnier.Fotbollskanalen.ImageSwitchModule.Init();Fotbollskanalen.PublishTimeModule.ApplyRelativeTimeNow(document);i=!1}})},rt=function(){return n};return{AddPushNextArticleClick:k,AddPushNextArticleSlideInScroll:d,LoadNextArticles:y,HasNextContentList:s,SetBaseArticleId:tt,GetNextContentList:rt}}();Bonnier.namespace("Bonnier.Fotbollskanalen.RegularClickModule");Bonnier.Fotbollskanalen.RegularClickModule=function(){var n=function(){$('[data-js="openPersonalizationEdit"]').on("click",function(n){n.preventDefault();Bonnier.Fotbollskanalen.PersonalizationEditModule.show()})},t=function(){$('[data-js="showHiddenSiblings"]').on("click",function(){var n=$(this),i=n.attr("data-showmore"),r=n.attr("data-showless"),t=n.siblings("[data-js='hiddenSibling']");$t.exists(t.find(".show"))?(t.find(".show").removeClass("show").hide(),n.text(i)):(t.find(":hidden").addClass("show").fadeIn(),n.html(r))})},i=function(){var n=!1;$('[data-js="toggleGlobalSearch"]').on("click",function(){n?(Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch(),n=!1):(Bonnier.Fotbollskanalen.GlobalSearchModule.OpenSearch(),n=!0)})},r=function(){$('[data-js="showFilterList"]').on("click",function(){var i=$(this),n=i.attr("toggle-target"),t;$('[data-js="'+n+'"]').toggleClass("filter-list-open");parseFloat(getAndroidVersion())<4.2&&(t=$("body").height(),$('[data-js="'+n+'"]').css("height",t+"px"),$("body").scrollTop(0))});if(Bonnier.Fotbollskanalen.DeviceTypeModule.IsDesktop())$(".filter-list").on("click",function(n){$(this).removeClass("filter-list-open");n.stopPropagation()});else $('[ data-js="toggleFilterList"]').on("click",function(n){$(this).parent().parent().removeClass("filter-list-open");n.stopPropagation()})};return{ShowHiddenSiblings:t,ToggleGlobalSearch:i,ShowFilterList:r,OpenPersonalizationEdit:n}}();(window.$fk||$)(function(){$t.exists('[data-js="showHiddenSiblings"]')&&Bonnier.Fotbollskanalen.RegularClickModule.ShowHiddenSiblings();$t.exists('[data-js="toggleGlobalSearch"]')&&Bonnier.Fotbollskanalen.RegularClickModule.ToggleGlobalSearch();$t.exists('[data-js="showFilterList"]')&&Bonnier.Fotbollskanalen.RegularClickModule.ShowFilterList();$t.exists('[data-js="openPersonalizationEdit"]')&&Bonnier.Fotbollskanalen.RegularClickModule.OpenPersonalizationEdit()});Bonnier.namespace("Bonnier.Fotbollskanalen.ResultItemModule");Bonnier.Fotbollskanalen.ResultItemModule=function(){var n=function(n,t){t.removeClass("animate-item");var i=t.find('[data-js="match-score-home"]'),r=t.find('[data-js="match-score-away"]');if(n.is_live){(parseInt(i.html(),10)!==n.home_team_score||parseInt(r.html(),10)!==n.away_team_score)&&t.addClass("animate-item");t.find('[data-js="match-live"]').removeClass("group-item--hidden");t.find('[data-js="match-time"]').addClass("group-item--hidden");t.find('[data-js="match-score-status"]').addClass("group-item__score--live");i.html(n.home_team_score);r.html(n.away_team_score);switch(n.status.toLowerCase()){case"ht":t.find('[data-js="match-live-timer"]').html("HT");break;case"pen":t.find('[data-js="match-live-timer"]').html(n.status);t.find('[data-js="match-penalties"]').removeClass("group-item--hidden");t.find('[data-js="match-penalties-home"]').html(n.home_team_penalties);t.find('[data-js="match-penalties-away"]').html(n.away_team_penalties);break;default:t.find('[data-js="match-live-timer"]').html(n.timer+"<span class='timer-dot'>'<\/span>")}}else n.is_finished&&(t.find('[data-js="match-live"]').addClass("group-item--hidden"),t.find('[data-js="match-score-status"]').removeClass("group-item__score--live"),i.html(n.home_team_score),r.html(n.away_team_score),n.status.toLowerCase()=="11m"&&(t.find('[data-js="match-penalties"]').removeClass("group-item--hidden"),t.find('[data-js="match-penalties-home"]').html(n.home_team_penalties),t.find('[data-js="match-penalties-away"]').html(n.away_team_penalties)))},t=function(){$.getJSON(useWww("/api/liveresults/leagues/"),function(t){t.forEach(function(t){var i=$("#match_"+t.match_id),r=i.attr("data-status");(t.is_live||r==="is_live"&&t.is_finished)&&n(t,i)})})},i=function(){setInterval(t,6e4)};return{Init:i}}();(window.$fk||$)(function(){$t.exists('[data-js="real-time-results"]')&&Bonnier.Fotbollskanalen.ResultItemModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.SearchModule");Bonnier.Fotbollskanalen.SearchModule=function(){var n=!1,h=this,o=$(document.body),f=$("[data-clear-input]"),c=$("[data-close-search]"),t=$("[data-global-search]"),l=$("[data-hamburger]"),i=$("[data-header]"),s=$("[data-header-search]"),r=$("[data-search-input]"),u=$("[data-search-trigger]"),a=$("[data-mobile-menu]"),e;return this.toggleSearch=function(f){i.toggleClass("header__search--open");t.toggle();r.focus();u.toggle();n?(n=!1,Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch()):(n=!0,Bonnier.Fotbollskanalen.GlobalSearchModule.OpenSearch(),positionGlobalSearch(),f.stopPropagation(),f.preventDefault())},this.positionGlobalSearch=function(){if($(window).width()>1024){var n=s.offset().left-10;t.css({left:n+"px"})}},$(window).resize(function(){$(window).width()>1024&&Bonnier.Fotbollskanalen.GlobalSearchModule!==undefined&&n&&(n=!1,t.toggle(),i.removeClass("header__search--open"),u.toggle(),Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch&&Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch())}),this.searchInputKeydownHandler=function(n){n.keyCode===27&&toggleSearch(n)},this.searchInputKeyupHandler=function(){Bonnier.Fotbollskanalen.GlobalSearchModule.Search($(this).val())},e=function(){o.not(i).on("click",function(r){n&&(n=!1,t.toggle(),i.toggleClass("header__search--open"),Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch(),u.toggle(),r.stopPropagation())});r.click(function(n){n=$.event.fix(n);n.stopPropagation()});f.on("click",function(n){n.stopPropagation();f.val="";f.removeClass("search__input-clear-wrapper--open");r.focus()});t.click(function(n){n=$.event.fix(n);n.stopPropagation()});$t.isNative||$("html").click(function(){n&&(n=!1,Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch&&Bonnier.Fotbollskanalen.GlobalSearchModule.KillSearch(),toggleSearch(event))});u.on("click",function(n){toggleSearch(n)});r.on({keydown:searchInputKeydownHandler,keyup:searchInputKeyupHandler})},{Init:e}}();(window.$fk||$)(function(){$t.isAndroid||$t.isIos||Bonnier.Fotbollskanalen.SearchModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.SocialShareModule");Bonnier.Fotbollskanalen.SocialShareModule=function(n,t){var f=function(){e()},e=function(){$('[data-js="share-btn"]').on("touchend click",function(n){i(n)});$('[data-js="feed-on-facebook"]').on("click",function(n){feedOnFacebook(n)});$('[data-js="share-on-twitter"]').on("click",function(n){r(n)})},i=function(n){var t,r;n.preventDefault();var f=$(n.currentTarget).data("share-url"),e=$(n.currentTarget).data("custom-share-url"),o=$(n.currentTarget).data("url"),s=e||o,i=f+encodeURIComponent(s);Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent("article","share",document.title,i);t=u(i,500,500);r=setInterval(function(){try{(t==null||t.closed)&&clearInterval(r)}catch(n){}},500);t.focus()},r=function(n){n.preventDefault();var i=$(n.currentTarget).data("share-url"),r=$(n.currentTarget).data("share-description"),f=$(n.currentTarget).data("url"),e=i+encodeURIComponent(r)+"&url="+encodeURIComponent(f),t=u(e,500,500),o=setInterval(function(){try{(t==null||t.closed)&&clearInterval(o)}catch(n){}},500);t.focus()},u=function(n,i,r){return t.open(n,"_blank","width="+i+", height="+r)},o=function(n){var t=$(n).closest(".article-hybrid-widgets").siblings(".article").find(".article__main-container").data("url")||location.pathname;return"https://www.fotbollskanalen.se"+t};return{Init:f,Share:i,ShareOnTwitter:r,GetSharingUrl:o}}(jQuery,window);(window.$fk||$)(function(){($t.exists('[data-js="share-btn"]')||$t.exists('[data-js="feed-on-facebook"]')||$t.exists('[data-js="share-on-facebook"]')||$t.exists('[data-js="share-on-twitter"]'))&&Bonnier.Fotbollskanalen.SocialShareModule.Init()});Bonnier.namespace("Bonnier.Fotbollskanalen.StickyAdModule");Bonnier.Fotbollskanalen.StickyAdModule=function(){var n=function(){t()},t=function(){var n,t,r;const u=15e3;$(window).focus(function(){t()});$(window).blur(function(){r()});$(window).scroll(function(){t()});$(window).mousemove(function(){t()});t=function(){n||(n=setTimeout(function(){i();r()},u))};r=function(){clearInterval(n);n=0}},i=function(){$t.dispatchCustomEvent("reloadStickyDesktopAd")};return{Init:n}};Bonnier.namespace("Bonnier.Fotbollskanalen.StickyTopAdModule");Bonnier.Fotbollskanalen.StickyTopAdModule=function(){var n=function(){};return{Init:n}};Bonnier.namespace("Bonnier.Fotbollskanalen.SubNavigationModule");Bonnier.Fotbollskanalen.SubNavigationModule=function(){var r=$("[data-subnav-tab]"),n=$("[data-subnav-link]"),t=$("[data-subnav-container]"),i=function(n,i){if(n){var r=n.attr("data-section");$(".subnav__link.selected").removeClass("selected");n.addClass("selected");t.children("section:not("+r+")").hide();$("#"+r).show();i;Bonnier.Fotbollskanalen.ImageLazyLoadModule.InitLazyLoadTab(r);Bonnier.Fotbollskanalen.ImageSwitchModule.Init();Bonnier.Fotbollskanalen.AdIframeModule.RenderHiddenAd(r)}},u=function(u){if($t.exists(r)&&$t.exists(t)){n.data("top",0).on("click",function(n){var e,f,t;n.preventDefault();var r=$(this),o=r.parent().find(".selected").data("top",top),s=u.persisted;Bonnier.Fotbollskanalen.DesktopAdPageViewIdModule.Init();i(r,!s);e=r.text().trim();f=$(this).attr("data-section");r.attr("href")!==o.attr("href")&&(t=getParameterByName("filter"),t=t?"&filter="+t:"",window.history.pushState({},e,window.location.pathname+"?tab="+f+t),Bonnier.Fotbollskanalen.TrackingModule.TrackIntraPageTabClick(window.location.pathname,f))});window.addEventListener("popstate",function(){var t,r=getParameterByName("tab");t=r?$('[href="?tab='+r+'"]'):n.first();i(t,!1)})}};return{Init:u}}();$t.isAndroid?window.addEventListener("load",function(n){Bonnier.Fotbollskanalen.SubNavigationModule.Init(n)}):window.addEventListener("pageshow",function(n){Bonnier.Fotbollskanalen.SubNavigationModule.Init(n)});SvSMatchViewModel=function(n,t,i,r){var u=this;u.Description=ko.observable("");u.Outcomes=ko.observableArray();u.DateString=ko.observable("");u.TimeString=ko.observable("");u.NoOutcomeUrl=ko.observable("");u.Events=ko.observableArray();u.PageType=ko.observable("");u.UserRandomKey=ko.observable("");u.SvsBannerTheme=ko.observable("");u.MatchId=ko.observable(n);u.MatchStartDate=ko.observable("");u.ImpressionImageUrl=null;u.betClickHandler=function(n,t){t.preventDefault();window.open(n.outcome_url())};u.load=function(){var f=Fotbollskanalen.CookieModule.getCookie("svs-banner-theme"),e;f===""&&(f="A",Math.floor(Math.random()*2)===0&&(f="B"),Fotbollskanalen.CookieModule.setCookie("svs-banner-theme",f,21));u.SvsBannerTheme(f);e="/api/getdraw/pagetype/{0}/matchid/{1}/bannertheme/{2}".format(t,n,f);$t.isNative||(e+="?returnurl="+encodeURIComponent(window.location.href));$.getJSON(e,function(f){if(f!==null&&typeof f!="undefined"){if($("#svs-match_"+i+"_"+n).show(),f.live)u.DateString(""),u.TimeString("LIVE"),u.MatchStartDate("LIVE"),setTimeout(function(){u.load()},6e4);else{u.DateString(f.close_time_day);u.MatchStartDate(f.match_start);u.TimeString(f.close_time_hour);var e=new Date(f.close_time).getTime(),o=setInterval(function(){var n=Date.now();n>e&&(clearInterval(o),u.load())},5e3)}u.Description(f.description);u.NoOutcomeUrl(f.no_outcome_url);u.PageType(t);u.UserRandomKey(r);ko.mapping.fromJS(f.event.outcomes,{},u.Outcomes)}})};u.load()};Bonnier.namespace("Bonnier.Fotbollskanalen.TableSorterModule");Bonnier.Fotbollskanalen.TableSorterModule=function(){function h(n){n=n?"data-sort-"+n:t;var u;return r===n?(u=!0,r="",i.setAttribute("points",s)):(u=!1,r=n,i.setAttribute("points",o)),function(i,r){var f=i.getAttribute(n),e=r.getAttribute(n),s=!1,o=u;if(f===e){if(n===t)return 0;f=i.getAttribute(t);e=r.getAttribute(t);o=!1}return(isNaN(f)||isNaN(e)||(f=Number(f),e=Number(e),s=!0),s)?o?f>e?1:-1:f>e?-1:1:o?f<e?1:-1:f<e?-1:1}}function f(){$(u).appendTo($(this));var n=$(this).attr("data-sort-action").split("|"),t=$('[data-sortable-list-id="'+n[0]+'"]');t.find("tr").sort(h(n[1])).appendTo(t)}var t="data-sort-arbiter",o="0,0 5,10 10,0 5,3",s="0,10 5,0 10,10 5,7",u=document.createElement("span"),n=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,r,e;return n.setAttribute("width","10"),n.setAttribute("height","10"),n.style.marginLeft="5px",i=document.createElementNS("http://www.w3.org/2000/svg","polygon"),n.appendChild(i),u.appendChild(n),r="",e=function(){$('[data-js="sort-header"]').on("click",f);var n=$('[data-sort-default="true"]');n.length>0&&f.apply(n[0])},{Listen:e}}();(window.$fk||$)(function(){Bonnier.Fotbollskanalen.TableSorterModule.Listen()});Bonnier.namespace("Bonnier.Fotbollskanalen.TrackingModule");Bonnier.Fotbollskanalen.TrackingModule=function(){function g(n){return n&&{}.toString.call(n)==="[object Function]"}var e=function(n,t){dataLayer.push({event:"follow-team",teamId:n,teamName:t})},o=function(n,t){dataLayer.push({event:"follow-player",playerId:n,playerName:t})},s=function(n,t){dataLayer.push({event:"follow-league",leagueId:n,leagueName:t})},h=function(n,t){dataLayer.push({event:"unfollow-team",teamId:n,teamName:t})},c=function(n,t){dataLayer.push({event:"unfollow-player",playerId:n,playerName:t})},l=function(n,t){dataLayer.push({event:"unfollow-league",leagueId:n,leagueName:t})},a=function(n,t){r("tab","click",n,t)},v=function(n,t){dataLayer.push({event:"sponsored-teaser-impr",sectionName:n,articleName:t})},y=function(n,t){dataLayer.push({event:"sponsored-article-teaser-impr",sectionName:n,articleName:t})},p=function(n,t){dataLayer.push({event:"sponsored-teaser-click",sectionName:n,articleName:t})},w=function(n,t,i){dataLayer.push({event:"article-show-comments-click",articleName:n,pageType:t,source:i})},b=function(n,t){dataLayer.push({event:"sponsored-article-teaser-click",sectionName:n,articleName:t})},k=function(n,t){dataLayer.push({event:"sponsored-article-impr",sectionName:n,articleName:t})},d=function(n,t,i,r,u){dataLayer.push({event:"sponsored-article-bet-purchase",product:n,drawComment:r,price:t,timeLeft:i,gameSystem:u})},nt=function(n,t,i){dataLayer.push({event:"global-search-click",globalSearchQuery:g(n)?"suggestion":n,resultTitle:t,resultType:i})},tt=function(n){dataLayer.push({event:"global-search-no-result",globalSearchQuery:n})},it=function(){dataLayer.push({event:"track-android-pageview"})},rt=function(n){window.google_tag_manager.dataLayer&&window.google_tag_manager.dataLayer.gtmLoad?n():setTimeout(rt,500)},ut=function(){var t={url:location.pathname,title:document.title,type:document.querySelector("meta[property='og:type']").getAttribute("content"),image:document.querySelector("meta[property='og:image']").getAttribute("content")};n(t.url,t.title,t.type,"track-ios-back-navigate-pageview");i(t.url,t.title,t.type,t.image)},ft=function(){var t={url:location.pathname,title:document.title,type:document.querySelector("meta[property='og:type']").getAttribute("content"),image:document.querySelector("meta[property='og:image']").getAttribute("content")};n(t.url,t.title,t.type,"track-ios-back-navigate-pageview")},et=function(){dataLayer.push({event:"player-index-impression"})},ot=function(){if(window.hasRegisteredTrackedPlayerIndexViewableImpression===undefined){window.hasRegisteredTrackedPlayerIndexViewableImpression=!0;inView(".player-index-sponsor").once("enter",function(){dataLayer.push({event:"player-index-viewable-impression"})})}},st=function(n){dataLayer.push({event:"player-index-expand-click",playerName:n})},ht=function(n){dataLayer.push({event:"player-index-expanded-deeplink-click",playerName:n})},ct=function(){dataLayer.push({event:"player-index-click-betsson"})},lt=function(){dataLayer.push({event:"player-index-click-player"})},at=function(){dataLayer.push({event:"player-index-click-team"})},vt=function(){dataLayer.push({event:"player-index-click-showmore"})},yt=function(n,t,i){dataLayer.push({event:"startpage-module-teaser-click",module:t,url:n,index:i})},pt=function(n,t,i){dataLayer.push({event:"member-content-click",module:t,url:n,index:i})},wt=function(){dataLayer.push({event:"login-success"});sessionStorage.getItem("onBoarding")&&Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent("onboarding_login",sessionStorage.getItem("onBoarding"));sessionStorage.getItem("sessionOpenedMyFeedAfterBubbleShow")&&(localStorage.setItem("userLoginAfterRedBubble","1"),Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent("red-bubble","login_on_min_feed"))},bt=function(){dataLayer.push({event:"register-account-success"});sessionStorage.getItem("onBoarding")&&Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent("onboarding_signup",sessionStorage.getItem("onBoarding"));sessionStorage.getItem("sessionOpenedMyFeedAfterBubbleShow")&&(localStorage.setItem("userRegisterAfterRedBubble","1"),Bonnier.Fotbollskanalen.TrackingModule.TrackGenericEvent("red-bubble","registered_on_min_feed"))},kt=function(){r("locked-article","impression")},dt=function(t,r,u,f){n(t,r,u,"push-next-article-pageview");i(t,r,u,f)},gt=function(t,r,u,f){n(t,r,u,"push-next-article-pageview-by-click");i(t,r,u,f)},t,n=function(n,i,r,e){f(n,i,r,e);$t.exists(".ga-retry")&&"serviceWorker"in navigator&&(navigator.serviceWorker.addEventListener("message",u),clearTimeout(t),t=setTimeout(function(){f(n,i,r,"track-ios-back-navigate-pageview");console.log("Google Analytics retry sent.")},5e3))},u=function(n){n.data.msg==="ga"&&(clearTimeout(t),navigator.serviceWorker.removeEventListener("message",u))},f=function(n,t,i,r){dataLayer.push({event:r,url:n,pageName:t,pageType:i})},i=function(n,t,i,r){window.LP4&&window.LP4.logPageview({url:"https://www.fotbollskanalen.se"+n,title:t,type:i,image:r})},ni=function(){$('[data-js="track"]').on("click",function(){var n=$(this).attr("href"),t=$(this).data("module"),i=$(this).data("itemindex"),r=$(this).data("member-content");Bonnier.Fotbollskanalen.TrackingModule.TrackStartPageClick(n,t,i);r==="True"&&Bonnier.Fotbollskanalen.TrackingModule.TrackMemberContentClick(n,t,i)})},ti=function(){dataLayer.push({event:"mobile-navigation",menuAction:"Open mobile menu"})},ii=function(n){dataLayer.push({event:"mobile-navigation",menuAction:"Interaction in mobile menu",menuElement:n})},ri=function(){dataLayer.push({event:"mobile-navigation",menuAction:"Close mobile menu"})},ui=function(n,t){dataLayer.push({event:"desktop-navigation",menuElement:n,menuSubElement:t})},fi=function(n,t){dataLayer.push({event:"mobile-navigation",menuAction:n,menuElement:t})},ei=function(n,t){dataLayer.push({event:"message-interaction",action:n,messageTitle:t})},oi=function(){dataLayer.push({event:"in-app-message-incoming"})},si=function(){dataLayer.push({event:"in-app-message-show"})},hi=function(){dataLayer.push({event:"in-app-message-open"})},ci=function(){dataLayer.push({event:"in-app-message-close"})},r=function(n,t,i,r){dataLayer.push({event:"generic-event",category:n,action:t,label:i,value:r})},li=function(n,t,i){dataLayer.push({event:"streamStart",content:{asset:{id:n,title:t},player:{autoplay:i}}})},ai=function(n,t,i){dataLayer.push({event:"stream_start_init",content_asset_id:n,content_asset_title:t,player_is_autoplay:i})};return{TrackFollowTeam:e,TrackFollowPlayer:o,TrackUnfollowTeam:h,TrackUnfollowPlayer:c,TrackGlobalSearch:nt,TrackIntraPageTabClick:a,TrackSponsoredTeaserImpression:v,TrackSponsoredArticleTeaserImpression:y,TrackSponsoredTeaserClick:p,TrackSponsoredArticleTeaserClick:b,TrackSponsoredArticleImpression:k,TrackSponsoredArticlePurchase:d,TrackNoResultGlobalSearch:tt,TrackAndroidPageView:it,TrackNativeBackNavigatePageView:ut,TrackMobileWebBackNavigatePageView:ft,TrackPlayerIndexImpression:et,TrackPlayerIndexViewableImpression:ot,TrackPlayerIndexClickBetsson:ct,TrackPlayerIndexClickPlayer:lt,TrackPlayerIndexClickTeam:at,TrackPlayerIndexExpandClick:st,TrackPlayerIndexExpandedDeeplinkClick:ht,TrackPlayerIndexClickShowMore:vt,TrackStartPageClick:yt,TrackPushNextArticlePageView:dt,TrackPushNextArticlePageViewByClick:gt,InitStartPageClick:ni,OpenMobileMenu:ti,InteractionInMobileMenu:ii,CloseMobileMenu:ri,InteractionInDesktopMenu:ui,MobileNavigationClick:fi,TrackMessageInteractionClick:ei,TrackVideoStarted:li,TrackVideoInitialized:ai,TrackFollowLeague:s,TrackUnfollowLeague:l,TrackMemberContentClick:pt,TrackLoginSuccess:wt,TrackRegisterAccountSuccess:bt,TrackArticleShowCommentsClick:w,TrackInAppMessageClose:ci,TrackInAppMessageOpen:hi,TrackInAppMessageShow:si,TrackInAppMessageIncoming:oi,TrackLockArticleShown:kt,TrackGenericEvent:r}}();(window.$fk||$)(function(){Bonnier.Fotbollskanalen.TrackingModule.InitStartPageClick()});VideoCountDownViewModel=function(){CountDown=ko.observable()};ko.bindingHandlers.timer={update:function(n){var t=$(n).find("> span");if(!t.attr("target-timestamp")){$(n).hide();return}var o=new Date(t.attr("target-timestamp")),i=function(n){return n<10?"0"+n:n},r=function(){var r=Math.floor((o.getTime()-Date.now()+e)/1e3);if(r<=0)clearInterval(f),$(n).text("Sändningen startar"),setTimeout(function(){location.href+=(location.href.indexOf("?")===-1?"?":"&")+"aver="+~~(Math.random()*1e5)},3e3);else{var u=Math.floor(r/86400),s=Math.floor(r%86400/3600),h=Math.floor(r%3600/60),c=r%60,l="Sänds om: "+u+"."+i(s)+":"+i(h)+":"+i(c);t.text(l)}},u,f,e=0;$.ajax({url:"https://time.b17g.services/now?client=fotbollskanalen-web&format=rfc3339"}).done(function(n){u=moment(n.trim()).toDate();e=Date.now()-u}).always(function(){r();f=setInterval(r,1e3)})}};VideoLandingPageTabViewModel=function(n){var t=this;t.page=1;t.pageSize=n.pageSize||14;t.keywords=n.keywords;t.VideoSearchResults=ko.observableArray();t.hasMoreVideos=ko.observable(!1);t.videoCountText=ko.observable("");moment.locale("en",{relativeTime:{future:"in %s",past:"%s ago",s:"s",m:"1m",mm:"%dm",h:"1t",hh:"%dt",d:"1d",dd:"%dd",M:"1m",MM:"%dm",y:"1å",yy:"%då"}});t.computeDate=function(n){return console.log(n),n=moment(n),moment().diff(n,"days")>1?moment(n,"YYYY-MM-DD HH:mm").fromNow(!0):zeroPad(n.hour())+":"+zeroPad(n.minutes())};t.showMoreVideos=function(){$.get("/api/videosearch/keywords/"+t.keywords+"/pagesize/"+t.pageSize+"/page/"+t.page,{},function(n){t.VideoSearchResults.push.apply(t.VideoSearchResults,n.items);t.hasMoreVideos(n.show_load_more);t.videoCountText(t.VideoSearchResults().length+" av "+n.count);Bonnier.Fotbollskanalen.ImageLazyLoadModule.LazyLoadWithinContainer("#landing-page-video-list",!0)},"json");t.page+=1};t.showMoreVideos()};Bonnier.namespace("Bonnier.Fotbollskanalen.VideoPlayLoggerModule");Bonnier.Fotbollskanalen.VideoPlayLoggerModule=function(){var n=function(n){if(n!==undefined&&n!==0){var t=new Image,i="https://fk-stat-{0}.herokuapp.com/visit?type=video&id={1}".format($t.isProd?"prod":"stage",n);t.src=i}};return{LogVideoStart:n}}(jQuery);Bonnier.namespace("Bonnier.Fotbollskanalen.VideoPlayModule");Bonnier.Fotbollskanalen.VideoPlayModule=function(){var n=!1,t=null,r=function(t,r){var u=$("#video-module-play-cover-"+t+"-"+r);if(u!==null&&u!==undefined){u.on("touchstart",function(){n=!1});u.on("touchmove",function(){n=!0});u.on("click",function(){if(!n){i(t,r);var f=u.attr("data-is-member-content")==="true";f&&!Fotbollskanalen.AccountModule.isLoggedIn()&&$([document.documentElement,document.body]).animate({scrollTop:$(".locked-article").offset().top-$(".locked-article").outerHeight()/2},1e3)}n=!1})}},i=function(n,i,r){var u=$("#video-module-play-cover-"+n+"-"+i);if(u!==null&&u!==undefined){var f=u.attr("data-video-title"),e=u.attr("data-player-version"),o=u.attr("data-cover-image-url"),s=u.attr("data-video-is-live"),h=u.attr("data-show-cover-image")==="True",c=u.attr("data-use-push-next-content"),l=u.attr("data-is-member-content")==="true";(!l||Fotbollskanalen.AccountModule.isLoggedIn())&&($t.dispatchCustomEvent("currentplaylistvideo",{detail:{assetId:i}}),$t.isNative?(h||u.hide(),Bonnier.Fotbollskanalen.NativeBridgeModule.SetVideoInfo(o,f,s),Bonnier.Fotbollskanalen.NativeBridgeModule.PlayVideo(i,r),Fotbollskanalen.PushNextContentModule.setPlayedVideo(parseInt(i))):(t!==null&&(t.destroy(),t=null),$('div[id^="video-module-play-cover"]').each(function(){$(this).show()}),$('div[id^="bonnier-video-player"]').each(function(){$(this).empty()}),$("#bonnier-video-player-"+n+"-"+i)!==null&&(window.bbrPlayerModule=new Fotbollskanalen.BonnierBroadcastingPlayerModule(e,c),window.bbrPlayerModule.appendBbrStyleAndScriptToHead(function(){window.bbrPlayerModule.playVideoAsset(i,!0,n)}))),Bonnier.Fotbollskanalen.VideoPlayLoggerModule.LogVideoStart(i))}},u=function(n,t){var i=$("#video-module-play-cover-"+n+"-"+t);i!==null&&i!==undefined&&(r(n,t),Bonnier.Fotbollskanalen.NativeBridgeModule.CanIUse("restore-video-image")&&document.addEventListener("onBackNavigation",function(){i.show();Bonnier.Fotbollskanalen.ImageLazyLoadModule.LazyLoadWithinContainer("#video-module-play-cover-"+n+"-"+t,!0)},!1))};return{Init:u,HandleVideoPlayStarted:i}}()