1;// Themify Theme Scripts - http://themify.me/ 2 3// Initialize object literals 4var FixedHeader = {}; 5 6///////////////////////////////////////////// 7// jQuery functions 8///////////////////////////////////////////// 9(function($){ 10 11 // Test if this is a touch device ///////// 12 function is_touch_device() { 13 return 'true' === themifyScript.isTouch; 14 } 15 16 // Fixed Header ///////////////////////// 17 FixedHeader = { 18 init: function() { 19 if( $('#headerwrap').length < 1 ) return; 20 this.headerHeight = $('#headerwrap').outerHeight(); 21 $(window).on('scroll', this.activate); 22 $(window).on('touchstart.touchScroll', this.activate); 23 $(window).on('touchmove.touchScroll', this.activate); 24 }, 25 26 activate: function() { 27 var $window = $(window), 28 scrollTop = $window.scrollTop(); 29 if ( scrollTop > $('#header').offset().top ) { 30 FixedHeader.scrollEnabled(); 31 } else if ( scrollTop + $window.height() == $window.height() ) { 32 FixedHeader.scrollDisabled(); 33 } 34 }, 35 36 scrollDisabled: function() { 37 $('#headerwrap').removeClass('fixed-header'); 38 $('#header').removeClass('header-on-scroll'); 39 $('#pagewrap').css('padding-top', ''); 40 $('body').removeClass('fixed-header-on'); 41 }, 42 43 scrollEnabled: function() { 44 $('#headerwrap').addClass('fixed-header'); 45 $('#header').addClass('header-on-scroll'); 46 $('#pagewrap').css('padding-top', $('#headerwrap').outerHeight()); 47 $('body').addClass('fixed-header-on'); 48 } 49 }; 50 51 // Initialize carousels ////////////////////////////// 52 function createCarousel(obj) { 53 obj.each(function() { 54 var $this = $(this); 55 $this.carouFredSel({ 56 responsive : true, 57 prev : '#' + $this.data('previd'), 58 next : '#' + $this.data('nextid'), 59 circular : true, 60 infinite : true, 61 swipe: true, 62 scroll : { 63 items : 1, 64 fx : $this.data('effect'), 65 duration : parseInt($this.data('speed')) 66 }, 67 auto : { 68 play : !!('off' != $this.data('autoplay')), 69 timeoutDuration : 'off' != $this.data('autoplay') ? parseInt($this.data('autoplay')) : 0, 70 button: '#breaking-news-play_pause' 71 }, 72 items : { 73 visible : { 74 min : 1, 75 max : 1 76 }, 77 width : 222 78 }, 79 onCreate : function() { 80 $this.closest('.slideshow-wrap').css({ 81 'visibility' : 'visible', 82 'height' : 'auto' 83 }); 84 $('.breaking-news .carousel-nav-wrap').remove(); 85 $('.breaking-news-loader').remove(); 86 $(window).resize(); 87 } 88 }); 89 }); 90 } 91 92 // DOCUMENT READY 93 $(document).ready(function() { 94 95 // Fixed header 96 if(themifyScript.fixedHeader){ 97 FixedHeader.init(); 98 } 99 100 ///////////////////////////////////////////// 101 // Scroll to top 102 ///////////////////////////////////////////// 103 $('.back-top a').click(function() { 104 $('body,html').animate({ scrollTop: 0 }, 800); 105 return false; 106 }); 107 108 ///////////////////////////////////////////// 109 // Add class if menu has children 110 ///////////////////////////////////////////// 111 $("#main-nav li:has(ul)").addClass("has-sub-menu"); 112 $("#main-nav li:has(div)").addClass("has-mega-sub-menu"); 113 114 if( typeof jQuery.fn.themifyDropdown == 'function' ) { 115 $( '#main-nav' ).themifyDropdown(); 116 } 117 118 ///////////////////////////////////////////// 119 // Add class for longer meta info 120 ///////////////////////////////////////////// 121 $('.post-content .post-title + .post-meta span').parent(".post-meta").addClass("post-meta-details"); 122 123 ///////////////////////////////////////////// 124 // search icon add class if it's focused 125 ///////////////////////////////////////////// 126 $(function () { 127 $("#headerwrap #searchform :input").focus(function() { 128 $(".icon-search").addClass("icon-focus"); 129 }).blur(function() { 130 $(".icon-search").removeClass("icon-focus"); 131 }); 132 }); 133 134 // Reset slide nav width 135 $(window).resize(function(){ 136 if ($(window).width() > 780) { 137 $('body').removeAttr('style'); 138 } 139 }); 140 141 ///////////////////////////////////////////// 142 // Toggle nav on mobile 143 ///////////////////////////////////////////// 144 var $menuIcon = $('#menu-icon'), 145 $menuIconTop = $('#menu-icon-top'), 146 $topNav = $('#top-nav'), 147 $mainNav = $('#main-nav'); 148 149 $('#menu-icon').themifySideMenu(); 150 $('#menu-icon-top').themifySideMenu({ 151 panel: '#top-nav-mobile-menu', 152 side: 'left' 153 }); 154 155 ///////////////////////////////////////////// 156 // NiceScroll plugin 157 ///////////////////////////////////////////// 158 if ( typeof $.fn.niceScroll !== 'undefined' && ! is_touch_device() ) { 159 var event = 'click'; 160 $menuIcon.on(event, function(){ 161 var nice = $mainNav.getNiceScroll(); 162 if ( nice.length == 0 ) { 163 $mainNav.niceScroll({ 164 autohidemode: false 165 }); 166 } 167 }); 168 $('.mega').each(function(){ 169 var alink = $(this).find('a').first(), 170 vw = $(window).width(); 171 $(window).resize(function(){ 172 vw = $(window).width(); 173 }); 174 alink.hover(function(){ 175 var niceMega = $(".mega .mega-sub-menu ul").getNiceScroll(); 176 if(niceMega.length == 0 && vw > 780) { 177 $(".mega .mega-sub-menu ul").show().niceScroll({ 178 autohidemode: false 179 }); 180 } 181 }); 182 }); 183 // Menu Top 184 $menuIconTop.on(event, function(){ 185 var nice = $topNav.getNiceScroll(); 186 if ( nice.length == 0 ) { 187 $topNav.niceScroll({ 188 autohidemode: false 189 }); 190 } 191 }); 192 } 193 194 ///////////////////////////////////////////// 195 // Header height for slide effect
196 ///////////////////////////////////////////// 197 function headerHeightSlide(){ 198 var headerH = $('#headerwrap').height(); 199 if (headerH > 120) { 200 $("#headerwrap").addClass("long-menu"); 201 } else { 202 $("#headerwrap").removeClass("long-menu"); 203 } 204 } 205 headerHeightSlide(); 206 $(window).resize(headerHeightSlide); 207 208 }); 209 210 // WINDOW LOAD 211 $(window).load(function() { 212 213 ///////////////////////////////////////////// 214 // Carousel initialization 215 ///////////////////////////////////////////// 216 if($('.slideshow').length>0){ 217 if(!$.fn.carouFredSel){ 218 Themify.LoadAsync(themify_vars.url+'/js/carousel.js',function(){ 219 createCarousel( $('.slideshow') ); 220 }); 221 } 222 else{ 223 createCarousel( $('.slideshow') ); 224 } 225 } 226 227 ///////////////////////////////////////////// 228 // Pause breaking news 229 ///////////////////////////////////////////// 230 $('#breaking-news-play_pause').click(function(){ 231 $(this).toggleClass('playing'); 232 }); 233 234 }); 235 236})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.