1// page init 2jQuery(document).ready(function($) { 3 4 5 /***************** AJAX SPINNER ******************/ 6 7 if ($('.spinner').length){ 8 $.fn.spin.presets.espresso = { 9 lines: 11, // The number of lines to draw 10 length: 3, // The length of each line 11 width: 7, // The line thickness 12 radius: 15, // The radius of the inner circle 13 corners: 1, // Corner roundness (0..1) 14 rotate: 0, // The rotation offset 15 direction: 1, // 1: clockwise, -1: counterclockwise 16 color: '#aaa', // #rgb or #rrggbb or array of colors 17 speed: 1, // Rounds per second 18 trail: 60, // Afterglow percentage 19 shadow: false, // Whether to render a shadow 20 hwaccel: false, // Whether to use hardware acceleration 21 className: 'spinner', // The CSS class to assign to the spinner 22 zIndex: 2e9, // The z-index (defaults to 2000000000) 23 top: 'auto', // Top position relative to parent in px 24 left: 'auto' // Left position relative to parent in px 25 } 26 27 $('.spinner').spin('espresso'); 28 } 29 30 31 /***************** REVERSE THE WOOCOMMERCE STARS ******************/ 32 33 setTimeout(function(){ 34 var stars = $('p.stars span'); 35 stars.children().each(function(i,star){stars.prepend(star)}); 36 },100); 37 38 39 /***************** COUNTDOWN ******************/ 40 if($('#event-countdown').length) { 41 42 var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; 43 44 var austDay = new Date(); 45 var date_str = $('#event-countdown .countdown-date').text().replace(',', '').split(' '); 46 47 var month_str = date_str[0]; 48 for(i=0;i<months.length;i++) { 49 if(months[i] == month_str) { 50 var austMonth = i; 51 } 52 } 53 54 var austDate = parseInt(date_str[1]); 55 var austYear = parseInt(date_str[2]); 56 var austHours = parseInt(date_str[3]); 57 var austMinutes = parseInt(date_str[4]); 58 var currentTimezone = $('.hidden-timezone').html(); 59 60 austDay = new Date(austYear, austMonth, austDate, austHours, austMinutes); 61 $('#event-countdown .countdown-date').countdown({until: austDay, timezone: currentTimezone, format: 'dhmS'}); 62 63 } 64 65
66 /***************** AJAX FUNCTIONS ******************/ 67 68 if ($('.ajax-wrapper').length){ 69 $('.ajax-wrapper').each(function(){ 70 var thisContent = this.id; 71 if (thisContent == 'schedule-block'){ 72 var event_category = $('.schedule-category').html(); 73 if (!event_category){ event_category = 0; } 74 $.post( 75 boxy_js_vars.ajax_url, 76 { action:'espresso_schedule_block', 'block':'schedule-block', 'first_day':false, 'category':event_category }, 77 function( newHTML ) { 78 $( '#schedule-block' ).html( newHTML ); 79 } 80 ); 81 } 82 }); 83 } 84 85 if ($('#schedule-block')){ 86 87 var currentlyLoadingSchedule = false; 88 89 $('.fg-schedule-week-change').click(function(e){ 90 91 e.preventDefault(); 92 93 if (!currentlyLoadingSchedule){ 94 95 var event_category = $('.schedule-category').html(); 96 if (!event_category){ event_category = 0; } 97 98 currentlyLoadingSchedule = true; 99 $('#schedule-block').html('<div class="spinner"></div>'); 100 $('.spinner').spin('espresso'); 101 102 var weekToLoad = $(this).attr('data'); 103 104 $.post( 105 boxy_js_vars.ajax_url,
106 { action:'espresso_schedule_block', 'block':'schedule-block', 'first_day':weekToLoad,'category':event_category }, 107 function( newHTML ) { 108 109 $( '#schedule-block' ).html( newHTML ); 110 111 var firstDay = new Date(weekToLoad); 112 var nextWeek = new Date(firstDay.getTime() + 7 * 24 * 60 * 60 * 1000); 113 var lastWeek = new Date(firstDay.getTime() - 7 * 24 * 60 * 60 * 1000); 114 115 lastWeekYear = lastWeek.getFullYear(); 116 lastWeekDay = lastWeek.getDate(); 117 lastWeekMonth = lastWeek.getMonth() + 1; 118 119 nextWeekYear = nextWeek.getFullYear(); 120 nextWeekDay = nextWeek.getDate(); 121 nextWeekMonth = nextWeek.getMonth() + 1; 122 123 $('.fg-schedule-prev-week').attr('data',lastWeekYear+'/'+lastWeekMonth+'/'+lastWeekDay); 124 $('.fg-schedule-next-week').attr('data',nextWeekYear+'/'+nextWeekMonth+'/'+nextWeekDay); 125 currentlyLoadingSchedule = false; 126 } 127 ); 128 129 } 130 131 }) 132 } 133 134 135 136 /***************** PARALLAX SECTIONS ******************/ 137 138 var $window = $(window); 139 var windowHeight = $window.height(); 140 141 $window.resize(function () { 142 windowHeight = $window.height(); 143 }); 144 145 $.fn.parallax = function(xpos, speedFactor, outerHeight) { 146 var $this = $(this); 147 var getHeight; 148 var firstTop; 149 var paddingTop = 0; 150 151 //get the starting position of each element to have parallax applied to it 152 $this.each(function(){ 153 firstTop = $this.offset().top; 154 }); 155 156 $window.resize(function () { 157 $this.each(function(){ 158 firstTop = $this.offset().top; 159 }); 160 }); 161 162 $window.load(function(){ 163 $this.each(function(){ 164 firstTop = $this.offset().top; 165 }); 166 }); 167 168 $window.scroll(function(){ 169 $this.each(function(){ 170 firstTop = $this.offset().top; 171 }); 172 }); 173 174 getHeight = function(jqo) { 175 return jqo.outerHeight(true); 176 }; 177 178 179 // setup defaults if arguments aren't specified 180 if (arguments.length < 1 || xpos === null) xpos = "50%"; 181 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 182 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 183 184 // function to be called whenever the window is scrolled or resized 185 function update(){ 186 var pos = $window.scrollTop(); 187 188 $this.each(function(){ 189 var $element = $(this); 190 var top = $element.offset().top; 191 var height = getHeight($element); 192 // Check if totally above or totally below viewport 193 if (top + height < pos || top > pos + windowHeight) { 194 return; 195 } 196 197 $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); 198 }); 199 } 200 201 $window.bind('scroll', update).resize(update); 202 update(); 203 }; 204 205 if ($('.parallax-zone').length){ 206 $('.parallax-zone').each(function(){ 207 var $id = $(this).attr('id'); 208 $('#'+$id + ".parallax-zone").parallax("50%", 0.4); 209 }); 210 } 211 212 213 $('a.fancybox').fancybox(); 214 215 $('ul#mobileNav').slicknav({ 216 label: '', 217 duration: 400, 218 easingOpen: "easeOutExpo", //available with jQuery UI 219 easingClose: "easeOutExpo", 220 prependTo:'#mobileSlickNav' 221 }); 222 223 $('.tweets-carousel').on('mouseenter', function(){ 224 $('.tweets-carousel').trigger('pause'); 225 }).on('mouseleave', function(){ 226 $('.tweets-carousel').trigger('play'); 227 }); 228 $('#recent-tweets .btn-prev').on('click', function(){ 229 $('.tweets-carousel').trigger('prev', 1); 230 return false; 231 }); 232 $('#recent-tweets .btn-next').on('click', function(){ 233 $('.tweets-carousel').trigger('next', 1); 234 return false; 235 }); 236 237 /***************** SEARCH BUTTON/FIELD ******************/ 238 239 $('.social-search .search').on('click',function(){ 240 $(this).addClass("active"); 241 $(this).parent().find('a.social').hide(); 242 setTimeout(function(){ 243 $(this).find('.social-search form input[type=text]').focus(); 244 },200); 245 }); 246 247 $(document).click(function() { 248 $(".social-search .search").removeClass("active"); 249 setTimeout(function(){ 250 $(".social-search .search").parent().find('a.social').fadeIn(500); 251 },200); 252 }); 253 $(".social-search .search").click(function(e) { 254 e.stopPropagation(); 255 return false; 256 }); 257 $(".social-search .search input[type=submit]").click(function() { 258 $(this).parent().submit(); 259 return false;
260 }); 261 262 $(document).on('focusin', '.field', function() { 263 if(this.title==this.value) { 264 this.value = ''; 265 } 266 }).on('focusout', '.field', function(){ 267 if(this.value=='') { 268 this.value = this.title; 269 } 270 }); 271 272 // Sticky Nav 273 nav = $('nav.full'); 274 headerHeight = $('#header').height(); 275 276 if (nav.length && sticky_nav){ 277 $(window).scroll(function() { 278 279 if($(window).scrollTop() >= headerHeight) { 280 nav.addClass('fixed'); 281 $('body').addClass('sticky-nav'); 282 } else { 283 nav.removeClass('fixed'); 284 $('body').removeClass('sticky-nav'); 285 } 286 287 }); 288 } 289 290 $('.dropdown').animate({opacity:0},0); 291 292 $('nav ul > li').on('mouseenter', function() { 293 if($(this).find('> .dropdown').length) { 294 if($.browser.msie && $.browser.version < 9) { 295 $(this).find('> .dropdown').show().animate({opacity:1},0); 296 } else { 297 $(this).find('> .dropdown').show().stop().animate({opacity:1},150,'easeOutQuad'); 298 } 299 } 300 }).on('mouseleave', function() { 301 if($(this).find('> .dropdown').length) { 302 if($.browser.msie && $.browser.version < 9) { 303 $(this).find('> .dropdown').animate({opacity:0}
303,0,function(){ 304 $(this).hide(); 305 }); 306 } else { 307 $(this).find('> .dropdown').stop().animate({opacity:0},150,'easeInQuad',function(){ 308 $(this).hide(); 309 }); 310 } 311 } 312 }); 313 314 315 316 /***************** FITVIDS ******************/ 317 318 $('.page-content').fitVids(); 319 320 321 322 /***************** GALLERIES ON-RESIZE ******************/ 323 324 if (jQuery('.Collage').length){ 325 var resizeTimer = null; 326 $(window).bind('resize', function() { 327 $('.Collage .Image_Wrapper').css("opacity", 0); 328 if (resizeTimer) clearTimeout(resizeTimer); 329 resizeTimer = setTimeout(initCarousels, 400); 330 }); 331 } 332 333 334 335 /***************** INITIATE SLIDERS ******************/ 336 337 $(window).on('load', function(){ 338 initCarousels(); 339 }); 340 341}); 342 343// cycle scroll galleries init 344function initCarousels() { 345 346 if (jQuery('.tweets-carousel').length){ 347 jQuery('.tweets-carousel').carouFredSel({ 348 auto: false, 349 width: 1440, 350 height: 'variable', 351 responsive: true, 352 items: { 353 visible: 1, 354 width: 1440, 355 }, 356 scroll: { 357 duration: 700, 358 easing: 'easeInOutExpo' 359 }, 360 onCreate: function(){ 361 jQuery('#recent-tweets').css({'padding':'40px 0 45px','max-height':'100%'}); 362 } 363 }); 364 } 365 366 if (jQuery('.Collage').length){ 367 jQuery('.Collage').collageCaption().removeWhitespace().collagePlus({ 368 'targetHeight' : 400, 369 'fadeSpeed' : 2000, 370 'effect' : 'effect-2', 371 'direction' : 'horizontal', 372 'allowPartialLastRow' : false 373 }); 374 jQuery('.Collage a').magnificPopup({ 375 type:'image', 376 mainClass: 'mfp-with-zoom', // this class is for CSS animation below 377 zoom: { 378 enabled: true, // By default it's false, so don't forget to enable it 379 duration: 300, // duration of the effect, in milliseconds 380 easing: 'ease-in-out', // CSS transition easing function 381 opener: function(openerElement) { 382 return openerElement.is('img') ? openerElement : openerElement.find('img'); 383 } 384 }, 385 gallery: { 386 enabled: true, // set to true to enable gallery 387 preload: [0,2], // read about this option in next Lazy-loading section 388 navigateByImgClick: true, 389 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', // markup of an arrow button 390 tPrev: 'Previous (Left arrow key)', // title for left button 391 tNext: 'Next (Right arrow key)', // title for right button 392 tCounter: '<span class="mfp-counter">%curr% of %total%</span>' // markup of counter 393 } 394 }); 395 396 } 397 398}
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.