/* Core for FullJS 3.0 version: 1.0.4 */ ;(function($){ window.FJSCore={ local:location.protocol=="file:" ,basepath:location.pathname.slice(0,location.pathname.lastIndexOf('/')+1) ,defState:'' ,defMobileState:'' ,defStateMobileText:'Home' ,emptyNavigationText:'-- navigate to --' ,ajaxFolder:"/ajax/" ,indexFile:'index.aspx' ,indexFile2:'index.aspx?siteid=1' ,indexFile3:'index.aspx?fkeyid=&siteid=1&pageid=273&newsview=1' ,modules:{} ,mobileVersion:true ,mobileFolowLinks:false } if(FJSCore.mobileVersion&&(FJSCore.mobile=(device.mobile())||location.search.slice(1)==='mobile')) document.write('') else FJSCore.mobile=false if(FJSCore.tablet=device.tablet()||location.search.slice(1)==='tablet') document.write('') })(jQuery); !function($){ var win=$(window) ,doc=$(document) ,Core=window.FJSCore ,$Core=$(Core) doc .on('changeLocation',function(e,d){ if(d===Core.state) return false if(!Core.local) history.pushState(d,'',Core.basepath+d) if((''+d).indexOf('#')===-1) Core.state=d //,Core.hash='' else Core.state=d.slice(0,d.indexOf('#')) //,Core.hash=location.hash.slice(1) $Core.trigger('changeState',Core.state) }) .on('click','a',function(e){ var $this=$(this) ,href=$this.attr('href') if (href[0]==='#'){ if (href.length === 1) { return false; } if(window.history&&window.history.pushState) { location.hash=href } else { location.hash+=href } return false; } if(!/^\.\/|^\/[^/]|^javascript/.test(href)){ window.location.replace(~href.indexOf('://')?href:'//'+href); return false; } }) .on('click','a[href^="/"]:not([href^="//"]),a[href^="./"]',function(e){ var href=$(this).attr('href') href=href.replace(/^\./,'').replace(Core.basepath,'').replace(/^\//,'') if(FJSCore.mobile&&href===FJSCore.defState) href=FJSCore.defMobileState doc.trigger('changeLocation',href) //e.preventDefault() //return false }) $Core.on('changeState',function(){ FJSCore.modules.updateTitle&&FJSCore.modules.updateTitle(false) }) win .on('popstate load afterload hashchange',function(){ popstate() }) function popstate(){ var locationHref=location.href.match(/.+\/([^?#]*)\??([^#]*)\#?(.*)$/) ,defState=FJSCore.mobile?FJSCore.defMobileState:FJSCore.defState ,state=locationHref[1]//||defState ,search=locationHref[2] ,hash=locationHref[3] switch(state){ case FJSCore.defState: case FJSCore.defMobileState: state=defState } state=search?state+'?'+search:state if(Core.state!==state){ FJSCore.prevState = Core.state ? Core.state : state; Core.state=state; //Core.search=search Core.hash=hash; $Core.trigger('changeState',Core.state); } } $(function(){ Core.ajaxOverlay=$('
').hide() Core.globOverlay=$('#glob-overlay') Core.ajaxOverlay .appendTo('#glob-wrap') Core.globOverlay.add(Core.ajaxOverlay) .on('show',function(){ $(this).fadeIn() }) .on('hide',function(){ $(this).fadeOut() }) win.on('afterload',function(){ $.when(Core.globOverlay.trigger('hide')) .then(function(){ $('body').removeClass('overlaid') }) }) }) FJSCore.prepareLoaded=function(root){ $('a[href^="/"]:not([href^="//"])',root).each(function(){ var $this=$(this) $this.attr({href:'.'+$this.attr('href')}) }) FJSCore.modules.ajaxForms&&FJSCore.modules.ajaxForms(root) FJSCore.modules.updateTitle&&FJSCore.modules.updateTitle(root) } FJSCore.modules.updateTitle=function(root){ document.title=root?$('title',root).text():FJSCore.title } $('html').addClass(FJSCore.mobile?'mobile':FJSCore.tablet?'tablet desktop':'desktop') $(function(){ FJSCore.prepareLoaded($('html')) FJSCore.title=$('html>head>title').text() if(!FJSCore.mobile) $('.mobile-only').remove() }) }(window.jQuery); !function($){ $(function follows(){ FJSCore.modules.follows=follows $('[data-follow]').not('[data-follow="location"]')//,[data-follow="hash"] .each(function(){ var $this=$(this) ,follow=$this.data('follow') $(follow).on('changeState',function(e,d){ $this.trigger('changeState',d) }) }) $('[data-follow="location"]') .each(function(){ var $this=$(this) $(window.FJSCore) .on('changeState',function(e,d){ $this.trigger('changeState',d) }) }) /*$('[data-follow="hash"]') .each(function(){ var $this=$(this) $(window.FJSCore) .on('changeState',function(e,d){ if(window.FJSCore.hash) $this.trigger('changeHashState',window.FJSCore.hash) }) })*/ }) }(window.jQuery); !function($){ $(function(){ var opt={ elementsPath:'>ul>li' ,activeClass:'active' } $('[data-type="navigation"]').each(function(){ var th=$(this) ,data=$.extend({},opt,th.data('options')) data.elements=$(data.elementsPath,th) th .data({navigation:data}) .on('changeState',function(e,d){ data.elements.each(function(){ var th=$(this) ,a=$('a',th) ,href=a.attr('href').replace(FJSCore.basepath,'').replace(/^\.\//,'') if(href===d) th.addClass(data.activeClass) else th.removeClass(data.activeClass) }) }) }) }) }(window.jQuery); !function($){ $(function switcher(){ var opt={ elementsPath:'>div' } ,xhr FJSCore.modules.switcher=switcher $.ajaxSetup({ type: "get", cache:false, async:true, accepts: "html", dataType: "html", isLocal:true, crossDomain:false }) $('[data-type="switcher"]').each(function(){ var $this=$(this) ,flags=$this.data('flags')||'' ,data=$.extend({},opt,$this.data('options')) ,show,hide data.elements=$(data.elementsPath,$this) $this .data({switcher:data}) .on('changeState',function(e,d){ show=$() hide=$() if(isExternal(d)&&~flags.indexOf('ajax')){ var url=FJSCore.basepath+FJSCore.ajaxFolder.slice(1)+d if(xhr)xhr.abort() FJSCore.ajaxOverlay.trigger('show') try{ xhr=$.get(url,function(html){ var ajaxPage=$('
').attr({'data-url':FJSCore.state}) show=show.add(ajaxPage) hide=hide.add($(data.elementsPath,$this)) ajaxPage .html(html) .hide() .appendTo($this) data.elements=data.elements.add(ajaxPage) FJSCore.prepareLoaded(ajaxPage) show_hide_actions() }) xhr.error(function(e){ history.replaceState(FJSCore.prevState,'',FJSCore.basepath+FJSCore.defState); $(document).trigger('changeLocation','404.html') }) $.when(xhr) .then(function(){ FJSCore.ajaxOverlay.trigger('hide') }) }catch(e){console.log(e)} }else{ /*if(d===FJSCore.indexFile || d=== FJSCore.indexFile2 || d=== FJSCore.indexFile3){ d=FJSCore.defState;console.log(d," : ",FJSCore.defState); }*/ d="" data.elements.each(function(){ var $this=$(this) if($this.data('id')===d) show=show.add($this) else hide=hide.add($this) }) show_hide_actions() } function show_hide_actions(){ hide=hide.not(':hidden') data.prev=data.curr data.curr=show hide.trigger('hide',data) if(show.length!==0) show.trigger('show',data) $.when(data.elements) .then(function(){ data.elements.filter('.ajax-page:hidden').remove() }) } }) }) $('[data-source]') .each(function(){ var $this=$(this) ,url=location.href.slice(0,location.href.lastIndexOf('/'))+'/ajax/'+$this.data('source') $this .on('show',function(e,d){ if(!$this.data('loaded')){ if(xhr)xhr.abort() e.stopPropagation() FJSCore.ajaxOverlay.trigger('show') xhr=$.get(url,function(data){ $this .html(data) .data('loaded',true) .trigger('show',d) FJSCore.prepareLoaded($this) }) $.when(xhr) .then(function(){ FJSCore.ajaxOverlay.trigger('hide') }) } }) }) $('[data-type="switcher"][data-follow="location"]').each(function(){ var $this=$(this) FJSCore.internalIds=(FJSCore.internalIds||$()).add($this.data('switcher').elements) }) FJSCore.internalIds=FJSCore.internalIds&&FJSCore.internalIds.map&&FJSCore.internalIds.map(function(){return $(this).data('id')}) function isExternal(url){ var external=true,i=0,l=FJSCore.internalIds.length for(i=0;i') ,header=$('
') ,content=$('
') ,footer=$('