var excludeMobileRedirect = ["/fifaworldcup/organisation/ticketing/", "/worldcup/organisation/ticketing/"];define(['frameworks/bundle'],function () {;(function($,w,d) {var scrollspyModel=fifa.model.extend({scroll_detect_disable:false,animate_disable:false,no_sticky:false,initialize:function(options) {var _this=this;fifa.model.prototype.initialize.apply(_this,[options]);_this.triggerMe('init');},onInit:function() {var _this=this;_this.set('$nav_items',_this.get('$nav').find('.nav a'));_this.no_sticky=_this.get('$nav_items').filter('[data-nosticky="true"]').length>0;_this.set('$refs',_this.getReferences());var $nav_row=_this.get('$nav').closest('.row');if(!$nav_row.length) {$nav_row=_this.get('$nav');}var $nav_row_next=$nav_row.next('.row,.anchor');_this.set('sticky_$row_next',$nav_row_next.length ? $nav_row_next:$nav_row);},get$Ref:function($this) {var model_ref=$this.attr('model-ref'),cache_key=['ref',model_ref].join('.');return (fifa.cacheMap.get(cache_key)||fifa.cacheMap.set(cache_key,$(model_ref)));},onLoad:function() {var _this=this,pathname=_this.getPathName(),full_path=pathname[pathname.length - 1]==='/' ? [pathname,'index.html'].join(''):null,item_selector='[href="' + pathname + '"]';if(w.location.hash==='#nosticky') {_this.get('$nav_items').each(function() {this.href += '#nosticky';});return;}var $selected_by_path=_this.get('$nav_items').filter(full_path ? ['[href="' + full_path + '"]',item_selector].join(','):item_selector);_this.triggerMe('itemSet',_this,true,$selected_by_path);_this.setStickyNav();},getPathName:function() {var location_pathname=w.location.pathname,history_state=History.getState(),history_pathname,hostAndPort=[w.location.protocol,'/','/',w.location.host].join('');if(history_state&&history_state.url) {return history_state.url.replace(hostAndPort,'');}return location_pathname;},onItemChange:function($this) {if(!$this.is('a')) {$this=$this.find('a');}if(!$this.length) {return;}this.scroll_detect_disable=true;this.animate_disable=true;this.triggerMe('historyPush',$this);this.scroll_detect_disable=false;this.animate_disable=false;},getReferences:function() {var _this=this,selectors=[];_this.get('$nav_items').each(function() {var ref=this.getAttribute('data-ref')||(this.setAttribute('first-ref',['#',w.models.module.get('first').attr('id')].join('')),this.getAttribute('first-ref'));if(ref==='#') { return;}this.setAttribute('model-ref',ref);selectors.push(ref);});return $(selectors.join(','));},onResetDefaultStyles:function() {var _this=this;_this.get('sticky_$row_next').css({ paddingTop:''});_this.get('content_wrap').removeAttribute('style');},setStickyNav:function() {var _this=this;if(_this.get('$w').scrollTop()<(_this.get('$nav').attr('data-offset-top')||0)) {fifa.get$SectionHeader().removeClass('hidden');_this.triggerMe('resetDefaultStyles');_this.get('$nav').removeClass('navbar-fixed-top').removeAttr('data-offset-top');if(_this.no_sticky) {_this.get('$nav_items').each(function() {this.href += '#nosticky';});}fifa.setPageHeaderHeight();}else if(!_this.get('$nav').hasClass('navbar-fixed-top')&&_this.get('$w').scrollTop()>=((_this.get('$nav').offset()||{ top:fifa.getSiteHeaderHeight() * 2}).top - fifa.getSiteHeaderHeight())) {_this.get('$nav').attr('data-offset-top',(_this.get('$nav').offset().top - fifa.getSiteHeaderHeight())).addClass('navbar-fixed-top');fifa.setPageHeaderHeight();_this.get('content_wrap').setAttribute('style','background-position-y:' + fifa.getPageHeaderHeight() + 'px');if(_this.get('sticky_$row_next')&&_this.get('sticky_$row_next').length) {fifa.get$SectionHeader().addClass('hidden');if(!_this.get('sticky_$row_next_paddingTop')) {_this.set('sticky_$row_next_paddingTop',parseInt(_this.get('sticky_$row_next').css('padding-top'),10) + fifa.getSectionHeaderHeight() + fifa.getPageHeaderHeight());}_this.get('sticky_$row_next').css({ paddingTop:_this.get('sticky_$row_next_paddingTop')});}if(_this.no_sticky) {_this.get('$nav_items').each(function() {this.href=this.href.replace('#nosticky','');});}}},onHistoryPush:function($this) {this.setStickyNav();var $ref=this.get$Ref($this);fifa.dispatcher.trigger('history:pushState',{ ref:$this.attr('model-ref')},$ref.attr('data-title'),$this.attr('href'));},_scroll_tm:null,coreOnPageScroll:function() {this.triggerMe('pageScroll');},onPageScroll:function() {var _this=this;if(_this.scroll_detect_disable) { return;}_this.setStickyNav();if(_this._scroll_tm) { clearTimeout(_this._scroll_tm);}_this._scroll_tm=setTimeout(function(s) {clearTimeout(s);_this.triggerMe('itemSet',_this);},50);},onItemClick:function($this) {var _this=this,history_state=History.getState();if(!$this) { $this=_this.get('$nav_items').first();}_this.animate_disable=false;_this.scroll_detect_disable=true;if((history_state.data&&history_state.data.ref===$this.attr('model-ref'))||($this.attr('model-ref').indexOf("#")==0)) {_this.triggerMe('animate',$this);}else {_this.triggerMe('historyPush',$this);}_this.animate_disable=true;},pageViewOnBackToTopClick:function() {this.triggerMe('itemClick',null);},historyOnStateChange:function(history_state) {var _this=this,$this;if(!history_state.data.ref) {$this=_this.get('$nav_items').first();}else {$this=_this.get('$nav_items').filter('[model-ref="' + history_state.data.ref + '"]');}_this.triggerMe('animate',$this);},onAnimate:function($this,skipModelTrigger) {var _this=this,$parent=$this.parent(),scrollTop;var $this_idx=_this.get('$nav_items').index($this);if($this_idx===0) {scrollTop=0;}else {var ref_key=['ref',$this.attr('model-ref')].join('.'),$ref=_this.get$Ref($this),row_key=[ref_key,'row'].join('.'),ref_offset=(fifa.cacheMap.get(row_key)||fifa.cacheMap.set(row_key,$ref.closest('.row,.anchor'))).offset().top;if($ref.length) {var offset_from_top=0;if(!_this.get('$nav').hasClass('navbar-fixed-top')) {offset_from_top=fifa.get$PageHeader().offset().top - fifa.get$PageShare().offset().top - fifa.getPageShareHeight();}scrollTop=ref_offset - fifa.getPageHeaderHeight() - fifa.getSiteHeaderHeight() - offset_from_top;}else {scrollTop=0;}}if(scrollTop<0) {scrollTop=0;}if(!$parent.hasClass('active')) {_this.get('$nav').find('.active').removeClass('active');$parent.addClass('active');}if(_this.animate_disable) { return;}if(scrollTop===_this.get('$body_html').scrollTop()) { return;}_this.get('$body_html').stop(true).animate({ scrollTop:scrollTop},function() {if(!skipModelTrigger) {_this.triggerMe('itemChange',$this);}_this.triggerView('setBackToTop',$parent);});},defaults:{$nav:$('.nav-scrollspy'),$nav_items:null,$refs:null,$body_html:$(navigator.userAgent.indexOf('WebKit/')===-1 ? 'html':'body'),sticky_$row_next:null,sticky_$row_next_paddingTop:null,$w:$(w),content_wrap:d.getElementById('content-wrap'),$adv_lb:$('.adv-lb:first')},coreOnReinit:function() {var _this=this;_this.set('$nav',$('.nav-scrollspy'));_this.set('$adv_lb',$('.adv-lb:first'));_this.set('content_wrap',d.getElementById('content-wrap'));fifa.cacheMap.removeByKey('ref');_this.triggerMe('init');},name:'scrollspy',view_name:'scrollspy:view'});w.models.scrollspy=new scrollspyModel({bind:['init','pageScroll','core:pageScroll','load','itemSet','historyPush','itemChange','itemClick','animate','history:stateChange','page:view:backToTopClick','core:reinit','resetDefaultStyles']});}(window.jQuery||window.jm,window,document));;(function($,w,d) {var scrollspyView=fifa.view.extend({$contentWrap:null,initialize:function(options) {var _this=this;fifa.view.prototype.initialize.apply(_this,[options]);_this.triggerModel('load');},events:{'click .nav-pills a':'onItemClick'},scrollspyOnItemSet:function(model,skipModelTrigger,$selected) {var _this=this,isVisible=false;if($selected&&$selected.length) {var $selected_parent=$selected.parent();if($selected_parent.is(model.get('$nav').find('.active'))) {var $actual_active=model.get('$nav').find('.active').removeClass('active'),$new_active=$selected_parent.addClass('active');}_this.triggerModel('animate',$selected,skipModelTrigger);return;}model.get('$refs').each(function() {if(isVisible) { return;}if(isVisible=fifa.isElementInViewport(this)) {var _id=this.getAttribute('id'),$actual_active=model.get('$nav').find('li.active'),$nav_item=model.get('$nav_items').filter('[model-ref="#' + _id + '"]'),$new_active=$nav_item.length ? $nav_item.parent():model.get('$nav_items').filter('[model-ref*="#' + _id + ',"]').parent();if($actual_active.is($new_active)) { return;}$actual_active.removeClass('active');$new_active.addClass('active');if(skipModelTrigger) { return;}_this.triggerModel('itemChange',$new_active);}});},onItemClick:function(event) {var _this=this,$this=$(event.currentTarget);if($this.attr('data-noscroll')!=='true') {event.preventDefault();_this.triggerModel('itemClick',$this);}},coreOnReinit:function() {var _this=this;_this.setElement(__cfg.el);_this.triggerModel('load');},name:'scrollspy:view',model_name:'scrollspy'}),__cfg={el:'.nav-scrollspy',bind:['scrollspy:itemSet','core:reinit']};w.views.scrollspy=new scrollspyView(__cfg);}(window.jQuery||window.jm,window,document)); });