1jQuery(document).ready(function($) { 2 "use strict"; 3 4 if( 'undefined' == typeof hootData ) 5 window.hootData = {}; 6 7 /****** Init lightslider ******/ 8 9 if( 'undefined' == typeof hootData.lightSlider || 'enable' == hootData.lightSlider ) { 10 if (typeof $.fn.lightSlider != 'undefined') { 11 $(".lightSlider").each(function(i){ 12 var $self = $(this), 13 settings = { 14 item: 1, 15 slideMove: 1, // https://github.com/sachinchoolur/lightslider/issues/118 16 slideMargin: 0, 17 mode: "slide", 18 auto: true, 19 loop: true, 20 slideEndAnimatoin: false, 21 slideEndAnimation: false, 22 pause: 5000, 23 adaptiveHeight: true, 24 vertical: false, 25 verticalHeight: 500, 26 onSliderLoad: function (el) { setTimeout( () => { if (typeof AOS === 'object') { AOS.refresh(); } }, 1000); }, 27 onAfterSlide: function (el) { if (typeof AOS === 'object') { AOS.refresh(); } }, 28 }, 29 selfData = $self.data(), 30 responsiveitem = (parseInt(selfData.responsiveitem)) ? parseInt(selfData.responsiveitem) : 2, 31 breakpoint = (parseInt(selfData.breakpoint)) ? parseInt(selfData.breakpoint) : 960, 32 customs = { 33 item: selfData.item, 34 slideMove: selfData.slidemove, 35 slideMargin: selfData.slidemargin, 36 mode: selfData.mode, 37 auto: selfData.auto, 38 loop: selfData.loop, 39 slideEndAnimatoin: selfData.slideendanimation, 40 slideEndAnimation: selfData.slideendanimation, 41 pause: selfData.pause, 42 adaptiveHeight: selfData.adaptiveheight, 43 vertical: selfData.vertical, 44 verticalHeight: selfData.verticalheight, 45 }; 46 $.extend(settings,customs); 47 if( settings.item >= 2 && ! settings.vertical ) { /* Its a carousel */ 48 settings.responsive = [ { breakpoint: breakpoint, 49 settings: { 50 item: responsiveitem, 51 } 52 }, ]; 53 } 54 if( settings.vertical == true ) { 55 var verticalslider = $self.lightSlider(settings), 56 $arrownav = $self.closest('.lightSliderVertical').find('.lSAction'); 57 $arrownav.children('.lSPrev').on('click', function(e){ 58 e.preventDefault(); 59 verticalslider.goToPrevSlide(); 60 verticalslider.pause(); 61 }); 62 $arrownav.children('.lSNext').on('click', function(e){ 63 e.preventDefault(); 64 verticalslider.goToNextSlide(); 65 verticalslider.pause(); 66 }); 67 if( settings.auto == true ) { /* https://github.com/sachinchoolur/lightslider/issues/139#issuecomment-122578507 For fix, update to v1.1.6 */ 68 verticalslider.play(); // enable auto play 69 verticalslider.goToSlide(1); // play() moves it by 1 70 } 71 } else { 72 $self.lightSlider(settings); 73 } 74 }); 75 } 76 } 77 78 /****** Content Blocks ******/ 79 80 // Themes need to explicitly enable this 81 if( 'undefined' != typeof hootData.contentblockhover && 'enable' == hootData.contentblockhover ) { 82 // setTimeout( function(){ contentblockhover(false); }, 500 ); 83 // Reinit on window.load (Ideally only this should be required but this can take too long in certain cases - we still 84 // add it for cases when not calculated properly because images not loaded on document.ready inspite of setTimeout above) 85 $(window).on('load', function(){ contentblockhover(false); } ); 86 87 // Use jquery instead of window.onresize = function() {} since that is being triggered by slider everytime a slide changes 88 $(window).on('resize', function () { 89 if ( this.cbhResetTimeout ) 90 clearTimeout( this.cbhResetTimeout ); 91 this.cbhResetTimeout = setTimeout( function(){ contentblockhover(true); }, 500 ); 92 }); 93 } 94 95 function contentblockhover(reset){ 96 // if ( reset ) console.log('called when reset true'); else console.log('called when reset false'); 97 $('.content-block-style5 .content-block').each(function(){ 98 var $self = $(this); 99 if ( ! $self.children('.content-block-content-clone').length ) { 100 101 var $content = $self.children('.content-block-content'), 102 $title = $content.children('.content-block-title'), 103 $text = $content.children('.content-block-subtitle, .content-block-text, .more-link'), 104 titlemarginadjust = parseInt( $title.css('margin-bottom') ), 105 topadjust = parseInt( $content.css('bottom') ); 106 107 if ( !titlemarginadjust || isNaN( titlemarginadjust ) ) titlemarginadjust = 0; 108 if ( !topadjust || isNaN( topadjust ) ) topadjust = 0; 109 110 // Reset before calculating top 111 if ( reset ) { 112 $content.css('top', 'auto'); 113 // Hide Text // Redundant for latest => can be deleted later 114 if( 'undefined' == typeof hootData.contentblockhovertext || 'disable' != hootData.contentblockhovertext ) 115 $text.hide(); 116 } 117 118 // Set Top 119 var top = $self.height() - $content.outerHeight(); 120 // Adjust top // Redundant for latest => can be deleted later 121 if( 'undefined' == typeof hootData.contentblockhovertext || 'disable' != hootData.contentblockhovertext ) 122 top = top + titlemarginadjust - topadjust; 123 if ( top && !isNaN(top) ) $content.css('top', top+'px'); // @todo: Fix for edge case scenario (if user loads/refreshes page whilst hovering mouse on a cb5 box) in themes like Nevark where top!=0 => top will not be 0 as $self.height() > $content.outerHeight() by 10px, hence top will be 10 instead of 0 (top 5px and bottom 5px distances) 124 125 // Show Text // Redundant for latest => can be deleted later 126 if( 'undefined' == typeof hootData.contentblockhovertext || 'disable' != hootData.contentblockhovertext ) 127 $text.show(); 128 129 } 130 }); 131 } 132 133 // Lazy Load Fix 134 // @credit https://stackoverflow.com/questions/1950038/#answer-24284069 135 // @credit https://stackoverflow.com/questions/19401633/ 136 var cbimgobserver = new MutationObserver(function(mutations) { 137 mutations.forEach(function(mutation) { 138 if (mutation.attributeName === "class") { 139 var attributeValue = $(mutation.target).prop(mutation.attributeName); 140 if ( attributeValue.indexOf('lazy') !== -1 ) { // works for a3lazyload ; should have worked for jetpack lazy, however .observe() is not working for JP images ; hence we simply end up excluding image using classes via php 141 contentblockhover(true); 142 } 143 } 144 }); 145 }); 146 147 $('.content-blocks-widget').each(function(){ 148 var $cb5img = $(this).find('.content-block-style5 .content-block img'); 149 if ( $cb5img.length) { cbimgobserver.observe( $cb5img[0], { attributes: true, attributeFilter: ['class'] }); } // should have worked for jetpack lazy, however .observe() is not working for JP images ; hence we simply end up excluding image using classes via php 150 }); 151 152 153 /****** Ticker ******/ 154 155 function tickeranim( $currentItem, settings ) { 156 var visiblewidth = parseInt( $currentItem.outerWidth(true) ), 157 moved = parseInt( $currentItem.css('marginLeft') ), 158 distance = visiblewidth - moved, // since marginLeft is negative 159 speed = (parseFloat(settings.speed)) ? parseFloat(settings.speed) : 0.035, 160 duration = visiblewidth / speed; 161 $currentItem.animate({ marginLeft: -distance }, duration, 'linear', function() { 162 $currentItem.appendTo( $currentItem.parent() ).css('marginLeft', 0); 163 tickeranim( $currentItem.parent().children(':first'), settings ); 164 }); 165 }; 166 $('.ticker-msg-box').each(function(){ 167 var $self = $(this), 168 $list = $self.children('.ticker-msgs'), 169 $msgs = $list.children('.ticker-msg'), 170 settings = $self.data(), 171 listwidth = 0; 172 if ( $msgs.length ) { 173 $msgs.each( function() { listwidth += $(this).outerWidth( true ); } ); 174 if ( listwidth > $list.width() ) { 175 $self.css( 'width', $self.width() ); 176 // $self.css( 'height', $self.height() ); // Can skip this as not really needed - height can stay auto 177 $msgs.clone().appendTo( $list ); 178 tickeranim( $list.children(':first'),settings ); 179 $self.hover( 180 function() { $list.children().stop(); }, 181 function() { tickeranim( $list.children(':first'), settings ); } 182 ); 183 $list.find('a').on({ 184 focus: function() { $list.children().stop(); }, 185 blur: function() { tickeranim( $list.children(':first'), settings ); } 186 }); 187 } 188 } 189 }); 190 191 /****** Number Boxes ******/ 192 193 if (typeof $.fn.circliful != 'undefined') { 194 195 var hootCircliful = function( $el ) { 196 $el.find(".number-block-circle").each(function(i){ 197 var $self = $(this), 198 settings = { 199 animation: 1, 200 foregroundBorderWidth: 10, 201 percent: 100, 202 }, 203 selfData = $self.data(), 204 customs = {}; 205 if ( selfData.foregroundcolor ) customs.foregroundColor = selfData.foregroundcolor; 206 if ( selfData.backgroundcolor ) customs.backgroundColor = selfData.backgroundcolor; 207 if ( selfData.fillcolor ) customs.fillColor = selfData.fillcolor; 208 if ( selfData.foregroundborderwidth ) customs.foregroundBorderWidth = selfData.foregroundborderwidth; 209 if ( selfData.backgroundborderwidth ) customs.backgroundBorderWidth = selfData.backgroundborderwidth; 210 if ( selfData.fontcolor ) customs.fontColor = selfData.fontcolor; 211 if ( selfData.percent ) customs.percent = selfData.percent; 212 if ( selfData.animation ) customs.animation = selfData.animation; 213 if ( selfData.animationstep ) customs.animationStep = selfData.animationstep; 214 if ( selfData.icon ) customs.icon = selfData.icon; 215 if ( selfData.iconsize ) customs.iconSize = selfData.iconsize; 216 if ( selfData.iconcolor ) customs.iconColor = selfData.iconcolor; 217 if ( selfData.iconposition ) customs.iconPosition = selfData.iconposition; 218 if ( selfData.percentagetextsize ) customs.percentageTextSize = selfData.percentagetextsize; 219 if ( selfData.textadditionalcss ) customs.textAdditionalCss = selfData.textadditionalcss; 220 if ( selfData.targetpercent ) customs.targetPercent = selfData.targetpercent; 221 if ( selfData.targettextsize ) customs.targetTextSize = selfData.targettextsize; 222 if ( selfData.targetcolor ) customs.targetColor = selfData.targetcolor; 223 if ( selfData.text ) customs.text = selfData.text; 224 if ( selfData.textstyle ) customs.textStyle = selfData.textstyle; 225 if ( selfData.textcolor ) customs.textColor = selfData.textcolor; 226 // WPHOOT MOD Values 227 if ( selfData.percentsign ) customs.percentSign = selfData.percentsign; 228 if ( selfData.displayprefix ) customs.displayPrefix = selfData.displayprefix; 229 if ( selfData.displaysuffix ) customs.displaySuffix = selfData.displaysuffix; 230 if ( selfData.display ) customs.display = selfData.display; 231 // WPHOOT MOD Values end 232 $.extend(settings,customs);
233 $self.circliful(settings); 234 }); 235 }; 236 237 if( 'undefined' == typeof hootData.circliful || 'enable' == hootData.circliful ) { 238 // Hootkit does not load Waypoints. It is upto the theme to deploy waypoints. 239 if (typeof Waypoint === "function" && ( 'undefined' == typeof hootData.nbwaypoint || 'enable' == hootData.nbwaypoint )) { 240 var offset = 75; 241 if( 'undefined' != typeof hootData.numberblockOffset ) 242 offset = hootData.numberblockOffset; 243 var nbwaypoints = $('.number-blocks-widget').waypoint(function(direction) { 244 if(direction=='down') { 245 hootCircliful( $(this.element) ); 246 this.destroy(); 247 } 248 },{offset: offset + '%'}); 249 } else { 250 $('.number-blocks-widget').each( function(){ 251 hootCircliful($(this)); 252 }); 253 } 254 } 255 256 } 257 258 /****** Toggles ******/ 259 260 if( 'undefined' == typeof hootData.toggle || 'enable' == hootData.toggle ) { 261 $('.hootkit-toggle').each( function() { 262 var $self = $(this), 263 onlyone = $self.is('.toggle-onlyone'), 264 $units = $self.find( '.hootkit-toggle-unit' ), 265 $heads = $self.find( '.hootkit-toggle-head' ), 266 $boxes = $self.find( '.hootkit-toggle-box' ); 267 $heads.click( function() { 268 var $head = $(this), 269 $box = $head.siblings( '.hootkit-toggle-box' ), 270 $unit = $head.parent('.hootkit-toggle-unit'); 271 if ( onlyone ) { 272 if ( $unit.is( '.hootkit-toggle-active' ) ) $box.addClass('currentClick'); 273 $units.removeClass( 'hootkit-toggle-active' ); 274 $boxes.not('.currentClick').slideUp('fast'); 275 } 276 $unit.toggleClass( 'hootkit-toggle-active' ); 277 $box.not('.currentClick').slideToggle( 'fast' ); 278 $box.removeClass('currentClick'); 279 }); 280 }); 281 } 282 283 /****** Tabs ******/ 284 285 if( 'undefined' == typeof hootData.tabs || 'enable' == hootData.tabs ) { 286 $('.hootkit-tabs').each(function(i){ 287 var $self = $(this), 288 nav = $self.find('.hootkit-tabhead'), 289 tabs = $self.find('.hootkit-tabbox'); 290 291 nav.click( function() { 292 var navself = $(this), 293 tabid = navself.data('tabcount'), 294 tabself = tabs.filter('[data-tabcount="'+tabid+'"]'); 295 296 tabs.removeClass('current-tabbox'); 297 tabself.addClass('current-tabbox'); 298 nav.removeClass('current-tabhead'); 299 navself.addClass('current-tabhead'); 300 }); 301 }); 302 } 303 304 /****** Scroller (Divider) ******/ 305 306 if( 'undefined' == typeof hootData.scroller || 'enable' == hootData.scroller ) { 307 $('.hootkit-divider > a').on('click', function(e) { 308 e.preventDefault(); 309 var scrollSpeed = 500, 310 scrollPadding = 50; 311 if( 'undefined' != typeof hootData && 'undefined' != typeof hootData.customScrollerSpeed ) 312 scrollSpeed = hootData.customScrollerSpeed; 313 if( 'undefined' != typeof hootData && 'undefined' != typeof hootData.customScrollerPadding ) 314 scrollPadding = hootData.customScrollerPadding; 315 var target = $(this).attr('href'); 316 var destin = $(target).offset().top - scrollPadding; 317 $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destin}, scrollSpeed ); 318 }); 319 } 320 321});
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.